本文整理汇总了PHP中osC_DateTime::fromUnixTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_DateTime::fromUnixTimestamp方法的具体用法?PHP osC_DateTime::fromUnixTimestamp怎么用?PHP osC_DateTime::fromUnixTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_DateTime
的用法示例。
在下文中一共展示了osC_DateTime::fromUnixTimestamp方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAdministratorsLog
function listAdministratorsLog()
{
global $toC_Json, $osC_Database;
$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
$Qlog = $osC_Database->query('select SQL_CALC_FOUND_ROWS count(al.id) as total, al.id, al.module, al.module_action, al.module_id, al.action, a.user_name, unix_timestamp(al.datestamp) as datestamp from :table_administrators_log al, :table_administrators a where');
if (!empty($_REQUEST['fm']) && in_array($_REQUEST['fm'], $_SESSION['admin']['access'])) {
$Qlog->appendQuery('al.module = :module');
$Qlog->bindValue(':module', $_REQUEST['fm']);
} else {
$Qlog->appendQuery('al.module in (":modules")');
$Qlog->bindRaw(':modules', implode('", "', $_SESSION['admin']['access']));
}
$Qlog->appendQuery('and');
if (is_numeric($_REQUEST['fu']) && !empty($_REQUEST['fu'])) {
$Qlog->appendQuery('al.administrators_id = :administrators_id and');
$Qlog->bindInt(':administrators_id', $_REQUEST['fu']);
}
$Qlog->appendQuery('al.administrators_id = a.id group by al.id order by al.id desc');
$Qlog->bindTable(':table_administrators_log', TABLE_ADMINISTRATORS_LOG);
$Qlog->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
$Qlog->setExtBatchLimit($start, $limit);
$Qlog->execute();
$records = array();
while ($Qlog->next()) {
$records[] = array('administrators_log_id' => $Qlog->valueInt('id'), 'administrators_id' => $Qlog->valueInt('administrators_id'), 'module' => $Qlog->value('module') . ' (' . $Qlog->valueInt('total') . ')', 'module_id' => $Qlog->valueInt('module_id'), 'module_action' => $Qlog->valueProtected('module_action'), 'user_name' => $Qlog->valueProtected('user_name'), 'date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($Qlog->value('datestamp')), true), 'logo_info_title' => osc_icon('info.png') . ' ' . $Qlog->valueProtected('user_name') . ' » ' . $Qlog->valueProtected('module_action') . ' » ' . $Qlog->value('module') . ' » ' . $Qlog->valueInt('module_id'));
}
$Qlog->freeResult();
$response = array(EXT_JSON_READER_TOTAL => $Qlog->getBatchSize(), EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}
示例2: listCache
function listCache()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('cache');
$response = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
if (strpos($file['name'], '-') !== false) {
$code = substr($file['name'], 0, strpos($file['name'], '-'));
} else {
$code = substr($file['name'], 0, strpos($file['name'], '.'));
}
if (isset($cached_files[$code])) {
$cached_files[$code]['total']++;
if ($last_modified > $cached_files[$code]['last_modified']) {
$cached_files[$code]['last_modified'] = $last_modified;
}
} else {
$cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
}
$response[] = array('code' => $code, 'total' => $cached_files[$code]['total'], 'last_modified' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($cached_files[$code]['last_modified']), true));
}
$response = array(EXT_JSON_READER_ROOT => $response);
echo $toC_Json->encode($response);
}
示例3: listDirectory
function listDirectory()
{
global $osC_Language, $toC_Json, $osC_MessageStack;
$directory = OSC_ADMIN_FILE_MANAGER_ROOT_PATH;
if (isset($_REQUEST['directory']) && !empty($_REQUEST['directory'])) {
$directory .= '/' . urldecode($_REQUEST['directory']);
} elseif (isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
$directory .= '/' . urldecode($_REQUEST['goto']);
}
$osC_DirectoryListing = new osC_DirectoryListing($directory);
$osC_DirectoryListing->setStats(true);
$records = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$file_owner = function_exists('posix_getpwuid') ? posix_getpwuid($file['user_id']) : '-?-';
$group_owner = function_exists('posix_getgrgid') ? posix_getgrgid($file['group_id']) : '-?-';
if ($file['is_directory'] === true) {
$entry_icon = osc_icon('folder_red.png');
$action = array(array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
} else {
$entry_icon = osc_icon('file.png');
$action = array(array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit')), array('class' => 'icon-download-record', 'qtip' => $osC_Language->get('icon_download')), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
}
$records[] = array('icon' => $entry_icon, 'file_name' => $file['name'], 'is_directory' => $file['is_directory'], 'size' => number_format($file['size']), 'permission' => osc_get_file_permissions($file['permissions']), 'file_owner' => $file_owner, 'group_owner' => $group_owner, 'writeable' => osc_icon(is_writable($osC_DirectoryListing->getDirectory() . '/' . $file['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'), 'last_modified_date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($file['last_modified']), true), 'action' => $action);
}
$response = array(EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}
示例4: listBackup
function listBackup()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_BACKUP);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setExcludeEntries('.htaccess');
$response = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$response[] = array('file' => $file['name'], 'date' => osC_DateTime::getDate(osC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $file['name'])), true), 'size' => number_format(filesize(DIR_FS_BACKUP . $file['name'])));
}
$response = array(EXT_JSON_READER_ROOT => $response);
echo $toC_Json->encode($response);
}
示例5: listMessages
function listMessages()
{
global $toC_Json, $osC_Database;
$max_execution_time = ini_get('max_execution_time');
ini_set('max_execution_time', 1800);
$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$limit = empty($_REQUEST['limit']) ? MAX_DISPLAY_SEARCH_RESULTS : $_REQUEST['limit'];
$toC_Email_Account = new toC_Email_Account($_REQUEST['accounts_id']);
if (isset($_REQUEST['check_email']) && $_REQUEST['check_email'] == 'true' || $toC_Email_Account->isImap()) {
$toC_Email_Account->fetchEmail($_REQUEST['folders_id']);
}
$Qmessages = $osC_Database->query('select * from :table_email_messages where accounts_id = :accounts_id and folders_id = :folders_id');
$Qmessages->bindTable(':table_email_messages', TABLE_EMAIL_MESSAGES);
$Qmessages->bindInt(':accounts_id', $toC_Email_Account->getAccountId());
$Qmessages->bindInt(':folders_id', $_REQUEST['folders_id']);
if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
$Qmessages->appendQuery('and (subject like :subject or from_address like :from)');
$Qmessages->bindValue(':subject', '%' . $_REQUEST['search'] . '%');
$Qmessages->bindValue(':from', '%' . $_REQUEST['search'] . '%');
}
$Qmessages->appendQuery('order by id desc');
$Qmessages->setExtBatchLimit($start, $limit);
$Qmessages->execute();
$day_start = mktime(0, 0, 0);
$day_end = mktime(0, 0, 0, date('m'), date('d') + 1);
$records = array();
while ($Qmessages->next()) {
$date = $Qmessages->value('udate');
if ($date > $day_start && $date < $day_end) {
$date = date('H:i', $date);
} else {
$date = osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($date));
}
$records[] = array('id' => $Qmessages->valueInt('id'), 'fetch_time' => $Qmessages->value('fetch_timestamp'), 'attachments' => $Qmessages->valueInt('attachments'), 'icon' => $Qmessages->valueInt('attachments') == 1 ? osc_icon('email_attachment.png') : '', 'new' => $Qmessages->valueInt('new'), 'subject' => $Qmessages->value('subject'), 'from_address' => htmlentities($Qmessages->value('from_address'), ENT_QUOTES, 'UTF-8'), 'size' => $Qmessages->valueInt('size'), 'sender' => $Qmessages->value('reply_to'), 'date' => $date, 'priority' => $Qmessages->valueInt('priority'), 'messages_flag' => $Qmessages->valueInt('messages_flag'));
}
$response = array(EXT_JSON_READER_TOTAL => $Qmessages->getBatchSize(), EXT_JSON_READER_ROOT => $records, 'unseen' => toC_Email_Accounts_Admin::getNewMessagesAmount($_REQUEST['accounts_id'], $_REQUEST['folders_id']));
ini_set('max_execution_time', $max_execution_time);
echo $toC_Json->encode($response);
}
示例6: getDateOrTime
function getDateOrTime($date)
{
$day_start = mktime(0, 0, 0);
$day_end = mktime(0, 0, 0, date('m'), date('d') + 1);
if ($date > $day_start && $date < $day_end) {
$date = date('H:i', $date);
} else {
$date = osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($date));
}
return $date;
}
示例7:
<td onclick="document.getElementById('batch<?php
echo $cache;
?>
').checked = !document.getElementById('batch<?php
echo $cache;
?>
').checked;"><?php
echo $cache;
?>
</td>
<td align="center"><?php
echo $stats['total'];
?>
</td>
<td align="right"><?php
echo osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($stats['last_modified']), true);
?>
</td>
<td align="right"><?php
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&block=' . $cache . '&action=delete'), osc_icon('trash.png'));
?>
</td>
<td align="center"><?php
echo osc_draw_checkbox_field('batch[]', $cache, null, 'id="batch' . $cache . '"');
?>
</td>
</tr>
<?php
}
?>
示例8: cacheMessage
function cacheMessage($id, $data)
{
$data['subject'] = htmlspecialchars($data['subject'], ENT_QUOTES, 'UTF-8');
$data['account_id'] = $this->_data['account_id'];
$data['full_from'] = htmlspecialchars($data['from'], ENT_QUOTES, 'UTF-8');
$RFC822 = new RFC822();
$address = $RFC822->parse_address_list($data['from']);
$data['sender'] = isset($address[0]['email']) ? htmlspecialchars($address[0]['email'], ENT_QUOTES, 'UTF-8') : '';
$data['from'] = isset($address[0]['personal']) ? htmlspecialchars($address[0]['personal'], ENT_QUOTES, 'UTF-8') : '';
//to
if (!empty($data['to'])) {
$to = array();
foreach ($data['to'] as $address) {
$address = $RFC822->parse_address_list($address);
$to[] = array('email' => htmlspecialchars($address[0]['email'], ENT_QUOTES, 'UTF-8'), 'name' => htmlspecialchars($address[0]['personal'], ENT_QUOTES, 'UTF-8'));
}
$data['to'] = $to;
}
//cc
if (!empty($data['cc'])) {
$cc = array();
foreach ($data['cc'] as $address) {
$address = $RFC822->parse_address_list($address);
$cc[] = array('email' => htmlspecialchars($address[0]['email'], ENT_QUOTES, 'UTF-8'), 'name' => htmlspecialchars($address[0]['personal'], ENT_QUOTES, 'UTF-8'));
}
$data['cc'] = $cc;
}
//bcc
if (!empty($data['bcc'])) {
$bcc = array();
foreach ($data['bcc'] as $address) {
$address = $RFC822->parse_address_list($address);
$bcc[] = array('email' => htmlspecialchars($address[0]['email'], ENT_QUOTES, 'UTF-8'), 'name' => htmlspecialchars($address[0]['personal'], ENT_QUOTES, 'UTF-8'));
}
$data['bcc'] = $bcc;
}
$data['date'] = osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($data['udate']), true);
$parts = array_reverse($this->_inbox->f("parts"));
$html_alternative = false;
for ($i = 0; $i < count($parts); $i++) {
if (eregi('html', $parts[$i]['mime']) && (strtolower($parts[$i]['type']) == 'alternative' || strtolower($parts[$i]['type']) == 'related')) {
$html_alternative = true;
}
}
$data['body'] = '';
//attachments
$attachments = array();
if (eregi('html', $data['content_type'])) {
$default_mime = 'text/html';
} else {
$default_mime = 'text/plain';
}
$part_count = count($parts);
if ($part_count == 1) {
//if there's only one part use the message parameters.
if (eregi('plain', $parts[0]['mime'])) {
$parts[0]['mime'] = $default_mime;
}
if (!empty($data['content_transfer_encoding'])) {
$parts[0]['transfer'] = $data['content_transfer_encoding'];
}
}
while ($part = array_shift($parts)) {
$mime = isset($part["mime"]) ? strtolower($part["mime"]) : $default_mime;
//some clients just send html
if ($mime == 'html') {
$mime = 'text/html';
}
if (empty($data['body']) && !eregi('attachment', $part["disposition"]) && (eregi('html', $mime) || eregi('plain', $mime) && (!$html_alternative || strtolower($part['type']) != 'alternative') || $mime == "text/enriched" || $mime == "unknown/unknown")) {
$part_body = $this->_inbox->view_part($data['uid'], $part["number"], $part["transfer"], $part["charset"]);
switch ($mime) {
case 'unknown/unknown':
case 'text/plain':
$uuencoded_attachments = $this->_inbox->extract_uuencoded_attachments($part_body);
$part_body = Imap::text_to_html($part_body);
for ($i = 0; $i < count($uuencoded_attachments); $i++) {
$attachment = $uuencoded_attachments[$i];
$attachment['number'] = $part['number'];
unset($attachment['data']);
$attachment['uuencoded_partnumber'] = $i + 1;
$attachments[] = $attachment;
}
break;
case 'text/html':
$part_body = Imap::convert_html($part_body);
break;
case 'text/enriched':
$part_body = Imap::enriched_to_html($part_body);
break;
}
$data['body'] .= $part_body;
} else {
$attachments[] = $part;
}
}
//$data['event']=false;
$data['attachments'] = array();
$index = 0;
for ($i = 0; $i < count($attachments); $i++) {
if ($this->_inbox->part_is_attachment($attachments[$i])) {
//.........这里部分代码省略.........
示例9: foreach
</th>
</tr>
</tfoot>
<tbody>
<?php
foreach ($osC_DirectoryListing->getFiles() as $file) {
?>
<tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">
<td><?php
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&file=' . $file['name'] . '&action=download'), osc_icon('download.png') . ' ' . $file['name']);
?>
</td>
<td><?php
echo osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $file['name'])), true);
?>
</td>
<td><?php
echo number_format(filesize(DIR_FS_BACKUP . $file['name']));
?>
bytes</td>
<td align="right">
<?php
echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&file=' . $file['name'] . '&action=restore'), osc_icon('restore.png')) . ' ' . osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&file=' . $file['name'] . '&action=delete'), osc_icon('trash.png'));
?>
</td>
<td align="center"><?php
echo osc_draw_checkbox_field('batch[]', $file['name'], null, 'id="batch' . addslashes($file['name']) . '"');