本文整理汇总了PHP中get_friendly_size函数的典型用法代码示例。如果您正苦于以下问题:PHP get_friendly_size函数的具体用法?PHP get_friendly_size怎么用?PHP get_friendly_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_friendly_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: array
if ($ext == 'gz' || $ext == 'sql') {
$backups[@filemtime(MYBB_ADMIN_DIR . 'backups/' . $file)] = array("file" => $file, "time" => @filemtime(MYBB_ADMIN_DIR . 'backups/' . $file), "type" => $ext);
}
}
}
$count = count($backups);
krsort($backups);
$table = new Table();
$table->construct_header($lang->backup_filename);
$table->construct_header($lang->file_size, array("class" => "align_center"));
$table->construct_header($lang->creation_date);
$table->construct_header($lang->controls, array("class" => "align_center"));
foreach ($backups as $backup) {
if ($backup['time']) {
$time = my_date($mybb->settings['dateformat'] . ", " . $mybb->settings['timeformat'], $backup['time']);
} else {
$time = "-";
}
$table->construct_cell("<a href=\"index.php?module=tools-backupdb&action=dlbackup&file={$backup['file']}\">{$backup['file']}</a>");
$table->construct_cell(get_friendly_size(filesize(MYBB_ADMIN_DIR . 'backups/' . $backup['file'])), array("class" => "align_center"));
$table->construct_cell($time);
$table->construct_cell("<a href=\"index.php?module=tools-backupdb&action=backup&action=delete&file={$backup['file']}&my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_backup_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));
$table->construct_row();
}
if ($count == 0) {
$table->construct_cell($lang->no_backups, array('colspan' => 4));
$table->construct_row();
}
$table->output($lang->existing_database_backups);
$page->output_footer();
}
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:backupdb.php
示例2: output_footer
/**
* Output the page footer.
*/
function output_footer($quit = true)
{
global $mybb, $maintimer, $db, $lang, $plugins;
$plugins->run_hooks("admin_page_output_footer");
$memory_usage = get_friendly_size(get_memory_usage());
$totaltime = $maintimer->stop();
$querycount = $db->query_count;
echo "\t\t\t</div>\n";
echo "\t\t</div>\n";
echo "\t<br style=\"clear: both;\" />";
echo "\t<br style=\"clear: both;\" />";
echo "\t</div>\n";
echo "<div id=\"footer\"><p class=\"generation\">" . $lang->sprintf($lang->generated_in, $totaltime, $querycount, $memory_usage) . "</p><p class=\"powered\">Powered By MyBB. © " . COPY_YEAR . " MyBB Group. All Rights Reserved.</p></div>\n";
if ($mybb->debug_mode) {
echo $db->explain;
}
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
if ($quit != false) {
exit;
}
}
开发者ID:KasaiDot,项目名称:mybb,代码行数:26,代码来源:class_page.php
示例3: build_attachment_row
function build_attachment_row($attachment, &$table, $use_form = false)
{
global $mybb, $form;
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
// Here we do a bit of detection, we want to automatically check for removal any missing attachments and any not assigned to a post uploaded > 24hours ago
// Check if the attachment exists in the file system
$checked = false;
$title = $cell_class = '';
if (!file_exists(MYBB_ROOT . $mybb->settings['uploadspath'] . "/{$attachment['attachname']}")) {
$cell_class = "bad_attachment";
$title = $lang->error_not_found;
$checked = true;
} elseif (!$attachment['pid'] && $attachment['dateuploaded'] < TIME_NOW - 60 * 60 * 24 && $attachment['dateuploaded'] != 0) {
$cell_class = "bad_attachment";
$title = $lang->error_not_attached;
$checked = true;
} else {
if (!$attachment['tid'] && $attachment['pid']) {
$cell_class = "bad_attachment";
$title = $lang->error_does_not_exist;
$checked = true;
} else {
if ($attachment['visible'] == 0) {
$cell_class = "invisible_attachment";
}
}
}
if ($cell_class) {
$cell_class .= " align_center";
} else {
$cell_class = "align_center";
}
if ($use_form == true && is_object($form)) {
$table->construct_cell($form->generate_check_box('aids[]', $attachment['aid'], '', array('checked' => $checked)));
}
$table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));
$table->construct_cell("<a href=\"../attachment.php?aid={$attachment['aid']}\" target=\"_blank\">{$attachment['filename']}</a>");
$table->construct_cell(get_friendly_size($attachment['filesize']), array('class' => $cell_class));
if ($attachment['user_username']) {
$attachment['username'] = $attachment['username'];
}
$table->construct_cell(build_profile_link($attachment['username'], $attachment['uid'], "_blank"), array("class" => "align_center"));
$table->construct_cell("<a href=\"../" . get_post_link($attachment['pid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($attachment['subject']) . "</a>", array("class" => "align_center"));
$table->construct_cell(my_number_format($attachment['downloads']), array("class" => "align_center"));
if ($attachment['dateuploaded'] > 0) {
$date = my_date($mybb->settings['dateformat'], $attachment['dateuploaded']) . ", " . my_date($mybb->settings['timeformat'], $attachment['dateuploaded']);
} else {
$date = $lang->unknown;
}
$table->construct_cell($date, array("class" => "align_center"));
$table->construct_row();
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:52,代码来源:attachments.php
示例4: elseif
if ($user['avatartype'] == "gallery" || stristr($user['avatar'], $mybb->settings['avatardir'])) {
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_gallery_avatar}</strong>";
} elseif ($user['avatartype'] == "remote" || my_strpos(my_strtolower($user['avatar']), "http://") !== false) {
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_remote_avatar}</strong>";
$avatar_url = $user['avatar'];
}
}
if ($errors) {
$avatar_url = htmlspecialchars_uni($mybb->input['avatar_url']);
}
if ($mybb->settings['maxavatardims'] != "") {
list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
$max_size = "<br />{$lang->max_dimensions_are} {$max_width}x{$max_height}";
}
if ($mybb->settings['avatarsize']) {
$maximum_size = get_friendly_size($mybb->settings['avatarsize'] * 1024);
$max_size .= "<br />{$lang->avatar_max_size} {$maximum_size}";
}
if ($user['avatar']) {
$remove_avatar = "<br /><br />" . $form->generate_check_box("remove_avatar", 1, "<strong>{$lang->remove_avatar}</strong>");
}
$table->construct_cell($lang->avatar_desc . "{$remove_avatar}<br /><small>{$max_size}</small>");
$table->construct_row();
$table->output($lang->avatar . ": {$user['username']}");
// Custom avatar
if ($mybb->settings['avatarresizing'] == "auto") {
$auto_resize = $lang->avatar_auto_resize;
} else {
if ($mybb->settings['avatarresizing'] == "user") {
$auto_resize = "<input type=\"checkbox\" name=\"auto_resize\" value=\"1\" checked=\"checked\" id=\"auto_resize\" /> <label for=\"auto_resize\">{$lang->attempt_to_auto_resize}</label></span>";
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:users.php
示例5: upload_attachment
/**
* Upload an attachment in to the file system
*
* @param array Attachment data (as fed by PHPs $_FILE)
* @return array Array of attachment data if successful, otherwise array of error data
*/
function upload_attachment($attachment)
{
global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache;
$posthash = $db->escape_string($mybb->input['posthash']);
if (isset($attachment['error']) && $attachment['error'] != 0) {
$ret['error'] = $lang->error_uploadfailed . $lang->error_uploadfailed_detail;
switch ($attachment['error']) {
case 1:
// UPLOAD_ERR_INI_SIZE
$ret['error'] .= $lang->error_uploadfailed_php1;
break;
case 2:
// UPLOAD_ERR_FORM_SIZE
$ret['error'] .= $lang->error_uploadfailed_php2;
break;
case 3:
// UPLOAD_ERR_PARTIAL
$ret['error'] .= $lang->error_uploadfailed_php3;
break;
case 4:
// UPLOAD_ERR_NO_FILE
$ret['error'] .= $lang->error_uploadfailed_php4;
break;
case 6:
// UPLOAD_ERR_NO_TMP_DIR
$ret['error'] .= $lang->error_uploadfailed_php6;
break;
case 7:
// UPLOAD_ERR_CANT_WRITE
$ret['error'] .= $lang->error_uploadfailed_php7;
break;
default:
$ret['error'] .= $lang->sprintf($lang->error_uploadfailed_phpx, $attachment['error']);
break;
}
return $ret;
}
if (!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name'])) {
$ret['error'] = $lang->error_uploadfailed . $lang->error_uploadfailed_php4;
return $ret;
}
$ext = get_extension($attachment['name']);
// Check if we have a valid extension
$query = $db->simple_select("attachtypes", "*", "extension='" . $db->escape_string($ext) . "'");
$attachtype = $db->fetch_array($query);
if (!$attachtype['atid']) {
$ret['error'] = $lang->error_attachtype;
return $ret;
}
// Check the size
if ($attachment['size'] > $attachtype['maxsize'] * 1024 && $attachtype['maxsize'] != "") {
$ret['error'] = $lang->sprintf($lang->error_attachsize, $attachtype['maxsize']);
return $ret;
}
// Double check attachment space usage
if ($mybb->usergroup['attachquota'] > 0) {
$query = $db->simple_select("attachments", "SUM(filesize) AS ausage", "uid='" . $mybb->user['uid'] . "'");
$usage = $db->fetch_array($query);
$usage = $usage['ausage'] + $attachment['size'];
if ($usage > $mybb->usergroup['attachquota'] * 1024) {
$friendlyquota = get_friendly_size($mybb->usergroup['attachquota'] * 1024);
$ret['error'] = $lang->sprintf($lang->error_reachedattachquota, $friendlyquota);
return $ret;
}
}
// Check if an attachment with this name is already in the post
$query = $db->simple_select("attachments", "*", "filename='" . $db->escape_string($attachment['name']) . "' AND (posthash='{$posthash}' OR (pid='" . intval($pid) . "' AND pid!='0'))");
$prevattach = $db->fetch_array($query);
if ($prevattach['aid']) {
$ret['error'] = $lang->error_alreadyuploaded;
return $ret;
}
// Check if the attachment directory (YYYYMM) exists, if not, create it
$month_dir = gmdate("Ym");
if (!@is_dir($mybb->settings['uploadspath'] . "/" . $month_dir)) {
@mkdir($mybb->settings['uploadspath'] . "/" . $month_dir);
// Still doesn't exist - oh well, throw it in the main directory
if (!@is_dir($mybb->settings['uploadspath'] . "/" . $month_dir)) {
$month_dir = '';
}
}
// If safe_mode is enabled, don't attempt to use the monthly directories as it won't work
if (ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on') {
$month_dir = '';
}
// All seems to be good, lets move the attachment!
$filename = "post_" . $mybb->user['uid'] . "_" . TIME_NOW . "_" . md5(random_str()) . ".attach";
$file = upload_file($attachment, $mybb->settings['uploadspath'] . "/" . $month_dir, $filename);
// Failed to create the attachment in the monthly directory, just throw it in the main directory
if ($file['error'] && $month_dir) {
$file = upload_file($attachment, $mybb->settings['uploadspath'] . '/', $filename);
}
if ($month_dir) {
$filename = $month_dir . "/" . $filename;
//.........这里部分代码省略.........
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:101,代码来源:functions_upload.php
示例6: COUNT
$query = $db->simple_select("attachments", "SUM(filesize) AS ausage, COUNT(aid) AS acount", "uid='" . $mybb->user['uid'] . "'");
$usage = $db->fetch_array($query);
$totalusage = $usage['ausage'];
$totalattachments = $usage['acount'];
$friendlyusage = get_friendly_size($totalusage);
if ($mybb->usergroup['attachquota']) {
$percent = round($totalusage / ($mybb->usergroup['attachquota'] * 1024) * 100) . "%";
$attachquota = get_friendly_size($mybb->usergroup['attachquota'] * 1024);
$usagenote = $lang->sprintf($lang->attachments_usage_quota, $friendlyusage, $attachquota, $percent, $totalattachments);
} else {
$percent = $lang->unlimited;
$attachquota = $lang->unlimited;
$usagenote = $lang->sprintf($lang->attachments_usage, $friendlyusage, $totalattachments);
}
$multipage = multipage($totalattachments, $perpage, $page, "usercp.php?action=attachments");
$bandwidth = get_friendly_size($bandwidth);
if (!$attachments) {
eval("\$attachments = \"" . $templates->get("usercp_attachments_none") . "\";");
$usagenote = '';
}
$plugins->run_hooks("usercp_attachments_end");
eval("\$manageattachments = \"" . $templates->get("usercp_attachments") . "\";");
output_page($manageattachments);
}
if ($mybb->input['action'] == "do_attachments" && $mybb->request_method == "post") {
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));
$plugins->run_hooks("usercp_do_attachments_start");
require_once MYBB_ROOT . "inc/functions_upload.php";
if (!isset($mybb->input['attachments']) || !is_array($mybb->input['attachments'])) {
error($lang->no_attachments_selected);
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:usercp.php
示例7: multipage
$start = 0;
$page = 1;
}
$multipage = multipage($unapproved_attachments, $perpage, $page, "modcp.php?action=modqueue&type=attachments");
$query = $db->query("\n\t\t\tSELECT a.*, p.subject AS postsubject, p.dateline, p.uid, u.username, t.tid, t.subject AS threadsubject\n\t\t\tFROM " . TABLE_PREFIX . "attachments a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.pid=a.pid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n\t\t\tWHERE a.visible='0'{$tflist_queue_attach}\n\t\t\tORDER BY a.dateuploaded DESC\n\t\t\tLIMIT {$start}, {$perpage}\n\t\t");
$attachments = '';
while ($attachment = $db->fetch_array($query)) {
$altbg = alt_trow();
if (!$attachment['dateuploaded']) {
$attachment['dateuploaded'] = $attachment['dateline'];
}
$attachdate = my_date('relative', $attachment['dateuploaded']);
$attachment['postsubject'] = htmlspecialchars_uni($attachment['postsubject']);
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
$attachment['threadsubject'] = htmlspecialchars_uni($attachment['threadsubject']);
$attachment['filesize'] = get_friendly_size($attachment['filesize']);
$link = get_post_link($attachment['pid'], $attachment['tid']) . "#pid{$attachment['pid']}";
$thread_link = get_thread_link($attachment['tid']);
$profile_link = build_profile_link($attachment['username'], $attachment['uid']);
eval("\$attachments .= \"" . $templates->get("modcp_modqueue_attachments_attachment") . "\";");
}
if (!$attachments && $mybb->input['type'] == "attachments") {
eval("\$attachments = \"" . $templates->get("modcp_modqueue_attachments_empty") . "\";");
}
if ($attachments) {
add_breadcrumb($lang->mcp_nav_modqueue_attachments, "modcp.php?action=modqueue&type=attachments");
$plugins->run_hooks("modcp_modqueue_attachments_end");
if ($nummodqueuethreads > 0 || $mybb->usergroup['issupermod'] == 1) {
eval("\$thread_link = \"" . $templates->get("modcp_modqueue_thread_link") . "\";");
$navsep = " | ";
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:modcp.php
示例8: fs_run
function fs_run()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $target, $udata;
if (function_exists("memory_get_usage")) {
$memory_usage = get_friendly_size(memory_get_peak_usage(true));
} else {
$memory_usage = 'Unknown';
}
$query_count = $db->query_count;
// patchs
if ($target['script'] == 'index.php' && empty($target['uid'])) {
--$query_count;
} else {
if ($target['script'] == 'portal.php') {
//++$query_count;
} else {
if ($target['script'] == 'showthread.php') {
++$query_count;
}
}
}
if (!is_array($udata) || empty($udata['uid'])) {
--$query_count;
}
header("content-type: text/xml");
$output = "<?xml version='1.0' encoding='UTF-8'?>\n<FloatStats>\n\t<DatabaseQueries>{$query_count}</DatabaseQueries>\n\t<MemoryUsage>{$memory_usage}</MemoryUsage>\n</FloatStats>";
echo $output;
exit;
}
开发者ID:Sama34,项目名称:ProStats,代码行数:29,代码来源:floatstats.php
示例9: debug_page
/**
* Prints a debug information page
*/
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $lang;
$totaltime = $maintimer->totaltime;
$phptime = $maintimer->format($maintimer->totaltime - $db->query_time);
$query_time = $maintimer->format($db->query_time);
$percentphp = number_format($phptime / $maintimer->totaltime * 100, 2);
$percentsql = number_format($query_time / $maintimer->totaltime * 100, 2);
$phpversion = PHP_VERSION;
$serverload = get_server_load();
if ($mybb->settings['gzipoutput'] != 0) {
$gzipen = "Enabled";
} else {
$gzipen = "Disabled";
}
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
echo "<head>";
echo "<title>MyBB Debug Information</title>";
echo "</head>";
echo "<body>";
echo "<h1>MyBB Debug Information</h1>\n";
echo "<h2>Page Generation</h2>\n";
echo "<table bgcolor=\"#666666\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td bgcolor=\"#CCCCCC\" colspan=\"4\"><b><span style=\"size:2;\">Page Generation Statistics</span></b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Page Generation Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$totaltime} seconds</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">No. DB Queries:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$db->query_count}</font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Processing Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$phptime} seconds ({$percentphp}%)</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">DB Processing Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$query_time} seconds ({$percentsql}%)</font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Extensions Used:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$mybb->config['database']['type']}, xml</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$globaltime} seconds</font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Version:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$phpversion}</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Server Load:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$serverload}</font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">GZip Encoding Status:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$gzipen}</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">No. Templates Used:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">" . count($templates->cache) . " (" . intval(count(explode(",", $templatelist))) . " Cached / " . intval(count($templates->uncached_templates)) . " Manually Loaded)</font></td>\n";
echo "</tr>\n";
$memory_usage = get_memory_usage();
if (!$memory_usage) {
$memory_usage = $lang->unknown;
} else {
$memory_usage = get_friendly_size($memory_usage) . " ({$memory_usage} bytes)";
}
$memory_limit = @ini_get("memory_limit");
echo "<tr>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Memory Usage:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$memory_usage}</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Memory Limit:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$memory_limit}</font></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<h2>Database Connections (" . count($db->connections) . " Total) </h2>\n";
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">" . implode("<br />", $db->connections) . "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<h2>Database Queries (" . $db->query_count . " Total) </h2>\n";
echo $db->explain;
echo "<h2>Template Statistics</h2>\n";
if (count($templates->cache) > 0) {
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - " . count($templates->cache) . " Total</strong></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">" . implode(", ", array_keys($templates->cache)) . "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
}
if (count($templates->uncached_templates) > 0) {
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - " . count($templates->uncached_templates) . " Total</strong></td>\n";
echo "</tr>\n";
//.........这里部分代码省略.........
开发者ID:khanfusiion,项目名称:mybb,代码行数:101,代码来源:functions.php
示例10: my_number_format
$query = $db->simple_select("threads", "COUNT(*) AS newthreads", "dateline > '{$timecut}' AND visible='1' AND closed NOT LIKE 'moved|%'");
$newthreads = my_number_format($db->fetch_field($query, "newthreads"));
// Get the number of posts
$posts = my_number_format($stats['numposts']);
// Get the number of unapproved posts
if ($stats['numunapprovedposts'] < 0) {
$status['numunapprovedposts'] = 0;
}
$unapproved_posts = my_number_format($stats['numunapprovedposts']);
// Get the number of new posts for today
$query = $db->simple_select("posts", "COUNT(*) AS newposts", "dateline > '{$timecut}' AND visible='1'");
$newposts = my_number_format($db->fetch_field($query, "newposts"));
// Get the number and total file size of attachments
$query = $db->simple_select("attachments", "COUNT(*) AS numattachs, SUM(filesize) as spaceused", "visible='1' AND pid > '0'");
$attachs = $db->fetch_array($query);
$attachs['spaceused'] = get_friendly_size($attachs['spaceused']);
// Get the number of unapproved attachments
$query = $db->simple_select("attachments", "COUNT(*) AS numattachs", "visible='0' AND pid > '0'");
$unapproved_attachs = my_number_format($db->fetch_field($query, "numattachs"));
// Fetch the last time an update check was run
$update_check = $cache->read("update_check");
// If last update check was greater than two weeks ago (14 days) show an alert
if (isset($update_check['last_check']) && $update_check['last_check'] <= TIME_NOW - 60 * 60 * 24 * 14) {
$lang->last_update_check_two_weeks = $lang->sprintf($lang->last_update_check_two_weeks, "index.php?module=home-version_check");
$page->output_error("<p>{$lang->last_update_check_two_weeks}</p>");
}
// If the update check contains information about a newer version, show an alert
if (isset($update_check['latest_version_code']) && $update_check['latest_version_code'] > $mybb->version_code) {
$lang->new_version_available = $lang->sprintf($lang->new_version_available, "MyBB {$mybb->version}", "<a href=\"http://mybb.com/downloads\" target=\"_blank\">MyBB {$update_check['latest_version']}</a>");
$page->output_error("<p><em>{$lang->new_version_available}</em></p>");
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:index.php
示例11: array
$table->construct_header("Month", array("colspan" => 1));
$table->construct_header("Year", array("colspan" => 1));
$table->construct_cell("<strong>Total</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($total_bandwidth_week), array('width' => '25%'));
$table->construct_cell(get_friendly_size($total_bandwidth_month), array('width' => '200'));
$table->construct_cell(get_friendly_size($total_bandwidth_year), array('width' => '200'));
$table->construct_row();
$table->construct_cell("<strong>Sent By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($bandwidth_sent_week), array('width' => '25%'));
$table->construct_cell(get_friendly_size($bandwidth_sent_month), array('width' => '200'));
$table->construct_cell(get_friendly_size($bandwidth_sent_year), array('width' => '200'));
$table->construct_row();
$table->construct_cell("<strong>Saved By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($saved_bandwidth_week), array('width' => '25%'));
$table->construct_cell(get_friendly_size($saved_bandwidth_month), array('width' => '200'));
$table->construct_cell(get_friendly_size($saved_bandwidth_year), array('width' => '200'));
$table->construct_row();
$table->output("Bandwidth Usage");
$table = new Table();
$table->construct_header("Type", array("colspan" => 1));
$table->construct_header("Week", array("colspan" => 1));
$table->construct_header("Month", array("colspan" => 1));
$table->construct_header("Year", array("colspan" => 1));
$table->construct_cell("<strong>Total</strong>", array('width' => '25%'));
$table->construct_cell($total_requests_week, array('width' => '25%'));
$table->construct_cell($total_requests_month, array('width' => '25%'));
$table->construct_cell($total_requests_year, array('width' => '25%'));
$table->construct_row();
$table->construct_cell("<strong>Sent By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell($sent_requests_week, array('width' => '25%'));
$table->construct_cell($sent_requests_month, array('width' => '25%'));
开发者ID:nmalcolm,项目名称:mybb-cloudflare-manager,代码行数:31,代码来源:cloudflare_statistics.php
示例12: array
$table->construct_header("Month", array("colspan" => 1));
$table->construct_header("Year", array("colspan" => 1));
$table->construct_cell("<strong>Total</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($total_bandwidth_week) . " (100%)", array('width' => '25%'));
$table->construct_cell(get_friendly_size($total_bandwidth_month) . " (100%)", array('width' => '200'));
$table->construct_cell(get_friendly_size($total_bandwidth_year) . " (100%)", array('width' => '200'));
$table->construct_row();
$table->construct_cell("<strong>Sent By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($bandwidth_sent_week) . " ({$bandwidth_percent_week_sent}%)", array('width' => '25%'));
$table->construct_cell(get_friendly_size($bandwidth_sent_month) . " ({$bandwidth_percent_month_sent}%)", array('width' => '200'));
$table->construct_cell(get_friendly_size($bandwidth_sent_year) . " ({$bandwidth_percent_year_sent}%)", array('width' => '200'));
$table->construct_row();
$table->construct_cell("<strong>Saved By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell(get_friendly_size($saved_bandwidth_week) . " ({$bandwidth_percent_week_saved}%)", array('width' => '25%'));
$table->construct_cell(get_friendly_size($saved_bandwidth_month) . " ({$bandwidth_percent_month_saved}%)", array('width' => '200'));
$table->construct_cell(get_friendly_size($saved_bandwidth_year) . " ({$bandwidth_percent_year_saved}%)", array('width' => '200'));
$table->construct_row();
$table->output("Bandwidth Usage");
$table = new Table();
$table->construct_header("Type", array("colspan" => 1));
$table->construct_header("Week", array("colspan" => 1));
$table->construct_header("Month", array("colspan" => 1));
$table->construct_header("Year", array("colspan" => 1));
$table->construct_cell("<strong>Total</strong>", array('width' => '25%'));
$table->construct_cell(number_format($total_requests_week) . " (100%)", array('width' => '25%'));
$table->construct_cell(number_format($total_requests_month) . " (100%)", array('width' => '25%'));
$table->construct_cell(number_format($total_requests_year) . " (100%)", array('width' => '25%'));
$table->construct_row();
$table->construct_cell("<strong>Sent By CloudFlare</strong>", array('width' => '25%'));
$table->construct_cell(number_format($sent_requests_week) . " ({$requests_percent_week_sent}%)", array('width' => '25%'));
$table->construct_cell(number_format($sent_requests_month) . " ({$requests_percent_month_sent}%)", array('width' => '25%'));
开发者ID:EspialWires,项目名称:MyBB-CloudFlare-Manager,代码行数:31,代码来源:cloudflare_statistics.php
示例13: output_footer
/**
* Output the page footer.
*
* @param bool $quit
*/
function output_footer($quit = true)
{
global $mybb, $maintimer, $db, $lang, $plugins;
$args = array('this' => &$this, 'quit' => &$quit);
$plugins->run_hooks("admin_page_output_footer", $args);
$memory_usage = get_friendly_size(get_memory_usage());
$totaltime = format_time_duration($maintimer->stop());
$querycount = $db->query_count;
if (my_strpos(getenv("REQUEST_URI"), "?")) {
$debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "&debug=1#footer";
} else {
$debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "?debug=1#footer";
}
echo "\t\t\t</div>\n";
echo "\t\t</div>\n";
echo "\t<br style=\"clear: both;\" />";
echo "\t<br style=\"clear: both;\" />";
echo "\t</div>\n";
echo "<div id=\"footer\"><p class=\"generation\">" . $lang->sprintf($lang->generated_in, $totaltime, $debuglink, $querycount, $memory_usage) . "</p><p class=\"powered\">Powered By <a href=\"http://www.mybb.com/\" target=\"_blank\">MyBB</a>, © 2002-" . COPY_YEAR . " <a href=\"http://www.mybb.com/\" target=\"_blank\">MyBB Group</a>.</p></div>\n";
if ($mybb->debug_mode) {
echo $db->explain;
}
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
if ($quit != false) {
exit;
}
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:34,代码来源:class_page.php
示例14: array
$table->construct_header($lang->size, array("class" => "align_center", "width" => 100));
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
$query = $db->simple_select("datacache");
while ($cacheitem = $db->fetch_array($query)) {
$table->construct_cell("<strong><a href=\"index.php?module=tools-cache&action=view&title=" . urlencode($cacheitem['title']) . "\">{$cacheitem['title']}</a></strong>");
$table->construct_cell(get_friendly_size(strlen($cacheitem['cache'])), array("class" => "align_center"));
if (method_exists($cache, "update_" . $cacheitem['title'])) {
$table->construct_cell("<a href=\"index.php?module=tools-cache&action=rebuild&title=" . urlencode($cacheitem['title']) . "&my_post_key={$mybb->post_code}\">" . $lang->rebuild_cache . "</a>", array("class" => "align_center"));
} elseif (method_exists($cache, "reload_" . $cacheitem['title'])) {
$table->construct_cell("<a href=\"index.php?module=tools-cache&action=reload&title=" . urlencode($cacheitem['title']) . "&my_post_key={$mybb->post_code}\">" . $lang->reload_cache . "</a>", array("class" => "align_center"));
} elseif (function_exists("update_" . $cacheitem['title'])) {
$table->construct_cell("<a href=\"index.php?module=tools-cache&action=rebuild&title=" . urlencode($cacheitem['title']) . "&my_post_key={$mybb->post_code}\">" . $lang->rebuild_cache . "</a>", array("class" => "align_center"));
} elseif (function_exists("reload_" . $cacheitem['title'])) {
$table->construct_cell("<a href=\"index.php?module=tools-cache&action=reload&title=" . urlencode($cacheitem['title']) . "&my_post_key={$mybb->post_code}\">" . $lang->reload_cache . "</a>", array("class" => "align_center"));
} else {
$table->construct_cell("");
}
$table->construct_row();
}
// Rebuilds forum settings
$cachedsettings = (array) $mybb->settings;
if (isset($cachedsettings['internal'])) {
unset($cachedsettings['internal']);
}
$table->construct_cell("<strong><a href=\"index.php?module=tools-cache&action=view&title=settings\">settings</a></strong>");
$table->construct_cell(get_friendly_size(strlen(my_serialize($cachedsettings))), array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=tools-cache&action=reload&title=settings&my_post_key={$mybb->post_code}\">" . $lang->reload_cache . "</a>", array("class" => "align_center"));
$table->construct_row();
$table->output("<div style=\"float: right;\"><small><a href=\"index.php?module=tools-cache&action=rebuild_all&my_post_key={$mybb->post_code}\">" . $lang->rebuild_reload_all . "</a></small></div>" . $lang->cache_manager);
$page->output_footer();
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:cache.php
示例15: upload_attachment
/**
* Upload an attachment in to the file system
*
* @param array $attachment Attachment data (as fed by PHPs $_FILE)
* @param boolean $update_attachment Whether or not we are updating a current attachment or inserting a new one
* @return array Array of attachment data if successful, otherwise array of error data
*/
function upload_attachment($attachment, $update_attachment = false)
{
global $mybb, $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache;
$posthash = $db->escape_string($mybb->get_input('posthash'));
$pid = (int) $pid;
if (iss
|
请发表评论