1
0

cleanup prepare

This commit is contained in:
Ian
2015-01-18 17:42:12 +01:00
parent 1025ec5748
commit 8a464c060f

View File

@ -1,7 +1,6 @@
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
# Improved by Vladimir Ajgl (vlada@ajgl.cz) 2008-01-26
if (IN_serendipity !== true) {
die ("Don't hack!");
@ -1096,8 +1095,8 @@ function serendipity_syncThumbs($deleteThumbs = false) {
global $serendipity;
$i = 0;
$files = serendipity_fetchImages();
$files = serendipity_fetchImages();
$fcount = count($files);
for ($x = 0; $x < $fcount; $x++) {
@ -1144,8 +1143,7 @@ function serendipity_syncThumbs($deleteThumbs = false) {
}
} else {
// Calculate correct thumbnail size from original image
$expect = serendipity_calculate_aspect_size(
$fdim[0], $fdim[1], $serendipity['thumbSize'], $serendipity['thumbConstraint']);
$expect = serendipity_calculate_aspect_size($fdim[0], $fdim[1], $serendipity['thumbSize'], $serendipity['thumbConstraint']);
// Check actual thumbnail size
if ($tdim[0] != $expect[0] || $tdim[1] != $expect[1]) {
// This thumbnail is incorrect; delete it so
@ -1504,11 +1502,15 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
// in the database
$nCount = 0;
if ($debug) echo "<p>Image Sync Right: " . serendipity_checkPermission('adminImagesSync') . " Onthefly Sync: " . $serendipity['onTheFlySynch'] . " Hash: " . $serendipity['current_image_hash'] . "!=" . $serendipity['last_image_hash']. "</p>";
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 "<p>Got images: <pre>" . print_r($aResultSet, true) . "</pre></p>";
if (is_array($aResultSet)) {
foreach ($aResultSet AS $sKey => $sFile) {
serendipity_plugin_api::hook_event('backend_thumbnail_filename_select', $sFile);
@ -1520,13 +1522,16 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
}
$sFileName = $sFile['path'] . $sFile['name'] . (empty($sFile['extension']) ? '' : '.' . $sFile['extension']);
if ($debug) echo "<p>File name is $sFileName, thumbnail is $sThumbNailFile</p>";
unset($aResultSet[$sKey]);
if (isset($aFilesOnDisk[$sFileName])) {
unset($aFilesOnDisk[$sFileName]);
} else {
if ($debug) echo "<span class='block_level'>Deleting Image {$sFile['id']}</span>";
serendipity_deleteImage($sFile['id']);
++$nCount;
}
@ -1540,7 +1545,9 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
serendipity_set_config_var('last_image_hash', $serendipity['current_image_hash'], 0);
$aUnmatchedOnDisk = array_keys($aFilesOnDisk);
if ($debug) echo "<p>Got unmatched files: <pre>" . print_r($aUnmatchedOnDisk, true) . "</pre></p>";
$nCount = 0;
foreach ($aUnmatchedOnDisk AS $sFile) {
if (preg_match('@\.' . $serendipity['thumbSuffix'] . '\.@', $sFile)) {
@ -1664,7 +1671,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
/**
* Generate the url-parameters needed when generating the ML to select an image to add to the editor, to store the relevant options (like which textare to add it to)
*
* */
*/
function serendipity_generateImageSelectorParems() {
global $serendipity;
$sortParams = array('perpage', 'order', 'ordermode');
@ -3565,8 +3572,8 @@ function &serendipity_getMediaPaths() {
$aExclude = array("CVS" => true, ".svn" => true, "_vti_cnf" => true); // add _vti_cnf to exclude possible added servers frontpage extensions
serendipity_plugin_api::hook_event('backend_media_path_exclude_directories', $aExclude);
$paths = array();
$paths = array();
$aResultSet = serendipity_traversePath(
$serendipity['serendipityPath'] . $serendipity['uploadPath'],
'',