|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /home/jackjohn/public_html/imagemanager/ |
Upload File : |
<?php
/**
* edit_image.php
*
* @package MCImageManager.pages
* @author Moxiecode
* @copyright Copyright © 2006, Moxiecode Systems AB, All rights reserved.
*/
require_once("includes/general.php");
$data = array();
verifyAccess($mcImageManagerConfig);
$path = getRequestParam("path", "");
$orgpath = getRequestParam("orgpath", "");
$action = getRequestParam("action", "");
$status = getRequestParam("status", "");
$msg = getRequestParam("msg", "");
$rootpath = toUnixPath(getRealPath($mcImageManagerConfig, 'filesystem.rootpath'));
$fileFactory =& new FileFactory($mcImageManagerConfig, $rootpath);
$targetFile =& $fileFactory->getFile($path);
$config = $targetFile->getConfig();
$wwwroot = removeTrailingSlash(toUnixPath(getWWWRoot($config)));
$tools = explode(',', $config['thumbnail.image_tools']);
if (!in_array("edit", $tools))
trigger_error("The thumbnail.image_tools needs to include edit.", FATAL);
if ($targetFile->isDirectory())
trigger_error("You may not edit directories.", WARNING);
$dir = $targetFile->getParentFile();
if (!$dir->canWrite())
trigger_error("You don't have write access to the directory.", FATAL);
// Delete old files
$files = $dir->listFiles();
foreach ($files as $file) {
if (strpos($file->getName(), "mcic_") === 0 && time() - $file->lastModified() > 3600)
$file->delete();
}
$urlprefix = removeTrailingSlash(toUnixPath($config['preview.urlprefix']));
$urlsuffix = toUnixPath($config['preview.urlsuffix']);
$pos = strpos($path, $wwwroot);
if ($pos !== false && $pos == 0)
$data['src'] = $urlprefix . substr($path, strlen($wwwroot)) . $urlsuffix;
else
$data['src'] = "";
if (!$orgpath)
$orgpath = $path;
$data['src'] .= "?rnd=" . time();
$data['orgpath'] = $orgpath;
$data['action'] = $action;
$data['status'] = $status;
$data['path'] = $path;
$data['msg'] = $msg;
$data['filename'] = basename($orgpath);
$data['demo'] = checkBool($config['general.demo']) ? "true" : "false";
$data['demo_msg'] = $config['general.demo_msg'];
// Render output
renderPage("edit_image.tpl.php", $data);
?>