1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8// This script may only be included - so its better to die if called directly. 9if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) { 10 header('location: index.php'); 11 exit; 12} 13 14$imagegallib = TikiLib::lib('imagegal'); 15 16if (isset($_REQUEST['galfeatures'])) { 17 // Check for last character being a / or a \ 18 // My next commit is to create a clas to put this code into 19 // TODO Do not modify $_REQUEST variable directly 20 if (substr($_REQUEST['gal_use_dir'], -1) != '\\' 21 && substr($_REQUEST['gal_use_dir'], -1) != '/' 22 && $_REQUEST['gal_use_dir'] != '' 23 ) { 24 $_REQUEST['gal_use_dir'] .= '/'; 25 } 26 27 if (substr($_REQUEST['gal_batch_dir'], -1) != '\\' 28 && substr($_REQUEST['gal_batch_dir'], -1) != '/' 29 && $_REQUEST['gal_batch_dir'] != '' 30 ) { 31 $_REQUEST['gal_batch_dir'] .= '/'; 32 } 33} 34 35//*** begin state-changing actions 36if (isset($_POST['rmvorphimg']) && $access->checkCsrfForm(tra('Remove orphan images?'))) { 37 $adminlib->remove_orphan_images(); 38 Feedback::success(tra('Orphan images successfully removed')); 39} 40 41if (isset($_POST['mvimg']) && isset($_POST['move_gallery']) && $access->checkCsrf()) { 42 if (($_POST['mvimg'] == 'to_fs' && $prefs['gal_use_db'] == 'n') 43 || ($_POST['mvimg'] == 'to_db' && $prefs['gal_use_db'] == 'y') 44 ) { 45 $mvresult = $imagegallib->move_gallery_store($_POST['move_gallery'], $_POST['mvimg']); 46 $mvmsg = sprintf(tra('moved %d images, %d errors occurred.'), $mvresult['moved_images'], $mvresult['errors']); 47 if ($mvresult['timeout']) { 48 $mvmsg .= ' ' . tra('a timeout occurred. Hit the reload button to move the rest'); 49 } 50 Feedback::note($mvmsg); 51 } 52} 53//*** end state-changing actions 54 55$galleries = $imagegallib->list_visible_galleries(0, -1, 'name_desc', 'admin', ''); 56$smarty->assign_by_ref('galleries', $galleries['data']); 57$smarty->assign('max_img_upload_size', $imagegallib->max_img_upload_size()); 58