Thread: [Linpha-cvs] SF.net SVN: linpha: [4625] trunk/linpha2 (Page 6)
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-11-08 22:21:24
|
Revision: 4625 http://svn.sourceforge.net/linpha/?rev=4625&view=rev Author: fangehrn Date: 2006-11-08 14:20:32 -0800 (Wed, 08 Nov 2006) Log Message: ----------- 2006-11-08 flo * finished new folder thumbnail - use a gif instead of png - much smaller (about 20kb instead of >100kb) - the transparency works in internet explorer - but we have no shadow i tested also the filesize and time to create the thumbnail: * with -colors 64: 18.32KB 1.1s * with -colors 128: 22.29KB 1.07s * with -colors 256: 27.19KB 3.9s !! * with -colors 512: 27.09KB 4.5s !! * * it seems that the -quality switch doesnt matter with gif images i've choosen 128 colors, i think the quality is enough..?? Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/default/themes/default/css/global.css Added Paths: ----------- trunk/linpha2/lib/graphics/thumb_folder.gif Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/ChangeLog 2006-11-08 22:20:32 UTC (rev 4625) @@ -1,3 +1,19 @@ +2006-11-08 flo + * finished new folder thumbnail + - use a gif instead of png + - much smaller (about 20kb instead of >100kb) + - the transparency works in internet explorer + - but we have no shadow + i tested also the filesize and time to create the thumbnail: + * with -colors 64: 18.32KB 1.1s + * with -colors 128: 22.29KB 1.07s + * with -colors 256: 27.19KB 3.9s !! + * with -colors 512: 27.09KB 4.5s !! + * + * it seems that the -quality switch doesnt matter with gif images + i've choosen 128 colors, i think the quality is enough..?? + + 2006-11-06 flo * fixed some bugs * testing new folder thumbnail Modified: trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -25,9 +25,53 @@ if(!defined('LINPHA_DIR')) { exit(1); } +/* +roundrectangle 1,1 122,92 15,15 +# create the old style folder thumb +convert -size 182x182 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 \ + -quality 70 output_file + +# create a rounded corner folder thumb with shadow +only works with png as output format +but this cause a too high file size (>100KB) +and in IE the png transparency is shown correctly +see also http://www.cit.gu.edu.au/~anthony/graphics/imagick6/thumbnails/ + +convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \ + -background none -fill none -stroke black -strokewidth 3 \ + -draw "roundrectangle 1,1 122,92 15,15" rounded_corner_overlay.png +convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \ + -background none -fill white -stroke black -strokewidth 1 \ + -draw "roundrectangle 1,1 122,92 15,15" rounded_corner_mask.png + + + +# create the rounded corner folder thumb + - open gimp + - create new empty image, 200x200 transparent background + - use Auswahl - Alles, Auswahl - Abgerundetes Rechteck 20% + - fill with black color + - use Auswahl - Verkleinern - 2 pixel + - fill with color #fefaca + - save as gif + + +to composite the four images to the folder image, we could do this with only one command +but there seems to be a bug in imagemagick 6.2.4 (used in ubuntu 6.06 lts, see also http://www.imagemagick.org/pipermail/magick-users/2006-June/017707.html) +so we have to deal with it... + convert -size 100x100 xc:skyblue \ + balloon.gif -geometry 40x40+5+10 -composite \ + medical.gif -geometry +35+30 -composite \ + present.gif -geometry 24x24+62+50 -composite \ + shading.gif -geometry 16x16+10+55 -composite \ + compose_resize.gif +*/ + + + /** - * create new tmp folder + * create new unique tmp folder */ for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; @@ -38,31 +82,43 @@ */ for($i=1; list($key,$value) = each($array_ids) ; $i++) { - LinFilesys::linExec("convert ". LinImage::getCachePath('thumb',$value) . " -quality 70 -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); + LinFilesys::linExec($this->imagemagick_path."convert ". LinImage::getCachePath('thumb',$value) . " -quality 70 -resize 80x80 ".$tmp_folder."/".$i.".jpg" ); } -// LinFilesys::linExec("convert -size 182x182 xc:lemonchiffon -mattecolor peru -frame 9x9+3+3 -quality 70 ".$this->output_file); - + $str = $this->imagemagick_path."convert ".LINPHA_DIR."/lib/graphics/thumb_folder.gif "; + for($i=1; $i<=count($array_ids); $i++ ) { switch($i) { case 1: - //LinFilesys::linExec("composite -compose atop -geometry +15+15 -quality 70 ".$tmp_folder."/1.jpg ".$this->output_file." ".$this->output_file); - LinFilesys::linExec("composite -compose atop -geometry +15+15 -quality 70 ".$tmp_folder."/1.jpg ".LINPHA_DIR."/lib/graphics/thumb_folder.png ".$this->output_file); + $str .= $tmp_folder."/1.jpg -geometry +15+15 -composite "; break; case 2: - LinFilesys::linExec("composite -compose atop -geometry +105+15 -quality 70 ".$tmp_folder."/2.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/2.jpg -geometry +105+15 -composite "; break; case 3: - LinFilesys::linExec("composite -compose atop -geometry +15+105 -quality 70 ".$tmp_folder."/3.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/3.jpg -geometry +15+105 -composite "; break; case 4: - LinFilesys::linExec("composite -compose atop -geometry +105+105 -quality 70 ".$tmp_folder."/4.jpg ".$this->output_file." ".$this->output_file); + $str .= $tmp_folder."/4.jpg -geometry +105+105 -composite "; break; } } + + /** + * filesizes and time: + * with -colors 64: 18.32KB 1.1s + * with -colors 128: 22.29KB 1.07s + * with -colors 256: 27.19KB 3.9s !! + * with -colors 512: 27.09KB 4.5s !! + * + * it seems that the -quality switch doesnt matter with gif images + */ + $str .= "-colors 128 ".$this->output_file; + LinFilesys::linExec( $str ); + /** * delete tmp folder */ Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -145,12 +145,9 @@ if($this->mode == 'thumb') { $this->cached_id = $this->photo_id; - if($this->img_type == 0) - { - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id).'.png'; - } - else - { + if($this->img_type == 0) { // folder are gif files + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id,'.gif'); + } else { $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); } @@ -484,7 +481,7 @@ * @param int $id image id * @return string full path to cached image */ -function getCachePath($what,$id) +function getCachePath($what,$id,$ext='.jpg') { $path = LinSql::getPath('cache'); @@ -497,7 +494,7 @@ $subdir = substr($id,0,2); } - return $path .'/'. $what .'/' .$subdir .'/'.$id .'.jpg'; + return $path .'/'. $what .'/' .$subdir .'/'.$id .$ext; } /** @@ -598,9 +595,9 @@ */ function printFileToScreen() { - if( $this->img_type == 0 ) + if( $this->img_type == 0 ) // folder are gif images, all other are jpg { - header("Content-type: image/png"); + header("Content-type: image/gif"); } else { Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -179,56 +179,35 @@ */ function printMenus($modules,$comingfrom_ajax=false) { - if(strpos($modules,'home') !== false) + $array = explode(',',$modules); + foreach($array AS $value) { - $fragment = 'menu_home'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - if(strpos($modules,'search') !== false) - { - $fragment = 'menu_search'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'login') !== false) - { - $fragment = 'menu_login'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'more') !== false) - { - if( isset( $this->output['menu_More'] ) ) { - $this->printMenu("More"); + switch($value) + { + case 'more': + if( isset( $this->output['menu_More'] ) ) { + $this->printMenu("More"); + } + break; + case 'settings': + if($GLOBALS['linpha']->sql->isLoggedIn()) { + echo '<!-- my settings -->'."\n"; + $this->printMenu("My Settings",LINPHA_LINK."&linCat=settings"); + } + break; + case 'admin': + if($GLOBALS['linpha']->sql->isLoggedIn()) { + echo '<!-- admin links -->'."\n"; + $this->printMenu("Admin",LINPHA_CLIENT."/admin/"); + } + break; + default: // all other, like home, search, login, guestbook, icons, more + $fragment = 'menu_'.$value; + include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); + break; } } - if(strpos($modules,'icons') !== false) - { - $fragment = 'menu_icons'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - } - - - if(strpos($modules,'settings') !== false) - { - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- my settings -->'."\n"; - $this->printMenu("My Settings",LINPHA_LINK."&linCat=settings"); - } - } - - if(strpos($modules,'admin') !== false) - { - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- admin links -->'."\n"; - $this->printMenu("Admin",LINPHA_CLIENT."/admin/"); - } - } - if($comingfrom_ajax && isset($this->output['sys_log']) && !empty($this->output['sys_log'])) { echo '<script language="JavaScript" type="text/javascript">myLinGlobal.linSyslog("'.$this->output['sys_log'].'");</script>'; Added: trunk/linpha2/lib/graphics/thumb_folder.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/graphics/thumb_folder.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/js/LinGlobal.js 2006-11-08 22:20:32 UTC (rev 4625) @@ -75,8 +75,8 @@ { if( t.responseText == 'use_js saved' ) { + myLinGlobal.linSyslog('Ajax enabled'); location.href = document.location; - this.linSyslog('Ajax enabled'); } }, Modified: trunk/linpha2/lib/lang/lang.German.php =================================================================== --- trunk/linpha2/lib/lang/lang.German.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/lib/lang/lang.German.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -61,6 +61,7 @@ "Random images" => "Zufallsbilder", "Browse by Date" => "Nach Datum durchsuchen", "Albums" => "Alben", -"Photos" => "Fotos" +"Photos" => "Fotos", +"You must have cookies enabled to log in." => "Um sich anmelden zu k\xF6nnen, m\xFCssen Cookies aktiviert sein.", ); ?> Modified: trunk/linpha2/templates/default/fragments.php =================================================================== --- trunk/linpha2/templates/default/fragments.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/fragments.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -2,14 +2,16 @@ switch($fragment) { -case 'menu_home': + +case 'menu_home': /* menu item 'home' */ ?> <ul style="margin-left: 50px;"> <li><a href="<?php echo LINPHA_LINK; ?>&linCat=alb"><?php echo i18n("Home"); ?></a></li> </ul> <?php break; -case 'menu_search': + +case 'menu_search': /* menu item 'search' */ ?> <ul> <li><span><?php echo i18n("Search"); ?> </span> @@ -22,7 +24,7 @@ <input type="hidden" name="button[meta][all]" value="1" /> <input type="hidden" name="cmd" value="search" /> <input type="hidden" name="linCat" value="search" /> - <input type="submit" name="submit" value="<?php echo i18n("Search"); ?>" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> </form> </div> </li> @@ -31,7 +33,8 @@ </ul> <?php break; -case 'menu_login': + +case 'menu_login': /* menu item 'login' */ ?> <ul> <li> @@ -50,11 +53,13 @@ <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> <?php } else { ?> <!-- login infos --> + <br /> <label for="formUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="formUsername" /><br /> <label for="formPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="formPassword" /><br /> <?php if($GLOBALS['linpha']->sql->config->value['sys_user_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="formCheckboxRemember" /><label for="formCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> <input type="hidden" name="cmd" value="login" /> - <input type="submit" name="submit" value="<?php echo i18n("Login"); ?>" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> + <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> <?php } ?> </form> @@ -65,7 +70,8 @@ </ul> <?php break; -case 'menu_icons': + +case 'menu_icons': /* menu item 'icons' */ ?> <!-- icons --> <div> @@ -75,6 +81,45 @@ </div> <?php break; + +case 'menu_guestbook': /* menu item 'guestbook' */ +if( false ) +{ +?> + <!-- guestbook --> + <ul> + <li> + <a href="<?php echo LINPHA_LINK.'&linCat=guestbook'; ?>"><?php echo i18n("Guestbook"); ?></a> + </li> + </ul> +<?php +} +break; + +case 'menu_empty1': /* menu item 'emtpy1' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + +case 'menu_empty2': /* menu item 'empty2' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + + +/** + * the slideshow controls + */ case 'slideshow': ?> <div id="linDivSlideshowControls"> Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/global.html.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -33,7 +33,7 @@ <!-- menu --> <div id="linDivMenu"> - <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin'); ?> + <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin,guestbook'); ?> </div> <div style="clear: both;"></div> Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2006-11-08 22:20:32 UTC (rev 4625) @@ -65,6 +65,6 @@ #linDivMenu ul a:hover, #linDivMenu ul span:hover { background: #bbbbbb; } - #linDivMenu ul ul { + #linDivMenu ul ul, .linInputMenu { background-color: #eeeeee; } Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-06 22:52:41 UTC (rev 4624) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-08 22:20:32 UTC (rev 4625) @@ -183,7 +183,7 @@ padding: 0; float: left; } - + /** * first level elements */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-10 06:41:01
|
Revision: 4630 http://svn.sourceforge.net/linpha/?rev=4630&view=rev Author: fangehrn Date: 2006-11-09 14:22:06 -0800 (Thu, 09 Nov 2006) Log Message: ----------- 2006-11-09 flo * added a maintenance part in the admin pages * added a db maintenance script - currently only detections implemented Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php Added Paths: ----------- trunk/linpha2/admin/maintenance.php trunk/linpha2/admin/maintenance_db.php trunk/linpha2/admin/maintenance_import.php Removed Paths: ------------- trunk/linpha2/admin/import.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/ChangeLog 2006-11-09 22:22:06 UTC (rev 4630) @@ -1,3 +1,8 @@ +2006-11-09 flo + * added a maintenance part in the admin pages + * added a db maintenance script + - currently only detections implemented + 2006-11-08 flo * finished new folder thumbnail - use a gif instead of png Deleted: trunk/linpha2/admin/import.php =================================================================== --- trunk/linpha2/admin/import.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/admin/import.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -1,426 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* Florian Angehrn -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * This file updates the database - * @package Import - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * try it, it works sometimes - */ -ini_set("max_execution_time", "6000"); - - -$array_meta = Array('exif','iptc','xmp'); - -if( isset($_POST['cmd']) && $_POST['cmd']=='import') -{ - echo '<h1 class="linStyle">'.i18n("Running Import...").'</h1>'; - - if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') - { - $all_albums = true; - } - else - { - $all_albums = false; - } - - - /** - * import - */ - if($_REQUEST['index_import']=='index') - { - echo '<h2 class="linStyle">'.i18n("Directory Import").'</h2>'; - if($all_albums) - { - echo i18n("Parsing All Directories...").'<br />'; - LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = false ); - } - else - { - foreach($_REQUEST['album_select'] AS $key=>$value) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); - echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; - LinImport::updateDir( $parent_id = $value, $recursive = true, $dryrun = false ); - } - } - - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) - { - echo $GLOBALS['linpha']->template->output['sys_log']; - unset($GLOBALS['linpha']->template->output['sys_log']); - } - - echo '<br />'; - } - - /** - * thumbnails - */ - /** - * @todo should we create the folder thumbnails here? - * they will be automatically created on each visit - * we would have to take care to the script backwards, - * that means first of the depest subfolder until we're on top - */ - if($_REQUEST['index_thumbnails']!='no' OR isset($_REQUEST['index_thumbnails_delete'])) - { - echo '<h2 class="linStyle">'.i18n("Thumbnails").'</h2>'; - - $thumbnail = new LinImage(); - - if($_REQUEST['index_thumbnails']=='recreate') - { - $_GET['force'] = true; - } - - /** - * all albums selected - */ - if($all_albums) - { - /** - * delete thumbnails - */ - if( isset($_REQUEST['index_thumbnails_delete']) ) - { - echo i18n("Delete All Existing Thumbnails...").'<br />'; - $thumbcachepath = LinSql::getPath('cache').'/thumb'; - LinFilesys::rm_rf( $thumbcachepath ); // all subfolders will automatically be recreated on each image access - if(file_exists($thumbcachepath)) - { - echo i18n("Warning while deleting file/folder, check permissions!").'<br />'; - } - else - { - mkdir( $thumbcachepath ); - } - } - - /** - * set query string for create/recreate thumbnails - */ - if($_REQUEST['index_thumbnails']!='no') - { - echo '<h3>'.i18n("Parsing All Directories...").'</h3><br />'; - $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - } - } - else // $all_albums == false -> not all directory selected - { - /** - * go through each selected directory - */ - foreach($_REQUEST['album_select'] AS $key=>$value) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); - echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; - - $sql = "SELECT id FROM ".PREFIX."photos WHERE " . - "parent_id = '".LinSql::linAddslashes($value)."' AND " . - "img_type <> 0 AND img_type <> 9999999"; - - /** - * delete thumbnails - */ - if( isset($_REQUEST['index_thumbnails_delete']) ) - { - echo i18n("Delete Thumbnails"); - $query = $GLOBALS['linpha']->db->Execute($sql); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) - { - if( LinImage::deleteCachedThumbnail($data[0]) ) - { - echo " ".$data[0].","; - } - } - echo '<br />'; - } - - /** - * set query string for create/recreate thumbnails - */ - if($_REQUEST['index_thumbnails']!='no') - { - $createthumbquery = $GLOBALS['linpha']->db->Execute($sql); - } - } - } - - /** - * now create thumbnails, $query has been set previously - */ - if($_REQUEST['index_thumbnails']!='no') - { - echo i18n("Create Thumbnail"); - while($data = $createthumbquery->FetchRow(ADODB_FETCH_NUM)) - { - if( ! $thumbnail->createThumbnail($data[0]) ) - { - echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; - } - if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! - { - echo " ".$data[0].","; - } - flush(); - } - echo '<br />'; - } - - echo '<br />'; - } - - - /** - * exif, iptc, xmp - * - * if "Delete First" and "All albums" was selected, the whole table will be deleted - */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - - foreach($array_meta AS $meta_value) - { - if( isset( $_REQUEST['index_'.$meta_value] ) && - ( $_REQUEST['index_'.$meta_value] == 'index' OR isset($_REQUEST['index_'.$meta_value.'_delete']) ) ) - { - echo '<h2 class="linStyle">'.i18n("File Indexing").' ('.strtoupper($meta_value).')</h2>'; - - /** - * get imgids to indexing, if reindex is selected: delete these entries first - */ - if($all_albums) - { - echo i18n("All Directories selected").'<br />'; - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) - { - $array_meta_ids[$data['id']] = $data['md5sum']; - } - } - else - { - echo i18n("Directory selected:").' '; - foreach($_REQUEST['album_select'] AS $key=>$value) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); - echo $data['name'].', '; - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE " . - "parent_id = '".LinSql::linAddslashes($value)."' AND " . - "img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) - { - $array_meta_ids[$data['id']] = $data['md5sum']; - } - } - echo '<br />'; - } - - /** - * delete first (if selected) - */ - if( isset($_REQUEST['index_'.$meta_value.'_delete']) ) - { - if( $all_albums ) - { - echo i18n("Delete all index data").'<br />'; - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value); - } - elseif( isset($array_meta_ids) ) - { - echo i18n("Delete index data of selected directories").'<br />'; - foreach($array_meta_ids AS $id=>$md5sum) - { - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); - } - } - } - - /** - * index image, parse all saved ids - */ - if( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) - { - $MetaData->setFields($meta_value); - - echo i18n("Index Image"); - - foreach($array_meta_ids AS $id=>$md5sum) - { - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - - if( $query->EOF) // not a single value returned - { - $full_filename = LinSql::getFullImagePath($id); - - switch($meta_value) - { - case 'exif': - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment - include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData( $full_filename,$md5sum ); - break; - case 'iptc': - include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData( $full_filename,$md5sum ); - break; - case 'xmp': - break; - } - - echo " ".$id.","; - flush(); - } - } - - } - - echo '<br /><br />'; - } - unset($array_meta_ids); - } -} - - -echo '<h1 class="linStyle">'.i18n("Import").'</h1>'; -echo i18n("Select Folders For Import/Update:"); -?> -<br /> -<form action="./?cat=import" method="POST"> -<select name="album_select[]" size="10" multiple="multiple" style="width: 500px;"> -<?php linBuildAlbumSelect($with_all_albs_entry=true); ?> -</select> -<br /><br /> - -<?php echo i18n("Import").':'; ?> -<br /> - -<input type="checkbox" id="index_import_detect_filechanges" name="force_update" value="true" /><label for="index_import_detect_filechanges"> <?php echo i18n("Detect File Changes"); ?></label><br /> -<input type="radio" id="index_import_no" name="index_import" value="no" /><label for="index_import_no"> <?php echo i18n("No Import"); ?></label><br /> -<input type="radio" id="index_import_index" name="index_import" value="index" checked="checked" /><label for="index_import_index"> <?php echo i18n("Import"); ?></label><br /> -<br /> - -<?php echo i18n("Thumbnails").':'; ?> -<br /> -<input type="checkbox" id="index_thumbnails_deletefirst" name="index_thumbnails_delete" value="delete" /><label for="index_thumbnails_deletefirst"> <?php echo i18n("Delete First"); ?></label><br /> -<input type="radio" id="index_thumbnails_no" name="index_thumbnails" value="no" /><label for="index_thumbnails_no"> <?php echo i18n("No Create"); ?></label><br /> -<input type="radio" id="index_thumbnails_index" name="index_thumbnails" value="create" checked="checked" /><label for="index_thumbnails_index"> <?php echo i18n("Create"); ?></label><br /> -<input type="radio" id="index_thumbnails_reindex" name="index_thumbnails" value="recreate" /><label for="index_thumbnails_reindex"> <?php echo i18n("Re-create"); ?></label><br /> -<br /> - -<?php -foreach($array_meta AS $value) -{ - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) - { - echo strtoupper($value).":<br />"; - echo '<input type="checkbox" id="index_'.$value.'_deletefirst" name="index_'.$value.'_delete" value="delete" /><label for="index_'.$value.'_deletefirst"> '.i18n("Delete First").'</label><br />'; - echo '<input type="radio" id="index_'.$value.'_no" name="index_'.$value.'" value="no" /><label for="index_'.$value.'_no"> '.i18n("No indexing").'</label><br />'; - echo '<input type="radio" id="index_'.$value.'_index" name="index_'.$value.'" value="index" checked="checked" /><label for="index_'.$value.'_index"> '.i18n("Indexing").'</label><br />'; - echo '<br />'; - } -} - -?> -<input type="hidden" name="cmd" value="import"> -<input type="submit" name="submit" value="<?php echo i18n("Start"); ?>" /> -</form> -<br /><br /> -<?php - - -/** - * dry-run - */ -echo '<h2 class="linStyle">'.i18n("Stuff Not Up-To-Date").'</h2>'; - -/** - * import - */ - if($linpha->sql->config->value['sys_import_autoimport']) - { - LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); - } - - /** - * flush buffer - */ - echo '<b>'.i18n("Following files/folders needs updating:").'</b><br />'; - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) - { - echo $GLOBALS['linpha']->template->output['sys_log']; - unset($GLOBALS['linpha']->template->output['sys_log']); - } - else - { - echo i18n("Nothing, we're up-to-date!").'<br />'; - } - - echo '<br />'; - -/** - * thumbnails - */ - $thumbnail = new LinImage(); - - $num = 0; - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) - { - - $thumbnail->mode = 'thumb'; - $thumbnail->photo_id = $data[0]; - - $thumbnail->setFileInformation(); - - if( ! $thumbnail->isCached ) - { - $num++; - } - } - echo '<b>'.i18n("Nr Thumbnails To Create:").' '.$num.'<br />'; - -/** - * exif, iptc, xmp - * - * nr images to index: (nr_total - nr_indexed) - */ - $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); - foreach($array_meta AS $value) - { - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) - { - $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".PREFIX."meta_".$value); - - echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total[0] - $nr_indexed[0]) .' <br />'; - } - } -?> \ No newline at end of file Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/admin/index.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -78,7 +78,7 @@ //'linpha_home' => Array('name' => 'Linpha Home', 'link' => 'linpha_home'), 'settings' => Array('name' => 'Settings', 'link' => 'settings'), 'permissions' => Array('name' => 'Permissions', 'link' => 'permissions'), - 'import' => Array('name' => 'Import', 'link' => 'import'), + 'maintenance' => Array('name' => 'Maintenance', 'link' => 'maintenance'), 'imagefields' => Array('name' => 'Image fields', 'link' => 'imagefields'), ); @@ -92,8 +92,8 @@ case 'permissions': include_once('./permissions.php'); break; -case 'import': - include_once('./import.php'); +case 'maintenance': + include_once('./maintenance.php'); break; case 'imagefields': include_once('./image_fields.php'); Added: trunk/linpha2/admin/maintenance.php =================================================================== --- trunk/linpha2/admin/maintenance.php (rev 0) +++ trunk/linpha2/admin/maintenance.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -0,0 +1,25 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'import'; +} + +$array_menu = Array( + 'import' => Array('name' => 'Import', 'link' => 'maintenance_import'), + 'db' => Array('name' => 'Database', 'link' => 'maintenance_db'), +); + +LinAdmin::printAdminMenu($array_menu,$cat2); + +switch($cat2) +{ + case 'import': + include_once(LINPHA_DIR.'/admin/maintenance_import.php'); + break; + case 'db': + include_once(LINPHA_DIR.'/admin/maintenance_db.php'); + break; +} +?> Added: trunk/linpha2/admin/maintenance_db.php =================================================================== --- trunk/linpha2/admin/maintenance_db.php (rev 0) +++ trunk/linpha2/admin/maintenance_db.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -0,0 +1,307 @@ +<?php + +/** + * check if each photo has a parent element + */ + echo '<h2>'.i18n("Checking photos table").'</h2>'; + echo '('.i18n("Checking intern consistency of the photos table. This means every entry must belong to a folder.").')<br /><br />'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, parent_id, name FROM ".PREFIX."photos"); + $i = 0; + $i_tot = 0; + while($data = $query->FetchRow()) + { + if($data['parent_id'] != 0) + { + $query2 = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($data['parent_id'])."'"); + $data2 = $query2->FetchRow(); + if( isset($data2['id'])) + { + $i++; + } + else + { + echo i18n("Warning: This entry doesn't belongs to a folder:").' '.$data['name'].'<br />'; + + /** + * @todo there should be an option where we could really delete any obsolete entries + */ + echo i18n("Should delete it").'<br />'; + } + } + else + { + $i++; + } + + $i_tot++; + } + echo sprintf(i18n("%d of %d entries are <font color='green'>ok</font>."),$i,$i_tot).'<br />'; + +/** + * check cached photos exists in filesystem and vice versa + */ + echo '<br /><h2>'.i18n("Checking image cache").'</h2>'; + + echo '<h3>'.i18n("Do all cache entries exists in the photos table?").'</h3>'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT ".PREFIX."photos_cache.id, ".PREFIX."photos_cache.photo_id" . + " FROM ".PREFIX."photos_cache". + " LEFT OUTER JOIN ".PREFIX."photos ON ".PREFIX."photos.id = ".PREFIX."photos_cache.photo_id". + " WHERE ".PREFIX."photos.id IS NULL"); + + if( $query->EOF ) + { + echo '<font color="green">ok</font> '.i18n("There is no broken association.").'<br />'; + } + else + { + echo '<font color="red">failed</font><br />'; + while($data = $query->FetchRow() ) + { + echo i18n("Missing entry of:").' '.$data['photo_id'].' ('.i18n("Cache Id").': '.$data['id'].')<br />'; + } + echo '<br />'; + } + + + echo '<h3>'.i18n("Do all cache entries exists in the filesystem?").'</h3>'; + $query = $GLOBALS['linpha']->db->Execute("SELECT id, photo_id FROM ".PREFIX."photos_cache"); + $i = 0; + $i_tot = 0; + while($data = $query->FetchRow() ) + { + $filename = LinImage::getCachePath('img',$data['id'],'jpg'); + if( !file_exists($filename)) + { + echo i18n("Cached file doesn't exists:").' '.$filename.' ('.i18n("Photo Nr").': '.$data['photo_id'].')<br />'; + + /** + * @todo there should be an option where we could really delete any obsolete entries + */ + echo i18n("Should delete it").'<br />'; + } + else + { + if(filesize($filename) == 0) + { + echo i18n("Filesize is zero of:").' '.$filename.' ('.i18n("Photo Nr").': '.$data['photo_id'].')<br />'; + } + else + { + $i++; + } + } + + $i_tot++; + } + echo sprintf(i18n("%d of %d entries are <font color='green'>ok</font>."),$i,$i_tot).'<br />'; + + + echo '<br /><h3>'.i18n("Are there obsolete cached images lying around?").'</h3>'; + $path = LinSql::getPath('cache'); + $i = 0; + $i_tot = 0; + $sub_dir_handle = opendir($path.'/img'); + while( ($sub_dir = readdir($sub_dir_handle)) !== false ) + { + if($sub_dir != "." && $sub_dir != "..") + { + $sub_file_handle = opendir($path.'/img/'.$sub_dir); + while( ($sub_file = readdir($sub_file_handle)) !== false ) + { + if($sub_file != "." && $sub_file != "..") + { + $filename_without_ext = LinFilesys::getFilenameWithoutFileExt($sub_file); + + /** + * need this pre check because mysql returns a result even if id is '107.' + * testquery: "SELECT * FROM linpha_photos WHERE id = '107.'" + */ + if(! preg_match('/^[0-9]*$/', $filename_without_ext)) + { + echo i18n("Obsolete cached file:").' '.$path.'/img/'.$sub_dir.'/'.$sub_file.'<br />'; + } + else + { + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos_cache WHERE " . + "id = '".LinSql::linAddslashes( LinFilesys::getFilenameWithoutFileExt($sub_file) )."'"); + $data = $query->FetchRow(); + + if( isset($data['id'])) + { + $i++; + } + else + { + echo i18n("Obsolete cached file:").' '.$path.'/img/'.$sub_dir.'/'.$sub_file.'<br />'; + } + } + + $i_tot++; + } + } + + closedir($sub_file_handle); + } + } + closedir($sub_dir_handle); + echo sprintf(i18n("%d of %d entries are <font color='green'>ok</font>."),$i,$i_tot).'<br />'; + + + echo '<br /><h3>'.i18n("Are there obsolete cached thumbnails lying around?").'</h3>'; + $path = LinSql::getPath('cache'); + $i = 0; + $i_tot = 0; + $sub_dir_handle = opendir($path.'/thumb'); + while( ($sub_dir = readdir($sub_dir_handle)) !== false ) + { + if($sub_dir != "." && $sub_dir != "..") + { + $sub_file_handle = opendir($path.'/thumb/'.$sub_dir); + while( ($sub_file = readdir($sub_file_handle)) !== false ) + { + if($sub_file != "." && $sub_file != "..") + { + $filename_without_ext = LinFilesys::getFilenameWithoutFileExt($sub_file); + + /** + * need this pre check because mysql returns a result even if id is '107.' + * testquery: "SELECT * FROM linpha_photos WHERE id = '107.'" + */ + if(! preg_match('/^[0-9]*$/', $filename_without_ext)) + { + echo i18n("Obsolete cached file:").' '.$path.'/img/'.$sub_dir.'/'.$sub_file.'<br />'; + } + else + { + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."photos WHERE " . + "id = '".LinSql::linAddslashes( $filename_without_ext )."'"); + $data = $query->FetchRow(); + + if( isset($data['name'])) + { + $i++; + } + else + { + echo i18n("Obsolete cached file:").' '.$path.'/img/'.$sub_dir.'/'.$sub_file.'<br />'; + } + } + + $i_tot++; + } + } + + closedir($sub_file_handle); + } + } + closedir($sub_dir_handle); + echo sprintf(i18n("%d of %d entries are <font color='green'>ok</font>."),$i,$i_tot).'<br />'; + +/** + * check comment/exif/iptc/xmp to photo association + */ + echo '<br /><h2>'.i18n("Checking meta data").'</h2>'; + $array_meta = array('comments','data','exif','iptc'/*,'xmp'*/); + foreach($array_meta AS $value) + { + echo i18n("Checking table").' '.PREFIX."meta_".$value.' '; + $query = $GLOBALS['linpha']->db->Execute("SELECT ".PREFIX."meta_".$value.".md5sum FROM ".PREFIX."meta_".$value. + " LEFT OUTER JOIN ".PREFIX."photos ON ".PREFIX."photos.md5sum = ".PREFIX."meta_".$value.".md5sum". + " WHERE ".PREFIX."photos.id IS NULL"); + + if( $query->EOF ) + { + echo '<font color="green">ok</font>'.'<br />'; + } + else + { + echo '<font color="red">failed</font><br />'; + while($data = $query->FetchRow() ) + { + echo i18n("Missing entry with md5sum:").' '.$data['md5sum'].'<br />'; + } + echo '<br />'; + } + } + + +/** + * check permission entries + */ + $array_perms = array( + 'read', + 'write', + 'basket_print', + 'basket_mail', + 'basket_download', + 'metadata_comments', + 'metadata_deletecomments', + 'metadata_edit', + 'watermark', + 'stats', + 'download', + ); + + echo '<br /><h2>'.i18n("Checking permission entries").'</h2>'; + + foreach($array_perms AS $value) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT permission FROM ".PREFIX."permissions " . + "WHERE photos_id = '0' AND perm_type = '".$value."'"); + $data = $query->FetchRow(); + + echo i18n("Checking").' "'.$value.'" '; + if( isset($data['permission']) ) + { + echo '<font color="green">'.i18n("ok").'</font>'; + } + else + { + echo '<font color="red">'.i18n("failed").'</font><br />'; + echo i18n("Please check the database, these entry is missing!").'<br />'; + } + echo '<br />'; + } + +/** + * checking config entries + */ + echo '<br /><h2>'.i18n("Checking config entries").'</h2>'; + + /** + * prevent some php notices + */ + $options = array(); + $_SESSION['sys_im_bracket_support'] = ''; + $_SESSION['sys_im_use_convert'] = ''; + $_SESSION['sys_im_convert_path'] = ''; + $_SESSION['language'] = ''; + $_SESSION['album_dir'] = ''; + $_SESSION['cache_dir'] = ''; + $_SESSION['tmp_dir'] = ''; + + include(LINPHA_DIR.'/install/sql/sql.data.php'); + foreach($options AS $key=>$value) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."config " . + "WHERE option_name = '".$key."'"); + $data = $query->FetchRow(); + + echo i18n("Checking").' "'.$key.'" '; + if( isset($data['id']) ) + { + echo '<font color="green">'.i18n("ok").'</font>'; + } + else + { + echo '<font color="red">'.i18n("failed").'</font><br />'; + echo i18n("Please check the database, these entry is missing!").'<br />'; + } + echo '<br />'; + } + + +?> \ No newline at end of file Copied: trunk/linpha2/admin/maintenance_import.php (from rev 4623, trunk/linpha2/admin/import.php) =================================================================== --- trunk/linpha2/admin/maintenance_import.php (rev 0) +++ trunk/linpha2/admin/maintenance_import.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -0,0 +1,426 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This file updates the database + * @package Import + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * try it, it works sometimes + */ +ini_set("max_execution_time", "6000"); + + +$array_meta = Array('exif','iptc','xmp'); + +if( isset($_POST['cmd']) && $_POST['cmd']=='import') +{ + echo '<h1 class="linStyle">'.i18n("Running Import...").'</h1>'; + + if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') + { + $all_albums = true; + } + else + { + $all_albums = false; + } + + + /** + * import + */ + if($_REQUEST['index_import']=='index') + { + echo '<h2 class="linStyle">'.i18n("Directory Import").'</h2>'; + if($all_albums) + { + echo i18n("Parsing All Directories...").'<br />'; + LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = false ); + } + else + { + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; + LinImport::updateDir( $parent_id = $value, $recursive = true, $dryrun = false ); + } + } + + if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + { + echo $GLOBALS['linpha']->template->output['sys_log']; + unset($GLOBALS['linpha']->template->output['sys_log']); + } + + echo '<br />'; + } + + /** + * thumbnails + */ + /** + * @todo should we create the folder thumbnails here? + * they will be automatically created on each visit + * we would have to take care to the script backwards, + * that means first of the depest subfolder until we're on top + */ + if($_REQUEST['index_thumbnails']!='no' OR isset($_REQUEST['index_thumbnails_delete'])) + { + echo '<h2 class="linStyle">'.i18n("Thumbnails").'</h2>'; + + $thumbnail = new LinImage(); + + if($_REQUEST['index_thumbnails']=='recreate') + { + $_GET['force'] = true; + } + + /** + * all albums selected + */ + if($all_albums) + { + /** + * delete thumbnails + */ + if( isset($_REQUEST['index_thumbnails_delete']) ) + { + echo i18n("Delete All Existing Thumbnails...").'<br />'; + $thumbcachepath = LinSql::getPath('cache').'/thumb'; + LinFilesys::rm_rf( $thumbcachepath ); // all subfolders will automatically be recreated on each image access + if(file_exists($thumbcachepath)) + { + echo i18n("Warning while deleting file/folder, check permissions!").'<br />'; + } + else + { + mkdir( $thumbcachepath ); + } + } + + /** + * set query string for create/recreate thumbnails + */ + if($_REQUEST['index_thumbnails']!='no') + { + echo '<h3>'.i18n("Parsing All Directories...").'</h3><br />'; + $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + } + } + else // $all_albums == false -> not all directory selected + { + /** + * go through each selected directory + */ + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; + + $sql = "SELECT id FROM ".PREFIX."photos WHERE " . + "parent_id = '".LinSql::linAddslashes($value)."' AND " . + "img_type <> 0 AND img_type <> 9999999"; + + /** + * delete thumbnails + */ + if( isset($_REQUEST['index_thumbnails_delete']) ) + { + echo i18n("Delete Thumbnails"); + $query = $GLOBALS['linpha']->db->Execute($sql); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + if( LinImage::deleteCachedThumbnail($data[0]) ) + { + echo " ".$data[0].","; + } + } + echo '<br />'; + } + + /** + * set query string for create/recreate thumbnails + */ + if($_REQUEST['index_thumbnails']!='no') + { + $createthumbquery = $GLOBALS['linpha']->db->Execute($sql); + } + } + } + + /** + * now create thumbnails, $query has been set previously + */ + if($_REQUEST['index_thumbnails']!='no') + { + echo i18n("Create Thumbnail"); + while($data = $createthumbquery->FetchRow(ADODB_FETCH_NUM)) + { + if( ! $thumbnail->createThumbnail($data[0]) ) + { + echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; + } + if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! + { + echo " ".$data[0].","; + } + flush(); + } + echo '<br />'; + } + + echo '<br />'; + } + + + /** + * exif, iptc, xmp + * + * if "Delete First" and "All albums" was selected, the whole table will be deleted + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + + foreach($array_meta AS $meta_value) + { + if( isset( $_REQUEST['index_'.$meta_value] ) && + ( $_REQUEST['index_'.$meta_value] == 'index' OR isset($_REQUEST['index_'.$meta_value.'_delete']) ) ) + { + echo '<h2 class="linStyle">'.i18n("File Indexing").' ('.strtoupper($meta_value).')</h2>'; + + /** + * get imgids to indexing, if reindex is selected: delete these entries first + */ + if($all_albums) + { + echo i18n("All Directories selected").'<br />'; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow()) + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + } + else + { + echo i18n("Directory selected:").' '; + foreach($_REQUEST['album_select'] AS $key=>$value) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + echo $data['name'].', '; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE " . + "parent_id = '".LinSql::linAddslashes($value)."' AND " . + "img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + $array_meta_ids[$data['id']] = $data['md5sum']; + } + } + echo '<br />'; + } + + /** + * delete first (if selected) + */ + if( isset($_REQUEST['index_'.$meta_value.'_delete']) ) + { + if( $all_albums ) + { + echo i18n("Delete all index data").'<br />'; + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value); + } + elseif( isset($array_meta_ids) ) + { + echo i18n("Delete index data of selected directories").'<br />'; + foreach($array_meta_ids AS $id=>$md5sum) + { + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); + } + } + } + + /** + * index image, parse all saved ids + */ + if( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) + { + $MetaData->setFields($meta_value); + + echo i18n("Index Image"); + + foreach($array_meta_ids AS $id=>$md5sum) + { + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". + "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); + + if( $query->EOF) // not a single value returned + { + $full_filename = LinSql::getFullImagePath($id); + + switch($meta_value) + { + case 'exif': + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment + include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); + $MetaData->saveExifData( $full_filename,$md5sum ); + break; + case 'iptc': + include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); + $MetaData->saveIptcData( $full_filename,$md5sum ); + break; + case 'xmp': + break; + } + + echo " ".$id.","; + flush(); + } + } + + } + + echo '<br /><br />'; + } + unset($array_meta_ids); + } +} + + +echo '<h1 class="linStyle">'.i18n("Import").'</h1>'; +echo i18n("Select Folders For Import/Update:"); +?> +<br /> +<form action="./?cat=import" method="POST"> +<select name="album_select[]" size="10" multiple="multiple" style="width: 500px;"> +<?php linBuildAlbumSelect($with_all_albs_entry=true); ?> +</select> +<br /><br /> + +<?php echo i18n("Import").':'; ?> +<br /> + +<input type="checkbox" id="index_import_detect_filechanges" name="force_update" value="true" /><label for="index_import_detect_filechanges"> <?php echo i18n("Detect File Changes"); ?></label><br /> +<input type="radio" id="index_import_no" name="index_import" value="no" /><label for="index_import_no"> <?php echo i18n("No Import"); ?></label><br /> +<input type="radio" id="index_import_index" name="index_import" value="index" checked="checked" /><label for="index_import_index"> <?php echo i18n("Import"); ?></label><br /> +<br /> + +<?php echo i18n("Thumbnails").':'; ?> +<br /> +<input type="checkbox" id="index_thumbnails_deletefirst" name="index_thumbnails_delete" value="delete" /><label for="index_thumbnails_deletefirst"> <?php echo i18n("Delete First"); ?></label><br /> +<input type="radio" id="index_thumbnails_no" name="index_thumbnails" value="no" /><label for="index_thumbnails_no"> <?php echo i18n("No Create"); ?></label><br /> +<input type="radio" id="index_thumbnails_index" name="index_thumbnails" value="create" checked="checked" /><label for="index_thumbnails_index"> <?php echo i18n("Create"); ?></label><br /> +<input type="radio" id="index_thumbnails_reindex" name="index_thumbnails" value="recreate" /><label for="index_thumbnails_reindex"> <?php echo i18n("Re-create"); ?></label><br /> +<br /> + +<?php +foreach($array_meta AS $value) +{ + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + echo strtoupper($value).":<br />"; + echo '<input type="checkbox" id="index_'.$value.'_deletefirst" name="index_'.$value.'_delete" value="delete" /><label for="index_'.$value.'_deletefirst"> '.i18n("Delete First").'</label><br />'; + echo '<input type="radio" id="index_'.$value.'_no" name="index_'.$value.'" value="no" /><label for="index_'.$value.'_no"> '.i18n("No indexing").'</label><br />'; + echo '<input type="radio" id="index_'.$value.'_index" name="index_'.$value.'" value="index" checked="checked" /><label for="index_'.$value.'_index"> '.i18n("Indexing").'</label><br />'; + echo '<br />'; + } +} + +?> +<input type="hidden" name="cmd" value="import"> +<input type="submit" name="submit" value="<?php echo i18n("Start"); ?>" /> +</form> +<br /><br /> +<?php + + +/** + * dry-run + */ +echo '<h2 class="linStyle">'.i18n("Stuff Not Up-To-Date").'</h2>'; + +/** + * import + */ + if($linpha->sql->config->value['sys_import_autoimport']) + { + LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); + } + + /** + * flush buffer + */ + echo '<b>'.i18n("Following files/folders needs updating:").'</b><br />'; + if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + { + echo $GLOBALS['linpha']->template->output['sys_log']; + unset($GLOBALS['linpha']->template->output['sys_log']); + } + else + { + echo i18n("Nothing, we're up-to-date!").'<br />'; + } + + echo '<br />'; + +/** + * thumbnails + */ + $thumbnail = new LinImage(); + + $num = 0; + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + + $thumbnail->mode = 'thumb'; + $thumbnail->photo_id = $data[0]; + + $thumbnail->setFileInformation(); + + if( ! $thumbnail->isCached ) + { + $num++; + } + } + echo '<b>'.i18n("Nr Thumbnails To Create:").' '.$num.'<br />'; + +/** + * exif, iptc, xmp + * + * nr images to index: (nr_total - nr_indexed) + */ + $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); + foreach($array_meta AS $value) + { + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".PREFIX."meta_".$value); + + echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total[0] - $nr_indexed[0]) .' <br />'; + } + } +?> \ No newline at end of file Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/docs/dev/TODO.txt 2006-11-09 22:22:06 UTC (rev 4630) @@ -12,7 +12,10 @@ - Installer - define final installer behaviour - - if installation is complete, the user must delete the install/ folder ? (install/ignore_delete_install_msg.txt) + - if installation is complete, the user must delete the install/ folder ? + (install/ignore_delete_install_msg.txt) + -> we need to move the sql scripts to the /lib folder because we need them + in the admin - maintenance - db part - user have to delete var/sql/config.sql.php before another installation can continue ? -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - DONT add feature to drop tables if they already exists Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -238,6 +238,26 @@ } /** + * gets the filename withouth the file extension (index.html > index) + * + * @author flo + * @param string $filename + * @return string filename without file extension + * @package filesys + * @uses admin/maintenance_db.php + */ +function getFilenameWithoutFileExt($filename) +{ + if(substr_count($filename,'.') == 0) { + return $filename; // no point found, -> is already filename without the extension + } + $pos = strrpos( $filename, '.' ); // find last point + $filename = substr( $filename, 0, $pos ); // extract filename + + return $filename; +} + +/** * This function formats the filesize (byte) value to kB/MB/GB */ function niceFilesize($filesize, $precision) Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -330,8 +330,6 @@ /** * explode string to array and remove first and last entry of array because they are empty - * - * should be moved to "others" */ function linExplodeAndSlice($del,$string) { Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -490,7 +490,7 @@ * @todo use img_type as parameter and decide in this function * which file extension to use */ -function getCachePath($what,$id,$ext='.jpg') +function getCachePath($what,$id,$ext='jpg') { $path = LinSql::getPath('cache'); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -279,7 +279,7 @@ array( 'name' => i18n("Import"), 'value' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_CLIENT.'/admin/?cat=import&album_select[]='.$this->id_parent), + array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') ) ); @@ -601,6 +601,7 @@ /** * create thumbnail info text (filename, description, etc.) */ + $i=0; foreach($this->photos_filtered AS $key=>$photo_value) { $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; @@ -630,22 +631,22 @@ } else { + $i++; if($index == 'before') { $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped - $i++; } elseif($index == 'after') { $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped - $i++; } } } - $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; // $photo_value['name'] is already escaped } + + $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-09 16:05:39 UTC (rev 4629) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-09 22:22:06 UTC (rev 4630) @@ -480,7 +480,8 @@ } else { - $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($photos_id)."'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($photos_id)."'"); if( isset( $data[0] ) ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-11-10 11:02:00
|
Revision: 4631 http://svn.sourceforge.net/linpha/?rev=4631&view=rev Author: bzrudi Date: 2006-11-10 03:01:46 -0800 (Fri, 10 Nov 2006) Log Message: ----------- fixed sqlite query bug, fixed some issues in view_meta Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css trunk/linpha2/templates/default/view_meta.html.php trunk/linpha2/templates/default/view_thumb_static.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-09 22:22:06 UTC (rev 4630) +++ trunk/linpha2/ChangeLog 2006-11-10 11:01:46 UTC (rev 4631) @@ -1,3 +1,7 @@ +2006-11-09 bzrudi + * made sqlite work again (broken query) + * fixed a couple of issues in view_meta + 2006-11-09 flo * added a maintenance part in the admin pages * added a db maintenance script Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-09 22:22:06 UTC (rev 4630) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-10 11:01:46 UTC (rev 4631) @@ -24,9 +24,11 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -define('SELECT_FIELDS',PREFIX."photos.id, ".PREFIX."photos.name, ".PREFIX."photos.img_type, ". - PREFIX."photos.md5sum, ".PREFIX."photos.width, ".PREFIX."photos.height, ". - PREFIX."photos.stats_numbers, ".PREFIX."photos.time_add"); +define('SELECT_FIELDS',PREFIX."photos.id AS id, ".PREFIX."photos.name AS name, " . + "".PREFIX."photos.img_type AS img_type, ".PREFIX."photos.md5sum AS md5sum, " . + "".PREFIX."photos.width AS width, ".PREFIX."photos.height AS height, " . + "".PREFIX."photos.stats_numbers AS stats_numbers, " . + "".PREFIX."photos.time_add AS time_add"); class LinImgview { @@ -85,7 +87,6 @@ */ $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".PREFIX."photos " . "WHERE id = '".linSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); - /** * check for valid id */ @@ -230,6 +231,7 @@ function filterPhotosNotPermitted() { $this->photos_filtered = Array(); + if(isset($this->photos)) { foreach($this->photos AS $key=>$value) Modified: trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css 2006-11-09 22:22:06 UTC (rev 4630) +++ trunk/linpha2/templates/default/themes/vertical-nav/css/view_img.css 2006-11-10 11:01:46 UTC (rev 4631) @@ -12,7 +12,7 @@ margin-left: 10px; width: 120px; - min-height: 667px; + min-height: 650px; height:expression( "650px" ); /* ie hack */ } Modified: trunk/linpha2/templates/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/default/view_meta.html.php 2006-11-09 22:22:06 UTC (rev 4630) +++ trunk/linpha2/templates/default/view_meta.html.php 2006-11-10 11:01:46 UTC (rev 4631) @@ -10,8 +10,8 @@ width: 300px; } </style> -<a href="<?php echo $linTpl->URL_full.'&view=img'; ?>">Back to normal view</a> -<h1 class="linStyle"><?php i18n("Edit Image Imformation"); ?></h1> +<a href="<?php echo $linTpl->URL_full.'&view=img'; ?>"><?php echo i18n("<< Back To Default View");?></a> +<h1 class="linStyle"><?php echo i18n("Edit Image Imformation")?></h1> <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) @@ -29,9 +29,13 @@ <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> <table border='1'> <tr> - <td width="150"><b><?php i18n("Name"); ?></b></td> - <td width="200"><b><?php i18n("Value"); ?></b></td> - <td rowspan="<?php echo $num_query['0']+1; ?>"><?php echo $linTpl->output['image']; ?></td> + <td width="150"><b><?php echo i18n("Name"); ?></b></td> + <td width="200"><b><?php echo i18n("Value"); ?></b></td> + <td rowspan="<?php echo $num_query['0']+1; ?>"> + <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$GLOBALS['linpha']->template->idCurrent;?> + width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" + height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" + </td> </tr> <?php while($data = $query->FetchRow()) Modified: trunk/linpha2/templates/default/view_thumb_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb_static.html.php 2006-11-09 22:22:06 UTC (rev 4630) +++ trunk/linpha2/templates/default/view_thumb_static.html.php 2006-11-10 11:01:46 UTC (rev 4631) @@ -39,7 +39,8 @@ <div class="linDivThumb"> <?php echo $linTpl->output['thumb_infos'][$value['id']]['before']; ?> <div class="linDivImg"> - <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"><img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> + <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"> + <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> </div> <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-11-10 13:09:08
|
Revision: 4632 http://svn.sourceforge.net/linpha/?rev=4632&view=rev Author: bzrudi Date: 2006-11-10 05:08:52 -0800 (Fri, 10 Nov 2006) Log Message: ----------- make random and new images on start page respect thumbsize settings Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/themes/default/css/home.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-10 11:01:46 UTC (rev 4631) +++ trunk/linpha2/ChangeLog 2006-11-10 13:08:52 UTC (rev 4632) @@ -1,6 +1,8 @@ 2006-11-09 bzrudi * made sqlite work again (broken query) * fixed a couple of issues in view_meta + * make random and new images on start page respect thumbsize settings. + I used "sys_style_thumb_size_display", if its the wrong value please change! 2006-11-09 flo * added a maintenance part in the admin pages Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-11-10 11:01:46 UTC (rev 4631) +++ trunk/linpha2/templates/default/home.html.php 2006-11-10 13:08:52 UTC (rev 4632) @@ -15,8 +15,10 @@ { ?> <div class="linDivRandomimg"> - <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' - . '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage" /></a>'; ?> + <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' . + '<img class="linImgRandomimg" title="'.htmlentities($value['path']).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="randomimage"' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . + 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> <br /><br /> </div> <?php @@ -34,8 +36,10 @@ { ?> <div class="linDivNewimg"> - <?php echo '<a href="'.LINPHA_LINK.'&linCat=newimg&linId='.$value['id'].'">' - . '<img class="linImgNewimg" title="'.htmlspecialchars($value['path'],ENT_QUOTES).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="newimage" /></a>'; ?> + <?php echo '<a href="'.LINPHA_LINK.'&linCat=newimg&linId='.$value['id'].'">' . + '<img class="linImgNewimg" title="'.htmlspecialchars($value['path'],ENT_QUOTES).'" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="newimage" ' . + 'width="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"' . + 'height="'.$GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display'].'"/></a>'; ?> <br /><br /> </div> <?php Modified: trunk/linpha2/templates/default/themes/default/css/home.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/home.css 2006-11-10 11:01:46 UTC (rev 4631) +++ trunk/linpha2/templates/default/themes/default/css/home.css 2006-11-10 13:08:52 UTC (rev 4632) @@ -10,9 +10,6 @@ .linImgRandomimg, .linImgNewimg { border: 0; - - width: 130px; - height: 130px; } .linDivFolder a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-10 15:46:34
|
Revision: 4634 http://svn.sourceforge.net/linpha/?rev=4634&view=rev Author: fangehrn Date: 2006-11-10 07:46:14 -0800 (Fri, 10 Nov 2006) Log Message: ----------- 2006-11-10 flo * implemented thumbnail folder with gdlib but the quality is quite bad...why? Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/image/gdlib/image.php trunk/linpha2/lib/classes/image/gdlib/thumbnail.php trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/ChangeLog 2006-11-10 15:46:14 UTC (rev 4634) @@ -1,3 +1,7 @@ +2006-11-10 flo + * implemented thumbnail folder with gdlib + but the quality is quite bad...why? + 2006-11-09 bzrudi * made sqlite work again (broken query) * fixed a couple of issues in view_meta Modified: trunk/linpha2/lib/classes/image/gdlib/image.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -56,7 +56,7 @@ /** * rotate image */ - LinImage::imageRotateGd($scaled_image,$this->rotate); + LinImage::GDimageRotate($scaled_image,$this->rotate); /** * save image Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -57,13 +57,7 @@ /** * create image resources */ - switch($this->img_type) - { - case 1: $src_image = imagecreatefromgif($this->src_file); break; - case 2: $src_image = imagecreatefromjpeg($this->src_file); break; - case 3: $src_image = imagecreatefrompng($this->src_file); break; - default: return false;; - } + $src_image = LinImage::GDimagecreate($this->src_file,$this->img_type); $scaled_image = imagecreatetruecolor($this->img_thumbsize, $this->img_thumbsize); @@ -86,7 +80,7 @@ /** * rotate image */ - LinImage::imageRotateGd($scaled_image,$this->rotate); + LinImage::GDimageRotate($scaled_image,$this->rotate); /** * save image Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -29,6 +29,64 @@ if(!defined('LINPHA_DIR')) { exit(1); } -copy( LinImage::getCachePath('thumb',$array_ids[0]), $this->output_file ); +if( ! $im = @ImageCreateFromGIF (LINPHA_DIR.'/lib/graphics/thumb_folder.gif')) +{ + copy( $array_ids[0], $this->output_file ); + linLog(LOG_TYPE_IMPORT,LOG_ERR,'thumbnail',"Cannot create folder thumbnail"); +} +else +{ + for($i=1; list($key,$value) = each($array_thumbs); $i++ ) + { +// echo $value['file'].' '.$value['type'].'<br />'; + $im2 = LinImage::GDimagecreate($value['file'],$value['type']); + $src_width = ImageSX($im2); + $src_height = ImageSY($im2); + + switch($i) + { + case 1: + imagecopyresized( + $im,$im2, + 15,15, // int dstX, int dstY + 0,0, // int srcX, int srcY + 80,80, // int dstW, int dstH + $src_width,$src_height // int srcW, int srcH + ); + break; + case 2: + imagecopyresized( + $im,$im2, + 105,15, // int dstX, int dstY + 0,0, // int srcX, int srcY + 80,80, // int dstW, int dstH + $src_width,$src_height // int srcW, int srcH + ); + break; + case 3: + imagecopyresized( + $im,$im2, + 15,105, // int dstX, int dstY + 0,0, // int srcX, int srcY + 80,80, // int dstW, int dstH + $src_width,$src_height // int srcW, int srcH + ); + break; + case 4: + imagecopyresized( + $im,$im2, + 105,105, // int dstX, int dstY + 0,0, // int srcX, int srcY + 80,80, // int dstW, int dstH + $src_width,$src_height // int srcW, int srcH + ); + break; + } + + imagedestroy($im2); + } + + imagegif($im,$this->output_file); +} ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -73,36 +73,37 @@ /** * create new unique tmp folder */ - for($i=0; file_exists(LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i); $i++) { } - $tmp_folder = LinSql::getPath('tmp').'/thumb_folder_'.session_id().'_'.$i; - mkdir($tmp_folder,0700); + $tmp_folder = LinFilesys::createTmpFolder('thumb_folder'); /** - * run imagemagick + * create smaller thumbs and set up the convert string at the same time for later use */ - for($i=1; list($key,$value) = each($array_ids) ; $i++) - { - LinFilesys::linExec( $this->imagemagick_path."convert ". $value . " -quality 70 -resize 80x80 ".$tmp_folder . "/" . $i . "." . LinFilesys::getFileExtFromPath($value) ); - } $str = $this->imagemagick_path."convert ".LINPHA_DIR."/lib/graphics/thumb_folder.gif "; - - reset($array_ids); - for($i=1; list($key,$value) = each($array_ids); $i++ ) + reset($array_thumbs); + for($i=1; list($key,$value) = each($array_thumbs); $i++ ) { + switch($value['type']) // thumbnails are either jpg (files) or gifs (folders) + { + case '1': $fileext = 'gif'; break; + case '2': $fileext = 'jpg'; break; + default: $fileext = 'jpg'; break; + } + LinFilesys::linExec( $this->imagemagick_path."convert ". $value['file'] . " -quality 70 -resize 80x80 " . $tmp_folder . "/" . $i . "." . $fileext ); + switch($i) { case 1: - $str .= $tmp_folder."/1.".LinFilesys::getFileExtFromPath($value)." -geometry +15+15 -composite "; + $str .= $tmp_folder."/1.".$fileext." -geometry +15+15 -composite "; break; case 2: - $str .= $tmp_folder."/2.".LinFilesys::getFileExtFromPath($value)." -geometry +105+15 -composite "; + $str .= $tmp_folder."/2.".$fileext." -geometry +105+15 -composite "; break; case 3: - $str .= $tmp_folder."/3.".LinFilesys::getFileExtFromPath($value)." -geometry +15+105 -composite "; + $str .= $tmp_folder."/3.".$fileext." -geometry +15+105 -composite "; break; case 4: - $str .= $tmp_folder."/4.".LinFilesys::getFileExtFromPath($value)." -geometry +105+105 -composite "; + $str .= $tmp_folder."/4.".$fileext." -geometry +105+105 -composite "; break; } } @@ -123,10 +124,16 @@ /** * delete tmp folder */ - reset($array_ids); - for($i=1; list($key,$value) = each($array_ids) ; $i++) + reset($array_thumbs); + for($i=1; list($key,$value) = each($array_thumbs) ; $i++) { - unlink( $tmp_folder .'/'. $i . '.' . LinFilesys::getFileExtFromPath($value) ); + switch($value['type']) // thumbnails are either jpg (files) or gifs (folders) + { + case '1': $fileext = 'gif'; break; + case '2': $fileext = 'jpg'; break; + default: $fileext = 'jpg'; break; + } + unlink( $tmp_folder .'/'. $i . '.' . $fileext ); } rmdir($tmp_folder); Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -527,6 +527,7 @@ * Action: * login, logout, rotate * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm + * thumbnail, image * * * @param string $type log types Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-10 13:42:45 UTC (rev 4633) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-10 15:46:14 UTC (rev 4634) @@ -364,7 +364,7 @@ * and create array_ids which holds 4 image ids */ $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); - $array_ids = Array(); + $array_thumbs = Array(); $i=0; while($data = $query->FetchRow(ADODB_FETCH_NUM)) { @@ -373,15 +373,17 @@ break; } - if($data['1']==0) { // folders are gif files, all others are jpg + if($data['1']=='0') { // folders are gif files, all others are jpg $file = LinImage::getCachePath('thumb',$data['0'],'gif'); + $type = '1'; } else { $file = LinImage::getCachePath('thumb',$data['0'],'jpg'); + $type = '2'; } if( file_exists( $file ) ) { - $array_ids[] = $file; + $array_thumbs[] = array('id' => $data['0'],'file' => $file, 'type' => $type); $i++; } } @@ -389,7 +391,7 @@ /** * no images found in this folder */ - if(count($array_ids) == 0) + if(count($array_thumbs) == 0) { return false; } @@ -631,11 +633,11 @@ * @param int $angle angle to rotate * @author flo */ -function imageRotateGd(& $src_img, $angle) +function GDimageRotate(& $src_img, $angle) { - if(function_exists('imagerotate')) + if($angle != "0") { - if($angle != "0") + if(function_exists('imagerotate')) { /** * flip $angle, because with this function, left means right, and right means left :-) @@ -644,12 +646,25 @@ $angle = $angle % 360; $src_img = imagerotate($src_img,$angle,0); } + else + { + linLog(LOG_TYPE_META,LOG_WARNING,'rotate',"Cannot rotate image becuase the function imagerotate() doesnt exists, consider upgrading your php version"); + } } - else +} + +function GDimagecreate($src_file,$img_type) +{ + switch($img_type) { - linLog(LOG_TYPE_META,LOG_WARNING,'rotate',"Cannot rotate image becuase the function imagerotate() doesnt exists, consider upgrading your php version"); + case 1: $src_image = imagecreatefromgif($src_file); break; + case 2: $src_image = imagecreatefromjpeg($src_file); break; + case 3: $src_image = imagecreatefrompng($src_file); break; + default: return false; } + + return $src_image; } - + } // end class linImage ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-10 18:28:27
|
Revision: 4635 http://svn.sourceforge.net/linpha/?rev=4635&view=rev Author: fangehrn Date: 2006-11-10 10:28:09 -0800 (Fri, 10 Nov 2006) Log Message: ----------- improved LinImage::getCachePath() Modified Paths: -------------- trunk/linpha2/admin/maintenance_db.php trunk/linpha2/lib/classes/image/gdlib/image.php trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.import.class.php Modified: trunk/linpha2/admin/maintenance_db.php =================================================================== --- trunk/linpha2/admin/maintenance_db.php 2006-11-10 15:46:14 UTC (rev 4634) +++ trunk/linpha2/admin/maintenance_db.php 2006-11-10 18:28:09 UTC (rev 4635) @@ -72,7 +72,7 @@ $i_tot = 0; while($data = $query->FetchRow() ) { - $filename = LinImage::getCachePath('img',$data['id'],'jpg'); + $filename = LinImage::getCachePath('img',$data['id'],'2'); if( !file_exists($filename)) { echo i18n("Cached file doesn't exists:").' '.$filename.' ('.i18n("Photo Nr").': '.$data['photo_id'].')<br />'; Modified: trunk/linpha2/lib/classes/image/gdlib/image.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 15:46:14 UTC (rev 4634) +++ trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 18:28:09 UTC (rev 4635) @@ -19,7 +19,7 @@ */ /** - * Create thumbnails with gdlib + * Create images with gdlib * @package Image */ Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 15:46:14 UTC (rev 4634) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 18:28:09 UTC (rev 4635) @@ -20,18 +20,21 @@ /** * Create folder thumbnails with gdlib - * don't think we are going to create the same nice folder icons as with imagemagick - * -> use first image in this folder as thumbnail - * - * * @package Image */ if(!defined('LINPHA_DIR')) { exit(1); } -if( ! $im = @ImageCreateFromGIF (LINPHA_DIR.'/lib/graphics/thumb_folder.gif')) + +if( !function_exists('imagecreatefromgif') + OR ! $im = @imagecreatefromgif (LINPHA_DIR.'/lib/graphics/thumb_folder.gif')) { - copy( $array_ids[0], $this->output_file ); + /** + * on failure, do nothing + * -> if the output file doesnt exists, we will take a default file + * + * //copy( $array_thumbs[0]['file'], $this->output_file ); + */ linLog(LOG_TYPE_IMPORT,LOG_ERR,'thumbnail',"Cannot create folder thumbnail"); } else @@ -86,7 +89,20 @@ imagedestroy($im2); } - imagegif($im,$this->output_file); + if (function_exists("imagegif")) + { + imagegif($im,$this->output_file); + } + elseif (function_exists("imagejpeg")) { + imagejpeg($im, $this->output_file, 0.5); + linLog(LOG_TYPE_IMPORT,LOG_ERR,'thumbnail',"Can only create a jpeg folder thumbnail because the php function 'imagegif' doesnt exists. Please enable the gdlib extension or update your php version."); + } + else + { + linLog(LOG_TYPE_IMPORT,LOG_ERR,'thumbnail',"Cannot create folder thumbnail because the php function 'imagegif' doesnt exists. Please enable the gdlib extension or update your php version."); + } + + imagedestroy($im); } ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-10 15:46:14 UTC (rev 4634) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-10 18:28:09 UTC (rev 4635) @@ -145,12 +145,8 @@ if($this->mode == 'thumb') { $this->cached_id = $this->photo_id; - if($this->img_type == 0) { // folder are gif files - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id,'gif'); - } else { - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); - } - + + $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id,$this->img_type); } elseif($this->mode == 'img') { @@ -235,7 +231,7 @@ if(isset($data['id']) && !empty($data['id'])) { $this->cached_id = $data['id']; - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); + $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); } else { @@ -248,7 +244,7 @@ $this->cached_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) " . "FROM ".PREFIX."photos_cache "); - $this->output_file = LinImage::getCachePath($this->mode,$this->cached_id); + $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); if(file_exists($this->output_file)) { @@ -366,24 +362,24 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); $array_thumbs = Array(); $i=0; - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { if($i >= 4) { break; } - if($data['1']=='0') { // folders are gif files, all others are jpg - $file = LinImage::getCachePath('thumb',$data['0'],'gif'); - $type = '1'; - } else { - $file = LinImage::getCachePath('thumb',$data['0'],'jpg'); - $type = '2'; - } - + $file = LinImage::getCachePath('thumb',$data['id'],$data['img_type']); + if( file_exists( $file ) ) { - $array_thumbs[] = array('id' => $data['0'],'file' => $file, 'type' => $type); + if($data['1']=='0') { // folders are gif files, all others are jpg + $type = '1'; + } else { + $type = '2'; + } + + $array_thumbs[] = array('id' => $data['id'],'file' => $file, 'type' => $type); $i++; } } @@ -398,7 +394,14 @@ include(LINPHA_DIR.'/lib/classes/image/'.$this->image_tool.'/thumbnail_folder.php'); - return true; + if( !file_exists($this->output_file)) + { + return false; + } + else + { + return true; + } } function createThumbnailVideo() @@ -492,8 +495,17 @@ * @todo use img_type as parameter and decide in this function * which file extension to use */ -function getCachePath($what,$id,$ext='jpg') +function getCachePath($what,$id,$img_type) { + /** + * thumbnails of folders are gif files, all others are (currently at least) jpg files + */ + if($what == 'thumb' && $img_type == '0') { + $ext = 'gif'; + } else { + $ext = 'jpg'; + } + $path = LinSql::getPath('cache'); if(strlen($id)==1) @@ -514,9 +526,9 @@ * @param int $id id of thumb in database * @return boolean false if there was no image, true if there was an image to delete */ -function deleteCachedThumbnail($id) +function deleteCachedThumbnail($id,$img_type) { - $output = LinImage::getCachePath('thumb',$id); + $output = LinImage::getCachePath('thumb',$id,$img_type); if(file_exists($output)) { @@ -538,12 +550,12 @@ * * @param int $id id of image in database */ -function deleteCachedImage($id) +function deleteCachedImage($id,$img_type) { $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos_cache WHERE photo_id = '".$id."'"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { - $output = LinImage::getCachePath('img',$data[0]); + $output = LinImage::getCachePath('img',$data[0],$img_type); if(file_exists($output)) { @@ -657,7 +669,7 @@ { switch($img_type) { - case 1: $src_image = imagecreatefromgif($src_file); break; + case 1: $src_image = imagecreatefromgif($src_file); echo 'gif'; exit(); break; case 2: $src_image = imagecreatefromjpeg($src_file); break; case 3: $src_image = imagecreatefrompng($src_file); break; default: return false; Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-10 15:46:14 UTC (rev 4634) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-10 18:28:09 UTC (rev 4635) @@ -232,11 +232,14 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT id, name " . "FROM ".PREFIX."photos WHERE parent_id = '".$photo_id."' "); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { LinImport::deleteEntry( $data['id'], $full_filename.'/'.$data['name']); } + $data = $GLOBALS['linpha']->db->GetRow("SELECT img_type, md5sum FROM ".PREFIX."photos WHERE id = '".$photo_id."'"); + + linSysLog(i18n("Import").': '.i18n("Delete").': '.htmlspecialchars($full_filename,ENT_QUOTES)); linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_delete',"Delete: ".$full_filename); @@ -245,13 +248,12 @@ * delete thumbnail and image in cache folder * even delete folder thumbnail */ - LinImage::deleteCachedThumbnail($photo_id); - LinImage::deleteCachedImage($photo_id); + LinImage::deleteCachedThumbnail($photo_id,$data['img_type']); + LinImage::deleteCachedImage($photo_id,$data['img_type']); /** * delete metadata (exif,iptc,xmp) */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum FROM ".PREFIX."photos WHERE id = '".$photo_id."'"); $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_exif WHERE md5sum = '".$data['md5sum']."'"); $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_iptc WHERE md5sum = '".$data['md5sum']."'"); //$GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_xmp WHERE md5sum = '".$data['md5sum']."'"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-10 18:49:17
|
Revision: 4637 http://svn.sourceforge.net/linpha/?rev=4637&view=rev Author: fangehrn Date: 2006-11-10 10:49:05 -0800 (Fri, 10 Nov 2006) Log Message: ----------- * improved LinImage::getCachePath() * added imagetruecolortopalette ( $im2, true, 256 ); to gdlib folder thumbnail function and now im getting really good looking folder thumbnails! * fixed some bugs Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/lib/classes/image/gdlib/image.php trunk/linpha2/lib/classes/image/gdlib/thumbnail.php trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-10 18:34:37 UTC (rev 4636) +++ trunk/linpha2/ChangeLog 2006-11-10 18:49:05 UTC (rev 4637) @@ -1,6 +1,10 @@ 2006-11-10 flo * implemented thumbnail folder with gdlib but the quality is quite bad...why? + * improved LinImage::getCachePath() + * added imagetruecolortopalette ( $im2, true, 256 ); to gdlib folder thumbnail function + and now im getting really good looking folder thumbnails! + * fixed some bugs 2006-11-09 bzrudi * made sqlite work again (broken query) Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2006-11-10 18:34:37 UTC (rev 4636) +++ trunk/linpha2/admin/maintenance_import.php 2006-11-10 18:49:05 UTC (rev 4637) @@ -314,7 +314,7 @@ echo i18n("Select Folders For Import/Update:"); ?> <br /> -<form action="./?cat=import" method="POST"> +<form action="./?cat=maintenance_import" method="POST"> <select name="album_select[]" size="10" multiple="multiple" style="width: 500px;"> <?php linBuildAlbumSelect($with_all_albs_entry=true); ?> </select> Modified: trunk/linpha2/lib/classes/image/gdlib/image.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 18:34:37 UTC (rev 4636) +++ trunk/linpha2/lib/classes/image/gdlib/image.php 2006-11-10 18:49:05 UTC (rev 4637) @@ -28,13 +28,7 @@ /** * create image resources */ - switch($this->img_type) - { - case 1: $src_image = imagecreatefromgif($this->src_file); break; - case 2: $src_image = imagecreatefromjpeg($this->src_file); break; - case 3: $src_image = imagecreatefrompng($this->src_file); break; - default: return false;; - } + $src_image =& LinImage::GDimageCreateFrom($this->src_file,$this->img_type); $scaled_image = imagecreatetruecolor($this->img_width, $this->img_height); /** Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-11-10 18:34:37 UTC (rev 4636) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail.php 2006-11-10 18:49:05 UTC (rev 4637) @@ -57,7 +57,7 @@ /** * create image resources */ - $src_image = LinImage::GDimagecreate($this->src_file,$this->img_type); + $src_image =& LinImage::GDimageCreateFrom($this->src_file,$this->img_type); $scaled_image = imagecreatetruecolor($this->img_thumbsize, $this->img_thumbsize); Modified: trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php =================================================================== --- trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 18:34:37 UTC (rev 4636) +++ trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php 2006-11-10 18:49:05 UTC (rev 4637) @@ -43,6 +43,7 @@ { //echo $value['file'].' '.$value['type'].'<br />'; $im2 =& LinImage::GDimageCreateFrom($value['file'],$value['type']); + imagetruecolortopalette ( $im2, true, 256 ); $src_width = ImageSX($im2); $src_height = ImageSY($im2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-10 19:26:14
|
Revision: 4638 http://svn.sourceforge.net/linpha/?rev=4638&view=rev Author: fangehrn Date: 2006-11-10 11:24:29 -0800 (Fri, 10 Nov 2006) Log Message: ----------- * re-arranging admin/metadata pages Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/install/sql/sql.data.php Added Paths: ----------- trunk/linpha2/admin/metadata.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/metadata_select.php Removed Paths: ------------- trunk/linpha2/admin/image_fields.php trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_define_post.php trunk/linpha2/admin/image_fields_select.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/ChangeLog 2006-11-10 19:24:29 UTC (rev 4638) @@ -5,6 +5,7 @@ * added imagetruecolortopalette ( $im2, true, 256 ); to gdlib folder thumbnail function and now im getting really good looking folder thumbnails! * fixed some bugs + * re-arranging admin/metadata pages 2006-11-09 bzrudi * made sqlite work again (broken query) Deleted: trunk/linpha2/admin/image_fields.php =================================================================== --- trunk/linpha2/admin/image_fields.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/admin/image_fields.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -1,26 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat2)) -{ - $cat2 = 'select'; -} - -$array_menu = Array( - 'select' => Array('name' => 'Select image fields', 'link' => 'imagefields_select'), - 'define' => Array('name' => 'Define image fields', 'link' => 'imagefields_define') -); - -LinAdmin::printAdminMenu($array_menu,$cat2); - -switch($cat2) -{ -case 'select': - include_once('./image_fields_select.php'); - break; -case 'define': - include_once('./image_fields_define.php'); - break; -} -?> - Deleted: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/admin/image_fields_define.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -1,377 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -/** - * init - */ - if(!isset($cat3)) - { - $cat3 = 'own'; - } - $array_field_types = Array( - 1 => 'text', - 2 => 'select', - 3 => 'date' - ); - -/** - * show subsubmenu - */ - $array_menu = Array( - 'own' => Array('name' => 'Own fields', 'link' => 'imagefields_define_own'), - 'adddata' => Array('name' => 'Add select data (set Category names)', 'link' => 'imagefields_define_adddata'), - 'exif' => Array('name' => 'Exif fields', 'link' => 'imagefields_define_exif'), - 'iptc' => Array('name' => 'Iptc fields', 'link' => 'imagefields_define_iptc') - ); - - LinAdmin::printAdminMenu($array_menu,$cat3); - -/** - * parse POST data - */ -if(isset($_POST['cmd'])) { - include_once(LINPHA_DIR.'/admin/image_fields_define_post.php'); -} - -switch($cat3) -{ -case 'own': - show_own_fields(); - break; -case 'adddata': - show_add_data(); - break; -case 'exif': -case 'iptc': - show_exif_iptc(); - break; -} - -function show_own_fields() -{ - ?> - <h3>Built-in fields</h3> - <form name="builtin" action="./?cat=imagefields_define_own" method="POST"> - <table border="0" width="400"> - <tr> - <td><b>Field name</b></td> - <td><b>Type</b></td> - <td><b>Enable</b></td> - <td><b>Disable</b></td> - </tr> - - <?php - /** - * get builtin fields - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . - "FROM ".PREFIX."meta_fields " . - "WHERE flags = '5' OR flags = '6' "); - - while($data = $query->FetchRow()) - { - echo '<tr><td>'; - echo $data['name']; - echo '</td><td>'; - echo $GLOBALS['array_field_types'][$data['field_type']]; - echo '</td><td>'; - - echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==5 ? ' checked="checked"' : '') .' />'; - echo '</td><td>'; - echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==6 ? ' checked="checked"' : '') .' />'; - echo '</td></tr>'; - } - - ?> - </table> - - <input type="hidden" name="cmd" value="update_builtin" /> - <input type="submit" name="submit" value="submit" /> - </form> - <br /> - - - <h3>Add new own fields</h3> - <form name="addnew" action="./?cat=imagefields_define_own" method="POST"> - <table border="0"> - <tr> - <td width="100">Name</td> - <td><input type="text" name="new_name" value="" maxlength="255" style="width: 200px;" /></td> - </tr> - <tr> - <td>Type</td> - <td> - <select name="new_type" style="width: 200px;" > - <?php - foreach($GLOBALS['array_field_types'] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'; - } - ?> - </select> - </td> - </tr> - </table> - <input type="hidden" name="cmd" value="add_new" /> - <input type="submit" name="submit" value="add new"/> - </form> - <br /> - - <?php - /** - * get own fields - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . - "FROM ".PREFIX."meta_fields " . - "WHERE flags = '7' " . - "OR flags = '8'"); - - if( ! $query->EOF ) - { - ?> - <h3>Own fields</h3> - <form name="builtin" action="./?cat=imagefields_define_own" method="POST"> - <table border="0"> - <tr> - <td width="170"><b>Field name</b></td> - <td width="150"><b>Type</b></td> - <td width="70"><b>Enable</b></td> - <td width="100"><b>Disable</b></td> - <td><b>Commands</b></td> - <td> </td> - </tr> - - <?php - while($data = $query->FetchRow()) - { - ?> - <tr> - <form action="./?cat=imagefields_define_own" method="POST"> - <td> - <input type="text" name="new_name" value="<?php echo $data['name']; ?>" style="width: 150px;" maxlength="255" /> - </td> - <td><?php echo $GLOBALS['array_field_types'][$data['field_type']]; ?></td> - <td> - <?php - echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==7 ? ' checked="checked"' : '') .' />'; - ?> - </td> - <td> - <?php - echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==8 ? ' checked="checked"' : '') .' />'; - ?> - </td> - <td> - <input type="hidden" name="cmd" value="change_field" /> - <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> - <input type="submit" name="rename" value="submit" /> - </td> - </form> - <td> - <form action="./?cat=imagefields_define_own" method="POST"> - <input type="hidden" name="cmd" value="delete" /> - <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> - <input type="submit" name="delete" value="delete" /> - </form> - </td> - </tr> - <?php - } - - ?> - </table> - </form> - <?php - } -} - -function show_add_data() -{ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); - while($data = $query->FetchRow()) - { - ?> - <h3><?php echo $data['name']; ?></h3> - <table border="0"> - <tr> - <td width="170"><b>Name</b></td> - <td width="150"><b>Private</b></td> - <td><b>Commands</b></td> - <td> </td> - </tr> - <?php - $query2 = $GLOBALS['linpha']->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); - while($data2 = $query2->FetchRow()) - { - ?> - <tr> - <form action="./?cat=imagefields_define_adddata" method="POST"> - <td> - <input type="text" name="new_name" value="<?php echo $data2['name']; ?>" /> - </td> - <td> - <input type="checkbox" name="isprivate" value="true"<?php echo ($data2['isprivate'] ? ' checked="checked"' : ''); ?> /> - </td> - <td> - <input type="hidden" name="cmd" value="mod_category" /> - <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> - <input type="submit" name="submit" value="Submit" /> - </td> - </form> - <td> - <form action="./?cat=imagefields_define_adddata" method="POST"> - <input type="hidden" name="cmd" value="delete_category" /> - <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> - <input type="submit" name="delete" value="delete" /> - </form> - </td> - </tr> - <?php - } - ?> - <tr> - <form action="./?cat=imagefields_define_adddata" method="POST"> - <td> - <input type="text" name="new_name" value="" /> - </td> - <td> - <input type="checkbox" name="isprivate" value="1" /> - </td> - <td> - <input type="hidden" name="field_id" value="<?php echo $data['id']; ?>" /> - <input type="hidden" name="cmd" value="add_new_category" /> - <input type="submit" name="submit" value="Add new" /> - </td> - <td> </td> - </form> - </tr> - </table> - <?php - } -} - -function show_exif_iptc() -{ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - $MetaData->setFields( $GLOBALS['cat3'] ); - - /** - * get enabled/disabled setting - */ - $enabled = $GLOBALS['linpha']->sql->config->value['sys_image_'.$GLOBALS['cat3']]; -?> - - <div align="center"> - <form action="./?cat=imagefields_define_<?php echo $GLOBALS['cat3']; ?>" method="POST"> - <input type="radio" name="exifiptc_enable" value="1"<?php echo ($enabled ? ' checked="checked"' : ''); ?> />Enable - <input type="radio" name="exifiptc_enable" value="0"<?php echo ($enabled ? '' : ' checked="checked"'); ?> />Disable - <input type="hidden" name="cmd" value="update_exifiptc" /> - <input type="submit" name="name" value="update" /> - </form> - <br /><br /> - - <form action="./?cat=imagefields_define_<?php echo $GLOBALS['cat3']; ?>" method="POST" onsubmit="selectAll()"> - <table border="0"> - <tr> - <td valign="top" rowspan="3" align="center"> - 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"; - } - ?> - </select> - <br /> - </td> - <td> - <input type="button" name="shiftleft" value="<" onclick="addElement()" /> - <br /> - <input type="button" name="shiftright" value=">" onclick="removeElement()" /> - </td> - <td valign="top"> - 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>'; - } - ?> - </select> - </td> - </tr> - </table> - <input type="hidden" name="cmd" value="create_exifiptc" /> - <input type="submit" name="name" value="Submit" /> - </form> - - </div> - - <script type="text/javascript"> - /** - * http://www.babailiica.com/js/sorter/ - */ - - function selectAll() - { - obj = document.getElementById('selected_fields'); - for (var i=0; i<obj.length; i++) { - obj[i].selected = true; - } - } - - function addElement () - { - obj_from = document.getElementById('all_fields'); - obj_to = document.getElementById('selected_fields'); - - moveElement(obj_from, obj_to); - } - - function removeElement () - { - obj_from = document.getElementById('selected_fields'); - obj_to = document.getElementById('all_fields'); - - moveElement(obj_from, obj_to); - } - - function moveElement(obj_from, obj_to) - { - if(obj_from.selectedIndex != -1) - { - old_index = obj_from.selectedIndex; - - NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); - obj_to.options[ obj_to.options.length] = NewEntry; - - obj_from.options[ obj_from.selectedIndex ] = null; - - /** - * set selectedIndex back to field above - */ - obj_to.selectedIndex = obj_to.length - 1; - - if( obj_from.selectedIndex == obj_from.length ) - { - obj_from.selectedIndex = obj_from.selectedIndex - 1; - } - else - { - obj_from.selectedIndex = old_index; - } - } - else - { - alert('nothing selected'); - } - } - - </script> - <?php -} - -?> \ No newline at end of file Deleted: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -1,107 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -switch($_POST['cmd']) -{ -case 'update_builtin': - - foreach($_POST['builtin'] AS $key=>$value) - { - if($value) { - $flag = 5; - } else { - $flag = 6; - } - - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . - "flags = '".$flag."' ". - "WHERE id = '".linSql::linAddslashes($key)."'"); - } - - break; -case 'add_new': - /** - * check for duplicates with the same name - */ - $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, flags) " . - "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); - break; -case 'change_field': - - if(linSql::linAddslashes($_POST['builtin'][$_POST['id']])) { - $flag = 7; - } else { - $flag = 8; - } - - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". - "flags = '".$flag."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; -case 'delete': - ?> - <h3>Delete selected field</h3> - Really sure? all will be lost... - <form action="./?cat=imagefields_define_own" method="POST"> - <input type="hidden" name="cmd" value="do_delete" /> - <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> - <input type="submit" name="delete" value="delete" /> - <a href="./?cat=imagefields_define_own">Cancel</a> - </form> - <br /><br /> - <?php - break; -case 'do_delete': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; -case 'add_new_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . - "'".linSql::linAddslashes($_POST['field_id'])."'," . - "'".linSql::linAddslashes($_POST['new_name'])."'," . - "'".$isprivate."')"); - - break; -case 'mod_category': - if(isset($_POST['isprivate'])) { - $isprivate = 1; - } else { - $isprivate = 0; - } - - $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". - "isprivate = '".$isprivate."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - - break; -case 'delete_category': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); - break; -case 'update_exifiptc': - $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); - $linpha->sql->config->reloadConfig(); - break; -case 'create_exifiptc': - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - if( ! isset($_POST['selected_fields'])) - { - $_POST['selected_fields'] = Array(); - } - if($cat3 == 'exif') { - $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_exif"); - $linpha->db->Execute( Metadata::createExifTable( $_POST['selected_fields'] ) ); - } elseif($cat3 == 'iptc') { - $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_iptc"); - $linpha->db->Execute( Metadata::createIptcTable( $_POST['selected_fields'] ) ); - } - break; -} - - -?> \ No newline at end of file Deleted: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/admin/image_fields_select.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -1,312 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat3)) -{ - $cat3 = 'image'; -} - -$array_menu = Array( - 'image' => Array('name' => 'Image', 'link' => 'imagefields_select_image'), - 'thumb' => Array('name' => 'Thumbnail', 'link' => 'imagefields_select_thumb'), - 'thumbdetail' => Array('name' => 'Thumbnail Detail View', 'link' => 'imagefields_select_thumbdetail'), - 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video'), - 'album' => Array('name' => 'Album', 'link' => 'imagefields_select_album') -); - -LinAdmin::printAdminMenu($array_menu,$cat3); - -switch($cat3) -{ -case 'image': - printFieldsTable(10); - break; -case 'thumb': - printFieldsTable(13); - break; -case 'thumbdetail': - printFieldsTable(14); - break; -case 'video': - - break; -} - - - -function printFieldsTable($flag_nr) -{ - if(isset($_POST['cmd']) && $_POST['cmd']=='select_image_fields') - { - /** - * delete all existing entries in database - */ - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."'"); - - /** - * write new entrys - */ - if(isset($_POST['select_image_fields'])) - { - foreach($_POST['select_image_fields'] AS $value) - { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . - " VALUES ('".linSql::linAddslashes($value)."','".$flag_nr."')"); - } - } - } - - /** - * set exif/iptc fields - */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - $MetaData->setFields('exif'); - $MetaData->setFields('iptc'); -?> - <form name="form_image_fields" method="POST" onsubmit="selectAll()"> - <div align="center"> - <table border="0"> - <tr> - <td valign="top" rowspan="4" align="center"> - Selected fields<br /> - <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> - <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); - while($data = $query->FetchRow()) - { - echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; - } - ?> - </select> - <br /> - <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> - <input type="button" name="shift_down" value="v" onclick="movedownElement()" /> - <br /><br /> - <input type="button" name="remove" value="delete selected" onclick="deleteElement()" /> - <br /><br /> - <input type="text" name="title_name" value="" /><br /> - <input type="button" name="add_title" value="add title" onclick="addElement()" /> - </td> - <td> - <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('image_fields')" /> - </td> - <td> - Image fields (builtin)<br /> - <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> - <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE flags = '1' OR flags = '5'"); - while($data = $query->FetchRow()) - { - echo '<option value="builtin_'.$data['name'].'">'.i18n( ucfirst( $data['name'] ) ).'</option>'; - } - ?> - </select> - </td> - </tr> - <tr> - <td> - <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> - </td> - <td> - Image fields (own) (<a href="./?cat=imagefields_define_own">define</a>)<br /> - <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> - <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE flags = '7'"); - while($data = $query->FetchRow()) - { - echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; - } - ?> - </select> - </td> - </tr> - <tr> - <td> - <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> - </td> - <td> - Exif fields (<a href="./?cat=imagefields_define_exif">define</a>)<br /> - <?php - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { - $str_disabled = ''; - } else { - $str_disabled = ' disabled="disabled"'; - } - ?> - <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> - <?php - foreach($MetaData->defined_fields['exif'] AS $key=>$value) - { - echo '<option value="exif_'.$key.'">'.$value.'</option>'; - } - ?> - </select> - </td> - </tr> - <tr> - <td> - <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> - </td> - <td> - IPTC fields (<a href="./?cat=imagefields_define_iptc">define</a>)<br /> - <?php - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { - $str_disabled = ''; - } else { - $str_disabled = ' disabled="disabled"'; - } - ?> - <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> - <?php - foreach($MetaData->defined_fields['iptc'] AS $key=>$value) - { - echo '<option value="iptc_'.$key.'">'.$value.'</option>'; - } - ?> - </select> - </td> - </tr> - </table> - <br /> - <input type="hidden" name="cmd" value="select_image_fields" /> - <input type="submit" name="submit" value="submit" /> - - </div> - </form> - - <script type="text/javascript"> - /** - * http://www.babailiica.com/js/sorter/ - */ - - function selectAll() - { - obj = document.getElementById('select_image_fields'); - for (var i=0; i<obj.length; i++) { - obj[i].selected = true; - } - } - - - function copyElement (coming_from) - { - obj_from = document.getElementById(coming_from); - obj = document.getElementById('select_image_fields'); - - NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); - obj.options[ obj.options.length ] = NewEntry; - - /** - * append ' (exif)' and ' (iptc)' - */ - if(coming_from=='exif_fields') - { - obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; - } - if(coming_from=='iptc_fields') - { - obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; - } - - - /** - * remove new selection on left side - */ - obj.options[ obj.options.length-1 ].selected = false; - } - - function addElement () - { - obj = document.getElementById('select_image_fields'); - - NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); - NewEntry.className = "linSelectOptionTitle"; - obj.options[obj.options.length] = NewEntry; - document.form_image_fields.title_name.value = ""; - } - - function deleteElement () - { - obj = document.getElementById('select_image_fields'); - - current_index = obj.selectedIndex; - obj.options[ current_index ] = null; - - /** - * set selectedIndex back to field above - */ - if( current_index == obj.length ) - { - obj.selectedIndex = current_index - 1; - } - else - { - obj.selectedIndex = current_index; - } - } - - function moveupElement () - { - obj = document.getElementById('select_image_fields'); - - current_index = obj.selectedIndex; - if( current_index != 0 ) - { - /** - * swap entries - */ - tmp_value = obj.options[ current_index ].value; - tmp_text = obj.options[ current_index ].text; - tmp_class = obj.options[ current_index ].className; - - obj.options[ current_index ].value = obj.options[ current_index - 1].value; - obj.options[ current_index ].text = obj.options[ current_index - 1].text; - obj.options[ current_index ].className = obj.options[ current_index - 1].className; - - obj.options[ current_index - 1].value = tmp_value; - obj.options[ current_index - 1].text = tmp_text; - obj.options[ current_index - 1].className = tmp_class; - - /** - * set selectedIndex back to swapped field - */ - obj.selectedIndex = current_index - 1; - } - } - - function movedownElement () - { - obj = document.getElementById('select_image_fields'); - - current_index = obj.selectedIndex; - - if( current_index != ( obj.length - 1 ) ) - { - /** - * swap entries - */ - tmp_value = obj.options[ current_index ].value; - tmp_text = obj.options[ current_index ].text; - tmp_class = obj.options[ current_index ].className; - - obj.options[ current_index ].value = obj.options[ current_index + 1].value; - obj.options[ current_index ].text = obj.options[ current_index + 1].text; - obj.options[ current_index ].className = obj.options[ current_index + 1].className; - - obj.options[ current_index + 1].value = tmp_value; - obj.options[ current_index + 1].text = tmp_text; - obj.options[ current_index + 1].className = tmp_class; - - /** - * set selectedIndex back to swapped field - */ - obj.selectedIndex = current_index + 1; - } - } - </script> -<?php -} -?> \ No newline at end of file Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/admin/index.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -79,7 +79,7 @@ 'settings' => Array('name' => 'Settings', 'link' => 'settings'), 'permissions' => Array('name' => 'Permissions', 'link' => 'permissions'), 'maintenance' => Array('name' => 'Maintenance', 'link' => 'maintenance'), - 'imagefields' => Array('name' => 'Image fields', 'link' => 'imagefields'), + 'metadata' => Array('name' => 'Meta Data', 'link' => 'metadata'), ); LinAdmin::printAdminMenu($array_menu,$cat1); @@ -95,8 +95,8 @@ case 'maintenance': include_once('./maintenance.php'); break; -case 'imagefields': - include_once('./image_fields.php'); +case 'metadata': + include_once('./metadata.php'); break; } ?> Copied: trunk/linpha2/admin/metadata.php (from rev 4634, trunk/linpha2/admin/image_fields.php) =================================================================== --- trunk/linpha2/admin/metadata.php (rev 0) +++ trunk/linpha2/admin/metadata.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -0,0 +1,26 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'select'; +} + +$array_menu = Array( + 'select' => Array('name' => 'Select image fields', 'link' => 'metadata_select'), + 'define' => Array('name' => 'Define image fields', 'link' => 'metadata_define') +); + +LinAdmin::printAdminMenu($array_menu,$cat2); + +switch($cat2) +{ +case 'select': + include_once('./metadata_select.php'); + break; +case 'define': + include_once('./metadata_define.php'); + break; +} +?> + Copied: trunk/linpha2/admin/metadata_define.php (from rev 4634, trunk/linpha2/admin/image_fields_define.php) =================================================================== --- trunk/linpha2/admin/metadata_define.php (rev 0) +++ trunk/linpha2/admin/metadata_define.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -0,0 +1,377 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * init + */ + if(!isset($cat3)) + { + $cat3 = 'own'; + } + $array_field_types = Array( + 1 => 'text', + 2 => 'select', + 3 => 'date' + ); + +/** + * show subsubmenu + */ + $array_menu = Array( + 'own' => Array('name' => 'Own fields', 'link' => 'metadata_define_own'), + 'adddata' => Array('name' => 'Add select data (set Category names)', 'link' => 'metadata_define_adddata'), + 'exif' => Array('name' => 'Exif fields', 'link' => 'metadata_define_exif'), + 'iptc' => Array('name' => 'Iptc fields', 'link' => 'metadata_define_iptc') + ); + + LinAdmin::printAdminMenu($array_menu,$cat3); + +/** + * parse POST data + */ +if(isset($_POST['cmd'])) { + include_once(LINPHA_DIR.'/admin/metadata_define_post.php'); +} + +switch($cat3) +{ +case 'own': + show_own_fields(); + break; +case 'adddata': + show_add_data(); + break; +case 'exif': +case 'iptc': + show_exif_iptc(); + break; +} + +function show_own_fields() +{ + ?> + <h3>Built-in fields</h3> + <form name="builtin" action="./?cat=metadata_define_own" method="POST"> + <table border="0" width="400"> + <tr> + <td><b>Field name</b></td> + <td><b>Type</b></td> + <td><b>Enable</b></td> + <td><b>Disable</b></td> + </tr> + + <?php + /** + * get builtin fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . + "FROM ".PREFIX."meta_fields " . + "WHERE flags = '5' OR flags = '6' "); + + while($data = $query->FetchRow()) + { + echo '<tr><td>'; + echo $data['name']; + echo '</td><td>'; + echo $GLOBALS['array_field_types'][$data['field_type']]; + echo '</td><td>'; + + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==5 ? ' checked="checked"' : '') .' />'; + echo '</td><td>'; + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==6 ? ' checked="checked"' : '') .' />'; + echo '</td></tr>'; + } + + ?> + </table> + + <input type="hidden" name="cmd" value="update_builtin" /> + <input type="submit" name="submit" value="submit" /> + </form> + <br /> + + + <h3>Add new own fields</h3> + <form name="addnew" action="./?cat=metadata_define_own" method="POST"> + <table border="0"> + <tr> + <td width="100">Name</td> + <td><input type="text" name="new_name" value="" maxlength="255" style="width: 200px;" /></td> + </tr> + <tr> + <td>Type</td> + <td> + <select name="new_type" style="width: 200px;" > + <?php + foreach($GLOBALS['array_field_types'] AS $key=>$value) + { + echo '<option value="'.$key.'">'.$value.'</option>'; + } + ?> + </select> + </td> + </tr> + </table> + <input type="hidden" name="cmd" value="add_new" /> + <input type="submit" name="submit" value="add new"/> + </form> + <br /> + + <?php + /** + * get own fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . + "FROM ".PREFIX."meta_fields " . + "WHERE flags = '7' " . + "OR flags = '8'"); + + if( ! $query->EOF ) + { + ?> + <h3>Own fields</h3> + <form name="builtin" action="./?cat=metadata_define_own" method="POST"> + <table border="0"> + <tr> + <td width="170"><b>Field name</b></td> + <td width="150"><b>Type</b></td> + <td width="70"><b>Enable</b></td> + <td width="100"><b>Disable</b></td> + <td><b>Commands</b></td> + <td> </td> + </tr> + + <?php + while($data = $query->FetchRow()) + { + ?> + <tr> + <form action="./?cat=metadata_define_own" method="POST"> + <td> + <input type="text" name="new_name" value="<?php echo $data['name']; ?>" style="width: 150px;" maxlength="255" /> + </td> + <td><?php echo $GLOBALS['array_field_types'][$data['field_type']]; ?></td> + <td> + <?php + echo '<input type="radio" name="builtin['.$data['id'].']" value="1"'. ( $data['flags']==7 ? ' checked="checked"' : '') .' />'; + ?> + </td> + <td> + <?php + echo '<input type="radio" name="builtin['.$data['id'].']" value="0"'. ( $data['flags']==8 ? ' checked="checked"' : '') .' />'; + ?> + </td> + <td> + <input type="hidden" name="cmd" value="change_field" /> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> + <input type="submit" name="rename" value="submit" /> + </td> + </form> + <td> + <form action="./?cat=metadata_define_own" method="POST"> + <input type="hidden" name="cmd" value="delete" /> + <input type="hidden" name="id" value="<?php echo $data['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + </form> + </td> + </tr> + <?php + } + + ?> + </table> + </form> + <?php + } +} + +function show_add_data() +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); + while($data = $query->FetchRow()) + { + ?> + <h3><?php echo $data['name']; ?></h3> + <table border="0"> + <tr> + <td width="170"><b>Name</b></td> + <td width="150"><b>Private</b></td> + <td><b>Commands</b></td> + <td> </td> + </tr> + <?php + $query2 = $GLOBALS['linpha']->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); + while($data2 = $query2->FetchRow()) + { + ?> + <tr> + <form action="./?cat=metadata_define_adddata" method="POST"> + <td> + <input type="text" name="new_name" value="<?php echo $data2['name']; ?>" /> + </td> + <td> + <input type="checkbox" name="isprivate" value="true"<?php echo ($data2['isprivate'] ? ' checked="checked"' : ''); ?> /> + </td> + <td> + <input type="hidden" name="cmd" value="mod_category" /> + <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> + <input type="submit" name="submit" value="Submit" /> + </td> + </form> + <td> + <form action="./?cat=metadata_define_adddata" method="POST"> + <input type="hidden" name="cmd" value="delete_category" /> + <input type="hidden" name="id" value="<?php echo $data2['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + </form> + </td> + </tr> + <?php + } + ?> + <tr> + <form action="./?cat=metadata_define_adddata" method="POST"> + <td> + <input type="text" name="new_name" value="" /> + </td> + <td> + <input type="checkbox" name="isprivate" value="1" /> + </td> + <td> + <input type="hidden" name="field_id" value="<?php echo $data['id']; ?>" /> + <input type="hidden" name="cmd" value="add_new_category" /> + <input type="submit" name="submit" value="Add new" /> + </td> + <td> </td> + </form> + </tr> + </table> + <?php + } +} + +function show_exif_iptc() +{ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields( $GLOBALS['cat3'] ); + + /** + * get enabled/disabled setting + */ + $enabled = $GLOBALS['linpha']->sql->config->value['sys_image_'.$GLOBALS['cat3']]; +?> + + <div align="center"> + <form action="./?cat=metadata_define_<?php echo $GLOBALS['cat3']; ?>" method="POST"> + <input type="radio" name="exifiptc_enable" value="1"<?php echo ($enabled ? ' checked="checked"' : ''); ?> />Enable + <input type="radio" name="exifiptc_enable" value="0"<?php echo ($enabled ? '' : ' checked="checked"'); ?> />Disable + <input type="hidden" name="cmd" value="update_exifiptc" /> + <input type="submit" name="name" value="update" /> + </form> + <br /><br /> + + <form action="./?cat=metadata_define_<?php echo $GLOBALS['cat3']; ?>" method="POST" onsubmit="selectAll()"> + <table border="0"> + <tr> + <td valign="top" rowspan="3" align="center"> + 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"; + } + ?> + </select> + <br /> + </td> + <td> + <input type="button" name="shiftleft" value="<" onclick="addElement()" /> + <br /> + <input type="button" name="shiftright" value=">" onclick="removeElement()" /> + </td> + <td valign="top"> + 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>'; + } + ?> + </select> + </td> + </tr> + </table> + <input type="hidden" name="cmd" value="create_exifiptc" /> + <input type="submit" name="name" value="Submit" /> + </form> + + </div> + + <script type="text/javascript"> + /** + * http://www.babailiica.com/js/sorter/ + */ + + function selectAll() + { + obj = document.getElementById('selected_fields'); + for (var i=0; i<obj.length; i++) { + obj[i].selected = true; + } + } + + function addElement () + { + obj_from = document.getElementById('all_fields'); + obj_to = document.getElementById('selected_fields'); + + moveElement(obj_from, obj_to); + } + + function removeElement () + { + obj_from = document.getElementById('selected_fields'); + obj_to = document.getElementById('all_fields'); + + moveElement(obj_from, obj_to); + } + + function moveElement(obj_from, obj_to) + { + if(obj_from.selectedIndex != -1) + { + old_index = obj_from.selectedIndex; + + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj_to.options[ obj_to.options.length] = NewEntry; + + obj_from.options[ obj_from.selectedIndex ] = null; + + /** + * set selectedIndex back to field above + */ + obj_to.selectedIndex = obj_to.length - 1; + + if( obj_from.selectedIndex == obj_from.length ) + { + obj_from.selectedIndex = obj_from.selectedIndex - 1; + } + else + { + obj_from.selectedIndex = old_index; + } + } + else + { + alert('nothing selected'); + } + } + + </script> + <?php +} + +?> \ No newline at end of file Copied: trunk/linpha2/admin/metadata_define_post.php (from rev 4634, trunk/linpha2/admin/image_fields_define_post.php) =================================================================== --- trunk/linpha2/admin/metadata_define_post.php (rev 0) +++ trunk/linpha2/admin/metadata_define_post.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -0,0 +1,107 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +switch($_POST['cmd']) +{ +case 'update_builtin': + + foreach($_POST['builtin'] AS $key=>$value) + { + if($value) { + $flag = 5; + } else { + $flag = 6; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + "flags = '".$flag."' ". + "WHERE id = '".linSql::linAddslashes($key)."'"); + } + + break; +case 'add_new': + /** + * check for duplicates with the same name + */ + $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, flags) " . + "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); + break; +case 'change_field': + + if(linSql::linAddslashes($_POST['builtin'][$_POST['id']])) { + $flag = 7; + } else { + $flag = 8; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "flags = '".$flag."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'delete': + ?> + <h3>Delete selected field</h3> + Really sure? all will be lost... + <form action="./?cat=metadata_define_own" method="POST"> + <input type="hidden" name="cmd" value="do_delete" /> + <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" /> + <input type="submit" name="delete" value="delete" /> + <a href="./?cat=metadata_define_own">Cancel</a> + </form> + <br /><br /> + <?php + break; +case 'do_delete': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'add_new_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . + "'".linSql::linAddslashes($_POST['field_id'])."'," . + "'".linSql::linAddslashes($_POST['new_name'])."'," . + "'".$isprivate."')"); + + break; +case 'mod_category': + if(isset($_POST['isprivate'])) { + $isprivate = 1; + } else { + $isprivate = 0; + } + + $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . + "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "isprivate = '".$isprivate."' ". + "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + + break; +case 'delete_category': + $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + break; +case 'update_exifiptc': + $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); + $linpha->sql->config->reloadConfig(); + break; +case 'create_exifiptc': + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + if( ! isset($_POST['selected_fields'])) + { + $_POST['selected_fields'] = Array(); + } + if($cat3 == 'exif') { + $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_exif"); + $linpha->db->Execute( Metadata::createExifTable( $_POST['selected_fields'] ) ); + } elseif($cat3 == 'iptc') { + $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_iptc"); + $linpha->db->Execute( Metadata::createIptcTable( $_POST['selected_fields'] ) ); + } + break; +} + + +?> \ No newline at end of file Copied: trunk/linpha2/admin/metadata_select.php (from rev 4634, trunk/linpha2/admin/image_fields_select.php) =================================================================== --- trunk/linpha2/admin/metadata_select.php (rev 0) +++ trunk/linpha2/admin/metadata_select.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -0,0 +1,327 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/** + * @package admin + * @subpackage metadata + * + * for a description of the table structure, flag nr etc. see in the developper wiki at + * http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + +if(!isset($cat3)) +{ + $cat3 = 'image'; +} + +$array_menu = Array( + 'image' => Array('name' => 'Image', 'link' => 'metadata_select_image'), + 'slideshow' => Array('name' => 'Slideshow', 'link' => 'metadata_select_slideshow'), + 'thumb' => Array('name' => 'Thumbnail', 'link' => 'metadata_select_thumb'), + 'thumbdetail' => Array('name' => 'Thumbnail Detail View', 'link' => 'metadata_select_thumbdetail'), + 'video' => Array('name' => 'Video', 'link' => 'metadata_select_video'), + 'album' => Array('name' => 'Album', 'link' => 'metadata_select_album') +); + +LinAdmin::printAdminMenu($array_menu,$cat3); + +switch($cat3) +{ +case 'image': + printFieldsTable(10); + break; +case 'slideshow': + printFieldsTable(15); + break; +case 'thumb': + printFieldsTable(13); + break; +case 'thumbdetail': + printFieldsTable(14); + break; +case 'video': + printFieldsTable(11); + break; +case 'album': + printFieldsTable(12); + break; +} + + + +function printFieldsTable($flag_nr) +{ + if(isset($_POST['cmd']) && $_POST['cmd']=='select_image_fields') + { + /** + * delete all existing entries in database + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."'"); + + /** + * write new entrys + */ + if(isset($_POST['select_image_fields'])) + { + foreach($_POST['select_image_fields'] AS $value) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . + " VALUES ('".linSql::linAddslashes($value)."','".$flag_nr."')"); + } + } + } + + /** + * set exif/iptc fields + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); +?> + <form name="form_image_fields" method="POST" onsubmit="selectAll()"> + <div align="center"> + <table border="0"> + <tr> + <td valign="top" rowspan="4" align="center"> + Selected fields<br /> + <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); + while($data = $query->FetchRow()) + { + echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; + } + ?> + </select> + <br /> + <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> + <input type="button" name="shift_down" value="v" onclick="movedownElement()" /> + <br /><br /> + <input type="button" name="remove" value="delete selected" onclick="deleteElement()" /> + <br /><br /> + <input type="text" name="title_name" value="" /><br /> + <input type="button" name="add_title" value="add title" onclick="addElement()" /> + </td> + <td> + <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('image_fields')" /> + </td> + <td> + Image fields (builtin)<br /> + <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + "WHERE flags = '1' OR flags = '5'"); + while($data = $query->FetchRow()) + { + echo '<option value="builtin_'.$data['name'].'">'.i18n( ucfirst( $data['name'] ) ).'</option>'; + } + ?> + </select> + </td> + </tr> + <tr> + <td> + <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> + </td> + <td> + Image fields (own) (<a href="./?cat=metadata_define_own">define</a>)<br /> + <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + "WHERE flags = '7'"); + while($data = $query->FetchRow()) + { + echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; + } + ?> + </select> + </td> + </tr> + <tr> + <td> + <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> + </td> + <td> + Exif fields (<a href="./?cat=metadata_define_exif">define</a>)<br /> + <?php + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $str_disabled = ''; + } else { + $str_disabled = ' disabled="disabled"'; + } + ?> + <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> + <?php + foreach($MetaData->defined_fields['exif'] AS $key=>$value) + { + echo '<option value="exif_'.$key.'">'.$value.'</option>'; + } + ?> + </select> + </td> + </tr> + <tr> + <td> + <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> + </td> + <td> + IPTC fields (<a href="./?cat=metadata_define_iptc">define</a>)<br /> + <?php + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $str_disabled = ''; + } else { + $str_disabled = ' disabled="disabled"'; + } + ?> + <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> + <?php + foreach($MetaData->defined_fields['iptc'] AS $key=>$value) + { + echo '<option value="iptc_'.$key.'">'.$value.'</option>'; + } + ?> + </select> + </td> + </tr> + </table> + <br /> + <input type="hidden" name="cmd" value="select_image_fields" /> + <input type="submit" name="submit" value="submit" /> + + </div> + </form> + + <script type="text/javascript"> + /** + * http://www.babailiica.com/js/sorter/ + */ + + function selectAll() + { + obj = document.getElementById('select_image_fields'); + for (var i=0; i<obj.length; i++) { + obj[i].selected = true; + } + } + + + function copyElement (coming_from) + { + obj_from = document.getElementById(coming_from); + obj = document.getElementById('select_image_fields'); + + NewEntry = new Option( obj_from.options[ obj_from.selectedIndex ].text, obj_from.options[ obj_from.selectedIndex ].value, false, true ); + obj.options[ obj.options.length ] = NewEntry; + + /** + * append ' (exif)' and ' (iptc)' + */ + if(coming_from=='exif_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; + } + if(coming_from=='iptc_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; + } + + + /** + * remove new selection on left side + */ + obj.options[ obj.options.length-1 ].selected = false; + } + + function addElement () + { + obj = document.getElementById('select_image_fields'); + + NewEntry = new Option( document.form_image_fields.title_name.value, document.form_image_fields.title_name.value, false, true ); + NewEntry.className = "linSelectOptionTitle"; + obj.options[obj.options.length] = NewEntry; + document.form_image_fields.title_name.value = ""; + } + + function deleteElement () + { + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; + obj.options[ current_index ] = null; + + /** + * set selectedIndex back to field above + */ + if( current_index == obj.length ) + { + obj.selectedIndex = current_index - 1; + } + else + { + obj.selectedIndex = current_index; + } + } + + function moveupElement () + { + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; + if( current_index != 0 ) + { + /** + * swap entries + */ + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; + + obj.options[ current_index ].value = obj.options[ current_index - 1].value; + obj.options[ current_index ].text = obj.options[ current_index - 1].text; + obj.options[ current_index ].className = obj.options[ current_index - 1].className; + + obj.options[ current_index - 1].value = tmp_value; + obj.options[ current_index - 1].text = tmp_text; + obj.options[ current_index - 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + obj.selectedIndex = current_index - 1; + } + } + + function movedownElement () + { + obj = document.getElementById('select_image_fields'); + + current_index = obj.selectedIndex; + + if( current_index != ( obj.length - 1 ) ) + { + /** + * swap entries + */ + tmp_value = obj.options[ current_index ].value; + tmp_text = obj.options[ current_index ].text; + tmp_class = obj.options[ current_index ].className; + + obj.options[ current_index ].value = obj.options[ current_index + 1].value; + obj.options[ current_index ].text = obj.options[ current_index + 1].text; + obj.options[ current_index ].className = obj.options[ current_index + 1].className; + + obj.options[ current_index + 1].value = tmp_value; + obj.options[ current_index + 1].text = tmp_text; + obj.options[ current_index + 1].className = tmp_class; + + /** + * set selectedIndex back to swapped field + */ + obj.selectedIndex = current_index + 1; + } + } + </script> +<?php +} +?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-10 18:49:05 UTC (rev 4637) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-10 19:24:29 UTC (rev 4638) @@ -182,19 +182,13 @@ /** * metadata + * see http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields for the definition */ /** - * special and builtin fields + * special fields + * flag_nr 1 */ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('description', 1, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('category', 2, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('persons', 2, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('date', 3, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('filename', 0, 1)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('imagesize', 0, 1)"; @@ -203,10 +197,38 @@ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('thumbnail', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('time_add', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('time_mod', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('time_exif', 0, 1)"; + + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('stats_numbers', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('stats_views', 0, 1)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('stats_downloads', 0, 1)"; + /** - * preselected fields for image info + * builtin fields + * flag_nr 5 (builtin enabled) */ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('description', 1, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('category', 2, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('persons', 2, 5)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('date', 3, 5)"; + + /** + * image fields + * flag_nr 10 + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_imagesize', 0, 10)"; @@ -219,12 +241,34 @@ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_persons', 0, 10)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 10)"; + "(name, field_type, flags) VALUES ('builtin_time_exif', 0, 10)"; /** - * preselected fields for thumbnails + * video fields + * flag_nr 11 */ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('??', 0, 11)"; + + /** + * album fields + * flag_nr 12 + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_filename', 0, 12)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_description', 0, 12)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; + + + /** + * thumbnails fields + * flag_nr 13 + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_thumbnail', 0, 13)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 13)"; @@ -232,7 +276,8 @@ "(name, field_type, flags) VALUES ('builtin_description', 0, 13)"; /** - * preselected fields for thumbnails in detail view + * thumbnails in detail view fields + * flag_nr 14 */ $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_thumbnail', 0, 14)"; @@ -246,6 +291,15 @@ "(name, field_type, flags) VALUES ('builtin_dimension', 0, 14)"; $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 14)"; - + + /** + * slideshow fields + * flag_nr 15 + */ + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_filename', 0, 15)"; + $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_description', 0, 15)"; + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-11 17:00:03
|
Revision: 4640 http://svn.sourceforge.net/linpha/?rev=4640&view=rev Author: fangehrn Date: 2006-11-11 08:59:12 -0800 (Sat, 11 Nov 2006) Log Message: ----------- 2006-11-11 flo * renamed: PREFIX -> LIN_PREFIX DB_TYPE -> LIN_DB_TYPE SELECT_FIELDS -> LIN_SELECT_FIELDS Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_db.php trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/admin/permissions_groups.php trunk/linpha2/admin/permissions_others.php trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/permissions_usergroup.php trunk/linpha2/admin/permissions_users.php trunk/linpha2/admin/settings_layout.php trunk/linpha2/install/manual_install.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/metadata_editor.php trunk/linpha2/lib/include/basket_build_mail.php trunk/linpha2/lib/include/upgrade.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/lib/modules/module.settings.php trunk/linpha2/reset_database.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/view_meta.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/ChangeLog 2006-11-11 16:59:12 UTC (rev 4640) @@ -1,3 +1,9 @@ +2006-11-11 flo + * renamed: + PREFIX -> LIN_PREFIX + DB_TYPE -> LIN_DB_TYPE + SELECT_FIELDS -> LIN_SELECT_FIELDS + 2006-11-10 flo * implemented thumbnail folder with gdlib but the quality is quite bad...why? Modified: trunk/linpha2/admin/maintenance_db.php =================================================================== --- trunk/linpha2/admin/maintenance_db.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/maintenance_db.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -6,14 +6,14 @@ echo '<h2>'.i18n("Checking photos table").'</h2>'; echo '('.i18n("Checking intern consistency of the photos table. This means every entry must belong to a folder.").')<br /><br />'; - $query = $GLOBALS['linpha']->db->Execute("SELECT id, parent_id, name FROM ".PREFIX."photos"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, parent_id, name FROM ".LIN_PREFIX."photos"); $i = 0; $i_tot = 0; while($data = $query->FetchRow()) { if($data['parent_id'] != 0) { - $query2 = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos " . + $query2 = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($data['parent_id'])."'"); $data2 = $query2->FetchRow(); if( isset($data2['id'])) @@ -46,10 +46,10 @@ echo '<h3>'.i18n("Do all cache entries exists in the photos table?").'</h3>'; - $query = $GLOBALS['linpha']->db->Execute("SELECT ".PREFIX."photos_cache.id, ".PREFIX."photos_cache.photo_id" . - " FROM ".PREFIX."photos_cache". - " LEFT OUTER JOIN ".PREFIX."photos ON ".PREFIX."photos.id = ".PREFIX."photos_cache.photo_id". - " WHERE ".PREFIX."photos.id IS NULL"); + $query = $GLOBALS['linpha']->db->Execute("SELECT ".LIN_PREFIX."photos_cache.id, ".LIN_PREFIX."photos_cache.photo_id" . + " FROM ".LIN_PREFIX."photos_cache". + " LEFT OUTER JOIN ".LIN_PREFIX."photos ON ".LIN_PREFIX."photos.id = ".LIN_PREFIX."photos_cache.photo_id". + " WHERE ".LIN_PREFIX."photos.id IS NULL"); if( $query->EOF ) { @@ -67,7 +67,7 @@ echo '<h3>'.i18n("Do all cache entries exists in the filesystem?").'</h3>'; - $query = $GLOBALS['linpha']->db->Execute("SELECT id, photo_id FROM ".PREFIX."photos_cache"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, photo_id FROM ".LIN_PREFIX."photos_cache"); $i = 0; $i_tot = 0; while($data = $query->FetchRow() ) @@ -125,7 +125,7 @@ } else { - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos_cache WHERE " . + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE " . "id = '".LinSql::linAddslashes( LinFilesys::getFilenameWithoutFileExt($sub_file) )."'"); $data = $query->FetchRow(); @@ -176,7 +176,7 @@ } else { - $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."photos WHERE " . + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".LIN_PREFIX."photos WHERE " . "id = '".LinSql::linAddslashes( $filename_without_ext )."'"); $data = $query->FetchRow(); @@ -207,10 +207,10 @@ $array_meta = array('comments','data','exif','iptc'/*,'xmp'*/); foreach($array_meta AS $value) { - echo i18n("Checking table").' '.PREFIX."meta_".$value.' '; - $query = $GLOBALS['linpha']->db->Execute("SELECT ".PREFIX."meta_".$value.".md5sum FROM ".PREFIX."meta_".$value. - " LEFT OUTER JOIN ".PREFIX."photos ON ".PREFIX."photos.md5sum = ".PREFIX."meta_".$value.".md5sum". - " WHERE ".PREFIX."photos.id IS NULL"); + echo i18n("Checking table").' '.LIN_PREFIX."meta_".$value.' '; + $query = $GLOBALS['linpha']->db->Execute("SELECT ".LIN_PREFIX."meta_".$value.".md5sum FROM ".LIN_PREFIX."meta_".$value. + " LEFT OUTER JOIN ".LIN_PREFIX."photos ON ".LIN_PREFIX."photos.md5sum = ".LIN_PREFIX."meta_".$value.".md5sum". + " WHERE ".LIN_PREFIX."photos.id IS NULL"); if( $query->EOF ) { @@ -249,7 +249,7 @@ foreach($array_perms AS $value) { - $query = $GLOBALS['linpha']->db->Execute("SELECT permission FROM ".PREFIX."permissions " . + $query = $GLOBALS['linpha']->db->Execute("SELECT permission FROM ".LIN_PREFIX."permissions " . "WHERE photos_id = '0' AND perm_type = '".$value."'"); $data = $query->FetchRow(); @@ -286,7 +286,7 @@ include(LINPHA_DIR.'/install/sql/sql.data.php'); foreach($options AS $key=>$value) { - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."config " . + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."config " . "WHERE option_name = '".$key."'"); $data = $query->FetchRow(); Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/maintenance_import.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -62,7 +62,7 @@ { foreach($_REQUEST['album_select'] AS $key=>$value) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; LinImport::updateDir( $parent_id = $value, $recursive = true, $dryrun = false ); } @@ -126,7 +126,7 @@ if($_REQUEST['index_thumbnails']!='no') { echo '<h3>'.i18n("Parsing All Directories...").'</h3><br />'; - $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); } } else // $all_albums == false -> not all directory selected @@ -136,10 +136,10 @@ */ foreach($_REQUEST['album_select'] AS $key=>$value) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; - $sql = "SELECT id FROM ".PREFIX."photos WHERE " . + $sql = "SELECT id FROM ".LIN_PREFIX."photos WHERE " . "parent_id = '".LinSql::linAddslashes($value)."' AND " . "img_type <> 0 AND img_type <> 9999999"; @@ -217,7 +217,7 @@ { echo i18n("All Directories selected").'<br />'; - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); while($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; @@ -228,10 +228,10 @@ echo i18n("Directory selected:").' '; foreach($_REQUEST['album_select'] AS $key=>$value) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo $data['name'].', '; - $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".PREFIX."photos WHERE " . + $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " . "parent_id = '".LinSql::linAddslashes($value)."' AND " . "img_type <> 0 AND img_type <> 9999999"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) @@ -250,14 +250,14 @@ if( $all_albums ) { echo i18n("Delete all index data").'<br />'; - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value); } elseif( isset($array_meta_ids) ) { echo i18n("Delete index data of selected directories").'<br />'; foreach($array_meta_ids AS $id=>$md5sum) { - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); } } } @@ -274,7 +274,7 @@ foreach($array_meta_ids AS $id=>$md5sum) { $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); + "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); if( $query->EOF) // not a single value returned { @@ -392,7 +392,7 @@ $thumbnail = new LinImage(); $num = 0; - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { @@ -413,12 +413,12 @@ * * nr images to index: (nr_total - nr_indexed) */ - $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); + $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".LIN_PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); foreach($array_meta AS $value) { if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { - $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".PREFIX."meta_".$value); + $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".LIN_PREFIX."meta_".$value); echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total[0] - $nr_indexed[0]) .' <br />'; } Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/metadata_define.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -65,7 +65,7 @@ * get builtin fields */ $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . - "FROM ".PREFIX."meta_fields " . + "FROM ".LIN_PREFIX."meta_fields " . "WHERE flags = '5' OR flags = '6' "); while($data = $query->FetchRow()) @@ -122,7 +122,7 @@ * get own fields */ $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . - "FROM ".PREFIX."meta_fields " . + "FROM ".LIN_PREFIX."meta_fields " . "WHERE flags = '7' " . "OR flags = '8'"); @@ -187,7 +187,7 @@ function show_add_data() { - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."meta_fields WHERE field_type = '2'"); while($data = $query->FetchRow()) { ?> @@ -200,7 +200,7 @@ <td> </td> </tr> <?php - $query2 = $GLOBALS['linpha']->db->Execute("SELECT id, name, isprivate FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'"); + $query2 = $GLOBALS['linpha']->db->Execute("SELECT id, name, isprivate FROM ".LIN_PREFIX."meta_category WHERE field_id = '".$data['id']."'"); while($data2 = $query2->FetchRow()) { ?> Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/metadata_define_post.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -13,7 +13,7 @@ $flag = 6; } - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . "flags = '".$flag."' ". "WHERE id = '".linSql::linAddslashes($key)."'"); } @@ -23,7 +23,7 @@ /** * check for duplicates with the same name */ - $linpha->db->Execute("INSERT into ".PREFIX."meta_fields (name, field_type, flags) " . + $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, field_type, flags) " . "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); break; case 'change_field': @@ -34,7 +34,7 @@ $flag = 8; } - $linpha->db->Execute("UPDATE ".PREFIX."meta_fields SET " . + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . "name = '".linSql::linAddslashes($_POST['new_name'])."', ". "flags = '".$flag."' ". "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); @@ -53,7 +53,7 @@ <?php break; case 'do_delete': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); break; case 'add_new_category': if(isset($_POST['isprivate'])) { @@ -61,7 +61,7 @@ } else { $isprivate = 0; } - $linpha->db->Execute("INSERT into ".PREFIX."meta_category (field_id, name, isprivate) VALUES (" . + $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_category (field_id, name, isprivate) VALUES (" . "'".linSql::linAddslashes($_POST['field_id'])."'," . "'".linSql::linAddslashes($_POST['new_name'])."'," . "'".$isprivate."')"); @@ -74,14 +74,14 @@ $isprivate = 0; } - $linpha->db->Execute("UPDATE ".PREFIX."meta_category SET " . + $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_category SET " . "name = '".linSql::linAddslashes($_POST['new_name'])."', ". "isprivate = '".$isprivate."' ". "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); break; case 'delete_category': - $linpha->db->Execute("DELETE FROM ".PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); break; case 'update_exifiptc': $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); @@ -94,10 +94,10 @@ $_POST['selected_fields'] = Array(); } if($cat3 == 'exif') { - $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_exif"); + $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_exif"); $linpha->db->Execute( Metadata::createExifTable( $_POST['selected_fields'] ) ); } elseif($cat3 == 'iptc') { - $linpha->db->Execute("DROP TABLE IF EXISTS ".PREFIX."meta_iptc"); + $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_iptc"); $linpha->db->Execute( Metadata::createIptcTable( $_POST['selected_fields'] ) ); } break; Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/metadata_select.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -56,7 +56,7 @@ /** * delete all existing entries in database */ - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."'"); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE flags = '".$flag_nr."'"); /** * write new entrys @@ -65,7 +65,7 @@ { foreach($_POST['select_image_fields'] AS $value) { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, flags)" . + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, flags)" . " VALUES ('".linSql::linAddslashes($value)."','".$flag_nr."')"); } } @@ -87,7 +87,7 @@ Selected fields<br /> <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."meta_fields WHERE flags = '".$flag_nr."' ORDER by id"); while($data = $query->FetchRow()) { echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; @@ -110,7 +110,7 @@ Image fields (builtin)<br /> <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."meta_fields " . "WHERE flags = '1' OR flags = '5'"); while($data = $query->FetchRow()) { @@ -128,7 +128,7 @@ Image fields (own) (<a href="./?cat=metadata_define_own">define</a>)<br /> <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."meta_fields " . "WHERE flags = '7'"); while($data = $query->FetchRow()) { Modified: trunk/linpha2/admin/permissions_groups.php =================================================================== --- trunk/linpha2/admin/permissions_groups.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/permissions_groups.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -16,7 +16,7 @@ { case 'ren_group': case 'del_group': - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."groups WHERE group_name = 'admin'"); $admingroup_id = $data['id']; if($_POST['id'] == $admingroup_id) { @@ -40,7 +40,7 @@ /** * check if group already exists */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."groups " . "WHERE group_name = '".LinSql::linAddslashes($_POST['group_name'])."'"); if(isset($data['id'])) { @@ -55,18 +55,18 @@ switch($_POST['cmd']) { case 'ren_group': - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."groups " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."groups " . "SET group_name='".LinSql::linAddslashes($_POST['group_name'])."' " . "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); linSysLog(i18n("Group Renamed")); break; case 'del_group': - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."groups ". + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."groups ". "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); linSysLog(i18n("Group Deleted")); break; case 'new_group': - $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."groups (group_name) ". + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."groups (group_name) ". "VALUES ('".LinSql::linAddslashes($_POST['group_name'])."')"); linSysLog(i18n("Group Created")); break; @@ -84,7 +84,7 @@ <td><b><?php echo i18n("Actions"); ?></b></td> </tr> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER BY group_name"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups ORDER BY group_name"); while($data = $query->FetchRow()) { ?> Modified: trunk/linpha2/admin/permissions_others.php =================================================================== --- trunk/linpha2/admin/permissions_others.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/permissions_others.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -51,7 +51,7 @@ { if($_POST['allowall'] == 'allowall') { - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."permissions " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."permissions " . "SET permission = ';public;' " . "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); } @@ -66,7 +66,7 @@ $str = ';'.implode(';',$_POST['groups']).';'; } - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."permissions " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."permissions " . "SET permission = '".LinSql::linAddslashes($str)."' " . "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); } @@ -75,7 +75,7 @@ echo '<b>'.i18n("Edit").': '.i18n($array_menu[$cat3]['name']).'</b><br />'; - $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".PREFIX."permissions " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".LIN_PREFIX."permissions " . "WHERE perm_type = '".LinSql::linAddslashes($key)."'"); $array_permissions = linExplodeAndSlice(';',$data['permission']); @@ -101,7 +101,7 @@ <select id="selectgroups" name="groups[]" size="5" style="width: 200;" multiple="multiple"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups ORDER by group_name"); while($data = $query->FetchRow()) { if(in_array($data['id'],$array_permissions)) Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/permissions_readwrite.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -43,7 +43,7 @@ /** * insert or update */ - $query = $linpha->db->Execute("SELECT id FROM ".PREFIX."permissions " . + $query = $linpha->db->Execute("SELECT id FROM ".LIN_PREFIX."permissions " . "WHERE photos_id = '".LinSql::linAddslashes($_POST['photo_id'])."' AND perm_type = '".$sql_perm_type."'"); /** @@ -55,7 +55,7 @@ { if( ! $query->EOF && $_POST['photo_id'] != 0) { - $linpha->db->Execute("DELETE FROM ".PREFIX."permissions " . + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."permissions " . "WHERE photos_id = '".LinSql::linAddslashes($_POST['photo_id'])."' " . "AND perm_type = '".$sql_perm_type."'"); } @@ -84,12 +84,12 @@ if( ! $query->EOF ) { - $linpha->db->Execute("UPDATE ".PREFIX."permissions SET permission = ';".LinSql::linAddslashes($str_groups).";' " . + $linpha->db->Execute("UPDATE ".LIN_PREFIX."permissions SET permission = ';".LinSql::linAddslashes($str_groups).";' " . "WHERE photos_id = '".LinSql::linAddslashes($_POST['photo_id'])."' AND perm_type = '".$sql_perm_type."'"); } else { - $linpha->db->Execute("INSERT into ".PREFIX."permissions (photos_id, perm_type, permission) VALUES (" . + $linpha->db->Execute("INSERT into ".LIN_PREFIX."permissions (photos_id, perm_type, permission) VALUES (" . "'".LinSql::linAddslashes($_POST['photo_id'])."', '".$sql_perm_type."'," . "';".LinSql::linAddslashes($str_groups).";' )"); } @@ -121,7 +121,7 @@ * get groups */ $array_groups = Array(); - $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups WHERE group_name <> 'admin'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups WHERE group_name <> 'admin'"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { $array_groups[$data[0]] = $data[1]; @@ -138,7 +138,7 @@ /** * check wether add or edit (insert or update) */ - $query = $linpha->db->Execute("SELECT id FROM ".PREFIX."permissions " . + $query = $linpha->db->Execute("SELECT id FROM ".LIN_PREFIX."permissions " . "WHERE photos_id = '".LinSql::linAddslashes($linpha->template->idCurrent)."' AND perm_type = '".$sql_perm_type."'"); if( ! $query->EOF ) @@ -152,7 +152,7 @@ } } - $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."photos " . + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); $data = $query->FetchRow(ADODB_FETCH_NUM); ?> @@ -239,7 +239,7 @@ */ function printDirPermsEntry( $parent_id , $recursive , $stage) { - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, img_type FROM ".PREFIX."photos WHERE parent_id = '".$parent_id."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, img_type FROM ".LIN_PREFIX."photos WHERE parent_id = '".$parent_id."'"); while( $data = $query->FetchRow() ) { list($i, $perm) = $GLOBALS['linpha']->sql->getPerm( $data['id'], $GLOBALS['sql_perm_type'] ); Modified: trunk/linpha2/admin/permissions_usergroup.php =================================================================== --- trunk/linpha2/admin/permissions_usergroup.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/permissions_usergroup.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -5,7 +5,7 @@ * get groups */ echo '<b>'.i18n("Edit Group Members").'</b><br />'; -$query = $linpha->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); +$query = $linpha->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups ORDER by group_name"); while($data = $query->FetchRow()) { echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=group&linId='.$data['id'].'">'.$data['group_name'].'</a><br />'; @@ -17,7 +17,7 @@ * get users */ echo '<b>'.i18n("Edit User Memberships").'</b><br />'; -$query = $linpha->db->Execute("SELECT id, username FROM ".PREFIX."users ORDER by username"); +$query = $linpha->db->Execute("SELECT id, username FROM ".LIN_PREFIX."users ORDER by username"); while($data = $query->FetchRow()) { echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&linId='.$data['id'].'">'.$data['username'].'</a><br />'; @@ -59,7 +59,7 @@ /** * delete all entries of current user */ - $linpha->db->Execute("DELETE FROM ".PREFIX."user_group WHERE ".$column_name." = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."user_group WHERE ".$column_name." = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); /** * add new entries if exists @@ -78,7 +78,7 @@ $userid = LinSql::linAddslashes($linpha->template->idCurrent); $groupid = LinSql::linAddslashes($value); } - $linpha->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$groupid."')"); + $linpha->db->Execute("INSERT into ".LIN_PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$groupid."')"); } } } @@ -86,7 +86,7 @@ /** * get informations */ - $data = $linpha->db->GetRow("SELECT ".$select_name." FROM ".PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + $data = $linpha->db->GetRow("SELECT ".$select_name." FROM ".LIN_PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); echo '<b>'; if($_GET['edit']=='user') { @@ -106,7 +106,7 @@ <select name="usergroup[]" size="5" style="width: 200;" multiple="multiple"> <?php $query = $linpha->db->Execute("SELECT id, ".$other_select_name." " . - "FROM ".PREFIX.$other_table_name." " . + "FROM ".LIN_PREFIX.$other_table_name." " . "ORDER by ".$other_select_name); while($data = $query->FetchRow()) { @@ -123,7 +123,7 @@ $userid = LinSql::linAddslashes($linpha->template->idCurrent); $groupid = $data['id']; } - $data2 = $linpha->db->GetRow("SELECT id FROM ".PREFIX."user_group " . + $data2 = $linpha->db->GetRow("SELECT id FROM ".LIN_PREFIX."user_group " . "WHERE user_id = '".$userid."' " . "AND group_id = '".$groupid."'"); if(isset($data2['id'])) Modified: trunk/linpha2/admin/permissions_users.php =================================================================== --- trunk/linpha2/admin/permissions_users.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/permissions_users.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -27,7 +27,7 @@ */ if( $_POST['old_user_name'] != $_POST['mod_user_name'] ) { - $query = $GLOBALS['linpha']->db->Execute("SELECT username FROM ".PREFIX."users " . + $query = $GLOBALS['linpha']->db->Execute("SELECT username FROM ".LIN_PREFIX."users " . "WHERE username = '".LinSql::linAddslashes($_POST['mod_user_name'])."'"); if( ! $query->EOF ) { @@ -56,7 +56,7 @@ $sql_str_new_password = "password='".$md5_pass."', "; } - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."users SET ". + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."users SET ". "username='".LinSql::linAddslashes($_POST['mod_user_name'])."', ". "display_name='".LinSql::linAddslashes($_POST['mod_user_fullname'])."', ". $sql_str_new_password. @@ -84,7 +84,7 @@ break; case 'del_user': - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."users WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."users WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); break; case 'new_user': @@ -99,7 +99,7 @@ /** * check if username already exists */ - $query = $GLOBALS['linpha']->db->Execute("SELECT username FROM ".PREFIX."users " . + $query = $GLOBALS['linpha']->db->Execute("SELECT username FROM ".LIN_PREFIX."users " . "WHERE username = '".LinSql::linAddslashes($_POST['new_user_name'])."'"); if( ! $query->EOF ) { @@ -114,7 +114,7 @@ throw new Exception(i18n("Password To Short")); } - $GLOBALS['linpha']->db->Execute("INSERT INTO ".PREFIX."users " . + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."users " . "(username, password, user_email, display_name) ". "VALUES " . "('".LinSql::linAddslashes($_POST['new_user_name'])."', '".md5($_POST['new_user_pass'])."', ". @@ -140,7 +140,7 @@ /** * show users */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, username, display_name, user_email FROM ".PREFIX."users ORDER BY username"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, username, display_name, user_email FROM ".LIN_PREFIX."users ORDER BY username"); while($data = $query->FetchRow()) { ?> Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/admin/settings_layout.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -128,7 +128,7 @@ break; case 'home': $welcometxt = i18n("Add Your Own Welcome Text Here"); - $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".PREFIX."meta_comments WHERE md5sum='welcometext'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); if(isset($data['meta_comment'])) { $welcometxt = $data['meta_comment']; @@ -154,14 +154,14 @@ */ if(isset($update)) { - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET " . "meta_comment = '".LinSql::linAddslashes($_POST['welcometext'])."'" . "WHERE md5sum='welcometext'"); $welcometxt = $_POST['welcometext']; } else { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (md5sum, meta_comment) " . + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (md5sum, meta_comment) " . "VALUES ('welcometext', '".LinSql::linAddslashes($_POST['welcometext'])."')"); $welcometxt = $_POST['welcometext']; } Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/install/manual_install.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -60,8 +60,8 @@ $_SESSION['sql_dbname'] = "linpha"; - define('PREFIX', $_SESSION['sql_prefix']); - define('DB_TYPE', $_SESSION['sql_dbtype']); + define('LIN_PREFIX', $_SESSION['sql_prefix']); + define('LIN_DB_TYPE', $_SESSION['sql_dbtype']); @@ -86,13 +86,13 @@ include_once(LINPHA_DIR.'/install/sql/sql.tables.php'); foreach($linpha_tables AS $key=>$value) { - $linpha_tables[$key] = PREFIX.$value; + $linpha_tables[$key] = LIN_PREFIX.$value; } /** * include sql strings */ - include_once(LINPHA_DIR."/install/sql/sql.".DB_TYPE.".php"); + include_once(LINPHA_DIR."/install/sql/sql.".LIN_DB_TYPE.".php"); /** * finally create tables Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -143,41 +143,41 @@ } else { $override = 0; } - $sql_queries[] = "INSERT INTO ".PREFIX."config (option_name, option_value, override, user_id) " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . "VALUES ('".$name."', '".$value."', '".$override."', '0')"; } /** * groups */ -$sql_queries[] = "INSERT INTO ".PREFIX."groups (group_name) VALUES ('admin')"; +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."groups (group_name) VALUES ('admin')"; /** * permissions */ -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (photos_id, perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (photos_id, perm_type, permission) " . "VALUES (0, 'read', ';public;')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (photos_id, perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (photos_id, perm_type, permission) " . "VALUES (0, 'write', ';;')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('basket_print', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('basket_mail', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('basket_download', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('metadata_comments', ';public;')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('metadata_deletecomments', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('metadata_edit', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('watermark', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('stats', '')"; -$sql_queries[] = "INSERT INTO ".PREFIX."permissions (perm_type, permission) " . +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('download', '')"; /** @@ -188,63 +188,63 @@ * special fields * flag_nr 1 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('filename', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('imagesize', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('dimension', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('thumbnail', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('time_add', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('time_mod', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('time_exif', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('stats_numbers', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('stats_views', 0, 1)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('stats_downloads', 0, 1)"; /** * builtin fields * flag_nr 5 (builtin enabled) */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('description', 1, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('category', 2, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('persons', 2, 5)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('date', 3, 5)"; /** * image fields * flag_nr 10 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_imagesize', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_dimension', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_category', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_persons', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_time_exif', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_stats_views', 0, 10)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_stats_downloads', 0, 10)"; @@ -252,20 +252,20 @@ * video fields * flag_nr 11 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('??', 0, 11)"; /** * album fields * flag_nr 12 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 12)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 12)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; @@ -273,37 +273,37 @@ * thumbnails fields * flag_nr 13 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_thumbnail', 0, 13)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 13)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 13)"; /** * thumbnails in detail view fields * flag_nr 14 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_thumbnail', 0, 14)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 14)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 14)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_imagesize', 0, 14)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_dimension', 0, 14)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('exif_datetimeoriginal', 0, 14)"; /** * slideshow fields * flag_nr 15 */ - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_filename', 0, 15)"; - $sql_queries[] = "INSERT INTO ".PREFIX."meta_fields " . + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 15)"; ?> Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/install/step10_postsettings.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -81,7 +81,7 @@ <?php -$query = $linpha->db->Execute("SELECT option_value FROM ".PREFIX."config " . +$query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); $data = $query->FetchRow(ADODB_FETCH_NUM); Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/install/step11_finish.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -55,7 +55,7 @@ } echo "Adding linpha admin user... "; - $result = $linpha->db->Execute("INSERT INTO ".PREFIX."users (username, password, user_email) VALUES (" . + $result = $linpha->db->Execute("INSERT INTO ".LIN_PREFIX."users (username, password, user_email) VALUES (" . "'".LinSql::linAddslashes($_POST['admin_name'])."', " . "'".md5($_POST['admin_pass'])."', " . "'".LinSql::linAddslashes($_POST['admin_email'])."')"); @@ -63,18 +63,18 @@ { echo failed_msg(); } else { - $userid = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) FROM ".PREFIX."users "); + $userid = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) FROM ".LIN_PREFIX."users "); /** * fails for pg */ - //$userid = $GLOBALS['linpha']->db->PO_Insert_ID(PREFIX."users", "id"); + //$userid = $GLOBALS['linpha']->db->PO_Insert_ID(LIN_PREFIX."users", "id"); /** * adding user to group 'admin' */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."groups WHERE group_name = 'admin'"); - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid['id']."','".$data['id']."')"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."groups WHERE group_name = 'admin'"); + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."user_group (user_id, group_id) VALUES ('".$userid['id']."','".$data['id']."')"); echo success_msg(); } @@ -85,14 +85,14 @@ echo "<br />".tr("Saving Thumbnail Size To Database")."... "; if( isset( $_POST['sys_style_tn_size'] ) ) { - $result = $linpha->db->Execute("UPDATE ".PREFIX."config " . + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . "SET option_value = '".LinSql::linAddslashes($_POST['sys_style_tn_size'])."' " . "WHERE option_name = 'sys_style_thumb_size_max'"); if(!$result) { echo failed_msg(); } else { - $result = $linpha->db->Execute("UPDATE ".PREFIX."config " . + $result = $linpha->db->Execute("UPDATE ".LIN_PREFIX."config " . "SET option_value = '".LinSql::linAddslashes($_POST['sys_style_tn_size'])."' " . "WHERE option_name = 'sys_style_thumb_size_display'"); echo success_msg(); Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/install/step9_createtables.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -46,13 +46,13 @@ include_once(LINPHA_DIR.'/install/sql/sql.tables.php'); foreach($linpha_tables AS $key=>$value) { - $linpha_tables[$key] = PREFIX.$value; + $linpha_tables[$key] = LIN_PREFIX.$value; } /** * include sql strings */ - include_once(LINPHA_DIR."/install/sql/sql.".DB_TYPE.".php"); + include_once(LINPHA_DIR."/install/sql/sql.".LIN_DB_TYPE.".php"); /** * finally create tables @@ -65,7 +65,7 @@ $result = $linpha->db->Execute($query); if(!$result) { - echo PREFIX.$translation_array[$key].' '; + echo LIN_PREFIX.$translation_array[$key].' '; echo failed_msg(); echo ' '.$linpha->db->ErrorMsg().'<br />'; $error_nr = 1; Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -37,7 +37,7 @@ /** * get system option names and values and save in array for easier access */ - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); while($data = $query->FetchRow()) { $this->options[] = $data['option_name']; @@ -209,7 +209,7 @@ /** * update system config array, used in admin/settings*.php */ - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); while($data = $query->FetchRow()) { $this->option_value_system[$data['option_name']] = $data['option_value']; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -284,7 +284,7 @@ function linBuildAlbumSelectSubEntry($id,$text) { - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); while($data = $query->FetchRow()) { if(!isset($_REQUEST['album_select'])) { Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -54,7 +54,7 @@ * and get img_type and rotate informations */ $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type, rotate, width, height " . - "FROM ".PREFIX."photos " . + "FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes( $this->photo_id )."'"); if( $query->EOF ) // not a single value returned @@ -220,7 +220,7 @@ /** * check if entry in linpha_photos_cache exists */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."photos_cache WHERE " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE " . "photo_id = '".$this->photo_id."' AND " . "img_width = '".$this->img_width."' AND " . "img_height = '".$this->img_height."' AND " . @@ -239,11 +239,11 @@ * insert an empty entry and get cached_id * we will update correct values only if create cached image has been successfull */ - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."photos_cache " . + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."photos_cache " . "(photo_id) VALUES ('".$this->photo_id."')"); $this->cached_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) " . - "FROM ".PREFIX."photos_cache "); + "FROM ".LIN_PREFIX."photos_cache "); $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); if(file_exists($this->output_file)) @@ -359,7 +359,7 @@ * check if we have already some thumbnails in this folder * and create array_ids which holds 4 image ids */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id, img_type FROM ".LIN_PREFIX."photos WHERE parent_id = '".LinSql::linAddslashes( $this->photo_id )."'"); $array_thumbs = Array(); $i=0; while($data = $query->FetchRow()) @@ -457,7 +457,7 @@ return false; } - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos_cache SET " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache SET " . "img_width = '".$this->img_width."', " . "img_height = '".$this->img_height."', " . "img_quality = '".$this->img_quality."', " . @@ -473,7 +473,7 @@ /** * got a cached copy, increment counter and time_use */ - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos_cache " . + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache " . "SET hits = hits + 1, time_use = '".time()."' " . "WHERE id = '".$this->cached_id."'"); } @@ -552,7 +552,7 @@ */ function deleteCachedImage($id,$img_type) { - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos_cache WHERE photo_id = '".$id."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE photo_id = '".$id."'"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { $output = LinImage::getCachePath('img',$data[0],$img_type); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-10 19:29:08 UTC (rev 4639) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-11 16:59:12 UTC (rev 4640) @@ -24,11 +24,11 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -define('SELECT_FIELDS',PREFIX."photos.id AS id, ".PREFIX."photos.name AS name, " . - "".PREFIX."photos.img_type AS img_type, ".PREFIX."photos.md5sum AS md5sum, " . - "".PREFIX."photos.width AS width, ".PREFIX."photos.height AS height, " . - "".PREFIX."photos.stats_numbers AS stats_numbers, " . - "".PREFIX."photos.time_add AS time_add"); +define('LIN_SELECT_FIELDS',LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . + "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . + "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . + "".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . + "".LIN_PREFIX."photos.time_add AS time_add"); class LinImgview { @@ -85,7 +85,7 @@ /** * set file informations */ - $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".PREFIX."photos " . + $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . "WHERE id = '".linSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); /** * check for valid id @@ -893,7 +893,7 @@ } else { - $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".PREFIX."meta_comments WHERE md5sum='welcometext'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); if(isset($data['meta_comment'])) { $GLOBALS['linpha']->template->output['welcome'] = $data['meta_comment']; @@ -923,7 +923,7 @@ $GLOBALS['linpha']->template->output['browse_by_date'] = ''; $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . - "FROM ".PREFIX."meta_exif"); + "FROM ".LIN_PREFIX."meta_exif"); if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) { /** @@ -942,7 +942,7 @@ */ if($i > 1900) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); if($data[0]>0) { $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; @@ -962,7 +962,7 @@ if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) { - switch(DB_TYPE) + switch(LIN_DB_TYPE) { case 'mysql': $str_random = 'rand()'; @@ -979,7 +979,7 @@ } $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); for($i = 1; $i <= $nr_images ; ) { @@ -1035,18 +1035,18 @@ * */ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . - "FROM ".PREFIX."meta_comments " . + "FROM ".LIN_PREFIX."meta_comments " . "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); if( $query->EOF ) { - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . "VALUES ('".time()."','".$GLOBALS['linpha']->template->idCurrent."','".linSql::linAddslashes($_POST['author'])."'," . "'".linSql::linAddslashes($_POST['comment'])."')"); } else // update { - $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."meta_comments SET ". + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". "meta_time = '".time()."', ". "meta_author = '".linSql::linAddslashes($_POST['author'])."', " . "meta_comment = '".linSql::linAddslashes($_POST['comment'])."' " . @@ -1057,7 +1057,7 @@ /** * get data */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id, meta_time, meta_author, meta_comment FROM ".PREFIX."meta_comments"); + $data = $GLOBALS['linpha']->db->GetRow("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments"); if(isset($data['meta_author'])) { $GLOBALS['linpha']->template->output[... [truncated message content] |
From: <fan...@us...> - 2006-11-11 18:39:57
|
Revision: 4641 http://svn.sourceforge.net/linpha/?rev=4641&view=rev Author: fangehrn Date: 2006-11-11 10:39:48 -0800 (Sat, 11 Nov 2006) Log Message: ----------- * some minor changes with the metadata stuff Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-11 16:59:12 UTC (rev 4640) +++ trunk/linpha2/ChangeLog 2006-11-11 18:39:48 UTC (rev 4641) @@ -3,6 +3,7 @@ PREFIX -> LIN_PREFIX DB_TYPE -> LIN_DB_TYPE SELECT_FIELDS -> LIN_SELECT_FIELDS + * some minor changes with the metadata stuff 2006-11-10 flo * implemented thumbnail folder with gdlib Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2006-11-11 16:59:12 UTC (rev 4640) +++ trunk/linpha2/admin/metadata_define.php 2006-11-11 18:39:48 UTC (rev 4641) @@ -42,7 +42,16 @@ show_add_data(); break; case 'exif': + echo i18n("The exif data are normally automatically created by the digital camera. These values may not be edited whitin LinPHA."); + echo '<br /><br />'; + echo i18n("You probably may not choose all exif tags, because the database table would get to big."); + echo '<br /><br /><br />'; + show_exif_iptc(); + break; case 'iptc': +case 'xmp': + echo i18n("The iptc/xmp data are normally not created by default. They need to be filled in within LinPHA or with an external program like photoshop. The iptc/xmp tags are very common in the photographer industry."); + echo '<br /><br />'; show_exif_iptc(); break; } @@ -194,8 +203,8 @@ <h3><?php echo $data['name']; ?></h3> <table border="0"> <tr> - <td width="170"><b>Name</b></td> - <td width="150"><b>Private</b></td> + <td width="170"><b><?php echo i18n("Name"); ?></b></td> + <td width="150"><b><?php echo i18n("Private"); echo ' <span title="'.i18n("not visible in the search page by the normal user").'">(Info)</span>'; ?></b></td> <td><b>Commands</b></td> <td> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-12 18:26:22
|
Revision: 4644 http://svn.sourceforge.net/linpha/?rev=4644&view=rev Author: fangehrn Date: 2006-11-12 10:26:04 -0800 (Sun, 12 Nov 2006) Log Message: ----------- 2006-11-12 flo * changed upload behaviour: only images and videos allowed to be uploaded if you have a public upload folder, its dangerous if the user may upload own php files! but: we will need to make an option which file types are allowed, its also dangerous to upload videos because there are security holes in the video players! Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.filemanager.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-12 16:57:30 UTC (rev 4643) +++ trunk/linpha2/ChangeLog 2006-11-12 18:26:04 UTC (rev 4644) @@ -1,3 +1,9 @@ +2006-11-12 flo + * changed upload behaviour: only images and videos allowed to be uploaded + if you have a public upload folder, its dangerous if the user may upload own php files! + but: we will need to make an option which file types are allowed, + its also dangerous to upload videos because there are security holes in the video players! + 2006-11-11 flo * renamed: PREFIX -> LIN_PREFIX Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-12 16:57:30 UTC (rev 4643) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-12 18:26:04 UTC (rev 4644) @@ -134,7 +134,7 @@ ); /** - * create sql executes + * create sql executes for all option entries */ while( list($name, $value) = each($options) ) { Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-12 16:57:30 UTC (rev 4643) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-12 18:26:04 UTC (rev 4644) @@ -524,7 +524,7 @@ * LOG_INFO 6 Informative Meldung. * LOG_DEBUG 6 Debug-Level-Meldung. * - * Action: + * Events: * login, logout, rotate * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm * thumbnail, image Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-12 16:57:30 UTC (rev 4643) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-12 18:26:04 UTC (rev 4644) @@ -226,7 +226,9 @@ /** - * filter out files and folders not permitted + * filter out files and folders not permitted and escape filename + * all other values dont have to be escaped + * (currently at least, have a look at LIN_SELECT_FIELDS) */ function filterPhotosNotPermitted() { @@ -606,20 +608,24 @@ $i=0; foreach($this->photos_filtered AS $key=>$photo_value) { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; - - $filename = $photo_value['name']; - $md5sum = $photo_value['md5sum']; - $full_filename = LinSql::getFullImagePath( $photo_value['id'] ); - if($_SESSION['mode_thumbview'] == 'thumbdetail') { - $flag_nr = 14; + $flag_nr = 14; // flag nr of thumbdetail } else { - $flag_nr = 13; + $flag_nr = 13; // flag nr of thumb } - $array_image_infos = MetaData::readInformations( $full_filename, $filename, $md5sum, $photo_value['width'], $photo_value['height'], $flag_nr ); + $array_image_infos = MetaData::readInformations( + array( + 'filename' => $photo_value['name'], + 'full_filename' => LinSql::getFullImagePath( $photo_value['id'] ), + 'md5sum' => $photo_value['md5sum'], + 'width' => $photo_value['width'], + 'height' => $photo_value['height'] + ), + $flag_nr + ); + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; $index = 'before'; $i=0; foreach($array_image_infos AS $value) @@ -656,6 +662,10 @@ */ if( linUseAjax() ) { + /** + * create javascript object containing all thumb informations + */ + $GLOBALS['linpha']->template->setModuleName('view_thumb'); $GLOBALS['linpha']->template->output['page_nr_left'] = ''; @@ -721,7 +731,7 @@ } - $this->viewThumbWritePageNumbers(); + $this->viewThumbNojsWritePageNumbers(); /** * create array $this->photos_show which contains only the photos of the current page @@ -749,7 +759,7 @@ /** * setup page numbers (only used if static) */ -function viewThumbWritePageNumbers() +function viewThumbNojsWritePageNumbers() { /** * writing page numbers @@ -1181,7 +1191,16 @@ $this->viewImgStoreImageInformation(); include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $GLOBALS['linpha']->template->output['image_infos'] = MetaData::readInformations( $this->full_filename, $this->filename, $this->md5sum, $this->org_width, $this->org_height, $flag_nr=10 ); + $GLOBALS['linpha']->template->output['image_infos'] = MetaData::readInformations( + array( + 'filename' => $this->filename, + 'full_filename' => $this->full_filename, + 'md5sum' => $this->md5sum, + 'width' => $this->org_width, + 'height' => $this->org_height + ), + $flag_nr=10 + ); if(isset($_GET['force_update'])) { LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); Modified: trunk/linpha2/lib/modules/module.filemanager.php =================================================================== --- trunk/linpha2/lib/modules/module.filemanager.php 2006-11-12 16:57:30 UTC (rev 4643) +++ trunk/linpha2/lib/modules/module.filemanager.php 2006-11-12 18:26:04 UTC (rev 4644) @@ -31,6 +31,12 @@ * * * it doesnt make sense to give write permissions to the files itself + * + * + * @todo make an option with allowed filetypes to upload: images, images and videos, all + * default setting: images + * its very dangerous if users may upload php files etc.!! or even video files may be + * prepared with malicious code (there are known security holes in some video players!) */ if(!defined('LINPHA_DIR')) { exit(1); } @@ -351,8 +357,8 @@ * get full source name */ $full_sourcename = LinSql::getFullImagePath( $value ); - - if( $full_filename == false ) + + if( $full_sourcename == false ) { throw new Exception(i18n("This file doesn't exists anymore!").' '.$full_filename); } @@ -577,108 +583,119 @@ linLog(LOG_TYPE_FILEMANAGER,LOG_NOTICE,'fm_perm',"changed permission of ".$full_filename." to ".$mode); break; - } // end switch($_POST['file_action']) - break; // end case 'do_file_action': - - case 'upload': - $targetdir = LinSql::getFullImagePath( $linpha->template->idCurrent ); - - for($i = 0; $i < $linpha->sql->config->value['plugins_filemanager_nruploads']; $i++ ) - { - if( isset( $_FILES[ 'file' . $i ] ) && $_FILES[ 'file' . $i]['name'] ) // break loop as sson as 'name' is not set, to prevent a couple of warnings + case 'upload': + $targetdir = LinSql::getFullImagePath( $linpha->template->idCurrent ); + + $full_filename = LinSql::getFullImagePath( $linpha->template->idCurrent ); + if( $full_filename == false ) { - $thisfile = $_FILES[ 'file' . $i ]; - - /** - * check errors - */ - if (isset($thisfile['error']) && $thisfile['error'] != 0 ) // ['error'] was added in PHP 4.2.0 + throw new Exception(i18n("This file doesn't exists anymore!").' '.$full_filename); + } + + for($i = 0; $i < $linpha->sql->config->value['plugins_filemanager_nruploads']; $i++ ) + { + if( isset( $_FILES[ 'file' . $i ] ) && $_FILES[ 'file' . $i]['name'] ) // break loop as sson as 'name' is not set, to prevent a couple of warnings { - switch ( $thisfile['error'] ) + $thisfile = $_FILES[ 'file' . $i ]; + + /** + * check errors + */ + if (isset($thisfile['error']) && $thisfile['error'] != 0 ) // ['error'] was added in PHP 4.2.0 { - case 1: - throw new Exception( sprintf(i18n("Error: The uploaded file %s exceeds the upload_max_filesize directive in php.ini - %s"), - htmlspecialchars($thisfile['name'],ENT_QUOTES), ini_get('upload_max_filesize') ) ); - break; - case 2: - throw new Exception( sprintf(i18n("size of uploaded file %s exceeds the HTML FORM settings"), htmlspecialchars($thisfile['name'],ENT_QUOTES) ) ); - break; - case 3: - throw new Exception( sprintf(i18n("The uploaded file %s was only partially uploaded"), htmlspecialchars($thisfile['name'],ENT_QUOTES) ) ); - break; + switch ( $thisfile['error'] ) + { + case 1: + throw new Exception( sprintf(i18n("Error: The uploaded file %s exceeds the upload_max_filesize directive in php.ini - %s"), + htmlspecialchars($thisfile['name'],ENT_QUOTES), ini_get('upload_max_filesize') ) ); + break; + case 2: + throw new Exception( sprintf(i18n("size of uploaded file %s exceeds the HTML FORM settings"), htmlspecialchars($thisfile['name'],ENT_QUOTES) ) ); + break; + case 3: + throw new Exception( sprintf(i18n("The uploaded file %s was only partially uploaded"), htmlspecialchars($thisfile['name'],ENT_QUOTES) ) ); + break; + } } - } - - if ( $_POST[ 'app' . $i ] == '-' ) - { - if ( !move_uploaded_file( $thisfile['tmp_name'], "".$targetdir.'/'.$thisfile['name']."" ) ) + + if ( $_POST[ 'app' . $i ] == '-' ) { - throw new Exception( sprintf(i18n("Unable To Move File (%s) To Directory (%s)"),htmlspecialchars($thisfile['name'],ENT_QUOTES),htmlspecialchars($targetdir,ENT_QUOTES ) ) ); + list($org_width, $org_height, $org_type) = LinIdentify::linGetImageSize( $thisfile['tmp_name'] ); + if( !LinIdentify::isSupportedImage( $org_type ) && !LinIdentify::isVideo( $org_type ) ) + { + throw new Exception( i18n("This File Is Wether An Image Nor A Video").' ('.htmlspecialchars($thisfile['name'],ENT_QUOTES).')' ); + } + + if ( !move_uploaded_file( $thisfile['tmp_name'], "".$targetdir.'/'.$thisfile['name']."" ) ) + { + throw new Exception( sprintf(i18n("Unable To Move File (%s) To Directory (%s)"),htmlspecialchars($thisfile['name'],ENT_QUOTES),htmlspecialchars($targetdir,ENT_QUOTES ) ) ); + } + + $somethingUploaded = true; } - - $somethingUploaded = true; - } - /** - * extract archives - */ - else // $_POST[ 'app' . $i ] != '-' - { - $tmpfolder = LinFilesys::createTmpFolder('filemanager'); - - if ( !move_uploaded_file( $thisfile['tmp_name'], $tmpfolder . '/' . $thisfile['name'] ) ) + /** + * extract archives + */ + else // $_POST[ 'app' . $i ] != '-' { - throw new Exception(sprintf( i18n("Unable To Move File (%s) To Directory (%s)"), htmlspecialchars($thisfile[ 'name' ],ENT_QUOTES), htmlspecialchars($targetdir,ENT_QUOTES) ) ); + $tmpfolder = LinFilesys::createTmpFolder('filemanager'); + + if ( !move_uploaded_file( $thisfile['tmp_name'], $tmpfolder . '/' . $thisfile['name'] ) ) + { + throw new Exception(sprintf( i18n("Unable To Move File (%s) To Directory (%s)"), htmlspecialchars($thisfile[ 'name' ],ENT_QUOTES), htmlspecialchars($targetdir,ENT_QUOTES) ) ); + } + + + $command = $apps->apps[$_POST['app'.$i]]['command_extract']; + $apps->searchApp($_POST['app'.$i]); + + $executable = $apps->found_apps[$_POST['app'.$i]].$apps->apps[$_POST['app'.$i]]['executable_extract']; + + $command = str_replace('{executable}',$executable,$command); + $command = str_replace('{archive_name}',linEscapeString($thisfile['name']),$command); + + $oldpwd = getcwd(); + if ( !chdir( $tmpfolder ) ) + { + throw new Exception( sprintf( i18n("Unable to switch (chdir) to %s directory. File being processed: %s"), $tmpfolder, $thisfile[ 'name' ] ) ); + } + + $output=array(); $return_value=''; // do not this directly in exec() ! + exec( $command, $output, $return_value ); + chdir( $oldpwd ); + + + echo '<textarea cols="80" rows="4"">' . + htmlspecialchars( $command . "\n". implode( "\n", $output ), ENT_QUOTES ) . + '</textarea><br />'; + + unset($output); + + /** + * move valid images and videos to target dir + * this will delete the archive file automatically... + * and also delete the tmpfolder + */ + moveValidEntries( $tmpfolder, $targetdir ); + + $somethingUploaded = true; } - - - $command = $apps->apps[$_POST['app'.$i]]['command_extract']; - $apps->searchApp($_POST['app'.$i]); - - $executable = $apps->found_apps[$_POST['app'.$i]].$apps->apps[$_POST['app'.$i]]['executable_extract']; - - $command = str_replace('{executable}',$executable,$command); - $command = str_replace('{archive_name}',linEscapeString($thisfile['name']),$command); - - $oldpwd = getcwd(); - if ( !chdir( $tmpfolder ) ) - { - throw new Exception( sprintf( i18n("Unable to switch (chdir) to %s directory. File being processed: %s"), $tmpfolder, $thisfile[ 'name' ] ) ); - } - - $output=array(); $return_value=''; // do not this directly in exec() ! - exec( $command, $output, $return_value ); - chdir( $oldpwd ); - - - echo '<textarea cols="80" rows="4"">' . - htmlspecialchars( $command . "\n". implode( "\n", $output ), ENT_QUOTES ) . - '</textarea><br />'; - - unset($output); - - /** - * move valid images and videos to target dir - * this will delete the archive file automatically... - * and also delete the tmpfolder - */ - moveValidEntries( $tmpfolder, $targetdir ); - - $somethingUploaded = true; + + linSysLog(i18n("File uploaded").": ".$thisfile['tmp_name']." ".$targetdir.'/'.$thisfile['name']); + linLog(LOG_TYPE_FILEMANAGER,LOG_NOTICE,'fm_upload',"Uploaded file (".$thisfile['tmp_name']." ".$targetdir.'/'.$thisfile['name'].")"); } - - linSysLog(i18n("File uploaded").": ".$thisfile['tmp_name']." ".$targetdir.'/'.$thisfile['name']); - linLog(LOG_TYPE_FILEMANAGER,LOG_NOTICE,"File Upload", "Uploaded file (".$thisfile['tmp_name']." ".$targetdir.'/'.$thisfile['name'].")"); } - } - - if(isset($somethingUploaded)) - { - if( ! $linpha->sql->config->value['sys_import_autoimport'] ) + + if(isset($somethingUploaded)) { - linSysLog(i18n($str_autoimportdisabled)); + if( ! $linpha->sql->config->value['sys_import_autoimport'] ) + { + linSysLog(i18n($str_autoimportdisabled)); + } } - } - break; + break; + } // end switch($_POST['file_action']) + break; // end case 'do_file_action': } // end switch($_REQUEST['cmd']) } // end try() @@ -723,7 +740,7 @@ }*/ } -echo i18n("Current Folder:").' '.linSetNavigationLine( $parent_id, LINPHA_LINK.'&linCat=filemanager&id').'<br />'; +echo i18n("Current Folder:").' '.linSetNavigationLine( $parent_id, LINPHA_LINK.'&linCat=filemanager&linId=').'<br />'; ?> <form method="POST" action="<?php echo LINPHA_LINK.'&linCat=filemanager&linId='.$parent_id; ?>"> @@ -935,7 +952,7 @@ } ?> -<input type="hidden" name="cmd" value="upload" /> +<input type="hidden" name="cmd" value="do_file_action" /> <input type="hidden" name="file_action" value="upload" /> <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Upload Files"); ?>"/> </form> @@ -1175,7 +1192,6 @@ else { list($org_width, $org_height, $org_type) = LinIdentify::linGetImageSize( $source .'/'. $entry ); - if( LinIdentify::isSupportedImage( $org_type ) OR LinIdentify::isVideo( $org_type ) ) { rename( $source .'/'. $entry, $dest .'/'. $entry); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-12 23:15:15
|
Revision: 4645 http://svn.sourceforge.net/linpha/?rev=4645&view=rev Author: fangehrn Date: 2006-11-12 15:14:49 -0800 (Sun, 12 Nov 2006) Log Message: ----------- * improved MetaData class a lot Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/templates/default/home.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/ChangeLog 2006-11-12 23:14:49 UTC (rev 4645) @@ -3,6 +3,7 @@ if you have a public upload folder, its dangerous if the user may upload own php files! but: we will need to make an option which file types are allowed, its also dangerous to upload videos because there are security holes in the video players! + * improved MetaData class a lot 2006-11-11 flo * renamed: Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/admin/maintenance_import.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -200,8 +200,7 @@ * * if "Delete First" and "All albums" was selected, the whole table will be deleted */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new MetaDataIndex(); foreach($array_meta AS $meta_value) { @@ -267,8 +266,6 @@ */ if( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) { - $MetaData->setFields($meta_value); - echo i18n("Index Image"); foreach($array_meta_ids AS $id=>$md5sum) @@ -283,14 +280,10 @@ switch($meta_value) { case 'exif': - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment - include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData( $full_filename,$md5sum ); + $MetaData->saveData( 'exif', $full_filename,$md5sum ); break; case 'iptc': - include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData( $full_filename,$md5sum ); + $MetaData->saveData( 'iptc', $full_filename,$md5sum ); break; case 'xmp': break; Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/admin/metadata_define.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -261,8 +261,7 @@ function show_exif_iptc() { - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaDataAdmin(); $MetaData->setFields( $GLOBALS['cat3'] ); /** Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/admin/metadata_define_post.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -88,17 +88,16 @@ $linpha->sql->config->reloadConfig(); break; case 'create_exifiptc': - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); if( ! isset($_POST['selected_fields'])) { $_POST['selected_fields'] = Array(); } if($cat3 == 'exif') { $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_exif"); - $linpha->db->Execute( Metadata::createExifTable( $_POST['selected_fields'] ) ); + $linpha->db->Execute( LinMetadataAdmin::createExifTable( $_POST['selected_fields'] ) ); } elseif($cat3 == 'iptc') { $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_iptc"); - $linpha->db->Execute( Metadata::createIptcTable( $_POST['selected_fields'] ) ); + $linpha->db->Execute( LinMetadataAdmin::createIptcTable( $_POST['selected_fields'] ) ); } break; } Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/admin/metadata_select.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -74,8 +74,7 @@ /** * set exif/iptc fields */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaDataAdmin(); $MetaData->setFields('exif'); $MetaData->setFields('iptc'); ?> Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/index.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -13,7 +13,7 @@ /** * some init stuff */ - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); global $linpha; $linpha = new Linpha(); $linpha->sql->startSession(); @@ -25,38 +25,38 @@ { $_GET['linCat'] = 'alb'; } - + /** * open modules */ switch($_GET['linCat']) { case 'alb': - include_once(LINPHA_DIR.'/lib/modules/module.albums.php'); + require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; case 'search': - include_once(LINPHA_DIR.'/lib/modules/module.search.php'); + require_once(LINPHA_DIR.'/lib/modules/module.search.php'); break; case 'basket': - include_once(LINPHA_DIR.'/lib/modules/module.basket.php'); + require_once(LINPHA_DIR.'/lib/modules/module.basket.php'); break; case 'browse': - include_once(LINPHA_DIR.'/lib/modules/module.browse.php'); + require_once(LINPHA_DIR.'/lib/modules/module.browse.php'); break; case 'filemanager': - include_once(LINPHA_DIR.'/lib/modules/module.filemanager.php'); + require_once(LINPHA_DIR.'/lib/modules/module.filemanager.php'); break; case 'settings': - include_once(LINPHA_DIR.'/lib/modules/module.settings.php'); + require_once(LINPHA_DIR.'/lib/modules/module.settings.php'); break; case 'ajax': - include_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); + require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); break; case 'newimg': - include_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); + require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; case 'empty': - include_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; } Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -260,8 +260,6 @@ * flag_nr 12 */ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('builtin_filename', 0, 12)"; - $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 12)"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -24,11 +24,14 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -define('LIN_SELECT_FIELDS',LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . +define('LIN_SELECT_FIELDS', + "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . - "".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . - "".LIN_PREFIX."photos.time_add AS time_add"); + "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . + "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . + "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" +); class LinImgview { @@ -613,17 +616,13 @@ } else { $flag_nr = 13; // flag nr of thumb } - $array_image_infos = MetaData::readInformations( - array( - 'filename' => $photo_value['name'], - 'full_filename' => LinSql::getFullImagePath( $photo_value['id'] ), - 'md5sum' => $photo_value['md5sum'], - 'width' => $photo_value['width'], - 'height' => $photo_value['height'] - ), - $flag_nr - ); + $array_image_infos = LinMetaDataRead::readInformations( + $photo_value, + LinSql::getFullImagePath( $photo_value['id'] ), + $flag_nr + ); + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; $index = 'before'; @@ -914,13 +913,49 @@ } } - $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; - $days_in_sec = $days*60*60*24; - $lower_date = time()-$days_in_sec; - $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); - $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); + /** + * new images + */ + $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; + $days_in_sec = $days*60*60*24; + $lower_date = time()-$days_in_sec; + $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); + + /** + * random images + */ + $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); - $this->viewHomeSetBrowseByDate(); + /** + * browse by date + */ + $this->viewHomeSetBrowseByDate(); + + /** + * album informations + */ + + foreach($this->photos_filtered AS $photo_key=>$photo_value) + { + $array_image_infos = LinMetaDataRead::readInformations( + $photo_value, + LinSql::getFullImagePath( $photo_value['id'] ), + $flag_nr=12 + ); + + $this->photos_filtered[$photo_key]['album_infos'] = ''; + foreach($array_image_infos AS $key=>$value) + { + if($key == 'builtin_stats_numbers') + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; + } + else + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; + } + } + } } /** @@ -1190,17 +1225,11 @@ $this->viewImgStoreImageInformation(); - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $GLOBALS['linpha']->template->output['image_infos'] = MetaData::readInformations( - array( - 'filename' => $this->filename, - 'full_filename' => $this->full_filename, - 'md5sum' => $this->md5sum, - 'width' => $this->org_width, - 'height' => $this->org_height - ), - $flag_nr=10 - ); + $GLOBALS['linpha']->template->output['image_infos'] = LinMetaDataRead::readInformations( + $this->photos_filtered[ $this->current_key ], + $this->src_file, + $flag_nr=10 + ); if(isset($_GET['force_update'])) { LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); @@ -1255,51 +1284,22 @@ { $this->full_filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - /** - * set image informations - */ - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); - $MetaData->setFields('exif'); - $MetaData->setFields('iptc'); + $array_meta = array('exif','iptc'); + foreach($array_meta AS $value) + { + if( !isset($MetaData) ) + { + $MetaData = new LinMetaDataIndex(); + } - /** - * read exif and iptc from file if no entry - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) - { - /** - * check if exif information are already in db - * if not, read exif information from file and store it in the db - * - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$this->md5sum."'"); - - if( $query->EOF) // not a single value returned - { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment - include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); - $MetaData->saveExifData( $this->full_filename,$this->md5sum); - } - } - - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) - { - /** - * check if there is already IPTC info in db if not, get IPTC - * information from file and store it in the db - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".LIN_PREFIX."meta_iptc WHERE md5sum = '".$this->md5sum."'"); - - if( $query->EOF) // not a single value returned - { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); - $MetaData->saveIptcData( $this->full_filename,$this->md5sum); - } - } + /** + * read exif/iptc from file if no entry + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + $MetaData->saveData( $value, $this->full_filename,$this->md5sum); + } + } } /** Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -456,13 +456,12 @@ { include_once( LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php' ); $meta = get_EXIF_JPEG($dirname.'/'.$filename); - include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); /** * get date */ if( isset($meta[0][34665]['Data'][0][36867]['Data'][0]) ) { - $time_exif = MetaData::convertExifDateToUnix( $meta[0][34665]['Data'][0][36867]['Data'][0] ); + $time_exif = LinMetaDataIndex::convertExifDateToUnix( $meta[0][34665]['Data'][0][36867]['Data'][0] ); } /** @@ -471,7 +470,7 @@ */ if( $GLOBALS['linpha']->sql->config->value['sys_import_exif_autorot'] && isset($meta[0][274]['Data'][0]) ) { - $rotate = MetaData::getRotationByExifTag( $meta[0][274]['Data'][0] ); + $rotate = LinMetaDataIndex::getRotationByExifTag( $meta[0][274]['Data'][0] ); } } } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-12 18:26:04 UTC (rev 4644) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-12 23:14:49 UTC (rev 4645) @@ -26,561 +26,144 @@ if(!defined('LINPHA_DIR')) { exit(1); } -class MetaData { - -public $available_fields, $defined_fields; - - -function __construct() -{ -} - /** - * show nice name for exif, iptc, builtin and own fields, for example: convert "exif_datetimeoriginal" to "DateTime Original" + * Functions to read MetaData from the database */ -function getNameOfField( $key , $show_exifiptc_in_brackets) +class LinMetaDataRead extends LinMetaData { - $pos = strpos($key,'_'); - $first_part = substr($key,0,$pos); - $last_part = substr($key,$pos+1); - switch($first_part) + /** + * read image information from database + * and escape data with htmlspecialchars() if necessary + * + * @param array array_src_infos array containing needed source file informations, same as LIN_SELECT_FIELDS + * + */ + function readInformations($array_src_infos, $full_filename, $flag_nr) { - case 'builtin': // builtin and special fields like filename, imagesize and dimension - $value = i18n( ucfirst( $last_part ) ); - break; - - case 'id': // own fields - $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."meta_fields WHERE id = '".$last_part."'"); - $value = i18n( ucfirst( $data2['name'] ) ); - break; - case 'exif': - $value = $GLOBALS['Tags_Exif'][$last_part]; - if($show_exifiptc_in_brackets) { - $value .= ' (exif)'; - } - break; - case 'iptc': - $value = $GLOBALS['Tags_Iptc'][$last_part]; - if($show_exifiptc_in_brackets) { - $value .= ' (iptc)'; - } - break; - } - - return $value; -} - -/** - * read image information from database - */ -function readInformations($full_filename,$filename,$md5sum,$width,$height,$flag_nr) -{ - $query = $GLOBALS['linpha']->db->Execute("SELECT name " . - "FROM ".LIN_PREFIX."meta_fields " . - "WHERE flags = '".$flag_nr."' ORDER by id"); - - while($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) - { - $name = MetaData::getNameOfField( $fields_data['0'], false ); - $value = ''; - - $pos = strpos($fields_data['0'],'_'); - $first_part = substr($fields_data['0'],0,$pos); - $last_part = substr($fields_data['0'],$pos+1); - /** - * get field id - */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id " . - "FROM ".LIN_PREFIX."meta_fields WHERE name = '".$last_part."'"); + $query = $GLOBALS['linpha']->db->Execute("SELECT name " . + "FROM ".LIN_PREFIX."meta_fields " . + "WHERE flags = '".$flag_nr."' ORDER by id"); - switch($first_part) + while($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) { - case 'builtin': + $name = LinMetaData::getNameOfField( $fields_data['0'], false ); + $value = ''; + + $pos = strpos($fields_data['0'],'_'); + $first_part = substr($fields_data['0'],0,$pos); + $last_part = substr($fields_data['0'],$pos+1); /** - * @todo maybe we could save this values in the db for - * speed improvements + * get field id */ - switch($last_part) + $data = $GLOBALS['linpha']->db->GetRow("SELECT id " . + "FROM ".LIN_PREFIX."meta_fields WHERE name = '".$last_part."'"); + + switch($first_part) { - case 'filename': - $value = '<span title="'.$filename.'">'.$filename.'</span>'; // is already escaped - break; - case 'imagesize': - $value = LinFilesys::niceFilesize( filesize( $full_filename ), 2 ); - break; - case 'dimension': - $value = $width.'x'.$height; - break; - case 'thumbnail': - $value = 'thumbnail'; - break; - default: // field entries which are stored in linpha_meta_data + case 'builtin': + + switch($last_part) + { + case 'filename': + $value = $array_src_infos['name']; // is already escaped + break; + case 'imagesize': + $value = LinFilesys::niceFilesize( filesize( $full_filename ), 2 ); + break; + case 'dimension': + $value = $array_src_infos['width'].'x'.$array_src_infos['height']; + break; + case 'thumbnail': + $value = 'thumbnail'; + break; + case 'time_add': + $name = i18n("Date Added"); + $value = linStrftime($array_src_infos['time_add']); + break; + case 'time_mod': + $name = i18n("Date Modified"); + $value = linStrftime($array_src_infos['time_mod']); + break; + case 'time_exif': + $name = i18n("Date Taken"); + $value = linStrftime($array_src_infos['time_exif']); + break; + case 'stats_numbers': + $name = i18n("Photos"); + $value = $array_src_infos['stats_numbers']; + break; + case 'stats_views': + $name = i18n("Nr Of Views"); + $value = $array_src_infos['stats_views']; + break; + case 'stats_downloads': + $name = i18n("Nr Of Downloads"); + $value = $array_src_infos['stats_downloads']; + break; + default: + + /** + * description, category, persons, date (field entries which are stored in linpha_meta_data) + */ + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . + "FROM ".LIN_PREFIX."meta_data ". + "WHERE field_id = '".$data['id']."' " . + "AND md5sum = '".$array_src_infos['md5sum']."'"); + + if(isset($meta_data['meta_data'])) { + $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); + } + } + case 'id': // own fields $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . - "FROM ".LIN_PREFIX."meta_data ". + "FROM ".LIN_PREFIX."meta_data " . "WHERE field_id = '".$data['id']."' " . - "AND md5sum = '".$md5sum."'"); - + "AND md5sum = '".$array_src_infos['md5sum']."'"); + if(isset($meta_data['meta_data'])) { $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); } - } - case 'id': // own fields - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . - "FROM ".LIN_PREFIX."meta_data " . - "WHERE field_id = '".$data['id']."' " . - "AND md5sum = '".$md5sum."'"); - - if(isset($meta_data['meta_data'])) { - $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); - } - break; - case 'exif': - if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { - $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." " . - "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - - if(isset($exif_data[$last_part])) { - $value = htmlspecialchars($exif_data[$last_part],ENT_QUOTES); + break; + case 'exif': + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { + $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." " . + "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$array_src_infos['md5sum']."'"); + + if(isset($exif_data[$last_part])) { + $value = htmlspecialchars($exif_data[$last_part],ENT_QUOTES); + } } - } - break; - case 'iptc': - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { - $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." " . - "FROM ".LIN_PREFIX."meta_iptc WHERE md5sum = '".$md5sum."'"); - - if(isset($iptc_data[$last_part])) { - $value = htmlspecialchars($iptc_data[$last_part],ENT_QUOTES); + break; + case 'iptc': + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + $iptc_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." " . + "FROM ".LIN_PREFIX."meta_iptc WHERE md5sum = '".$array_src_infos['md5sum']."'"); + + if(isset($iptc_data[$last_part])) { + $value = htmlspecialchars($iptc_data[$last_part],ENT_QUOTES); + } } + break; } - break; - } - - if($value != '') - { - $output_array[$fields_data['name']] = Array('name' => $name, 'value' => $value); - } - } - - return $output_array; -} - -/** - * set available and defined fields - * @param string $what [exif,iptc] - */ -function setFields($what) -{ - /** - * create definedfields[] - */ - $this->defined_fields[$what] = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$what); - - /** - * remove md5sum entry - */ - unset($this->defined_fields[$what]['MD5SUM']); - /** - * change keys to lowercase - */ - foreach($this->defined_fields[$what] AS $key=>$value) - { - $new_key = strtolower($key); - unset($this->defined_fields[$what][$key]); - $this->defined_fields[$what][$new_key] = $GLOBALS['Tags_'.ucfirst($what)][$new_key]; - } - - /** - * create available_fields - */ - foreach($GLOBALS['Tags_'.ucfirst($what)] AS $key=>$value) - { - if( ! isset( $this->defined_fields[$what][$key] )) + if($value != '') { - $this->available_fields[$what][$key] = $value; + $output_array[$fields_data['name']] = Array('name' => $name, 'value' => $value); } } -} - - -/** - * save data in DB functions - */ - /** - * store EXIF data in DB - * - * create an entry in the db even if we haven't found anything - * to prevent img_view.class.php to call this function every time - * the image is viewed - */ - function saveExifData($filename,$md5sum) - { - /** - * get exif info from file - */ - $exif_data = get_EXIF_JPEG( $filename ); - - /** - * get exif tags - */ - $exif_tags = $this->getExifTranslationArray(); - /** - * special tags - */ - // Canon Owner Name append to Artist - if(isset($exif_data['Makernote_Tag']['Decoded Data']) - && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string - && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) - { - $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; - if(isset($exif_data[0][315]['Text Value'])) - { - $exif_data[0][315]['Text Value'] .= $owner; - } - else - { - $exif_data[0][315]['Text Value'] = $owner; - } - - } - - /** - * search for valid tags - */ - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - foreach($exif_tags AS $key=>$value) - { - $key = strtolower($key); - - if($value != "" && isset($this->defined_fields['exif'][$key])) - { - /** - * there are currently only entries at level deep 2 and 5 in the - * array - */ - $array_pieces = explode('/',$value); - switch(count($array_pieces)) - { - case 2: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) - { - $str_columns .= $key.', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; - $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; - } - break; - case 5: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) - { - $str_columns .= $key.', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; - $str_values .= "'".linSql::linAddslashes(trim( $exif_value ))."', "; - } - break; - default: - echo "Error no valid path for key: ".$key." value: ".$value; - break; - } - } - } - - /** - * add jpegcomment - */ - if(in_array('jpegcomment',$this->defined_fields['exif'])) - { - $jpeg_header_data = get_jpeg_header_data( $filename ); - $comment = get_jpeg_Comment( $jpeg_header_data ); - if(!empty($comment)) - { - $str_columns .= 'jpegcomment, '; - $str_values .= "'".linSql::linAddslashes(trim( $comment ))."', "; - } - } - - /** - * remove last two signs - */ - $str_columns = substr($str_columns,0,strlen($str_columns)-2); - $str_values = substr($str_values,0,strlen($str_values)-2); - - - /** - * no double entries - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".LIN_PREFIX."meta_exif ". - "WHERE md5sum = '".$md5sum."'"); - - if( $query->EOF) // not a sigle value returned - { - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_exif (".$str_columns.") ". - "VALUES (".$str_values.")"); - } + return $output_array; } - /** - * esacape sql strings a clean way - - function cleansql($text) - { - $return=""; - $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); - $count = count($chars); - for ($c=0; $c<$count; $c++) - { - $letter=$chars[$c]; - if (!preg_match("/[a-zA-Z0-9]/", $letter)) - { - $return .= "\\$letter"; - } - else - { - $return .= "$letter"; - } - } - return $return; - } - */ - /** - * store IPTC data in DB - */ - function saveIptcData($filename, $md5sum) - { - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data($filename); - - if($jpeg_header_data) - { - // get array with all available IPTC data - $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); - - // init values (prevent php notice msg if not set) - $caption = ""; - $object_name = ""; - $edit_status = ""; - $priority = ""; - $category = ""; - $supplemental_categorie = ""; - $job_id = ""; - $keywords = ""; - $date_released = ""; - $time_released = ""; - $instructions = ""; - $date_created = ""; - $time_created = ""; - $program = ""; - $object_cycle = ""; - $byline = ""; - $byline_title = ""; - $city = ""; - $sublocation = ""; - $state = ""; - $country_code = ""; - $country = ""; - $trans_reference = ""; - $headline = ""; - $credit = ""; - $source = ""; - $copyright = ""; - $caption_writer = ""; - - $IPTC_Meta = array(); +} // end class LinMetaData - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum " . - "FROM ".LIN_PREFIX."meta_iptc " . - "WHERE md5sum = '".$md5sum."' "); - if( $query->EOF) // not a sigle value returned - { - if(is_array($IPTC_Info)) - { - // Cycle through each of the IPTC-NAA IIM records - foreach($IPTC_Info as $IPTC_Record) - { - switch ( $IPTC_Record['IPTC_Type'] ) - { - case "2:05": // object name - $object_name = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:07": // edit_status - $edit_status = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:10": // priority - $priority = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:15": // category - $category = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:20": // supplemental_categorie - $supplemental_categorie .= " ".linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:22": // job_id - $job_id = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:25": // keywords - $keywords .= " ".linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:30": // date_released - $date_released = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:35": // time_released - $time_released = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:40": // instructions - $instructions = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:55": // date_created - $date_created = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:60": // time_created - $time_created = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:65": // program - $program = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:75": // object_cycle - $object_cycle = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:80": // byline - $byline = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:85": // byline_title - $byline_title = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:90": // city - $city = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:92": // sublocation - $sublocation = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:95": // state - $state = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:100": // country_code - $country_code = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:101": // country - $country = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:103": // trans_reference - $trans_reference = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:105": // headline - $headline = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:110": // credit - $credit = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:115": // source - $source = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:116": // copyright - $copyright = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:120": // caption - $caption = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:122": // caption_writer - $caption_writer = linSql::linAddslashes(rtrim($IPTC_Record['RecData'])); - break; - } - } - - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference) " . - "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . - "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . - "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . - "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . - "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . - "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . - "'".$country_code."', '".$trans_reference."')"); - - return true; - } - else - { - /** - * save empty entry to prevent re-read on every page visit - */ - $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."meta_iptc " . - "(md5sum) VALUES('".$md5sum."')"); - - return false; - } - } - } - else - { - return false; - } - } - - - /** - * edit iptc functions + * Admin functions to select the tags which should be indexed */ - /** - * edit IPTC Data in HTML popup - */ - function editIptcData() - { - - } - - /** - * save modified IPTC data to DB - */ - function saveModIptcData() - { - - } - - - -/** - * createTable functions - */ +class LinMetaDataAdmin extends LinMetaData +{ function createExifTable($array='') { if(empty($array)) @@ -594,7 +177,7 @@ "md5sum VARCHAR(32) NOT NULL, "; foreach($array AS $key=>$value) { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; + $str .= LinSql::linAddslashes(strtolower($value))." VARCHAR(255), "; } $str .= "PRIMARY KEY (md5sum), "; $str .= "KEY (md5sum) )"; @@ -648,189 +231,7 @@ 'fnumber' ); } - - /** - * get array with exiftags and path where they are - * keys are used to create the database table - * - * warning: if making changes in the keys of the array, we will need to - * update the db!! - */ - function getExifTranslationArray() - { - return Array( - // TIFF Rev. 6.0 Attribute Information - // A. Tags relating to image data structure - 'ImageWidth' => '', - 'ImageLength' => '', - 'BitsPerSample' => '', - 'Compression' => '', - 'PhotometricInterpretation' => '', - 'Orientation' => '0/274', - 'SamplesPerPixel' => '', - 'PlanarConfiguration' => '', - 'YCbCrSubSampling' => '', - 'YCbCrPositioning' => '0/531', - 'XResolution' => '0/282', - 'YResolution' => '0/283', - 'ResolutionUnit' => '0/296', - - // B. Tags relating to recording offset - 'StripOffsets' => '', - 'RowsPerStrip' => '', - 'StripByteCounts' => '', - 'JPEGInterchangeFormat' => '', - 'JPEGInterchangeFormatLength' => '', - - // C. Tags relating to image data characteristics - 'TransferFunction' => '', - 'WhitePoint' => '', - 'PrimaryChromaticities' => '', - 'YCbCrCoefficients' => '', - 'ReferenceBlackWhite' => '', - - // D. Other tags - 'DateTime' => '0/306', - 'ImageDescription' => '0/270', - 'Make' => '0/271', - 'Model' => '0/272', - 'Software' => '0/305', - 'Artist' => '0/315', - 'Copyright' => '0/33432', - - // Exif IFD Attribute Information - // A. Tags Relating to Version - 'ExifVersion' => '0/34665/Data/0/36864', - 'FlashpixVersion' => '0/34665/Data/0/40960', - - // B. Tag Relating to Image Data Characteristics - 'ColorSpace' => '0/34665/Data/0/40961', - - // C. Tags Relating to Image Configuration - 'ComponentsConfiguration' => '0/34665/Data/0/37121', - 'CompressedBitsPerPixel' => '0/34665/Data/0/37122', - 'PixelXDimension' => '0/34665/Data/0/40962', - 'PixelYDimension' => '0/34665/Data/0/40963', - - // D. Tags Relating to User Information - //'MakerNote' => '', too big to store!! - 'UserComment' => '0/34665/Data/0/37510', - - // E. Tag Relating to Related File Information - 'RelatedSoundFile' => '', - - // F. Tags Relating to Date and Time - 'DateTimeOriginal' => '0/34665/Data/0/36867', - 'DateTimeDigitized' => '0/34665/Data/0/36868', - 'SubSecTime' => '', - 'SubSecTimeOriginal' => '', - 'SubSecTimeDigitized' => '', - - // G. Tags Relating to Picture-Taking Conditions - 'ExposureTime' => '0/34665/Data/0/33434', - 'FNumber' => '0/34665/Data/0/33437', - 'ExposureProgram' => '0/34665/Data/0/34850', - 'SpectralSensitivity' => '', - 'ISOSpeedRatings' => '0/34665/Data/0/34855', - 'OECF' => '', - 'ShutterSpeedValue' => '0/34665/Data/0/37377', - 'ApertureValue' => '0/34665/Data/0/37378', - 'BrightnessValue' => '0/34665/Data/0/37379', - 'ExposureBiasValue' => '0/34665/Data/0/37380', - 'MaxApertureValue' => '0/34665/Data/0/37381', - 'SubjectDistance' => '0/34665/Data/0/37382', - 'MeteringMode' => '0/34665/Data/0/37383', - 'LightSource' => '0/34665/Data/0/37384', - 'Flash' => '0/34665/Data/0/37385', - 'FocalLength' => '0/34665/Data/0/37386', - 'SubjectArea' => '', - 'FlashEnergy' => '', - 'SpatialFrequencyResponse' => '', - 'FocalPlaneXResolution' => '0/34665/Data/0/41486', - 'FocalPlaneYResolution' => '0/34665/Data/0/41487', - 'FocalPlaneResolutionUnit' => '0/34665/Data/0/41488', - 'SubjectLocation' => '', - 'ExposureIndex' => '', - 'SensingMethod' => '0/34665/Data/0/41495', - 'FileSource' => '0/34665/Data/0/41728', - 'SceneType' => '0/34665/Data/0/41729', - 'CFAPattern' => '', - 'CustomRendered' => '0/34665/Data/0/41985', - 'ExposureMode' => '0/34665/Data/0/41986', - 'WhiteBalance' => '0/34665/Data/0/41987', - 'DigitalZoomRatio' => '0/34665/Data/0/41988', - 'FocalLengthIn35mmFilm' => '', - 'SceneCaptureType' => '0/34665/Data/0/41990', - 'GainControl' => '0/34665/Data/0/41991', - 'Contrast' => '0/34665/Data/0/41992', - 'Saturation' => '0/34665/Data/0/41993', - 'Sharpness' => '0/34665/Data/0/41994', - 'DeviceSettingDescription' => '', - 'SubjectDistanceRange' => '', - - // H. Other Tags - 'ImageUniqueID' => '', - - // GPS Attribute Information - // A. Tags Relating to GPS - 'GPSVersionID' => '0/34853/Data/0/0', - 'GPSLatitudeRef' => '0/34853/Data/0/1', - 'GPSLatitude' => '0/34853/Data/0/2', - 'GPSLongitudeRef' => '0/34853/Data/0/3', - 'GPSLongitude' => '0/34853/Data/0/4', - 'GPSAltitudeRef' => '0/34853/Data/0/5', - 'GPSAltitude' => '0/34853/Data/0/6', - 'GPSTimeStamp' => '0/34853/Data/0/7', - 'GPSSatellites' => '0/34853/Data/0/8', - 'GPSStatus' => '0/34853/Data/0/9', - 'GPSMeasureMode' => '0/34853/Data/0/10', - 'GPSDOP' => '0/34853/Data/0/11', - 'GPSSpeedRef' => '0/34853/Data/0/12', - 'GPSSpeed' => '0/34853/Data/0/13', - 'GPSTrackRef' => '0/34853/Data/0/14', - 'GPSTrack' => '0/34853/Data/0/15', - 'GPSImgDirectionRef' => '0/34853/Data/0/16', - 'GPSImgDirection' => '0/34853/Data/0/17', - 'GPSMapDatum' => '0/34853/Data/0/18', - 'GPSDestLatitudeRef' => '0/34853/Data/0/19', - 'GPSDestLatitude' => '0/34853/Data/0/20', - 'GPSDestLongitudeRef' => '0/34853/Data/0/21', - 'GPSDestLongitude' => '0/34853/Data/0/22', - 'GPSDestBearingRef' => '0/34853/Data/0/23', - 'GPSDestBearing' => '0/34853/Data/0/24', - 'GPSDestDistanceRef' => '0/34853/Data/0/25', - 'GPSDestDistance' => '0/34853/Data/0/26', - 'GPSProcessingMethod' => '0/34853/Data/0/27', - 'GPSAreaInformation' => '0/34853/Data/0/28', - 'GPSDateStamp' => '0/34853/Data/0/29', - 'GPSDifferential' => '0/34853/Data/0/30', - - // Custom Makernotes http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html - // there are several tags: camera settings etc. might be usefull - - // Canon - // overwrite Artist => 0/315 - //'OwnerName' => 'Makernote_Tag/Decoded Data/0/9' - - // Casio - - // Fujifilm - - // Konica/Minolta - - // Nikon - - // Olympus - - // Panasonic - - // Ricoh - - 'JpegComment' => '' - ); - } - - + function createIptcTable($array='') { if(empty($array)) @@ -845,7 +246,7 @@ foreach($array AS $key=>$value) { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; + $str .= LinSql::linAddslashes(strtolower($value))." VARCHAR(255), "; } $str .= "PRIMARY KEY (md5sum), "; $str .= "KEY (md5sum) )"; @@ -879,9 +280,215 @@ $str = substr($str,0,strlen($str)-2).")"; } return $str; + } + +} // end class LinMetaDataAdmin + + +/** + * Index functions (save data in DB) + */ +class LinMetaDataIndex extends LinMetaData +{ + /** + * wrapper function for saveExifData and saveIptcDate for easier access + */ + function saveData($what,$filename,$md5sum) + { + /** + * no double entries + * do this check at very first position to improve performance! + * also do not setFields in the __contruct() because they may never be used + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum FROM ".LIN_PREFIX."meta_".$what." ". + "WHERE md5sum = '".$md5sum."'"); + + if( $query->EOF) // not a single value returned + { + /** + * define tags to index if not already done + */ + if( !isset($this->defined_fields[$what])) + { + $this->setFields($what); + } + + switch($what) + { + case 'exif': + $this->saveExifData($filename,$md5sum); + break; + case 'iptc': + $this->saveIptcData($filename,$md5sum); + break; + } + } } + + /** + * store EXIF data in DB + * + * create an entry in the db even if we haven't found anything + * to prevent img_view.class.php to call this function every time + * the image is viewed + */ + function saveExifData($filename,$md5sum) + { + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment + include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); + $str_columns = "md5sum, "; + $str_values = "'".$md5sum."', "; + + /** + * get exif info from file + */ + $exif_data = get_EXIF_JPEG( $filename ); + if( $exif_data) + { + /** + * special tags + */ + // Canon Owner Name append to Artist + if(isset($exif_data['Makernote_Tag']['Decoded Data']) + && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string + && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) + { + $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; + if(isset($exif_data[0][315]['Text Value'])) + { + $exif_data[0][315]['Text Value'] .= $owner; + } + else + { + $exif_data[0][315]['Text Value'] = $owner; + } + + } + + /** + * search for valid tags + */ + foreach($this->defined_fields['exif'] AS $key=>$value) + //foreach(LinMetaData::$Tags['exif'] AS $key=>$value) + { + if( !empty(LinMetaData::$Tags['exif'][$key]['pathvalue']) ) + { + /** + * there are currently only entries at level deep 2 and 5 in the array + */ + $array_pieces = explode('/',$value['pathvalue']); + switch(count($array_pieces)) + { + case 2: + if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) + { + $str_columns .= $key.', '; + + $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; + $str_values .= "'".LinSql::linAddslashes(trim( $exif_value ))."', "; + } + break; + case 5: + if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) + { + $str_columns .= $key.', '; + + $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; + $str_values .= "'".LinSql::linAddslashes(trim( $exif_value ))."', "; + } + break; + default: + echo "Error no valid path for key: ".$key." value: ".$value['pathvalue']."<br />"; + break; + } + } + } + + /** + * add jpegcomment + */ + if(isset($this->defined_fields['exif']['jpegcomment'])) + { + $jpeg_header_data = get_jpeg_header_data( $filename ); + $comment = get_jpeg_Comment( $jpeg_header_data ); + if(!empty($comment)) + { + $str_columns .= 'jpegcomment, '; + $str_values .= "'".LinSql::linAddslashes(trim( $comment ))."', "; + } + } + } + + /** + * remove last two signs (the comma and the space) which we added to much + */ + $str_columns = substr($str_columns,0,strlen($str_columns)-2); + $str_values = substr($str_values,0,strlen($str_values)-2); + + + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_exif (".$str_columns.") ". + "VALUES (".$str_values.")"); + } + /** + * store IPTC data in DB + */ + function saveIptcData($filename, $md5sum) + { + include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); + + $str_columns = "md5sum, "; + $str_values = "'".$md5sum."', "; + + // Retrieve the header information + $jpeg_header_data = get_jpeg_header_data($filename); + + if( $jpeg_header_data ) + { + // get array with all available IPTC data + $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); + + if(is_array($IPTC_Info)) + { + /** + * search for valid tags + */ + foreach($this->defined_fields['iptc'] AS $key=>$value) + { + if( !empty(LinMetaData::$Tags['iptc'][$key]['path']) ) + { + $str_columns .= $key.', '; + $str_values .= "'"; + + foreach($IPTC_Info as $IPTC_Record) + { + if( $IPTC_Record['IPTC_Type'] == LinMetaData::$Tags['iptc'][$key]['path'] ) + { + $str_values .= "".LinSql::linAddslashes(trim( $IPTC_Record['RecData'] ))." "; + + } + } + + $str_values .= "', "; + } + } + } + } + + /** + * remove last two signs (the comma and the space) which we added to much + */ + $str_columns = substr($str_columns,0,strlen($str_columns)-2); + $str_values = substr($str_values,0,strlen($str_values)-2); + + + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_iptc (".$str_columns.") ". + "VALUES (".$str_values.")"); + } + + /** * Autorotate Images via EXIF tag * Most Images contain an orientation tag which shows if and how to rotate * the images @@ -889,8 +496,8 @@ * @return degrees to rotate * @author bzrudi */ - function getRotationByExifTag($rotation) - { + function getRotationByExifTag($rotation) + { if(is_numeric($rotation)) { switch($rotation) @@ -970,188 +577,318 @@ return mktime($hour,$min,$sec,$month,$day,$year); } -} // end class metadata +} // end class LinMetaDataIndex -$GLOBALS['Tags_Exif'] = Array( - // TIFF Rev. 6.0 Attribute Information - // A. Tags relating to image data structure - 'imagewidth' => 'Image Width', - 'imagelength' => 'Image Length', - 'bitspersample' => 'Bits Per Sample', - 'compression' => 'Compression', - 'photometricinterpretation' => 'Photometric Interpretation', - 'orientation' => 'Orientation', - 'samplesperpixel' => 'Samples Per Pixel', - 'planarconfiguration' => 'Planar Configuration', - 'ycbcrsubsampling' => 'YCbCr Sub Sampling', - 'ycbcrpositioning' => 'YCbCr Positioning', - 'xresolution' => 'X Resolution', - 'yresolution' => 'Y Resolution', - 'resolutionunit' => 'Resolution Unit', - - // B. Tags relating to recording offset - 'stripoffsets' => 'Strip Offsets', - 'rowsperstrip' => 'Rows Per Strip', - 'stripbytecounts' => 'Strip Byte Counts', - 'jpeginterchangeformat' => 'JPEG Interchange Format', - 'jpeginterchangeformatlength' => 'JPEG Interchange Format Length', - - // C. Tags relating to image data characteristics - 'transferfunction' => 'Transfer Function', - 'whitepoint' => 'White Point', - 'primarychromaticities' => 'Primary Chromaticities', - 'ycbcrcoefficients' => 'YCbCr Coefficients', - 'referenceblackwhite' => 'Reference Black White', - - // D. Other tags - 'datetime' => 'Date Time', - 'imagedescription' => 'Image Description', - 'make' => 'Make', - 'model' => 'Model', - 'software' => 'Software', - 'artist' => 'Artist', - 'copyright' => 'Copyright', - -// Exif IFD Attribute Information - // A. Tags Relating to Version - 'exifversion' => 'Exif Version', - 'flashpixversion' => 'FlashPix Version', - - // B. Tag Relating to Image Data Characteristics - 'colorspace' => 'Color Space', - - // C. Tags Relating to Image Configuration - 'componentsconfiguration' => 'Components Configuration', - 'compressedbitsperpixel' => 'Compressed Bits Per Pixel', - 'pixelxdimension' => 'Pixel X Dimension', - 'pixelydimension' => 'Pixel Y Dimension', - - // D. Tags Relating to User Information - //'makernote' => 'MakerNote', too big to store!! - 'usercomment' => 'User Comment', - - // E. Tag Relating to Related File Information - 'relatedsoundfile' => 'Related Sound File', - - // F. Tags Relating to Date and Time - 'datetimeoriginal' => 'Date Time Original', - 'datetimedigitized' => 'Date Time Digitized', - 'subsectime' => 'Sub Sec Time', - 'subsectimeoriginal' => 'Sub Sec Time Original', - 'subsectimedigitized' => 'Sub Sec Time Digitized', - - // G. Tags Relating to Picture-Taking Conditions - 'exposuretime' => 'Exposure Time', - 'fnumber' => 'F Number', - 'exposureprogram' => 'Exposure Program', - 'spectralsensitivity' => 'Spectral Sensitivity', - 'isospeedratings' => 'ISO Speed Ratings', - 'oecf' => 'OECF', - 'shutterspeedvalue' => 'Shutter Speed Value', - 'aperturevalue' => 'Aperture Value', - 'brightnessvalue' => 'Brightness Value', - 'exposurebiasvalue' => 'Exposure Bias Value', - 'maxaperturevalue' => 'MaxAperture Value', - 'subjectdistance' => 'Subject Distance', - 'meteringmode' => 'Metering Mode', - 'lightsource' => 'Light Source', - 'flash' => 'Flash', - 'focallength' => 'Focal Length', - 'subjectarea' => 'Subject Area', - 'flashenergy' => 'Flash Energy', - 'spatialfrequencyresponse' => 'Spatial Frequency Response', - 'focalplanexresolution' => 'Focal Plane X Resolution', - 'focalplaneyresolution' => 'Foca Plane Y Resolution', - 'focalplaneresolutionunit' => 'Focal Plane Resolution Unit', - 'subjectlocation' => 'Subject Location', - 'exposureindex' => 'Exposure Index', - 'sensingmethod' => 'Sensing Method', - 'filesource' => 'File Source', - 'scenetype' => 'Scene Type', - 'cfapattern' => 'CFA Pattern', - 'customrendered' => 'Custom Rendered', - 'exposuremode' => 'Exposure Mode', - 'whitebalance' => 'White Balance', - 'digitalzoomratio' => 'Digital Zoom Ratio', - 'focallengthin35mmfilm' => 'Focal Length In 35mm Film', - 'scenecapturetype' => 'Scene Capture Type', - 'gaincontrol' => 'Gain Control', - 'contrast' => 'Contrast', - 'saturation' => 'Saturation', - 'sharpness' => 'Sharpness', - 'devicesettingdescription' => 'Device Setting Description', - 'subjectdistancerange' => 'Subject Distance Range', - - // H. Other Tags - 'imageuniqueid' => 'Image Unique ID', - -// GPS Attribute Information - // A. Tags Relating to GPS - 'gpsversionid' => 'GPS Version ID', - 'gpslatituderef' => 'GPS Latitude Ref', - 'gpslatitude' => 'GPS Latitude', - 'gpslongituderef' => 'GPS Longitude Ref', - 'gpslongitude' => 'GPS Longitude', - 'gpsaltituderef' => 'GPS Altitude Ref', - 'gpsaltitude' => 'GPS Altitude', - 'gpstimestamp' => 'GPS Timestamp', - 'gpssatellites' => 'GPS Satellites', - 'gpsstatus' => 'GPS Status', - 'gpsmeasuremode' => 'GPS Measure Mode', - 'gpsdop' => 'GPS DOP', - 'gpsspeedref' => 'GPS Speed Ref', - 'gpsspeed' => 'GPS Speed', - 'gpstrackref' => 'GPS Track Ref', - 'gpstrack' => 'GPS Track', - 'gpsimgdirectionref' => 'GPS Img Direction Ref', - 'gpsimgdirection' => 'GPS Img Direction', - 'gpsmapdatum' => 'GPS Map Datum', - 'gpsdestlatituderef' => 'GPS Dest Latitude Ref', - 'gpsdestlatitude' => 'GPS Dest Latitude', - 'gpsdestlongituderef' => 'GPS Dest Longitude Ref', - 'gpsdestlongitude' => 'GPS Dest Longitude', - 'gpsdestbearingref' => 'GPS Dest Bearing Ref', - 'gpsdestbearing' => 'GPS Dest Bearing', - 'gpsdestdistanceref' => 'GPS Dest Distance Ref', - 'gpsdestdistance' => 'GPS Dest Distance', - 'gpsprocessingmethod' => 'GPS Processing Method', - 'gpsareainformation' => 'GPS Area Information', - 'gpsdatestamp' => 'GPS DateStamp', - 'gpsdifferential' => 'GPS Differential', - -// Custom Makernotes - 'jpegcomment' => 'JPEG Comment' -); +/** + * Modificate metadata and save the information back to the file (iptc and xmp) + */ +class LinMetaDataModificate extends LinMetaData +{ -$GLOBALS['Tags_Iptc'] = Array( - 'caption' => 'Caption', - 'caption_writer' => 'Caption Writer', - 'headline' => 'Headline', - 'instructions' => 'Special Instructions', - 'keywords' => 'Keywords', - 'category' => 'Category', - 'supplemental_categorie' => 'Supplemental Category', - 'copyright' => 'Copyright Notice', - 'byline' => 'By-Line (Author)', - 'byline_title' => 'By-Line Title', - 'credit' => 'Credit', - 'source' => 'Source', - 'edit_status' => 'Edit Status', - 'priority' => 'Priority', - 'object_cycle' => 'Object Cycle', - 'job_id' => 'Fixture Identifier', - 'program' => 'Originating Program', - 'object_name' => 'Object Name (Title)', - 'date_created' => 'Date Created', - 'date_released' => 'Release Date', - 'time_created' => 'Time Created', - 'time_released' => 'Release Time', - 'city' => 'City', - 'sublocation' => 'Sub-Location', - 'state' => 'Province/State', - 'country' => 'Country Name', - 'country_code' => 'Country Code', - 'trans_reference' => 'Transmission Reference' -); +/** + * edit iptc functions + */ + /** + * edit IPTC Data in HTML popup + */ + function editIptcData() + { + + } + + /** + * save modified IPTC data to DB + */ + function saveModIptcData() + { + + } + +} // end class LinMetaDataModificate + + +/** + * class LinMetaData + * + * some common definitions which are used in more than one child class of LinMetaData + */ +class LinMetaData +{ + public $available_fields, $defined_fields; + + static $Tags = array( + + 'exif' => array( + // TIFF Rev. 6.0 Attribute Information + // A. Tags relating to image data structure + 'imagewidth' => array('name' => 'Image Width', 'pathkey' => 'ImageWidth', 'pathvalue' => ''), + 'imagelength' => array('name' => 'Image Length', 'pathkey' => 'ImageLength', 'pathvalue' => ''), + 'bitspersample' => arra... [truncated message content] |
From: <bz...@us...> - 2006-11-13 13:54:54
|
Revision: 4647 http://svn.sourceforge.net/linpha/?rev=4647&view=rev Author: bzrudi Date: 2006-11-13 05:54:32 -0800 (Mon, 13 Nov 2006) Log Message: ----------- fixed broken search, made image rotating by menu (partially) work Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/ChangeLog 2006-11-13 13:54:32 UTC (rev 4647) @@ -1,3 +1,8 @@ +2006-11-13 bzrudi + * fixed broken search + * made image ratating by menu work (there is a know problem with the aspect + ratio I will later on have a closer look) + 2006-11-12 flo * changed upload behaviour: only images and videos allowed to be uploaded if you have a public upload folder, its dangerous if the user may upload own php files! Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -482,7 +482,48 @@ } +/** + * Rotates images when called from menu direction left/right. + * Insert rotation value into linpha_photos and swap + * also image width and height in table. + * Later do a force recreate + * + * @param string $direction either 90 (right turn) or -90 (left turn) + * @param int $linID + * + */ + + function rotateImageByMenuCall($direction, $linId) + { + /** + * Insert ration value in linpha_photos + */ + $rotate = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET rotate='".$direction."' " . + "WHERE id='".$linId."'"); + + /** + * Swap image width and height + */ + $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . + "FROM ".LIN_PREFIX."photos " . + "WHERE id='".$linId."' "); + + $swap = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . + "width = '".$imagedata['height']."', " . + "height = '".$imagedata['width']."' " . + "WHERE id='".$linId."'"); + + /** + * force recreate with new values + */ + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail( $linId ); + } + + /** * returns the full path to the cached image * in thumb mode, $id is the photoid Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -436,9 +436,9 @@ { $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = '#'; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_left'; $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = '#'; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_right';; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) @@ -554,9 +554,15 @@ } break; case 'rotate_left': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); + } + break; case 'rotate_right': if($GLOBALS['linpha']->sql->isAdmin()) { + LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); } break; case 'basket_add_all': Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/modules/module.search.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -246,7 +246,7 @@ * exif/iptc/xmp */ include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaData(); /** * exif @@ -433,9 +433,7 @@ (isset($need_iptc_table) ? "LEFT OUTER JOIN ".LIN_PREFIX."meta_iptc ON ".LIN_PREFIX."photos.md5sum = ".LIN_PREFIX."meta_iptc.md5sum " : ''). "WHERE ".$sql_buttons.$sql_categories.$sql_exif_date.$sql_albums.'1=1'; - $linpha->db->debug = true; $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc($sql_begin.$sql_where); - $linpha->db->debug = false; if( count($linpha->imgview->photos) == 0 ) { @@ -448,7 +446,7 @@ } $GLOBALS['linpha']->template->output['navigation'] .= '<a class="button" href="'.LINPHA_LINK.'&linCat=search&cmd=new">'. - i18n("New Search").'</a>'. + i18n("New Search").'</a> '. '<a class="button" href="'.LINPHA_LINK.'&linCat=search&cmd=edit">'. i18n("Edit Search").'</a>'; Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/templates/default/search.html.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -79,7 +79,7 @@ } include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaData(); /** * Exif/Iptc/Xmp Informations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-13 21:58:28
|
Revision: 4649 http://svn.sourceforge.net/linpha/?rev=4649&view=rev Author: fangehrn Date: 2006-11-13 13:58:18 -0800 (Mon, 13 Nov 2006) Log Message: ----------- 2006-11-13 flo * changed behaviour of the session data on logout dont destroy the session, only delete the user sensitive informations like username, userid, user_groups and user_displayname * fixed view_basket view * fixed bug in exif index Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/templates/default/basket.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/ChangeLog 2006-11-13 21:58:18 UTC (rev 4649) @@ -1,3 +1,10 @@ +2006-11-13 flo + * changed behaviour of the session data + on logout dont destroy the session, only delete the user sensitive informations + like username, userid, user_groups and user_displayname + * fixed view_basket view + * fixed bug in exif index + 2006-11-13 bzrudi * fixed broken search * made image ratating by menu work (there is a know problem with the aspect Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -492,14 +492,13 @@ * @param int $linID * */ - - function rotateImageByMenuCall($direction, $linId) + function rotateImageByMenuCall($direction, $linId) { /** * Insert ration value in linpha_photos */ $rotate = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET rotate='".$direction."' " . + "SET rotate='".LinSql::linAddslashes($direction)."' " . "WHERE id='".$linId."'"); /** @@ -507,12 +506,12 @@ */ $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . "FROM ".LIN_PREFIX."photos " . - "WHERE id='".$linId."' "); + "WHERE id='".LinSql::linAddslashes($linId)."' "); $swap = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . - "width = '".$imagedata['height']."', " . - "height = '".$imagedata['width']."' " . - "WHERE id='".$linId."'"); + "width = '".LinSql::linAddslashes($imagedata['height'])."', " . + "height = '".LinSql::linAddslashes($imagedata['width'])."' " . + "WHERE id='".LinSql::linAddslashes($linId)."'"); /** * force recreate with new values Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -166,6 +166,14 @@ $this->adminCommands(); } + if(isset($_GET['linMsg'])) + { + switch($_GET['linMsg']) + { + case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; + } + } + /** * set ref urls * used in basket and ajax reloadmenu @@ -436,9 +444,9 @@ { $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_right';; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -377,7 +377,7 @@ /** * there are currently only entries at level deep 2 and 5 in the array */ - $array_pieces = explode('/',$value['pathvalue']); + $array_pieces = explode('/',LinMetaData::$Tags['exif'][$key]['pathvalue']); switch(count($array_pieces)) { case 2: @@ -399,7 +399,7 @@ } break; default: - echo "Error no valid path for key: ".$key." value: ".$value['pathvalue']."<br />"; + echo "Error no valid path for key: ".$key." value: ".LinMetaData::$Tags['exif'][$key]['pathvalue']."<br />"; break; } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -282,8 +282,16 @@ { linLog(LOG_TYPE_USER,LOG_NOTICE,'logout','User '.$_SESSION['user_name'].': logged out'); - $_SESSION = array(); // delete all session data - session_destroy(); // destroy session + /** + * do not destroy the session because we save a lot of other informations in the session + * like: ref_url, use_ajax, ... + * $_SESSION = array(); // delete all session data + * session_destroy(); // destroy session + */ + unset($_SESSION['user_name']); + unset($_SESSION['user_id']); + unset($_SESSION['user_groups']); + unset($_SESSION['user_display_name']); if(isset($_COOKIE['linpha_userid'])) { setcookie('linpha_userid'); // delete cookie linpha_userid Modified: trunk/linpha2/lib/modules/module.ajax.php =================================================================== --- trunk/linpha2/lib/modules/module.ajax.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/modules/module.ajax.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -65,12 +65,10 @@ { if( isset($_SESSION['ref_url_base']) ) { - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); - $linpha->imgview->setCurrentView($_SESSION['ref_modulename']); - + $linpha->template->URL_base = $_SESSION['ref_url_base']; $linpha->template->URL_full = $linpha->template->URL_base.'&linId='.$linpha->template->idCurrent; $_SESSION['ref_url_full'] = $linpha->template->URL_full; @@ -79,7 +77,6 @@ } else // return a default menu { - } $linpha->template->printMenus('home,search,login,more,icons,settings,admin',$comingfrom_ajax=true); Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/lib/modules/module.basket.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -25,10 +25,6 @@ if(!defined('LINPHA_DIR')) { exit(1); } -@ini_set("memory_limit", "100M"); // try to increase memory_limit -@ini_set('max_execution_time','1000'); // try remove php script time limit of 30 sec -@set_time_limit(0); // try remove php script time limit of 30 sec - /** * parse POST data and GET commands */ @@ -48,6 +44,10 @@ */ if( isset( $_REQUEST['cmd'] ) ) { + @ini_set("memory_limit", "100M"); // try to increase memory_limit + @ini_set('max_execution_time','1000'); // try remove php script time limit of 30 sec + @set_time_limit(0); // try remove php script time limit of 30 sec + switch($_REQUEST['cmd']) { case 'checkout': @@ -125,7 +125,7 @@ } } - Header("Location: ".linConvertAmp($_SESSION['basket_ref_url'])); + Header("Location: ".linConvertAmp($_SESSION['ref_url_full'])."&linMsg=basket_added"); exit(); case 'remove_all': @@ -180,7 +180,7 @@ /** * create select form */ - $GLOBALS['linpha']->template->output['select_checkout'] = '<option value=""></option>'."\n"; + $GLOBALS['linpha']->template->output['select_checkout'] = ''; if( $GLOBALS['linpha']->sql->checkPermission('basket_download') ) { $GLOBALS['linpha']->template->output['select_checkout'] .= '<option value="download"'. Modified: trunk/linpha2/templates/default/basket.html.php =================================================================== --- trunk/linpha2/templates/default/basket.html.php 2006-11-13 21:57:49 UTC (rev 4648) +++ trunk/linpha2/templates/default/basket.html.php 2006-11-13 21:58:18 UTC (rev 4649) @@ -8,18 +8,19 @@ <?php } ?> <br /><br /> + <h1 class="linStyle"><?php echo i18n("Basket"); ?></h1> - <br /> - <form name="basket_checkout" action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <h2 class="linStyle">1. <?php echo i18n("Select Checkout"); ?></h2> + <?php if($linTpl->output['select_checkout']!='') { ?> + <form name="basket_checkout" action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <h2 class="linStyle">1. <?php echo i18n("Select Checkout"); ?></h2> + <select name="checkout_as" class="linForms" onchange="document.basket_checkout.submit()"> + <option value=""></option> + <?php echo $linTpl->output['select_checkout']; ?> + </select> + </form> + <br /> + <?php } ?> - <select name="checkout_as" class="linForms" onchange="document.basket_checkout.submit()"> - <?php echo $linTpl->output['select_checkout']; ?> - </select> - - </form> - <br /> - <?php if(isset($_REQUEST['checkout_as'])) { @@ -190,10 +191,14 @@ foreach($linTpl->output['basket_folder_contents'][$value] AS $sub_value) { ?> - <div style='float: left;'> - <label for='<?php echo $i; ?>'><img style='cursor: pointer;' src='<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$sub_value; ?>' class='img_thumbnail' /></label> + <div style="float: left;"> + <label for="<?php echo $i; ?>"><img style="cursor: pointer;" src="<?php + echo LINPHA_CLIENT.'/get_thumb.php?linId='.$sub_value; ?>" width="<?php + echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php + echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; + ?>" class="img_thumbnail" /></label> <br /> - <input type='checkbox' id='<?php echo $i; ?>' name='img_id[]' value='<?php echo $sub_value; ?>'> + <input type="checkbox" id="<?php echo $i; ?>" name="img_id[]" value="<?php echo $sub_value; ?>"> </div> <?php $i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2006-11-15 15:21:58
|
Revision: 4653 http://svn.sourceforge.net/linpha/?rev=4653&view=rev Author: bzrudi Date: 2006-11-15 07:21:56 -0800 (Wed, 15 Nov 2006) Log Message: ----------- fixed bug in photos_cache table, where img_width and img_height were wrong Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-15 08:25:19 UTC (rev 4652) +++ trunk/linpha2/ChangeLog 2006-11-15 15:21:56 UTC (rev 4653) @@ -1,3 +1,11 @@ +2006-11-15 bzrudi + * fixed bug in photos_cache table, where img_width and img_height were wrong + for images which needs rotating (by EXIF tag) + @todo: get_images.php should take width and height values from photos_cache + if image is already in cache!? (currently images which need rotating by + EXIF are created OK in cache path, but get_images.php distorts them while + viewing due wrong use of width and height for those images. + 2006-11-13 flo * changed behaviour of the session data on logout dont destroy the session, only delete the user sensitive informations Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-15 08:25:19 UTC (rev 4652) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-15 15:21:56 UTC (rev 4653) @@ -39,6 +39,7 @@ private $src_file; private $img_width, $img_height; private $img_quality; +private $no_size_override; /** * constructor @@ -212,14 +213,36 @@ { return false; } - + + /** + * this results in fliped img_width and img_height for later photos_cache + * compare, we take care of it below... + */ $array = $this->scaleToFit($this->org_width,$this->org_height,$this->max_width,$this->max_height); $this->img_width = $array['w']; - $this->img_height = $array['h']; - + $this->img_height = $array['h']; + /** * check if entry in linpha_photos_cache exists */ + /** + * Take care of fliped img_width and img_height, or it will result in a + * cache hit miss (scaleToFit() (above) takes the width and height from + * photos table, where values are wrong for images which need rotate) + */ + $rot = $GLOBALS['linpha']->db->GetRow("SELECT is_rotated, img_width, img_height " . + "FROM ".LIN_PREFIX."photos_cache " . + "WHERE photo_id = '".$this->photo_id."' "); + + if(isset($rot['is_rotated']) && $rot['is_rotated'] != 0) + { + + $dummy_height = $this->img_height; + $this->img_height = $this->img_width; + $this->img_width = $dummy_height; + linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Flipping width and height to get cache hit for image # ".$this->photo_id); + } + $data = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE " . "photo_id = '".$this->photo_id."' AND " . "img_width = '".$this->img_width."' AND " . @@ -230,11 +253,16 @@ if(isset($data['id']) && !empty($data['id'])) { + linLog(LOG_TYPE_IMPORT,LOG_INFO,'debug',"Cache HIT for image # ".$this->photo_id); + $this->cached_id = $data['id']; $this->output_file = LinImage::getCachePath('img',$this->cached_id,$this->img_type); } else { + linLog( LOG_TYPE_IMPORT,LOG_INFO,'image',"Cache MISS for image # ".$this->photo_id); + + /** * insert an empty entry and get cached_id * we will update correct values only if create cached image has been successfull @@ -456,7 +484,19 @@ $this->error_msg = "Incorrect filesize (".$filesize.")"; return false; } - + + /** + * If image needs rotating (by EXIF value) flip width and height + * to have the right values in photos_cache + */ + if($this->rotate != 0) + { + $dummy_height = $this->img_height; + $this->img_height = $this->img_width; + $this->img_width = $dummy_height; + linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Height/width flip during storage of image # ".$this->photo_id." in photos_cache" ); + + } $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos_cache SET " . "img_width = '".$this->img_width."', " . "img_height = '".$this->img_height."', " . @@ -484,8 +524,8 @@ /** * Rotates images when called from menu direction left/right. - * Insert rotation value into linpha_photos and swap - * also image width and height in table. + * Insert rotation value into linpha_photos and flip image width + * and height in table. * Later do a force recreate * * @param string $direction either 90 (right turn) or -90 (left turn) @@ -502,13 +542,13 @@ "WHERE id='".$linId."'"); /** - * Swap image width and height + * Flip image width and height */ $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . "FROM ".LIN_PREFIX."photos " . "WHERE id='".LinSql::linAddslashes($linId)."' "); - $swap = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . + $flip = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . "width = '".LinSql::linAddslashes($imagedata['height'])."', " . "height = '".LinSql::linAddslashes($imagedata['width'])."' " . "WHERE id='".LinSql::linAddslashes($linId)."'"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-15 23:22:29
|
Revision: 4655 http://svn.sourceforge.net/linpha/?rev=4655&view=rev Author: fangehrn Date: 2006-11-15 15:22:22 -0800 (Wed, 15 Nov 2006) Log Message: ----------- 2006-11-15 flo * resolve category names in MetaData::readInformations() * "cache sql querys" in MetaData::readInformations() if we have to read a lot of metadata of the thumbnails the sql queries are reduced now by factor 3-4 Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.oci8po.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/ChangeLog 2006-11-15 23:22:22 UTC (rev 4655) @@ -1,3 +1,9 @@ +2006-11-15 flo + * resolve category names in MetaData::readInformations() + * "cache sql querys" in MetaData::readInformations() + if we have to read a lot of metadata of the thumbnails + the sql queries are reduced now by factor 3-4 + 2006-11-15 bzrudi * fixed bug in photos_cache table, where img_width and img_height were wrong for images which needs rotating (by EXIF tag) Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -66,6 +66,7 @@ "md5sum VARCHAR(32) NOT NULL default '', " . "width INT NOT NULL default '0', " . "height INT NOT NULL default '0', " . + "filesize INT NOT NULL default '0', " . "time_add INT NOT NULL default '0', " . "time_mod INT NOT NULL default '0', " . "time_exif INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/install/sql/sql.oci8po.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/install/sql/sql.oci8po.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -61,6 +61,7 @@ "md5sum VARCHAR2(32), " . "width NUMBER(10) default '0', " . "height NUMBER(10) default '0', " . + "filesize NUMBER(10) default '0', " . "time_add NUMBER(12) DEFAULT '0', " . "time_mod NUMBER(12) DEFAULT '0', " . "time_exif NUMBER(12) DEFAULT '0', " . Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -61,6 +61,7 @@ "md5sum VARCHAR(32) NOT NULL default '', " . "width INT NOT NULL default '0', " . "height INT NOT NULL default '0', " . + "filesize INT NOT NULL default '0', " . "time_add INT NOT NULL default '0', " . "time_mod INT NOT NULL default '0', " . "time_exif INT NOT NULL default '0', " . Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -61,6 +61,7 @@ "md5sum VARCHAR(32) NOT NULL default '', " . "width INTEGER NOT NULL default '0', " . "height INTEGER NOT NULL default '0', " . + "filesize INTEGER NOT NULL default '0', " . "time_add INTEGER NOT NULL default '0', " . "time_mod INTEGER NOT NULL default '0', " . "time_exif INTEGER NOT NULL default '0', " . Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -28,6 +28,7 @@ "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . + "".LIN_PREFIX."photos.filesize AS filesize, " . "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" @@ -623,6 +624,7 @@ * create thumbnail info text (filename, description, etc.) */ $i=0; + $MetaData = new LinMetaDataRead(); foreach($this->photos_filtered AS $key=>$photo_value) { if($_SESSION['mode_thumbview'] == 'thumbdetail') { @@ -631,11 +633,7 @@ $flag_nr = 13; // flag nr of thumb } - $array_image_infos = LinMetaDataRead::readInformations( - $photo_value, - LinSql::getFullImagePath( $photo_value['id'] ), - $flag_nr - ); + $array_image_infos = $MetaData->readInformations($photo_value,$flag_nr); $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; @@ -669,7 +667,6 @@ $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height - /** * switch between javascript */ @@ -948,14 +945,10 @@ /** * album informations */ - + $MetaData = new LinMetaDataRead(); foreach($this->photos_filtered AS $photo_key=>$photo_value) { - $array_image_infos = LinMetaDataRead::readInformations( - $photo_value, - LinSql::getFullImagePath( $photo_value['id'] ), - $flag_nr=12 - ); + $array_image_infos = $MetaData->readInformations($photo_value,$flag_nr=12); $this->photos_filtered[$photo_key]['album_infos'] = ''; foreach($array_image_infos AS $key=>$value) @@ -1097,7 +1090,7 @@ "FROM ".LIN_PREFIX."meta_comments " . "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); - if( $query->EOF ) + if( $query->EOF ) // insert { $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . "VALUES ('".time()."','".$GLOBALS['linpha']->template->idCurrent."','".linSql::linAddslashes($_POST['author'])."'," . @@ -1134,7 +1127,6 @@ { $GLOBALS['linpha']->template->output['comment_text'] = ''; } - } @@ -1239,9 +1231,9 @@ $this->viewImgStoreImageInformation(); - $GLOBALS['linpha']->template->output['image_infos'] = LinMetaDataRead::readInformations( + $MetaData = new LinMetaDataRead(); + $GLOBALS['linpha']->template->output['image_infos'] = $MetaData->readInformations( $this->photos_filtered[ $this->current_key ], - $this->src_file, $flag_nr=10 ); @@ -1418,8 +1410,6 @@ $GLOBALS['linpha']->template->setModuleName('view_img_static'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); - $this->viewImgCommon(); - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { /** @@ -1446,12 +1436,14 @@ { $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_data ". "(field_id, md5sum, meta_data) VALUES " . - "('".linSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); + "('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); } } } } } + + $this->viewImgCommon(); } } // end class linImgview Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -170,13 +170,14 @@ linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_new',"New: ".$dirname.'/'.$filename); - list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate) = + list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate,$filesize) = LinImport::getFileInformation($dirname,$filename); $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."photos ( " . - "parent_id, name, img_type, md5sum, width, height, time_add, time_mod, time_exif, rotate, stats_numbers ) " . + "parent_id, name, img_type, md5sum, width, height, filesize, time_add, time_mod, time_exif, rotate, stats_numbers ) " . "VALUES ( '".$parent_id."' , '".$GLOBALS['linpha']->sql->linAddslashes($filename)."', '".$file_type."'," . - "'".$md5sum."' , '".$org_width."' , '".$org_height."' , '".time()."', '".filemtime($dirname.'/'.$filename)."', '".$time_exif."', '".$rotate."', '".$stats_number."' )"); + "'".$md5sum."' , '".$org_width."' , '".$org_height."' , '".$filesize."', '".time()."', " . + "'".filemtime($dirname.'/'.$filename)."', '".$time_exif."', '".$rotate."', '".$stats_number."' )"); /** * delete thumbnail if one exists with the same id @@ -279,14 +280,14 @@ */ function updateEntry( $id , $dirname , $filename ) { - list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate) + list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate,$filesize) = LinImport::getFileInformation($dirname,$filename); $data = $GLOBALS['linpha']->db->GetRow("SELECT img_type, md5sum " . "FROM ".LIN_PREFIX."photos WHERE id = '".$id."'"); /** - * update file_type + * file type changed (not the file content) -> update file_type * * on change of file_type, change: * - img_type @@ -294,7 +295,7 @@ * - time_exif * - stats_numbers */ - if($file_type != $data[0]) + if($file_type != $data['img_type']) { linSysLog(i18n("Import").': '.i18n("Detected a change of file type, update entry of:").' '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_update',"Detected a change of file type, update entry of: ".$dirname.'/'.$filename); @@ -305,26 +306,30 @@ } /** - * update md5sum + * file data change -> update md5sum * * on change of md5sum, change: * - width and height + * - filesize * - time_exif, time_mod - * - rotate ?) + * - rotate (maybe the file got an orientation tag, or the file has been autorotated with an external program) */ /** * @todo hey, thats a nice feature! we are now able to detect * changes on images and update the md5sum of the images in the comments etc.!! */ - if($md5sum != $data[1]) + if($md5sum != $data['md5sum']) { linSysLog(i18n("Import").': '.i18n("Detected a change of file data, update entry of:").' '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_update',"Detected a change of file data, update entry of: ".$dirname.'/'.$filename); - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET md5sum = '".$md5sum."', width = '".$org_width."', height = '".$org_height."', time_mod = '".filemtime($dirname.'/'.$filename)."', time_exif = '".$time_exif."', rotate = '".$rotate."' WHERE id = '".$id."'"); + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . + "md5sum = '".$md5sum."', width = '".$org_width."', height = '".$org_height."', " . + "filesize='".$filesize."', time_mod = '".filemtime($dirname.'/'.$filename)."', " . + "time_exif = '".$time_exif."', rotate = '".$rotate."' " . + "WHERE id = '".$id."'"); - LinImport::updateMd5sum( $id, $data[1], $md5sum ); + LinImport::updateMd5sum( $id, $data['md5sum'], $md5sum ); $thumbnail = new LinImage(); $_GET['force'] = true; @@ -386,6 +391,7 @@ $rotate = "0"; $org_width = "0"; $org_height = "0"; + $filesize = 0; $ext = LinFilesys::getFileExtFromPath($filename); if($filename{0} == '.') @@ -426,6 +432,7 @@ elseif( is_file( $dirname.'/'.$filename ) ) { list($org_width,$org_height,$file_type) = LinIdentify::linGetImageSize($dirname.'/'.$filename); + $filesize = filesize($dirname.'/'.$filename); /** * calculate md5sum (not for videos we have @@ -481,7 +488,7 @@ linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo','Error: what am i? '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); } - return array($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate); + return array($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate,$filesize); } /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-15 15:40:45 UTC (rev 4654) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-15 23:22:22 UTC (rev 4655) @@ -31,6 +31,8 @@ */ class LinMetaDataRead extends LinMetaData { + public $cachedFieldNames, $cachedSelectedFieldNames, $cachedFieldIds; + /** * read image information from database * and escape data with htmlspecialchars() if necessary @@ -38,25 +40,35 @@ * @param array array_src_infos array containing needed source file informations, same as LIN_SELECT_FIELDS * */ - function readInformations($array_src_infos, $full_filename, $flag_nr) + function readInformations($array_src_infos, $flag_nr) { - $query = $GLOBALS['linpha']->db->Execute("SELECT name " . - "FROM ".LIN_PREFIX."meta_fields " . - "WHERE flags = '".$flag_nr."' ORDER by id"); - - while($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) + //$GLOBALS['linpha']->db->debug = true; + + /** + * cache field names if not already done + * readInformations() is executed for each thumbnail on a folder + * save a lot of time if do it only once! + */ + if( !isset($this->cachedSelectedFieldNames) OR !is_array($this->cachedSelectedFieldNames)) { - $name = LinMetaData::getNameOfField( $fields_data['0'], false ); + $query = $GLOBALS['linpha']->db->Execute("SELECT name " . + "FROM ".LIN_PREFIX."meta_fields " . + "WHERE flags = '".$flag_nr."' ORDER by id"); + + while($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) + { + $this->cachedSelectedFieldNames[] = $fields_data['0']; + } + } + + foreach($this->cachedSelectedFieldNames AS $field_name) + { + $name = $this->getNameOfField( $field_name, false ); $value = ''; - $pos = strpos($fields_data['0'],'_'); - $first_part = substr($fields_data['0'],0,$pos); - $last_part = substr($fields_data['0'],$pos+1); - /** - * get field id - */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id " . - "FROM ".LIN_PREFIX."meta_fields WHERE name = '".$last_part."'"); + $pos = strpos($field_name,'_'); + $first_part = substr($field_name,0,$pos); + $last_part = substr($field_name,$pos+1); switch($first_part) { @@ -64,67 +76,86 @@ switch($last_part) { - case 'filename': - $value = $array_src_infos['name']; // is already escaped - break; - case 'imagesize': - $value = LinFilesys::niceFilesize( filesize( $full_filename ), 2 ); - break; - case 'dimension': - $value = $array_src_infos['width'].'x'.$array_src_infos['height']; - break; - case 'thumbnail': - $value = 'thumbnail'; - break; - case 'time_add': - $name = i18n("Date Added"); - $value = linStrftime($array_src_infos['time_add']); - break; - case 'time_mod': - $name = i18n("Date Modified"); - $value = linStrftime($array_src_infos['time_mod']); - break; - case 'time_exif': - $name = i18n("Date Taken"); - $value = linStrftime($array_src_infos['time_exif']); - break; - case 'stats_numbers': - $name = i18n("Photos"); - $value = $array_src_infos['stats_numbers']; - break; - case 'stats_views': - $name = i18n("Nr Of Views"); - $value = $array_src_infos['stats_views']; - break; - case 'stats_downloads': - $name = i18n("Nr Of Downloads"); - $value = $array_src_infos['stats_downloads']; - break; + case 'filename': + $value = $array_src_infos['name']; // is already escaped + break; + case 'imagesize': + $value = LinFilesys::niceFilesize( $array_src_infos['filesize'], 2 ); + break; + case 'dimension': + $value = $array_src_infos['width'].'x'.$array_src_infos['height']; + break; + case 'thumbnail': + $value = 'thumbnail'; + break; + case 'time_add': + $name = i18n("Date Added"); + $value = linStrftime($array_src_infos['time_add']); + break; + case 'time_mod': + $name = i18n("Date Modified"); + $value = linStrftime($array_src_infos['time_mod']); + break; + case 'time_exif': + $name = i18n("Date Taken"); + $value = linStrftime($array_src_infos['time_exif']); + break; + case 'stats_numbers': + $name = i18n("Photos"); + $value = $array_src_infos['stats_numbers']; + break; + case 'stats_views': + $name = i18n("Nr Of Views"); + $value = $array_src_infos['stats_views']; + break; + case 'stats_downloads': + $name = i18n("Nr Of Downloads"); + $value = $array_src_infos['stats_downloads']; + break; + + default: + /** + * description, category, persons, date (field entries which are stored in linpha_meta_data) + */ + /** + * get field id, and cache it + */ + if( !isset($this->cachedFieldIds[$last_part]) ) + { + $this->cachedFieldIds[$last_part] = $GLOBALS['linpha']->db->GetOne("SELECT id " . + "FROM ".LIN_PREFIX."meta_fields WHERE name = '".$last_part."'"); + } + + /** + * get data + */ + $meta_data = $GLOBALS['linpha']->db->GetOne("SELECT meta_data " . + "FROM ".LIN_PREFIX."meta_data ". + "WHERE field_id = '".$this->cachedFieldIds[$last_part]."' " . + "AND md5sum = '".$array_src_infos['md5sum']."'"); + + if( !empty($meta_data) ) { + $value = htmlspecialchars($meta_data,ENT_QUOTES); + } + break; + } // end switch($last_part) + break; // end case 'builtin' - default: - - /** - * description, category, persons, date (field entries which are stored in linpha_meta_data) - */ - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . - "FROM ".LIN_PREFIX."meta_data ". - "WHERE field_id = '".$data['id']."' " . - "AND md5sum = '".$array_src_infos['md5sum']."'"); - - if(isset($meta_data['meta_data'])) { - $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); - } - } case 'id': // own fields - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . + + /** + * get data + */ + $meta_data = $GLOBALS['linpha']->db->GetOne("SELECT meta_data " . "FROM ".LIN_PREFIX."meta_data " . - "WHERE field_id = '".$data['id']."' " . + "WHERE field_id = '".$last_part."' " . "AND md5sum = '".$array_src_infos['md5sum']."'"); - if(isset($meta_data['meta_data'])) { - $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); + if(isset($meta_data) && !empty($meta_data)) { + $value = htmlspecialchars($meta_data,ENT_QUOTES); } break; + case 'exif': if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { $exif_data = $GLOBALS['linpha']->db->GetRow("SELECT ".$last_part." " . @@ -149,7 +180,43 @@ if($value != '') { - $output_array[$fields_data['name']] = Array('name' => $name, 'value' => $value); + /** + * get category names if the data looks like ';5;4;44;' or at least ';2;' + */ + if( preg_match( '/^;[0-9;]*;$/', $value) ) + { + $array_catids = linExplodeAndSlice(';',$value); + $str_catnames = ''; + $isValidCategory = true; + for($i=1; list($key,$catid) = each($array_catids) ; $i++) + { + $str_catnames .= $GLOBALS['linpha']->db->GetOne("SELECT name FROM ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($catid)."'"); + + /** + * was this a valid category id? + * maybe someone just added ;nice; as a description + * + * this will only check the first category id, but thats okay + */ + if(empty($str_catnames)) + { + $isValidCategory = false; + break; + } + + if( $i < count($array_catids) ) + { + $str_catnames .= ', '; + } + } + + if($isValidCategory) + { + $value = $str_catnames; + } + } + + $output_array[$field_name] = Array('name' => $name, 'value' => $value); } } @@ -869,8 +936,25 @@ break; case 'id': // own fields - $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."meta_fields WHERE id = '".$last_part."'"); - $value = i18n( ucfirst( $data2['name'] ) ); + + /** + * enable cache (only possible in object context) + * we wont have to read this for each thumbnail + */ + if(isset($this->cachedFieldNames[$last_part])) + { + $value = i18n( ucfirst( $this->cachedFieldNames[$last_part] ) ); + } + else + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."meta_fields WHERE id = '".$last_part."'"); + $value = i18n( ucfirst( $data['name'] ) ); + + if(isset($this)) // cache entry, but only in object context + { + $this->cachedFieldNames[$last_part] = $data['name']; + } + } break; case 'exif': $value = LinMetaData::$Tags['exif'][$last_part]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-16 21:46:58
|
Revision: 4657 http://svn.sourceforge.net/linpha/?rev=4657&view=rev Author: fangehrn Date: 2006-11-16 13:46:57 -0800 (Thu, 16 Nov 2006) Log Message: ----------- 2006-11-16 flo * generate also a md5sum for folders take the full filename * dont generate md5sum for the videos anymore we dont have memory limit problems with the builtin md5_file (tested) * show album comment in album container -> we could do such nice stuff without any javascript if IE only would support max-/min-height !!!! add some album comments to test it Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_select.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/themes/default/css/global.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/ChangeLog 2006-11-16 21:46:57 UTC (rev 4657) @@ -1,3 +1,12 @@ +2006-11-16 flo + * generate also a md5sum for folders + take the full filename + * dont generate md5sum for the videos anymore + we dont have memory limit problems with the builtin md5_file (tested) + * show album comment in album container + -> we could do such nice stuff without any javascript if IE only would support max-/min-height !!!! + add some album comments to test it + 2006-11-15 flo * resolve category names in MetaData::readInformations() * some performance improvements: Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/admin/metadata_select.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -75,8 +75,6 @@ * set exif/iptc fields */ $MetaData = new LinMetaDataAdmin(); - $MetaData->setFields('exif'); - $MetaData->setFields('iptc'); ?> <form name="form_image_fields" method="POST" onsubmit="selectAll()"> <div align="center"> @@ -137,6 +135,10 @@ </select> </td> </tr> + <?php + if($flag_nr != 11 && $flag_nr != 12) + { + ?> <tr> <td> <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> @@ -152,6 +154,7 @@ ?> <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php + $MetaData->setFields('exif'); foreach($MetaData->defined_fields['exif'] AS $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; @@ -175,6 +178,7 @@ ?> <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php + $MetaData->setFields('iptc'); foreach($MetaData->defined_fields['iptc'] AS $key=>$value) { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; @@ -183,6 +187,13 @@ </select> </td> </tr> + <?php + } + else + { + echo '<tr><td height="100"></td><td></td></tr><tr><td height="100"></td><td></td></tr>'; + } + ?> </table> <br /> <input type="hidden" name="cmd" value="select_image_fields" /> Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -211,6 +211,10 @@ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('stats_downloads', 0, 1)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('first_comment', 0, 1)"; + + /** * builtin fields * flag_nr 5 (builtin enabled) @@ -260,11 +264,15 @@ * flag_nr 12 */ $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . + "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; + $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . "(name, field_type, flags) VALUES ('builtin_description', 0, 12)"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('builtin_time_add', 0, 12)"; + "(name, field_type, flags) VALUES ('builtin_persons', 0, 12)"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."meta_fields " . - "(name, field_type, flags) VALUES ('builtin_stats_numbers', 0, 12)"; + "(name, field_type, flags) VALUES ('builtin_first_comment', 0, 12)"; /** Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -957,6 +957,10 @@ { $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; } + elseif($key == 'builtin_first_comment') + { + $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value'].'</div>'; + } else { $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; @@ -1088,28 +1092,36 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); if( $query->EOF ) // insert { - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->template->idCurrent."','".linSql::linAddslashes($_POST['author'])."'," . - "'".linSql::linAddslashes($_POST['comment'])."')"); + $GLOBALS['linpha']->db->Execute( + "INSERT into ".LIN_PREFIX."meta_comments " . + "(meta_time, md5sum, meta_author, meta_comment) " . + "VALUES " . + "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . + "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" + ); } else // update { $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". "meta_time = '".time()."', ". - "meta_author = '".linSql::linAddslashes($_POST['author'])."', " . - "meta_comment = '".linSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); + "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . + "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); } } /** * get data */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments"); + $data = $GLOBALS['linpha']->db->GetRow( + "SELECT id, meta_time, meta_author, meta_comment " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$this->md5sum."'" + ); if(isset($data['meta_author'])) { $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -428,33 +428,27 @@ elseif( is_dir( $dirname.'/'.$filename ) ) { $file_type = 0; + $md5sum = md5($dirname.'/'.$filename); } elseif( is_file( $dirname.'/'.$filename ) ) { list($org_width,$org_height,$file_type) = LinIdentify::linGetImageSize($dirname.'/'.$filename); $filesize = filesize($dirname.'/'.$filename); - /** - * calculate md5sum (not for videos we have - * plenty of memory_limit problems here...) - * - * -> but we need an md5sum for statistics, comments, etc. - * -> calculate one of the full filename - * -> with a re-import all is lost... - * - * @todo as we're using php >= 5.0 in linpha 2.0, we can use the builtin md5_file - * do we have such limits with this function either??? - */ - if( LinIdentify::isVideo($file_type) ) + if( LinIdentify::isVideo($file_type) OR LinIdentify::isSupportedImage($file_type) ) { - $md5sum = md5($dirname.'/'.$filename); + /** + * calculate md5sum + * we dont have memory limit for videos anymore with the builtin md5_file() (tested !) + * + * the calculation of a over 200MB file is done in less than 2 seconds on a newer computer + */ + $md5sum = md5_file($dirname.'/'.$filename); $stats_number = 1; } - elseif( LinIdentify::isSupportedImage($file_type) ) + + if( LinIdentify::isSupportedImage($file_type) ) { - $md5sum = md5_file($dirname.'/'.$filename); - $stats_number = 1; - /** * exif date and exif rotate stuff * globally turn off using 'sys_import_exif' if having problems with phpmeta Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -31,7 +31,7 @@ */ class LinMetaDataRead extends LinMetaData { - public $cachedFieldNames, $cachedSelectedFieldNames, $cachedFieldIds; + public $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; /** * read image information from database @@ -42,8 +42,6 @@ */ function readInformations($array_src_infos, $flag_nr) { - //$GLOBALS['linpha']->db->debug = true; - /** * cache field names if not already done * readInformations() is executed for each thumbnail on a folder @@ -112,6 +110,14 @@ $name = i18n("Nr Of Downloads"); $value = $array_src_infos['stats_downloads']; break; + case 'first_comment': + $name = i18n("First Comment"); + $value = $GLOBALS['linpha']->db->GetOne( + "SELECT meta_comment FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".LinSql::linAddslashes($array_src_infos['md5sum'])."' " . + "ORDER by meta_time ASC" + ); + break; default: /** @@ -939,7 +945,7 @@ /** * enable cache (only possible in object context) - * we wont have to read this for each thumbnail + * we dont want have to read this for each thumbnail */ if(isset($this->cachedFieldNames[$last_part])) { @@ -957,13 +963,13 @@ } break; case 'exif': - $value = LinMetaData::$Tags['exif'][$last_part]; + $value = LinMetaData::$Tags['exif'][$last_part]['name']; if($show_exifiptc_in_brackets) { $value .= ' (exif)'; } break; case 'iptc': - $value = LinMetaData::$Tags['iptc'][$last_part]; + $value = LinMetaData::$Tags['iptc'][$last_part]['name']; if($show_exifiptc_in_brackets) { $value .= ' (iptc)'; } Modified: trunk/linpha2/lib/modules/module.filemanager.php =================================================================== --- trunk/linpha2/lib/modules/module.filemanager.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/lib/modules/module.filemanager.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -39,6 +39,11 @@ * prepared with malicious code (there are known security holes in some video players!) */ +/** + * @todo update md5sum while renaming or moving a folder + * on a folder, the md5sum is based on $md5sum = md5($dirname.'/'.$filename); + */ + if(!defined('LINPHA_DIR')) { exit(1); } /** Modified: trunk/linpha2/templates/default/home.html.php =================================================================== --- trunk/linpha2/templates/default/home.html.php 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/templates/default/home.html.php 2006-11-16 21:46:57 UTC (rev 4657) @@ -71,8 +71,10 @@ <div class="linDivFolder"> <?php echo $linTpl->divRoundCorners('top','','albums'); ?> + <div class="linDivThumbnail"> <?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">' . '<img class="linImgFolderThumbnail" src="'. LINPHA_CLIENT.'/get_thumb.php?linId=' .$value['id'] .'" alt="thumbnail_album" /></a>'; ?> + </div> <div class="linDivFolderText"> <h2 class="linStyle"><?php echo '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a>'; ?></h2> @@ -81,8 +83,11 @@ </div> + <div style="clear: both;"></div> + <?php echo $linTpl->divRoundCorners('bottom','','albums'); ?> </div> + <?php } ?> <?php } ?> </div> Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-15 23:25:20 UTC (rev 4656) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-16 21:46:57 UTC (rev 4657) @@ -133,14 +133,12 @@ width: 700px; } - - .linDivFolderText { - margin: 0; - padding: 5px; + .linDivThumbnail { height: 140px; + float: left; } - + .linImgFolderThumbnail { margin: 0; margin-left: 20px; @@ -148,15 +146,23 @@ margin-top: 5px; padding: 0; - float: left; - width: 130px; height: 130px; border: 0; } + .linDivFolderText { + margin: 0; + padding: 5px; + } + .linDivFolderComment { + overflow: auto; + max-height: 300px; + } + + /** * menu */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-17 21:36:16
|
Revision: 4658 http://svn.sourceforge.net/linpha/?rev=4658&view=rev Author: fangehrn Date: 2006-11-17 13:36:12 -0800 (Fri, 17 Nov 2006) Log Message: ----------- * nearly finished meta data support Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/themes/default/css/global.css trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_meta.html.php Added Paths: ----------- trunk/linpha2/templates/default/view_albmeta.html.php Removed Paths: ------------- trunk/linpha2/templates/default/view_albcomment.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/ChangeLog 2006-11-17 21:36:12 UTC (rev 4658) @@ -1,3 +1,6 @@ +2006-11-17 flo + * nearly finished meta data support + 2006-11-16 flo * generate also a md5sum for folders take the full filename Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/admin/index.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -62,15 +62,6 @@ $cat4 = $array[3]; } } - - -/*<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/admin/admin.css'; ?>' type='text/css'> -<link rel='stylesheet' href='<?php echo LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/css/syslog.css'; ?>' type='text/css'> -</head> -<body>*/ ?> <?php Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -105,7 +105,7 @@ { if($active==$key) { - echo '<li class="active"><a href="./?cat='.$value['link'].'" class="current">'.i18n($value['name']).'</a></li>'; + echo '<li><a href="./?cat='.$value['link'].'" class="current">'.i18n($value['name']).'</a></li>'; } else { Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -189,8 +189,8 @@ $post=eregi_replace("^www\\.([^ ,\r\n]*)","[url]http://www.\\1[/url]",$post); // 3. part - $post=preg_replace("/\[url\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=_blank>\\1</a>",$post); - $post=preg_replace("/\[url=(.*)\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=_blank>\\2</a>",$post); + $post=preg_replace("/\[url\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=\"_blank\">\\1</a>",$post); + $post=preg_replace("/\[url=(.*)\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=\"_blank\">\\2</a>",$post); //##### Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -625,7 +625,8 @@ } /** - * deleteCached cached images by photo id + * delete all cached images by this photo id + * (there can be more than one image with the same photo id in different sizes etc.) * * @param int $id id of image in database */ Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -161,30 +161,6 @@ $this->filterPhotosNotPermitted(); /** - * doing some special commands - */ - if(isset($_GET['admin_cmd'])) { - $this->adminCommands(); - } - - if(isset($_GET['linMsg'])) - { - switch($_GET['linMsg']) - { - case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; - } - } - - /** - * set ref urls - * used in basket and ajax reloadmenu - */ - $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; - $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; - $_SESSION['ref_modulename'] = $this->modulename; - - - /** * set mode specific things */ switch($this->mode) @@ -202,8 +178,8 @@ case 'basket': $this->viewBasket(); break; - case 'albcomment': - $this->viewAlbComment(); + case 'albmeta': + $this->viewAlbMeta(); break; } break; @@ -220,6 +196,30 @@ break; } + /** + * doing some special commands + * + * should be done after viewImg(), because adminCommands() (force_import) uses some image informations + */ + if(isset($_GET['admin_cmd'])) { + $this->adminCommands(); + } + + if(isset($_GET['linMsg'])) + { + switch($_GET['linMsg']) + { + case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; + } + } + + /** + * set ref urls + * used in basket and ajax reloadmenu + */ + $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; + $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; + $_SESSION['ref_modulename'] = $this->modulename; /** * set admin menu and more menu @@ -296,7 +296,7 @@ 'name' => i18n("Import"), 'value' => array( array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') + array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') ) ); @@ -403,8 +403,7 @@ array( 'name' => i18n("Metainfo"), 'value' => array( - array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), - array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), ) ); } @@ -562,6 +561,9 @@ $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); } break; + case 'force_import': // called in viewImg + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); + break; case 'rotate_left': if($GLOBALS['linpha']->sql->isAdmin()) { @@ -959,7 +961,11 @@ } elseif($key == 'builtin_first_comment') { - $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value'].'</div>'; + $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value']; + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + $this->photos_filtered[$photo_key]['album_infos'] .= ' <a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$photo_value['id'].'&view=albmeta'.'">Edit</a>'; + } + $this->photos_filtered[$photo_key]['album_infos'] .= '</div>'; } else { @@ -1077,9 +1083,9 @@ /** * setup comment view */ -function viewAlbComment() +function viewAlbMeta() { - $GLOBALS['linpha']->template->setModuleName('view_albcomment'); + $GLOBALS['linpha']->template->setModuleName('view_albmeta'); /** * save data @@ -1215,7 +1221,7 @@ <comment> <time><?php echo linStrftime($data['meta_time']); ?></time> <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> - <text><?php echo htmlspecialchars($data['meta_comment'],ENT_QUOTES); ?></text> + <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> </comment> <?php } ?> </root> @@ -1248,10 +1254,6 @@ $this->photos_filtered[ $this->current_key ], $flag_nr=10 ); - - if(isset($_GET['force_update'])) { - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); - } } @@ -1422,39 +1424,6 @@ $GLOBALS['linpha']->template->setModuleName('view_img_static'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - /** - * save metadata - */ - if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') - { - if(isset($_POST['field'])) - { - /** - * delete existing entries - */ - $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - - foreach($_POST['field'] AS $key=>$value) - { - if(is_array($value)) // coming from a select (categories etc.) - { - $value = ';'.implode(';',$value).';'; - } - - if(! empty($value) ) - { - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_data ". - "(field_id, md5sum, meta_data) VALUES " . - "('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); - } - } - } - } - } - $this->viewImgCommon(); } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -331,9 +331,8 @@ LinImport::updateMd5sum( $id, $data['md5sum'], $md5sum ); - $thumbnail = new LinImage(); - $_GET['force'] = true; - $thumbnail->createThumbnail($id); + LinImage::deleteCachedImage($id, $data['img_type']); // they will automatically be recreated + LinImage::deleteCachedThumbnail($id, $data['img_type']); } } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -112,10 +112,11 @@ break; case 'first_comment': $name = i18n("First Comment"); - $value = $GLOBALS['linpha']->db->GetOne( + $value = linHtmlTag( + $GLOBALS['linpha']->db->GetOne( "SELECT meta_comment FROM ".LIN_PREFIX."meta_comments " . "WHERE md5sum = '".LinSql::linAddslashes($array_src_infos['md5sum'])."' " . - "ORDER by meta_time ASC" + "ORDER by meta_time ASC") ); break; @@ -659,6 +660,124 @@ class LinMetaDataModificate extends LinMetaData { + function saveLinphaMeta() + { + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + /** + * save metadata + */ + if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') + { + if(isset($_POST['field'])) + { + /** + * delete existing entries + */ + $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + + foreach($_POST['field'] AS $key=>$value) + { + if(is_array($value)) // coming from a select (categories etc.) + { + $value = ';'.implode(';',$value).';'; + } + + if(! empty($value) ) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_data ". + "(field_id, md5sum, meta_data) VALUES " . + "('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); + } + } + } + } + } + + } + + function setMetaData() + { + LinMetaDataModificate::saveLinphaMeta(); + + global $linTpl; + + /** + * set meta linpha + */ + $GLOBALS['linpha']->template->output['meta_linpha'] = ''; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . + "FROM ".LIN_PREFIX."meta_fields " . + "WHERE flags = '5' OR flags = '7' ORDER by id"); + while($data = $query->FetchRow()) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<tr><td width="150" valign="top">'; + + if( $data['flags']==5 ) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('builtin_'.$data['name'],false); + } + elseif( $data['flags']==7 ) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('id_'.$data['id'],false); + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td><td>'; + + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".LIN_PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'" . + "AND field_id = '".$data['id']."'"); + + switch($data['field_type']) + { + case 1: + case 3: + if(isset($meta_data['meta_data'])) { + $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); + } else { + $value = ''; + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<input type="text" class="linForms" name="field['.$data['id'].']" value="'.$value.'" style="width: 250px;" maxlength="255" />'; + break; + case 2: + if(isset($meta_data['meta_data'])) { + $array_pieces = linExplodeAndSlice(';',$meta_data['meta_data']); + } else { + $array_pieces = Array(); + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<select name="field['.$data['id'].'][]" class="linForms" size="7" multiple="multiple" style="width: 250px;">'; + + $cat_query = $GLOBALS['linpha']->db->Execute("SELECT id, name " . + "FROM ".LIN_PREFIX."meta_category " . + "WHERE field_id = '".$data['id']."'"); + while($cat_data = $cat_query->FetchRow()) + { + if(in_array($cat_data['id'],$array_pieces)) { + $checked = ' selected="selected"'; + } else { + $checked = ''; + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<option value="'.$cat_data['id'].'"'.$checked.'>'.htmlspecialchars($cat_data['name'],ENT_QUOTES).'</option>'."\n"; + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</select>'; + break; + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td></tr>'; + } + + /** + * set meta iptc + */ + $GLOBALS['linpha']->template->output['meta_iptc'] = '<tr><td>some iptc data</td><td></td></tr>'; + + $fragment = 'edit_meta'; + include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); + } + /** * edit iptc functions */ Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -96,7 +96,7 @@ <?php if($this->layout_name != 'default' && file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css')) { ?> -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; ?>' type='text/css'>\n"; +<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; ?>' type='text/css'> <?php } ?> <!-- body css --> Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/lib/js/LinImage.js 2006-11-17 21:36:12 UTC (rev 4658) @@ -408,40 +408,9 @@ } } - /** - * set comments - */ this.initTextareaAddComment(); - $('linDivComments').innerHTML = ''; + this.setComments(); - if(this.xmlDoc[IdCurrent].getElementsByTagName('comment').length > 0) - { - for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('comment').length; i++) - { - var tagcomment = this.xmlDoc[IdCurrent].getElementsByTagName('comment').item(i); - var commenttime = document.createTextNode( tagcomment.getElementsByTagName('time').item(0).firstChild.data + ' by ' ); - var commentauthor = document.createTextNode( tagcomment.getElementsByTagName('author').item(0).firstChild.data ); - var commenttext = document.createTextNode( tagcomment.getElementsByTagName('text').item(0).firstChild.data ); - - $('linDivComments').appendChild(commenttime); - $('linDivComments').appendChild(commentauthor); - $('linDivComments').appendChild( document.createElement("hr") ); - $('linDivComments').appendChild(commenttext); - $('linDivComments').appendChild( document.createElement("br") ); - $('linDivComments').appendChild( document.createElement("br") ); - - /*var ElemDiv = document.createElement("div"); - ElemDiv.setAttribute('class','comments'); - ElemDiv.appendChild(commenttime); - ElemDiv.appendChild(commentauthor); - ElemDiv.appendChild( document.createElement("br") ); - ElemDiv.appendChild(commenttext); - ElemDiv.appendChild( document.createElement("br") ); - - $('linDivComments').appendChild(ElemDiv);*/ - } - } - /** * set image nr * currently only in slideshow used @@ -930,16 +899,47 @@ // Comments // ----------------------------------------------------------------------------------- + setComments: function() + { + $('linDivComments').innerHTML = ''; + + if(this.xmlDoc[IdCurrent].getElementsByTagName('comment').length > 0) + { + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('comment').length; i++) + { + var tagcomment = this.xmlDoc[IdCurrent].getElementsByTagName('comment').item(i); + var commenttime = document.createTextNode( tagcomment.getElementsByTagName('time').item(0).firstChild.data + ' by ' ); + var commentauthor = document.createTextNode( tagcomment.getElementsByTagName('author').item(0).firstChild.data ); +// var commenttext = document.createTextNode( tagcomment.getElementsByTagName('text').item(0).firstChild.data ); + + var commenttextdiv = Builder.node('div', {id: 'linComment'+i}); + + $('linDivComments').appendChild(commenttime); + $('linDivComments').appendChild(commentauthor); + $('linDivComments').appendChild( document.createElement("hr") ); + $('linDivComments').appendChild(commenttextdiv); + $('linDivComments').appendChild( document.createElement("br") ); + $('linDivComments').appendChild( document.createElement("br") ); + + $('linComment'+i).innerHTML = tagcomment.getElementsByTagName('text').item(0).firstChild.data; + } + } + }, + saveComment: function(t) { - this.xmlDoc[IdCurrent] = t.responseXML.documentElement; + // not use 'this.' doesnt work if call from ajax success function + + myLinImage.xmlDoc[IdCurrent] = t.responseXML.documentElement; - if(this.xmlDoc[IdCurrent].getElementsByTagName('commentadded').length > 0) + if(myLinImage.xmlDoc[IdCurrent].getElementsByTagName('commentadded').length > 0) { - myLinGlobal.linSyslog( this.xmlDoc[IdCurrent].getElementsByTagName('commentadded').item(0).firstChild.data ); + myLinImage.initTextareaAddComment(); + myLinGlobal.linSyslog( myLinImage.xmlDoc[IdCurrent].getElementsByTagName('commentadded').item(0).firstChild.data ); } - myLinImage.loadImage(IdCurrent); // not use 'this.' doesnt work if call from ajax success function + //myLinImage.loadImage(IdCurrent); + myLinImage.setComments(); }, /** Modified: trunk/linpha2/templates/default/fragments.php =================================================================== --- trunk/linpha2/templates/default/fragments.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/templates/default/fragments.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -121,48 +121,132 @@ * the slideshow controls */ case 'slideshow': -?> -<div id="linDivSlideshowControls"> - <div style="float: left; margin-left: 10px; "> - <a href="javascript:myLinImage.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> - <a href="javascript:myLinImage.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> - <a href="javascript:myLinImage.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> - <a href="javascript:myLinImage.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> - <a href="javascript:myLinImage.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> - </div> + ?> + <div id="linDivSlideshowControls"> + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> + <a href="javascript:myLinImage.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> + <a href="javascript:myLinImage.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> + <a href="javascript:myLinImage.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> + <a href="javascript:myLinImage.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> + </div> + + <div style="float: left; margin-left: 40px; "> + <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinImage.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> + <option value="3">3 s</option> + <option value="4">4 s</option> + <option value="5" selected="selected">5 s</option> + <option value="10">10 s</option> + <option value="15">15 s</option> + <option value="30">30 s</option> + <option value="45">45 s</option> + <option value="60">60 s</option> + </select> + </div> - <div style="float: left; margin-left: 40px; "> - <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinImage.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> - <option value="3">3 s</option> - <option value="4">4 s</option> - <option value="5" selected="selected">5 s</option> - <option value="10">10 s</option> - <option value="15">15 s</option> - <option value="30">30 s</option> - <option value="45">45 s</option> - <option value="60">60 s</option> - </select> + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> + <a href="javascript:myLinImage.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> + </div> + + <div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div> + + <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> + <a href="javascript:myLinImage.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> + </div> + + <div style="clear: both;"></div> </div> + <?php echo $linTpl->divRoundCorners('bottom','alpha'); ?> +<?php +break; - <div style="float: left; margin-left: 10px; "> - <a href="javascript:myLinImage.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> - <a href="javascript:myLinImage.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> - <!--<a href="javascript:myLinImage.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> - </div> - <div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div> +/** + * view meta + */ +case 'edit_meta': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { ?> + + <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/css/admin.css'; ?>' type='text/css'> - <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> - <a href="javascript:myLinImage.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <input type="hidden" name="cmd" value="insert_metadata" /> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <ul class="linUlMenu"> + <li><a id="linAMetaLinpha" href="javascript:showMetaLinpha()">LinPHA MetaData</a></li> + <li><a id="linAMetaIptc" href="javascript:showMetaIptc()">XMP (IPTC)</a></li> + </ul> + <div id="linDivMetaIptc"> + <?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { ?> + <table border="0" style="float: left;"> + <?php echo $linTpl->output['meta_iptc']; ?> + <tr> + <td rowspan="2"> + <br /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </table> + <?php } else { + echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; + echo '<br /><br />'; + } + } ?> </div> + <?php } /* end if img_type!=0 */ ?> + + <div id="linDivMetaLinpha"> + <table border="0" style="float: left;"> + <?php echo $linTpl->output['meta_linpha']; ?> + <tr> + <td rowspan="2"> + <br /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </table> + </div> + + <img style="margin-left: 20px;" src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$GLOBALS['linpha']->template->idCurrent; + ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; + ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; + ?>" /> + + </form> - <div style="clear: both;"></div> -</div> -<?php echo $linTpl->divRoundCorners('bottom','alpha'); ?> + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <script language="JavaScript" type="text/javascript"> + <!-- + function showMetaLinpha() + { + $('linAMetaLinpha').className = 'current'; + $('linAMetaIptc').className = ''; + Element.hide('linDivMetaIptc'); + Element.show('linDivMetaLinpha'); + } + + function showMetaIptc() + { + $('linAMetaLinpha').className = ''; + $('linAMetaIptc').className = 'current'; + Element.hide('linDivMetaLinpha'); + Element.show('linDivMetaIptc'); + } + showMetaLinpha(); + --> + </script> + <?php } /* end if img_type!=0 */ ?> -<?php + <?php } /* end if checkPermission('metadata_edit') */ ?> + + <?php break; } ?> Modified: trunk/linpha2/templates/default/themes/default/css/global.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/templates/default/themes/default/css/global.css 2006-11-17 21:36:12 UTC (rev 4658) @@ -160,6 +160,13 @@ .linDivFolderComment { overflow: auto; max-height: 300px; + + margin: 0; + margin-top: 10px; + margin-bottom: 10px; + padding: 0; + + word-wrap: break-word; /* fix ie to force width */ } Deleted: trunk/linpha2/templates/default/view_albcomment.html.php =================================================================== --- trunk/linpha2/templates/default/view_albcomment.html.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/templates/default/view_albcomment.html.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -1,19 +0,0 @@ -<div id="linDivMainOuter"> - <?php echo $linTpl->divRoundCorners('top'); ?> - - <div id="linDivMain"> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - Author: - <input type="text" name="author" value="<?php echo $linTpl->output['comment_author']; ?>" size="40" maxlength="255" /> - <br /> - <textarea name="comment" rows="10" cols="50"><?php echo $linTpl->output['comment_text']; ?></textarea> - <br /> - <input type="hidden" name="cmd" value="add_comment" /> - - <a class="linButton" href="<?php echo $linTpl->URL_full.'&view=thumb'; ?>">back</a> - <input type="submit" class="linButton" name="submit" value="submit" /> - </form> - </div> - - <?php echo $linTpl->divRoundCorners('bottom'); ?> -</div> \ No newline at end of file Copied: trunk/linpha2/templates/default/view_albmeta.html.php (from rev 4657, trunk/linpha2/templates/default/view_albcomment.html.php) =================================================================== --- trunk/linpha2/templates/default/view_albmeta.html.php (rev 0) +++ trunk/linpha2/templates/default/view_albmeta.html.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -0,0 +1,26 @@ +<div id="linDivMainOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + + <div id="linDivMain"> + <a class="linButton" href="<?php echo $linTpl->URL_full.'&view=thumb'; ?>"><?php echo i18n("<< Back To Album View");?></a> + <br /><br /> + + <h1 class="linStyle"><?php echo i18n("Edit Album Comment"); ?></h1> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + Author: + <input type="text" name="author" value="<?php echo $linTpl->output['comment_author']; ?>" size="40" maxlength="255" /> + <br /> + <textarea name="comment" rows="10" cols="50"><?php echo $linTpl->output['comment_text']; ?></textarea> + <br /> + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" class="linButton" name="submit" value="submit" /> + </form> + <br /> + + <h1 class="linStyle"><?php echo i18n("Edit Album Informations"); ?></h1> + <?php LinMetaDataModificate::setMetaData(); ?> + <div style="clear: both;"></div> + </div> + + <?php echo $linTpl->divRoundCorners('bottom'); ?> +</div> \ No newline at end of file Modified: trunk/linpha2/templates/default/view_img_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_img_static.html.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/templates/default/view_img_static.html.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -35,8 +35,11 @@ <?php echo $linTpl->divRoundCorners('top'); ?> <div id="linDivMain"> <?php if($_SESSION['mode_imageview']=='meta') { ?> - <!-- edit meta data - include view_meta.html --> - <?php include_once(LINPHA_DIR.'/templates/'.$linTpl->template_name.'/view_meta.html.php'); + <!-- edit meta data - include view_meta.html --> + <a href="<?php echo $linTpl->URL_full.'&view=img'; ?>"><?php echo i18n("<< Back To Default View");?></a> + <br /><br /> + <h1 class="linStyle"><?php echo i18n("Edit Image Imformation")?></h1> + <?php LinMetaDataModificate::setMetaData(); } else { ?> <!-- show image --> @@ -85,7 +88,7 @@ <?php while($data = $linTpl->output['image_comments']->FetchRow()) { ?> <?php echo linStrftime($data['meta_time']).' '.i18n("by").' '.htmlspecialchars($data['meta_author'],ENT_QUOTES); ?> <hr /> - <?php echo htmlspecialchars($data['meta_comment'],ENT_QUOTES); ?> + <?php echo linHtmlTag($data['meta_comment'],ENT_QUOTES); ?> <br /><br /> <?php } ?> </div> Modified: trunk/linpha2/templates/default/view_meta.html.php =================================================================== --- trunk/linpha2/templates/default/view_meta.html.php 2006-11-16 21:46:57 UTC (rev 4657) +++ trunk/linpha2/templates/default/view_meta.html.php 2006-11-17 21:36:12 UTC (rev 4658) @@ -1,100 +0,0 @@ -<?php -/** - * this file is included from view_img.html.php - */ - -?> -<style> -#linImgMainimage -{ - width: 300px; -} -</style> -<a href="<?php echo $linTpl->URL_full.'&view=img'; ?>"><?php echo i18n("<< Back To Default View");?></a> -<h1 class="linStyle"><?php echo i18n("Edit Image Imformation")?></h1> -<?php - -if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) -{ - $num_query = $GLOBALS['linpha']->db->GetRow("SELECT count(id) " . - "FROM ".LIN_PREFIX."meta_fields " . - "WHERE flags = '5' " . - "OR flags = '7'"); - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type " . - "FROM ".LIN_PREFIX."meta_fields " . - "WHERE flags = '5' OR flags = '7' ORDER by id"); - -?> -<form action="<?php echo $linTpl->URL_full; ?>" method="POST"> -<table border='1'> - <tr> - <td width="150"><b><?php echo i18n("Name"); ?></b></td> - <td width="200"><b><?php echo i18n("Value"); ?></b></td> - <td rowspan="<?php echo $num_query['0']+1; ?>"> - <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$GLOBALS['linpha']->template->idCurrent;?> - width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" - height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" - </td> - </tr> - <?php - while($data = $query->FetchRow()) - { - ?> - <tr> - <td><?php echo $data['name']; ?></td> - <td> - <?php - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'" . - "AND field_id = '".$data['id']."'"); - - switch($data['field_type']) - { - case 1: - case 3: - if(isset($meta_data['meta_data'])) { - $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); - } else { - $value = ''; - } - echo '<input type="text" name="field['.$data['id'].']" value="'.$value.'" style="width: 200px;" maxlength="255" />'; - break; - case 2: - if(isset($meta_data['meta_data'])) { - $array_pieces = linExplodeAndSlice(';',$meta_data['meta_data']); - } else { - $array_pieces = Array(); - } - ?> - <select name="field[<?php echo $data['id']; ?>][]" multiple="multiple" style="width: 200px;"> - <?php - $cat_query = $GLOBALS['linpha']->db->Execute("SELECT id, name " . - "FROM ".LIN_PREFIX."meta_category " . - "WHERE field_id = '".$data['id']."'"); - while($cat_data = $cat_query->FetchRow()) - { - if(in_array($cat_data['id'],$array_pieces)) { - $checked = ' selected="selected"'; - } else { - $checked = ''; - } - - echo '<option value="'.$cat_data['id'].'"'.$checked.'>'.htmlspecialchars($cat_data['name'],ENT_QUOTES).'</option>'."\n"; - } - ?> - </select> - <?php - break; - } - ?> - </td> - </tr> - <?php - } - ?> -</table> -<input type="hidden" name="cmd" value="insert_metadata" /> -<input type="submit" name="submit" value="submit" /> -</form> -<?php } /* end if checkPermission('metadata_edit') */ ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-11-19 20:37:09
|
Revision: 4659 http://svn.sourceforge.net/linpha/?rev=4659&view=rev Author: fangehrn Date: 2006-11-19 12:32:55 -0800 (Sun, 19 Nov 2006) Log Message: ----------- 2006-11-19 flo * mostly finished iptc write support @todo only save iptc data if we entered some data in the iptc form @todo show full exif informations with pjmt/ShowFileInfo.php (provide security!) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/docs/dev/important stuff.txt trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/metadata_editor.php trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php trunk/linpha2/lib/include/common.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/lib/lang/language.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/default/themes/default/css/global.css trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/view_albmeta.html.php trunk/linpha2/templates/default/view_img_static.html.php Added Paths: ----------- trunk/linpha2/lib/classes/pjmt/ trunk/linpha2/lib/include/Edit_File_Info.php trunk/linpha2/lib/include/calendar.php Removed Paths: ------------- trunk/linpha2/lib/classes/phpmeta/ trunk/linpha2/lib/include/calender.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/ChangeLog 2006-11-19 20:32:55 UTC (rev 4659) @@ -1,3 +1,8 @@ +2006-11-19 flo + * mostly finished iptc write support + @todo only save iptc data if we entered some data in the iptc form + @todo show full exif informations with pjmt/ShowFileInfo.php (provide security!) + 2006-11-17 flo * nearly finished meta data support Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/admin/metadata_define.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -200,7 +200,7 @@ while($data = $query->FetchRow()) { ?> - <h3><?php echo $data['name']; ?></h3> + <h3><?php echo i18n( ucfirst( $data['name'] ) ); ?></h3> <table border="0"> <tr> <td width="170"><b><?php echo i18n("Name"); ?></b></td> Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/docs/dev/TODO.txt 2006-11-19 20:32:55 UTC (rev 4659) @@ -8,6 +8,14 @@ thats not very user friendly - escape exif data +- how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? + i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file + and use it this way: echo i18n( LIN_STR_SUBMIT ); + or use: + define('LIN_STR_SUBMIT', i18n("Submit") ); + echo LIN_STR_SUBMIT; + ? + ## Big Todos - Installer Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/docs/dev/external_libraries.txt 2006-11-19 20:32:55 UTC (rev 4659) @@ -42,12 +42,37 @@ "RecName" => @$GLOBALS[ "IPTC_Entry_Names" ][ $iptctype ], "RecDesc" => @$GLOBALS[ "IPTC_Entry_Descriptions" ][ $iptctype ], ---- + + Edit_File_Info.php (located in /lib/include) + - base file from "Edit_File_Info.php", a lot of changes... - removed files: + Write_File_Info.php + - copied content to LinMetaDataModificate::saveModIptcData() + + Example.php + - renamed to ShowFileInfo.php, @todo add checkPermisions() !! + + Photoshop_File_Info.php + - line 1061 replace + if ( stristr ( $new_Exif_array[0][305]['Data'][0], $GLOBALS[ "Software Name" ]) == FALSE ) + with + if ( stristr ( $new_Exif_array[0][305]['Data'][0], "LinPHA") == FALSE ) + (we have changed $GLOBALS[ "Software Name" ] manually) + + - line 1450 replace + if ( stristr ( $new_Exif_array[0][305]['Data'][0], $GLOBALS[ "Software Name" ]) == FALSE ) + with + if ( stristr ( $new_Exif_array[0][305]['Data'][0], "LinPHA") == FALSE ) + + + - line 2051 replace "return false;" with "$foobar = false; return $foobar;" to prevent php notice "Notice: Only variable references should be returned by reference " + - line 2111 replace "return false;" with "$foobar = false; return $foobar;" to prevent php notice "Notice: Only variable references should be returned by reference " + + + Removed files: - documentation/ - Edit_File_Info.php - Edit_File_Info_Example.php - - Example.php - get_*_thumb.php (security) - test.jpg - TIFFExample.php Modified: trunk/linpha2/docs/dev/important stuff.txt =================================================================== --- trunk/linpha2/docs/dev/important stuff.txt 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/docs/dev/important stuff.txt 2006-11-19 20:32:55 UTC (rev 4659) @@ -1,8 +1,7 @@ - if we use exec($str, $array_output=array(), $return_value=''); it will always return empty $array_output and $return_value - you have to initialize $array_output and $return_value before! - + you have to initialize $array_output and $return_value before the exec() statement: $array_output = array(); $return_value = ''; exec($str, $array_output, $return_value); @@ -13,6 +12,10 @@ clearstatcache(); $handle = fopen($tmp_file, "rb"); $file_data = fread($handle, filesize($tmp_file)); + +- is_writable() does not work correctly under windows, it returns just the readonly attribute + see http://bugs.php.net/bug.php?id=27609 for details + see http://ch2.php.net/is_writable for alternative implementations - adodb eof $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM meta_fields WHERE flags = '7'"); @@ -32,9 +35,4 @@ echo "Error: ".$error -> getMessage(); } -- $GLOBALS['linpha']->sql->config->value['sys_'] - -- some common language strings - "Successfully updated data." - "Submit" - ?? \ No newline at end of file +- $GLOBALS['linpha']->sql->config->value['sys_'] \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -562,7 +562,7 @@ } break; case 'force_import': // called in viewImg - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); break; case 'rotate_left': if($GLOBALS['linpha']->sql->isAdmin()) @@ -1145,6 +1145,11 @@ { $GLOBALS['linpha']->template->output['comment_text'] = ''; } + + /** + * save modified meta data + */ + LinMetaDataModificate::saveModifiedMetaData(); } @@ -1155,6 +1160,14 @@ */ function viewImg() { + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + $this->max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; + $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + + $array = LinImage::scaleToFit($this->org_width,$this->org_height,$this->max_width,$this->max_height); + $this->img_width = $array['w']; + $this->img_height = $array['h']; + $this->viewImgCommon(); $this->viewImgComments(); @@ -1231,20 +1244,10 @@ } // end viewImgAjax() /** - * stuff used Img and Meta view - * @uses LinImageview::viewImg - * @uses LinImageview:viewMeta + * stuff used in viewImg() and viewMeta() */ function viewImgCommon() { - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - $this->max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; - $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; - - $array = LinImage::scaleToFit($this->org_width,$this->org_height,$this->max_width,$this->max_height); - $this->img_width = $array['w']; - $this->img_height = $array['h']; - $this->viewImgSetPrevNextThumb(); $this->viewImgStoreImageInformation(); @@ -1256,7 +1259,6 @@ ); } - /** * get/save image comments */ @@ -1302,8 +1304,6 @@ */ function viewImgStoreImageInformation() { - $this->full_filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - $array_meta = array('exif','iptc'); foreach($array_meta AS $value) { @@ -1317,7 +1317,7 @@ */ if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { - $MetaData->saveData( $value, $this->full_filename,$this->md5sum); + $MetaData->saveData( $value, $this->src_file, $this->md5sum ); } } } @@ -1423,7 +1423,14 @@ { $GLOBALS['linpha']->template->setModuleName('view_img_static'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); + + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + /** + * save modified meta data + */ + LinMetaDataModificate::saveModifiedMetaData(); + $this->viewImgCommon(); } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -56,13 +56,16 @@ * read current directory in array */ $importarray_folder = Array(); - $d = dir( $dirname ); - while( false !== ($entry = $d->read() ) ) + if( $d = @dir( $dirname ) ) { - if($entry != '.' AND $entry != '..') + while( false !== ($entry = $d->read() ) ) { - $importarray_folder[] = $entry; + if($entry != '.' AND $entry != '..') + { + $importarray_folder[] = $entry; + } } + $d->close(); } /** @@ -338,20 +341,33 @@ /** * if the md5sum changes, update the md5sum in linpha_stats, linpha_meta_data - * occurs while rotating images, or if LinImport detects a change of the file + * occurs while rotating images, or we edited the iptc data, + * or if LinImport detects a change of the file * (for example: image has been edited with an external program) * * problem: if there are two images with the same md5sum, and one image gets changed - * linpha will update the md5sum of the changed image forthe comments (for example) + * linpha will update the md5sum of the changed image for the comments (for example) * to the new value, but if we then do a "detect file changes" on the old image, * the old image will do the same and change the md5sum of the comment back to this * this will create a race condition - * - * @todo if the file changed, it is best to re-index image - * -> delete/update exif/iptc/xmp data! + * -> thats not true ?! the "detect file changes" on the old image will not detect + * any changes, because there are no changes! */ function updateMd5sum( $id, $old_md5sum, $new_md5sum ) { + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET " . + "md5sum = '".$new_md5sum."' WHERE md5sum = '".$old_md5sum."'"); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_data SET " . + "md5sum = '".$new_md5sum."' WHERE md5sum = '".$old_md5sum."'"); + + + /** + * if the file changed, it is best to re-index image + * -> delete/update exif/iptc/xmp data! + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$old_md5sum."'"); + $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_iptc WHERE md5sum = '".$old_md5sum."'"); } @@ -450,11 +466,11 @@ { /** * exif date and exif rotate stuff - * globally turn off using 'sys_import_exif' if having problems with phpmeta + * globally turn off using 'sys_import_exif' if having problems with pjmt */ if( $GLOBALS['linpha']->sql->config->value['sys_import_exif'] ) { - include_once( LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php' ); + include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); $meta = get_EXIF_JPEG($dirname.'/'.$filename); /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -408,8 +408,8 @@ */ function saveExifData($filename,$md5sum) { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); // used for jpeg comment - include_once(LINPHA_DIR.'/lib/classes/phpmeta/EXIF.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); // used for jpeg comment + include_once(LINPHA_DIR.'/lib/classes/pjmt/EXIF.php'); $str_columns = "md5sum, "; $str_values = "'".$md5sum."', "; @@ -510,8 +510,8 @@ */ function saveIptcData($filename, $md5sum) { - include_once(LINPHA_DIR.'/lib/classes/phpmeta/Photoshop_IRB.php'); - include_once(LINPHA_DIR.'/lib/classes/phpmeta/JPEG.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); $str_columns = "md5sum, "; $str_values = "'".$md5sum."', "; @@ -659,142 +659,335 @@ */ class LinMetaDataModificate extends LinMetaData { + function showEditMetaData() + { + /** + * set meta linpha + */ + $GLOBALS['linpha']->template->output['meta_linpha'] = ''; + + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . + "FROM ".LIN_PREFIX."meta_fields " . + "WHERE flags = '5' OR flags = '7' ORDER by id"); + while($data = $query->FetchRow()) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<tr><td width="150" valign="top">'; + + if( $data['flags']==5 ) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('builtin_'.$data['name'],false); + } + elseif( $data['flags']==7 ) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('id_'.$data['id'],false); + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td><td>'; + + $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".LIN_PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'" . + "AND field_id = '".$data['id']."'"); + + switch($data['field_type']) + { + case 1: + if(isset($meta_data['meta_data'])) { + $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); + } else { + $value = ''; + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<input type="text" class="linForms" name="linMetaField['.$data['id'].']" value="'.$value.'" style="width: 250px;" maxlength="255" />'; + break; + case 3: + if(isset($meta_data['meta_data'])) { + $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); + } else { + $value = ''; + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= + '<input type="text" class="linForms" name="linMetaField['.$data['id'].']" id="linField'.$data['id'].'" value="'.$value.'" style="width: 150px;" maxlength="255" />' + .' <a href="javascript:void(0);" onclick="var loginWin = window.open(\''.LINPHA_CLIENT.'/lib/include/calendar.php?form=linField'.$data['id'].'\''. + ',\'Calendar\',\'height=250,width=300,scrollbars=no,menubar=no,status=no\');" target="_top">'.i18n("Calendar").'</a>'; + + break; + case 2: + if(isset($meta_data['meta_data'])) { + $array_pieces = linExplodeAndSlice(';',$meta_data['meta_data']); + } else { + $array_pieces = Array(); + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<select name="linMetaField['.$data['id'].'][]" class="linForms" size="7" multiple="multiple" style="width: 250px;">'; + + $cat_query = $GLOBALS['linpha']->db->Execute("SELECT id, name " . + "FROM ".LIN_PREFIX."meta_category " . + "WHERE field_id = '".$data['id']."'"); + while($cat_data = $cat_query->FetchRow()) + { + if(in_array($cat_data['id'],$array_pieces)) { + $checked = ' selected="selected"'; + } else { + $checked = ''; + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<option value="'.$cat_data['id'].'"'.$checked.'>'.htmlspecialchars($cat_data['name'],ENT_QUOTES).'</option>'."\n"; + } + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</select>'."\n". + '<br /><span style="font-size: smaller;">'.i18n("For Multiple Select Use CTRL").'</span>'; + + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->output['meta_linpha'] .= '<br /><span style="font-size: smaller;"><a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_adddata">'.i18n("Add More Options").'</a><br /><br /></span>'; + } + + break; + } + + $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td></tr>'; + } + + /** + * set meta iptc + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) + { + if( isset($GLOBALS['linpha']->imgview->src_file) && file_exists($GLOBALS['linpha']->imgview->src_file)) + { + if( is_writable($GLOBALS['linpha']->imgview->src_file)) + { + $edit_possible = true; + $filename = $GLOBALS['linpha']->imgview->src_file; // used in IPTC Edit_File_Info.php + } + else + { + $edit_possible = false; + } + } + else + { + $edit_possible = false; + } + } + + /** + * build the meta data view + */ + $fragment = 'edit_meta'; + global $linTpl; + include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - function saveLinphaMeta() + } // end function showEditMetaData() + + function saveModifiedMetaData() { if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - /** - * save metadata - */ if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') { - if(isset($_POST['field'])) + LinMetaDataModificate::saveModifiedMetaDataLinpha(); + + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] + && isset($GLOBALS['linpha']->imgview->src_file) + && file_exists($GLOBALS['linpha']->imgview->src_file) + ) { /** - * delete existing entries + * write iptc data */ - $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - - foreach($_POST['field'] AS $key=>$value) + global $new_ps_file_info_array; + $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; + + /** + * important! + * remove other POST data from this array, because pjmt just takes all values and this will generate unexpected results!!! + * we got problems because $_POST['linMetaField'] is an array and pjmt couldnt handle this + */ + unset($new_ps_file_info_array['cmd']); + unset($new_ps_file_info_array['linMetaField']); + unset($new_ps_file_info_array['submit']); + + if( LinMetaDataModificate::saveModifiedMetaDataIptc( $new_ps_file_info_array ) ) { - if(is_array($value)) // coming from a select (categories etc.) - { - $value = ';'.implode(';',$value).';'; - } - - if(! empty($value) ) - { - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_data ". - "(field_id, md5sum, meta_data) VALUES " . - "('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($value)."')"); - } + /** + * force read data from file again if write was successful + */ + unset($new_ps_file_info_array); + LinImport::updateEntry( + $GLOBALS['linpha']->template->idCurrent , + dirname($GLOBALS['linpha']->imgview->src_file) , + basename($GLOBALS['linpha']->imgview->src_file) + ); } } } } - } - - function setMetaData() + + /** + * save modified linpha meta data to database + */ + function saveModifiedMetaDataLinpha() { - LinMetaDataModificate::saveLinphaMeta(); - - global $linTpl; - - /** - * set meta linpha - */ - $GLOBALS['linpha']->template->output['meta_linpha'] = ''; - - $query = $GLOBALS['linpha']->db->Execute("SELECT id, name, field_type, flags " . - "FROM ".LIN_PREFIX."meta_fields " . - "WHERE flags = '5' OR flags = '7' ORDER by id"); - while($data = $query->FetchRow()) + if( isset($_POST['linMetaField']) && is_array($_POST['linMetaField']) ) { - $GLOBALS['linpha']->template->output['meta_linpha'] .= '<tr><td width="150" valign="top">'; + /** + * delete existing entries + */ + $query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_data " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - if( $data['flags']==5 ) + /** + * insert new entries + */ + foreach($_POST['linMetaField'] AS $key=>$value) { - $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('builtin_'.$data['name'],false); - } - elseif( $data['flags']==7 ) - { - $GLOBALS['linpha']->template->output['meta_linpha'] .= LinMetaData::getNameOfField('id_'.$data['id'],false); - } - $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td><td>'; - - $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data FROM ".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'" . - "AND field_id = '".$data['id']."'"); - - switch($data['field_type']) - { - case 1: - case 3: - if(isset($meta_data['meta_data'])) { - $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); - } else { - $value = ''; + if(is_array($value)) // coming from a select (categories etc.) + { + $value = ';'.implode(';',$value).';'; } - $GLOBALS['linpha']->template->output['meta_linpha'] .= '<input type="text" class="linForms" name="field['.$data['id'].']" value="'.$value.'" style="width: 250px;" maxlength="255" />'; - break; - case 2: - if(isset($meta_data['meta_data'])) { - $array_pieces = linExplodeAndSlice(';',$meta_data['meta_data']); - } else { - $array_pieces = Array(); - } - $GLOBALS['linpha']->template->output['meta_linpha'] .= '<select name="field['.$data['id'].'][]" class="linForms" size="7" multiple="multiple" style="width: 250px;">'; - - $cat_query = $GLOBALS['linpha']->db->Execute("SELECT id, name " . - "FROM ".LIN_PREFIX."meta_category " . - "WHERE field_id = '".$data['id']."'"); - while($cat_data = $cat_query->FetchRow()) + if(! empty($value) ) { - if(in_array($cat_data['id'],$array_pieces)) { - $checked = ' selected="selected"'; - } else { - $checked = ''; - } - - $GLOBALS['linpha']->template->output['meta_linpha'] .= '<option value="'.$cat_data['id'].'"'.$checked.'>'.htmlspecialchars($cat_data['name'],ENT_QUOTES).'</option>'."\n"; + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_data ". + "(field_id, md5sum, meta_data) VALUES " . + "('".LinSql::linAddslashes($key)."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($value)."')"); } - $GLOBALS['linpha']->template->output['meta_linpha'] .= '</select>'; - break; } - - $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td></tr>'; } - - /** - * set meta iptc - */ - $GLOBALS['linpha']->template->output['meta_iptc'] = '<tr><td>some iptc data</td><td></td></tr>'; - - $fragment = 'edit_meta'; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); } - -/** - * edit iptc functions - */ - /** - * edit IPTC Data in HTML popup - */ - function editIptcData() - { - - } /** - * save modified IPTC data to DB + * save iptc metadata back to file + * + * copied from pjmt/Write_File_Info.php + * + * @todo only save data if we entered some data in the iptc form!! */ - function saveModIptcData() + function saveModifiedMetaDataIptc( & $new_ps_file_info_array ) { + /** // Turn off Error Reporting + error_reporting ( 0 ); // Change: changed to no reporting - as of version 1.11 + include 'Toolkit_Version.php'; // Change: added as of version 1.11*/ + + // Include the required files for reading and writing Photoshop File Info + include_once(LINPHA_DIR.'/lib/classes/pjmt/JPEG.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/XMP.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/EXIF.php'); + include_once(LINPHA_DIR.'/lib/classes/pjmt/Photoshop_File_Info.php'); + + $GLOBALS[ "Software Name" ] = "LinPHA v".LINPHA_VERSION.", powered by PHP JPEG Metadata Toolkit v" . $GLOBALS['Toolkit_Version'] ; + + // Copy all of the HTML Posted variables into an array + /** + * $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; + */ + + // Some characters are escaped with backslashes in HTML Posted variable + // Cycle through each of the HTML Posted variables, and strip out the slashes + /** + * already done in /include/common.php !! + * foreach( $new_ps_file_info_array as $var_key => $var_val ) + { + $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val ); + }*/ + + // Keywords should be an array - explode it on newline boundarys + $new_ps_file_info_array[ 'keywords' ] = explode( "\n", trim( $new_ps_file_info_array[ 'keywords' ] ) ); + + // Supplemental Categories should be an array - explode it on newline boundarys + $new_ps_file_info_array[ 'supplementalcategories' ] = explode( "\n", trim( $new_ps_file_info_array[ 'supplementalcategories' ] ) ); + + /** + // Make the filename easier to access + $filename = $new_ps_file_info_array[ 'filename' ]; + + // Protect against hackers editing other files + $path_parts = pathinfo( $filename ); + if ( strcasecmp( $path_parts["extension"], "jpg" ) != 0 ) + { + echo "Incorrect File Type - JPEG Only\n"; + exit( ); + } + // Change: removed limitation on file being in current directory - as of version 1.11 + * + */ + $filename = $GLOBALS['linpha']->imgview->src_file; + + // Retrieve the header information + $jpeg_header_data = get_jpeg_header_data( $filename ); + + // Retreive the EXIF, XMP and Photoshop IRB information from + // the existing file, so that it can be updated + $Exif_array = get_EXIF_JPEG( $filename ); + $XMP_array = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ); + $IRB_array = get_Photoshop_IRB( $jpeg_header_data ); + + // Update the JPEG header information with the new Photoshop File Info + $jpeg_header_data = put_photoshop_file_info( $jpeg_header_data, $new_ps_file_info_array, $Exif_array, $XMP_array, $IRB_array ); + + // Check if the Update worked + if ( $jpeg_header_data == FALSE ) + { + // Update of file info didn't work - output error message + /** + * echo "Error - Failure update Photoshop File Info : $filename <br>\n"; + */ + linSysLog( i18n("Error - Failure update Photoshop File Info :" .' '. $filename) ); + + // Output HTML with the form and data which was + // sent, to allow the user to fix it + + /**$outputfilename = $filename; + include "Edit_File_info.php"; + echo "</body>\n"; + echo "</html>\n"; + + // Abort processing + exit( );*/ + + return false; + } + + // Attempt to write the new JPEG file + elseif ( FALSE == put_jpeg_header_data( $filename, $filename, $jpeg_header_data ) ) + { + // Writing of the new file didn't work - output error message + /** + * echo "Error - Failure to write new JPEG : $filename <br>\n"; + */ + linSysLog( i18n("Error: Failure to write new JPEG:" .' '. $filename) ); + + // Output HTML with the form and data which was + // sent, to allow the user to fix it + + /**$outputfilename = $filename; + include "Edit_File_info.php"; + echo "</body>\n"; + echo "</html>\n"; + + // Abort processing + exit( );*/ + + return false; + } + else + { + // Writing of new JPEG succeeded + + // Output information about new file + + linSysLog( i18n("DONE! Updated:" .' '. $filename) ); + /** + echo "<h1>DONE! - $filename updated</h1>\n"; + echo "<p><a href=\"Example.php?jpeg_fname=$filename\" >View Full Metatdata Information</a></p>\n"; + echo "<p><a href=\"Edit_File_Info_Example.php?jpeg_fname=$filename\" >Re-Edit Photoshop File Info</a></p>\n"; + echo "<br><br>\n"; + echo "<p>Below is the updated image, you can save it and look at the changed metadata in your favorite image editor</p>\n"; + echo "<p><img src=\"$filename\" ></p>\n";*/ + + return true; + } } } // end class LinMetaDataModificate @@ -1025,6 +1218,7 @@ * MetaColumns() returns the keys always uppercase independent of ADODB_ASSOC_CASE */ $array = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$what); + $this->defined_fields[$what] = array(); foreach($array AS $key=>$value) { if( $key != 'MD5SUM') Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -551,6 +551,9 @@ /** * method to check if we are admin + * + * just returns the content of $isAdmin which has status private + * to prevent modification from external */ function isAdmin() { Modified: trunk/linpha2/lib/classes/metadata_editor.php =================================================================== --- trunk/linpha2/lib/classes/metadata_editor.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/metadata_editor.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -97,12 +97,12 @@ // Hide any unknown EXIF tags $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; - include './phpmeta/JPEG.php'; - include './phpmeta/JFIF.php'; - include './phpmeta/PictureInfo.php'; - include './phpmeta/XMP.php'; - include './phpmeta/Photoshop_IRB.php'; - include './phpmeta/EXIF.php'; + include './pjmt/JPEG.php'; + include './pjmt/JFIF.php'; + include './pjmt/PictureInfo.php'; + include './pjmt/XMP.php'; + include './pjmt/Photoshop_IRB.php'; + include './pjmt/EXIF.php'; // Output the title echo "<title>Metadata details for $filename</title>"; Copied: trunk/linpha2/lib/classes/pjmt (from rev 4658, trunk/linpha2/lib/classes/phpmeta) Modified: trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php =================================================================== --- trunk/linpha2/lib/classes/phpmeta/Photoshop_File_Info.php 2006-11-17 21:36:12 UTC (rev 4658) +++ trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -1058,7 +1058,7 @@ { // An existing EXIF Software or Firmware Tag was found // Check if the existing Software or Firmware Tag already contains the Toolkit's name - if ( stristr ( $new_Exif_array[0][305]['Data'][0], $GLOBALS[ "Software Name" ]) == FALSE ) + if ( stristr ( $new_Exif_array[0][305]['Data'][0], "LinPHA") == FALSE ) { // Toolkit Name string not found in the existing Software/Firmware string - append it. $firmware_str = $new_Exif_array[0][305]['Data'][0] . " " . $GLOBALS[ "Software Name" ]; @@ -1442,12 +1442,13 @@ // Photoshop replaces the CreatorTool with "Adobe Photoshop ..." // This toolkit instead preserves existing value and appends the toolkit name to the end of it + // Check if a CreatorTool already exists if ( $Item[ 'value' ] != "" ) { // An existing CreatorTool was found // Check if the existing CreatorTool already contains the Toolkit's name - if ( stristr ( $Item[ 'value' ], $GLOBALS[ "Software Name" ]) == FALSE ) + if ( stristr ( $Item[ 'value' ], "LinPHA") == FALSE ) { // Toolkit Name string not found in the existing CreatorTool string - append it. $Item[ 'value' ] = $Item[ 'value' ] . " " . $GLOBALS[ "Software Name" ]; @@ -1463,9 +1464,6 @@ $Item[ 'value' ] = $GLOBALS[ "Software Name" ]; } - - - // Process the XMP Basic Job Information block // Find the XAP Basic Job Information within the XMP block @@ -2048,7 +2046,8 @@ } // No matching tag found - return error code - return FALSE; + //return FALSE; // prevent PHP notice "Notice: Only variable references should be returned by reference in D:\eclipse\linpha2\lib\classes\pjmt\Photoshop_File_Info.php on line 2051" + $foobar = false; return $foobar; } /****************************************************************************** @@ -2108,7 +2107,8 @@ } // No matching rdf:Description block found - return FALSE; + //return FALSE; // prevent PHP notice "Notice: Only variable references should be returned by reference in D:\eclipse\linpha2\lib\classes\pjmt\Photoshop_File_Info.php on line 2051" + $foobar = false; return $foobar; } /****************************************************************************** Added: trunk/linpha2/lib/include/Edit_File_Info.php =================================================================== --- trunk/linpha2/lib/include/Edit_File_Info.php (rev 0) +++ trunk/linpha2/lib/include/Edit_File_Info.php 2006-11-19 20:32:55 UTC (rev 4659) @@ -0,0 +1,562 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/**************************************************************************** +* +* Filename: Edit_File_Info.php +* +* Description: Allows the user to edit the metadata of an image over the internet +* in the same way that Photoshop edits 'File Info' data +* This file provides only the html for a form containing the file info +* input fields. The rest of the html file must be provided by the calling script. +* $outputfilename must always be defined - it is ne name of the file which +* have the metadata changed after the form has been submitted +* +* This file has several modes of operation: +* +* 1) If $new_ps_file_info_array is defined then it's data will be used +* to fill the fields. +* 2) If $new_ps_file_info_array is not defined but $filename is defined, +* then the file info fields will be filled from the metadata in the file specified +* 3) If $new_ps_file_info_array is not defined but $filename and $default_ps_file_info_array +* are defined, then the file info fields will be filled from the metadata +* in the file specified, but where fields are blank, they will be filled from $default_ps_file_info_array +* 4) Otherwise the fields will be blank +* +* See Edit_File_Info_Example.php for an example of usage +* +* Author: Evan Hunter +* +* Date: 17/11/2004 +* +* Project: PHP JPEG Metadata Toolkit +* +* Revision: 1.11 +* +* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php +* +* URL: http://electronics.ozhiker.com +* +* Copyright: Copyright Evan Hunter 2004 +* +* License: This file is part of the PHP JPEG Metadata Toolkit. +* +* The PHP JPEG Metadata Toolkit is free software; you can +* redistribute it and/or modify it under the terms of the +* GNU General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* The PHP JPEG Metadata Toolkit is distributed in the hope +* that it will be useful, but WITHOUT ANY WARRANTY; without +* even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +* +* You should have received a copy of the GNU General Public +* License along with the PHP JPEG Metadata Toolkit; if not, +* write to the Free Software Foundation, Inc., 59 Temple +* Place, Suite 330, Boston, MA 02111-1307 USA +* +* If you require a different license for commercial or other +* purposes, please contact the author: ev...@oz... +* +***************************************************************************/ + + + + include LINPHA_DIR.'/lib/classes/pjmt/Toolkit_Version.php'; // Change: added as of version 1.11 + + // Check for operation modes 2 or 3 + // i.e. $filename is defined, and $new_ps_file_info_array is not + if ( ( ! isset( $new_ps_file_info_array ) ) && + ( isset( $filename ) ) && + ( is_string( $filename ) ) ) + { + // Hide any unknown EXIF tags + $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; + + // Accessing the existing file info for the specified file requires these includes + include_once( LINPHA_DIR.'/lib/classes/pjmt/JPEG.php' ); + include_once( LINPHA_DIR.'/lib/classes/pjmt/XMP.php' ); + include_once( LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php' ); + include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); + include_once( LINPHA_DIR.'/lib/classes/pjmt/Photoshop_File_Info.php' ); + + // Retrieve the header information from the JPEG file + $jpeg_header_data = get_jpeg_header_data( $filename ); + + // Retrieve EXIF information from the JPEG file + $Exif_array = get_EXIF_JPEG( $filename ); + + // Retrieve XMP information from the JPEG file + $XMP_array = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ); + + // Retrieve Photoshop IRB information from the JPEG file + $IRB_array = get_Photoshop_IRB( $jpeg_header_data ); + + // Retrieve Photoshop File Info from the three previous arrays + $new_ps_file_info_array = get_photoshop_file_info( $Exif_array, $XMP_array, $IRB_array ); + + + + // Check if there is an array of defaults available + if ( ( isset( $default_ps_file_info_array) ) && + ( is_array( $default_ps_file_info_array) ) ) + { + // There are defaults defined + + // Check if there is a default for the date defined + if ( ( ! array_key_exists( 'date', $default_ps_file_info_array ) ) || + ( ( array_key_exists( 'date', $default_ps_file_info_array ) ) && + ( $default_ps_file_info_array['date'] == '' ) ) ) + { + // No default for the date defined + // figure out a default from the file + + // Check if there is a EXIF Tag 36867 "Date and Time of Original" + if ( ( $Exif_array != FALSE ) && + ( array_key_exists( 0, $Exif_array ) ) && + ( array_key_exists( 34665, $Exif_array[0] ) ) && + ( array_key_exists( 0, $Exif_array[0][34665] ) ) && + ( array_key_exists( 36867, $Exif_array[0][34665][0] ) ) ) + { + // Tag "Date and Time of Original" found - use it for the default date + $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36867]['Data'][0]; + $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); + } + // Check if there is a EXIF Tag 36868 "Date and Time when Digitized" + else if ( ( $Exif_array != FALSE ) && + ( array_key_exists( 0, $Exif_array ) ) && + ( array_key_exists( 34665, $Exif_array[0] ) ) && + ( array_key_exists( 0, $Exif_array[0][34665] ) ) && + ( array_key_exists( 36868, $Exif_array[0][34665][0] ) ) ) + { + // Tag "Date and Time when Digitized" found - use it for the default date + $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36868]['Data'][0]; + $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); + } + // Check if there is a EXIF Tag 306 "Date and Time" + else if ( ( $Exif_array != FALSE ) && + ( array_key_exists( 0, $Exif_array ) ) && + ( array_key_exists( 306, $Exif_array[0] ) ) ) + { + // Tag "Date and Time" found - use it for the default date + $default_ps_file_info_array['date'] = $Exif_array[0][306]['Data'][0]; + $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); + } + else + { + // Couldn't find an EXIF date in the image + // Set default date as creation date of file + $default_ps_file_info_array['date'] = date ("Y-m-d", filectime( $filename )); + } + } + + // Cycle through all the elements of the default values array + foreach( $default_ps_file_info_array as $def_key =>$default_item ) + { + // Check if the current element is Keywords or + // Supplemental Categories as these are arrays + // and need to be treated differently + if ( ( strcasecmp( $def_key, "keywords" ) == 0 ) || + ( strcasecmp( $def_key, "supplementalcategories" ) == 0 ) ) + { + // Keywords or Supplemental Categories found + // Check if the File Info from the file is empty for this element + // and if there are default values in this array element + if ( ( count( $new_ps_file_info_array[ $def_key ] ) == 0 ) && + ( is_array( $default_item ) ) && + ( count( $default_item ) >= 0 ) ) + { + // The existing file info is empty, and there are + // defaults - add them + $new_ps_file_info_array[ $def_key ] = $default_item; + } + } + // Otherwise, this is not an array element, just check if it is blank in the existing file info + else if ( trim( $new_ps_file_info_array[ $def_key ] ) == "" ) + { + // The existing file info is blank, add the default value + $new_ps_file_info_array[ $def_key ] = $default_item; + } + + } + } + } + // Check for operation mode 4 - $new_ps_file_info_array and $filename are not defined, + else if ( ( ( !isset($new_ps_file_info_array) ) || ( ! is_array($new_ps_file_info_array) ) ) && + ( ( !isset($filename) ) || ( ! is_string( $filename ) ) ) ) + { + // No filename or new_ps_file_info_array defined, create a blank file info array to display + $new_ps_file_info_array = array( + "title" => "", + "author" => "", + "authorsposition" => "", + "caption" => "", + "captionwriter" => "", + "jobname" => "", + "copyrightstatus" => "", + "copyrightnotice" => "", + "ownerurl" => "", + "keywords" => array(), + "category" => "", + "supplementalcategories" => array(), + "date" => "", + "city" => "", + "state" => "", + "country" => "", + "credit" => "", + "source" => "", + "headline" => "", + "instructions" => "", + "transmissionreference" => "", + "urgency" => "" ); + } + + + +/*************************************************************************** +* +* Now output the actual HTML form +* +***************************************************************************/ +/** +?> + + + + + <form name="EditJPEG" action="Write_File_Info.php" method="post"> + + + echo "<input name=\"filename\" type=\"hidden\" value=\"$outputfilename\">"; + + <table> +*/ +?> + <tr> + <td> + Title + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"title\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'title' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + <tr> + <td> + Author + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"author\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'author' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + <tr> + <td> + Authors Position + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"authorsposition\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'authorsposition' ], ENT_QUOTES) ."\"> - Note: not used in Photoshop 7 or higher"; + ?> + </td> + </tr> + + <tr> + <td> + Description + </td> + <td> + <textarea name="caption" class="linForms" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'caption' ], ENT_QUOTES); ?></textarea> + </td> + </tr> + + <tr> + <td> + Description Writer + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"captionwriter\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'captionwriter' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + + <tr> + <td> + Keywords + </td> + <td> + <textarea class="linForms" name="keywords" rows=3 cols=37 wrap="off"><?php + foreach( $new_ps_file_info_array[ 'keywords' ] as $keyword ) + { + echo htmlspecialchars($keyword, ENT_QUOTES)."
"; + } + ?></textarea> + </td> + </tr> + + + <tr> + <td> + Copyright Status + </td> + <td> + <select size=1 class="linForms" name="copyrightstatus"> + <?php + $copystatus = $new_ps_file_info_array[ 'copyrightstatus' ]; + if ( $copystatus == "Unknown" ) + { + echo "<option value=\"Unknown\" SELECTED >Unknown</option>\n"; + } + else + { + echo "<option value=\"Unknown\">Unknown</option>\n"; + } + + if ( $copystatus == "Copyrighted Work" ) + { + echo "<option value=\"Copyrighted Work\" SELECTED >Copyrighted Work</option>\n"; + } + else + { + echo "<option value=\"Copyrighted Work\">Copyrighted Work</option>\n"; + } + + if ( $copystatus == "Public Domain" ) + { + echo "<option value=\"Public Domain\" SELECTED >Public Domain</option>\n"; + } + else + { + echo "<option value=\"Public Domain\">Public Domain</option>\n"; + } + ?> + </select> + </td> + </tr> + + + <tr> + <td> + Copyright Notice + </td> + <td> + <textarea class="linForms" name="copyrightnotice" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'copyrightnotice' ], ENT_QUOTES); ?></textarea> + </td> + </tr> + + + <tr> + <td> + Copyright Info URL + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"ownerurl\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\">\n"; + if ($new_ps_file_info_array[ 'ownerurl' ] != "" ) + { + echo "<a href=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\" > (". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) .")</a>\n"; + } + ?> + + </td> + </tr> + + + <tr> + <td> + Category + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"category\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'category' ], ENT_QUOTES) ."\">\n"; + ?> + + </td> + </tr> + + <tr> + <td> + Supplemental Categories + </td> + <td> + <textarea class="linForms" name="supplementalcategories" rows=3 cols=37 wrap="off"><?php + foreach( $new_ps_file_info_array[ 'supplementalcategories' ] as $supcat ) + { + echo htmlspecialchars($supcat, ENT_QUOTES)."
"; + } + ?></textarea> + </td> + </tr> + + + + <tr> + <td> + Date Created + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"date\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'date' ], ENT_QUOTES) ."\">"; + ?> + - Note date must be YYYY-MM-DD format + </td> + </tr> + + <tr> + <td> + City + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"city\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'city' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + + <tr> + <td> + State + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"state\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'state' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + + <tr> + <td> + Country + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"country\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'country' ], ENT_QUOTES) ."\">"; + ?> + </td> + </tr> + + + + <tr> + <td> + Credit + </td> + <td> + <?php + echo "<input size=49 class=\"linForms\" name=\"credit\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'credit' ], ENT_QUOTES) ."\">"; + ?> + ... [truncated message content] |
From: <fan...@us...> - 2006-11-23 21:46:30
|
Revision: 4661 http://svn.sourceforge.net/linpha/?rev=4661&view=rev Author: fangehrn Date: 2006-11-23 13:46:25 -0800 (Thu, 23 Nov 2006) Log Message: ----------- 2006-11-23 flo * todo: only save iptc data if we entered some data in the iptc form -- done * todo: show full exif informations with pjmt/ShowFileInfo.php (provide security!) -- done Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/include/File_Info_Edit.php trunk/linpha2/lib/include/File_Info_Show.php Removed Paths: ------------- trunk/linpha2/lib/classes/pjmt/ShowFileInfo.php trunk/linpha2/lib/include/Edit_File_Info.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/ChangeLog 2006-11-23 21:46:25 UTC (rev 4661) @@ -1,7 +1,9 @@ +2006-11-23 flo + * todo: only save iptc data if we entered some data in the iptc form -- done + * todo: show full exif informations with pjmt/ShowFileInfo.php (provide security!) -- done + 2006-11-19 flo * mostly finished iptc write support - @todo only save iptc data if we entered some data in the iptc form - @todo show full exif informations with pjmt/ShowFileInfo.php (provide security!) 2006-11-17 flo * nearly finished meta data support Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/admin/metadata_define_post.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -15,7 +15,7 @@ $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . "flags = '".$flag."' ". - "WHERE id = '".linSql::linAddslashes($key)."'"); + "WHERE id = '".LinSql::linAddslashes($key)."'"); } break; @@ -24,20 +24,20 @@ * check for duplicates with the same name */ $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, field_type, flags) " . - "VALUES ('".linSql::linAddslashes($_POST['new_name'])."', '".linSql::linAddslashes($_POST['new_type'])."', '7') "); + "VALUES ('".LinSql::linAddslashes($_POST['new_name'])."', '".LinSql::linAddslashes($_POST['new_type'])."', '7') "); break; case 'change_field': - if(linSql::linAddslashes($_POST['builtin'][$_POST['id']])) { + if(LinSql::linAddslashes($_POST['builtin'][$_POST['id']])) { $flag = 7; } else { $flag = 8; } $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_fields SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". "flags = '".$flag."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); break; case 'delete': ?> @@ -53,7 +53,7 @@ <?php break; case 'do_delete': - $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_fields WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); break; case 'add_new_category': if(isset($_POST['isprivate'])) { @@ -62,8 +62,8 @@ $isprivate = 0; } $linpha->db->Execute("INSERT into ".LIN_PREFIX."meta_category (field_id, name, isprivate) VALUES (" . - "'".linSql::linAddslashes($_POST['field_id'])."'," . - "'".linSql::linAddslashes($_POST['new_name'])."'," . + "'".LinSql::linAddslashes($_POST['field_id'])."'," . + "'".LinSql::linAddslashes($_POST['new_name'])."'," . "'".$isprivate."')"); break; @@ -75,13 +75,13 @@ } $linpha->db->Execute("UPDATE ".LIN_PREFIX."meta_category SET " . - "name = '".linSql::linAddslashes($_POST['new_name'])."', ". + "name = '".LinSql::linAddslashes($_POST['new_name'])."', ". "isprivate = '".$isprivate."' ". - "WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + "WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); break; case 'delete_category': - $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_category WHERE id = '".linSql::linAddslashes($_POST['id'])."'"); + $linpha->db->Execute("DELETE FROM ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); break; case 'update_exifiptc': $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['exifiptc_enable']); Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/admin/metadata_select.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -66,7 +66,7 @@ foreach($_POST['select_image_fields'] AS $value) { $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_fields (name, flags)" . - " VALUES ('".linSql::linAddslashes($value)."','".$flag_nr."')"); + " VALUES ('".LinSql::linAddslashes($value)."','".$flag_nr."')"); } } } Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/index.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -55,6 +55,9 @@ case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; +case 'exif': + require_once(LINPHA_DIR.'/lib/include/File_Info_Show.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/linpha.class.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -45,7 +45,7 @@ function __construct() { - $this->sql = new linSql(); + $this->sql = new LinSql(); /** * some defines Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -90,7 +90,7 @@ * set file informations */ $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . - "WHERE id = '".linSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); /** * check for valid id */ @@ -1286,8 +1286,8 @@ } $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".linSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . - "'".linSql::linAddslashes($comment)."')"); + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . + "'".LinSql::linAddslashes($comment)."')"); $this->newCommentAdded = true; // used for ajax } Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -777,46 +777,53 @@ } // end function showEditMetaData() + /** + * save meta linpha and meta iptc separetaly + */ function saveModifiedMetaData() { if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - if(isset($_POST['cmd']) && $_POST['cmd']=='insert_metadata') + /** + * write linpha meta data + */ + if(isset($_POST['linCmd']) && $_POST['linCmd']=='linInsertMetaLinpha') { LinMetaDataModificate::saveModifiedMetaDataLinpha(); + } + + /** + * write iptc data + */ + if( isset($_POST['linCmd']) + && $_POST['linCmd']=='linInsertMetaIptc' + && $GLOBALS['linpha']->sql->config->value['sys_image_iptc'] + && isset($GLOBALS['linpha']->imgview->src_file) + && file_exists($GLOBALS['linpha']->imgview->src_file) ) + { + global $new_ps_file_info_array; + $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; - if($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] - && isset($GLOBALS['linpha']->imgview->src_file) - && file_exists($GLOBALS['linpha']->imgview->src_file) - ) + /** + * important! + * remove other POST data from this array, because pjmt just takes all values and this will generate unexpected results!!! + * we got problems because $_POST['linMetaField'] is an array and pjmt couldnt handle this + */ + unset($new_ps_file_info_array['linCmd']); + unset($new_ps_file_info_array['linMetaField']); + unset($new_ps_file_info_array['submit']); + + if( LinMetaDataModificate::saveModifiedMetaDataIptc( $new_ps_file_info_array ) ) { /** - * write iptc data + * force read data from file again if write was successful */ - global $new_ps_file_info_array; - $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; - - /** - * important! - * remove other POST data from this array, because pjmt just takes all values and this will generate unexpected results!!! - * we got problems because $_POST['linMetaField'] is an array and pjmt couldnt handle this - */ - unset($new_ps_file_info_array['cmd']); - unset($new_ps_file_info_array['linMetaField']); - unset($new_ps_file_info_array['submit']); - - if( LinMetaDataModificate::saveModifiedMetaDataIptc( $new_ps_file_info_array ) ) - { - /** - * force read data from file again if write was successful - */ - unset($new_ps_file_info_array); - LinImport::updateEntry( - $GLOBALS['linpha']->template->idCurrent , - dirname($GLOBALS['linpha']->imgview->src_file) , - basename($GLOBALS['linpha']->imgview->src_file) - ); - } + unset($new_ps_file_info_array); + LinImport::updateEntry( + $GLOBALS['linpha']->template->idCurrent , + dirname($GLOBALS['linpha']->imgview->src_file) , + basename($GLOBALS['linpha']->imgview->src_file) + ); } } } @@ -859,8 +866,6 @@ * save iptc metadata back to file * * copied from pjmt/Write_File_Info.php - * - * @todo only save data if we entered some data in the iptc form!! */ function saveModifiedMetaDataIptc( & $new_ps_file_info_array ) { @@ -933,7 +938,7 @@ /** * echo "Error - Failure update Photoshop File Info : $filename <br>\n"; */ - linSysLog( i18n("Error - Failure update Photoshop File Info :" .' '. $filename) ); + linSysLog( i18n("Error: Failure update Photoshop File Info:" .' '. $filename) ); // Output HTML with the form and data which was // sent, to allow the user to fix it Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -176,7 +176,7 @@ /** - * register sub class linSqlConfig + * register sub class LinSqlConfig * (not during install, because we dont have any config table yet) */ if( ! isset($_SESSION['installmode2']) ) @@ -489,7 +489,7 @@ { $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".LIN_PREFIX."permissions " . "WHERE perm_type = '".LinSql::linAddslashes($perm_type)."' " . - "AND photos_id = '".linSql::linAddslashes($photos_id)."'"); + "AND photos_id = '".LinSql::linAddslashes($photos_id)."'"); if( isset( $data[0] ) && !empty( $data[0] ) ) { @@ -822,11 +822,11 @@ setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); } -} // end class linSql +} // end class LinSql /** - * sub-class linSqlConfig + * sub-class LinSqlConfig */ class LinSqlConfig { @@ -934,6 +934,6 @@ } } -} // end sub-class linSqlConfig +} // end sub-class LinSqlConfig ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php =================================================================== --- trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -912,7 +912,7 @@ if ( count( $date_pieces ) != 3 ) { // INVALID DATE - echo "Invalid Date - must be YYYY-MM-DD format<br>"; + linSysLog( i18n("Invalid Date - must be YYYY-MM-DD format") ); return FALSE; } @@ -923,7 +923,7 @@ if ( ! is_numeric( $piece ) ) { // INVALID DATE - echo "Invalid Date - must be YYYY-MM-DD format<br>"; + linSysLog( i18n("Invalid Date - must be YYYY-MM-DD format") ); return FALSE; } } Deleted: trunk/linpha2/lib/classes/pjmt/ShowFileInfo.php =================================================================== --- trunk/linpha2/lib/classes/pjmt/ShowFileInfo.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/classes/pjmt/ShowFileInfo.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -1,218 +0,0 @@ -<html> - -<!--*************************************************************************** -* -* Filename: Example.php -* -* Description: An example of how the PHP JPEG Metadata Toolkit can be used to -* display JPEG Metadata. -* -* Author: Evan Hunter -* -* Date: 30/7/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.11 -* -* Changes: 1.00 -> 1.10 : Changed name of GET parameter from 'filename' to 'jpeg_fname' -* to stop script-kiddies using the google command 'allinurl:*.php?filename=*' -* to find servers to attack -* Changed behavior when no filename is given, to be cleaner -* 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php -* Changed this example file to be easily relocatable -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* License: This file is part of the PHP JPEG Metadata Toolkit. -* -* The PHP JPEG Metadata Toolkit is free software; you can -* redistribute it and/or modify it under the terms of the -* GNU General Public License as published by the Free Software -* Foundation; either version 2 of the License, or (at your -* option) any later version. -* -* The PHP JPEG Metadata Toolkit is distributed in the hope -* that it will be useful, but WITHOUT ANY WARRANTY; without -* even the implied warranty of MERCHANTABILITY or FITNESS -* FOR A PARTICULAR PURPOSE. See the GNU General Public License -* for more details. -* -* You should have received a copy of the GNU General Public -* License along with the PHP JPEG Metadata Toolkit; if not, -* write to the Free Software Foundation, Inc., 59 Temple -* Place, Suite 330, Boston, MA 02111-1307 USA -* -* If you require a different license for commercial or other -* purposes, please contact the author: ev...@oz... -* -***************************************************************************--> - - <head> - - <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> - <STYLE TYPE="text/css" MEDIA="screen, print, projection"> - <!-- - - BODY { background-color:#505050; color:#F0F0F0 } - a { color:orange } - .EXIF_Main_Heading { color:red } - .EXIF_Secondary_Heading{ color: orange} - .EXIF_Table { border-collapse: collapse ; border: 1px solid #909000} - .EXIF_Table tbody td{border-width: 1px; border-style:solid; border-color: #909000;} - - --> - </STYLE> - - - <?php - // Turn off Error Reporting - error_reporting ( 0 ); - - // Change: Allow this example file to be easily relocatable - as of version 1.11 - $Toolkit_Dir = "./"; // Ensure dir name includes trailing slash - - // Hide any unknown EXIF tags - $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; - - include $Toolkit_Dir . 'Toolkit_Version.php'; // Change: added as of version 1.11 - include $Toolkit_Dir . 'JPEG.php'; // Change: Allow this example file to be easily relocatable - as of version 1.11 - include $Toolkit_Dir . 'JFIF.php'; - include $Toolkit_Dir . 'PictureInfo.php'; - include $Toolkit_Dir . 'XMP.php'; - include $Toolkit_Dir . 'Photoshop_IRB.php'; - include $Toolkit_Dir . 'EXIF.php'; - - // Retrieve the JPEG image filename from the http url request - if ( ( !array_key_exists( 'jpeg_fname', $GLOBALS['HTTP_GET_VARS'] ) ) || - ( $GLOBALS['HTTP_GET_VARS']['jpeg_fname'] == "" ) ) - { - echo "<title>No image filename defined</title>\n"; - echo "</head>\n"; - echo "<body>\n"; - echo "<p>No image filename defined - use GET method with field: jpeg_fname</p>\n"; - echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 - echo "</body>\n"; - exit( ); - } - else - { - $filename = $GLOBALS['HTTP_GET_VARS']['jpeg_fname']; - } - - - // Output the title - echo "<title>Metadata details for $filename</title>"; - - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data( $filename ); - - ?> - - </head> - - <body> - - <p>Interpreted using: <a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - <br> - <br> - - <h1><B><U>Metadata for "<?php echo $filename; ?>"</U></B></h1> - <br> - - <!-- Output a link allowing user to edit the Photoshop File Info - Change: Allow this example file to be easily relocatable - as of version 1.11 - --> - <?php $relative_filename = get_relative_path( $filename, $Toolkit_Dir ); ?> - <h4><a href="<?php echo $Toolkit_Dir."Edit_File_Info_Example.php?jpeg_fname=$relative_filename"; ?>" >Click here to edit the Photoshop File Info for this file</a></h4> - <br> - - - - <!-- Output the information about the APP segments --> - <?php echo Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Intrinsic JPEG Information --> - <?php echo Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG Comment --> - <?php echo Interpret_Comment_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JPEG File Interchange Format Information --> - <?php echo Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the JFIF Extension Information --> - <?php echo Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Picture Info Text --> - <?php echo Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the EXIF Information --> - <?php echo Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the XMP Information --> - <?php echo Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ) ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Photoshop IRB (including the IPTC-NAA info --> - <?php echo Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Output the Meta Information --> - <?php echo Interpret_EXIF_to_HTML( get_Meta_JPEG( $filename ), $filename ); ?> - - <BR> - <HR> - <BR> - - <!-- Display the original image --> - - <h2>Original Image</h2> - <?php echo "<img src=\"$filename\">"; ?> - - - <BR> - <BR> - <BR> - <p>Interpreted using:</p> - <p><a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 --> - - </body> - -</html> \ No newline at end of file Deleted: trunk/linpha2/lib/include/Edit_File_Info.php =================================================================== --- trunk/linpha2/lib/include/Edit_File_Info.php 2006-11-19 20:41:34 UTC (rev 4660) +++ trunk/linpha2/lib/include/Edit_File_Info.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -1,562 +0,0 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -/**************************************************************************** -* -* Filename: Edit_File_Info.php -* -* Description: Allows the user to edit the metadata of an image over the internet -* in the same way that Photoshop edits 'File Info' data -* This file provides only the html for a form containing the file info -* input fields. The rest of the html file must be provided by the calling script. -* $outputfilename must always be defined - it is ne name of the file which -* have the metadata changed after the form has been submitted -* -* This file has several modes of operation: -* -* 1) If $new_ps_file_info_array is defined then it's data will be used -* to fill the fields. -* 2) If $new_ps_file_info_array is not defined but $filename is defined, -* then the file info fields will be filled from the metadata in the file specified -* 3) If $new_ps_file_info_array is not defined but $filename and $default_ps_file_info_array -* are defined, then the file info fields will be filled from the metadata -* in the file specified, but where fields are blank, they will be filled from $default_ps_file_info_array -* 4) Otherwise the fields will be blank -* -* See Edit_File_Info_Example.php for an example of usage -* -* Author: Evan Hunter -* -* Date: 17/11/2004 -* -* Project: PHP JPEG Metadata Toolkit -* -* Revision: 1.11 -* -* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php -* -* URL: http://electronics.ozhiker.com -* -* Copyright: Copyright Evan Hunter 2004 -* -* License: This file is part of the PHP JPEG Metadata Toolkit. -* -* The PHP JPEG Metadata Toolkit is free software; you can -* redistribute it and/or modify it under the terms of the -* GNU General Public License as published by the Free Software -* Foundation; either version 2 of the License, or (at your -* option) any later version. -* -* The PHP JPEG Metadata Toolkit is distributed in the hope -* that it will be useful, but WITHOUT ANY WARRANTY; without -* even the implied warranty of MERCHANTABILITY or FITNESS -* FOR A PARTICULAR PURPOSE. See the GNU General Public License -* for more details. -* -* You should have received a copy of the GNU General Public -* License along with the PHP JPEG Metadata Toolkit; if not, -* write to the Free Software Foundation, Inc., 59 Temple -* Place, Suite 330, Boston, MA 02111-1307 USA -* -* If you require a different license for commercial or other -* purposes, please contact the author: ev...@oz... -* -***************************************************************************/ - - - - include LINPHA_DIR.'/lib/classes/pjmt/Toolkit_Version.php'; // Change: added as of version 1.11 - - // Check for operation modes 2 or 3 - // i.e. $filename is defined, and $new_ps_file_info_array is not - if ( ( ! isset( $new_ps_file_info_array ) ) && - ( isset( $filename ) ) && - ( is_string( $filename ) ) ) - { - // Hide any unknown EXIF tags - $GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE; - - // Accessing the existing file info for the specified file requires these includes - include_once( LINPHA_DIR.'/lib/classes/pjmt/JPEG.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/XMP.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/Photoshop_IRB.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/EXIF.php' ); - include_once( LINPHA_DIR.'/lib/classes/pjmt/Photoshop_File_Info.php' ); - - // Retrieve the header information from the JPEG file - $jpeg_header_data = get_jpeg_header_data( $filename ); - - // Retrieve EXIF information from the JPEG file - $Exif_array = get_EXIF_JPEG( $filename ); - - // Retrieve XMP information from the JPEG file - $XMP_array = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) ); - - // Retrieve Photoshop IRB information from the JPEG file - $IRB_array = get_Photoshop_IRB( $jpeg_header_data ); - - // Retrieve Photoshop File Info from the three previous arrays - $new_ps_file_info_array = get_photoshop_file_info( $Exif_array, $XMP_array, $IRB_array ); - - - - // Check if there is an array of defaults available - if ( ( isset( $default_ps_file_info_array) ) && - ( is_array( $default_ps_file_info_array) ) ) - { - // There are defaults defined - - // Check if there is a default for the date defined - if ( ( ! array_key_exists( 'date', $default_ps_file_info_array ) ) || - ( ( array_key_exists( 'date', $default_ps_file_info_array ) ) && - ( $default_ps_file_info_array['date'] == '' ) ) ) - { - // No default for the date defined - // figure out a default from the file - - // Check if there is a EXIF Tag 36867 "Date and Time of Original" - if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 34665, $Exif_array[0] ) ) && - ( array_key_exists( 0, $Exif_array[0][34665] ) ) && - ( array_key_exists( 36867, $Exif_array[0][34665][0] ) ) ) - { - // Tag "Date and Time of Original" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36867]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - // Check if there is a EXIF Tag 36868 "Date and Time when Digitized" - else if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 34665, $Exif_array[0] ) ) && - ( array_key_exists( 0, $Exif_array[0][34665] ) ) && - ( array_key_exists( 36868, $Exif_array[0][34665][0] ) ) ) - { - // Tag "Date and Time when Digitized" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][34665][0][36868]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - // Check if there is a EXIF Tag 306 "Date and Time" - else if ( ( $Exif_array != FALSE ) && - ( array_key_exists( 0, $Exif_array ) ) && - ( array_key_exists( 306, $Exif_array[0] ) ) ) - { - // Tag "Date and Time" found - use it for the default date - $default_ps_file_info_array['date'] = $Exif_array[0][306]['Data'][0]; - $default_ps_file_info_array['date'] = preg_replace( "/(\d\d\d\d):(\d\d):(\d\d)( \d\d:\d\d:\d\d)/", "$1-$2-$3", $default_ps_file_info_array['date'] ); - } - else - { - // Couldn't find an EXIF date in the image - // Set default date as creation date of file - $default_ps_file_info_array['date'] = date ("Y-m-d", filectime( $filename )); - } - } - - // Cycle through all the elements of the default values array - foreach( $default_ps_file_info_array as $def_key =>$default_item ) - { - // Check if the current element is Keywords or - // Supplemental Categories as these are arrays - // and need to be treated differently - if ( ( strcasecmp( $def_key, "keywords" ) == 0 ) || - ( strcasecmp( $def_key, "supplementalcategories" ) == 0 ) ) - { - // Keywords or Supplemental Categories found - // Check if the File Info from the file is empty for this element - // and if there are default values in this array element - if ( ( count( $new_ps_file_info_array[ $def_key ] ) == 0 ) && - ( is_array( $default_item ) ) && - ( count( $default_item ) >= 0 ) ) - { - // The existing file info is empty, and there are - // defaults - add them - $new_ps_file_info_array[ $def_key ] = $default_item; - } - } - // Otherwise, this is not an array element, just check if it is blank in the existing file info - else if ( trim( $new_ps_file_info_array[ $def_key ] ) == "" ) - { - // The existing file info is blank, add the default value - $new_ps_file_info_array[ $def_key ] = $default_item; - } - - } - } - } - // Check for operation mode 4 - $new_ps_file_info_array and $filename are not defined, - else if ( ( ( !isset($new_ps_file_info_array) ) || ( ! is_array($new_ps_file_info_array) ) ) && - ( ( !isset($filename) ) || ( ! is_string( $filename ) ) ) ) - { - // No filename or new_ps_file_info_array defined, create a blank file info array to display - $new_ps_file_info_array = array( - "title" => "", - "author" => "", - "authorsposition" => "", - "caption" => "", - "captionwriter" => "", - "jobname" => "", - "copyrightstatus" => "", - "copyrightnotice" => "", - "ownerurl" => "", - "keywords" => array(), - "category" => "", - "supplementalcategories" => array(), - "date" => "", - "city" => "", - "state" => "", - "country" => "", - "credit" => "", - "source" => "", - "headline" => "", - "instructions" => "", - "transmissionreference" => "", - "urgency" => "" ); - } - - - -/*************************************************************************** -* -* Now output the actual HTML form -* -***************************************************************************/ -/** -?> - - - - - <form name="EditJPEG" action="Write_File_Info.php" method="post"> - - - echo "<input name=\"filename\" type=\"hidden\" value=\"$outputfilename\">"; - - <table> -*/ -?> - <tr> - <td> - Title - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"title\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'title' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - <tr> - <td> - Author - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"author\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'author' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - <tr> - <td> - Authors Position - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"authorsposition\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'authorsposition' ], ENT_QUOTES) ."\"> - Note: not used in Photoshop 7 or higher"; - ?> - </td> - </tr> - - <tr> - <td> - Description - </td> - <td> - <textarea name="caption" class="linForms" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'caption' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - <tr> - <td> - Description Writer - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"captionwriter\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'captionwriter' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Keywords - </td> - <td> - <textarea class="linForms" name="keywords" rows=3 cols=37 wrap="off"><?php - foreach( $new_ps_file_info_array[ 'keywords' ] as $keyword ) - { - echo htmlspecialchars($keyword, ENT_QUOTES)."
"; - } - ?></textarea> - </td> - </tr> - - - <tr> - <td> - Copyright Status - </td> - <td> - <select size=1 class="linForms" name="copyrightstatus"> - <?php - $copystatus = $new_ps_file_info_array[ 'copyrightstatus' ]; - if ( $copystatus == "Unknown" ) - { - echo "<option value=\"Unknown\" SELECTED >Unknown</option>\n"; - } - else - { - echo "<option value=\"Unknown\">Unknown</option>\n"; - } - - if ( $copystatus == "Copyrighted Work" ) - { - echo "<option value=\"Copyrighted Work\" SELECTED >Copyrighted Work</option>\n"; - } - else - { - echo "<option value=\"Copyrighted Work\">Copyrighted Work</option>\n"; - } - - if ( $copystatus == "Public Domain" ) - { - echo "<option value=\"Public Domain\" SELECTED >Public Domain</option>\n"; - } - else - { - echo "<option value=\"Public Domain\">Public Domain</option>\n"; - } - ?> - </select> - </td> - </tr> - - - <tr> - <td> - Copyright Notice - </td> - <td> - <textarea class="linForms" name="copyrightnotice" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'copyrightnotice' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - <tr> - <td> - Copyright Info URL - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"ownerurl\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\">\n"; - if ($new_ps_file_info_array[ 'ownerurl' ] != "" ) - { - echo "<a href=\"". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) ."\" > (". htmlspecialchars($new_ps_file_info_array[ 'ownerurl' ], ENT_QUOTES) .")</a>\n"; - } - ?> - - </td> - </tr> - - - <tr> - <td> - Category - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"category\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'category' ], ENT_QUOTES) ."\">\n"; - ?> - - </td> - </tr> - - <tr> - <td> - Supplemental Categories - </td> - <td> - <textarea class="linForms" name="supplementalcategories" rows=3 cols=37 wrap="off"><?php - foreach( $new_ps_file_info_array[ 'supplementalcategories' ] as $supcat ) - { - echo htmlspecialchars($supcat, ENT_QUOTES)."
"; - } - ?></textarea> - </td> - </tr> - - - - <tr> - <td> - Date Created - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"date\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'date' ], ENT_QUOTES) ."\">"; - ?> - - Note date must be YYYY-MM-DD format - </td> - </tr> - - <tr> - <td> - City - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"city\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'city' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - State - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"state\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'state' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Country - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"country\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'country' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - - <tr> - <td> - Credit - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"credit\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'credit' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - <tr> - <td> - Source - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"source\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'source' ], ENT_QUOTES) ."\">"; - ?> - </td> - </tr> - - - - <tr> - <td> - Headline - </td> - <td> - <textarea class="linForms" name="headline" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'headline' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - - <tr> - <td> - Instructions - </td> - <td> - <textarea class="linForms" name="instructions" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'instructions' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - - <tr> - <td> - Transmission Reference - </td> - <td> - <textarea class="linForms" name="transmissionreference" rows=3 cols=37 wrap="off"><?php echo htmlspecialchars($new_ps_file_info_array[ 'transmissionreference' ], ENT_QUOTES); ?></textarea> - </td> - </tr> - - <tr> - <td> - Job Name - </td> - <td> - <?php - echo "<input size=49 class=\"linForms\" name=\"jobname\" type=\"text\" value=\"". htmlspecialchars($new_ps_file_info_array[ 'jobname' ], ENT_QUOTES) ."\"> - Note: not used in Photoshop CS"; - ?> - </td> - </tr> - - <tr> - <td> - Urgency - </td> - <td> - <select size="1" class="linForms" name="urgency"> - <?php - for( $i = 1; $i <= 8; $i++ ) - { - echo "<option value=\"$i\""; - if ( $new_ps_file_info_array[ 'urgency' ] == $i ) - { - echo " SELECTED "; - } - echo ">"; - if ( $i == 1 ) - { - echo "High"; - } - else if ( $i == 5 ) - { - echo "Normal"; - } - else if ( $i == 8 ) - { - echo "Low"; - } - else - { - echo "$i"; - } - echo "</option>\n"; - } - if ( $new_ps_file_info_array[ 'urgency' ] == "none" ) - { - echo "<option value=\"none\" SELECTED >None</option>"; - } - else - { - echo "<option value=\"none\" >None</option>"; - } - ?> - - </select> - </td> - </tr> Copied: trunk/linpha2/lib/include/File_Info_Edit.php (from rev 4660, trunk/linpha2/lib/include/Edit_File_Info.php) =================================================================== --- trunk/linpha2/lib/include/File_Info_Edit.php (rev 0) +++ trunk/linpha2/lib/include/File_Info_Edit.php 2006-11-23 21:46:25 UTC (rev 4661) @@ -0,0 +1,590 @@ +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +/**************************************************************************** +* +* Filename: Edit_File_Info.php +* +* Description: Allows the user to edit the metadata of an image over the internet +* in the same way that Photoshop edits 'File Info' data +* This file provides only the html for a form containing the file info +* input fields. The rest of the html file must be provided by the calling script. +* $outputfilename must always be defined - it is ne name of the file which +* have the metadata changed after the form has been submitted +* +* This file has several modes of operation: +* +* 1) If $new_ps_file_info_array is defined then it's data will be used +* to fill the fields. +* 2) If $new_ps_file_info_array is not defined but $filename is defined, +* then the file info fields will be filled from the metadata in the file specified +* 3) If $new_ps_file_info_array is not defined but $filename and $default_ps_file_info_array +* are defined, then the file info fields will be filled from the metadata +* in the file specified, but where fields are blank, they will be filled from $default_ps_file_info_array +* 4) Otherwise the fields will be blank +* +* See Edit_File_Info_Example.php for an example of usage +* +* Author: Evan Hunter +* +* Date: 17/11/2004 +* +* Project: PHP JPEG Metadata Toolkit +* +* Revision: 1.11 +* +* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php +* +* URL: http://electronics.ozhiker.com +* +* Copyright: Copyright Evan Hunter 2004 +* +* License: This file is part of the PHP JPEG Metadata Toolkit. +* +* The PHP JPEG Metadata Toolkit is free software; you can +* redistribute it and/or modify it under the terms of the +* GNU General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* The PHP JPEG Metadata Toolkit is distributed in the hope +* that it will be useful, but WITHOUT ANY WARRANTY; without +* even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +* +* You should have received a copy of the GNU General Public +* License along with the PHP JPEG Metadata Toolkit; if not, +* write to the Free Software Foundation, Inc., 59 Temple +* Place, Suite 330, Boston, MA 02111-1307 USA +* +* If you require a different license for commercial or other +* purposes, please contact the author: ev...@oz... +* +***************************************************************************/ + +/** + * if $default_ps_file_info_array is set and the key 'date' is empty + * it will be auto filled with the exif date and we prevent errors like + * "Invalid Date - must be YYYY-MM-DD format" + */ +$default_ps_file_info_array = array ( + 'title' => "", + 'author' => "", + 'authorsposition' => "", + 'caption' => "", + 'captionwriter' => "", + 'jobname' => "", + 'copyrightstatus' => "", + 'copyrightnotice' => "", + 'ownerurl' => "", + 'keywords' => array(), + 'category' => "", + 'supplementalcategories'=> array(), + 'date' => "", + 'city' => "", + 'state' => "", + 'country' => "", + 'credit' => "", + 'source' => "", + 'headline' => "", + 'instructions' => "", + 'transmissionreference' => "", + 'urgency' => "" + ); + + ... [truncated message content] |
From: <fan...@us...> - 2006-11-27 06:44:40
|
Revision: 4664 http://svn.sourceforge.net/linpha/?rev=4664&view=rev Author: fangehrn Date: 2006-11-26 14:14:38 -0800 (Sun, 26 Nov 2006) Log Message: ----------- 2006-11-26 flo * create backup of file while editing iptc data * added new requirements check in the installer: show a warning if the server does not support .htaccess files Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/install/lib.install.php trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/ChangeLog 2006-11-26 22:14:38 UTC (rev 4664) @@ -1,3 +1,8 @@ +2006-11-26 flo + * create backup of file while editing iptc data + * added new requirements check in the installer: show a warning if the server does not + support .htaccess files + 2006-11-23 flo * todo: only save iptc data if we entered some data in the iptc form -- done * todo: show full exif informations with pjmt/ShowFileInfo.php (provide security!) -- done Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/docs/dev/TODO.txt 2006-11-26 22:14:38 UTC (rev 4664) @@ -6,6 +6,9 @@ ## Small Todos - 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 - how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? @@ -16,6 +19,16 @@ echo LIN_STR_SUBMIT; ? +- if GDLib is not installed, the rounded corner stuff does not work + -> create for each installed theme and/or example in the admin page rounded corners by hand and save them to /lib/graphics + -> in roundedcorners.php add a check if function_exists 'imagejpeg' and if not, take them from /lib/graphics + -> allow user only to choose colors for which the images in /lib/graphics exists if gdlib is not installed, and add an info why it is limited + +- if the /var folder is not protected from outside (allow override in httpd.conf not set, or IIS with no support of .htaccess files) + its maybe dangerous to save the linpha logger's log file to /var + a hacker could get a list of possible usernames and other private informations! + so, what to do? i would like to have the linpha logger enabled by default... + ## Big Todos - Installer @@ -28,16 +41,6 @@ -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - DONT add feature to drop tables if they already exists -- IPTC/XMP Image fields - - Read XMP entries - - Write IPTC/XMP entries - - UTF-8 support - - see also - https://sourceforge.net/forum/message.php?msg_id=3648731 - and - https://sourceforge.net/forum/message.php?msg_id=3674100 - - wait until new release is done by evan hunter ? - - Videos - Video thumbnail (what about ffmpeg?) - switch between quicktime and mplayer? @@ -67,6 +70,17 @@ DONE ==== + +- IPTC/XMP Image fields + - Read XMP entries + - Write IPTC/XMP entries + - UTF-8 support + - see also + https://sourceforge.net/forum/message.php?msg_id=3648731 + and + https://sourceforge.net/forum/message.php?msg_id=3674100 + - wait until new release is done by evan hunter ? + - Style - use relative font sizes instead of aboslute - style forms this way http://www.cssplay.co.uk/menu/form.html Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/install/lib.install.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -373,7 +373,39 @@ } +/** + * get a clean path + * input: ..//./../dir4//./dir5/dir6/..//dir7/ + * output: ../../dir4/dir5/dir7/ + * + * the php builtin function realpath does not work if the file does not exists + * + * thanks to http://ch2.php.net/realpath + */ +function installCleanPath($path) { + $result = array(); + // $pathA = preg_split('/[\/\\\]/', $path); + $pathA = explode('/', $path); + if (!$pathA[0]) + $result[] = ''; + foreach ($pathA AS $key => $dir) { + if ($dir == '..') { + if (end($result) == '..') { + $result[] = '..'; + } elseif (!array_pop($result)) { + $result[] = '..'; + } + } elseif ($dir && $dir != '.') { + $result[] = $dir; + } + } + if (!end($pathA)) + $result[] = ''; + return implode('/', $result); +} + + function failed_msg() { $str = "<font color='red'>"; Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/install/lib.requirements.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -216,4 +216,55 @@ } } +/** + * this function checks if the server supports the .htaccess directive to forbid + * access to albums and var folder + * + * @author flo + * @uses step2_requirements.php + * @package requirements + * @return int error number: 1: access forbidden, 2: access possible, 3: unknown + * @todo test with other webservers than apache2 (-> apache1, IIS, ..?) + */ +function installCheckProtectedFromOutside() +{ + $dir = installCleanPath( dirname($_SERVER['PHP_SELF']).'/'.LINPHA_DIR ); // same as LINPHA_CLIENT + $dir .= '/albums/'; + $url = $_SERVER['SERVER_NAME']; + $port = $_SERVER['SERVER_PORT']; + + $fp = fsockopen ($url, $port, $errno, $errstr, 5); + if (!$fp) + { + return 3; + } + else + { + $get_data = "GET ".$dir." HTTP/1.1\r\nHost: ".$_SERVER['SERVER_NAME']."\r\nConnection: close\r\n\r\n"; + fputs ($fp, $get_data); + + $string = ''; + while (!feof($fp)) + { + $string .= fgets($fp,128); + } + fclose($fp); + + if( preg_match('/^HTTP\/1.1 403 Forbidden/', $string) // string starts with "HTTP/1.1 403 Forbidden" + OR strpos($string, 'Error 403')!==false // string contains "Error 403" + OR strpos($string, '403 Forbidden') !== false) // string contains "403 Forbidden" + { + return 1; + } + elseif( preg_match('/^HTTP\/1.1 200 OK/', $string) ) // string starts with "HTTP/1.1 200 OK" + { + return 2; + } + else + { + return 3; + } + } +} + ?> \ No newline at end of file Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/install/step2_requirements.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -377,7 +377,32 @@ $error = 1; } +/** + * checking album and var folder are protected from outside + */ + print_line_left("Album And System Folder Protected From Outside"); + + $ret = installCheckProtectedFromOutside(); + if( $ret == 1 ) + { + print_line_middle("Yes"); + print_line_right(success_msg()); + print_line_info("The /albums and /var folders are protected from outside. See <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details."); + } + elseif( $ret == 2 ) + { + print_line_middle("No"); + print_line_right(warning_msg()); + print_line_info("The /albums and /var folders are not protected from outside! Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details."); + } + elseif( $ret == 3 ) + { + print_line_middle("Unknown"); + print_line_right(warning_msg()); + print_line_info("Cannot determine wether the /albums and /var folders are protected from outside! Please see <a href=\"http://linpha.sourceforge.net/wiki/index.php/Secure_LinPHA\">here</a> for more details."); + } + /** * show footer of table requirements */ Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -285,6 +285,8 @@ * input: ..//./../dir4//./dir5/dir6/..//dir7/ * output: ../../dir4/dir5/dir7/ * + * the php builtin function realpath does not work if the file does not exists + * * thanks to http://ch2.php.net/realpath */ function cleanPath($path) { @@ -309,5 +311,39 @@ return implode('/', $result); } +/** + * copy a file with a timestamp + * + * @author flo + * @param $filename string path to file to backup + * @return bool true if successful, false on failure + * @uses LinMetaDataModificate::saveModifiedMetaData() + */ +function backupFile($filename) +{ + if( !file_exists($filename)) + { + return false; + } + + $dirname = dirname($filename); + $basename = basename($filename); + + $pos = strrpos($basename,'.'); + $file_without_ext = substr($basename,0,$pos); + $file_ext = substr($basename,$pos+1); + + $timeformat = strftime("%Y%m%d_%H%M%S"); + + if( @copy($filename, $dirname.'/.'.$file_without_ext.'_bak_'.$timeformat.'.'.$file_ext) ) + { + return true; + } + else + { + return false; + } +} + } // end class LinFile ?> Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -528,6 +528,7 @@ * login, logout, rotate * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm * thumbnail, image + * meta_iptc * * * @param string $type log types @@ -548,9 +549,9 @@ { switch($type) { - case LOG_TYPE_IMPORT: $type_msg = 'IMPORT'; break; - case LOG_TYPE_UPDATE: $type_msg = 'UPDATE'; break; - case LOG_TYPE_USER: $type_msg = 'USER'; break; + case LOG_TYPE_IMPORT: $type_msg = 'IMPORT '; break; + case LOG_TYPE_UPDATE: $type_msg = 'UPDATE '; break; + case LOG_TYPE_USER: $type_msg = 'USER '; break; case LOG_TYPE_DB: $type_msg = 'DATABASE'; break; case LOG_TYPE_META: $type_msg = 'COMMENTS'; break; case LOG_TYPE_FILEMANAGER: $type_msg = 'FILEMANAGER'; break; @@ -563,13 +564,13 @@ switch($severity) { case LOG_EMERG: $severity_msg = 'EMERGENCY ERROR'; break; - case LOG_ALERT: $severity_msg = 'ALERT'; break; + case LOG_ALERT: $severity_msg = 'ALERT '; break; case LOG_CRIT: $severity_msg = 'CRITICAL ERROR'; break; - case LOG_ERR: $severity_msg = 'ERROR'; break; + case LOG_ERR: $severity_msg = 'ERROR '; break; case LOG_WARNING: $severity_msg = 'WARNING'; break; - case LOG_NOTICE: $severity_msg = 'NOTICE'; break; - case LOG_INFO: $severity_msg = 'INFO'; break; - case LOG_DEBUG: $severity_msg = 'DEBUG'; break; + case LOG_NOTICE: $severity_msg = 'NOTICE '; break; + case LOG_INFO: $severity_msg = 'INFO '; break; + case LOG_DEBUG: $severity_msg = 'DEBUG '; break; } /** @@ -595,14 +596,14 @@ */ if( !isset($GLOBALS['linpha']->sql->config->value) ) // database not connected! { - error_log("$time | $severity_msg | $type_msg | $ip | $user | $text".LIN_NL, 3, LINPHA_DIR.'/var/db_error.log' ); + error_log("$time | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LINPHA_DIR.'/var/db_error.log' ); } else { /** * filename */ - error_log("$time | $severity_msg | $type_msg | $ip | $user | $text".LIN_NL, 3, LinFilesys::getFullPath($GLOBALS['linpha']->sql->config->value['plugins_log_filename']) ); + error_log("$time | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LinFilesys::getFullPath($GLOBALS['linpha']->sql->config->value['plugins_log_filename']) ); /** * email @@ -642,7 +643,7 @@ } } - syslog($severity, "LinPHA $severity_msg | $type_msg | $ip | $user | $text"); + syslog($severity, "LinPHA $severity_msg | $type_msg | $ip | $user | $event | $text"); } } } Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -41,7 +41,6 @@ public $tot_photos; public $photos; public $photos_filtered; -public $use_javascript; public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; private $nr_pages, $current_page; // only used if javascript disabled private $newCommentAdded = false; // used for ajax Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -467,6 +467,9 @@ /** * exif date and exif rotate stuff * globally turn off using 'sys_import_exif' if having problems with pjmt + * + * @todo index all exif tags if we already have read the meta data! + * but should we also read iptc at this point? */ if( $GLOBALS['linpha']->sql->config->value['sys_import_exif'] ) { Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -790,6 +790,7 @@ if(isset($_POST['linCmd']) && $_POST['linCmd']=='linInsertMetaLinpha') { LinMetaDataModificate::saveModifiedMetaDataLinpha(); + linSysLog( i18n("Successfully updated data.") ); } /** @@ -813,18 +814,26 @@ unset($new_ps_file_info_array['linMetaField']); unset($new_ps_file_info_array['submit']); - if( LinMetaDataModificate::saveModifiedMetaDataIptc( $new_ps_file_info_array ) ) + if( LinFilesys::backupFile($GLOBALS['linpha']->imgview->src_file)) { - /** - * force read data from file again if write was successful - */ - unset($new_ps_file_info_array); - LinImport::updateEntry( - $GLOBALS['linpha']->template->idCurrent , - dirname($GLOBALS['linpha']->imgview->src_file) , - basename($GLOBALS['linpha']->imgview->src_file) - ); + if( LinMetaDataModificate::saveModifiedMetaDataIptc( $new_ps_file_info_array, $GLOBALS['linpha']->imgview->src_file ) ) // error handling already done + { + /** + * force read data from file again if write was successful + */ + unset($new_ps_file_info_array); + LinImport::updateEntry( + $GLOBALS['linpha']->template->idCurrent , + dirname($GLOBALS['linpha']->imgview->src_file) , + basename($GLOBALS['linpha']->imgview->src_file) + ); + } } + else + { + linSysLog( sprintf( i18n("Error: Cannot create backup of: %s"), $GLOBALS['linpha']->imgview->src_file) ); + linLog( LOG_TYPE_META, LOG_ERR, 'meta_iptc', "Error: Cannot create backup of:" .' '. $GLOBALS['linpha']->imgview->src_file ); + } } } } @@ -867,7 +876,7 @@ * * copied from pjmt/Write_File_Info.php */ - function saveModifiedMetaDataIptc( & $new_ps_file_info_array ) + function saveModifiedMetaDataIptc( & $new_ps_file_info_array, $filename ) { /** // Turn off Error Reporting error_reporting ( 0 ); // Change: changed to no reporting - as of version 1.11 @@ -917,7 +926,6 @@ // Change: removed limitation on file being in current directory - as of version 1.11 * */ - $filename = $GLOBALS['linpha']->imgview->src_file; // Retrieve the header information $jpeg_header_data = get_jpeg_header_data( $filename ); @@ -939,6 +947,7 @@ * echo "Error - Failure update Photoshop File Info : $filename <br>\n"; */ linSysLog( i18n("Error: Failure update Photoshop File Info:" .' '. $filename) ); + linLog( LOG_TYPE_META, LOG_ERR, 'meta_iptc', "Error: Failure update Photoshop File Info:" .' '. $filename ); // Output HTML with the form and data which was // sent, to allow the user to fix it @@ -962,6 +971,7 @@ * echo "Error - Failure to write new JPEG : $filename <br>\n"; */ linSysLog( i18n("Error: Failure to write new JPEG:" .' '. $filename) ); + linLog( LOG_TYPE_META, LOG_ERR, 'meta_iptc', "Error: Failure to write new JPEG:" .' '. $filename ); // Output HTML with the form and data which was // sent, to allow the user to fix it @@ -983,6 +993,7 @@ // Output information about new file linSysLog( i18n("DONE! Updated:" .' '. $filename) ); + linLog( LOG_TYPE_META, LOG_NOTICE, 'meta_iptc', "Updated:" .' '. $filename ); /** echo "<h1>DONE! - $filename updated</h1>\n"; echo "<p><a href=\"Example.php?jpeg_fname=$filename\" >View Full Metatdata Information</a></p>\n"; Modified: trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php =================================================================== --- trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php 2006-11-23 21:49:17 UTC (rev 4663) +++ trunk/linpha2/lib/classes/pjmt/Photoshop_File_Info.php 2006-11-26 22:14:38 UTC (rev 4664) @@ -238,10 +238,13 @@ // Cycle through each Subject value and save them foreach ( $Item['children'][0]['children'] as $keywords ) { - if ( ! in_array ( HTML_UTF8_Escape( $keywords['value'] ), $outputarray['keywords'])) + /** + * edited by linpha, flo 25.11.2006: first check if array_key_exists befor in_array statement to prevent php notice + */ + if ( array_key_exists( 'value', $keywords ) ) { - if ( array_key_exists( 'value', $keywords ) ) - { + if ( ! in_array ( HTML_UTF8_Escape( $keywords['value'] ), $outputarray['keywords'])) + { $outputarray['keywords'][] = HTML_UTF8_Escape( $keywords['value'] ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Florian A. <fl...@an...> - 2006-12-17 21:52:09
|
Revision: 4665 http://svn.sourceforge.net/linpha/?rev=4665&view=rev Author: fangehrn Date: 2006-12-17 13:49:03 -0800 (Sun, 17 Dec 2006) Log Message: ----------- 2006-12-17 flo * added newest getid3 library * added watermark scripts from linpha1 (used for video thumbnails) * added video thumbnail (modified from linpha1) * added video support in LinImage.js * @todo download video, play video, video metadata Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/settings_layout.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/docs/dev/important stuff.txt trunk/linpha2/lib/classes/image/gdlib/image.php trunk/linpha2/lib/classes/image/gdlib/thumbnail.php trunk/linpha2/lib/classes/image/gdlib/thumbnail_folder.php trunk/linpha2/lib/classes/image/imagemagick/image.php trunk/linpha2/lib/classes/image/imagemagick/thumbnail.php trunk/linpha2/lib/classes/image/imagemagick/thumbnail_folder.php trunk/linpha2/lib/classes/linpha.filesys.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/lib/plugins/watermark/func.watermark.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/misc/roundcorners.php Added Paths: ----------- trunk/linpha2/lib/classes/getid3/ trunk/linpha2/lib/classes/getid3/extension.cache.dbm.php trunk/linpha2/lib/classes/getid3/extension.cache.mysql.php trunk/linpha2/lib/classes/getid3/getid3.lib.php trunk/linpha2/lib/classes/getid3/getid3.php trunk/linpha2/lib/classes/getid3/license/ trunk/linpha2/lib/classes/getid3/license/dependencies.txt trunk/linpha2/lib/classes/getid3/license/license.commercial.txt trunk/linpha2/lib/classes/getid3/license/license.txt trunk/linpha2/lib/classes/getid3/license/readme.txt trunk/linpha2/lib/classes/getid3/module.archive.gzip.php trunk/linpha2/lib/classes/getid3/module.archive.rar.php trunk/linpha2/lib/classes/getid3/module.archive.szip.php trunk/linpha2/lib/classes/getid3/module.archive.tar.php trunk/linpha2/lib/classes/getid3/module.archive.zip.php trunk/linpha2/lib/classes/getid3/module.audio-video.asf.php trunk/linpha2/lib/classes/getid3/module.audio-video.bink.php trunk/linpha2/lib/classes/getid3/module.audio-video.flv.php trunk/linpha2/lib/classes/getid3/module.audio-video.matroska.php trunk/linpha2/lib/classes/getid3/module.audio-video.mpeg.php trunk/linpha2/lib/classes/getid3/module.audio-video.nsv.php trunk/linpha2/lib/classes/getid3/module.audio-video.quicktime.php trunk/linpha2/lib/classes/getid3/module.audio-video.real.php trunk/linpha2/lib/classes/getid3/module.audio-video.riff.php trunk/linpha2/lib/classes/getid3/module.audio-video.swf.php trunk/linpha2/lib/classes/getid3/module.audio.aac.php trunk/linpha2/lib/classes/getid3/module.audio.ac3.php trunk/linpha2/lib/classes/getid3/module.audio.au.php trunk/linpha2/lib/classes/getid3/module.audio.avr.php trunk/linpha2/lib/classes/getid3/module.audio.bonk.php trunk/linpha2/lib/classes/getid3/module.audio.flac.php trunk/linpha2/lib/classes/getid3/module.audio.la.php trunk/linpha2/lib/classes/getid3/module.audio.lpac.php trunk/linpha2/lib/classes/getid3/module.audio.midi.php trunk/linpha2/lib/classes/getid3/module.audio.mod.php trunk/linpha2/lib/classes/getid3/module.audio.monkey.php trunk/linpha2/lib/classes/getid3/module.audio.mp3.php trunk/linpha2/lib/classes/getid3/module.audio.mpc.php trunk/linpha2/lib/classes/getid3/module.audio.ogg.php trunk/linpha2/lib/classes/getid3/module.audio.optimfrog.php trunk/linpha2/lib/classes/getid3/module.audio.rkau.php trunk/linpha2/lib/classes/getid3/module.audio.shorten.php trunk/linpha2/lib/classes/getid3/module.audio.tta.php trunk/linpha2/lib/classes/getid3/module.audio.voc.php trunk/linpha2/lib/classes/getid3/module.audio.vqf.php trunk/linpha2/lib/classes/getid3/module.audio.wavpack.php trunk/linpha2/lib/classes/getid3/module.graphic.bmp.php trunk/linpha2/lib/classes/getid3/module.graphic.gif.php trunk/linpha2/lib/classes/getid3/module.graphic.jpg.php trunk/linpha2/lib/classes/getid3/module.graphic.pcd.php trunk/linpha2/lib/classes/getid3/module.graphic.png.php trunk/linpha2/lib/classes/getid3/module.graphic.svg.php trunk/linpha2/lib/classes/getid3/module.graphic.tiff.php trunk/linpha2/lib/classes/getid3/module.misc.exe.php trunk/linpha2/lib/classes/getid3/module.misc.iso.php trunk/linpha2/lib/classes/getid3/module.tag.apetag.php trunk/linpha2/lib/classes/getid3/module.tag.id3v1.php trunk/linpha2/lib/classes/getid3/module.tag.id3v2.php trunk/linpha2/lib/classes/getid3/module.tag.lyrics3.php trunk/linpha2/lib/classes/getid3/write.apetag.php trunk/linpha2/lib/classes/getid3/write.id3v1.php trunk/linpha2/lib/classes/getid3/write.id3v2.php trunk/linpha2/lib/classes/getid3/write.lyrics3.php trunk/linpha2/lib/classes/getid3/write.metaflac.php trunk/linpha2/lib/classes/getid3/write.php trunk/linpha2/lib/classes/getid3/write.real.php trunk/linpha2/lib/classes/getid3/write.vorbiscomment.php trunk/linpha2/lib/classes/image/gdlib/image_watermark.php trunk/linpha2/lib/classes/image/imagemagick/image_watermark.php trunk/linpha2/lib/classes/image/linpha.gdlib.class.php trunk/linpha2/lib/classes/image/linpha.imagemagick.class.php |
From: <fan...@us...> - 2006-12-22 15:38:51
|
Revision: 4666 http://svn.sourceforge.net/linpha/?rev=4666&view=rev Author: fangehrn Date: 2006-12-22 07:38:48 -0800 (Fri, 22 Dec 2006) Log Message: ----------- 2006-12-22 flo * added download feature (without watermark and statistics) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.download.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/ChangeLog 2006-12-22 15:38:48 UTC (rev 4666) @@ -1,4 +1,7 @@ +2006-12-22 flo + * added download feature (without watermark and statistics) + 2006-12-17 flo * added newest getid3 library * added watermark scripts from linpha1 (used for video thumbnails) Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/index.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -58,6 +58,9 @@ case 'exif': require_once(LINPHA_DIR.'/lib/include/File_Info_Show.php'); break; +case 'download': + require_once(LINPHA_DIR.'/lib/modules/module.download.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -529,6 +529,7 @@ * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm * thumbnail, image * meta_iptc + * download_noperm * * * @param string $type log types @@ -545,17 +546,19 @@ define('LOG_TYPE_META', 4); define('LOG_TYPE_FILEMANAGER', 5); define('LOG_TYPE_GUESTBOOK', 6); +define('LOG_TYPE_BASKET', 7); function linLog($type,$severity,$event,$text) { switch($type) { case LOG_TYPE_IMPORT: $type_msg = 'IMPORT '; break; case LOG_TYPE_UPDATE: $type_msg = 'UPDATE '; break; - case LOG_TYPE_USER: $type_msg = 'USER '; break; + case LOG_TYPE_USER: $type_msg = 'USER '; break; case LOG_TYPE_DB: $type_msg = 'DATABASE'; break; case LOG_TYPE_META: $type_msg = 'COMMENTS'; break; case LOG_TYPE_FILEMANAGER: $type_msg = 'FILEMANAGER'; break; case LOG_TYPE_GUESTBOOK: $type_msg = 'GUESTBOOK'; break; + case LOG_TYPE_BASKET: $type_msg = 'BASKET'; break; } /** Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -513,6 +513,6 @@ ); return $array; } // end function getImagetypeTranslationArray() - + } // end class linIdentify ?> Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -515,7 +515,7 @@ */ if( $GLOBALS['linpha']->sql->checkPermission('download')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_CLIENT.'/download_file.php?id='.$GLOBALS['linpha']->template->idCurrent.'">'. + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent.'">'. '<img src="'.$GLOBALS['linpha']->template->themeFile('images/download.png').'" border="0" title="'.i18n("Download Image").'" />' .'</a>'."\n"; } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -420,7 +420,7 @@ if(isset($_SESSION['user_id'])) { $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . - "FROM ".LIN_PREFIX."config WHERE user_id = '".$_SESSION['user_id']."'"); + "FROM ".LIN_PREFIX."config WHERE user_id = '".LinSql::linAddslashes($_SESSION['user_id'])."'"); while($data = $query->FetchRow(ADODB_FETCH_NUM)) { Added: trunk/linpha2/lib/modules/module.download.php =================================================================== --- trunk/linpha2/lib/modules/module.download.php (rev 0) +++ trunk/linpha2/lib/modules/module.download.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -0,0 +1,510 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Download + * @package Modules + * @todo use unified error messages + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +if( !isset($_GET['linId']) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +$fullfilename = LinSql::getFullImagePath($_GET['linId']); + +/** + * check for valid filename + */ +if( $fullfilename === FALSE OR !file_exists($fullfilename) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +/** + * get file informations + */ +$data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($_GET['linId'])."'"); + +$md5sum = $data['md5sum']; +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check download permissions and photos permissions + */ +if( !LinSql::photoIsAllowed( $_GET['linId'], 'read' ) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + exit(1); +} + +/** + * check permission + * allow video allways because we cannot watch a video without downloading it + */ +if( !LinSql::checkPermission('download') AND !LinIdentify::isVideo($img_type) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + exit(1); +} + +/** + * statistics + * do not count video views as downloads + */ +if( isset($_GET['isDownload']) OR !LinIdentify::isVideo($img_type) ) +{ + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); + + /** + * @todo + include_once(TOP_DIR.'/plugins/stats/stats.class.php'); + linStats('download',$md5sum); + */ +} + + +/** +* Watermark stuff +* +* if watermark is enabled (and it is a valid image), don't download the original image, +* but download a watermarked image +* +* @todo +*/ + //if(need_watermark($_GET['imgid']) && is_supported_image($org_type)) + +/** + * disable zlib compression to avoid broken archives + */ +@ini_set ('zlib.output_compression', 'Off'); + +header("Pragma: public"); +header("Expires: 0"); +header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); +header("Content-Type: ".get_mime_by_ext( LinFilesys::getFileExtFromPath($filename) )); + +/** + * removed this browser switch as it makes problem with ie6 and tiff files + * see http://sourceforge.net/tracker/index.php?func=detail&aid=999178&group_id=64772&atid=508614 + * +$user_agent = @strtolower($_SERVER["HTTP_USER_AGENT"]); +if ((is_integer (strpos($user_agent, "msie"))) && (is_integer (strpos($user_agent, "win")))) { + header( "Content-Disposition: filename=".$filename.";" ); +} else { + header( "Content-Disposition: attachment; filename=".$filename.";" ); +}*/ + +header( "Content-Disposition: attachment; filename=".$filename.";" ); + +header("Content-Transfer-Encoding: binary"); +header("Content-Length: ".filesize($fullfilename)); +readfile($fullfilename); + + +/** + * get the mime-type by file extension + * @uses module download + */ +function get_mime_by_ext($ext) +{ + $ext = strtolower($ext); + + /*switch($ext) { + case "avi": return "video/avi"; + case "mpg": return "video/mpeg"; + case "mpeg": return "video/mpeg"; + case "mp4": return "video/quicktime"; + case "mov": return "video/quicktime"; + + case "bmp": return "image/bmp"; + case "gif": return "image/gif"; + case "png": return "image/png"; + case "jpg": return "image/jpg"; + case "jpeg": return "image/jpg"; + case "psd": return "image/psd"; + case "tif": return "image/tiff"; + case "tiff": return "image/tiff"; + + case "tar": return "application/x-tar"; + case "gz": return "application/x-gzip"; + case "bz2": return "application/zip"; + case "zip": return "application/zip"; + case "rar": return "application/rar"; + + default: return "application/force-download"; + }*/ + + $arrayMimeTypes = array( + '323' => 'text/h323', + '3gp' => 'audio/3gpp', + '3gp' => 'video/3gpp', + 'IVF' => 'video/x-ivf', + 'Mtx' => 'Application/metastream', + 'aaf' => 'application/octet-stream', + 'aca' => 'application/octet-stream', + 'ace' => 'application/x-compressed', + 'acx' => 'application/internet-property-stream', + 'aer' => 'Application/atmosphere', + 'afm' => 'application/octet-stream', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/aiff', + 'aiff' => 'audio/aiff', + 'application' => 'application/x-ms-application', + 'art' => 'image/x-jg', + 'as' => 'text/plain', + 'asd' => 'application/octet-stream', + 'asf' => 'video/x-ms-asf', + 'asi' => 'application/octet-stream', + 'asm' => 'text/plain', + 'asr' => 'video/x-ms-asf', + 'asx' => 'video/x-ms-asf', + 'au' => 'audio/basic', + 'avi' => 'video/x-msvideo', + 'axs' => 'application/olescript', + 'bas' => 'text/plain', + 'bcpio' => 'application/x-bcpio', + 'bin' => 'application/octet-stream', + 'bmp' => 'image/bmp', + 'c' => 'text/plain', + 'cab' => 'application/octet-stream', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cdf' => 'application/x-cdf', + //'cfg' => '3DVista CFG', + 'chm' => 'application/octet-stream', + 'class' => 'application/x-java-applet', + 'clp' => 'application/x-msclip', + 'cmx' => 'image/x-cmx', + 'cnf' => 'text/plain', + 'co' => 'application/x-cult3d-object', + 'cod' => 'image/cis-cod', + 'cpio' => 'application/x-cpio', + 'cpp' => 'text/plain', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'csh' => 'application/x-csh', + 'css' => 'text/css', + 'csv' => 'application/octet-stream', + 'cur' => 'application/octet-stream', + 'dcr' => 'application/x-director', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dib' => 'image/bmp', + 'dir' => 'application/x-director', + 'disco' => 'text/xml', + 'djv' => 'Image/x.djvu', + 'djvu' => 'Image/x.djvu', + 'dll' => 'application/x-msdownload', + 'dlm' => 'text/dlm', + 'dnl' => 'application/x-msdownload', + 'doc' => 'application/msword', + 'dot' => 'application/msword', + 'dsp' => 'application/octet-stream', + 'dtd' => 'text/xml', + 'dvi' => 'application/x-dvi', + 'dwf' => 'drawing/x-dwf', + 'dwg' => 'image/x-dwg', + 'dwp' => 'application/octet-stream', + 'dxr' => 'application/x-director', + 'eml' => 'message/rfc822', + 'emz' => 'application/octet-stream', + 'eot' => 'application/octet-stream', + 'eps' => 'application/postscript', + 'etx' => 'text/x-setext', + 'evy' => 'application/envoy', + 'exe' => 'application/octet-stream', + 'fdf' => 'application/vnd.fdf', + 'fif' => 'application/fractals', + 'fla' => 'application/octet-stream', + 'flr' => 'x-world/x-vrml', + 'flv' => 'application/x-shockwave-flash', + 'gif' => 'image/gif', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'h' => 'text/plain', + 'hdf' => 'application/x-hdf', + 'hdml' => 'text/x-hdml', + 'hhc' => 'application/x-oleobject', + 'hhk' => 'application/octet-stream', + 'hhp' => 'application/octet-stream', + 'hlp' => 'application/winhlp', + 'hqx' => 'application/mac-binhex40', + 'hta' => 'application/hta', + 'htc' => 'text/x-component', + 'htm' => 'text/html', + 'html' => 'text/html', + 'htt' => 'text/webviewhtml', + 'hxt' => 'text/html', + 'ico' => 'image/x-icon', + 'ics' => 'application/octet-stream', + 'ief' => 'image/ief', + 'iii' => 'application/x-iphone', + 'inf' => 'application/octet-stream', + 'ins' => 'application/x-internet-signup', + 'ips' => 'application/x-ipscript', + 'ipx' => 'application/x-ipix', + 'isp' => 'application/x-internet-signup', + 'ivr' => 'i-world/i-vrml', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jar' => 'application/java-archive', + 'java' => 'application/octet-stream', + 'jck' => 'application/liquidmotion', + 'jcz' => 'application/liquidmotion', + 'jfif' => 'image/pjpeg', + 'jpb' => 'application/octet-stream', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'application/x-javascript', + 'kml' => 'Application/vnd.google-earth.kml+xml', + 'kmz' => 'Application/vnd.google-earth.kmz', + 'latex' => 'application/x-latex', + 'lit' => 'application/x-ms-reader', + 'lpk' => 'application/octet-stream', + 'lsf' => 'video/x-la-asf', + 'lsx' => 'video/x-la-asf', + 'lzh' => 'application/octet-stream', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm1v' => 'video/mpeg', + 'm3u' => 'audio/x-mpegurl', + 'man' => 'application/x-troff-man', + 'manifest' => 'application/x-ms-manifest', + 'map' => 'text/plain', + 'mdb' => 'application/x-msaccess', + 'mdp' => 'application/octet-stream', + 'me' => 'application/x-troff-me', + 'mht' => 'message/rfc822', + 'mhtml' => 'message/rfc822', + 'mid' => 'audio/mid', + 'midi' => 'audio/mid', + 'mix' => 'application/octet-stream', + 'mmf' => 'application/x-smaf', + 'mno' => 'text/xml', + 'mny' => 'application/x-msmoney', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'video/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mpa' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpp' => 'application/vnd.ms-project', + 'mpv2' => 'video/mpeg', + 'ms' => 'application/x-troff-ms', + 'msi' => 'application/octet-stream', + 'mts' => 'Application/metastream', + 'mvb' => 'application/x-msmediaview', + 'mw2' => 'Image/x.mw2', + 'mwx' => 'Image/x.mwx', + 'nc' => 'application/x-netcdf', + 'nsc' => 'video/x-ms-asf', + 'nws' => 'message/rfc822', + 'ocx' => 'application/octet-stream', + 'oda' => 'application/oda', + 'ods' => 'application/oleobject', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'p10' => 'application/pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'pbm' => 'image/x-portable-bitmap', + 'pcx' => 'application/octet-stream', + 'pcz' => 'application/octet-stream', + 'pdf' => 'application/pdf', + 'pfb' => 'application/octet-stream', + 'pfm' => 'application/octet-stream', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pko' => 'application/vnd.ms-pki.pko', + 'pma' => 'application/x-perfmon', + 'pmc' => 'application/x-perfmon', + 'pml' => 'application/x-perfmon', + 'pmr' => 'application/x-perfmon', + 'pmw' => 'application/x-perfmon', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'pnz' => 'image/png', + 'pot' => 'application/vnd.ms-powerpoint', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppt' => 'application/vnd.ms-powerpoint', + 'prf' => 'application/pics-rules', + 'prm' => 'application/octet-stream', + 'prx' => 'application/octet-stream', + 'ps' => 'application/postscript', + 'psd' => 'application/octet-stream', + 'psm' => 'application/octet-stream', + 'psp' => 'application/octet-stream', + 'pub' => 'application/x-mspublisher', + 'qt' => 'video/quicktime', + 'qtl' => 'application/x-quicktimeplayer', + 'qxd' => 'application/octet-stream', + 'ra' => 'audio/x-pn-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'rar' => 'application/octet-stream', + 'ras' => 'image/x-cmu-raster', + //'rba' => '3DVista Audio', + 'rdf' => 'application/xml', + 'rf' => 'image/vnd.rn-realflash', + 'rgb' => 'image/x-rgb', + 'rm' => 'application/vnd.rn-realmedia', + 'rmi' => 'audio/mid', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'roff' => 'application/x-troff', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rtf' => 'application/rtf', + 'rtx' => 'text/richtext', + 'scd' => 'application/x-msschedule', + 'sct' => 'text/scriptlet', + 'sea' => 'application/octet-stream', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'sit' => 'application/x-stuffit', + //'ski' => '3DVista SKI', + //'skz' => '3DVista SKZ', + 'smd' => 'audio/x-smd', + 'smi' => 'application/octet-stream', + 'smx' => 'audio/x-smd', + 'smz' => 'audio/x-smd', + 'snd' => 'audio/basic', + 'snp' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spl' => 'application/futuresplash', + 'src' => 'application/x-wais-source', + 'ssm' => 'application/streamingmedia', + 'sst' => 'application/vnd.ms-pki.certstore', + 'stl' => 'application/vnd.ms-pki.stl', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svg' => 'image/svg+xml', + 'svg2' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 't' => 'application/x-troff', + 'tar' => 'application/x-tar', + 'tcl' => 'application/x-tcl', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'tgz' => 'application/x-compressed', + 'thn' => 'application/octet-stream', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'toc' => 'application/octet-stream', + 'tr' => 'application/x-troff', + 'trm' => 'application/x-msterminal', + 'tsv' => 'text/tab-separated-values', + 'ttf' => 'application/octet-stream', + 'txt' => 'text/plain', + 'u32' => 'application/octet-stream', + 'uls' => 'text/iuls', + 'ustar' => 'application/x-ustar', + 'utx' => 'Text/xml', + 'vbs' => 'text/vbscript', + 'vcf' => 'text/x-vcard', + 'vcs' => 'text/plain', + 'vdx' => 'application/vnd.visio', + 'vml' => 'text/xml', + 'vsd' => 'application/vnd.visio', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vsx' => 'application/vnd.visio', + 'vtx' => 'application/vnd.visio', + 'wav' => 'audio/wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'application/x-msmetafile', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmp' => 'video/x-ms-wmp', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-ms-wmz', + 'wps' => 'application/vnd.ms-works', + 'wri' => 'application/x-mswrite', + 'wrl' => 'x-world/x-vrml', + 'wrz' => 'x-world/x-vrml', + 'wsdl' => 'text/xml', + 'wvx' => 'video/x-ms-wvx', + 'x' => 'application/directx', + 'xaf' => 'x-world/x-vrml', + 'xbm' => 'image/x-xbitmap', + 'xdr' => 'text/plain', + 'xla' => 'application/vnd.ms-excel', + 'xlc' => 'application/vnd.ms-excel', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlt' => 'application/vnd.ms-excel', + 'xlw' => 'application/vnd.ms-excel', + 'xml' => 'text/xml', + 'xof' => 'x-world/x-vrml', + 'xpm' => 'image/x-xpixmap', + 'xsd' => 'text/xml', + 'xsf' => 'text/xml', + 'xsl' => 'text/xml', + 'xslt' => 'text/xml', + 'xsn' => 'application/octet-stream', + 'xwd' => 'image/x-xwindowdump', + 'z' => 'application/x-compress', + 'zip' => 'application/x-zip-compressed' + ); + + if( isset($arrayMimeTypes[$ext])) + { + return $arrayMimeTypes[$ext]; + } + else + { + return "application/force-download"; + } + +} + +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-12-17 21:49:03 UTC (rev 4665) +++ trunk/linpha2/templates/default/view_img.html.php 2006-12-22 15:38:48 UTC (rev 4666) @@ -46,7 +46,7 @@ <div id="linDivVideoLink" class="linDivMetaLinks"> <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> <br /><br /> - <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> + <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2006-12-28 16:26:17
|
Revision: 4667 http://svn.sourceforge.net/linpha/?rev=4667&view=rev Author: fangehrn Date: 2006-12-28 08:26:12 -0800 (Thu, 28 Dec 2006) Log Message: ----------- 2006-12-28 flo * added video support * added panorama detection (view does not yet work) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/modules/module.download.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.panorama.php trunk/linpha2/lib/modules/module.video.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/ChangeLog 2006-12-28 16:26:12 UTC (rev 4667) @@ -1,4 +1,8 @@ +2006-12-28 flo + * added video support + * added panorama detection (view does not yet work) + 2006-12-22 flo * added download feature (without watermark and statistics) Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/index.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -58,6 +58,12 @@ case 'exif': require_once(LINPHA_DIR.'/lib/include/File_Info_Show.php'); break; +case 'video': + require_once(LINPHA_DIR.'/lib/modules/module.video.php'); + break; +case 'panorama': + require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); + break; case 'download': require_once(LINPHA_DIR.'/lib/modules/module.download.php'); break; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -529,7 +529,7 @@ * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm * thumbnail, image * meta_iptc - * download_noperm + * accessdenied * * * @param string $type log types Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -28,6 +28,7 @@ public $layoutimagespath; public $output; public $URL_base, $URL_full, $idCurrent; + public $hideMenu = false, $hideTitle = false; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; @@ -112,10 +113,10 @@ #menu ul { width: 1em; } /* this will be a *min* width */ #menu ul ul { width: 12em; } #menu ul li { float: left; width: 100%; } - </style> +<?php /* </style> <![endif]--> <!--[if lt IE 7]> - <style type="text/css" media="screen"> + <style type="text/css" media="screen">*/ ?> body { behavior: url(<?php echo LINPHA_CLIENT; ?>/templates/misc/csshover.htc); font-size: 100%; } #menu ul li a { height: 1%; } #menu a, #menu span { font: bold 0.7em/1.4em arial, helvetica, sans-serif; } Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/js/LinImage.js 2006-12-28 16:26:12 UTC (rev 4667) @@ -315,6 +315,16 @@ /*Element.setHeight('prevLink', imgHeight); Element.setHeight('nextLink', imgHeight); Element.setWidth( 'imageDataContainer', imgWidth + (borderSize * 2));*/ + + /** + * show panorama link + * the only reason why do this at this point is, because this is only done on images + * and we just know the width and height + */ + if( imgWidth/imgHeight >= 2 || imgHeight/imgWidth >= 2 ) + { + Element.show('linHrefPanoLink'); + } this.showImage(); }, @@ -440,9 +450,12 @@ { var meta = this.xmlDoc[IdCurrent].getElementsByTagName('meta').item(i); var metaname = meta.getElementsByTagName('name').item(0).firstChild.data; - var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; + if(meta.getElementsByTagName('value').item(0).hasChildNodes()) { // prevent error in IE + var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; + } else { + var metavalue = ''; + } - var tr = Builder.node('tr'); var tdleft = Builder.node('td', {className: 'linTdMetaLeftColumn'}, metaname ); var tdright = Builder.node('td', metavalue ); @@ -463,14 +476,14 @@ */ switch( this.currentFileType ) { - case '1': + case '1': // image this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') Element.hide('linDivVideoLink'); Element.show('linDivExifLink'); break; - case '2': + case '2': // video Element.show('linDivVideoLink'); Element.hide('linDivExifLink'); @@ -883,7 +896,7 @@ setImageInfoLink: function() { $('linDivInfoLink').style.top = $('linImgMainimage').offsetTop + $('linImgMainimage').offsetHeight + 3; - $('linDivInfoLink').style.left = $('linImgMainimage').offsetLeft + $('linImgMainimage').offsetWidth - 50; // 50: value of view_img.css width = 50px; can't get width with javascript because element is hidden + $('linDivInfoLink').style.left = $('linImgMainimage').offsetLeft + $('linImgMainimage').offsetWidth - 200; // 200: width of linDivInfoLink, value set view_img.css width = 200px; can't get width with javascript because element is hidden Element.show('linDivInfoLink'); }, @@ -928,7 +941,8 @@ }, hideImgInfoNow: function() { - $('linDivMetaOuter').style.display = 'none'; + Element.hide('linDivMetaOuter'); + Element.hide('linHrefPanoLink'); Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; Modified: trunk/linpha2/lib/modules/module.download.php =================================================================== --- trunk/linpha2/lib/modules/module.download.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/lib/modules/module.download.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -25,13 +25,13 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -if( !isset($_GET['linId']) ) +if( $linpha->template->idCurrent == 0 ) { echo i18n("No valid id supplied!"); exit(1); } -$fullfilename = LinSql::getFullImagePath($_GET['linId']); +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); /** * check for valid filename @@ -46,7 +46,7 @@ * get file informations */ $data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($_GET['linId'])."'"); + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); $md5sum = $data['md5sum']; $img_type = $data['img_type']; @@ -54,12 +54,12 @@ /** - * check download permissions and photos permissions + * check photo permissions */ -if( !LinSql::photoIsAllowed( $_GET['linId'], 'read' ) ) +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) { echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); exit(1); } @@ -70,7 +70,7 @@ if( !LinSql::checkPermission('download') AND !LinIdentify::isVideo($img_type) ) { echo i18n("No permission!"); - linLog(LOG_TYPE_BASKET, LOG_ERR, 'download_noperm', 'No permission to access the file '.$_GET['linId']); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); exit(1); } Added: trunk/linpha2/lib/modules/module.panorama.php =================================================================== --- trunk/linpha2/lib/modules/module.panorama.php (rev 0) +++ trunk/linpha2/lib/modules/module.panorama.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -0,0 +1,68 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Video + * @package Modules + * @todo use unified error messages + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +if( $linpha->template->idCurrent == 0 ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); + +/** + * check for valid filename + */ +if( $fullfilename === FALSE OR !file_exists($fullfilename) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +/** + * get file informations + */ +$data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + +$md5sum = $data['md5sum']; +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check photos permissions + */ +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); + exit(1); +} + + + +?> \ No newline at end of file Added: trunk/linpha2/lib/modules/module.video.php =================================================================== --- trunk/linpha2/lib/modules/module.video.php (rev 0) +++ trunk/linpha2/lib/modules/module.video.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -0,0 +1,227 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Video + * @package Modules + * @todo use unified error messages + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +if( $linpha->template->idCurrent == 0 ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +$fullfilename = LinSql::getFullImagePath($linpha->template->idCurrent); + +/** + * check for valid filename + */ +if( $fullfilename === FALSE OR !file_exists($fullfilename) ) +{ + echo i18n("No valid id supplied!"); + exit(1); +} + +/** + * get file informations + */ +$data = $GLOBALS['linpha']->db->GetRow("SELECT img_type FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); + +$img_type = $data['img_type']; +$filename = basename($fullfilename); + + +/** + * check file permissions + */ +if( !LinSql::photoIsAllowed( $linpha->template->idCurrent, 'read' ) ) +{ + echo i18n("No permission!"); + linLog(LOG_TYPE_BASKET, LOG_ERR, 'accessdenied', 'No permission to access the file '.$linpha->template->idCurrent); + exit(1); +} + +if( !LinIdentify::isVideo($img_type) ) +{ + echo i18n("This is not a video!"); + exit(1); +} + +/** + * statistics + * count video views + */ + /** + * @todo + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET stats_downloads = stats_downloads + 1 WHERE md5sum='".$md5sum."'"); + + include_once(TOP_DIR.'/plugins/stats/stats.class.php'); + linStats('download',$md5sum); + */ + +/** + * get width and height of video + */ + include_once(LINPHA_DIR.'/lib/classes/getid3/getid3.php'); + define('GETID3_HELPERAPPSDIR', LINPHA_DIR); // needs to be set to a valid dir, otherwise it doesn't work under windows + $getID3 = new getID3; + $file_info = $getID3->analyze($fullfilename); + + if( isset($file_info['video']['resolution_x']) AND $file_info['video']['resolution_x'] != 0) + { + $file_width = $file_info['video']['resolution_x']; + } + + if( isset($file_info['video']['resolution_y']) AND $file_info['video']['resolution_y'] != 0) + { + $file_height = $file_info['video']['resolution_y']; + } + + + + + +ob_start(); + + /* + http://www.public.iastate.edu/~rdalhoff/embedvideo.html + + Real Video + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="160" WIDTH="220"> + <PARAM NAME="SRC" + VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="ImageWindow"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="160" controls="ImageWindow" + nojava="true" center="true" console="Carol1"> + </embed> + </OBJECT> + <br> + <OBJECT CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" + HEIGHT="100" WIDTH="220"> + <PARAM NAME="SRC" VALUE="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm"> + <PARAM NAME="CONTROLS" VALUE="all"> + <PARAM NAME="CONSOLE" VALUE="video1"> + <embed src="http://realserver.ait.iastate.edu:8080/ramgen/rdalhoff/Carol6.rm?embed" + width="220" height="100" nojava="true" controls="All" console="Carol1"> + + </embed> + </OBJECT> + + Quicktime + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" + codebase="http://www.apple.com/qtactivex/qtplugin.cab" + width="240" height="180"> + <param name="src" value="carol6-ref.mov"> + <param name="loop" value="false"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="180" + width="240" + src="carol6-ref.mov" + name="Get QuickTime" + loop="false" + cache="true" + controller="true" autoplay="false" + pluginspage="http://www.apple.com/quicktime/download/"> + </embed> + </object> + + + Old Linpha1 (quicktime) + <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="<?php echo $this->stage_height; ?>" width="<?php echo $this->stage_width; ?>"> + <param name="bgcolor" value="#a3a3a3"> + <param name="src" value="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>"> + <param name="autoplay" value="false"> + <param name="controller" value="true"> + <embed + height="<?php echo $this->stage_height; ?>" + width="<?php echo $this->stage_width; ?>" + pluginspage="http://www.apple.com/quicktime/download/" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']; ?>" + type="video/quicktime" + controller="true" + autoplay="false"> + </object> + + New Linpha1 (mediaplayer, new version can also play quicktime files) + <embed type="application/x-mplayer2" + src="<?php echo TOP_DIR."/actions/file_download.php?imgid=".$_GET['imgid']."&ignore=true"; ?>" + width="<?php echo $this->stage_width; ?>" + height="<?php echo ($this->stage_height + 45); ?>" + transparentatstart="true" + autostart="true" + animationatstart="true" + showcontrols="true" + showaudiocontrols="true" + showpositioncontrols="true" + autosize="false" + showstatusbar="true" + displaysize="true" + hspace="4"> + </embed> + + Somewhere found (does not work in firefox unless we add type="application/x-mplayer2") + <embed + src="7.wmv" + width=400 + height=369 + autoplay=true + controller=true + loop=false + showstatusbar=true> + </embed> + */ +?> +<div style="text-align: center;"> + <h2 class="linStyle"><?php + $array_path = LinSql::getFullFilenameFromId( $linpha->template->idCurrent ); + echo implode(' / ',$array_path); + ?></h3> + <embed type="application/x-mplayer2" src="<?php echo LINPHA_LINK.'linCat=download&linId='.$linpha->template->idCurrent; ?>" + width="<?php echo $file_width; ?>" height="<?php echo ($file_height+45); ?>" + autoplay="true" controller="true" loop="false" showstatusbar="false"> + </embed> + <br /> + <a href="javascript:window.close()"><?php echo i18n("Close"); ?></a> + <?php + echo '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$linpha->template->idCurrent.'&isDownload=true">'.i18n("Download").'</a>'; + ?> +</div> + +<?php +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +//$linpha->template->overrideModule('css','filemanager'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=video&linId='.$linpha->template->idCurrent; +$linpha->template->hideMenu = true; +$linpha->template->hideTitle = true; +$linpha->template->output['title'] = i18n("Video"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/global.html.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -26,21 +26,26 @@ <div id="linDivSyslogText"><?php echo (isset($linTpl->output['sys_log']) ? $linTpl->output['sys_log'] : ''); ?></div> </div> + <!-- title/navigation --> +<?php if(! $linTpl->hideTitle) { ?> <div id="linDivTitle"> <?php echo $linTpl->linpha_title." :: ".$linTpl->output['title']; ?> </div> +<?php } ?> + <!-- menu --> +<?php if(! $linTpl->hideMenu) { ?> <div id="linDivMenu"> <?php $linTpl->printMenus('home,search,login,more,icons,settings,admin,guestbook'); ?> </div> <div style="clear: both;"></div> <!-- end menu --> +<?php } ?> - <?php $linTpl->includeFile('body'); ?> </body> Modified: trunk/linpha2/templates/default/themes/default/css/view_img.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/view_img.css 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/themes/default/css/view_img.css 2006-12-28 16:26:12 UTC (rev 4667) @@ -39,7 +39,7 @@ text-align: right; font-size: 0.7em; - width: 50px; /* hardcoded in LinImage.js setImageInfoLink() better to not change!*/ + width: 200px; /* hardcoded in LinImage.js setImageInfoLink() better to not change!*/ } #linTableMeta { Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2006-12-22 15:38:48 UTC (rev 4666) +++ trunk/linpha2/templates/default/view_img.html.php 2006-12-28 16:26:12 UTC (rev 4667) @@ -51,6 +51,7 @@ </div> <div id="linDivInfoLink" style="display: none; color: grey;"> + <a id="linHrefPanoLink" href="<?php echo LINPHA_LINK.'linCat=panorama&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank" style="color: black;">Panorama</a> <a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2007-01-19 15:01:05
|
Revision: 4668 http://svn.sourceforge.net/linpha/?rev=4668&view=rev Author: fangehrn Date: 2007-01-19 07:00:57 -0800 (Fri, 19 Jan 2007) Log Message: ----------- 2007-01-19 flo * added new ptviewer.jar * added panorama support (copy from linpha1) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/modules/module.panorama.php Added Paths: ----------- trunk/linpha2/lib/js/ptviewer.jar Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-12-28 16:26:12 UTC (rev 4667) +++ trunk/linpha2/ChangeLog 2007-01-19 15:00:57 UTC (rev 4668) @@ -1,3 +1,6 @@ +2007-01-19 flo + * added new ptviewer.jar + * added panorama support (copy from linpha1) 2006-12-28 flo * added video support Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2006-12-28 16:26:12 UTC (rev 4667) +++ trunk/linpha2/docs/dev/external_libraries.txt 2007-01-19 15:00:57 UTC (rev 4668) @@ -16,8 +16,9 @@ include_once($this->PluginDir . "class.smtp.php"); to include_once(LINPHA_DIR . "/lib/classes/smtp.class.php"); - +- ptviewer 3.1.2 (http://webuser.hs-furtwangen.de/~dersch/) + - PHP_JPEG_Metadata_Toolkit_1.11 CHANGES Added: trunk/linpha2/lib/js/ptviewer.jar =================================================================== (Binary files differ) Property changes on: trunk/linpha2/lib/js/ptviewer.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/linpha2/lib/modules/module.panorama.php =================================================================== --- trunk/linpha2/lib/modules/module.panorama.php 2006-12-28 16:26:12 UTC (rev 4667) +++ trunk/linpha2/lib/modules/module.panorama.php 2007-01-19 15:00:57 UTC (rev 4668) @@ -45,14 +45,13 @@ /** * get file informations */ -$data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type FROM ".LIN_PREFIX."photos " . +$data = $GLOBALS['linpha']->db->GetRow("SELECT md5sum, img_type, width, height FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); $md5sum = $data['md5sum']; $img_type = $data['img_type']; $filename = basename($fullfilename); - /** * check photos permissions */ @@ -63,6 +62,73 @@ exit(1); } +if(isset($_GET['lower'])) { + $width = $_GET['width']; + $height = $_GET['height']; + + $param = ''; +} else { + $width = $data['width']; + $height = $data['height']; + $param = '&fullsize=1'; +} +$param .= '&width='.$width.'&height='.$height; + +$lower_width = round($width/2); +$lower_height = round($height/2); + + +ob_start(); +?> + +<div align='center'> +<h2><?php echo i18n("Panorama view of").' '.$filename; ?></h2> +<font color='FF0000'><?php echo i18n("Please use mouse or arrow keys to navigate!"); ?></font><br /> +<applet name='ptviewer' archive='<?php echo LINPHA_CLIENT; ?>/lib/js/ptviewer.jar' code='ptviewer.class' width='100%' height='50%' mayscript='true'> +<script language='JavaScript' type='text/javascript'> +<?php /* hint from the author of ptviewer */ ?> +if (navigator.appName != 'Netscape') document.writeln("<PARAM name=maxarray value='40000000'>"); +</script> + +<param name='file' value='<?php + /** + * use file_download.php because we don't have direct access to the albums dir anymore (.htaccess) + */ + echo LINPHA_CLIENT.'/get_image.php?linId='.$linpha->template->idCurrent.$param; +?>'> +<param name='bgcolor' value='000080'> +<param name='pan' value='0'> +<param name='tilt' value='0'> +<param name='fov' value='90'> +<param name='fovmax' value='120'> +<param name='fovmin' value='20'> +<param name='auto' value='0.5'> +</applet> +<br /> +<a href='http://www.fh-furtwangen.de/~dersch/' target='_blank'>Powered by PTViewer</a> +<br /><br /> +<?php +echo i18n("If it takes too long to load, try a lower resolution:").' '; +echo '<a href="'.LINPHA_LINK.'linCat=panorama&linId='.$linpha->template->idCurrent.'&lower=1&width='.$lower_width.'&height='.$lower_height.'">'; +echo '['.$lower_width.'x'.$lower_height.']'; +echo '</a><br />'; +echo '('.i18n("Current resolution:").' ['.$width.'x'.$height.'])'; +?> +<br /><br /> +<a href='javascript:window.close()'><?php echo i18n("Close window"); ?></a> +</div> + +<?php +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +//$linpha->template->overrideModule('css','filemanager'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=panorama&linId='.$linpha->template->idCurrent; +$linpha->template->hideMenu = true; +$linpha->template->hideTitle = true; +$linpha->template->output['title'] = i18n("Panorama"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |