Thread: [Linpha-cvs] SF.net SVN: linpha: [4849] trunk/linpha2 (Page 10)
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2008-02-02 15:05:31
|
Revision: 4849 http://linpha.svn.sourceforge.net/linpha/?rev=4849&view=rev Author: bzrudi Date: 2008-02-02 07:05:22 -0800 (Sat, 02 Feb 2008) Log Message: ----------- minor improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-02 13:11:40 UTC (rev 4848) +++ trunk/linpha2/ChangeLog 2008-02-02 15:05:22 UTC (rev 4849) @@ -3,6 +3,7 @@ assign images to closest/nearest trackpoint in GPX file using some offset logic. - add some new methods for this + * Add support for images starting earlier as track 2008-02-01 bzrudi * More improvements to XML parser class. XML/GPX parsing works now, same @@ -10,7 +11,7 @@ well as the image EXIF datetimeoriginal tag from all images in folder. * Add some required new methods to LinMetaData() class * Add new file modules.geodata.php for testing all geodata stuff - * some basic tests work alright now + * Some basic tests work alright now 2008-01-31 bzrudi * Maps plugin Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 13:11:40 UTC (rev 4848) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-02 15:05:22 UTC (rev 4849) @@ -294,7 +294,58 @@ if($images['starttime'] < $track['starttime']) { echo "Offset detected, images start earlier...<br>"; - print_r($images['geodata']); + + $number = count($images['geodata']); + + while(list($image_time, $filename) = each($images['geodata'])) + { + if($image_time < $track['starttime']) + { + $no_offsync++; + $files_offsync[] = $filename; + } + } + echo "$no_offsync "."out of ".$number ." images are out of sync...<br>"; + echo "We have an offset of ".($track['starttime']-$images['starttime'])." " . + "seconds, which is about ".(($track['starttime']-$images['starttime'])/3600)." hours"; + echo "<br>Calibrating...<br>"; + + if($no_offsync > '0') + { + $full_hour = round(($track['starttime']-$images['starttime'])/3600, '0'); + + if($full_hour != '0') + { + echo "Usually offset is because of wrong UTC/GMT settings, so " . + "trying full hours first<br>"; + echo "Setting full hour offset to ".$full_hour." h<br>"; + echo "Faking image times... new setting +$full_hour h<br>"; + + $offset = ($full_hour*3600); + + } + else + { + echo "Danm, looks like we have an time skew < 1h - not so good<br>"; + echo "Setting offset to 5 min...<br>"; + echo "Faking image times... new setting -5 min<br>"; + + $offset = '300'; + } + + foreach($images['geodata'] AS $image_time => $filename) + { + $geo_tmp[($image_time + $offset)] = $filename; + } + + $image_tmp = array("starttime" => ($images['starttime'] + $offset), + "endtime" => ($images['endtime'] + $offset), + "geodata" => $geo_tmp ); + + echo "Rerunning offset test...<br>"; + $this->fixImagesOffset($track, $image_tmp); + } + } elseif($images['endtime'] > $track['endtime']) { @@ -398,7 +449,7 @@ while($loop === true) { - $loop = $this->trkptRadar($trkdata, $image_time, $offset); + $loop = $this->trkptRadar($trkdata, $image_time, $offset, $image_filename); $offset++; } } @@ -415,7 +466,7 @@ * @author bzrudi * @return bool */ - private function trkptRadar($trkdata, $image_time, $offset) + private function trkptRadar($trkdata, $image_time, $offset, $image_filename) { if(array_key_exists($image_time, $trkdata)) { @@ -423,6 +474,11 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time]['lat']."<br>and LON: " . "".$trkdata[$image_time]['lon']."<br><br>"; + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time]['lat'], + $trkdata[$image_time]['lon']); + return false; } elseif(array_key_exists(($image_time + $offset), $trkdata)) @@ -431,6 +487,11 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time + $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time + $offset]['lon']."<br><br>"; + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time + $offset]['lat'], + $trkdata[$image_time + $offset]['lon']); + return false; } elseif(array_key_exists(($image_time - $offset), $trkdata)) @@ -439,6 +500,10 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time - $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time - $offset]['lon']."<br><br>"; + $this->writeGpsData2File($image_filename, + $trkdata[$image_time - $offset]['lat'], + $trkdata[$image_time - $offset]['lon']); + return false; } else @@ -448,6 +513,32 @@ } } + + /** + * Write GPS data to file + */ + private function writeGpsData2File($filename, $lat, $lon) + { + echo "Trying to write GPS data to files - ***SIMULATION***<br>"; + echo "Trying file: ".$filename."<br>"; + + ($lon > 0) ? $lonref = "E" : $latref = "W"; + ($lat > 0) ? $latref = "N" : $latref = "S"; + + echo "Latref ".$latref." Longref ".$lonref."<br><br>"; + + + $filename = substr($filename, 2); + $filename = LINPHA_DIR."/$filename"; + $return = ""; + $meta = ""; + $parameters = "-GPSLongitudeRef = ".$lonref." " . + "-GPSLongitude = ".$lon." " . + "-GPSLatitudeRef = ".$latref." " . + "-GPSLatitude = ".$lat." "; + + //LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + } }// end class /* vi: set ts=4 sw=4 sts=4 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-04 22:12:53
|
Revision: 4852 http://linpha.svn.sourceforge.net/linpha/?rev=4852&view=rev Author: fangehrn Date: 2008-02-04 14:12:44 -0800 (Mon, 04 Feb 2008) Log Message: ----------- 2008-02-04 flo * Some more work on the installer - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) - don't like the gray background - added hash_secret variable in config.sql.php will be used by iha.class Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/security.txt trunk/linpha2/install/header.php trunk/linpha2/install/header_html.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/look.css trunk/linpha2/install/manual_install.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.exiftool.class.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.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/sql/config.dir.php trunk/linpha2/lib/include/sql/config.sql.php trunk/linpha2/lib/plugins/log/sql/sql.data.php Added Paths: ----------- trunk/linpha2/lib/iha/ trunk/linpha2/lib/iha/License-LGPL.txt trunk/linpha2/lib/iha/iha.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/ChangeLog 2008-02-04 22:12:44 UTC (rev 4852) @@ -1,3 +1,11 @@ + +2008-02-04 flo + * Some more work on the installer + - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) + - don't like the gray background + - added hash_secret variable in config.sql.php + will be used by iha.class + 2008-02-02 bzrudi * It should now be possible to auto adjust images to fit tracks AND to auto assign images to closest/nearest trackpoint in GPX file using some offset Modified: trunk/linpha2/docs/dev/security.txt =================================================================== --- trunk/linpha2/docs/dev/security.txt 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/docs/dev/security.txt 2008-02-04 22:12:44 UTC (rev 4852) @@ -11,4 +11,13 @@ - check every data coming by the user (GET/POST/COOKIE) -- every switch statement should have a default: case to prevent manipulation \ No newline at end of file +- every switch statement should have a default: case to prevent manipulation + + + + + + + +http://www.php-einfach.de/improved_hash_algorithm.php +http://cookies.lcs.mit.edu/pubs/webauth:tr.pdf \ No newline at end of file Modified: trunk/linpha2/install/header.php =================================================================== --- trunk/linpha2/install/header.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/header.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -86,19 +86,6 @@ "step11_finish.php" ); -$title_str[0] = i18n_install("Welcome"); -$title_str[1] = i18n_install("Accept GPL"); -$title_str[2] = i18n_install("Requirements"); -$title_str[3] = i18n_install("Database Type"); -$title_str[4] = i18n_install("Directories"); -$title_str[5] = i18n_install("Database Login"); -$title_str[6] = i18n_install("Select Database"); -$title_str[7] = i18n_install("Select Prefix"); -$title_str[8] = i18n_install("System Checks"); -$title_str[9] = i18n_install("Database Tables"); -$title_str[10] = i18n_install("Post Settings"); -$title_str[11] = i18n_install("Finalizing"); - if(! isset($is_special)) { $current_file = basename($_SERVER['PHP_SELF']); @@ -141,10 +128,14 @@ if($key >= 3) { session_start(); + + /** + * not needed?! this will delete our saved requirements and dbtype + * if($key==3) { $_SESSION = Array(); - } + }*/ } Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/header_html.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,75 +24,54 @@ * @package Installation */ +$menu_str[0] = i18n_install("Welcome"); +$menu_str[1] = i18n_install("Accept GPL"); +$menu_str[2] = i18n_install("Requirements"); +$menu_str[3] = i18n_install("Database Type"); +$menu_str[4] = i18n_install("Directories"); +$menu_str[5] = i18n_install("Database Login"); +$menu_str[6] = i18n_install("Select Database"); +$menu_str[7] = i18n_install("Select Prefix"); +$menu_str[8] = i18n_install("System Checks"); +$menu_str[9] = i18n_install("Database Tables"); +$menu_str[10] = i18n_install("Post Settings"); +$menu_str[11] = i18n_install("Finalizing"); + +$icon_str[0] = './graphics/start.png'; +$icon_str[1] = './graphics/gnu.png'; +$icon_str[2] = './graphics/important.png'; +$icon_str[3] = './graphics/phppg.png'; +$icon_str[4] = './graphics/directories.png'; +$icon_str[5] = './graphics/login.png'; +$icon_str[6] = './graphics/phppg.png'; +$icon_str[7] = './graphics/phppg.png'; +$icon_str[8] = './graphics/phppg.png'; +$icon_str[9] = './graphics/createtables.png'; +$icon_str[10] = './graphics/settings.png'; +$icon_str[11] = './graphics/finish.png'; + +$title_str[0] = i18n_install("Welcome To LinPHA2 Installation Wizzard"); +$title_str[1] = i18n_install("Accept The GNU General Public License GPL"); +$title_str[2] = i18n_install("Checking For Required Software"); +$title_str[3] = i18n_install("Select Type Of Database To Use"); +$title_str[4] = i18n_install("Define LinPHA Storage And Album Directories"); +$title_str[5] = i18n_install("Directories Testing And Database Login"); +$title_str[6] = i18n_install("Connection Test And Database Selection"); +$title_str[7] = i18n_install("Database Table Prefix Selection"); +$title_str[8] = i18n_install("Running Database Tests And Checking Permissions"); +$title_str[9] = i18n_install("Creating Database Tables And Writing Config Files"); +$title_str[10] = i18n_install("Setup LinPHA Admin And Initial Settings"); +$title_str[11] = i18n_install("Finishing LinPHA2 Setup"); + +$icon = $icon_str[$key]; +$title = $title_str[$key]; + $end = count($files)-1; $step = $key+1; $finalstep = $end+1; $strStep = i18n_install("Step %d of %d"); $strStep = sprintf($strStep, $step, $finalstep); - -switch($step) -{ - case 1: - $icon = './graphics/start.png'; - $title = i18n_install("Welcome To LinPHA2 Installation Wizzard"); - break; - - case 2: - $icon = './graphics/gnu.png'; - $title = i18n_install("Accept The GNU General Public License GPL"); - break; - - case 3: - $icon = './graphics/important.png'; - $title = i18n_install("Checking For Required Software"); - break; - - case 4: - $icon = './graphics/phppg.png'; - $title = i18n_install("Select Type Of Database To Use"); - break; - - case 5: - $icon = './graphics/directories.png'; - $title = i18n_install("Define LinPHA Storage And Album Directories"); - break; - - case 6: - $icon = './graphics/login.png'; - $title = i18n_install("Directories Testing And Database Login"); - break; - - case 7: - $icon = './graphics/phppg.png'; - $title = i18n_install("Connection Test And Database Selection"); - break; - - case 8: - $icon = './graphics/phppg.png'; - $title = i18n_install("Database Table Prefix Selection"); - break; - - case 9: - $icon = './graphics/phppg.png'; - $title = i18n_install("Running Database Tests And Checking Permissions"); - break; - - case 10: - $icon = './graphics/createtables.png'; - $title = i18n_install("Creating Database Tables And Writing Config Files"); - break; - - case 11: - $icon = './graphics/settings.png'; - $title = i18n_install("Setup LinPHA Admin And Initial Settings"); - break; - - case 12: - $icon = './graphics/finish.png'; - $title = i18n_install("Finishing LinPHA2 Setup"); - break; -} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -131,20 +110,13 @@ } echo '<div class="leftsidebox'.$style.'">'; - echo $title_str[$i]; - /* switch($i) - { - case 0: - echo i18n_install("Welcome"); - break; - case $end: - echo i18n_install("Finish"); - break; - default: - echo $title_str[$i]; - break; + + if ($i==0) { + echo '<a href="'.$_SERVER['PHP_SELF'].'?reset">'.$menu_str[$i].'</a>'; + } else { + echo $menu_str[$i]; } -*/ + echo "</div>"; } Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/lib.install.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -105,7 +105,7 @@ } if( installMkdir_p( substr( $target,0,strrpos( $target,'/') ) ) ) { - return mkdir($target,intval($mode,8)); // crawl back up & create dir tree + return @mkdir($target,intval($mode,8)); // crawl back up & create dir tree } else { @@ -161,6 +161,11 @@ /** * if $path is absolute, this is returned, if $path is relative, the relative path starting * from the linpha rootdirectory is returned +* +* always removed ending '/' to have unified paths in linpha +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -170,17 +175,29 @@ */ function installGetFullPath($path) { - if(installIsAbsolutePath($path)) { - $full_path = $path; - } else { - $full_path = LINPHA_DIR.'/'.$path; - } - - return $full_path; + if ( ! installIsAbsolutePath($path) ) + { + $path = LINPHA_DIR.'/'.$path; + } + + /** + * remove ending '/' if exists + */ + $len = strlen( $path ); + $lastsign = substr( $path, $len-1); + if($lastsign == '/' OR $lastsign == '\\') + { + $path = substr($path,0,$len-1); + } + + return $path; } /** * checks wether $path is absolute or relative +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -190,10 +207,10 @@ */ function installIsAbsolutePath($path) { - if(substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path + if (substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path ((strpos($path, ':') !== false) AND (strpos( PHP_OS, 'WIN' ) !== FALSE)) // we are on windows and the string contains a ':' -> absolut path (c:/..) - ) { // absolut path + ) { // absolute path return true; } else { return false; @@ -201,9 +218,13 @@ } /** - * creates a random password + * generates a random string/password in given length + * @author bzrudi + * @param int length of random string to generate + * @return string random string + * @package functions */ -function random_password($len) +function installRandomString($len) { $pass = ''; $lchar = 0; @@ -296,26 +317,30 @@ $array = array('album','sql','cache','tmp'); foreach($array AS $value) { - /** - * remove ending slash if not already done - */ - $len = strlen( $_POST[$value.'_dir'] ); - $lastsign = substr( $_POST[$value.'_dir'], $len-1); - if($lastsign == '/' && $lastsign == '\\') - { - $_POST[$value.'_dir'] = substr($_POST[$value.'_dir'],0,$len-1); - } + if (isset($_POST[$value.'_dir'])) + { + /** + * remove ending slash if not already done + */ + $len = strlen( $_POST[$value.'_dir'] ); + $lastsign = substr( $_POST[$value.'_dir'], $len-1); + if($lastsign == '/' && $lastsign == '\\') + { + $_POST[$value.'_dir'] = substr($_POST[$value.'_dir'],0,$len-1); + } + + /** + * save current value and append correct dir names + */ + $_SESSION[$value.'_dir'] = $_POST[$value.'_dir']; + + /** + * get correct dir names (take care of relativ and absolute paths, add + * LINPHA_DIR if necessary) + */ + } - /** - * save current value and append correct dir names - */ - $_SESSION[$value.'_dir'] = $_POST[$value.'_dir']; - - /** - * get correct dir names (take care of relativ and absolute paths, add - * LINPHA_DIR if necessary) - */ - $dirs[$value] = installGetFullPath( $_SESSION[$value.'_dir'] ); + $dirs[$value] = installGetFullPath( $_SESSION[$value.'_dir'] ); } return $dirs; } Modified: trunk/linpha2/install/look.css =================================================================== --- trunk/linpha2/install/look.css 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/look.css 2008-02-04 22:12:44 UTC (rev 4852) @@ -55,12 +55,12 @@ .leftside { - background: #F3F3F3; /*#e2e2e2;*/ + background: #E0E8FF; /*#F3F3F3; /*#e2e2e2;*/ border-right: 0px; } .rightside { - background: #F3F3F3; /*#eeeeee;*/ + background: #E0E8FF; /*#F3F3F3; /*#eeeeee;*/ } .button { @@ -85,6 +85,10 @@ font-weight: bold; } +.leftsidebox a { + color: #000000; +} + .box2 { } Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/manual_install.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -59,6 +59,7 @@ $_SESSION['sql_password'] = ""; $_SESSION['sql_dbname'] = "linpha"; $_SESSION['sql_dbport'] = "3306"; + $_SESSION['hash_secret'] = ""; define('LIN_PREFIX', $_SESSION['sql_prefix']); @@ -137,16 +138,8 @@ echo $_SESSION['album_dir']."\n"; echo $_SESSION['sql_dir']."\n"; echo $_SESSION['cache_dir']."\n"; -echo $_SESSION['cache_dir'].'/imgcache/'."\n"; -for($i = 0; $i < 10; $i++) -{ - echo $_SESSION['cache_dir'].'/imgcache/'.$i.'/'."\n"; -} -echo $_SESSION['cache_dir'].'/thumbache/'."\n"; -for($i = 0; $i < 10; $i++) -{ - echo $_SESSION['cache_dir'].'/thumbache/'.$i.'/'."\n"; -} +echo $_SESSION['cache_dir'].'/img'."\n"; +echo $_SESSION['cache_dir'].'/thumb/'."\n"; echo $_SESSION['tmp_dir']."\n"; echo $_SESSION['tmp_dir'].'/adocache/'; ?> @@ -165,6 +158,7 @@ $comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; $comment[6] = $donotchange; $comment[7] = $changeme; +$comment[8] = $changeme; include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); ?> Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step10_postsettings.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -45,13 +45,14 @@ echo i18n_install("Connecting To Database...").' '; unset($_SESSION['installmode1']); +$_SESSION['installmode2'] = true; include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new Linpha(); -$linpha->sql->dbConnect(); +$linpha->sql->dbConnect(); // will exit on failure -echo success_msg(); // TODO: we should check for success before stating it ;-) +echo success_msg(); /** * add new linpha admin user Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step3_dbtype.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -77,21 +77,22 @@ * check for supported databases * define disabled and checked variables */ -foreach($array_databases AS $key=>$value) +foreach ($array_databases as $key=>$value) { - if(!function_exists($value)) { + if (!function_exists($value)) { $disabled = ' disabled="disabled"'; } else { $disabled = ''; } - if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == $key) { + if (isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == $key && empty($disabled)) { $checked = ' checked="checked"'; + $is_first = false; } else { /** * use first entry as checked */ - if(!isset($is_first) && empty($disabled)) + if (!isset($is_first) && empty($disabled)) { $is_first = false; $checked = ' checked="checked"'; @@ -125,12 +126,10 @@ <br /><br /> <h1><?php echo i18n_install("Select Installation Mode"); ?></h1><hr> -<input type='radio' id='linInputModeAutomatic' name='install_mode' value='automatic' checked="checked"><?php -/* no linebreak between <input> and <label> tag */ ?><label for="linInputModeAutomatic"> +<label for="linInputModeAutomatic"><input type='radio' id='linInputModeAutomatic' name='install_mode' value='automatic' checked="checked"> <?php echo i18n_install("Automatic mode"); ?></label> <br /> -<input type='radio' id='linInputModeManual' name='install_mode' value='manual'><?php -/* no linebreak between <input> and <label> tag */ ?><label for="linInputModeManual"> +<label for="linInputModeManual"><input type='radio' id='linInputModeManual' name='install_mode' value='manual'> <?php echo i18n_install("Manual Mode (Experts Only)"); ?></label> <?php Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -27,9 +27,9 @@ include_once(LINPHA_DIR.'/install/header.php'); if (!isset($_SESSION['default_sql_dir']) ) { // save for later use in initInitialDirectories() - $_SESSION['default_sql_dir'] = 'var/sql-'.random_password(10); - $_SESSION['default_cache_dir'] = 'var/cache-'.random_password(10); - $_SESSION['default_tmp_dir'] = 'var/tmp-'.random_password(10); + $_SESSION['default_sql_dir'] = 'var/sql-'.installRandomString(10); + $_SESSION['default_cache_dir'] = 'var/cache-'.installRandomString(10); + $_SESSION['default_tmp_dir'] = 'var/tmp-'.installRandomString(10); } $album_dir = (isset($_SESSION['album_dir']) ? $_SESSION['album_dir'] : 'albums'); @@ -69,12 +69,13 @@ include_once(LINPHA_DIR.'/install/header_html.php'); + +echo i18n_install("For security reasons folders were named random.").' '; +echo i18n_install("For maximum security place all these folders outside of the www root!").' '; +echo '('.i18n_install("Relative or absolute paths are allowed.").')<br /><br />'; ?> <div class="boxalign"> <?php -echo '<b>'.i18n_install("For maximum security place all these folders outside of the www root!") . - '</b><br />('.i18n_install("Relative or absolute paths allowed.").')<br /><br />'; - echo i18n_install("Album Directory").":"; ?> <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" name="album_dir" size="30" value="<?php echo $album_dir; ?>"> @@ -113,11 +114,7 @@ (-> <?php echo installLinRealpath( installGetFullPath($tmp_dir) ); ?>) <br /><br /> -<?php -echo i18n_install("For security reasons folders were named random."); -?> - <input type="hidden" name="cmd_step4" value="save"> Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step6_selectdatabase.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -110,7 +110,7 @@ $_SESSION['allowed_to_create_db'] = false; break; -// case "sqlite": sqlite goes directly to stage8 +// case "sqlite": sqlite goes directly to stage7 } if(isset($error_nr)) Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -133,39 +133,55 @@ /** * checking album, sql, cache and tmp directory */ - $dirs = initSessionValues(); - if(initInitialDirectories($dirs) != true) - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(); - } - - echo i18n_install("Connecting SQLite Database...").' '; - - if(file_exists(LINPHA_DIR.'/'.$_SESSION['sql_dir'].'/'.$_SESSION['sql_dbname'])) + if(isset($_POST['cmd_step4'])) + { + /** + * checking album, sql, cache and tmp directory + */ + $dirs = initSessionValues(); + if(initInitialDirectories($dirs) != true) + { + $show_next_button = false; + include_once(LINPHA_DIR.'/install/footer.php'); + exit(); + } + } + + + if (isset($_SESSION['sqlite_db_created']) && $_SESSION['sqlite_db_created']==$_SESSION['sql_dir']) { - echo failed_msg(); - echo "<br />".sprintf( i18n_install("Database Already Exists, Delete First The File %s!"),$_SESSION['sql_dbname'] ); - $error_nr = 3; + echo i18n_install("Sqlite database already created, please continue to next step."); } else { - - /** - * store in session to be used when switching to adodb - */ - - if ($db = @sqlite_open(LINPHA_DIR.'/'.$_SESSION['sql_dir'].'/'.$_SESSION['sql_dbname'], 0666, $sqliteerror)) - { - echo success_msg(); - } - else - { - echo failed_msg(); - echo "<br />".i18n_install("Failed To Create Database").": ".$sqliteerror; - $error_nr = 3; - } + echo i18n_install("Creating SQLite Database...").' '; + + $sqlite_file = installGetFullPath( $_SESSION['sql_dir'] ).'/'.$_SESSION['sql_dbname']; + if(file_exists($sqlite_file)) + { + echo failed_msg(); + echo "<br />".sprintf( i18n_install("Database Already Exists, Delete First The File %s!"),$_SESSION['sql_dbname'] ); + $error_nr = 3; + } + else + { + if ($db = @sqlite_open($sqlite_file, 0666, $sqliteerror)) + { + echo success_msg(); + + /** + * do check for sqlite database already exist only once per sql_dir + * to prevent error message when pushing back button on step8 + */ + $_SESSION['sqlite_db_created'] = $_SESSION['sql_dir']; + } + else + { + echo failed_msg(); + echo "<br />".i18n_install("Failed To Create Database").": ".$sqliteerror; + $error_nr = 3; + } + } } break; case "oci8po": Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step8_testing.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -61,10 +61,10 @@ * switching to AdoDB * connect to db and check if connection was succesfull */ - echo i18n_install("Switching To AdoDB..").' '; + echo i18n_install("Switching To AdoDB...").' '; $_SESSION['installmode1'] = true; $_SESSION['installmode2'] = true; - + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new Linpha(); @@ -130,8 +130,8 @@ if($_SESSION['sql_dbtype'] == "mysql") { echo i18n_install("Trying To Create New LinPHA Database User...").' '; - $random_pass = random_password(8); - $random_user = "linpha_".random_password(4); + $random_pass = installRandomString(10); + $random_user = "linpha_".installRandomString(4); if($_SESSION['sql_hostname'] == 'localhost' OR $_SESSION['sql_hostname'] == '127.0.0.1') { @@ -180,21 +180,13 @@ } } } - echo '<br /><br /><hr /><br />'; + echo '<br /><br />'; } +echo '<br /><br />'; /** * running tests */ -/** - * prevent test running sqlite db - * @todo why?? -flo - * @todo - because at least alter will fail ;-) - bzrudi - */ - -if($_SESSION['sql_dbtype'] != 'sqlite') -{ - for($i = 1; $i <= $n_runs; $i++) { /** @@ -215,16 +207,32 @@ echo "<br />".i18n_install("Running Tests").": "; - $array_tests = array( - "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", - "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", - "ALTER" => "ALTER TABLE ".$table_name." ADD md5sum VARCHAR(32)", - "UPDATE" => "UPDATE ".$table_name." SET md5sum = '".md5('the life ist beautiful')."'", - "SELECT" => "SELECT * FROM ".$table_name, - "DELETE" => "DELETE FROM ".$table_name, - "DROP" => "DROP TABLE ".$table_name ); - - foreach($array_tests AS $key=>$value) + if ($_SESSION['sql_dbtype'] == 'sqlite') + { + /** + * sqlite does not support ALTER commands + */ + $array_tests = array( + "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL, md5sum VARCHAR(32) )", + "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", + "UPDATE" => "UPDATE ".$table_name." SET md5sum = '".md5('the life ist beautiful')."'", + "SELECT" => "SELECT * FROM ".$table_name, + "DELETE" => "DELETE FROM ".$table_name, + "DROP" => "DROP TABLE ".$table_name + ); + } else { + $array_tests = array( + "CREATE" => "CREATE TABLE ".$table_name." ( id INT NOT NULL )", + "INSERT" => "INSERT into ".$table_name." ( id ) VALUES ( '5' )", + "ALTER" => "ALTER TABLE ".$table_name." ADD md5sum VARCHAR(32)", + "UPDATE" => "UPDATE ".$table_name." SET md5sum = '".md5('the life ist beautiful')."'", + "SELECT" => "SELECT * FROM ".$table_name, + "DELETE" => "DELETE FROM ".$table_name, + "DROP" => "DROP TABLE ".$table_name + ); + } + + foreach($array_tests AS $key=>$value) { echo " ".$key." "; @@ -283,21 +291,14 @@ } } } -} -else -{ - /** - * skip tests for sqlite - */ - echo i18n_install("Skipping Database Tests"); -} + /** * new user failed, use old connection */ if(isset($use_other_conn)) { echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; - $linpha->db = $orig_conn; + $linpha->db = $orig_conn; // @TODO flo: i don't think that this makes any sense... } elseif($n_runs == 2) { Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/install/step9_createtables.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -211,6 +211,8 @@ $comment[5] = ''; $comment[6] = ''; $comment[7] = ''; + $comment[8] = ''; + $_SESSION['hash_secret'] = installRandomString(32); include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,9 @@ * This class provides functions for edit configs etc. * @package Admin */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinAdmin { Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,7 @@ * This is the base class which needs to be included. It takes care of * including a number of class files and sets up basic things. */ + if(!defined('LINPHA_DIR')) { exit(1); } include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -25,6 +25,9 @@ * @package MetaData * @author bzrudi */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinExifTool extends LinMetaData { Modified: trunk/linpha2/lib/classes/linpha.filesys.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.filesys.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,11 +23,10 @@ * @package Filesystem */ +if(!defined('LINPHA_DIR')) { exit(1); } class LinFilesys { - - /** * create directory recursively - same as "mkdir -p" */ @@ -174,6 +173,9 @@ * the relative path starting from the linpha root directory is returned * * always removed ending '/' to have unified paths in linpha +* +* this function is also defined in lib.install.php +* always update both files! * * @author flo * @param string $path a path @@ -200,9 +202,11 @@ return $path; } - /** * checks wether $path is absolute or relative +* +* this function is also defined in linpha.filesys.class.php +* always update both files! * * @author flo * @param string $path a path @@ -213,7 +217,7 @@ { if(substr($path,0,1) == '/' OR // string begins with a '/' -> absolut path ((strpos($path, ':') !== false) AND (strpos( PHP_OS, 'WIN' ) !== FALSE)) // we are on windows and the string contains a ':' -> absolut path (c:/..) - ) { // absolut path + ) { // absolute path return true; } else { return false; Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,6 +23,8 @@ * @package Functions */ +if(!defined('LINPHA_DIR')) { exit(1); } + /** * get content of the systems PATH variable and remove dirs not in open_basedir and safe_mode_exec_dir (only if activated) */ @@ -582,7 +584,6 @@ /** * Setup Log Time Output Message & Remote IP */ - $time = linStrftime(time()); $ip = $_SERVER["REMOTE_ADDR"]; if( !isset($_SESSION['user_name'])) { $user = 'anonymous'; @@ -612,6 +613,8 @@ if(isset($GLOBALS['linpha']->sql->config->value['plugins_log_enable']) && $GLOBALS['linpha']->sql->config->value['plugins_log_enable'] == '1') { + $time = linStrftime(time()); // only when database is connected + /** * In case of database connection error a file named * db_error_tmp.log is created. If the file exists, copy it's content @@ -946,7 +949,6 @@ * @param int length of random string to generate * @return string random string * @package functions - */ function random_string($len) { Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,6 +24,8 @@ * @package Image */ +if(!defined('LINPHA_DIR')) { exit(1); } + class LinIdentify { Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,7 @@ * This class takes care of all different views (thumb view, menus...) * @package Image */ + if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -18,13 +18,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + /** * This class takes automagic care of added/deleted images and albums * @package Image */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinImport { - /** * update selected directory * add new dirs/files, delete old ones Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -18,15 +18,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -if (!defined('LINPHA_DIR')) { exit (1); } -include_once LINPHA_DIR.'/lib/pjmt/Unicode.php'; - /** * This is the baseclass to handle all the EXIF/IPTC/XMP stuff used in LinPHA * It is extended by LinExifTool and LinPjmtTool class * @package MetaData * @author bzrudi,flo */ + +if (!defined('LINPHA_DIR')) { exit (1); } +include_once LINPHA_DIR.'/lib/pjmt/Unicode.php'; + class LinMetaData { public $defined_fields, $available_fields, $objMetaTool; Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -24,6 +24,9 @@ * @package MetaData * @author bzrudi,flo */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinPjmtTool extends LinMetaData { /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -23,6 +23,8 @@ * @package Database */ +if(!defined('LINPHA_DIR')) { exit(1); } + class LinSql { private $isLoggedIn, $isAdmin; @@ -49,9 +51,8 @@ $db_username = $_SESSION['sql_username']; $db_password = $_SESSION['sql_password']; $db_port = $_SESSION['sql_dbport']; - $db_name = ($db_type == "sqlite" ? LINPHA_DIR.'/'.$_SESSION['sql_dir'] : '').$_SESSION['sql_dbname']; + $db_name = $_SESSION['sql_dbname']; $db_prefix = $_SESSION['sql_prefix']; - } else { @@ -61,20 +62,23 @@ include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); */ + /** + * if this file does not exists we already switch to installer + */ $sql_dir = ''; - include(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... + require_once(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) { - include_once( $include_file ); + require_once( $include_file ); } else { - linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to the database !!! Cannot get config file ./var/config.sql.php"); + linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to the database !!! Cannot get config file $include_file"); include(LINPHA_DIR."/lib/include/db_connect_error.html"); - echo "<br /><br /><b>ERROR MESSAGE: Failed to include config file './var/config.sql.php' is it missing?</b>"; + echo "<br /><br /><b>ERROR MESSAGE: Failed to include config file. See log file for details.</b>"; exit(1); } @@ -114,15 +118,11 @@ switch(LIN_DB_TYPE) { case "sqlite": - if(isset($_SESSION['installmode1'])) - { - $sql_dir = LinFilesys::getFullPath($_SESSION['sql_dir']); - $GLOBALS['linpha']->db->Connect($sql_dir.'/database.sqlite'); + if(isset($_SESSION['installmode1'])) { + $sql_dir = $_SESSION['sql_dir']; } - else - { - $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/database.sqlite'); - } + + $GLOBALS['linpha']->db->Connect(LinFilesys::getFullPath( $sql_dir ).'/'.$db_name); break; case "mysql": $GLOBALS['linpha']->db->Connect("$db_hostname:$db_port", $db_username, $db_password, $db_name); Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-04 13:52:22 UTC (rev 4851) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-04 22:12:44 UTC (rev 4852) @@ -22,6 +22,9 @@ * This class takes care of LinPHAs template layouts * @package Template */ + +if(!defined('LINPHA_DIR')) { exit(1); } + class LinTemplate { public $template_name, $layout_name; @@ -159,8 +162,8 @@ </style> <![endif]--> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> var LINPHA_LINK = '<?php echo LINPHA_LINK; ?>'; var LINPHA_CLIENT = '<?php echo LINPHA_CLIENT; ?>'; @@ -169,11 +172,11 @@ var IdCurrent = startIdCurrent; <?php if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { - //echo "var checkAjaxCompatibility = true;"."\n"; - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} /*else { - echo "var checkAjaxCompatibility = false;"."\n"; -}*/ + //echo "var checkAjaxCompatibility = true;"."\n"; + echo "myLinGlobal.checkAjaxCompatibility();"."\n"; +} /*else { + echo "var checkAjaxCompatibility = false;"."\n"; +}*/ ?> </script> Added: trunk/linpha2/lib/iha/License-LGPL.txt =================================================================== --- trunk/linpha2/lib/iha/License-LGPL.txt (rev 0) +++ trunk/linpha2/lib/iha/License-LGPL.txt 2008-02-04 22:12:44 UTC (rev 4852) @@ -0,0 +1,506 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portio... [truncated message content] |
From: <fan...@us...> - 2008-02-06 20:50:54
|
Revision: 4853 http://linpha.svn.sourceforge.net/linpha/?rev=4853&view=rev Author: fangehrn Date: 2008-02-06 12:50:49 -0800 (Wed, 06 Feb 2008) Log Message: ----------- 2008-02-06 flo * common.php/linpha.class.php - fixed LINPHA_CLIENT when linpha is installed not to a subfolder - secured $_SERVER['PATH_INFO'] Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/linpha2.specs.txt trunk/linpha2/docs/dev/security.txt trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/calendar.php trunk/linpha2/lib/include/common.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/ChangeLog 2008-02-06 20:50:49 UTC (rev 4853) @@ -1,4 +1,10 @@ + +2008-02-06 flo + * common.php/linpha.class.php + - fixed LINPHA_CLIENT when linpha is installed not to a subfolder + - secured $_SERVER['PATH_INFO'] + 2008-02-04 flo * Some more work on the installer - fixed several bugs (absolute paths, sqlite, manual mode, back navigation) Modified: trunk/linpha2/docs/dev/linpha2.specs.txt =================================================================== --- trunk/linpha2/docs/dev/linpha2.specs.txt 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/docs/dev/linpha2.specs.txt 2008-02-06 20:50:49 UTC (rev 4853) @@ -53,6 +53,13 @@ - htmlentities() - smart_htmlspecialchars() from phpmeta used several times in forms in linpha1 ? + /* update 06.02.2008 fa */ + decided to use htmlentities($str, ENT_QUOTES) + difference between htmlspecialchars() and htmlentities(): + htmlspecialchars(): Array( ["] => " [<] => < [>] => > [&] => & ) + htmlentities(): Array( [ ] => [¡] => ¡ [¢] => ¢ [£] => £ [¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => § [¨] => ¨ [©] => © [ª] => ª [«] => « [¬] => ¬ [] => ­ [®] => ® [¯] => ¯ [°] => ° [±] => ± [²] => ² [³] => ³ [´] => ´ [µ] => µ [¶] => ¶ [·] => · [¸] => ¸ [¹] => ¹ [º] => º [»] => » [¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿ [À] => À [Á] => Á [Â] => Â [Ã] => Ã [Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç [È] => È [É] => É [Ê] => Ê [Ë] => Ë [Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï [Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó [Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => × [Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û [Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß [à] => à [á] => á [â] => â [ã] => ã [ä] => ä [å] => å [æ] => æ [ç] => ç [è] => è [é] => é [ê] => ê [ë] => ë [ì] => ì [í] => í [î] => î [ï] => ï [ð] => ð [ñ] => ñ [ò] => ò [ó] => ó [ô] => ô [õ] => õ [ö] => ö [÷] => ÷ [ø] => ø [ù] => ù [ú] => ú [û] => û [ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ ["] => " [<] => < [>] => > [&] => &) + -> its better to convert German Umlauts etc. to html entities to prevent problems if the browser does not support UTF-8 + - ? - php session limit the session cookie not only to domain, but also to full url path Modified: trunk/linpha2/docs/dev/security.txt =================================================================== --- trunk/linpha2/docs/dev/security.txt 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/docs/dev/security.txt 2008-02-06 20:50:49 UTC (rev 4853) @@ -8,6 +8,8 @@ where no quotes are used, take special care: "ORDER by id,(select password from users)" - encode all untrusted html data with htmlspecialchars( $text, ENT_QUOTES ) + /* update 06.02.2008 fa */ decided to switch to htmlentities($str, ENT_QUOTES) + see linpha2.specs.txt for details - check every data coming by the user (GET/POST/COOKIE) Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -79,10 +79,16 @@ } } - if(!defined('LINPHA_CLIENT')) + if(!defined('LINPHA_CLIENT')) // LINPHA_CLIENT must be defined before linpha is included from another page { - define('LINPHA_CLIENT', LinFilesys::cleanPath( dirname($_SERVER['PHP_SELF']).'/'.LINPHA_DIR ) ); + $dir = dirname($_SERVER['PHP_SELF']); + if ($dir=='\\' || $dir=='/') { // this is the case when linpha is installed not to a subfolder + define('LINPHA_CLIENT', '' ); // LINPHA_CLIENT has never an ending slash + } else { + define('LINPHA_CLIENT', LinFilesys::cleanPath( $dir.'/'.LINPHA_DIR ) ); + } } + /** * installation check Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -230,6 +230,14 @@ } else { + /** + * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure + * and may contain cross site scripting. in common.php all htmlentities have been + * replaced + * + * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() + * and returns false if it is not a valid album, so as far as i know it's safe to use it this way + */ if( isset($_SERVER['PATH_INFO']) ) { $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this Modified: trunk/linpha2/lib/include/calendar.php =================================================================== --- trunk/linpha2/lib/include/calendar.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/include/calendar.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -1,179 +1,179 @@ -<?php -/* -* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> -* -* 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. -*/ - -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } - -include_once(LINPHA_DIR.'/lib/include/common.php'); - -$style['tablebg']="#B3BCDE"; - -/** - * @todo do we need the startSession() for the language stuff? - */ -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -?> -<title>Calender - LinPHA</title> -</head> -<body> -<?php - $m = (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m']; // wenn $m $y noch nicht existiert, aktuellen monat und aktuelles jahr in $m und $y schreiben - $y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y']; -?> -<div align="center"> -<table bgcolor="<?php echo $style['tablebg']; ?>"> - <tr> - <td valign="top"> -<?php - /*== get what weekday the first is on ==*/ - $month_in_dec = strftime("%m",mktime(0,0,0,$m,1,$y)); - - $tmpd = getdate(mktime(0,0,0,$m,1,$y)); - $firstwday= $tmpd["wday"]; - - $lastday = mk_getLastDayofMonth($m,$y); - - $arr_month_long = Array( - '1' => i18n("January"), - '2' => i18n("February"), - '3' => i18n("March"), - '4' => i18n("April"), - '5' => i18n("May"), - '6' => i18n("June"), - '7' => i18n("July"), - '8' => i18n("August"), - '9' => i18n("September"), - '10' => i18n("October"), - '11' => i18n("November"), - '12' => i18n("December") - ); -?> -<table cellpadding=2 cellspacing=0 border=1> - <tr> - <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>"> - <table cellpadding=0 cellspacing=0 border=0 width="100%"> - <tr> - <td width="20"><a href="?m=<?php echo (($m-1)<1) ? 12 : $m-1 ; ?>&y=<?php echo (($m-1)<1) ? $y-1 : $y ; ?>&form=<?php echo $_GET['form']; ?>"><<</a></td> - <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2> - <?php echo $arr_month_long[intval($month_in_dec)]." ".$y; ?> - </font></td> - <td width="20"><a href="?m=<?php echo (($m+1)>12) ? 1 : $m+1 ; ?>&y=<?php echo (($m+1)>12) ? $y+1 : $y ; ?>&form=<?php echo $_GET['form']; ?>">>></a></td> - </tr> - </table></td> - </tr> - <tr> - <td width="22"><?php echo i18n("Sun"); ?></td> - <td width="22"><?php echo i18n("Mon"); ?></td> - <td width="22"><?php echo i18n("Tue"); ?></td> - <td width="22"><?php echo i18n("Wed"); ?></td> - <td width="22"><?php echo i18n("Thu"); ?></td> - <td width="22"><?php echo i18n("Fri"); ?></td> - <td width="22"><?php echo i18n("Sat"); ?></td> - </tr> - <?php - $d = 1; - $wday = $firstwday; - $firstweek = true; - - /*== loop through all the days of the month ==*/ - while ( $d <= $lastday) - { - - /*== set up blank days for first week ==*/ - if ($firstweek) { - print "<tr>"; - for ($i=1; $i<=$firstwday; $i++) - { print '<td><font size="2"></font></td>'; } - $firstweek = false; - } - - /*== Sunday start week with <tr> ==*/ - if ($wday==0) { print "<tr>"; } - - /*== check for event ==*/ - print "<td>"; - if($d<10) { - if($m<10) { - $tag = "$y:0$m:0$d"; - } else { - $tag = "$y:$m:0$d"; - } - } else { - if($m<10) { - $tag = "$y:0$m:$d"; - } else { - $tag = "$y:$m:$d"; - } - } - - $heute = date("Y:m:d",mktime()); // "01" bis "12" - if($tag==$heute) - { - $font1 = "<font color=\"#FF0000\">"; - $font2 = "</font>"; - } - else - { - $font1 = ""; - $font2 = ""; - } - if(isset($_GET['additional_cmd'])) - { - $str = ",opener.".$_GET['additional_cmd']; - } - else - { - $str = ""; - } - echo '<a href="#" onClick="opener.document.getElementById(\''.$_GET['form'].'\').value=\''.$tag.'\'' . $str . ',window.close();">'.$font1.$d.$font2.'</a>'; - print "</td>\n"; - - /*== Saturday week with </tr> ==*/ - if ($wday==6) { print "</tr>\n"; } - - $wday++; - $wday = $wday % 7; - $d++; - } -?> -</tr> -</table> -<div align="center"><a href="#" onClick="window.close()"><?php echo i18n("Close Window"); ?></a></div> - - </td> - </tr> -</table> -</div> -</body> -</html> -<?php -/*== get the last day of the month ==*/ -function mk_getLastDayofMonth($mon,$year) -{ - for ($tday=28; $tday <= 31; $tday++) - { - $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); - if ($tdate["mon"] != $mon) - { break; } - - } - $tday--; - - return $tday; -} -?> +<?php +/* +* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> +* +* 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. +*/ + +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } + +include_once(LINPHA_DIR.'/lib/include/common.php'); + +$style['tablebg']="#B3BCDE"; + +/** + * @todo do we need the startSession() for the language stuff? + */ +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +?> +<title>Calender - LinPHA</title> +</head> +<body> +<?php + $m = (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m']; // wenn $m $y noch nicht existiert, aktuellen monat und aktuelles jahr in $m und $y schreiben + $y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y']; +?> +<div align="center"> +<table bgcolor="<?php echo $style['tablebg']; ?>"> + <tr> + <td valign="top"> +<?php + /*== get what weekday the first is on ==*/ + $month_in_dec = strftime("%m",mktime(0,0,0,$m,1,$y)); + + $tmpd = getdate(mktime(0,0,0,$m,1,$y)); + $firstwday= $tmpd["wday"]; + + $lastday = mk_getLastDayofMonth($m,$y); + + $arr_month_long = Array( + '1' => i18n("January"), + '2' => i18n("February"), + '3' => i18n("March"), + '4' => i18n("April"), + '5' => i18n("May"), + '6' => i18n("June"), + '7' => i18n("July"), + '8' => i18n("August"), + '9' => i18n("September"), + '10' => i18n("October"), + '11' => i18n("November"), + '12' => i18n("December") + ); +?> +<table cellpadding=2 cellspacing=0 border=1> + <tr> + <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>"> + <table cellpadding=0 cellspacing=0 border=0 width="100%"> + <tr> + <td width="20"><a href="?m=<?php echo (($m-1)<1) ? 12 : $m-1 ; ?>&y=<?php echo (($m-1)<1) ? $y-1 : $y ; ?>&form=<?php echo $_GET['form']; ?>"><<</a></td> + <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2> + <?php echo $arr_month_long[intval($month_in_dec)]." ".$y; ?> + </font></td> + <td width="20"><a href="?m=<?php echo (($m+1)>12) ? 1 : $m+1 ; ?>&y=<?php echo (($m+1)>12) ? $y+1 : $y ; ?>&form=<?php echo $_GET['form']; ?>">>></a></td> + </tr> + </table></td> + </tr> + <tr> + <td width="22"><?php echo i18n("Sun"); ?></td> + <td width="22"><?php echo i18n("Mon"); ?></td> + <td width="22"><?php echo i18n("Tue"); ?></td> + <td width="22"><?php echo i18n("Wed"); ?></td> + <td width="22"><?php echo i18n("Thu"); ?></td> + <td width="22"><?php echo i18n("Fri"); ?></td> + <td width="22"><?php echo i18n("Sat"); ?></td> + </tr> + <?php + $d = 1; + $wday = $firstwday; + $firstweek = true; + + /*== loop through all the days of the month ==*/ + while ( $d <= $lastday) + { + + /*== set up blank days for first week ==*/ + if ($firstweek) { + print "<tr>"; + for ($i=1; $i<=$firstwday; $i++) + { print '<td><font size="2"></font></td>'; } + $firstweek = false; + } + + /*== Sunday start week with <tr> ==*/ + if ($wday==0) { print "<tr>"; } + + /*== check for event ==*/ + print "<td>"; + if($d<10) { + if($m<10) { + $tag = "$y:0$m:0$d"; + } else { + $tag = "$y:$m:0$d"; + } + } else { + if($m<10) { + $tag = "$y:0$m:$d"; + } else { + $tag = "$y:$m:$d"; + } + } + + $heute = date("Y:m:d",mktime()); // "01" bis "12" + if($tag==$heute) + { + $font1 = "<font color=\"#FF0000\">"; + $font2 = "</font>"; + } + else + { + $font1 = ""; + $font2 = ""; + } + if(isset($_GET['additional_cmd'])) + { + $str = ",opener.".$_GET['additional_cmd']; + } + else + { + $str = ""; + } + echo '<a href="#" onClick="opener.document.getElementById(\''.$_GET['form'].'\').value=\''.$tag.'\'' . $str . ',window.close();">'.$font1.$d.$font2.'</a>'; + print "</td>\n"; + + /*== Saturday week with </tr> ==*/ + if ($wday==6) { print "</tr>\n"; } + + $wday++; + $wday = $wday % 7; + $d++; + } +?> +</tr> +</table> +<div align="center"><a href="#" onClick="window.close()"><?php echo i18n("Close Window"); ?></a></div> + + </td> + </tr> +</table> +</div> +</body> +</html> +<?php +/*== get the last day of the month ==*/ +function mk_getLastDayofMonth($mon,$year) +{ + for ($tday=28; $tday <= 31; $tday++) + { + $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); + if ($tdate["mon"] != $mon) + { break; } + + } + $tday--; + + return $tday; +} +?> Modified: trunk/linpha2/lib/include/common.php =================================================================== --- trunk/linpha2/lib/include/common.php 2008-02-04 22:12:44 UTC (rev 4852) +++ trunk/linpha2/lib/include/common.php 2008-02-06 20:50:49 UTC (rev 4853) @@ -77,7 +77,7 @@ } /** - * secure PHP_SELF + * secure PHP_SELF and PATH_INFO * * added from linpha1 patch 1432469 * @@ -97,14 +97,27 @@ * */ // Secure the PHP_SELF variable by first making all HTML code unuseable + + //$_SERVER['PHP_SELF'] = '/tests/simple.php/"><script>alert(\'xss\')</script><foo'; $_SERVER['PHP_SELF'] = htmlentities($_SERVER['PHP_SELF']); + if (isset($_SERVER['PATH_INFO'])) { + /** + * @TODO this will probably break special signs in the perma-link feature + * www.somewhere.com/index.php/album1/photo.jpg + * www.somewhere.com/index.php/album2 with spaces and 'quotes' and other "quotes"/photo <1>.jpg + * + * for the moment its ok for me. would need furhter investigation to get perma-link with special signs working + */ + $_SERVER['PATH_INFO'] = htmlentities($_SERVER['PATH_INFO']); + } + // Split it up into path and filename $SELF_DIR = dirname($_SERVER['PHP_SELF']); $SELF_FILE = basename($_SERVER['PHP_SELF']); // Check for a .php inside the $SELF_DIR... - while (ereg(".php", $SELF_DIR)) + while (ereg(".php", $SELF_DIR)) // this will not work if there is a folder with .php in its name, but this is very unlikely { // Correct the dirname $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, ".php") + 4)); @@ -115,7 +128,22 @@ } // Put both together again and let's pray it is secured now... - $_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE; + if ( $SELF_DIR=='/' || $SELF_DIR=='\\') { + // if linpha is not installed in a subfolder take special behaviour + $_SERVER['PHP_SELF'] = "/".$SELF_FILE; + + /** + * (windows xp sp2 apache2.2 + * dirname('/'): \ + * dirname('/index.php'): \ + * dirname('/linpha/index.php'): /linpha + * dirname('/linpha/index.php/<asd>'): /linpha/index.php + * dirname('/linpha/index.php/<asd>/<asd>'): /linpha/index.php/<asd>) + */ + + } else { + $_SERVER['PHP_SELF'] = $SELF_DIR."/".$SELF_FILE; + } // Remove uneccessary variables unset($SELF_DIR); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-06 23:26:04
|
Revision: 4854 http://linpha.svn.sourceforge.net/linpha/?rev=4854&view=rev Author: fangehrn Date: 2008-02-06 15:25:59 -0800 (Wed, 06 Feb 2008) Log Message: ----------- 2008-02-06 flo * User - implemented "improved hash algorithm" for more secure password hashes * Cookies - added cookie settings Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_define_post.php trunk/linpha2/admin/permissions_users.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/install/step11_finish.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/include/sql/sql.mysql.php trunk/linpha2/lib/include/sql/sql.oci8po.php trunk/linpha2/lib/include/sql/sql.postgres.php trunk/linpha2/lib/include/sql/sql.sqlite.php trunk/linpha2/reset_database.php trunk/linpha2/templates/default/fragments.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/ChangeLog 2008-02-06 23:25:59 UTC (rev 4854) @@ -4,6 +4,12 @@ * common.php/linpha.class.php - fixed LINPHA_CLIENT when linpha is installed not to a subfolder - secured $_SERVER['PATH_INFO'] + + * User + - implemented "improved hash algorithm" for more secure password hashes + + * Cookies + - added cookie settings 2008-02-04 flo * Some more work on the installer Modified: trunk/linpha2/admin/maintenance.php =================================================================== --- trunk/linpha2/admin/maintenance.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/maintenance.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,25 +1,25 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat2)) -{ - $cat2 = 'import'; -} - -$array_menu = array( - 'import' => array('name' => i18n("Import"), 'link' => 'maintenance_import'), - 'db' => array('name' => i18n("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; -} -?> +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat2)) +{ + $cat2 = 'import'; +} + +$array_menu = array( + 'import' => array('name' => i18n("Import"), 'link' => 'maintenance_import'), + 'db' => array('name' => i18n("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; +} +?> Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/metadata_define.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -431,10 +431,10 @@ { obj_from.selectedIndex = obj_from.selectedIndex - 1; } - else if( old_index > obj_from.length -1 ) - { - obj_from.selectedIndex = obj_from.length -1; - } + else if( old_index > obj_from.length -1 ) + { + obj_from.selectedIndex = obj_from.length -1; + } else { obj_from.selectedIndex = old_index; Modified: trunk/linpha2/admin/metadata_define_post.php =================================================================== --- trunk/linpha2/admin/metadata_define_post.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/metadata_define_post.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,145 +1,145 @@ -<?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. -*/ - -/** - * @package admin - * @subpackage MetaData - * - * For a description of the table structure, flags, etc. consult the developper - * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields - */ - -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 ".LIN_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 ".LIN_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 ".LIN_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 ".LIN_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 ".LIN_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 ".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 ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); - break; - -case 'update_config_metadata': - $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['metadata_config_enable']); - $linpha->sql->config->reloadConfig(); - break; - -case 'create_metadata_table': - if( ! isset($_POST['selected_fields'])) { - $_POST['selected_fields'] = Array(); - } - if(isset($cat3)) { - if(LIN_DB_TYPE == "mysql") { - $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_$cat3"); - } else { - @$linpha->db->Execute("DROP TABLE ".LIN_PREFIX."meta_$cat3"); - } - $linpha->db->Execute(LinMetaData::createMetaDataTable( $_POST['selected_fields'], $cat3)); - } - break; - -default: - echo i18n("FATAL: Unknown POST Request"); - exit(); - break; -} -?> +<?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. +*/ + +/** + * @package admin + * @subpackage MetaData + * + * For a description of the table structure, flags, etc. consult the developper + * wiki at http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields + */ + +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 ".LIN_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 ".LIN_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 ".LIN_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 ".LIN_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 ".LIN_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 ".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 ".LIN_PREFIX."meta_category WHERE id = '".LinSql::linAddslashes($_POST['id'])."'"); + break; + +case 'update_config_metadata': + $linpha->sql->config->updateConfig('sys_image_'.$cat3,$_POST['metadata_config_enable']); + $linpha->sql->config->reloadConfig(); + break; + +case 'create_metadata_table': + if( ! isset($_POST['selected_fields'])) { + $_POST['selected_fields'] = Array(); + } + if(isset($cat3)) { + if(LIN_DB_TYPE == "mysql") { + $linpha->db->Execute("DROP TABLE IF EXISTS ".LIN_PREFIX."meta_$cat3"); + } else { + @$linpha->db->Execute("DROP TABLE ".LIN_PREFIX."meta_$cat3"); + } + $linpha->db->Execute(LinMetaData::createMetaDataTable( $_POST['selected_fields'], $cat3)); + } + break; + +default: + echo i18n("FATAL: Unknown POST Request"); + exit(); + break; +} +?> Modified: trunk/linpha2/admin/permissions_users.php =================================================================== --- trunk/linpha2/admin/permissions_users.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/permissions_users.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -52,8 +52,7 @@ { $sql_str_new_password = ""; } else { - $md5_pass = md5($_POST['mod_user_pass']); - $sql_str_new_password = "password='".$md5_pass."', "; + $sql_str_new_password = "password='".$GLOBALS['linpha']->sql->getPWHash($_POST['mod_user_pass'])."', "; } $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."users SET ". @@ -62,6 +61,8 @@ $sql_str_new_password. "user_email='".LinSql::linAddslashes($_POST['mod_user_mail'])."' ". "WHERE id='".LinSql::linAddslashes($_POST['id'])."'"); + + unset($sql_str_new_password, $_POST['mod_user_pass'], $_REQUEST['mod_user_pass']); /** * if current account is changed update session variables and login cookie @@ -73,7 +74,7 @@ /** * does not work, because headers are already sent - * + * @TODO if(isset($_COOKIE['linpha_userid']) && isset($_COOKIE['linpha_password']) && isset($md5_pass)) @@ -117,8 +118,11 @@ $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'])."', ". + "('".LinSql::linAddslashes($_POST['new_user_name'])."', '".$GLOBALS['linpha']->sql->getPWHash($_POST['new_user_pass'])."', ". "'".LinSql::linAddslashes($_POST['new_user_mail'])."', '".LinSql::linAddslashes($_POST['new_user_fullname'])."')"); + + unset($_POST['new_user_pass'], $_REQUEST['new_user_pass']); + break; } } Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -1,136 +1,136 @@ -<?php -if(!defined('LINPHA_DIR')) { exit(1); } - -if(!isset($cat3)) -{ - $cat3 = 'enable'; -} - -$arrPlugins = LinAdmin::getPlugins(); - -/** - * save settings before showing menu - */ - if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - foreach($arrPlugins as $value) - { - $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; - } - - /** - * create database tables and insert config data if necessary - */ - foreach($arrPlugins as $value) // go through all plugins - { - // only if we enabled the plugin now and it didn't existed before - if( isset($_POST['plugins_'.$value.'_enable']) - && $_POST['plugins_'.$value.'_enable']=='1' - && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) - { - $str1 = i18n("Enabling plugin \"%s\""); - linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); - - /** - * create database tables - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; - if( file_exists($includeFile) ) - { - $sql_tables = array(); - include($includeFile); - - linSysLog(i18n("Creating tables")); - foreach($sql_tables as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - /** - * insert config data - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; - if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) - { - $sql_queries = array(); - include($includeFile); - - linSysLog(i18n("Insert config data")); - foreach($sql_queries as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - } - } - - // set plugins_*_enable to '1' - $LinAdmin->saveConfig($arrPluginsFullName); - } - -/** - * show menu - */ -$array_menu = array( - 'enable' => array('name' => i18n("Enable/Disable Plugins"), 'link' => 'settings_plugins_enable'), -); -foreach( $arrPlugins as $key=>$value) -{ - if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) - && $LinAdmin->option_value_system['plugins_'.$value.'_enable'] == '1' - ) - { - $array_menu[$value] = array( - 'name' => $LinAdmin->description_array['plugins_'.$value], - 'link' => 'settings_plugins_'.$value - ); - } -} - -LinAdmin::printAdminMenu($array_menu,$cat3); -?> - -<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_plugins_'.$cat3; ?>"> -<?php -if($cat3=='enable') -{ - foreach( $arrPlugins as $key=>$value) - { - if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable'])) { - $optionValue = $LinAdmin->option_value_system['plugins_'.$value.'_enable']; - } else { - $optionValue = '0'; - } - - $LinAdmin->printAdminConfig( - 'radio', - $LinAdmin->getDescriptionByOptionName('plugins_'.$value), - 'plugins_'.$value.'_enable', - $optionValue - ); - } -} -elseif(in_array($cat3,$arrPlugins)) // prevent including evil file -{ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$cat3.'/settings.'.$cat3.'.php'; - if( file_exists($includeFile)) - { - include_once($includeFile); - } -} - +<?php +if(!defined('LINPHA_DIR')) { exit(1); } + +if(!isset($cat3)) +{ + $cat3 = 'enable'; +} + +$arrPlugins = LinAdmin::getPlugins(); + +/** + * save settings before showing menu + */ + if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + foreach($arrPlugins as $value) + { + $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; + } + + /** + * create database tables and insert config data if necessary + */ + foreach($arrPlugins as $value) // go through all plugins + { + // only if we enabled the plugin now and it didn't existed before + if( isset($_POST['plugins_'.$value.'_enable']) + && $_POST['plugins_'.$value.'_enable']=='1' + && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) + { + $str1 = i18n("Enabling plugin \"%s\""); + linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); + + /** + * create database tables + */ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; + if( file_exists($includeFile) ) + { + $sql_tables = array(); + include($includeFile); + + linSysLog(i18n("Creating tables")); + foreach($sql_tables as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + // it the table already exists, we get automatically a nice message like + // "Table 'linpha2_plugins_maps_markers' already exists" + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + } + + /** + * insert config data + */ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; + if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) + { + $sql_queries = array(); + include($includeFile); + + linSysLog(i18n("Insert config data")); + foreach($sql_queries as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + // it the table already exists, we get automatically a nice message like + // "Table 'linpha2_plugins_maps_markers' already exists" + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + } + + } + } + + // set plugins_*_enable to '1' + $LinAdmin->saveConfig($arrPluginsFullName); + } + +/** + * show menu + */ +$array_menu = array( + 'enable' => array('name' => i18n("Enable/Disable Plugins"), 'link' => 'settings_plugins_enable'), +); +foreach( $arrPlugins as $key=>$value) +{ + if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) + && $LinAdmin->option_value_system['plugins_'.$value.'_enable'] == '1' + ) + { + $array_menu[$value] = array( + 'name' => $LinAdmin->description_array['plugins_'.$value], + 'link' => 'settings_plugins_'.$value + ); + } +} + +LinAdmin::printAdminMenu($array_menu,$cat3); +?> + +<form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=settings_plugins_'.$cat3; ?>"> +<?php +if($cat3=='enable') +{ + foreach( $arrPlugins as $key=>$value) + { + if(isset($LinAdmin->option_value_system['plugins_'.$value.'_enable'])) { + $optionValue = $LinAdmin->option_value_system['plugins_'.$value.'_enable']; + } else { + $optionValue = '0'; + } + + $LinAdmin->printAdminConfig( + 'radio', + $LinAdmin->getDescriptionByOptionName('plugins_'.$value), + 'plugins_'.$value.'_enable', + $optionValue + ); + } +} +elseif(in_array($cat3,$arrPlugins)) // prevent including evil file +{ + $includeFile = LINPHA_DIR.'/lib/plugins/'.$cat3.'/settings.'.$cat3.'.php'; + if( file_exists($includeFile)) + { + include_once($includeFile); + } +} + ?> \ No newline at end of file Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/docs/dev/TODO.txt 2008-02-06 23:25:59 UTC (rev 4854) @@ -29,11 +29,6 @@ - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big -- php session - limit the session cookie not only to domain, but also to full url path - we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 - -> session_set_cookie_params() - ## Big Todos - Switch to strict mode @@ -115,6 +110,12 @@ DONE ############################################################################ +- php session + limit the session cookie not only to domain, but also to full url path + we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 + -> session_set_cookie_params() + + - 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 ); Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/install/step11_finish.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -57,8 +57,11 @@ echo "Adding linpha admin user... "; $result = $linpha->db->Execute("INSERT INTO ".LIN_PREFIX."users (username, password, user_email) VALUES (" . "'".LinSql::linAddslashes($_POST['admin_name'])."', " . - "'".md5($_POST['admin_pass'])."', " . + "'".$linpha->sql->getPWHash($_POST['admin_pass'])."', " . "'".LinSql::linAddslashes($_POST['admin_email'])."')"); + + unset($_POST['admin_pass'],$_REQUEST['admin_pass']); + if(!$result) { echo failed_msg(); Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -314,7 +314,7 @@ 'sys_style_image_height', 'sys_style_image_nrprevnextthumbs', - 'sys_user_autologin' + 'sys_session_autologin' ); }*/ @@ -346,7 +346,8 @@ 'sys_style_home_usedefaultwelcometext', 'sys_style_thumb_showsubfoldersseparate', 'sys_style_image_useeffects', - 'sys_user_autologin', + 'sys_session_autologin', + 'sys_session_ipcheck', 'plugins_filemanager_enable', 'plugins_guestbook_enable', Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -213,7 +213,7 @@ */ $GLOBALS['linpha']->template = new linTemplate(); global $linTpl; - $linTpl = $GLOBALS['linpha']->template; + $linTpl = $GLOBALS['linpha']->template; // this is just a reference linIncludeLanguageFile(); @@ -263,34 +263,60 @@ */ if (session_id() == '') { - session_name('linpha2'); + if (empty($GLOBALS['linpha']->sql->config->value['sys_session_name'])) { + session_name('linpha2'); + } else { + session_name($GLOBALS['linpha']->sql->config->value['sys_session_name']); + } + + if (!empty($GLOBALS['linpha']->sql->config->value['sys_session_cookiepath'])) { + switch($GLOBALS['linpha']->sql->config->value['sys_session_cookiepath']) + { + case 'unchanged': + break; + case 'auto': + $path = LINPHA_LINK; + if (substr($path,strlen($path)-2)=='/?') { + $path = substr($path,0,strlen($path)-2); + } + session_set_cookie_params(0,$path); + break; + case 'root': + case 'top': + session_set_cookie_params(0,'/'); + break; + default: + session_set_cookie_params(0,$GLOBALS['linpha']->sql->config->value['sys_session_cookiepath']); + break; + } + } + session_start(); } /** * read cookie */ - if($this->config->value['sys_user_autologin']) { - if(!isset($_SESSION['user_name']) && - isset($_COOKIE['linpha_userid'])&&$_COOKIE['linpha_userid']!=""&& - isset($_COOKIE['linpha_password'])&&$_COOKIE['linpha_password']!="") + if ($this->config->value['sys_session_autologin'] + && !isset($_SESSION['user_name']) + && isset($_COOKIE['linpha_userid']) && $_COOKIE['linpha_userid']!="" + && isset($_COOKIE['linpha_password']) && $_COOKIE['linpha_password']!="") + { + $query = $GLOBALS['linpha']->db->Execute("SELECT username, password, display_name FROM ".LIN_PREFIX."users ". + "WHERE id = '".LinSql::linAddslashes($_COOKIE['linpha_userid'])."' ". + "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); + if($data = $query->FetchRow()) { - $query = $GLOBALS['linpha']->db->Execute("SELECT username, display_name FROM ".LIN_PREFIX."users ". - "WHERE id = '".LinSql::linAddslashes($_COOKIE['linpha_userid'])."' ". - "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); - if($data = $query->FetchRow()) - { - linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$_POST['username'].': successfully logged in.'); - linSysLog(i18n("Successfully Logged In!")); - - $this->setUserInformation($data['username'],$_COOKIE['linpha_userid'],$data['display_name']); - } - else // wrong cookie - { - setcookie('linpha_userid'); // delete cookie linpha_userid - setcookie('linpha_password'); // delete cookie linpha_password - } + linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$data['username'].': successfully logged in (cookie).'); + linSysLog(i18n("Successfully Logged In!")); + + $this->setUserInformation($data['username'],$_COOKIE['linpha_userid'],$data['display_name']); } + else // wrong cookie + { + setcookie('linpha_userid'); // delete cookie linpha_userid + setcookie('linpha_password'); // delete cookie linpha_password + } } /** @@ -331,10 +357,12 @@ /** * get user from DB */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, id, display_name FROM ".LIN_PREFIX."users ". + $data = $GLOBALS['linpha']->db->GetRow("SELECT id, username, password, display_name FROM ".LIN_PREFIX."users ". "WHERE username='".LinSql::linAddslashes($_POST['username'])."'"); - if( isset($data['username']) && isset($data['password']) && $_POST['username'] == $data['username'] && md5($_POST['password']) == $data['password']) + if ( isset($data['username']) && isset($data['password']) + && $_POST['username'] == $data['username'] + && $this->compareHash($data['id'], $_POST['password'], $data['password']) ) { /** * sucessfull login @@ -345,8 +373,9 @@ $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); - if(isset($_POST['rememberme'])) { - $this->setLinphaCookie($data['id'], md5($_POST['password'])); + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin'] + && isset($_POST['rememberme'])) { + $this->setLinphaCookie($data['id'], $data['password']); // this should be the updated hash (when needed) from compareHash() (call by reference) } /** @@ -375,11 +404,15 @@ $this->isAdmin = false; if(isset($_SESSION['user_id']) && isset($_SESSION['user_name']) && !empty($_SESSION['user_id']) && !empty($_SESSION['user_name']) ) { - if( isset($_SERVER['REMOTE_ADDR']) && ($_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) ) + if( $GLOBALS['linpha']->sql->config->value['sys_session_ipcheck'] && + isset($_SERVER['REMOTE_ADDR']) && ($_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) ) { /** * ip check wrong! */ + linLog(LOG_TYPE_USER,LOG_WARNING,'login','IP Check failed for '.$_SESSION['user_name']. + '. Session IP: '.$_SESSION['REMOTE_ADDR'].', Current IP: '.$_SERVER['REMOTE_ADDR']); + $this->isLoggedIn=false; $_SESSION = array(); @@ -601,6 +634,66 @@ } } + function getPWHash($pw) + { + require(LINPHA_DIR.'/lib/iha/iha.php'); + $iha = new iha(); + + /** + * see not below + $sql_dir = ''; + require_once( LINPHA_DIR.'/var/config.dir.php' ); + $hash_secret = ''; + require_once( LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php' ); + $iha->password = $hash_secret;*/ + + return $iha->hash($pw); + } + function compareHash($userid,$pw,&$hash) + { + if (strlen($hash)==32) // old md5 hash is used + { + if (md5($pw)==$hash) + { + // update old hash + $hash = $this->getPWHash($pw); + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."users " . + "SET password = '".LinSql::linAddslashes($hash)."' " . + "WHERE id = '".LinSql::linAddslashes($userid)."'"); + + return true; + } + else + { + return false; + } + } + else + { + require(LINPHA_DIR.'/lib/iha/iha.php'); + $iha = new iha(); + + /** + * @TODO + * $hash_secret not used at the moment + * it has 2 main disadvantages: + * - we would have to change require_once(config.sql.php) to require(config.sql.php) + * - if the admin deletes the file config.sql.php users will not never be able to authenticate + * - it does not make sense to store the $hash_secret in the database instead of a file, + * this would be no additional security! + $sql_dir = ''; + require_once( LINPHA_DIR.'/var/config.dir.php' ); + $hash_secret = ''; + require_once( LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php' ); + $iha->password = $hash_secret;*/ + + if ($iha->compare($pw, $hash)) + return true; + else + return false; + } + } + /** * other stuff */ @@ -777,7 +870,7 @@ * * @uses LinSql::startSession */ - function setLinphaCookie($userid, $md5pw) + function setLinphaCookie($userid, $pwhash) { /** * calculate correct path for cookie @@ -829,7 +922,7 @@ * set the cookie */ setcookie("linpha_userid", $userid, (time() + 60 * 60 * 24 * 31), $php_self_dir); - setcookie("linpha_password", $md5pw, (time() + 60 * 60 * 24 * 31), $php_self_dir); + setcookie("linpha_password", $pwhash, (time() + 60 * 60 * 24 * 31), $php_self_dir); } } // end class LinSql Modified: trunk/linpha2/lib/include/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.data.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.data.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -53,6 +53,11 @@ 'sys_path_tmp_dir' => $_SESSION['tmp_dir'], 'sys_path_install_dir' => 'install', + 'sys_session_autologin' => '1', + 'sys_session_ipcheck' => '1', + 'sys_session_cookiepath' => 'unchanged', + 'sys_session_name' => 'linpha2', + 'sys_basket_mail_max_size' => (1024*1024*2), 'sys_basket_mail_smpthost' => 'localhost', 'sys_basket_download_limit' => '0', @@ -95,8 +100,6 @@ 'sys_style_layout_title' => 'Linpha 2.0', 'sys_style_others_sortorder' => 'nameasc', - - 'sys_user_autologin' => '1', ); $options_user_overrideable = Array( Modified: trunk/linpha2/lib/include/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -33,7 +33,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id INT NOT NULL AUTO_INCREMENT , " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INT default '0', " . Modified: trunk/linpha2/lib/include/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id NUMBER PRIMARY KEY, " . "username VARCHAR2(255) NOT NULL, " . - "password VARCHAR2(32) NOT NULL, " . + "password VARCHAR2(255) NOT NULL, " . "user_email VARCHAR2(255) NOT NULL, " . "display_name VARCHAR2(255), " . "stats_downloads NUMBER(10) DEFAULT '0', " . Modified: trunk/linpha2/lib/include/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id SERIAL PRIMARY KEY, " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INT NOT NULL default 0 , " . Modified: trunk/linpha2/lib/include/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -32,7 +32,7 @@ "CREATE TABLE ".$linpha_tables['users']." ( ". "id INTEGER PRIMARY KEY, " . "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(32) NOT NULL default '' , " . + "password VARCHAR(255) NOT NULL default '' , " . "user_email VARCHAR(255) NOT NULL default '' , " . "display_name VARCHAR(255) NOT NULL default '' , " . "stats_downloads INTEGER NOT NULL default '0' , " . Modified: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/reset_database.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -106,7 +106,7 @@ unset($error_nr); } - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."users (username, password) VALUES ('root','".md5('test')."')"); + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."users (username, password) VALUES ('root','".$linpha->sql->getPWHash('test')."')"); $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."user_group (user_id, group_id) VALUES ('1','1')"); Modified: trunk/linpha2/templates/default/fragments.php =================================================================== --- trunk/linpha2/templates/default/fragments.php 2008-02-06 20:50:49 UTC (rev 4853) +++ trunk/linpha2/templates/default/fragments.php 2008-02-06 23:25:59 UTC (rev 4854) @@ -56,7 +56,7 @@ <br /> <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> - <?php if($GLOBALS['linpha']->sql->config->value['sys_user_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> + <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> <input type="hidden" name="cmd" value="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> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-07 20:43:39
|
Revision: 4856 http://linpha.svn.sourceforge.net/linpha/?rev=4856&view=rev Author: fangehrn Date: 2008-02-07 12:43:31 -0800 (Thu, 07 Feb 2008) Log Message: ----------- 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.sql.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/ChangeLog 2008-02-07 20:43:31 UTC (rev 4856) @@ -1,4 +1,7 @@ +2008-02-07 flo + * AdoDB updated to version 503 + * fixed adodb error handler 2008-02-06 flo * common.php/linpha.class.php Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/docs/dev/TODO.txt 2008-02-07 20:43:31 UTC (rev 4856) @@ -24,8 +24,6 @@ - should enable browsers cache for the thumbnails and maybe also for the images -- fix (adodb) error handler - - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big @@ -85,7 +83,7 @@ ############################################################################ Open questions ############################################################################ - + - thumbnail size, set a max size (for example 150px), to be able to switch the size on fly @@ -110,6 +108,8 @@ DONE ############################################################################ +- fix (adodb) error handler + - php session limit the session cookie not only to domain, but also to full url path we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -30,13 +30,13 @@ */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { - if (error_reporting() == 0) return; // obey @ protocol + //if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': $sql = $p1; $inputparams = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")"; break; case 'PCONNECT': @@ -44,10 +44,10 @@ $host = $p1; $database = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)"; break; default: - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)"; break; } /* @@ -64,16 +64,26 @@ * and optionally, port number, of the socket receiving the debug information. * 3 message is appended to the file destination */ - if (defined('ADODB_ERROR_LOG_TYPE')) { + /*if (defined('ADODB_ERROR_LOG_TYPE')) { $t = date('Y-m-d H:i:s'); if (defined('ADODB_ERROR_LOG_DEST')) error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST); else error_log("($t) $s", ADODB_ERROR_LOG_TYPE); - } + }*/ //print "<p>$s</p>"; - trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + //trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + + /** + * if adodb errorhandler is used, the function $db->ErrorMsg() does not work + * anymore + * -> output the error to screen + * -> no need anymore for : + * if(!$create) { echo $GLOBALS['db']->ErrorMsg().'<br />'; } + */ + echo $s.'<br />'; + linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } ?> Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -594,9 +594,11 @@ /** * don't trust $text (contains $_GET and $_POST data) * see also linpha advisory http://secunia.com/advisories/18808/ - * and for more details http://retrogod.altervista.org/linpha_10_local.html + * and for more details http://retrogod.altervista.org/linpha_10_local.html + * + * still use this even if file has a random name, its to dangerous to */ - $text = htmlspecialchars($text, ENT_QUOTES); + $text = htmlentities($text, ENT_QUOTES); /** * Process Log Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -46,6 +46,7 @@ if(isset($_SESSION['installmode1'])) { + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); $db_type = $_SESSION['sql_dbtype']; $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; @@ -56,9 +57,9 @@ } else { - error_reporting(0); - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); - + error_reporting(0); + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); + /** * if this file does not exists we already switch to installer */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-07 23:22:55
|
Revision: 4857 http://linpha.svn.sourceforge.net/linpha/?rev=4857&view=rev Author: fangehrn Date: 2008-02-07 15:22:46 -0800 (Thu, 07 Feb 2008) Log Message: ----------- 2008-02-07 flo * Important: the define ADODB_FETCH_ASSOC never worked now it is enabled and maybe some queries are broken..? -> imgview broken because of $db->GetAssoc() * Added benchmark module * Enabled adodb's logSql() function -> perf.php analysis all sql queries Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/common.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php Added Paths: ----------- trunk/linpha2/lib/adodb/docs/ trunk/linpha2/lib/adodb/docs/docs-active-record.htm trunk/linpha2/lib/adodb/docs/docs-adodb.htm trunk/linpha2/lib/adodb/docs/docs-datadict.htm trunk/linpha2/lib/adodb/docs/docs-oracle.htm trunk/linpha2/lib/adodb/docs/docs-perf.htm trunk/linpha2/lib/adodb/docs/docs-session.htm trunk/linpha2/lib/adodb/docs/docs-session.old.htm trunk/linpha2/lib/adodb/docs/old-changelog.htm trunk/linpha2/lib/adodb/docs/readme.htm trunk/linpha2/lib/adodb/docs/tips_portable_sql.htm trunk/linpha2/lib/adodb/docs/tute.htm trunk/linpha2/lib/adodb/perf/ trunk/linpha2/lib/adodb/perf/perf-db2.inc.php trunk/linpha2/lib/adodb/perf/perf-informix.inc.php trunk/linpha2/lib/adodb/perf/perf-mssql.inc.php trunk/linpha2/lib/adodb/perf/perf-mysql.inc.php trunk/linpha2/lib/adodb/perf/perf-oci8.inc.php trunk/linpha2/lib/adodb/perf/perf-postgres.inc.php trunk/linpha2/lib/modules/module.benchmark.php trunk/linpha2/logsql.txt trunk/linpha2/perf.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-07 20:43:31 UTC (rev 4856) +++ trunk/linpha2/ChangeLog 2008-02-07 23:22:46 UTC (rev 4857) @@ -2,6 +2,12 @@ 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler + * Important: the define ADODB_FETCH_ASSOC never worked + now it is enabled and maybe some queries are broken..? + -> imgview broken because of $db->GetAssoc() + * Added benchmark module + * Enabled adodb's logSql() function + -> perf.php analysis all sql queries 2008-02-06 flo * common.php/linpha.class.php Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-07 20:43:31 UTC (rev 4856) +++ trunk/linpha2/index.php 2008-02-07 23:22:46 UTC (rev 4857) @@ -67,11 +67,13 @@ case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; +case 'benchmark': + require_once(LINPHA_DIR.'/lib/modules/module.benchmark.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; - - + default: // include plugins $pluginDir = LINPHA_DIR.'/lib/plugins'; Added: trunk/linpha2/lib/adodb/docs/docs-active-record.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-active-record.htm (rev 0) +++ trunk/linpha2/lib/adodb/docs/docs-active-record.htm 2008-02-07 23:22:46 UTC (rev 4857) @@ -0,0 +1,544 @@ +<html> +<style> +pre { + background-color: #eee; + padding: 0.75em 1.5em; + font-size: 12px; + border: 1px solid #ddd; +} + +li,p { +font-family: Arial, Helvetica, sans-serif ; +} +</style> +<title>ADOdb Active Record</title> +<body> +<h1>ADOdb Active Record</h1> +<p> (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This + means you can use it in compiled proprietary and commercial products.</font></p> +<p><hr> +<ol> + +<h3><li>Introduction</h3> +<p> +ADOdb_Active_Record is an Object Relation Mapping (ORM) implementation using PHP. In an ORM system, the tables and rows of the database are abstracted into native PHP objects. This allows the programmer to focus more on manipulating the data and less on writing SQL queries. +<p> +This implementation differs from Zend Framework's implementation in the following ways: +<ul> +<li>Works with PHP4 and PHP5 and provides equivalent functionality in both versions of PHP.<p> +<li>ADOdb_Active_Record works when you are connected to multiple databases. Zend's only works when connected to a default database.<p> +<li>Support for $ADODB_ASSOC_CASE. The field names are upper-cased, lower-cased or left in natural case depending on this setting.<p> +<li>No field name conversion to camel-caps style, unlike Zend's implementation which will convert field names such as 'first_name' to 'firstName'.<p> +<li>NewADOConnection::GetActiveRecords() and ADOConnection::GetActiveRecordsClass() functions in adodb.inc.php.<p> +<li>Caching of table metadata so it is only queried once per table, no matter how many Active Records are created.<p> +<li>The additional functionality is described <a href=#additional>below</a>. +</ul> +<P> +ADOdb_Active_Record is designed upon the principles of the "ActiveRecord" design pattern, which was first described by Martin Fowler. The ActiveRecord pattern has been implemented in many forms across the spectrum of programming languages. ADOdb_Active_Record attempts to represent the database as closely to native PHP objects as possible. +<p> +ADOdb_Active_Record maps a database table to a PHP class, and each instance of that class represents a table row. Relations between tables can also be defined, allowing the ADOdb_Active_Record objects to be nested. +<p> + +<h3><li>Setting the Database Connection</h3> +<p> +The first step to using ADOdb_Active_Record is to set the default connection that an ADOdb_Active_Record objects will use to connect to a database. + +<pre> +require_once('adodb/adodb-active-record.inc.php'); + +$db = NewADOConnection('mysql://root:pwd@localhost/dbname'); +ADOdb_Active_Record::SetDatabaseAdapter($db); +</pre> + +<h3><li>Table Rows as Objects</h3> +<p> +First, let's create a temporary table in our MySQL database that we can use for demonstrative purposes throughout the rest of this tutorial. We can do this by sending a CREATE query: + +<pre> +$db->Execute("CREATE TEMPORARY TABLE `persons` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name_first` varchar(100) NOT NULL default '', + `name_last` varchar(100) NOT NULL default '', + `favorite_color` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM; + "); + </pre> +<p> +ADOdb_Active_Record's are object representations of table rows. Each table in the database is represented by a class in PHP. To begin working with a table as a ADOdb_Active_Record, a class that extends ADOdb_Active_Records needs to be created for it. + +<pre> +class Person extends ADOdb_Active_Record{} +$person = new Person(); +</pre> + +<p> +In the above example, a new ADOdb_Active_Record object $person was created to access the "persons" table. Zend_Db_DataObject takes the name of the class, pluralizes it (according to American English rules), and assumes that this is the name of the table in the database. +<p> +This kind of behavior is typical of ADOdb_Active_Record. It will assume as much as possible by convention rather than explicit configuration. In situations where it isn't possible to use the conventions that ADOdb_Active_Record expects, options can be overridden as we'll see later. + +<h3><li>Table Columns as Object Properties</h3> +<p> +When the $person object was instantiated, ADOdb_Active_Record read the table metadata from the database itself, and then exposed the table's columns (fields) as object properties. +<p> +Our "persons" table has three fields: "name_first", "name_last", and "favorite_color". Each of these fields is now a property of the $person object. To see all these properties, use the ADOdb_Active_Record::getAttributeNames() method: +<pre> +var_dump($person->getAttributeNames()); + +/** + * Outputs the following: + * array(4) { + * [0]=> + * string(2) "id" + * [1]=> + * string(9) "name_first" + * [2]=> + * string(8) "name_last" + * [3]=> + * string(13) "favorite_color" + * } + */ + </pre> +<p> +One big difference between ADOdb and Zend's implementation is we do not automatically convert to camelCaps style. +<p> +<h3><li>Inserting and Updating a Record</h3><p> + +An ADOdb_Active_Record object is a representation of a single table row. However, when our $person object is instantiated, it does not reference any particular row. It is a blank record that does not yet exist in the database. An ADOdb_Active_Record object is considered blank when its primary key is NULL. The primary key in our persons table is "id". +<p> +To insert a new record into the database, change the object's properties and then call the ADOdb_Active_Record::save() method: +<pre> +$person = new Person(); +$person->nameFirst = 'Andi'; +$person->nameLast = 'Gutmans'; +$person->save(); + </pre> +<p> +Oh, no! The above code snippet does not insert a new record into the database. Instead, outputs an error: +<pre> +1048: Column 'name_first' cannot be null + </pre> +<p> +This error occurred because MySQL rejected the INSERT query that was generated by ADOdb_Active_Record. If exceptions are enabled in ADOdb and you are using PHP5, an error will be thrown. In the definition of our table, we specified all of the fields as NOT NULL; i.e., they must contain a value. +<p> +ADOdb_Active_Records are bound by the same contraints as the database tables they represent. If the field in the database cannot be NULL, the corresponding property in the ADOdb_Active_Record also cannot be NULL. In the example above, we failed to set the property $person->favoriteColor, which caused the INSERT to be rejected by MySQL. +<p> +To insert a new ADOdb_Active_Record in the database, populate all of ADOdb_Active_Record's properties so that they satisfy the constraints of the database table, and then call the save() method: +<pre> +/** + * Calling the save() method will successfully INSERT + * this $person into the database table. + */ +$person = new Person(); +$person->name_first = 'Andi'; +$person->name_last = 'Gutmans'; +$person->favorite_color = 'blue'; +$person->save(); +</pre> +<p> +Once this $person has been INSERTed into the database by calling save(), the primary key can now be read as a property. Since this is the first row inserted into our temporary table, its "id" will be 1: +<pre> +var_dump($person->id); + +/** + * Outputs the following: + * string(1) + */ + </pre> +<p> +From this point on, updating it is simply a matter of changing the object's properties and calling the save() method again: + +<pre> +$person->favorite_color = 'red'; +$person->save(); + </pre> +<p> +The code snippet above will change the favorite color to red, and then UPDATE the record in the database. + +<a name=additional> +<h2>ADOdb Specific Functionality</h2> +<h3><li>Setting the Table Name</h3> +<p>The default behaviour on creating an ADOdb_Active_Record is to "pluralize" the class name and + use that as the table name. Often, this is not the case. For example, the Person class could be reading + from the "People" table. +<p>We provide two ways to define your own table: +<p>1. Use a constructor parameter to override the default table naming behaviour. +<pre> + class Person extends ADOdb_Active_Record{} + $person = new Person('People'); +</pre> +<p>2. Define it in a class declaration: +<pre> + class Person extends ADOdb_Active_Record + { + var $_table = 'People'; + } + $person = new Person(); +</pre> + +<h3><li>$ADODB_ASSOC_CASE</h3> +<p>This allows you to control the case of field names and properties. For example, all field names in Oracle are upper-case by default. So you +can force field names to be lowercase using $ADODB_ASSOC_CASE. Legal values are as follows: +<pre> + 0: lower-case + 1: upper-case + 2: native-case +</pre> +<p>So to force all Oracle field names to lower-case, use +<pre> +$ADODB_ASSOC_CASE = 0; +$person = new Person('People'); +$person->name = 'Lily'; +$ADODB_ASSOC_CASE = 2; +$person2 = new Person('People'); +$person2->NAME = 'Lily'; +</pre> + +<p>Also see <a href=http://phplens.com/adodb/reference.constants.adodb_assoc_case.html>$ADODB_ASSOC_CASE</a>. + +<h3><li>ADOdb_Active_Record::Save()</h3> +<p> +Saves a record by executing an INSERT or UPDATE SQL statement as appropriate. +<p>Returns false on unsuccessful INSERT, true if successsful INSERT. +<p>Returns 0 on failed UPDATE, and 1 on UPDATE if data has changed, and -1 if no data was changed, so no UPDATE statement was executed. + +<h3><li>ADOdb_Active_Record::Replace()</h3> +<p> +ADOdb supports replace functionality, whereby the record is inserted if it does not exists, or updated otherwise. +<pre> +$rec = new ADOdb_Active_Record("product"); +$rec->name = 'John'; +$rec->tel_no = '34111145'; +$ok = $rec->replace(); // 0=failure, 1=update, 2=insert +</pre> + + +<h3><li>ADOdb_Active_Record::Load($where)</h3> +<p>Sometimes, we want to load a single record into an Active Record. We can do so using: +<pre> +$person->load("id=3"); + +// or using bind parameters + +$person->load("id=?", array(3)); +</pre> +<p>Returns false if an error occurs. + +<h3><li>ADOdb_Active_Record::Find($whereOrderBy, $bindarr=false, $pkeyArr=false)</h3> +<p>We want to retrieve an array of active records based on some search criteria. For example: +<pre> +class Person extends ADOdb_Active_Record { +var $_table = 'people'; +} + +$person = new Person(); +$peopleArray = $person->Find("name like ? order by age", array('Sm%')); +</pre> + +<h3><li>Error Handling and Debugging</h3> +<p> +In PHP5, if adodb-exceptions.inc.php is included, then errors are thrown. Otherwise errors are handled by returning a value. False by default means an error has occurred. You can get the last error message using the ErrorMsg() function. +<p> +To check for errors in ADOdb_Active_Record, do not poll ErrorMsg() as the last error message will always be returned, even if it occurred several operations ago. Do this instead: +<pre> +# right! +$ok = $rec->Save(); +if (!$ok) $err = $rec->ErrorMsg(); + +# wrong :( +$rec->Save(); +if ($rec->ErrorMsg()) echo "Wrong way to detect error"; +</pre> +<p>The ADOConnection::Debug property is obeyed. So +if $db->debug is enabled, then ADOdb_Active_Record errors are also outputted to standard output and written to the browser. + +<h3><li>ADOdb_Active_Record::Set()</h3> +<p>You can convert an array to an ADOdb_Active_Record using Set(). The array must be numerically indexed, and have all fields of the table defined in the array. The elements of the array must be in the table's natural order too. +<pre> +$row = $db->GetRow("select * from tablex where id=$id"); + +# PHP4 or PHP5 without enabling exceptions +$obj = new ADOdb_Active_Record('Products'); +if ($obj->ErrorMsg()){ + echo $obj->ErrorMsg(); +} else { + $obj->Set($row); +} + +# in PHP5, with exceptions enabled: + +include('adodb-exceptions.inc.php'); +try { + $obj = new ADOdb_Active_Record('Products'); + $obj->Set($row); +} catch(exceptions $e) { + echo $e->getMessage(); +} +</pre> +<p> +<h3><li>Primary Keys</h3> +<p> +ADOdb_Active_Record does not require the table to have a primary key. You can insert records for such a table, but you will not be able to update nor delete. +<p>Sometimes you are retrieving data from a view or table that has no primary key, but has a unique index. You can dynamically set the primary key of a table through the constructor, or using ADOdb_Active_Record::SetPrimaryKeys(): +<pre> + $pkeys = array('category','prodcode'); + + // set primary key using constructor + $rec = new ADOdb_Active_Record('Products', $pkeys); + + // or use method + $rec->SetPrimaryKeys($pkeys); +</pre> + + +<h3><li>Retrieval of Auto-incrementing ID</h3> +When creating a new record, the retrieval of the last auto-incrementing ID is not reliable for databases that do not support the Insert_ID() function call (check $connection->hasInsertID). In this case we perform a <b>SELECT MAX($primarykey) FROM $table</b>, which will not work reliably in a multi-user environment. You can override the ADOdb_Active_Record::LastInsertID() function in this case. + +<h3><li>Dealing with Multiple Databases</h3> +<p> +Sometimes we want to load data from one database and insert it into another using ActiveRecords. This can be done using the optional parameter of the ADOdb_Active_Record constructor. In the following example, we read data from db.table1 and store it in db2.table2: +<pre> +$db = NewADOConnection(...); +$db2 = NewADOConnection(...); + +ADOdb_Active_Record::SetDatabaseAdapter($db2); + +$activeRecs = $db->GetActiveRecords('table1'); + +foreach($activeRecs as $rec) { + $rec2 = new ADOdb_Active_Record('table2',$db2); + $rec2->id = $rec->id; + $rec2->name = $rec->name; + + $rec2->Save(); +} +</pre> +<p> +If you have to pass in a primary key called "id" and the 2nd db connection in the constructor, you can do so too: +<pre> +$rec = new ADOdb_Active_Record("table1",array("id"),$db2); +</pre> + +<h3><li>$ADODB_ACTIVE_CACHESECS</h3> +<p>You can cache the table metadata (field names, types, and other info such primary keys) in $ADODB_CACHE_DIR (which defaults to /tmp) by setting +the global variable $ADODB_ACTIVE_CACHESECS to a value greater than 0. This will be the number of seconds to cache. + You should set this to a value of 30 seconds or greater for optimal performance. + +<h3><li>Active Record Considered Bad?</h3> +<p>Although the Active Record concept is useful, you have to be aware of some pitfalls when using Active Record. The level of granularity of Active Record is individual records. It encourages code like the following, used to increase the price of all furniture products by 10%: +<pre> + $recs = $db->GetActiveRecords("Products","category='Furniture'"); + foreach($recs as $rec) { + $rec->price *= 1.1; // increase price by 10% for all Furniture products + $rec->save(); + } +</pre> +Of course a SELECT statement is superior because it's simpler and much more efficient (probably by a factor of x10 or more): +<pre> + $db->Execute("update Products set price = price * 1.1 where category='Furniture'"); +</pre> +<p>Another issue is performance. For performance sensitive code, using direct SQL will always be faster than using Active Records due to overhead and the fact that all fields in a row are retrieved (rather than only the subset you need) whenever an Active Record is loaded. + +<h3><li>Transactions</h3> +<p> +The default transaction mode in ADOdb is autocommit. So that is the default with active record too. +The general rules for managing transactions still apply. Active Record to the database is a set of insert/update/delete statements, and the db has no knowledge of active records. +<p> +Smart transactions, that does an auto-rollback if an error occurs, is still the best method to multiple activities (inserts/updates/deletes) that need to be treated as a single transaction: +<pre> +$conn->StartTrans(); +$parent->save(); +$child->save(); +$conn->CompleteTrans(); +</pre> + +<h2>ADOConnection Supplement</h2> + +<h3><li>ADOConnection::GetActiveRecords()</h3> +<p> +This allows you to retrieve an array of ADOdb_Active_Records. Returns false if an error occurs. +<pre> +$table = 'products'; +$whereOrderBy = "name LIKE 'A%' ORDER BY Name"; +$activeRecArr = $db->GetActiveRecords($table, $whereOrderBy); +foreach($activeRecArr as $rec) { + $rec->id = rand(); + $rec->save(); +} +</pre> +<p> +And to retrieve all records ordered by specific fields: +<pre> +$whereOrderBy = "1=1 ORDER BY Name"; +$activeRecArr = $db->ADOdb_Active_Records($table); +</pre> +<p> +To use bind variables (assuming ? is the place-holder for your database): +<pre> +$activeRecArr = $db->GetActiveRecords($tableName, 'name LIKE ?', + array('A%')); +</pre> +<p>You can also define the primary keys of the table by passing an array of field names: +<pre> +$activeRecArr = $db->GetActiveRecords($tableName, 'name LIKE ?', + array('A%'), array('id')); +</pre> + +<h3><li>ADOConnection::GetActiveRecordsClass()</h3> +<p> +This allows you to retrieve an array of objects derived from ADOdb_Active_Records. Returns false if an error occurs. +<pre> +class Product extends ADOdb_Active_Records{}; +$table = 'products'; +$whereOrderBy = "name LIKE 'A%' ORDER BY Name"; +$activeRecArr = $db->GetActiveRecordsClass('Product',$table, $whereOrderBy); + +# the objects in $activeRecArr are of class 'Product' +foreach($activeRecArr as $rec) { + $rec->id = rand(); + $rec->save(); +} +</pre> +<p> +To use bind variables (assuming ? is the place-holder for your database): +<pre> +$activeRecArr = $db->GetActiveRecordsClass($className,$tableName, 'name LIKE ?', + array('A%')); +</pre> +<p>You can also define the primary keys of the table by passing an array of field names: +<pre> +$activeRecArr = $db->GetActiveRecordsClass($className,$tableName, 'name LIKE ?', + array('A%'), array('id')); +</pre> + +</ol> + +<h3><li>ADOConnection::ErrorMsg()</h3> +<p>Returns last error message. +<h3><li>ADOConnection::ErrorNo()</h3> +<p>Returns last error number. +<h2>Code Sample</h2> +<p>The following works with PHP4 and PHP5 +<pre> +include('../adodb.inc.php'); +include('../adodb-active-record.inc.php'); + +// uncomment the following if you want to test exceptions +#if (PHP_VERSION >= 5) include('../adodb-exceptions.inc.php'); + +$db = NewADOConnection('mysql://root@localhost/northwind'); +$db->debug=1; +ADOdb_Active_Record::SetDatabaseAdapter($db); + +$db->Execute("CREATE TEMPORARY TABLE `persons` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name_first` varchar(100) NOT NULL default '', + `name_last` varchar(100) NOT NULL default '', + `favorite_color` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM; + "); + +class Person extends ADOdb_Active_Record{} +$person = new Person(); + +echo "<p>Output of getAttributeNames: "; +var_dump($person->getAttributeNames()); + +/** + * Outputs the following: + * array(4) { + * [0]=> + * string(2) "id" + * [1]=> + * string(9) "name_first" + * [2]=> + * string(8) "name_last" + * [3]=> + * string(13) "favorite_color" + * } + */ + +$person = new Person(); +$person->nameFirst = 'Andi'; +$person->nameLast = 'Gutmans'; +$person->save(); // this save() will fail on INSERT as favorite_color is a must fill... + + +$person = new Person(); +$person->name_first = 'Andi'; +$person->name_last = 'Gutmans'; +$person->favorite_color = 'blue'; +$person->save(); // this save will perform an INSERT successfully + +echo "<p>The Insert ID generated:"; print_r($person->id); + +$person->favorite_color = 'red'; +$person->save(); // this save() will perform an UPDATE + +$person = new Person(); +$person->name_first = 'John'; +$person->name_last = 'Lim'; +$person->favorite_color = 'lavender'; +$person->save(); // this save will perform an INSERT successfully + +// load record where id=2 into a new ADOdb_Active_Record +$person2 = new Person(); +$person2->Load('id=2'); +var_dump($person2); + +// retrieve an array of records +$activeArr = $db->GetActiveRecordsClass($class = "Person",$table = "persons","id=".$db->Param(0),array(2)); +$person2 = $activeArr[0]; +echo "<p>Name first (should be John): ",$person->name_first, "<br>Class = ",get_class($person2); +</pre> + + <h3>Todo (Code Contributions welcome)</h3> + <p>Check _original and current field values before update, only update changes. Also if the primary key value is changed, then on update, we should save and use the original primary key values in the WHERE clause! + <p>Handle 1-to-many relationships. + <p>PHP5 specific: Make GetActiveRecords*() return an Iterator. + <p>PHP5 specific: Change PHP5 implementation of Active Record to use __get() and __set() for better performance. + +<h3> Change Log</h3> +<p>0.08 +Added support for assoc arrays in Set(). + +<p>0.07 +<p>$ADODB_ASSOC_CASE=2 did not work properly. Fixed. +<p>Added === check in ADODB_SetDatabaseAdapter for $db, adodb-active-record.inc.php. Thx Christian Affolter. + +<p>0.06 +<p>Added ErrorNo(). +<p>Fixed php 5.2.0 compat issues. + +<p>0.05 +<p>If inserting a record and the value of a primary key field is null, then we do not insert that field in as +we assume it is an auto-increment field. Needed by mssql. + +<p>0.04 5 June 2006 <br> +<p>Added support for declaring table name in $_table in class declaration. Thx Bill Dueber for idea. +<p>Added find($where,$bindarr=false) method to retrieve an array of active record objects. + +<p>0.03 <br> +- Now we only update fields that have changed, using $this->_original.<br> +- We do not include auto_increment fields in replace(). Thx Travis Cline<br> +- Added ADODB_ACTIVE_CACHESECS.<br> + +<p>0.02 <br> +- Much better error handling. ErrorMsg() implemented. Throw implemented if adodb-exceptions.inc.php detected.<br> +- You can now define the primary keys of the view or table you are accessing manually.<br> +- The Active Record allows you to create an object which does not have a primary key. You can INSERT but not UPDATE in this case. +- Set() documented.<br> +- Fixed _pluralize bug with y suffix. + +<p> + 0.01 6 Mar 2006<br> +- Fixed handling of nulls when saving (it didn't save nulls, saved them as '').<br> +- Better error handling messages.<br> +- Factored out a new method GetPrimaryKeys().<br> + <p> + 0.00 5 Mar 2006<br> + 1st release +</body> +</html> \ No newline at end of file Added: trunk/linpha2/lib/adodb/docs/docs-adodb.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-adodb.htm (rev 0) +++ trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-07 23:22:46 UTC (rev 4857) @@ -0,0 +1,3627 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><title>ADODB Manual</title> + +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + +<style> +pre { + background-color: #eee; + padding: 0.75em 1.5em; + font-size: 12px; + border: 1px solid #ddd; +} +</style></head> +<body bgcolor="#ffffff" text="black"> + +<h2>ADOdb Library for PHP</h2> +<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This + means you can use it in compiled proprietary and commercial products.</font></p> + + + <p>Useful ADOdb links: <a href="http://adodb.sourceforge.net/#download">Download</a> <a href="http://adodb.sourceforge.net/#docs">Other Docs</a> + +</p><p><a href="#intro"><b>Introduction</b></a><b><br> + <a href="#features">Unique Features</a><br> + <a href="#users">How People are using ADOdb</a><br> + <a href="#bugs">Feature Requests and Bug Reports</a><br> + </b><b><a href="#install">Installation</a><br> + <a href="#mininstall">Minimum Install</a><br> + <a href="#coding">Initializing Code and Connectioning to Databases</a><br> + </b><font size="2"> <a href="#dsnsupport">Data Source Name (DSN) Support</a></font> <a href="#connect_ex">Connection Examples</a> <br> + <b><a href="#speed">High Speed ADOdb - tuning tips</a></b><br> + <b><a href="#hack">Hacking and Modifying ADOdb Safely</a><br> + <a href="#php5">PHP5 Features</a></b><br> + <font size="2"><a href="#php5iterators">foreach iterators</a> <a href="#php5exceptions">exceptions</a></font><br> + <b> <a href="#drivers">Supported Databases</a></b><br> + <b> <a href="#quickstart">Tutorials</a></b><br> + <a href="#ex1">Example 1: Select</a><br> + <a href="#ex2">Example 2: Advanced Select</a><br> + <a href="#ex3">Example 3: Insert</a><br> + <a href="#ex4">Example 4: Debugging</a> <a href="#exrs2html">rs2html + example</a><br> + <a href="#ex5">Example 5: MySQL and Menus</a><br> + <a href="#ex6">Example 6: Connecting to Multiple Databases at once</a> <br> + <a href="#ex7">Example 7: Generating Update and Insert SQL</a> <br> + <a href="#ex8">Example 8: Implementing Scrolling with Next and Previous</a><br> + <a href="#ex9">Example 9: Exporting in CSV or Tab-Delimited Format</a> <br> + <a href="#ex10">Example 10: Custom filters</a><br> + <a href="#ex11">Example 11: Smart Transactions</a><br> + <br> + <b> <a href="#errorhandling">Using Custom Error Handlers and PEAR_Error</a><br> + <a href="#DSN">Data Source Names</a><br> + <a href="#caching">Caching</a><br> + <a href="#pivot">Pivot Tables</a></b> +</p><p><a href="#ref"><b>REFERENCE</b></a> +</p><p> <font size="2">Variables: <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> +<a href="#adodb_ansi_padding_off">$ADODB_ANSI_PADDING_OFF</a> + <a href="#adodb_cache_dir">$ADODB_CACHE_DIR</a> <br> + <a href="#force_type">$ADODB_FORCE_TYPE</a> + <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> + <a href="#adodb_lang">$ADODB_LANG</a> <a href=#adodb_auto_quote>ADODB_QUOTE_FIELDNAMES</a> <br> + Constants: </font><font size="2"><a href="#adodb_assoc_case">ADODB_ASSOC_CASE</a> + </font><br> + <a href="#ADOConnection"><b> ADOConnection</b></a><br> + <font size="2">Connections: <a href="#connect">Connect</a> <a href="#pconnect">PConnect</a> + <a href="#nconnect">NConnect</a> <a href="#isconnected">IsConnected</a><br> + Executing SQL: <a href="#execute">Execute</a> <a href="#cacheexecute"><i>CacheExecute</i></a> + <a href="#selectlimit">SelectLimit</a> <a href="#cacheSelectLimit"><i>CacheSelectLimit</i></a> + <a href="#param">Param</a> <a href="#prepare">Prepare</a> <a href="#preparesp">PrepareSP</a> + <a href="#inparameter">InParameter</a> <a href="#outparameter">OutParameter</a> <a href="#autoexecute">AutoExecute</a> + <br> + <a href="#getone">GetOne</a> + <a href="#cachegetone"><i>CacheGetOne</i></a> <a href="#getrow">GetRow</a> <a href="#cachegetrow"><i>CacheGetRow</i></a> + <a href="#getall">GetAll</a> <a href="#cachegetall"><i>CacheGetAll</i></a> <a href="#getcol">GetCol</a> + <a href="#cachegetcol"><i>CacheGetCol</i></a> <a href="#getassoc1">GetAssoc</a> <a href="#cachegetassoc"><i>CacheGetAssoc</i></a> <a href="#replace">Replace</a> + <br> + <a href="#executecursor">ExecuteCursor</a> + (oci8 only)<br> + Generates SQL strings: <a href="#getupdatesql">GetUpdateSQL</a> <a href="#getinsertsql">GetInsertSQL</a> + <a href="#concat">Concat</a> <a href="#ifnull">IfNull</a> <a href="#length">length</a> <a href="#random">random</a> <a href="#substr">substr</a> + <a href="#qstr">qstr</a> <a href="#param">Param</a> <a href="#OffsetDate">OffsetDate</a> <a href="#sqldate">SQLDate</a> + <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> + <a href="#binddate">BindDate</a> <a href="#bindtimestamp">BindTimeStamp</a> + <br> + Blobs: <a href="#updateblob">UpdateBlob</a> <a href="#updateclob">UpdateClob</a> + <a href="#updateblobfile">UpdateBlobFile</a> <a href="#blobencode">BlobEncode</a> + <a href="#blobdecode">BlobDecode</a><br> + Paging/Scrolling: <a href="#pageexecute">PageExecute</a> <a href="#cachepageexecute">CachePageExecute</a><br> + Cleanup: <a href="#cacheflush">CacheFlush</a> <a href="#Close">Close</a><br> + Transactions: <a href="#starttrans">StartTrans</a> <a href="#completetrans">CompleteTrans</a> + <a href="#failtrans">FailTrans</a> <a href="#hasfailedtrans">HasFailedTrans</a> + <a href="#begintrans">BeginTrans</a> <a href="#committrans">CommitTrans</a> + <a href="#rollbacktrans">RollbackTrans</a> <a href=#SetTransactionMode>SetTransactionMode</a><br> + Fetching Data: </font> <font size="2"><a href="#setfetchmode">SetFetchMode</a><br> + Strings: <a href="#concat">concat</a> <a href="#length">length</a> <a href="#qstr">qstr</a> <a href="#quote">quote</a> <a href="#substr">substr</a><br> + Dates: <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a href="#unixdate">UnixDate</a> + <a href="#binddate">BindDate</a> <a href="#bindtimestamp">BindTimeStamp</a> + <a href="#unixtimestamp">UnixTimeStamp</a> <a href="#OffsetDate">OffsetDate</a> + <a href="#SQLDate">SQLDate</a> <br> + Row Management: <a href="#affected_rows">Affected_Rows</a> <a href="#inserted_id">Insert_ID</a> <a href="#rowlock">RowLock</a> + <a href="#genid">GenID</a> <a href="#createseq">CreateSequence</a> <a href="#dropseq">DropSequence</a> + <br> + Error Handling: <a href="#errormsg">ErrorMsg</a> <a href="#errorno">ErrorNo</a> + <a href="#metaerror">MetaError</a> <a href="#metaerrormsg">MetaErrorMsg</a> <a href="#ignoreerrors">IgnoreErrors</a><br> + Data Dictionary (metadata): <a href="#metadatabases">MetaDatabases</a> <a href="#metatables">MetaTables</a> + <a href="#metacolumns">MetaColumns</a> <a href="#metacolumnames">MetaColumnNames</a> + <a href="#metaprimarykeys">MetaPrimaryKeys</a> <a href="#metaforeignkeys">MetaForeignKeys</a> + <a href="#serverinfo">ServerInfo</a> <br> + Statistics and Query-Rewriting: <a href="#logsql">LogSQL</a> <a href="#fnexecute">fnExecute + and fnCacheExecute</a><br> + </font><font size="2">Deprecated: <a href="#bind">Bind</a> <a href="#blankrecordset">BlankRecordSet</a> + <a href="#parameter">Parameter</a></font> + <a href="#adorecordSet"><b><br> + ADORecordSet</b></a><br> + <font size="2"> + Returns one field: <a href="#fields">Fields</a><br> + Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a> + <a href="#fetchobject">FetchObject</a> <a href="#fetchnextobject">FetchNextObject</a> + <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a> + <a href="#getrowassoc">GetRowAssoc</a> <br> + Returns all rows:<a href="#getarray">GetArray</a> <a href="#getrows">GetRows</a> + <a href="#getassoc">GetAssoc</a><br> + Scrolling:<a href="#move">Move</a> <a href="#movenext">MoveNext</a> <a href="#movefirst">MoveFirst</a> + <a href="#movelast">MoveLast</a> <a href="#abspos">AbsolutePosition</a> <a href="#currentrow">CurrentRow</a> + <a href="#atfirstpage">AtFirstPage</a> <a href="#atlastpage">AtLastPage</a> + <a href="#absolutepage">AbsolutePage</a> </font> <font size="2"><br> + Menu generation:<a href="#getmenu">GetMenu</a> <a href="#getmenu2">GetMenu2</a><br> + Dates:<a href="#userdate">UserDate</a> <a href="#usertimestamp">UserTimeStamp</a> + <a href="#unixdate">UnixDate</a> <a href="#unixtimestamp">UnixTimeStamp<br> + </a>Recordset Info:<a href="#recordcount">RecordCount</a> <a href="#po_recordcount">PO_RecordCount</a> + <a href="#nextrecordset">NextRecordSet</a><br> + Field Info:<a href="#fieldcount">FieldCount</a> <a href="#fetchfield">FetchField</a> + <a href="#metatype">MetaType</a><br> + Cleanup: <a href="#rsclose">Close</a></font> +</p> +<p><font size="2"><a href="#rs2html"><b>rs2html</b></a> <a href="#exrs2html">example</a></font><br> + <a href="#adodiff">Differences between ADOdb and ADO</a><br> + <a href="#driverguide"><b>Database Driver Guide<br> + </b></a><b><a href="#changes">Change Log</a></b><br> +</p> +<h2>Introduction<a name="intro"></a></h2> +<p>PHP's database access functions are not standardised. This creates a need for + a database class library to hide the differences between the different database + API's (encapsulate the differences) so we can easily switch databases. PHP 4.0.5 or later + is now required (because we use array-based str_replace).</p> +<p>We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, Informix, + PostgreSQL, FrontBase, SQLite, Interbase (Firebird and Borland variants), Foxpro, Access, ADO, DB2, SAP DB and ODBC. + We have had successful reports of connecting to Progress and CacheLite via ODBC. We hope more people + will contribute drivers to support other databases.</p> +<p>PHP4 supports session variables. You can store your session information using + ADOdb for true portability and scalability. See adodb-session.php for more information.</p> +<p>Also read <a href="http://phplens.com/lens/adodb/tips_portable_sql.htm">tips_portable_sql.htm</a> + for tips on writing + portable SQL.</p> +<h2>Unique Features of ADOdb<a name="features"></a></h2> +<ul> + <li><b>Easy for Windows programmers</b> to adapt to because many of the conventions + are similar to Microsoft's ADO.</li> + <li>Unlike other PHP database classes which focus only on select statements, + <b>we provide support code to handle inserts and updates which can be adapted + to multiple databases quickly.</b> Methods are provided for date handling, + string concatenation and string quoting characters for differing databases.</li> + <li>A<b> metatype system </b>is built in so that we can figure out that types + such as CHAR, TEXT and STRING are equivalent in different databases.</li> + <li><b>Easy to port</b> because all the database dependant code are stored in + stub functions. You do not need to port the core logic of the classes.</li> + <li><b>Portable table and index creation</b> with the <a href="docs-datadict.htm">datadict</a> classes. + </li><li><b>Database performance monitoring and SQL tuning</b> with the <a href="docs-perf.htm">performance monitoring</a> classes. + </li><li><b>Database-backed sessions</b> with the <a href="docs-session.htm">session management</a> classes. Supports session expiry notification. +<li><b>Object-Relational Mapping</b> using <a href="docs-active-record.htm">ADOdb_Active_Record</a> classes. +</li></ul> +<h2>How People are using ADOdb<a name="users"></a></h2> +Here are some examples of how people are using ADOdb (for a much longer list, +visit <a href="http://phplens.com/phpeverywhere/adodb-cool-apps">adodb-cool-apps</a>): +<ul> +<li><a href="http://phplens.com/">PhpLens</a> is a commercial data grid +component that allows both cool Web designers and serious unshaved +programmers to develop and maintain databases on the Web easily. +Developed by the author of ADOdb.<p> + +</p></li><li><a href="http://www.interakt.ro/phakt/">PHAkt: PHP Extension for DreamWeaver Ultradev</a> allows you to script PHP in the popular Web page editor. Database handling provided by ADOdb.<p> + +</p></li><li><a href="http://www.andrew.cmu.edu/%7Erdanyliw/snort/snortacid.html">Analysis Console for Intrusion Databases</a> +(ACID): PHP-based analysis engine to search and process a database of +security incidents generated by security-related software such as IDSes +and firewalls (e.g. Snort, ipchains). By Roman Danyliw.<p> + +</p></li><li><a href="http://www.postnuke.com/">PostNuke</a> is a very +popular free content management system and weblog system. It offers +full CSS support, HTML 4.01 transitional compliance throughout, an +advanced blocks system, and is fully multi-lingual enabled. <p> + +</p></li><li><a href="http://www.auto-net.no/easypublish.php?page=index&lang_id=2">EasyPublish CMS</a> +is another free content management system for managing information and +integrated modules on your internet, intranet- and extranet-sites. From +Norway.<p> + +</p></li><li><a href="http://nola.noguska.com/">NOLA</a> is a full featured accounting, inventory, and job tracking application. It is licensed under the GPL, and developed by Noguska. +</li></ul><p> + +</p><h2>Feature Requests and Bug Reports<a name="bugs"></a></h2> +<p>Feature requests and bug reports can be emailed to <a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a> + or posted to the ADOdb Help forums at <a href="http://phplens.com/lens/lensforum/topics.php?id=4">http://phplens.com/lens/lensforum/topics.php?id=4</a>.</p> +<h2>Installation Guide<a name="install"></a></h2> +<p>Make sure you are running PHP 4.0.5 or later. + Unpack all the files into a directory accessible by your webserver.</p> +<p>To test, try modifying some of the tutorial examples. Make sure you customize + the connection settings correctly. You can debug using <i>$db->debug = true</i> as shown below:</p> +<pre><?php<br> include('adodb/adodb.inc.php');<br> $db = <a href="#adonewconnection">ADONewConnection</a>($dbdriver); # eg 'mysql' or 'postgres'<br> $db->debug = true;<br> $db-><a href="#connect">Connect</a>($server, $user, $password, $database);<br> $rs = $db-><a href="#execute">Execute</a>('select * from some_small_table');<br> print "<pre>";<br> print_r($rs-><a href="#getrows">GetRows</a>());<br> print "</pre>";<br>?></pre> + + <h3>Minimum Install<a name="mininstall"></a></h3> +<p>For developers who want to release a minimal install of ADOdb, you will need: +</p><ul> +<li>adodb.inc.php +</li><li>adodb-lib.inc.php +</li><li>adodb-time.inc.php +</li><li>drivers/adodb-$database.inc.php +</li><li>license.txt (for legal reasons) +</li><li>adodb-php4.inc.php +</li><li>adodb-iterator.inc.php (php5 functionality) +</li></ul> +Optional: +<ul> +<li>adodb-error.inc.php and lang/adodb-$lang.inc.php (if you use MetaError()) +</li><li>adodb-csvlib.inc.php (if you use cached recordsets - CacheExecute(), etc) +</li><li>adodb-exceptions.inc.php and adodb-errorhandler.inc.php (if you use adodb error handler or php5 exceptions). +<li>adodb-active-record.inc.php if you use <a href=docs-active-record.htm>Active Records</a>. +</li></ul> + +<h3>Code Initialization Examples<a name="coding"></a></h3> +<p>When running ADOdb, at least two files are loaded. First is adodb/adodb.inc.php, + which contains all functions used by all database classes. The code specific + to a particular database is in the adodb/driver/adodb-????.inc.php file.</p> + <a name="adonewconnection"></a> +<p>For example, to connect to a mysql database:</p> +<pre>include('/path/to/set/here/adodb.inc.php');<br>$conn =ADONewConnection('mysql');<br></pre> +<p>Whenever you need to connect to a database, you create a Connection object + using the <b>ADONewConnection</b>($driver) function. + <b>NewADOConnection</b>($driver) is an alternative name for the same function.</p> + +<p>At this point, you are not connected to the database (no longer true if you pass in a <a href="#dsnsupport">dsn</a>). You will first need to decide +whether to use <i>persistent</i> or <i>non-persistent</i> connections. The advantage of <i>persistent</i> +connections is that they are faster, as the database connection is never closed (even +when you call Close()). <i>Non-persistent </i>connections take up much fewer resources though, +reducing the risk of your database and your web-server becoming overloaded. +</p><p>For persistent connections, +use $conn-><a href="#pconnect">PConnect()</a>, + or $conn-><a href="#connect">Connect()</a> for non-persistent connections. +Some database drivers also support <a href="#nconnect">NConnect()</a>, which forces +the creation of a new connection. + +<a name="connection_gotcha"></a> +</p><p><b>Connection Gotcha</b>: If you create two connections, but both use the same userid and password, +PHP will share the same connection. This can cause problems if the connections are meant to +different databases. The solution is to always use different userid's for different databases, + or use NConnect(). + + <a name="dsnsupport"></a> + </p><h3>Data Source Name (DSN) Support</h3> + <p> Since ADOdb 4.51, you can connect to a database by passing a dsn to NewADOConnection() (or ADONewConnection, which is + the same function). The dsn format is: +</p><pre> $driver://$username:$password@hostname/$database?options[=value]<br></pre><p> +NewADOConnection() calls Connect() or PConnect() internally for you. If the connection fails, false is returned. +</p><pre> <font color="#008000"># non-persistent connection</font> + $dsn = 'mysql://root:pwd@localhost/mydb'; + $db = NewADOConnection($dsn); + if (!$db) die("Connection failed"); + + <font color="#008000"># no need to call connect/pconnect!</font> + $arr = $db->GetArray("select * from table"); + + <font color="#008000"># persistent connection</font> + $dsn2 = 'mysql://root:pwd@localhost/mydb?persist'; +</pre> +<p> +If you have special characters such as /:?_ in your dsn, then you need to rawurlencode them first: +</p><pre> $pwd = rawurlencode($pwd);<br> $dsn = "mysql://root:$pwd@localhost/mydb"; + $dsn2=rawurlencode("sybase_ase")."://user:pass@host/path?query";<br></pre> +<p> +Legal options are: +</p><p> +<table align="center" border="1"><tbody><tr><td>For all drivers</td><td> + 'persist', 'persistent', 'debug', 'fetchmode', 'new' + </td></tr><tr><td>Interbase/Firebird + </td><td> + 'dialect','charset','buffers','role' + </td></tr><tr><td>M'soft ADO</td><td> + 'charpage' + + </td></tr><tr><td>MySQL</td><td> + 'clientflags' +</td></tr><tr><td>MySQLi</td><td> + 'port', 'socket', 'clientflags' +</td></tr><tr><td>Oci8</td><td> + 'nls_date_format','charset' +</td></tr></tbody></table> +</p><p> +For all drivers, when the options <i>persist</i> or <i>persistent</i> are set, a persistent connection is forced; similarly, when <i>new</i> is set, then +a new connection will be created using NConnect if the underlying driver supports it. +The <i>debug</i> option enables debugging. The <i>fetchmode</i> calls <a href="#setfetchmode">SetFetchMode()</a>. +If no value is defined for an option, then the value is set to 1. +</p><p> +ADOdb DSN's are compatible with version 1.0 of PEAR DB's DSN format. +<a name="connect_ex"> +</a></p><h3><a name="connect_ex">Examples of Connecting to Databases</a></h3> +<h4><a name="connect_ex">MySQL and Most Other Database Drivers</a></h4> +<p><a name="connect_ex">MySQL connections are very straightforward, and the parameters are identical + to mysql_connect:</a></p> +<pre><a name="connect_ex"> $conn =ADONewConnection('mysql'); <br> $conn->PConnect('localhost','userid','password','database');<br> <br> <font color="#008000"># or dsn </font> + $dsn = 'mysql://user:pwd@localhost/mydb'; + $conn = ADONewConnection($dsn); # no need for Connect() + + <font color="#008000"># or persistent dsn</font> + $dsn = 'mysql://user:pwd@localhost/mydb?persist'; + $conn = ADONewConnection($dsn); # no need for PConnect() + + <font color="#008000"># a more complex example:</font> + $pwd = urlencode($pwd); + $flags = MYSQL_CLIENT_COMPRESS; + $dsn = "mysql://user:$pwd@localhost/mydb?persist&clientflags=$flags"; + $conn = ADONewConnection($dsn); # no need for PConnect() + </a></pre> +<p><a name="connect_ex"> For most drivers, you can use the standard function: Connect($server, $user, $password, $database), or +a </a><a href="dsnsupport">DSN</a> since ADOdb 4.51. Exceptions to this are listed below. +</p> +<a name=pdo> +<h4>PDO</h4> +<p>PDO, which only works with PHP5, accepts a driver specific connection string: +<pre> + $conn = NewADOConnection('pdo'); + $conn->Connect('mysql:host=localhost',$user,$pwd,$mydb); + $conn->Connect('mysql:host=localhost;dbname=mydb',$user,$pwd); + $conn->Connect("mysql:host=localhost;dbname=mydb;username=$user;password=$pwd"); +</pre> +<p>The DSN mechanism is also supported: +<pre> + $conn = NewADOConnection("pdo_mysql://user:pwd@localhost/mydb?persist"); # persist is optional +</pre> +<h4>PostgreSQL</h4> +<p>PostgreSQL 7 and 8 accepts connections using: </p> +<p>a. the standard connection string:</p> +<pre> $conn = ADONewConnection('postgres'); <br> $conn->PConnect('host=localhost port=5432 dbname=mary');</pre> +<p> b. the classical 4 parameters:</p> + <pre> $conn->PConnect('localhost','userid','password','database');<br> </pre> +<p>c. dsn: +</p><pre> $dsn = 'postgres://user:pwd@localhost/mydb?persist'; # persist is optional + $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<a name="ldap"></a> + + <h4>LDAP</h4> + <p>Here is an example of querying a LDAP server. Thanks to Josh Eldridge for the driver and this example: +</p><pre> +require('/path/to/adodb.inc.php'); + +/* Make sure to set this BEFORE calling Connect() */ +$LDAP_CONNECT_OPTIONS = Array( + Array ("OPTION_NAME"=>LDAP_OPT_DEREF, "OPTION_VALUE"=>2), + Array ("OPTION_NAME"=>LDAP_OPT_SIZELIMIT,"OPTION_VALUE"=>100), + Array ("OPTION_NAME"=>LDAP_OPT_TIMELIMIT,"OPTION_VALUE"=>30), + Array ("OPTION_NAME"=>LDAP_OPT_PROTOCOL_VERSION,"OPTION_VALUE"=>3), + Array ("OPTION_NAME"=>LDAP_OPT_ERROR_NUMBER,"OPTION_VALUE"=>13), + Array ("OPTION_NAME"=>LDAP_OPT_REFERRALS,"OPTION_VALUE"=>FALSE), + Array ("OPTION_NAME"=>LDAP_OPT_RESTART,"OPTION_VALUE"=>FALSE) +); +$host = 'ldap.baylor.edu'; +$ldapbase = 'ou=People,o=Baylor University,c=US'; + +$ldap = NewADOConnection( 'ldap' ); +$ldap->Connect( $host, $user_name='', $password='', $ldapbase ); + +echo "<pre>"; + +print_r( $ldap->ServerInfo() ); +$ldap->SetFetchMode(ADODB_FETCH_ASSOC); +$userName = 'eldridge'; +$filter="(|(CN=$userName*)(sn=$userName*)(givenname=$userName*)(uid=$userName*))"; + +$rs = $ldap->Execute( $filter ); +if ($rs) + while ($arr = $rs->FetchRow()) { + print_r($arr); + } + +$rs = $ldap->Execute( $filter ); +if ($rs) + while (!$rs->EOF) { + print_r($rs->fields); + $rs->MoveNext(); + } + +print_r( $ldap->GetArray( $filter ) ); +print_r( $ldap->GetRow( $filter ) ); + +$ldap->Close(); +echo "</pre>"; +</pre> +<p>Using DSN: +<pre> +$dsn = "ldap://ldap.baylor.edu/ou=People,o=Baylor University,c=US"; +$db = NewADOConnection($dsn); +</pre> +<h4>Interbase/Firebird</h4> +You define the database in the $host parameter: +<pre> $conn =ADONewConnection('ibase'); <br> $conn->PConnect('localhost:c:\ibase\employee.gdb','sysdba','masterkey');<br></pre> +<p>Or dsn: +</p><pre> $dsn = 'firebird://user:pwd@localhost/mydb?persist&dialect=3'; # persist is optional<br> $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<h4>SQLite</h4> +Sqlite will create the database file if it does not exist. +<pre> $conn =ADONewConnection('sqlite'); + $conn->PConnect('c:\path\to\sqlite.db'); # sqlite will create if does not exist<br></pre> +<p>Or dsn: +</p><pre> $path = urlencode('c:\path\to\sqlite.db'); + $dsn = "sqlite://$path/?persist"; # persist is optional + $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<h4>Oracle (oci8)</h4> +<p>With oci8, you can connect in multiple ways. Note that oci8 works fine with +newer versions of the Oracle, eg. 9i and 10g.</p> +<p>a. PHP and Oracle reside on the same machine, use default SID.</p> +<pre> $conn->Connect(false, 'scott', 'tiger');</pre> +<p>b. TNS Name defined in tnsnames.ora (or ONAMES or HOSTNAMES), eg. 'myTNS'</p> +<pre> $conn->PConnect(false, 'scott', 'tiger', 'myTNS');</pre> +<p>or</p> +<pre> $conn->PConnect('myTNS', 'scott', 'tiger');</pre> +<p>c. Host Address and SID</p> +<pre> + $conn->connectSID = true; + $conn->Connect('192.168.0.1', 'scott', 'tiger', 'SID');</pre> +<p>d. Host Address and Service Name</p> +<pre> $conn->Connect('192.168.0.1', 'scott', 'tiger', 'servicename');</pre> +<p>e. Oracle connection string: +</p><pre> $cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port))<br> (CONNECT_DATA=(SID=$sid)))";<br> $conn->Connect($cstr, 'scott', 'tiger');<br></pre> +<p>f. ADOdb dsn: +</p><pre> $dsn = 'oci8://user:pwd@tnsname/?persist'; # persist is optional<br> $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br> <br> $dsn = 'oci8://user:pwd@host/sid';<br> $conn = ADONewConnection($dsn);<br> <br> $dsn = 'oci8://user:pwd@/'; # oracle on local machine<br> $conn = ADONewConnection($dsn);<br></pre> +<p>You can also set the charSet for Oracle 9.2 and later, supported since PHP 4.3.2, ADOdb 4.54: +</p><pre> $conn->charSet = 'we8iso8859p1';<br> $conn->Connect(...);<br> <br> # or<br> $dsn = 'oci8://user:pwd@tnsname/?charset=WE8MSWIN1252';<br> $db = ADONewConnection($dsn);<br></pre> +<a name="dsnless"></a> +<h4>DSN-less ODBC ( Access, MSSQL and DB2 examples)</h4> +<p>ODBC DSN's can be created in the ODBC control panel, or you can use a DSN-less + connection.To use DSN-less connections with ODBC you need PHP 4.3 or later. +</p> +<p>For Microsoft Access:</p> +<pre> $db = ADONewConnection('access');<br> $dsn = <strong>"Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;";</strong> + $db->Connect($dsn); +</pre> +For Microsoft SQL Server: +<pre> $db = ADONewConnection('odbc_mssql');<br> $dsn = <strong>"Driver={SQL Server};Server=localhost;Database=northwind;"</strong>;<br> $db->Connect($dsn,'userid','password');<br></pre> +or if you prefer to use the mssql extension (which is limited to mssql 6.5 functionality): +<pre> $db = ADONewConnection('mssql');<br> $db->Execute('localhost', 'userid', 'password', 'northwind');<br></pre> +For DB2: +<pre> + $dbms = 'db2'; # or 'odbc_db2' if db2 extension not available + $db = ADONewConnection($dbms); + $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP;". + "uid=root; pwd=secret";<br> $db->Connect($dsn); +</pre> +<b>DSN-less Connections with ADO</b><br> +If you are using versions of PHP earlier than PHP 4.3.0, DSN-less connections +only work with Microsoft's ADO, which is Microsoft's COM based API. An example +using the ADOdb library and Microsoft's ADO: +<pre><?php<br> include('adodb.inc.php'); <br> $db =ADONewConnection("ado_mssql");<br> print "<h1>Connecting DSN-less $db->databaseType...</h1>";<br> <br> <b>$myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};"<br> . "SERVER=flipper;DATABASE=ai;UID=sa;PWD=;" ;</b> + $db->Connect($myDSN); + + $rs = $db->Execute("select * from table"); + $arr = $rs->GetArray(); + print_r($arr); +?> +</pre><a name="speed"></a> +<h2>High Speed ADOdb - tuning tips</h2> +<p>ADOdb is a big class library, yet it <a href="http://phplens.com/lens/adodb/">consistently beats</a> all other PHP class + libraries in performance. This is because it is designed in a layered fashion, + like an onion, with the fastest functions in the innermost layer. Stick to the + following functions for best performance:</p> +<table align="center" border="1" width="40%"> + <tbody><tr> + <td><div align="center"><b>Innermost Layer</b></div></td> + </tr> + <tr> + <td><p align="center">Connect, PConnect, NConnect<br> + Execute, CacheExecute<br> + SelectLimit, CacheSelectLimit<br> + MoveNext, Close <br> + qstr, Affected_Rows, Insert_ID</p></td> + </tr> +</tbody></table> +<p>The fastest way to access the field data is by accessing the array $recordset->fields + directly. Also set the global variables <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> + = ADODB_FETCH_NUM, and (for oci8, ibase/firebird and odbc) <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> = false + before you connect to your database.</p> +<p>Consider using bind parameters if your database supports it, as it improves + query plan reuse. Use ADOdb's performance tuning system to identify bottlenecks + quickly. At the time of writing (Dec 2003), this means oci8 and odbc drivers.</p> + <p>Lastly make sure you have a PHP accelerator cache installed such as APC, Turck + MMCache, Zend Accelerator or ionCube.</p> + <p>Some examples:</p> + <table align="center" border="1"><tbody><tr><td><b>Fastest data retrieval using PHP</b></td><td><b>Fastest data retrieval using ADOdb extension</b></td></tr> +<tr><td> +<pre>$rs = $rs->Execute($sql);<br>while (!$rs->EOF) {<br> var_dump($rs->fields);<br> $rs->MoveNext();<br>}</pre></td><td> +<pre>$rs = $rs->Execute($sql);<br>$array = adodb_getall($rs);<br>var_dump($array);<br><br><br></pre></td></tr></tbody></table> + <p><b>Advanced Tips</b> + </p><p>If you have the <a href="http://adodb.sourceforge.net/#extension">ADOdb C extension</a> installed, + you can replace your calls to $rs->MoveNext() with adodb_movenext($rs). + This doubles the speed of this operation. For retrieving entire recordsets at once, +use GetArray(), which uses the high speed extension function adodb_getall($rs) internally. + </p><p>Execute() is the default way to run queries. You can use the low-level functions _Execute() and _query() +to reduce query overhead. Both these functions share the same parameters as Execute(). +</p><p>If you do not have any bind parameters or your database supports +binding (without emulation), +then you can call _Execute() directly. Calling this function bypasses +bind emulation. Debugging is still supported in _Execute(). +</p><p>If you do not require debugging facilities nor emulated +binding, and do not require a recordset to be returned, then you can +call _query. This is great for inserts, updates and deletes. Calling +this function +bypasses emulated binding, debugging, and recordset handling. Either +the resultid, true or false are returned by _query(). </p><p>For Informix, you can disable scrollable cursors with $db->cursorType = 0. +</p><p><a name="hack"></a> </p> +<h2>Hacking ADOdb Safely</h2> +<p>You might want to modify ADOdb for your own purposes. Luckily you can +still maintain backward compatibility by sub-classing ADOdb and using the $ADODB_NEWCONNECTION +variable. $ADODB_NEWCONNECTION allows you to override the behaviour of ADONewConnection(). +ADOConnection() checks for this variable and will call +the function-name stored in this variable if it is defined. +</p><p>In the following example, new functionality for the connection object +is placed in the <i>hack_mysql</i> and <i>hack_postgres7</i> classes. The recordset class naming convention +can be controlled using $rsPrefix. Here we set it to 'hack_rs_', which will make ADOdb use +<i>hack_rs_mysql</i> and <i>hack_rs_postgres7</i> as the recordset classes. + + +</p><pre>class hack_mysql extends adodb_mysql {<br>var $rsPrefix = 'hack_rs_';<br> /* Your mods here */<br>}<br><br>class hack_rs_mysql extends ADORecordSet_mysql {<br> /* Your mods here */<br>}<br><br>class hack_postgres7 extends adodb_postgres7 {<br>var $rsPrefix = 'hack_rs_';<br> /* Your mods here */<br>}<br><br>class hack_rs_postgres7 extends ADORecordSet_postgres7 {<br> /* Your mods here */<br>}<br><br>$ADODB_NEWCONNECTION = 'hack_factory';<br><br>function hack_factory($driver)<br>{<br> if ($driver !== 'mysql' && $driver !== 'postgres7') return false;<br> <br> $driver = 'hack_'.$driver;<br> $obj = new $driver();<br> return $obj;<br>}<br><br>include_once('adodb.inc.php');<br></pre> +<p></p><p>Don't forget to call the constructor of the parent class in +your constructor. If you want to use the default ADOdb drivers return +false in the above hack_factory() function. + Also you can define your own ADORecordSet_empty() class, by defining a class $$this->rsPrefix.'empty' since 4.96/5.02. +<a name="php5"></a> +</p><h2>PHP5 Features</h2> + ADOdb 4.02 or later will transparently determine which version of PHP you are using. +If PHP5 is detected, the following features become available: +<ul> + +<li><b>PDO</b>: PDO drivers are available. See the <a href=#pdo>connection examples</a>. Currently PDO drivers are + not as powerful as native drivers, and should be treated as experimental.<br><br> +<a name="php5iterators"></a> +<li><b>Foreach iterators</b>: This is a very natural way of going through a recordset: +<pre> $ADODB_FETCH_MODE = ADODB_FETCH_NUM;<br> $rs = $db->Execute($sql);<br> foreach($rs as $k =gt; $row) {<br> echo "r1=".$row[0]." r2=".$row[1]."<br>";<br> }<br></pre> +<p> +<a name="php5exceptions"></a> +</p></li><li><b>Exceptions</b>: Just include <i>adodb-exceptions.inc.php</i> and you can now +catch exceptions on errors as they occur. +<pre> <b>include("../adodb-exceptions.inc.php");</b> <br> include("../adodb.inc.php"); <br> try { <br> $db = NewADOConnection("oci8"); <br> $db->Connect('','scott','bad-password'); <br> } catch (exception $e) { <br> var_dump($e); <br> adodb_backtrace($e->gettrace());<br> } <br></pre> +<p>Note that reaching EOF is <b>not</b> considered an error nor an exception. +</p></li></ul> +<h3><a name="drivers"></a>Databases Supported</h3> +The <i>name</i> below is the value you pass to NewADOConnection($name) to create a connection object for that database. +<p> +</p><p> +</p><table border="1" width="100%"> + <tbody><tr valign="top"> + <td><b>Name</b></td> + <td><b>Tested</b>... [truncated message content] |
From: <bz...@us...> - 2008-02-11 17:52:04
|
Revision: 4860 http://linpha.svn.sourceforge.net/linpha/?rev=4860&view=rev Author: bzrudi Date: 2008-02-11 09:51:58 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Removed all calls for ADODB_FETCH_NUM as they do no longer work. Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/install/step10_postsettings.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/modules/module.basket.php trunk/linpha2/lib/modules/module.benchmark.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.search.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/ChangeLog 2008-02-11 17:51:58 UTC (rev 4860) @@ -1,4 +1,12 @@ - +2008-02-11 bzrudi + * Removed all calls for ADODB_FETCH_NUM as they do no longer work. + AdoDB documentation says FTECH_ASSOC is nearly as fast as FETCH_NUM. + As we used FETCH_NUM just in a small number of cases, I guess it's save to + convert to default (FETCH_ASSOC). + To be true I wonder if it ever worked as expected as we sometimes asked for + FETCH_NUM but return was used as ASSOC !?!?. However let's use ASSOC to + be save. + 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/admin/maintenance_import.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -150,11 +150,11 @@ { echo i18n("Delete Thumbnails"); $query = $GLOBALS['linpha']->db->Execute($sql); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - if( LinImage::deleteCachedThumbnail($data[0], $data[1])) + if( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) { - echo " ".$data[0].","; + echo " ".$data['id'].","; } } echo '<br />'; @@ -176,15 +176,15 @@ if($_REQUEST['index_thumbnails']!='no') { echo i18n("Create Thumbnail"); - while($data = $createthumbquery->FetchRow(ADODB_FETCH_NUM)) + while($data = $createthumbquery->FetchRow()) { - if( ! $thumbnail->createThumbnail($data[0]) ) + 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].","; + echo " ".$data['0'].","; } flush(); } @@ -233,7 +233,7 @@ $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)) + while($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -387,11 +387,11 @@ $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $thumbnail->mode = 'thumb'; - $thumbnail->photo_id = $data[0]; + $thumbnail->photo_id = $data['0']; $thumbnail->setFileInformation(); Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -122,9 +122,9 @@ */ $array_groups = Array(); $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups WHERE group_name <> 'admin'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - $array_groups[$data[0]] = $data[1]; + $array_groups[$data['id']] = $data['group_name']; } /** @@ -154,10 +154,10 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); - $data = $query->FetchRow(ADODB_FETCH_NUM); + $data = $query->FetchRow(); ?> <form name="permission" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>"> - <h3><?php echo i18n("Change/Add permissions of folder/file"); ?> "<?php echo $data[0]; ?>"</h3> + <h3><?php echo i18n("Change/Add permissions of folder/file"); ?> "<?php echo $data['name']; ?>"</h3> <?php /** Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/install/step10_postsettings.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -98,9 +98,9 @@ <?php $query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); -$data = $query->FetchRow(ADODB_FETCH_NUM); +$data = $query->FetchRow(); -if(false === $data[0]) +if(false === $data['option_value']) { echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2><hr>"; ?> Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -797,9 +797,9 @@ function deleteCachedImage($id,$img_type) { $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE photo_id = '".$id."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - $output = LinImage::getCachePath('img',$data[0],$img_type); + $output = LinImage::getCachePath('img',$data['id'],$img_type); if(file_exists($output)) { Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -26,7 +26,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS 'id2', " . + "".LIN_PREFIX."photos.id AS id2, " . "".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, " . @@ -260,7 +260,7 @@ $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); $this->photos_filtered[] = $value; - print_r($value); + //print_r($value); } } } @@ -973,15 +973,15 @@ { $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . "FROM ".LIN_PREFIX."meta_exif"); - if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) + if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) { /** * get min and max year */ - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); /** * get years between */ @@ -992,10 +992,10 @@ */ if($i > 1900) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } @@ -1033,14 +1033,14 @@ for($i = 1; $i <= $nr_images ; ) { - $data = $query->FetchRow(ADODB_FETCH_NUM); - if(isset($data['0'])) + $data = $query->FetchRow(); + if(isset($data['id'])) { - $path = LinSql::getFullImagePath( $data[0] ); + $path = LinSql::getFullImagePath( $data['id'] ); - if(file_exists($path) && LinSql::photoIsAllowed($data['0'])) + if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) { - $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['0'],'path'=>$path); + $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); $i++; } } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -142,15 +142,15 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . "FROM ".LIN_PREFIX."photos WHERE img_type = '0' " . "AND parent_id = '".$parent_id."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { /** * on dryrun, the delete process isn't done completley * so it would appear here again, prevent this! */ - if( !isset($deleted_keys) OR !in_array($data['0'],$deleted_keys) ) + if( !isset($deleted_keys) OR !in_array($data['id'],$deleted_keys) ) { - LinImport::updateDir($data['0'], $recursive, $dryrun); + LinImport::updateDir($data['id'], $recursive, $dryrun); } } } @@ -187,7 +187,7 @@ /** * delete thumbnail if one exists with the same id */ - $inserted_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) FROM ".LIN_PREFIX."photos "); + $inserted_id = $GLOBALS['linpha']->db->GetOne("SELECT max(id) FROM ".LIN_PREFIX."photos "); LinImage::deleteCachedThumbnail($inserted_id,$file_type); @@ -381,10 +381,10 @@ { if( $id != 0 ) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) AS s " . "FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."'"); $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET stats_numbers = '".$data[0]."' WHERE id = '".$id."'"); + "SET stats_numbers = '".$data['s']."' WHERE id = '".$id."'"); $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id " . "FROM ".LIN_PREFIX."photos WHERE id = '".$id."'"); Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -73,9 +73,9 @@ "WHERE flags = '" . $flag_nr . "' " . "ORDER by id"); - while ($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) + while ($fields_data = $query->FetchRow()) { - $this->cachedSelectedFieldNames[] = $fields_data['0']; + $this->cachedSelectedFieldNames[] = $fields_data['name']; } } @@ -938,7 +938,7 @@ while($data = $query->FetchRow()) { - $filename = LinSql::getFullImagePath($data['0']); + $filename = LinSql::getFullImagePath($data['id']); $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); //echo '<pre>', print_r($dataArray), '</pre>'; Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -57,7 +57,7 @@ } else { - error_reporting(0); + error_reporting('E_ALL'); include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** @@ -171,7 +171,7 @@ } - exit(1); + //exit(1); } @@ -477,7 +477,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '".LinSql::linAddslashes($_SESSION['user_id'])."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } @@ -545,18 +545,18 @@ "WHERE perm_type = '".LinSql::linAddslashes($perm_type)."' " . "AND photos_id = '".LinSql::linAddslashes($photos_id)."'"); - if( isset( $data[0] ) && !empty( $data[0] ) ) + if( isset( $data['permission'] ) && !empty( $data['permission'] ) ) { - return array($i, $data[0]); + return array($i, $data['permission']); } else { $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($photos_id)."'"); - if( isset( $data[0] ) ) + if( isset( $data['parent_id'] ) ) { - $photos_id = $data[0]; + $photos_id = $data['parent_id']; } else { @@ -968,7 +968,7 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $this->value[$data['option_name']] = $data['option_value']; } @@ -983,7 +983,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '".$_SESSION['user_id']."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.basket.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -166,12 +166,12 @@ foreach($_SESSION['basket_ids'] AS $value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".LIN_PREFIX."photos WHERE id = '". LinSql::linAddslashes($value)."'" ); - $array_folders[] = $data[0]; + $array_folders[] = $data['parent_id']; /** * store all imgids in an array with parent_id as the key for easy access */ - $GLOBALS['linpha']->template->output['basket_folder_contents'][$data[0]][] = $value; + $GLOBALS['linpha']->template->output['basket_folder_contents'][$data['parent_id']][] = $value; } $GLOBALS['linpha']->template->output['basket_folders'] = array_unique($array_folders); Modified: trunk/linpha2/lib/modules/module.benchmark.php =================================================================== --- trunk/linpha2/lib/modules/module.benchmark.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.benchmark.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -17,7 +17,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $config[$data['option_name']] = $data['option_value']; } Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.browse.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -69,11 +69,11 @@ /** * year */ - $data = $linpha->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + $data = $linpha->db->GetRow("SELECT min(datetimeoriginal) AS min, max(datetimeoriginal) AS max " . "FROM ".LIN_PREFIX."meta_exif"); - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); $sum = 0; @@ -87,19 +87,19 @@ */ if($i > 1900) { - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['year']) && $i == $_GET['year']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } - $sum += $data[0]; + $sum += $data['datetime']; } } } @@ -107,8 +107,11 @@ /** * calc not indexed images */ - $data = $linpha->db->GetRow("SELECT sum( stats_numbers ) FROM ".LIN_PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); - $str_datelinks .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> ('.($data[0]-$sum).')'; + $data = $linpha->db->GetRow("SELECT sum( stats_numbers ) AS sum " . + "FROM ".LIN_PREFIX."photos " . + "WHERE parent_id = '0' " . + "GROUP BY parent_id"); + $str_datelinks .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> ('.($data['sum']-$sum).')'; if(isset($_GET['year']) && $_GET['year'] != 0) @@ -127,17 +130,19 @@ $i = "0".$i; } - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif " . - "WHERE datetimeoriginal LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime " . + "FROM ".LIN_PREFIX."meta_exif " . + "WHERE datetimeoriginal " . + "LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['month']) && $i == $_GET['month']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } @@ -162,17 +167,19 @@ $i = "0".$i; } - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif " . - "WHERE datetimeoriginal LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime " . + "FROM ".LIN_PREFIX."meta_exif " . + "WHERE datetimeoriginal " . + "LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['day']) && $i == $_GET['day']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.search.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -198,9 +198,9 @@ } $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - if(isset($_REQUEST['button']['meta'][$data[0]]) OR isset($_REQUEST['button']['meta']['all'])) + if(isset($_REQUEST['button']['meta'][$data['id']]) OR isset($_REQUEST['button']['meta']['all'])) { $sql_buttons .= " OR ("; @@ -208,7 +208,7 @@ reset($array_strings); for($i = 1; list($key,$value) = each($array_strings); $i++) { - $sql_buttons .= " (".LIN_PREFIX."meta_data.field_id = '".$data[0]."' AND ".LIN_PREFIX."meta_data.meta_data LIKE '%".$value."%') "; + $sql_buttons .= " (".LIN_PREFIX."meta_data.field_id = '".$data['id']."' AND ".LIN_PREFIX."meta_data.meta_data LIKE '%".$value."%') "; /** * append AND/OR, but not on last item This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 18:48:31
|
Revision: 4863 http://linpha.svn.sourceforge.net/linpha/?rev=4863&view=rev Author: fangehrn Date: 2008-02-11 10:48:26 -0800 (Mon, 11 Feb 2008) Log Message: ----------- 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.sql.class.php Removed Paths: ------------- trunk/linpha2/install/ignore_delete_install_msg.txt trunk/linpha2/logsql.txt Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/ChangeLog 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,3 +1,8 @@ + +2008-02-11 flo + * deleted "debug" files and added them to the ignore list + -> we will not forget them on releases and they will not be on any snapshot + 2008-02-11 bzrudi * Removed all calls for ADODB_FETCH_NUM as they do no longer work. AdoDB documentation says FTECH_ASSOC is nearly as fast as FETCH_NUM. Deleted: trunk/linpha2/install/ignore_delete_install_msg.txt =================================================================== --- trunk/linpha2/install/ignore_delete_install_msg.txt 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/install/ignore_delete_install_msg.txt 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,2 +0,0 @@ -If this file exists, the check for existing ./install directory is ignored. -This file must be remove in official releases. \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:48:26 UTC (rev 4863) @@ -177,7 +177,6 @@ /** * enable sql logging - * @TODO disable on public release */ if (file_exists(LINPHA_DIR.'/logsql.txt')) { $GLOBALS['linpha']->db->LogSQL(); Deleted: trunk/linpha2/logsql.txt =================================================================== --- trunk/linpha2/logsql.txt 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/logsql.txt 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,2 +0,0 @@ -if this file exists linpha logs all sql queries -by appending the GET variable "perf" you will get some nice stats \ 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...> - 2008-02-11 19:21:36
|
Revision: 4866 http://linpha.svn.sourceforge.net/linpha/?rev=4866&view=rev Author: fangehrn Date: 2008-02-11 11:21:34 -0800 (Mon, 11 Feb 2008) Log Message: ----------- 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.sql.class.php Property Changed: ---------------- trunk/linpha2/ trunk/linpha2/install/ Property changes on: trunk/linpha2 ___________________________________________________________________ Name: svn:ignore - .project project.index .cache .settings + .project project.index .cache .settings logsql.txt Property changes on: trunk/linpha2/install ___________________________________________________________________ Name: svn:ignore + ignore_delete_install_msg.txt Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:59:15 UTC (rev 4865) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 19:21:34 UTC (rev 4866) @@ -27,7 +27,7 @@ class LinSql { - private $isLoggedIn, $isAdmin; + private $isLoggedIn = false, $isAdmin; public $config; // sub class $linpha->sql->config /** @@ -57,14 +57,19 @@ } else { - error_reporting('E_ALL'); + //error_reporting('E_ALL'); + error_reporting(0); include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** - * if this file does not exists we already switch to installer + * if we can keep the "_once" at those include files it would be + * a good security improvement! + * + * if this file does not exists we already switched to installer + * -> there's no need for file_exists() */ $sql_dir = ''; - require_once(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... + require_once(LINPHA_DIR.'/var/config.dir.php'); $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 21:31:43
|
Revision: 4867 http://linpha.svn.sourceforge.net/linpha/?rev=4867&view=rev Author: fangehrn Date: 2008-02-11 13:31:42 -0800 (Mon, 11 Feb 2008) Log Message: ----------- * fixed some E_STRICT error messages, there are a lot of them... Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/plugins/watermark/func.watermark.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/misc/roundcorners.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/ChangeLog 2008-02-11 21:31:42 UTC (rev 4867) @@ -2,6 +2,7 @@ 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot + * fixed some E_STRICT error messages, there are a lot of them... 2008-02-11 bzrudi * Removed all calls for ADODB_FETCH_NUM as they do no longer work. Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -86,4 +86,4 @@ echo $s.'<br />'; linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -57,8 +57,7 @@ } else { - //error_reporting('E_ALL'); - error_reporting(0); + error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** Modified: trunk/linpha2/lib/plugins/watermark/func.watermark.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -26,7 +26,7 @@ * @author flo * @todo adapt from linpha1 */ -function needWatermark($imgid) +static function needWatermark($imgid) { if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] @@ -41,7 +41,7 @@ /** * returns array with all the configs and the default values, they are only defined here */ -function getWatermarkArray() +static function getWatermarkArray() { return array ( 'wm_active' => "0", @@ -67,7 +67,7 @@ ); } -function readWatermark() +static function readWatermark() { $arr_config = LinWatermark::getWatermarkArray(); while(list($name,$value) = each($arr_config) ) @@ -77,7 +77,7 @@ return $arr_read; } -function updateWatermark() +static function updateWatermark() { $arr_config = LinWatermark::getWatermarkArray(); while(list($name,$value) = each($arr_config) ) @@ -89,7 +89,7 @@ /** * restore watermark settings to initial settings or to examples */ -function restoreWatermark() +static function restoreWatermark() { global $wm_restore_to; @@ -155,7 +155,7 @@ * $resize: resize factor in percent * */ -function wmArrResized($w,$h,$org_width,$org_height,$resize) +static function wmArrResized($w,$h,$org_width,$org_height,$resize) { $arr_resized['w'] = round($w * $resize/100); $arr_resized['h'] = round($h * $resize/100); @@ -321,7 +321,7 @@ /** * not used anymore */ -function getHtmlColorFromRgb($r,$g,$b) +static function getHtmlColorFromRgb($r,$g,$b) { if(strlen(dechex($r))==1) { $r = '0'.$r; @@ -346,7 +346,7 @@ * used to check if it is a valid html color * @uses isHtmlColor() */ -function everyCharIsHex($string) +static function everyCharIsHex($string) { for($i=0;$i<strlen($string);$i++) { @@ -387,7 +387,7 @@ * used to check if it is a valid html color * @uses getRgbFromAll() */ -function isHtmlColor($string) +static function isHtmlColor($string) { switch(strlen($string)) { @@ -412,7 +412,7 @@ * it doesn't matter if the html color is '#00FF00' or '00FF00' * @uses getRgbFromAll() */ -function getRgbFromHtml($string) +static function getRgbFromHtml($string) { switch(strlen($string)) { @@ -438,7 +438,7 @@ * * @uses watermark_gd() */ -function getRgbFromAll($string) +static function getRgbFromAll($string) { if( isset( LinWatermark::$Colors[$string]) ) { @@ -459,7 +459,7 @@ * * used in linpha2 - admin - settings_layout */ -function getHtmlFromAll($string) +static function getHtmlFromAll($string) { if(LinWatermark::isHtmlColor($string)) { @@ -493,7 +493,7 @@ * pos_x, pos_y: additional adjust for the image * */ -function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) +static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) { switch($align) Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -5,7 +5,7 @@ * force caching in browser * works in firefox and internet explorer */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); Modified: trunk/linpha2/templates/misc/roundcorners.php =================================================================== --- trunk/linpha2/templates/misc/roundcorners.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/templates/misc/roundcorners.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -74,7 +74,7 @@ * force caching in browser * works in firefox and internet explorer */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 18:55:20
|
Revision: 4874 http://linpha.svn.sourceforge.net/linpha/?rev=4874&view=rev Author: fangehrn Date: 2008-02-13 10:55:13 -0800 (Wed, 13 Feb 2008) Log Message: ----------- 2008-02-13 flo * moved not needed files to the misc folder * updated adodb to version 504 Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/adodb/adodb-active-record.inc.php trunk/linpha2/lib/adodb/adodb-csvlib.inc.php trunk/linpha2/lib/adodb/adodb-datadict.inc.php trunk/linpha2/lib/adodb/adodb-error.inc.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/adodb/adodb-errorpear.inc.php trunk/linpha2/lib/adodb/adodb-exceptions.inc.php trunk/linpha2/lib/adodb/adodb-iterator.inc.php trunk/linpha2/lib/adodb/adodb-lib.inc.php trunk/linpha2/lib/adodb/adodb-pager.inc.php trunk/linpha2/lib/adodb/adodb-pear.inc.php trunk/linpha2/lib/adodb/adodb-perf.inc.php trunk/linpha2/lib/adodb/adodb-php4.inc.php trunk/linpha2/lib/adodb/adodb-time.inc.php trunk/linpha2/lib/adodb/adodb.inc.php trunk/linpha2/lib/adodb/docs/docs-adodb.htm trunk/linpha2/lib/adodb/docs/docs-datadict.htm trunk/linpha2/lib/adodb/docs/docs-perf.htm trunk/linpha2/lib/adodb/docs/docs-session.htm trunk/linpha2/lib/adodb/docs/docs-session.old.htm trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php trunk/linpha2/lib/adodb/perf/perf-db2.inc.php trunk/linpha2/lib/adodb/perf/perf-informix.inc.php trunk/linpha2/lib/adodb/perf/perf-mssql.inc.php trunk/linpha2/lib/adodb/perf/perf-mysql.inc.php trunk/linpha2/lib/adodb/perf/perf-oci8.inc.php trunk/linpha2/lib/adodb/perf/perf-postgres.inc.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/ChangeLog 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,4 +1,8 @@ +2008-02-13 flo + * moved not needed files to the misc folder + * updated adodb to version 504 + 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/index.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,11 +1,11 @@ <?php if(defined('LINPHA_DIR')) { - if(!defined('LINPHA_IS_INCLUDED')) { - define('LINPHA_IS_INCLUDED',1); - } + if(!defined('LINPHA_IS_INCLUDED')) { + define('LINPHA_IS_INCLUDED',1); + } } else { - define('LINPHA_DIR','.'); + define('LINPHA_DIR','.'); } include_once(LINPHA_DIR.'/lib/include/common.php'); @@ -13,84 +13,81 @@ /** * some init stuff */ - require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - global $linpha; - $linpha = new Linpha(); - $linpha->sql->startSession(); - - include_once(LINPHA_DIR.'/lib/include/integrity.php'); - include_once(LINPHA_DIR.'/lib/include/upgrade.php'); + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + + include_once(LINPHA_DIR.'/lib/include/integrity.php'); + include_once(LINPHA_DIR.'/lib/include/upgrade.php'); + + if(!isset($_GET['linCat'])) + { + $_GET['linCat'] = 'alb'; + } - if(!isset($_GET['linCat'])) - { - $_GET['linCat'] = 'alb'; - } - /** * open modules */ switch($_GET['linCat']) { case 'alb': - require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); + break; case 'search': - require_once(LINPHA_DIR.'/lib/modules/module.search.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.search.php'); + break; case 'basket': - require_once(LINPHA_DIR.'/lib/modules/module.basket.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.basket.php'); + break; case 'browse': - require_once(LINPHA_DIR.'/lib/modules/module.browse.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.browse.php'); + break; case 'settings': - require_once(LINPHA_DIR.'/lib/modules/module.settings.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.settings.php'); + break; case 'ajax': - require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); + break; case 'newimg': - require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); + break; case 'metadata': - require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); - break; + require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); + break; case 'video': - require_once(LINPHA_DIR.'/lib/modules/module.video.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.video.php'); + break; case 'panorama': - require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); + break; case 'download': - require_once(LINPHA_DIR.'/lib/modules/module.download.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.download.php'); + break; case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; -case 'benchmark': - require_once(LINPHA_DIR.'/lib/modules/module.benchmark.php'); - break; case 'empty': - require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); - break; - -default: - // include plugins - $pluginDir = LINPHA_DIR.'/lib/plugins'; - $includeFile = $pluginDir.'/'.$_GET['linCat'].'/module.'.$_GET['linCat'].'.php'; + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + break; - if( is_dir($pluginDir) - && isset($GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']=='1' - && file_exists($includeFile)) - { - require_once($includeFile); - } - else - { - require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); - } - break; +default: + // include plugins + $pluginDir = LINPHA_DIR.'/lib/plugins'; + $includeFile = $pluginDir.'/'.$_GET['linCat'].'/module.'.$_GET['linCat'].'.php'; + + if( is_dir($pluginDir) + && isset($GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']=='1' + && file_exists($includeFile)) + { + require_once($includeFile); + } + else + { + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + } + break; } ?> \ No newline at end of file Modified: trunk/linpha2/lib/adodb/adodb-active-record.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -@version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +@version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Latest version is available at http://adodb.sourceforge.net Released under both BSD license and Lesser GPL library license. Modified: trunk/linpha2/lib/adodb/adodb-csvlib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -8,7 +8,7 @@ /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/adodb-datadict.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /** - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-error.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-errorpear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-iterator.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-lib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -10,7 +10,7 @@ $ADODB_INCLUDED_LIB = 1; /* - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. @@ -417,7 +417,7 @@ } else $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")"; - } else if (strncmp($zthis->databaseType,'postgres',8) == 0) { + } else if (strncmp($zthis->databaseType,'postgres',8) == 0 || strncmp($zthis->databaseType,'mysql',5) == 0) { $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; } else { $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)"; @@ -451,7 +451,7 @@ // strip off unneeded ORDER BY if no UNION if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql; - else $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); + else $rewritesql = $rewritesql = adodb_strip_order_by($sql); if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0]; @@ -1012,7 +1012,6 @@ if (!is_numeric($val)) $val = (integer) $val; break; - default: $val = str_replace(array("'"," ","("),"",$arrFields[$fname]); // basic sql injection defence if (empty($val)) $val = '0'; Modified: trunk/linpha2/lib/adodb/adodb-pager.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-pear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-perf.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-perf.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-perf.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/adodb-php4.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-php4.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-php4.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-time.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-time.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-time.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -242,6 +242,12 @@ CHANGELOG +- 11 Feb 2008 0.33 +* Bug in 0.32 fix for hour handling. Fixed. + +- 1 Feb 2008 0.32 +* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly. + - 10 Jan 2008 0.31 * Now adodb_mktime(0,0,0,24,1,2037) works correctly. @@ -380,7 +386,7 @@ /* Version Number */ -define('ADODB_DATE_VERSION',0.31); +define('ADODB_DATE_VERSION',0.33); $ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2); @@ -426,10 +432,13 @@ /** Test Suite -*/ +*/ function adodb_date_test() { + for ($m=-24; $m<=24; $m++) + echo "$m :",adodb_date('d-m-Y',adodb_mktime(0,0,0,1+$m,20,2040)),"<br>"; + error_reporting(E_ALL); print "<h4>Testing adodb_date and adodb_mktime. version=".ADODB_DATE_VERSION.' PHP='.PHP_VERSION."</h4>"; @set_time_limit(0); @@ -1211,7 +1220,7 @@ ); - if ($usephpfns && ($year + $mon/12+$day/365.25+$hr*24*365.25 >= 2038)) $usephpfns = false; + if ($usephpfns && ($year + $mon/12+$day/365.25+$hr/(24*365.25) >= 2038)) $usephpfns = false; if ($usephpfns) { return $is_gmt ? @@ -1237,7 +1246,7 @@ $year = adodb_year_digit_check($year); if ($mon > 12) { - $y = floor($mon / 12); + $y = floor(($mon-1)/ 12); $year += $y; $mon -= $y*12; } else if ($mon < 1) { Modified: trunk/linpha2/lib/adodb/adodb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -14,7 +14,7 @@ /** \mainpage - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. You can choose which license you prefer. @@ -169,7 +169,7 @@ /** * ADODB version as a string. */ - $ADODB_vers = 'V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; + $ADODB_vers = 'V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; /** * Determines whether recordset->RecordCount() is used. Modified: trunk/linpha2/lib/adodb/docs/docs-adodb.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -15,7 +15,7 @@ <body bgcolor="#ffffff" text="black"> <h2>ADOdb Library for PHP</h2> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> <p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p> @@ -2118,7 +2118,7 @@ Since 4.96, we return null if no records were found.</font></p> <p><font><b>GetRow<a name="getrow"></a>($sql,$inputarr=false)</b></font></p> <p><font>Executes the SQL and returns the first row as an array. The recordset and remaining - rows are discarded for you automatically. If an error occurs, false is returned.</font></p> + rows are discarded for you automatically. If no data is found, an empty recordset is returned. If an error occurs, false is returned.</font></p> <p><font><b>GetAll<a name="getall"></a>($sql,$inputarr=false)</b></font></p> <p>Executes the SQL and returns the all the rows as a 2-dimensional @@ -2929,6 +2929,11 @@ <h2><font>Change Log<a name="Changes"></a><a name="changes"></a><a name="changelog"></a></font></h2> +<p><a name="4.98"></a><b>4.98/5.04 13 Feb 2008</b> +<p> Fixed adodb_mktime problem which causes a performance bottleneck in $hrs. +<p>Added mysqli support to adodb_getcount(). +<p>Removed MYSQLI_TYPE_CHAR from MetaType(). + <p><a name="4.97"></a><b>4.97/5.03 22 Jan 2008</b> <p>Active Record: $ADODB_ASSOC_CASE=1 did not work properly. Fixed. <p>Modified Fields() in recordset class to support display null fields in FetchNextObject(). Modified: trunk/linpha2/lib/adodb/docs/docs-datadict.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-datadict.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-datadict.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -20,7 +20,7 @@ </head> <body style="background-color: rgb(255, 255, 255);"> <h2>ADOdb Data Dictionary Library for PHP</h2> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (<a +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>).<br> AXMLS (c) 2004 ars Cognita, Inc</p> <p><font size="1">This software is dual licensed using BSD-Style and Modified: trunk/linpha2/lib/adodb/docs/docs-perf.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-perf.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-perf.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -18,7 +18,7 @@ </head> <body> <h3>The ADOdb Performance Monitoring Library</h3> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my)</p> +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my)</p> <p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p> Modified: trunk/linpha2/lib/adodb/docs/docs-session.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-session.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-session.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -21,7 +21,7 @@ <body style="background-color: rgb(255, 255, 255);"> <h1>ADODB Session 2 Management Manual</h1> <p> -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) </p> <p> <font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial Modified: trunk/linpha2/lib/adodb/docs/docs-session.old.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-session.old.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-session.old.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -21,7 +21,7 @@ <body style="background-color: rgb(255, 255, 255);"> <h3>ADODB Session Management Manual</h3> <p> -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) </p> <p> <font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial Modified: trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved. This is a version of the ADODB driver for DB2. It uses the 'ibm_db2' PECL extension for PHP (http://pecl.php.net/package/ibm_db2), which in turn requires DB2 V8.2.2 or Modified: trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** -* @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +* @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** -* @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +* @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -945,7 +945,7 @@ case 'SET': case MYSQLI_TYPE_TINY_BLOB : - case MYSQLI_TYPE_CHAR : + #case MYSQLI_TYPE_CHAR : case MYSQLI_TYPE_STRING : case MYSQLI_TYPE_ENUM : case MYSQLI_TYPE_SET : @@ -1052,7 +1052,7 @@ case 'SET': case MYSQLI_TYPE_TINY_BLOB : - case MYSQLI_TYPE_CHAR : + #case MYSQLI_TYPE_CHAR : case MYSQLI_TYPE_STRING : case MYSQLI_TYPE_ENUM : case MYSQLI_TYPE_SET : Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com Based on the previous postgres drivers. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - version V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. + version V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights +version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/perf/perf-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/perf/perf-db2.inc.php 2008-02-13 18:42:19 UTC (rev... [truncated message content] |
From: <fan...@us...> - 2008-02-13 22:02:34
|
Revision: 4879 http://linpha.svn.sourceforge.net/linpha/?rev=4879&view=rev Author: fangehrn Date: 2008-02-13 14:02:33 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/linpha2/install/step7_selectprefix.php Added Paths: ----------- trunk/linpha2/lib/adodb/datadict/ trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php trunk/linpha2/lib/adodb/datadict/datadict-sybase.inc.php Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:01:25 UTC (rev 4878) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -76,7 +76,7 @@ if(isset($_POST['create_database']) && $_POST['create_database'] == "create") { echo i18n_install("Creating Database...").' '; - $result = @mysql_query("CREATE database ".$_SESSION['sql_dbname']); + $result = @mysql_query("CREATE database ".$_SESSION['sql_dbname']." DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"); if($result) { Added: trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,95 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_access extends ADODB_DataDict { + + var $databaseType = 'access'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'TEXT'; + case 'XL': + case 'X': return 'MEMO'; + + case 'C2': return 'TEXT'; // up to 32K + case 'X2': return 'MEMO'; + + case 'B': return 'BINARY'; + + case 'D': return 'DATETIME'; + case 'T': return 'DATETIME'; + + case 'L': return 'BYTE'; + case 'I': return 'INTEGER'; + case 'I1': return 'BYTE'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'COUNTER'; + return ''; + } + if (substr($ftype,0,7) == 'DECIMAL') $ftype = 'DECIMAL'; + $suffix = ''; + if (strlen($fdefault)) { + //$suffix .= " DEFAULT $fdefault"; + if ($this->debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)"); + } + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function CreateDatabase($dbname,$options=false) + { + return array(); + } + + + function SetSchema($schema) + { + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,143 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_db2 extends ADODB_DataDict { + + var $databaseType = 'db2'; + var $seqField = false; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'CLOB'; + case 'X': return 'VARCHAR(3600)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(3600)'; // up to 32000, but default page size too small + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) + { + $suffix = ''; + if ($fautoinc) return ' GENERATED ALWAYS AS IDENTITY'; # as identity start with + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + + + function ChangeTableSQL($tablename, $flds, $tableoptions = false) + { + + /** + Allow basic table changes to DB2 databases + DB2 will fatally reject changes to non character columns + + */ + + $validTypes = array("CHAR","VARC"); + $invalidTypes = array("BIGI","BLOB","CLOB","DATE", "DECI","DOUB", "INTE", "REAL","SMAL", "TIME"); + // check table exists + $cols = $this->MetaColumns($tablename); + if ( empty($cols)) { + return $this->CreateTableSQL($tablename, $flds, $tableoptions); + } + + // already exists, alter table instead + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $this->TableName($tablename); + $sql = array(); + + foreach ( $lines as $id => $v ) { + if ( isset($cols[$id]) && is_object($cols[$id]) ) { + /** + If the first field of $v is the fieldname, and + the second is the field type/size, we assume its an + attempt to modify the column size, so check that it is allowed + $v can have an indeterminate number of blanks between the + fields, so account for that too + */ + $vargs = explode(' ' , $v); + // assume that $vargs[0] is the field name. + $i=0; + // Find the next non-blank value; + for ($i=1;$i<sizeof($vargs);$i++) + if ($vargs[$i] != '') + break; + + // if $vargs[$i] is one of the following, we are trying to change the + // size of the field, if not allowed, simply ignore the request. + if (in_array(substr($vargs[$i],0,4),$invalidTypes)) + continue; + // insert the appropriate DB2 syntax + if (in_array(substr($vargs[$i],0,4),$validTypes)) { + array_splice($vargs,$i,0,array('SET','DATA','TYPE')); + } + + // Now Look for the NOT NULL statement as this is not allowed in + // the ALTER table statement. If it is in there, remove it + if (in_array('NOT',$vargs) && in_array('NULL',$vargs)) { + for ($i=1;$i<sizeof($vargs);$i++) + if ($vargs[$i] == 'NOT') + break; + array_splice($vargs,$i,2,''); + } + $v = implode(' ',$vargs); + $sql[] = $alter . $this->alterCol . ' ' . $v; + } else { + $sql[] = $alter . $this->addCol . ' ' . $v; + } + } + + return $sql; + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,151 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +class ADODB2_firebird extends ADODB_DataDict { + + var $databaseType = 'firebird'; + var $seqField = false; + var $seqPrefix = 'gen_'; + var $blobSize = 40000; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'VARCHAR(32000)'; + case 'X': return 'VARCHAR(4000)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(4000)'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE PRECISION'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function NameQuote($name = NULL) + { + if (!is_string($name)) { + return FALSE; + } + + $name = trim($name); + + if ( !is_object($this->connection) ) { + return $name; + } + + $quote = $this->connection->nameQuote; + + // if name is of the form `name`, quote it + if ( preg_match('/^`(.+)`$/', $name, $matches) ) { + return $quote . $matches[1] . $quote; + } + + // if name contains special characters, quote it + if ( !preg_match('/^[' . $this->nameRegex . ']+$/', $name) ) { + return $quote . $name . $quote; + } + + return $quote . $name . $quote; + } + + function CreateDatabase($dbname, $options=false) + { + $options = $this->_Options($options); + $sql = array(); + + $sql[] = "DECLARE EXTERNAL FUNCTION LOWER CSTRING(80) RETURNS CSTRING(80) FREE_IT ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf'"; + + return $sql; + } + + function _DropAutoIncrement($t) + { + if (strpos($t,'.') !== false) { + $tarr = explode('.',$t); + return 'DROP GENERATOR '.$tarr[0].'."gen_'.$tarr[1].'"'; + } + return 'DROP GENERATOR "GEN_'.$t; + } + + + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fautoinc) $this->seqField = $fname; + if ($fconstraint) $suffix .= ' '.$fconstraint; + + return $suffix; + } + +/* +CREATE or replace TRIGGER jaddress_insert +before insert on jaddress +for each row +begin +IF ( NEW."seqField" IS NULL OR NEW."seqField" = 0 ) THEN + NEW."seqField" = GEN_ID("GEN_tabname", 1); +end; +*/ + function _Triggers($tabname,$tableoptions) + { + if (!$this->seqField) return array(); + + $tab1 = preg_replace( '/"/', '', $tabname ); + if ($this->schema) { + $t = strpos($tab1,'.'); + if ($t !== false) $tab = substr($tab1,$t+1); + else $tab = $tab1; + $seqField = $this->seqField; + $seqname = $this->schema.'.'.$this->seqPrefix.$tab; + $trigname = $this->schema.'.trig_'.$this->seqPrefix.$tab; + } else { + $seqField = $this->seqField; + $seqname = $this->seqPrefix.$tab1; + $trigname = 'trig_'.$seqname; + } + if (isset($tableoptions['REPLACE'])) + { $sql[] = "DROP GENERATOR \"$seqname\""; + $sql[] = "CREATE GENERATOR \"$seqname\""; + $sql[] = "ALTER TRIGGER \"$trigname\" BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END"; + } + else + { $sql[] = "CREATE GENERATOR \"$seqname\""; + $sql[] = "CREATE TRIGGER \"$trigname\" FOR $tabname BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END"; + } + + $this->seqField = false; + return $sql; + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,125 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_generic extends ADODB_DataDict { + + var $databaseType = 'generic'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'VARCHAR(250)'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'VARCHAR(250)'; + + case 'B': return 'VARCHAR'; + + case 'D': return 'DATE'; + case 'T': return 'DATE'; + + case 'L': return 'DECIMAL(1)'; + case 'I': return 'DECIMAL(10)'; + case 'I1': return 'DECIMAL(3)'; + case 'I2': return 'DECIMAL(5)'; + case 'I4': return 'DECIMAL(10)'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'DECIMAL(32,8)'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + +/* +//db2 + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'X': return 'VARCHAR'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + +// ifx +function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR';// 255 + case 'X': return 'TEXT'; + + case 'C2': return 'NVARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } +*/ +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,67 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_ibase extends ADODB_DataDict { + + var $databaseType = 'ibase'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'VARCHAR(4000)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(4000)'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE PRECISION'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,80 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_informix extends ADODB_DataDict { + + var $databaseType = 'informix'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR';// 255 + case 'XL': + case 'X': return 'TEXT'; + + case 'C2': return 'NVARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME YEAR TO SECOND'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'SERIAL'; + return ''; + } + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + +} + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,282 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +/* +In ADOdb, named quotes for MS SQL Server use ". From the MSSQL Docs: + + Note Delimiters are for identifiers only. Delimiters cannot be used for keywords, + whether or not they are marked as reserved in SQL Server. + + Quoted identifiers are delimited by double quotation marks ("): + SELECT * FROM "Blanks in Table Name" + + Bracketed identifiers are delimited by brackets ([ ]): + SELECT * FROM [Blanks In Table Name] + + Quoted identifiers are valid only when the QUOTED_IDENTIFIER option is set to ON. By default, + the Microsoft OLE DB Provider for SQL Server and SQL Server ODBC driver set QUOTED_IDENTIFIER ON + when they connect. + + In Transact-SQL, the option can be set at various levels using SET QUOTED_IDENTIFIER, + the quoted identifier option of sp_dboption, or the user options option of sp_configure. + + When SET ANSI_DEFAULTS is ON, SET QUOTED_IDENTIFIER is enabled. + + Syntax + + SET QUOTED_IDENTIFIER { ON | OFF } + + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_mssql extends ADODB_DataDict { + var $databaseType = 'mssql'; + var $dropIndex = 'DROP INDEX %2$s.%1$s'; + var $renameTable = "EXEC sp_rename '%s','%s'"; + var $renameColumn = "EXEC sp_rename '%s.%s','%s'"; + + var $typeX = 'TEXT'; ## Alternatively, set it to VARCHAR(4000) + var $typeXL = 'TEXT'; + + //var $alterCol = ' ALTER COLUMN '; + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + + $len = -1; // mysql max_length is not accurate + switch (strtoupper($t)) { + case 'R': + case 'INT': + case 'INTEGER': return 'I'; + case 'BIT': + case 'TINYINT': return 'I1'; + case 'SMALLINT': return 'I2'; + case 'BIGINT': return 'I8'; + + case 'REAL': + case 'FLOAT': return 'F'; + default: return parent::MetaType($t,$len,$fieldobj); + } + } + + function ActualType($meta) + { + switch(strtoupper($meta)) { + + case 'C': return 'VARCHAR'; + case 'XL': return (isset($this)) ? $this->typeXL : 'TEXT'; + case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle + case 'C2': return 'NVARCHAR'; + case 'X2': return 'NTEXT'; + + case 'B': return 'IMAGE'; + + case 'D': return 'DATETIME'; + case 'T': return 'DATETIME'; + case 'L': return 'BIT'; + + case 'R': + case 'I': return 'INT'; + case 'I1': return 'TINYINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INT'; + case 'I8': return 'BIGINT'; + + case 'F': return 'REAL'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname $this->addCol"; + foreach($lines as $v) { + $f[] = "\n $v"; + } + $s .= implode(', ',$f); + $sql[] = $s; + return $sql; + } + + /* + function AlterColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + foreach($lines as $v) { + $sql[] = "ALTER TABLE $tabname $this->alterCol $v"; + } + + return $sql; + } + */ + + function DropColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + if (!is_array($flds)) + $flds = explode(',',$flds); + $f = array(); + $s = 'ALTER TABLE ' . $tabname; + foreach($flds as $v) { + $f[] = "\n$this->dropCol ".$this->NameQuote($v); + } + $s .= implode(', ',$f); + $sql[] = $s; + return $sql; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) + { + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fautoinc) $suffix .= ' IDENTITY(1,1)'; + if ($fnotnull) $suffix .= ' NOT NULL'; + else if ($suffix == '') $suffix .= ' NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + /* +CREATE TABLE + [ database_name.[ owner ] . | owner. ] table_name + ( { < column_definition > + | column_name AS computed_column_expression + | < table_constraint > ::= [ CONSTRAINT constraint_name ] } + + | [ { PRIMARY KEY | UNIQUE } [ ,...n ] + ) + +[ ON { filegroup | DEFAULT } ] +[ TEXTIMAGE_ON { filegroup | DEFAULT } ] + +< column_definition > ::= { column_name data_type } + [ COLLATE < collation_name > ] + [ [ DEFAULT constant_expression ] + | [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ] + ] + [ ROWGUIDCOL] + [ < column_constraint > ] [ ...n ] + +< column_constraint > ::= [ CONSTRAINT constraint_name ] + { [ NULL | NOT NULL ] + | [ { PRIMARY KEY | UNIQUE } + [ CLUSTERED | NONCLUSTERED ] + [ WITH FILLFACTOR = fillfactor ] + [ON {filegroup | DEFAULT} ] ] + ] + | [ [ FOREIGN KEY ] + REFERENCES ref_table [ ( ref_column ) ] + [ ON DELETE { CASCADE | NO ACTION } ] + [ ON UPDATE { CASCADE | NO ACTION } ] + [ NOT FOR REPLICATION ] + ] + | CHECK [ NOT FOR REPLICATION ] + ( logical_expression ) + } + +< table_constraint > ::= [ CONSTRAINT constraint_name ] + { [ { PRIMARY KEY | UNIQUE } + [ CLUSTERED | NONCLUSTERED ] + { ( column [ ASC | DESC ] [ ,...n ] ) } + [ WITH FILLFACTOR = fillfactor ] + [ ON { filegroup | DEFAULT } ] + ] + | FOREIGN KEY + [ ( column [ ,...n ] ) ] + REFERENCES ref_table [ ( ref_column [ ,...n ] ) ] + [ ON DELETE { CASCADE | NO ACTION } ] + [ ON UPDATE { CASCADE | NO ACTION } ] + [ NOT FOR REPLICATION ] + | CHECK [ NOT FOR REPLICATION ] + ( search_conditions ) + } + + + */ + + /* + CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name + ON { table | view } ( column [ ASC | DESC ] [ ,...n ] ) + [ WITH < index_option > [ ,...n] ] + [ ON filegroup ] + < index_option > :: = + { PAD_INDEX | + FILLFACTOR = fillfactor | + IGNORE_DUP_KEY | + DROP_EXISTING | + STATISTICS_NORECOMPUTE | + SORT_IN_TEMPDB + } +*/ + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; + $clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : ''; + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + + $sql[] = $s; + + return $sql; + } + + + function _GetSize($ftype, $ty, $fsize, $fprec) + { + switch ($ftype) { + case 'INT': + case 'SMALLINT': + case 'TINYINT': + case 'BIGINT': + return $ftype; + } + if ($ty == 'T') return $ftype; + return parent::_GetSize($ftype, $ty, $fsize, $fprec); + + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,181 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_mysql extends ADODB_DataDict { + var $databaseType = 'mysql'; + var $alterCol = ' MODIFY COLUMN'; + var $alterTableAddIndex = true; + var $dropTable = 'DROP TABLE IF EXISTS %s'; // requires mysql 3.22 or later + + var $dropIndex = 'DROP INDEX %s ON %s'; + var $renameColumn = 'ALTER TABLE %s CHANGE COLUMN %s %s %s'; // needs column-definition! + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->auto_increment; + + $len = -1; // mysql max_length is not accurate + switch (strtoupper($t)) { + case 'STRING': + case 'CHAR': + case 'VARCHAR': + case 'TINYBLOB': + case 'TINYTEXT': + case 'ENUM': + case 'SET': + if ($len <= $this->blobSize) return 'C'; + + case 'TEXT': + case 'LONGTEXT': + case 'MEDIUMTEXT': + return 'X'; + + // php_mysql extension always returns 'blob' even if 'text' + // so we have to check whether binary... + case 'IMAGE': + case 'LONGBLOB': + case 'BLOB': + case 'MEDIUMBLOB': + return !empty($fieldobj->binary) ? 'B' : 'X'; + + case 'YEAR': + case 'DATE': return 'D'; + + case 'TIME': + case 'DATETIME': + case 'TIMESTAMP': return 'T'; + + case 'FLOAT': + case 'DOUBLE': + return 'F'; + + case 'INT': + case 'INTEGER': return $is_serial ? 'R' : 'I'; + case 'TINYINT': return $is_serial ? 'R' : 'I1'; + case 'SMALLINT': return $is_serial ? 'R' : 'I2'; + case 'MEDIUMINT': return $is_serial ? 'R' : 'I4'; + case 'BIGINT': return $is_serial ? 'R' : 'I8'; + default: return 'N'; + } + } + + function ActualType($meta) + { + switch(strtoupper($meta)) { + case 'C': return 'VARCHAR'; + case 'XL':return 'LONGTEXT'; + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'LONGTEXT'; + + case 'B': return 'LONGBLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME'; + case 'L': return 'TINYINT'; + + case 'R': + case 'I4': + case 'I': return 'INTEGER'; + case 'I1': return 'TINYINT'; + case 'I2': return 'SMALLINT'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + if ($funsigned) $suffix .= ' UNSIGNED'; + if ($fnotnull) $suffix .= ' NOT NULL'; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fautoinc) $suffix .= ' AUTO_INCREMENT'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + /* + CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] + [table_options] [select_statement] + create_definition: + col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] + [PRIMARY KEY] [reference_definition] + or PRIMARY KEY (index_col_name,...) + or KEY [index_name] (index_col_name,...) + or INDEX [index_name] (index_col_name,...) + or UNIQUE [INDEX] [index_name] (index_col_name,...) + or FULLTEXT [INDEX] [index_name] (index_col_name,...) + or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) + [reference_definition] + or CHECK (expr) + */ + + /* + CREATE [UNIQUE|FULLTEXT] INDEX index_name + ON tbl_name (col_name[(length)],... ) + */ + + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + if ($this->alterTableAddIndex) $sql[] = "ALTER TABLE $tabname DROP INDEX $idxname"; + else $sql[] = sprintf($this->dropIndex, $idxname, $tabname); + + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + if (isset($idxoptions['FULLTEXT'])) { + $unique = ' FULLTEXT'; + } elseif (isset($idxoptions['UNIQUE'])) { + $unique = ' UNIQUE'; + } else { + $unique = ''; + } + + if ( is_array($flds) ) $flds = implode(', ',$flds); + + if ($this->alterTableAddIndex) $s = "ALTER TABLE $tabname ADD $unique INDEX $idxname "; + else $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname; + + $s .= ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + $sql[] = $s; + + return $sql; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,290 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_oci8 extends ADODB_DataDict { + + var $databaseType = 'oci8'; + var $seqField = false; + var $seqPrefix = 'SEQ_'; + var $dropTable = "DROP TABLE %s CASCADE CONSTRAINTS"; + var $trigPrefix = 'TRIG_'; + var $alterCol = ' MODIFY '; + var $typeX = 'VARCHAR(4000)'; + var $typeXL = 'CLOB'; + + function MetaType($t,$len=-1) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + switch (strtoupper($t)) { + case 'VARCHAR': + case 'VARCHAR2': + case 'CHAR': + case 'VARBINARY': + case 'BINARY': + if (isset($this) && $len <= $this->blobSize) return 'C'; + return 'X'; + + case 'NCHAR': + case 'NVARCHAR2': + case 'NVARCHAR': + if (isset($this) && $len <= $this->blobSize) return 'C2'; + return 'X2'; + + case 'NCLOB': + case 'CLOB': + return 'XL'; + + case 'LONG RAW': + case 'LONG VARBINARY': + case 'BLOB': + return 'B'; + + case 'DATE': + return 'T'; + + case 'INT': + case 'SMALLINT': + case 'INTEGER': + return 'I'; + + default: + return 'N'; + } + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'X': return $this->typeX; + case 'XL': return $this->typeXL; + + case 'C2': return 'NVARCHAR2'; + case 'X2': return 'NVARCHAR2(4000)'; + + case 'B': return 'BLOB'; + + case 'D': + case 'T': return 'DATE'; + case 'L': return 'DECIMAL(1)'; + case 'I1': return 'DECIMAL(3)'; + case 'I2': return 'DECIMAL(5)'; + case 'I': + case 'I4': return 'DECIMAL(10)'; + + case 'I8': return 'DECIMAL(20)'; + case 'F': return 'DECIMAL'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function CreateDatabase($dbname, $options=false) + { + $options = $this->_Options($options); + $password = isset($options['PASSWORD']) ? $options['PASSWORD'] : 'tiger'; + $tablespace = isset($options["TABLESPACE"]) ? " DEFAULT TABLESPACE ".$options["TABLESPACE"] : ''; + $sql[] = "CREATE USER ".$dbname." IDENTIFIED BY ".$password.$tablespace; + $sql[] = "GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO $dbname"; + + return $sql; + } + + function AddColumnSQL($tabname, $flds) + { + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname ADD ("; + foreach($lines as $v) { + $f[] = "\n $v"; + } + + $s .= implode(', ',$f).')'; + $sql[] = $s; + return $sql; + } + + function AlterColumnSQL($tabname, $flds) + { + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname MODIFY("; + foreach($lines as $v) { + $f[] = "\n $v"; + } + $s .= implode(', ',$f).')'; + $sql[] = $s; + return $sql; + } + + function DropColumnSQL($tabname, $flds) + { + if (!is_array($flds)) $flds = explode(',',$flds); + foreach ($flds as $k => $v) $flds[$k] = $this->NameQuote($v); + + $sql = array(); + $s = "ALTER TABLE $tabname DROP("; + $s .= implode(', ',$flds).') CASCADE CONSTRAINTS'; + $sql[] = $s; + return $sql; + } + + function _DropAutoIncrement($t) + { + if (strpos($t,'.') !== false) { + $tarr = explode('.',$t); + return "drop sequence ".$tarr[0].".seq_".$tarr[1]; + } + return "drop sequence seq_".$t; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + + if ($fdefault == "''" && $fnotnull) {// this is null in oracle + $fnotnull = false; + if ($this->debug) ADOConnection::outp("NOT NULL and DEFAULT='' illegal in Oracle"); + } + + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + + if ($fautoinc) $this->seqField = $fname; + if ($fconstraint) $suffix .= ' '.$fconstraint; + + return $suffix; + } + +/* +CREATE or replace TRIGGER jaddress_insert +before insert on jaddress +for each row +begin +select seqaddress.nextval into :new.A_ID from dual; +end; +*/ + function _Triggers($tabname,$tableoptions) + { + if (!$this->seqField) return array(); + + if ($this->schema) { + $t = strpos($tabname,'.'); + if ($t !== false) $tab = substr($tabname,$t+1); + else $tab = $tabname; + $seqname = $this->schema.'.'.$this->seqPrefix.$tab; + $trigname = $this->schema.'.'.$this->trigPrefix.$this->seqPrefix.$tab; + } else { + $seqname = $this->seqPrefix.$tabname; + $trigname = $this->trigPrefix.$seqname; + } + + if (strlen($seqname) > 30) { + $seqname = $this->seqPrefix.uniqid(''); + } // end if + if (strlen($trigname) > 30) { + $trigname = $this->trigPrefix.uniqid(''); + } // end if + + if (isset($tableoptions['REPLACE'])) $sql[] = "DROP SEQUENCE $seqname"; + $seqCache = ''; + if (isset($tableoptions['SEQUENCE_CACHE'])){$seqCache = $tableoptions['SEQUENCE_CACHE'];} + $seqIncr = ''; + if (isset($tableoptions['SEQUENCE_INCREMENT'])){$seqIncr = ' INCREMENT BY '.$tableoptions['SEQUENCE_INCREMENT'];} + $seqStart = ''; + if (isset($tableoptions['SEQUENCE_START'])){$seqIncr = ' START WITH '.$tableoptions['SEQUENCE_START'];} + $sql[] = "CREATE SEQUENCE $seqname $seqStart $seqIncr $seqCache"; + $sql[] = "CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON $tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField = 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END;"; + + $this->seqField = false; + return $sql; + } + + /* + CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] + [table_options] [select_statement] + create_definition: + col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] + [PRIMARY KEY] [reference_definition] + or PRIMARY KEY (index_col_name,...) + or KEY [index_name] (index_col_name,...) + or INDEX [index_name] (index_col_name,...) + or UNIQUE [INDEX] [index_name] (index_col_name,...) + or FULLTEXT [INDEX] [index_name] (index_col_name,...) + or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) + [reference_definition] + or CHECK (expr) + */ + + + + function _IndexSQL($idxname, $tabname, $flds,$idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + if (isset($idxoptions['BITMAP'])) { + $unique = ' BITMAP'; + } elseif (isset($idxoptions['UNIQUE'])) { + $unique = ' UNIQUE'; + } else { + $unique = ''; + } + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + if (isset($idxoptions['oci8'])) + $s .= $idxoptions['oci8']; + + + $sql[] = $s; + + return $sql; + } + + function GetCommentSQL($table,$col) + { + $table = $this->connection->qstr($table); + $col = $this->connection->qstr($col); + return "select comments from USER_COL_COMMENTS where TABLE_NAME=$table and COLUMN_NAME=$col"; + } + + function SetCommentSQL($table,$col,$cmt) + { + $cmt = $this->connection->qstr($cmt); + return "COMMENT ON COLUMN $table.$col IS $cmt"; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,447 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_postgres extends ADODB_DataDict { + + var $databaseType = 'postgres'; + var $seqField = false; + var $seqPrefix = 'SEQ_'; + var $addCol = ' ADD COLUMN'; + var $quote = '"'; + var $renameTable = 'ALTER TABLE %s RENAME TO %s'; // at least since 7.1 + var $dropTable = 'DROP TABLE %s CASCADE'; + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->unique && + $fieldobj->has_default && substr($fieldobj->default_value,0,8) == 'nextval('; + + switch (strtoupper($t)) { + case 'INTERVAL': + case 'CHAR': + case 'CHARACTER': + case 'VARCHAR': + case 'NAME': + case 'BPCHAR': + if ($len <= $this->blobSize) return 'C'; + + case 'TEXT': + return 'X'; + + case 'IMAGE': // user defined type + case 'BLOB': // user defined type + case 'BIT': // This is a bit string, not a single bit, so don't return 'L' + case 'VARBIT': + case 'BYTEA': + return 'B'; + + case 'BOOL': + case 'BOOLEAN': + return 'L'; + + case 'DATE': + return 'D'; + + case 'TIME': + case 'DATETIME': + case 'TIMESTAMP': + case 'TIMESTAMPTZ': + return 'T'; + + case 'INTEGER': return !$is_serial ? 'I' : 'R'; + case 'SMALLINT': + case 'INT2': return !$is_serial ? 'I2' : 'R'; + case 'INT4': return !$is_serial ? 'I4' : 'R'; + case 'BIGINT': + case 'INT8': return !$is_serial ? 'I8' : 'R'; + + case 'OID': + case 'SERIAL': + return 'R'; + + case 'FLOAT4': + case 'FLOAT8': + case 'DOUBLE PRECISION': + case 'REAL': + return 'F'; + + default: + return 'N'; + } + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BYTEA'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'INT2'; + case 'I4': return 'INT4'; + case 'I8': return 'INT8'; + + case 'F': return 'FLOAT8'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + /** + * Adding a new Column + * + * reimplementation of the default function as postgres does NOT allow to set the default in the same statement + * + * @param string $tabname table-name + * @param string $flds column-names and types for the changed columns + * @return array with SQL strings + */ + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' '; + foreach($lines as $v) { + if (($not_null = preg_match('/NOT NULL/i',$v))) { + $v = preg_replace('/NOT NULL/i','',$v); + } + if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { + list(,$colname,$default) = $matches; + $sql[] = $alter . str_replace('DEFAULT '.$default,'',$v); + $sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default; + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; + } else { + $sql[] = $alter . $v; + } + if ($not_null) { + list($colname) = explode(' ',$v); + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; + } + } + return $sql; + } + + + function DropIndexSQL ($idxname, $tabname = NULL) + { + return array(sprintf($this->dropIndex, $this->TableName($idxname), $this->TableName($tabname))); + } + + /** + * Change the definition of one column + * + * Postgres can't do that on it's own, you need to supply the complete defintion of the new table, + * to allow, recreating the table and copying the content over to the new table + * @param string $tabname table-name + * @param string $flds column-name and type for the changed column + * @param string $tableflds complete defintion of the new table, eg. for postgres, default '' + * @param array/ $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + /* + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if (!$tableflds) { + if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL"); + return array(); + } + return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions); + }*/ + + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + // Check if alter single column datatype available - works with 8.0+ + $has_alter_column = 8.0 <= (float) @$this->serverInfo['version']; + + if ($has_alter_column) { + $tabname = $this->TableName($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; + foreach($lines as $v) { + if ($not_null = preg_match('/NOT NULL/i',$v)) { + $v = preg_replace('/NOT NULL/i','',$v); + } + // this next block doesn't work - there is no way that I can see to + // explicitly ask a column to be null using $flds + else if ($set_null = preg_match('/NULL/i',$v)) { + // if they didn't specify not null, see if they explicitely asked for null + $v = preg_replace('/\sNULL/i','',$v); + } + + if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { + list(,$colname,$default) = $matches; + $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v); + $sql[] = $alter . $colname . ' TYPE ' . str_replace('DEFAULT '.$default,'',$v); + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; + } + else { + // drop default? + preg_match ('/^\s*(\S+)\s+(.*)$/',$v,$matches); + list (,$colname,$rest) = $matches; + $sql[] = $alter . $colname . ' TYPE ' . $rest; + } + + list($colname) = explode(' ',$v); + if ($not_null) { + // this does not error out if the column is already not null + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; + } + if ($set_null) { + // this does not error out if the column is already null + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' DROP NOT NULL'; + } + } + return $sql; + } + + // does not have alter column + if (!$tableflds) { + if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL"); + return array(); + } + return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions); + } + + /** + * Drop one column + * + * Postgres < 7.3 can't do that on it's own, you need to supply the complete defintion of the new table, + * to allow, recreating the table and copying the content over to the new table + * @param string $tabname table-name + * @param string $flds column-name and type for the changed column + * @param string $tableflds complete defintion of the new table, eg. for postgres, default '' + * @param array/ $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + $has_drop_column = 7.3 <= (float) @$this->serverInfo['version']; + if (!$has_drop_column && !$tableflds) { + if ($this->debug) ADOConnection::outp("DropColumnSQL needs complete table-definiton for PostgreSQL < 7.3"); + return array(); + } + if ($has_drop_column) { + return ADODB_DataDict::DropColumnSQL($tabname, $flds); + } + return $this->_recreate_copy_table($tabname,$flds,$tableflds,$tableoptions); + } + + /** + * Save the content into a temp. table, drop and recreate the original table and copy the content back in + * + * We also take care to set the values of the sequenz and recreate the indexes. + * All this is done in a transaction, to not loose the content of the table, if something went wrong! + * @internal + * @param string $tabname table-name + * @param string $dropflds column-names to drop + * @param string $tableflds complete defintion of the new table, eg. for postgres + * @param array/string $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + function _recreate_copy_table($tabname,$dropflds,$tableflds,$tableoptions='') + { + if ($dropflds && !is_array($dropflds)) $dropflds = explode(',',$dropflds); + $copyflds = array(); + foreach($this->MetaColumns($tabname) as $fld) { + if (!$dropflds || !in_array($fld->name,$dropflds)) { + // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one + if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) && + in_array($fld->type,array('varchar','char','text','bytea'))) { + $copyflds[] = "to_number($fld->name,'S9999999999999D99')"; + } else { + $copyflds[] = $fld->name; + } + // identify the sequence name and the fld its on + if ($fld->primary_key && $fld->has_default && + preg_match("/nextval\('([^']+)'::text\)/",$fld->default_value,$matches)) { + $seq_name = $matches[1]; + $seq_fld = $fld->name; + } + } + } + $copyflds = implode(', ',$copyflds); + + $tempname = $tabname.'_tmp'; + $aSql[] = 'BEGIN'; // we use a transaction, to make sure not to loose the content of the table + $aSql[] = "SELECT * INTO TEMPORARY TABLE $tempname FROM $tabname"; + $aSql = array_merge($aSql,$this->DropTableSQL($tabname)); + $aSql = array_merge($aSql,$this->CreateTableSQL($tabname,$tableflds,$tableoptions)); + $aSql[] = "INSERT INTO $tabname SELECT $copyflds FROM $tempname"; + if ($seq_name && $seq_fld) { // if we have a sequence we need to set it again + $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence + $aSql[] = "SELECT setval('$seq_name',MAX($seq_fld)) FROM $tabname"; + } + $aSql[] = "DROP TABLE $tempname"; + // recreate the indexes, if they not contain one of the droped columns + foreach($this->MetaIndexes($tabname) as $idx_name => $idx_data) + { + if (substr($idx_name,-5) != '_pkey' && (!$dropflds || !count(array_intersect($dropflds,$idx_data['columns'])))) { + $aSql = array_merge($aSql,$this->CreateIndexSQL($idx_name,$tabname,$idx_data['columns'], + $idx_data['unique'] ? array('UNIQUE') : False)); + } + } + $aSql[] = 'COMMIT'; + return $aSql; + } + + function DropTableSQL($tabname) + { + $sql = ADODB_DataDict::DropTableSQL($tabname); + + $drop_seq = $this->_DropAutoIncrement($tabname); + if ($drop_seq) $sql[] = $drop_seq; + + return $sql; + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'SERIAL'; + return ''; + } + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + // search for a sequece for the given table (asumes the seqence-name contains the table-name!) + // if yes return sql to drop it + // this is still necessary if postgres < 7.3 or the SERIAL was created on an earlier version!!! + function _DropAutoIncrement($tabname) + { + $tabname = $this->connection->quote('%'.$tabname.'%'); + + $seq = $this->connection->GetOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'"); + + // check if a tables depends on the sequenz and it therefor cant and dont need to be droped separatly + if (!$seq || $this->connection->GetOne("SELECT relname FROM pg_class JOIN pg_depend ON pg_class.relfilenode=pg_depend.objid WHERE relname='$seq' AND relkind='S' AND deptype='i'")) { + return False; + } + return "DROP SEQUENCE ".$seq; + } + + function RenameTableSQL($tabname,$newname) + { + if (!empty($this->schema)) { + $rename_from = $this->TableName($tabname); + $schema_save = $this->schema; + $this->schema = false; + $rename_to = $this->TableName($newname); + $this->schema = $schema_save; + return array (sprintf($this->renameTable, $rename_from, $rename_to)); + } + + return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname))); + } + + /* + CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( + { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ] + | table_constraint } [, ... ] + ) + [ INHERITS ( parent_table [, ... ] ) ] + [ WITH OIDS | WITHOUT OIDS ] + where column_constraint is: + [ CONSTRAINT constraint_name ] + { NOT NULL | NULL | UNIQUE | PRIMARY KEY | + CHECK (expression) | + REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ] + [ ON DELETE action ] [ ON UPDATE action ] } + [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] + and table_constraint is: + [ CONSTRAINT constraint_name ] + { UNIQUE ( column_name [, ... ] ) | + PRIMARY KEY ( column_name [, ... ] ) | + CHECK ( expression ) | + FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ] + [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } + [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] + */ + + + /* + CREATE [ UNIQUE ] INDEX index_name ON table +[ USING acc_method ] ( column [ ops_name ] [, ...] ) +[ WHERE predicate ] +CREATE [ UNIQUE ] INDEX index_name ON table +[ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] ) +[ WHERE predicate ] + */ + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; + + $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' '; + + if (isset($idxoptions['HASH'])) + $s .= 'USING HASH '; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s .= '(' . $flds . ')'; + $sql[] = $s; + + return $sql; + } + + function _GetSize($ftype, $ty, $fsize, $fprec) + { + if (strlen($fsize) && $ty != 'X' && $ty != 'B' && $ty != 'I' && strpos($ftype,'(') === false) { + $ftype .= "(".$fsize; + if (strlen($fprec)) $ftype .= ",".$fprec; + $ftype .= ')'; + } + return $ftype; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,121 @@ +<?php + +/** + V4.50 6 July 2004 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + + Modified from datadict-generic.inc.php for sapdb by RalfBecker-AT-outdoor-training.de +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_sapdb extends ADODB_DataDict { + + var $databaseType = 'sapdb'; + var $seqField = false; + var $renameColumn = 'RENAME COLUMN %s.%s TO %s'; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'LONG'; + + case 'C2': return 'VARCHAR UNICODE'; + case 'X2': return 'LONG UNICODE'; + + case 'B': return 'LONG'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'FIXED(3)'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'FIXED(20)'; + + case 'F': return 'FLOAT(38)'; + case 'N': return 'FIXED'; + default: + return $meta; + } + } + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + static $maxdb_type2adodb = array( + 'VARCHAR' => 'C', + 'CHARACTER' => 'C', + 'LONG' => 'X', // no way to differ between 'X' and 'B' :-( + 'DATE' => 'D', + 'TIMESTAMP' => 'T', + 'BOOLEAN' => 'L', + 'INTEGER' => 'I4', + 'SMALLINT' => 'I2', + 'FLOAT' => 'F', + 'FIXED' => 'N', + ); + $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C'; + + // convert integer-types simulated with fixed back to integer + if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) { + $type = $len == 20 ? 'I8' : 'I1'; + } + if ($fieldobj->auto_increment) $type = 'R'; + + return $type; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + if ($funsigned) $suffix .= ' UNSIGNED'; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fautoinc) $suffix .= ' DEFAULT SERIAL'; + elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' ); + } + + function AlterColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' ); + } + + function DropColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + if (!is_array($flds)) $flds = explode(',',$flds); + foreach($flds as $k => $v) { + $flds[$k] = $this->NameQuote($v); + } + return array( 'ALTER TABLE ' . $tabname . ' DROP ... [truncated message content] |
From: <fan...@us...> - 2008-02-17 22:50:19
|
Revision: 4880 http://linpha.svn.sourceforge.net/linpha/?rev=4880&view=rev Author: fangehrn Date: 2008-02-17 14:50:14 -0800 (Sun, 17 Feb 2008) Log Message: ----------- 2008-02-17 flo * implemented adodb datadict - mysql works - sqlite works - fixed plugin tables creation - fixed reset_database.php * changed mysql to utf8 - database creation - table creation - database connection Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_db.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/install/footer.php trunk/linpha2/install/header_html.php trunk/linpha2/install/manual_install.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/sql/sql.tables.php trunk/linpha2/lib/plugins/example/sql/sql.data.php trunk/linpha2/lib/plugins/maps/sql/sql.data.php trunk/linpha2/reset_database.php Added Paths: ----------- trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php trunk/linpha2/lib/include/sql/sql.tablesconfig.php Removed Paths: ------------- trunk/linpha2/lib/include/sql/sql.info.txt trunk/linpha2/lib/include/sql/sql.mysql.php trunk/linpha2/lib/include/sql/sql.oci8po.php trunk/linpha2/lib/include/sql/sql.postgres.php trunk/linpha2/lib/include/sql/sql.sqlite.php trunk/linpha2/lib/plugins/example/sql/sql.mysql.php trunk/linpha2/lib/plugins/example/sql/sql.oci8po.php trunk/linpha2/lib/plugins/example/sql/sql.postgres.php trunk/linpha2/lib/plugins/example/sql/sql.sqlite.php trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/ChangeLog 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,4 +1,16 @@ +2008-02-17 flo + * implemented adodb datadict + - mysql works + - sqlite works + - fixed plugin tables creation + - fixed reset_database.php + + * changed mysql to utf8 + - database creation + - table creation + - database connection + 2008-02-13 flo * moved not needed files to the misc folder * updated adodb to version 504 Modified: trunk/linpha2/admin/maintenance_db.php =================================================================== --- trunk/linpha2/admin/maintenance_db.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/admin/maintenance_db.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -323,7 +323,7 @@ else { echo '<font color="red">'.i18n("failed").'</font><br />'; - echo i18n("Please check the database, these entry is missing!").'<br />'; + echo i18n("Please check the database, this entry is missing!").'<br />'; } echo '<br />'; } Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -11,77 +11,90 @@ /** * save settings before showing menu */ - if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - foreach($arrPlugins as $value) - { - $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; - } - - /** - * create database tables and insert config data if necessary - */ - foreach($arrPlugins as $value) // go through all plugins - { - // only if we enabled the plugin now and it didn't existed before - if( isset($_POST['plugins_'.$value.'_enable']) - && $_POST['plugins_'.$value.'_enable']=='1' - && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) - { - $str1 = i18n("Enabling plugin \"%s\""); - linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); - - /** - * create database tables - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; - if( file_exists($includeFile) ) - { - $sql_tables = array(); - include($includeFile); + if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; + + foreach($arrPlugins as $value) + { + $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; + } + + /** + * create database tables and insert config data if necessary + */ + foreach($arrPlugins as $value) // go through all plugins + { + // only if we enabled the plugin now and it didn't existed before + if( isset($_POST['plugins_'.$value.'_enable']) + && $_POST['plugins_'.$value.'_enable']=='1' + && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) + { + $str1 = i18n("Enabling plugin \"%s\""); + linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); + + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; + if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) + { + $sql_queries = array(); + $linpha_tables = array(); + include_once($includeFile); + + /** + * create database tables + */ + if (LIN_DB_TYPE=='sqlite') { + $dict = &NewDataDictionary($linpha->db,'sqlite'); // force use of sqlite datadict file + } else { + $dict = &NewDataDictionary($linpha->db); + } + //$dict->debug = true; + + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + + /** + * if the table already exists, we get automatically a nice message like + * "Table 'linpha2_plugins_maps_markers' already exists" + */ + if ($dict->ExecuteSQLArray($sqlarray, $continue_on_error = false) != 2) { + /** + * RETURNS: 0 if failed, 1 if executed all but with errors, 2 if executed successfully + * $sqlarray: an array of strings with sql code (no semicolon at the end of string) + * $contOnError: if true, then continue executing even if error occurs + */ + + linSysLog($linpha->db->ErrorMsg()); + } + } + + /** + * insert config data + */ + linSysLog(i18n("Insert config data")); + foreach($sql_queries as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + + } + } + } + unset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT']); + + // set plugins_*_enable to '1' + $LinAdmin->saveConfig($arrPluginsFullName); + } - linSysLog(i18n("Creating tables")); - foreach($sql_tables as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - /** - * insert config data - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; - if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) - { - $sql_queries = array(); - include($includeFile); - - linSysLog(i18n("Insert config data")); - foreach($sql_queries as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - } - } - - // set plugins_*_enable to '1' - $LinAdmin->saveConfig($arrPluginsFullName); - } - /** * show menu */ Modified: trunk/linpha2/install/footer.php =================================================================== --- trunk/linpha2/install/footer.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/footer.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -31,12 +31,19 @@ </div> </form> +<script language="JavaScript" type='text/javascript'> +<!-- <?php -if(isset($do_javascript_disable_button)) +if (isset($do_javascript_disable_backbutton)) { + ?> + document.back_form.submit_button.disabled = true; + <?php +} + +if (isset($do_javascript_disable_button)) +{ ?> -<script language="JavaScript" type='text/javascript'> -<!-- document.install_form.next_button.disabled = true; function checkForm() @@ -81,11 +88,13 @@ // run at startup to enable text fields if values are preentered checkForm(); -//--> -</script> <?php } ?> +//--> +</script> + + </div> </div> </body> Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/header_html.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -77,7 +77,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> -<title><?php echo i18n_install("LinPHA2 Install Wizzard"); ?></title> +<title><?php echo i18n_install("LinPHA 2 Installation Wizzard"); ?></title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="layout.css" /> @@ -91,7 +91,7 @@ <img class='header_icons' src='./graphics/start.png' /> </div> <div class="header_right"> - <h1 class="header_title"><?php echo i18n_install("Linpha 2 Installation Wizzard"); ?></h1> + <h1 class="header_title"><?php echo i18n_install("LinPHA 2 Installation Wizzard"); ?></h1> <p class='header_subinfo'><?php echo $strStep; ?></p> </div> </div> Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/manual_install.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -39,7 +39,7 @@ 'sql_prefix' => 'linpha_' ); - foreach($array AS $key=>$value) + foreach($array as $key=>$value) { if(isset($_POST[$key])) { @@ -54,19 +54,40 @@ /** * define variables manually */ - $_SESSION['sql_hostname'] = "localhost"; - $_SESSION['sql_username'] = "root"; - $_SESSION['sql_password'] = ""; - $_SESSION['sql_dbname'] = "linpha"; - $_SESSION['sql_dbport'] = "3306"; - $_SESSION['hash_secret'] = ""; - - define('LIN_PREFIX', $_SESSION['sql_prefix']); define('LIN_DB_TYPE', $_SESSION['sql_dbtype']); + $_SESSION['sql_hostname'] = "localhost"; + $_SESSION['sql_username'] = "root"; + $_SESSION['sql_password'] = ""; + $_SESSION['sql_dbname'] = "linpha"; + $_SESSION['hash_secret'] = ""; + switch(LIN_DB_TYPE) + { + case 'mysql': + $_SESSION['sql_dbport'] = "3306"; + break; + case 'sqlite': + $_SESSION['sql_hostname'] = ""; + $_SESSION['sql_username'] = ""; + $_SESSION['sql_password'] = ""; + $_SESSION['sql_dbname'] = "sqlite.db"; + $_SESSION['sql_dbport'] = ""; + break; + case 'postgres': + $_SESSION['sql_dbport'] = "5432"; + break; + case 'oci8po': + $_SESSION['sql_dbport'] = "1521"; + break; + default: + $_SESSION['sql_dbport'] = ""; + break; + } + + echo "<h2>".i18n_install("LinPHA Manual Install")."</h2>"; ?> <br /> @@ -82,29 +103,26 @@ /** * create tables */ - /** - * get table names and add prefix - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); - foreach($linpha_tables AS $key=>$value) - { - $linpha_tables[$key] = LIN_PREFIX.$value; - } - - /** - * include sql strings - */ - include_once(LINPHA_DIR."/lib/include/sql/sql.".LIN_DB_TYPE.".php"); - - /** - * finally create tables - */ - $str_query = ""; - while( list($key,$query) = each($sql_tables) ) - { - $str_query .= $query.";\n"; - } + require_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + $db = ADONewConnection(LIN_DB_TYPE); + $dict = NewDataDictionary($db,LIN_DB_TYPE); + + $str_query = ""; + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + foreach($sqlarray as $query) + { + $str_query .= $query.";\n"; + } + } + /** * insert data */ @@ -155,11 +173,11 @@ * sql config file */ $comment[1] = $donotchange; -$comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; -$comment[6] = $donotchange; -$comment[7] = $changeme; +$comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; $comment[6] = $changeme; +$comment[7] = $donotchange; $comment[8] = $changeme; +$str = ''; include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); ?> <br /><br /> @@ -169,6 +187,8 @@ <br /><br /> +<b><?php echo i18n_install("Please make sure all these database, databases tables, folders and files exist before continuing."); ?></b> + <form method="POST" action="<?php echo $next_file; ?>"> <?php include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -51,23 +51,7 @@ $_SESSION['install_mode'] = $_POST['install_mode']; } -/** - * sqlite doesn't know anyhting about username, password, hostname and - * databasename -> skip the following pages - */ - if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") - { - $_SESSION['sql_username'] = ''; - $_SESSION['sql_password'] = ''; - $_SESSION['sql_hostname'] = ''; - $_SESSION['sql_dbname'] = 'database.sqlite'; - $_SESSION['sql_prefix'] = 'linpha_'; - - $next_file = "step7_selectprefix.php"; - } - - include_once(LINPHA_DIR.'/install/header_html.php'); echo i18n_install("For security reasons folders were named random.").' '; Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step5_getlogin.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -64,9 +64,12 @@ header("Location: manual_install.php"); exit(); } - } +if ($_SESSION['sql_dbtype']=='sqlite') +{ + $next_file = 'step7_selectprefix.php'; +} include_once(LINPHA_DIR.'/install/header_html.php'); if(isset($_POST['cmd_step4'])) @@ -81,72 +84,82 @@ exit(); } } -?> - -<h1><?php echo $title_str[$key]; ?></h1> -<hr /> -<br /> -<?php -if($_SESSION['sql_dbtype'] == 'mysql') -{ - echo i18n_install("NOTE: If you have setup a root Password for your MySQL Database please login using your root account."); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '3306'; -} -elseif($_SESSION['sql_dbtype'] == 'postgres') +elseif ($_SESSION['sql_dbtype']=='sqlite') { - echo i18n_install("NOTE: There is currently now way to let LinPHA create the required Database, so you have to create a new Database using \"createdb\" from commandline before you proceed."); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '5432'; + // show at least one message + echo i18n_install("Directories already created."); } -elseif($_SESSION['sql_dbtype'] == 'oci8po') + +if ($_SESSION['sql_dbtype'] != 'sqlite') { - echo i18n_install("NOTE: Oracle support is only testet on XE the \"Free\" Edition. If you get things running using a \"real\" Oracle Database please drop us a note!"); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '1521'; + ?> + + <h1><?php echo $title_str[$key]; ?></h1> + <hr /> + <br /> + <?php + + if($_SESSION['sql_dbtype'] == 'mysql') + { + echo i18n_install("NOTE: If you have setup a root Password for your MySQL Database please login using your root account."); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '3306'; + } + elseif($_SESSION['sql_dbtype'] == 'postgres') + { + echo i18n_install("NOTE: There is currently now way to let LinPHA create the required Database, so you have to create a new Database using \"createdb\" from commandline before you proceed."); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '5432'; + } + elseif($_SESSION['sql_dbtype'] == 'oci8po') + { + echo i18n_install("NOTE: Oracle support is only testet on XE the \"Free\" Edition. If you get things running using a \"real\" Oracle Database please drop us a note!"); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '1521'; + } + ?> + + <div class="boxalign"> + <?php echo i18n_install("Username").":"; ?> + <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" + name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> + <br /> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Password").":"; ?> + <input class="boxalignelement" type="password" id="check02" + onKeyup="checkForm()" name="sql_password"> + <br /> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Hostname").":"; ?> + <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" + name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? + $_SESSION['sql_hostname'] : 'localhost' ; ?>"> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Port").":"; ?> + <input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" + name="sql_dbport" value="<?php echo isset($_SESSION['sql_dbport']) ? + $_SESSION['sql_dbport'] : '3306' ; ?>"> + </div> + + + <?php + + $array_check = array( + 'check01' => 'text', + //'check02' => 'text', + 'check03' => 'text', + 'check04' => 'text' + ); + + $do_javascript_disable_button = true; } -?> - -<div class="boxalign"> -<?php echo i18n_install("Username").":"; ?> -<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" - name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> -<br /> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Password").":"; ?> -<input class="boxalignelement" type="password" id="check02" - onKeyup="checkForm()" name="sql_password"> -<br /> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Hostname").":"; ?> -<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" - name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? - $_SESSION['sql_hostname'] : 'localhost' ; ?>"> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Port").":"; ?> -<input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" - name="sql_dbport" value="<?php echo isset($_SESSION['sql_dbport']) ? - $_SESSION['sql_dbport'] : '3306' ; ?>"> -</div> - - -<?php - -$array_check = array( - 'check01' => 'text', - //'check02' => 'text', - 'check03' => 'text', - 'check04' => 'text' -); - -$do_javascript_disable_button = true; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -28,11 +28,17 @@ /** - * sqlite go back stuff + * sqlite go back and validation stuff */ if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { - $back_file = "step4_selectdirectories.php"; + $back_file = "step5_getlogin.php"; + + $_SESSION['sql_username'] = ''; + $_SESSION['sql_password'] = ''; + $_SESSION['sql_hostname'] = ''; + $_SESSION['sql_dbname'] = 'database.sqlite'; + $_SESSION['sql_prefix'] = 'linpha_'; } include_once(LINPHA_DIR.'/install/header_html.php'); @@ -130,24 +136,6 @@ break; case "sqlite": - /** - * checking album, sql, cache and tmp directory - */ - if(isset($_POST['cmd_step4'])) - { - /** - * checking album, sql, cache and tmp directory - */ - $dirs = initSessionValues(); - if(initInitialDirectories($dirs) != true) - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(); - } - } - - if (isset($_SESSION['sqlite_db_created']) && $_SESSION['sqlite_db_created']==$_SESSION['sql_dir']) { echo i18n_install("Sqlite database already created, please continue to next step."); Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step8_testing.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -72,8 +72,6 @@ echo success_msg(); - - echo '<br />'; /** @@ -81,29 +79,24 @@ */ if($_SESSION['sql_dbtype'] != "sqlite") { - ?> - <?php echo i18n_install("Checking For Existing Tables...").' '; ?> - <?php - $array_tables = $linpha->db->MetaTables(); + echo i18n_install("Checking For Existing Tables...").' '; + + $array_tables = $linpha->db->MetaTables(); - if (! isset($array_tables) OR ! is_array($array_tables)) + if (!isset($array_tables) OR !is_array($array_tables)) { echo failed_msg(); - echo "<br />".i18n_install("Cannot Read Tables").": ".mysql_error(); + echo "<br />".i18n_install("Error: Cannot read tables from database."); + echo $linpha->db->ErrorMsg().'<br />'; + $error_nr = 2; } else { - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + $linpha_tables = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + $linpha_tables = array_keys($linpha_tables); - /** - * add prefix - */ - foreach($linpha_tables as $key=>$value) - { - $linpha_tables[$key] = $_SESSION['sql_prefix'].$value; - } - $result = array_intersect ($linpha_tables, $array_tables); if(isset($result) && is_array($result) && (count($result) > 0) ) @@ -127,7 +120,7 @@ * try to create a new db user */ $n_runs = 1; -if($_SESSION['sql_dbtype'] == "mysql") +if ( $_SESSION['sql_dbtype'] == "mysql" && !isset($_SESSION['no_create_new_user']) ) // no_create_new_user is set later when we are already successfully running the new user (and of course have no permission to create another one) { echo i18n_install("Trying To Create New LinPHA Database User...").' '; $random_pass = installRandomString(10); @@ -292,22 +285,19 @@ } } -/** - * new user failed, use old connection - */ - if(isset($use_other_conn)) - { - echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; - $linpha->db = $orig_conn; // @TODO flo: i don't think that this makes any sense... - } - elseif($n_runs == 2) - { - $_SESSION['sql_username'] = $random_user; - $_SESSION['sql_password'] = $random_pass; - } +if(isset($use_other_conn)) +{ + echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; +} +elseif($n_runs == 2) +{ + $_SESSION['sql_username'] = $random_user; + $_SESSION['sql_password'] = $random_pass; + $_SESSION['no_create_new_user'] = true; // set this variable to prevent create another user if we later press the back button +} echo '<br /><br />'; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step9_createtables.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -23,106 +23,56 @@ * linpha installer * @package Installation */ -include_once(LINPHA_DIR.'/lib/include/common.php'); -include_once(LINPHA_DIR.'/install/header.php'); +require_once(LINPHA_DIR.'/lib/include/common.php'); +require_once(LINPHA_DIR.'/install/header.php'); +require_once(LINPHA_DIR.'/install/header_html.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -/** - * now, it is too late to go back... - */ -$show_back_button = false; - -include_once(LINPHA_DIR.'/install/header_html.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new Linpha(); $linpha->sql->dbConnect(); /** * create tables */ - /** - * get table names and add prefix - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); - - // append LIN_PREFIX before each table - // but we also could do this directly in the sql.mysql.php file!? - foreach($linpha_tables as $key=>$value) - { - $linpha_tables[$key] = LIN_PREFIX.$value; - } - - /** - * include sql strings - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.'.LIN_DB_TYPE.'.php'); - - /** - * finally create tables - */ - echo i18n_install("Creating Tables...").' '; - - $translation_array = array_keys($linpha_tables); // only used in error case - while( list($key,$query) = each($sql_tables) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo LIN_PREFIX.$translation_array[$key].' '; - echo failed_msg(); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - /** - * take care of oracle sequences and triggers - */ - if($_SESSION['sql_dbtype'] == 'oci8po') - { - echo i18n_install("Creating Sequences...")."<br /> "; - - /** - * create sequences - */ - while( list($key, $query) = each($sql_sequence) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo failed_msg(); - echo sprintf( i18n_install("Failed To Create Sequence for [%s]",$key) ); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - - /** - * create triggers - */ - echo i18n_install("Creating Triggers...")."<br /> "; - while( list($key, $query) = each($sql_trigger) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo failed_msg(); - echo sprintf( i18n_install("Failed To Create Trigger for [%s]",$key) ); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - } + echo i18n_install("Creating Tables...").' '; + + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + if (LIN_DB_TYPE=='sqlite') { + $dict = &NewDataDictionary($linpha->db,'sqlite'); // force use of sqlite datadict file + } else { + $dict = &NewDataDictionary($linpha->db); + } + //$dict->debug = true; + + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + + if ($dict->ExecuteSQLArray($sqlarray, $continue_on_error = false) != 2) { + /** + * RETURNS: 0 if failed, 1 if executed all but with errors, 2 if executed successfully + * $sqlarray: an array of strings with sql code (no semicolon at the end of string) + * $contOnError: if true, then continue executing even if error occurs + */ + $error_nr = 1; + } + } - if(!isset($error_nr)) - { - echo success_msg(); - } - else - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(1); - } + if(!isset($error_nr)) + { + echo success_msg(); + } + else + { + echo failed_msg(); + $show_next_button = false; + include_once(LINPHA_DIR.'/install/footer.php'); + exit(1); + } /** * insert data @@ -158,8 +108,8 @@ * create cache directories */ echo "<br />".i18n_install("Creating Cache Directories...").' '; - mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/img', 0700); - mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/thumb', 0700); + @mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/img', 0700); + @mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/thumb', 0700); echo success_msg(); @@ -237,7 +187,8 @@ exit(1); } +$do_javascript_disable_backbutton = true; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -0,0 +1,82 @@ +<?php + +/** + V4.64 20 June 2005 (c) 2000-2005 John Lim (jl...@na...). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_sqlite extends ADODB_DataDict { + + var $databaseType = 'sqlite'; + var $seqField = false; + + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + switch (strtoupper($t)) { + case 'TEXT': + return 'X'; + case 'FLOAT': + case 'DOUBLE': + return 'F'; + } + return parent::MetaType($t,$len,$fieldobj); + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'TEXT'; + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATE'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'INTEGER'; + case 'I2': return 'INTEGER'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } +} + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -83,7 +83,10 @@ * -> no need anymore for : * if(!$create) { echo $GLOBALS['db']->ErrorMsg().'<br />'; } */ - echo $s.'<br />'; + if (!isset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'])) + { + linSysLog($s.'<br />'); + } linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -43,10 +43,11 @@ */ function dbConnect() { - + error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); + if(isset($_SESSION['installmode1'])) { - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); $db_type = $_SESSION['sql_dbtype']; $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; @@ -57,8 +58,6 @@ } else { - error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** * if we can keep the "_once" at those include files it would be @@ -130,6 +129,13 @@ break; case "mysql": $GLOBALS['linpha']->db->Connect("$db_hostname:$db_port", $db_username, $db_password, $db_name); + $GLOBALS['linpha']->db->Execute('SET NAMES "UTF8"'); + $GLOBALS['linpha']->db->Execute("SET collation_connection='utf8_general_ci'"); + $GLOBALS['linpha']->db->Execute("SET collation_server='utf8_general_ci'"); + $GLOBALS['linpha']->db->Execute("SET character_set_client='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_connection='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_results='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_server='utf8'"); break; case "postgres": if(isset($db_password)) Deleted: trunk/linpha2/lib/include/sql/sql.info.txt =================================================================== --- trunk/linpha2/lib/include/sql/sql.info.txt 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.info.txt 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,7 +0,0 @@ - - - -- only use lower case table and column names - -missing: utf8 explanations -missing: sample table for each database driver \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,150 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* 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. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INT default '0', " . - "override SMALLINT default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id INT NOT NULL AUTO_INCREMENT , " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INT default '0', " . - "stats_downloads_size INT default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "group_name VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "group_id INT NOT NULL default '0', " . - "user_id INT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "photos_id INT NOT NULL default '0', " . - "perm_type VARCHAR(255) NOT NULL default '0', " . - "permission VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "parent_id INT NOT NULL default '0', " . - "img_type INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "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', " . - "rotate INT NOT NULL default '0', " . - "stats_numbers INT NOT NULL default '0', " . - "stats_views INT NOT NULL default '0', " . - "stats_downloads INT NOT NULL default '0', " . - "geodata INT(1) default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "photo_id INT NOT NULL default '0', " . - "img_width SMALLINT NOT NULL default '0', " . - "img_height SMALLINT NOT NULL default '0', " . - "img_quality SMALLINT NOT NULL default '0', " . - "img_size INT NOT NULL default '0', " . - "is_rotated SMALLINT NOT NULL default '0', " . - "has_watermark SMALLINT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_use INT NOT NULL default '0', " . - "time_creating INT NOT NULL default '0', " . - "hits INT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "name VARCHAR(255) NOT NULL default '', " . - "field_type SMALLINT NOT NULL default '0', " . - "flags SMALLINT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "field_id INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "isprivate SMALLINT default NULL, " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "datetimeoriginal VARCHAR(255) default NULL, " . - "make VARCHAR(255) default NULL, " . - "model VARCHAR(255) default NULL, " . - "artist VARCHAR(255) default NULL, " . - "copyright VARCHAR(255) default NULL, " . - "aperturevalue VARCHAR(255) default NULL, " . - "shutterspeedvalue VARCHAR(255) default NULL, " . - "exposuretime VARCHAR(255) default NULL, " . -// "isospeedratings VARCHAR(255) default NULL, " . - "flash VARCHAR(255) default NULL, " . - "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL, " . -// "jpegcomment VARCHAR(255) default NULL, " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_time INT NOT NULL default '0', " . - "meta_author VARCHAR(255) NOT NULL default '', " . - "meta_comment text NOT NULL, " . - " PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "field_id INT NOT NULL default '0', " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_data VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", -); -?> Deleted: trunk/linpha2/lib/include/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,248 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* 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. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id NUMBER PRIMARY KEY, " . - "option_name VARCHAR2(255) NOT NULL, " . - "option_value VARCHAR2(255), " . - "user_id NUMBER(10) DEFAULT '0', " . - "override NUMBER(6) DEFAULT '0'" . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id NUMBER PRIMARY KEY, " . - "username VARCHAR2(255) NOT NULL, " . - "password VARCHAR2(255) NOT NULL, " . - "user_email VARCHAR2(255) NOT NULL, " . - "display_name VARCHAR2(255), " . - "stats_downloads NUMBER(10) DEFAULT '0', " . - "stats_downloads_size NUMBER(10) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id NUMBER PRIMARY KEY, " . - "group_name VARCHAR2(255) NOT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id NUMBER PRIMARY KEY, " . - "group_id NUMBER(10), " . - "user_id NUMBER(10)" . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id NUMBER PRIMARY KEY, " . - "photos_id NUMBER DEFAULT '0', " . - "perm_type VARCHAR2(255), " . - "permission VARCHAR2(255)" . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id NUMBER PRIMARY KEY, " . - "parent_id NUMBER DEFAULT '0', " . - "img_type NUMBER(10) DEFAULT '0', " . - "name VARCHAR2(255) NOT NULL, " . - "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', " . - "rotate NUMBER(12) DEFAULT '0', " . - "stats_numbers NUMBER(10) DEFAULT '0', " . - "stats_views NUMBER(10) DEFAULT '0', " . - "stats_downloads NUMBER(10) DEFAULT '0'" . - "geodata NUMBER(1) default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id NUMBER PRIMARY KEY, " . - "photo_id NUMBER DEFAULT '0', " . - "img_width NUMBER(6) DEFAULT '0', " . - "img_height NUMBER(6) DEFAULT '0', " . - "img_quality NUMBER(6) DEFAULT '0', " . - "img_size NUMBER(10) DEFAULT '0', " . - "is_rotated NUMBER(2) DEFAULT '0', " . - "has_watermark NUMBER(2) DEFAULT '0', " . - "time_add NUMBER(12) DEFAULT '0', " . - "time_use NUMBER(12) DEFAULT '0', " . - "time_creating NUMBER(12) DEFAULT '0', " . - "hits NUMBER(10) DEFAULT '0'" . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id NUMBER PRIMARY KEY, " . - "name VARCHAR2(255) NOT NULL, " . - "field_type NUMBER(12) DEFAULT '0', " . - "flags NUMBER(6) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id NUMBER PRIMARY KEY, " . - "field_id NUMBER(12) DEFAULT '0', " . - "name VARCHAR2(255), " . - "isprivate NUMBER(6) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR2(32) NOT NULL, " . - "datetimeoriginal VARCHAR2(255) DEFAULT NULL, " . - "make VARCHAR2(255) DEFAULT NULL, " . - "model VARCHAR2(255) DEFAULT NULL, " . - "artist VARCHAR2(255) DEFAULT NULL, " . - "copyright VARCHAR2(255) DEFAULT NULL, " . - "aperturevalue VARCHAR2(255) DEFAULT NULL, " . - "shutterspeedvalue VARCHAR2(255) DEFAULT NULL, " . - "exposuretime VARCHAR2(255) DEFAULT NULL, " . -// "isospeedratings VARCHAR2(255) DEFAULT NULL, " . - "flash VARCHAR2(255) DEFAULT NULL, " . - "focallength VARCHAR2(255) DEFAULT NULL, " . - "fnumber VARCHAR2(255) DEFAULT NULL " . -// "jpegcomment VARCHAR2(255) DEFAULT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR2(32) NOT NULL" . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR2(32) NOT NULL" . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id NUMBER PRIMARY KEY, " . - "md5sum VARCHAR2(32) NOT NULL, " . - "meta_time NUMBER(12) DEFAULT '0', " . - "meta_author VARCHAR2(255), " . - "meta_comment CLOB " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id NUMBER PRIMARY KEY, " . - "field_id NUMBER DEFAULT '0', " . - "md5sum VARCHAR2(32) NOT NULL, " . - "meta_data VARCHAR2(255)" . - ")" -); - -/** - * autoincrement the oracle way ;-) - */ -$sql_sequence[] = "CREATE SEQUENCE config_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE users_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE groups_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE user_group_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE permissions_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE photos_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE photos_cache_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_fields_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_category_seq START WITH 1"; -//$sql_sequence[] = "CREATE SEQUENCE meta_exif_seq START WITH 1"; -//$sql_sequence[] = "CREATE SEQUENCE meta_iptc_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_comments_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_data_seq START WITH 1"; - -$sql_trigger[] = "CREATE OR REPLACE TRIGGER config_trig " . - "BEFORE INSERT ON ".$linpha_tables['config']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT config_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER users_trig " . - "BEFORE INSERT ON ".$linpha_tables['users']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT users_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER groups_trig " . - "BEFORE INSERT ON ".$linpha_tables['groups']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT groups_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER user_group_trig " . - "BEFORE INSERT ON ".$linpha_tables['user_group']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT user_group_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER permissions_trig " . - "BEFORE INSERT ON ".$linpha_tables['permissions']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT permissions_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER photos_trig " . - "BEFORE INSERT ON ".$linpha_tables['photos']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT photos_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER photos_cache_trig " . - "BEFORE INSERT ON ".$linpha_tables['photos_cache']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT photos_cache_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_fields_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_fields']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_fields_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_category_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_category']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_category_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -/*$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_exif_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_exif']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_exif_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; - -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_iptc_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_iptc']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_iptc_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -*/ -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_comments_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_comments']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_comments_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_data_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_data']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_data_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -?> - \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,153 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* 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. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id SERIAL PRIMARY KEY, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INT default '0', " . - "override SMALLINT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id SERIAL PRIMARY KEY, " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INT NOT NULL default 0 , " . - "stats_downloads_size INT NOT NULL default 0 " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id SERIAL PRIMARY KEY, " . - "group_name VARCHAR(255) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id SERIAL PRIMARY KEY, " . - "group_id INT NOT NULL default 0, " . - "user_id INT NOT NULL default 0" . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id SERIAL PRIMARY KEY, " . - "photos_id INT NOT NULL default '0', " . - "perm_type VARCHAR(255) NOT NULL default '0', " . - "permission VARCHAR(255) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id SERIAL PRIMARY KEY, " . - "parent_id INT NOT NULL default '0', " . - "img_type INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL, " . - "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', " . - "rotate INT NOT NULL default '0', " . - "stats_numbers INT NOT NULL default '0', " . - "stats_views INT NOT NULL default '0', " . - "stats_downloads INT NOT NULL default '0', " . - "geodata INT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id SERIAL PRIMARY KEY, " . - "photo_id INT NOT NULL default '0', " . - "img_width SMALLINT NOT NULL default '0', " . - "img_height SMALLINT NOT NULL default '0', " . - "img_quality SMALLINT NOT NULL default '0', " . - "img_size INT NOT NULL default '0', " . - "is_rotated SMALLINT NOT NULL default '0', " . - "has_watermark SMALLINT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_use INT NOT NULL default '0', " . - "time_creating INT NOT NULL default '0', " . - "hits INT NOT NULL default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id SERIAL PRIMARY KEY, " . - "name VARCHAR(255) NOT NULL default '', " . - "field_type SMALLINT NOT NULL default '0', " . - "flags SMALLINT NOT NULL default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id SERIAL PRIMARY KEY, " . - "field_id INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "isprivate SMALLINT default NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "datetimeoriginal VARCHAR(255) default NULL, " . - "make VARCHAR(255) default NULL, " . - "model VARCHAR(255) default NULL, " . - "artist VARCHAR(255) default NULL, " . - "copyright VARCHAR(255) default NULL, " . - "aperturevalue VARCHAR(255) default NULL, " . - "shutterspeedvalue VARCHAR(255) default NULL, " . - "exposuretime VARCHAR(255) default NULL, " . -// "isospeedratings VARCHAR(255) default NULL, " . - "flash VARCHAR(255) default NULL, " . - "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL " . -// "jpegcomment VARCHAR(255) default NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR(32) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id SERIAL PRIMARY KEY, " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_time INT NOT NULL default '0', " . - "meta_author VARCHAR(255) NOT NULL default '', " . - "meta_comment TEXT NOT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id SERIAL PRIMARY KEY, " . - "field_id INT NOT NULL default '0', " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_data VARCHAR(255) NOT NULL default '' " . - ")" -); - -/** - * make md5sum UNIQUE in postgres DB (linpha_meta_iptc and linpha_meta_exif) - * + add important indexes - * @todo - add required indexes! -$sql_tables[] = "CREATE UNIQUE INDEX md5index_iptc ON ".$linpha_tables['meta_iptc']." USING btree (md5sum)"; -$sql_tables[] = "CREATE UNIQUE INDEX md5index_exif ON ".$linpha_tables['meta_exif']." USING btree (md5sum)"; - -$sql_tables[] = "CREATE INDEX prev_path ON ".$linpha_tables['photos']." USING btree (prev_path)"; -$sql_tables[] = "CREATE INDEX date ON ".$linpha_tables['photos']." USING btree (date)"; -$sql_tables[] = "CREATE INDEX name ON ".$linpha_tables['photos']." USING btree (name)"; -$sql_tables[] = "CREATE INDEX filename ON ".$linpha_tables['photos']." USING btree (filename)"; -$sql_tables[] = "CREATE INDEX md5sum ON ".$linpha_tables['photos']." USING btree (md5sum)"; - -$sql_tables[] = "CREATE INDEX filename_cache ON ".$linpha_tables['photo_cache']." USING btree (filename)"; -*/ -?> - \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,136 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* 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. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id INTEGER PRIMARY KEY, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INTEGER default '0', " . - "override SMALLINT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id INTEGER PRIMARY KEY, " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INTEGER NOT NULL default '0' , " . - "stats_downloads_size INTE... [truncated message content] |
From: <fan...@us...> - 2008-02-20 19:01:17
|
Revision: 4886 http://linpha.svn.sourceforge.net/linpha/?rev=4886&view=rev Author: fangehrn Date: 2008-02-20 11:01:10 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.color.class.php trunk/linpha2/lib/plugins/watermark/watermark.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/ChangeLog 2008-02-20 19:01:10 UTC (rev 4886) @@ -1,4 +1,8 @@ +2008-02-20 flo + * moved func.watermark.php to classes/linpha.color.class.php + they are used at several other places + 2008-02-17 flo * implemented adodb datadict - mysql works Modified: trunk/linpha2/lib/classes/linpha.color.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.color.class.php 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/lib/classes/linpha.color.class.php 2008-02-20 19:01:10 UTC (rev 4886) @@ -19,157 +19,10 @@ if(!defined('LINPHA_DIR')) { exit(1); } -class LinWatermark +class LinColor { /** -* @author flo -* @todo adapt from linpha1 -*/ -static function needWatermark($imgid) -{ - if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] - && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] - && !check_permissions('watermark',$imgid) ) - { - return true; - } else { - return false; - } -} - -/** - * returns array with all the configs and the default values, they are only defined here - */ -static function getWatermarkArray() -{ - return array ( - 'wm_active' => "0", - 'wm_watermark' => "0", - 'wm_text' => "Copyright 2007", - 'wm_font' => "", - 'wm_fontsize' => "20", - 'wm_fontcolor' => "white", - 'wm_align' => "southwest", - 'wm_horizontal' => "0", - 'wm_vertical' => "0", - 'wm_enable_shadow' => "1", - 'wm_shadow_size' => "1", - 'wm_shadow_fontsize' => "20", - 'wm_shadow_color' => "black", - 'wm_enable_rectangle' => "1", - 'wm_rectangle_color' => "darkgrey", - 'wm_height' => "30", - 'wm_width' => "145", - 'wm_img_img' => "", - 'wm_dissolve' => "75%", - 'wm_resize' => "30" - ); -} - -static function readWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; - } - return $arr_read; -} - -static function updateWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); - } -} - -/** - * restore watermark settings to initial settings or to examples - */ -static function restoreWatermark() -{ - global $wm_restore_to; - - $arr_config = LinWatermark::getWatermarkArray(); - switch($_POST['setdefault']) - { - case 'initial': - break; - case 'settings1': - $arr_config['wm_watermark'] = 1; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "10"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_align'] = "south"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "2"; - $arr_config['wm_height'] = "20"; - $arr_config['wm_width'] = "2000"; - $arr_config['wm_resize'] = "no"; - break; - case 'settings2': - $arr_config['wm_watermark'] = 2; - $arr_config['wm_dissolve'] = "65%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_img_img'] = "linpha.png"; - $arr_config['wm_horizontal'] = "10"; - $arr_config['wm_vertical'] = "10"; - $arr_config['wm_resize'] = "30"; - - break; - case 'settings3': // maybe better for gd lib than for convert - $arr_config['wm_watermark'] = 1; - $arr_config['wm_dissolve'] = "100%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "20"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "1"; - $arr_config['wm_shadow_size'] = "5"; - $arr_config['wm_shadow_fontsize'] = "2"; - $arr_config['wm_height'] = "30"; - $arr_config['wm_width'] = "260"; - $arr_config['wm_resize'] = "no"; - break; - } - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$value); - } -} - -/** - * calcs the new height and width of the resized watermark - * $w, $h: size of the big image - * $org_width, $org_height: size of the watermark rectangle/image - * $resize: resize factor in percent - * - */ -static function wmArrResized($w,$h,$org_width,$org_height,$resize) -{ - $arr_resized['w'] = round($w * $resize/100); - $arr_resized['h'] = round($h * $resize/100); - - $no_increase = 0; - $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); - - //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. - // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); - - return $array; -} - -/** * list with many available colors * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html * @uses getRgbFromAll() @@ -392,13 +245,13 @@ switch(strlen($string)) { case 6: - if(LinWatermark::everyCharIsHex($string)) { + if(LinColor::everyCharIsHex($string)) { return 1; } break; case 7: if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { + if(LinColor::everyCharIsHex(substr($string,1,6))) { return 1; } } @@ -440,13 +293,13 @@ */ static function getRgbFromAll($string) { - if( isset( LinWatermark::$Colors[$string]) ) + if( isset( LinColor::$Colors[$string]) ) { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); + return LinColor::getRgbFromHtml( LinColor::$Colors[$string] ); } - elseif(LinWatermark::isHtmlColor($string) ) + elseif(LinColor::isHtmlColor($string) ) { - return LinWatermark::getRgbFromHtml( $string ); + return LinColor::getRgbFromHtml( $string ); } else { @@ -461,7 +314,7 @@ */ static function getHtmlFromAll($string) { - if(LinWatermark::isHtmlColor($string)) + if(LinColor::isHtmlColor($string)) { if(substr($string,0,1)=="#") { @@ -474,9 +327,9 @@ } else { - if( isset( LinWatermark::$Colors[$string]) ) + if( isset( LinColor::$Colors[$string]) ) { - return substr(LinWatermark::$Colors[$string],1,6); + return substr(LinColor::$Colors[$string],1,6); } else { @@ -485,63 +338,5 @@ } } -/** - * @uses watermark_gd() - * calcs the position in pixel with a given align - * src_w, src_h: width and height from the textfield (or the small watermark image) - * dst_w, dst_h: width and height from the image - * pos_x, pos_y: additional adjust for the image - * - */ -static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) -{ - - switch($align) - { - case "center": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "east": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "west": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "north": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "south": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "northeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "northwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - case "southwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "southeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - default: - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - - } - return $arr_pos; } - -} ?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/watermark/watermark.class.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/watermark.class.php 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/lib/plugins/watermark/watermark.class.php 2008-02-20 19:01:10 UTC (rev 4886) @@ -170,323 +170,7 @@ } /** - * list with many available colors - * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html - * @uses getRgbFromAll() - */ -static $Colors = array( - 'aliceblue'=>'#f0f8ff', - 'antiquewhite'=>'#faebd7', - 'aquamarine'=>'#7fffd4', - 'azure'=>'#f0ffff', - 'beige'=>'#f5f5dc', - 'bisque'=>'#ffe4c4', - 'black'=>'#000000', - 'blanchedalmond'=>'#ffebcd', - 'blue'=>'#0000ff', - 'blueviolet'=>'#8a2be2', - 'brown'=>'#a52a2a', - 'burlywood'=>'#deb887', - 'cadetblue'=>'#5f9ea0', - 'chartreuse'=>'#7fff00', - 'chocolate'=>'#d2691e', - 'coral'=>'#ff7f50', - 'cornflowerblue'=>'#6495ed', - 'cornsilk'=>'#fff8dc', - 'cyan'=>'#00ffff', - 'darkblue'=>'#00008b', - 'darkcyan'=>'#008b8b', - 'darkgoldenrod'=>'#b886011', - 'darkgray'=>'#a9a9a9', - 'darkgreen'=>'#006400', - 'darkgrey'=>'#a9a9a9', - 'darkkhaki'=>'#bdb76b', - 'darkmagenta'=>'#8b008b', - 'darkolivegreen'=>'#556b2f', - 'darkorange'=>'#ff8c00', - 'darkorchid'=>'#9932cc', - 'darkred'=>'#8b0000', - 'darksalmon'=>'#e9967a', - 'darkseagreen'=>'#8fbc8f', - 'darkslateblue'=>'#483d8b', - 'darkslategray'=>'#2f4f4f', - 'darkslategrey'=>'#2f4f4f', - 'darkturquoise'=>'#00ced1', - 'darkviolet'=>'#9400d3', - 'deeppink'=>'#ff1493', - 'deepskyblue'=>'#00bfff', - 'dimgray'=>'#696969', - 'dimgrey'=>'#696969', - 'dodgerblue'=>'#1e90ff', - 'firebrick'=>'#b22222', - 'floralwhite'=>'#fffaf0', - 'forestgreen'=>'#228b22', - 'gainsboro'=>'#dcdcdc', - 'ghostwhite'=>'#f8f8ff', - 'gold'=>'#ffd700', - 'goldenrod'=>'#daa520', - 'gray'=>'#bebebe', - 'green'=>'#00ff00', - 'greenyellow'=>'#adff2f', - 'honeydew'=>'#f0fff0', - 'hotpink'=>'#ff69b4', - 'indianred'=>'#cd5c5c', - 'ivory'=>'#fffff0', - 'khaki'=>'#f0e68c', - 'lavender'=>'#e6e6fa', - 'lavenderblush'=>'#fff0f5', - 'lawngreen'=>'#7cfc00', - 'lemonchiffon'=>'#fffacd', - 'lightblue'=>'#add8e6', - 'lightcoral'=>'#f08080', - 'lightcyan'=>'#e0ffff', - 'lightgoldenrod'=>'#eedd82', - 'lightgoldenrodyellow'=>'#fafad2', - 'lightgray'=>'#d3d3d3', - 'lightgreen'=>'#90ee90', - 'lightgrey'=>'#d3d3d3', - 'lightpink'=>'#ffb6c1', - 'lightred'=>'#ffc8c8', - 'lightsalmon'=>'#ffa07a', - 'lightseagreen'=>'#20b2aa', - 'lightskyblue'=>'#87cefa', - 'lightslateblue'=>'#8470ff', - 'lightslategray'=>'#778899', - 'lightsteelblue'=>'#b0c4de', - 'lightyellow'=>'#ffffe0', - 'limegreen'=>'#32cd32', - 'linen'=>'#faf0e6', - 'magenta'=>'#ff00ff', - 'maroon'=>'#b03060', - 'mediumaquamarine'=>'#66cdaa', - 'mediumblue'=>'#0000cd', - 'mediumorchid'=>'#ba55d3', - 'mediumpurple'=>'#9370db', - 'mediumseagreen'=>'#3cb371', - 'mediumslateblue'=>'#7b68ee', - 'mediumspringgreen'=>'#00fa9a', - 'mediumturquoise'=>'#48d1cc', - 'mediumvioletred'=>'#c71585', - 'midnightblue'=>'#191970', - 'mintcream'=>'#f5fffa', - 'mistyrose'=>'#ffe4e1', - 'moccasin'=>'#ffe4b5', - 'navajowhite'=>'#ffdead', - 'navy'=>'#000080', - 'navyblue'=>'#000080', - 'oldlace'=>'#fdf5e6', - 'olivedrab'=>'#6b8e23', - 'orange'=>'#ffa500', - 'orangered'=>'#ff4500', - 'orchid'=>'#da70d6', - 'palegoldenrod'=>'#eee8aa', - 'palegreen'=>'#98fb98', - 'paleturquoise'=>'#afeeee', - 'palevioletred'=>'#db7093', - 'papayawhip'=>'#ffefd5', - 'peachpuff'=>'#ffdab9', - 'peru'=>'#cd853f', - 'pink'=>'#ffc0cb', - 'plum'=>'#dda0dd', - 'powderblue'=>'#b0e0e6', - 'purple'=>'#a020f0', - 'red'=>'#ff0000', - 'rosybrown'=>'#bc8f8f', - 'royalblue'=>'#4169e1', - 'saddlebrown'=>'#8b4513', - 'salmon'=>'#fa8072', - 'sandybrown'=>'#f4a460', - 'seagreen'=>'#2e8b57', - 'seashell'=>'#fff5ee', - 'sienna'=>'#a0522d', - 'skyblue'=>'#87ceeb', - 'slateblue'=>'#6a5acd', - 'slategray'=>'#708090', - 'slategrey'=>'#708090', - 'snow'=>'#fffafa', - 'springgreen'=>'#00ff7f', - 'steelblue'=>'#4682b4', - 'tan'=>'#d2b48c', - 'thistle'=>'#d8bfd8', - 'tomato'=>'#ff6347', - 'turquoise'=>'#40e0d0', - 'violet'=>'#ee82ee', - 'violetred'=>'#d02090', - 'wheat'=>'#f5deb3', - 'white'=>'#ffffff', - 'yellow'=>'#ffff00', - 'yellowgreen'=>'#9acd32' -); - -/** - * not used anymore - */ -static function getHtmlColorFromRgb($r,$g,$b) -{ - if(strlen(dechex($r))==1) { - $r = '0'.$r; - } else { - $r = dechex($r); - } - if(strlen(dechex($g))==1) { - $g = '0'.$g; - } else { - $g = dechex($g); - } - if(strlen(dechex($b))==1) { - $b = '0'.$b; - } else { - $b = dechex($b); - } - - return '#'.$r.$g.$b; -} - -/** - * used to check if it is a valid html color - * @uses isHtmlColor() - */ -static function everyCharIsHex($string) -{ - for($i=0;$i<strlen($string);$i++) - { - $char = substr($string,$i,1); - $valid_color = false; - - if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... - $valid_color = true; - } - for($n=1;$n<=9;$n++) - { - if($char == $n) { - $valid_color = true; - } - } - - for($n='a';$n<='f';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - - for($n='A';$n<='F';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - if(!$valid_color) { - return 0; - } - } - return 1; -} - -/** - * used to check if it is a valid html color - * @uses getRgbFromAll() - */ -static function isHtmlColor($string) -{ - switch(strlen($string)) - { - case 6: - if(LinWatermark::everyCharIsHex($string)) { - return 1; - } - break; - case 7: - if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { - return 1; - } - } - break; - } - return 0; -} - -/** - * converts a html color to an array with the rgb values - * it doesn't matter if the html color is '#00FF00' or '00FF00' - * @uses getRgbFromAll() - */ -static function getRgbFromHtml($string) -{ - switch(strlen($string)) - { - case 6: - break; - case 7: - $string = substr($string,1,6); - break; - } - $r_hex = substr($string,0,2); - $g_hex = substr($string,2,2); - $b_hex = substr($string,4,2); - $arr['r'] = hexdec($r_hex); - $arr['g'] = hexdec($g_hex); - $arr['b'] = hexdec($b_hex); - return $arr; -} - -/** - * returns an array with the rgb values - * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' - * if it isn't a correct color, the color (0,0,0) is returned - * * @uses watermark_gd() - */ -static function getRgbFromAll($string) -{ - if( isset( LinWatermark::$Colors[$string]) ) - { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); - } - elseif(LinWatermark::isHtmlColor($string) ) - { - return LinWatermark::getRgbFromHtml( $string ); - } - else - { - array('r'=>0,'g'=>0,'b'=>0); - } -} - -/** - * return html color without '#' - * - * used in linpha2 - admin - settings_layout - */ -static function getHtmlFromAll($string) -{ - if(LinWatermark::isHtmlColor($string)) - { - if(substr($string,0,1)=="#") - { - return substr($string,1,6); - } - else - { - return $string; - } - } - else - { - if( isset( LinWatermark::$Colors[$string]) ) - { - return substr(LinWatermark::$Colors[$string],1,6); - } - else - { - return 'ffffff'; - } - } -} - -/** - * @uses watermark_gd() * calcs the position in pixel with a given align * src_w, src_h: width and height from the textfield (or the small watermark image) * dst_w, dst_h: width and height from the image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-22 09:26:25
|
Revision: 4892 http://linpha.svn.sourceforge.net/linpha/?rev=4892&view=rev Author: fangehrn Date: 2008-02-22 01:26:16 -0800 (Fri, 22 Feb 2008) Log Message: ----------- 2008-02-22 flo * implemented jscookmenu * changed templates with new rounded corners (not yet finished, found another problem when the page is too long) * temporary fix for "lindivtab undefined" 2008-02-20 flo * moved func.watermark.php to classes/linpha.color.class.php they are used at several other places * fixed some php stricts notices * implemented new rounded corners * changed to html strict * fixed some html strict javascript bugs Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/templates/default/basket.html.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/menu.html.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/home.css trunk/linpha2/templates/default/view_albmeta.html.php trunk/linpha2/templates/default/view_basket.html.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_thumb.html.php trunk/linpha2/templates/default/view_thumb_static.html.php trunk/linpha2/templates/misc/box.php Added Paths: ----------- trunk/linpha2/lib/js/JSCookMenu/ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js trunk/linpha2/lib/js/JSCookMenu/effect.js trunk/linpha2/templates/default/menu.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/ChangeLog 2008-02-22 09:26:16 UTC (rev 4892) @@ -1,7 +1,17 @@ +2008-02-22 flo + * implemented jscookmenu + * changed templates with new rounded corners + (not yet finished, found another problem when the page is too long) + * temporary fix for "lindivtab undefined" + 2008-02-20 flo * moved func.watermark.php to classes/linpha.color.class.php they are used at several other places + * fixed some php stricts notices + * implemented new rounded corners + * changed to html strict + * fixed some html strict javascript bugs 2008-02-17 flo * implemented adodb datadict Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/index.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -31,6 +31,7 @@ */ switch($_GET['linCat']) { +case 'home': case 'alb': require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -274,50 +274,39 @@ */ function setMenu() { - /** - * Menu My Settings - */ - if($GLOBALS['linpha']->sql->isLoggedIn()) - { - if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) - { - $GLOBALS['linpha']->template->output['menu_My Settings']['filemanager'] = - array('name' => i18n("Filemanager"), 'value' => LINPHA_LINK.'&linCat=filemanager'); - } - } + /** * Menu Admin */ if($GLOBALS['linpha']->sql->isAdmin()) { - $GLOBALS['linpha']->template->output['menu_Admin']['import'] = + $GLOBALS['linpha']->template->menu['admin']['import'] = array( '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.'&admin_cmd=force_import') + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), + array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') ) ); - $GLOBALS['linpha']->template->output['menu_Admin']['permissions'] = + $GLOBALS['linpha']->template->menu['admin']['permissions'] = array( 'name' => i18n("Permissions"), - 'value' => array( - array('name' => i18n("Set Permissions"), 'value' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) ) ); - if($this->mode == 'thumb' OR $this->mode == 'image') + if($this->mode == 'thumb' || $this->mode == 'image') { /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = array( + $GLOBALS['linpha']->template->menu['admin']['import']['value'][] = array( 'name' => i18n("Recreate This Thumbnail"), - 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' + 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); } } @@ -331,9 +320,9 @@ * more than one time used stuff */ $array = linGetSortOrders(); - foreach($array AS $value) // i18n() already called + foreach($array as $value) // i18n() already called { - $array_sort_orders_links[] = array('name' => $value, 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); + $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } $open_basket_link = LINPHA_LINK.'&linCat=basket'; @@ -342,99 +331,99 @@ { case 'thumb': - $GLOBALS['linpha']->template->output['menu_More']['basket'] = + $GLOBALS['linpha']->template->menu['more']['basket'] = array( 'name' => i18n("Basket"), - 'value' => array( - array('name' => i18n("Add All To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), + array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) ) ); if( linUseAjax() ) { $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array AS $value) + foreach($array as $value) { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); + $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); } $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array AS $value) + foreach($array as $value) { - $array_nr_links[] = array('name' => $value, 'value' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); + $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); } - $array_views_links[] = array('name' => i18n("Normal"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); + $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), - array('name' => i18n("View"), 'value' => $array_views_links), - array('name' => i18n("Thumb Size"), 'value' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'value' => $array_nr_links) + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View"), 'link' => $array_views_links), + array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), + array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) ) ); } else { - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), ) ); } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { - $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = + $GLOBALS['linpha']->template->menu['more']['metainfo'] = array( 'name' => i18n("Metainfo"), - 'value' => array( - array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), + 'link' => array( + array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), ) ); } break; case 'image': - $GLOBALS['linpha']->template->output['menu_More']['basket'] = + $GLOBALS['linpha']->template->menu['more']['basket'] = array( 'name' => i18n("Basket"), - 'value' => array( - array('name' => i18n("Add To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) + 'link' => array( + array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) ) ); - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), - array('name' => i18n("View at"), 'value' => + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View at"), 'link' => array( - array('name' => '640x480', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), + array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), + array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), + array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), + array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), + array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), + array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), + array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), + array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), + array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), ) ) ) @@ -443,28 +432,28 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $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->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'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { - $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = + $GLOBALS['linpha']->template->menu['more']['metainfo'] = array( 'name' => i18n("Metainfo"), - 'value' => array( - array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + 'link' => array( + array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ); } @@ -476,39 +465,32 @@ /** * Icons */ - $GLOBALS['linpha']->template->output['menu_Icons'] = ''; if($this->mode == 'thumb') { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=download">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/download.png').'" border="0" title="'.i18n("Download Images").'" />' - .'</a>'."\n"; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=print">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/print.png').'" border="0" title="'.i18n("Print Images").'" />' - .'</a>'."\n"; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=mail">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Mail Images").'" />' - .'</a>'."\n"; - } - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="javascript:myLinThumbnails.loadSlideshow()">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Play Slideshow").'" />' - .'</a>'."\n"; - } - + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; + } + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; + } } elseif($this->mode == 'image') { @@ -517,30 +499,24 @@ */ if( $GLOBALS['linpha']->sql->checkPermission('download')) { - $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"; + $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; } if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=print">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/print.png').'" border="0" title="'.i18n("Print Image").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; } if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=mail">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Mail Image").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; } /** * slideshow icon */ if( linUseAjax() ) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="javascript:myLinImage.fullscreenStart()">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Play Slideshow").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; } } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -221,62 +221,13 @@ } /** - * start template - * this must be at execatly this place, because: - * 1. it needs to be after the database is connected, because - * in the constructor of linTemplate() are configs from the db read - * 2. we need the template already in startSession(), because of the - * syslog after loggin in - * - * the same with the language file + * include language file + * must be after dbConnnect, but before login */ - $GLOBALS['linpha']->template = new linTemplate(); - global $linTpl; - $linTpl = $GLOBALS['linpha']->template; // this is just a reference - linIncludeLanguageFile(); /** - * set idCurrent - * add support for static links - * linpha2/index.php/album1/file.jpg - * will set the correct id - */ - if(isset($_GET['linId'])) - { - $GLOBALS['linpha']->template->idCurrent = intval($_GET['linId']); - } - else - { - /** - * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure - * and may contain cross site scripting. in common.php all htmlentities have been - * replaced - * - * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() - * and returns false if it is not a valid album, so as far as i know it's safe to use it this way - */ - if( isset($_SERVER['PATH_INFO']) ) - { - $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this - - if($id === false) - { - $GLOBALS['linpha']->template->idCurrent = 0; - } - else - { - $GLOBALS['linpha']->template->idCurrent = $id; - } - } - else - { - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - /** * maybe the session is already started * this should be no problem, hopefully */ @@ -327,7 +278,7 @@ if($data = $query->FetchRow()) { linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$data['username'].': successfully logged in (cookie).'); - linSysLog(i18n("Successfully Logged In!")); + $sysLogMsg[] = i18n("Successfully Logged In!"); $this->setUserInformation($data['username'],$_COOKIE['linpha_userid'],$data['display_name']); } @@ -363,13 +314,13 @@ setcookie('linpha_password'); // delete cookie linpha_password } - linSysLog(i18n("Logged out.")); + $sysLogMsg[] = i18n("Logged out."); } elseif($_POST['cmd']=='login') { if( !isset($_POST['username']) OR !isset($_POST['password']) OR empty($_POST['username']) OR empty($_POST['password'])) { - linSysLog(i18n("Please Fill In All Fields!")); + $sysLogMsg[] = i18n("Please Fill In All Fields!"); } else { @@ -388,7 +339,7 @@ */ linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$_POST['username'].': successfully logged in.'); - linSysLog(i18n("Successfully Logged In!")); + $sysLogMsg[] = i18n("Successfully Logged In!"); $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); @@ -408,9 +359,8 @@ /** * failed login */ - linLog(LOG_TYPE_USER,LOG_WARNING,'login','User '.$_POST['username'].': login failed!'); - linSysLog(i18n("Login Failed!")); + $sysLogMsg[] = i18n("Login Failed!"); } } } @@ -491,6 +441,24 @@ $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } } + + /** + * start template + * this must be after login stuff + * template requires login information + */ + $GLOBALS['linpha']->template = new linTemplate(); + global $linTpl; + $linTpl = $GLOBALS['linpha']->template; // this is just a reference + + /** + * add previously added log messages + */ + if (isset($sysLogMsg)) { + foreach($sysLogMsg as $msg) { + linSysLog($msg); + } + } } // end function startSession Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -31,13 +31,15 @@ public $layoutimagespath; public $output; public $URL_base, $URL_full, $idCurrent; + public $hideMenu = false, $hideTitle = false; + public $menu, $menuFinal, $nofMenuEntries = 0; + public $arrayDefaultMenuEntries; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; public $fnCallback = ''; - private $body_name; private $head_name; private $css_name; @@ -59,8 +61,69 @@ $this->albumsbgcolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_albumsbg']; $this->linkscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_links']; $this->linkshovercolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_linkshover']; - $this->fieldscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + $this->formscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + /** + * set idCurrent + * add support for static links + * linpha2/index.php/album1/file.jpg + * will set the correct id + */ + if(isset($_GET['linId'])) + { + $this->idCurrent = intval($_GET['linId']); + } + else + { + /** + * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure + * and may contain cross site scripting. in common.php all htmlentities have been + * replaced + * + * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() + * and returns false if it is not a valid album, so as far as i know it's safe to use it this way + */ + if( isset($_SERVER['PATH_INFO']) ) + { + $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this + + if($id === false) + { + $this->idCurrent = 0; + } + else + { + $this->idCurrent = $id; + } + } + else + { + $this->idCurrent = 0; + } + } + + /** + * Initial menu entries + */ + if($GLOBALS['linpha']->sql->isLoggedIn()) + { + if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) + { + $GLOBALS['linpha']->template->menu['settings']['filemanager'] = + array('name' => i18n("Filemanager"), 'link' => LINPHA_LINK.'&linCat=filemanager'); + } + } + + $this->arrayDefaultMenuEntries = array( + 'home' => i18n("Home"), + 'search' => i18n("Search"), + 'login' => i18n("Login"), + 'more' => i18n("More"), + 'admin' => i18n("Admin"), + 'settings' => i18n("Settings") + ); + } /** @@ -74,20 +137,23 @@ { case 'body': $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->body_name.'.html.php'; - if(file_exists($filename)) - { + if (file_exists($filename)) { include_once( $filename ); } break; + case 'menu': + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.html.php'; + if (file_exists($filename)) { + include_once( $filename ); + } + + break; case 'head': /** * do some common definitions in head */ -?> -<!-- css includes --> -<?php /** * Prepare http url */ @@ -98,72 +164,48 @@ 'albumsbg' => ''.$this->albumsbgcolor.'', 'links' => ''.$this->linkscolor.'', 'linkshover' => ''.$this->linkshovercolor.'', - 'fieldscolor' => ''.$this->fieldscolor.'' + 'forms' => ''.$this->formscolor.'' ); +/** + * colorsettings.php + */ ?> -<!-- colorsettings.php --> - -<link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. $this->template_name.'/themes/default/colorsettings.php?'. - http_build_query($urlParams);?>' type='text/css'> + http_build_query($urlParams);?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename.'?'. + http_build_query($urlParams); ?>" type="text/css" /> +<?php } +/** + * global.css + */ +?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/global.css'; ?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> +<?php } +/** + * body css + */ +?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> +<?php } -<?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. - $this->layout_name.'/colorsettings.php')) - { ?> - - <link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?". - http_build_query($urlParams); ?>' type='text/css'> -<?php } ?> - -<!-- global.css --> - -<link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/global.css'; ?>' type='text/css'> - -<?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'> -<?php } ?> - -<!-- body css --> - -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>' - type='text/css'> - -<?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. - $this->layout_name.'/css/'.$this->css_name.'.css')) - { ?> - <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/'.$this->layout_name.'/css/'. - $this->css_name.'.css'; ?>' type='text/css'> -<?php } ?> - - <!--[if IE]> - <style type="text/css" media="screen"> - #menu ul { width: 1em; } /* this will be a *min* width */ - #menu ul ul { width: 12em; } - #menu ul li { float: left; width: 100%; } -<?php /* </style> - <![endif]--> - <!--[if lt IE 7]> - <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; } - </style> - <![endif]--> - +/** + * javascript + */ +?> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> @@ -172,6 +214,7 @@ var linUrlBase = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var startIdCurrent = <?php echo $this->idCurrent; ?>; var IdCurrent = startIdCurrent; +var myThemePanelBase = '<?php echo $this->themeFile('menu/'); ?>'; <?php if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { //echo "var checkAjaxCompatibility = true;"."\n"; @@ -181,11 +224,17 @@ }*/ ?> </script> +<?php +/* menu must be after myThemePanelBase definition */ +$filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.head.php'; +if (file_exists($filename)) { + include_once( $filename ); +} +?> <?php $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; - if(file_exists($filename)) - { + if (file_exists($filename)) { include_once( $filename ); } @@ -217,229 +266,175 @@ } } - /** - * print the whole menu - * @uses global.html.php, module.ajax.php - */ - function printMenus($modules,$comingfrom_ajax=false) - { - $array = explode(',',$modules); - foreach($array AS $value) - { - switch($value) - { - case 'more': - if( isset( $this->output['menu_More'] ) ) { - $this->printMenu("More",i18n("More")); - } - break; - case 'settings': - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- my settings -->'."\n"; - $this->printMenu("My Settings",i18n("My Settings"),LINPHA_LINK."&linCat=settings"); - } - break; - case 'admin': - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- admin links -->'."\n"; - $this->printMenu("Admin",i18n("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($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>'; - } - } - /** - * print the main menu entries (more, admin, ...) - */ - function printMenu($index,$text,$link='') - { - if( ! isset( $GLOBALS['linpha']->template->output['menu_'.$index] ) ) - { - echo "\n".'<ul>'."\n"; - echo "\t".'<li><a href="'.$link.'">'.$text.'</a>'."\n"; - echo "\n".'</ul>'."\n"; - } - else - { - echo "\n".'<ul>'."\n"; - if(!empty($link)) - { - echo "\t".'<li><a href="'.$link.'">'.$text.'</a>'."\n"; - } - else - { - echo "\t".'<li><span>'.$text.' </span>'."\n"; - } - echo "\n".'<ul id="linMenu'.$index.'" onmouseover="myLinGlobal.reloadMenu()">'."\n"; - - foreach($GLOBALS['linpha']->template->output['menu_'.$index] AS $key=>$value) - { - if(!is_array($value['value'])) - { - if(isset($value['target'])) { - $target_str = ' target="'.$value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($value['id'])) { - $id_str = ' id="'.$value['id'].'"'; - } else { - $id_str = ''; - } + function setMenu() + { + $arrayMenuEntries = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_list']); + + foreach($arrayMenuEntries as $menuEntry) + { + if ($menuEntry == 'more' || $menuEntry == 'admin' || $menuEntry == 'settings') + { + if (!isset($this->menu[$menuEntry])) { + continue; + } + } + + if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $this->arrayDefaultMenuEntries[$menuEntry], + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } elseif ( strpos($menuEntry, 'plugin_') !== false ) { + $menuEntry = substr($menuEntry, 7); + $this->menuFinal[ $menuEntry ] = array( + 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } elseif ( strpos($menuEntry, 'icon_') !== false ) { + if (isset($this->menu[$menuEntry])) { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $menuEntry, + 'link' => $this->menu[$menuEntry] + ); + } + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink1'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink1']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink2'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink2']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink3'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink3']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink4'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink4']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink5'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink5']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } else { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $menuEntry, + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } + + $this->nofMenuEntries++; + } + } + + function createJSCookMenu() + { + foreach ($this->menu as $key=>$arrayMenuEntry) + { + if (strpos($key,'icon_')===false) { + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + $this->createJSCookMenuEntry($key, $arrayMenuEntry); + $this->menuJSCook[$key][] = "]"; + } + } + } + + function createJSCookMenuEntry($key, &$arrayMenuEntry) + { + //print_r($arrayMenuEntry); + + foreach ($arrayMenuEntry as $arraySubMenuEntry) + { + $this->menuJSCook[$key][] = "[null, '".htmlentities($arraySubMenuEntry['name'], ENT_QUOTES)."', "; + if (is_array($arraySubMenuEntry['link'])) { + $this->menuJSCook[$key][] = "null, null, null, "."\n"; + $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); + } else { + $link = linConvertAmp($arraySubMenuEntry['link']); + $link = str_replace("'",'\\\'', $link); + $this->menuJSCook[$key][] = "'".$link."', null, null,"; + } + + $this->menuJSCook[$key][] = "],"."\n"; + } + /* + [null, 'More', null, null, 'Some more options', + [null, 'Basket', null, null, 'Download/Mail/Print a batch of images', + [null, 'Add All To Basket', 'url', 'target', 'description'], + [null, 'Switch To Basket View', 'url', 'target', 'description'], + [null, 'Open Basket (0 Images)', 'url', 'target', 'description'] + ], + [null, 'View', null, null, 'description', + [null, 'Sort', 'url', 'target', 'description', + [null, 'Name Asc', 'url', 'target', 'description'], + [null, 'Name Desc', 'url', 'target', 'description'], + [null, 'Date Asc', 'url', 'target', 'description'], + [null, 'Date Desc', 'url', 'target', 'description'] + ], + [null, 'View', 'url', 'target', 'description', + [null, 'Normal', 'url', 'target', 'description'], + [null, 'Detail', 'url', 'target', 'description'] + ], + [null, 'Thumb Size', 'url', 'target', 'description', + [null, '50 Pixel', 'url', 'target', 'description'], + [null, '75 Pixel', 'url', 'target', 'description'], + [null, '100 Pixel', 'url', 'target', 'description'], + [null, '150 Pixel', 'url', 'target', 'description'], + [null, '200 Pixel', 'url', 'target', 'description'], + [null, '250 Pixel', 'url', 'target', 'description'], + [null, '300 Pixel', 'url', 'target', 'description'], + [null, '400 Pixel', 'url', 'target', 'description'], + [null, '500 Pixel', 'url', 'target', 'description'] + ], + [null, 'Thumb Nr', 'url', 'target', 'description' + [null, 'auto', 'url', 'target', 'description'], + [null, '10', 'url', 'target', 'description'], + [null, '25', 'url', 'target', 'description'], + [null, '50', 'url', 'target', 'description'], + [null, '100', 'url', 'target', 'description'], + [null, '200', 'url', 'target', 'description'], + [null, 'all', 'url', 'target', 'description'] + ] + ], + ], + */ + } - echo "\t".'<li'.$id_str.'><a href="'.$value['value'].'"'.$target_str.'>'.$value['name'].'</a></li>'."\n"; - } - else - { - echo "\t".'<li><span>'.$value['name'].' </span>'."\n"; - - echo "\t".'<ul>'."\n"; - - foreach($value['value'] AS $sub_value) - { - if(!is_array($sub_value['value'])) - { - if(isset($sub_value['target'])) { - $target_str = ' target="'.$sub_value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($sub_value['id'])) { - $id_str = ' id="'.$sub_value['id'].'"'; - } else { - $id_str = ''; - } - - echo "\t\t".'<li'.$id_str.'><a href="'.$sub_value['value'].'"'.$target_str.'>'.$sub_value['name'].'</a></li>'."\n"; - } - else - { - echo "\t\t".'<li><span>'.$sub_value['name'].' </span>'."\n"; - - echo "\t\t".'<ul>'."\n"; - - foreach($sub_value['value'] AS $subsub_value) - { - if(isset($subsub_value['target'])) { - $target_str = ' target="'.$subsub_value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($subsub_value['id'])) { - $id_str = ' id="'.$subsub_value['id'].'"'; - } else { - $id_str = ''; - } - - echo "\t\t\t".'<li'.$id_str.'><a href="'.$subsub_value['value'].'"'.$target_str.'>'.$subsub_value['name'].'</a></li>'."\n"; - - } - - echo "\t\t".'</ul>'."\n"; - echo "\t\t".'</li>'."\n"; - } - } - - echo "\t".'</ul>'."\n"; - echo "\t".'</li>'."\n"; - } - } - - echo "\t".'</ul>'."\n"; - echo "\t".'</li>'."\n"; - echo '</ul>'."\n"; - } - } - - /** - * rounded corner stuff - */ - function divRoundCorners($top_bottom,$alpha='',$type='') - { - $size = 15; - - if(empty($type)) // default - { - $color = $this->bgcolor; - $bgcolor = $this->bodybgcolor; - } - elseif($type=='albums') - { - $color = $this->albumsbgcolor; - $bgcolor = $this->bgcolor; - } - - if($top_bottom == 'top') - { - $alignleft = 'tl'; - $alignright = 'tr'; - } - elseif($top_bottom == 'bottom') - { - $alignleft = 'bl'; - $alignright = 'br'; - } + /** + * rounded corner stuff + */ + function divRoundCorners($top_bottom,$type='') + { + if ($type=='main') { + $class = 'linCornMain'; + } elseif($type=='album') { + $class = 'linCornFolder'; + } else { + $class = ''; + } - /** - * Prepare http url - */ - $lcornerParam = array( - 'color' => ''.$color.'', - 'bgcolor' => ''.$bgcolor.'', - 'size' => ''.$size.'', - 'align' => ''.$alignleft.'' - ); - - $rcornerParam = array( - 'color' => ''.$color.'', - 'bgcolor' => ''.$bgcolor.'', - 'size' => ''.$size.'', - 'align' => ''.$alignright.'' - ); - - if(empty($alpha)) // default - { - $str = '<div style="background: - url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($rcornerParam).') no-repeat top right;">'; - - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($lcornerParam).'" - alt="" width="'.$size.'" height="'.$size.'" />'; - - $str .= '</div>'; - } - else // currently only used in slideshow, sucks with IE - { - $str = '<div style="position: relative; background: - url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($rcornerParam).'&alpha) no-repeat top right;">'; - - $str .= '<div class="roundAlphabottomInner"> </div>'; - - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($lcornerParam).'&alpha" - alt="" width="'.$size.'" height="'.$size.'" class="AlphaCorner" />'; - - $str .= '</div>'; - } + if ($top_bottom == 'top') + { + return '<div class="linCorn '.$class.'"><div class="linCornC"><div class="linCornT"></div>'; + } + elseif($top_bottom == 'bottom') + { + return '</div><div class="linCornB"><div></div></div></div>'; + } + } - return $str; - } - function themeFile( $filename ) { if( file_exists( LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/'.$filename ) ) Modified: trunk/linpha2/lib/include/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.data.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/include/sql/sql.data.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -99,6 +99,13 @@ 'sys_style_layout_template' => 'default', 'sys_style_layout_title' => 'Linpha 2.0', + 'sys_style_menu_list' => 'home,search,login,more,icon_slideshow,icon_download,icon_mail,icon_print,admin,settings', + 'sys_style_menu_userlink1' => '', + 'sys_style_menu_userlink2' => '', + 'sys_style_menu_userlink3' => '', + 'sys_style_menu_userlink4' => '', + 'sys_style_menu_userlink5' => '', + 'sys_style_others_sortorder' => 'nameasc', ); Added: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js (rev 0) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-02-22 09:26:16 UTC (rev 4892) @@ -0,0 +1,1658 @@ +/* + JSCookMenu v2.0.3 (c) Copyright 2002-2006 by Heng Yuan + + http://jscook.sourceforge.net/JSCookMenu/ + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +// default node properties +var _cmNodeProperties = +{ + // theme prefix + prefix: '', + + // main menu display attributes + // + // Note. When the menu bar is horizontal, + // mainFolderLeft and mainFolderRight are + // put in <span></span>. When the menu + // bar is vertical, they would be put in + // a separate TD cell. + + // HTML code to the left of the folder item + mainFolderLeft: '', + // HTML code to the right of the folder item + mainFolderRight: '', + // HTML code to the left of the regular item + mainItemLeft: '', + // HTML code to the right of the regular item + mainItemRight: '', + + // sub menu display attributes + + // HTML code to the left of the folder item + folderLeft: '', + // HTML code to the right of the folder item + folderRight: '', + // HTML code to the left of the regular item + itemLeft: '', + // HTML code to the right of the regular item + itemRight: '', + // cell spacing for main menu + mainSpacing: 0, + // cell spacing for sub menus + subSpacing: 0, + + // optional settings + // If not set, use the default + + // auto disappear time for submenus in milli-seconds + delay: 500, + + // 1st layer sub menu starting index + zIndexStart: 1000, + // z-index incremental step for subsequent layers + zIndexInc: 5, + + // sub menu header appears before the sub menu table + subMenuHeader: null, + // sub menu header appears after the sub menu table + subMenuFooter: null, + + // submenu location adjustments + // + // offsetHMainAdjust for adjusting the first submenu + // of a 'hbr' menu. + // offsetVMainAdjust for adjusting the first submenu + // of a 'vbr' menu. + // offsetSubAdjust for subsequent level of submenus + // + offsetHMainAdjust: [0, 0], + offsetVMainAdjust: [0, 0], + offsetSubAdjust: [0, 0], + + // act on click to open sub menu + // not yet implemented + // 0 : use default behavior + // 1 : hover open in all cases + // 2 : click on main, hover on sub + // 3 : click open in all cases (illegal as of 1.5) + clickOpen: 1, + + // special effects on open/closing a sub menu + effect: null +}; + +// Globals +var _cmIDCount = 0; +var _cmIDName = 'cmSubMenuID'; // for creating submenu id + +var _cmTimeOut = null; // how long the menu would stay +var _cmCurrentItem = null; // the current menu item being selected; + +var _cmNoAction = new Object (); // indicate that the item cannot be hovered. +var _cmNoClick = new Object (); // similar to _cmNoAction but does not respond to mouseup/mousedown events +var _cmSplit = new Object (); // indicate that the item is a menu split + +var _cmMenuList = new Array (); // a list of the current menus +var _cmItemList = new Array (); // a simple list of items + +var _cmFrameList = new Array (); // a pool of reusable iframes +var _cmFrameListSize = 0; // keep track of the actual size +var _cmFrameIDCount = 0; // keep track of the frame id +var _cmFrameMasking = true; // use the frame masking + +// disable iframe masking for IE7 +/*@cc_on + @if (@_jscript_version >= 5.6) + if (_cmFrameMasking) + { + var v = navigator.appVersion; + var i = v.indexOf ("MSIE "); + if (i >= 0) + { + if (parseInt (navigator.appVersion.substring (i + 5)) >= 7) + _cmFrameMasking = false; + } + } + @end +@*/ + +var _cmClicked = false; // for onClick + +// flag for turning on off hiding objects +// +// 0: automatic +// 1: hiding +// 2: no hiding +var _cmHideObjects = 0; + +// Utility function to do a shallow copy a node property +function cmClone (nodeProperties) +{ + var returnVal = new Object (); + for (v in nodeProperties) + returnVal[v] = nodeProperties[v]; + return returnVal; +} + +// +// store the new menu information into a structure to retrieve it later +// +function cmAllocMenu (id, menu, orient, nodeProperties, prefix) +{ + var info = new Object (); + info.div = id; + info.menu = menu; + info.orient = orient; + info.nodeProperties = nodeProperties; + info.prefix = prefix; + var menuID = _cmMenuList.length; + _cmMenuList[menuID] = info; + return menuID; +} + +// +// request a frame +// +function cmAllocFrame () +{ + if (_cmFrameListSize > 0) + return cmGetObject (_cmFrameList[--_cmFrameListSize]); + var frameObj = document.createElement ('iframe'); + var id = _cmFrameIDCount++; + frameObj.id = 'cmFrame' + id; + frameObj.frameBorder = '0'; + frameObj.style.display = 'none'; + frameObj.src = 'javascript:false'; + document.body.appendChild (frameObj); + frameObj.style.filter = 'alpha(opacity=0)'; + frameObj.style.zIndex = 99; + frameObj.style.position = 'absolute'; + frameObj.style.border = '0'; + frameObj.scrolling = 'no'; + return frameObj; +} + +// +// make a frame resuable later +// +function cmFreeFrame (frameObj) +{ + _cmFrameList[_cmFrameListSize++] = frameObj.id; +} + +////////////////////////////////////////////////////////////////////// +// +// Drawing Functions and Utilit... [truncated message content] |
From: <fan...@us...> - 2008-02-25 23:07:14
|
Revision: 4895 http://linpha.svn.sourceforge.net/linpha/?rev=4895&view=rev Author: fangehrn Date: 2008-02-25 15:07:07 -0800 (Mon, 25 Feb 2008) Log Message: ----------- 2008-02-25 flo * fixed login menu * fixed some menu related bugs reload menu after login does not yet work * added utf-8 database charset for postgres and oracle Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/menu/theme.js Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/ChangeLog 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,4 +1,10 @@ +2008-02-25 flo + * fixed login menu + * fixed some menu related bugs + reload menu after login does not yet work + * added utf-8 database charset for postgres and oracle + 2008-02-22 flo * implemented jscookmenu * changed templates with new rounded corners Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -232,7 +232,7 @@ <?php -} // end if plugin_filemanager_enable +} // end if plugins_filemanager_enable /** * print the permission entries Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -13,7 +13,7 @@ */ if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; + $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; // disable syslog foreach($arrPlugins as $value) { @@ -86,9 +86,17 @@ } } - } + /** + * add menu entry + */ + if (strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_list'], 'plugins_'.$value)===false) { + $GLOBALS['linpha']->sql->config->updateConfig('sys_style_menu_list', + $GLOBALS['linpha']->sql->config->value['sys_style_menu_list'].',plugins_'.$value + ); + } + } // end if valid plugin } - } + } // end foreach unset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT']); // set plugins_*_enable to '1' Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -138,6 +138,7 @@ $GLOBALS['linpha']->db->Execute("SET character_set_server='utf8'"); break; case "postgres": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) if(isset($db_password)) { $GLOBALS['linpha']->db->Connect("host=$db_hostname port=$db_port user=$db_username password=$db_password dbname=$db_name"); @@ -148,6 +149,7 @@ } break; case "oci8po": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) $GLOBALS['linpha']->db->PConnect($db_hostname, $db_username, $db_password, $db_name); break; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -33,7 +33,7 @@ public $URL_base, $URL_full, $idCurrent; public $hideMenu = false, $hideTitle = false; - public $menu, $menuFinal, $nofMenuEntries = 0; + public $menu = array(), $menuFinal, $nofMenuEntries = 0; public $arrayDefaultMenuEntries; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; @@ -273,7 +273,7 @@ foreach($arrayMenuEntries as $menuEntry) { - if ($menuEntry == 'more' || $menuEntry == 'admin' || $menuEntry == 'settings') + if ($menuEntry == 'more') { if (!isset($this->menu[$menuEntry])) { continue; @@ -281,12 +281,19 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + if ($menuEntry == 'more') { + $link = ''; + } elseif($menuEntry == 'admin') { + $link = LINPHA_CLIENT.'/admin/'; + } else { + $link = LINPHA_LINK.'&linCat='.$menuEntry; + } $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], - 'link' => LINPHA_LINK.'&linCat='.$menuEntry + 'link' => $link ); - } elseif ( strpos($menuEntry, 'plugin_') !== false ) { - $menuEntry = substr($menuEntry, 7); + } elseif ( strpos($menuEntry, 'plugins_') !== false ) { + $menuEntry = substr($menuEntry, 8); $this->menuFinal[ $menuEntry ] = array( 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else 'link' => LINPHA_LINK.'&linCat='.$menuEntry @@ -344,7 +351,13 @@ foreach ($this->menu as $key=>$arrayMenuEntry) { if (strpos($key,'icon_')===false) { - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + if (empty($this->menuFinal[$key]['link'])) { + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + } else { + $link = linConvertAmp($this->menuFinal[$key]['link']); + $link = str_replace("'",'\\\'', $link); + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', '".$link."', null, null, "."\n"; + } $this->createJSCookMenuEntry($key, $arrayMenuEntry); $this->menuJSCook[$key][] = "]"; } Modified: trunk/linpha2/lib/modules/module.ajax.php =================================================================== --- trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -64,9 +64,11 @@ */ elseif(isset($_GET['reloadmenu'])) { - if( isset($_SESSION['ref_url_base']) ) + if( isset($_SESSION['ref_url_base']) ) { - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); + // call imgview to get menu details + + include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); $linpha->imgview->setCurrentView($_SESSION['ref_modulename']); @@ -79,8 +81,10 @@ else // return a default menu { } - - $linpha->template->printMenus('home,search,login,more,icons,settings,admin',$comingfrom_ajax=true); + + $linTpl->includeFile('menu'); + $linTpl->setMenu(); + linSetMenuJS(); } exit(); // important if linpha is included from another webpage Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/global.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -49,7 +49,7 @@ <!-- menu --> <?php if (!$linTpl->hideMenu) { ?> <div id="linDivMenu"> - <?php $linTpl->includeFile('menu'); ?> + <?php $linTpl->includeFile('menu'); linDrawMenu(); ?> </div> <!-- end menu --> <?php } ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/menu.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,127 +1,122 @@ <?php -/* +function linDrawMenu() +{ + global $linTpl; + $linTpl->setMenu(); ?> - <ul> - <li><span><?php echo i18n("Search"); ?> </span> - <ul> - <li><a href="<?php echo LINPHA_LINK; ?>&linCat=search"><?php echo i18n("Extended Search"); ?></a></li> - <li> - <div> - <form method="GET" action="<?php echo LINPHA_LINK; ?>&linCat=search"> - <input type="text" class="linForms" name="search_text" value="" /> - <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" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> - </form> - </div> - </li> - </ul> - </li> - </ul> - <ul> - <li> - <span><?php echo i18n("Login"); ?> </span> - <ul id="linMenuLogin"> - <li> - <div> - <?php if( linUseAjax() ) { ?> - <form action="" method="POST" onsubmit="new Ajax.Updater('linDivMenu', LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'post', asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;"> - <?php } else { ?> - <form action="<?php echo $this->URL_full; ?>" method="POST"> - <?php } - if($GLOBALS['linpha']->sql->isLoggedIn()) { ?> - <?php echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> - <input type="hidden" name="cmd" value="logout" /> - <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> - <?php } else { ?> - <!-- login infos --> - <br /> - <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> - <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> - <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> - <input type="hidden" name="cmd" value="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> - </div> - </li> - </ul> - </li> - </ul> - <!-- icons --> - <div> - <?php if( isset( $this->output['menu_Icons'] ) ) { - echo $this->output['menu_Icons']; - } ?> - </div> -<?php -*/ - -$menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; -$menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; -$menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; -$menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; - -$linTpl->setMenu(); -$linTpl->createJSCookMenu(); -?> <script type="text/javascript"> <!-- -var myMenu = -[ +var myMenu = <?php linSetMenuJS(); ?>; +cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + +function linRedrawMenu() +{ + cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); +} +function linReloadMenu(form_params) +{ + myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); +} +--> +</script> <?php -reset($linTpl->menuFinal); -list($key, $menuEntry) = each($linTpl->menuFinal); -$prevIsIcon = false; -if (isset( $menu[$key] )) { - echo $menu[$key]; -} elseif (isset($linTpl->menuJSCook[$key])) { - echo $linTpl->menuJSCook[$key]; -} elseif (isset( $menu[$key.'_img'] )) { - echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; - $prevIsIcon = true; -} else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; +linSetMenuNoJS(); } -for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) +function linSetMenuJS() { - if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { - echo ','."\n"; + global $linTpl; + $linTpl->createJSCookMenu(); + + $html_search = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2"><form action="">' . + '<input type="text" size="10" name="searchwhat" value="" /><input type="submit" value="'.i18n("search").'" /></form></td>'; + + $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; + if (linUseAjax()) { + $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; } else { - echo ',_cmSplit,'."\n"; + $html_login .= '<form action="'.$this->URL_full.'" method="POST">'; } + if ($GLOBALS['linpha']->sql->isLoggedIn()) { + $html_login .= i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />' . + '<input type="hidden" name="cmd" value="logout" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Logout").'" />'; + } else { + $html_login .= '<br /><label for="linFormUsername" style="display: block; float: left; width: 80px;">' . + i18n("Username").': </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" />' . + '<br /><label for="linFormPassword" style="display: block; float: left; width: 80px;">' . + i18n("Password").': </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" />' . + '<br /><br />'; + + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { + $html_login .= '<label for="linFormCheckboxRemember">' . + '<input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" />' . + i18n("Remember Me").'</label>'; + } + + $html_login .= '<input type="hidden" name="cmd" value="login" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Login").'" /><br /><br />' . + '<div style="font-size: smaller; border: 0px;">'.i18n("You must have cookies enabled to log in.").'</div>'; + } + $html_login .= '</form></td>'; + + $menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_search)."']," . "\n" . + "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . + "]"; + $menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_login)."']" . "\n" . + "]"; + $menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; + $menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; + $menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; + $menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; + + echo '['; + reset($linTpl->menuFinal); + list($key, $menuEntry) = each($linTpl->menuFinal); $prevIsIcon = false; if (isset( $menu[$key] )) { echo $menu[$key]; } elseif (isset($linTpl->menuJSCook[$key])) { - echo implode('',$linTpl->menuJSCook[$key]); + echo $linTpl->menuJSCook[$key]; } elseif (isset( $menu[$key.'_img'] )) { echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; $prevIsIcon = true; } else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; } + + for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) + { + if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { + echo ','."\n"; + } else { + echo ',_cmSplit,'."\n"; + } + + $prevIsIcon = false; + if (isset( $menu[$key] )) { + echo $menu[$key]; + } elseif (isset($linTpl->menuJSCook[$key])) { + echo implode('',$linTpl->menuJSCook[$key]); + } elseif (isset( $menu[$key.'_img'] )) { + echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; + $prevIsIcon = true; + } else { + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; + } + } + echo ']'; } + +function linSetMenuNoJS() +{ + global $linTpl; ?> -]; -cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); ---> -</script> <noscript> <?php reset($linTpl->menuFinal); @@ -139,3 +134,6 @@ } ?> </noscript> +<?php +} +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/themes/default/menu/theme.js =================================================================== --- trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 23:07:07 UTC (rev 4895) @@ -58,6 +58,8 @@ // also for the other lvls offsetSubAdjust: [0, -2], + delay: 500, + effect: new CMFadingEffect (8, 4) // rest use default settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 15:12:02
|
Revision: 4896 http://linpha.svn.sourceforge.net/linpha/?rev=4896&view=rev Author: fangehrn Date: 2008-03-07 07:11:53 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * added static login form (for non javascript browsers) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.empty.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/menu.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.login.php trunk/linpha2/templates/default/static.login.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/ChangeLog 2008-03-07 15:11:53 UTC (rev 4896) @@ -1,4 +1,7 @@ +2008-03-07 flo + * added static login form (for non javascript browsers) + 2008-02-25 flo * fixed login menu * fixed some menu related bugs Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/index.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -35,6 +35,9 @@ case 'alb': require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; +case 'login': + require_once(LINPHA_DIR.'/lib/modules/module.login.php'); + break; case 'search': require_once(LINPHA_DIR.'/lib/modules/module.search.php'); break; Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -296,7 +296,7 @@ */ if( isset($_POST['cmd']) ) { - if($_POST['cmd']=='logout') + if($_POST['cmd']=='logout' && isset($_SESSION['user_name'])) // check for $_SESSION['user_name'] if the user reloads the page after logout { linLog(LOG_TYPE_USER,LOG_NOTICE,'logout','User '.$_SESSION['user_name'].': logged out'); Modified: trunk/linpha2/lib/modules/module.empty.php =================================================================== --- trunk/linpha2/lib/modules/module.empty.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/lib/modules/module.empty.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -25,37 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } -echo $_SERVER['PHP_SELF'].'<br />'; +$linpha->template->output['default'] = '<br />'; - -if( isset($_SERVER['PATH_INFO']) ) -{ - echo $_SERVER['PATH_INFO'].'<br />'; - - $name = substr($_SERVER['PATH_INFO'],1); - echo $name.'<br />'; - - $id = LinSql::getIdFromFullFilename($name); - - - echo '<br /><br /><br />'; - - if($id === false) - { - echo 'false!'; - } - else - { - echo 'not false!<br />'; - echo $id.'<br />'; - } -} - - -exit(); - -$linpha->template->output['default'] = ''; - $linpha->template->setModuleName('default'); $linpha->template->URL_full = LINPHA_LINK.'&linCat=empty'; $linpha->template->output['title'] = i18n("empty"); Added: trunk/linpha2/lib/modules/module.login.php =================================================================== --- trunk/linpha2/lib/modules/module.login.php (rev 0) +++ trunk/linpha2/lib/modules/module.login.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -0,0 +1,33 @@ +<?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. + */ + +/** + * Filemanager + * @package Modules + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +$linpha->template->setModuleName('static.login'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=login'; +$linpha->template->output['title'] = i18n("Login"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/default.html.php =================================================================== --- trunk/linpha2/templates/default/default.html.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/templates/default/default.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -7,4 +7,4 @@ ?> </div> -<?php echo $linTpl->divRoundCorners('top','main'); ?> +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -20,7 +20,7 @@ --> </script> <?php -linSetMenuNoJS(); + linSetMenuNoJS(); } function linSetMenuJS() @@ -37,7 +37,7 @@ 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; } else { - $html_login .= '<form action="'.$this->URL_full.'" method="POST">'; + $html_login .= '<form action="'.$linTpl->URL_full.'" method="POST">'; } if ($GLOBALS['linpha']->sql->isLoggedIn()) { Added: trunk/linpha2/templates/default/static.login.html.php =================================================================== --- trunk/linpha2/templates/default/static.login.html.php (rev 0) +++ trunk/linpha2/templates/default/static.login.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -0,0 +1,45 @@ +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMain"> +<br /><br /> +<form action="<?php echo $linTpl->URL_full; ?>" method="POST"> +<?php +if ($GLOBALS['linpha']->sql->isLoggedIn()) { + echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')'; + ?> + <br /> + <input type="hidden" name="cmd" value="logout" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Logout"); ?>" /> + <?php + +} else { + ?> + <br /><label for="linFormUsername" style="display: block; float: left; width: 80px;"> + <?php echo i18n("Username"); ?>: </label> + <input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /> + + <br /><label for="linFormPassword" style="display: block; float: left; width: 80px;"> + <?php echo i18n("Password"); ?>: </label> + <input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /> + <br /><br /> + + <?php + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { + ?> + <label for="linFormCheckboxRemember"> + <input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /> + <?php echo i18n("Remember Me"); ?> + </label> + <?php + } + ?> + + <input type="hidden" name="cmd" value="login" /> + <input type="submit" name="submit" class="linButton" 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> +<br /><br /> + </div> +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 15:53:44
|
Revision: 4897 http://linpha.svn.sourceforge.net/linpha/?rev=4897&view=rev Author: fangehrn Date: 2008-03-07 07:53:42 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * fixed some bugs * implemented dynamic menu reload Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/templates/default/maps.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/view_img.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/ChangeLog 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,5 +1,7 @@ 2008-03-07 flo + * fixed some bugs + * implemented dynamic menu reload * added static login form (for non javascript browsers) 2008-02-25 flo Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -304,7 +304,7 @@ /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->menu['admin']['import']['value'][] = array( + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( 'name' => i18n("Recreate This Thumbnail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); @@ -383,8 +383,8 @@ if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) @@ -433,17 +433,17 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -281,6 +281,14 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + + if ($menuEntry == 'admin' && !$GLOBALS['linpha']->sql->isAdmin()) { + continue; + } + if ($menuEntry == 'settings' && !$GLOBALS['linpha']->sql->isLoggedIn()) { + continue; + } + if ($menuEntry == 'more') { $link = ''; } elseif($menuEntry == 'admin') { @@ -288,6 +296,7 @@ } else { $link = LINPHA_LINK.'&linCat='.$menuEntry; } + $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], 'link' => $link Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -84,7 +84,7 @@ } }, - AjaxPost: function(parameters,successFunction) + AjaxPost: function(url, parameters, successFunction) { var opt = { // Use POST @@ -108,17 +108,17 @@ } } - new Ajax.Request(xmlUrl + '&linId=' + IdCurrent + '&xml', opt); + new Ajax.Request(url, opt); }, - reloadMenu: function() + /*reloadMenu: function() { if( this.menuNeedsUpdating ) { new Ajax.Updater('menu', LINPHA_LINK + '&linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'get', asynchronous:true, evalScripts:true}); this.menuNeedsUpdating = false; } - }, + },*/ /** * setWindowSize() Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -67,16 +67,7 @@ }, loadImageXml: function(imgId) { - // http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request - new Ajax.Request( - xmlUrl + '&linId=' + imgId + '&xml', - { - method:'get', - asynchronous:true, - onSuccess:this.loadImageContinue, - onFailure: function(t) { alert('Error ' + t.status + ' -- ' + t.statusText); } - } - ); + myLinGlobal.AjaxPost(linUrlBase + '&linId=' + imgId + '&xml', '', myLinImage.loadImageContinue); }, loadImageContinue: function(t) { Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -20,6 +20,8 @@ this.markersData = false; this.markersObj = new Array(); this.imagesObj = new Array(); + + this.ajaxUrl = linUrlBase + '&linId=' + IdCurrent + '&xml'; }, /** @@ -27,7 +29,7 @@ */ loadMarkers: function() { - myLinGlobal.AjaxPost('cmd=loadMarkers',myLinMaps.showMarkers); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers); }, showMarkers: function(t) { @@ -102,7 +104,7 @@ deleteMarker: function(markerId) { - myLinGlobal.AjaxPost('cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); }, deleteMarkerFinish: function(t) { @@ -135,14 +137,14 @@ assignAlbum: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumChange: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumDelete: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumFinish: function(t) { @@ -162,7 +164,7 @@ loadAlbums: function() { - myLinGlobal.AjaxPost('cmd=loadAlbums',myLinMaps.showAlbums); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums); }, showAlbums: function(t) { @@ -192,7 +194,7 @@ this.toggleNav(); } - myLinGlobal.AjaxPost('cmd=loadImages&albId='+albId,myLinMaps.showImages); + myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages); }, showImages: function(t) Modified: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -27,7 +27,7 @@ var mapDefaultZoom = 4; var mapDefaultLat = 49.9801; var mapDefaultLng = 10.8731; - + geocoder = new GClientGeocoder(); googlemap = new google.maps.Map2(document.getElementById("linDivMapObject")); @@ -179,7 +179,7 @@ inputForm.setAttribute("action",""); inputForm.setAttribute("method","POST"); inputForm.setAttribute("id","linFormEditMarker"); - inputForm.onsubmit = function() {myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;}; + inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;}; inputForm.innerHTML = $('linDivEditMarker').innerHTML; myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked. Modified: trunk/linpha2/templates/default/maps.head.php =================================================================== --- trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -9,13 +9,14 @@ var myMenu = <?php linSetMenuJS(); ?>; cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); -function linRedrawMenu() +function linRedrawMenu(t) { - cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + myMenuReload = eval('(' + t.responseText + ')'); + cmDraw ('linDivMenu', myMenuReload, 'hbr', cmThemePanel); } function linReloadMenu(form_params) { - myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); + myLinGlobal.AjaxPost(LINPHA_LINK + 'linCat=ajax&reloadmenu&linId=' + IdCurrent, form_params, linRedrawMenu); } --> </script> @@ -33,9 +34,10 @@ $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; if (linUseAjax()) { - $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + /*$html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. - 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">';*/ + $html_login .= '<form action="" method="POST" onsubmit="linReloadMenu(Form.serialize(this)); return false;">'; } else { $html_login .= '<form action="'.$linTpl->URL_full.'" method="POST">'; } Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 20:16:26
|
Revision: 4898 http://linpha.svn.sourceforge.net/linpha/?rev=4898&view=rev Author: fangehrn Date: 2008-03-07 12:16:10 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * started using YUI tabview (oh this was easy) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/view_img.head.php trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/templates/default/static.view_img.html.php trunk/linpha2/templates/default/static.view_thumb.html.php Removed Paths: ------------- trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_thumb_static.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/ChangeLog 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,5 +1,6 @@ 2008-03-07 flo + * started using YUI tabview (oh this was easy) * fixed some bugs * implemented dynamic menu reload * added static login form (for non javascript browsers) Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/index.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -71,7 +71,10 @@ case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; -case 'empty': +case 'viewer': + require_once(LINPHA_DIR.'/lib/modules/module.viewer.php'); + break; + case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -686,7 +686,7 @@ } else { - $GLOBALS['linpha']->template->setModuleName('view_thumb_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); $this->viewThumbNojs(); @@ -1149,7 +1149,7 @@ } else { - $GLOBALS['linpha']->template->setModuleName('view_img_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_img'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); } } @@ -1401,7 +1401,7 @@ */ function viewMeta() { - $GLOBALS['linpha']->template->setModuleName('view_img_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_img'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 20:16:10 UTC (rev 4898) @@ -100,7 +100,7 @@ // Handle 404 on404: function(t) { - alert('Error 404: location "' + t.statusText + '" was not found.'); + alert('Error 404: ' + t.statusText); }, // Handle other errors onFailure: function(t) { @@ -203,7 +203,7 @@ /** * menu tab functions - */ + openTab: function( className, tabNr ) { divElems = document.getElementsByTagName('div'); for(i = 0, n = 0; i < divElems.length; i++) @@ -233,7 +233,7 @@ //this.tabs[ className ][ tabNr ] = ''; //this.tabs.className.tabNr = ''; $(elemAId).style.color = ''; - }, + },*/ /** * popup functions Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/js/LinImage.js 2008-03-07 20:16:10 UTC (rev 4898) @@ -465,7 +465,7 @@ case '1': // image this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') - Element.hide('linDivVideoLink'); + //Element.hide('linDivVideoLink'); //Element.show('linDivExifLink'); //$('linAMetaExif').href = '#' + $('linAMetaExif').href; //myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); @@ -473,7 +473,7 @@ break; case '2': // video - Element.show('linDivVideoLink'); + //Element.show('linDivVideoLink'); //Element.hide('linDivExifLink'); //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); //$('linAMetaExif').href = '#' + $('linAMetaExif').href; @@ -903,19 +903,15 @@ * idea: * swap the colors of <a> and <div> tag (id 'linHrefInfoLink' and 'linDivInfoLink' * so it is possible to set the colors in the css template (and not in javascript file) - */ + showImgInfo: function() { - /** - * make visible/invisible - */ + // make visible/invisible if( this.imgInfoShowHide == 'hide' ) { this.imgInfoShowHide = 'show'; - /** - * set position - */ + // set position $('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop + 'px'; $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight + 'px'; @@ -933,12 +929,14 @@ $('linHrefInfoLink').style.color = this.imgInfoColorActive; } - }, + },*/ hideImgInfoNow: function() { //Element.hide('linDivMetaOuter'); Element.hide('linHrefPanoLink'); - Element.setOpacity('linDivMainimage',1); + Element.hide('linDivVideoLink'); + + //Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; //$('linHrefInfoLink').style.color = this.imgInfoColorActive; Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/global.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -56,7 +56,7 @@ <?php $linTpl->includeFile('body'); ?> -<?php echo microtime(true)-$GLOBALS['linStartTime']; ?> +<?php /*echo microtime(true)-$GLOBALS['linStartTime'];*/ ?> </body> </html> <?php Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -124,6 +124,10 @@ reset($linTpl->menuFinal); for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) { + if ($key=='more') { + continue; // static mode hasn't a 'more' menu + } + if (isset( $menu[$key.'_img'] )) { echo '<a href="'.$menuEntry['link'].'" class="linAIconMenu">'.$menu[$key.'_img'].' '.'</a>'; // icons } else { Copied: trunk/linpha2/templates/default/static.view_img.html.php (from rev 4895, trunk/linpha2/templates/default/view_img_static.html.php) =================================================================== --- trunk/linpha2/templates/default/static.view_img.html.php (rev 0) +++ trunk/linpha2/templates/default/static.view_img.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -0,0 +1,107 @@ + +<!-- navigation --> +<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> + <?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivNavigation"> + <?php echo $linTpl->output['navigation']; ?> + </div> + + <?php echo $linTpl->divRoundCorners('bottom','main'); ?> +<?php } ?> + +<!-- thumbnails --> +<?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivThumbnavi"> + <div id="linDivThumbnavi_Prev"> + <?php echo $linTpl->output['prev_thumb']; ?> + </div> + <div id="linDivThumbnavi_Current"> + <?php echo $linTpl->output['current_thumb']; ?> + </div> + <div id="linDivThumbnavi_Next"> + <?php echo $linTpl->output['next_thumb']; ?> + </div> + </div> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> + +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMain"> + <?php if($_SESSION['mode_imageview']=='meta') { ?> + <!-- 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 LinMetaData::showEditMetaData(); + } else { ?> + + <!-- show image --> + <div id="linDivMainimage"> + <img id="linImgMainimage" width="<?php echo $GLOBALS['linpha']->imgview->img_width; ?>" height="<?php echo $GLOBALS['linpha']->imgview->img_height; + ?>" src="<?php echo LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent. + '&max_width='.$GLOBALS['linpha']->imgview->img_width.'&max_height='.$GLOBALS['linpha']->imgview->img_height; ?>" /> + </div> + <br /><br /> + + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:linOpenTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + <script language="JavaScript" type="text/javascript"> + function linOpenTextarea() + { + document.getElementById('linInputAddCommentTextarea').style.display = 'block'; + document.getElementById('linDivAddCommentText').style.display = 'none'; + + document.getElementById('linInputAddCommentTextarea').value = document.getElementById('linInputAddCommentText').value; + } + </script> + + <br /><br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"> + <?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 linHtmlTag($data['meta_comment'],ENT_QUOTES); ?> + <br /><br /> + <?php } ?> + </div> + + <?php } /* end if view!=meta */ ?> + </div> + +<?php echo $linTpl->divRoundCorners('top','bottom'); ?> + +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMetaStatic"> + <table id="linTableMeta"> + <?php + foreach($linTpl->output['image_infos'] AS $value) + { + echo '<tr><td class="linTdMetaLeftColumn">'.$value['name'].'</strong></td><td>'.$value['value'].'</td></tr>'; + } + ?> + </table> + </div> +<?php echo $linTpl->divRoundCorners('botom','main'); ?> \ No newline at end of file Copied: trunk/linpha2/templates/default/static.view_thumb.html.php (from rev 4895, trunk/linpha2/templates/default/view_thumb_static.html.php) =================================================================== --- trunk/linpha2/templates/default/static.view_thumb.html.php (rev 0) +++ trunk/linpha2/templates/default/static.view_thumb.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -0,0 +1,52 @@ + +<!-- navigation --> +<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> + <?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivNavigation"> + <?php echo $linTpl->output['navigation']; ?> + </div> + + <?php echo $linTpl->divRoundCorners('bottom','main'); ?> +<?php } ?> + +<!-- main --> +<?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivPagenrOuter"> + <div id="linDivPagenr"> + <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> + <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> + <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> + </div> + </div> + + <div id="linDivMain"> + + <?php + if( isset($GLOBALS['linpha']->imgview->photos_show)) + { + for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) + { + if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { + echo '<div style="clear: left;"></div>'; // add clear float for line break + } + ?> + + <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> + </div> + <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> + </div> + <?php + } + } + ?> + + </div> + <div style="clear: both;"></div> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img.head.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -22,3 +22,18 @@ <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinImage.js"> </script> + + +<!-- YUI Dependencies --> +<!-- Sam Skin CSS for TabView --> +<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.0/build/tabview/assets/skins/sam/tabview.css"> + +<!-- JavaScript Dependencies for Tabview: --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/element/element-beta-min.js"></script> + +<!-- OPTIONAL: Connection (required for dynamic loading of data) --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/connection/connection-min.js"></script> + +<!-- Source file for TabView --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/tabview/tabview-min.js"></script> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -23,7 +23,7 @@ <!-- main --> <?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMain"> + <div id="linDivMain" class="yui-skin-sam"> <div id="linDivloading"> <img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif"> </div> @@ -37,72 +37,157 @@ <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;"><?php echo i18n("Panorama"); ?></a> + <div id="linDivVideoLink"> + <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play 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> <?php /*<a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a>*/ ?> </div> <br /><br /> - - <div id="linDivTabs"> - <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | - <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> - <br /><br /> - - <div class="linDivTab"> - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); return false;"> - <?php echo i18n("Add Comment"); ?>:<br /> - <div id="linDivAddCommentText"> - <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> - <a href="javascript:myLinImage.openTextarea()">(+)</a> - </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - - <br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"></div> - </div> - <div class="linDivTab"> - Rating - </div> - <div class="linDivTab"> - Info - <div id="linDivMeta"></div> + <div id="linDivTabs" class="yui-navset"> + <ul class="yui-nav"> + <li class="selected"><a href=""><em><?php echo i18n("Comments"); ?></em></a></li> + </ul> + <div class="yui-content" style="height: 200px; overflow: auto;"> + <div><p> + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(linUrlBase + '&linId=' + IdCurrent + '&xml', Form.serialize(this),myLinImage.saveComment); return false;"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:myLinImage.openTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + + <br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"></div> + </p></div> + - <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 /> - <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> - <br /> - <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> + </div> - </div> - <div class="linDivTab"> - EXIF - - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> - </div> - <script type="text/javascript"> - //myLinGlobal.openTab('linDivTab',0); - </script> - </div> + + <script type="text/javascript"> + var myTabs = new YAHOO.widget.TabView("linDivTabs"); + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Image Info"); ?>', + content: '<div id="linDivMeta"></div>' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("GPS Info"); ?>', + content: 'GPS' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("EXIF"); ?>', + content: 'EXIF' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("ITPC/XMP"); ?>', + content: 'ITPC/XMP' + })); + + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Edit Meta Data"); ?>', + content: 'edit' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Edit ITPC/XMP"); ?>', + content: 'edit' + })); + + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Video Info"); ?>', + content: '<div id="linDivMeta"></div>' + })); + + /* + <li><a href=""><em><?php echo i18n("Rating"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("Fileinfo"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("GPS Info"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("EXIF"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("IPTC/XMP"); ?></em></a></li> + + <div><p><?php echo i18n("Rating"); ?></p></div> + + <div><p> + <?php echo i18n("Fileinfo"); ?> + <div id="linDivMeta"></div> + + + </p></div> + + <div><p><?php echo i18n("GPS Info"); ?></p></div> + + <div><p> + <?php echo i18n("EXIF"); ?> + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + </p></div> + + <div><p><?php echo i18n("IPTC/XMP"); ?></p></div> + + */ + /*alert( myTabs ); + alert( myTabs.get(0) ); + alert( myTabs.get(0).set('content','hiho') );*/ + //var tab0 = myTabs.get(0); + //alert(tab0); + //tabView.removeTab(tabView.get('activeTab')); + </script> + + + <div id="container"></div> + + <script type="text/javascript"> + /*var tabView = new YAHOO.widget.TabView(); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'lorem', + content: '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat.</p>', + active: true + })); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'ipsum', + content: '<ul><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li></ul>' + + })); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'dolor', + content: '<form action="#"><fieldset><legend>Lorem Ipsum</legend><label for="foo"> <input id="foo" name="foo"></label><input type="submit" value="submit"></fieldset></form>' + })); + + tabView.appendTo('container');*/ + + //tabView.removeTab(tabView.get('activeTab')); + //tabView.getTab(0).set('content','hiho'); + //tabView.getTab(0).set('disabled',true); + //tabView.getTab(0).set('contentVisible',false); + + </script> + </div> <?php echo $linTpl->divRoundCorners('bottom','main'); ?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/view_img_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_img_static.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img_static.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,107 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- thumbnails --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivThumbnavi"> - <div id="linDivThumbnavi_Prev"> - <?php echo $linTpl->output['prev_thumb']; ?> - </div> - <div id="linDivThumbnavi_Current"> - <?php echo $linTpl->output['current_thumb']; ?> - </div> - <div id="linDivThumbnavi_Next"> - <?php echo $linTpl->output['next_thumb']; ?> - </div> - </div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> - -<?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMain"> - <?php if($_SESSION['mode_imageview']=='meta') { ?> - <!-- 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 LinMetaData::showEditMetaData(); - } else { ?> - - <!-- show image --> - <div id="linDivMainimage"> - <img id="linImgMainimage" width="<?php echo $GLOBALS['linpha']->imgview->img_width; ?>" height="<?php echo $GLOBALS['linpha']->imgview->img_height; - ?>" src="<?php echo LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent. - '&max_width='.$GLOBALS['linpha']->imgview->img_width.'&max_height='.$GLOBALS['linpha']->imgview->img_height; ?>" /> - </div> - <br /><br /> - - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <?php echo i18n("Add Comment"); ?>:<br /> - <div id="linDivAddCommentText"> - <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> - <a href="javascript:linOpenTextarea()">(+)</a> - </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - <script language="JavaScript" type="text/javascript"> - function linOpenTextarea() - { - document.getElementById('linInputAddCommentTextarea').style.display = 'block'; - document.getElementById('linDivAddCommentText').style.display = 'none'; - - document.getElementById('linInputAddCommentTextarea').value = document.getElementById('linInputAddCommentText').value; - } - </script> - - <br /><br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"> - <?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 linHtmlTag($data['meta_comment'],ENT_QUOTES); ?> - <br /><br /> - <?php } ?> - </div> - - <?php } /* end if view!=meta */ ?> - </div> - -<?php echo $linTpl->divRoundCorners('top','bottom'); ?> - -<?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMetaStatic"> - <table id="linTableMeta"> - <?php - foreach($linTpl->output['image_infos'] AS $value) - { - echo '<tr><td class="linTdMetaLeftColumn">'.$value['name'].'</strong></td><td>'.$value['value'].'</td></tr>'; - } - ?> - </table> - </div> -<?php echo $linTpl->divRoundCorners('botom','main'); ?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/view_thumb_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb_static.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_thumb_static.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,52 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- main --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivPagenrOuter"> - <div id="linDivPagenr"> - <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> - <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> - <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> - </div> - </div> - - <div id="linDivMain"> - - <?php - if( isset($GLOBALS['linpha']->imgview->photos_show)) - { - for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) - { - if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { - echo '<div style="clear: left;"></div>'; // add clear float for line break - } - ?> - - <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> - </div> - <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> - </div> - <?php - } - } - ?> - - </div> - <div style="clear: both;"></div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:53:32
|
Revision: 4908 http://linpha.svn.sourceforge.net/linpha/?rev=4908&view=rev Author: fangehrn Date: 2008-03-16 01:53:26 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-16 08:53:04 UTC (rev 4907) +++ trunk/linpha2/ChangeLog 2008-03-16 08:53:26 UTC (rev 4908) @@ -1,4 +1,14 @@ +2008-03-15 flo + * fixed some IE bugs + everything should now work fine on firefox/opera/IE + +2008-03-13 flo + * finished fullscreen/slideshow/navigation + +2008-03-09 flo + * re-design thumb and image view + 2008-03-07 flo * started using YUI tabview (oh this was easy) * fixed some bugs Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-16 08:53:04 UTC (rev 4907) +++ trunk/linpha2/index.php 2008-03-16 08:53:26 UTC (rev 4908) @@ -53,6 +53,9 @@ case 'ajax': require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); break; +case 'image': + require_once(LINPHA_DIR.'/lib/modules/module.image.php'); + break; case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; @@ -74,7 +77,7 @@ case 'viewer': require_once(LINPHA_DIR.'/lib/modules/module.viewer.php'); break; - case 'empty': +case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-30 22:08:10
|
Revision: 4913 http://linpha.svn.sourceforge.net/linpha/?rev=4913&view=rev Author: fangehrn Date: 2008-03-30 15:08:03 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 2008-03-30 flo * JSCookMenu fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 * Disable submenu "image" in thumb mode * search, newimg, browse: changed to new AlbumView class * added transparency to search image 2008-03-18 flo * implemented order by feature 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/index.php trunk/linpha2/lib/classes/adodb-exceptions.inc.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.identify.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/include/calendar.php trunk/linpha2/lib/include/metadata_info_show.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/js/LinThumbnails.js trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/lib/js/LinYUIAlbumNavigation.js trunk/linpha2/lib/js/LinYUIGlobal.js trunk/linpha2/lib/js/LinYUIPage.js trunk/linpha2/lib/lang/lang.German.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.download.php trunk/linpha2/lib/modules/module.image.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.panorama.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/lib/modules/module.settings.php trunk/linpha2/lib/plugins/example/module.example.php trunk/linpha2/lib/plugins/filemanager/module.filemanager.php trunk/linpha2/lib/plugins/filemanager/sql/sql.data.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/menu.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/slideshow.js.php trunk/linpha2/templates/default/tabs/comments.html.php trunk/linpha2/templates/default/tabs/exif.html.php trunk/linpha2/templates/default/themes/default/DefsThumbView.js trunk/linpha2/templates/default/themes/default/css/global.css trunk/linpha2/templates/default/themes/default/menu/theme.css Added Paths: ----------- trunk/linpha2/lib/graphics/xmag.png trunk/linpha2/lib/graphics/xmag_big.png trunk/linpha2/lib/modules/module.viewer.php trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/tabs/editIptcXmp.html.php trunk/linpha2/templates/default/tabs/editMeta.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/ChangeLog 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,4 +1,17 @@ +2008-03-30 flo + * JSCookMenu fixed bug in cmEnableItem() reported here: + http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 + + * Disable submenu "image" in thumb mode + * search, newimg, browse: + changed to new AlbumView class + + * added transparency to search image + +2008-03-18 flo + * implemented order by feature + 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -3,36 +3,45 @@ if($cat2 == 'view') { - $sql_perm_type = 'read'; + $sql_perm_type = 'read'; } elseif($cat2 == 'write') { - $sql_perm_type = 'write'; - - ?> - <br /><hr /><br /> - <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2; ?>"> - <?php - if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - $LinAdmin->saveConfig( - Array( - 'plugins_filemanager_userEnable' - ) - ); - } - - $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_filemanager_userEnable'),'plugins_filemanager_userEnable',$LinAdmin->option_value_system['plugins_filemanager_userEnable']); - - ?> - <input type="hidden" name="cmd" value="saveconfig" /> - <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> - </form> - <br /><hr /><br /> - <?php + if (!isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'])) { + ?> + <a href="./?cat=settings_plugins"><?php echo i18n("Enable Filemanager Plugin") ?></a> + <?php + } else { + + $sql_perm_type = 'write'; + + ?> + <br /><hr /><br /> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2; ?>"> + <?php + if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $LinAdmin->saveConfig( + array( + 'plugins_filemanager_userEnable' + ) + ); + } + + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_filemanager_userEnable'),'plugins_filemanager_userEnable',$LinAdmin->option_value_system['plugins_filemanager_userEnable']); + + ?> + <input type="hidden" name="cmd" value="saveconfig" /> + <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </form> + <br /><hr /><br /> + <?php + } } -if($cat2 == 'view' OR ($cat2 == 'write' AND $GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable'] )) +if($cat2 == 'view' || ($cat2 == 'write' + && isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable']) + && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_userEnable'] )) { /** @@ -193,8 +202,8 @@ <input type="hidden" name="photo_id" value="<?php echo $linpha->template->idCurrent; ?>" /> <input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" /> <input type="hidden" name="cmd" value="save_permissions" /> - <input type="submit" name="submit" value="save" /> - <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>">cancel</a> + <input type="submit" name="submit" value="<?php echo i18n("Save"); ?>" /> + <a href="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>"><?php echo i18n("Cancel"); ?></a> </form> <br /><br /> <?php @@ -248,7 +257,7 @@ * exclude files */ if($data['img_type'] == 0 // show folders - || ($GLOBALS['view_mode']=='files' && $GLOBALS['cat2']=='read') // show files if we not on top (and it doesnt make sense to give write permissions to the file itself) + || ($GLOBALS['view_mode']=='files' && $GLOBALS['cat2']=='view') // show files if we not on top (and it doesnt make sense to give write permissions to the file itself) || ( $data['img_type'] != 0 && $i == 0 ) ) // show files which have permissions explicitly set (not inherited) { echo '<tr><td>'; Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/docs/dev/external_libraries.txt 2008-03-30 22:08:03 UTC (rev 4913) @@ -4,6 +4,13 @@ - scriptaculous 1.8.0 (contains prototype) - prototype 1.6.0 +- JSCookMenu + CHANGES + ------- + fixed bug in cmEnableItem() reported here: + http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 + + - adodb - getid3 1.7.7 Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/index.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -59,9 +59,6 @@ case 'newimg': require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); break; -case 'metadata': - require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); - break; case 'video': require_once(LINPHA_DIR.'/lib/modules/module.video.php'); break; Modified: trunk/linpha2/lib/classes/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,82 +1,82 @@ -<?php - -/** - * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. - * Released under both BSD license and Lesser GPL library license. - * Whenever there is any discrepancy between the two licenses, - * the BSD license will take precedence. - * - * Set tabs to 4 for best viewing. - * - * Latest version is available at http://php.weblogs.com - * - * Exception-handling code using PHP5 exceptions (try-catch-throw). - */ - - -if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); -define('ADODB_ERROR_HANDLER','adodb_throw'); - -class ADODB_Exception extends Exception { -var $dbms; -var $fn; -var $sql = ''; -var $params = ''; -var $host = ''; -var $database = ''; - - function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) - { - switch($fn) { - case 'EXECUTE': - $this->sql = $p1; - $this->params = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; - break; - - case 'PCONNECT': - case 'CONNECT': - $user = $thisConnection->user; - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; - break; - default: - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; - break; - } - - $this->dbms = $dbms; - if ($thisConnection) { - $this->host = $thisConnection->host; - $this->database = $thisConnection->database; - } - $this->fn = $fn; - $this->msg = $errmsg; - - if (!is_numeric($errno)) $errno = -1; - parent::__construct($s,$errno); - } -} - -/** -* Default Error Handler. This will be called with the following params -* -* @param $dbms the RDBMS you are connecting to -* @param $fn the name of the calling function (in uppercase) -* @param $errno the native error number from the database -* @param $errmsg the native error msg from the database -* @param $p1 $fn specific parameter - see below -* @param $P2 $fn specific parameter - see below -*/ - -function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) -{ -global $ADODB_EXCEPTION; - - if (error_reporting() == 0) return; // obey @ protocol - if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; - else $errfn = 'ADODB_EXCEPTION'; - throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); -} - - +<?php + +/** + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * Released under both BSD license and Lesser GPL library license. + * Whenever there is any discrepancy between the two licenses, + * the BSD license will take precedence. + * + * Set tabs to 4 for best viewing. + * + * Latest version is available at http://php.weblogs.com + * + * Exception-handling code using PHP5 exceptions (try-catch-throw). + */ + + +if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); +define('ADODB_ERROR_HANDLER','adodb_throw'); + +class ADODB_Exception extends Exception { +var $dbms; +var $fn; +var $sql = ''; +var $params = ''; +var $host = ''; +var $database = ''; + + function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) + { + switch($fn) { + case 'EXECUTE': + $this->sql = $p1; + $this->params = $p2; + $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; + break; + + case 'PCONNECT': + case 'CONNECT': + $user = $thisConnection->user; + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; + break; + default: + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; + break; + } + + $this->dbms = $dbms; + if ($thisConnection) { + $this->host = $thisConnection->host; + $this->database = $thisConnection->database; + } + $this->fn = $fn; + $this->msg = $errmsg; + + if (!is_numeric($errno)) $errno = -1; + parent::__construct($s,$errno); + } +} + +/** +* Default Error Handler. This will be called with the following params +* +* @param $dbms the RDBMS you are connecting to +* @param $fn the name of the calling function (in uppercase) +* @param $errno the native error number from the database +* @param $errmsg the native error msg from the database +* @param $p1 $fn specific parameter - see below +* @param $P2 $fn specific parameter - see below +*/ + +function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) +{ +global $ADODB_EXCEPTION; + + if (error_reporting() == 0) return; // obey @ protocol + if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; + else $errfn = 'ADODB_EXCEPTION'; + throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); +} + + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -91,7 +91,8 @@ 'plugins_rss' => i18n("RSS"), 'plugins_watermark' => i18n("Watermark"), - + 'plugins_filemanager_userEnable' => i18n("Enable filemanager for non-admin users"), + 'plugins_log_filename' => i18n("Log to this filename"), 'plugins_log_syslog_enable' => i18n("Send important messages to syslog"), 'plugins_log_syslog_add_events' => i18n("Additional log events sent to syslog"), Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -25,15 +25,15 @@ if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.sql.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.template.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.import.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.identify.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.functions.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.image.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.filesys.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.import.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.identify.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.functions.php'); class Linpha { @@ -125,7 +125,6 @@ define('LIN_STR_ACCESSDENIED', i18n("Error: Access denied") ); define('LIN_STR_NOVALIDDATA', i18n("Error: No valid data") ); -define('LIN_STR_CHKFILEPERM', i18n("Check file permissions") ); +define('LIN_STR_CHKFILEPERM', i18n("Error: File not writable. Please check the file permissions.") ); - ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -239,6 +239,8 @@ /** * print a nice navigation line with links on each entry + * + * @uses filemanager, basket */ function linSetNavigationLine( $id, $link ) { @@ -306,34 +308,8 @@ } } -/** - * returns an array with the sort orders - */ -function linGetSortOrders() -{ - return Array( - 'nameasc' => i18n("Name Asc"), - 'namedesc' => i18n("Name Desc"), - 'dateasc' => i18n("Date Asc"), - 'datedesc' => i18n("Date Desc") - ); -} /** - * return the correct sql order string - */ -function linGetSqlSortOrder($order) -{ - switch($order) - { - case 'nameasc': return "name ASC"; - case 'namedesc': return "name DESC"; - case 'dateasc': return "time_add ASC"; - case 'datedesc': return "time_add DESC"; - } -} - -/** * explode string to array and remove first and last entry of array because they are empty */ function linExplodeAndSlice($del,$string) @@ -353,6 +329,18 @@ } /** + * Javascript strings must be surrounded with double quotes + * (-> there is no need to escape single quotes) + * + * @param string $str + * @return escape string + */ +function linEscapeQuotes($str) +{ + return str_replace('"','\\"', $str); +} + +/** * some functions to calculate the page rendering time * this is very useful while trying to speed up LinPHA :-) */ @@ -496,14 +484,7 @@ */ function linUseAjax() { - if( isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax']) ) - { - return true; - } - else - { - return false; - } + return isset($_SESSION['linUseAjax']) && ! isset($_SESSION['linDisableAjax']); } Modified: trunk/linpha2/lib/classes/linpha.identify.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.identify.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.identify.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -101,12 +101,14 @@ function getShortFileType( $img_type ) { - if( LinIdentify::isSupportedImage( $img_type )) { + if (LinIdentify::isSupportedImage( $img_type )) { return 1; - } elseif( LinIdentify::isVideo( $img_type )) { + } elseif (LinIdentify::isVideo( $img_type )) { return 2; - } else { + } elseif ($img_type==0) { return 0; + } else { + return LinIdentify::$ImageTypes['unsupported']; } } @@ -280,12 +282,10 @@ $type = trim($type); $type = strtolower($type); - $imagetypes = LinIdentify::getImagetypeTranslationArray(); - - if(array_key_exists($type,$imagetypes)) { - $orgtype = $imagetypes[$type]; + if(array_key_exists($type,LinIdentify::$ImageTypes)) { + $orgtype = LinIdentify::$ImageTypes[$type]; } else { - $orgtype = $imagetypes['unsupported']; + $orgtype = LinIdentify::$ImageTypes['unsupported']; } /** @@ -343,26 +343,23 @@ function getImagetypeFromFilename($filename) { $ext = LinFilesys::getFileExtFromPath($filename); - $imagetypes = LinIdentify::getImagetypeTranslationArray(); - if(array_key_exists($ext,$imagetypes)) { - return $imagetypes[$ext]; + if(array_key_exists($ext,LinIdentify::$ImageTypes)) { + return LinIdentify::$ImageTypes[$ext]; } else { - return $imagetypes['unsupported']; + return LinIdentify::$ImageTypes['unsupported']; } } /** - * gets an array with all imagetypes, fileext are the keys, imagetype the values + * array with all imagetypes, fileext are the keys, imagetype the values * see http://ch.php.net/manual/de/function.exif-imagetype.php * * @author flo * @return array keys=>value, fileext=>imagetype * @uses get_imagetype_from_filename(),convert_imagetype() */ -function getImagetypeTranslationArray() -{ - $array = Array( +static $ImageTypes = array( // getimagesize starts here 'gif' => 1, @@ -553,8 +550,6 @@ 'unsupported' => 9999999 ); - return $array; -} // end function getImagetypeTranslationArray() -} // end class linIdentify +} // end class LinIdentify ?> Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -393,16 +393,6 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { /** - * Write "own" linpha MetaData fields - */ - if(isset($_POST['linCmd']) - && $_POST['linCmd'] == 'linInsertMetaLinpha') - { - LinMetaData::saveModifiedMetaDataLinpha(); - linSysLog(i18n("Successfully updated data.")); - } - - /** * Write IPTC/XMP MetaData to file */ if(isset($_POST['linCmd']) @@ -596,22 +586,21 @@ * @return none * @author flo */ - public function saveModifiedMetaDataLinpha() + public function saveModifiedMetaDataLinpha($md5sum) { - if(isset($_POST['linMetaField']) - && is_array($_POST['linMetaField'])) + if(isset($_POST['linMetaField']) && is_array($_POST['linMetaField'])) { /** * Delete existing entries */ $query = $GLOBALS['linpha']->db->Execute("DELETE FROM " . "".LIN_PREFIX."meta_data " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + "WHERE md5sum = '".$md5sum."'"); /** * Insert new entries */ - foreach($_POST['linMetaField'] AS $key => $value) + foreach($_POST['linMetaField'] as $key => $value) { if(is_array($value)) // coming from a select (categories etc.) { @@ -622,7 +611,7 @@ { $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)."')"); + "VALUES ('".LinSql::linAddslashes($key)."','".$md5sum."','".LinSql::linAddslashes($value)."')"); } } } @@ -631,7 +620,7 @@ /** * */ - public function showEditMetaData() + public function showEditMetaData($md5sum) { /** * set meta linpha @@ -653,8 +642,8 @@ $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'] . "'"); + "WHERE md5sum = '" . $md5sum . "'" . + "AND field_id = '" . $data['id'] . "'"); switch ($data['field_type']) { case 1 : @@ -701,7 +690,7 @@ $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>'; + '<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>'; @@ -712,29 +701,6 @@ $GLOBALS['linpha']->template->output['meta_linpha'] .= '</td></tr>'; } - - /** - * set meta IPTC - */ - if ($GLOBALS['linpha']->sql->config->value['sys_image_iptc'] || $GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { - if (isset ($GLOBALS['linpha']->imgview->src_file) && file_exists($GLOBALS['linpha']->imgview->src_file)) { - if (is_writable($GLOBALS['linpha']->imgview->src_file)) { - $meta_edit_possible = true; - $filename = $GLOBALS['linpha']->imgview->src_file; // used in IPTC Edit_File_Info.php - } else { - $meta_edit_possible = false; - } - } else { - $meta_edit_possible = false; - } - } - /** - * build the meta data view - */ - $fragment = 'edit_meta'; - global $linTpl; - include (LINPHA_DIR . '/templates/' . $this->template_name . '/fragments.php'); - } /** Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -449,7 +449,7 @@ * this must be after login stuff * template requires login information */ - $GLOBALS['linpha']->template = new linTemplate(); + $GLOBALS['linpha']->template = new LinTemplate(); global $linTpl; $linTpl = $GLOBALS['linpha']->template; // this is just a reference Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -101,6 +101,13 @@ $this->idCurrent = 0; } } + + /** + * check ajax compatibility + */ + if (isset($_GET['linUseAjax'])) { + $_SESSION['linUseAjax'] = true; + } /** * Initial menu entries @@ -110,8 +117,8 @@ if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) { - $GLOBALS['linpha']->template->menu['settings']['filemanager'] = - array('name' => i18n("Filemanager"), 'link' => LINPHA_LINK.'&linCat=filemanager'); + $this->menu['settings']['filemanager'] = + array('name' => i18n("Filemanager"), 'link' => 'javascript:location.href="'.LINPHA_LINK.'&linCat=filemanager&linId="+linIdCurrent'); } } @@ -123,7 +130,6 @@ 'admin' => i18n("Admin"), 'settings' => i18n("Settings") ); - } /** @@ -140,106 +146,19 @@ if (file_exists($filename)) { include_once( $filename ); } - break; case 'menu': $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.html.php'; if (file_exists($filename)) { include_once( $filename ); } - break; case 'head': -/** - * do some common definitions in head - */ - -/** - * Prepare http url - */ -$urlParams = array( - 'bg' => ''.$this->bgcolor.'', - 'bodybg' => ''.$this->bodybgcolor.'', - 'font' => ''.$this->fontcolor.'', - 'albumsbg' => ''.$this->albumsbgcolor.'', - 'links' => ''.$this->linkscolor.'', - 'linkshover' => ''.$this->linkshovercolor.'', - 'forms' => ''.$this->formscolor.'' - ); -/** - * colorsettings.php - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/colorsettings.php?'. - http_build_query($urlParams);?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename.'?'. - http_build_query($urlParams); ?>" type="text/css" /> -<?php } -/** - * global.css - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/global.css'; ?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> -<?php } -/** - * body css - */ -?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>" type="text/css" /> -<?php -$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css'; -if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> -<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> -<?php } - -/** - * javascript - */ -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> -<script type="text/javascript" language="JavaScript"> -var LINPHA_LINK = '<?php echo LINPHA_LINK; ?>'; -var LINPHA_CLIENT = '<?php echo LINPHA_CLIENT; ?>'; -var linUrlBase = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; -var startIdCurrent = <?php echo $this->idCurrent; ?>; -var IdCurrent = startIdCurrent; -var myThemePanelBase = '<?php echo $this->themeFile('menu/'); ?>'; -<?php -if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { - //echo "var checkAjaxCompatibility = true;"."\n"; - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} /*else { - echo "var checkAjaxCompatibility = false;"."\n"; -}*/ -?> -</script> -<?php -/* menu must be after myThemePanelBase definition */ -$filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.head.php'; -if (file_exists($filename)) { - include_once( $filename ); -} -?> - -<?php - $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; - if (file_exists($filename)) { - include_once( $filename ); - } - + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/global.head.php'; + if (file_exists($filename)) { + include_once( $filename ); + } break; - } } @@ -355,41 +274,54 @@ } } + /** + * important: javascript strings must be surround by double quotes + * single quotes will produce an error when parsing JSON data !! + */ function createJSCookMenu() { foreach ($this->menu as $key=>$arrayMenuEntry) { if (strpos($key,'icon_')===false) { if (empty($this->menuFinal[$key]['link'])) { - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + $this->menuJSCook[$key][] = '[null, "'.$this->arrayDefaultMenuEntries[$key].'", null, null, null, ' . "\n"; } else { $link = linConvertAmp($this->menuFinal[$key]['link']); - $link = str_replace("'",'\\\'', $link); - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', '".$link."', null, null, "."\n"; + $this->menuJSCook[$key][] = '[null, "'.$this->arrayDefaultMenuEntries[$key].'", "'.linEscapeQuotes($link).'", null, null, ' . "\n"; } $this->createJSCookMenuEntry($key, $arrayMenuEntry); - $this->menuJSCook[$key][] = "]"; + $this->menuJSCook[$key][] = ']'; } } } + /** + * important: javascript strings must be surround by double quotes + * single quotes will produce an error when parsing JSON data !! + */ function createJSCookMenuEntry($key, &$arrayMenuEntry) { //print_r($arrayMenuEntry); foreach ($arrayMenuEntry as $arraySubMenuEntry) { - $this->menuJSCook[$key][] = "[null, '".htmlentities($arraySubMenuEntry['name'], ENT_QUOTES)."', "; - if (is_array($arraySubMenuEntry['link'])) { - $this->menuJSCook[$key][] = "null, null, null, "."\n"; - $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); - } else { - $link = linConvertAmp($arraySubMenuEntry['link']); - $link = str_replace("'",'\\\'', $link); - $this->menuJSCook[$key][] = "'".$link."', null, null,"; + if ($arraySubMenuEntry['name']=='split') + { + $this->menuJSCook[$key][] = '"_cmSplit",' . "\n"; } - - $this->menuJSCook[$key][] = "],"."\n"; + else + { + $this->menuJSCook[$key][] = '[null, "'.htmlentities($arraySubMenuEntry['name'], ENT_QUOTES).'", '; + if (is_array($arraySubMenuEntry['link'])) { + $this->menuJSCook[$key][] = 'null, null, null, ' . "\n"; + $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); + } else { + $link = linConvertAmp($arraySubMenuEntry['link']); + $this->menuJSCook[$key][] = '"'.linEscapeQuotes($link).'", null, null,'; + } + + $this->menuJSCook[$key][] = '],' . "\n"; + } } /* [null, 'More', null, null, 'Some more options', @@ -443,6 +375,8 @@ $class = 'linCornMain'; } elseif($type=='album') { $class = 'linCornFolder'; + } elseif($type=='slideshow') { + $class = 'linCornSlideshow'; } else { $class = ''; } Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 21:55:12 UTC (rev 4912) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 22:08:03 UTC (rev 4913) @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> * Florian Angehrn @@ -26,26 +26,31 @@ if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS id2, " . - "".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" + "".LIN_PREFIX."photos.id AS id2, " . /* first field used as array key by AdoDB::GetAssoc() */ + "".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, " . + "".LIN_PREFIX."photos.geodata AS geodata" ); -class LinImgview { +class LinViewAlbum { public $mode; // 'home', 'thumb', 'image' public $modulename; // 'albums', 'browse', ... -public $tot_photos; public $photos; public $photos_filtered; -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 +public $folderData; +public $title; /** * constructor @@ -61,96 +66,106 @@ */ function setCurrentView($modulename) { - $this->modulename = $modulename; - - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - - if( $GLOBALS['linpha']->template->idCurrent == 0 ) - { - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); - } - else // $this->modulename=='browse' | 'search' , others will come.. - { - $this->mode = 'thumb'; + $this->modulename = $modulename; + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; - if( ! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - } - else - { - /** - * 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)."'"); - /** - * check for valid id - */ - - if( isset($current_data['id']) ) - { - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; - $this->org_width = $current_data['width']; - $this->org_height = $current_data['height']; + if( ! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + } + else + { + /** + * set file informations + */ + $this->folderData = $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 + */ + + if( isset($this->folderData['id']) ) + { + if ($this->folderData['img_type'] != 0) // id of an image + { + $this->folderData = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".$this->folderData['parent_id']."'"); + + if( isset($this->folderData['id']) && $this->folderData['img_type'] == 0 ) + { + $this->mode = 'thumb'; + $GLOBALS['linpha']->template->output['startup_id'] = $GLOBALS['linpha']->template->idCurrent; + $GLOBALS['linpha']->template->idCurrent = $this->folderData['id']; + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + else + { + $this->mode = 'thumb'; + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if ($this->mode == 'home') { + $this->orderby = $this->getSqlSortOrder( + $GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder'], + $GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder_asc'] + ); + } else { + if (isset($_GET['linOrderBy'])) { + if ($_GET['linOrderBy'] == 'ASC') { + $_SESSION['sort_order_asc'] = 'ASC'; + } else if ($_GET['linOrderBy'] == 'DESC') { + $_SESSION['sort_order_asc'] = 'DESC'; + } else { + $_SESSION['sort_order'] = $_GET['linOrderBy']; + } + } + + if (isset($_SESSION['sort_order_asc'])) { + $str_asc = $_SESSION['sort_order_asc']; + } else { + $str_asc = $GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder_asc']; + } + + if (isset($_SESSION['sort_order'])) { + $this->orderby = $this->getSqlSortOrder($_SESSION['sort_order'], $str_asc); + } else { + $this->orderby = $this->getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder'], $str_asc); + } + } - /** - * switch between thumb_view and img_view - */ - if( $this->img_type == 0) - { - $this->mode = 'thumb'; - $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - - if(! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - else - { - $this->mode = 'image'; - $this->id_parent = $current_data['parent_id']; // use parent_id on image view - - if( ! isset($_SESSION['mode_imageview']) ) - { - $_SESSION['mode_imageview'] = 'img'; - } - } - } - else // no valid id supplied - { - $this->mode = 'home'; - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - if($this->mode == 'thumb' && isset($_GET['view'])) - { - $_SESSION['mode_thumbview'] = $_GET['view']; - } - if($this->mode == 'image' && isset($_GET['view'])) - { - $_SESSION['mode_imageview'] = $_GET['view']; - } - - /** - * set id_parent to a default value - */ - if( ! isset( $this->id_parent) ) - { - $this->id_parent = $GLOBALS['linpha']->template->idCurrent; - } + if ($this->mode == 'thumb') + { + if (isset($_GET['view'])) { + $_SESSION['mode_thumbview'] = $_GET['view']; + } elseif (! isset($_SESSION['mode_thumbview']) ) { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } } /** @@ -158,82 +173,54 @@ */ function buildImgView() { - $this->filterPhotosNotPermitted(); + $this->filterPhotosNotPermitted(); - /** - * set mode specific things - */ - switch($this->mode) - { - case 'home': - $this->viewHome(); - break; - case 'thumb': - switch($_SESSION['mode_thumbview']) - { - case 'thumb': - case 'thumbdetail': - $this->viewThumb(); - break; - case 'basket': - $this->viewBasket(); - break; - case 'albmeta': - $this->viewAlbMeta(); - break; - } - break; - case 'image': - switch($_SESSION['mode_imageview']) - { - case 'img': - $this->viewImg(); /* will exit in xml mode */ - break; - case 'meta': - $this->viewMeta(); - break; - } - 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 mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + switch($_SESSION['mode_thumbview']) + { + case 'thumb': + case 'thumbdetail': + $this->viewThumb(); // will exit() when linJSON is set + break; + case 'basket': + $this->viewBasket(); + break; + case 'albmeta': + $this->viewAlbMeta(); + break; + } + 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 - * - this should be done after adminCommands, because of - * "nr images in basket" is changed in adminCommands() - * - * - this should be done after viewImg(), because of $org_width and $org_height in "View at" - */ - $this->setMenu(); + /** + * set admin menu and more menu + * - this should be done after adminCommands, because of + * "nr images in basket" is changed in adminCommands() + * + * - this should be done after viewImg(), because of $org_width and $org_height in "View at" + */ + $this->setMenu(); - /** - * at this point, there should be absolute no output - */ - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); + /** + * at this point, there should be absolute no output + */ + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); } /** @@ -243,30 +230,27 @@ */ function filterPhotosNotPermitted() { - $this->photos_filtered = Array(); + $this->photos_filtered = Array(); - if(isset($this->photos)) - { - foreach($this->photos AS $key=>$value) - { - if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view - { - if( LinSql::photoIsAllowed( $value['id'] ) ) - { - /** - * escape name here - * -> we do not have to do it in the templates - */ - $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); - $this->photos_filtered[] = $value; - - //print_r($value); - } - } - } - } - - unset($this->photos); + if(isset($this->photos)) + { + foreach($this->photos AS $key=>$data) + { + if( LinSql::photoIsAllowed( $data['id'] ) ) + { + /** + * escape name here + * -> we do not have to do it in the templates + */ + $data['name'] = htmlentities($data['name'],ENT_QUOTES); + $this->photos_filtered[] = $data; + + //print_r($value); + } + } + } + + unset($this->photos); } /** @@ -274,318 +258,173 @@ */ function setMenu() { + /** + * Menu Admin + */ + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->menu['admin']['import'] = + array( + 'name' => i18n("Import"), + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => 'javascript:location.href="'.LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]="+linIdCurrent'), + array('name' => i18n("Detect File Changes"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=force_import&linId="+linIdCurrent') + ) + ); - - /** - * Menu Admin - */ - if($GLOBALS['linpha']->sql->isAdmin()) - { - $GLOBALS['linpha']->template->menu['admin']['import'] = - array( - 'name' => i18n("Import"), - 'link' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') - ) - ); + $GLOBALS['linpha']->template->menu['admin']['permissions'] = + array( + 'name' => i18n("Permissions"), + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => 'javascript:location.href="'.LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId="+linIdCurrent') + ) + ); - $GLOBALS['linpha']->template->menu['admin']['permissions'] = - array( - 'name' => i18n("Permissions"), - 'link' => array( - array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) - ) - ); - - - if($this->mode == 'thumb' || $this->mode == 'image') - { - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( - 'name' => i18n("Recreate This Thumbnail"), - 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); - } - } - - /** - * Menu More - */ - if($this->mode != 'home') - { - /** - * more than one time used stuff - */ - $array = linGetSortOrders(); - foreach($array as $value) // i18n() already called - { - $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); - } - - $open_basket_link = LINPHA_LINK.'&linCat=basket'; - - switch($this->mode) - { - case 'thumb': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - - if( linUseAjax() ) - { - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array as $value) - { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); - } - - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array as $value) - { - $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); - } - - $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View"), 'link' => $array_views_links), - array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) - ) - ); - } - else - { - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - ) - ); - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), - ) - ); - } - break; - case 'image': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View at"), 'link' => - array( - array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), - ) - ) - ) - ); - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ); - } - - break; - } - } - - /** - * Icons - */ - if($this->mode == 'thumb') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + + if($this->mode != 'home') { - $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + /** + * append to "admin - import" entry + */ + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( + 'name' => i18n("Recreate This Thumbnail"), + 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=recreate&linId="+linIdCurrent' + ); } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + } + + /** + * Menu More + */ + if($this->mode != 'home') + { + $array_sort_orders_links[] = array('name' => i18n("Ascending"), 'link' => "javascript:myLinAlbum.changeSortOrder('ASC')"); + $array_sort_orders_links[] = array('name' => i18n("Descending"), 'link' => "javascript:myLinAlbum.changeSortOrder('DESC')"); + $array_sort_orders_links[] = array('name' => 'split', 'link' => ""); + + $array = $this->getSortOrders(); + foreach($array as $key=>$value) // i18n() already called { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + $array_sort_orders_links[] = array('name' => $value, 'link' => "javascript:myLinAlbum.changeSortOrder('".$key."')"); // $GLOBALS['linpha']->template->URL_full.'&order_by=' } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_all&linId="+linIdCurrent'), + array('name' => i18n("Add To Basket"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&admin_cmd=basket_add_this&linId="+linIdCurrent'), + array('name' => i18n("Switch To Basket View"), 'link' => 'javascript:location.href="'.$GLOBALS['linpha']->template->URL_base.'&view=basket&linId="+linIdCurrent'), + array('name' => i18n("Open Basket"), 'link' => LINPHA_LINK.'&linCat=baske... [truncated message content] |
From: <fan...@us...> - 2008-04-01 20:40:16
|
Revision: 4914 http://linpha.svn.sourceforge.net/linpha/?rev=4914&view=rev Author: fangehrn Date: 2008-04-01 13:40:02 -0700 (Tue, 01 Apr 2008) Log Message: ----------- 2008-04-01 flo * improved menu handling (enable/disable items) * implemented "view at" function Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/templates/default/global.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css trunk/linpha2/templates/default/viewer.head.php trunk/linpha2/templates/default/viewer.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/ChangeLog 2008-04-01 20:40:02 UTC (rev 4914) @@ -1,4 +1,8 @@ +2008-04-01 flo + * improved menu handling (enable/disable items) + * implemented "view at" function + 2008-03-30 flo * JSCookMenu fixed bug in cmEnableItem() reported here: http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279 Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -156,6 +156,8 @@ } else { $this->orderby = $this->getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder'], $str_asc); } + + $GLOBALS['linpha']->template->output['sort_order_asc'] = $str_asc; } if ($this->mode == 'thumb') Modified: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-01 20:40:02 UTC (rev 4914) @@ -19,6 +19,8 @@ this.TabView = null; this.Tabs = new Array(); //this.activeTabLabel = null; + + this.panelViewAt = null; }; // initHistoryManager() @@ -107,24 +109,26 @@ } if (!this.initialized) { + this.updateSortMenu(linSortOrder); this.initHistoryManager(); // this will call showAlbum() or showImage() this.initialized = true; - } - - if (this.mode == 'thumb') { + } else if (this.mode == 'thumb') { this.showAlbum(); } else if (this.mode == 'image') { this.showAlbum(); this.changeImage(linIdCurrent); - } - + } } // openAlbum() YAHOO.linpha.Album.prototype.openAlbum = function() { + + YAHOO.log("openAlbum()"); + try { YAHOO.util.History.navigate("linphaViewer", "album"); } catch (e) { + YAHOO.log("openAlbum(): opera fallback"); this.showAlbum(); // opera fallback } }; @@ -136,7 +140,7 @@ YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); myLinPage.setTitle(this.album.TitleUrl); - cmDisableItem(myMenu[6][8], "ThemePanel") // disable menu entry "Image" + cmDisableItem(myMenu[6][8], "ThemePanel") // disable menu entry "Image" (i don't know how to get the image menu entry dynamically) htmlstr = []; @@ -161,6 +165,14 @@ YAHOO.util.Dom.setStyle('linDivTabs', "display", "none"); YAHOO.util.Dom.setStyle('linDivImage', "display", "none"); //YAHOO.util.Dom.setStyle('linDivNav', "display", "block"); + + if (linStartupId != 0) + { + this.mode = 'thumb'; // important to prevent endless loop + this.openImage(linStartupId); // no changeImage() !! history manager has to be updated, otherwise future calls to openAlbum() would not work + linStartupId = 0; + return; + } myLinPage.setResizeMode('thumb'); @@ -170,11 +182,6 @@ } this.mode = 'thumb'; - if (linStartupId != 0) { - this.changeImage(linStartupId); - } - - YAHOO.util.Dom.setStyle('linDivThumbs', "display", "block"); }; @@ -216,7 +223,7 @@ myLinPage.setTitle(this.album.TitleUrl + ' > <a href="javascript:myLinAlbum.openImage('+imgId+')">' + this.album.Thumbs[this.currentIndex].title + '</a>' ); - cmEnableItem(myMenu[6][8], "ThemePanel") // enable menu entry "Image" + cmEnableItem(myMenu[6][8], "ThemePanel") // enable menu entry "Image" (i don't know how to get the image menu entry dynamically) /** * hide elements @@ -227,12 +234,12 @@ YAHOO.util.Dom.setStyle('linDivOtherInfo', "display", "none"); // handle coming from thumb (or init) - if (this.mode != 'image') { - + if (this.mode != 'image') + { + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); YAHOO.util.Dom.setStyle('linDivDescription', "display", "none"); YAHOO.util.Dom.setStyle('linImgMainImage', "display", "none"); - YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); this.mode = 'image'; //YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); @@ -602,10 +609,77 @@ YAHOO.linpha.Album.prototype.changeSortOrder = function(order) { this.loadAlbum( '&linOrderBy='+order ); - //cmDisableItem(myMenu[11], 'linMenu') - //cmGetMenuItem(myMenu[11]) + // setTimeout is required because the menu is at the moment still open and will change his css classes when it closes + if (order=="ASC") { + setTimeout("myLinAlbum.updateSortMenu(\"ASC\");", 1000); + } else if(order=="DESC") { + setTimeout("myLinAlbum.updateSortMenu(\"DESC\");", 1000); + } }; +// updateSortMenu() +YAHOO.linpha.Album.prototype.updateSortMenu = function(order) { + + // enable/disable menu entry "Sort - ASC/DESC" (i don't know how to get the image menu entry dynamically) + + YAHOO.log(order); + if (order=="ASC") + { + cmDisableItem(myMenu[6][6][5], "ThemePanel"); + cmEnableItem(myMenu[6][6][6], "ThemePanel"); + } + else if(order=="DESC") + { + cmEnableItem(myMenu[6][6][5], "ThemePanel"); + cmDisableItem(myMenu[6][6][6], "ThemePanel"); + } +} + +// viewImageAt() +YAHOO.linpha.Album.prototype.viewImageAt = function(width, height) { + //alert( width + ' ' + height ); + + /*linYUILoader.onSuccess = function(width, height) { + var panel = new YAHOO.widget.Panel("panelViewAt", { width: "320px" } ); + panel.setHeader("Panel #2 from Script"); + panel.setBody("This is a dynamically generated Panel. " + width + ' ' + height + ' ' + linIdCurrent); + panel.setFooter("End of Panel #2"); + panel.render( "linPanelContainer" ); + };*/ + /*"this.viewImageAtShow("+width+", "+height+")";*/ + + this.viewAtWidth = width; + this.viewAtHeight = height; + linYUILoader.onSuccess = this.viewImageAtShow; + + linYUILoader.require(["dragdrop", "container"]); + linYUILoader.insert(); +}; +// viewImageAtShow() +YAHOO.linpha.Album.prototype.viewImageAtShow = function() { + linYUILoader.onSuccess = null; + //alert( myLinAlbum.viewAtWidth + ' ' + myLinAlbum.viewAtHeight + ' ' + linIdCurrent ); + + if (myLinAlbum.panelViewAt != null) { + document.getElementById("linPanelContainer").innerHTML = ""; + } + + myLinAlbum.panelViewAt = new YAHOO.widget.Panel("linPanelViewAt", { close: true, visible: true, + x: YAHOO.util.Dom.getDocumentScrollLeft()+80, y: YAHOO.util.Dom.getDocumentScrollTop()+130, monitorresize: false /*zindex: 200*/ } ); + myLinAlbum.panelViewAt.setHeader(myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].title); + myLinAlbum.panelViewAt.setBody("<img src=\""+linImageSrc+linIdCurrent+"&width="+myLinAlbum.viewAtWidth+"&height="+myLinAlbum.viewAtHeight+"\" />" ); + + if (myLinAlbum.viewAtWidth == 0) { + myLinAlbum.panelViewAt.setFooter(myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].w + +"x"+myLinAlbum.album.Thumbs[myLinAlbum.ThumbIds[linIdCurrent]].h); + } else { + myLinAlbum.panelViewAt.setFooter(myLinAlbum.viewAtWidth+"x"+myLinAlbum.viewAtHeight); + } + myLinAlbum.panelViewAt.render( /*document.body*/ "linPanelContainer" ); +}; + + + myLinPage.enableOnResize('thumb'); var myLinAlbum = new YAHOO.linpha.Album(); Modified: trunk/linpha2/templates/default/global.head.php =================================================================== --- trunk/linpha2/templates/default/global.head.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/global.head.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -72,7 +72,8 @@ <?php if (linUseAjax()) { ?> <!-- Load the YUI Loader script: --> -<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> +<!--<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-min.js"></script> --> +<script src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta.js"></script> <script type="text/javascript" language="Javascript"> var linYUILoader = new YAHOO.util.YUILoader({ require: ["logger"/*, "menu"*/], Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/menu.html.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -8,7 +8,7 @@ <!-- var myMenu = <?php linSetMenuJS(); ?>; linReplaceJSCookObjects(myMenu); -cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); +cmDraw('linDivMenu', myMenu, 'hbr', cmThemePanel); function linReloadMenu(formElem) { @@ -19,10 +19,10 @@ function linRedrawMenu(t) { try { - //myMenuReload = eval('(' + t.responseText + ')'); - myMenuReload = YAHOO.lang.JSON.parse(t.responseText); - linReplaceJSCookObjects(myMenuReload); - cmDraw ('linDivMenu', myMenuReload, 'hbr', cmThemePanel); + //myMenu = eval('(' + t.responseText + ')'); + myMenu = YAHOO.lang.JSON.parse(t.responseText); + linReplaceJSCookObjects(myMenu); + cmDraw('linDivMenu', myMenu, 'hbr', cmThemePanel); } catch (e) { alert("Error reloading menu (" + e + ")"); Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-01 20:40:02 UTC (rev 4914) @@ -121,6 +121,26 @@ /*height: 200px; min height set in DefsThumbView.js */ overflow: auto; } + +/** + * view at panel + */ +#linPanelContainer { + width: 660px; /* required */ + font-size: 0; /* for IE */ +} +#linPanelViewAt .hd { + font-size: medium; +} +#linPanelViewAt .bd { + width: 668px; + height: 495px; + overflow: auto; + font-size: medium; +} +#linPanelViewAt .ft { + font-size: medium; +} /** * slideshow Modified: trunk/linpha2/templates/default/viewer.head.php =================================================================== --- trunk/linpha2/templates/default/viewer.head.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/viewer.head.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -18,6 +18,7 @@ var linTnSizeOther = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; var linPreloadImages = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_nrPreloadImages']; ?>; var linStartupId = <?php echo (isset($linTpl->output['startup_id']) ? $linTpl->output['startup_id'] : 0); ?>; +var linSortOrder = '<?php echo $linTpl->output['sort_order_asc']; ?>'; var linAlbum = <?php echo $linTpl->output['thumb_list']."\n"; ?>; if (linUseEffects) { Modified: trunk/linpha2/templates/default/viewer.html.php =================================================================== --- trunk/linpha2/templates/default/viewer.html.php 2008-03-30 22:08:03 UTC (rev 4913) +++ trunk/linpha2/templates/default/viewer.html.php 2008-04-01 20:40:02 UTC (rev 4914) @@ -1,3 +1,5 @@ +<div id="linPanelContainer" class="yui-skin-sam"></div> + <!-- navigation --> <?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> <?php echo $linTpl->divRoundCorners('top','main'); ?> @@ -50,7 +52,7 @@ <ul id="linUlTabNav" class="yui-nav"></ul> <div id="linDivTabContent" class="yui-content"></div> </div> - + </div> <?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-04-02 20:55:33
|
Revision: 4915 http://linpha.svn.sourceforge.net/linpha/?rev=4915&view=rev Author: fangehrn Date: 2008-04-02 13:54:22 -0700 (Wed, 02 Apr 2008) Log Message: ----------- 2008-04-02 flo * adapted static album/image view to fit new layout Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/static.view_img.html.php trunk/linpha2/templates/default/static.view_thumb.html.php trunk/linpha2/templates/default/themes/default/css/filemanager.css Added Paths: ----------- trunk/linpha2/lib/classes/linpha.static.view.album.class.php trunk/linpha2/templates/default/themes/default/css/static.view_img.css trunk/linpha2/templates/default/themes/default/css/static.view_thumb.css Removed Paths: ------------- trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/templates/default/themes/default/css/view_img.css trunk/linpha2/templates/default/themes/default/css/view_thumb.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/ChangeLog 2008-04-02 20:54:22 UTC (rev 4915) @@ -1,4 +1,7 @@ +2008-04-02 flo + * adapted static album/image view to fit new layout + 2008-04-01 flo * improved menu handling (enable/disable items) * implemented "view at" function Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -103,9 +103,22 @@ } } +function createAlbumViewObj() +{ + if (linUseAjax()) + { + require_once(LINPHA_DIR . '/lib/classes/linpha.view.album.class.php'); + return new LinViewAlbum(); + } + else + { + require_once(LINPHA_DIR . '/lib/classes/linpha.static.view.album.class.php'); + return new LinViewAlbumStatic(); + } +} + } // end class Linpha - /** * handle common language strings * prefer Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -247,7 +247,7 @@ $str = '<a href="'.$link.'0">></a> '; $array_files = $GLOBALS['linpha']->sql->getFullFilenameFromId( $id ); - foreach($array_files AS $key=>$value) + foreach($array_files as $key=>$value) { if($value != "") { Deleted: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -1,1418 +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 class takes care of all different views (thumb view, menus...) - * @package Image - */ - -if(!defined('LINPHA_DIR')) { exit(1); } - -define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS id2, " . - "".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" -); - -class LinImgview { - -public $mode; // 'home', 'thumb', 'image' -public $modulename; // 'albums', 'browse', ... -public $tot_photos; -public $photos; -public $photos_filtered; -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 - -/** - * constructor - */ -function __construct() -{ - -} - -/** - * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) - * @param string $modulname (album, browse, search, ...) - */ -function setCurrentView($modulename) -{ - $this->modulename = $modulename; - - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - - if( $GLOBALS['linpha']->template->idCurrent == 0 ) - { - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); - } - else // $this->modulename=='browse' | 'search' , others will come.. - { - $this->mode = 'thumb'; - - if( ! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - } - else - { - /** - * 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)."'"); - /** - * check for valid id - */ - - if( isset($current_data['id']) ) - { - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; - $this->org_width = $current_data['width']; - $this->org_height = $current_data['height']; - - /** - * switch between thumb_view and img_view - */ - if( $this->img_type == 0) - { - $this->mode = 'thumb'; - $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - - if(! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - else - { - $this->mode = 'image'; - $this->id_parent = $current_data['parent_id']; // use parent_id on image view - - if( ! isset($_SESSION['mode_imageview']) ) - { - $_SESSION['mode_imageview'] = 'img'; - } - } - } - else // no valid id supplied - { - $this->mode = 'home'; - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - if($this->mode == 'thumb' && isset($_GET['view'])) - { - $_SESSION['mode_thumbview'] = $_GET['view']; - } - if($this->mode == 'image' && isset($_GET['view'])) - { - $_SESSION['mode_imageview'] = $_GET['view']; - } - - /** - * set id_parent to a default value - */ - if( ! isset( $this->id_parent) ) - { - $this->id_parent = $GLOBALS['linpha']->template->idCurrent; - } -} - -/** - * main function to prepare desired layout view - */ -function buildImgView() -{ - $this->filterPhotosNotPermitted(); - - /** - * set mode specific things - */ - switch($this->mode) - { - case 'home': - $this->viewHome(); - break; - case 'thumb': - switch($_SESSION['mode_thumbview']) - { - case 'thumb': - case 'thumbdetail': - $this->viewThumb(); - break; - case 'basket': - $this->viewBasket(); - break; - case 'albmeta': - $this->viewAlbMeta(); - break; - } - break; - case 'image': - switch($_SESSION['mode_imageview']) - { - case 'img': - $this->viewImg(); /* will exit in xml mode */ - break; - case 'meta': - $this->viewMeta(); - break; - } - 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 - * - this should be done after adminCommands, because of - * "nr images in basket" is changed in adminCommands() - * - * - this should be done after viewImg(), because of $org_width and $org_height in "View at" - */ - $this->setMenu(); - - /** - * at this point, there should be absolute no output - */ - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); -} - -/** - * 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() -{ - $this->photos_filtered = Array(); - - if(isset($this->photos)) - { - foreach($this->photos AS $key=>$value) - { - if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view - { - if( LinSql::photoIsAllowed( $value['id'] ) ) - { - /** - * escape name here - * -> we do not have to do it in the templates - */ - $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); - $this->photos_filtered[] = $value; - - //print_r($value); - } - } - } - } - - unset($this->photos); -} - -/** - * create optional top menu - */ -function setMenu() -{ - - - /** - * Menu Admin - */ - if($GLOBALS['linpha']->sql->isAdmin()) - { - $GLOBALS['linpha']->template->menu['admin']['import'] = - array( - 'name' => i18n("Import"), - 'link' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') - ) - ); - - $GLOBALS['linpha']->template->menu['admin']['permissions'] = - array( - 'name' => i18n("Permissions"), - 'link' => array( - array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) - ) - ); - - - if($this->mode == 'thumb' || $this->mode == 'image') - { - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( - 'name' => i18n("Recreate This Thumbnail"), - 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); - } - } - - /** - * Menu More - */ - if($this->mode != 'home') - { - /** - * more than one time used stuff - */ - $array = linGetSortOrders(); - foreach($array as $value) // i18n() already called - { - $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); - } - - $open_basket_link = LINPHA_LINK.'&linCat=basket'; - - switch($this->mode) - { - case 'thumb': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - - if( linUseAjax() ) - { - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array as $value) - { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); - } - - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array as $value) - { - $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); - } - - $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View"), 'link' => $array_views_links), - array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) - ) - ); - } - else - { - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - ) - ); - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), - ) - ); - } - break; - case 'image': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View at"), 'link' => - array( - array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), - ) - ) - ) - ); - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ); - } - - break; - } - } - - /** - * Icons - */ - if($this->mode == 'thumb') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; - } - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; - } - } - elseif($this->mode == 'image') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; - } - - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; - } - } -} - -/** - * method for special admin commands, like rotating images, import stuff etc. - * @uses LinImgview::buildImgView() - */ -function adminCommands() -{ - switch($_GET['admin_cmd']) - { - case 'recreate': - if($GLOBALS['linpha']->sql->isAdmin()) - { - $thumbnail = new LinImage(); - $_GET['force'] = true; - $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); - } - break; - case 'force_import': // called in viewImg - LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); - 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': - case 'basket_add_all_with_checkout': - /** - * coming from imgview, mode=viewThumb - * the permission check with photoIsAllowed() is done while checking out - */ - foreach($this->photos_filtered AS $value) - { - if($value['img_type']!=0) - { - $_SESSION['basket_ids'][] = $value['id']; - } - } - - if($_GET['admin_cmd'] == 'basket_add_all_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; - case 'basket_add_this': - case 'basket_add_this_with_checkout': - /** - * coming from imgview, mode=viewImg - */ - $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; - - if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') - { - header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); - exit(); - } - break; - } -} - -/** - * define thumbnail view - */ -function viewThumb() -{ - $this->viewThumbSetSubFolders(); - - /** - * create thumbnail info text (filename, description, etc.) - */ - $i=0; - - foreach($this->photos_filtered AS $key=>$photo_value) - { - if($_SESSION['mode_thumbview'] == 'thumbdetail') { - $flag_nr = 14; // flag nr of thumbdetail - } else { - $flag_nr = 13; // flag nr of thumb - } - - $array_image_infos = LinMetaData::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'] = ''; - $index = 'before'; - $i=0; - foreach($array_image_infos AS $value) - { - /** - * got thumbnail, switch to index after - */ - if($value['value']=='thumbnail') - { - $index = 'after'; - } - else - { - $i++; - if($index == 'before') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - elseif($index == 'after') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - } - } - - $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 - - /** - * switch between javascript - */ - if( linUseAjax() ) - { - /** - * create javascript object containing all thumb informations - */ - - $GLOBALS['linpha']->template->setModuleName('view_thumb'); - - $GLOBALS['linpha']->template->output['page_nr_left'] = ''; - $GLOBALS['linpha']->template->output['page_nr_right'] = ''; - $GLOBALS['linpha']->template->output['page_nr'] = ''; - - - /** - * create files db - * this is a normal javascript array - * just another kind of definition... - */ - $GLOBALS['linpha']->template->output['files_db'] = 'var linImgIds = ['."\n"; - if($this->tot_photos > 0) // check if not all entries were folders - { - foreach($this->photos_filtered AS $key=>$value) - { - if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) - { - $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; - $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; - $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; - - $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.str_replace('"','\"',$before).'", after: "'.str_replace('"','\"',$after).'", title: "'.str_replace('"','\"',$title).'" }'; - } - } - - $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); - - } - $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); - - $this->viewThumbNojs(); - } -} - -/** - * thumbnail view with javascript disabled (static) - * @uses LinImgView::viewThumb() - */ -function viewThumbNojs() -{ - /** - * prepare variables - */ - $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; - $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); - if(isset($_GET['pn']) && $_GET['pn'] > 1) - { - $this->current_page = $_GET['pn']; - } - else - { - $_GET['pn'] = 1; - $this->current_page = 1; - } - - - $this->viewThumbNojsWritePageNumbers(); - - /** - * create array $this->photos_show which contains only the photos of the current page - */ - if($this->tot_photos > 0) // only if not all entries were folders - { - $img_nr = 1; - $i = 0; - $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; - - foreach($this->photos_filtered AS $value) - { - if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page - && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate - { - $this->photos_show[] = $value; - $img_nr++; - } - $i++; - } - } -} - -/** - * setup page numbers (only used if static) - */ -function viewThumbNojsWritePageNumbers() -{ - /** - * writing page numbers - */ - $start_nr = 1; - - /** - * write left and right '...' if more than 10 pages - */ - $left_dots = ""; - $right_dots = ""; - if($this->nr_pages > 10) - { - $start_nr = $_GET['pn']; - - if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album - { - $start_nr = $this->nr_pages-10; - $left_dots = "... "; - } - elseif($start_nr <=5 ) // we are at the beginning - { - $this->nr_pages = 10; - $start_nr = 1; - $right_dots = " ..."; - } - else - { - $this->nr_pages = $start_nr+5; - $start_nr -= 5; - if($_GET['pn']!="6") : $left_dots="... "; endif; - $right_dots=" ..."; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; - - for($i=$start_nr; $i <= $this->nr_pages; $i++) - { - if($i == $this->current_page) - { - $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; - - /** - * write starting ' << ' and ' < ' - */ - if($this->current_page != 1) - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; - } - - /** - * write ending '>' and '>>' - */ - if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; - } -} - -/** - * print sub folders AND calculate tot_photos - * @todo should we show subfolders separate..? - * i think this is useless if we can set automatically view = thumbdetail - */ -function viewThumbSetSubFolders() -{ - $output_folders = ''; - $nr_folders = 0; - - if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) - { - $GLOBALS['linpha']->template->output['navigation'] = ''; - } - - if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) - { - foreach($this->photos_filtered AS $key=>$value) - { - if($value['img_type'] == 0) - { - $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a><br />'; - $nr_folders++; - } - } - } - - /** - * set tot_photos - * subtract number of folders if they are shown separate - */ - $this->tot_photos = count($this->photos_filtered) - $nr_folders; -} - -/** - * setup detailed thumbdetail view - */ -function viewThumbdetail() -{ - $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); -} - -/** - * setup main/home view layout - */ -function viewHome() -{ - $GLOBALS['linpha']->template->setModuleName('home'); - - /** - * set welcome text - */ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) - { - $GLOBALS['linpha']->template->output['welcome'] = '<h1 class="linStyle">'.i18n("Welcome").'</h1>'. - i18n("Hi, this is the home of \"The PHP Photo Archive\" <a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; - } - else - { - $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']; - } - else - { - $GLOBALS['linpha']->template->output['welcome'] = ''; - } - } - - /** - * 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',''); - - /** - * browse by date - */ - $this->viewHomeSetBrowseByDate(); - - /** - * album informations - */ - foreach($this->photos_filtered AS $photo_key=>$photo_value) - { - $array_image_infos = LinMetaData::readInformations($photo_value,$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 />'; - } - elseif($key == 'builtin_first_comment') - { - $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 - { - $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; - } - } - } -} - -/** - * setup browse by date feature - */ -function viewHomeSetBrowseByDate() -{ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) - { - $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . - "FROM ".LIN_PREFIX."meta_exif"); - if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) - { - /** - * get min and max year - */ - $min_year = substr($data['min'],0,4); - $max_year = substr($data['max'],0,4); - /** - * get years between - */ - for($i = $min_year; $i <= $max_year; $i++) - { - /** - * exclude all wrong/empty/... dates - */ - if($i > 1900) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data['datetime']>0) - { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; - } - } - } - } - } -} - -/** - * setup random and new imgages view - */ -function viewHomeSetImages($key,$optionname,$sql) -{ - $GLOBALS['linpha']->template->output[$key] = array(); - - if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) - { - switch(LIN_DB_TYPE) - { - case 'mysql': - $str_random = 'rand()'; - break; - case 'postgres': - $str_random = 'random()'; - break; - case 'sqlite': - $str_random = 'random()'; - break; - case 'oci8po': - $str_random = $GLOBALS['linpha']->db->random; - break; - } - - $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; - $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 ; ) - { - $data = $query->FetchRow(); - if(isset($data['id'])) - { - $path = LinSql::getFullImagePath( $data['id'] ); - - if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) - { - $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); - $i++; - } - } - else - { - break; - } - } - } -} - -/** - * setup basket view - */ -function viewBasket() -{ - $GLOBALS['linpha']->template->setModuleName('view_basket'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb - - $this->viewThumbSetSubFolders(); - $this->viewThumbNojs(); -} - -/** - * setup comment view - */ -function viewAlbMeta() -{ - $GLOBALS['linpha']->template->setModuleName('view_albmeta'); - - /** - * save data - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") - { - /** - * check if comment exists - * - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id " . - "FROM ".LIN_PREFIX."meta_comments " . - "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()."', '".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 = '".LinSql::linAddslashes($this->md5sum)."'"); - } - } - - /** - * get data - */ - $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']; - } - else - { - $GLOBALS['linpha']->template->output['comment_author'] = $_SESSION['user_name']; - } - - if(isset($data['meta_comment'])) - { - $GLOBALS['linpha']->template->output['comment_text'] = $data['meta_comment']; - } - else - { - $GLOBALS['linpha']->template->output['comment_text'] = ''; - } - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); -} - -/** - * setup image view - */ -function viewImg() -{ - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image - { - $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - } - else - { - $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; - $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; - $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); - - $this->img_width = $array['w']; - $this->img_height = $array['h']; - } - - $this->viewImgCommon(); - $this->viewImgComments(); - - if( linUseAjax() ) - { - $GLOBALS['linpha']->template->setModuleName('view_img'); - - if(isset($_GET['xml'])) - { - $this->viewImgXml(); - exit(); - } - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - } -} - -/** - * generate xml data for ajax image view - */ -function viewImgXml() -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - ?> -<root> -<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> -<filetype><?php echo LinIdentify::getShortFileType( $this->img_type ); ?></filetype> -<imgwidth><?php echo $this->org_width; ?></imgwidth> -<imgheight><?php echo $this->org_height; ?></imgheight> -<imgnr><?php printf(i18n("Image %s of %s"),$this->current_key+1,count($this->photos_filtered)); ?></imgnr> -<title><?php /* oh, what an evil hack */ echo str_replace('<','<',$GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']); ?></title> -<?php - if(isset($this->xmldata['prev_thumb'])) { - foreach($this->xmldata['prev_thumb'] AS $value) - { - echo '<prevthumb>'.$value.'</prevthumb>'."\n"; - } - } - if(isset($this->xmldata['next_thumb'])) { - foreach($this->xmldata['next_thumb'] AS $value) - { - echo '<nextthumb>'.$value.'</nextthumb>'."\n"; - } - } - - foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) - { ?> -<meta> - <name><?php echo $value['name']; ?></name><value><?php echo htmlspecialchars($value['value']); ?></value> -</meta> -<?php - } - - if($this->newCommentAdded) - { - echo '<commentadded>'.i18n("Comment successfully added.").'</commentadded>'."\n"; - } - - while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) - { ?> -<comment> - <time><?php echo htmlspecialchars(linStrftime($data['meta_time'])); ?></time> - <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> - <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> -</comment> -<?php } ?> -</root> - -<?php - -} // end viewImgAjax() - -/** - * stuff used in viewImg() and viewMeta() - */ -function viewImgCommon() -{ - $this->viewImgSetPrevNextThumb(); - - $this->viewImgStoreImageInformation(); - - $GLOBALS['linpha']->template->output['image_infos'] = - LinMetaData::readInformations($this->photos_filtered[$this->current_key], - $flag_nr=10); - -} - -/** - * get/save image comments - */ -function viewImgComments() -{ - /** - * image comments - */ - if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) - { - /** - * save comment - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment' - && isset($_POST['inputAddCommentAuthor']) - && !empty($_POST['inputAddCommentAuthor']) - && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) - || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) - { - if( !empty($_POST['inputAddCommentTextarea'])) { - $comment = $_POST['inputAddCommentTextarea']; - } else { - $comment = $_POST['inputAddCommentText']; - } - - $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)."')"); - $this->newCommentAdded = true; // used for ajax - } - - /** - * get comments - */ - $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - } -} - -/** - * store image informations in database if s - */ -function viewImgStoreImageInformation() -{ - $array_meta = array('exif','iptc','xmp'); - foreach($array_meta AS $value) - { - if(!isset($MetaData)) - { - $MetaData = new LinMetaData(); - } - - /** - * read exif/iptc/xmp from file if no entry - */ - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) - { - $MetaData->saveData($value, $this->src_file, $this->md5sum ); - } - - /** - * Read image geodata. This depends on the maps plugin. So we only - * run this additionally import if maps plugin is enabled and admin - * selected "autoimport". - * This should prevent all others from suffering performance issues - * during import - */ - if(isset($GLOBALS['linpha']->sql->config->value['plugins_maps_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] - && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']) - { - $MetaData->singleImportGeoData($this->md5sum, $this->src_file); - error_log("DOING GEODATA AUTOIMPORT",'',0); - } - } -} - -/** - * generate html code for the prev/next thumbnail - */ -function viewImgThumbHtml($key,$class) -{ - $id = $this->photos_filtered[$key]['id']; - $name = $this->photos_filtered[$key]['name']; - - $str = '<div class="linDivThumbnavi_'.$class.'">' - . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' - . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' - . '<br />'.$name.'</div>'."\n"; - - return $str; -} - -/** - * set prev/next thumb for img_view and meta_view - */ -function viewImgSetPrevNextThumb() -{ - $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; - - /** - * search current key in array - */ - foreach($this->photos_filtered AS $key=>$value) - { - if($value['id'] == $GLOBALS['linpha']->template->idCurrent) - { - $this->current_key = $key; - break; - } - } - - /** - * ooh, something went wrong - */ - if(!isset($this->current_key)) - { - $this->current_key = 0; - } - - /** - * set prev thumbs - */ - $GLOBALS['linpha']->template->output['prev_thumb'] = ''; - for($i=$nr_prev_next_thumbs; $i > 0; $i--) - { - if($this->current_key >= $i) - { - if(isset($_GET['xml'])) - { - $this->xmldata['prev_thumb'][] = $this->photos_filtered[$this->current_key - $i]['id']; - } - else - { - $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); - } - } - } - - /** - * set next thumbs - */ - $GLOBALS['linpha']->template->output['next_thumb'] = ''; - for($i=0; $i < $nr_prev_next_thumbs; $i++) - { - if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) - { - if(isset($_GET['xml'])) - { - $this->xmldata['next_thumb'][] = $this->photos_filtered[$this->current_key + ($i+1)]['id']; - } - else - { - $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); - } - } - } - - - /** - * set current image and thumb - */ - if(isset($_GET['xml'])) - { - } - else - { - $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); - } -} - -/** - * setup MetaData view - */ -function viewMeta() -{ - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); - - $this->viewImgCommon(); -} - -} // end class linImgview -?> Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-01 20:40:02 UTC (rev 4914) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -79,7 +79,7 @@ } } - foreach ($this->cachedSelectedFieldNames AS $field_name) + foreach ($this->cachedSelectedFieldNames as $field_name) { $name = LinMetaData::getNameOfField($field_name, false); $value = ''; @@ -107,9 +107,9 @@ case 'dimension' : $value = $array_src_infos['width'] . 'x' . $array_src_infos['height']; break; - case 'thumbnail' : + /*case 'thumbnail' : $value = 'thumbnail'; - break; + break;*/ case 'time_add' : $name = i18n("Date Added"); $value = linStrftime($array_src_infos['time_add']); Copied: trunk/linpha2/lib/classes/linpha.static.view.album.class.php (from rev 4909, trunk/linpha2/lib/classes/linpha.imgview.class.php) =================================================================== --- trunk/linpha2/lib/classes/linpha.static.view.album.class.php (rev 0) +++ trunk/linpha2/lib/classes/linpha.static.view.album.class.php 2008-04-02 20:54:22 UTC (rev 4915) @@ -0,0 +1,494 @@ +<?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 class takes care of all different views (thumb view, menus...) + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +require_once(LINPHA_DIR . '/lib/classes/linpha.view.album.class.php'); + +class LinViewAlbumStatic extends LinViewAlbum { + +public $mode; // 'home', 'thumb', 'image' +public $modulename; // 'albums', 'browse', ... +public $tot_photos; +public $photos; +public $photos_filtered; +public $idParent, $img_type, $filename, $md5sum, $org_width, $org_height; +private $nr_pages, $current_page; // only used if javascript disabled + +/** + * constructor + */ +function __construct() +{ +} + +/** + * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) + * @param string $modulname (album, browse, search, ...) + */ +function setCurrentView($modulename) +{ + $this->modulename = $modulename; + + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; + } + } + else + { + /** + * 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)."'"); + /** + * check for valid id + */ + + if( isset($current_data['id']) ) + { + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; + $this->org_width = $current_data['width']; + $this->org_height = $current_data['height']; + + /** + * switch between thumb_view and img_view + */ + if( $this->img_type == 0) + { + $this->mode = 'thumb'; + $this->idParent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! + } + else + { + $this->mode = 'image'; + $this->idParent = $current_data['parent_id']; // use parent_id on image view + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if ($this->mode == 'thumb' && !isset($_SESSION['mode_thumbview'])) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + + $this->setSortOrder(); + + /** + * set idParent to a default value + */ + if (!isset( $this->idParent)) + { + $this->idParent = $GLOBALS['linpha']->template->idCurrent; + } +} + +/** + * main function to prepare desired layout view + */ +function buildImgView() +{ + $this->filterPhotosNotPermitted(); + + /** + * set mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + $this->viewThumb(); + break; + case 'image': + $this->viewImg(); + break; + } + + /** + * at this point, there should be absolute no output + */ + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +} + +/** + * setup main/home view layout + */ +function viewHome() +{ + parent::viewHome(); +} + + +/** + * define thumbnail view + */ +function viewThumb() +{ + $this->tot_photos = count($this->photos_filtered); + + /** + * create thumbnail info text (filename, description, etc.) + */ + $i=0; + + foreach($this->photos_filtered as $key=>$photo_value) + { + if($_SESSION['mode_thumbview'] == 'thumbdetail') { + $flag_nr = 14; // flag nr of thumbdetail + } else { + $flag_nr = 13; // flag nr of thumb + } + + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']] = ''; + $i=0; + foreach($array_image_infos as $value) + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + + $GLOBALS['linpha']->template->output['thumb_title'][$photo_value['id']] = $photo_value['name']; // $photo_value['name'] is already escaped + } + + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); + + $this->viewThumbNojs(); +} + +/** + * thumbnail view with javascript disabled (static) + * @uses LinImgView::viewThumb() + */ +function viewThumbNojs() +{ + /** + * prepare variables + */ + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; + $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); + if(isset($_GET['pn']) && $_GET['pn'] > 1) + { + $this->current_page = $_GET['pn']; + } + else + { + $_GET['pn'] = 1; + $this->current_page = 1; + } + + + $this->viewThumbNojsWritePageNumbers(); + + /** + * create array $this->photos_show which contains only the photos of the current page + */ + if ($this->tot_photos > 0) // only if not all entries were folders + { + $img_nr = 1; + $i = 0; + $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; + + foreach ($this->photos_filtered as $value) + { + if ($i >= $startup_img_nr && $img_nr <= $max_photos_per_page) // add images only while in current page + { + $this->photos_show[] = $value; + $img_nr++; + } + $i++; + } + } +} + +/** + * setup page numbers (only used if static) + */ +function viewThumbNojsWritePageNumbers() +{ + /** + * writing page numbers + */ + $start_nr = 1; + + /** + * write left and right '...' if more than 10 pages + */ + $left_dots = ""; + $right_dots = ""; + if($this->nr_pages > 10) + { + $start_nr = $_GET['pn']; + + if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album + { + $start_nr = $this->nr_pages-10; + $left_dots = "... "; + } + elseif($start_nr <=5 ) // we are at the beginning + { + $this->nr_pages = 10; + $start_nr = 1; + $right_dots = " ..."; + } + else + { + $this->nr_pages = $start_nr+5; + $start_nr -= 5; + if($_GET['pn']!="6") : $left_dots="... "; endif; + $right_dots=" ..."; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; + + for($i=$start_nr; $i <= $this->nr_pages; $i++) + { + if($i == $this->current_page) + { + $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; + + /** + * write starting ' << ' and ' < ' + */ + if($this->current_page != 1) + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; + } + + /** + * write ending '>' and '>>' + */ + if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; + } +} + + + + +/** + * setup image view + */ +function viewImg() +{ + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image + { + $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + } + else + { + $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; + $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); + + $this->img_width = $array['w']; + $this->img_height = $array['h']; + } + + $this->viewImgSetPrevNextThumb(); + $this->viewImgComments(); + + + $GLOBALS['linpha']->template->output['image_infos'] = LinMetaData::readInformations( + $this->photos_filtered[$this->current_key], $flag_nr=10); + + $GLOBALS['linpha']->template->setModuleName('static.view_img'); +} + +/** + * set prev/next thumb for img_view and meta_view + */ +function viewImgSetPrevNextThumb() +{ + $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; + + /** + * search current key in array + */ + foreach ($this->photos_filtered as $key=>$value) + { + if ($value['id'] == $GLOBALS['linpha']->template->idCurrent) + { + $this->current_key = $key; + break; + } + } + + /** + * ooh, something went wrong + */ + if (!isset($this->current_key)) + { + $this->current_key = 0; + } + + /** + * set prev thumbs + */ + $GLOBALS['linpha']->template->output['prev_thumb'] = ''; + for($i=$nr_prev_next_thumbs; $i > 0; $i--) + { + if($this->current_key >= $i) + { + $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); + } + } + + /** + * set next thumbs + */ + $GLOBALS['linpha']->template->output['next_thumb'] = ''; + for($i=0; $i < $nr_prev_next_thumbs; $i++) + { + if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) + { + $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); + } + } + + /** + * set current image and thumb + */ + $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); +} + +/** + * generate html code for the prev/next thumbnail + */ +function viewImgThumbHtml($key,$class) +{ + $id = $this->photos_filtered[$key]['id']; + $name = $this->photos_filtered[$key]['name']; + + $str = '<div class="linDivThumbnavi_'.$class.'">' + . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' + . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' + . '<br />'.$name.'</div>'."\n"; + + return $str; +} + +/** + * get/save image comments + */ +function viewImgComments() +{ + /** + * image comments + */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $... [truncated message content] |
From: <fan...@us...> - 2008-04-06 21:38:46
|
Revision: 4916 http://linpha.svn.sourceforge.net/linpha/?rev=4916&view=rev Author: fangehrn Date: 2008-04-06 14:38:41 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 2008-04-06 flo * metadata cleanups and improvements Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/classes/linpha.view.album.class.php trunk/linpha2/lib/classes/linpha.view.image.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/include/sql/sql.tables.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/ChangeLog 2008-04-06 21:38:41 UTC (rev 4916) @@ -1,4 +1,7 @@ +2008-04-06 flo + * metadata cleanups and improvements + 2008-04-02 flo * adapted static album/image view to fit new layout Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -31,13 +31,13 @@ ini_set("max_execution_time", "6000"); -$array_meta = Array('exif','iptc','xmp'); +$array_meta = array('exif','iptc','xmp'); -if( isset($_POST['cmd']) && $_POST['cmd']=='import') +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') + if (!isset($_REQUEST['album_select']) OR $_REQUEST['album_select'][0]=='all') { $all_albums = true; } @@ -50,17 +50,17 @@ /** * import */ - if($_REQUEST['index_import']=='index') + if ($_REQUEST['index_import']=='index') { echo '<h2 class="linStyle">'.i18n("Directory Import").'</h2>'; - if($all_albums) + 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) + foreach ($_REQUEST['album_select'] AS $key=>$value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo i18n("Parsing Directory:").' '.$data['name'].'<br />'; @@ -68,7 +68,7 @@ } } - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + if ( isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo $GLOBALS['linpha']->template->output['sys_log']; unset($GLOBALS['linpha']->template->output['sys_log']); @@ -86,13 +86,13 @@ * 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'])) + 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') + if ($_REQUEST['index_thumbnails']=='recreate') { $_GET['force'] = true; } @@ -100,17 +100,17 @@ /** * all albums selected */ - if($all_albums) + if ($all_albums) { /** * delete thumbnails */ - if( isset($_REQUEST['index_thumbnails_delete']) ) + 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)) + if (file_exists($thumbcachepath)) { echo i18n("Warning while deleting file/folder, check permissions!").'<br />'; } @@ -123,7 +123,7 @@ /** * set query string for create/recreate thumbnails */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { echo '<h3>'.i18n("Parsing All Directories...").'</h3><br />'; $createthumbquery = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> '0' AND img_type <> '9999999'"); @@ -146,13 +146,13 @@ /** * delete thumbnails */ - if( isset($_REQUEST['index_thumbnails_delete']) ) + if ( isset($_REQUEST['index_thumbnails_delete']) ) { echo i18n("Delete Thumbnails"); $query = $GLOBALS['linpha']->db->Execute($sql); while($data = $query->FetchRow()) { - if( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) + if ( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) { echo " ".$data['id'].","; } @@ -163,7 +163,7 @@ /** * set query string for create/recreate thumbnails */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { $createthumbquery = $GLOBALS['linpha']->db->Execute($sql); } @@ -173,16 +173,16 @@ /** * now create thumbnails, $query has been set previously */ - if($_REQUEST['index_thumbnails']!='no') + if ($_REQUEST['index_thumbnails']!='no') { echo i18n("Create Thumbnail"); while($data = $createthumbquery->FetchRow()) { - if( ! $thumbnail->createThumbnail($data['id']) ) + if ( ! $thumbnail->createThumbnail($data['id']) ) { echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; } - if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! + if ( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! { echo " ".$data['id'].","; } @@ -202,9 +202,9 @@ */ $MetaData = new LinMetaData(); - foreach($array_meta AS $meta_value) + foreach($array_meta as $meta_value) { - if( isset( $_REQUEST['index_'.$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>'; @@ -212,12 +212,12 @@ /** * get imgids to indexing, if reindex is selected: delete these entries first */ - if($all_albums) + if ($all_albums) { echo i18n("All Directories selected").'<br />'; $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -225,7 +225,7 @@ else { echo i18n("Directory selected:").' '; - foreach($_REQUEST['album_select'] AS $key=>$value) + foreach ($_REQUEST['album_select'] AS $key=>$value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'"); echo $data['name'].', '; @@ -233,7 +233,7 @@ $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()) + while ($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -244,17 +244,17 @@ /** * delete first (if selected) */ - if( isset($_REQUEST['index_'.$meta_value.'_delete']) ) + if ( isset($_REQUEST['index_'.$meta_value.'_delete']) ) { - if( $all_albums ) + if ( $all_albums ) { echo i18n("Delete all index data").'<br />'; $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value); } - elseif( isset($array_meta_ids) ) + elseif (isset($array_meta_ids)) { echo i18n("Delete index data of selected directories").'<br />'; - foreach($array_meta_ids AS $id=>$md5sum) + foreach ($array_meta_ids AS $id=>$md5sum) { $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."meta_".$meta_value." WHERE md5sum = '".$md5sum."'"); } @@ -264,31 +264,17 @@ /** * index image, parse all saved ids */ - if( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) + if ( isset($array_meta_ids) && $_REQUEST['index_'.$meta_value] == 'index' ) { echo i18n("Index Image"); - foreach($array_meta_ids AS $id=>$md5sum) + foreach ($array_meta_ids as $id=>$md5sum) { - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum ". - "FROM ".LIN_PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - - if( $query->EOF) // not a single value returned + if (LinMetaData::fileNeedsIndexing($md5sum, LIN_PREFIX."meta_".$meta_value)) { $full_filename = LinSql::getFullImagePath($id); - - switch($meta_value) - { - case 'exif': - $MetaData->saveData('exif',$full_filename,$md5sum); - break; - case 'iptc': - $MetaData->saveData('iptc',$full_filename,$md5sum); - break; - case 'xmp': - $MetaData->saveData('xmp',$full_filename,$md5sum); - break; - } + + $MetaData->saveMetaDataToDatabase($meta_value, $full_filename, $md5sum); echo " ".$id.","; flush(); @@ -333,7 +319,7 @@ <?php foreach($array_meta AS $value) { - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$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 />'; @@ -359,7 +345,7 @@ /** * import */ - if($linpha->sql->config->value['sys_import_autoimport']) + if ($linpha->sql->config->value['sys_import_autoimport']) { LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); } @@ -368,7 +354,7 @@ * flush buffer */ echo '<b>'.i18n("Following files/folders needs updating:").'</b><br />'; - if( isset($GLOBALS['linpha']->template->output['sys_log']) ) + if ( isset($GLOBALS['linpha']->template->output['sys_log']) ) { echo $GLOBALS['linpha']->template->output['sys_log']; unset($GLOBALS['linpha']->template->output['sys_log']); @@ -395,7 +381,7 @@ $thumbnail->setFileInformation(); - if( ! $thumbnail->isCached ) + if ( ! $thumbnail->isCached ) { $num++; } @@ -414,7 +400,7 @@ foreach($array_meta AS $value) { - if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) " . "AS number_idx " . Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/docs/dev/TODO.txt 2008-04-06 21:38:41 UTC (rev 4916) @@ -27,10 +27,11 @@ - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big +- re-add getId3 as fallback if exiftool is not available + (video thumbnail and video playback) + ## Big Todos -- Use Effekts is sometimes hardcoded, make use of config - setting sys_style_image_useeffects in all places where used - Installer - OSX testing @@ -58,6 +59,7 @@ Open questions ############################################################################ + - thumbnail size, set a max size (for example 150px), to be able to switch the size on fly @@ -82,6 +84,9 @@ DONE ############################################################################ +- Use Effekts is sometimes hardcoded, make use of config + setting sys_style_image_useeffects in all places where used + - Switch to strict mode - we should changed html type to strict mode: old: Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -143,11 +143,31 @@ */ public function readMetaDataFromFile($metatype, $filename) { - $meta =""; - $return=""; + $meta = ""; + $return = ""; $metaArray = array(); + + /** + * used inputs: iptc, xmp, exif, exifgps + * use the switch statement to be sure that no invalid input is used + */ + switch($metatype) + { + case 'iptc': + $metatypeInput = 'iptc'; + break; + case 'xmp': + $metatypeInput = 'xmp'; + break; + case 'exifgps': + $metatypeInput = 'gps'; + break; + default: + $metatypeInput = 'exif'; + break; + } - $parameters = "-$metatype:all " . // Get all Tag Information + $parameters = "-$metatypeInput:all " . // Get all Tag Information "-s " . // Print tag names instead of descr. "-t " . // Use tab \t as delimiter "-fast " . // Do not read to EOF @@ -167,61 +187,47 @@ * Create usable array information by cycling and splitting * all information */ - foreach($meta as $value) + foreach($meta as $row) { - $temp = explode("\t", $value); - $metaArray[trim($temp['0'])] = @trim($temp['1']); - } - - return $metaArray; - } - - /** - * Save all MetaData to database - * @param string $filename filename to parse for MetaData - * @param string $md5sum md5sum of file - * @param string $tag save EXIF, IPTC or XMP MetaData - */ - public function saveMetaData($filename, $md5sum, $tag) - { - - $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - - //echo '<pre>', print_r($dataArray), '</pre>'; - - - $str_columns = "md5sum, "; - $str_values = "'" . $md5sum . "', "; - - if(is_array($dataArray)) - { + $temp = explode("\t", $row); + + $key = trim($temp['0']); + $value = $temp['1']; + /** - * Lower array data to make it compareable to LinExifTool::$metaTags + * normalize tag names + * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - /** - * Search for valid and filled tags - */ - foreach($this->defined_fields[$tag] AS $key => $value) + switch($key) { - if(array_key_exists($key, $lowerDataArray)) - { - $str_columns .= str_replace("_", "-", $key) . ', '; - $str_values .= "'".trim($lowerDataArray[$key])."', "; - //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; - } + case "Comment": + $key = "JPEGComment"; + break; + case "ModifyDate": + $key = "DateTime"; + break; + case "CreateDate": + $key = "DateTimeDigitized"; + break; + case "ISO": + $key = "ISOSpeedRatings"; + break; + case "ExifImageWidth": + $key = "PixelXDimension"; + break; + case "ExifImageHeight": + $key = "PixelYDimension"; + break; + case "FocalLengthIn35mmFormat": + $key = "FocalLengthIn35mmFilm"; + break; } + + + $metaArray[$key] = $value; + } - /** - * Remove last two signs (the comma and the space) which we add 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_$tag " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - } + return $metaArray; } /** @@ -291,7 +297,7 @@ * @return array fileds already selected to be used (defined_fields) * and also available fields from $metaTags (available_fields) * @author bzrudi,flo - */ + public function setMetaFields($metatype) { @@ -300,7 +306,7 @@ * without the md5sum entry. * MetaColumns() returns the keys always uppercase independent * of ADODB_ASSOC_CASE setting, so strtolower() them. - */ + $array = $GLOBALS['linpha']->db->MetaColumns(LIN_PREFIX."meta_".$metatype); $this->defined_fields[$metatype] = array (); @@ -317,7 +323,7 @@ /** * Create available_fields, mostly used in admin section where one will * setup the MetaData fields to index. - */ + foreach (LinExifTool::$metaTags[$metatype] AS $key => $value) { if (!isset ($this->defined_fields[$metatype][$key])) @@ -325,7 +331,7 @@ $this->available_fields[$metatype][$key] = $value; } } - } + }*/ /** * Just get DateTimeOriginal from EXIF header @@ -359,186 +365,185 @@ * @param none * @return none * @author bzrudi - */ + public static $metaTags = array( 'xmp' => array( - //Iptc4xmpCore schema tags - 'countrycode' => 'Country Code', - 'intellectualgenre' => 'Intellectual Genre', - 'location' => 'Location', - 'scene' => 'Scene', - 'subjectcode' => 'Subject Code', - - //Dublin Core schema tags - 'contributor' => 'Contributor', - 'coverage' => 'Coverage', - 'creator' => 'Creator', - 'date' => 'Date', - 'description' => 'Description', - 'format' => 'Format', - 'identifier' => 'Identifier', - 'publisher' => 'Publisher', - 'rights' => 'Rights', - 'subject' => 'Subject', - 'title' => 'Title', - - //Adobe Photoshop schema tags - 'authorsposition' => 'Authors Position', - 'captionwriter' => 'Caption Writer', - 'category' => 'Category', - 'city' => 'City', - 'colormode' => 'Color Mode', - 'country' => 'Country', - 'credit' => 'Credit', - //'datecreated' => 'DateCreated', - 'headline' => 'Headline', - 'iccprofilename' => 'ICC Profile Name', - 'instructions' => 'Instructions', - 'source' => 'Source', - 'state' => 'State', - 'supplementalcategories' => 'Supplemental Categories', - 'transmissionreference' => 'Transmission Reference', - 'urgency' => 'Urgency' - + //Iptc4xmpCore schema tags + 'countrycode' => '', + 'intellectualgenre' => '', + 'location' => '', + 'scene' => '', + 'subjectcode' => '', + + //Dublin Core schema tags + 'contributor' => '', + 'coverage' => '', + 'creator' => '', + 'date' => '', + 'description' => '', + 'format' => '', + 'identifier' => '', + 'publisher' => '', + 'rights' => '', + 'subject' => '', + 'title' => '', + + //Adobe Photoshop schema tags + 'authorsposition' => '', + 'captionwriter' => '', + 'category' => '', + 'city' => '', + 'colormode' => '', + 'country' => '', + 'credit' => '', + //'datecreated' => '', + 'headline' => '', + 'iccprofilename' => '', + 'instructions' => '', + 'source' => '', + 'state' => '', + 'supplementalcategories' => '', + 'transmissionreference' => '', + 'urgency' => '' ), //IPTC schema tags 'iptc' => array( - //IPTC ApplicationRecord Tags - 'applicationrecordversion' => 'Application Record Version', - 'objecttypereference' => 'Object Type Reference', - 'objectattributereference' => 'Object Attribute Reference', - 'objectname' => 'Object Name', - 'objectcycle' => 'Object Cycle', - 'editstatus' => 'Edit Status', - 'subjectreference' => 'Subject Reference', - //'category' => 'Category', - 'supplementalcategories' => 'Supplemental Categories', - 'keywords' => 'Keywords', - 'specialinstructions' => 'Special Instructions', - 'datecreated' => 'Date Created', - 'timecreated' => 'Time Created', - 'by_line' => 'By-line', - 'by_linetitle' => 'By-line Title', - //'city' => 'City', - 'sub_location' => 'Sub-location', - 'province_state' => 'Province-State', - 'country_primarylocationcode' => 'Country-Primary Location Code', - 'country_primarylocationname' => 'Country-Primary Location Name', - 'originaltransmissionreference' => 'Original Transmission Reference', - //'headline' => 'Headline', - //'credit' => 'Credit', - //'source' => 'Source', - 'copyrightnotice' => 'Copyright Notice', - 'contact' => 'Contact', - 'caption_abstract' => 'Caption-Abstract', - 'writer_editor' => 'Writer-Editor', - 'originatingprogram' => 'Originating Program', - 'releasedate' => 'Release Date' + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => '', + 'objecttypereference' => '', + 'objectattributereference' => '', + 'objectname' => '', + 'objectcycle' => '', + 'editstatus' => '', + 'subjectreference' => '', + //'category' => '', + 'supplementalcategories' => '', + 'keywords' => '', + 'specialinstructions' => '', + 'datecreated' => '', + 'timecreated' => '', + 'by_line' => '', + 'by_linetitle' => '', + //'city' => '', + 'sub_location' => '', + 'province_state' => '', + 'country_primarylocationcode' => '', + 'country_primarylocationname' => '', + 'originaltransmissionreference' => '', + //'headline' => '', + //'credit' => '', + //'source' => '', + 'copyrightnotice' => '', + 'contact' => '', + 'caption_abstract' => '', + 'writer_editor' => '', + 'originatingprogram' => '', + 'releasedate' => '' ), //EXIF schema tags 'exif' => array( - //IFD0 - 'processingsoftware' => 'Processing Software', - 'imagewidth' => 'Image Width', - 'imagelength' => 'Image Length', - 'bitspersample' => 'Bits Per Sample', - 'compression' => 'Compression', - 'photometricinterpretation' => 'Photometric Interpretation', - 'thresholding' => 'Thresholding', - 'cellwidth' => 'Cell Width', - 'celllength' => 'Cell Length', - 'fillorder' => 'Fill Order', - 'documentname' => 'Document Name', - 'imagedescription' => 'Image Description', - 'make' => 'Maker', - 'model' => 'Model', - 'orientation' => 'Orientation', - 'samplesperpixel' => 'Samples Per Pixel', - 'rowsperstrip' => 'Rows Per Strip', - 'minsamplevalue' => 'Min Sample Value', - 'maxsamplevalue' => 'Max Sample Value', - 'xresolution' => 'X Resolution', - 'yresolution' => 'Y Resolution', - 'planarconfiguration' => 'Planar Configuration', - 'pagename' => 'Page Name', - 'xposition' => 'X Position', - 'yposition' => 'Y Position', - 'grayresponseunit' => 'Gray Response Unit', - 'resolutionunit' => 'Resolution Unit', - 'pagenumber' => 'Page Number', - 'software' => 'Software', - 'modifydate' => 'Modify Date', - 'artist' => 'Artist', - 'hostcomputer' => 'Host Computer', - 'predictor' => 'Predictor', - 'whitepoint' => 'White Point', - 'primarychromaticities' => 'Primary Chromaticities', - 'halftonehints' => 'Halftone Hints', - 'tilewidth' => 'Tile Width', - 'tilelength' => 'Tile Length', - 'ycbcrcoefficients' => 'YCbCr Coefficients', - 'ycbcrsubsampling' => 'YCbCr Sub Sampling', - 'ycbcrpositioning' => 'YCbCr Positioning', - 'referenceblackwhite' => 'Reference Black White', - 'relatedimagefileformat' => 'Related Image File Format', - 'relatedimagewidth' => 'Related Image Width', - 'relatedimagelength' => 'Related Image Length', - 'rating' => 'Rating', - 'ratingpercent' => 'Rating Percent', - 'copyright' => 'Copyright', - - //ExifIFD - 'exposuretime' => 'Exposure Time', - 'fnumber' => 'F Number', - 'exposureprogram' => 'Exposure Program', - 'spectralsensitivity' => 'Spectral Sensitivity', - 'iso' => 'ISO', - 'timezoneoffset' => 'Time Zone Offset', - 'selftimermode' => 'Self Timer Mode', - 'exifversion' => 'Exif Version', - 'datetimeoriginal' => 'Date Time Original', - 'createdate' => 'Create Date', - 'componentsconfiguration' => 'Components Configuration', - 'compressedbitsperpixel' => 'Compressed Bits Per Pixel', - 'shutterspeedvalue' => 'Shutter Speed Value', - 'aperturevalue' => 'Aperture Value', - 'brightnessvalue' => 'Brightness Value', - 'exposurecompensation' => 'Exposure Compensation', - 'maxaperturevalue' => 'Max Aperture Value', - 'subjectdistance' => 'Subject Distance', - 'meteringmode' => 'Metering Mode', - 'lightsource' => 'Light Source', - 'flash' => 'Flash', - 'focallength' => 'Focal Length', - 'imagenumber' => 'Image Number', - 'securityclassification' => 'Security Classification', - 'imagehistory' => 'Image History', - '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', - 'focallengthin35mmformat' => 'Focal Length In 35mm Format', - 'scenecapturetype' => 'Scene Capture Type', - 'gaincontrol' => 'Gain Control', - 'contrast' => 'Contrast', - 'saturation' => 'Saturation', - 'sharpness' => 'Sharpness', - 'subjectdistancerange' => 'Subject Distance Range', - 'gamma' => 'Gamma' + //IFD0 + 'processingsoftware' => '', + 'imagewidth' => '', + 'imagelength' => '', + 'bitspersample' => '', + 'compression' => '', + 'photometricinterpretation' => '', + 'thresholding' => '', + 'cellwidth' => '', + 'celllength' => '', + 'fillorder' => '', + 'documentname' => '', + 'imagedescription' => '', + 'make' => '', + 'model' => '', + 'orientation' => '', + 'samplesperpixel' => '', + 'rowsperstrip' => '', + 'minsamplevalue' => '', + 'maxsamplevalue' => '', + 'xresolution' => '', + 'yresolution' => '', + 'planarconfiguration' => '', + 'pagename' => '', + 'xposition' => '', + 'yposition' => '', + 'grayresponseunit' => '', + 'resolutionunit' => '', + 'pagenumber' => '', + 'software' => '', + 'modifydate' => '', + 'artist' => '', + 'hostcomputer' => '', + 'predictor' => '', + 'whitepoint' => '', + 'primarychromaticities' => '', + 'halftonehints' => '', + 'tilewidth' => '', + 'tilelength' => '', + 'ycbcrcoefficients' => '', + 'ycbcrsubsampling' => '', + 'ycbcrpositioning' => '', + 'referenceblackwhite' => '', + 'relatedimagefileformat' => '', + 'relatedimagewidth' => '', + 'relatedimagelength' => '', + 'rating' => '', + 'ratingpercent' => '', + 'copyright' => '', + + //ExifIFD + 'exposuretime' => '', + 'fnumber' => '', + 'exposureprogram' => '', + 'spectralsensitivity' => '', + 'iso' => '', + 'timezoneoffset' => '', + 'selftimermode' => '', + 'exifversion' => '', + 'datetimeoriginal' => '', + 'createdate' => '', + 'componentsconfiguration' => '', + 'compressedbitsperpixel' => '', + 'shutterspeedvalue' => '', + 'aperturevalue' => '', + 'brightnessvalue' => '', + 'exposurecompensation' => '', + 'maxaperturevalue' => '', + 'subjectdistance' => '', + 'meteringmode' => '', + 'lightsource' => '', + 'flash' => '', + 'focallength' => '', + 'imagenumber' => '', + 'securityclassification' => '', + 'imagehistory' => '', + 'subjectlocation' => '', + 'exposureindex' => '', + 'sensingmethod' => '', + 'filesource' => '', + 'scenetype' => '', + 'cfapattern' => '', + 'customrendered' => '', + 'exposuremode' => '', + 'whitebalance' => '', + 'digitalzoomratio' => '', + 'focallengthin35mmformat' => '', + 'scenecapturetype' => '', + 'gaincontrol' => '', + 'contrast' => '', + 'saturation' => '', + 'sharpness' => '', + 'subjectdistancerange' => '', + 'gamma' => '' ) - ); + );*/ } /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -30,7 +30,8 @@ class LinMetaData { - public $defined_fields, $available_fields, $objMetaTool; + //public $defined_fields, $available_fields, + public $objMetaTool; private $cachedFieldNames, $cachedFieldIds, $cachedSelectedFieldNames; @@ -41,12 +42,12 @@ { if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) { - include_once LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'; + require_once LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'; $this->objMetaTool = new LinExifTool(); } else { - include_once LINPHA_DIR.'/lib/classes/linpha.pjmt.class.php'; + require_once LINPHA_DIR.'/lib/classes/linpha.pjmt.class.php'; $this->objMetaTool = new LinPjmtTool(); } } @@ -706,7 +707,7 @@ /** * This method is used to setup the initial most useful defaults for the * MetaData tables EXIF/IPTC/XMP during creation and provides default - * Geodata (GPS) Tgas for the maps plugin + * Geodata (GPS) Tags for the maps plugin * @param string exif,iptc,xmp,gps * @return array with metadata information * @author bzrudi,flo @@ -766,43 +767,6 @@ ); break; - case 'gps': - return array ( - 'gpsversionid', - 'gpslatituderef', - 'gpslatitude', - 'gpslongituderef', - 'gpslongitude', - 'gpsaltituderef', - 'gpsaltitude', - 'gpstimestamp', - 'gpssatellites', - 'gpsstatus', - 'gpsmeasuremode', - 'gpsdop', - 'gpsspeedref', - 'gpsspeed', - 'gpstrackref', - 'gpstrack', - 'gpsimgdirectionref', - 'gpsimgdirection', - 'gpsmapdatum', - 'gpsdestlatituderef', - 'gpsdestlatitude', - 'gpsdestlongituderef', - 'gpsdestlongitude', - 'gpsdestbearingref', - 'gpsdestbearing', - 'gpsdestdistanceref', - 'gpsdestdistance', - 'gpsprocessingmethod', - 'gpsareainformation', - 'gpsdatestamp', - 'gpsdatetime', - 'gpsposition', - ); - break; - default: return array(); break; @@ -814,13 +778,13 @@ * @param string $metatype exif,iptc,xmp * @return none * @author bzrudi - */ + public function setMetaFields($metatype) { $this->objMetaTool->setMetaFields($metatype); $this->defined_fields = $this->objMetaTool->defined_fields; $this->available_fields = $this->objMetaTool->available_fields; - } + }*/ /** * This method is used to create any required MEtaData table @@ -828,9 +792,8 @@ * @param string $metatype exif,iptc,xmp * @return none * @author bzrudi,flo - * TODO cleanup + set required indexes! */ - public function createMetaDataTable($array, $metatype) + /*public function createMetaDataTable($array, $metatype) { if (!is_array($array)) { @@ -858,9 +821,8 @@ $value = str_replace("-", "_", strtolower($value)); $str .= strtolower($value) . " VARCHAR(255), "; } - /** - * remove last 2 signs (the comma and the space) - */ + + // remove last 2 signs (the comma and the space) $str = substr($str, 0, strlen($str) - 2) . ")"; } elseif (LIN_DB_TYPE == "postgres") @@ -874,13 +836,11 @@ $str .= "$value" . " TEXT, "; } - /** - * remove last 2 signs (the comma and the space) - */ + // remove last 2 signs (the comma and the space) $str = substr($str, 0, strlen($str) - 2) . ")"; } return $str; - } + }*/ /** * Save all Image GeoData (GPS) to database. @@ -895,6 +855,7 @@ */ public function massImportGeoData() { + $arrayGPSTags = $this->getDefaultMetaTags('gps'); $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos @@ -905,152 +866,96 @@ while($data = $query->FetchRow()) { $filename = LinSql::getFullImagePath($data['id']); - $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - - //echo '<pre>', print_r($dataArray), '</pre>'; - - $str_columns = "md5sum, "; - $str_values = "'".$data['id']."', "; - - if(is_array($dataArray)) + + if ($this->saveMetaDataToDatabase('exifgps', $filename, $data['md5sum'] )) { - /** - * Lower array data to make it compareable to $metaTags - */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - //echo '<pre>', print_r($lowerDataArray), '</pre>'; - - foreach($this->getDefaultMetaTags('gps') AS $key => $value) - { - if(array_key_exists($value, $lowerDataArray)) - { - - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; - } - } - /** - * Remove last two signs (the comma and the space) which we add 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."plugins_maps_image_geodata " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET geodata='1' WHERE md5sum='".$data['md5sum']."' "); + "SET geodata='1' WHERE md5sum='".$data['md5sum']."' "); } } } /** - * Save single Image GeoData (GPS) to database during import. - * Used in maps plugin if enabled. Other than massImportGeoData() we just - * get all "geodata" for a single image only. - * @param none - * @return none - * @author bzrudi + * Parse GPX data from file */ - public function singleImportGeoData($md5sum, $filename) + public function parseGpxFile($filename) { - /* - * Prevent double entries and prevent warnings + $parser = new GpxParser($filename); + } + + static public function fileNeedsIndexing($md5sum, $db_table) + { + /** + * Prevent double entries. We do this check at very first position + * to improve performance! */ $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata " . - "WHERE md5sum = '".$md5sum."' "); + "FROM " . $db_table . " " . + "WHERE md5sum = '" . $md5sum . "'"); - if($query->EOF) - { - $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - - if(is_array($dataArray)) - { - /** - * Lower array data to make it compareable to $metaTags - */ - - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - foreach($this->getDefaultMetaTags('gps') AS $key => $value) - { - if(array_key_exists($value, $lowerDataArray)) - { - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; - } - } - - /** - * Remove last two signs (the comma and the space) which we add 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."plugins_maps_image_geodata " . - "(" . $str_columns . ") VALUES (" . $str_values . ")"); - - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET geodata='1' WHERE md5sum='".$md5sum."' "); - } - } + return $query->EOF; } /** - * Parse GPX data from file + * Save all MetaData to database + * @param string $tag save EXIF, IPTC or XMP MetaData + * @param string $filename filename to parse for MetaData + * @param string $md5sum md5sum of file + * @return none + * @author bzrudi, flo */ - public function parseGpxFile($filename) + public function saveMetaDataToDatabase($tag, $db_table, $filename, $md5sum) { - $parser = new GpxParser($filename); + $dataArray = $this->objMetaTool->readMetaDataFromFile($tag, $filename); - } - - /** - * Simple wrapper method for saveMetaData() - * @param string $what meta type exif,iptc,xmp - * @param string $filename filename - * @param string $md5sum md5sum of image - * @return none - * @author bzrudi,flo - */ - public function saveData($what, $filename, $md5sum) { + //echo '<pre>', print_r($dataArray), '</pre>'; + + if (!is_array($dataArray)) { + return false; + } + + $columns[] = "md5sum"; + $values[] = "'" . $md5sum . "'"; + /** - * Prevent double entries. We do this check at very first position - * to improve performance! - * Also we do not setMetaFields in the __contruct() because they may - * never be used + * Lower array data to make it compareable to LinExifTool::$metaTags + * this is about two times faster than calling strtolow($key) in the loop! */ - $query = $GLOBALS['linpha']->db->Execute("SELECT md5sum " . - "FROM " . LIN_PREFIX . "meta_" . $what . " " . - "WHERE md5sum = '" . $md5sum . "'"); + $lowerDataArray = array_change_key_case($dataArray, CASE_LOWER); - if($query->EOF) // not a single value returned + /** + * Search for valid and filled tags + */ + $hasData = false; + //foreach ($this->defined_fields[$tag] as $key => $value) + foreach ($lowerDataArray as $key => $value) { - /** - * define tags to index if not already done - */ - if(!isset ($this->defined_fields[$what])) + //if (array_key_exists($key, $lowerDataArray)) + if (isset(LinMetaData::$metaTags[$tag][$key])) { - $this->objMetaTool->setMetaFields($what); + //$columns .= str_replace("_", "-", $key) . ', '; // why? (flo) + $columns[] = $key; + + $value = trim($lowerDataArray[$key]); + if (!empty($value)) { + $hasData = true; + } + $values[] = "'".LinSql::linAddslashes($value)."'"; + //$str_values .= "'".HTML_UTF8_Escape(trim($lowerDataArray[$key]))."', "; } - switch($what) - { - case 'exif': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - case 'iptc': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - case 'xmp': - $this->objMetaTool->saveMetaData($filename, $md5sum, $what); - break; - } } + + $str_columns = implode(', ', $columns); + $str_values = implode(', ', $values); + + /** + * insert empty record even if we have no data to prevent call to this function + * on every image view + */ + $GLOBALS['linpha']->db->Execute("INSERT into ". $db_table . + "(" . $str_columns . ") VALUES (" . $str_values . ")"); + + return $hasData; } /** @@ -1187,7 +1092,239 @@ $image_date = $this->objMetaTool->getDateTimeOriginal($filename); return $image_date; } + + /** + * Define array with allowed IPTC/XMP tags and human readable translation + * This array should correspond with the sql definition in include/sql/sql.tables.php + * @param none + * @return none + * @author bzrudi flo + */ + public static $metaTags = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode' => 'Country Code', + 'intellectualgenre' => 'Intellectual Genre', + 'location' => 'Location', + 'scene' => 'Scene', + 'subjectcode' => 'Subject Code', + + //Dublin Core schema tags + 'contributor' => 'Contributor', + 'coverage' => 'Coverage', + 'creator' => 'Creator', + 'date' => 'Date', + 'description' => 'Description', + 'format' => 'Format', + 'identifier' => 'Identifier', + 'publisher' => 'Publisher', + 'rights' => 'Rights', + 'subject' => 'Subject', + 'title' => 'Title', + + //Adobe Photoshop schema tags + 'authorsposition' => 'Authors Position', + 'captionwriter' => 'Caption Writer', + 'category' => 'Category', + 'city' => 'City', + 'colormode' => 'Color Mode', + 'country' => 'Country', + 'credit' => 'Credit', + //'datecreated' => 'DateCreated', + 'headline' => 'Headline', + 'iccprofilename' => 'ICC Profile Name', + 'instructions' => 'Instructions', + 'source' => 'Source', + 'state' => 'State', + 'supplementalcategories' => 'Supplemental Categories', + 'transmissionreference' => 'Transmission Reference', + 'urgency' => 'Urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => 'Application Record Version', + 'objecttypereference' => 'Object Type Reference', + 'objectattributereference' => 'Object Attribute Reference', + 'objectname' => 'Object Name', + 'objectcycle' => 'Object Cycle', + 'editstatus' => 'Edit Status', + 'subjectreference' => 'Subject Reference', + //'category' => 'Category', + 'supplementalcategories' => 'Supplemental Categories', + 'keywords' => 'Keywords', + 'specialinstructions' => 'Special Instructions', + 'datecreated' => 'Date Created', + 'timecreated' => 'Time Created', + 'by_line' => 'By-line', + 'by_linetitle' => 'By-line Title', + //'city' => 'City', + 'sub_location' => 'Sub-location', + 'province_state' => 'Province-State', + 'country_primarylocationcode' => 'Country-Primary Location Code', + 'country_primarylocationname' => 'Country-Primary Location Name', + 'originaltransmissionreference' => 'Original Transmission Reference', + //'headline' => 'Headline', + //'credit' => 'Credit', + //'source' => 'Source', + 'copyrightnotice' => 'Copyright Notice', + 'contact' => 'Contact', + 'caption_abstract' => 'Caption-Abstract', + 'writer_editor' => 'Writer-Editor', + 'originatingprogram' => 'Originating Program', + 'releasedate' => 'Release Date' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware' => 'Processing Software', + 'imagewidth' => 'Image Width', + 'imagelength' => 'Image Length', + 'bitspersample' => 'Bits Per Sample', + 'compression' => 'Compression', + 'photometricinterpretation' => 'Photometric Interpretation', + 'thresholding' => 'Thresholding', + 'cellwidth' => 'Cell Width', + 'celllength' => 'Cell Length', + 'fillorder' => 'Fill Order', + 'documentname' => 'Document Name', + 'imagedescription' => 'Image Description', + 'make' => 'Maker', + 'model' => 'Model', + 'orientation' => 'Orientation', + 'samplesperpixel' => 'Samples Per Pixel', + 'rowsperstrip' => 'Rows Per Strip', + 'minsamplevalue' => 'Min Sample Value', + 'maxsamplevalue' => 'Max Sample Value', + 'xresolution' => 'X Resolution', + 'yresolution' => 'Y Resolution', + 'planarconfiguration' => 'Planar Configuration', + 'pagename' => 'Page Name', + 'xposition' => 'X Position', + 'yposition' => 'Y Position', + 'grayresponseunit' => 'Gray Response Unit', + 'resolutionunit' => 'Resolution Unit', + 'pagenumber' => 'Page Number', + 'software' => 'Software', + 'artist' => 'Artist', + 'hostcomputer' => 'Host Computer', + 'predictor' => 'Predictor', + 'whitepoint' => 'White Point', + 'primarychromaticities' => 'Primary Chromaticities', + 'halftonehints' => 'Halftone Hints', + 'tilewidth' => 'Tile Width', + 'tilelength' => 'Tile Length', + 'ycbcrcoefficients' => 'YCbCr Coefficients', + 'ycbcrsubsampling' => 'YCbCr Sub Sampling', + 'ycbcrpositioning' => 'YCbCr Positioning', + 'referenceblackwhite' => 'Reference Black White', + 'relatedimagefileformat' => 'Related Image File Format', + 'relatedimagewidth' => 'Related Image Width', + 'relatedimagelength' => 'Related Image Length', + 'rating' => 'Rating', + 'ratingpercent' => 'Rating Percent', + 'copyright' => 'Copyright', + + //ExifIFD + 'exposuretime' => 'Exposure Time', + 'fnumber' => 'F Number', + 'exposureprogram' => 'Exposure Program', + 'spectralsensitivity' => 'Spectral Sensitivity', + 'isospeedratings' => 'ISO Speed Ratings', + 'timezoneoffset' => 'Time Zone Offset', + 'selftimermode' => 'Self Timer Mode', + 'exifversion' => 'Exif Version', + 'flashpixversion' => 'FlashPix Version', + 'colorspace' => 'Color Space', + 'pixelxdimension' => 'Pixel X Dimension', + 'pixelydimension' => 'Pixel Y Dimension', + 'datetime' => 'Date Time (Modify Date)', + 'datetimeoriginal' => 'Date Time Original', + 'datetimedigitized' => 'Date Time Digitized (Create Date)', + 'componentsconfiguration' => 'Components Configuration', + 'compressedbitsperpixel' => 'Compressed Bits Per Pixel', + 'shutterspeedvalue' => 'Shutter Speed Value', + 'aperturevalue' => 'Aperture Value', + 'brightnessvalue' => 'Brightness Value', + 'exposurebiasvalue' => 'Exposure Bias Value', + 'exposurecompensation' => 'Exposure Compensation', + 'maxaperturevalue' => 'Max Aperture Value', + 'subjectdistance' => 'Subject Distance', + 'meteringmode' => 'Metering Mode', + 'lightsource' => 'Light Source', + 'flash' => 'Flash', + 'focallength' => 'Focal Length', + 'imagenumber' => 'Image Number', + 'securityclassification' => 'Security Classification', + 'focalplanexresolution' => 'Focal Plane X Resolution', + 'focalplaneyresolution' => 'Foca Plane Y Resolution', + 'focalplaneresolutionunit' => 'Focal Plane Resolution Unit', + 'imagehistory' => 'Image History', + '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 Format', + 'scenecapturetype' => 'Scene Capture Type', + 'gaincontrol' => 'Gain Control', + 'contrast' => 'Contrast', + 'saturation' => 'Saturation', + 'sharpness' => 'Sharpness', + 'subjectdistancerange' => 'Subject Distance Range', + 'gamma' => 'Gamma', + 'relatedsoundfile' => 'Related Sound File', + 'usercomment' => 'User Comment', + 'jpegcomment' => 'JPEG Comment' + ), + + 'exifgps' => array ( + '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', + 'gpsdatetime' => 'GPS DateTime', + 'gpsposition' => 'GPS Position', + 'gpsdifferential' => 'GPS Differential' + ) + ); } /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-02 20:54:22 UTC (rev 4915) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-06 21:38:41 UTC (rev 4916) @@ -34,19 +34,24 @@ */ function __construct() { - } /** - * This method reads all available GeoData Information from image. - * @param string $metatype exi - * @param string $filename - * @return array Array with all available Tag informations - * @author bzrudi - * @todo respect exec return status, don't use filename as input (security) + * This method reads all available exif/gps/iptc/xmp information from image. + * @param string $filename filename to parse for MetaData + * @param string $md5sum md5sum of file + * @param string $tag save IPTC or XMP MetaData */ public function readMetaDataFromFile($metatype, $filename) { + $metaArray = array(); + + if (!isset(LinPjmtTool::$metaTags[$metatype])) + { + // TODO IPTC and XMP currently not implemented + return $metaArray; + } + include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); @@ -54,165 +59,89 @@ * get exif info from file */ $exif_data = get_EXIF_JPEG($filename); - - if($exif_data) + if (!$exif_data) { - /** - * search for valid tags - */ - foreach($this->getDefaultMetaTags('gps') AS $key => $value) + return $metaArray(); + } + + /** + * 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'])) { - if(!empty(LinPjmtTool::$metaTags['exif'][$value]['pathvalue'])) - { - /** - * there are currently only entries at level deep 2 and 5 - * in the array - */ - $ap = explode('/', - LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); - - switch(count($ap)) - { - case 2 : - if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) - { - //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; - $dataArray[$value] = - LinSql::linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])); - } - break; - case 5 : - if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) - { - //echo "DATA2".$exif_data... [truncated message content] |
From: <fan...@us...> - 2008-04-07 20:36:50
|
Revision: 4918 http://linpha.svn.sourceforge.net/linpha/?rev=4918&view=rev Author: fangehrn Date: 2008-04-07 13:36:31 -0700 (Mon, 07 Apr 2008) Log Message: ----------- 2008-04-07 flo * metadata - fixed admin section * import - do not use output buffering so we see some progress while importing Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/metadata_define.php trunk/linpha2/admin/metadata_select.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/filemanager/module.filemanager.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/css/viewer.css Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/ChangeLog 2008-04-07 20:36:31 UTC (rev 4918) @@ -1,4 +1,11 @@ +2008-04-07 flo + * metadata + - fixed admin section + + * import + - do not use output buffering so we see some progress while importing + 2008-04-06 flo * metadata cleanups and improvements Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/maintenance_import.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -25,6 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } +function linImport() +{ /** * try it, it works sometimes */ @@ -274,7 +276,7 @@ { $full_filename = LinSql::getFullImagePath($id); - $MetaData->saveMetaDataToDatabase($meta_value, $full_filename, $md5sum); + $MetaData->saveMetaDataToDatabase($meta_value, LIN_PREFIX."meta_".$meta_value, $full_filename, $md5sum); echo " ".$id.","; flush(); @@ -345,7 +347,7 @@ /** * import */ - if ($linpha->sql->config->value['sys_import_autoimport']) + if ($GLOBALS['linpha']->sql->config->value['sys_import_autoimport']) { LinImport::updateDir( $parent_id = 0, $recursive = true, $dryrun = true ); } @@ -373,7 +375,7 @@ $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow()) + while ($data = $query->FetchRow()) { $thumbnail->mode = 'thumb'; @@ -398,7 +400,7 @@ "WHERE parent_id = '0' " . "GROUP BY parent_id"); - foreach($array_meta AS $value) + foreach($array_meta as $value) { if ($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { @@ -409,4 +411,8 @@ echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total['s'] - $nr_indexed['number_idx']) .' <br />'; } } + +} // end linImport() + +$GLOBALS['linpha']->template->fnCallback = 'linImport'; ?> \ No newline at end of file Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_define.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -28,7 +28,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } -include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); +//include_once(LINPHA_DIR.'/lib/classes/linpha.exiftool.class.php'); /** * init @@ -49,9 +49,9 @@ $array_menu = array( 'own' => array('name' => i18n("Own fields"), 'link' => 'metadata_define_own'), 'adddata' => array('name' => i18n("Add select data (set Category names)"), 'link' => 'metadata_define_adddata'), - 'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), - 'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), - 'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') + //'exif' => array('name' => i18n("EXIF fields"), 'link' => 'metadata_define_exif'), + //'iptc' => array('name' => i18n("IPTC fields"), 'link' => 'metadata_define_iptc'), + //'xmp' => array('name' => i18n("XMP fields"), 'link' => 'metadata_define_xmp') ); LinAdmin::printAdminMenu($array_menu,$cat3); @@ -326,7 +326,7 @@ function show_metadata() { $MetaData = new LinMetaData(); - $MetaData->setMetaFields($GLOBALS['cat3']); + //$MetaData->setMetaFields($GLOBALS['cat3']); /** * get enabled/disabled setting @@ -350,10 +350,10 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'."\n"; - } + //foreach($MetaData->defined_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'."\n"; + //} ?> </select> <br /> @@ -367,10 +367,10 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) - { - echo '<option value="'.$key.'">'.$value.'</option>'; - } + //foreach($MetaData->available_fields[$GLOBALS['cat3']] AS $key=>$value) + //{ + // echo '<option value="'.$key.'">'.$value.'</option>'; + //} ?> </select> </td> Modified: trunk/linpha2/admin/metadata_select.php =================================================================== --- trunk/linpha2/admin/metadata_select.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/admin/metadata_select.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -164,8 +164,9 @@ <input type="button" name="exif_shiftleft" value="<" onclick="copyElement('exif_fields')" /> </td> <td> - EXIF fields (<a href="./?cat=metadata_define_exif">define</a>)<br /> + EXIF fields<br /> <?php + // (<a href="./?cat=metadata_define_exif">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) { $str_disabled = ''; } else { @@ -174,11 +175,16 @@ ?> <select id="exif_fields" name="exif_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('exif'); - foreach($MetaData->defined_fields['exif'] AS $key=>$value) + //$MetaData->setMetaFields('exif'); + //foreach($MetaData->defined_fields['exif'] AS $key=>$value) + foreach (LinMetaData::$metaTags['exif'] as $key=>$value) { echo '<option value="exif_'.$key.'">'.$value.'</option>'; } + foreach (LinMetaData::$metaTags['gpsexif'] as $key=>$value) + { + echo '<option value="exif_'.$key.'">'.$value.'</option>'; + } ?> </select> </td> @@ -188,8 +194,9 @@ <input type="button" name="iptc_shiftleft" value="<" onclick="copyElement('iptc_fields')" /> </td> <td> - IPTC fields (<a href="./?cat=metadata_define_iptc">define</a>)<br /> + IPTC fields<br /> <?php + // (<a href="./?cat=metadata_define_iptc">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { $str_disabled = ''; } else { @@ -198,9 +205,10 @@ ?> <select id="iptc_fields" name="iptc_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('iptc'); - foreach($MetaData->defined_fields['iptc'] AS $key=>$value) - { + //$MetaData->setMetaFields('iptc'); + //foreach($MetaData->defined_fields['iptc'] AS $key=>$value) + foreach (LinMetaData::$metaTags['iptc'] as $key=>$value) + { echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } ?> @@ -212,8 +220,9 @@ <input type="button" name="xmp_shiftleft" value="<" onclick="copyElement('xmp_fields')" /> </td> <td> - XMP fields (<a href="./?cat=metadata_define_xmp">define</a>)<br /> + XMP fields<br /> <?php + // (<a href="./?cat=metadata_define_xmp">define</a>) if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { $str_disabled = ''; } else { @@ -222,8 +231,9 @@ ?> <select id="xmp_fields" name="xmp_fields" size="5" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $MetaData->setMetaFields('xmp'); - foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + //$MetaData->setMetaFields('xmp'); + //foreach($MetaData->defined_fields['xmp'] AS $key=>$value) + foreach (LinMetaData::$metaTags['xmp'] as $key=>$value) { echo '<option value="xmp_'.$key.'">'.$value.'</option>'; } @@ -245,6 +255,20 @@ </div> </form> + + <?php + echo '<br /><h2 class="linStyle">'.i18n("EXIF").'</h2>'; + echo i18n("EXIF data is usually created by the any Digital Camera. These values will be indexed for searching and displaying them, but can't be edited with LinPHA."); + echo '<br /><br />'; + echo '<h2 class="linStyle">'.i18n("IPTC/XMP").'</h2>'; + echo i18n("IPTC/XMP data is usually not available by default."); + echo i18n("It needs to be filled up either with LinPHA, or with any other external program which allows IPTC/XMP editing like Photoshop. IPTC/XMP is a standard within professional Photographer business."); + echo '<br /><br />'; + + if($GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail']) { + echo i18n("IPTC disabled due missing dependencies. Exiftool can't be used in your configuration. Please see the LinPHA FAQ for details"); + } + ?> <script type="text/javascript"> /** @@ -290,6 +314,13 @@ * remove new selection on left side */ obj.options[ obj.options.length-1 ].selected = false; + + /** + * increase selection on the right side by one + */ + if (obj_from.selectedIndex < obj_from.length-1) { + obj_from.selectedIndex += 1; + } } function addElement () Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/docs/dev/TODO.txt 2008-04-07 20:36:31 UTC (rev 4918) @@ -7,11 +7,6 @@ - add common interface for thumb order (ORDER by..) to prevent "LinPHA New_images.PHP SQL Injection Vulnerability" etc. -- since the admin pages uses the template system, there is no update of the status during the import - thats not very user friendly - -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() - and just echo it in the template - - escape exif data (see Common Tasks UTF8) - optimize DB querys (index) @@ -84,6 +79,11 @@ DONE ############################################################################ +- since the admin pages uses the template system, there is no update of the status during the import + thats not very user friendly + -> solution: start import etc. directly from the template file, and not buffer the output with ob_start() + and just echo it in the template + - Use Effekts is sometimes hardcoded, make use of config setting sys_style_image_useeffects in all places where used Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -340,40 +340,29 @@ break; case 'exif' : - $value = '(EXIF) '; - if($show_metadata_extra_info) - { - //TODO make exiftool proof in an clean way - if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']) - { - $value .= LinExifTool::$metaTags['exif'][$last_part]; - } - else - { - $value .= LinPjmtTool::$metaTags['exif'][$last_part]['name']; - } + $value = LinMetaData::$metaTags['exif'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (EXIF)'; } break; case 'iptc' : - $value = '(IPTC) '; - if($show_metadata_extra_info) - { - $value .= $this->objMetaTool->metaTags['iptc'][$last_part]; + $value = LinMetaData::$metaTags['iptc'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (IPTC)'; } break; case 'xmp' : - $value = '(XMP) '; - if($show_metadata_extra_info) - { - $value = $this->objMetaTool->metaTags['xmp'][$last_part]; + $value = LinMetaData::$metaTags['xmp'][$last_part]; + if ($show_metadata_extra_info) { + $value .= ' (XMP)'; } break; default: linLog(LOG_TYPE_IMPORT,LOG_ERR,'import_others', - "Error in getNameOfField(); linpha.metadata.class.php"); + "Error in LinMetaData::getNameOfField(): unknown default value: ".$first_part); $value = ""; break; } Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -61,7 +61,7 @@ $exif_data = get_EXIF_JPEG($filename); if (!$exif_data) { - return $metaArray(); + return $metaArray; } /** Modified: trunk/linpha2/lib/plugins/filemanager/module.filemanager.php =================================================================== --- trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/lib/plugins/filemanager/module.filemanager.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -273,8 +273,10 @@ * its not allowed to change the file extension * a user could upload anEvilPhpScriptMaskedAsAnImage.jpg and rename it later * to anEvilPhpScriptMaskedAsAnImage.php + * + * folders are not affected by this limitation */ - if( LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) + if( !is_dir($full_filename) && LinFilesys::getFileExtFromPath($new_name) != LinFilesys::getFileExtFromPath($full_filename) ) { throw new Exception(i18n("For security reasons it is not allowed to change the file extension!")); } Modified: trunk/linpha2/templates/default/default.html.php =================================================================== --- trunk/linpha2/templates/default/default.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/default.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -2,7 +2,9 @@ <div id="linDivMain"> <?php -echo $linTpl->output['default']; +if (isset($linTpl->output['default'])) { + echo $linTpl->output['default']; +} $linTpl->callback(); ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/menu.html.php 2008-04-07 20:36:31 UTC (rev 4918) @@ -146,7 +146,7 @@ echo '["'.linEscapeQuotes($menu[$key.'_img']).'", " ", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; $prevIsIcon = true; } else { - echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes($menuEntry['link']).'", null, null]'; + echo '[null, "'.linEscapeQuotes($menuEntry['name']).'", "'.linEscapeQuotes(linConvertAmp($menuEntry['link'])).'", null, null]'; } } echo ']'; Modified: trunk/linpha2/templates/default/themes/default/css/viewer.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-06 21:40:37 UTC (rev 4917) +++ trunk/linpha2/templates/default/themes/default/css/viewer.css 2008-04-07 20:36:31 UTC (rev 4918) @@ -114,7 +114,7 @@ /*clear: both;*/ /*height: 265px; min height set in DefsThumbView.js */ /*border: 1px solid black;*/ - max-width: 700px; + /*max-width: 700px;*/ } #linDivTabContent { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |