本文整理汇总了PHP中COM_getUserDateTimeFormat函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_getUserDateTimeFormat函数的具体用法?PHP COM_getUserDateTimeFormat怎么用?PHP COM_getUserDateTimeFormat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_getUserDateTimeFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adduserevent
/**
* Adds an event to the user's calendar
*
* The user has asked that an event be added to their personal
* calendar. Show a confirmation screen.
*
* @param string $eid event ID to add to user's calendar
* @return string HTML for confirmation form
*
*/
function adduserevent($eid)
{
global $_CONF, $_TABLES, $LANG_CALJP_1;
$retval = '';
$eventsql = "SELECT * FROM {$_TABLES['eventsjp']} WHERE eid='{$eid}'" . COM_getPermSql('AND');
$result = DB_query($eventsql);
$nrows = DB_numRows($result);
if ($nrows == 1) {
$retval .= COM_startBlock(sprintf($LANG_CALJP_1[11], COM_getDisplayName()));
$A = DB_fetchArray($result);
$cal_template = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates/');
$cal_template->set_file(array('addevent' => 'addevent.thtml'));
$cal_template->set_var('intro_msg', $LANG_CALJP_1[8]);
$cal_template->set_var('lang_event', $LANG_CALJP_1[12]);
$event_title = stripslashes($A['title']);
if (!empty($A['url']) && $A['url'] != 'http://') {
$event_title_and_url = COM_createLink($event_title, $A['url'], array('class' => 'url'));
$cal_template->set_var('event_url', $A['url']);
$cal_template->set_var('event_begin_anchortag', '<a href="' . $A['url'] . '" class="url">');
$cal_template->set_var('event_end_anchortag', '</a>');
} else {
$event_title_and_url = $event_title;
$cal_template->set_var('event_url', '');
$cal_template->set_var('event_begin_anchortag', '');
$cal_template->set_var('event_end_anchortag', '');
}
$cal_template->set_var('event_title', $event_title_and_url);
$cal_template->set_var('event_title_only', $event_title);
$cal_template->set_var('lang_starts', $LANG_CALJP_1[13]);
$cal_template->set_var('lang_ends', $LANG_CALJP_1[14]);
$thestart = COM_getUserDateTimeFormat($A['datestart'] . ' ' . $A['timestart']);
$theend = COM_getUserDateTimeFormat($A['dateend'] . ' ' . $A['timeend']);
if ($A['allday'] == 0) {
$cal_template->set_var('event_start', $thestart[0]);
$cal_template->set_var('event_end', $theend[0]);
} else {
$cal_template->set_var('event_start', strftime($_CONF['shortdate'], $thestart[1]));
$cal_template->set_var('event_end', strftime($_CONF['shortdate'], $theend[1]));
}
$cal_template->set_var('lang_where', $LANG_CALJP_1[4]);
$location = stripslashes($A['location']) . '<br' . XHTML . '>' . stripslashes($A['address1']) . '<br' . XHTML . '>' . stripslashes($A['address2']) . '<br' . XHTML . '>' . stripslashes($A['city']) . ', ' . stripslashes($A['state']) . ' ' . $A['zipcode'];
$cal_template->set_var('event_location', $location);
$cal_template->set_var('lang_description', $LANG_CALJP_1[5]);
$description = stripslashes($A['description']);
if (empty($A['postmode']) || $A['postmode'] == 'plaintext') {
$description = COM_nl2br($description);
}
$cal_template->set_var('event_description', PLG_replaceTags($description));
$cal_template->set_var('event_id', $eid);
$cal_template->set_var('lang_addtomycalendar', $LANG_CALJP_1[9]);
$cal_template->set_var('gltoken_name', CSRF_TOKEN);
$cal_template->set_var('gltoken', SEC_createToken());
$cal_template->parse('output', 'addevent');
$retval .= $cal_template->finish($cal_template->get_var('output'));
$retval .= COM_endBlock();
} else {
$retval .= COM_showMessage(23);
}
return $retval;
}
示例2: HELLO_getListField_hello
function HELLO_getListField_hello($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF;
switch ($fieldname) {
case 'see_hello':
$retval = '';
$retval .= COM_createLink($icon_arr['list'], "{$_CONF['site_admin_url']}/plugins/hello/read_email.php?mode=edit&hello_id={$A['hello_id']}");
break;
case 'creation':
$creation = COM_getUserDateTimeFormat(strtotime($A['creation']));
$retval .= $creation[0];
break;
default:
$retval = stripslashes($fieldvalue);
break;
}
return $retval;
}
示例3: phpblock_shoutblock
function phpblock_shoutblock()
{
global $_TABLES, $_USER, $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $PHP_SELF, $REMOTE_ADDR, $LANG01, $_CONF;
$shout_out = "";
$wrap_width = 20;
$max_stories = 5;
$welcome = "Welcome to shoutbox.<p>";
$shout_out .= $welcome;
if ($HTTP_POST_VARS["shout_submit"]) {
$shout_name = addslashes(COM_checkWords(strip_tags($HTTP_POST_VARS["shout_name"])));
$shout_message = addslashes(COM_checkWords(strip_tags($HTTP_POST_VARS["shout_message"])));
$result = DB_query("INSERT INTO shoutbox (name,message,time)" . "VALUES (\"{$shout_name}\", \"{$shout_message}\",now() )");
}
$count = DB_query("select count(*) as count from shoutbox");
$A = DB_fetchArray($count);
$shout_out .= '<b>' . $A['count'] . '</b> shouts already<p>';
$result = DB_query("select * from shoutbox order by id desc limit {$max_stories}");
$nrows = DB_numrows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$shout_out .= '<b>' . $A['name'] . '</b>';
$thetime = COM_getUserDateTimeFormat($A['time']);
$shout_time = $thetime[0];
$shout_out .= '<i> on ' . $shout_time . '</i><br>';
$shout_out .= wordwrap($A['message'], $wrap_width, "<br>", 1) . '<br><br>';
}
$shout_out .= "\n<form name='shoutform' action='{$PHP_SELF}' method='post'>";
if (!empty($_USER['uid'])) {
$shout_out .= '<b>Name: ' . $_USER['username'] . '</b><br>';
$shout_out .= '<input type="hidden" value="' . $_USER['username'] . '"';
} else {
$shout_out .= '<b>Name: Anonymous</b><br>';
$shout_out .= '<input type="hidden" value="Anonymous"';
}
$shout_out .= ' name="shout_name"><b>Message:</b>';
$shout_out .= "\n<input type='text' value='Your Message' name='shout_message' size=20 maxlength='100'><br>";
$shout_out .= "\n<input type='submit' name='shout_submit' value='Shout it!'>";
$shout_out .= "\n</form>";
return $shout_out;
}
示例4: searchFormatCallback
/**
* Callback function for the ListFactory class
*
* This function gets called by the ListFactory class and formats
* each row accordingly for example pulling usernames from the
* users table and displaying a link to their profile.
*
* @param array $row An array of plain data to format
* @return array A reformatted version of the input array
*
*/
public function searchFormatCallback($preSort, $row)
{
global $_CONF, $LANG09;
if ($preSort) {
if (is_array($row[LF_SOURCE_TITLE])) {
$row[LF_SOURCE_TITLE] = implode($_CONF['search_separator'], $row[LF_SOURCE_TITLE]);
}
if (is_numeric($row['uid'])) {
if (empty($this->_names[$row['uid']])) {
$this->_names[$row['uid']] = htmlspecialchars(COM_getDisplayName($row['uid']));
if ($row['uid'] != 1) {
$this->_names[$row['uid']] = COM_createLink($this->_names[$row['uid']], $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $row['uid']);
}
}
$row['uid'] = $this->_names[$row['uid']];
}
} else {
$row[LF_SOURCE_TITLE] = COM_createLink($row[LF_SOURCE_TITLE], $this->_searchURL . '&type=' . $row[LF_SOURCE_NAME] . '&mode=search');
if ($row['url'] != '#') {
$row['url'] = ($row['url'][0] == '/' ? $_CONF['site_url'] : '') . $row['url'];
if (isset($this->_url_rewrite[$row[LF_SOURCE_NAME]]) && $this->_url_rewrite[$row[LF_SOURCE_NAME]]) {
$row['url'] = COM_buildUrl($row['url']);
}
if (isset($this->_append_query[$row[LF_SOURCE_NAME]]) && $this->_append_query[$row[LF_SOURCE_NAME]]) {
if (!empty($this->_query)) {
$row['url'] .= (strpos($row['url'], '?') ? '&' : '?') . 'query=' . urlencode($this->_query);
}
}
}
$row['title'] = $this->_shortenText($this->_query, $row['title'], 8);
$row['title'] = stripslashes(str_replace('$', '$', $row['title']));
$row['title'] = COM_createLink($row['title'], $row['url']);
if ($row['description'] == 'LF_NULL') {
$row['description'] = '<i>' . $LANG09[70] . '</i>';
} elseif ($row['description'] != '<i>' . $LANG09[70] . '</i>') {
$row['description'] = stripslashes($this->_shortenText($this->_query, PLG_replaceTags($row['description']), $this->_wordlength));
}
if ($row['date'] != 'LF_NULL') {
$dt = COM_getUserDateTimeFormat(intval($row['date']));
$row['date'] = $dt[0];
}
if ($row['hits'] != 'LF_NULL') {
$row['hits'] = COM_NumberFormat($row['hits']) . ' ';
// simple solution to a silly problem!
}
}
return $row;
}
示例5: DB_fetchArray
$csscode = 1;
for ($i = 1; $i <= $nrows; $i++) {
$P = DB_fetchArray($result);
$fres = DB_query("SELECT grp_id,rating_view FROM {$_TABLES['ff_forums']} WHERE forum_id=" . (int) $P['forum']);
list($forumgrpid, $view_rating) = DB_fetchArray($fres);
$groupname = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id=" . (int) $forumgrpid);
if (SEC_inGroup($groupname)) {
if ($_FF_CONF['enable_user_rating_system'] && !COM_isAnonUser()) {
if ($view_rating > $user_rating) {
continue;
}
}
if ($_FF_CONF['use_censor']) {
$P['subject'] = COM_checkWords($P['subject']);
}
$postdate = COM_getUserDateTimeFormat($P['date']);
$link = '<a href="' . $_CONF['site_url'] . '/forum/viewtopic.php?forum=' . $P['forum'] . '&showtopic=' . $P['id'] . '&highlight=' . htmlentities($html_query, ENT_QUOTES, COM_getEncodingt()) . '">';
$report->set_var(array('post_start_ahref' => $link, 'post_subject' => $P['subject'], 'post_end_ahref' => '</a>', 'post_date' => $postdate[0], 'post_replies' => $P['replies'], 'post_views' => $P['views'], 'csscode' => $csscode));
$report->parse('rrow', 'reportrow', true);
if ($csscode == 2) {
$csscode = 1;
} else {
$csscode++;
}
}
}
}
if ($forum == 0) {
$link = '<p><a href="' . $_CONF['site_url'] . '/forum/index.php">' . $LANG_GF02['msg175'] . '</a></p>';
$report->set_var('bottomlink', $link);
} else {
示例6: userprofile
/**
* Shows a profile for a user
*
* This grabs the user profile for a given user and displays it
*
* @return string HTML for user profile page
*
*/
function userprofile()
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG04, $LANG09, $LANG28, $LANG_LOGIN;
// @param int $user User ID of profile to get
// @param int $msg Message to display (if != 0)
// @param string $plugin optional plugin name for message
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['profileloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
return $retval;
}
if (isset($_GET['uid'])) {
$user = COM_applyFilter($_GET['uid'], true);
if (!is_numeric($user) || $user < 2) {
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
} else {
if (isset($_GET['username'])) {
$username = $_GET['username'];
if (!USER_validateUsername($username, 1)) {
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
if (empty($username) || $username == '') {
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
$username = DB_escapeString($username);
$user = DB_getItem($_TABLES['users'], 'uid', "username = '{$username}'");
if ($user < 2) {
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
} else {
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
}
$msg = 0;
if (isset($_GET['msg'])) {
$msg = COM_applyFilter($_GET['msg'], true);
}
$plugin = '';
if ($msg > 0 && isset($_GET['plugin'])) {
$plugin = COM_applyFilter($_GET['plugin']);
}
$result = DB_query("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,lastlogin,homepage,about,location,pgpkey,photo,email,status,emailfromadmin,emailfromuser,showonline FROM {$_TABLES['userinfo']},{$_TABLES['userprefs']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['userinfo']}.uid = {$_TABLES['userprefs']}.uid AND {$_TABLES['users']}.uid = " . (int) $user);
$nrows = DB_numRows($result);
if ($nrows == 0) {
// no such user
echo COM_refresh($_CONF['site_url'] . '/index.php');
}
$A = DB_fetchArray($result);
if ($A['status'] == USER_ACCOUNT_DISABLED && !SEC_hasRights('user.edit')) {
COM_displayMessageAndAbort(30, '', 403, 'Forbidden');
}
$display_name = @htmlspecialchars(COM_getDisplayName($user, $A['username'], $A['fullname']), ENT_COMPAT, COM_getEncodingt());
if ($msg > 0) {
$retval .= COM_showMessage($msg, $plugin, '', 0, 'info');
}
// format date/time to user preference
$curtime = COM_getUserDateTimeFormat($A['regdate']);
$A['regdate'] = $curtime[0];
$user_templates = new Template($_CONF['path_layout'] . 'users');
$user_templates->set_file(array('profile' => 'profile.thtml', 'email' => 'email.thtml', 'row' => 'commentrow.thtml', 'strow' => 'storyrow.thtml'));
$user_templates->set_var('layout_url', $_CONF['layout_url']);
$user_templates->set_var('start_block_userprofile', COM_startBlock($LANG04[1] . ' ' . $display_name));
$user_templates->set_var('end_block', COM_endBlock());
$user_templates->set_var('lang_username', $LANG04[2]);
$user_templates->set_var('tooltip', COM_getTooltipStyle());
if ($_CONF['show_fullname'] == 1) {
if (empty($A['fullname'])) {
$username = $A['username'];
$fullname = '';
} else {
$username = $A['fullname'];
$fullname = $A['username'];
}
} else {
$username = $A['username'];
$fullname = '';
}
$username = @htmlspecialchars($username, ENT_COMPAT, COM_getEncodingt());
$fullname = @htmlspecialchars($fullname, ENT_COMPAT, COM_getEncodingt());
if ($A['status'] == USER_ACCOUNT_DISABLED) {
$username = sprintf('%s - %s', $username, $LANG28[42]);
if (!empty($fullname)) {
$fullname = sprintf('% - %s', $fullname, $LANG28[42]);
}
}
$user_templates->set_var('username', $username);
$user_templates->set_var('user_fullname', $fullname);
if (SEC_hasRights('user.edit') || isset($_USER['uid']) && $_USER['uid'] == $A['uid']) {
global $_IMAGE_TYPE, $LANG_ADMIN;
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG_ADMIN['edit'] . '" title="' . $LANG_ADMIN['edit'] . '" />';
if ($_USER['uid'] == $A['uid']) {
//.........这里部分代码省略.........
示例7: CLASSIFIEDS_getAdForm
/**
* This function creates an Ad Form
*
* Creates an Form for an Ad using the supplied defaults (if specified).
*
* @param array $ad array of values describing an Ad
* @return string HTML string of Ad form
*/
function CLASSIFIEDS_getAdForm($ad = array(), $copy = false)
{
global $_CONF, $_CLASSIFIEDS_CONF, $LANG_CLASSIFIEDS_2, $LANG_CLASSIFIEDS_ADMIN, $_TABLES, $LANG24, $LANG_ADMIN, $_USER;
if ($_USER['uid'] < 2) {
return CLASSIFIEDS_loginRequiredForm();
}
if (!SEC_hasRights('classifieds.publish')) {
//Give publish rights to logged-in users if there is no group with this feature
$ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'classifieds.publish'");
$grp_id = DB_getItem($_TABLES['access'], 'acc_grp_id', "acc_ft_id = {$ft_id}");
//COM_errorLog('Classifieds feature: ' . $ft_id . ' | Group: ' . $grp_id );
if ($grp_id == '') {
// Give access
} else {
// Display message
return $LANG_CLASSIFIEDS_2['access_reserved'] . ' <strong>"' . DB_getItem($_TABLES['groups'], 'grp_name', "grp_id = {$grp_id}") . '"</strong>';
}
}
$active = true;
if ($ad != '') {
$created = COM_getUserDateTimeFormat($A['created']);
$active_days = (time() - $created['1']) / (24 * 3600);
if ($active_days > $_CLASSIFIEDS_CONF['active_days']) {
$active = false;
}
if ((SEC_hasAccess2($ad) != 3 || $ad['deleted'] == 1 || $active == false) && !SEC_hasRights('classifieds.admin')) {
echo COM_refresh($_CLASSIFIEDS_CONF['site_url'] . "/index.php?error=0");
exit;
}
}
//Display form
$ad['clid'] == '' ? $retval = COM_startBlock($LANG_CLASSIFIEDS_2['insert_new_ad']) : ($retval = COM_startBlock($LANG_CLASSIFIEDS_2['edit_label'] . ' ' . $ad['title']));
$template = new Template($_CONF['path'] . 'plugins/classifieds/templates');
$template->set_file(array('ad' => 'ad_form.thtml'));
$template->set_var('site_url', $_CLASSIFIEDS_CONF['site_url']);
$template->set_var('xhtml', XHTML);
$template->set_var('gltoken_name', CSRF_TOKEN);
$template->set_var('gltoken', SEC_createToken());
if (is_numeric($ad['clid'])) {
$template->set_var('clid', '<input type="hidden" name="clid" value="' . $ad['clid'] . '" />');
} else {
$template->set_var('clid', '');
}
//Your Ad
$template->set_var('your_ad', $LANG_CLASSIFIEDS_2['your_ad']);
//category
$categories = '';
$template->set_var('category_label', $LANG_CLASSIFIEDS_2['category']);
$categories .= '<option value="0">' . $LANG_CLASSIFIEDS_2['choose_category'] . '</option>';
$categories .= CLASSIFIEDS_adOptionList($_TABLES['cl_cat'], 'cid,category,pid', $ad['catid'], 'catorder', "catdeleted=0");
$template->set_var('categories', $categories);
//type
$template->set_var('type_label', $LANG_CLASSIFIEDS_2['type']);
if ($ad['type'] == '1') {
$template->set_var('type_d', ' selected');
$template->set_var('type_o', '');
} elseif ($ad['type'] == '0') {
$template->set_var('type_d', '');
$template->set_var('type_o', ' selected');
} else {
$template->set_var('type_d', '');
$template->set_var('type_o', '');
}
$choosetype = '<option value="-1">' . $LANG_CLASSIFIEDS_2['choose_type'] . '</option>';
$template->set_var('choose_type', $choosetype);
$template->set_var('offer', $LANG_CLASSIFIEDS_2['offer']);
$template->set_var('demand', $LANG_CLASSIFIEDS_2['demand']);
//title
$template->set_var('title_label', $LANG_CLASSIFIEDS_2['title']);
$template->set_var('title', $ad['title']);
$template->set_var('currency', $_CLASSIFIEDS_CONF['currency']);
//text
$template->set_var('text_label', $LANG_CLASSIFIEDS_2['text']);
$template->set_var('text', $ad['text']);
//Price
$template->set_var('price_label', $LANG_CLASSIFIEDS_2['price']);
$template->set_var('price', number_format(floatval($ad['price']), $_CONF['decimal_count']));
//images
$template->set_var('images', $LANG_CLASSIFIEDS_2['images']);
$fileinputs = '';
$saved_images = '';
if ($_CLASSIFIEDS_CONF['max_images_per_ad'] > 0) {
if ($ad['clid'] != '') {
$icount = DB_count($_TABLES['cl_pic'], 'pi_pid', $ad['clid']);
if ($icount > 0) {
$result_pics = DB_query("SELECT * FROM {$_TABLES['cl_pic']} WHERE pi_pid = '" . $ad['clid'] . "'");
for ($z = 1; $z <= $icount; $z++) {
$I = DB_fetchArray($result_pics);
$saved_images .= '<div><p>' . $z . ') ' . '<a class="lightbox" href="' . $_CLASSIFIEDS_CONF['site_url'] . '/timthumb.php?src=' . $_CLASSIFIEDS_CONF['url_images'] . $I['pi_filename'] . '&w=640"><img src="' . $_CLASSIFIEDS_CONF['site_url'] . '/timthumb.php?src=' . $_CLASSIFIEDS_CONF['url_images'] . $I['pi_filename'] . '&w=' . $size . '&h=' . $size . '" align="top" alt="' . $A['title'] . '" /></a>' . ' ' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['pi_img_num'] . ']"' . XHTML . '><br' . XHTML . '></p></div>';
}
}
}
//.........这里部分代码省略.........
示例8: userprofile
/**
* Shows a profile for a user
*
* This grabs the user profile for a given user and displays it
*
* @param int $user User ID of profile to get
* @param int $msg Message to display (if != 0)
* @return string HTML for user profile page
*
*/
function userprofile($user, $msg = 0)
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG04, $LANG09, $LANG_LOGIN;
$retval = '';
if (empty($_USER['username']) && ($_CONF['loginrequired'] == 1 || $_CONF['profileloginrequired'] == 1)) {
$retval .= COM_siteHeader('menu');
$retval .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
$login->set_file(array('login' => 'submitloginrequired.thtml'));
$login->set_var('xhtml', XHTML);
$login->set_var('login_message', $LANG_LOGIN[2]);
$login->set_var('site_url', $_CONF['site_url']);
$login->set_var('site_admin_url', $_CONF['site_admin_url']);
$login->set_var('layout_url', $_CONF['layout_url']);
$login->set_var('lang_login', $LANG_LOGIN[3]);
$login->set_var('lang_newuser', $LANG_LOGIN[4]);
$login->parse('output', 'login');
$retval .= $login->finish($login->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
$retval .= COM_siteFooter();
return $retval;
}
$result = DB_query("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,homepage,about,location,pgpkey,photo,email FROM {$_TABLES['userinfo']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['users']}.uid = {$user}");
$nrows = DB_numRows($result);
if ($nrows == 0) {
// no such user
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$A = DB_fetchArray($result);
$display_name = COM_getDisplayName($user, $A['username'], $A['fullname']);
// format date/time to user preference
$curtime = COM_getUserDateTimeFormat($A['regdate']);
$A['regdate'] = $curtime[0];
$user_templates = new Template($_CONF['path_layout'] . 'users');
$user_templates->set_file(array('profile' => 'profile.thtml', 'row' => 'commentrow.thtml', 'strow' => 'storyrow.thtml'));
$user_templates->set_var('xhtml', XHTML);
$user_templates->set_var('site_url', $_CONF['site_url']);
$user_templates->set_var('start_block_userprofile', COM_startBlock($LANG04[1] . ' ' . $display_name));
$user_templates->set_var('end_block', COM_endBlock());
$user_templates->set_var('lang_username', $LANG04[2]);
if ($_CONF['show_fullname'] == 1) {
$user_templates->set_var('username', $A['fullname']);
$user_templates->set_var('user_fullname', $A['username']);
} else {
$user_templates->set_var('username', $A['username']);
$user_templates->set_var('user_fullname', $A['fullname']);
}
if (SEC_hasRights('user.edit')) {
global $_IMAGE_TYPE, $LANG_ADMIN;
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG_ADMIN['edit'] . '" title="' . $LANG_ADMIN['edit'] . '"' . XHTML . '>';
$edit_link_url = COM_createLink($edit_icon, "{$_CONF['site_admin_url']}/user.php?mode=edit&uid={$A['uid']}");
$user_templates->set_var('edit_link', $edit_link_url);
}
$photo = USER_getPhoto($user, $A['photo'], $A['email'], -1);
$user_templates->set_var('user_photo', $photo);
$user_templates->set_var('lang_membersince', $LANG04[67]);
$user_templates->set_var('user_regdate', $A['regdate']);
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('user_id', $user);
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->set_var('lang_homepage', $LANG04[6]);
$user_templates->set_var('user_homepage', COM_killJS($A['homepage']));
$user_templates->set_var('lang_location', $LANG04[106]);
$user_templates->set_var('user_location', strip_tags($A['location']));
$user_templates->set_var('lang_bio', $LANG04[7]);
$user_templates->set_var('user_bio', nl2br(stripslashes($A['about'])));
$user_templates->set_var('lang_pgpkey', $LANG04[8]);
$user_templates->set_var('user_pgp', nl2br($A['pgpkey']));
$user_templates->set_var('start_block_last10stories', COM_startBlock($LANG04[82] . ' ' . $display_name));
$user_templates->set_var('start_block_last10comments', COM_startBlock($LANG04[10] . ' ' . $display_name));
$user_templates->set_var('start_block_postingstats', COM_startBlock($LANG04[83] . ' ' . $display_name));
$user_templates->set_var('lang_title', $LANG09[16]);
$user_templates->set_var('lang_date', $LANG09[17]);
// for alternative layouts: use these as headlines instead of block titles
$user_templates->set_var('headline_last10stories', $LANG04[82]);
$user_templates->set_var('headline_last10comments', $LANG04[10]);
$user_templates->set_var('headline_postingstats', $LANG04[83]);
$result = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
$nrows = DB_numRows($result);
$tids = array();
for ($i = 0; $i < $nrows; $i++) {
$T = DB_fetchArray($result);
$tids[] = $T['tid'];
}
$topics = "'" . implode("','", $tids) . "'";
// list of last 10 stories by this user
if (count($tids) > 0) {
$sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = {$user}) AND (draft_flag = 0) AND (date <= NOW()) AND (tid IN ({$topics}))" . COM_getPermSQL('AND');
$sql .= " ORDER BY unixdate DESC LIMIT 10";
$result = DB_query($sql);
//.........这里部分代码省略.........
示例9: USER_sendReminders
/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return string HTML with success or error message
*
*/
function USER_sendReminders()
{
global $_CONF, $_TABLES, $LANG04, $LANG28;
$msg = '';
$user_list = array();
if (isset($_POST['delitem'])) {
$user_list = $_POST['delitem'];
}
$nusers = count($user_list);
if (count($user_list) == 0) {
$msg = $LANG28[79] . '<br/>';
} else {
$c = 0;
if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
foreach ($_POST['delitem'] as $delitem) {
$uid = COM_applyFilter($delitem);
$useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$uid}'");
$username = DB_getItem($_TABLES['users'], 'username', "uid = '{$uid}'");
$lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$uid}'");
$lasttime = COM_getUserDateTimeFormat($lastlogin);
if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
$template = new Template($_CONF['path_data']);
$template->set_file(array('mail' => 'reminder_email.txt'));
$template->set_var('site_url', $_CONF['site_url']);
$template->set_var('site_name', $_CONF['site_name']);
$template->set_var('site_slogan', $_CONF['site_slogan']);
$template->set_var('lang_username', $LANG04[2]);
$template->set_var('username', $username);
$template->set_var('name', COM_getDisplayName($uid));
$template->set_var('lastlogin', $lasttime[0]);
$template->parse('output', 'mail');
$mailtext = $template->get_var('output');
} else {
if ($lastlogin == 0) {
$mailtext = $LANG28[83] . "\n\n";
} else {
$mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
}
$mailtext .= sprintf($LANG28[84], $username) . "\n";
$mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
}
$subject = sprintf($LANG28[81], $_CONF['site_name']);
if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
$mailfrom = $_CONF['noreply_mail'];
global $LANG_LOGIN;
$mailtext .= LB . LB . $LANG04[159];
} else {
$mailfrom = $_CONF['site_mail'];
}
$to = array();
$to = COM_formatEmailAddress($username, $useremail);
$from = array();
$from = COM_formatEmailAddress('', $mailfrom);
if (COM_mail($to, $subject, $mailtext, $from)) {
DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$uid}");
$c++;
} else {
COM_errorLog("Error attempting to send account reminder to user: {$username} ({$uid})");
}
}
}
COM_numberFormat($c);
// just in case we have more than 999)..
$msg .= "{$LANG28[80]}: {$c}<br/>\n";
}
return $msg;
}
示例10: fncEdit
//.........这里部分代码省略.........
$sql .= "," . $_TABLES['USERBOX_def_fieldset'] . " AS t2 " . LB;
$sql .= " WHERE ";
$sql .= " t.id = {$id}";
$sql .= " AND t.id = t1.uid";
$sql .= " AND t.fieldset_id = t2.fieldset_id" . LB;
$result = DB_query($sql);
$A = DB_fetchArray($result);
$fieldset_id = COM_stripslashes($A['fieldset_id']);
$fieldset_name = COM_stripslashes($A['fieldset_name']);
$code = COM_stripslashes($A['code']);
//@@@@@
$title = COM_stripslashes($A['title']);
//@@@@@
$username = COM_stripslashes($A['username']);
//@@@@@
$fullname = COM_stripslashes($A['fullname']);
//@@@@@
$page_title = COM_stripslashes($A['page_title']);
$description = COM_stripslashes($A['description']);
$defaulttemplatesdirectory = COM_stripslashes($A['defaulttemplatesdirectory']);
$hits = COM_stripslashes($A['hits']);
$comments = COM_stripslashes($A['comments']);
$comment_expire = COM_stripslashes($A['comment_expire']);
if ($comment_expire === "0000-00-00 00:00:00") {
$comment_expire_flag = 0;
$w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
$comment_expire_year = date('Y', $w);
$comment_expire_month = date('m', $w);
$comment_expire_day = date('d', $w);
$comment_expire_hour = 0;
$comment_expire_minute = 0;
} else {
$comment_expire_flag = 1;
$wary = COM_getUserDateTimeFormat(COM_stripslashes($A['comment_expire_un']));
$comment_expire = $wary[1];
$comment_expire_year = date('Y', $comment_expire);
$comment_expire_month = date('m', $comment_expire);
$comment_expire_day = date('d', $comment_expire);
$comment_expire_hour = date('H', $comment_expire);
$comment_expire_minute = date('i', $comment_expire);
}
$commentcode = COM_stripslashes($A['commentcode']);
$trackbackcode = COM_stripslashes($A['trackbackcode']);
$cache_time = COM_stripslashes($A['cache_time']);
$meta_description = COM_stripslashes($A['meta_description']);
$meta_keywords = COM_stripslashes($A['meta_keywords']);
$language_id = COM_stripslashes($A['language_id']);
$owner_id = COM_stripslashes($A['owner_id']);
$group_id = COM_stripslashes($A['group_id']);
$perm_owner = COM_stripslashes($A['perm_owner']);
$perm_group = COM_stripslashes($A['perm_group']);
$perm_members = COM_stripslashes($A['perm_members']);
$perm_anon = COM_stripslashes($A['perm_anon']);
$category = DATABOX_getdatas("category_id", $_TABLES['USERBOX_category'], "id = {$id}");
$additionfields = DATABOX_getadditiondatas($id, $pi_name);
$additionfields_fnm = array();
//@@@@@
$additionfields_del = array();
$additionfields_date = "";
$draft_flag = COM_stripslashes($A['draft_flag']);
//編集日
$wary = COM_getUserDateTimeFormat(COM_stripslashes($A['modified_un']));
$modified = $wary[1];
//$modified = strtotime(COM_stripslashes($A['modified']));
$modified_month = date('m', $modified);
$modified_day = date('d', $modified);
示例11: showtopic
//.........这里部分代码省略.........
} else {
$editAllowed = true;
}
if ($editAllowed) {
$editlink = "{$_CONF['site_url']}/forum/createtopic.php?method=edit&forum={$showtopic['forum']}&id={$showtopic['id']}&editid={$showtopic['id']}&page={$page}";
$editlinktext = $LANG_GF09['edit'];
$topictemplate->set_var('editlink', $editlink);
$topictemplate->set_var('editlinktext', $editlinktext);
$topictemplate->set_var('LANG_edit', $LANG_GF01['EDITICON']);
$topictemplate->parse('edittopic_link', 'edittopic_link');
}
}
if ($highlight != '') {
$showtopic['subject'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['subject']);
$showtopic['comment'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['comment']);
}
if (!isset($showtopic['pid'])) {
$showtopic['pid'] = 0;
}
if ($showtopic['pid'] == 0) {
$replytopicid = $showtopic['id'];
$is_lockedtopic = $showtopic['locked'];
$views = $showtopic['views'];
$topictemplate->set_var('read_msg', sprintf($LANG_GF02['msg49'], $views));
if ($is_lockedtopic) {
$topictemplate->parse('topiclocked_icon', 'topiclocked_icon');
}
} else {
$replytopicid = $showtopic['pid'];
$is_lockedtopic = DB_getItem($_TABLES['forum_topic'], 'locked', "id={$showtopic['pid']}");
$topictemplate->set_var('read_msg', '');
}
if ($CONF_FORUM['allow_user_dateformat']) {
$date = COM_getUserDateTimeFormat($showtopic['date']);
$topictemplate->set_var('posted_date', $date[0]);
} else {
$date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']);
$topictemplate->set_var('posted_date', $date);
}
if ($mode != 'preview') {
if ($is_lockedtopic == 0) {
$is_readonly = DB_getItem($_TABLES['forum_forums'], 'is_readonly', 'forum_id=' . $showtopic['forum']);
if ($is_readonly == 0 or forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_edit')) {
$quotelink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$showtopic['forum']}&id={$replytopicid}&quoteid={$showtopic['id']}";
$quotelinktext = $LANG_GF09['quote'];
$topictemplate->set_var('quotelink', $quotelink);
$topictemplate->set_var('quotelinktext', $quotelinktext);
$topictemplate->set_var('LANG_quote', $LANG_GF01['QUOTEICON']);
$topictemplate->parse('quotetopic_link', 'quotetopic_link');
}
}
$topictemplate->set_var('topic_post_id', $showtopic['id']);
if ($showtopic['uid'] > 1 && $uservalid) {
$profile_link = "{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}";
$profile_linktext = $LANG_GF09['profile'];
$topictemplate->set_var('profilelink', $profile_link);
$topictemplate->set_var('profilelinktext', $profile_linktext);
$topictemplate->set_var('LANG_profile', $LANG_GF01['ProfileLink']);
$topictemplate->parse('profile_link', 'profile_link');
if ($CONF_FORUM['use_pm_plugin']) {
$pmusernmame = COM_getDisplayName($showtopic['uid']);
$pmplugin_link = forumPLG_getPMlink($pmusernmame);
if ($pmplugin_link != '') {
$pm_link = $pmplugin_link;
$pm_linktext = $LANG_GF09['pm'];
$topictemplate->set_var('pmlink', $pm_link);
示例12: COM_getUserDateTimeFormat
$lastdate = COM_getUserDateTimeFormat($lastreply['date']);
$lastdate = $lastdate[0];
} else {
$lastdate = strftime($CONF_FORUM['default_Datetime_format'], $lastreply['date']);
}
} else {
$lastdate = strftime($CONF_FORUM['default_Datetime_format'], $record['lastupdated']);
$lastreply = $record;
}
$firstdate1 = strftime($format1, $record['date']);
if ($firstdate1 == date($format2)) {
$firsttime = strftime($format3, $record['date']);
$firstdate = $LANG_GF01['TODAY'] . $firsttime;
} elseif (isset($CONF_FORUM['use_userdate_format']) && $CONF_FORUM['use_userdate_format']) {
// FIXME: why would it not be set?
$firstdate = COM_getUserDateTimeFormat($record['date']);
$firstdate = $firstdate[0];
} else {
$firstdate = strftime($CONF_FORUM['default_Datetime_format'], $record['date']);
}
if (!COM_isAnonUser()) {
// Determine if there are new topics since last visit for this user.
// If topic has been updated or is new - then the user will not have record for this parent topic in the log table
if (DB_getItem($_TABLES['forum_log'], 'COUNT(*)', "uid='{$_USER['uid']}' AND topic='{$record['id']}' AND time > 0") == 0) {
if ($record['sticky'] == 1) {
$folderimg = "stickynew_icon";
} elseif ($record['locked'] == 1) {
$folderimg = "lockednew_icon";
} else {
$folderimg = "normalnew_icon";
}
示例13: MONITOR_getListField_images
function MONITOR_getListField_images($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF;
switch ($fieldname) {
case 'date':
$retval = '<small style="white-space: nowrap;">#' . $A['cid'] . ' - ';
$creation = COM_getUserDateTimeFormat(strtotime($fieldvalue));
$retval .= $creation[0] . '</small>';
break;
//Images
//Images
case 'ai_filename':
if (!is_file($_CONF['path_images'] . 'articles/' . $fieldvalue)) {
$image = $_CONF['site_url'] . '/admin/plugins/monitor/images/unavailable.png';
} else {
$image = $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'];
}
$retval = '<div style="float:left;margin:10px 20px 10px 5px; "><a href="' . $_CONF['site_url'] . '/images/articles/' . $fieldvalue . '" target="_blank"><img src="' . $_CONF['site_url'] . '/admin/plugins/monitor/images.php?src=' . $image . '&w=100&h=100&a=t" align="top" alt="' . stripslashes($fieldvalue) . '" /></a></div><p><strong>' . stripslashes($fieldvalue) . '</strong><br' . XHTML . '>';
$retval .= '#' . $A['ai_img_num'] . ' ';
$creation = COM_getUserDateTimeFormat(strtotime($A['date']));
$retval .= $creation[0] . '<br' . XHTML . '><a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['ai_sid'] . '" target="_blank">' . stripslashes($A['title']) . '</a></p>';
break;
case 'title_image':
$retval = stripslashes($fieldvalue);
break;
case 'uid':
if ($fieldvalue >= 2) {
$retval = COM_createLink($A['username'], $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']);
$retval = '<p style="white-space: nowrap;">' . $retval . '</span></p>';
} else {
$retval = '<p style="white-space: nowrap;">' . $A['username'] . '</p>';
}
break;
default:
$retval = stripslashes($fieldvalue);
break;
}
return $retval;
}
示例14: optimize
/**
* Prepare for optimizing tables
*
* @return string HTML form
*
*/
function optimize()
{
global $_CONF, $_TABLES, $LANG_ADMIN, $LANG_DB_BACKUP;
$retval = '';
$lastrun = DB_getItem($_TABLES['vars'], 'UNIX_TIMESTAMP(value)', "name = 'lastoptimizeddb'");
$retval .= COM_startBlock($LANG_DB_BACKUP['optimize_title']);
$retval .= '<p>' . $LANG_DB_BACKUP['optimize_explain'] . '</p>' . LB;
if (!empty($lastrun)) {
$last = COM_getUserDateTimeFormat($lastrun);
$retval .= '<p>' . $LANG_DB_BACKUP['last_optimization'] . ': ' . $last[0] . '</p>' . LB;
}
$retval .= '<p>' . $LANG_DB_BACKUP['optimization_patience'] . '</p>' . LB;
$retval .= miniform_DoOrCancel($LANG_DB_BACKUP['optimize_button'], 'dooptimize');
$retval .= COM_endBlock();
return $retval;
}
示例15: COM_createHTMLDocument
//.........这里部分代码省略.........
if (empty($topic)) {
$pagetitle = $_CONF['site_slogan'];
$pagetitle_siteslogan = true;
} else {
$pagetitle = stripslashes(DB_getItem($_TABLES['topics'], 'topic', "tid = '{$topic}'"));
}
}
if (!empty($pagetitle)) {
$header->set_var('page_site_splitter', ' - ');
} else {
$header->set_var('page_site_splitter', '');
}
$header->set_var('page_title', $pagetitle);
$header->set_var('site_name', $_CONF['site_name']);
if (COM_onFrontpage() or $pagetitle_siteslogan) {
$title_and_name = $_CONF['site_name'];
if (!empty($pagetitle)) {
$title_and_name .= ' - ' . $pagetitle;
}
} else {
$title_and_name = '';
if (!empty($pagetitle)) {
$title_and_name = $pagetitle . ' - ';
}
$title_and_name .= $_CONF['site_name'];
}
$header->set_var('page_title_and_site_name', $title_and_name);
COM_setLangIdAndAttribute($header);
$header->set_var('background_image', $_CONF['layout_url'] . '/images/bg.' . $_IMAGE_TYPE);
$msg = rtrim($LANG01[67]) . ' ' . $_CONF['site_name'];
if (!empty($_USER['username'])) {
$msg .= ', ' . COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
}
$curtime = COM_getUserDateTimeFormat();
$header->set_var('welcome_msg', $msg);
$header->set_var('datetime', $curtime[0]);
$header->set_var('site_logo', $_CONF['layout_url'] . '/images/logo.' . $_IMAGE_TYPE);
$header->set_var('theme', $_CONF['theme']);
$header->set_var('datetime_html5', strftime('%FT%T', $curtime[1]));
$header->set_var('charset', COM_getCharset());
$header->set_var('direction', $LANG_DIRECTION);
$template_vars = array('rdf_file' => $feed, 'rss_url' => $feed, 'site_mail' => "mailto:{$_CONF['site_mail']}", 'site_name' => $_CONF['site_name'], 'site_slogan' => $_CONF['site_slogan'], 'button_home' => $LANG_BUTTONS[1], 'button_contact' => $LANG_BUTTONS[2], 'button_contribute' => $LANG_BUTTONS[3], 'button_sitestats' => $LANG_BUTTONS[7], 'button_personalize' => $LANG_BUTTONS[8], 'button_search' => $LANG_BUTTONS[9], 'button_advsearch' => $LANG_BUTTONS[10], 'button_directory' => $LANG_BUTTONS[11]);
$header->set_var($template_vars);
// Get plugin menu options
$plugin_menu = PLG_getMenuItems();
if ($_COM_VERBOSE) {
COM_errorLog('num plugin menu items in header = ' . count($plugin_menu), 1);
}
// Now add nested template for menu items
COM_renderMenu($header, $plugin_menu);
if (count($plugin_menu) == 0) {
$header->parse('plg_menu_elements', 'menuitem_none', true);
} else {
$count_plugin_menu = count($plugin_menu);
for ($i = 1; $i <= $count_plugin_menu; $i++) {
$header->set_var('menuitem_url', current($plugin_menu));
$header->set_var('menuitem_text', key($plugin_menu));
if ($i == $count_plugin_menu) {
$header->parse('plg_menu_elements', 'menuitem_last', true);
} else {
$header->parse('plg_menu_elements', 'menuitem', true);
}
next($plugin_menu);
}
}
// Call to plugins to set template variables in the header