本文整理汇总了PHP中Misc::db2gmtime方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::db2gmtime方法的具体用法?PHP Misc::db2gmtime怎么用?PHP Misc::db2gmtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::db2gmtime方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
function parse($value)
{
if (!$value) {
return null;
}
$config = $this->getConfiguration();
return $config['gmt'] ? Misc::db2gmtime($value) : $value;
}
示例2: cacheable
function cacheable($etag, $modified, $ttl = 3600)
{
// Thanks, http://stackoverflow.com/a/1583753/1025836
$last_modified = Misc::db2gmtime($modified);
header("Last-Modified: " . date('D, d M y H:i:s', $last_modified) . " GMT", false);
header('ETag: "' . $etag . '"');
header("Cache-Control: private, max-age={$ttl}");
header('Expires: ' . gmdate(DATE_RFC822, time() + $ttl) . " GMT");
header('Pragma: private');
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified || @trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
header("HTTP/1.1 304 Not Modified");
exit;
}
}
示例3: die
<?php
if (!defined('KTKADMININC') || !is_object($ticket) || !is_object($thisuser) || !$thisuser->isStaff()) {
die(_('Access Denied'));
}
if (!($thisuser->canEditTickets() || $thisuser->isManager() && $ticket->getDeptId() == $thisuser->getDeptId())) {
die(_('Access Denied. Perm error.'));
}
if ($_POST && $errors) {
$info = Format::input($_POST);
} else {
$info = array('email' => $ticket->getEmail(), 'name' => $ticket->getName(), 'phone' => $ticket->getPhone(), 'pri' => $ticket->getPriorityId(), 'topicId' => $ticket->getTopicId(), 'topic' => $ticket->getTopic(), 'subject' => $ticket->getSubject(), 'duedate' => $ticket->getDueDate() ? Format::userdate('m/d/Y', Misc::db2gmtime($ticket->getDueDate())) : '', 'time' => $ticket->getDueDate() ? Format::userdate('G:i', Misc::db2gmtime($ticket->getDueDate())) : '');
}
?>
<div width="100%">
<?php
if ($errors['err']) {
?>
<p align="center" id="errormessage"><?php
echo $errors['err'];
?>
</p>
<?php
} elseif ($msg) {
?>
<p align="center" class="infomessage"><?php
echo $msg;
?>
</p>
<?php
} elseif ($warn) {
示例4: sprintf
if ($entry->flags & ThreadEntry::FLAG_EDITED) {
?>
<span class="label label-bare" title="<?php
echo sprintf(__('Edited on %s by %s'), Format::datetime($entry->updated), 'You');
?>
"><?php
echo __('Edited');
?>
</span>
<?php
}
?>
</span>
</div>
<?php
echo sprintf(__('<b>%s</b> posted %s'), $name, sprintf('<time class="relative" datetime="%s" title="%s">%s</time>', date(DateTime::W3C, Misc::db2gmtime($entry->created)), Format::daydatetime($entry->created), Format::relativeTime(Misc::db2gmtime($entry->created))));
?>
<span style="max-width:500px" class="faded title truncate"><?php
echo $entry->title;
?>
</span>
</span>
</div>
<div class="thread-body" id="thread-id-<?php
echo $entry->getId();
?>
">
<div><?php
echo $entry->getBody()->toHtml();
?>
</div>
示例5: db_daydatetime
function db_daydatetime($time)
{
global $cfg;
return Format::userdate($cfg->getDayDateTimeFormat(), Misc::db2gmtime($time));
}
示例6:
if(!($thisuser->canEditTickets() || ($thisuser->isManager() && $ticket->getDeptId()==$thisuser->getDeptId()))) die('Access Denied. Perm error.');
if($_POST && $errors){
$info=Format::input($_POST);
}else{
$info=array('email'=>$ticket->getEmail(),
'name' =>$ticket->getName(),
'phone'=>$ticket->getPhone(),
'phone_ext'=>$ticket->getPhoneExt(),
'pri'=>$ticket->getPriorityId(),
'topicId'=>$ticket->getTopicId(),
'topic'=>$ticket->getHelpTopic(),
'subject' =>$ticket->getSubject(),
'duedate' =>$ticket->getDueDate()?(Format::userdate('m/d/Y',Misc::db2gmtime($ticket->getDueDate()))):'',
'time'=>$ticket->getDueDate()?(Format::userdate('G:i',Misc::db2gmtime($ticket->getDueDate()))):'',
);
/*Note: Please don't make me explain how dates work - it is torture. Trust me! */
}
?>
<div width="100%">
<?if($errors['err']) {?>
<p align="center" id="errormessage"><?=$errors['err']?></p>
<?}elseif($msg) {?>
<p align="center" class="infomessage"><?=$msg?></p>
<?}elseif($warn) {?>
<p class="warnmessage"><?=$warn?></p>
<?}?>
</div>
<table width="100%" border="0" cellspacing=1 cellpadding=2>
示例7: update
function update($vars, &$errors)
{
global $cfg, $thisstaff;
if (!$cfg || !$thisstaff || !$thisstaff->canEditTickets()) {
return false;
}
$fields = array();
$fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => __('Help topic selection is required'));
$fields['slaId'] = array('type' => 'int', 'required' => 0, 'error' => __('Select a valid SLA'));
$fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => __('Invalid date format - must be MM/DD/YY'));
$fields['note'] = array('type' => 'text', 'required' => 1, 'error' => __('A reason for the update is required'));
$fields['user_id'] = array('type' => 'int', 'required' => 0, 'error' => __('Invalid user-id'));
if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
$errors['err'] = __('Missing or invalid data - check the errors and try again');
}
if ($vars['duedate']) {
if ($this->isClosed()) {
$errors['duedate'] = __('Due date can NOT be set on a closed ticket');
} elseif (!$vars['time'] || strpos($vars['time'], ':') === false) {
$errors['time'] = __('Select a time from the list');
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
$errors['duedate'] = __('Invalid due date');
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
$errors['duedate'] = __('Due date must be in the future');
}
}
// Validate dynamic meta-data
$forms = DynamicFormEntry::forTicket($this->getId());
foreach ($forms as $form) {
// Don't validate deleted forms
if (!in_array($form->getId(), $vars['forms'])) {
continue;
}
$form->setSource($_POST);
if (!$form->isValid()) {
$errors = array_merge($errors, $form->errors());
}
}
if ($errors) {
return false;
}
$sql = 'UPDATE ' . TICKET_TABLE . ' SET updated=NOW() ' . ' ,topic_id=' . db_input($vars['topicId']) . ' ,sla_id=' . db_input($vars['slaId']) . ' ,source=' . db_input($vars['source']) . ' ,duedate=' . ($vars['duedate'] ? db_input(date('Y-m-d G:i', Misc::dbtime($vars['duedate'] . ' ' . $vars['time']))) : 'NULL');
if ($vars['user_id']) {
$sql .= ', user_id=' . db_input($vars['user_id']);
}
if ($vars['duedate']) {
//We are setting new duedate...
$sql .= ' ,isoverdue=0';
}
$sql .= ' WHERE ticket_id=' . db_input($this->getId());
if (!db_query($sql) || !db_affected_rows()) {
return false;
}
if (!$vars['note']) {
$vars['note'] = sprintf(_S('Ticket details updated by %s'), $thisstaff->getName());
}
$this->logNote(_S('Ticket Updated'), $vars['note'], $thisstaff);
// Decide if we need to keep the just selected SLA
$keepSLA = $this->getSLAId() != $vars['slaId'];
// Update dynamic meta-data
foreach ($forms as $f) {
// Drop deleted forms
$idx = array_search($f->getId(), $vars['forms']);
if ($idx === false) {
$f->delete();
} else {
$f->set('sort', $idx);
$f->save();
}
}
// Reload the ticket so we can do further checking
$this->reload();
// Reselect SLA if transient
if (!$keepSLA && (!$this->getSLA() || $this->getSLA()->isTransient())) {
$this->selectSLAId();
}
// Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
if ($this->isOverdue() && (!$this->getEstDueDate() || Misc::db2gmtime($this->getEstDueDate()) > Misc::gmtime())) {
$this->clearOverdue();
}
Signal::send('model.updated', $this);
return true;
}
示例8: getUpdateInfo
function getUpdateInfo()
{
$info = array('name' => $this->getName(), 'email' => $this->getEmail(), 'phone' => $this->getPhone(), 'phone_ext' => $this->getPhoneExt(), 'subject' => $this->getSubject(), 'source' => $this->getSource(), 'topicId' => $this->getTopicId(), 'priorityId' => $this->getPriorityId(), 'slaId' => $this->getSLAId(), 'duedate' => $this->getDueDate() ? Format::userdate('m/d/Y', Misc::db2gmtime($this->getDueDate())) : '', 'time' => $this->getDueDate() ? Format::userdate('G:i', Misc::db2gmtime($this->getDueDate())) : '');
return $info;
}
示例9: update
function update($vars, &$errors)
{
global $cfg, $thisstaff;
if (!$cfg || !$thisstaff || !$thisstaff->canEditTickets()) {
return false;
}
$fields = array();
$fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Help topic required');
$fields['slaId'] = array('type' => 'int', 'required' => 0, 'error' => 'Select SLA');
$fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => 'Invalid date - must be MM/DD/YY');
$fields['note'] = array('type' => 'text', 'required' => 1, 'error' => 'Reason for the update required');
$fields['user_id'] = array('type' => 'int', 'required' => 0, 'error' => 'Invalid user-id');
if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
$errors['err'] = 'Missing or invalid data - check the errors and try again';
}
if ($vars['duedate']) {
if ($this->isClosed()) {
$errors['duedate'] = 'Due date can NOT be set on a closed ticket';
} elseif (!$vars['time'] || strpos($vars['time'], ':') === false) {
$errors['time'] = 'Select time';
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
$errors['duedate'] = 'Invalid due date';
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
$errors['duedate'] = 'Due date must be in the future';
}
}
if ($errors) {
return false;
}
$sql = 'UPDATE ' . TICKET_TABLE . ' SET updated=NOW() ' . ' ,topic_id=' . db_input($vars['topicId']) . ' ,sla_id=' . db_input($vars['slaId']) . ' ,source=' . db_input($vars['source']) . ' ,duedate=' . ($vars['duedate'] ? db_input(date('Y-m-d G:i', Misc::dbtime($vars['duedate'] . ' ' . $vars['time']))) : 'NULL');
if ($vars['user_id']) {
$sql .= ', user_id=' . db_input($vars['user_id']);
}
if ($vars['duedate']) {
//We are setting new duedate...
$sql .= ' ,isoverdue=0';
}
$sql .= ' WHERE ticket_id=' . db_input($this->getId());
if (!db_query($sql) || !db_affected_rows()) {
return false;
}
if (!$vars['note']) {
$vars['note'] = sprintf('Ticket Updated by %s', $thisstaff->getName());
}
$this->logNote('Ticket Updated', $vars['note'], $thisstaff);
// Decide if we need to keep the just selected SLA
$keepSLA = $this->getSLAId() != $vars['slaId'];
// Reload the ticket so we can do further checking
$this->reload();
// Reselect SLA if transient
if (!$keepSLA && (!$this->getSLA() || $this->getSLA()->isTransient())) {
$this->selectSLAId();
}
// Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
if ($this->isOverdue() && (!$this->getEstDueDate() || Misc::db2gmtime($this->getEstDueDate()) > Misc::gmtime())) {
$this->clearOverdue();
}
return true;
}
示例10: array
echo $htmlId;
?>
" data-thread-id="<?php
echo $this->getId();
?>
">-->
<?php
if (count($entries)) {
// Go through all the entries and bucket them by time frame
$buckets = array();
$rel = 0;
foreach ($entries as $i => $E) {
// First item _always_ shows up
if ($i != 0) {
// Set relative time resolution to 12 hours
$rel = Format::relativeTime(Misc::db2gmtime($E->created, false, 43200));
}
$buckets[$rel][] = $E;
}
// Go back through the entries and render them on the page
//echo "test: " . json_encode($buckets);
$i = 0;
foreach ($buckets as $rel => $entries) {
// TODO: Consider adding a date boundary to indicate significant
// changes in dates between thread items.
foreach ($entries as $entry) {
// Emit all events prior to this entry
while ($event && $event->timestamp < $entry->created) {
$event->render(ThreadEvent::MODE_CLIENT);
$events->next();
$event = $events->current();
示例11: die
<?php
if (!defined('OSTSCPINC') || !is_object($ticket) || !is_object($thisuser) || !$thisuser->isStaff()) {
die('Access Denied');
}
if (!($thisuser->canEditTickets() || $thisuser->isManager() && $ticket->getDeptId() == $thisuser->getDeptId())) {
die('Access Denied. Perm error.');
}
if ($_POST && $errors) {
$info = Format::input($_POST);
} else {
$info = array('email' => $ticket->getEmail(), 'name' => $ticket->getName(), 'phone' => $ticket->getPhone(), 'phone_ext' => $ticket->getPhoneExt(), 'pri' => $ticket->getPriorityId(), 'topicId' => $ticket->getTopicId(), 'topic' => $ticket->getHelpTopic(), 'subject' => Format::htmlchars($ticket->getSubject()), 'assetid' => $ticket->getAssetId(), 'tickettypeid' => $ticket->getTicketTypeId(), 'duedate' => $ticket->getDueDate() ? Format::userdate('m/d/Y', Misc::db2gmtime($ticket->getDueDate())) : '', 'time' => $ticket->getDueDate() ? Format::userdate('G:i', Misc::db2gmtime($ticket->getDueDate())) : '');
/*Note: Please don't make me explain how dates work - it is torture. Trust me! */
}
?>
<script type="text/javascript">
function change(){
var text=document.forms["form"]["subject"].value;
var len = text.length;
var s = text;
for(i=0; i<len; i++)
{
s = s.replace(/[\u2018|\u2019|\u201A]/g, "\'");
// smart double quotes
s = s.replace(/[\u201C|\u201D|\u201E]/g, "\"");
// ellipsis
s = s.replace(/\u2026/g, "...");
示例12: getVar
function getVar($tag)
{
global $cfg;
if ($tag && is_callable(array($this, 'get' . ucfirst($tag)))) {
return call_user_func(array($this, 'get' . ucfirst($tag)));
}
switch (strtolower($tag)) {
case 'create_date':
return Format::date($cfg->getDateTimeFormat(), Misc::db2gmtime($this->getCreateDate()), $cfg->getTZOffset(), $cfg->observeDaylightSaving());
break;
case 'update_date':
return Format::date($cfg->getDateTimeFormat(), Misc::db2gmtime($this->getUpdateDate()), $cfg->getTZOffset(), $cfg->observeDaylightSaving());
break;
}
return false;
}
示例13: update
function update($vars, &$errors)
{
global $cfg, $thisstaff;
if (!$cfg || !$thisstaff || !$thisstaff->canEditTickets()) {
return false;
}
$fields = array();
$fields['name'] = array('type' => 'string', 'required' => 1, 'error' => 'Name required');
$fields['email'] = array('type' => 'email', 'required' => 1, 'error' => 'Valid email required');
$fields['subject'] = array('type' => 'string', 'required' => 1, 'error' => 'Subject required');
$fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Help topic required');
$fields['priorityId'] = array('type' => 'int', 'required' => 1, 'error' => 'Priority required');
$fields['slaId'] = array('type' => 'int', 'required' => 0, 'error' => 'Select SLA');
$fields['phone'] = array('type' => 'phone', 'required' => 0, 'error' => 'Valid phone # required');
$fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => 'Invalid date - must be MM/DD/YY');
$fields['note'] = array('type' => 'text', 'required' => 1, 'error' => 'Reason for the update required');
if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
$errors['err'] = 'Missing or invalid data - check the errors and try again';
}
if ($vars['duedate']) {
if ($this->isClosed()) {
$errors['duedate'] = 'Due date can NOT be set on a closed ticket';
} elseif (!$vars['time'] || strpos($vars['time'], ':') === false) {
$errors['time'] = 'Select time';
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
$errors['duedate'] = 'Invalid due date';
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
$errors['duedate'] = 'Due date must be in the future';
}
}
//Make sure phone extension is valid
if ($vars['phone_ext']) {
if (!is_numeric($vars['phone_ext']) && !$errors['phone']) {
$errors['phone'] = 'Invalid phone ext.';
} elseif (!$vars['phone']) {
//make sure they just didn't enter ext without phone #
$errors['phone'] = 'Phone number required';
}
}
if ($errors) {
return false;
}
$sql = 'UPDATE ' . TICKET_TABLE . ' SET updated=NOW() ' . ' ,email=' . db_input($vars['email']) . ' ,name=' . db_input(Format::striptags($vars['name'])) . ' ,subject=' . db_input(Format::striptags($vars['subject'])) . ' ,phone="' . db_input($vars['phone'], false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext'] ? $vars['phone_ext'] : NULL) . ' ,priority_id=' . db_input($vars['priorityId']) . ' ,topic_id=' . db_input($vars['topicId']) . ' ,sla_id=' . db_input($vars['slaId']) . ' ,source=' . db_input($vars['source']) . ' ,duedate=' . ($vars['duedate'] ? db_input(date('Y-m-d G:i', Misc::dbtime($vars['duedate'] . ' ' . $vars['time']))) : 'NULL');
if ($vars['duedate']) {
//We are setting new duedate...
$sql .= ' ,isoverdue=0';
}
$sql .= ' WHERE ticket_id=' . db_input($this->getId());
if (!db_query($sql) || !db_affected_rows()) {
return false;
}
if (!$vars['note']) {
$vars['note'] = sprintf('Ticket Updated by %s', $thisstaff->getName());
}
$this->logNote('Ticket Updated', $vars['note'], $thisstaff);
$this->reload();
// Reselect SLA if transient
if (!$this->getSLAId() || $this->getSLA()->isTransient()) {
$this->selectSLAId();
}
//Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
if ($this->isOverdue() && (!$this->getEstDueDate() || Misc::db2gmtime($this->getEstDueDate()) > Misc::gmtime())) {
$this->clearOverdue();
}
return true;
}
示例14: __
echo $category->getId();
?>
"><?php
echo $category->getName();
?>
</a>
</div>
<div class="faq-content">
<div class="article-title flush-left">
<?php
echo $faq->getLocalQuestion();
?>
</div>
<div class="faded"><?php
echo __('Last updated') . ' ' . Format::relativeTime(Misc::db2gmtime($category->getUpdateDate()));
?>
</div>
<br/>
<div class="thread-body bleed">
<?php
echo $faq->getLocalAnswerWithImages();
?>
</div>
</div>
</div>
<div class="span4 pull-right">
<div class="sidebar">
<div class="searchbar">
<form method="get" action="faq.php">