本文整理汇总了PHP中FSS_Helper::CurDate方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::CurDate方法的具体用法?PHP FSS_Helper::CurDate怎么用?PHP FSS_Helper::CurDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSS_Helper
的用法示例。
在下文中一共展示了FSS_Helper::CurDate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveLog
function SaveLog()
{
$db = JFactory::getDBO();
$class = get_class($this);
$class = str_ireplace("FSSCron", "", $class);
$now = FSS_Helper::CurDate();
$qry = "INSERT INTO #__fss_cron_log (cron, `when`, log) VALUES ('" . FSSJ3Helper::getEscaped($db, $class) . "', '{$now}', '" . FSSJ3Helper::getEscaped($db, $this->_log) . "')";
$db->SetQuery($qry);
$db->Query();
//echo $qry."<br>";
$qry = "DELETE FROM #__fss_cron_log WHERE `when` < DATE_SUB('{$now}', INTERVAL " . (int) FSS_Settings::get('support_cronlog_keep') . " DAY)";
$db->SetQuery($qry);
$db->Query();
}
示例2: Save
function Save()
{
$db = JFactory::getDBO();
$this->item = array();
$this->item['id'] = FSS_Input::getInt('id', 0);
$user = JFactory::getUser();
$userid = $user->get('id');
$this->errors = array();
$ok = true;
foreach ($this->edit as $edit) {
$field = $this->GetField($edit);
$this->item[$field->field] = FSS_Input::getString($field->input_name, '');
if ($field->type == "text") {
$this->item[$field->field] = FSS_Input::getHTML($field->input_name, '');
}
if ($field->more) {
if (strpos($this->item[$field->field], "system-readmore") > 0) {
$pos = strpos($this->item[$field->field], "system-readmore");
$top = substr($this->item[$field->field], 0, $pos);
$top = substr($top, 0, strrpos($top, "<"));
$bottom = substr($this->item[$field->field], $pos);
$bottom = substr($bottom, strpos($bottom, ">") + 1);
$this->item[$field->field] = $top;
$this->item[$field->more] = $bottom;
} else {
$this->item[$field->more] = '';
}
}
if ($field->required) {
if ($this->item[$field->field] == "") {
$ok = false;
$this->errors[$field->field] = $field->required;
}
}
}
$now = FSS_Helper::CurDate();
// if errors
if ($ok) {
if ($this->item['id']) {
$qry = "UPDATE " . $this->table . " SET ";
$sets = array();
foreach ($this->edit as $edit) {
$field = $this->GetField($edit);
if ($field->type != "related" && $field->type != "tags") {
$sets[] = $field->field . " = '" . FSSJ3Helper::getEscaped($db, $this->item[$field->field]) . "'";
}
if ($field->more) {
$sets[] = "`" . $field->more . "` = '" . FSSJ3Helper::getEscaped($db, $this->item[$field->more]) . "'";
}
}
if (FSS_Permission::auth("core.edit.state", $this->getAsset())) {
$sets[] = "published = " . FSS_Input::getInt('published', 0);
if ($this->has_author) {
$sets[] = "author = " . FSS_Input::getInt('author', 0);
}
}
if ($this->has_modified) {
$sets[] = "modified = '{$now}'";
}
$qry .= implode(", ", $sets);
$qry .= " WHERE id = '" . FSSJ3Helper::getEscaped($db, $this->item['id']) . "'";
} else {
$fieldlist = array();
if ($this->has_author) {
$fieldlist[] = "author";
}
if ($this->has_added) {
$fieldlist[] = "added";
}
$setlist = array();
foreach ($this->edit as $edit) {
$field = $this->GetField($edit);
if ($field->type == "related" || $field->type == "tags") {
continue;
}
$fieldlist[] = $field->field;
$setlist[] = "'" . FSSJ3Helper::getEscaped($db, $this->item[$field->field]) . "'";
if ($field->more) {
$fieldlist[] = "`" . $field->more . "`";
$setlist[] = "'" . FSSJ3Helper::getEscaped($db, $this->item[$field->more]) . "'";
}
}
if ($this->has_modified) {
$fieldlist[] = "modified";
$setlist[] = "'{$now}'";
$fieldlist[] = "created";
$setlist[] = "'{$now}'";
}
$fieldlist[] = "published";
if (FSS_Permission::auth("core.edit.state", $this->getAsset())) {
$setlist[] = FSS_Input::getInt('published', 0);
} else {
$setlist[] = "0";
}
if ($this->has_ordering) {
// need to get ordering value
$order = $this->GetOrderValue();
if ($order < 1) {
$order = 1;
}
//.........这里部分代码省略.........
示例3: doLog
function doLog()
{
$output = "";
if (array_key_exists("Ticket", $this->debug_data)) {
$ticket = $this->debug_data['Ticket'];
$output .= "Ticket: ";
$output .= "<a href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $ticket['id']) . "'>";
$output .= "{$ticket['id']} / {$ticket['reference']} / {$ticket['title']}</a><br>";
}
$output .= "Subject: " . $this->subject . "<br />";
if (count($this->getAllTo()) > 1) {
$output .= "Send config: " . FSS_Settings::Get('email_send_multiple') . "<br />";
}
foreach ($this->getAllTo() as $email => $name) {
$output .= "To: {$name} ({$email})<br />";
}
$output .= "<hr />";
$output .= str_replace("\n", "<br />", $this->body);
if (count($this->files) || count($this->skipped_files)) {
$output .= "<hr />";
if (count($this->files)) {
$output .= "Files: <br />";
foreach ($this->files as $file => $display) {
$output .= "{$display}<br />";
}
}
if (count($this->skipped_files)) {
$output .= "Skipped Files (due to size restrictions): <br />";
foreach ($this->skipped_files as $file => $display) {
$output .= "{$display}<br />";
}
}
}
$output .= "<hr />";
$output .= "To address reasons: <br />";
foreach ($this->source as $address => $source) {
$output .= "{$address} => " . implode(", ", $source) . "<br />";
}
$now = FSS_Helper::CurDate();
$db = JFactory::getDBO();
$qry = "INSERT INTO #__fss_cron_log (cron, log, `when`) VALUES ('" . $db->escape("EMail Sent") . "', '" . $db->escape($output) . "', '{$now}')";
$db->setQuery($qry);
$db->Query();
}
示例4: DoPost
function DoPost()
{
$this->post['name'] = FSS_Input::getString('name', '');
$this->post['email'] = FSS_Input::getEMail('email', '');
$this->post['website'] = FSS_Input::getURL('website', '');
$this->post['body'] = FSS_Input::getString('body', '');
$this->post['itemid'] = FSS_Input::getInt('itemid', 0);
$this->post['ident'] = FSS_Input::getInt('ident', 0);
$published = 1;
if ($this->moderate) {
$published = 0;
}
$captcha = new FSS_Captcha();
$this->valid = 1;
if ($this->post['name'] == "") {
$this->errors['name'] = JText::_("YOU_MUST_ENTER_A_NAME");
$this->valid = 0;
}
if ($this->use_email && $this->post['email'] != "" && !JMailHelper::isEmailAddress($this->post['email'])) {
$this->errors['email'] = JText::_("INVALID_EMAIL_ADDRESS_ENTERED");
$this->valid = 0;
}
if ($this->use_website && $this->post['website'] != "" && 0) {
$this->errors['website'] = JText::_("INVALID_WEBSITE_ADDRESS_ENTERED");
$this->valid = 0;
}
if ($this->post['body'] == "") {
$this->errors['body'] = JText::_("YOU_MUST_ENTER_A_COMMENT_TO_POST");
$this->valid = 0;
}
if ($this->handler->item_select_must_have) {
if ($this->post['itemid'] == 0) {
$this->errors['itemid'] = JText::_("YOU_MUST_SELECT_A") . $this->handler->email_article_type;
$this->valid = 0;
}
}
if (!$captcha->ValidateCaptcha()) {
$this->errors['captcha'] = JText::_("INVALID_SECURITY_CODE");
$this->valid = 0;
}
if (!FSSCF::ValidateFields($this->customfields, $this->errors)) {
$this->valid = 0;
}
$output['valid'] = $this->valid;
if ($this->valid == 1) {
$db = JFactory::getDBO();
$user = JFactory::getUser();
$userid = $user->id;
$custom = FSSCF::Comm_StoreFields($this->customfields);
$custom = serialize($custom);
$now = FSS_Helper::CurDate();
$qry = "INSERT INTO " . $this->table . " (ident, itemid, name, email, website, body, published, created, userid, custom) VALUES (";
$qry .= $this->post['ident'];
$qry .= " , " . $this->post['itemid'];
$qry .= " , '" . FSSJ3Helper::getEscaped($db, $this->post['name']);
$qry .= "' , '" . FSSJ3Helper::getEscaped($db, $this->post['email']);
$qry .= "' , '" . FSSJ3Helper::getEscaped($db, $this->post['website']);
$qry .= "' , '" . FSSJ3Helper::getEscaped($db, $this->post['body']);
$qry .= "' , {$published}, '{$now}', '" . FSSJ3Helper::getEscaped($db, $userid) . "', '" . FSSJ3Helper::getEscaped($db, $custom) . "' )";
$db->SetQuery($qry);
$db->Query();
$this->comment = $this->post;
$this->comment['id'] = $db->insertid();
$this->comment['ident'] = $this->post['ident'];
foreach ($this->customfields as $id => $field) {
$this->comment["custom_{$id}"] = FSS_Input::getString("custom_{$id}", "");
JRequest::setVar("custom_{$id}", '');
}
FSS_EMail::Send_Comment($this);
//print_r($output);
//exit();
//ob_clean();
//print_p($this);
if ($this->moderate) {
$this->comment['published'] = 0;
include $this->tmplpath . DS . 'moderate.php';
} else {
if ($this->opt_show_posted_message_only) {
$this->comment['published'] = 0;
include $this->tmplpath . DS . 'thanks.php';
} else {
$this->comment['published'] = 1;
include $this->tmplpath . DS . 'thanks.php';
include $this->tmplpath . DS . 'comment.php';
}
}
$output['comment'] = ob_get_contents();
if ($this->opt_display) {
if ($this->opt_order == 0) {
$output['display'] = 'before';
} else {
$output['display'] = 'after';
}
} else {
$output['display'] = 'none';
}
if ($this->opt_show_posted_message_only) {
$output['display'] = "replace";
}
$this->post['name'] = $this->GetName();
//.........这里部分代码省略.........
示例5: getDBTime
function getDBTime()
{
$this->db_time = strtotime(FSS_Helper::CurDate());
}
示例6: addAuditNote
/**
* Adds an audit note to this ticket
**/
function addAuditNote($note)
{
if (!$this->audit_changes) {
return;
}
$db = JFactory::getDBO();
$now = FSS_Helper::CurDate();
if ($this->is_batch) {
$note = "Batch: " . $note;
}
$qry = "INSERT INTO #__fss_ticket_messages (ticket_ticket_id, subject, body, user_id, admin, posted) VALUES ('";
$qry .= FSSJ3Helper::getEscaped($db, $this->id) . "','Audit Message','" . FSSJ3Helper::getEscaped($db, $note) . "','" . FSSJ3Helper::getEscaped($db, $this->current_user) . "',3, '{$now}')";
$db->SetQuery($qry);
$db->Query();
}
示例7: Execute
function Execute($aparams)
{
$debug = 0;
$this->Log("Auto closing tickets");
$db = JFactory::getDBO();
$can_close = FSS_Ticket_Helper::GetStatusIDs('can_autoclose');
$def_close = FSS_Ticket_Helper::GetStatusID('def_closed');
if ($debug) {
$this->Log("Can Close : " . implode(", ", $can_close));
}
if ($debug) {
$this->Log("Close To : " . $def_close);
}
$now = FSS_Helper::CurDate();
// if no audit log to be created, then can just close all tickets in a single query, this is quicker!
if (!$aparams['addaudit'] && !$aparams['emailuser']) {
if ($debug) {
echo "No audit required, just closing<br>";
}
$qry = "UPDATE #__fss_ticket_ticket SET closed = '{$now}', ticket_status_id = {$def_close} WHERE DATE_ADD(`lastupdate` ,INTERVAL " . FSSJ3Helper::getEscaped($db, $aparams['closeinterval']) . " DAY) < '{$now}' AND ticket_status_id IN (" . implode(", ", $can_close) . ")";
$db->setQuery($qry);
$db->Query();
// UNCOMMENT
$rows = $db->getAffectedRows();
if ($debug) {
$this->Log($qry);
}
// COMMENT
$this->Log("Auto closed {$rows} tickets");
return;
}
$qry = "SELECT * FROM #__fss_ticket_ticket WHERE DATE_ADD(`lastupdate` ,INTERVAL " . FSSJ3Helper::getEscaped($db, $aparams['closeinterval']) . " DAY) < '{$now}' AND ticket_status_id IN (" . implode(", ", $can_close) . ")";
$db->setQuery($qry);
if ($debug) {
$this->Log($qry);
}
$rows = $db->loadAssocList();
$this->Log("Found " . count($rows) . " tickets to close");
if (count($rows) == 0) {
return;
}
$ids = array();
$auditrows = array();
foreach ($rows as $row) {
$ids[] = FSSJ3Helper::getEscaped($db, $row['id']);
if ($aparams['addaudit']) {
// add audit log to the ticket
$auditqry[] = "(" . FSSJ3Helper::getEscaped($db, $row['id']) . ", 'Audit Message', 'Ticket auto-closed after " . FSSJ3Helper::getEscaped($db, $aparams['closeinterval']) . " days of inactivity', 0, 3, '{$now}')";
}
if ($aparams['emailuser']) {
FSS_EMail::Admin_AutoClose($row);
}
}
if ($aparams['addaudit']) {
$qry = "INSERT INTO #__fss_ticket_messages (ticket_ticket_id, subject, body, user_id, admin, posted) VALUES \n";
$qry .= implode(",\n ", $auditqry);
if ($debug) {
$this->Log("Saving Audit Messages");
}
if ($debug) {
$this->Log($qry);
}
$db->setQuery($qry);
$db->Query();
}
$qry = "UPDATE #__fss_ticket_ticket SET closed = '{$now}', ticket_status_id = {$def_close} WHERE id IN (" . implode(", ", $ids) . ")";
if ($debug) {
$this->Log("Closing Tickets");
}
if ($debug) {
$this->Log($qry);
}
$db->setQuery($qry);
$db->Query();
$this->Log("Closed " . count($rows) . " tickets");
/*echo "<pre style='background-color:white;'>";
echo $qry;
echo "</pre>";*/
}
示例8: merge
function merge()
{
$source_id = FSS_Input::getInt('source_id');
$dest_id = FSS_Input::getInt('dest_id');
if ($source_id < 1) {
return $this->cancel();
}
if ($dest_id < 1) {
return $this->cancel();
}
$source = new SupportTicket();
if (!$source->load($source_id)) {
return $this->cancel();
}
$dest = new SupportTicket();
if (!$dest->load($dest_id)) {
return $this->cancel();
}
//print_p($source);
// need to copy messages
$db = JFactory::getDBO();
$sql = "SELECT * FROM #__fss_ticket_messages WHERE ticket_ticket_id = " . $db->escape($source_id);
$db->setQuery($sql);
$messages = $db->loadObjectList();
$msg_map = array();
foreach ($messages as $message) {
$old_id = $message->id;
unset($message->id);
$message->ticket_ticket_id = $dest_id;
$new_id = $this->Insert("#__fss_ticket_messages", $message);
$msg_map[$old_id] = $new_id;
}
// add time
$qry = "UPDATE #__fss_ticket_ticket SET timetaken = timetaken + " . (int) $source->timetaken . " WHERE id = " . $dest_id;
$db->setQuery($qry);
$db->Query();
if ($source->timetaken > 0) {
$qry = "UPDATE #__fss_ticket_ticket SET timetaken = 0 WHERE id = " . $source_id;
$db->setQuery($qry);
$db->Query();
$source->addAuditNote("Time taken cleared as merged with another ticket");
}
// copy files
$sql = "SELECT * FROM #__fss_ticket_attach WHERE ticket_ticket_id = " . $db->escape($source_id);
$db->setQuery($sql);
$attachments = $db->loadObjectList();
foreach ($attachments as $attachment) {
unset($attachment->id);
$attachment->ticket_ticket_id = $dest_id;
// change id to that of new message
if (array_key_exists($attachment->message_id, $msg_map)) {
$attachment->message_id = $msg_map[$attachment->message_id];
}
$new_id = $this->Insert("#__fss_ticket_attach", $attachment);
}
// add audit messages to both
$source->addAuditNote("Ticket merged into another ticket then closed. Dest Ticket: " . $dest->reference . " - " . $dest->title);
$dest->addAuditNote("Ticket merged into this one. Merged Ticket: " . $source->reference . " - " . $source->title);
// close source ticket
$closed = FSS_Ticket_Helper::GetStatusID('def_closed');
// add merge tag to source ticket
$now = FSS_Helper::CurDate();
$qry = "UPDATE #__fss_ticket_ticket SET merged = " . (int) $dest_id . ", ticket_status_id = " . (int) $closed . ", lastupdate = '{$now}', closed = '{$now}' WHERE id = " . (int) $source_id;
$db->setQuery($qry);
$db->Query();
// redirect to new ticket
// TODO:
/*
Need to copy cc information on the ticket
*/
$session = JFactory::getSession();
$session->clear('merge');
$session->clear('merge_ticket_id');
?>
<script>
window.location = '<?php
echo FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $dest_id, false);
?>
';
</script>
<?php
exit;
}
示例9: AddTicketAuditNote
function AddTicketAuditNote($ticketid, $note, $userid)
{
if ($ticketid < 1) {
echo "ERROR: AddTicketAuditNote called with no ticket id ({$note})<br>";
exit;
}
$db = JFactory::getDBO();
$now = FSS_Helper::CurDate();
$qry = "INSERT INTO #__fss_ticket_messages (ticket_ticket_id, subject, body, user_id, admin, posted) VALUES ('";
$qry .= FSSJ3Helper::getEscaped($db, $ticketid) . "','Audit Message','" . FSSJ3Helper::getEscaped($db, $note) . "','" . FSSJ3Helper::getEscaped($db, $userid) . "',3, '{$now}')";
$db->SetQuery($qry);
//echo $qry. "<br>";
$db->Query();
//echo "Audit: $ticketid - $note<br>";
}
示例10: saveTicket
function saveTicket()
{
$name = "";
$db = JFactory::getDBO();
$ok = true;
$this->errors['subject'] = '';
$this->errors['body'] = '';
$this->errors['cat'] = '';
if (FSS_Settings::get('support_subject_message_hide') == "subject") {
$ticket->subject = substr(strip_tags($ticket->body), 0, 40);
} else {
if ($ticket->subject == "") {
$this->errors['subject'] = JText::_("YOU_MUST_ENTER_A_SUBJECT_FOR_YOUR_SUPPORT_TICKET");
$ok = false;
}
}
if (FSS_Settings::get('support_altcat')) {
$cats = $this->get('Cats');
if (count($cats) > 0 && $catid == 0) {
$this->errors['cat'] = JText::_("YOU_MUST_SELECT_A_CATEGORY");
$ok = false;
}
}
if ($body == "" && FSS_Settings::get('support_subject_message_hide') != "message") {
$this->errors['body'] = JText::_("YOU_MUST_ENTER_A_MESSAGE_FOR_YOUR_SUPPORT_TICKET");
$ok = false;
}
$fields = FSSCF::GetCustomFields(0, $prodid, $deptid);
if (!FSSCF::ValidateFields($fields, $this->errors)) {
$ok = false;
}
$email = "";
$password = "";
$now = FSS_Helper::CurDate();
if ($ok) {
/*$admin_id = FSS_Ticket_Helper::AssignHandler($prodid, $deptid, $catid);
$now = FSS_Helper::CurDate();
$def_open = FSS_Ticket_Helper::GetStatusID('def_open');
$qry = "INSERT INTO #__fss_ticket_ticket (reference, ticket_status_id, ticket_pri_id, ticket_cat_id, ticket_dept_id, prod_id, title, opened, lastupdate, user_id, admin_id, email, password, unregname, lang) VALUES ";
$qry .= "('', $def_open, '".FSSJ3Helper::getEscaped($db, $priid)."', '".FSSJ3Helper::getEscaped($db, $catid)."', '".FSSJ3Helper::getEscaped($db, $deptid)."', '".FSSJ3Helper::getEscaped($db, $prodid)."', '".FSSJ3Helper::getEscaped($db, $subject)."', '{$now}', '{$now}', '".FSSJ3Helper::getEscaped($db, $userid)."', '".FSSJ3Helper::getEscaped($db, $admin_id)."', '{$email}', '".FSSJ3Helper::getEscaped($db, $password)."', '{$name}', '".JFactory::getLanguage()->getTag()."')";
$db->setQuery($qry);$db->Query();
$this->ticketid = $db->insertid();
$ref = FSS_Ticket_Helper::createRef($this->ticketid);
$qry = "UPDATE #__fss_ticket_ticket SET reference = '".FSSJ3Helper::getEscaped($db, $ref)."' WHERE id = '" . FSSJ3Helper::getEscaped($db, $this->ticketid) . "'";
$db->setQuery($qry);$db->Query();
$qry = "INSERT INTO #__fss_ticket_messages (ticket_ticket_id, subject, body, user_id, posted) VALUES ('";
$qry .= FSSJ3Helper::getEscaped($db, $this->ticketid) . "','".FSSJ3Helper::getEscaped($db, $subject)."','".FSSJ3Helper::getEscaped($db, $body)."','".FSSJ3Helper::getEscaped($db, $userid)."','{$now}')";
$db->setQuery($qry);$db->Query();
$messageid = $db->insertid();
FSSCF::StoreFields($fields,$this->ticketid);
$files = array();
// save any uploaded file
for ($i = 1; $i < 10; $i++)
{
$file = JRequest::getVar('filedata_' . $i, '', 'FILES', 'array');
if (array_key_exists('error',$file) && $file['error'] == 0 && $file['name'] != '')
{
$destpath = JPATH_COMPONENT_SITE.DS.'files'.DS.'support'.DS;
$destname = md5(mt_rand(0,999999).'-'.$file['name']);
while (JFile::exists($destpath . $destname))
{
$destname = md5(mt_rand(0,999999).'-'.$file['name']);
}
if (JFile::upload($file['tmp_name'], $destpath . $destname))
{
$qry = "INSERT INTO #__fss_ticket_attach (ticket_ticket_id, filename, diskfile, size, user_id, added, message_id) VALUES ('";
$qry .= FSSJ3Helper::getEscaped($db, $this->ticketid) . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $file['name']) . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $destname) . "',";
$qry .= "'" . $file['size'] . "',";
$qry .= "'" . FSSJ3Helper::getEscaped($db, $userid) . "',";
$qry .= "'{$now}', $messageid )";
$file_obj = new stdClass();
$file_obj->filename = $file['name'];
$file_obj->diskfile = $destname;
$file_obj->size = $file['size'];
$files[] = $file_obj;
$db->setQuery($qry);$db->Query();
} else {
// ERROR : File cannot be uploaded! try permissions
//.........这里部分代码省略.........