本文整理汇总了PHP中get_human_size函数的典型用法代码示例。如果您正苦于以下问题:PHP get_human_size函数的具体用法?PHP get_human_size怎么用?PHP get_human_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_human_size函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_update_course
//.........这里部分代码省略.........
}
// create the course content directory
$path = AT_CONTENT_DIR . $new_course_id . '/';
@mkdir($path, 0700);
@copy(AT_CONTENT_DIR . 'index.html', AT_CONTENT_DIR . $new_course_id . '/index.html');
// create the course backup directory
$path = AT_BACKUP_DIR . $new_course_id . '/';
@mkdir($path, 0700);
@copy(AT_CONTENT_DIR . 'index.html', AT_BACKUP_DIR . $new_course_id . '/index.html');
/* insert some default content: */
if (!$course_data['course_id'] && $course_data['initial_content'] == '1') {
$contentManager = new ContentManager($db, $new_course_id);
$contentManager->initContent();
$cid = $contentManager->addContent($new_course_id, 0, 1, _AT('welcome_to_atutor'), addslashes(_AT('this_is_content')), '', '', 1, date('Y-m-d H:00:00'));
$announcement = _AT('default_announcement');
$sql = "INSERT INTO %snews VALUES (NULL, %d, %d, NOW(), 1, '%s', '%s')";
$result = queryDB($sql, array(TABLE_PREFIX, $new_course_id, $instructor, _AT('welcome_to_atutor'), $announcement));
if ($isadmin) {
global $sqlout;
write_to_log(AT_ADMIN_LOG_INSERT, 'news', $result, $sqlout);
}
} else {
if (!$course_data['course'] && count($initial_content_info) == 2) {
$Backup->setCourseID($new_course_id);
$Backup->restore($material = TRUE, 'append', $initial_content_info[0], $initial_content_info[1]);
}
}
// custom icon, have to be after directory is created
if ($_FILES['customicon']['tmp_name'] != '') {
$course_data['comments'] = trim($course_data['comments']);
$owner_id = $_SESSION['course_id'];
$owner_type = "1";
if ($_FILES['customicon']['error'] == UPLOAD_ERR_INI_SIZE) {
$msg->addError(array('FILE_TOO_BIG', get_human_size(megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1)))));
} else {
if (!isset($_FILES['customicon']['name']) || $_FILES['customicon']['error'] == UPLOAD_ERR_NO_FILE || $_FILES['customicon']['size'] == 0) {
$msg->addError('FILE_NOT_SELECTED');
} else {
if ($_FILES['customicon']['error'] || !is_uploaded_file($_FILES['customicon']['tmp_name'])) {
$msg->addError('FILE_NOT_SAVED');
}
}
}
if (!$msg->containsErrors()) {
$course_data['description'] = $addslashes(trim($course_data['description']));
$_FILES['customicon']['name'] = addslashes($_FILES['customicon']['name']);
if ($course_data['comments']) {
$num_comments = 1;
} else {
$num_comments = 0;
}
$path = AT_CONTENT_DIR . $owner_id . "/custom_icons/";
if (!is_dir($path)) {
@mkdir($path);
}
// if we can upload custom course icon, it means GD is enabled, no need to check extension again.
$gd_info = gd_info();
$supported_images = array();
if ($gd_info['GIF Create Support']) {
$supported_images[] = 'gif';
}
if ($gd_info['JPG Support'] || $gd_info['JPEG Support']) {
$supported_images[] = 'jpg';
}
if ($gd_info['PNG Support']) {
$supported_images[] = 'png';
示例2: get_human_size
}
}
exit;
}
} else {
$msg->addError(array('MAX_STORAGE_EXCEEDED', get_human_size($my_MaxCourseSize)));
handleAjaxUpload(500);
if ($alter) {
header('Location: ' . $_base_href . 'editor/edit_content.php?cid=' . $_REQUEST['cid'] . SEP . 'pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'tab=' . $_REQUEST['tab']);
} else {
header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'framed=' . $framed . SEP . 'cp=' . $_GET['cp'] . SEP . 'pid=' . $_GET['pid'] . SEP . 'cid=' . $_GET['cid'] . SEP . 'a_type=' . $_GET['a_type']);
}
exit;
}
} else {
$msg->addError(array('FILE_TOO_BIG', get_human_size($my_MaxFileSize)));
handleAjaxUpload(500);
if ($alter) {
header('Location: ' . $_base_href . 'editor/edit_content.php?cid=' . $_REQUEST['cid'] . SEP . 'pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'tab=' . $_REQUEST['tab']);
} else {
header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'framed=' . $framed . SEP . 'cp=' . $_GET['cp'] . SEP . 'pid=' . $_GET['pid'] . SEP . 'cid=' . $_GET['cid'] . SEP . 'a_type=' . $_GET['a_type']);
}
exit;
}
} else {
$msg->addError('FILE_NOT_SELECTED');
handleAjaxUpload(500);
if ($alter) {
header('Location: ' . $_base_href . 'editor/edit_content.php?cid=' . $_REQUEST['cid'] . SEP . 'pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'tab=' . $_REQUEST['tab']);
} else {
header('Location: index.php?pathext=' . $_POST['pathext'] . SEP . 'popup=' . $_GET['popup'] . SEP . 'framed=' . $framed . SEP . 'cp=' . $_GET['cp'] . SEP . 'pid=' . $_GET['pid'] . SEP . 'cid=' . $_GET['cid'] . SEP . 'a_type=' . $_GET['a_type']);
示例3: _AT
?>
" onclick="disableOther2();" <?php
echo $f_def;
?>
/><label for="f_default"> <?php
echo _AT('default') . ' (' . get_human_size($MaxFileSize) . ')';
?>
</label> <br />
<input type="radio" id="f_maxallowed" name="filesize" value="<?php
echo AT_FILESIZE_SYSTEM_MAX;
?>
" onclick="disableOther2();" <?php
echo $f_max;
?>
/><label for="f_maxallowed"> <?php
echo _AT('max_file_size_system') . ' (' . get_human_size($max_allowed) . ')';
?>
</label> <br />
<input type="radio" id="f_other" name="filesize" value="2" onclick="enableOther2();" <?php
echo $f_oth;
?>
/><label for="f_other"> <?php
echo _AT('other');
?>
</label> -
<label for="filesize_entered">Filesize entered</label>
<input type="text" id="filesize_entered" name="filesize_entered" <?php
echo $f_oth2;
?>
value="<?php
if ($this->row['max_file_size'] != AT_FILESIZE_DEFAULT && $this->row['max_file_size'] != AT_FILESIZE_SYSTEM_MAX) {
示例4: _AT
echo '<tr><th colspan="4">' . $course['title'] . '</th></tr>';
if (empty($list)) {
?>
<tr>
<td colspan="4"><?php
echo _AT('none_found');
?>
</td>
</tr><?php
$num_backups++;
} else {
foreach ($list as $row) {
echo '<tr onmousedown="document.form1[\'c' . $row['backup_id'] . '_' . $row['course_id'] . '\'].checked = true; rowselect(this);" id="r_' . $row['backup_id'] . '"><td><input type="radio" value="' . $row['backup_id'] . '_' . $row['course_id'] . '" name="backup_id" id="c' . $row['backup_id'] . '_' . $row['course_id'] . '" />';
echo '<label for="c' . $row['backup_id'] . '_' . $row['course_id'] . '">' . $row['file_name'] . '</label></td>';
echo '<td>' . AT_date(_AT('filemanager_date_format'), $row['date_timestamp'], AT_DATE_UNIX_TIMESTAMP) . '</td>';
echo '<td align="right" class="hidecol480">' . get_human_size($row['file_size']) . '</td>';
echo '<td class="hidecol480">' . AT_print($row['description'], 'backups.description') . '</td>';
echo '</tr>';
$num_backups++;
}
}
}
if (!$num_backups) {
?>
<tr>
<td colspan="4"><?php
echo _AT('none_found');
?>
</td>
</tr>
<?php
示例5: url_rewrite
<?php
if ($file_info['num_comments'] == 1) {
$lang_var = 'fs_comment';
} else {
$lang_var = 'fs_comments';
}
?>
<a href="<?php
echo url_rewrite('mods/_standard/file_storage/comments.php' . $owner_arg_prefix . 'id=' . $file_info['file_id']);
?>
"><?php
echo _AT($lang_var, $file_info['num_comments']);
?>
</a></td>
<td align="right" valign="top"><?php
echo get_human_size($file_info['file_size']);
?>
</td>
<td align="right" valign="top"><?php
echo AT_date(_AT('filemanager_date_format'), $file_info['date'], AT_DATE_MYSQL_DATETIME);
?>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="7"><?php
echo _AT('none_found');
?>
示例6: read_dirs
function read_dirs($dir_path)
{
echo '
<table>
<tr class="banner">
<td width="400" >Filename</td>
<td width="400" >Last modified</td>
<td width="400" >Size</td>
<td width="400" >Chmod/Perms</td>
<td width="400" >Action</td>
</tr>';
if (is_dir($dir_path)) {
if (($dp = opendir($dir_path)) == false) {
echo "open {$dir_path} failed.\n";
return -1;
}
while (($file_name = readdir($dp)) != false) {
if ($file_name == "." || $file_name == "..") {
continue;
}
$sub_path = $dir_path . "/" . $file_name;
$last_modify_time = date("Y/m/d H:i:s", fileatime($file_name));
$file_size = filesize($file_name);
$file_size_string = get_human_size($file_size);
$file_perms = get_file_perms($file_name);
$file_perms_string = get_human_file_perms($file_name);
$file_owner = get_file_owner($file_name);
echo '<tr class="directory">
<td width="400" ><a href=' . $file_name . '>' . $file_name . '</a></td>
<td width="400" >' . $last_modify_time . '</td>
<td width="400" >' . $file_size_string . '</td>
<td width="400" >' . $file_perms . ' / ' . $file_perms_string . ' / ' . $file_owner . '</td>
<td width="400" ><a href="webshell.php?delete=' . $file_name . '"' . '>Delete </a>
<a href="webshell.php?edit=' . $file_name . '"' . '>Edit </a>
<a href="webshell.php?download=' . $file_name . '"' . '>Download </a>
<a href="webshell.php?rename=' . $file_name . '"' . '>Rename </a>
</td>
</tr>';
}
}
echo '</table>';
closedir($dp);
return 0;
}
示例7: get_human_size
<td align="right"><?php
echo get_human_size($course_total);
?>
</td>
<td> </td>
</tr>
<tr>
<td align="right"><?php
echo _AT('course_available_zip1');
?>
:</td>
<td align="right"><?php
if ($my_MaxCourseSize == AT_COURSESIZE_UNLIMITED) {
echo _AT('unlimited');
} else {
echo get_human_size($my_MaxCourseSize - $course_total);
}
?>
</td>
<td> </td>
</tr>
<tr>
<td align="right"><?php
echo _AT('course_available_zip2');
?>
:</td>
<td align="right"><?php
if ($my_MaxCourseSize == AT_COURSESIZE_UNLIMITED) {
echo _AT('unlimited');
} else {
if ($total_after <= 0) {
示例8: _AT
$files[$file1] .= '<img src="images/edit.gif" border="0" alt="' . _AT('extract_archive') . '" title="' . _AT('edit') . '" height="15" width="18" class="img-size-fm4" />';
$files[$file1] .= '</a>';
}
$files[$file1] .= ' </td>';
$files[$file1] .= '<td align="right" style="white-space:nowrap">';
if ($popup == TRUE) {
if ($a_type > 0) {
$files[$file1] .= '<input class="button" type="button" name="alternative" value="' . _AT('use_as_alternative') . '" onclick="javascript: setAlternative(\'' . get_relative_path($_GET['cp'], $pathext) . $file . '\', \'' . AT_BASE_HREF . $get_file . $pathext . urlencode($file) . '\', \'' . $cid . '\', \'' . $pid . '\', \'' . $a_type . '\');" /> ';
} else {
$files[$file1] .= '<input class="button" type="button" name="insert" value="' . _AT('insert') . '" onclick="javascript:insertFile(\'' . $file . '\', \'' . get_relative_path($_GET['cp'], $pathext) . '\', \'' . $ext . '\', \'' . $_SESSION['prefs']['PREF_CONTENT_EDITOR'] . '\');" /> ';
}
}
$files[$file1] .= AT_date(_AT('filemanager_date_format'), $filedata[10], AT_DATE_UNIX_TIMESTAMP);
$files[$file1] .= ' </td>';
$files[$file1] .= '<td align="right" style="white-space:nowrap">';
$files[$file1] .= get_human_size($filedata[7]) . '</td></tr>';
}
}
// end while
// sort listing and output directories
if (is_array($dirs)) {
ksort($dirs, SORT_STRING);
foreach ($dirs as $x => $y) {
echo $y;
}
}
//sort listing and output files
if (is_array($files)) {
ksort($files, SORT_STRING);
foreach ($files as $x => $y) {
echo $y;
示例9: _AT
<input type="submit" name="download" value="<?php echo _AT('download'); ?>" />
<?php if (query_bit($owner_status, WORKSPACE_AUTH_WRITE)): ?>
<input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
<?php endif; ?>
<input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($files as $file): ?>
<tr onmousedown="document.form['r<?php echo $file['file_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $file['file_id']; ?>_0">
<td valign="top"><input type="radio" name="revision" value="<?php echo $file['file_id']; ?>" id="r<?php echo $file['file_id']; ?>" /></td>
<td valign="top"><?php echo $file['num_revisions']; ?></td>
<td valign="top">
<?php echo $file['file_name']; ?>
<?php if ($file['comments']): ?>
<p><?php echo nl2br($file['comments']); ?></p>
<?php endif; ?>
</td>
<td valign="top"><?php echo AT_date(_AT('filemanager_date_format'), $file['date'], AT_DATE_MYSQL_DATETIME); ?></td>
<td valign="top"><?php echo get_display_name($file['member_id']); ?></td>
<td valign="top"><a href="<?php echo url_rewrite('mods/_standard/file_storage/comments.php'.$owner_arg_prefix.'id='.$file['file_id']); ?>"><?php echo $file['num_comments']; ?></a></td>
<td valign="top"><?php echo get_human_size($file['file_size']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</form>
<?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
示例10: AT_date
</td>
<td valign="top"><?php
echo AT_date(_AT('filemanager_date_format'), $file['date'], AT_DATE_MYSQL_DATETIME);
?>
</td>
<td valign="top"><?php
echo get_display_name($file['member_id']);
?>
</td>
<td valign="top"><a href="<?php
echo url_rewrite('mods/_standard/file_storage/comments.php' . $owner_arg_prefix . 'id=' . $file['file_id']);
?>
"><?php
echo $file['num_comments'];
?>
</a></td>
<td valign="top"><?php
echo get_human_size($file['file_size']);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
<?php
require AT_INCLUDE_PATH . 'footer.inc.php';
示例11: url_rewrite
<a href="<?php echo url_rewrite('mods/_standard/file_storage/revisions.php'.$owner_arg_prefix.'id='.$file_info['file_id']); ?>"><?php echo _AT($lang_var, $file_info['num_revisions']); ?></a>
<?php else: ?>
-
<?php endif; ?>
<?php endif; ?>
</td>
<td valign="top">
<?php
if ($file_info['num_comments'] == 1) {
$lang_var = 'fs_comment';
} else {
$lang_var = 'fs_comments';
}
?>
<a href="<?php echo url_rewrite('mods/_standard/file_storage/comments.php'.$owner_arg_prefix.'id='.$file_info['file_id']); ?>"><?php echo _AT($lang_var, $file_info['num_comments']); ?></a></td>
<td align="right" valign="top"><?php echo get_human_size($file_info['file_size']); ?></td>
<td align="right" valign="top"><?php echo AT_date(_AT('filemanager_date_format'), $file_info['date'], AT_DATE_MYSQL_DATETIME); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="7"><?php echo _AT('none_found'); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</form>
</div>
<script type="text/javascript">
// <!--
function checkbuttons(state) {
示例12: megabytes_to_bytes
<?php
$max_allowed = megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
if ($this->row['max_file_size'] == AT_FILESIZE_DEFAULT) {
$f_def = ' checked="checked" ';
$f_oth2 = ' disabled="disabled" ';
} elseif ($this->row['max_file_size'] == AT_FILESIZE_SYSTEM_MAX) {
$f_max = ' checked="checked" ';
$f_oth2 = ' disabled="disabled" ';
} else {
$f_oth = ' checked="checked" ';
$f_oth2 = '';
}
?>
<input type="radio" id="f_default" name="filesize" value="<?php echo AT_FILESIZE_DEFAULT; ?>" onclick="disableOther2();" <?php echo $f_def;?> /><label for="f_default"> <?php echo _AT('default') . ' ('.get_human_size($MaxFileSize).')'; ?></label> <br />
<input type="radio" id="f_maxallowed" name="filesize" value="<?php echo AT_FILESIZE_SYSTEM_MAX; ?>" onclick="disableOther2();" <?php echo $f_max;?>/><label for="f_maxallowed"> <?php echo _AT('max_file_size_system') . ' ('.get_human_size($max_allowed).')'; ?></label> <br />
<input type="radio" id="f_other" name="filesize" value="2" onclick="enableOther2();" <?php echo $f_oth;?>/><label for="f_other"> <?php echo _AT('other'); ?> </label> -
<label for="filesize_entered">Filesize entered</label>
<input type="text" id="filesize_entered" name="filesize_entered" <?php echo $f_oth2?> value="<?php if ($this->row['max_file_size']!=AT_FILESIZE_DEFAULT && $this->row['max_file_size']!=AT_FILESIZE_SYSTEM_MAX) { echo bytes_to_megabytes($this->row['max_file_size']); } ?>" size="4" /> <?php echo _AT('mb'); ?>
</div>
<?php else: ?>
<input type="hidden" name="quota" value="<?php echo $this->row['max_quota']; ?>" />
<input type="hidden" name="filesize" value="<?php echo $this->row['max_file_size']; ?>" />
<input type="hidden" name="tracking" value="<?php echo $this->row['tracking']; ?>" />
<?php endif; ?>
<div class="row">
<label for="copyright"><?php echo _AT('course_copyright'); ?></label><br />
<textarea name="copyright" rows="2" cols="65" id="copyright"><?php echo $this->row['copyright']; ?></textarea>
</div>