[Linpha-cvs] SF.net SVN: linpha: [4612] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-11-01 17:55:02
|
Revision: 4612 http://svn.sourceforge.net/linpha/?rev=4612&view=rev Author: fangehrn Date: 2006-11-01 09:54:09 -0800 (Wed, 01 Nov 2006) Log Message: ----------- 2006-11-01 flo * implemented linpha_log() Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/permissions_usergroup.php trunk/linpha2/admin/settings_features.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/get_image.php trunk/linpha2/get_thumb.php trunk/linpha2/install/lib.install.php trunk/linpha2/install/lib.requirements.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/step2_requirements.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/archiver.config.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/common.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/lib/modules/module.albums.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.filemanager.php trunk/linpha2/lib/modules/module.newimg.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/lib/plugins/watermark/func.watermark.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/view_basket.html.php trunk/linpha2/templates/default/view_img_static.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/ChangeLog 2006-11-01 17:54:09 UTC (rev 4612) @@ -1,3 +1,6 @@ +2006-11-01 flo + * implemented linpha_log() + 2006-10-31 flo * saving img width and height during import in database * use in imgview.class the width and heigth from database Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/admin/permissions_readwrite.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -22,9 +22,8 @@ ); } + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_filemanager_enable'),'plugins_filemanager_enable',$LinAdmin->option_value_system['plugins_filemanager_enable']); - $LinAdmin->printAdminConfig('radio',i18n("Enable Filemanager For Non-Admin Users"),'plugins_filemanager_enable'); - ?> <input type="hidden" name="cmd" value="saveconfig" /> <input type="submit" name="submit" value="<?php echo i18n("Submit"); ?>" /> @@ -33,7 +32,7 @@ <?php } -if($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) +if($cat2 == 'view' OR ($cat2 == 'write' AND $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] )) { /** @@ -102,7 +101,7 @@ */ if(isset($_GET['parent_id']) && $_GET['parent_id'] != 0) { - $parent_id = $_GET['parent_id']; + $parent_id = intval($_GET['parent_id']); $view_mode = 'files'; $array = $GLOBALS['linpha']->sql->getFullFilenameFromId( LinSql::linAddslashes($parent_id) ); @@ -131,7 +130,7 @@ /** * show edit/add permission dialog */ - if(isset($_GET['cmd']) AND isset($_GET['id'])) + if(isset($_GET['cmd']) && $_GET['cmd']=='edit') { $checked = ''; $array_perms = array(); @@ -140,11 +139,11 @@ * check wether add or edit (insert or update) */ $query = $linpha->db->Execute("SELECT id FROM ".PREFIX."permissions " . - "WHERE photos_id = '".LinSql::linAddslashes($_GET['id'])."' AND perm_type = '".$sql_perm_type."'"); + "WHERE photos_id = '".LinSql::linAddslashes($linpha->template->idCurrent)."' AND perm_type = '".$sql_perm_type."'"); if( ! $query->EOF ) { - list($stage, $perm) = $GLOBALS['linpha']->sql->getPerm( $_GET['id'], $sql_perm_type ); + list($stage, $perm) = $GLOBALS['linpha']->sql->getPerm( $linpha->template->idCurrent, $sql_perm_type ); $array_perms = explode(';',$perm); if(in_array('public',$array_perms)) @@ -154,7 +153,7 @@ } $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($_GET['id'])."'"); + "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); $data = $query->FetchRow(ADODB_FETCH_NUM); ?> <form name="permission" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>"> @@ -165,7 +164,7 @@ * top folder can't be inherit * -> make sure we cannot delete this entry! */ - if($_GET['id'] != 0) + if($linpha->template->idCurrent != 0) { ?> <input type="checkbox" id="group_inherit" name="inherit" value="1" /><label for="group_inherit"> <?php echo i18n("Inherit From Parent"); ?></label><br /> @@ -191,7 +190,7 @@ echo '<input type="checkbox" id="group_'.$key.'" name="group[]" value="'.$key.'"'.$checked.' /><label for="group_'.$key.'"> '.$value.'</a><br />'; } ?> - <input type="hidden" name="photo_id" value="<?php echo $_GET['id']; ?>" /> + <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" /> Modified: trunk/linpha2/admin/permissions_usergroup.php =================================================================== --- trunk/linpha2/admin/permissions_usergroup.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/admin/permissions_usergroup.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -5,7 +5,7 @@ * get groups */ echo '<b>'.i18n("Edit Group Members").'</b><br />'; -$query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); +$query = $linpha->db->Execute("SELECT id, group_name FROM ".PREFIX."groups ORDER by group_name"); while($data = $query->FetchRow()) { echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=group&id='.$data['id'].'">'.$data['group_name'].'</a><br />'; @@ -17,7 +17,7 @@ * get users */ echo '<b>'.i18n("Edit User Memberships").'</b><br />'; -$query = $GLOBALS['linpha']->db->Execute("SELECT id, username FROM ".PREFIX."users ORDER by username"); +$query = $linpha->db->Execute("SELECT id, username FROM ".PREFIX."users ORDER by username"); while($data = $query->FetchRow()) { echo '<a href="'.LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit=user&id='.$data['id'].'">'.$data['username'].'</a><br />'; @@ -59,7 +59,7 @@ /** * delete all entries of current user */ - $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."user_group WHERE ".$column_name." = '".LinSql::linAddslashes($_GET['id'])."'"); + $linpha->db->Execute("DELETE FROM ".PREFIX."user_group WHERE ".$column_name." = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); /** * add new entries if exists @@ -71,14 +71,14 @@ if($_GET['edit']=='group') { $userid = LinSql::linAddslashes($value); - $groupid = LinSql::linAddslashes($_GET['id']); + $groupid = LinSql::linAddslashes($linpha->template->idCurrent); } elseif($_GET['edit']=='user') { - $userid = LinSql::linAddslashes($_GET['id']); + $userid = LinSql::linAddslashes($linpha->template->idCurrent); $groupid = LinSql::linAddslashes($value); } - $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$groupid."')"); + $linpha->db->Execute("INSERT into ".PREFIX."user_group (user_id, group_id) VALUES ('".$userid."','".$groupid."')"); } } } @@ -86,7 +86,7 @@ /** * get informations */ - $data = $GLOBALS['linpha']->db->GetRow("SELECT ".$select_name." FROM ".PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($_GET['id'])."'"); + $data = $linpha->db->GetRow("SELECT ".$select_name." FROM ".PREFIX.$table_name." WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); echo '<b>'; if($_GET['edit']=='user') { @@ -102,10 +102,10 @@ * get all groups/users */ ?> - <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit='.$_GET['edit'].'&id='.$_GET['id']; ?>"> + <form method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_usergroup&edit='.$_GET['edit'].'&id='.$linpha->template->idCurrent; ?>"> <select name="usergroup[]" size="5" style="width: 200;" multiple="multiple"> <?php - $query = $GLOBALS['linpha']->db->Execute("SELECT id, ".$other_select_name." " . + $query = $linpha->db->Execute("SELECT id, ".$other_select_name." " . "FROM ".PREFIX.$other_table_name." " . "ORDER by ".$other_select_name); while($data = $query->FetchRow()) @@ -116,14 +116,14 @@ if($_GET['edit']=='group') { $userid = $data['id']; - $groupid = LinSql::linAddslashes($_GET['id']); + $groupid = LinSql::linAddslashes($linpha->template->idCurrent); } elseif($_GET['edit']=='user') { - $userid = LinSql::linAddslashes($_GET['id']); + $userid = LinSql::linAddslashes($linpha->template->idCurrent); $groupid = $data['id']; } - $data2 = $GLOBALS['linpha']->db->GetRow("SELECT id FROM ".PREFIX."user_group " . + $data2 = $linpha->db->GetRow("SELECT id FROM ".PREFIX."user_group " . "WHERE user_id = '".$userid."' " . "AND group_id = '".$groupid."'"); if(isset($data2['id'])) Modified: trunk/linpha2/admin/settings_features.php =================================================================== --- trunk/linpha2/admin/settings_features.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/admin/settings_features.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -7,7 +7,8 @@ } $array_menu = Array( - 'others' => Array('name' => 'Others', 'link' => 'settings_features_others') + 'log' => Array('name' => 'Logging', 'link' => 'settings_features_log'), + 'others' => Array('name' => 'Others', 'link' => 'settings_features_others'), ); LinAdmin::printAdminMenu($array_menu,$cat3); @@ -18,22 +19,65 @@ switch($cat3) { -case 'others': + +case 'log': + /** * save settings */ if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { $LinAdmin->saveConfig(Array( + 'plugins_log_filename', + 'plugins_log_syslog_enable', + 'plugins_log_syslog_add_events', + 'plugins_log_email_enable', + 'plugins_log_email_add_events', + 'plugins_log_email_to', + 'plugins_log_email_headers', + 'plugins_log_email_subject' + )); + } + + echo '<br /><h2>'.i18n("Filename").'</h2>'; + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_filename'),'plugins_log_filename',$LinAdmin->option_value_system['plugins_log_filename']); + + echo '<br /><h2>'.i18n("Syslog").'</h2>'; + echo i18n("(Event log in Windows)"); + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_log_syslog_enable'),'plugins_log_syslog_enable',$LinAdmin->option_value_system['plugins_log_syslog_enable']); + + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_syslog_add_events'),'plugins_log_syslog_add_events',$LinAdmin->option_value_system['plugins_log_syslog_add_events']); + echo i18n("Comma separated list. Valid events: login, logout, rotate, comments, guestbook, fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm"); + echo '<br />'; + + echo '<br /><h2>'.i18n("Email").'</h2>'; + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('plugins_log_email_enable'),'plugins_log_email_enable',$LinAdmin->option_value_system['plugins_log_email_enable']); + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_email_to'),'plugins_log_email_to',$LinAdmin->option_value_system['plugins_log_email_to']); + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_email_subject'),'plugins_log_email_subject',$LinAdmin->option_value_system['plugins_log_email_subject']); + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_email_headers'),'plugins_log_email_headers',$LinAdmin->option_value_system['plugins_log_email_headers']); + + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('plugins_log_email_add_events'),'plugins_log_email_add_events',$LinAdmin->option_value_system['plugins_log_email_add_events']); + echo i18n("Comma separated list. Valid events: login, logout, rotate, comments, guestbook, fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm"); + + break; + +case 'others': + /** + * save settings + */ + /* if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $LinAdmin->saveConfig(Array( 'sys_image_exif', 'sys_image_iptc', 'sys_image_xmp' )); } - $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_exif'),'sys_image_exif',$option_value_system['sys_image_exif']); - $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_iptc'),'sys_image_iptc',$option_value_system['sys_image_iptc']); - $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_xmp'),'sys_image_xmp',$option_value_system['sys_image_xmp']); + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_exif'),'sys_image_exif',$LinAdmin->option_value_system['sys_image_exif']); + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_iptc'),'sys_image_iptc',$LinAdmin->option_value_system['sys_image_iptc']); + $LinAdmin->printAdminConfig('radio',$LinAdmin->getDescriptionByOptionName('sys_image_xmp'),'sys_image_xmp',$LinAdmin->option_value_system['sys_image_xmp']);*/ break; + } ?> \ No newline at end of file Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/docs/dev/TODO.txt 2006-11-01 17:54:09 UTC (rev 4612) @@ -6,6 +6,7 @@ ## Small Todos - since the admin pages uses the template system, there is no update of the status during the import thats not very user friendly +- escape exif data ## Big Todos Modified: trunk/linpha2/get_image.php =================================================================== --- trunk/linpha2/get_image.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/get_image.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -34,9 +34,13 @@ */ try { - if(!isset( $_GET['id'] ) ) + include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + $linpha = new linpha(); + $linpha->sql->startSession(); + + if( $linpha->template->idCurrent == 0 ) { - throw new Exception("no id supplied!"); + throw new Exception("no valid id supplied!"); } /** @@ -54,12 +58,8 @@ $overrideSettings['rotate'] = intval($_GET['rotate']); } - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new linpha(); - $linpha->sql->startSession(); - $image = new LinImage(); - if( ! $image->createImage($_GET['id'],$overrideSettings) ) // returns false if no permission + if( ! $image->createImage($linpha->template->idCurrent, $overrideSettings) ) // returns false if no permission { throw new Exception("Error while creating image!<br />Error: ".$image->error_msg); } @@ -69,6 +69,7 @@ catch(Exception $error) { echo "Error: ".$error -> getMessage(); + linLog(LOG_TYPE_IMPORT,LOG_ERR,'image',$error->getMessage()); } Modified: trunk/linpha2/get_thumb.php =================================================================== --- trunk/linpha2/get_thumb.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/get_thumb.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -32,16 +32,17 @@ */ try { - if(!isset( $_GET['id'] ) ) - { - throw new Exception("no id supplied!"); - } - include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); $linpha = new linpha(); $linpha->sql->startSession(); + + if( $linpha->template->idCurrent == 0 ) + { + throw new Exception("no valid id supplied!"); + } $thumbnail = new LinImage(); + /** * set necessary infos to display image if exists @@ -49,7 +50,7 @@ * * returns false if no permission */ - if( ! $thumbnail->createThumbnail($_GET['id']) ) + if( ! $thumbnail->createThumbnail($linpha->template->idCurrent) ) { throw new Exception("Error while creating thumbnail!<br />Error: ".$thumbnail->error_msg); } @@ -59,6 +60,7 @@ catch(Exception $error) { echo "Error: ".$error -> getMessage(); + linLog(LOG_TYPE_IMPORT,LOG_ERR,'thumbnail',$error->getMessage()); } Modified: trunk/linpha2/install/lib.install.php =================================================================== --- trunk/linpha2/install/lib.install.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/install/lib.install.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -72,40 +72,7 @@ return $str; } // end tr() -/** -* don't know where to place this part -* other.php is the only one which is also included during the installation -* any ideas? maybe we have to create a new file common_startup.php for example -* -* Note: The PATH_SEPARATOR was introduced with PHP 4.3.0-RC2. -*/ -if(!defined('PATH_SEPARATOR')) -{ - if(installGetOS()=='win') - { - define('PATH_SEPARATOR',';'); - } - else - { - define('PATH_SEPARATOR',':'); - } -} -/** - * getOS, use this name as getOS will be declard in linpha.class.php also - */ -function installGetOS() -{ - if(strtoupper(substr(PHP_OS,0,3)) == 'WIN') - { - return "win"; - } - else - { - return "unix"; - } -} - function installGetPATH($array_path) { /** Modified: trunk/linpha2/install/lib.requirements.php =================================================================== --- trunk/linpha2/install/lib.requirements.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/install/lib.requirements.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -24,7 +24,7 @@ */ function installCheckConvert() { - if(installGetOS()=='win') { + if( LIN_OS == 'win' ) { $convert = 'convert.exe'; } else { $convert = 'convert'; Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/install/sql/sql.data.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -88,9 +88,18 @@ 'sys_style_others_sortorder' => 'nameasc', + 'sys_user_autologin' => '1', - 'sys_user_autologin' => '1', - + + 'plugins_log_filename' => 'var/linpha.log', + 'plugins_log_syslog_enable' => '0', + 'plugins_log_syslog_add_events' => '', + 'plugins_log_email_enable' => '0', + 'plugins_log_email_add_events' => '', + 'plugins_log_email_to' => 'LinPHA Logger<log@'.$_SERVER["HTTP_HOST"].'>', + 'plugins_log_email_headers' => 'From:LinPHA Logger<noreply@'.$_SERVER["HTTP_HOST"].'>', + 'plugins_log_email_subject' => 'Linpha Log', + 'plugins_filemanager_enable' => '0', 'plugins_filemanager_nruploads' => '5' ); Modified: trunk/linpha2/install/step2_requirements.php =================================================================== --- trunk/linpha2/install/step2_requirements.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/install/step2_requirements.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -245,7 +245,7 @@ * checking posix extension * only if we are we are on unix */ - if(installGetOS() != "win") + if( LIN_OS != "win" ) { print_line_left("Posix Extension"); if(installCheckPosix()) Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -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); - } + }*/ + /** + * 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,'db',$s); //print "<p>$s</p>"; - trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + //trigger_error($s,ADODB_ERROR_HANDLER_TYPE); } ?> Modified: trunk/linpha2/lib/classes/archiver.config.php =================================================================== --- trunk/linpha2/lib/classes/archiver.config.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/archiver.config.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -43,7 +43,7 @@ * OR bzrudi AT tuxpower DOT de */ -switch(getOS()) +switch( LIN_OS ) { case 'unix': // tar @@ -188,7 +188,7 @@ /** * @todo !Freebyte Zip http://www.freebyte.com/fbzip/#cmd * @todo Ultimate Zip http://www.ultimatezip.com/download.htm -@todo Arj http://arj.sourceforge.net/ + * @todo Arj http://arj.sourceforge.net/ */ //$this->path_delimiter = ';'; Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -76,6 +76,17 @@ 'sys_style_layout_color_albumsbg' => "Albums Background Color", 'sys_style_layout_color_links' => "Links Color", 'sys_style_layout_color_linkshover' => "Links Hover Color", + + 'plugins_log_filename' => "Log to this filename", + 'plugins_log_syslog_enable' => "Send important messages to syslog", + 'plugins_log_syslog_add_events' => "Additional log events sent to syslog", + 'plugins_log_email_enable' => "Send important messages by email", + 'plugins_log_email_add_events' => "Additional log events sent by email", + 'plugins_log_email_to' => "Recipient", + 'plugins_log_email_headers' => "Extra headers", + 'plugins_log_email_subject' => "Subject", + + 'plugins_filemanager_enable' => "Enable Filemanager For Non-Admin Users", ); } @@ -308,6 +319,8 @@ 'sys_style_thumb_showsubfoldersseparate', 'sys_style_image_useeffects', 'sys_user_autologin', + 'plugins_log_syslog_enable', + 'plugins_log_email_enable', 'plugins_filemanager_enable' ); } Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.functions.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -244,7 +244,8 @@ /** - * linpha syslog window, shows up system info like "images added" + * LinPHA user logging function + * shows up system info in the browser like "images added" */ function linSysLog($str) { @@ -299,24 +300,7 @@ } } - /** - * returns the Operating System used - * used to enable/disable OS related features - */ -function getOS() -{ - if(strtoupper(substr(PHP_OS,0,3)) == 'WIN') - { - return "win"; - } - else - { - return "unix"; - } -} - -/** * returns an array with the sort orders */ function getSortOrders() @@ -376,7 +360,7 @@ */ function linEscapeString($str) { - if(getOS() == 'win') + if( LIN_OS == 'win' ) { /** * replace forward slash with backslash, need this for powerarchiver for @@ -578,6 +562,11 @@ } } +/** + * switch between Ajax and static view + * takes care if we explicit disable ajax + * even if we could use it + */ function useAjax() { if( isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax']) ) @@ -590,4 +579,219 @@ } } + +/** + * LinPHA internal logging function + * + * Types: + * LOG_TYPE_IMPORT + * LOG_TYPE_UPDATE + * LOG_TYPE_USER + * LOG_TYPE_DB + * LOG_TYPE_META + * LOG_TYPE_FILEMANAGER + * LOG_TYPE_GUESTBOOK + * + * Severity: + * LOG_EMERG 1 System ist unbrauchbar. + * LOG_ALERT 1 Aktion ist sofort erforderlich. + * LOG_CRIT 1 Kritischer Zustand. + * LOG_ERR 4 Fehler aufgetreten. + * LOG_WARNING 5 Warnung aufgetreten. + * LOG_NOTICE 6 Normale, aber wichtige, Meldung. + * LOG_INFO 6 Informative Meldung. + * LOG_DEBUG 6 Debug-Level-Meldung. + * + * Action: + * login, logout, rotate + * fm_others, fm_upload, fm_delete, fm_move, fm_copy, fm_rename, fm_create_folder, fm_perm + * + * + * @param string $type log types + * @param string $severity from notice - fatal error + * @param string $text + */ +define('LOG_TYPE_IMPORT', 0); +define('LOG_TYPE_UPDATE', 1); +define('LOG_TYPE_USER', 2); +define('LOG_TYPE_DB', 3); +define('LOG_TYPE_META', 4); +define('LOG_TYPE_FILEMANAGER', 5); +define('LOG_TYPE_GUESTBOOK', 6); +function linLog($type,$severity,$event,$text) +{ + switch($type) + { + case LOG_TYPE_IMPORT: $type_msg = 'IMPORT'; break; + case LOG_TYPE_UPDATE: $type_msg = 'UPDATE'; break; + case LOG_TYPE_USER: $type_msg = 'USER'; break; + case LOG_TYPE_DB: $type_msg = 'DATABASE'; break; + case LOG_TYPE_META: $type_msg = 'COMMENTS'; break; + case LOG_TYPE_FILEMANAGER: $type_msg = 'FILEMANAGER'; break; + case LOG_TYPE_GUESTBOOK: $type_msg = 'GUESTBOOK'; break; + } + + /** + * Set Log Severity Output Message + */ + switch($severity) + { + case LOG_EMERG: $severity_msg = 'EMERGENCY ERROR'; break; + //case LOG_ALERT: $severity_msg = 'ALERT'; break; // same as LOG_EMERG + //case LOG_CRIT: $severity_msg = 'CRITICAL ERROR'; break; // same as LOG_EMERG + case LOG_ERR: $severity_msg = 'ERROR'; break; + case LOG_WARNING: $severity_msg = 'WARNING'; break; + case LOG_NOTICE: $severity_msg = 'NOTICE'; break; + case LOG_INFO: $severity_msg = 'INFO'; break; + //case LOG_DEBUG: $severity_msg = 'DEBUG'; break; // same as LOG_DEBUG + } + + /** + * Setup Log Time Output Message & Remote IP + */ + $time = linStrftime(time()); + $ip = $_SERVER["REMOTE_ADDR"]; + if( !isset($_SESSION['user_name'])) { + $user = 'anonymous'; + } else { + $user = $_SESSION['user_name']; + } + + /** + * 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 + */ + $text = htmlspecialchars($text, ENT_QUOTES); + + /** + * Process Log + */ + if( !isset($GLOBALS['linpha']->sql->config->value) ) // database not connected! + { + error_log("$time | $severity_msg | $type_msg | $ip | $user | $text".LIN_NL, 3, LINPHA_DIR.'/var/db_error.log' ); + } + else + { + /** + * filename + */ + error_log("$time | $severity_msg | $type_msg | $ip | $user | $text".LIN_NL, 3, $GLOBALS['linpha']->sql->config->value['plugins_log_filename'] ); + + /** + * email + */ + if( $GLOBALS['linpha']->sql->config->value['plugins_log_email_enable'] ) + { + if( $severity <= LOG_WARNING OR + strpos($GLOBALS['linpha']->sql->config->value['plugins_log_email_add_events'], $event) !== false ) + { + mail( + $GLOBALS['linpha']->sql->config->value['plugins_log_email_to'], + $GLOBALS['linpha']->sql->config->value['plugins_log_email_subject'], + "$time | $severity_msg | $type_msg | $ip | $ip | $user | $text", + $GLOBALS['linpha']->sql->config->value['plugins_log_email_headers'] + ); + } + } + + /** + * syslog + */ + if( $GLOBALS['linpha']->sql->config->value['plugins_log_syslog_enable'] && + $severity <= LOG_WARNING ) + { + /** + * In Windows NT, use the following values of priority: + * 1 = error, + * 2-5 = warning + * 6 = info + */ + + if( LIN_OS == 'win' ) + { + if( $severity <= LOG_ERR ) + { + $severity = 1; + } + } + + syslog($severity, "LinPHA $severity_msg | $type_msg | $ip | $user | $text"); + } + } +} + +/** + * format user inputs and autoformat urls and mailaddresses + */ +function htmltag($post) +{ + $post = htmlspecialchars($post, ENT_QUOTES); + + //###### URL + // the next two parts converts http://linpha.sf.net to [url]http://linpha.sf.net[/url] + // and www.sourceforge.net to [url]http://www.sourceforge.net[/url] + // im the third part converts [url]http://linpha.sf.net[/url] to <a href="http://linpha.sf.net">http://linpha.sf.net</a> + + // 1. part + // detect url if it is after one of the following signs: ' ', '\r' or '\n' + $post=eregi_replace("([ \r\n])http://([^ ,\r\n]*)","\\1[url]http://\\2[/url]",$post); + $post=eregi_replace("([ \r\n])https://([^ ,\r\n]*)","\\1[url]https://\\2[/url]",$post); + $post=eregi_replace("([ \r\n])ftp://([^ ,\r\n]*)","\\1[url]ftp://\\2[/url]",$post); + $post=eregi_replace("([ \r\n])www\\.([^ ,\r\n]*)","\\1[url]http://www.\\2[/url]",$post); + + // 2. part + // detect url if the url is in the beginning of the string + $post=eregi_replace("^http://([^ ,\r\n]*)","[url]http://\\1[/url]",$post); + $post=eregi_replace("^https://([^ ,\r\n]*)","[url]https://\\1[/url]",$post); + $post=eregi_replace("^ftp://([^ ,\r\n]*)","[url]ftp://\\1[/url]",$post); + $post=eregi_replace("^www\\.([^ ,\r\n]*)","[url]http://www.\\1[/url]",$post); + + // 3. part + $post=preg_replace("/\[url\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=_blank>\\1</a>",$post); + $post=preg_replace("/\[url=(.*)\](.*)\[\/url\]/iUms","<a href=\"\\1\" target=_blank>\\2</a>",$post); + //##### + + + // e-mail + $post= eregi_replace('([_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z]+)+)','<a href="mailto:\\1">\\1</a>',$post); + + // formatting + $post = str_replace("[hr]","<hr>",$post); + $post=preg_replace("/\[b\](.*)\[\/b\]/iUms","<b>\\1</b>",$post); + $post=preg_replace("/\[i\](.*)\[\/i\]/iUms","<i>\\1</i>",$post); + $post=preg_replace("/\[s\](.*)\[\/s\]/iUms","<strike>\\1</strike>",$post); + $post=preg_replace("/\[u\](.*)\[\/u\]/iUms","<u>\\1</u>",$post); + $post=preg_replace("/\[h1\](.*)\[\/h1\]/iUms","<h1>\\1</h1>",$post); + $post=preg_replace("/\[h2\](.*)\[\/h2\]/iUms","<h2>\\1</h2>",$post); + $post=preg_replace("/\[h3\](.*)\[\/h3\]/iUms","<h3>\\1</h3>",$post); + $post=preg_replace("/\[h4\](.*)\[\/h4\]/iUms","<h4>\\1</h4>",$post); + $post=preg_replace("/\[h5\](.*)\[\/h5\]/iUms","<h5>\\1</h5>",$post); + + + //code + $post=preg_replace("/\[code\](.*)\[\/code\]/msiU", "<blockquote><pre><smallfont><hr>\\1<hr></smallfont></pre></blockquote>", $post); + + // image + $post=preg_replace("/\[img\](.*)\[\/img\]/iUms","<img src=\"\\1\" border=\"0\">",$post); + + // center + $post=preg_replace("/\[center\](.*)\[\/center\]/iUms","<center>\\1</center>",$post); + + // colors + $post=preg_replace("/\[green\](.*)\[\/green\]/iUms","<span style=\"color:green\">\\1</span>",$post); + $post=preg_replace("/\[yellow\](.*)\[\/yellow\]/iUms","<span style=\"color:yellow\">\\1</span>",$post); + $post=preg_replace("/\[red\](.*)\[\/red\]/iUms","<span style=\"color:red\">\\1</span>",$post); + $post=preg_replace("/\[blue\](.*)\[\/blue\]/iUms","<span style=\"color:blue\">\\1</span>",$post); + $post=preg_replace("/\[white\](.*)\[\/white\]/iUms","<span style=\"color:white\">\\1</span>",$post); + $post=preg_replace("/\[black\](.*)\[\/black\]/iUms","<span style=\"color:black\">\\1</span>",$post); + + $post=preg_replace("/\[color=(.*)\](.*)\[\/color\]/iUms","<span style=\"color:\\1\">\\2</span>",$post); + + // <br /> + $post= nl2br($post); + + return $post; +} + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -304,6 +304,8 @@ return false; } + linLog(LOG_TYPE_IMPORT,LOG_INFO,'thumbnail',"Creating thumbnail ".$this->photo_id); + /** * image thumbnail */ @@ -331,6 +333,7 @@ if( ! file_exists( $this->output_file ) ) { + $this->error_msg = "Output File Doesnt Exists"; return false; } } @@ -411,6 +414,8 @@ if( ! $this->isCached OR $this->force ) { + linLog(LOG_TYPE_IMPORT,LOG_INFO,'image',"Creating image ".$this->photo_id); + /** * include the create image script */ @@ -422,6 +427,7 @@ if( ! file_exists( $this->output_file ) ) { + $this->error_msg = "Output File Doesnt Exists"; return false; } @@ -603,19 +609,25 @@ * @param imageressource $src_img pointer to the source image * @param int $angle angle to rotate * @author flo - * @todo maybe we should use linpha_log if imagerotate() doesn't exists */ function imageRotateGd(& $src_img, $angle) { - if(function_exists('imagerotate') && $angle != "0") + if(function_exists('imagerotate')) { - /** - * flip $angle, because with this function, left means right, and right means left :-) - */ - $angle = 360 - $angle; - $angle = $angle % 360; - $src_img = imagerotate($src_img,$angle,0); + if($angle != "0") + { + /** + * flip $angle, because with this function, left means right, and right means left :-) + */ + $angle = 360 - $angle; + $angle = $angle % 360; + $src_img = imagerotate($src_img,$angle,0); + } } + else + { + linLog(LOG_TYPE_META,LOG_WARNING,'rotate',"Cannot rotate image becuase the function imagerotate() doesnt exists, consider upgrading your php version"); + } } } // end class linImage Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -36,7 +36,7 @@ public $photos; public $photos_filtered; public $use_javascript; -public $id_current, $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; +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 @@ -49,7 +49,7 @@ /** - * set current view and set fileinfos of $_GET['id'] + * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['id']) * @param string $modulname (album, browse, search, ...) */ function setCurrentView($modulename) @@ -58,13 +58,33 @@ $this->orderby = getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - if(isset($_GET['id']) && $_GET['id'] != 0) + if( $GLOBALS['linpha']->template->idCurrent == 0 ) { /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + $this->orderby = getSqlSortOrder($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 ".PREFIX."photos " . - "WHERE id = '".linSql::linAddslashes($_GET['id'])."'"); + "WHERE id = '".linSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); /** * check for valid id @@ -77,7 +97,6 @@ $this->md5sum = $current_data['md5sum']; $this->org_width = $current_data['width']; $this->org_height = $current_data['height']; - $this->id_current = $current_data['id']; /** * switch between thumb_view and img_view @@ -106,32 +125,10 @@ else // no valid id supplied { $this->mode = 'home'; - $this->id_current = 0; + $GLOBALS['linpha']->template->idCurrent = 0; } } - else // ( ! isset($_GET['id'] OR $_GET['id']==0) ) - { - $this->id_current = 0; - - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = getSqlSortOrder($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'; - } - } - } - if($this->mode == 'thumb' && isset($_GET['view'])) { $_SESSION['mode_thumbview'] = $_GET['view']; @@ -146,7 +143,7 @@ */ if( ! isset( $this->id_parent) ) { - $this->id_parent = $this->id_current; + $this->id_parent = $GLOBALS['linpha']->template->idCurrent; } } @@ -262,24 +259,36 @@ function setMenu() { /** + * Menu My Settings + */ + if($GLOBALS['linpha']->sql->isLoggedIn()) + { + if( $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] OR $GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->output['menu_My Settings']['filemanager'] = + array('name' => i18n("Filemanager"), 'value' => LINPHA_DIR.'/?cat=filemanager'); + } + } + + /** * Menu Admin */ if($GLOBALS['linpha']->sql->isAdmin()) { $GLOBALS['linpha']->template->output['menu_Admin']['import'] = - Array( + array( 'name' => i18n("Import"), - 'value' => Array( - Array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_DIR.'/admin/?cat=import&album_select[]='.$this->id_parent), - Array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') + 'value' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_DIR.'/admin/?cat=import&album_select[]='.$this->id_parent), + array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&force_update') ) ); $GLOBALS['linpha']->template->output['menu_Admin']['permissions'] = - Array( + array( 'name' => i18n("Permissions"), - 'value' => Array( - Array('name' => i18n("Set Permissions"), 'value' => LINPHA_DIR.'/admin/?cat=permissions_view&cmd=edit&id='.$this->id_current) + 'value' => array( + array('name' => i18n("Set Permissions"), 'value' => LINPHA_DIR.'/admin/?cat=permissions_view&cmd=edit&id='.$GLOBALS['linpha']->template->idCurrent) ) ); @@ -289,7 +298,7 @@ /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = Array( + $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = array( 'name' => i18n("Recreate This Thumbnail"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); @@ -307,7 +316,7 @@ $array = getSortOrders(); foreach($array AS $value) { - $array_sort_orders_links[] = Array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); + $array_sort_orders_links[] = array('name' => i18n($value), 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } $open_basket_link = LINPHA_DIR.'/?cat=basket'; @@ -317,12 +326,12 @@ case 'thumb': $GLOBALS['linpha']->template->output['menu_More']['basket'] = - Array( + 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) + '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) ) ); @@ -331,36 +340,36 @@ $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); foreach($array AS $value) { - $array_tn_sizes_links[] = Array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:set_tn_size('.$value.')'); + $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:set_tn_size('.$value.')'); } $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); foreach($array AS $value) { - $array_nr_links[] = Array('name' => $value, 'value' =>"javascript:set_nr_images('".$value."')"); + $array_nr_links[] = array('name' => $value, 'value' =>"javascript:set_nr_images('".$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"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = array('name' => i18n("Detail"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); $GLOBALS['linpha']->template->output['menu_More']['view'] = - Array( + 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) + '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) ) ); } else { $GLOBALS['linpha']->template->output['menu_More']['view'] = - Array( + array( 'name' => i18n("View"), - 'value' => Array( - Array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), + 'value' => array( + array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), ) ); } @@ -375,11 +384,11 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = - Array( + array( 'name' => i18n("Metainfo"), - 'value' => Array( - Array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), - Array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + 'value' => array( + array('name' => i18n("Edit Album Comment"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albcomment'), + array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ); } @@ -401,15 +410,15 @@ array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), array('name' => i18n("View at"), 'value' => array( - array('name' => '640x480', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width=1920&height=1200', 'target' => '_blank'), - array('name' => $this->org_width.'x'.$this->org_height.' '.i18n("Fullscreen").')', 'value' => LINPHA_DIR.'/get_image.php?id='.$this->id_current.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), + array('name' => '640x480', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), + array('name' => '800x600', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), + array('name' => '1024x768', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), + array('name' => '1280x800', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), + array('name' => '1280x960', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), + array('name' => '1280x1024', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), + array('name' => '1600x1200', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), + array('name' => '1920x1200', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), + array('name' => $this->org_width.'x'.$this->org_height.' '.i18n("Fullscreen").')', 'value' => LINPHA_DIR.'/get_image.php?id='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), ) ) ) @@ -436,10 +445,10 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = - Array( + array( 'name' => i18n("Metainfo"), - 'value' => Array( - Array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + 'value' => array( + array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ); } @@ -492,7 +501,7 @@ */ if( $GLOBALS['linpha']->sql->checkPermission('download')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_DIR.'/download_file.php?id='.$this->id_current.'">'. + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_DIR.'/download_file.php?id='.$GLOBALS['linpha']->template->idCurrent.'">'. '<img src="'.$GLOBALS['linpha']->template->layoutsimagespath.'/download.png" border="0" title="'.i18n("Download Image").'" />' .'</a>'."\n"; } @@ -534,7 +543,7 @@ { $thumbnail = new LinImage(); $_GET['force'] = true; - $thumbnail->createThumbnail($this->id_current); + $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); } break; case 'rotate_left': @@ -568,7 +577,7 @@ /** * coming from imgview, mode=viewImg */ - $_SESSION['basket_ids'][] = $this->id_current; + $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') { @@ -946,7 +955,7 @@ */ function viewHomeSetImages($key,$optionname,$sql) { - $GLOBALS['linpha']->template->output[$key] = Array(); + $GLOBALS['linpha']->template->output[$key] = array(); if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) { @@ -978,7 +987,7 @@ if(file_exists($path) && LinSql::photoIsAllowed($data['0'])) { - $GLOBALS['linpha']->template->output[$key][] = Array('id'=>$data['0'],'path'=>$path); + $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['0'],'path'=>$path); $i++; } } @@ -1024,12 +1033,12 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . "FROM ".PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); if( $query->EOF ) { $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->id_current."','".linSql::linAddslashes($_POST['author'])."'," . + "VALUES ('".time()."','".$GLOBALS['linpha']->template->idCurrent."','".linSql::linAddslashes($_POST['author'])."'," . "'".linSql::linAddslashes($_POST['comment'])."')"); } else // update @@ -1038,7 +1047,7 @@ "meta_time = '".time()."', ". "meta_author = '".linSql::linAddslashes($_POST['author'])."', " . "meta_comment = '".linSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->id_current."'"); + "WHERE md5sum = '".$GLOBALS['linpha']->template->idCurrent."'"); } } @@ -1105,7 +1114,7 @@ echo '<?xml version="1.0" ?>'."\n"; ?> <root> -<imgid><?php echo $this->id_current; ?></imgid> +<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> <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> @@ -1158,7 +1167,7 @@ */ function viewImgCommon() { - $this->src_file = LinSql::getFullImagePath( $this->id_current ); + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); $this->max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; $this->max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; @@ -1174,7 +1183,7 @@ $GLOBALS['linpha']->template->output['image_infos'] = MetaData::readInformations( $this->full_filename, $this->filename, $this->md5sum, $this->org_width, $this->org_height, $flag_nr=10 ); if(isset($_GET['force_update'])) { - LinImport::updateEntry( $this->id_current , dirname($this->full_filename) , $this->filename ); + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->full_filename) , $this->filename ); } } @@ -1224,7 +1233,7 @@ */ function viewImgStoreImageInformation() { - $this->full_filename = LinSql::getFullImagePath( $this->id_current ); + $this->full_filename = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); /** * set image informations @@ -1301,7 +1310,7 @@ */ foreach($this->photos_filtered AS $key=>$value) { - if($value['id'] == $this->id_current) + if($value['id'] == $GLOBALS['linpha']->template->idCurrent) { $this->current_key = $key; break; Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -152,6 +152,7 @@ catch(Exception $error) { linSysLog(i18n("Error during import files/folders").": ".$error -> getMessage()); + linLog(LOG_TYPE_IMPORT,LOG_ERR,'import_others',"Error during import files/folders: ".$error -> getMessage()); } } @@ -165,7 +166,8 @@ */ function addNewEntry( $parent_id , $dirname , $filename , $recursive ) { - linSysLog(i18n("New").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linSysLog(i18n("Import").': '.i18n("New").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_new',"New: ".$dirname.'/'.$filename); list($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate) = @@ -235,7 +237,9 @@ LinImport::deleteEntry( $data['id'], $full_filename.'/'.$data['name']); } - linSysLog(i18n("Delete Entry").': '.htmlspecialchars($full_filename,ENT_QUOTES)); + linSysLog(i18n("Import").': '.i18n("Delete").': '.htmlspecialchars($full_filename,ENT_QUOTES)); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_delete',"Delete: ".$full_filename); + /** * delete thumbnail and image in cache folder @@ -290,7 +294,9 @@ */ if($file_type != $data[0]) { - linSysLog(i18n("Detected a change of file_type in:")." ".htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linSysLog(i18n("Import").': '.i18n("Detected a change of file type, update entry of:").' '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_update',"Detected a change of file type, update entry of: ".$dirname.'/'.$filename); + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos " . "SET img_type = '".$file_type."', width = '".$org_width."', height = '".$org_height."', time_exif = '".$time_exif."', stats_numbers = '".$stats_number."' " . "WHERE id = '".$id."'"); @@ -310,8 +316,9 @@ */ if($md5sum != $data[1]) { - linSysLog(sprintf(i18n("File %s changed, updating data..."),htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES))); - + linSysLog(i18n("Import").': '.i18n("Detected a change of file data, update entry of:").' '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_update',"Detected a change of file data, update entry of: ".$dirname.'/'.$filename); + $GLOBALS['linpha']->db->Execute("UPDATE ".PREFIX."photos " . "SET md5sum = '".$md5sum."', width = '".$org_width."', height = '".$org_height."', time_mod = '".filemtime($dirname.'/'.$filename)."', time_exif = '".$time_exif."', rotate = '".$rotate."' WHERE id = '".$id."'"); @@ -381,22 +388,26 @@ $ext = LinFilesys::getFileExtFromPath($filename); if($filename{0} == '.') { - linSysLog(htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is Hidden")); + linSysLog(i18n("Import").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is Hidden")); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo',$dirname.'/'.$filename." Is Hidden"); $file_type = 9999999; } elseif( in_array( $filename, LinImport::getIgnoreFilelist() ) ) { - linSysLog(htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is In The Ignore List")); + linSysLog(i18n("Import").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is In The Ignore List")); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo',$dirname.'/'.$filename." Is In The Ignore List"); $file_type = 9999999; } elseif( in_array($ext, LinImport::getIgnoreFileext() ) ) { - linSysLog(htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is In The Ignore List")); + linSysLog(i18n("Import").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is In The Ignore List Of File Types")); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo',$dirname.'/'.$filename." Is In The Ignore List Of File Types"); $file_type = 9999999; } elseif( !is_readable( $dirname.'/'.$filename) ) { - linSysLog(htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is Not Readable")); + linSysLog(i18n("Import").': '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)." ".i18n("Is Not Readable")); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo',$dirname.'/'.$filename." Is Not Readable"); $file_type = 9999999; } /** @@ -465,7 +476,8 @@ } else { - linSysLog('Error: what am i? '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linSysLog(i18n("Import").': Error: what am i? '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); + linLog(LOG_TYPE_IMPORT,LOG_NOTICE,'import_fileinfo','Error: what am i? '.htmlspecialchars($dirname.'/'.$filename,ENT_QUOTES)); } return array($md5sum,$file_type,$org_width,$org_height,$stats_number,$time_exif,$rotate); Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -125,7 +125,7 @@ $value = htmlspecialchars($meta_data['meta_data'],ENT_QUOTES); } } - case 'id': + case 'id': // own fields $meta_data = $GLOBALS['linpha']->db->GetRow("SELECT meta_data " . "FROM ".PREFIX."meta_data " . "WHERE field_id = '".$data['id']."' " . Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-10-31 23:05:16 UTC (rev 4611) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-11-01 17:54:09 UTC (rev 4612) @@ -67,7 +67,14 @@ } else { - die("Error: cannot get config file 'config.sql.php'"); + linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to the database !!! Cannot get config file ./var/config.sql.php"); + + echo "Cannot connect to the database, please contact admin!!!<br />"; + echo "Cannot get config file './var/config.sql.php'<br />"; + + include(LINPHA_DIR."/include/db_connect_error.html"); + + exit(1); } } @@ -144,6 +151,15 @@ } else { + if( isset($GLOBALS['linpha']->db) ) + { + linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to database: ".$GLOBALS['linpha']->db->ErrorMsg()); + } + else + { + linLog(LOG_TYPE_DB,LOG_EMERG,'db_connect',"Cannot connect to database!"); + } + include(LINPHA_DIR."/include/db_connect_error.html"); } exit(1); @@ -152,7 +168,7 @@ /** * register sub class linSqlConfig - * (not during install, because we wont have any config table yet) + * (not during install, because we dont have any config table yet) */ if( ! isset($_SESSION['installmode2']) ) { @@ -185,7 +201,13 @@ * syslog after loggin in */ $GLOBALS['linpha']->template = new linTemplate(); - + + if(!isset($_GET['id'])) { + $GLOBALS['linpha']->template->idCurrent = 0; + } else { + $GLOBALS['linpha']->template->idCurrent = intval($_GET['id']); + } + session_name('linpha2'); session_start(); @@ -202,7 +224,7 @@ "AND password = '".LinSql::linAddslashes($_COOKIE['linpha_password'])."'"); if($data = $query->FetchRow()) { - //linpha_log('login','notice','User '.$_POST['user_name'].": successfully logged in."); + linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$_P... [truncated message content] |