/** * */ public function log() { $file_list = array(); $files_list = array(); File::getFiles(LOG_PATH, $file_list, '#\\.log#i'); foreach ($file_list as $key => $value) { $files_list_temp = array(); $files_list_temp['id'] = base64_encode($value); $files_list_temp['name'] = $value; $files_list_temp['size'] = File::realSize($value); $files_list_temp['create_time'] = date("Y-m-d H:i:s", File::filectime($value)); $files_list_temp['mod_time'] = date("Y-m-d H:i:s", File::filemtime($value)); $files_list[] = $files_list_temp; } $files_list = array_sort($files_list, "mod_time"); $this->assign('logs_list', $files_list); $this->display(); }
/** * @function imageManager */ public function imageManager() { header("Content-Type: text/html; charset=utf-8"); //需要遍历的目录列表,最好使用缩略图地址,否则当网速慢时可能会造成严重的延时 $paths = array(Upload_PATH, 'upload1/'); // $action = htmlspecialchars($_POST["action"]); $action = htmlspecialchars($_REQUEST["action"]); if ($action == "get") { if (!defined('SAE_TMP_PATH')) { $files = array(); foreach ($paths as $path) { //$dir = new Dir(); //$tmp = $dir->getfiles($path); $tmp = File::getFiles($path); if ($tmp) { $files = array_merge($files, $tmp); } } if (!count($files)) { return; } rsort($files, SORT_STRING); $str = ""; foreach ($files as $file) { $str .= __ROOT__ . '/' . $file . "ue_separate_ue"; } echo $str; } else { // SAE环境下 $st = new \SaeStorage(); // 实例化 /* * getList:获取指定domain下的文件名列表 * return: 执行成功时返回文件列表数组,否则返回false * 参数:存储域,路径前缀,返回条数,起始条数 */ $num = 0; while ($ret = $st->getList(get_opinion('SaeStorage'), null, 100, $num)) { foreach ($ret as $file) { if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) { echo $st->getUrl('upload', $file) . "ue_separate_ue"; } $num++; } } } } }
/** * */ public function restoreFile() { $handle = opendir(System_Backup_PATH); $file_list = array(); File::getFiles(System_Backup_PATH, $file_list, '#\\.zip$#i'); foreach ($file_list as $key => $value) { $files_list_temp = array(); $files_list_temp['id'] = base64_encode($value); $files_list_temp['name'] = $value; $files_list_temp['size'] = File::realSize($value); $files_list_temp['create_time'] = date("Y-m-d H:i:s", File::filectime($value)); $files_list_temp['mod_time'] = date("Y-m-d H:i:s", File::filemtime($value)); $files_list[] = $files_list_temp; } $this->assign('backup', $files_list); $this->display(); }