本文整理匯總了PHP中size_readable函數的典型用法代碼示例。如果您正苦於以下問題:PHP size_readable函數的具體用法?PHP size_readable怎麽用?PHP size_readable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了size_readable函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getEntry
function getEntry($num)
{
global $r;
if (!file_exists("data/" . int_esc($num) . "/entry")) {
return "";
}
$entry = file("data/" . int_esc($num) . "/entry");
$textile = new Textile();
$body = join("\n", array_slice($entry, 2));
$size = split("\\.", $entry[0]);
return "<a href='{$r}/?e={$num}'>#{$num}</a> <a href='{$entry['0']}'>{$entry['1']} [" . size_readable($size[2]) . "]</a> <br />\n\tDescription:\n\t" . $textile->TextileRestricted($body) . "\n\t<p class='entrylinks'><a href='{$r}/?e={$num}'>Comments[" . getCommentsNum($num) . "] »</a> </p>\n\t";
}
示例2: upload
//.........這裏部分代碼省略.........
if ($this->uploaded && !is_readable($file)) {
$this->uploaded = false;
$this->error = $this->translate('local_file_not_readable');
}
if ($this->uploaded) {
$this->file_src_pathname = $file;
$this->file_src_name = basename($file);
$this->log .= '- local file name OK<br />';
preg_match('/\\.([^\\.]*$)/', $this->file_src_name, $extension);
if (is_array($extension) && sizeof($extension) > 0) {
$this->file_src_name_ext = strtolower($extension[1]);
$this->file_src_name_body = substr($this->file_src_name, 0, strlen($this->file_src_name) - strlen($this->file_src_name_ext) - 1);
} else {
$this->file_src_name_ext = '';
$this->file_src_name_body = $this->file_src_name;
}
$this->file_src_size = file_exists($this->file_src_pathname) ? filesize($this->file_src_pathname) : 0;
}
$this->file_src_error = 0;
}
}
} else {
// this is an element from $_FILE, i.e. an uploaded file
$this->log .= '<b>source is an uploaded file</b><br />';
if ($this->uploaded) {
$this->file_src_error = trim($file['error']);
switch ($this->file_src_error) {
case UPLOAD_ERR_OK:
// all is OK
$this->log .= '- upload OK<br />';
break;
case UPLOAD_ERR_INI_SIZE:
$this->uploaded = false;
$this->error = sprintf($this->translate('uploaded_too_big_ini'), size_readable(sprintf("%u", $this->file_max_size)));
break;
case UPLOAD_ERR_FORM_SIZE:
$this->uploaded = false;
$this->error = sprintf($this->translate('uploaded_too_big_html'), size_readable(sprintf("%u", $this->file_max_size)));
break;
case UPLOAD_ERR_PARTIAL:
$this->uploaded = false;
$this->error = $this->translate('uploaded_partial');
break;
case UPLOAD_ERR_NO_FILE:
$this->uploaded = false;
$this->error = $this->translate('uploaded_missing');
break;
case @UPLOAD_ERR_NO_TMP_DIR:
$this->uploaded = false;
$this->error = $this->translate('uploaded_no_tmp_dir');
break;
case @UPLOAD_ERR_CANT_WRITE:
$this->uploaded = false;
$this->error = $this->translate('uploaded_cant_write');
break;
case @UPLOAD_ERR_EXTENSION:
$this->uploaded = false;
$this->error = $this->translate('uploaded_err_extension');
break;
default:
$this->uploaded = false;
$this->error = $this->translate('uploaded_unknown') . ' (' . $this->file_src_error . ')';
}
}
if ($this->uploaded) {
$this->file_src_pathname = $file['tmp_name'];
示例3: date
} else {
$maxyears = date("Y") - $minyear['year'];
}
for ($years = 0; $years <= $maxyears; $years++) {
$overview['year'] = date("Y") - $years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$totals = array('jan' => 0, 'feb' => 0, 'mar' => 0, 'apr' => 0, 'may' => 0, 'jun' => 0, 'jul' => 0, 'aug' => 0, 'sep' => 0, 'oct' => 0, 'nov' => 0, 'dec' => 0);
$customer_name_list_stmt = Database::prepare("\n\t\t\tSELECT `customerid`,`company`,`name`,`firstname`\n\t\t\tFROM `" . TABLE_PANEL_CUSTOMERS . "`\n\t\t\tWHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "\n\t\t\tORDER BY name");
Database::pexecute($customer_name_list_stmt, array('id' => $userinfo['adminid']));
while ($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host = array('name' => $customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company'], 'customerid' => $customer_name['customerid'], 'jan' => '-', 'feb' => '-', 'mar' => '-', 'apr' => '-', 'may' => '-', 'jun' => '-', 'jul' => '-', 'aug' => '-', 'sep' => '-', 'oct' => '-', 'nov' => '-', 'dec' => '-');
$traffic_list_stmt = Database::prepare("\n\t\t\t\tSELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic\n\t\t\t\tFROM `" . TABLE_PANEL_TRAFFIC . "`\n\t\t\t\tWHERE year = :year AND `customerid` = :id\n\t\t\t\tGROUP BY month ORDER BY month");
Database::pexecute($traffic_list_stmt, array('year' => date("Y") - $years, 'id' => $customer_name['customerid']));
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host[$months[(int) $traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
}
eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array('name' => $lng['traffic']['months']['total']);
foreach ($totals as $month => $bytes) {
$virtual_host[$month] = $bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
}
示例4: date
if (!isset($minyear['year']) || $minyear['year'] == 0) {
$maxyears = 0;
} else {
$maxyears = date("Y") - $minyear['year'];
}
for ($years = 0; $years <= $maxyears; $years++) {
$overview['year'] = date("Y") - $years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$customer_name_list = $db->query("SELECT `customerid`,`company`,`name`,`firstname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int) $userinfo['adminid'] . "' ") . " ORDER BY name");
$totals = array('jan' => 0, 'feb' => 0, 'mar' => 0, 'apr' => 0, 'may' => 0, 'jun' => 0, 'jul' => 0, 'aug' => 0, 'sep' => 0, 'oct' => 0, 'nov' => 0, 'dec' => 0);
while ($customer_name = $db->fetch_array($customer_name_list)) {
$virtual_host = array('name' => $customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company'], 'customerid' => $customer_name['customerid'], 'jan' => '-', 'feb' => '-', 'mar' => '-', 'apr' => '-', 'may' => '-', 'jun' => '-', 'jul' => '-', 'aug' => '-', 'sep' => '-', 'oct' => '-', 'nov' => '-', 'dec' => '-');
$traffic_list = $db->query("SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE year = " . (date("Y") - $years) . " AND `customerid` = '" . $customer_name['customerid'] . "' GROUP BY month ORDER BY month");
while ($traffic_month = $db->fetch_array($traffic_list)) {
$virtual_host[$months[(int) $traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.3f %s');
$totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
}
eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array('name' => $lng['traffic']['months']['total']);
foreach ($totals as $month => $bytes) {
$virtual_host[$month] = $bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.3f %s');
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
}
示例5: size_readable
<div class="progress" style="height:15px;margin-bottom:0px;">
<div class="progress-bar progress-bar-<?php
echo $info->status->memory->level;
?>
" style="width: <?php
echo $info->status->memory->progress;
?>
%;"></div>
</div>
</td>
<td>
<?php
echo size_readable($info->status->disk->used);
?>
/ <?php
echo size_readable($info->status->disk->total);
?>
<br />
<div class="progress" style="height:15px;margin-bottom:0px;">
<div class="progress-bar progress-bar-<?php
echo $info->status->disk->level;
?>
" style="width: <?php
echo $info->status->disk->progress;
?>
%;"></div>
</div>
</td>
<td>
<span class="label label-success"><?php
echo $info->status->load[0];
示例6: explode
$row['email'] = $idna_convert->decode($row['email']);
$row['email_full'] = $idna_convert->decode($row['email_full']);
$row['destination'] = explode(' ', $row['destination']);
uasort($row['destination'], 'strcasecmp');
while (list($dest_id, $destination) = each($row['destination'])) {
$row['destination'][$dest_id] = $idna_convert->decode($row['destination'][$dest_id]);
if ($row['destination'][$dest_id] == $row['email_full']) {
unset($row['destination'][$dest_id]);
}
}
$destinations_count = count($row['destination']);
$row['destination'] = implode(', ', $row['destination']);
if (strlen($row['destination']) > 35) {
$row['destination'] = substr($row['destination'], 0, 32) . '... (' . $destinations_count . ')';
}
$row['mboxsize'] = size_readable($row['mboxsize'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate("email/emails_email") . "\";");
$count++;
}
$i++;
}
}
$emaildomains_count_stmt = Database::prepare("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "`\n\t\t\tWHERE `customerid`= :customerid\n\t\t\tAND `isemaildomain`='1' ORDER BY `domain` ASC");
Database::pexecute($emaildomains_count_stmt, array("customerid" => $userinfo['customerid']));
$emaildomains_count = $emaildomains_count_stmt->fetch(PDO::FETCH_ASSOC);
$emaildomains_count = $emaildomains_count['count'];
eval("echo \"" . getTemplate("email/emails") . "\";");
} elseif ($action == 'delete' && $id != 0) {
$stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "`\n\t\t\tWHERE `customerid`= :customerid\n\t\t\tAND `id`= :id");
$result = Database::pexecute_first($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
示例7: formatChangesHTML
/**
* Format the changes
*
* @param changes: array of changes
* @param $field_perm an array with the permission associated to each field. false to no check perms
* @param string $artifact_href The direct link to the artifact
* @param $visible_change only needed when using permissions. Returns true if there is any change
* that the user has permission to see
*
* @return string
*/
function formatChangesHTML($changes, $field_perm, $artifact_href, &$visible_change)
{
global $art_field_fact, $Language;
$group_id = $this->ArtifactType->getGroupID();
$visible_change = false;
$out = '';
$out_com = '';
$out_ch = '';
reset($changes);
$fmt = "%20s | %-25s | %s" . $GLOBALS['sys_lf'];
$hp = $this->getHTMLPurifier();
$out .= '<h2>' . $Language->getText('tracker_include_artifact', 'mail_latest_modifications') . '</h2>';
$out .= '
<div class="tracker_artifact_followup_header">
<div class="tracker_artifact_followup_title">
<span class="tracker_artifact_followup_title_user">';
if ($this->hasFieldPermission($field_perm, 'assigned_to') || $this->hasFieldPermission($field_perm, 'multi_assigned_to') || !isset($field_perm['assigned_to']) && !isset($field_perm['multi_assigned_to'])) {
$user = UserManager::instance()->getCurrentUser();
if ($user->isLoggedIn()) {
$out .= '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ')</a>';
} else {
$out = $Language->getText('tracker_include_artifact', 'anon_user');
}
}
$timezone = '';
if ($user->getId() != 0) {
$timezone = ' (' . $user->getTimezone() . ')';
}
$out .= '
</span>
</div>
<div class="tracker_artifact_followup_date">' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $_SERVER['REQUEST_TIME']) . $timezone . '</div>
</div>
<div class="tracker_artifact_followup_avatar">
' . $user->fetchHtmlAvatar() . '
</div>
<div class="tracker_artifact_followup_content">
<div class="tracker_artifact_followup_comment">';
//Process special cases first: follow-up comment
if (!empty($changes['comment'])) {
$visible_change = true;
if (!empty($changes['comment']['type']) && $changes['comment']['type'] != $Language->getText('global', 'none')) {
$out_com .= "<strong>[" . $changes['comment']['type'] . "]</strong><br />";
}
$out_com .= '<div class="tracker_artifact_followup_comment_body">';
$out_com .= $this->formatFollowUp($group_id, $changes['comment']['format'], $changes['comment']['add'], self::OUTPUT_BROWSER);
$out_com .= '</div>';
unset($changes['comment']);
}
//Process special cases first: file attachment
if (!empty($changes['attach'])) {
$visible_change = true;
$out_ch .= '<tr>';
$out_ch .= '<td valign="top"><strong>' . $Language->getText('tracker_include_artifact', 'add_attachment') . '</strong></td>';
$out_ch .= '<td valign="top"><a href="' . $changes['attach']['href'] . '">' . $hp->purify($changes['attach']['name']) . '</a> (' . size_readable($changes['attach']['size']) . ')</td>';
$out_ch .= '</tr>';
unset($changes['attach']);
}
// All the rest of the fields now
reset($changes);
foreach ($changes as $field_name => $h) {
// If both removed and added items are empty skip - Sanity check
if ((!empty($h['del']) || !empty($h['add'])) && $this->hasFieldPermission($field_perm, $field_name)) {
$visible_change = true;
$label = $field_name;
$field = $art_field_fact->getFieldFromName($field_name);
if ($field) {
$label = $field->getLabel();
if (isset($h['del'])) {
$h['del'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['del']));
}
if (isset($h['add'])) {
$h['add'] = SimpleSanitizer::unsanitize(util_unconvert_htmlspecialchars($h['add']));
}
}
$out_ch .= '<tr>';
$out_ch .= ' <td valign="top" nowrap="nowrap"><ul style="margin:0; padding:0; margin-left:1.5em; "><li><strong>' . $hp->purify(SimpleSanitizer::unsanitize($label)) . ': </strong></li></ul></td>';
$out_ch .= ' <td valign="top">';
if ($field && ($field->getDisplayType() == 'TA' || $field->getDisplayType() == 'TF')) {
$before = explode("\n", $h['del']);
$after = explode("\n", $h['add']);
$callback = array(Codendi_HTMLPurifier::instance(), 'purify');
$d = new Codendi_Diff(array_map($callback, $before, array_fill(0, count($before), CODENDI_PURIFIER_CONVERT_HTML)), array_map($callback, $after, array_fill(0, count($after), CODENDI_PURIFIER_CONVERT_HTML)));
$f = new Codendi_HtmlUnifiedDiffFormatter(2);
$diff = $f->format($d);
if ($diff) {
$out_ch .= '<div class="diff">' . $diff . '</div>';
}
} else {
//.........這裏部分代碼省略.........
示例8: before_soapCall
function before_soapCall(&$loaded_params)
{
$this->soapCommand = 'addUploadedFile';
if (!$loaded_params['others']['uploaded_file'] && !$loaded_params['others']['local_file']) {
exit_error("You must specify a file name with either the --local_file or --uploaded_file parameter, depending the way you want to add the file.");
} else {
if (!$loaded_params['others']['local_file']) {
// we will test if the file is present in the incoming directory
$uploaded_files = $GLOBALS['soap']->call("getUploadedFiles", array('group_id' => $loaded_params['soap']['group_id']));
if (!in_array($loaded_params['others']['uploaded_file'], $uploaded_files)) {
exit_error("File '" . $loaded_params['others']['uploaded_file'] . "' not found in incoming directory.");
}
$loaded_params['soap']['filename'] = $loaded_params['others']['uploaded_file'];
} else {
$localFileLocation = $loaded_params['others']['local_file'];
if (!file_exists($localFileLocation)) {
exit_error("File '" . $localFileLocation . "' doesn't exist");
} else {
if (!is_readable($localFileLocation)) {
exit_error("Could not open '" . $localFileLocation . "' for reading");
} else {
// TODO : use PHP_BigFile
//$path = PHP_BigFile::stream(realpath($localFileLocation));
$path = realpath($localFileLocation);
$GLOBALS['LOG']->add('Calculating md5 checksum of the file ...');
$loaded_params['soap']['reference_md5'] = PHP_BigFile::getMd5Sum($path);
$GLOBALS['LOG']->add('Md5 checksum calculated.');
$offset = 0;
$chunkSize = $GLOBALS['soap']->getFileChunkSize();
$startTime = microtime(true);
$totalTran = 0;
$i = 0;
/* During this loop the file in construction in the incoming directory
* may be corrupted by concurrent access, such as releasing it
* or use of addFileChunk again with the same filename.
* This corruption will be automatically detected at the end of upload
* when comparing the md5 sums and file will not be released.
*/
do {
$offset = $i * $chunkSize;
$contents = file_get_contents($path, false, NULL, $offset, $chunkSize);
$cLength = strlen($contents);
$contents = base64_encode($contents);
if ($i == 0) {
$firstChunk = true;
} else {
$firstChunk = false;
}
$addedSize = $GLOBALS['soap']->call("addFileChunk", array('filename' => basename($path), 'contents' => $contents, 'first_chunk' => $firstChunk));
if ($addedSize == $cLength) {
$totalTran += $cLength;
$i++;
} else {
exit_error("Upload of the file failed");
}
} while ($cLength >= $chunkSize);
$endTime = microtime(true);
$transRate = $totalTran / ($endTime - $startTime);
$GLOBALS['LOG']->add('Transfer rate: ' . size_readable($transRate, null, 'bi', '%.2f %s/s'));
$loaded_params['soap']['filename'] = basename($loaded_params['others']['local_file']);
$loaded_params['soap']['is_upload'] = true;
}
}
}
// sort the parameters in the right order
uksort($loaded_params['soap'], array($this, "sort_parameters"));
}
}
示例9: opendir
}
$zipu = opendir($yu);
#open directory
while (false !== ($zyu = readdir($zipu))) {
# if (!eregi("\.html",$zyu) && !eregi("error",$zyu) && $zyu!='.' && $zyu!='..' && !is_dir($yu."/".$zyu))
if (!preg_match("/(\\.html|error)\$/i", $zyu) && !preg_match("/^[\\.]/", $zyu) && !is_dir($yu . "/" . $zyu)) {
$ziparrayu[] = $zyu;
}
}
closedir($zipu);
if ($ziparrayu) {
sort($ziparrayu);
echo "\n<table BORDER=1 CELLSPACING=0 CELLPADDING=0 class=table>";
echo "\n<tr>\n<td valign=top align=center nowrap=\"nowrap\"><font size=4 color=blue><b>" . A_CHAT_LOGS_27 . " " . A_CHAT_LOGS_12 . "</b></font></td></tr>\n<tr>\n<td valign=top align=left nowrap=\"nowrap\">";
$zipu_size = 0;
foreach ($ziparrayu as $zyu) {
$yu_time = strftime(L_SHORT_DATETIME, filemtime($yu . "/" . $zyu));
if (strstr($L, "chinese") || strstr($L, "korean") || strstr($L, "japanese")) {
$yu_time = str_replace(" ", "", $yu_time);
}
echo "\n<li><a href=\"{$pstr}&fdel=" . $yu . "/" . $zyu . "\" onclick=\"return confirm('" . sprintf(A_CHAT_LOGS_14 . A_CHAT_LOGS_12 . A_CHAT_LOGS_19, $zyu) . "')\" title='" . A_CHAT_LOGS_29 . " " . A_CHAT_LOGS_12 . "'><font size=-2 color=red><b>x</b></font></a> <a href={$yu}/{$zyu} title='" . sprintf(A_CHAT_LOGS_28, $zyu) . " " . A_CHAT_LOGS_12 . "'>{$zyu}</a> (" . size_readable(filesize($yu . "/" . $zyu)) . " / " . $yu_time . ")";
#print name of each file found
$zipu_size = $zipu_size + filesize($yu . "/" . $zyu);
}
echo "\n</td>\n</tr>\n<td valign=top nowrap=\"nowrap\" class=\"notify\"><li>" . sprintf(A_CHAT_LOGS_31, " = ", size_readable($zipu_size, '%01.2f %s')) . "</td>\n</tr>\n</table>\n<br />\n";
}
unset($ziparrayu);
$totalu_size = $totalu_size + $zipu_size;
echo "\n<table BORDER=1 CELLSPACING=0 CELLPADDING=0 class=table>\n<tr>\n<td valign=top align=center nowrap=\"nowrap\" class=\"notify\" colspan=7>" . sprintf(A_CHAT_LOGS_31, A_CHAT_LOGS_12 . " = ", size_readable($totalu_size, '%01.2f %s')) . "</td>\n</tr>\n</table>\n<br />\n";
echo "\n<P ALIGN=right><A HREF=#full>" . A_CHAT_LOGS_20 . "</A>\n<br />\n<A HREF=#home>" . A_CHAT_LOGS_21 . "</A></P><CENTER>";
}
示例10: implode
$tplFolger->assign('cur-dir', implode('/', $aTmp));
} else {
$tplFolger->assign('cur-dir', implode('/', $aCurPath) . '/' . $v);
}
$tplFolger->assign('v', $v);
$tplDir->assign('Folger', $tplFolger);
$tplFolger->reset();
} elseif (is_file($sCurDir . '/' . $v)) {
$tplFile = $tplDir->fetchBlock('File');
$tplFile->assign('v', $v);
$rImg = imagecreatefromjpeg($sCurDir . '/' . $v);
$nWidth = imagesx($rImg);
$nHeight = imagesy($rImg);
$tplFile->assign('_name', $v);
$tplFile->assign('_resolution', $nWidth . '*' . $nHeight);
$tplFile->assign('_size', size_readable(filesize($sCurDir . '/' . $v)));
$tplFile->assign('file', '/userfiles/' . $_GET['cur-dir'] . '/' . $v);
$tplDir->assign('File', $tplFile);
$tplFile->reset();
}
if ($v == '..') {
$tplDir->assign('Del', '');
} else {
$tplDel = $tplDir->fetchBlock('Del');
$tplDel->assign('path', implode('/', $aCurPath) . '/' . $v);
$tplDir->assign('Del', $tplDel);
$tplDel->reset();
}
$tpl->assign('dir', $tplDir);
$tplDir->reset();
}
示例11: array
$handle->dir_auto_chmod = true;
$handle->dir_chmod = 0777;
$handle->mime_check = true;
$handle->mime_magic_check = true;
$handle->no_script = false;
$handle->allowed = array('image/*');
$handle->image_convert = 'gif';
# $handle->image_bevel = 3;
# $handle->image_frame = 1;
# $handle->image_frame_colors = array('#999999', '#FF0000', '#666666', '#333333', '#000000');
$handle->Process("./images/avatars/uploaded/");
// we check if everything went OK
if ($handle->processed) {
$avatar = C_AVA_RELPATH . "uploaded/" . $handle->file_dst_name;
unset($url);
$avamsgupload = "<P class=\"success\">" . sprintf(L_UPLOAD_SUCCESS, $handle->file_src_name . " (" . size_readable($handle->file_src_size) . ")", $handle->file_dst_name . " (" . size_readable(sprintf("%u", filesize($handle->file_dst_pathname))) . ")") . "</P>";
} else {
$avamsgupload = "<P class=\"error\">" . $handle->error . "</P>";
}
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
$avamsgupload = "<P class=\"error\">" . $handle->error . "</P>";
}
// we delete the temporary files
$handle->Clean();
}
$DbAva = new DB();
// it's a URL string, perhaps.
// parse a avatar image from input url
if (isset($url)) {
示例12: soapCall
function soapCall($soap_params, $use_extra_params = true)
{
// Prepare SOAP parameters
$callParams = $soap_params;
unset($callParams['remote_name']);
unset($callParams['output']);
$callParams['chunk_offset'] = 0;
$callParams['chunk_size'] = $GLOBALS['soap']->getFileChunkSize();
$startTime = microtime(true);
$totalTran = 0;
$i = 0;
do {
$callParams['chunk_offset'] = $i * $GLOBALS['soap']->getFileChunkSize();
$content = base64_decode($GLOBALS['soap']->call($this->soapCommand, $callParams, $use_extra_params));
if ($i == 0) {
$this->manageOutput($soap_params, $output, $fd);
}
$cLength = strlen($content);
if ($output !== false) {
$written = fwrite($fd, $content);
if ($written != $cLength) {
throw new Exception('Received ' . $cLength . ' of data but only ' . $written . ' written on Disk');
}
} else {
echo $content;
}
$totalTran += $cLength;
$i++;
} while ($cLength >= $GLOBALS['soap']->getFileChunkSize());
$endTime = microtime(true);
$transRate = $totalTran / ($endTime - $startTime);
$GLOBALS['LOG']->add('Transfer rate: ' . size_readable($transRate, null, 'bi', '%.2f %s/s'));
// Finish!
if ($output !== false) {
fclose($fd);
unset($callParams['chunk_offset']);
unset($callParams['chunk_size']);
//Check the md5sum
$localChecksum = PHP_BigFile::getMd5Sum($output);
$remoteChecksum = $GLOBALS['soap']->call('getDocmanFileMD5sum', $callParams, $use_extra_params);
if ($localChecksum == $remoteChecksum) {
echo "File retrieved successfully.\n";
} else {
exit_error("Local and remote checksums are not the same. Try to download it again.\n");
}
}
}
示例13: display
//.........這裏部分代碼省略.........
><?php
echo TimeDate::toDisplayDate($jLicence->licence['license_expiry']);
?>
</td>
<td <?php
echo $center;
?>
><?php
echo $jLicence->getActiveUserCount();
?>
/ <?php
echo $jLicence->getLicensedUsers();
?>
</td>
</tr>
</tbody>
<thead>
<tr>
<th <?php
echo $center;
?>
colspan="4"><?php
echo $jLang['_ADMIN_DASH_LOGGING'];
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td nowrap><?php
echo $jLang['_ADMIN_DASH_FILE_SIZE'];
?>
: <?php
echo size_readable(filesize($mosConfig_absolute_path . '/components/com_jtips/jtips.log'));
?>
</td>
<td <?php
echo $center;
?>
><a href="index2.php?option=com_jtips&task=DownloadLog&module=Dashboard"><?php
echo $jLang['_ADMIN_DASH_DOWNLOAD'];
?>
</a></td>
<td <?php
echo $center;
?>
><a href="index2.php?option=com_jtips&task=PurgeLog&module=Dashboard"><?php
echo $jLang['_ADMIN_DASH_PURGE'];
?>
</a></td>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4"><small><em><?php
echo $jLang['_ADMIN_DASH_LOG_ROTATED'];
?>
</em></small></td>
</tr>
</tfoot>
</table>
<?php
$tabs->endTab();
$tabs->startTab($jLang['_ADMIN_DASH_TAB_ABOUT'], 'about');
?>
示例14: array
<tbody>
<?php
//create list of file names
$files = array();
foreach (new DirectoryIterator($save_dir) as $fileinfo) {
if (!is_dir($save_dir . $fileinfo)) {
$files[$fileinfo->getMTime()] = $fileinfo->getFilename();
}
}
krsort($files);
$dirArray = array_values($files);
//loop through the array of files
for ($index = 0; $index < count($dirArray); $index++) {
$file_name = $dirArray[$index];
$file_path = str_replace(" ", "%20", $save_dir . $dirArray[$index]);
$file_size = size_readable(filesize($save_dir . $dirArray[$index]));
$file_modtime = strftime('%c', filemtime($save_dir . $dirArray[$index]));
$file_new = $index === 0 && $action_save && $scanner_ok && time() - filemtime($save_dir . $dirArray[$index]) <= 60;
if (!$do_file_timezone) {
$file_modtime = str_replace(array(' CET', ' CEST'), '', $file_modtime);
}
//file type and category
$file_extention = findexts($dirArray[$index]);
$file_category = '';
switch ($file_extention) {
case "bmp":
$file_extention = $lang[$lang_id][47];
$file_category = "image";
break;
case "jpg":
case "jpeg":
示例15: redir
if ($_POST['simple']) {
redir("{$r}/{$nImgPrefix}/{$uplImage}");
} elseif ($useHtaccess) {
redir("{$r}/i/{$uplImage}");
} else {
redir("{$r}/{$nImgPrefix}/html/{$uplImage}.html");
}
}
} elseif (isset($_FILES['file']) && $filesEnabled) {
$uplFile = nFileHandleUpload($_FILES['file']);
$about = preg_replace("/^.*:([^:]+)\$/", "\$1", exec("file --mime {$nFilePrefix}/{$uplFile}"));
if (!$uplFile) {
err_inf("Something is wrong. " . $_FILES['image']['error']);
} else {
$fullname = split('/', $uplFile);
file_put_contents("{$nFilePrefix}/html/{$uplFile}.html", "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ru' lang='ru'>\n\t<head>\n\t<title>{$fullname['1']}</title>\n\t<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n\t<link rel='icon' type='image/png' href='{$r}/favicon.png' />\n\t<link rel='STYLESHEET' href='{$r}/css.css' type= 'text/css' />\n\t</head>\n\t<body><p>\n\t{$fullname['1']}, {$about}, " . size_readable(filesize("{$nFilePrefix}/{$uplFile}"), null, '%d %s') . "\n\t<br />\n\t<a href='http://{$siteroot}{$r}/{$nFilePrefix}/{$uplFile}'>Download</a></p>\n\t<form action='{$r}/' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='MAX_FILE_SIZE' value='{$filelimit}' />\n\t<input type='file' size='50' name='file' /> <br />\n\t<input type='submit' value='Dump another one!' />\n\t<a href='{$r}/'>NBL file dumping facility</a> | <small><a href='{$r}/?delete={$nFilePrefix}/{$uplFile}'>Delete this file</a></small> </body></html>");
chmod("{$nFilePrefix}/html/{$uplFile}.html", 0755) or $fail = 1;
if ($_POST['simple']) {
redir("{$r}/{$nFilePrefix}/{$uplFile}");
} elseif ($useHtaccess) {
redir("{$r}/f/{$uplFile}");
} else {
redir("{$r}/{$nFilePrefix}/html/{$uplFile}.html");
}
}
}
// uploading form
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ru' lang='ru'>\n<head>\n<title>NBL file dumping facility</title>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n<link rel='icon' type='image/png' href='{$r}/favicon.png' />\n<link rel='STYLESHEET' href='{$r}/css.css' type= 'text/css' />\n</head>\n<body><div class='content'>\n";
inf_err();
if ($imagingEnabled) {
echo "\n<h2> Dump a picture </h2>\n\t<form action='{$r}/' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='MAX_FILE_SIZE' value='{$imglimit}' />\n\t<input type='file' size='50' name='image' /> <br />\n\t<input type='submit' value='Dump!' />\n</form>";