• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP format_file_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中format_file_size函数的典型用法代码示例。如果您正苦于以下问题:PHP format_file_size函数的具体用法?PHP format_file_size怎么用?PHP format_file_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了format_file_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: lp_display_document

/**
 * CLAROLINE
 *
 * @version     $Revision: 13511 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux S�bastien <[email protected]>
 * @author      Lederer Guillaume <[email protected]>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_document($TABLEASSET)
{
    // document browser vars
    // Update infos about asset
    $sql = "SELECT `path`\n          FROM `" . $TABLEASSET . "`\n          WHERE `module_id` = " . (int) $_SESSION['module_id'];
    $assetPath = claro_sql_query_get_single_value($sql);
    $courseDir = claro_get_course_path() . '/document';
    $baseWorkDir = get_path('coursesRepositorySys') . $courseDir;
    $file = $baseWorkDir . $assetPath;
    $fileSize = format_file_size(filesize($file));
    $fileDate = format_date(filectime($file));
    //####################################################################################\\
    //######################## DISPLAY DETAILS ABOUT THE DOCUMENT ########################\\
    //####################################################################################\\
    $out = '';
    $out .= "\n\n" . '<hr noshade="noshade" size="1" />' . "\n\n" . '<h4>' . get_lang('Document in module') . '</h4>' . "\n\n" . '<table class="claroTable" width="100%" border="0" cellspacing="2">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Filename') . '</th>' . "\n" . '<th>' . get_lang('Size') . '</th>' . "\n" . '<th>' . get_lang('Date') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n" . '<tr align="center">' . "\n" . '<td align="left">' . basename($file) . '</td>' . "\n" . '<td>' . $fileSize . '</td>' . "\n" . '<td>' . $fileDate . '</td>' . "\n" . '</tr>' . "\n" . '</tbody>' . "\n" . '</table>' . "\n";
    return $out;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:29,代码来源:document.inc.php


示例2: index

 /**
  * Main page in administration for Incoming Mail
  *
  */
 function index()
 {
     $config_admin_email = ConfigOptions::getValue('notifications_from_email');
     $notifications_email = $config_admin_email ? $config_admin_email : ADMIN_EMAIL;
     $default_mailbox = IncomingMailboxes::findByFromEmail($notifications_email);
     $add_default_mailbox_url = assemble_url('incoming_mail_admin_add_mailbox', array('default_email_address' => $notifications_email));
     if (!instance_of($default_mailbox, 'IncomingMailbox')) {
         $this->wireframe->addPageMessage(lang('System is not able to receive email messages sent as replies to notifications. If you would like your users to be able to reply to notifications and have their messages automatically submitted as comments please <a href=":add_default_mailbox_url">define an incoming mailbox</a> for <strong>:address</strong>.', array('address' => $notifications_email, 'add_default_mailbox_url' => $add_default_mailbox_url)), PAGE_MESSAGE_WARNING);
     } elseif (!$default_mailbox->getEnabled()) {
         $this->wireframe->addPageMessage(lang('System is not able to receive email messages sent as replies to notifications. If you would like your users to be able to reply to notifications and have their messages automatically submitted as comments please <a href=":edit_default_mailbox_url">enable default incoming mailbox</a>.', array('edit_default_mailbox_url' => $default_mailbox->getEditUrl())), PAGE_MESSAGE_WARNING);
     }
     // if
     if (!MM_CAN_DOWNLOAD_LARGE_ATTACHMENTS) {
         $limited_filesize = format_file_size(FAIL_SAFE_IMAP_ATTACHMENT_SIZE_MAX);
         if (!function_exists('imap_savebody')) {
             $this->wireframe->addPageMessage(lang("<b>Your PHP version is obsolete</b> - You won't be able to download attachments larger than <b>:file_size</b>. Please upgrade to latest stable version of PHP to solve this issue.", array('file_size' => $limited_filesize)), PAGE_MESSAGE_WARNING);
         } else {
             $this->wireframe->addPageMessage(lang("Importing attachments larger than <b>:file_size</b> is disabled. Module uses failsafe IMAP functions due to platform restrictions.", array('file_size' => $limited_filesize)), PAGE_MESSAGE_WARNING);
         }
         // if
     }
     // if
     use_model('incoming_mail_activity_logs', INCOMING_MAIL_MODULE);
     $per_page = 50;
     // mailbox activity per page
     $page = (int) $this->request->get('page');
     if ($page < 1) {
         $page = 1;
     }
     // if
     $only_problematic = (bool) array_var($_GET, 'only_problematic', false);
     if ($only_problematic) {
         list($activity_history, $pagination) = IncomingMailActivityLogs::paginateConflicts($page, $per_page);
     } else {
         list($activity_history, $pagination) = IncomingMailActivityLogs::paginate(array('order' => 'created_on DESC'), $page, $per_page);
     }
     // if
     $activity_history = group_by_date($activity_history);
     $this->smarty->assign(array('mailboxes' => IncomingMailboxes::find(), 'activity_history' => $activity_history, 'pagination' => $pagination, 'only_problematic' => $only_problematic));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:44,代码来源:IncomingMailAdminController.class.php


示例3: upload_file

 /**
  * Uploads the file
  * @access public
  * @params
  * $uploaddir : Directory Name in which uploaded file is placed
  * $name : file input type field name
  * $rename : you may pass string or boolean
     true : rename the file if it already exists and returns the renamed file name.
  *  String : rename the file to given string.
  *  $replace =true : replace the file if it is already existing
  *  $file_max_size : file size in bytes. 0 for default
  *  $check_type : checks file type exp ."(jpg|gif|jpeg)"
  *  Example upload_file("temp","file",true,true,0,"jpg|jpeg|bmp|gif")
  * return : On success it will return file name else return (boolean)false
 */
 public function upload_file($uploaddir, $name, $rename = null, $replace = false, $check_type = "")
 {
     $this->set_file_size($_FILES[$name]['size']);
     $this->error = $_FILES[$name]['error'];
     $this->set_temp_name($_FILES[$name]['tmp_name']);
     $this->set_directory($uploaddir);
     $this->check_for_directory();
     $this->set_file_name($_FILES[$name]['name']);
     $file_size = $this->file_type_info[$check_type]['max_file_size'] / 1000000;
     if ($this->error == 1) {
         $this->error = sprintf(__("Your file is too large for the web server.  The largest file you can upload here is %.1fM.  If this is too small, please ask the administrator to increase the <code>upload_max_filesize</code> directive in <code>php.ini</code>."), floatval(parse_file_size_string(ini_get("upload_max_filesize"))) / 1048576.0);
     } elseif ($this->error == 3) {
         $this->error = __('The uploaded file was only partially uploaded.');
     } elseif ($this->error == 4) {
         $this->error = __('No file was uploaded');
     } elseif (!is_uploaded_file($this->tmp_name)) {
         $this->error = "File " . $this->tmp_name . " is not uploaded correctly.";
     }
     if (empty($this->file_name)) {
         $this->error = "File is not uploaded correctly.";
     }
     if ($this->error != "") {
         return false;
     }
     //check here for valid file
     if (!empty($check_type)) {
         // set max upload size
         if (array_key_exists($check_type, $this->file_type_info)) {
             $this->set_max_size($this->file_type_info[$check_type]['max_file_size']);
         }
         // check file size against maximum
         if ($this->file_size > $this->max_filesize) {
             $this->error = sprintf(__("File too large; %s file uploads are limited to %s.  If this is too small, please ask the administrator to increase the limit."), $check_type, format_file_size($this->max_filesize));
             return false;
         }
         //if $check_type is just image then we can check it via getImagesize() function if the file is valid or not
         // does this check always for image
         if ($check_type == 'image') {
             $sizeCheck = @getImagesize($this->tmp_name);
             if (!$sizeCheck) {
                 $this->error = __("Invalid image file.");
                 return false;
             }
             //additional check to see if the image has any extension
             $ext = explode('.', $this->file_name);
             $ext = strtolower(end($ext));
             $img_mime = explode('/', $sizeCheck['mime']);
             $img_mime = strtolower(end($img_mime));
             //jpeg and jpg may have different extension and mime so handled specially
             if ($ext == 'jpg' || $ext == 'jpeg') {
             } else {
                 if ($ext != $img_mime) {
                     //means there is no image extension so lets add it
                     $this->file_name .= '.' . $img_mime;
                 }
             }
         }
         //check for other media types
         // can be turned of from config.inc define('CHECK_MIME_TYPE',0);
         if ($check_type == 'audio' || $check_type == 'video') {
             if (CHECK_MIME_TYPE == 1) {
                 $mime_type = exec('file -bi ' . $this->tmp_name);
                 // TO DO:: enalbe for audio/video //application/octet-stream
                 if (empty($mime_type)) {
                     $this->error = __("Invalid media file.");
                     return false;
                 }
                 if (strstr($mime_type, $check_type)) {
                 } else {
                     if (strstr($mime_type, 'media')) {
                     } else {
                         if (strstr($mime_type, 'octet-stream')) {
                             // Temporarily added for .wav file -- need to do something else
                         } else {
                             $this->error = __("Invalid media file.");
                             return false;
                         }
                     }
                 }
             }
         }
         //special treatment for doc types
         if ($check_type == 'doc') {
             if (CHECK_MIME_TYPE == 1) {
                 $mime_type = exec('file -bi ' . $this->tmp_name);
//.........这里部分代码省略.........
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:file_uploader.php


示例4: api_get_course_info

            $courseInfo = api_get_course_info();
            $workInfo = get_work_data_by_id($itemId);
            $workInfoParent = get_work_data_by_id($workInfo['parent_id']);
            $resultUpload = uploadWork($workInfoParent, $courseInfo, true, $workInfo);
            $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
            if (isset($resultUpload['url']) && !empty($resultUpload['url'])) {
                $title = isset($resultUpload['filename']) && !empty($resultUpload['filename']) ? $resultUpload['filename'] : get_lang('Untitled');
                $url = Database::escape_string($resultUpload['url']);
                $title = Database::escape_string($title);
                $sql = "UPDATE {$work_table} SET\n                            url_correction = '" . $url . "',\n                            title_correction = '" . $title . "'\n                        WHERE iid = {$itemId}";
                Database::query($sql);
                $result['title'] = $resultUpload['filename'];
                $result['url'] = 'view.php?' . api_get_cidreq() . '&id=' . $itemId;
                $json = array();
                $json['name'] = Display::url(api_htmlentities($result['title']), api_htmlentities($result['url']), array('target' => '_blank'));
                $json['type'] = api_htmlentities($file['type']);
                $json['size'] = format_file_size($file['size']);
            }
            if (isset($result['url'])) {
                $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded'));
            } else {
                $json['result'] = Display::return_icon('exclamation.png', get_lang('Error'));
            }
            echo json_encode($json);
        }
        break;
    default:
        echo '';
        break;
}
exit;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:work.ajax.php


示例5: validate_memory_limit

/**
 * Validate memory limit
 *
 * @param array $result
 */
function validate_memory_limit(&$results)
{
    $memory_limit = php_config_value_to_bytes(ini_get('memory_limit'));
    $formatted_memory_limit = $memory_limit === -1 ? 'unlimited' : format_file_size($memory_limit);
    if ($memory_limit === -1 || $memory_limit >= 67108864) {
        $results[] = new TestResult('Your memory limit is: ' . $formatted_memory_limit, STATUS_OK);
        return true;
    } else {
        $results[] = new TestResult('Your memory is too low to complete the installation. Minimal value is 64MB, and you have it set to ' . $formatted_memory_limit, STATUS_ERROR);
        return false;
    }
    // if
}
开发者ID:rajitha-bandara,项目名称:odwlbs-peoject,代码行数:18,代码来源:probe.php


示例6: show_form_send_ticket

/**
 *
 */
function show_form_send_ticket()
{
    global $types, $plugin;
    echo '<div class="divTicket">';
    //Category List
    $categoryList = array();
    foreach ($types as $type) {
        $categoryList[$type['category_id']] = $type['name'] . ": " . $type['description'];
    }
    //End Category List
    //Status List
    $statusList = array();
    $statusAttributes = array('style' => 'display: none;', 'id' => 'status_id', 'for' => 'status_id');
    $statusList[NEWTCK] = $plugin->get_lang('StatusNew');
    if (api_is_platform_admin()) {
        $statusAttributes = array('id' => 'status_id', 'for' => 'status_id', 'style' => 'width: 562px;');
        $statusList[PENDING] = $plugin->get_lang('StatusPending');
        $statusList[UNCONFIRMED] = $plugin->get_lang('StatusUnconfirmed');
        $statusList[CLOSE] = $plugin->get_lang('StatusClose');
        $statusList[REENVIADO] = $plugin->get_lang('StatusForwarded');
    }
    //End Status List
    //Source List
    $sourceList = array();
    $sourceAttributes = array('style' => 'display: none;', 'id' => 'source_id', 'for' => 'source_id');
    $sourceList[SRC_PLATFORM] = $plugin->get_lang('SrcPlatform');
    if (api_is_platform_admin()) {
        $sourceAttributes = array('id' => 'source_id', 'for' => 'source_id', 'style' => 'width: 562px;');
        $sourceList[SRC_EMAIL] = $plugin->get_lang('SrcEmail');
        $sourceList[SRC_PHONE] = $plugin->get_lang('SrcPhone');
        $sourceList[SRC_PRESC] = $plugin->get_lang('SrcPresential');
    }
    //End Source List
    //Priority List
    $priorityList = array();
    $priorityList[NORMAL] = $plugin->get_lang('PriorityNormal');
    $priorityList[HIGH] = $plugin->get_lang('PriorityHigh');
    $priorityList[LOW] = $plugin->get_lang('PriorityLow');
    //End Priority List
    $form = new FormValidator('send_ticket', 'POST', api_get_self(), "", array('enctype' => 'multipart/form-data', 'onsubmit' => 'return validate()', 'class' => 'span8 offset1 form-horizontal'));
    $form->addElement('hidden', 'user_id_request', '', array('id' => 'user_id_request'));
    $form->addElement('hidden', 'project_id', '', array('id' => 'project_id'));
    $form->addElement('hidden', 'other_area', '', array('id' => 'other_area'));
    $form->addElement('hidden', 'email', '', array('id' => 'email'));
    $form->addElement('select', 'category_id', get_lang('Category'), $categoryList, array('onchange' => 'changeType()', 'id' => 'category_id', 'for' => 'category_id', 'style' => 'width: 562px;'));
    $form->addElement('html', Display::div('', array('id' => 'user_request')));
    $form->addElement('select', 'status_id', get_lang('Status'), $statusList, $statusAttributes);
    $form->addElement('select', 'source_id', $plugin->get_lang('Source'), $sourceList, $sourceAttributes);
    $form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject', 'style' => 'width: 550px;'));
    $form->addElement('text', 'personal_email', $plugin->get_lang('PersonalEmail'), array('id' => 'personal_email', 'style' => 'width: 550px;'));
    $form->addHtmlEditor('content', get_lang('Message'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '600', 'Height' => '250'));
    $form->addElement('text', 'phone', get_lang('Phone') . ' (' . $plugin->get_lang('Optional') . ')', array('id' => 'phone'));
    $form->addElement('select', 'priority_id', $plugin->get_lang('Priority'), $priorityList, array('id' => 'priority_id', 'for' => 'priority_id'));
    $form->addElement('html', '<span id="filepaths">');
    $form->addElement('html', '<div id="filepath_1">');
    $form->addElement('file', 'attach_1', get_lang('FilesAttachment'));
    $form->addElement('html', '</div>');
    $form->addElement('html', '</span>');
    $form->addElement('html', '<div class="controls">');
    $form->addElement('html', '<span id="link-more-attach" >');
    $form->addElement('html', '<span class="label label-info" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span>');
    $form->addElement('html', '</span>');
    $form->addElement('html', '(' . sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))) . ')');
    $form->addElement('html', '<br/>');
    $form->addElement('button', 'compose', get_lang('SendMessage'), null, null, null, 'save', array('id' => 'btnsubmit'));
    $form->display();
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:70,代码来源:new_ticket.php


示例7: intval

                            } else {
                                $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
                            }
                        }
                    }
                }
            }
        }
    }
    $result_cache->assign_vars(array('dbsize' => $dbsize));
} else {
    $dbsize = $result_cache->get_var('dbsize');
}
$dbsize = intval($dbsize);
if ($dbsize != 0) {
    $dbsize = format_file_size($dbsize);
} else {
    $dbsize = $lang['Not_available'];
}
$sql = 'SELECT user_regdate
	FROM ' . USERS_TABLE . '
	WHERE user_id = ' . $newest_uid . '
	LIMIT 1';
$result = $stat_db->sql_query($sql);
$row = $stat_db->sql_fetchrow($result);
$newest_user_date = $row['user_regdate'];
// Most Online data
$sql = "SELECT *\n\tFROM " . CONFIG_TABLE . "\n\tWHERE config_name = 'record_online_users' OR config_name = 'record_online_date'";
$result = $stat_db->sql_query($sql);
$row = $stat_db->sql_fetchrowset($result);
$most_users_date = $lang['Not_available'];
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:admin_statistics_module.php


示例8: foreach

 $column_show[] = 0;
 // Here we change the way how the colums are going to be sort
 // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
 // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
 $column_order[3] = 8;
 $column_order[5] = 7;
 // The content of the sortable table = the received files
 foreach ($dropbox_person->sentWork as $dropbox_file) {
     $dropbox_file_data = array();
     if ($view_dropbox_category_sent == $dropbox_file->category) {
         $dropbox_file_data[] = $dropbox_file->id;
         $link_open = '<a href="' . api_get_path(WEB_CODE_PATH) . 'dropbox/dropbox_download.php?' . api_get_cidreq() . '&id=' . $dropbox_file->id . '">';
         $dropbox_file_data[] = $link_open . DocumentManager::build_document_icon_tag('file', $dropbox_file->title) . '</a>';
         $dropbox_file_data[] = '<a href="' . api_get_path(WEB_CODE_PATH) . 'dropbox/dropbox_download.php?' . api_get_cidreq() . '&id=' . $dropbox_file->id . '&action=download">' . Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL) . '</a>' . $link_open . $dropbox_file->title . '</a><br />' . $dropbox_file->description;
         $file_size = $dropbox_file->filesize;
         $dropbox_file_data[] = format_file_size($file_size);
         $receivers_celldata = null;
         foreach ($dropbox_file->recipients as $recipient) {
             $userInfo = api_get_user_info($recipient['user_id']);
             $receivers_celldata = UserManager::getUserProfileLink($userInfo) . ', ' . $receivers_celldata;
         }
         $receivers_celldata = trim(trim($receivers_celldata), ',');
         // Removing the trailing comma.
         $dropbox_file_data[] = $receivers_celldata;
         $last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
         $dropbox_file_data[] = date_to_str_ago($last_upload_date) . '<br /><span class="dropbox_date">' . api_format_date($last_upload_date) . '</span>';
         //$dropbox_file_data[] = $dropbox_file->author;
         $receivers_celldata = '';
         $action_icons = check_number_feedback($dropbox_file->id, $number_feedback) . ' ' . get_lang('Feedback') . '
             <a href="' . api_get_self() . '?' . api_get_cidreq() . '&view_received_category=' . $viewReceivedCategory . '&view_sent_category=' . $viewSentCategory . '&view=' . $view . '&action=viewfeedback&id=' . $dropbox_file->id . '&' . $sort_params . '">' . Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL) . '</a>
             <a href="' . api_get_self() . '?' . api_get_cidreq() . '&view_received_category=' . $viewReceivedCategory . '&view_sent_category=' . $viewSentCategory . '&view=' . $view . '&action=movesent&move_id=' . $dropbox_file->id . '&' . $sort_params . '">' . Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL) . '</a>
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:index.php


示例9: foreach

        foreach ($files_to_add as $add_file) {
            ?>
										<tr>
											<td><input type="checkbox" name="add[]" value="<?php 
            echo $add_file['name'];
            ?>
" /></td>
											<td><?php 
            echo $add_file['name'];
            ?>
</td>
											<td data-value="<?php 
            echo filesize($add_file['path']);
            ?>
"><?php 
            echo format_file_size(filesize($add_file['path']));
            ?>
</td>
											<td data-value="<?php 
            echo filemtime($add_file['path']);
            ?>
">
												<?php 
            echo date(TIMEFORMAT_USE, filemtime($add_file['path']));
            ?>
											</td>
											<td>
												<?php 
            switch ($add_file['reason']) {
                case 'not_on_db':
                    _e('Never assigned to any user or group', 'cftp_admin');
开发者ID:muddy-28,项目名称:ProjectSend,代码行数:31,代码来源:upload-import-orphans.php


示例10: gettext

echo "                </tr>\n";
echo "              </table>\n";
echo "              <table class=\"posthead\" width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" width=\"25\">&nbsp;</td>\n";
echo "                  <td align=\"left\" valign=\"top\" class=\"postbody\">", gettext("Total Size"), ":</td>\n";
echo "                  <td align=\"left\" valign=\"top\" class=\"postbody\">&nbsp;</td>\n";
echo "                  <td align=\"right\" valign=\"top\" class=\"postbody\">", format_file_size($total_attachment_size), "</td>\n";
echo "                  <td align=\"left\" width=\"25\">&nbsp;</td>\n";
echo "                </tr>\n";
if ($max_attachment_space > 0) {
    echo "                <tr>\n";
    echo "                  <td align=\"left\" width=\"25\">&nbsp;</td>\n";
    echo "                  <td align=\"left\" valign=\"top\" class=\"postbody\">", gettext("Free Space"), ":</td>\n";
    echo "                  <td align=\"left\" valign=\"top\" class=\"postbody\">&nbsp;</td>\n";
    echo "                  <td align=\"right\" valign=\"top\" class=\"postbody\">", format_file_size($users_free_space), "</td>\n";
    echo "                  <td align=\"left\" width=\"25\">&nbsp;</td>\n";
    echo "                </tr>\n";
}
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"5\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
echo "    </tr>\n";
echo "    <tr>\n";
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "    </tr>\n";
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:31,代码来源:attachments.php


示例11: process_uploaded_file

/**
 * This function checks if the upload succeeded
 *
 * @param array $uploaded_file ($_FILES)
 * @return true if upload succeeded
 */
function process_uploaded_file($uploaded_file, $show_output = true)
{
    // Checking the error code sent with the file upload.
    if (isset($uploaded_file['error'])) {
        switch ($uploaded_file['error']) {
            case 1:
                // The uploaded file exceeds the upload_max_filesize directive in php.ini.
                if ($show_output) {
                    Display::display_error_message(get_lang('UplExceedMaxServerUpload') . ini_get('upload_max_filesize'));
                }
                return false;
            case 2:
                // The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
                // Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor).
                $max_file_size = intval($_POST['MAX_FILE_SIZE']);
                if ($show_output) {
                    Display::display_error_message(get_lang('UplExceedMaxPostSize') . format_file_size($max_file_size));
                }
                return false;
            case 3:
                // The uploaded file was only partially uploaded.
                if ($show_output) {
                    Display::display_error_message(get_lang('UplPartialUpload') . ' ' . get_lang('PleaseTryAgain'));
                }
                return false;
            case 4:
                // No file was uploaded.
                if ($show_output) {
                    Display::display_error_message(get_lang('UplNoFileUploaded') . ' ' . get_lang('UplSelectFileFirst'));
                }
                return false;
        }
    }
    if (!file_exists($uploaded_file['tmp_name'])) {
        // No file was uploaded.
        if ($show_output) {
            Display::display_error_message(get_lang('UplUploadFailed'));
        }
        return false;
    }
    if (file_exists($uploaded_file['tmp_name'])) {
        $filesize = filesize($uploaded_file['tmp_name']);
        if (empty($filesize)) {
            // No file was uploaded.
            if ($show_output) {
                Display::display_error_message(get_lang('UplUploadFailedSizeIsZero'));
            }
            return false;
        }
    }
    $course_id = api_get_course_id();
    //Checking course quota if we are in a course
    if (!empty($course_id)) {
        $max_filled_space = DocumentManager::get_course_quota();
        // Check if there is enough space to save the file
        if (!DocumentManager::enough_space($uploaded_file['size'], $max_filled_space)) {
            if ($show_output) {
                Display::display_error_message(get_lang('UplNotEnoughSpace'));
            }
            return false;
        }
    }
    // case 0: default: We assume there is no error, the file uploaded with success.
    return true;
}
开发者ID:daffef,项目名称:chamilo-lms,代码行数:71,代码来源:fileUpload.lib.php


示例12: display_my_documents

function display_my_documents($dialogBox, $style)
{
    global $curDirName;
    global $curDirPath;
    global $parentDir;
    global $langUp;
    global $langName;
    global $langSize;
    global $langDate;
    global $langAddModulesButton;
    global $fileList;
    global $themeimg;
    global $langSelection, $langDirectory, $course_code;
    $output = '';
    /*
     * DISPLAY
     */
    $dspCurDirName = htmlspecialchars($curDirName);
    // $cmdCurDirPath = rawurlencode($curDirPath);
    $cmdParentDir = rawurlencode($parentDir);
    $output .= '<form action="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '" method="POST">';
    /* --------------------------------------
       DIALOG BOX SECTION
       -------------------------------------- */
    $colspan = 5;
    if (!empty($dialogBox)) {
        $output .= disp_message_box($dialogBox, $style) . "<br />";
    }
    /* --------------------------------------
       CURRENT DIRECTORY LINE
       -------------------------------------- */
    /* CURRENT DIRECTORY */
    if ($curDirName) {
        $output .= '
        <table class="table-default">
        <tr>
          <td width="1" class="right">' . icon('fa-folder-o') . '</td>
          <td>' . $langDirectory . ': <b>' . $dspCurDirName . '</b></td>';
        /* GO TO PARENT DIRECTORY */
        if ($curDirName) {
            $linkup = "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;openDir={$cmdParentDir}'>";
            $output .= "<td width='1'>{$linkup}<img src='{$themeimg}/folder_up.png' " . "hspace='5' alt='{$langUp}' title='langUp' /></a></td>" . "<td width='10' class='right'><small>{$linkup}{$langUp}</a></small></td>";
        }
        $output .= '</tr></table>';
    }
    $output .= '
    <div class="table-responsive">
    <table class="table-default" >';
    $output .= "\n    <tr class='list-header'>\n      <th colspan='2'><div align='left'>&nbsp;&nbsp;{$langName}</div></th>\n      <th>{$langSize}</th>\n      <th>{$langDate}</th>\n      <th>{$langSelection}</th>\n    </tr>";
    /* --------------------------------------
       DISPLAY FILE LIST
       -------------------------------------- */
    if ($fileList) {
        $iterator = 0;
        $ind = 1;
        while (list($fileKey, $fileName) = each($fileList['name'])) {
            if ($ind % 2 == 0) {
                $style = 'class="even"';
            } else {
                $style = 'class="odd"';
            }
            $dspFileName = htmlspecialchars($fileList['filename'][$fileKey]);
            $cmdFileName = str_replace("%2F", "/", rawurlencode($curDirPath . "/" . $fileName));
            if ($fileList['visible'][$fileKey] == 0) {
                continue;
                // skip the display of this file
            }
            if ($fileList['type'][$fileKey] == A_FILE) {
                $image = choose_image($fileName);
                $size = format_file_size($fileList['size'][$fileKey]);
                $date = nice_format($fileList['date'][$fileKey]);
                $file_url = file_url($fileList['path'][$fileKey], $dspFileName);
                $play_url = file_playurl($fileList['path'][$fileKey], $dspFileName);
                $urlFileName = MultimediaHelper::chooseMediaAhrefRaw($file_url, $play_url, $dspFileName, $dspFileName);
            } elseif ($fileList['type'][$fileKey] == A_DIRECTORY) {
                $image = 'fa-folder';
                $size = '&nbsp;';
                $date = '&nbsp;';
                $urlFileName = '<a href="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&amp;openDir=' . $cmdFileName . '">' . $dspFileName . '</a>';
            }
            $output .= '
                <tr ' . $style . '>
                <td class="center" width="1">' . icon($image, '') . '</td>
                <td align="left">' . $urlFileName . '</td>
                <td width="80" class="center">' . $size . '</td>
                <td width="80" class="center">' . $date . '</td>';
            if ($fileList['type'][$fileKey] == A_FILE) {
                $iterator++;
                $output .= '
                <td width="10" class="center">
                        <input type="checkbox" name="insertDocument_' . $iterator . '" id="insertDocument_' . $iterator . '" value="' . $curDirPath . "/" . $fileName . '" />
                        <input type="hidden" name="filenameDocument_' . $iterator . '" id="filenameDocument_' . $iterator . '" value="' . $dspFileName . '" />
                </td>';
            } else {
                $output .= '<td>&nbsp;</td>';
            }
            $output .= '</tr>';
            /* COMMENTS */
            if ($fileList['comment'][$fileKey] != "") {
                $fileList['comment'][$fileKey] = htmlspecialchars($fileList['comment'][$fileKey]);
//.........这里部分代码省略.........
开发者ID:nikosv,项目名称:openeclass,代码行数:101,代码来源:learnPathLib.inc.php


示例13: foreach

            foreach ($files as $name => $array) {
                $counter = 0;
                foreach ($array as $data) {
                    $fileList[$counter][$name] = $data;
                    $counter++;
                }
            }
            $resultList = [];
            foreach ($fileList as $file) {
                $globalFile = [];
                $globalFile['files'] = $file;
                /** @var Dropbox_SentWork $result */
                $result = store_add_dropbox($file);
                $json = array();
                if (!empty($result)) {
                    $json['name'] = Display::url(api_htmlentities($result->title), api_htmlentities(api_get_path(WEB_CODE_PATH) . 'dropbox/index.php?' . api_get_cidreq()), array('target' => '_blank'));
                    $json['url'] = api_get_path(WEB_CODE_PATH) . 'dropbox/index.php?' . api_get_cidreq();
                    $json['size'] = format_file_size($result->filesize);
                    $json['type'] = api_htmlentities($file['type']);
                    $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded'));
                } else {
                    $json['result'] = Display::return_icon('exclamation.png', get_lang('Error'));
                }
                $resultList[] = $json;
            }
            echo json_encode(['files' => $resultList]);
        }
        exit;
        break;
}
exit;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:dropbox.ajax.php


示例14: get_remote_file_size

function get_remote_file_size($file_path)
{
    if (!CHECK_REMOTE_FILES) {
        return 'n/a';
    }
    ob_start();
    @readfile($file_path);
    $file_data = ob_get_contents();
    ob_end_clean();
    return format_file_size(strlen($file_data));
}
开发者ID:4images,项目名称:4images,代码行数:11,代码来源:functions.php


示例15:

         $envelove_icon = "fa-envelope-o";
     } else {
         $bold_start = "<strong>";
         $bold_end = "</strong>";
         $envelove_icon = "fa-envelope";
     }
 
     $urlstr = '';
     if ($course_id != 0) {
         $urlstr = "&amp;course=".course_id_to_code($course_id);
     }
     
     if (($msg->filename != '') and ($msg->filesize != 0)) {
         $ahref = "dropbox_download.php?course=".course_id_to_code($msg->course_id)."&amp;id=".$msg->id;
         $filename = "&nbsp;&nbsp;&#124;&nbsp;&nbsp;<a class='outtabs' href='$ahref' target='_blank'><span class='fa fa-paperclip'></span>
         </a><span class='smaller'>&nbsp;&nbsp;(".format_file_size($msg->filesize).")</span><br />";
     } else {
         $filename = '';
     }
     
     $i = 0;
     
     if ($mbox_type == 'inbox') {
         $td[$i++] = "<i class='fa $envelove_icon' title='".q($msg->subject)."' /></i>&nbsp;&nbsp;$bold_start<a href='inbox.php?mid=$msg->id".$urlstr."'>".q($msg->subject)."</a>".$bold_end.$filename;
     } else {
         $td[$i++] = "<i class='fa fa-envelope-o' title='".q($msg->subject)."' /></i>&nbsp;&nbsp;<a href='outbox.php?mid=$msg->id".$urlstr."'>".q($msg->subject)."</a>".$filename;
     }
     
     if ($course_id == 0) {
         if ($msg->course_id != 0) {
             $td[$i++] = "$bold_start<a class=\"outtabs\" href=\"index.php?course=".course_id_to_code($msg->course_id)."\">".course_id_to_title($msg->course_id)."</a>$bold_end";
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:ajax_handler.php


示例16: format_file_size

 echo "<td width=\"16%\"><b>" . $lang['thumb_directory'] . "</b></td><td width=\"16%\">" . format_file_size(get_dir_size(THUMB_PATH)) . "</td>\n";
 echo "</tr>";
 //3
 echo "<tr class=\"" . get_row_bg() . "\">\n";
 $sql = "SELECT COUNT(*) as users\n          FROM " . USERS_TABLE . "\n          WHERE " . get_user_table_field("", "user_id") . " <> " . GUEST;
 $row = $site_db->query_firstrow($sql);
 echo "<td width=\"16%\"><b>" . $lang['users'] . "</b></td><td width=\"16%\">" . $row['users'] . "</td>\n";
 echo "<td width=\"16%\"><b>" . $lang['database'] . "</b></td><td width=\"16%\">";
 include ROOT_PATH . 'includes/db_utils.php';
 get_database_size();
 if (!empty($global_info['database_size']['total'])) {
     if (!empty($global_info['database_size']['4images'])) {
         $db_status = $lang['homestats_total'] . " <b>" . format_file_size($global_info['database_size']['total']) . "</b> / ";
         $db_status .= "4images:&nbsp;<b>" . format_file_size($global_info['database_size']['4images']) . "</b>";
     } else {
         $db_status = format_file_size(!empty($global_info['database_size']['total']));
     }
 } else {
     $db_status = "n/a";
 }
 echo $db_status . "</td>\n";
 echo "</tr>";
 show_table_footer();
 $sql = "SELECT SUM(cat_hits) AS sum\n          FROM " . CATEGORIES_TABLE;
 $row = $site_db->query_firstrow($sql);
 $sum = isset($row['sum']) ? $row['sum'] : 0;
 show_table_header($lang['top_cat_hits'] . " (" . $lang['homestats_total'] . " " . $sum . ")", 4);
 $sql = "SELECT cat_id, cat_name, cat_hits\n          FROM " . CATEGORIES_TABLE . "\n          ORDER BY cat_hits DESC\n          LIMIT {$stats_limit}";
 $result = $site_db->query($sql);
 $num = 1;
 while ($row = $site_db->fetch_array($result)) {
开发者ID:abhinay100,项目名称:fourimages_app,代码行数:31,代码来源:home.php


示例17: getAttachedFiles

/**
 * Return an array of prepared attachment data to build forum attachment table
 * Also, save this array into $_SESSION to do available  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP format_filesize函数代码示例发布时间:2022-05-15
下一篇:
PHP format_field函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap