diff options
| author | Lester Caine ext:(%22) <lester@lsces.co.uk> | 2012-05-07 00:59:58 +0100 |
|---|---|---|
| committer | Lester Caine ext:(%22) <lester@lsces.co.uk> | 2012-05-07 00:59:58 +0100 |
| commit | ff3272433b6a347a249db852ea61cedbcffc04c7 (patch) | |
| tree | 29a468c4c6d9ce6f101e54ee2916ef8080d2a2a6 | |
| parent | e97a3ea68b7f3c0d9231cab5a9d52ad52ee316b8 (diff) | |
| download | liberty-ff3272433b6a347a249db852ea61cedbcffc04c7.tar.gz liberty-ff3272433b6a347a249db852ea61cedbcffc04c7.tar.bz2 liberty-ff3272433b6a347a249db852ea61cedbcffc04c7.zip | |
Split static log functionality from dyanamic section
| -rw-r--r-- | LibertyComment.php | 2 | ||||
| -rw-r--r-- | LibertyContent.php | 54 | ||||
| -rw-r--r-- | plugins/mime.video.php | 30 |
3 files changed, 55 insertions, 31 deletions
diff --git a/LibertyComment.php b/LibertyComment.php index eb0aaf2..062d42b 100644 --- a/LibertyComment.php +++ b/LibertyComment.php @@ -377,7 +377,7 @@ class LibertyComment extends LibertyMime { return parent::getDisplayLink( $pLinkText, $pMixed, $anchor ); } - function getList( $pParamHash ) { + function getList( &$pParamHash ) { global $gBitSystem, $gLibertySystem; if ( !isset( $pParamHash['sort_mode']) or $pParamHash['sort_mode'] == '' ){ $pParamHash['sort_mode'] = 'created_desc'; diff --git a/LibertyContent.php b/LibertyContent.php index 87f2537..96eaf54 100644 --- a/LibertyContent.php +++ b/LibertyContent.php @@ -3169,13 +3169,47 @@ class LibertyContent extends LibertyBase { * Note: use $gBitSystem throughout that this function can be called statically if needed * * @param array $pParamHash - * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ - function storeActionLog( $pParamHash = NULL ) { + public static function storeActionLogFromHash( $pParamHash = NULL ) { global $gBitSystem; - if( $gBitSystem->isFeatureActive( 'liberty_action_log' ) && LibertyContent::verifyActionLog( $pParamHash ) ) { + if( $gBitSystem->isFeatureActive( 'liberty_action_log' ) && $this->verifyActionLog( $pParamHash ) ) { + $gBitSystem->mDb->associateInsert( BIT_DB_PREFIX."liberty_action_log", $pParamHash['action_log_store'] ); + } + } + + /** + * storeActionLog + * Note: use $gBitSystem throughout that this function can be called statically if needed + * + * @param array $pParamHash + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + public function storeActionLog( $pParamHash = NULL ) { + global $gBitSystem; + + if( !empty( $this ) && @BitBase::verifyId( $this->mContentId ) ) { + $pParamHash['action_log']['content_id'] = $this->mContentId; + } + if( !empty( $this->mInfo['title'] ) ) { + $pParamHash['action_log']['title'] = $this->mInfo['title']; + } + $log_message = ''; + if( empty( $pParamHash['action_log']['log_message'] ) && !empty( $this->mLogs ) ) { + foreach( $this->mLogs as $key => $msg ) { + $log_message .= "$msg"; + } + $pParamHash['action_log']['log_message'] = $log_message; + } + $error_message = ''; + if( empty( $pParamHash['action_log']['error_message'] ) && !empty( $this->mErrors ) ) { + foreach( $this->mErrors as $key => $msg ) { + $error_message .= "$msg\n"; + } + $pParamHash['action_log']['error_message'] = $error_message; + } + if( $gBitSystem->isFeatureActive( 'liberty_action_log' ) && static::verifyActionLog( $pParamHash ) ) { $gBitSystem->mDb->associateInsert( BIT_DB_PREFIX."liberty_action_log", $pParamHash['action_log_store'] ); } } @@ -3186,10 +3220,9 @@ class LibertyContent extends LibertyBase { * Note: use $gBitSystem throughout that this function can be called statically if needed * * @param array $pParamHash - * @access public * @return TRUE on success, FALSE on failure */ - function verifyActionLog( &$pParamHash ) { + public static function verifyActionLog( &$pParamHash ) { global $gBitUser, $gBitSystem; // we will set $ret FALSE if there is a problem along the way @@ -3201,10 +3234,7 @@ class LibertyContent extends LibertyBase { $pParamHash['action_log_store']['content_id'] = $pParamHash['action_log']['content_id']; } elseif( @BitBase::verifyId( $pParamHash['content_id'] ) ) { $pParamHash['action_log_store']['content_id'] = $pParamHash['content_id']; - } elseif( !empty( $this ) && @BitBase::verifyId( $this->mContentId ) ) { - $pParamHash['action_log_store']['content_id'] = $this->mContentId; } - // generic information needed in log if( !empty( $pParamHash['action_log']['user_id'] ) ) { $pParamHash['action_log_store']['user_id'] = $pParamHash['action_log']['user_id']; @@ -3215,8 +3245,6 @@ class LibertyContent extends LibertyBase { $pParamHash['action_log_store']['title'] = $pParamHash['action_log']['title']; } elseif( !empty( $pParamHash['content_store']['title'] ) ) { $pParamHash['action_log_store']['title'] = $pParamHash['content_store']['title']; - } elseif( !empty( $this ) && !empty( $this->mInfo['title'] ) ) { - $pParamHash['action_log_store']['title'] = $this->mInfo['title']; } else { $ret = FALSE; } @@ -3249,11 +3277,7 @@ class LibertyContent extends LibertyBase { } // error message - default is to put in any stuff in mErrors $error_message = ''; - if( empty( $pParamHash['action_log']['error_message'] ) && !empty( $this ) && !empty( $this->mErrors ) ) { - foreach( $this->mErrors as $key => $msg ) { - $error_message .= "$msg\n"; - } - } elseif( !empty( $pParamHash['action_log']['error_message'] ) ) { + if( !empty( $pParamHash['action_log']['error_message'] ) ) { $error_message = $pParamHash['action_log']['error_message']; } diff --git a/plugins/mime.video.php b/plugins/mime.video.php index ba419b6..d05d4cd 100644 --- a/plugins/mime.video.php +++ b/plugins/mime.video.php @@ -57,7 +57,7 @@ $gLibertySystem->registerPlugin( PLUGIN_MIME_GUID_VIDEO, $pluginParams ); /** * mime_video_preload This function is loaded on every page load before anything happens and is used to load required scripts. - * + * * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ @@ -68,7 +68,7 @@ function mime_video_preload() { /** * Store the data in the database - * + * * @param array $pStoreRow File data needed to store details in the database - sanitised and generated in the verify function * @access public * @return TRUE on success, FALSE on failure - $pStoreRow['errors'] will contain reason @@ -90,9 +90,9 @@ function mime_video_store( &$pStoreRow ) { } /** - * mime_video_update - * - * @param array $pStoreRow + * mime_video_update + * + * @param array $pStoreRow * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ @@ -139,7 +139,7 @@ function mime_video_update( &$pStoreRow, $pParams = NULL ) { /** * Load file data from the database - * + * * @param array $pFileHash Contains all file information * @param array $pPrefs Attachment preferences taken liberty_attachment_prefs * @param array $pParams Parameters for loading the plugin - e.g.: might contain values from the view page @@ -172,8 +172,8 @@ function mime_video_load( $pFileHash, &$pPrefs, $pParams = NULL ) { /** * This function will add an entry to the process queue for the cron job to take care of - * - * @param array $pContentId + * + * @param array $pContentId * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ @@ -202,8 +202,8 @@ function mime_video_add_process( $pStoreRow ) { /** * Convert a stored video file to flashvideo - * - * @param array $pParamHash + * + * @param array $pParamHash * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ @@ -481,7 +481,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { $pParamHash['log'] = $log; // we'll add an entry in the action logs - LibertyContent::storeActionLog( array( 'action_log' => $actionLog )); + LibertyContent::storeActionLogFromHash( array( 'action_log' => $actionLog )); // return the log $pParamHash['log'] = $log; @@ -491,7 +491,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { /** * This function will create a thumbnail for a given video - * + * * @param string $pFile path to video file * @param numric $pOffset Offset in seconds to use to create thumbnail from * @access public @@ -544,7 +544,7 @@ function mime_video_create_thumbnail( $pFile, $pOffset = 60 ) { /** * mime_video_calculate_videosize Calculate the display video size - * + * * @param array $pFileHash File information including attachment_id * @param array $pCommonObject common object - calculations will be stored in $pCommonObject->mStoragePrefs * @access public @@ -580,8 +580,8 @@ function mime_video_calculate_videosize( &$pMetaData, $pParams ) { /** * mime_video_fix_streaming will make sure the MOOV atom is at the beginning of the MP4 file to enable streaming - * - * @param array $pVideoFile + * + * @param array $pVideoFile * @access public * @return string shell result on success, FALSE on failure */ |
