[Linpha-cvs] SF.net SVN: linpha: [4805] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-12-09 13:15:36
|
Revision: 4805 http://linpha.svn.sourceforge.net/linpha/?rev=4805&view=rev Author: bzrudi Date: 2007-12-09 05:15:30 -0800 (Sun, 09 Dec 2007) Log Message: ----------- "fixed a couple of notices and warnings introduced by new plugin model" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.imgview.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-12-02 21:46:57 UTC (rev 4804) +++ trunk/linpha2/ChangeLog 2007-12-09 13:15:30 UTC (rev 4805) @@ -1,3 +1,6 @@ +2007-12-09 bzrudi + * fix for db_error.log file create + * fixed a couple of notices and warnings introduced by new plugin model 2007-12-02 flo * created settings and permissions section for plugins Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2007-12-02 21:46:57 UTC (rev 4804) +++ trunk/linpha2/lib/classes/linpha.functions.php 2007-12-09 13:15:30 UTC (rev 4805) @@ -602,55 +602,85 @@ */ if( !isset($GLOBALS['linpha']->sql->config->value) ) // database not connected! { - error_log("$time | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LINPHA_DIR.'/var/db_error.log' ); + error_log("".time()." | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LINPHA_DIR.'/var/db_error_tmp.log' ); } else { - /** - * filename - */ - error_log("$time | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LinFilesys::getFullPath($GLOBALS['linpha']->sql->config->value['plugins_log_filename']) ); - - /** - * email - */ - 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 + * Only if logging plugin is enabled */ - if( $GLOBALS['linpha']->sql->config->value['plugins_log_syslog_enable'] && - $severity <= LOG_WARNING ) - { - /** + if(isset($GLOBALS['linpha']->sql->config->value['plugins_log_enable']) && + $GLOBALS['linpha']->sql->config->value['plugins_log_enable'] == '1') + { + /** + * In case of database connection error a file named + * db_error_tmp.log is created. If the file exists, copy it's content + * over to the default filename defined in plugins_log_filename + * and delete it later for security reasons. We have to go this way, + * as a random filename would create a new file every time an error + * occured, and a defined filenname is not the best choice for + * security reasons. + * bzrudi + */ + if(file_exists(LINPHA_DIR.'/var/db_error_tmp.log')) + { + $fhandle = @file(LINPHA_DIR.'/var/db_error_tmp.log'); + if(is_array($fhandle)) + { + foreach($fhandle AS $line) + { + error_log("$line", 3, LinFilesys::getFullPath($GLOBALS['linpha']->sql->config->value['plugins_log_filename'])); + } + unlink(LINPHA_DIR.'/var/db_error_tmp.log'); + } + } + + /** + * filename + */ + error_log("$time | $severity_msg | $type_msg | $ip | $user | $event | $text".LIN_NL, 3, LinFilesys::getFullPath($GLOBALS['linpha']->sql->config->value['plugins_log_filename']) ); + + /** + * email + */ + 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 | $event | $text"); - } + + if( LIN_OS == 'win' ) + { + if( $severity <= LOG_ERR ) + { + $severity = 1; + } + } + + syslog($severity, "LinPHA $severity_msg | $type_msg | $ip | $user | $event | $text"); + } + } } } Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2007-12-02 21:46:57 UTC (rev 4804) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2007-12-09 13:15:30 UTC (rev 4805) @@ -279,7 +279,9 @@ */ if($GLOBALS['linpha']->sql->isLoggedIn()) { - if( $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] OR $GLOBALS['linpha']->sql->isAdmin()) + if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 + OR $GLOBALS['linpha']->sql->isAdmin()) { $GLOBALS['linpha']->template->output['menu_My Settings']['filemanager'] = array('name' => i18n("Filemanager"), 'value' => LINPHA_LINK.'&linCat=filemanager'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |