本文整理汇总了PHP中byte_convert函数的典型用法代码示例。如果您正苦于以下问题:PHP byte_convert函数的具体用法?PHP byte_convert怎么用?PHP byte_convert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了byte_convert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: work
public function work($info, $settings, $getter)
{
// Gain access to translations
global $lang;
// Say we're called more than once. Kill previous remnants
if (count($this->_windows) > 0) {
$this->_kill_windows();
}
// Get dimensions and give lovely header text
$fullscreen = ncurses_newwin(0, 0, 0, 0);
ncurses_wrefresh($fullscreen);
ncurses_getmaxyx($fullscreen, $x, $y);
ncurses_mvwaddstr($fullscreen, 0, 0, 'Generated by ' . AppName . ' (' . VERSION . ') on ' . date('m/d/Y @ h:i:s A (T)'));
ncurses_wrefresh($fullscreen);
$this->_max_dims = array($x, $y);
// Some important windows
$core_wins = array(array('name' => $lang['core'], 'content' => array(array($lang['os'], $info['OS']), array_key_exists('Distro', $info) ? array($lang['distro'], $info['Distro']['name'] . ($info['Distro']['version'] ? ' ' . $info['Distro']['version'] : '')) : false, array($lang['kernel'], $info['Kernel']), array_key_exists('Model', $info) && !empty($info['Model']) ? array($lang['model'], $info['Model']) : false, array($lang['uptime'], str_ireplace(array(' ', 'days', 'minutes', 'hours', 'seconds'), array('', 'd', 'm', 'h', 's'), reset(explode(';', $info['UpTime'])))), array($lang['hostname'], $info['HostName']), array_key_exists('CPUArchitecture', $info) ? array($lang['cpu_arch'], $info['CPUArchitecture']) : false, array($lang['load'], implode(' ', (array) $info['Load'])))), array('name' => $lang['memory'], 'content' => array(array($lang['size'], byte_convert($info['RAM']['total'])), array($lang['used'], byte_convert($info['RAM']['total'] - $info['RAM']['free'])), array($lang['free'], byte_convert($info['RAM']['free'])))));
// Show them
$h = 1;
foreach ($core_wins as $win) {
list($width, $height) = $this->_window_with_lines($win['name'], $win['content'], $h, 0);
$h += $height + 1;
}
// Makeshift event loop
while (true) {
// Die on input
$getch = ncurses_getch();
if ($getch > 0 && $getch == 113) {
$this->__destruct();
echo "\nEnding at your request.\n";
exit(0);
}
// Stop temporariy
ncurses_napms(1000);
// Call ourselves
$this->work($getter->getAll(), $settings, $getter);
}
}
示例2: get_item_description
function get_item_description($activity)
{
global $dbh;
global $settings;
if ($activity['type'] == 'backed up') {
?>
<a href="<?php
echo $activity['table'];
?>
" target="_blank">File</a> - <?php
echo byte_convert($activity['row']);
echo file_exists($activity['table']) ? '' : ' - <span class="warning">Missing File!</span>';
} elseif ($activity['type'] == 'error') {
$view_error = true ? ellipses($activity['sql']) : $activity['sql'];
return '<a href="#" class="dialog_note" title="Error Detail" message="<b>User:</b> ' . get_username($activity['user']) . '<br><b>Page:</b> ' . $activity['table'] . '<br><b>Time:</b> ' . date('M jS Y, g:i:s a', strtotime($activity['datetime'])) . '<br><br>' . str_replace('"', '\\"', strip_tags($activity['sql'])) . '">View Error</a>: ' . $view_error;
} elseif ($activity['type'] == 'installed') {
return 'Directus install';
} elseif ($activity['table'] == 'directus_users') {
return '<a href="users.php">' . $activity['sql'] . '</a> has been added to Directus Users';
} elseif ($activity['table'] == 'directus_media') {
// Get name of media
$sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `id` = :id ");
$sth->bindParam(':id', $activity['row']);
$sth->execute();
if ($row = $sth->fetch()) {
$title = $row['title'];
}
$title = $title ? ellipses($title, 20) : '<i>No title</i>';
$return = '<a href="#" class="open_media" media_id="' . $activity['row'] . '">' . $title . '</a> within Directus Media';
$return .= $activity['sql'] == 'batch' ? ' - <b>Batch upload</b>' : '';
return $return;
} elseif ($activity['table'] && $activity['row']) {
$first_field = get_primary_field_value($activity['table'], $activity['row']);
return '<a href="edit.php?table=' . $activity['table'] . '&item=' . $activity['row'] . '" title="' . ellipses(str_replace('"', '\\"', $first_field), 200) . '">' . ellipses($first_field, 20) . '</a> within ' . uc_table($activity['table']);
}
}
示例3: voicemail_messages
public function voicemail_messages()
{
$sql = "select * from v_voicemail_messages as m, v_voicemails as v ";
$sql .= "where m.domain_uuid = '{$this->domain_uuid}' ";
$sql .= "and m.voicemail_uuid = v.voicemail_uuid ";
if (is_array($this->voicemail_id)) {
$sql .= "and (";
$x = 0;
foreach ($this->voicemail_id as $row) {
if ($x > 0) {
$sql .= "or ";
}
$sql .= "v.voicemail_id = '" . $row['voicemail_id'] . "' ";
$x++;
}
$sql .= ") ";
} else {
$sql .= "and v.voicemail_id = '{$this->voicemail_id}' ";
}
if (strlen($this->order_by) == 0) {
$sql .= "order by v.voicemail_id, m.created_epoch desc ";
} else {
$sql .= "order by v.voicemail_id, m.{$this->order_by} {$this->order} ";
}
//$sql .= "limit $this->rows_per_page offset $this->offset ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
$result_count = count($result);
unset($prep_statement, $sql);
if ($result_count > 0) {
foreach ($result as &$row) {
//set the greeting directory
$path = $_SESSION['switch']['voicemail']['dir'] . '/default/' . $_SESSION['domain_name'] . '/' . $row['voicemail_id'];
if (file_exists($path . '/msg_' . $row['voicemail_message_uuid'] . '.wav')) {
$row['file_path'] = $path . '/msg_' . $row['voicemail_message_uuid'] . '.wav';
}
if (file_exists($path . '/msg_' . $row['voicemail_message_uuid'] . '.mp3')) {
$row['file_path'] = $path . '/msg_' . $row['voicemail_message_uuid'] . '.mp3';
}
$row['file_size'] = filesize($row['file_path']);
$row['file_size_label'] = byte_convert($row['file_size']);
$row['file_ext'] = substr($row['file_path'], -3);
$message_length = $row['message_length'];
if ($message_length < 60) {
$message_length = $message_length . " sec";
} else {
$message_length = round($message_length / 60, 2) . " min";
}
$row['message_length_label'] = $message_length;
$row['created_date'] = date("j M Y g:i a", $row['created_epoch']);
}
}
return $result;
}
示例4: rsort
}
echo "\t</tr>";
if ($emails) {
rsort($emails);
// most recent on top
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
$attachment = parse_attachments($connection, $email_id, FT_UID);
$file_name = $attachment[0]['filename'];
$caller_id_name = substr($file_name, 0, strpos($file_name, '-'));
$caller_id_number = is_numeric($caller_id_name) ? format_phone((int) $caller_id_name) : null;
echo "\t<tr " . ($metadata[0]['seen'] == 0 ? "style='font-weight: bold;'" : null) . ">\n";
echo "\t\t<td valign='top' class='" . $row_style[$c] . "'>" . $caller_id_name . "</td>\n";
echo "\t\t<td valign='top' class='" . $row_style[$c] . "'>" . $caller_id_number . "</td>\n";
echo "\t\t<td valign='top' class='" . $row_style[$c] . "'><a href='?id=" . $fax_uuid . "&email_id=" . $email_id . "&download'>" . $file_name . "</a></td>\n";
echo "\t\t<td valign='top' class='" . $row_style[$c] . "'>" . byte_convert(strlen($attachment[0]['attachment'])) . "</td>\n";
echo "\t\t<td valign='top' class='" . $row_style[$c] . "'>" . $metadata[0]['date'] . "</td>\n";
if (permission_exists('fax_inbox_delete')) {
echo "\t\t<td style='width: 25px;' class='list_control_icons'><a href='?id=" . $fax_uuid . "&email_id=" . $email_id . "&delete' onclick=\"return confirm('" . $text['confirm-delete'] . "')\">" . $v_link_label_delete . "</a></td>\n";
}
echo "\t</tr>\n";
// $fax_message = imap_fetchbody($connection, $email_id, '1.1', FT_UID);
// if ($fax_message == '') {
// $fax_message = imap_fetchbody($connection, $email_id, '1', FT_UID);
// }
$c = $c ? 0 : 1;
}
} else {
echo "<tr valign='top'>\n";
echo "\t<td colspan='4' style='text-align: center;'><br><br>" . $text['message-no_faxes_found'] . "<br><br></td>\n";
echo "</tr>\n";
示例5: getRAID
/**
* getRAID
*
* @access private
* @return array of raid arrays
*/
private function getRAID()
{
// Time?
if (!empty($this->settings['timer'])) {
$t = new LinfoTimerStart('RAID');
}
// Store it here
$raidinfo = array();
// mdadm?
if (array_key_exists('mdadm', (array) $this->settings['raid']) && !empty($this->settings['raid']['mdadm'])) {
// Try getting contents
$mdadm_contents = getContents('/proc/mdstat', false);
// No?
if ($mdadm_contents === false) {
$this->error->add('Linux softraid mdstat parser', '/proc/mdstat does not exist.');
}
// Parse
@preg_match_all('/(\\S+)\\s*:\\s*(\\w+)\\s*raid(\\d+)\\s*([\\w+\\[\\d+\\] (\\(\\w\\))?]+)\\n\\s+(\\d+) blocks\\s*(?:super \\d\\.\\d\\s*)?(level \\d\\, [\\w\\d]+ chunk\\, algorithm \\d\\s*)?\\[(\\d\\/\\d)\\] \\[([U\\_]+)\\]/mi', (string) $mdadm_contents, $match, PREG_SET_ORDER);
// Store them here
$mdadm_arrays = array();
// Deal with entries
foreach ((array) $match as $array) {
// Temporarily store drives here
$drives = array();
// Parse drives
foreach (explode(' ', $array[4]) as $drive) {
// Parse?
if (preg_match('/([\\w\\d]+)\\[\\d+\\](\\(\\w\\))?/', $drive, $match_drive) == 1) {
// Determine a status other than normal, like if it failed or is a spare
if (array_key_exists(2, $match_drive)) {
switch ($match_drive[2]) {
case '(S)':
$drive_state = 'spare';
break;
case '(F)':
$drive_state = 'failed';
break;
case null:
$drive_state = 'normal';
break;
// I'm not sure if there are status codes other than the above
// I'm not sure if there are status codes other than the above
default:
$drive_state = 'unknown';
break;
}
} else {
$drive_state = 'normal';
}
// Append this drive to the temp drives array
$drives[] = array('drive' => '/dev/' . $match_drive[1], 'state' => $drive_state);
}
}
// Add record of this array to arrays list
$mdadm_arrays[] = array('device' => '/dev/' . $array[1], 'status' => $array[2], 'level' => $array[3], 'drives' => $drives, 'size' => byte_convert($array[5] * 1024), 'algorithm' => $array[6], 'count' => $array[7], 'chart' => $array[8]);
}
// Append MD arrays to main raidinfo if it's good
if (is_array($mdadm_arrays) && count($mdadm_arrays) > 0) {
$raidinfo = array_merge($raidinfo, $mdadm_arrays);
}
}
// Return info
return $raidinfo;
}
示例6: generate_media_item
function generate_media_item($id, $title, $extension, $source, $height, $width, $file_size, $uploaded, $user, $caption, $search = false, $tags = '', $modal = false)
{
global $cms_all_users;
global $cms_user;
$click_type = $modal ? 'checkable' : 'editable';
?>
<tr class="media_item" id="media_<?php
echo $id;
?>
">
<td class="check" raw="X"><?php
if ($cms_user['media'] || $modal) {
?>
<input class="status_action_check" type="checkbox" name="media_ids_checked[]" value="<?php
echo $id;
?>
" id="<?php
echo $id;
?>
"><?php
}
?>
</td>
<td class="thumb <?php
echo $click_type;
?>
" raw="X">
<?php
if (!$modal) {
?>
<input name="media_ids[]" type="hidden" value="<?php
echo $id;
?>
" />
<?php
}
generate_media_image($extension, $source, $height, $width, $file_size);
$extension = strtoupper($extension);
$file_size_text = $extension == 'YOUTUBE' || $extension == 'VIMEO' ? seconds_convert($file_size) : byte_convert($file_size);
?>
</td>
<td class="field_title first_field <?php
echo $click_type;
?>
"><div class="wrap"><?php
echo $title;
?>
</div></td>
<td class="field_type <?php
echo $click_type;
?>
"><div class="wrap"><?php
echo $extension;
?>
</div></td>
<td class="field_size <?php
echo $click_type;
?>
"><div class="wrap"><?php
echo $file_size_text;
?>
</div></td>
<td class="field_caption <?php
echo $click_type;
?>
"><div class="wrap" title="<?php
echo $tags;
?>
"><?php
echo $caption;
?>
<span class="hide"><?php
echo $tags;
?>
</span></div></td>
<td class="field_user <?php
echo $click_type;
?>
"><div class="wrap"><?php
echo $user == $cms_user['id'] ? '<strong>' . $cms_all_users[$user]['username'] . '</strong>' : $cms_all_users[$user]['username'];
?>
</div></td>
<td class="field_date <?php
echo $click_type;
?>
"><div class="wrap" title="<?php
echo date('Y-m-d H:i:s', strtotime($uploaded));
?>
"><?php
echo contextual_time(strtotime($uploaded));
?>
</div></td>
</tr>
<?php
}
示例7: print_files
function print_files($c = '.')
{
global $root_path, $mode, $thmb_size, $file_class, $lng;
echo('<table id="file-list">');
$d = opendir($c);
$i = 0;
while($f = readdir($d))
{
if(strpos($f, '.') === 0) continue;
$ff = $c . '/' . $f;
$ext = strtolower(substr(strrchr($f, '.'), 1));
if(!is_dir($ff))
{
echo '<tr' . ($i%2 ? ' class="light"' : ' class="dark"') .'>';
//show preview and different icon, if file is image
$imageinfo = @getimagesize($ff);
if($imageinfo && $imageinfo[2] > 0 && $imageinfo[2]< 4)
{
$resize = '';
if($imageinfo[0] > $thmb_size or $imageinfo[1] > $thmb_size)
{
if($imageinfo[0] > $imageinfo[1])
{
$resize = ' style="width: ' . $thmb_size . 'px;"';
}
else
{
$resize = ' style="height: ' . $thmb_size . 'px;"';
}
}
if ($imageinfo[2] == 1)
{
$imagetype = "image_gif";
}
elseif ($imageinfo[2] == 2)
{
$imagetype = "image_jpg";
}
elseif ($imageinfo[2] == 3)
{
$imagetype = "image_jpg";
}
else
{
$imagetype = "image";
}
//echo '<td><a class="file thumbnail ' . $imagetype . '" href="#" onclick="submit_url(\'' . $root_path . '/' . $ff . '\');">' . $f . '<span><img' . $resize . ' src="' . $root_path . '/' . $ff . '" /></span></a>'; echo '</td>';
echo '<td><a class="file thumbnail ' . $imagetype . '" href="#" onclick="submit_url(\''. str_replace("../../../../", BASEURLX, $ff) . '\');">' . $f . '<span><img' . $resize . ' src="' . $root_path . '/' . $ff . '" /></span></a>'; echo '</td>';
}
//known file types
elseif(in_array($ext,$file_class))
{
echo '<td><a class="file file_' . $ext . '" href="#" onclick="submit_url(\'' . $root_path . '/' . $ff . '\');">' . $f . '</a>'; echo '</td>';
}
//all other files
else
{
echo '<td><a class="file unknown" href="#" onclick="submit_url(\'' . $root_path . '/' . $ff . '\');">' . $f . '</a>'; echo '</td>';
}
echo '<td>' . byte_convert(filesize($ff)) . '</td>';
echo '<td class="delete"><a href="#" title="' . $lng['delete_title'] . '" onclick="delete_file(\'' . $c . '\',\'' . $f . '\');">' . $lng['delete'] . '</a></td>';
echo '</tr>';
$i++;
}
}
echo('</table>');
}
示例8: foreach
if (!(permission_exists('recording_edit') || permission_exists('recording_delete'))) {
$colspan = $colspan - 1;
}
if ($result_count > 0) {
foreach ($result as $row) {
//playback progress bar
if (permission_exists('recording_play')) {
echo "<tr id='recording_progress_bar_" . $row['recording_uuid'] . "' style='display: none;'><td class='" . $row_style[$c] . "' style='border: none; padding: 0;' colspan='" . $colspan . "'><span class='playback_progress_bar' id='recording_progress_" . $row['recording_uuid'] . "'></span></td></tr>\n";
}
$tr_link = permission_exists('recording_edit') ? "href='recording_edit.php?id=" . $row['recording_uuid'] . "'" : null;
echo "<tr " . $tr_link . ">\n";
echo "\t<td valign='top' class='" . $row_style[$c] . "'>" . $row['recording_name'] . "</td>\n";
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo "\t<td valign='top' class='" . $row_style[$c] . "'>" . $row['recording_filename'] . "</td>\n";
$tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'] . '/' . $_SESSION['domain_name'] . '/' . $row['recording_filename']);
$tmp_filesize = byte_convert($tmp_filesize);
echo "\t<td class='" . $row_style[$c] . "' style='text-align: center;'>" . $tmp_filesize . "</td>\n";
}
if (permission_exists('recording_play') || permission_exists('recording_download')) {
echo "\t<td valign='top' class='" . $row_style[$c] . " row_style_slim tr_link_void'>";
if (permission_exists('recording_play')) {
$recording_file_path = $row['recording_filename'];
$recording_file_name = strtolower(pathinfo($recording_file_path, PATHINFO_BASENAME));
$recording_file_ext = pathinfo($recording_file_name, PATHINFO_EXTENSION);
switch ($recording_file_ext) {
case "wav":
$recording_type = "audio/wav";
break;
case "mp3":
$recording_type = "audio/mpeg";
break;
示例9: build_page
//.........这里部分代码省略.........
$tpl->set_var(array('UP_LINK_COL' => ' display_up_arrow', 'TEXT_UP' => $TEXT['UP'], 'DISPLAY_UP_ARROW' => ' display_up_arrow'));
}
// now set the dirs and files file_list_block and permissions
$tpl->set_block('browse', 'file_list_block', 'file_list');
$tpl->set_block('file_list', 'media_rename_block', 'media_rename');
$tpl->set_block('file_list', 'media_delete_block', 'media_delete');
// get dirs and files in currentDir
$FILE = scan_current_dir(LEPTON_PATH . MEDIA_DIRECTORY . '/' . $directory);
$temp_id = 0;
$line = $row_id = 1;
if (count($FILE['path']) > 0) {
foreach ($FILE['path'] as $name) {
$temp_id++;
$link_name = str_replace(' ', '%20', $name);
$tpl->set_var(array('NAME' => $name, 'NAME_SLASHED' => addslashes($name), 'TEMP_ID' => $temp_id, 'LINK' => 'index.php?dir=' . $directory . '/' . $link_name, 'LINK_RELATION' => '', 'ROW_ID' => $line++ & 1, 'FT_ICON' => THEME_URL . '/images/folder_16.png', 'FILETYPE_ICON' => THEME_URL . '/images/folder_16.png', 'FILETYPE' => 'dir', 'FILENAME' => '/' . addslashes($name), 'LINK_TARGET' => '_self', 'ENABLE_OVERLIB' => '', 'EXTENSION' => '', 'MOUSEOVER' => '', 'CLASS_PREVIEW' => '', 'IMAGEDETAIL' => '', 'DISPLAY_ICON' => '', 'SIZE' => '', 'DATE' => '', 'PREVIEW' => '', 'LINK_PATH' => $directory . '/' . $link_name, 'MEDIA_PATH' => MEDIA_DIRECTORY));
$tpl->parse('file_list', 'file_list_block', true);
}
}
// now set the files file_list_block and permissions
if (count($FILE['filename']) > 0) {
// convert to correct searchpattern
$allowed_file_types = str_replace(',', '|', RENAME_FILES_ON_UPLOAD);
foreach ($FILE['filename'] as $name) {
$preview = 'preview';
if (!preg_match("/\\." . $allowed_file_types . "\$/i", $name)) {
$preview = '';
continue;
}
$temp_id++;
$overlib = preg_match("/\\." . $allowed_img_types . "\$/i", $name) ? ' overlib' : '';
if ($preview) {
$filetype = get_filetype(LEPTON_URL . MEDIA_DIRECTORY . $directory . '/' . $name);
$size = filesize(LEPTON_PATH . MEDIA_DIRECTORY . $directory . '/' . $name);
$bytes = byte_convert($size);
$fdate = filemtime(LEPTON_PATH . MEDIA_DIRECTORY . $directory . '/' . $name);
$date = date(DATE_FORMAT . ' ' . TIME_FORMAT, $fdate);
$filetypeicon = get_filetype_icon(LEPTON_URL . MEDIA_DIRECTORY . $directory . '/' . $name);
$tooltip = '';
$imgdetail = $bytes;
$icon = THEME_URL . '/images/files/unknown.png';
if (!$pathsettings['global']['show_thumbs']) {
$info = @getimagesize(LEPTON_PATH . MEDIA_DIRECTORY . $directory . '/' . $name);
if ($info[0]) {
$imgdetail = fsize(filesize(LEPTON_PATH . MEDIA_DIRECTORY . $directory . '/' . $name)) . '<br /> ' . $info[0] . ' x ' . $info[1] . ' px';
$icon = 'thumb.php?t=1&img=' . $directory . '/' . $name;
$tooltip = ShowTip('thumb.php?t=2&img=' . $directory . '/' . $name, $allowed_img_types);
} else {
$icon = THEME_URL . '/images/files/' . $filetypeicon . '.png';
}
} else {
$filetypeicon = get_filetype_icon(LEPTON_PATH . MEDIA_DIRECTORY . $directory . '/' . $name);
$icon = THEME_URL . '/images/files/' . $filetypeicon . '.png';
}
$tpl->set_var(array('NAME' => $name, 'NAME_SLASHED' => addslashes($name), 'TEMP_ID' => $temp_id, 'LINK' => LEPTON_URL . MEDIA_DIRECTORY . $directory . '/' . $name, 'LINK_RELATION' => '', 'ROW_ID' => $line++ & 1, 'FT_ICON' => $icon, 'FILETYPE_ICON' => THEME_URL . '/images/files/' . $filetypeicon . '.png', 'FILENAME' => addslashes($name), 'LINK_TARGET' => '_top', 'ENABLE_OVERLIB' => $overlib, 'FILETYPE' => 'file', 'EXTENSION' => $filetype, 'MOUSEOVER' => $tooltip, 'CLASS_PREVIEW' => '', 'IMAGEDETAIL' => $imgdetail, 'DISPLAY_ICON' => '', 'SIZE' => $bytes, 'DATE' => $date, 'PREVIEW' => $preview));
$tpl->parse('file_list', 'file_list_block', true);
}
}
}
$tpl->set_var(array('TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'], 'TEXT_RELOAD' => $TEXT['RELOAD'], 'TEXT_RENAME' => $TEXT['RENAME'], 'TEXT_DELETE' => $TEXT['DELETE'], 'TEXT_SIZE' => $TEXT['SIZE'], 'TEXT_DATE' => $TEXT['DATE'], 'TEXT_NAME' => $TEXT['NAME'], 'TEXT_TYPE' => $TEXT['TYPE'], 'MEDIA_BROWSE' => '', 'NONE_FOUND' => $MESSAGE['MEDIA_NONE_FOUND'], 'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'], 'CONFIRM_DELETE' => js_alert_encode($MESSAGE['MEDIA_CONFIRM_DELETE']), 'CONFIRM_DELETE_FILE' => js_alert_encode($MESSAGE['MEDIA_CONFIRM_DELETE_FILE']), 'CONFIRM_DELETE_DIR' => js_alert_encode($MESSAGE['MEDIA_CONFIRM_DELETE_DIR'])));
// If no files are in the media folder say so
if ($temp_id == 0) {
$tpl->set_var('DISPLAY_LIST_TABLE', ' hide');
$tpl->set_var('DISPLAY_NONE_FOUND', ' center');
$tpl->set_var("file_list_block", "<tr><td></td></tr>");
$tpl->parse('file_list', 'file_list_block', true);
} else {
示例10: __
if (!$result['status']) {
$result['message'] = __('Description not updated');
}
echo json_encode($result);
return;
}
if ($get_file_row) {
$id_file = (int) get_parameter("id_attachment");
$id_company = (int) get_parameter("id");
$file = get_db_row_filter('tattachment', array('id_company' => $id_company, 'id_attachment' => $id_file));
$html = "";
if ($file) {
$link = "operation/common/download_file.php?id_attachment=" . $file["id_attachment"] . "&type=company";
$real_filename = $config["homedir"] . "/attachment/" . $file["id_attachment"] . "_" . rawurlencode($file["filename"]);
$html .= "<tr>";
$html .= "<td valign=top>";
$html .= '<a target="_blank" href="' . $link . '">' . $file['filename'] . '</a>';
$html .= "<td valign=top class=f9>" . $file["description"];
//$html .= "<td valign=top>". $file["id_usuario"];
$html .= "<td valign=top>" . byte_convert($file['size']);
$stat = stat($real_filename);
$html .= "<td valign=top class=f9>" . date("Y-m-d H:i:s", $stat['mtime']);
// Delete attachment
if (give_acl($config['id_user'], $incident['id_grupo'], 'IM')) {
$html .= "<td>" . '<a class="delete" name="delete_file_' . $file["id_attachment"] . '" href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $id . '&tab=files&id_attachment=' . $file["id_attachment"] . '&delete_file=1#incident-operations">
<img src="images/cross.png"></a>';
}
}
echo $html;
return;
}
示例11: seconds_convert
$length_size = seconds_convert($media_detail['file_size']);
if ($extension == 'youtube') {
$link = 'http://www.youtube.com/watch?v=' . $media_detail["source"];
$link_text = 'http://www.youtube.com/watch?v=<b>' . $media_detail["source"] . '</b>';
} elseif ($extension == 'vimeo') {
$link = 'http://vimeo.com/' . $media_detail["source"];
$link_text = 'http://vimeo.com/<b>' . $media_detail["source"] . '</b>';
}
$dimensions = $media_detail['width'] . ' x ' . $media_detail['height'] . ' - ';
} else {
if ($extension == 'jpg' || $extension == 'gif' || $extension == 'png') {
$length_size = byte_convert($media_detail['file_size']);
$link = '../' . $settings['cms']['media_path'] . $media_detail["source"];
$dimensions = $media_detail['width'] . ' x ' . $media_detail['height'] . ' - ';
} else {
$length_size = byte_convert($media_detail['file_size']);
$link = '../' . $settings['cms']['media_path'] . $media_detail["source"];
$dimensions = '';
}
// Get all non-video link texts
$page_url_array = explode('/inc/', CMS_PAGE_URL);
// Requires directus directory name
$site_path = $page_url_array[0];
$temp_path = get_absolute_path($site_path . '/../' . $settings['cms']['media_path'] . $media_detail["source"]);
$link_text = highlight_custom($media_detail['source'], $temp_path, '<b>', '</b>');
}
$extension = ucwords($extension);
//////////////////////////////////////////////////////////////////////////////
?>
<table class="media_modal_details" cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
示例12: skillsoft_download_customreport
/**
* This function will use CURL to download a file
*
* @param string $url - The URL we want to download
* @param string $folder - The folder where we will save it. DEFAULT = temp
* @param bool $trace - Do we output tracing info.
* @param string $prefix - The string to prefix all mtrace reports with
* @return string localpath or NULL on error
*/
function skillsoft_download_customreport($handle, $url, $folder = NULL, $trace = false, $prefix = ' ')
{
global $CFG;
set_time_limit(0);
$starttime = microtime(true);
if ($trace) {
mtrace($prefix . get_string('skillsoft_customreport_download_start', 'skillsoft'));
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_url', 'skillsoft', $url));
}
$basefolder = str_replace('\\', '/', $CFG->tempdir);
$downloadedfile = NULL;
if ($folder == NULL) {
$folder = 'reports';
}
/// Create temp directory if necesary
if (!make_temp_directory($folder, false)) {
//Couldn't create temp folder
if ($trace) {
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_createdirectoryfailed', 'skillsoft', $basefolder . '/' . $folder));
}
return NULL;
}
$filename = basename($url);
$fp = fopen($basefolder . '/' . $folder . '/' . $filename, 'wb');
if (!extension_loaded('curl') or ($ch = curl_init($url)) === false) {
//Error no CURL
if ($trace) {
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_curlnotavailable', 'skillsoft'));
}
} else {
$ch = curl_init($url);
//Ignore SSL errors
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FILE, $fp);
//Force SSLv3 to workaround Openssl 1.0.1 issue
//See https://bugs.launchpad.net/ubuntu/+source/curl/+bug/595415
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
//Setup Proxy Connection
if (!empty($CFG->proxyhost)) {
// SOCKS supported in PHP5 only
if (!empty($CFG->proxytype) and $CFG->proxytype == 'SOCKS5') {
if (defined('CURLPROXY_SOCKS5')) {
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
} else {
curl_close($ch);
if ($trace) {
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_socksproxyerror', 'skillsoft'));
}
return NULL;
}
}
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);
if (empty($CFG->proxyport)) {
curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost);
} else {
curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost . ':' . $CFG->proxyport);
}
if (!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $CFG->proxyuser . ':' . $CFG->proxypassword);
if (defined('CURLOPT_PROXYAUTH')) {
// any proxy authentication if PHP 5.1
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
}
}
}
curl_exec($ch);
// Check if any error occured
if (!curl_errno($ch)) {
$downloadresult = new stdClass();
$downloadresult->bytes = byte_convert(curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD));
$downloadresult->total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME);
$downloadresult->filepath = $basefolder . '/' . $folder . '/' . $filename;
fclose($fp);
if ($trace) {
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_result', 'skillsoft', $downloadresult));
}
$downloadedfile = $downloadresult->filepath;
//Update skillsoft_report_track table
skillsoft_update_customreport_downloaded($handle, $downloadedfile);
} else {
fclose($fp);
if ($trace) {
mtrace($prefix . $prefix . get_string('skillsoft_customreport_download_error', 'skillsoft', curl_error($ch)));
}
return NULL;
}
}
$endtime = microtime(true);
$duration = $endtime - $starttime;
//.........这里部分代码省略.........
示例13: array
$table->style = array ();
$table->rowstyle = array ();
$table->head = array ();
$table->head[0] = __('Filename');
$table->head[1] = __('Description');
$table->head[2] = __('Size');
$table->head[3] = __('Date');
$table->head[4] = __('Ops.');
foreach ($files as $file) {
$data = array ();
$data[0] = "<a href='operation/common/download_file.php?id_attachment=".$file["id_attachment"]."&type=company'>".$file["filename"] . "</a>";
$data[1] = $file["description"];
$data[2] = byte_convert($file["size"]);
$data[3] = $file["timestamp"];
// Todo. Delete files owner of lead and admins only
if ( (dame_admin($config["id_user"])) || ($file["id_usuario"] == $config["id_user"]) ){
$data[4] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&id=$id&op=files&deletef=".$file["id_attachment"]."'><img src='images/cross.png'></a>";
}
array_push ($table->data, $data);
array_push ($table->rowstyle, $style);
}
print_table ($table);
}
else {
echo "<h3>". __('There is no files attached for this lead')."</h3>";
}
示例14: unset
echo "</td>\n";
echo "\t</tr>";
unset($stream_icons, $icons);
//add the uuid of to the link
if (permission_exists('music_on_hold_edit')) {
$tr_link = "href='music_on_hold_edit.php?id=" . $row['music_on_hold_uuid'] . "'";
}
//get the music on hold path
$stream_path = $row['music_on_hold_path'];
$stream_path = str_replace("\$\${sounds_dir}", $_SESSION['switch']['sounds']['dir'], $stream_path);
//show the files
if (file_exists($stream_path)) {
$stream_files = array_merge(glob($stream_path . '/*.wav'), glob($stream_path . '/*.mp3'), glob($stream_path . '/*.ogg'));
foreach ($stream_files as $stream_file_path) {
$stream_file = pathinfo($stream_file_path, PATHINFO_BASENAME);
$stream_file_size = byte_convert(filesize($stream_file_path));
$stream_file_date = date("M d, Y H:i:s", filemtime($stream_file_path));
$stream_file_ext = pathinfo($stream_file, PATHINFO_EXTENSION);
switch ($stream_file_ext) {
case "wav":
$stream_file_type = "audio/wav";
break;
case "mp3":
$stream_file_type = "audio/mpeg";
break;
case "ogg":
$stream_file_type = "audio/ogg";
break;
}
$row_uuid = uuid();
echo "<tr id='recording_progress_bar_" . $row_uuid . "' style='display: none;'><td colspan='4' class='" . $row_style[$c] . " playback_progress_bar_background' style='padding: 0; border: none;'><span class='playback_progress_bar' id='recording_progress_" . $row_uuid . "'></span></td></tr>\n";
示例15: foreach
echo "\t<tr>\n";
echo "\t\t<th class=\"listhdr\">" . $text['label-file_name'] . "</th>\n";
echo "\t\t<th class=\"listhdr\">" . $text['label-tools'] . "</th>\n";
echo "\t\t<th class=\"listhdr\" style='text-align: right;'>" . $text['label-uploaded'] . "</th>\n";
echo "\t\t<th class=\"listhdr\" style='text-align: right;' nowrap=\"nowrap\">" . $text['label-file-size'] . "</th>\n";
echo "\t\t<th class=\"listhdr\" style='text-align: right;' nowrap=\"nowrap\">" . $text['label-sampling'] . "</th>\n";
echo "\t\t<td width='22px' align=\"center\" style=\"padding: 2px;\"><span id='category_" . $category_number . "_delete_icon'></span></td>\n";
echo "\t</tr>";
$moh_found = false;
foreach ($sampling_rate_dirs as $sampling_rate_dir) {
if ($handle = opendir($music_on_hold_category_parent_dir . "/" . $category_dir . "/" . $sampling_rate_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_file($music_on_hold_category_parent_dir . "/" . $category_dir . "/" . $sampling_rate_dir . "/" . $file)) {
$row_uuid = uuid();
$file_size = filesize($music_on_hold_category_parent_dir . "/" . $category_dir . "/" . $sampling_rate_dir . "/" . $file);
$file_size = byte_convert($file_size);
//playback progress bar
echo "<tr id='recording_progress_bar_" . $row_uuid . "' style='display: none;'><td colspan='5'><span class='playback_progress_bar' id='recording_progress_" . $row_uuid . "'></span></td></tr>\n";
echo "<tr>\n";
echo "\t<td class='" . $row_style[$c] . "'>" . $file . "</td>\n";
if (strlen($file) > 0) {
echo "\t<td valign='top' class='" . $row_style[$c] . " row_style_slim tr_link_void'>";
$recording_file_path = $file;
$recording_file_name = strtolower(pathinfo($row['recording_filename'], PATHINFO_BASENAME));
$recording_file_ext = pathinfo($recording_file_name, PATHINFO_EXTENSION);
switch ($recording_file_ext) {
case "wav":
$recording_type = "audio/wav";
break;
case "mp3":
$recording_type = "audio/mpeg";