本文整理汇总了PHP中FormatFileSize函数的典型用法代码示例。如果您正苦于以下问题:PHP FormatFileSize函数的具体用法?PHP FormatFileSize怎么用?PHP FormatFileSize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FormatFileSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BuildAssociativeFileArray
function BuildAssociativeFileArray($OrderedArray, $ThumbnailArray)
{
reset($OrderedArray);
$AssociativeArray = array();
while (list($key, $val) = each($OrderedArray)) {
$AssociativeArray[] = array("Name" => $this->FileNames[$key], "Size" => FormatFileSize($this->FileSizes[$key]), "Date" => $this->FileDates[$key], "HandlerMethod" => $this->HandlerMethods[$key], "ThumbnailPresent" => $this->FindThumbnail($this->FileNames[$key], $ThumbnailArray));
}
return $AssociativeArray;
}
示例2: TemplateReplace
function TemplateReplace($content, $bodycontent, $template_path, $useraccount, $packageinfo, $quotainfo, $permissionset, $personalinfo)
{
include 'conf/zcnf.php';
include 'lang/' . GetSystemOption('zpanel_lang') . '.php';
$fileContents = str_replace('{{usage:domains}}', GetQuotaUsages('domains', $useraccount['ac_id_pk']), $content);
$fileContents = str_replace('{{usage:subdomains}}', GetQuotaUsages('subdomains', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:parkeddomains}}', GetQuotaUsages('parkeddomains', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:mailboxes}}', GetQuotaUsages('mailboxes', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:forwarders}}', GetQuotaUsages('forwarders', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:distlists}}', GetQuotaUsages('distlists', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:ftpaccounts}}', GetQuotaUsages('ftpaccounts', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:mysql}}', GetQuotaUsages('mysql', $useraccount['ac_id_pk']), $fileContents);
$fileContents = str_replace('{{usage:diskspace}}', FormatFileSize(GetQuotaUsages('diskspace', $useraccount['ac_id_pk'])), $fileContents);
$fileContents = str_replace('{{usage:bandwidth}}', FormatFileSize(GetQuotaUsages('bandwidth', $useraccount['ac_id_pk'])), $fileContents);
$fileContents = str_replace('{{quota:domains}}', $quotainfo['qt_domains_in'], $fileContents);
$fileContents = str_replace('{{quota:subdomains}}', $quotainfo['qt_subdomains_in'], $fileContents);
$fileContents = str_replace('{{quota:parkeddomains}}', $quotainfo['qt_parkeddomains_in'], $fileContents);
$fileContents = str_replace('{{quota:mailboxes}}', $quotainfo['qt_mailboxes_in'], $fileContents);
$fileContents = str_replace('{{quota:forwarders}}', $quotainfo['qt_fowarders_in'], $fileContents);
$fileContents = str_replace('{{quota:distlists}}', $quotainfo['qt_distlists_in'], $fileContents);
$fileContents = str_replace('{{quota:ftpaccounts}}', $quotainfo['qt_ftpaccounts_in'], $fileContents);
$fileContents = str_replace('{{quota:mysql}}', $quotainfo['qt_mysql_in'], $fileContents);
$fileContents = str_replace('{{quota:diskspace}}', FormatFileSize($quotainfo['qt_diskspace_bi']), $fileContents);
$fileContents = str_replace('{{quota:bandwidth}}', FormatFileSize($quotainfo['qt_bandwidth_bi']), $fileContents);
$fileContents = str_replace('{{progbar:diskspace}}', "<img src=\"inc/zProgressBar.php?used=" . GetQuotaUsages('diskspace', $useraccount['ac_id_pk']) . "&total=" . $quotainfo['qt_diskspace_bi'] . "\">", $fileContents);
$fileContents = str_replace('{{progbar:bandwidth}}', "<img src=\"inc/zProgressBar.php?used=" . GetQuotaUsages('bandwidth', $useraccount['ac_id_pk']) . "&total=" . $quotainfo['qt_bandwidth_bi'] . "\">", $fileContents);
$fileContents = str_replace('{{server:company}}', GetSystemOption('sever_company'), $fileContents);
$fileContents = str_replace('{{server:serverip}}', $_SERVER['SERVER_ADDR'], $fileContents);
$fileContents = str_replace('{{server:userip}}', $_SERVER['REMOTE_ADDR'], $fileContents);
$fileContents = str_replace('{{server:uptime}}', GetServerUptime(), $fileContents);
$fileContents = str_replace('{{server:verapache}}', ShowApacheVersion(), $fileContents);
$fileContents = str_replace('{{server:verphp}}', ShowPHPVersion(), $fileContents);
$fileContents = str_replace('{{server:verkernal}}', ShowKernelVersion(ShowServerPlatform()), $fileContents);
$fileContents = str_replace('{{server:vermysql}}', ShowMySQLVersion(), $fileContents);
$fileContents = str_replace('{{server:veros}}', ShowServerPlatform(), $fileContents);
$fileContents = str_replace('{{server:osname}}', ShowServerOSName(), $fileContents);
$fileContents = str_replace('{{server:oslogo}}', "<img src=\"lib/emblems/os_icons/" . ShowServerOSName() . ".png\" title=\"This server is running " . ShowServerOSName() . "\">", $fileContents);
$fileContents = str_replace('{{server:verzpanel}}', GetSystemOption('zpanel_version'), $fileContents);
$fileContents = str_replace('{{link:home}}', "<a href=\"./\">" . $lang['215'] . "</a>", $fileContents);
$fileContents = str_replace('{{link:logout}}', "<a href=\"./login.php?logout\">" . $lang['216'] . "</a>", $fileContents);
$fileContents = str_replace('{{zp:templatepath}}', $template_path, $fileContents);
$fileContents = str_replace('{{account:username}}', $useraccount['ac_user_vc'], $fileContents);
$fileContents = str_replace('{{account:email}}', $personalinfo['ap_email_vc'], $fileContents);
$fileContents = str_replace('{{account:created}}', date(GetSystemOption('zpanel_df'), $useraccount['ac_created_ts']), $fileContents);
$fileContents = str_replace('{{account:fullname}}', $personalinfo['ap_fullname_vc'], $fileContents);
$fileContents = str_replace('{{package:name}}', $packageinfo['pk_name_vc'], $fileContents);
$fileContents = str_replace('{{account:type}}', ShowAccountType($permissionset), $fileContents);
$fileContents = str_replace('{{zp:content}}', $bodycontent, $fileContents);
return $fileContents;
}
示例3: AdminCacheMain
function AdminCacheMain()
{
AddCenterBox('Очистка кэша');
if (!System::cache()->Enabled) {
if (USE_CACHE) {
System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Папка "' . System::cache()->Path . '" не доступна для записи. Функция кэширования отключена.');
} else {
System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Функция кэширования отключена в конфигурационном файле "config/config.php".');
}
}
$text = '<table cellspacing="0" cellpadding="0" class="cfgtable">';
$text .= '<tr><th>Группа</th><th>Папка</th><th>Записей</th><th>Занимаемое место</th><th>Функции</th></tr>';
$num_rows = 0;
$total_size = 0;
$groups = System::cache()->GetGroups();
foreach ($groups as $g) {
$file_size = 0;
$num_files = 0;
$folder = System::cache()->Path . $g;
$files = scandir($folder);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
$f = $folder . '/' . $file;
if (!is_dir($f)) {
$file_size += filesize($f);
}
$num_files++;
}
}
$func = SpeedButton('Очистить', ADMIN_FILE . '?exe=cache&a=clear&group=' . SafeDB($g, 255, str), 'images/admin/cleanup.png');
$rows = floor($num_files / 2);
$text .= '<tr>' . '<td>' . SafeDB($g, 255, str) . '</td>' . '<td>' . SafeDB($folder, 255, str) . '</td>' . '<td>' . $rows . '</td>' . '<td>' . FormatFileSize($file_size) . '</td>' . '<td>' . $func . '</td>' . '</tr>';
$num_rows += $rows;
$total_size += $file_size;
}
$text .= '</table><br />';
$text .= 'Итого <b>' . count($groups) . '</b> групп(ы), <b>' . $num_rows . '</b> записей и <b>' . FormatFileSize($total_size) . '</b> занято. ' . System::admin()->SpeedButton('Очистить все группы', ADMIN_FILE . '?exe=cache&a=cleanup', '', true, true);
$text .= '<br /><br />';
AddText($text);
}
示例4: AdminGalleryMainFunc
function AdminGalleryMainFunc()
{
global $edit_images, $GalleryDir, $ThumbsDir;
UseScript('colorbox?theme=admin');
$back = SaveRefererUrl();
if (isset($_GET['cat']) && $_GET['cat'] > -1) {
$cat = SafeEnv($_GET['cat'], 11, int);
$where = "`cat_id`='{$cat}'";
} else {
$cat = -1;
$where = "";
}
$data = AdminGalleryGetTree()->GetCatsData($cat, true);
System::site()->DataAdd($data, -1, 'Все изображения', $cat == -1);
if (isset($_GET['page'])) {
$page = SafeEnv($_GET['page'], 11, int);
$page_param = '&page=' . SafeDB($_GET['page'], 11, int);
} else {
$page = 1;
$page_param = '';
}
AddCenterBox('Фото');
System::admin()->AddJS(Indent('
GallerySelectCat = function(){
Admin.LoadPage("' . ADMIN_FILE . '?exe=gallery&cat="+$("#gallery-cat").val());
}
'));
$text = '<div style="margin-bottom: 10px;">Категория: ' . System::site()->Select('cat', $data, false, 'id="gallery-cat" onchange="GallerySelectCat();"');
if ($cat < 0) {
$text .= ' (Для сортировки изображений, выберите категорию)';
}
$text .= '</div>';
AddText($text);
$images = System::database()->Select('gallery', $where);
$count_images = count($images) - 1;
SortArray($images, 'order');
if (count($images) > System::config('gallery/images_on_page')) {
$navigator = new Navigation($page);
$navigator->GenNavigationMenu($images, System::config('gallery/images_on_page'), ADMIN_FILE . '?exe=gallery' . ($cat > 0 ? '&cat=' . $cat : ''));
$nav = true;
} else {
$nav = false;
}
$text = '<table cellspacing="0" cellpadding="0" class="cfgtable">';
$text .= '<tr>' . ($cat > 0 ? '<th>Сортировка</th>' : '') . '<th>Изображение</th><th>Просмотров</th><th>Видят</th><th>Статус</th><th>Функции</th></tr>';
foreach ($images as $i => $img) {
$id = SafeDB($img['id'], 11, int);
$title = SafeDB($img['title'], 255, str);
if ($title == '') {
$title = 'Изображение ' . $id;
}
if (System::config('gallery/show_thumbs')) {
$img_filename = SafeDB($img['file'], 255, str);
$size = FormatFileSize(filesize($GalleryDir . $img_filename));
$asize = getimagesize($GalleryDir . $img_filename);
$asize = $asize[0] . 'x' . $asize[1];
$thumb = '<div style="margin: 5px 0;"><a href="' . $GalleryDir . $img_filename . '" target="_blank" class="colorbox">' . '<img title="' . $title . '" src="' . $ThumbsDir . $img_filename . (isset($_GET['update']) && $_GET['update'] == $id ? '?' . GenRandomString(5) : '') . '"></a></div>' . "({$asize}, {$size})";
} else {
$thumb = '';
}
$hits = SafeDB($img['hits'], 11, int);
$st = $img['show'] == '1' ? 'Вкл.' : 'Выкл.';
$func = '-';
$move_menu = '';
$link_go = Ufu('index.php?name=gallery&op=view&img=' . $id . '&cat=' . SafeDB($img['cat_id'], 11, int), 'gallery/{cat}/{img}/');
$func = '';
$func .= System::admin()->SpeedButton('Перейти к странице на сайте', $link_go, 'images/link_go.png', false, false, 'target="_blank"');
if ($edit_images) {
$edit_url = ADMIN_FILE . '?exe=gallery&a=editor&id=' . $id . '&back=' . $back;
$title = '<b>' . System::admin()->Link($title, $edit_url) . '</b>';
$hits .= ' ' . System::admin()->SpeedConfirm('Обнулить счётчик просмотров', ADMIN_FILE . '?exe=gallery&a=resethits&id=' . $id . '&back=' . $back, 'images/admin/arrow_in.png', 'Сбросить счётчик просмотров?');
$st = System::admin()->SpeedStatus('Вкл.', 'Выкл.', ADMIN_FILE . '?exe=gallery&a=changestatus&id=' . $id, $img['show'] == '1');
$func .= System::admin()->SpeedButton('Редактировать', $edit_url, 'images/admin/edit.png');
$func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=gallery&a=delete&id=' . $id . '&back=' . $back, 'images/admin/delete.png', 'Удалить изображение?');
$func .= '<div style="margin-top: 4px;">';
$func .= System::admin()->SpeedButton('Повернуть влево на 90°', ADMIN_FILE . '?exe=gallery&a=rotate&turn=left&id=' . $id . '&back=' . $back, 'images/admin/layer-rotate-left.png');
$func .= System::admin()->SpeedButton('Повернуть вправо на 90° ', ADMIN_FILE . '?exe=gallery&a=rotate&turn=right&id=' . $id . '&back=' . $back, 'images/admin/layer-rotate-right.png');
$func .= System::admin()->SpeedButton('Обновить эскиз', ADMIN_FILE . '?exe=gallery&a=refreshthumb&id=' . $id . '&back=' . $back, 'images/admin/refresh.png');
$func .= '</div>';
if ($count_images == 0) {
// Единственный элемент в списке
$move_menu .= ' - ';
} else {
if ($i != $count_images) {
// Первый элемент
$move_menu .= System::admin()->SpeedButton('Вниз', ADMIN_FILE . '?exe=gallery&a=move&to=down&id=' . $id . '&cat=' . $cat . $page_param, 'images/admin/down.png');
}
if ($i != 0) {
// Последний элемент
$move_menu .= System::admin()->SpeedButton('Вверх', ADMIN_FILE . '?exe=gallery&a=move&to=up&id=' . $id . '&cat=' . $cat . $page_param, 'images/admin/up.png');
}
}
}
$text .= Indent('
<tr>
' . ($cat > 0 ? '<td>' . $move_menu . '</td>' : '') . '
<td>' . $title . $thumb . '</td>
<td>' . $hits . '</td>
<td>' . ViewLevelToStr(SafeDB($img['view'], 1, int)) . '</td>
<td>' . $st . '</td>
//.........这里部分代码省略.........
示例5: Cleaner
?>
<tr>
<td><?php
echo Cleaner('o', $rowclients['ac_user_vc']);
?>
</td>
<td><?php
echo $package['pk_name_vc'];
?>
</td>
<td><?php
echo FormatFileSize(GetQuotaUsages('diskspace', $rowclients['ac_id_pk']));
?>
</td>
<td><?php
echo FormatFileSize(GetQuotaUsages('bandwidth', $rowclients['ac_id_pk']));
?>
</td>
<td><input type="submit" name="inEdit_<?php
echo $rowclients['ac_id_pk'];
?>
" id="inEdit_<?php
echo $rowclients['ac_id_pk'];
?>
" value="<?php
echo $lang['85'];
?>
" />
<?php
if ($rowclients['ac_id_pk'] != 2) {
示例6: PieGraph
$graph = new PieGraph(400, 250, "auto");
#$graph->SetAntiAlias(true);
$graph->title->Set("");
$graph->legend->Pos(0.1, 0.1);
$p1 = new PiePlot3d($data);
$p1->SetSliceColors(array('#333333', '#333333'));
$p1->SetCenter(0.4);
$p1->SetSize(90);
$p1->SetAngle(45);
$p1->value->SetColor("#666666");
$p1->SetLegends(explode(",", "" . $key . ""));
$graph->Add($p1);
$graph->Stroke();
} else {
$value = "" . ($quota - $_GET['used']) . "," . $_GET['used'] . "";
$key = "Free space: (" . FormatFileSize($diplayquota - $_GET['used']) . "),Used space: (" . FormatFileSize($_GET['used']) . ")";
$data = explode(",", "" . $value . "");
$graph = new PieGraph(400, 250, "auto");
#$graph->SetAntiAlias(true);
$graph->title->Set("");
$graph->legend->Pos(0.1, 0.1);
$p1 = new PiePlot3d($data);
$p1->SetSliceColors(array('#039ACA', '#333333'));
$p1->SetCenter(0.4);
$p1->SetSize(90);
$p1->SetAngle(45);
$p1->value->SetColor("#666666");
$p1->SetLegends(explode(",", "" . $key . ""));
$graph->Add($p1);
$graph->Stroke();
}
示例7: AdminUserAvatarsGallery
function AdminUserAvatarsGallery()
{
global $galeryedit;
TAddSubTitle('Галерея аватар');
if (isset($_GET['user']) && $_GET['user'] == '1') {
$personal = true;
$dir = System::config('general/personal_avatars_dir');
$dirlink = System::admin()->Link('Показать аватары из галереи', ADMIN_FILE . '?exe=user&a=avatars');
$users = System::database()->Select('users', "`type`='2'");
$c = sizeof($users);
for ($i = 0; $i < $c; $i++) {
$users[$users[$i]['avatar']] = $i;
}
} else {
$personal = false;
$dir = System::config('general/avatars_dir');
$dirlink = System::admin()->Link('Показать аватары пользователей', ADMIN_FILE . '?exe=user&a=avatars&user=1');
}
$avatars2 = GetFiles($dir, false, true, '.gif.jpg.jpeg.png');
$avatars = array();
foreach ($avatars2 as $av) {
$name = GetFileName($av, true);
$sub = substr($name, -3);
if ($sub != 'x24' && $sub != 'x64') {
$avatars[] = $av;
}
}
$c = count($avatars);
$allsize = 0;
$text = '<table cellspacing="0" cellpadding="0" class="cfgtable">';
if ($c > 0) {
$col = 0;
for ($i = 0; $i < $c; $i++) {
if ($col == 0) {
$text .= '<tr>';
}
$col++;
$imagfn = $dir . $avatars[$i];
$size = getimagesize($imagfn);
$fsize = filesize($imagfn);
$allsize = $allsize + $fsize;
if ($galeryedit) {
$funcs = System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=user&a=delavatar&filename=' . $avatars[$i] . ($personal ? '&personal' : ''), 'images/admin/delete.png', 'Удалить аватар?');
} else {
$funcs = ' ';
}
$text .= '<td align="center">
<table cellspacing="0" cellpadding="0" align="center" style="border:none; background: none;">
<tr style="border:none; background: none;">
<td style="border:none; background: none;"><a href="' . $imagfn . '" target="_blank"><img src="' . $imagfn . '" border="0" width="64" title="(' . $size[0] . ' x ' . $size[1] . ', ' . FormatFileSize($fsize) . ') ' . $avatars[$i] . '" /></a></td>
<td valign="top" style="border:none; background: none;">' . $funcs . '</td>
</tr>
';
if ($personal && isset($users[$avatars[$i]])) {
$text .= '<tr><td colspan="2" align="left" style="border:none; background: none;"><a href="' . ADMIN_FILE . '?exe=user&a=edituser&id=' . SafeDB($users[$users[$avatars[$i]]]['id'], 11, int) . '">' . SafeDB($users[$users[$avatars[$i]]]['name'], 255, str) . '</a></td></tr>';
}
$text .= '</table></td>';
if ($col == 5) {
$text .= '</tr>';
$col = 0;
}
}
if ($col < 5) {
$text .= '<td colspan="' . (5 - $col) . '"></td>';
$text .= '</tr>';
}
} else {
$text .= '<tr><td>В галерее нет ни одного аватара.</td></tr>';
}
$text .= '</table>';
$info = '<table cellspacing="0" cellpadding="0" border="0" class="cfgtable">
<tr>
<td width="34%">Аватар в галерее: ' . $c . '</td>
<td width="33%">Общий размер: ' . FormatFileSize($allsize) . '</td>
<td>' . $dirlink . '</td>
</tr>
</table>';
$text = $info . $text;
AddCenterBox('Галерея аватар', $text);
AddText($text);
if (!$personal && $galeryedit) {
System::admin()->FormTitleRow('Загрузить аватар');
FormRow('Выберите файл', System::site()->FFile('avatar'));
AddForm(System::site()->FormOpen(ADMIN_FILE . '?exe=user&a=saveavatar', 'post', true), System::site()->Submit('Загрузить'));
}
AddText('<br />');
}
示例8: PieGraph
$graph = new PieGraph(200, 125, "auto");
#$graph->SetAntiAlias(true);
$graph->title->Set("");
$graph->legend->Pos(0.0, 0.0);
$p1 = new PiePlot3d($data);
$p1->SetSliceColors(array('#333333', '#333333'));
$p1->SetCenter(0.5);
$p1->SetSize(50);
$p1->SetAngle(45);
$p1->value->SetColor("#666666");
$p1->SetLegends(explode(",", "" . $key . ""));
$graph->Add($p1);
$graph->Stroke();
} else {
$value = "" . ($quota - $used) . "," . $used . "";
$key = "Free: (" . FormatFileSize($diplayquota - $used) . "),Used: (" . FormatFileSize($used) . ")";
$data = explode(",", "" . $value . "");
$graph = new PieGraph(200, 125, "auto");
#$graph->SetAntiAlias(true);
$graph->title->Set("");
$graph->legend->Pos(0.0, 0.0);
$p1 = new PiePlot3d($data);
$p1->SetSliceColors(array('#039ACA', '#333333'));
$p1->SetCenter(0.5);
$p1->SetSize(50);
$p1->SetAngle(45);
$p1->value->SetColor("#666666");
$p1->SetLegends(explode(",", "" . $key . ""));
$graph->Add($p1);
$graph->Stroke();
}
示例9: GetPrefdLang
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
include 'lang/' . GetPrefdLang($personalinfo['ap_language_vc']) . '.php';
echo $lang['1'];
echo "<br><br>";
echo "\r\n<table class=\"zgrid\">\r\n <tr>\r\n <td align=\"left\" valign=\"top\"><img src=\"inc/zPieGraph.php?used=" . GetQuotaUsages('diskspace', $useraccount['ac_id_pk']) . ""a=" . $quotainfo['qt_diskspace_bi'] . "\" alt=\"Disk usage pie graph\"></td>\r\n <td align=\"left\" valign=\"top\"><table class=\"zgrid\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <th>" . $lang['3'] . "</th>\r\n\r\n <td>" . FormatFileSize(GetQuotaUsages('diskspace', $useraccount['ac_id_pk'])) . " / " . FormatFileSize($quotainfo['qt_diskspace_bi']) . "</td>\r\n </tr>\r\n <tr>\r\n <th>" . $lang['4'] . "</th>\r\n <td>" . FormatFileSize(GetQuotaUsages('bandwidth', $useraccount['ac_id_pk'])) . " / " . FormatFileSize($quotainfo['qt_bandwidth_bi']) . "</td>\r\n\r\n </tr>\r\n <tr>\r\n <th>" . $lang['5'] . "</th>\r\n <td>" . GetQuotaUsages('domains', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_domains_in'] . "</td>\r\n </tr>\r\n\t\t<tr>\r\n <th>" . $lang['6'] . "</th>\r\n\r\n <td>" . GetQuotaUsages('subdomains', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_subdomains_in'] . "</td>\r\n </tr>\r\n\t\t<tr>\r\n <th>" . $lang['7'] . "</th>\r\n\r\n <td>" . GetQuotaUsages('parkeddomains', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_parkeddomains_in'] . "</td>\r\n </tr>\r\n <tr>\r\n <th>" . $lang['8'] . "</th>\r\n <td>" . GetQuotaUsages('ftpaccounts', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_ftpaccounts_in'] . "</td>\r\n </tr>\r\n <tr>\r\n\r\n <th>" . $lang['9'] . "</th>\r\n <td>" . GetQuotaUsages('mysql', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_mysql_in'] . "</td>\r\n </tr>\r\n <tr>\r\n <th>" . $lang['10'] . "</th>\r\n <td>" . GetQuotaUsages('mailboxes', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_mailboxes_in'] . "</td>\r\n </tr>\r\n\r\n <tr>\r\n <th><strong>" . $lang['11'] . "</th>\r\n <td>" . GetQuotaUsages('forwarders', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_fowarders_in'] . "</td>\r\n </tr>\r\n\t\t<tr>\r\n <th>" . $lang['12'] . "</th>\r\n <td>" . GetQuotaUsages('distlists', $useraccount['ac_id_pk']) . " / " . $quotainfo['qt_distlists_in'] . "</td>\r\n </tr>\r\n </table>";
?>
</td>
</tr>
<tr>
<td style="background-image:none" colspan="2">
<table class="none" id="none">
<tr>
<td style="background-image:none; border:none"><?php
echo "<h2>" . $lang['4'] . "</h2><img src=\"inc/zPieGraphSmall.php?used=FFS" . GetQuotaUsages('bandwidth', $useraccount['ac_id_pk']) . ""a=" . $quotainfo['qt_bandwidth_bi'] . "\" alt=\"Disk usage pie graph\">";
?>
</td>
<td style="background-image:none; border:none"><?php
echo "<h2>" . $lang['5'] . "</h2><img src=\"inc/zPieGraphSmall.php?used=" . GetQuotaUsages('domains', $useraccount['ac_id_pk']) . ""a=" . $quotainfo['qt_domains_in'] . "\" alt=\"Disk usage pie graph\">";
示例10: IndexFormsViewForm
function IndexFormsViewForm($form)
{
$form_id = SafeEnv($form['id'], 11, int);
System::site()->AddBlock('forms', true, false, 'form');
System::site()->AddBlock('form_fields', true, true, 'field');
System::site()->AddTemplatedBox('', 'module/forms.html');
$vars['title'] = SafeDB($form['hname'], 255, str);
System::site()->SetTitle($vars['title']);
System::site()->BreadCrumbAdd($vars['title']);
$vars['desc'] = SafeDB($form['desc'], 0, str, false, false);
$controls = unserialize($form['form_data']);
if (trim($form['action']) != '') {
$action = SafeDB($form['action'], 250, str);
} else {
$action = Ufu("index.php?name=forms&form={$form_id}&op=save", 'forms/save/{form}/');
}
$enctype = '';
foreach ($controls as $control) {
$kind = FormsParseParams($control['kind']);
$type = trim($control['type']);
$value = '';
$name = $control['name'];
if (isset($_GET['f_' . $name])) {
$value = SafeDB($_GET['f_' . $name], 255, str);
}
if ($type != '') {
$type = explode(',', $type);
} else {
$type = array(255, str, false);
}
if ($type[1] == 'file') {
if ($type[0] == 0) {
$max_size = intval(ini_get('upload_max_filesize'));
$s_option = strtolower(substr(ini_get('upload_max_filesize'), -1));
} else {
$max_size = $type[0] * 1024;
$s_option = 'b';
}
$max_size = FormatFileSize($max_size, $s_option);
$max_length = false;
} else {
$max_size = false;
$max_length = SafeDB($type[0], 11, int);
}
if ($kind['control'] == 'file') {
$enctype = 'multipart/form-data';
}
$control_vars = array();
$control_vars['hname'] = SafeDB($control['hname'] . ($kind['required'] ? ' *' : ''), 255, str);
$control_vars['title'] = SafeDB($control['hname'], 255, str);
$control_vars['control'] = FormsGetControl(SafeDB($name, 255, str), $value, $control['kind'], $control['type'], $control['values'], $value != '' ? 'disabled' : '');
$control_vars['required'] = $kind['required'];
$control_vars['max_size'] = $max_size;
$control_vars['max_length'] = $max_length;
System::site()->AddSubBlock('form_fields', true, $control_vars);
}
$vars['open'] = System::site()->FormOpen($action, 'post', $enctype == 'multipart/form-data');
$vars['close'] = System::site()->FormClose();
$vars['submit'] = System::site()->Submit('Отправить форму');
// Капча
$vars['show_kaptcha'] = !System::user()->Auth || System::config('forms/show_captcha') && !System::user()->isAdmin();
$vars['kaptcha_url'] = 'index.php?name=plugins&p=antibot';
$vars['kaptcha_width'] = '120';
$vars['kaptcha_height'] = '40';
System::site()->Blocks['forms']['vars'] = $vars;
}
示例11: array
$totalrows = 0;
$light = array();
$i = 0;
foreach ($tables as $r) {
$i++;
$name = SafeDb($r['name'], 255, str);
$a = '';
if ($sort == 'name') {
$F = SafeDb($r['name'], 1, str);
if (!isset($light[$F])) {
$light[$F] = $F;
$a = '<span style="float:right; font-size:18px; margin-right:10px;"><b>' . strtoupper($F) . '</b></span>';
}
}
$func = SpeedButton('PHP код для создания', ADMIN_FILE . '?exe=dbadmin&a=viewtablecode&name=' . $name, 'images/admin/php.png');
$func .= SpeedButton('Переименовать', ADMIN_FILE . '?exe=dbadmin&a=renametable&name=' . $name, 'images/admin/rename.png');
if ($last_backup_name != '') {
$func .= System::admin()->SpeedConfirm('Восстановить из последней резервной копии', ADMIN_FILE . '?exe=dbadmin&a=backup_restore&name=' . $last_backup_name . '&table=' . $name, 'images/admin/restore.png', 'Все текущие данные будут затёрты. Восстановить таблицу из последней резервной копии БД?');
}
$func .= System::admin()->SpeedConfirm('Удалить', ADMIN_FILE . '?exe=dbadmin&a=droptable&name=' . $name . '&ok=0', 'images/admin/delete.png', 'Удалить таблицу?');
$text .= '<tr>' . '<td style="text-align:left; padding-left:10px;">' . $i . $a . '</td>' . '<td align="left" style="text-align:left; padding-left:10px;"><b>' . System::admin()->Link($name, ADMIN_FILE . '?exe=dbadmin&a=structure&name=' . $name) . '</b></td>' . '<td>' . $r['num_rows'] . '</td>' . '<td>' . FormatFileSize($r['size']) . '</td>' . '<td>' . (isset($r['type']) ? $r['type'] : 'По умолчанию') . '</td>' . '<td class="cfgtd">' . $func . '</td>' . '</tr>';
$totalsize += $r['size'];
$totalrows += $r['num_rows'];
System::admin()->BreadCrumbMenuItem($name, 'exe=dbadmin&a=structure&name=' . $name);
}
$text .= '</table><br><br>';
$top_text .= '<strong>Таблиц</strong>: ' . System::database()->NumRows() . '<br>';
$top_text .= '<strong>Всего записей</strong>: ' . $totalrows . '<br>';
$top_text .= '<strong>Общий размер</strong>: ' . FormatFileSize($totalsize) . '<br>';
AddCenterBox('Обзор таблиц (' . System::database()->NumRows() . ')');
AddText($text);
示例12: ShowDir
public function ShowDir($dir)
{
$dir_files = $this->CallDir($dir);
if ($dir_files == false) {
return '';
}
$ret = '';
foreach ($dir_files as $v) {
$thumb = $this->GetThumbUrl($dir, $v['general']['md5'], $v['general']['filename'], 100, 100);
$imageinfo = '';
$middle_thumb_attr = '';
if ($v['general']['type'] == 'image') {
$imageinfo = ' fwidth="' . $v['imageinfo']['width'] . '" fheight="' . $v['imageinfo']['height'] . '" ';
if ($v['imageinfo']['width'] > WIDTH_TO_LINK || $v['imageinfo']['height'] > HEIGHT_TO_LINK) {
if ($v['imageinfo']['width'] > $v['imageinfo']['height']) {
$middle_thumb = $this->GetThumbUrl($dir, $v['general']['md5'], $v['general']['filename'], WIDTH_TO_LINK, 0);
} else {
$middle_thumb = $this->GetThumbUrl($dir, $v['general']['md5'], $v['general']['filename'], 0, HEIGHT_TO_LINK);
}
$middle_thumb = RealPath2(DIR_FILES . '/' . $dir . '/.thumbs/' . basename($middle_thumb));
list($middle_width, $middle_height) = getimagesize($middle_thumb);
$middle_thumb_attr = 'fmiddle="' . $middle_thumb . '" fmiddlewidth="' . $middle_width . '" fmiddleheight="' . $middle_height . '" fclass="' . CLASS_LINK . '" frel="' . REL_LINK . '"';
}
}
$ret .= '<table class="imageBlock0" cellpadding="0" cellspacing="0"
filename="' . $v['general']['filename'] . '"
fname="' . $v['general']['name'] . '"
ext="' . strtoupper($v['general']['ext']) . '"
path="' . $v['general']['path'] . '"
linkto="' . $v['general']['link'] . '"
linkto_url="' . URL_FILES . '/' . ($dir != '' ? $dir . '/' : '') . $v['general']['filename'] . '"
fsize="' . $v['general']['size'] . '"
fsizetext="' . FormatFileSize($v['general']['size']) . '"
date="' . date('d.m.Y H:i', $v['general']['date']) . '"
type="' . $v['general']['type'] . '"
md5="' . $v['general']['md5'] . '"' . $imageinfo . $middle_thumb_attr . '>
<tr>
<td valign="bottom" align="center">
<div class="imageBlock1">
<div class="imageImage">
<img src="' . $thumb . '" alt="' . $v['general']['name'] . '">
</div>
<div class="imageName">' . $v['general']['name'] . '</div>
</div>
</td>
</tr>
</table>';
}
return $ret;
}
示例13: Upload
function Upload($InputName, $DestinationFolder, $DestinationName = '', $TimeStampName = '0', $OverwriteExistingFile = '0')
{
$Return = "";
if (array_key_exists($InputName, $_FILES)) {
$FileName = basename($_FILES[$InputName]['name']);
$FilePieces = explode('.', $FileName);
$FileExtension = $FilePieces[count($FilePieces) - 1];
if ($FileExtension == 'gz' && $FilePieces[count($FilePieces) - 2] == 'tar') {
$FileExtension = 'tar.gz';
}
if ($FileName != '') {
// Define file properties
if ($DestinationName == '') {
$DestinationName = $FileName;
}
$TempFileName = $_FILES[$InputName]['tmp_name'];
$FileType = $_FILES[$InputName]['type'];
$this->CurrentFileSize = $_FILES[$InputName]['size'];
// Ensure the file is not empty
if ($this->CurrentFileSize == 0) {
$this->Context->WarningCollector->Add('The file you attempted to upload (' . $FileName . ') was empty.');
}
// Ensure that the file's type is allowed
if (!array_key_exists($FileType, $this->AllowedFileTypes)) {
$this->Context->WarningCollector->Add('You are not allowed to upload (' . $FileName . ') the requested file type: ' . $FileType);
} else {
// Now make sure that the file type has the proper extension
if (!in_array(strtoupper($FileExtension), explode(',', strtoupper(join(',', $this->AllowedFileTypes[$FileType]))))) {
$Message = '';
for ($i = 0; $i < count($this->AllowedFileTypes[$FileType]); $i++) {
if ($Message != '') {
$Message .= ', ';
}
$Message .= $this->AllowedFileTypes[$FileType][$i];
}
$Message = 'The file you attempted to upload (' . $FileName . ') was of type "' . $FileType . '", but the file extension "' . $FileExtension . '" did not match the accepted extensions for this type of file: ' . $Message;
$this->Context->WarningCollector->Add($Message);
}
}
// Ensure that the file is not beyond the maximum allowable size
if ($this->CurrentFileSize > $this->MaximumFileSize) {
$this->Context->WarningCollector->Add('The file you have attempted to upload (' . $FileName . ') is larger than the allowed size: ' . FormatFileSize($this->MaximumFileSize));
}
if ($this->Context->WarningCollector->Count() == 0) {
// Redefine new file to include proper file extension
$DestinationNameOnly = substr($DestinationName, 0, strpos($DestinationName, '.' . $FileExtension));
if ($TimeStampName) {
$DestinationNameOnly .= date('-Y-m-d', mktime());
$DestinationName = $DestinationNameOnly . '.' . $FileExtension;
}
$Return = $DestinationName;
$NewFilePath = ConcatenatePath($DestinationFolder, $Return);
if (!$OverwriteExistingFile) {
$Loop = 2;
while (file_exists($NewFilePath)) {
$Return = $DestinationNameOnly . $Loop . '.' . $FileExtension;
$NewFilePath = ConcatenatePath($DestinationFolder, $Return);
$Loop++;
}
}
if (!move_uploaded_file($_FILES[$InputName]['tmp_name'], $NewFilePath)) {
$this->Context->WarningCollector->Add('Failed to upload the file: ' . $FileName);
}
}
} else {
$this->Context->WarningCollector->Add('You must provide a file to be uploaded.');
}
} else {
$this->Context->WarningCollector->Add('The file you attempted to upload could not be found in postback data.');
}
return $Return;
}
示例14: Cleaner
<th><?php
echo $lang['131'];
?>
</th>
<th></th>
</tr>
<?php
do {
?>
<tr>
<td><?php
echo Cleaner('o', $rowmysql['my_name_vc']);
?>
</td>
<td><?php
echo Cleaner('o', FormatFileSize($rowmysql['my_usedspace_bi']));
?>
</td>
<td><input type="submit" name="inDelete_<?php
echo $rowmysql['my_id_pk'];
?>
" id="inDelete_<?php
echo $rowmysql['my_id_pk'];
?>
" value="<?php
echo $lang['84'];
?>
" /></td>
</tr>
<?php
} while ($rowmysql = mysql_fetch_assoc($listmysql));
示例15: IndexGalleryFilterImageData
function IndexGalleryFilterImageData($img, $index, $count)
{
global $ThumbsDir, $GalleryDir;
$id = SafeDB($img['id'], 11, int);
$cat_id = SafeDB($img['cat_id'], 11, int);
$filename = SafeDB($img['file'], 255, str);
$vars = array();
$vars['id'] = $id;
$vars['cat_id'] = $cat_id;
$vars['date'] = TimeRender($img['public'], false);
$vars['date_time'] = TimeRender($img['public']);
$vars['title'] = SafeDB($img['title'], 255, str);
$vars['description_plain'] = SafeDB($img['description'], 0, str);
$vars['description'] = SafeDB($img['description'], 0, str, false, false);
$vars['thumb_src'] = $ThumbsDir . $filename;
$vars['image_src'] = $GalleryDir . $filename;
$vars['image_view_full'] = $vars['image_src'];
$vars['image_view'] = Ufu('index.php?name=gallery&op=view&img=' . $id . '&cat=' . $cat_id, 'gallery/{cat}/{img}/');
$vars['size'] = false;
$vars['asize'] = '';
if (is_file($GalleryDir . $filename)) {
$vars['size'] = FormatFileSize(filesize($GalleryDir . $filename));
$asize = getimagesize($GalleryDir . $filename);
$asize = $asize[0] . 'x' . $asize[1];
$vars['asize'] = $asize;
}
$vars['hits'] = SafeDB($img['hits'], 11, int);
$vars['author'] = SafeDB($img['author'], 255, str);
$vars['email'] = SafeDB($img['email'], 255, str);
$vars['site'] = SafeDB($img['site'], 255, str);
$vars['allow_comments'] = SafeDB($img['allow_comments'], 255, str);
$vars['comments'] = SafeDB($img['com_counter'], 11, int);
$vars['allow_votes'] = SafeDB($img['allow_votes'], 1, bool);
$vars['num_votes'] = SafeDB($img['num_votes'], 11, int);
$vars['rating'] = GetRatingImage(SafeDB($img['num_votes'], 11, int), SafeDB($img['sum_votes'], 11, int));
$vars['lcomments'] = 'Комментариев';
$vars['ldescription'] = 'Описание';
$vars['index'] = $index;
$vars['count'] = $count;
$vars['addvote_url'] = "index.php?name=gallery&op=addvote&img={$id}";
System::site()->DataAdd($vdata, '0', 'Ваша оценка');
System::site()->DataAdd($vdata, '1', 'Очень плохо');
System::site()->DataAdd($vdata, '2', 'Плохо');
System::site()->DataAdd($vdata, '3', 'Средне');
System::site()->DataAdd($vdata, '4', 'Хорошо');
System::site()->DataAdd($vdata, '5', 'Отлично');
$vars['votes'] = System::site()->Select('vote', $vdata);
$vars['addvotesubm'] = System::site()->Submit('Оценить изображение');
return $vars;
}