public static function decode($path) { $p = array('$modules' => ZPATH_MODULES); $path = strtr($path, $p); $path = path::clean($path); return $path; }
public function actionSelect($field = '', $dir = '') { $dir = empty($dir) ? zotop::get('dir') : $dir; $dir = trim(url::decode($dir), '/'); $path = site::template(); $path = $path . DS . str_replace('/', DS, $dir); $path = path::clean($path); $folders = folder::folders($path); $files = folder::files($path); $position = '<a href="' . zotop::url('system/template/select') . '">' . zotop::t('根目录') . '</a><em> : //</em> '; if (!empty($dir)) { $dirs = arr::dirpath($dir, '/'); foreach ($dirs as $d) { $position .= '<a href="' . zotop::url('system/template/select', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a> <em>/</em>'; } } $page = new dialog(); $page->title = zotop::t('模板管理'); $page->set('field', $field); $page->set('dir', $dir); $page->set('position', $position); $page->set('folders', $folders); $page->set('files', $files); $page->display(); }
public static function decode($path) { $p = array('$system' => ZOTOP_PATH_SYSTEM, '$modules' => ZOTOP_PATH_MODULES); $path = strtr($path, $p); $path = path::clean($path); return $path; }
/** * 删除文件 * @param string $file * @return boolean */ public static function delete($file) { if (file::exists($file)) { $file = path::clean($file); return @unlink($file); } return true; }
public function includeFile($attr) { if (!isset($attr['src'])) { return; } $src = path::clean($attr['src']); $tpl_file = $this->getFilePath($src); if (!$tpl_file) { return; } if (in_array($tpl_file, $this->compile_stack)) { return; } return '<?php try { ' . 'echo ' . $this->self_name . "->getData('" . str_replace("'", "\\'", $src) . "'); " . '} catch (Exception $e) {} ?>'; }
public function install($id, $path = '') { $path = empty($path) ? $id : $path; $modulePath = ZOTOP_MODULES . DS . $id; $modulePath = path::clean($modulePath); $moduleFile = $modulePath . DS . 'module.php'; $module = @(include $moduleFile); $module['path'] = $path; $module['type'] = '1'; $module['url'] = $path; $module['status'] = 1; $module['order'] = $this->max() + 1; $module['installtime'] = time::now(); $module['updatetime'] = time::now(); if (is_array($module)) { $insert = $this->insert($module); if ($insert) { return $this->reload(); } } return false; }
public function actionIndex($dir = '') { $dir = url::clean($dir); $path = ZOTOP_PATH_ROOT . DS . trim($dir, DS); $path = path::clean($path); //获取当前目录的子目录及子文件 $folders = (array) dir::folders($path); $files = (array) dir::files($path); $position = '<a href="' . zotop::url('webftp/index/index') . '">wwwroot</a>'; $dirs = arr::dirpath($dir, '/'); foreach ($dirs as $d) { $position .= ' / <a href="' . zotop::url('webftp/index/index', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a>'; } $page = new page(); $page->title = '文件管理器'; $page->set('position', $position); $page->set('navbar', $this->navbar($dir)); $page->set('folders', $folders); $page->set('files', $files); $page->set('path', $path); $page->set('dir', $dir); $page->display(); }
public static function file($file, $value = '', $expire = 0) { static $files = array(); $file = path::clean($file); //echo $file.'<br>'; if ('' !== $value) { if (is_null($value)) { $result = unlink($file); if ($result) { unset($files[$file]); } return $result; } else { $content = "<?php\nif (!defined('ZOTOP')) exit();\n//" . sprintf('%012d', $expire) . "\nreturn " . var_export($value, true) . ";\n?>"; $result = file_put_contents($file, $content); $files[$file] = $value; } return true; } if (isset($files[$file])) { return $files[$file]; } if (file_exists($file) && false !== ($content = file_get_contents($file))) { //注意:Dreamweaver会在文件最前面插入两个未知字符,39 $expire = (int) substr($content, strpos($content, '//') + 2, 12); if ($expire != 0 && time() > filemtime($file) + $expire) { //过期删除 unlink($file); return false; } $value = eval(substr($content, strpos($content, '//') + 14, -2)); $files[$file] = $value; } else { $value = false; } return $value; }
private function newMediaObject($blog_id, $user, $pwd, $file) { if (empty($file['name'])) { throw new Exception('No file name'); } if (empty($file['bits'])) { throw new Exception('No file content'); } $file_name = $file['name']; $file_bits = base64_decode($file['bits']); $this->setUser($user, $pwd); $this->setBlog(); $media = new dcMedia($this->core); $dir_name = path::clean(dirname($file_name)); $file_name = basename($file_name); $dir_name = preg_replace('!^/!', '', $dir_name); if ($dir_name != '') { $dir = explode('/', $dir_name); $cwd = './'; foreach ($dir as $v) { $v = files::tidyFileName($v); $cwd .= $v . '/'; $media->makeDir($v); $media->chdir($cwd); } } $media_id = $media->uploadBits($file_name, $file_bits); $f = $media->getFile($media_id); return array('file' => $file_name, 'url' => $f->file_url, 'type' => files::getMimeType($file_name)); }
/** * Remove item * * Removes a directory <var>$d</var> which is relative to working directory. * * @param string $d Directory to remove */ public function removeDir($d) { $d = path::real($this->pwd . '/' . path::clean($d)); if (!$this->inJail($d)) { throw new Exception(__('Directory is not in jail.')); } if (!files::isDeletable($d)) { throw new Exception(__('Directory cannot be removed.')); } if (@rmdir($d) === false) { throw new Exception(__('Directory cannot be removed.')); } }
public static function jsCandyUpload($params = array(), $base_url = null) { if (!$base_url) { $base_url = path::clean(dirname(preg_replace('/(\\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/'; } $params = array_merge($params, array('sess_id=' . session_id(), 'sess_uid=' . $_SESSION['sess_browser_uid'], 'xd_check=' . $GLOBALS['core']->getNonce())); return '<link rel="stylesheet" type="text/css" href="style/candyUpload/style.css" />' . "\n" . self::jsLoad('js/jquery/jquery.candyUpload.js') . '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . "dotclear.candyUpload = {};\n" . self::jsVar('dotclear.msg.activate_enhanced_uploader', __('Activate enhanced uploader')) . self::jsVar('dotclear.msg.disable_enhanced_uploader', __('Disable enhanced uploader')) . self::jsVar('$._candyUpload.prototype.locales.file_uploaded', __('File successfully uploaded.')) . self::jsVar('$._candyUpload.prototype.locales.max_file_size', __('Maximum file size allowed:')) . self::jsVar('$._candyUpload.prototype.locales.limit_exceeded', __('Limit exceeded.')) . self::jsVar('$._candyUpload.prototype.locales.size_limit_exceeded', __('File size exceeds allowed limit.')) . self::jsVar('$._candyUpload.prototype.locales.canceled', __('Canceled.')) . self::jsVar('$._candyUpload.prototype.locales.http_error', __('HTTP Error:')) . self::jsVar('$._candyUpload.prototype.locales.error', __('Error:')) . self::jsVar('$._candyUpload.prototype.locales.choose_file', __('Choose file')) . self::jsVar('$._candyUpload.prototype.locales.choose_files', __('Choose files')) . self::jsVar('$._candyUpload.prototype.locales.cancel', __('Cancel')) . self::jsVar('$._candyUpload.prototype.locales.clean', __('Clean')) . self::jsVar('$._candyUpload.prototype.locales.upload', __('Upload')) . self::jsVar('$._candyUpload.prototype.locales.no_file_in_queue', __('No file in queue.')) . self::jsVar('$._candyUpload.prototype.locales.file_in_queue', __('1 file in queue.')) . self::jsVar('$._candyUpload.prototype.locales.files_in_queue', __('%d files in queue.')) . self::jsVar('$._candyUpload.prototype.locales.queue_error', __('Queue error:')) . self::jsVar('dotclear.candyUpload.base_url', $base_url) . self::jsVar('dotclear.candyUpload.movie_url', $base_url . 'index.php?pf=swfupload.swf') . self::jsVar('dotclear.candyUpload.params', implode('&', $params)) . "\n//]]>\n" . "</script>\n"; }
/** Removes a file. @param f <b>fileItem</b> fileItem object */ public function removeFile($f) { if (!$this->okt->checkPerm('media') && !$this->okt->checkPerm('media_admin')) { throw new Exception(__('Permission denied.')); } $media_file = $this->relpwd ? path::clean($this->relpwd . '/' . $f) : path::clean($f); $strReq = 'DELETE FROM ' . $this->t_media . ' ' . "WHERE media_path = '" . $this->db->escapeStr($this->path) . "' " . "AND media_file = '" . $this->db->escapeStr($media_file) . "' "; if (!$this->okt->checkPerm('media_admin')) { $strReq .= 'AND user_id = ' . (int) $this->okt->user->id . ' '; } $this->db->execute($strReq); if ($this->db->affectedRows() == 0) { throw new Exception(__('File does not exist in the database.')); } parent::removeFile($f); $this->callFileHandler(files::getMimeType($media_file), 'remove', $f); }
$S = getimagesize($file->file); echo '<li><strong>' . __('Image width:') . '</strong> ' . $S[0] . ' px</li>' . '<li><strong>' . __('Image height:') . '</strong> ' . $S[1] . ' px</li>'; unset($S); } echo '<li><strong>' . __('File size:') . '</strong> ' . files::size($file->size) . '</li>' . '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->file_url . '">' . $file->file_url . '</a></li>' . '</ul>'; if (empty($_GET['find_posts'])) { echo '<p><a class="button" href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("find_posts" => 1, "tab" => "media-details-tab"))) . '">' . __('Show entries containing this media') . '</a></p>'; } else { echo '<h3>' . __('Entries containing this media') . '</h3>'; $params = array('post_type' => '', 'from' => 'LEFT OUTER JOIN ' . $core->prefix . 'post_media PM ON P.post_id = PM.post_id ', 'sql' => 'AND (' . 'PM.media_id = ' . (int) $id . ' ' . "OR post_content_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' " . "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' "); if ($file->media_image) { # We look for thumbnails too if (preg_match('#^http(s)?://#', $core->blog->settings->system->public_url)) { $media_root = $core->blog->settings->system->public_url; } else { $media_root = $core->blog->host . path::clean($core->blog->settings->system->public_url) . '/'; } foreach ($file->media_thumb as $v) { $v = preg_replace('/^' . preg_quote($media_root, '/') . '/', '', $v); $params['sql'] .= "OR post_content_xhtml LIKE '%" . $core->con->escape($v) . "%' "; $params['sql'] .= "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($v) . "%' "; } } $params['sql'] .= ') '; $rs = $core->blog->getPosts($params); if ($rs->isEmpty()) { echo '<p>' . __('No entry seems contain this media.') . '</p>'; } else { echo '<ul>'; while ($rs->fetch()) { $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
# Licensed under the GPL version 2.0 license. # See LICENSE file or # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # # -- END LICENSE BLOCK ----------------------------------------- require dirname(__FILE__) . '/../inc/admin/prepend.php'; dcPage::check('admin'); # -- Loading themes -- $core->themes = new dcThemes($core); $core->themes->loadModules($core->blog->themes_path, null); # -- Page helper -- $list = new adminThemesList($core->themes, $core->blog->themes_path, $core->blog->settings->system->store_theme_url); adminThemesList::$distributed_modules = explode(',', DC_DISTRIB_THEMES); # -- Theme screenshot -- if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) { $f = path::real(empty($_GET['src']) ? $core->blog->themes_path . '/' . $_GET['shot'] . '/screenshot.jpg' : $core->blog->themes_path . '/' . $_GET['shot'] . '/' . path::clean($_GET['src'])); if (!file_exists($f)) { $f = dirname(__FILE__) . '/images/noscreenshot.png'; } http::cache(array_merge(array($f), get_included_files())); header('Content-Type: ' . files::getMimeType($f)); header('Content-Length: ' . filesize($f)); readfile($f); exit; } # -- Display module configuration page -- if ($list->setConfiguration($core->blog->settings->system->theme)) { # Get content before page headers include $list->includeConfiguration(); # Gather content $list->getConfiguration();
function exists($path) { return is_dir(path::clean($path)); }
if ($dir && !empty($_POST['medias']) && !empty($_POST['delete_medias'])) { try { foreach ($_POST['medias'] as $media) { $core->media->removeItem(rawurldecode($media)); } dcPage::addSuccessNotice(sprintf(__('Successfully delete one media.', 'Successfully delete %d medias.', count($_POST['medias'])), count($_POST['medias']))); $core->adminurl->redirect('admin.media', $page_url_params); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Removing item from popup only if ($dir && !empty($_POST['rmyes']) && !empty($_POST['remove'])) { $_POST['remove'] = rawurldecode($_POST['remove']); try { if (is_dir(path::real($core->media->getPwd() . '/' . path::clean($_POST['remove'])))) { $msg = __('Directory has been successfully removed.'); } else { $msg = __('File has been successfully removed.'); } $core->media->removeItem($_POST['remove']); dcPage::addSuccessNotice($msg); $core->adminurl->redirect('admin.media', $page_url_params); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Rebuild directory if ($dir && $core->auth->isSuperAdmin() && !empty($_POST['rebuild'])) { try { $core->media->rebuild($d);
define('DC_RC_PATH', $_SERVER['REDIRECT_DC_RC_PATH']); } else { define('DC_RC_PATH', dirname(__FILE__) . '/config.php'); } if (!is_file(DC_RC_PATH)) { trigger_error('Unable to open config file', E_USER_ERROR); exit; } require DC_RC_PATH; if (empty($_GET['pf'])) { header('Content-Type: text/plain'); http::head(404, 'Not Found'); exit; } $allow_types = array('png', 'jpg', 'jpeg', 'gif', 'css', 'js', 'swf'); $pf = path::clean($_GET['pf']); $paths = array_reverse(explode(PATH_SEPARATOR, DC_PLUGINS_ROOT)); # Adding admin/res folder here to load some stuff $paths[] = dirname(__FILE__) . '/swf'; foreach ($paths as $m) { $PF = path::real($m . '/' . $pf); if ($PF !== false) { break; } } unset($paths); if ($PF === false || !is_file($PF) || !is_readable($PF)) { header('Content-Type: text/plain'); http::head(404, 'Not Found'); exit; }
/** * 返回目录下的全部文件夹的数组 * @param string $path 路径 * @param array $filter * @param bool|int $recurse 子目录,或者子目录级数 * @param bool $fullpath 全路径或者仅仅获取文件名称 * @param array $ignore 忽略的文件夹名称 * @return array */ public static function folders($path, $filter = '.', $recurse = false, $fullpath = false, $ignore = array('.svn', 'CVS', '.DS_Store', '__MACOSX')) { $folders = array(); $path = path::clean($path); if (!is_dir($path)) { return false; } $handle = opendir($path); while (($file = readdir($handle)) !== false) { $f = $path . DS . $file; if ($file != '.' && $file != '..' && !in_array($file, $ignore) && is_dir($f)) { if (preg_match("/{$filter}/", $file)) { if ($fullpath) { $folders[] = $f; } else { $folders[] = $file; } } if ($recurse) { if (is_integer($recurse)) { $recurse--; } $subfolders = dir::folders($f, $filter, $recurse, $fullpath, $ignore); $folders = array_merge($folders, $subfolders); } } } closedir($handle); return $folders; }
public static function jsUpload($params = array(), $base_url = null) { if (!$base_url) { $base_url = path::clean(dirname(preg_replace('/(\\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/'; } $params = array_merge($params, array('sess_id=' . session_id(), 'sess_uid=' . $_SESSION['sess_browser_uid'], 'xd_check=' . $GLOBALS['core']->getNonce())); return '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . "dotclear.jsUpload = {};\n" . "dotclear.jsUpload.msg = {};\n" . self::jsVar('dotclear.msg.enhanced_uploader_activate', __('Temporarily activate enhanced uploader')) . self::jsVar('dotclear.msg.enhanced_uploader_disable', __('Temporarily disable enhanced uploader')) . self::jsVar('dotclear.jsUpload.msg.limit_exceeded', __('Limit exceeded.')) . self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded', __('File size exceeds allowed limit.')) . self::jsVar('dotclear.jsUpload.msg.canceled', __('Canceled.')) . self::jsVar('dotclear.jsUpload.msg.http_error', __('HTTP Error:')) . self::jsVar('dotclear.jsUpload.msg.error', __('Error:')) . self::jsVar('dotclear.jsUpload.msg.choose_file', __('Choose file')) . self::jsVar('dotclear.jsUpload.msg.choose_files', __('Choose files')) . self::jsVar('dotclear.jsUpload.msg.cancel', __('Cancel')) . self::jsVar('dotclear.jsUpload.msg.clean', __('Clean')) . self::jsVar('dotclear.jsUpload.msg.upload', __('Upload')) . self::jsVar('dotclear.jsUpload.msg.send', __('Send')) . self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded', __('File successfully uploaded.')) . self::jsVar('dotclear.jsUpload.msg.no_file_in_queue', __('No file in queue.')) . self::jsVar('dotclear.jsUpload.msg.file_in_queue', __('1 file in queue.')) . self::jsVar('dotclear.jsUpload.msg.files_in_queue', __('%d files in queue.')) . self::jsVar('dotclear.jsUpload.msg.queue_error', __('Queue error:')) . self::jsVar('dotclear.jsUpload.base_url', $base_url) . "\n//]]>\n" . "</script>\n" . self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js') . self::jsLoad('js/jsUpload/tmpl.js') . self::jsLoad('js/jsUpload/template-upload.js') . self::jsLoad('js/jsUpload/template-download.js') . self::jsLoad('js/jsUpload/load-image.js') . self::jsLoad('js/jsUpload/jquery.iframe-transport.js') . self::jsLoad('js/jsUpload/jquery.fileupload.js') . self::jsLoad('js/jsUpload/jquery.fileupload-process.js') . self::jsLoad('js/jsUpload/jquery.fileupload-resize.js') . self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'); }
/** Removes a file. @param f <b>fileItem</b> fileItem object */ public function removeFile($f) { if (!$this->core->auth->check('media,media_admin', $this->core->blog->id)) { throw new Exception(__('Permission denied.')); } $media_file = $this->relpwd ? path::clean($this->relpwd . '/' . $f) : path::clean($f); $strReq = 'DELETE FROM ' . $this->table . ' ' . "WHERE media_path = '" . $this->con->escape($this->path) . "' " . "AND media_file = '" . $this->con->escape($media_file) . "' "; if (!$this->core->auth->check('media_admin', $this->core->blog->id)) { $strReq .= "AND user_id = '" . $this->con->escape($this->core->auth->userID()) . "'"; } $this->con->execute($strReq); if ($this->con->changes() == 0) { throw new Exception(__('File does not exist in the database.')); } parent::removeFile($f); $this->callFileHandler(files::getMimeType($media_file), 'remove', $f); }
public function onDefault($dir = '') { $path = ROOT . DS . trim($dir, DS); $path = path::clean($path); $folders = dir::folders($path); $files = dir::files($path); $fileext = array('php', 'css', 'js', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'psd', 'html', 'htm', 'tpl', 'rar', 'zip', 'mp3'); $page['title'] = '文件管理器'; page::header($page); page::add('<div id="page" class="clearfix">'); page::add('<div id="main">'); page::add('<div id="main-inner">'); page::top(); page::navbar($this->navbar(), 'default'); $column = array(); $column['select'] = ''; $column['name'] = '名称'; $column['type'] = '类型'; $column['size w60'] = '大小'; $column['atime w120'] = '创建时间'; $column['mtime w120'] = '修改时间'; $column['manage rename w80'] = '重命名'; $column['manage edit w80'] = '编辑'; $column['manage delete'] = '删除'; table::header('list', $column); foreach ($folders as $folder) { $column = array(); $column['select w20 center'] = html::image(url::theme() . '/image/fileext/folder.gif'); $column['name'] = '<a href="' . zotop::url('filemanager/index/default', array('dir' => $dir . DS . $folder)) . '"><b>' . $folder . '</b></a>'; $column['type w60'] = '文件夹'; $column['size w60'] = '--'; $column['atime w120'] = time::format(@fileatime($path . DS . $folder)); $column['mtime w120'] = time::format(@filemtime($path . DS . $folder)); $column['manage rename w80'] = '<a>重命名</a>'; $column['manage edit w80'] = '<a class="disabled">编辑</a>'; $column['manage delete'] = '<a>删除</a>'; table::row($column); } foreach ($files as $file) { $column = array(); $column['select w20 center'] = in_array(file::ext($file), $fileext) ? html::image(url::theme() . '/image/fileext/' . file::ext($file) . '.gif') : html::image(url::theme() . '/image/fileext/unknown.gif'); $column['name'] = '<a href="' . zotop::url('filemanager/index/default', array('dir' => $dir . DS . $file)) . '"><b>' . $file . '</b></a>'; $column['type w60'] = '文件'; $column['size w60'] = format::byte(@filesize($path . DS . $file)); $column['atime w120'] = time::format(@fileatime($path . DS . $file)); $column['mtime w120'] = time::format(@filemtime($path . DS . $file)); $column['manage rename w80'] = '<a>重命名</a>'; $column['manage edit w80'] = '<a href="' . zotop::url('filemanager/file/edit', array('filename' => $dir . DS . $file, 'dir' => '***')) . '">编辑</a>'; $column['manage delete'] = '<a>删除</a>'; table::row($column); } table::footer(); page::bottom(); page::add('</div>'); page::add('</div>'); page::add('<div id="side">'); block::header('快捷操作'); echo '<ul class="list">'; echo '<li class="file"><a href="' . zotop::url('zotop/file/newfile') . '" class="dialog">新建文件</a></li>'; echo '<li class="folder"><a href="' . zotop::url('zotop/file/newfolder') . '" class="dialog">新建文件夹</a></li>'; echo '<li class="folder"><a href="' . zotop::url('zotop/file/upload') . '" class="dialog">文件上传</a></li>'; echo '</ul>'; block::footer(); block::header('其他位置'); echo '<ul class="list">'; echo '<li class="root"><a>根目录</a></li>'; echo '<li class="root"><a>模板目录</a></li>'; echo '<li class="root"><a>模块目录</a></li>'; echo '<li class="root"><a>缓存目录</a></li>'; echo '</ul>'; block::footer(); page::add('</div>'); page::add('</div>'); page::footer(); }
/** * 返回目录下的全部文件的数组,当level为0时候返回全部子文件夹目录 * @param string $path * @param string $ext * @param int $level * @return array */ public static function brower($path, $ext = '', $level = 0) { if ($level < 0) { return false; } $path = path::clean($path); if (is_dir($path)) { $fso = opendir($path); $arr = array(); while ($name = readdir($fso)) { if ($name != '.' && $name != '..') { $tmp = $path . DS . $name; if (is_dir($tmp)) { if ($level == 0) { $arr[$name] = self::brower($tmp, $ext, $level); } else { if ($level != 1) { $arr[$name] = self::brower($tmp, $ext, $level - 1); } } } else { if (self::ext($name) == $ext || empty($ext)) { $arr[] = $name; } } } } return $arr; } else { return false; } }
protected function __flushCache() { $this->__putLog('Flushing cache'); $sCacheFiles = files::scanDir($this->sCacheDir); foreach ($sCacheFiles as $v) { $sCacheFile = $this->sCacheDir.'/'.$v; $sCacheFile = path::clean(path::real($sCacheFile)); if (is_file($sCacheFile)) { if (time() - filemtime($sCacheFile) >= $this->nCacheTime) { unlink($sCacheFile); $this->__putLog('Deleting '.$v); } } } $sCacheFiles = files::scanDir($this->sCacheDir); return true; }
# Licensed under the GPL version 2.0 license. # See LICENSE file or # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # # -- END LICENSE BLOCK ------------------------------------ require dirname(__FILE__) . '/../inc/admin/prepend.php'; dcPage::check('admin'); # Loading themes $core->themes = new dcThemes($core); $core->themes->loadModules($core->blog->themes_path, null); # Theme screenshot if (!empty($_GET['shot']) && $core->themes->moduleExists($_GET['shot'])) { if (empty($_GET['src'])) { $f = $core->blog->themes_path . '/' . $_GET['shot'] . '/screenshot.jpg'; } else { $f = $core->blog->themes_path . '/' . $_GET['shot'] . '/' . path::clean($_GET['src']); } $f = path::real($f); if (!file_exists($f)) { $f = dirname(__FILE__) . '/images/noscreenshot.png'; } http::cache(array_merge(array($f), get_included_files())); header('Content-Type: ' . files::getMimeType($f)); header('Content-Length: ' . filesize($f)); readfile($f); exit; } $can_install = $core->auth->isSuperAdmin(); $is_writable = is_dir($core->blog->themes_path) && is_writable($core->blog->themes_path); $default_tab = 'themes-list'; # Selecting theme