本文整理汇总了PHP中formatsize函数的典型用法代码示例。如果您正苦于以下问题:PHP formatsize函数的具体用法?PHP formatsize怎么用?PHP formatsize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatsize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getRouterDetail
public function getRouterDetail($router)
{
$html = '';
foreach ($router as $type => $value) {
switch ($type) {
case 'exts':
if ($value) {
$html .= "文件后缀:" . implode(',', $value);
} else {
$html .= "文件后缀:不限制";
}
break;
case 'size':
$sizearr = array();
if (is_numeric($value['lt'])) {
$sizearr[] = "大于" . formatsize($value['lt'] * 1024 * 1024);
}
if (is_numeric($value['gt'])) {
$sizearr[] = "小于" . formatsize($value['gt'] * 1024 * 1024);
}
if ($sizearr) {
$html .= '<br>文件大小:' . implode(' and ', $sizearr);
} else {
$html .= '<br>文件大小:不限制';
}
break;
}
}
return $html;
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:30,代码来源:table_local_router.php
示例2: index
public function index()
{
global $G, $lang;
if ($this->checkFormSubmit()) {
$delete = $_GET['delete'];
if ($delete && is_array($delete)) {
$deleteids = implodeids($delete);
$photos = $this->t('photo')->where("photoid IN({$deleteids})")->select();
foreach ($photos as $pp) {
@unlink(ROOT_PATH . '/' . $pp['thumb']);
@unlink(ROOT_PATH . '/' . $pp['picurl']);
}
$this->t('photo')->where("photoid IN({$deleteids})")->delete();
}
$this->showSuccess('delete_succeed');
} else {
$pagesize = 20;
$totalnum = $this->t('photo')->count();
$pagecount = $totalnum < $pagesize ? 1 : ceil($totalnum / $pagesize);
$photolist = $this->t('photo')->page($G['page'], $pagesize)->order('photoid', 'DESC')->select();
if ($photolist) {
$newlist = array();
foreach ($photolist as $list) {
$list['thumb'] = C('ATTACHURL') . $list['thumb'];
$list['size'] = formatsize($list['size']);
$list['uptime'] = @date('Y-m-d H:i', $list['uptime']);
$newlist[$list['photoid']] = $list;
}
$photolist = $newlist;
unset($newlist);
}
$pages = $this->showPages($G['page'], $pagecount, $totalnum);
include template('photo');
}
}
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:35,代码来源:class.PhotoController.php
示例3: fetch_all_by_pid
public function fetch_all_by_pid($pid)
{
global $_G;
$data = array();
//$openext=C::t('app_open')->fetch_all_orderby_ext($_G['uid']);
foreach (DB::fetch_all("select * from %t where pid= %d", array($this->_table, $pid)) as $value) {
if ($value['aid']) {
$attach = C::t('attachment')->fetch($value['aid']);
if (in_array(strtolower($attach['filetype']), array('png', 'jpeg', 'jpg', 'gif', 'bmp'))) {
$attach['img'] = C::t('attachment')->getThumbByAid($attach);
$attach['isimage'] = 1;
} else {
$attach['img'] = geticonfromext($attach['filetype'], '');
$attach['isimage'] = 0;
}
$attach['url'] = C::t('attachment')->getThumbByAid($attach, 120, 80, 1);
$attach['preview'] = 1;
$attach['filesize'] = formatsize($attach['filesize']);
$data[$value['qid']] = array_merge($value, $attach);
} else {
$value['preview'] = 1;
$data[$value['qid']] = $value;
}
}
return $data;
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:26,代码来源:table_feed_attach.php
示例4: crop
public function crop()
{
$this->pageinfo();
$sourcefile = dirname(dirname(dirname(dirname(__FILE__)))) . "/uploads" . $_GET["fileurl"];
$this->result["file"]["date"] = date("Y-m-d H:i:s", filemtime($sourcefile));
$this->result["file"]["size"] = formatsize(filesize($sourcefile));
//echo $sourcefile;
list($this->result["file"]["width"], $this->result["file"]["height"]) = getimagesize($sourcefile);
}
开发者ID:yfg2014,项目名称:yangphp_4,代码行数:9,代码来源:拷贝于+upload.class.php
示例5: backup
/** 工具 - 数据备份 **/
public function backup()
{
$dir = './data/database/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($filename = readdir($dh)) !== false) {
if ($filename != '.' && $filename != '..') {
if (substr($filename, strrpos($filename, '.')) == '.sql') {
$file = $dir . $filename;
$filemtime = date('Y-m-d H:i:s', filemtime($file));
$addtime[] = $filemtime;
$log[] = array('filename' => $filename, 'filesize' => formatsize(filesize($file)), 'addtime' => $filemtime, 'filepath' => C('SITE_URL') . $file);
}
}
}
}
} else {
@mk_dir($dir, 0777);
}
array_multisort($addtime, SORT_ASC, $log);
$this->assign('log', $log);
$this->assign('table', D('Database')->getTableList());
$this->display();
}
开发者ID:laiello,项目名称:thinksns-2,代码行数:25,代码来源:ToolAction.class.php
示例6: reset
reset($images_in_dir);
foreach ($images_in_dir as $file) {
$img_type = explode(".", $file);
$img_type = totranslit(end($img_type));
if (in_array($img_type, $allowed_extensions) and is_file($config_path_image_upload . $file)) {
$i++;
$this_size = @filesize($config_path_image_upload . $file);
$img_info = @getimagesize($config_path_image_upload . $file);
$total_size += $this_size;
echo "\n\t <tr>\n\t <td><a target=_blank href=\"" . $config['http_home_url'] . "uploads/" . $userdir . $sub_dir . "{$file}\">{$file}</a></td>\n\t <td>{$img_info['0']}x{$img_info['1']}</td>\n\t <td>" . formatsize($this_size) . "</td>\n\t <td><input type=\"checkbox\" name=\"images[{$file}]\" value=\"{$file}\" style=\"border: 0; background: transparent;\"></td>\n\t </tr>";
}
}
if (!$total_size) {
echo "<tr><td colspan=\"4\" align=\"center\" height=\"40\">" . $lang['files_head_4'] . "</td></tr>";
}
echo "</tbody></table><div class=\"box-footer padded\">\n\t\t<div id=\"file-uploader\" style=\"width:210px;float:left;\"></div>{$lang['images_listdir']} {$folder_list}\n\t\t<div style=\"float:right;\">{$lang['images_size']} " . formatsize($total_size) . " <input class=\"btn btn-red\" type=\"submit\" value=\" {$lang['images_del']} \"><input type=\"hidden\" name=\"action\" value=\"doimagedelete\"><input type=\"hidden\" name=\"user_hash\" value=\"{$dle_login_hash}\" /></div>\n\t</div>";
if ($_GET['userdir']) {
$userdir = totranslit($_GET['userdir'], true, false);
} else {
$userdir = "";
}
if ($_GET['sub_dir']) {
$subdir = totranslit($_GET['sub_dir'], true, false);
} else {
$subdir = "";
}
echo <<<HTML
</div>
</div>
</form>
<script type="text/javascript">
开发者ID:Gordondalos,项目名称:union,代码行数:31,代码来源:files.php
示例7: moneys
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
# для его дальнейшего распространения #
#-----------------------------------------------------#
require_once "../includes/start.php";
require_once "../includes/functions.php";
require_once "../includes/header.php";
include_once "../themes/" . $config['themes'] . "/index.php";
echo '<img src="../images/img/partners.gif" alt="image" /> <b>FAQ по сайту</b><br /><br />';
echo '<b>Для чего регистрироваться</b><br />';
echo 'Регистрация предназначена для тех, кто намерен часто заходить на сайт и иметь полный доступ ко все разделам сайта<br />';
echo 'После регистрации у вас появятся новые возможности:<br />';
echo '<b>1</b>. Повышать свой статус (после 6 месяцев пребывания на сайте, вы сможете изменить статус на персональный)<br />';
echo '<b>2</b>. Выбирать, покупать, загружать аватары (Загрузка своего аватара стоит ' . moneys(50000) . ') Аватар будет отображаться возле каждого вашего сообщения<br />';
echo '<b>3</b>. Добавлять свои фотографии в галерею и анкету (Вес картинки не должен превышать ' . formatsize($config['filesize']) . ')<br />';
echo '<b>4</b>. Изменять авторитет другим пользователям сайта положительными или отрицательным голосом (При достижении 150 баллов)<br />';
echo '<b>5</b>. Иметь свой собственный контакт и игнор-листы<br />';
echo '<b>6</b>. Изменять темы/скины по своему желанию, которая будет включаться автоматически при авторизации (Большой выбор скинов)<br />';
echo '<b>7</b>. Общаться по внутренней почте сайта с пользователями сайта, писать под своим ником в гостевой, чате, комментариях, форуме<br />';
echo '<b>8</b>. Играть в игры на деньги. Копить их в банке, брать кредит, перечислять, принимать, покупать виртуальные товары<br />';
echo '<b>9</b>. Участвовать в голосованиях на различные темы<br />';
echo '<b>10</b>. Добавлять свои объявления, на определенный срок (Купля,продажа,вакансии,услуги,обмен и т.д.)<br />';
echo '<b>11</b>. Изменять под себя настройки сайта, в частности количество показываемых сообщений в любых сервисах (гостевая, чат, форум и пр.) Чем можно снизить трафик передаваемой информации<br />';
echo '<br />При достижении определенного количества баллов, пользователю открываются новые возможности:<br />';
echo '<b>150</b> баллов - можете изменять авторитет, перечислять деньги<br />';
echo '<b>500</b> баллов - можете закрывать свои созданные темы на форуме<br />';
echo '<b>1000</b> баллов - исчезает вся реклама на главной странице сайта <br />';
echo '<br /><b>Как проходит регистрация</b><br />';
echo '<b>1</b>. Вводите желаемый ник и пароль<br />';
echo '<b>2</b>. Указываете свой email и код проверочный код<br />';
开发者ID:sirkadirov,项目名称:wap-motor,代码行数:31,代码来源:faq.php
示例8: array
$sql .= " and uid=%d";
$param[] = $uid;
}
$list = array();
if ($count = DB::result_first("SELECT COUNT(*) FROM %t WHERE {$sql}", $param)) {
foreach (DB::fetch_all("SELECT * FROM %t WHERE {$sql} {$orderby} limit {$start},{$perpage}", $param) as $value) {
if ($value['dateline']) {
$value['fdateline'] = dgmdate($value['dateline']);
}
if ($value['password']) {
$value['password'] = dzzdecode($value['password']);
}
if ($value['endtime']) {
$value['fendtime'] = dgmdate($value['endtime'], 'Y-m-d');
}
$value['fsize'] = formatsize($value['size']);
$value['ftype'] = getFileTypeName($value['type'], $value['ext']);
if ($value['type'] == 'folder') {
$value['img'] = 'dzz/images/extimg/folder.png';
}
if ($value['img']) {
$value['img'] = str_replace('dzz/images/extimg/', 'dzz/images/extimg_small/', $value['img']);
}
if ($value['type'] == 'image' && $value['status'] == -3) {
$value['img'] = '';
}
$value['fstatus'] = $sharestatus[$value['status']];
if (is_file($_G['setting']['attachdir'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png')) {
$value['qrcode'] = $_G['setting']['attachurl'] . './qrcode/' . $value['sid'][0] . '/' . $value['sid'] . '.png';
}
$value['shareurl'] = $_G['siteurl'] . 's.php?sid=' . $value['sid'];
开发者ID:druphliu,项目名称:dzzoffice,代码行数:31,代码来源:index.php
示例9: _formatMeta
function _formatMeta($meta, $bz)
{
global $_G, $documentexts, $imageexts;
//判断是否为根目录
$root = $bz . $this->_root;
$icosdata = array();
$bzarr = explode(':', $bz);
if ($meta['isdir']) {
$icoarr = array('icoid' => md5($bz . $meta['path']), 'path' => $bz . $meta['path'], 'dpath' => dzzencode($bz . $meta['path']), 'bz' => $bz, 'gid' => 0, 'name' => substr(strrchr($meta['path'], '/'), 1), 'username' => $_G['username'], 'uid' => $_G['uid'], 'oid' => md5($bz . $meta['path']), 'img' => 'dzz/images/default/system/folder.png', 'type' => 'folder', 'ext' => '', 'pfid' => md5(str_replace(strrchr($meta['path'], '/'), '', $bz . $meta['path'])), 'size' => 0, 'dateline' => intval($meta['mtime']), 'flag' => '');
if ($icoarr['path'] == $root) {
$icoarr['name'] = $this->_rootname;
$icoarr['flag'] = self::BZ;
$icoarr['pfid'] = 0;
}
$icoarr['fsize'] = formatsize($icoarr['size']);
$icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
$icoarr['fdateline'] = dgmdate($icoarr['dateline']);
$icosdata = $icoarr;
} else {
$ext = strtoupper(substr(strrchr($meta['path'], '.'), 1));
if (in_array($ext, $imageexts)) {
$type = 'image';
} elseif (in_array($ext, $documentexts)) {
$type = 'document';
} else {
$type = 'attach';
}
if ($type == 'image') {
$img = $_G['siteurl'] . DZZSCRIPT . '?mod=io&op=thumbnail&width=256&height=256&path=' . dzzencode($bz . $meta['path']);
$url = $_G['siteurl'] . DZZSCRIPT . '?mod=io&op=thumbnail&width=1440&height=900&path=' . dzzencode($bz . $meta['path']);
} else {
$img = geticonfromext($ext, $type);
$url = $_G['siteurl'] . DZZSCRIPT . '?mod=io&op=getStream&path=' . rawurlencode($bz . $meta['path']);
}
$icoarr = array('icoid' => md5($bz . $meta['path']), 'path' => $bz . $meta['path'], 'dpath' => dzzencode($bz . $meta['path']), 'bz' => $bz, 'gid' => 0, 'name' => substr(strrchr($meta['path'], '/'), 1), 'username' => $_G['username'], 'uid' => $_G['uid'], 'oid' => md5($bz . $meta['path']), 'img' => $img, 'url' => $url, 'type' => $type, 'ext' => strtolower($ext), 'pfid' => md5(str_replace(strrchr($meta['path'], '/'), '', $bz . $meta['path'])), 'size' => $meta['size'], 'dateline' => intval($meta['mtime']), 'flag' => '');
$icoarr['fsize'] = formatsize($icoarr['size']);
$icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
$icoarr['fdateline'] = dgmdate($icoarr['dateline']);
$icosdata = $icoarr;
}
return $icosdata;
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:42,代码来源:io_baiduPCS.php
示例10: dir
$dir = dir(S_ROOT . './data/' . $backupdir);
while (FALSE !== ($entry = $dir->read())) {
$backupfile = S_ROOT . './data/' . $backupdir . '/' . $entry;
$basefile = $backupdir . '/' . $entry;
if (is_file($backupfile)) {
$filesize = filesize($backupfile);
if (preg_match('/\\.sql$/i', $backupfile)) {
$fp = fopen($backupfile, 'rb');
$identify = explode(',', base64_decode(preg_replace('/^# Identify:\\s*(\\w+).*/s', '\\1', fgets($fp, 256))));
fclose($fp);
if ($identify[3] != 'multivol') {
$identify[4] = '';
}
$exportlog[] = array('version' => $identify[1], 'type' => $identify[2], 'method' => $identify[3], 'volume' => $identify[4], 'filename' => $basefile, 'dateline' => sgmdate('Y-m-d H:i:s', filemtime($backupfile)), 'size' => formatsize($filesize));
} elseif (preg_match('/\\.zip$/i', $backupfile)) {
$exportlog[] = array('type' => 'zip', 'filename' => $basefile, 'size' => formatsize($filesize), 'dateline' => sgmdate('Y-m-d H:i:s', filemtime($backupfile)), 'method' => '', 'volume' => '');
}
}
}
$dir->close();
} else {
cpmessage('directory_does_not_exist_or_can_not_be_accessed', '', 0, array(S_ROOT . './data/'));
//debug
}
} elseif ($_GET['op'] == 'export') {
$filename = getval('filename');
$type = getval('type');
$method = getval('method');
$usezip = intval(getval('usezip'));
$sqlcharset = getval('sqlcharset');
$extendins = getval('extendins');
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:admincp_backup.php
示例11: foreach
<tr>
<td width="350" style="padding:2px;">{$lang['anti_file']}</td>
<td width="100">{$lang['anti_size']}</td>
<td width="150">{$lang['addnews_date']}</td>
<td> </td>
</tr>
HTML;
foreach ($antivirus->bad_files as $idx => $data) {
if ($data['file_size'] < 50000) {
$color = "<font color=\"green\">";
} elseif ($data['file_size'] < 100000) {
$color = "<font color=\"blue\">";
} else {
$color = "<font color=\"red\">";
}
$data['file_size'] = formatsize($data['file_size']);
if ($data['type']) {
$type = $lang['anti_modified'];
} else {
$type = $lang['anti_not'];
}
if ($data['type'] == 2) {
$type = $lang['anti_modified_1'];
}
$data['file_path'] = preg_replace("/([0-9]){10}_/", "*****_", $data['file_path']);
echo <<<HTML
<tr>
<td style="padding:2px;">{$color}{$data['file_path']}</font></td>
<td>{$color}{$data['file_size']}</font></td>
<td>{$color}{$data['file_date']}</font></td>
<td>{$color}{$type}</font></td>
开发者ID:Banych,项目名称:SiteCreate,代码行数:31,代码来源:antivirus.php
示例12: dir_list_form
//.........这里部分代码省略.........
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "g", SORT_STRING, SORT_DESC, "u", SORT_STRING, SORT_DESC);
$or4 = "4A";
break;
case "5A":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_ASC);
$or5 = "5D";
break;
case "5D":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "size", SORT_NUMERIC, SORT_DESC);
$or5 = "5A";
break;
case "6A":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_ASC, "time", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
$or6 = "6D";
break;
case "6D":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "date", SORT_STRING, SORT_DESC, "time", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
$or6 = "6A";
break;
case "7A":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_ASC, "name", SORT_STRING, SORT_ASC);
$or7 = "7D";
break;
case "7D":
$entry_list = array_csort($entry_list, "type", SORT_STRING, SORT_ASC, "ext", SORT_STRING, SORT_DESC, "name", SORT_STRING, SORT_ASC);
$or7 = "7A";
break;
}
}
$out .= "\r\n <script language=\"Javascript\" type=\"text/javascript\">\r\n <!--\r\n function getCookieVal (offset) {\r\n var endstr = document.cookie.indexOf (';', offset);\r\n if (endstr == -1) endstr = document.cookie.length;\r\n return unescape(document.cookie.substring(offset, endstr));\r\n }\r\n function getCookie (name) {\r\n var arg = name + '=';\r\n var alen = arg.length;\r\n var clen = document.cookie.length;\r\n var i = 0;\r\n while (i < clen) {\r\n var j = i + alen;\r\n if (document.cookie.substring(i, j) == arg) return getCookieVal (j);\r\n i = document.cookie.indexOf(' ', i) + 1;\r\n if (i == 0) break;\r\n }\r\n return null;\r\n }\r\n function setCookie (name, value) {\r\n var argv = SetCookie.arguments;\r\n var argc = SetCookie.arguments.length;\r\n var expires = (argc > 2) ? argv[2] : null;\r\n var path = (argc > 3) ? argv[3] : null;\r\n var domain = (argc > 4) ? argv[4] : null;\r\n var secure = (argc > 5) ? argv[5] : false;\r\n document.cookie = name + '=' + escape (value) +\r\n ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) +\r\n ((path == null) ? '' : ('; path=' + path)) +\r\n ((domain == null) ? '' : ('; domain=' + domain)) +\r\n ((secure == true) ? '; secure' : '');\r\n }\r\n function delCookie (name) {\r\n var exp = new Date();\r\n exp.setTime (exp.getTime() - 1);\r\n var cval = GetCookie (name);\r\n document.cookie = name + '=' + cval + '; expires=' + exp.toGMTString();\r\n }\r\n function go(arg) {\r\n document.location.href='" . $path_info["basename"] . "?frame=3&dir_atual={$dir_atual}'+arg+'/';\r\n }\r\n function resolveIDs() {\r\n document.location.href='" . $path_info["basename"] . "?frame=3&set_resolveIDs=1&dir_atual={$dir_atual}';\r\n }\r\n var entry_list = new Array();\r\n // Custom object constructor\r\n function entry(name, type, size, selected){\r\n this.name = name;\r\n this.type = type;\r\n this.size = size;\r\n this.selected = false;\r\n }\r\n // Declare entry_list for selection procedures";
foreach ($entry_list as $i => $data) {
$out .= "\nentry_list['entry{$i}'] = new entry('" . $data["name"] . "', '" . $data["type"] . "', " . $data["size"] . ", false);";
}
$out .= "\r\n // Select/Unselect Rows OnClick/OnMouseOver\r\n var lastRows = new Array(null,null);\r\n function selectEntry(Row, Action){\r\n var MarkColor = '#" . $fm_color['Mark'] . "';\r\n var Cells = Row.getElementsByTagName('td');\r\n if (multipleSelection){\r\n // Avoid repeated onmouseover events from same Row ( cell transition )\r\n if (Row != lastRows[0]){\r\n if (Action == 'over') {\r\n if (entry_list[Row.id].selected){\r\n if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n else DefaultColor = '#" . $fm_color['File'] . "';\r\n if (unselect(entry_list[Row.id])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = DefaultColor;\r\n }\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n var LastRowDefaultColor;\r\n if (entry_list[LastRowID].type == 'dir') LastRowDefaultColor = '#" . $fm_color['Dir'] . "';\r\n else LastRowDefaultColor = '#" . $fm_color['File'] . "';\r\n if (Row.id == lastRows[1].id){\r\n var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n if (unselect(entry_list[LastRowID])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else LastRowCells[c].style.backgroundColor = LastRowDefaultColor;\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n if (select(entry_list[Row.id])){\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = MarkColor;\r\n }\r\n }\r\n // Change the last Row when you change the movement orientation\r\n if (lastRows[0] != null && lastRows[1] != null){\r\n var LastRowID = lastRows[0].id;\r\n if (Row.id == lastRows[1].id){\r\n var LastRowCells = lastRows[0].getElementsByTagName('td');\r\n if (select(entry_list[LastRowID])) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[LastRowID].type=='file' && !entry_list[LastRowID].selected) LastRowCells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else LastRowCells[c].style.backgroundColor = MarkColor;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n lastRows[1] = lastRows[0];\r\n lastRows[0] = Row;\r\n }\r\n }\r\n } else {\r\n if (Action == 'click') {\r\n var newColor = null;\r\n if (entry_list[Row.id].selected){\r\n var DefaultColor;\r\n if (entry_list[Row.id].type == 'dir') DefaultColor = '#" . $fm_color['Dir'] . "';\r\n else DefaultColor = '#" . $fm_color['File'] . "';\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n } else {\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n }\r\n if (newColor) {\r\n lastRows[0] = lastRows[1] = Row;\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (c == 0 && entry_list[Row.id].type=='file' && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = newColor;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n // Disable text selection and bind multiple selection flag\r\n var multipleSelection = false;\r\n if (is.ie) {\r\n document.onselectstart=new Function('return false');\r\n document.onmousedown=switch_flag_on;\r\n document.onmouseup=switch_flag_off;\r\n // Event mouseup is not generated over scrollbar.. curiously, mousedown is.. go figure.\r\n window.onscroll=new Function('multipleSelection=false');\r\n } else {\r\n if (document.layers) window.captureEvents(Event.MOUSEDOWN);\r\n if (document.layers) window.captureEvents(Event.MOUSEUP);\r\n window.onmousedown=switch_flag_on;\r\n window.onmouseup=switch_flag_off;\r\n }\r\n // Using same function and a ternary operator couses bug on double click\r\n function switch_flag_on(e) {\r\n lastRows[0] = lastRows[1] = null;\r\n if (is.ie){\r\n multipleSelection = (event.button == 1);\r\n } else {\r\n multipleSelection = (e.which == 1);\r\n }\r\n return false;\r\n }\r\n function switch_flag_off(e) {\r\n if (is.ie){\r\n multipleSelection = (event.button != 1);\r\n } else {\r\n multipleSelection = (e.which != 1);\r\n }\r\n return false;\r\n }\r\n var total_dirs_selected = 0;\r\n var total_files_selected = 0;\r\n function unselect(Entry){\r\n if (!Entry.selected) return false;\r\n Entry.selected = false;\r\n sel_totalsize -= Entry.size;\r\n if (Entry.type == 'dir') total_dirs_selected--;\r\n else total_files_selected--;\r\n update_sel_status();\r\n return true;\r\n }\r\n function select(Entry){\r\n if(Entry.selected) return false;\r\n Entry.selected = true;\r\n sel_totalsize += Entry.size;\r\n if(Entry.type == 'dir') total_dirs_selected++;\r\n else total_files_selected++;\r\n update_sel_status();\r\n return true;\r\n }\r\n function is_anything_selected(){\r\n var selected_dir_list = new Array();\r\n var selected_file_list = new Array();\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n if(entry_list['entry'+x].selected){\r\n if(entry_list['entry'+x].type == 'dir') selected_dir_list.push(entry_list['entry'+x].name);\r\n else selected_file_list.push(entry_list['entry'+x].name);\r\n }\r\n }\r\n document.form_action.selected_dir_list.value = selected_dir_list.join('<|*|>');\r\n document.form_action.selected_file_list.value = selected_file_list.join('<|*|>');\r\n return (total_dirs_selected>0 || total_files_selected>0);\r\n }\r\n function formatsize (arg) {\r\n var resul = '';\r\n if (arg>0){\r\n var j = 0;\r\n var ext = new Array(' bytes',' Kb',' Mb',' Gb',' Tb');\r\n while (arg >= Math.pow(1024,j)) ++j;\r\n resul = (Math.round(arg/Math.pow(1024,j-1)*100)/100) + ext[j-1];\r\n } else resul = '0 Mb';\r\n return resul;\r\n }\r\n var sel_totalsize = 0;\r\n function update_sel_status(){\r\n var t = total_dirs_selected+' " . et('Dir_s') . " " . et('And') . " '+total_files_selected+' " . et('File_s') . " " . et('Selected_s') . " = '+formatsize(sel_totalsize);\r\n document.getElementById(\"sel_status\").innerHTML = t;\r\n }\r\n // Select all/none/inverse\r\n function selectANI(Butt){\r\n var MarkColor = '#" . $fm_color['Mark'] . "';\r\n for(var x=0;x<" . (int) count($entry_list) . ";x++){\r\n if (entry_list['entry'+x].type == 'dir'){\r\n var DefaultColor = '#" . $fm_color['Dir'] . "';\r\n } else {\r\n var DefaultColor = '#" . $fm_color['File'] . "';\r\n }\r\n var Row = document.getElementById('entry'+x);\r\n var Cells = Row.getElementsByTagName('td');\r\n var newColor = null;\r\n switch (Butt.value){\r\n case '" . et('SelAll') . "':\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n break;\r\n case '" . et('SelNone') . "':\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n break;\r\n case '" . et('SelInverse') . "':\r\n if (entry_list[Row.id].selected){\r\n if (unselect(entry_list[Row.id])) newColor = DefaultColor;\r\n } else {\r\n if (select(entry_list[Row.id])) newColor = MarkColor;\r\n }\r\n break;\r\n }\r\n if (newColor) {\r\n for (var c=0; c < " . (int) $highlight_cols . "; c++) {\r\n if (entry_list[Row.id].type=='file' && c==0 && !entry_list[Row.id].selected) Cells[c].style.backgroundColor = '#" . $fm_color['FileFirstCell'] . "';\r\n else Cells[c].style.backgroundColor = newColor;\r\n }\r\n }\r\n }\r\n if (Butt.value == '" . et('SelAll') . "'){\r\n Butt.value = '" . et('SelNone') . "';\r\n } else if (Butt.value == '" . et('SelNone') . "'){\r\n Butt.value = '" . et('SelAll') . "';\r\n }\r\n return true;\r\n }\r\n function download(arg){\r\n parent.frame1.location.href='" . $path_info["basename"] . "?action=3&dir_atual={$dir_atual}&filename='+escape(arg);\r\n }\r\n function upload(){\r\n var w = 400;\r\n var h = 200;\r\n window.open('" . $path_info["basename"] . "?action=10&dir_atual={$dir_atual}', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function execute(){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeCmd') . ".');\r\n if(document.form_action.cmd_arg.value.length>0){\r\n if(confirm('" . et('ConfExec') . " \\' '+document.form_action.cmd_arg.value+' \\' ?')) {\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=6&dir_atual={$dir_atual}&cmd='+escape(document.form_action.cmd_arg.value), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n }\r\n function decompress(arg){\r\n if(confirm('" . strtoupper(et('Decompress')) . " \\' '+arg+' \\' ?')) {\r\n document.form_action.action.value = 72;\r\n document.form_action.cmd_arg.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function edit_file(arg){\r\n var w = 800;\r\n var h = 600;\r\n if(confirm('" . strtoupper(et('Edit')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=7&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function config(){\r\n var w = 600;\r\n var h = 400;\r\n window.open('" . $path_info["basename"] . "?action=2', 'win_config', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function server_info(arg){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=5', 'win_serverinfo', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function shell(){\r\n var w = 800;\r\n var h = 600;\r\n window.open('" . $path_info["basename"] . "?action=9', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n function view(arg){\r\n var w = 800;\r\n var h = 600;\r\n if(confirm('" . strtoupper(et('View')) . " \\' '+arg+' \\' ?')) window.open('" . $path_info["basename"] . "?action=4&dir_atual={$dir_atual}&filename='+escape(arg), '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=yes');\r\n }\r\n function rename(arg){\r\n var nome = '';\r\n if (nome = prompt('" . strtoupper(et('Ren')) . " \\' '+arg+' \\' " . et('To') . " ...')) document.location.href='" . $path_info["basename"] . "?frame=3&action=3&dir_atual={$dir_atual}&old_name='+escape(arg)+'&new_name='+escape(nome);\r\n }\r\n function set_dir_dest(arg){\r\n document.form_action.dir_dest.value=arg;\r\n if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n else alert('" . et('JSError') . ".');\r\n }\r\n function sel_dir(arg){\r\n document.form_action.action.value = arg;\r\n document.form_action.dir_dest.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n if (!getCookie('sel_dir_warn')) {\r\n alert('" . et('SelDir') . ".');\r\n document.cookie='sel_dir_warn'+'='+escape('true')+';';\r\n }\r\n parent.frame2.set_flag(true);\r\n }\r\n }\r\n function set_chmod_arg(arg){\r\n document.form_action.chmod_arg.value=arg;\r\n if (document.form_action.action.value.length>0) test(document.form_action.action.value);\r\n else alert('" . et('JSError') . "');\r\n }\r\n function chmod(arg){\r\n document.form_action.action.value = arg;\r\n document.form_action.dir_dest.value='';\r\n document.form_action.chmod_arg.value='';\r\n if (!is_anything_selected()) alert('" . et('NoSel') . ".');\r\n else {\r\n var w = 280;\r\n var h = 180;\r\n window.open('" . $path_info["basename"] . "?action=8', '', 'width='+w+',height='+h+',fullscreen=no,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');\r\n }\r\n }\r\n function test_action(){\r\n if (document.form_action.action.value != 0) return true;\r\n else return false;\r\n }\r\n function test_prompt(arg){\r\n var erro='';\r\n var conf='';\r\n if (arg == 1){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeDir') . ".');\r\n } else if (arg == 2){\r\n document.form_action.cmd_arg.value = prompt('" . et('TypeArq') . ".');\r\n } else if (arg == 71){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else document.form_action.cmd_arg.value = prompt('" . et('TypeArqComp') . "');\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(document.form_action.cmd_arg.value.length>0) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n function strstr(haystack,needle){\r\n var index = haystack.indexOf(needle);\r\n return (index==-1)?false:index;\r\n }\r\n function valid_dest(dest,orig){\r\n return (strstr(dest,orig)==false)?true:false;\r\n }\r\n // ArrayAlert - Selection debug only\r\n function aa(){\r\n var str = 'selected_dir_list:\\n';\r\n for (x=0;x<selected_dir_list.length;x++){\r\n str += selected_dir_list[x]+'\\n';\r\n }\r\n str += '\\nselected_file_list:\\n';\r\n for (x=0;x<selected_file_list.length;x++){\r\n str += selected_file_list[x]+'\\n';\r\n }\r\n alert(str);\r\n }\r\n function test(arg){\r\n var erro='';\r\n var conf='';\r\n if (arg == 4){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n conf = '" . et('RemSel') . " ?\\n';\r\n } else if (arg == 5){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".\\n';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('CopyTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 6){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.dir_dest.value.length == 0) erro = '" . et('NoDestDir') . ".';\r\n else if(document.form_action.dir_dest.value == document.form_action.dir_atual.value) erro = '" . et('DestEqOrig') . ".';\r\n else if(!valid_dest(document.form_action.dir_dest.value,document.form_action.dir_atual.value)) erro = '" . et('InvalidDest') . ".';\r\n conf = '" . et('MoveTo') . " \\' '+document.form_action.dir_dest.value+' \\' ?\\n';\r\n } else if (arg == 9){\r\n if (!is_anything_selected()) erro = '" . et('NoSel') . ".';\r\n else if(document.form_action.chmod_arg.value.length == 0) erro = '" . et('NoNewPerm') . ".';\r\n conf = '" . et('AlterPermTo') . " \\' '+document.form_action.chmod_arg.value+' \\' ?\\n';\r\n }\r\n if (erro!=''){\r\n document.form_action.cmd_arg.focus();\r\n alert(erro);\r\n } else if(conf!='') {\r\n if(confirm(conf)) {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n } else {\r\n document.form_action.action.value = arg;\r\n document.form_action.submit();\r\n }\r\n }\r\n //-->\r\n </script>";
$out .= "\r\n <form name=\"form_action\" action=\"" . $path_info["basename"] . "\" method=\"post\" onsubmit=\"return test_action();\">\r\n <input type=hidden name=\"frame\" va
|
请发表评论