[Linpha-cvs] SF.net SVN: linpha: [4918] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-04-07 20:36:50
|
Revision: 4918 http://linpha.svn.sourceforge.net/linpha/?rev=4918&view=rev Author: fangehrn Date: 2008-04-07 13:36:31 -0700 (Mon, 07 Apr 2008) Log Message: ----------- 2008-04-07 flo * metadata - fixed admin section * import - do not use output buffering so we see some progress while importing Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/filemanager/module.filemanager.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/ChangeLog 2008-04-07 20:36:31 UTC (rev 4918) @@ -1,4 +1,11 @@ +2008-04-07 flo + * metadata + - fixed admin section + + * import + - do not use output buffering so we see some progress while importing + 2008-04-06 flo * metadata cleanups and improvements Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -25,6 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } +function linImport() +{ /** * try it, it works sometimes */ @@ -274,7 +276,7 @@ { $full_filename = LinSql::getFullImagePath($id); - $MetaData->saveMetaDataToDatabase($meta_value, $full_filename, $md5sum); + $MetaData->saveMetaDataToDatabase($meta_value, LIN_PREFIX."meta_".$meta_value, $full_filename, $md5sum); echo " ".$id.","; flush(); @@ -345,7 +347,7 @@ /** * import */ - if ($linpha->sql->config->value['sys_import_autoimport']) + if ($GLOBALS['linpha']->sql->config->value['sys_import_autoimport']) { LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); } @@ -373,7 +375,7 @@ $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $thumbnail->mode = 'thumb'; @@ -398,7 +400,7 @@ "WHERE parent_id = '0' " . "GROUP BY parent_id"); - foreach($array_meta AS $value) + foreach($array_meta as $value) { if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { @@ -409,4 +411,8 @@ echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total['s'] - $nr_indexed['number_idx']) .' <br />'; } } + +} // end linImport() + +$GLOBALS['linpha']->template->fnCallback = 'linImport'; ?> \ No newline at end of file Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_define.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -28,7 +28,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); +//include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); /** * init @@ -49,9 +49,9 @@ $array_menu = array( 'own' => array('name' => i18n("Own fields"), 'link' => 'metadata_define_own'), 'adddata' => array('name' => i18n("Add select data (set Category names)"), 'link' => 'metadata_define_adddata'), - 'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), - 'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), - 'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') + //'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), + //'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), + //'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') ); LinAdmin::printAdminMenu($array_menu,$cat3); @@ -326,7 +326,7 @@ function show_metadata() { $MetaData = new LinMetaData(); - $MetaData->setMetaFields($GLOBALS['cat3']); + //$MetaData->setMetaFields($GLOBALS['cat3']); /** * get enabled/disabled setting @@ -350,10 +350,10 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'."\n"; - } + //foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'."\n"; + //} ?> </select> <br /> @@ -367,10 +367,10 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'; - } + //foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'; + //} ?> </select> </td> Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_select.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -164,8 +164,9 @@ <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> </td> <td> - EXIF fields (<a href="./?cat=metadata_define_exif">define</a>)<br /> + EXIF fields<br /> <?php + // (<a href="./?cat=metadata_define_exif">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { $str_disabled = ''; } else { @@ -174,11 +175,16 @@ ?> <select id="exif_fields" name="exif_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('exif'); - foreach($MetaData->defined_fields['exif'] AS $key=>$value) + //$MetaData->setMetaFields('exif'); + //foreach($MetaData->defined_fields['exif'] AS $key=>$value) + foreach (LinMetaData::$metaTags['exif'] as $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; } + foreach (LinMetaData::$metaTags['gpsexif'] as $key=>$value) + { + echo '<option value="exif_'.$key.'">'.$value.'</option>'; + } ?> </select> </td> @@ -188,8 +194,9 @@ <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> </td> <td> - IPTC fields (<a href="./?cat=metadata_define_iptc">define</a>)<br /> + IPTC fields<br /> <?php + // (<a href="./?cat=metadata_define_iptc">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { $str_disabled = ''; } else { @@ -198,9 +205,10 @@ ?> <select id="iptc_fields" name="iptc_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('iptc'); - foreach($MetaData->defined_fields['iptc'] AS $key=>$value) - { + //$MetaData->setMetaFields('iptc'); + //foreach($MetaData->defined_fields['iptc'] AS $key=>$value) + foreach (LinMetaData::$metaTags['iptc'] as $key=>$value) + { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } ?> @@ -212,8 +220,9 @@ <input type="button" name="xmp_shiftleft" value="<" onclick="copyElement('xmp_fields')" /> </td> <td> - XMP fields (<a href="./?cat=metadata_define_xmp">define</a>)<br /> + XMP fields<br /> <?php + // (<a href="./?cat=metadata_define_xmp">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { $str_disabled = ''; } else { @@ -222,8 +231,9 @@ ?> <select id="xmp_fields" name="xmp_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('xmp'); - foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + //$MetaData->setMetaFields('xmp'); + //foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + foreach (LinMetaData::$metaTags['xmp'] as $key=>$value) { echo '<option value="xmp_'.$key.'">'.$value.'</option>'; } @@ -245,6 +255,20 @@ </div> </form> + + <?php + echo '<br /><h2 class="linStyle">'.i18n("EXIF").'</h2>'; + echo i18n("EXIF data is usually created by the any Digital Camera. These values will be indexed for searching and displaying them, but can't be edited with LinPHA."); + echo '<br /><br />'; + echo '<h2 class="linStyle">'.i18n("IPTC/XMP").'</h2>'; + echo i18n("IPTC/XMP data is usually not available by default."); + echo i18n("It needs to be filled up either with LinPHA, or with any other external program which allows IPTC/XMP editing like Photoshop. IPTC/XMP is a standard within professional Photographer business."); + echo '<br /><br />'; + + if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { + echo i18n("IPTC disabled due missing dependencies. Exiftool can't be used in your configuration. Please see the LinPHA FAQ for details"); + } + ?> <script type="text/javascript"> /** @@ -290,6 +314,13 @@ * remove new selection on left side */ obj.options[ obj.options.length-1 ].selected = false; + + /** + * increase selection on the right side by one + */ + if (obj_from.selectedIndex < obj_from.length-1) { + obj_from.selectedIndex += 1; + } } function addElement () Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/docs/dev/TODO.txt 2008-04-07 20:36:31 UTC (rev 4918) @@ -7,11 +7,6 @@ - add common interface for thumb order (ORDER by..) to prevent "LinPHA New_images.PHP SQL Injection Vulnerability" etc. -- since the admin pages uses the template system, there is no update of the status during the import - thats not very user friendly - -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() - and just echo it in the template - - escape exif data (see Common Tasks UTF8) - optimize DB querys (index) @@ -84,6 +79,11 @@ DONE ############################################################################ +- since the admin pages uses the template system, there is no update of the status during the import + thats not very user friendly + -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() + and just echo it in the template + - Use Effekts is sometimes hardcoded, make use of config setting sys_style_image_useeffects in all places where used Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -340,40 +340,29 @@ break; case 'exif' : - $value = '(EXIF) '; - if($show_metadata_extra_info) - { - //TODO make exiftool proof in an clean way - if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) - { - $value .= LinExifTool::$metaTags['exif'][$last_part]; - } - else - { - $value .= LinPjmtTool::$metaTags['exif'][$last_part]['name']; - } + $value = LinMetaData::$metaTags['exif'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (EXIF)'; } break; case 'iptc' : - $value = '(IPTC) '; - if($show_metadata_extra_info) - { - $value .= $this->objMetaTool->metaTags['iptc'][$last_part]; + $value = LinMetaData::$metaTags['iptc'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (IPTC)'; } break; case 'xmp' : - $value = '(XMP) '; - if($show_metadata_extra_info) - { - $value = $this->objMetaTool->metaTags['xmp'][$last_part]; + $value = LinMetaData::$metaTags['xmp'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (XMP)'; } break; default: linLog(LOG_TYPE_IMPORT,LOG_ERR,'import_others', - "Error in getNameOfField(); linpha.metadata.class.php"); + "Error in LinMetaData::getNameOfField(): unknown default value: ".$first_part); $value = ""; break; } Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -61,7 +61,7 @@ $exif_data = get_EXIF_JPEG($filename); if (!$exif_data) { - return $metaArray(); + return $metaArray; } /** Modified: trunk/linpha2/lib/plugins/filemanager/module.filemanager.php =================================================================== --- trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -273,8 +273,10 @@ * its not allowed to change the file extension * a user could upload anEvilPhpScriptMaskedAsAnImage.jpg and rename it later * to anEvilPhpScriptMaskedAsAnImage.php + * + * folders are not affected by this limitation */ - if( LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) + if( !is_dir($full_filename) && LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) { throw new Exception(i18n("For security reasons it is not allowed to change the file extension!")); } Modified: trunk/linpha2/templates/default/default.html.php =================================================================== --- trunk/linpha2/templates/default/default.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/default.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -2,7 +2,9 @@ <div id="linDivMain"> <?php -echo $linTpl->output['default']; +if (isset($linTpl->output['default'])) { + echo $linTpl->output['default']; +} $linTpl->callback(); ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/menu.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -146,7 +146,7 @@ echo '["'.linEscapeQuotes($menu[$key.'_img']).'", " ", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; $prevIsIcon = true; } else { - echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; + echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes(linConvertAmp($menuEntry['link'])).'", null, null]'; } } echo ']'; Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-07 20:36:31 UTC (rev 4918) @@ -114,7 +114,7 @@ /*clear: both;*/ /*height: 265px; min height set in DefsThumbView.js */ /*border: 1px solid black;*/ - max-width: 700px; + /*max-width: 700px;*/ } #linDivTabContent { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |