本文整理汇总了PHP中Date::setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::setTimestamp方法的具体用法?PHP Date::setTimestamp怎么用?PHP Date::setTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::setTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ff_getListField_gettopic
function _ff_getListField_gettopic($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF, $_USER, $_TABLES, $LANG_ADMIN, $LANG04, $LANG28, $_IMAGE_TYPE;
global $_FF_CONF, $_SYSTEM, $LANG_GF02, $LANG_GF03;
USES_lib_html2text();
$dt = new Date('now', $_USER['tzid']);
$retval = '';
switch ($fieldname) {
case 'author':
$retval = $A['name'];
break;
case 'date':
$dt->setTimestamp($fieldvalue);
$retval = $dt->format($_FF_CONF['default_Datetime_format'], true);
break;
case 'lastupdated':
$dt->setTimestamp($fieldvalue);
$retval = $dt->format($_FF_CONF['default_Datetime_format'], true);
break;
case 'subject':
$testText = FF_formatTextBlock($A['comment'], 'text', 'text', $A['status']);
$testText = strip_tags($testText);
$html2txt = new html2text($testText, false);
$testText = trim($html2txt->get_text());
$lastpostinfogll = htmlspecialchars(preg_replace('#\\r?\\n#', '<br>', strip_tags(substr($testText, 0, $_FF_CONF['contentinfo_numchars']) . '...')), ENT_QUOTES, COM_getEncodingt());
$retval = '<span class="' . COM_getTooltipStyle() . '" style="text-decoration:none;" title="' . $A['subject'] . '::' . $lastpostinfogll . '">' . $fieldvalue . '</span>';
break;
case 'select':
$retval = '[ <a href="#" onclick="insert_topic(\'' . $A['id'] . '\'); return false;">' . $LANG_GF03['select'] . '</a> ]';
break;
default:
$retval = $fieldvalue;
break;
}
return $retval;
}
示例2: parse
//.........这里部分代码省略.........
}
$archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
$sql = " (date <= NOW()) AND (draft_flag = 0)";
if (empty($topic)) {
$sql .= COM_getLangSQL('tid', 'AND', 's');
}
// if a topic was provided only select those stories.
if (!empty($topic)) {
$sql .= " AND s.tid = '" . DB_escapeString($topic) . "' ";
}
if ($featured == 1) {
$sql .= " AND s.featured = 1 ";
} else {
if ($featured == 2) {
$sql .= " AND s.featured = 0 ";
}
}
if ($frontpage == 1) {
$sql .= " AND frontpage = 1 ";
}
if ($topic != $archivetid) {
$sql .= " AND s.tid != '{$archivetid}' ";
}
$sql .= COM_getPermSQL('AND', 0, 2, 's');
$sql .= COM_getTopicSQL('AND', 0, 's') . ' ';
$userfields = 'u.uid, u.username, u.fullname';
if ($_CONF['allow_user_photo'] == 1) {
$userfields .= ', u.photo';
if ($_CONF['use_gravatar']) {
$userfields .= ', u.email';
}
}
$orderBy = ' date DESC ';
$headlinesSQL = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, " . 'UNIX_TIMESTAMP(s.expire) as expireunix, ' . $userfields . ", t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, " . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND" . $sql . "ORDER BY featured DESC," . $orderBy;
if ($display > 0) {
$headlinesSQL .= " LIMIT " . $display;
}
$result = DB_query($headlinesSQL);
$numRows = DB_numRows($result);
if ($numRows < $cols) {
$cols = $numRows;
}
if ($cols > 6) {
$cols = 6;
}
if ($numRows > 0) {
$T = new Template($_CONF['path'] . 'system/autotags/');
$T->set_file('page', $template);
$T->set_var('columns', $cols);
$T->set_block('page', 'headlines', 'hl');
$newstories = array();
while ($A = DB_fetchArray($result)) {
$T->unset_var('readmore_url');
$T->unset_var('lang_readmore');
if ($A['attribution_author'] != '') {
$author = $A['attribution_author'];
} else {
$author = $A['username'];
}
$title = COM_undoSpecialChars($A['title']);
$title = str_replace(' ', ' ', $title);
$subtitle = COM_undoSpecialChars($A['subtitle']);
if ($A['story_image'] != '') {
$story_image = $_CONF['site_url'] . $A['story_image'];
} else {
$story_image = '';
}
$A['introtext'] = STORY_renderImages($A['sid'], $A['introtext']);
if (!empty($A['bodytext'])) {
$closingP = strrpos($A['introtext'], "</p>");
if ($closingP !== FALSE) {
$text = substr($A['introtext'], 0, $closingP);
$A['introtext'] = $text;
}
// adds the read more link
$T->set_var('readmore_url', COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']));
$T->set_var('lang_readmore', $LANG01['continue_reading']);
}
if ($truncate > 0) {
$A['introtext'] = $this->truncateHTML($A['introtext'], $truncate, '...');
}
$topicurl = $_CONF['site_url'] . '/index.php?topic=' . $A['tid'];
$dt->setTimestamp($A['unixdate']);
if ($A['commentcode'] >= 0) {
$cmtLinkArray = CMT_getCommentLinkWithCount('article', $A['sid'], $_CONF['site_url'] . '/article.php?story=' . $A['sid'], $A['comments'], 1);
$T->set_var(array('lang_comments' => '', 'comments_count' => $cmtLinkArray['comment_count'], 'comments_url' => $cmtLinkArray['url'], 'comments_url_extra' => $cmtLinkArray['url_extra']));
} else {
$T->unset_var('lang_comments');
$T->unset_var('comments_count');
$T->unset_var('comments_url');
$T->unset_var('comments_url_extra');
}
$T->set_var(array('titlelink' => $titleLink ? TRUE : '', 'meta' => $meta ? TRUE : '', 'lang_by' => $LANG01[95], 'lang_posted_in' => $LANG01['posted_in'], 'story_topic_url' => $topicurl, 'title' => $title, 'subtitle' => $subtitle, 'story_image' => $story_image, 'text' => PLG_replaceTags($A['introtext']), 'date' => $A['date'], 'time' => $dt->format('Y-m-d', true) . 'T' . $dt->format('H:i:s', true), 'topic' => $A['topic'], 'tid' => $A['tid'], 'author' => $author, 'author_id' => $A['uid'], 'sid' => $A['sid'], 'short_date' => $dt->format($_CONF['shortdate'], true), 'date_only' => $dt->format($_CONF['dateonly'], true), 'date' => $dt->format($dt->getUserFormat(), true), 'url' => COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']), 'attribution_url' => $A['attribution_url'], 'attribution_name' => $A['attribution_name']));
$T->parse('hl', 'headlines', true);
}
$retval = $T->finish($T->parse('output', 'page'));
CACHE_create_instance($instance_id, $retval, 0);
}
return $retval;
}
示例3: USER_getListField
/**
* returns field data for the user administration panel list
*
*/
function USER_getListField($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
global $_CONF, $_USER, $_TABLES, $LANG_ADMIN, $LANG04, $LANG28, $_IMAGE_TYPE;
$retval = '';
$dt = new Date('now', $_USER['tzid']);
switch ($fieldname) {
case 'edit':
$attr['title'] = $LANG_ADMIN['edit'];
$retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/user.php?edit=x&uid={$A['uid']}", $attr);
break;
case 'username':
$attr['title'] = $LANG28[108];
$url = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'];
$retval = COM_createLink($icon_arr['user'], $url, $attr);
$retval .= ' ';
$attr['style'] = 'vertical-align:top;';
$retval .= COM_createLink($fieldvalue, $url, $attr);
break;
case 'fullname':
$photoico = '';
if (!empty($A['photo'])) {
$photoico = " <img src=\"{$_CONF['layout_url']}/images/smallcamera." . $_IMAGE_TYPE . '" alt="{$LANG04[77]}"' . '/>';
} else {
$photoico = '';
}
$retval = COM_truncate($fieldvalue, 24, ' ...', true) . $photoico;
break;
case 'status':
$status = $A['status'];
switch ($status) {
case 0:
$retval = $LANG28[42];
break;
case 1:
$retval = $LANG28[14];
break;
case 2:
$retval = $LANG28[106];
break;
case 3:
$retval = $LANG28[45];
break;
case 4:
$retval = $LANG28[107];
break;
}
break;
case 'lastlogin':
if ($fieldvalue < 1) {
// if the user never logged in, show the registration date
$dt->setTimestamp(strtotime($A['regdate']));
$regdate = $dt->format($_CONF['shortdate'], true);
$retval = "{$LANG28[36]} ({$LANG28[53]}: {$regdate})";
} else {
$dt->setTimestamp($fieldvalue);
$retval = $dt->format($_CONF['shortdate'], true);
}
break;
case 'lastlogin_short':
if ($fieldvalue < 1) {
// if the user never logged in, show the registration date
$dt->setTimestamp(strtotime($A['regdate']));
$regdate = $dt->format($_CONF['shortdate'], true);
$retval = "({$LANG28[36]})";
} else {
$dt->setTimestamp($fieldvalue);
$retval = $dt->format($_CONF['shortdate'], true);
}
break;
case 'online_days':
if ($fieldvalue < 0) {
// users that never logged in, would have a negative online days
$retval = "N/A";
} else {
$retval = $fieldvalue;
}
break;
case 'phantom_date':
case 'offline_months':
$retval = COM_numberFormat(round($fieldvalue / 2592000));
break;
case 'online_hours':
$retval = COM_numberFormat(round($fieldvalue / 3600, 3));
break;
case 'regdate':
$dt->setTimestamp(strtotime($fieldvalue));
$retval = $dt->format($_CONF['shortdate'], true);
break;
case $_TABLES['users'] . '.uid':
$retval = $A['uid'];
break;
case 'email':
$url = 'mailto:' . $fieldvalue;
$attr['title'] = $LANG28[111];
$retval = COM_createLink($icon_arr['mail'], $url, $attr);
$retval .= ' ';
//.........这里部分代码省略.........
示例4: _ff_getListField_forum
function _ff_getListField_forum($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF, $_USER, $_TABLES, $LANG_ADMIN, $LANG04, $LANG28, $_IMAGE_TYPE;
global $_FF_CONF, $_SYSTEM, $LANG_GF02;
if (!isset($A['status'])) {
$A['status'] = 0;
}
USES_lib_html2text();
$retval = '';
$dt = new Date('now', $_USER['tzid']);
switch ($fieldname) {
case 'date':
case 'lastupdated':
$dt->setTimestamp($fieldvalue);
$retval = $dt->format($_FF_CONF['default_Datetime_format'], true);
break;
case 'subject':
$testText = FF_formatTextBlock($A['comment'], 'text', 'text', $A['status']);
$testText = strip_tags($testText);
$html2txt = new html2text($testText, false);
$testText = trim($html2txt->get_text());
$lastpostinfogll = @htmlspecialchars(preg_replace('#\\r?\\n#', '<br>', strip_tags(substr($testText, 0, $_FF_CONF['contentinfo_numchars']) . '...')), ENT_QUOTES, COM_getEncodingt());
$retval = '<a class="' . COM_getTooltipStyle() . '" style="text-decoration:none;" href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . ($A['pid'] == 0 ? $A['id'] : $A['pid']) . '&topic=' . $A['id'] . '#' . $A['id'] . '" title="' . $A['subject'] . '::' . $lastpostinfogll . '" rel="nofollow">' . $fieldvalue . '</a>';
break;
case 'bookmark':
$bm_icon_on = '<img src="' . _ff_getImage('star_on_sm') . '" title="' . $LANG_GF02['msg204'] . '" alt=""/>';
$retval = '<span id="forumbookmark' . $A['topic_id'] . '"><a href="#" onclick="ajax_toggleForumBookmark(' . $A['topic_id'] . ');return false;">' . $bm_icon_on . '</a></span>';
break;
case 'replies':
case 'views':
if ($fieldvalue != '') {
$retval = $fieldvalue;
} else {
$retval = '0';
}
break;
default:
$retval = $fieldvalue;
break;
}
return $retval;
}
示例5: _displayVersionData
function _displayVersionData()
{
global $_CONF, $_USER, $LANG_UPGRADE, $LANG01, $LANG_FILECHECK, $LANG_ADMIN, $_PLUGIN_INFO;
$retval = '';
$upToDate = 0;
$classCounter = 0;
$pluginInfo = '';
list($upToDate, $pluginsUpToDate, $pluginData) = _checkVersion();
$T = new Template($_CONF['path_layout'] . 'admin');
$T->set_file('page', 'vercheck.thtml');
$menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/vercheck.php', 'text' => $LANG_UPGRADE['recheck']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
$retval .= COM_startBlock($LANG_UPGRADE['title'], '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= ADMIN_createMenu($menu_arr, $LANG_UPGRADE['desc'], $_CONF['layout_url'] . '/images/icons/versioncheck.png');
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
switch ($upToDate) {
case 0:
$alertIcon = $_CONF['layout_url'] . '/images/alert.png';
$statusMsg = $LANG_UPGRADE['upgrade_title'];
$statusText = sprintf($LANG_UPGRADE['upgrade'], $pluginData['glfusioncms']['installed_version'], $pluginData['glfusioncms']['latest_version']);
break;
case 1:
$alertIcon = $_CONF['layout_url'] . '/images/check.png';
$statusMsg = $LANG_UPGRADE['uptodate_title'];
$statusText = $LANG_UPGRADE['uptodate'];
break;
case 2:
$alertIcon = $_CONF['layout_url'] . '/images/alert.png';
$statusMsg = $LANG_UPGRADE['unknown_title'];
$statusText = sprintf($LANG_UPGRADE['unknown'], $pluginData['glfusioncms']['installed_version']);
break;
default:
$alertIcon = $_CONF['layout_url'] . '/images/alert.png';
$statusMsg = $LANG_UPGRADE['error_title'];
$statusText = $LANG_UPGRADE['error'];
break;
}
$T->set_var(array('alerticon' => $alertIcon, 'statusmsg' => $statusMsg, 'statustext' => $statusText));
if ($pluginsUpToDate != -1) {
$pluginInfo .= '<div style="margin-top:10px;"><h3>' . $LANG_UPGRADE['plugin_title'] . '</h3>';
$dt = new Date('now', $_USER['tzid']);
$data_arr = array();
$text_arr = array();
$header_arr = array(array('text' => $LANG_UPGRADE['plugin'], 'field' => 'display_name'), array('text' => $LANG_UPGRADE['installed_version'], 'field' => 'installed_version'), array('text' => $LANG_UPGRADE['latest_version'], 'field' => 'latest_version'), array('text' => $LANG_UPGRADE['notes'], 'field' => 'notes'));
asort($pluginData);
foreach ($pluginData as $plugin) {
if ($plugin['plugin'] == 'glfusioncms') {
continue;
}
$dt->setTimestamp($plugin['release_date']);
if ($plugin['latest_version'] == 0) {
$upToDate = -1;
} else {
$upToDate = _upToDate($plugin['latest_version'], $plugin['installed_version']);
}
switch ($upToDate) {
case 0:
$notes = sprintf($LANG_UPGRADE['was_released'], $plugin['latest_version'], $dt->format("M d, Y", true));
$class = "notok";
if (strlen($plugin['url']) > 0) {
$latest_version = '<a href="' . $plugin['url'] . '" target="_blank">' . $plugin['latest_version'] . '</a>';
} else {
$latest_version = $plugin['latest_version'];
}
break;
case 1:
$notes = $LANG_UPGRADE['plugin_uptodate'];
$class = "yes";
$latest_version = $plugin['latest_version'];
break;
case 2:
$notes = $LANG_UPGRADE['plugin_newer'];
$class = "yes";
$latest_version = $plugin['latest_version'];
break;
default:
$notes = $LANG_UPGRADE['no_data'];
$class = "ok";
$latest_version = '???';
break;
}
$data_arr[] = array('display_name' => $plugin['display_name'], 'installed_version' => $plugin['installed_version'], 'latest_version' => '<span class="' . $class . '">' . $latest_version . '</span>', 'url' => $plugin['url'], 'notes' => $notes, 'release_date' => $plugin['release_date'], 'update_available' => $upToDate);
}
$pluginInfo .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
$pluginInfo .= '</div>';
}
$T->parse('output', 'page');
$retval .= $T->finish($T->get_var('output'));
$retval .= $pluginInfo;
return $retval;
}
示例6: elseif
}
$displaypageslink .= ' ';
}
}
// Check if user is an anonymous poster
if ($record['uid'] > 1) {
$showuserlink = '<span class="replypagination">';
$showuserlink .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $record['uid'] . '">' . $record['name'];
$showuserlink .= '</a></span>';
} else {
$showuserlink = $record['name'];
}
if ($record['last_reply_rec'] > 0) {
$lastreply['date'] = $record['lastupdated'];
$lastreply['name'] = $record['lpname'];
$dt->setTimestamp($lastreply['date']);
$lastdate1 = $dt->format('m/d/Y', true);
if ($dt->isToday()) {
$lasttime = $dt->format('H:i a', true);
$lastdate = $LANG_GF01['TODAY'] . $lasttime;
} elseif ($_FF_CONF['allow_user_dateformat']) {
$lastdate = $dt->format($dt->getUserFormat(), true);
} else {
$lastdate = $dt->format('M/d/y H:i a', true);
}
} else {
$dt->setTimestamp($record['lastupdated']);
$lastdate = $dt->format('M/d/y H:i a', true);
$lastreply = $record;
}
$dt->setTimestamp($record['date']);
示例7: getTemplateArrayCalendar
function getTemplateArrayCalendar($o_minDay, $s_date, $period)
{
// today
$today = new Date(getDateFromTimestamp(time()));
$tsToday = $today->getTimestamp();
// date asked for statistics
$dateAsked = new Date($s_date);
// used for going througt the month
$date = new Date($s_date);
$month = $date->getMonth();
$year = $date->getYear();
$prefixDay = $year . "-" . $month . "-";
$date->setDate($prefixDay . '01');
$week = $date->getWeek();
$day = 1;
$ts = $date->getTimestamp();
while ($date->getMonth() == $month) {
// day exists in stats, isn't it too old or in the future ?
if ($date->getTimestamp() >= $o_minDay->getTimestamp() && $date->getTimestamp() <= $tsToday) {
$exists = 1;
} else {
$exists = 0;
}
// day selected for stats view ?
if ($period == DB_ARCHIVES_PERIOD_DAY && $date->getDay() == $dateAsked->getDay() || $period == DB_ARCHIVES_PERIOD_WEEK && $date->getWeek() == $dateAsked->getWeek() || $period == DB_ARCHIVES_PERIOD_MONTH || $period == DB_ARCHIVES_PERIOD_YEAR) {
$selected = 1;
} else {
$selected = 0;
}
$weekNo = $date->getWeek() - $week;
if (defined('MONDAY_FIRST') && MONDAY_FIRST == 'no' && date("w", $ts) == 0) {
$weekNo += 1;
}
$dayOfWeek = (int) (!defined('MONDAY_FIRST') || MONDAY_FIRST == 'yes' ? date("w", $ts) == 0 ? 6 : date("w", $ts) - 1 : date("w", $ts));
$return[$weekNo][$dayOfWeek] = array('day' => substr($date->getDay(), 0, 1) === '0' ? substr($date->getDay(), 1, 2) : $date->getDay(), 'date' => $date->get(), 'exists' => $exists, 'selected' => $selected);
$date->addDays(1);
//these 2 lines useless? to check
$ts = $date->getTimeStamp();
$date->setTimestamp($ts);
}
foreach ($return as $key => $r) {
$row =& $return[$key];
for ($i = 0; $i < 7; $i++) {
if (!isset($row[$i])) {
$row[$i] = "-";
}
}
ksort($row);
}
return $return;
}
示例8: PrettySize
$p->set_var('file_size', PrettySize($size));
} else {
$p->set_var('file_size', 'Remote');
}
}
$p->set_var('homepage_url', $homepage);
$p->set_var('LANG_HOMEPAGE', _MD_HOMEPAGE);
$p->set_var('homepage', $homepage);
if ($comments) {
USES_lib_comments();
$commentCount = DB_count($_TABLES['comments'], 'sid', "fileid_{$lid}");
$recentPostMessage = _MD_COMMENTSWANTED;
if ($commentCount > 0) {
$result4 = DB_query("SELECT cid, UNIX_TIMESTAMP(date) AS day,username FROM {$_TABLES['comments']},{$_TABLES['users']} WHERE {$_TABLES['users']}.uid = {$_TABLES['comments']}.uid AND sid = 'fileid_{$lid}' ORDER BY date desc LIMIT 1");
$C = DB_fetchArray($result4);
$dt->setTimestamp($C['day']);
$recentPostMessage = $LANG01[27] . ': ' . $dt->format($_CONF['daytime'], true) . ' ' . $LANG01[104] . ' ' . $C['username'];
} else {
$commentCount = 0;
}
$comment_link = CMT_getCommentLinkWithCount('filemgmt', $lid, $_CONF['site_url'] . '/filemgmt/index.php?id=' . $lid, $commentCount, 1);
$p->set_var('comment_link', $comment_link['link_with_count']);
$p->set_var('show_comments', 'true');
} else {
$p->set_var('show_comments', 'none');
$p->unset_var('show_comments');
}
$p->set_var('LANG_DOWNLOAD', _MD_DOWNLOAD);
$p->set_var('LANG_FILELINK', _MD_FILELINK);
$p->set_var('LANG_RATETHISFILE', _MD_RATETHISFILE);
$p->set_var('LANG_REPORTBROKEN', _MD_REPORTBROKEN);
示例9: COM_olderStuff
/**
* Creates older stuff block
*
* Creates the olderstuff block for display.
* Actually updates the olderstuff record in the blocks table.
* @return void
*/
function COM_olderStuff()
{
global $_TABLES, $_CONF;
$sql = "SELECT sid,tid,title,comments,UNIX_TIMESTAMP(date) AS day FROM {$_TABLES['stories']} WHERE (perm_anon = 2) AND (frontpage = 1) AND (date <= NOW()) AND (draft_flag = 0)" . COM_getTopicSQL('AND', 1) . " ORDER BY featured DESC, date DESC LIMIT {$_CONF['limitnews']}, {$_CONF['limitnews']}";
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
$dateonly = $_CONF['dateonly'];
if (empty($dateonly)) {
$dateonly = 'd-M';
// fallback: day - abbrev. month name
}
$day = 'noday';
$string = '';
$dt = new Date();
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
$dt->setTimestamp($A['day']);
$daycheck = $dt->format("z", true);
if ($day != $daycheck) {
if ($day != 'noday') {
$daylist = COM_makeList($oldnews, 'list-older-stories');
$daylist = str_replace(array("\r", "\n"), '', $daylist);
$string .= $daylist;
// . '<br/>';
}
$day2 = $dt->format($_CONF['dateonly'], true);
$string .= '<h3>' . $dt->format('l', true) . ' <small>' . $day2 . '</small></h3>' . LB;
$oldnews = array();
$day = $daycheck;
}
$oldnews_url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
$oldnews[] = COM_createLink(COM_truncate($A['title'], $_CONF['title_trim_length'], '...'), $oldnews_url, array('title' => htmlspecialchars($A['title'], ENT_COMPAT, COM_getEncodingt()))) . ' (' . COM_numberFormat($A['comments']) . ')';
}
if (!empty($oldnews)) {
$daylist = COM_makeList($oldnews, 'list-older-stories');
$daylist = str_replace(array("\r", "\n"), '', $daylist);
$string .= $daylist;
$string = DB_escapeString($string);
DB_query("UPDATE {$_TABLES['blocks']} SET content = '{$string}' WHERE name = 'older_stories'");
}
}
}
示例10: plugin_subscription_email_format_comment
function plugin_subscription_email_format_comment($category, $track_id, $post_id, $uid)
{
global $_CONF, $_USER, $_TABLES, $LANG01, $LANG03, $LANG04;
$dt = new Date('now', $_USER['tzid']);
$permalink = 'Not defined';
$filter = sanitizer::getInstance();
$AllowedElements = $filter->makeAllowedElements($_CONF['htmlfilter_comment']);
$filter->setAllowedelements($AllowedElements);
$filter->setNamespace('glfusion', 'comment');
$post_id = COM_applyFilter($post_id, true);
$result = DB_query("SELECT * FROM {$_TABLES['comments']} WHERE cid={$post_id}");
if (DB_numRows($result) > 0) {
$A = DB_fetchArray($result);
$itemInfo = PLG_getItemInfo($A['type'], $track_id, 'url,title');
$permalink = $itemInfo['url'];
if (empty($permalink)) {
$permalink = $_CONF['site_url'];
}
if ($A['uid'] > 1) {
$name = COM_getDisplayName($A['uid']);
} else {
$name = $filter->sanitizeUsername($A['name']);
$name = $filter->censor($name);
}
$name = @htmlspecialchars($name, ENT_QUOTES, COM_getEncodingt());
$A['title'] = COM_checkWords($A['title']);
$A['title'] = @htmlspecialchars($A['title'], ENT_QUOTES, COM_getEncodingt());
//and finally: format the actual text of the comment, but check only the text, not sig or edit
$text = str_replace('<!-- COMMENTSIG --><div class="comment-sig">', '', $A['comment']);
$text = str_replace('</div><!-- /COMMENTSIG -->', '', $text);
$text = str_replace('<div class="comment-edit">', '', $text);
$text = str_replace('</div><!-- /COMMENTEDIT -->', '', $text);
$A['comment'] = $text;
if (preg_match('/<.*>/', $text) == 0) {
$A['comment'] = nl2br($A['comment']);
}
$A['comment'] = $filter->_replaceTags($A['comment']);
$notifymsg = sprintf($LANG03[46], '<a href="' . $_CONF['site_url'] . '/comment.php?mode=unsubscribe&sid=' . htmlentities($track_id) . '&type=' . $A['type'] . '" rel="nofollow">' . $LANG01['unsubscribe'] . '</a>');
$dt->setTimestamp(strtotime($A['date']));
$date = $dt->format('F d Y @ h:i a');
$T = new Template($_CONF['path_layout'] . 'comment');
$T->set_file(array('htmlemail' => 'notifymessage_html.thtml', 'textemail' => 'notifymessage_text.thtml'));
$T->set_var(array('post_subject' => $A['title'], 'post_date' => $date, 'post_name' => $name, 'post_comment' => $A['comment'], 'notify_msg' => $notifymsg, 'site_name' => $_CONF['site_name'], 'online_version' => sprintf($LANG01['view_online'], $permalink), 'permalink' => $permalink));
$T->parse('htmloutput', 'htmlemail');
$message = $T->finish($T->get_var('htmloutput'));
$T->parse('textoutput', 'textemail');
$msgText = $T->finish($T->get_var('textoutput'));
$html2txt = new html2text($msgText, false);
$messageText = $html2txt->get_text();
return array($message, $messageText, array());
}
return false;
}
示例11: EVLIST_yearview
/**
* Display a yearly calendar.
* Dates that have events scheduled are highlighted.
*
* @param integer $year Year to display, default is current year
* @param integer $month Starting month
* @param integer $day Starting day
* @param integer $cat Category to show
* @param integer $cal Calendar to show
* @return string HTML for calendar page
*/
function EVLIST_yearview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
global $_CONF, $_EV_CONF, $LANG_MONTH, $_SYSTEM;
EVLIST_setViewSession('year', $year, $month, $day);
$retval = '';
// Default to the current year
if ($year == 0) {
$year = date('Y');
}
if ($month == 0) {
$month = date('m');
}
if ($day == 0) {
$day = date('d');
}
$cat = (int) $cat;
$cal = (int) $cal;
// Get all the dates in the year
$starting_date = date('Y-m-d', mktime(0, 0, 0, 1, 1, $year));
$ending_date = date('Y-m-d', mktime(0, 0, 0, 1, 1, $year + 1));
$calendarView = Date_Calc::getCalendarYear($year, '%Y-%m-%d');
$daynames = EVLIST_getDayNames(1);
$events = EVLIST_getEvents($starting_date, $ending_date, array('cat' => $cat, 'cal' => $cal));
// A date object to handle formatting
$dt = new Date('now', $_CONF['timezone']);
$T = new Template(EVLIST_PI_PATH . '/templates/yearview');
$tpl = 'yearview';
if ($opt == 'print') {
$tpl .= '_print';
} elseif ($_EV_CONF['cal_tmpl'] == 'json') {
$tpl .= '_json';
}
$T->set_file(array('yearview' => $tpl . '.thtml'));
$count = 0;
$T->set_block('yearview', 'month', 'mBlock');
foreach ($calendarView as $monthnum => $monthdata) {
$monthnum_str = sprintf("%02d", $monthnum + 1);
$count++;
if (($count - 1) % 4 == 0) {
$T->set_var('st_row', 'true');
} else {
$T->clear_var('st_row');
}
$M = new Template($_CONF['path'] . 'plugins/evlist/templates/yearview');
$M->set_file(array('smallmonth' => 'smallmonth.thtml'));
$M->set_var('thisyear', $year);
$M->set_var('month', $monthnum + 1);
$M->set_var('monthname', $LANG_MONTH[$monthnum + 1]);
$M->set_block('smallmonth', 'daynames', 'nBlock');
for ($i = 0; $i < 7; $i++) {
$M->set_var('dayname', $daynames[$i]);
$M->parse('nBlock', 'daynames', true);
}
$M->set_block('smallmonth', 'week', 'wBlock');
foreach ($monthdata as $weeknum => $weekdata) {
list($weekYear, $weekMonth, $weekDay) = explode('-', $weekdata[0]);
$M->set_var(array('weekyear' => $weekYear, 'weekmonth' => $weekMonth, 'weekday' => $weekDay, 'urlfilt_cat' => $cat, 'urlfilt_cal' => $cal));
$M->set_block('smallmonth', 'day', 'dBlock');
foreach ($weekdata as $daynum => $daydata) {
list($y, $m, $d) = explode('-', $daydata);
$M->clear_var('no_day_link');
if ($daydata == $_EV_CONF['_today']) {
$dayclass = 'today';
} elseif ($m == $monthnum_str) {
$dayclass = 'on';
} else {
$M->set_var('no_day_link', 'true');
$dayclass = 'off';
}
if (isset($events[$daydata])) {
// Create the mootip hover text
$popup = '';
$daylinkclass = $dayclass == 'off' ? 'nolink-events' : 'day-events';
foreach ($events[$daydata] as $event) {
// Separate events by a newline if more than one
if (!empty($popup)) {
if ($_SYSTEM['framework'] == 'uikit') {
// HTML break for UIkit tooltip
$popup .= '<br />';
}
$popup .= LB;
}
// Don't show a time for all-day events
if ($event['allday'] == 0) {
$dt->setTimestamp(strtotime($event['rp_date_start'] . ' ' . $event['rp_time_start1']));
// Time is a localized string, not a timestamp, so
// don't adjust for the timezone
$popup .= $dt->format($_CONF['timeonly'], false) . ': ';
}
//.........这里部分代码省略.........
示例12: ExportTickets
/**
* Export tickets to a CSV file for a single occurrence
*
* @param integer $rp_id Repeat ID
* @return string CSV file containing all tickets
*/
public static function ExportTickets($rp_id = '')
{
global $_CONF, $LANG_EVLIST;
$retval = '';
// get the tickets, paid and unpaid. Need event id and uid.
$tickets = self::GetTickets($ev_id, $rp_id, $uid);
USES_evlist_class_repeat();
USES_evlist_class_tickettype();
$Rp = new evRepeat($rp_id);
$header = array($LANG_EVLIST['ticket_num'], $LANG_EVLIST['rsvp_date'], $LANG_EVLIST['name'], $LANG_EVLIST['fee'], $LANG_EVLIST['paid'], $LANG_EVLIST['date_used'], $LANG_EVLIST['waitlisted']);
$retval .= '"' . implode('","', $header) . '"' . "\n";
//$tic_types = array();
$counter = 0;
$dt_tick = new Date('now', $_CONF['timezone']);
$dt_used = new Date('now', $_CONF['timezone']);
foreach ($tickets as $tic_id => $ticket) {
$counter++;
$dt_tick->setTimestamp($ticket->dt);
$dt_used->setTimestamp($ticket->used);
$values = array($tic_id, $dt_tick->toMySQL(), str_replace('"', "'", COM_getDisplayName($ticket->uid)), $ticket->fee, $ticket->paid, $ticket->used > $ticket->dt ? $dt_used->toMySQL() : '', $counter > $Rp->Event->options['max_rsvp'] ? 'Yes' : 'No');
$retval .= '"' . implode('","', $values) . '"' . "\n";
}
return $retval;
}
示例13: IN
$sql .= "WHERE (a.uid = " . (int) $showuser . ") AND b.grp_id IN ({$grouplist}) ";
$sql .= "ORDER BY a.date DESC LIMIT {$_FF_CONF['show_last_post_count']}";
$result = DB_query($sql);
$nrows = DB_numRows($result);
$displayrecs = 0;
for ($i = 1; $i <= $nrows; $i++) {
$P = DB_fetchArray($result);
$userlogtime = DB_getItem($_TABLES['ff_log'], "time", "uid=" . (int) $_USER['uid'] . " AND topic=" . (int) $P['id']);
if ($userlogtime == NULL or $P['lastupdated'] > $userlogtime) {
if ($_FF_CONF['use_censor']) {
$P['subject'] = COM_checkWords($P['subject']);
$P['comment'] = COM_checkWords($P['comment']);
}
$topic_id = $P['id'];
$displayrecs++;
$dt->setTimestamp($P['date']);
$firstdate = $dt->format($_FF_CONF['default_Datetime_format'], true);
$dt->setTimestamp($P['lastupdated']);
$lastdate = $dt->format($_FF_CONF['default_Datetime_format'], true);
if ($P['uid'] > 1) {
$topicinfo = "{$LANG_GF01['STARTEDBY']} " . COM_getDisplayName($P['uid']) . ', ';
} else {
$topicinfo = "{$LANG_GF01['STARTEDBY']} {$P['name']},";
}
$topicinfo .= "{$firstdate}<br/>{$LANG_GF01['VIEWS']}:{$P['views']}, {$LANG_GF01['REPLIES']}:{$P['replies']}<br/>";
if (empty($P['last_reply_rec']) || $P['last_reply_rec'] < 1) {
$lastid = $P['id'];
$testText = FF_formatTextBlock($P['comment'], 'text', 'text', $P['status']);
$testText = strip_tags($testText);
$html2txt = new html2text($testText, false);
$testText = trim($html2txt->get_text());
示例14: View
/**
* View the current order summary
*
* @param boolean $final Indicates that this order is final.
* @param string $tpl "print" for a printable template
* @return string HTML for order view
*/
public function View($final = false, $tpl = '')
{
global $_PP_CONF, $_USER, $LANG_PP, $LANG_ADMIN, $_TABLES, $_CONF, $_SYSTEM;
USES_paypal_class_product();
// canView should be handled by the caller
if (!$this->canView()) {
return '';
}
$T = new Template(PAYPAL_PI_PATH . '/templates');
if ($tpl == 'print') {
$tpltype = '.print';
} else {
$tpltype = $_SYSTEM['framework'] == 'uikit' ? '.uikit' : '';
}
$T->set_file('order', "order{$tpltype}.thtml");
$isAdmin = SEC_hasRights('paypal.admin') ? true : false;
foreach ($this->_addr_fields as $fldname) {
$T->set_var($fldname, $this->{$fldname});
}
$T->set_block('order', 'ItemRow', 'iRow');
// Get the workflows so we sho the relevant info.
if (!isset($_PP_CONF['workflows']) || !is_array($_PP_CONF['workflows'])) {
USES_paypal_class_workflow();
ppWorkflow::Load();
}
foreach ($_PP_CONF['workflows'] as $key => $value) {
$T->set_var('have_' . $value, 'true');
}
$this->no_shipping = 1;
// no shipping unless physical item ordered
$subtotal = 0;
foreach ($this->items as $key => $item) {
$P = new Product($item['product_id']);
$item_options = '';
$opt = json_decode($item['options_text'], true);
if ($opt) {
foreach ($opt as $opt_str) {
$item_options .= " -- {$opt_str}<br />\n";
}
}
$item_total = $item['price'] * $item['quantity'];
$subtotal += $item_total;
$T->set_var(array('item_id' => htmlspecialchars($item['product_id']), 'item_descrip' => htmlspecialchars($item['description']), 'item_price' => COM_numberFormat($item['price'], 2), 'item_quantity' => (int) $item['quantity'], 'item_total' => COM_numberFormat($item_total, 2), 'item_options' => $item_options, 'is_admin' => $isAdmin ? 'true' : '', 'is_file' => $P->file != '' ? 'true' : ''));
$T->parse('iRow', 'ItemRow', true);
if ($item['data']['prod_type'] == PP_PROD_PHYSICAL) {
$this->no_shipping = 0;
}
}
$dt = new Date($this->order_date, $_CONF['timezone']);
$total = $subtotal + $this->shipping + $this->handling + $this->tax;
$T->set_var(array('pi_url' => PAYPAL_URL, 'is_admin' => $isAdmin ? 'true' : '', 'pi_admin_url' => PAYPAL_ADMIN_URL, 'total' => sprintf('%6.2f', $total), 'not_final' => $final ? '' : 'true', 'order_date' => $dt->format($_PP_CONF['datetime_fmt'], true), 'order_date_tip' => $dt->format($_PP_CONF['datetime_fmt'], false), 'order_number' => $this->order_id, 'shipping' => COM_numberFormat($this->shipping, 2), 'handling' => COM_numberFormat($this->handling, 2), 'tax' => COM_numberFormat($this->tax, 2), 'subtotal' => COM_numberFormat($subtotal, 2), 'have_billto' => 'true', 'have_shipto' => 'true', 'order_instr' => htmlspecialchars($this->instructions), 'shop_name' => $_PP_CONF['shop_name'], 'shop_addr' => $_PP_CONF['shop_addr']));
if ($isAdmin) {
USES_paypal_class_orderstatus();
$T->set_var(array('purch_name' => COM_getDisplayName($this->uid), 'purch_uid' => $this->uid, 'stat_update' => ppOrderStatus::Selection($this->order_id, 1, $this->status), 'status' => $this->status));
$sql = "SELECT * FROM {$_TABLES['paypal.order_log']} WHERE order_id = '" . DB_escapeString($this->order_id) . "'";
$res = DB_query($sql);
$T->set_block('order', 'LogMessages', 'Log');
while ($L = DB_fetchArray($res, false)) {
$dt->setTimestamp(strtotime($L['ts']));
$T->set_var(array('log_username' => $L['username'], 'log_msg' => $L['message'], 'log_ts' => $dt->format($_PP_CONF['datetime_fmt'], true), 'log_ts_tip' => $dt->format($_PP_CONF['datetime_fmt'], false)));
$T->parse('Log', 'LogMessages', true);
}
}
$status = $this->status;
if ($this->pmt_method != '') {
//if ($status & PP_STATUS_PAID) {
if (USES_paypal_gateway($this->pmt_method)) {
$gw = new $this->pmt_method();
$pmt_method = $gw->Description();
} else {
$pmt_method = $this->pmt_method;
}
$T->set_var(array('pmt_method' => $pmt_method, 'pmt_txn_id' => $this->pmt_txn_id));
}
$T->parse('output', 'order');
$form = $T->finish($T->get_var('output'));
return $form;
}
示例15: PAYPAL_getPurchaseHistoryField
/**
* Get an individual field for the history screen.
*
* @param string $fieldname Name of field (from the array, not the db)
* @param mixed $fieldvalue Value of the field
* @param array $A Array of all fields from the database
* @param array $icon_arr System icon array (not used)
* @param object $EntryList This entry list object
* @return string HTML for field display in the table
*/
function PAYPAL_getPurchaseHistoryField($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF, $_PP_CONF, $LANG_PP, $_USER;
static $dt = NULL;
if ($dt === NULL) {
$dt = new Date('now', $_USER['tzid']);
}
$retval = '';
switch ($fieldname) {
case 'order_date':
$dt->setTimestamp(strtotime($fieldvalue));
$retval = '<span title="' . $dt->format($_PP_CONF['datetime_fmt'], false) . '">' . $dt->format($_PP_CONF['datetime_fmt'], true) . '</span>';
break;
case 'name':
list($item_id, $item_opts) = PAYPAL_explode_opts($A['product_id']);
if (is_numeric($item_id)) {
// One of our catalog items, so link to it
$retval = COM_createLink($fieldvalue, PAYPAL_URL . '/index.php?detail=x&id=' . $item_id);
} else {
// Probably came from a plugin, just show the product name
$retval = htmlspecialchars($A['product_id'], ENT_QUOTES, COM_getEncodingt());
}
break;
case 'username':
if ($A['isAdmin']) {
$retval = COM_createLink($fieldvalue, PAYPAL_ADMIN_URL . '/index.php?orderhist=x&uid=' . $A['uid']);
} else {
$retval = COM_createLink($fieldvalue, $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']);
}
break;
case 'quantity':
$retval = '<div class="alignright">' . $fieldvalue . "</div>";
break;
case 'txn_id':
$base_url = $A['isAdmin'] ? PAYPAL_ADMIN_URL : PAYPAL_URL;
// Admins get a link to the transaction log, regular users just
// get the ID to check against their Paypal account.
if ($A['isAdmin'] == 1) {
$retval = COM_createLink($fieldvalue, $base_url . '/index.php?ipnlog=x&op=single&txn_id=' . $fieldvalue);
} else {
$retval = $fieldvalue;
}
break;
case 'prod_type':
// Return the plain-language product type description
//$retval = $LANG_PP['prod_types'][$fieldvalue];
$retval = $LANG_PP['prod_types'][$A['prod_type']];
//if ($fieldvalue == PP_PROD_DOWNLOAD && $A['exptime'] > time() ) {
if ($A['file'] != '' && $A['exptime'] > time()) {
$retval = COM_createLink($retval, PAYPAL_URL . "/download.php?id={$A['product_id']}");
}
break;
case 'short_description':
// If this is a plugin item, there should be a description recorded
// in the purchase file. If not, just take it from the product
// table.
if (!empty($A['description'])) {
$retval = $A['description'];
} else {
$retval = $fieldvalue;
}
break;
case 'status':
if ($A['isAdmin'] && is_array($LANG_PP['orderstatus'])) {
$retval = ppOrderStatus::Selection($A['order_id'], 0, $fieldvalue);
} elseif (isset($LANG_PP['orderstatus'][$fieldvalue])) {
$retval = $LANG_PP['orderstatus'][$fieldvalue];
} else {
$retval = 'Unknown';
}
break;
case 'order_id':
$base_url = $A['isAdmin'] ? PAYPAL_ADMIN_URL : PAYPAL_URL;
$retval = COM_createLink($fieldvalue, $base_url . '/index.php?order=' . $fieldvalue, array('data-uk-tooltip' => '', 'title' => 'View', 'class' => 'gl_mootip'));
$retval .= ' <a href="' . PAYPAL_URL . '/index.php?printorder=' . $fieldvalue . '" target="_blank" class="uk-icon-mini uk-icon-print gl_mootip"
title="Print" data-uk-tooltip>';
if (!$_PP_CONF['_is_uikit']) {
$retval .= '(print)';
}
$retval .= '</a>';
break;
default:
$retval = htmlspecialchars($fieldvalue, ENT_QUOTES, COM_getEncodingt());
break;
}
return $retval;
}