From: brockhaus Date: Tue, 7 Aug 2007 14:17:49 +0000 (+0000) Subject: On the fly update of the media databas: Not only images are added but video and audio... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=876b0495500471013dbbf3f71aa367541311fdab;p=s9y.git On the fly update of the media databas: Not only images are added but video and audio, too. --- diff --git a/docs/NEWS b/docs/NEWS index 25d64da..6a0fe82 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.3 () ------------------------------------------------------------------------ + * On the fly update of the media databas: Not only images are added + but video and audio, too. (brockhaus) + * New spam blocking method for trackbacks: ip validation. The senders ip is compared with the ip of the host, the trackback is set to. If they don't match, the trackback is rejected/moderated. diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php index 9a43c9a..7a3adec 100644 --- a/include/functions_images.inc.php +++ b/include/functions_images.inc.php @@ -1407,7 +1407,8 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa // in the database $nCount = 0; - if ($serendipity['onTheFlySynch'] && serendipity_checkPermission('adminImagesSync') && $serendipity['current_image_hash'] != $serendipity['last_image_hash']) { + if ($debug) echo "

Image Sync Right: " . serendipity_checkPermission('adminImagesSync') . " Onthefly Sync: " . $serendipity['onTheFlySynch'] . " Hash: " . $serendipity['current_image_hash'] . "!=" . $serendipity['last_image_hash']. "

"; + if ($serendipity['onTheFlySynch'] && serendipity_checkPermission('adminImagesSync') && ($debug || ($serendipity['current_image_hash'] != $serendipity['last_image_hash']))) { $aResultSet = serendipity_db_query("SELECT path, name, extension, thumbnail_name, id FROM {$serendipity['dbPrefix']}images", false, 'assoc'); if ($debug) echo "

Got images:

" . print_r($aResultSet, true) . "

"; @@ -1454,7 +1455,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa // MTG: 21/01/06: put files which have just 'turned up' into the database $aImageData = serendipity_getImageData($sFile); - if (serendipity_isImage($aImageData)) { + if (serendipity_isMedia($aImageData)) { $nPos = strrpos($sFile, "/"); if (is_bool($nPos) && !$nPos) { $sFileName = $sFile; @@ -1587,6 +1588,49 @@ function serendipity_isImage(&$file, $strict = false) { return (0 === strpos(strtolower($file['displaymime']), 'image/')); } +/** + * Check if a media item is a video + * + * @access public + * @param array File information + * @return boolean True if the file is a video + */ +function serendipity_isVideo($file) { + global $serendipity; + + $file['displaymime'] = $file['mime']; + + return (0 === strpos(strtolower($file['displaymime']), 'video/')); +} + +/** + * Check if a media item is an audio + * + * @access public + * @param array File information + * @return boolean True if the file is an audio + */ +function serendipity_isAudio($file) { + global $serendipity; + + $file['displaymime'] = $file['mime']; + + return (0 === strpos(strtolower($file['displaymime']), 'audio/')); +} + +/** + * Check if a media item is a media file (image, video or audio) + * + * @access public + * @param array File information + * @return boolean True if the file is an audio + */ +function serendipity_isMedia(&$file, $strict = false) { + global $serendipity; + + return serendipity_isImage($file, $strict) || serendipity_isVideo($file) || serendipity_isAudio($file); +} + /** * Recursively delete a directory tree *