本文整理汇总了PHP中getCurrentDate函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrentDate函数的具体用法?PHP getCurrentDate怎么用?PHP getCurrentDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCurrentDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertComment
function insertComment($username, $text) {
// if were not connected, connect.
global $isConnected;
if (isset($isConnected) == false)
connectDb ();
//Escape all strings and use the strip_tags() to be more safe
$safe_strings = TRUE;
function safeString($string){
$string = mysql_real_escape_string(strip_tags($string));
return $string;
}
$username = safeString($username);
$text = safeString($text);
//$username = mysql_real_escape_string($username);
//$ $text = mysql_real_escape_string($text);
// date and time
$date = getCurrentDate();
//Inserts a comment dB.
mysql_query("INSERT INTO comment (`username`, `text`, `date`) VALUES ('$username' , '$text', '$date')")
or die("Something went wrong with the insert query" . mysql_error());
}
示例2: __construct
function __construct()
{
$this->AccountId = 0;
$this->BatchId = 0;
$this->CreatedUserId = 0;
$this->ModifiedUserId = 0;
$this->RecordCount = 0;
$this->CurrentRecord = 0;
$this->CreatedDate = getCurrentDate();
$this->CompletedDate = getCurrentDate();
$this->ModifiedDate = getCurrentDate();
}
示例3: addNewView
function addNewView() {
$reviewId = $_GET['review_id'];
if (isset($_SESSION['uname'])) {
$viewedBy = $_SESSION['uname'];
} else {
$viewedBy = "Anonymous";
}
$viewedDate = getCurrentDate();
$ipAddress = getUserIpAddress();
$tableName = "review_hits";
$id = generateUniqueId($tableName);
$query = "INSERT INTO " . $tableName . " (id, review_id, viewed_by, view_date, ip_viewed_from) VALUES ($id, $reviewId, '$viewedBy', '$viewedDate', '$ipAddress')";
echo $query;
mysql_query($query) or die(mysql_error());
}
示例4: insertReviewPiks
function insertReviewPiks($reviewId, $fileNames) {
$query = "INSERT INTO review_pic (review_id, pic_url, uploaded_date, is_deleted) VALUES ";
$dated=getCurrentDate();
for ($i=0;$i<sizeof($fileNames);$i++) {
$fileName = $fileNames[$i];
$query .= "($reviewId, '$fileName', '$dated', 0)";
if (($i+1) != sizeof($fileNames)) {
$query .= ", ";
}
}
if (sizeof($fileNames) > 0) {
mysql_query($query) or die(mysql_error());
}
}
示例5: _setLinksToTimeLabels
function _setLinksToTimeLabels()
{
$portal_item = $this->getContextItem();
$start_date = $this->_getDateFromDateTime($this->getCreationDate());
if ($this->isClosed()) {
$end_date = $this->_getDateFromDateTime($this->getClosureDate());
}
$current_date = getCurrentDate();
$get_time_item_ids = false;
$first = true;
if ($portal_item->showTime()) {
$time_item_id_array = array();
$time_list = $portal_item->getTimeList();
if ($time_list) {
$time_item = $time_list->getFirst();
while ($time_item) {
if (!$time_item->isDeleted()) {
$date_label_start = $this->_getBeginDateFromTimeLabel($time_item->getTitle());
$date_label_end = $this->_getEndDateFromTimeLabel($time_item->getTitle());
if ($date_label_end < $date_label_start) {
$date_label_end = $date_label_end + 10000;
}
if ($date_label_start <= $start_date and $start_date <= $date_label_end) {
$get_time_item_ids = true;
}
if ($first) {
if ($date_label_start > $start_date) {
$get_time_item_ids = true;
}
$first = false;
}
if ($current_date < $date_label_start) {
$get_time_item_ids = false;
}
if (isset($end_date) and $date_label_start <= $end_date and $end_date <= $date_label_end) {
$get_time_item_ids = false;
}
if ($get_time_item_ids) {
$time_item_id_array[] = $time_item->getItemID();
}
}
$time_item = $time_list->getNext();
}
}
$this->setTimeListByID($time_item_id_array);
}
}
示例6: header
/**
* override the base class method getSmarty
* @param: NULL
* @return: object $smarty
* @access: public
*/
public function &getSmarty()
{
global $use_db_debug;
//输出头
header("Content-Type:text/html;charset=UTF-8");
if (file_exists(LIB_PATH . 'smarty/Smarty.class.php')) {
include_once LIB_PATH . 'smarty/Smarty.class.php';
} else {
die("you have not install SMARTY or it is not the corrent location");
}
include_once FUNCTION_PATH . 'getCurrentDate.fun.php';
$smarty = new Smarty();
$smarty->template_dir = ROOT_PATH . 'theme/admin/';
//增加根据用户theme的数据
//进行设置Smarty的编译目录
if (!file_exists(DATA_CACHE_PATH . 'smarty/admin/')) {
mkdir(DATA_CACHE_PATH . 'smarty/admin/') or die("Can't create the Smarty compile directly, please check the privilege is 777");
}
$smarty->compile_dir = DATA_CACHE_PATH . 'smarty/admin/';
$smarty->config_dir = THEME_CONFIG_PATH . SYSTEM_LANG . '/';
$smarty->left_delimiter = THEME_LEFT_DELIMITER;
$smarty->right_delimiter = THEME_RIGHT_DELIMITER;
if ($use_db_debug) {
$smarty->compile_check = false;
}
// assign the images and css file path
$smarty->assign('image_url', IMAGE_URL);
$smarty->assign('root_url', ROOT_URL);
$smarty->assign('css_url', ROOT_URL . 'theme/admin/');
$smarty->assign('now_date', getCurrentDate());
$smarty->assign('user_name', $_SESSION['user']['name']);
$smarty->assign('module', $_SESSION['module']);
$smarty->assign('action', $_SESSION['action']);
$smarty->assign('showbest', $_GET['showbest']);
return $smarty;
}
示例7: pivotx_update_post
/**
* Updates a post.
*
* @param string $uid
* @param string $postid
* @param string $title
* @param string $content
* @param array $categories
* @return void
*/
function pivotx_update_post($uid, $postid, $title, $content, $categories = '')
{
global $PIVOTX, $conversion_method, $body_separator;
$oldentry = $PIVOTX['db']->read_entry($postid);
$entry['code'] = $postid;
$entry['date'] = $oldentry['date'];
list($pivotintro, $pivotbody) = explode($body_separator, stripTrailingSpace(stripslashes($content)));
$entry['introduction'] = $pivotintro;
$entry['body'] = $pivotbody;
$entry['introduction'] = tidyHtml($entry['introduction'], TRUE);
$entry['body'] = tidyHtml($entry['body'], TRUE);
if (empty($categories)) {
$entry['category'] = $oldentry['category'];
} else {
$entry['category'] = $categories;
}
$entry['publish_date'] = $oldentry['publish_date'];
$entry['edit_date'] = date("Y-m-d-H-i", getCurrentDate());
$entry['title'] = stripTrailingSpace(stripslashes($title));
$entry['subtitle'] = $oldentry['subtitle'];
$entry['user'] = $uid;
$entry['convert_lb'] = $conversion_method;
$entry['status'] = "publish";
$entry['allow_comments'] = 1;
$entry['keywords'] = $oldentry['keywords'];
$entry['vialink'] = $oldentry['vialink'];
$entry['viatitle'] = $oldentry['viatitle'];
$PIVOTX['db']->set_entry($entry);
$PIVOTX['db']->save_entry(TRUE);
}
示例8: array
?>
</div>
<?php
include '../CommonPage/addDetails.php';
include '_selectDueDate.php';
?>
<div class="ui segment">
<div id="dueDorm">
<form action="" method="post">
<select class="ui search dropdown" id="selectDueDate" name="DueDateSelector">
<?php
$DateList = array();
$DateList = array_unique($array);
echo "<option value='start'>Due Date</option>";
foreach ($DateList as $value) {
if ($value < getCurrentDate()) {
echo '<option>' . $value . '</option> <br>';
}
}
?>
</select>
</form>
</div>
<div id="firstResult">
<div class="tableTop"><h1 style="text-align: center">Student List</h1></div>
<div class="container" style="border:1px solid #000000">
<table id="student-grid" class="display ui celled table" cellspacing="0";width="100%"style="border:"1px solid black"">
<thead style="background-color: rgb(240, 240, 240)">
<tr>
<td>Student RollNo</td>
示例9: array
?>
</div>
<?php
include '../CommonPage/addDetails.php';
include '_selectDueDate.php';
?>
<div class="ui segment">
<div id="dueDorm">
<form action="" method="post">
<select class="ui search dropdown" id="selectDueDate" name="DueDateSelector">
<?php
$DateList = array();
$DateList = array_unique($array);
echo "<option value='start'>Due Date</option>";
foreach ($DateList as $value) {
if ($value >= getCurrentDate()) {
echo '<option>' . $value . '</option> <br>';
}
}
?>
</select>
</form>
</div>
<div id="firstResult">
<div class="tableTop"><h1 style="text-align: center">Student List</h1></div>
<div class="container" style="border:1px solid #000000">
<table id="student-grid" class="display ui celled table" cellspacing="0";width="100%"style="border:"1px solid black"">
<thead style="background-color: rgb(240, 240, 240)">
<tr>
<td>Student RollNo</td>
示例10: save_entry
/**
* Saves the current entry - sql implementation.
*
* Returns true if successfully saved. Current implementation
* seems to return true no matter what...
*
* @param boolean $update_index Whether to update the date index.
* @return boolean
*/
function save_entry($update_index = TRUE)
{
// Set the 'commcount', 'commnames'..
unset($commnames);
if (isset($this->entry['comments'])) {
// Initialise the IP blocklist.
$blocklist = new IPBlock();
foreach ($this->entry['comments'] as $comment) {
if (!$blocklist->isBlocked($comment['ip'])) {
if ($comment[moderate] != 1) {
$commnames[] = stripslashes($comment['name']);
} else {
// if moderation is on, we add the name as '-'..
$commnames[] = '-';
}
}
}
if (isset($commnames) && count($commnames) > 0) {
$this->entry['comment_names'] = implode(", ", array_unique($commnames));
$this->entry['comment_count'] = count($commnames);
} else {
$this->entry['comment_names'] = "";
$this->entry['comment_count'] = 0;
}
} else {
unset($this->entry['comments']);
$this->entry['comment_names'] = "";
$this->entry['comment_count'] = 0;
}
// Set the 'trackcount', 'tracknames'..
unset($tracknames);
if (isset($this->entry['trackbacks'])) {
foreach ($this->entry['trackbacks'] as $trackback) {
$tracknames[] = stripslashes($trackback['name']);
}
if (isset($tracknames) && count($tracknames) > 0) {
$this->entry['trackback_names'] = implode(", ", array_unique($tracknames));
$this->entry['trackback_count'] = count($tracknames);
} else {
$this->entry['trackback_names'] = "";
$this->entry['trackback_count'] = 0;
}
} else {
unset($this->entry['trackbacks']);
$this->entry['trackback_names'] = "";
$this->entry['trackback_count'] = 0;
}
// Make sure we have an URI
if (empty($this->entry['uri'])) {
$this->entry['uri'] = makeURI($this->entry['title']);
}
$values = array('title' => $this->entry['title'], 'uri' => $this->entry['uri'], 'subtitle' => $this->entry['subtitle'], 'introduction' => $this->entry['introduction'], 'body' => $this->entry['body'], 'convert_lb' => intval($this->entry['convert_lb']), 'status' => $this->entry['status'], 'date' => $this->entry['date'], 'publish_date' => $this->entry['publish_date'], 'edit_date' => date("Y-m-d H:i:s", getCurrentDate()), 'user' => $this->entry['user'], 'allow_comments' => $this->entry['allow_comments'], 'keywords' => $this->entry['keywords'], 'via_link' => $this->entry['vialink'], 'via_title' => $this->entry['viatitle'], 'comment_count' => $this->entry['comment_count'], 'comment_names' => $this->entry['comment_names'], 'trackback_count' => $this->entry['trackback_count'], 'trackback_names' => $this->entry['trackback_names'], 'extrafields' => $this->entry['extrafields']);
// Check if the entry exists
$this->sql->query("SELECT uid FROM " . $this->entriestable . " WHERE uid=" . intval($this->entry['uid']));
if (is_array($this->sql->fetch_row())) {
// It exists, we do an update..
$qry = array();
$qry['update'] = $this->entriestable;
$qry['value'] = $values;
$qry['where'] = "uid=" . intval($this->entry['uid']);
$this->sql->build_update($qry);
$this->sql->query();
} else {
// New entry.
// Add the UID to the values array if it is already set (for
// example when importing entries).
if ($this->entry['uid'] != '') {
$values['uid'] = $this->entry['uid'];
}
$qry = array();
$qry['into'] = $this->entriestable;
$qry['value'] = $values;
$this->sql->build_insert($qry);
$this->sql->query();
// Set the UID to the last inserted ID if it isn't already set
// (which is normally the case for new entries).
if ($this->entry['uid'] == '') {
$this->entry['uid'] = $this->sql->get_last_id();
}
// A bit of a nasty hack, but needed when we have to insert tags for a new entry,
// and $db is not yet aware of the new $uid.
$GLOBALS['db']->entry['uid'] = $this->entry['uid'];
}
// We will also need to save the comments and trackbacks.. We should
// try to prevent doing unneeded queries, so we only insert comments
// and trackbacks which have no ['uid'] yet. (because these are either
// new, or are being converted from flat files)
if (!empty($this->entry['comments'])) {
foreach ($this->entry['comments'] as $comment) {
if ($comment['uid'] == "") {
// Ah, let's insert it.
//.........这里部分代码省略.........
示例11: checkTimedPublish
/**
* Checks if any pages set to 'timed publish' should be published.
*
* This code might have to be optimized to only check the latest pages for
* a very big site.
*/
function checkTimedPublish()
{
$date = date("Y-m-d-H-i", getCurrentDate());
$pageindex = $this->getIndex();
foreach ($pageindex as $chapter) {
// Skip chapters with no pages
if (!isset($chapter['pages'])) {
continue;
}
foreach ($chapter['pages'] as $page) {
if ($page['status'] == 'timed' && $page['publish_date'] <= $date) {
$page = $this->getPage($page['uid']);
$page['date'] = $page['publish_date'];
$page['status'] = "publish";
$this->savePage($page);
/* Disabled for now since it sendMailNotification doesn't support pages yet:
if (!$PIVOTX['config']->get('disable_new_page_notifications')) {
sendMailNotification('page',$page);
}
*/
}
}
}
}
示例12: _cronLog
/** cron log, INTERNAL
* daily cron, move old log entries to table log_archive
*
* @return array results of running this cron
*/
public function _cronLog()
{
include_once 'functions/misc_functions.php';
include_once 'functions/date_functions.php';
$time_start = getmicrotime();
$cron_array = array();
$cron_array['title'] = 'log cron';
$cron_array['description'] = 'move old logs to log archive';
$cron_array['success'] = false;
$cron_array['success_text'] = 'cron failed';
$context_item = $this->_environment->getCurrentContextItem();
$log_DB = $this->_environment->getLogManager();
$log_DB->resetlimits();
$log_DB->setContextLimit(0);
$from = 0;
$range = 500;
$log_DB->setRangeLimit($from, $range);
// // only archive logs that are older then the beginning of the actual day
// // getCurrentDate() returns date("Ymd");
// // Datenschutz : Logdaten nach bestimmtem Zeitraum löschen
// // Wenn im context_item das Extra eingestellt ist, dann
// if($context_item->getLogDeleteInterval() <= 1){
// $log_DB->setTimestampOlderLimit(getCurrentDate());
// } else {
// $log_DB->setTimestampOlderLimit(getCurrentDateTimeMinusDaysInMySQL($context_item->getLogDeleteInterval()));
// }
$log_DB->setTimestampOlderLimit(getCurrentDate());
$data_array = $log_DB->select();
$count = count($data_array);
if ($count == 0) {
$cron_array['success'] = true;
$cron_array['success_text'] = 'nothing to do';
} else {
$count_all = 0;
$log_archive_manager = $this->_environment->getLogArchiveManager();
while (count($data_array) > 0) {
// save old logs in log archive
$success = $log_archive_manager->save($data_array);
if ($success) {
// delete old logs
$success = $log_DB->deleteByArray($data_array);
if ($success) {
$cron_array['success'] = true;
$count_all = $count_all + count($data_array);
$cron_array['success_text'] = 'move ' . $count_all . ' log entries';
}
}
unset($data_array);
$data_array = $log_DB->select();
}
unset($log_archive_manager);
}
unset($log_DB);
$time_end = getmicrotime();
$time = round($time_end - $time_start, 0);
$cron_array['time'] = $time;
return $cron_array;
}
示例13: _cronPageImpressionAndUserActivity
/** cron log, INTERNAL
* daily cron
*
* @return array results of running this cron
*/
function _cronPageImpressionAndUserActivity()
{
include_once 'functions/misc_functions.php';
$time_start = getmicrotime();
$cron_array = array();
$cron_array['title'] = 'page impression and user activity cron';
$cron_array['description'] = 'count page impressions and user activity';
$cron_array['success'] = true;
$cron_array['success_text'] = 'cron failed';
$log_manager = $this->_environment->getLogManager();
$room_list = $this->getRoomList();
$count_rooms = 0;
if ($room_list->isNotEmpty()) {
$room_item = $room_list->getFirst();
while ($room_item) {
// get latest timestamp of page impressions and user actitivty
// from extra field PIUA_LAST
$piua_last = $room_item->getPageImpressionAndUserActivityLast();
if (!empty($piua_last)) {
$oldest_date = $piua_last;
} else {
// if there is no entry take creation_date
$creation_date = $room_item->getCreationDate();
$oldest_date = getYearFromDateTime($creation_date) . getMonthFromDateTime($creation_date) . getDayFromDateTime($creation_date);
}
$current_date = getCurrentDate();
$day_diff = getDifference($oldest_date, $current_date);
$pi_array = $room_item->getPageImpressionArray();
$ua_array = $room_item->getUserActivityArray();
$pi_input = array();
$ua_input = array();
// for each day, get page impressions and user activity
for ($i = 1; $i < $day_diff; $i++) {
$log_manager->resetLimits();
$log_manager->setContextLimit($room_item->getItemID());
$log_manager->setRequestLimit("commsy.php");
$older_limit_stamp = datetime2Timestamp(date("Y-m-d 00:00:00")) - ($i - 1) * 86400;
$older_limit = date('Y-m-d', $older_limit_stamp);
$log_manager->setTimestampOlderLimit($older_limit);
$log_manager->setTimestampNotOlderLimit($i);
$pi_input[] = $log_manager->getCountAll();
$ua_input[] = $log_manager->countWithUserDistinction();
}
// put actual date in extra field PIUA_LAST
$room_item->setPageImpressionAndUserActivityLast($current_date);
$room_item->setPageImpressionArray(array_merge($pi_input, $pi_array));
$room_item->setUserActivityArray(array_merge($ua_input, $ua_array));
$room_item->saveWithoutChangingModificationInformation();
$count_rooms++;
unset($room_item);
$room_item = $room_list->getNext();
}
}
unset($room_list);
unset($log_manager);
$cron_array['success_text'] = 'count page impressions and user activity of ' . $count_rooms . ' rooms';
$time_end = getmicrotime();
$time = round($time_end - $time_start, 0);
$cron_array['time'] = $time;
return $cron_array;
}
示例14: session_start
<?php
session_start();
include "../common/DatabaseConnection.php";
$db = new DatabaseConnection();
$db->createConnection();
$locationFK = $_SESSION['userLoc'];
$type = $_GET['artefactType'];
$dateType = $_GET['dtype'];
if ($dateType == 'c') {
getCurrentDate($locationFK, $type, $db);
} else {
getPending($locationFK, $type, $db);
}
function getCurrentDate($locationFK, $type, $db)
{
$sql = "select s.ScheduleMaintenancePK,s.ArtefactCode,a.ArtefactName,s.ScheduledServiceDate from scheduledmaintenance s\r\n\t\tinner join artefact a\r\n\t\ton s.ArtefactCode = a.ArtefactCode\r\n\t\twhere s.ScheduleMaintenancePK not in (select ScheduleMaintenanceFK from tasklist)\r\n\t\tand s.ScheduledServiceDate = current_date() and s.LocationFK='{$locationFK}' and s.ArtefactTypeCode = '{$type}' and a.visiblestatus='on'";
if ($result = $db->setQuery($sql)) {
if ($result->num_rows > 0) {
$resultArray = array();
while ($row = $result->fetch_assoc()) {
$url = "conditionalReport.php?artefactCode=" . $row['ArtefactCode'] . "&key=" . $row['ScheduleMaintenancePK'];
$name = $row['ArtefactName'];
echo "<a href=" . $url . " class='list-group-item'>" . "<span class='glyphicon glyphicon-file'></span>" . $name . "<span class='badge'>" . date('d/m/Y', strtotime($row['ScheduledServiceDate'])) . "</span></a>";
//echo " <a href=".$url." class='list-group-item' ><span class='glyphicon glyphicon-file'></span>".$name."<span class='badge'>".date('d/m/Y', strtotime($row['ScheduledServiceDate']))."</span></a>";
}
//echo json_encode($resultArray);
} else {
echo "NULL";
}
}
示例15: checkTimedPublish
/**
* Checks if any entries set to 'timed publish' should be published.
*
* @return void
*/
function checkTimedPublish()
{
global $PIVOTX;
$date = date("Y-m-d-H-i", getCurrentDate());
$entries = $this->read_entries(array('full' => true, 'status' => 'timed'));
foreach ($entries as $entry) {
if ($entry['publish_date'] <= $date) {
$entry['date'] = $entry['publish_date'];
$entry['status'] = "publish";
$this->set_entry($entry);
$this->save_entry(TRUE);
if (!$PIVOTX['config']->get('disable_new_entry_notifications')) {
sendMailNotification('entry', $this->entry);
}
writeTags($this->entry['keywords'], '', $this->entry['code']);
updateSearchIndex($this->entry);
}
}
}