[Linpha-cvs] SF.net SVN: linpha: [4913] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
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] |