本文整理汇总了PHP中USER_getPhoto函数的典型用法代码示例。如果您正苦于以下问题:PHP USER_getPhoto函数的具体用法?PHP USER_getPhoto怎么用?PHP USER_getPhoto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USER_getPhoto函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userprofile
//.........这里部分代码省略.........
$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']) {
$edit_url = "{$_CONF['site_url']}/usersettings.php";
} else {
$edit_url = "{$_CONF['site_admin_url']}/user.php?edit=x&uid={$A['uid']}";
}
$edit_link_url = COM_createLink($edit_icon, $edit_url);
$user_templates->set_var('edit_icon', $edit_icon);
$user_templates->set_var('edit_link', $edit_link_url);
$user_templates->set_var('user_edit', $edit_url);
} else {
$user_templates->set_var('user_edit', '');
}
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)';
// user does not have a photo
}
$lastlogin = $A['lastlogin'];
$lasttime = COM_getUserDateTimeFormat($lastlogin);
$photo = USER_getPhoto($user, $A['photo'], $A['email'], -1, 0);
$user_templates->set_var('user_photo', $photo);
$user_templates->set_var('lang_membersince', $LANG04[67]);
$user_templates->set_var('user_regdate', $A['regdate']);
if ($_CONF['lastlogin'] && $A['showonline']) {
$user_templates->set_var('lang_lastlogin', $LANG28[35]);
if (!empty($lastlogin)) {
$user_templates->set_var('user_lastlogin', $lasttime[0]);
} else {
$user_templates->set_var('user_lastlogin', $LANG28[36]);
}
}
if ($A['showonline']) {
if (DB_count($_TABLES['sessions'], 'uid', (int) $user)) {
$user_templates->set_var('online', 'online');
}
}
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('user_id', $user);
if ($A['email'] == '' || $A['emailfromuser'] == 0) {
$user_templates->set_var('email_option', '');
} else {
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->parse('email_option', 'email', true);
}
$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_online', $LANG04[160]);
$user_templates->set_var('lang_bio', $LANG04[7]);
$user_templates->set_var('user_bio', nl2br($A['about']));
$user_templates->set_var('follow_me', SOC_getFollowMeIcons($user, 'follow_user_profile.thtml'));
示例2: edituser
//.........这里部分代码省略.........
$user_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
$user_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
}
$user_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
$user_templates->set_var('lang_userid', $LANG28[2]);
if (empty($A['uid'])) {
$user_templates->set_var('user_id', $LANG_ADMIN['na']);
} else {
$user_templates->set_var('user_id', $A['uid']);
}
$user_templates->set_var('lang_regdate', $LANG28[14]);
$user_templates->set_var('regdate_timestamp', $curtime[1]);
$user_templates->set_var('user_regdate', $curtime[0]);
$user_templates->set_var('lang_lastlogin', $LANG28[35]);
if (empty($lastlogin)) {
$user_templates->set_var('user_lastlogin', $LANG28[36]);
} else {
$user_templates->set_var('user_lastlogin', $lasttime[0]);
}
$user_templates->set_var('lang_username', $LANG28[3]);
if (isset($A['username'])) {
$user_templates->set_var('username', $A['username']);
} else {
$user_templates->set_var('username', '');
}
$remoteservice = '';
if ($_CONF['show_servicename']) {
if (!empty($A['remoteservice'])) {
$remoteservice = '@' . $A['remoteservice'];
}
}
$user_templates->set_var('remoteservice', $remoteservice);
if ($_CONF['allow_user_photo'] && $A['uid'] > 0) {
$photo = USER_getPhoto($A['uid'], $A['photo'], $A['email'], -1);
$user_templates->set_var('user_photo', $photo);
if (empty($A['photo'])) {
$user_templates->set_var('lang_delete_photo', '');
$user_templates->set_var('delete_photo_option', '');
} else {
$user_templates->set_var('lang_delete_photo', $LANG28[28]);
$user_templates->set_var('delete_photo_option', '<input type="checkbox" name="delete_photo"' . XHTML . '>');
}
} else {
$user_templates->set_var('user_photo', '');
$user_templates->set_var('lang_delete_photo', '');
$user_templates->set_var('delete_photo_option', '');
}
$user_templates->set_var('lang_fullname', $LANG28[4]);
if (isset($A['fullname'])) {
$user_templates->set_var('user_fullname', htmlspecialchars($A['fullname']));
} else {
$user_templates->set_var('user_fullname', '');
}
if (empty($A['remoteservice'])) {
$user_templates->set_var('lang_password', $LANG28[5]);
$user_templates->set_var('lang_password_conf', $LANG28[39]);
$user_templates->parse('password_option', 'password', true);
} else {
$user_templates->set_var('password_option', '');
}
$user_templates->set_var('lang_emailaddress', $LANG28[7]);
if (isset($A['email'])) {
$user_templates->set_var('user_email', htmlspecialchars($A['email']));
} else {
$user_templates->set_var('user_email', '');
}
示例3: 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);
//.........这里部分代码省略.........
示例4: STORY_renderArticle
//.........这里部分代码省略.........
$article->set_var('site_name', $_CONF['site_name']);
//$article->set_var( 'story_date', $story->DisplayElements('date') );
$article->set_var('story_date_short', $story->DisplayElements('shortdate'));
$article->set_var('story_date_only', $story->DisplayElements('dateonly'));
$article->set_var('story_id', $story->getSid());
if ($_CONF['contributedbyline'] == 1) {
$article->set_var('lang_contributed_by', $LANG01[1]);
$article->set_var('contributedby_uid', $story->DisplayElements('uid'));
$fullname = $story->DisplayElements('fullname');
$username = $story->DisplayElements('username');
$article->set_var('contributedby_user', $username);
if (empty($fullname)) {
$article->set_var('contributedby_fullname', $username);
} else {
$article->set_var('contributedby_fullname', $fullname);
}
$authorname = COM_getDisplayName($story->DisplayElements('uid'), $username, $fullname);
$article->set_var('contributedby_author', $authorname);
$article->set_var('author', $authorname);
$profileUrl = '';
if ($story->DisplayElements('uid') > 1) {
$profileUrl = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $story->DisplayElements('uid');
$article->set_var('start_contributedby_anchortag', '<a class="storybyline" href="' . $profileUrl . '" rel="author">');
$article->set_var('end_contributedby_anchortag', '</a>');
$article->set_var('contributedby_url', $profileUrl);
}
$photo = '';
if ($_CONF['allow_user_photo'] == 1) {
$authphoto = $story->DisplayElements('photo');
if (empty($authphoto)) {
$authphoto = '(none)';
// user does not have a photo
}
$photo = USER_getPhoto($story->DisplayElements('uid'), $authphoto, $story->DisplayElements('email'));
}
if (!empty($photo)) {
$article->set_var('contributedby_photo', $photo);
$article->set_var('author_photo', $photo);
$camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>';
$article->set_var('camera_icon', COM_createLink($camera_icon, $profileUrl));
} else {
$article->set_var('contributedby_photo', '');
$article->set_var('author_photo', '');
$article->set_var('camera_icon', '');
}
}
$article->set_var('story_topic_id', $story->DisplayElements('tid'));
$article->set_var('story_topic_name', $topicname);
$article->set_var('story_topic_url', $topicurl);
$recent_post_anchortag = '';
$article->set_var('lang_permalink', $LANG01[127]);
$show_comments = true;
// n = Full display of article. p = 'Preview' mode.
if ($index != 'n' && $index != 'p' || !empty($query)) {
$attributes = ' class="non-ul"';
$attr_array = array('class' => 'non-ul');
if (!empty($query)) {
$attributes .= ' rel="bookmark"';
$attr_array['rel'] = 'bookmark';
}
$article->set_var('start_storylink_anchortag', '<a href="' . $articleUrl . '"' . $attributes . '>');
$article->set_var('end_storylink_anchortag', '</a>');
$article->set_var('story_title_link', COM_createLink($story->DisplayElements('title'), $articleUrl, $attr_array));
} else {
$article->set_var('story_title_link', $story->DisplayElements('title'));
}
示例5: STORY_renderArticle
/**
* Takes an article class and renders HTML in the specified template and style.
*
* Formats the given article into HTML. Called by index.php, article.php,
* submit.php and admin/story.php (Preview mode for the last two).
*
* @param object $story The story to display, an instance of the Story class.
* @param string $index n = 'Compact display' for list of stories. p = 'Preview' mode. Else full display of article.
* @param string $storytpl The template to use to render the story.
* @param string $query A search query, if one was specified.
*
* @return string Article as formated HTML.
*
* Note: Formerly named COM_Article, and re-written totally since then.
*/
function STORY_renderArticle(&$story, $index = '', $storytpl = 'storytext.thtml', $query = '')
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG05, $LANG11, $LANG_TRB, $_IMAGE_TYPE, $mode;
static $storycounter = 0;
if (empty($storytpl)) {
$storytpl = 'storytext.thtml';
}
$introtext = $story->displayElements('introtext');
$bodytext = $story->displayElements('bodytext');
if (!empty($query)) {
$introtext = COM_highlightQuery($introtext, $query);
$bodytext = COM_highlightQuery($bodytext, $query);
}
$article = new Template($_CONF['path_layout']);
$article->set_file(array('article' => $storytpl, 'bodytext' => 'storybodytext.thtml', 'featuredarticle' => 'featuredstorytext.thtml', 'featuredbodytext' => 'featuredstorybodytext.thtml', 'archivearticle' => 'archivestorytext.thtml', 'archivebodytext' => 'archivestorybodytext.thtml'));
$article->set_var('xhtml', XHTML);
$article->set_var('layout_url', $_CONF['layout_url']);
$article->set_var('site_url', $_CONF['site_url']);
$article->set_var('site_admin_url', $_CONF['site_admin_url']);
$article->set_var('site_name', $_CONF['site_name']);
$article->set_var('story_date', $story->DisplayElements('date'));
$article->set_var('story_date_short', $story->DisplayElements('shortdate'));
$article->set_var('story_date_only', $story->DisplayElements('dateonly'));
if ($_CONF['hideviewscount'] != 1) {
$article->set_var('lang_views', $LANG01[106]);
$article->set_var('story_hits', $story->DisplayElements('hits'));
}
$article->set_var('story_id', $story->getSid());
if ($_CONF['contributedbyline'] == 1) {
$article->set_var('lang_contributed_by', $LANG01[1]);
$article->set_var('contributedby_uid', $story->DisplayElements('uid'));
$fullname = $story->DisplayElements('fullname');
$username = $story->DisplayElements('username');
$article->set_var('contributedby_user', $username);
if (empty($fullname)) {
$article->set_var('contributedby_fullname', $username);
} else {
$article->set_var('contributedby_fullname', $fullname);
}
$authorname = COM_getDisplayName($story->DisplayElements('uid'), $username, $fullname);
$article->set_var('contributedby_author', $authorname);
$article->set_var('author', $authorname);
if ($story->DisplayElements('uid') > 1) {
$profileUrl = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $story->DisplayElements('uid');
$article->set_var('start_contributedby_anchortag', '<a class="storybyline" href="' . $profileUrl . '">');
$article->set_var('end_contributedby_anchortag', '</a>');
$article->set_var('contributedby_url', $profileUrl);
}
$photo = '';
if ($_CONF['allow_user_photo'] == 1) {
$authphoto = $story->DisplayElements('photo');
if (empty($authphoto)) {
$authphoto = '(none)';
// user does not have a photo
}
$photo = USER_getPhoto($story->DisplayElements('uid'), $authphoto, $story->DisplayElements('email'));
}
if (!empty($photo)) {
$article->set_var('contributedby_photo', $photo);
$article->set_var('author_photo', $photo);
$camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>';
$article->set_var('camera_icon', COM_createLink($camera_icon, $profileUrl));
} else {
$article->set_var('contributedby_photo', '');
$article->set_var('author_photo', '');
$article->set_var('camera_icon', '');
}
}
$topicname = $story->DisplayElements('topic');
$article->set_var('story_topic_id', $story->DisplayElements('tid'));
$article->set_var('story_topic_name', $topicname);
$topicurl = $_CONF['site_url'] . '/index.php?topic=' . $story->DisplayElements('tid');
if ((!isset($_USER['noicons']) or $_USER['noicons'] != 1) and $story->DisplayElements('show_topic_icon') == 1) {
$imageurl = $story->DisplayElements('imageurl');
if (!empty($imageurl)) {
$imageurl = COM_getTopicImageUrl($imageurl);
$article->set_var('story_topic_image_url', $imageurl);
$topicimage = '<img src="' . $imageurl . '" class="float' . $_CONF['article_image_align'] . '" alt="' . $topicname . '" title="' . $topicname . '"' . XHTML . '>';
$article->set_var('story_anchortag_and_image', COM_createLink($topicimage, $topicurl, array('rel' => "category")));
$article->set_var('story_topic_image', $topicimage);
$topicimage_noalign = '<img src="' . $imageurl . '" alt="' . $topicname . '" title="' . $topicname . '"' . XHTML . '>';
$article->set_var('story_anchortag_and_image_no_align', COM_createLink($topicimage_noalign, $topicurl, array('rel' => "category")));
$article->set_var('story_topic_image_no_align', $topicimage_noalign);
}
}
//.........这里部分代码省略.........
示例6: showtopic
function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1)
{
global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02;
global $fromblock, $highlight;
global $oldPost, $forumfiles;
$oldPost = 0;
//$mytimer = new timerobject();
//$mytimer->setPercision(2);
//$mytimer->startTimer();
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time1: $intervalTime");
if (!class_exists('StringParser')) {
require_once $_CONF['path_html'] . 'forum/include/bbcode/stringparser_bbcode.class.php';
}
$topictemplate = new Template($_CONF['path_layout'] . 'forum/layout');
$topictemplate->set_file(array('topictemplate' => 'topic.thtml', 'profile' => 'links/profile.thtml', 'pm' => 'links/pm.thtml', 'email' => 'links/email.thtml', 'website' => 'links/website.thtml', 'quote' => 'links/quotetopic.thtml', 'edit' => 'links/edittopic.thtml'));
// if preview, only stripslashes is gpc=on, else assume from db so strip
if ($mode == 'preview') {
$showtopic['subject'] = COM_stripslashes($showtopic['subject']);
$topictemplate->set_var('show_topicrow1', 'none');
$topictemplate->set_var('show_topicrule', 'none');
$topictemplate->set_var('lang_postpreview', $LANG_GF01['PREVIEW_HEADER']);
} else {
$showtopic['subject'] = stripslashes($showtopic['subject']);
$topictemplate->set_var('show_topicrow2', 'none');
}
$min_height = 50;
// Base minimum height of topic - will increase if avatar or sig is used
$date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']);
$userQuery = DB_query("SELECT * FROM {$_TABLES['users']} WHERE uid='{$showtopic['uid']}'");
if ($showtopic['uid'] > 1 and DB_numRows($userQuery) == 1) {
$userarray = DB_fetchArray($userQuery);
$username = COM_getDisplayName($showtopic['uid']);
$userlink = "<a href=\"{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}\" ";
$userlink .= "class=\"authorname {$onetwo}\"><b>{$username}</b></a>";
$uservalid = true;
$postcount = DB_query("SELECT * FROM {$_TABLES['gf_topic']} WHERE uid='{$showtopic['uid']}'");
$posts = DB_numRows($postcount);
// STARS CODE
$starimage = "<IMG SRC=\"%s\" ALT=\"{$LANG_GF01['FORUM']} %s\" TITLE=\"{$LANG_GF01['FORUM']} %s\">";
if ($posts < $CONF_FORUM['level2']) {
$user_level = sprintf($starimage, gf_getImage('rank1', 'ranks'), $CONF_FORUM['level1name'], $CONF_FORUM['level1name']);
$user_levelname = $CONF_FORUM['level1name'];
} elseif ($posts >= $CONF_FORUM['level2'] && $posts < $CONF_FORUM['level3']) {
$user_level = sprintf($starimage, gf_getImage('rank2', 'ranks'), $CONF_FORUM['level2name'], $CONF_FORUM['level2name']);
$user_levelname = $CONF_FORUM['level2name'];
} elseif ($posts >= $CONF_FORUM['level3'] && $posts < $CONF_FORUM['level4']) {
$user_level = sprintf($starimage, gf_getImage('rank3', 'ranks'), $CONF_FORUM['level3name'], $CONF_FORUM['level3name']);
$user_levelname = $CONF_FORUM['level3name'];
} elseif ($posts >= $CONF_FORUM['level4'] && $posts < $CONF_FORUM['level5']) {
$user_level = sprintf($starimage, gf_getImage('rank4', 'ranks'), $CONF_FORUM['level4name'], $CONF_FORUM['level4name']);
$user_levelname = $CONF_FORUM['level4name'];
} elseif ($posts > $CONF_FORUM['level5']) {
$user_level = sprintf($starimage, gf_getImage('rank5', 'ranks'), $CONF_FORUM['level5name'], $CONF_FORUM['level5name']);
$user_levelname = $CONF_FORUM['level5name'];
}
if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) {
$user_level = sprintf($starimage, gf_getImage('rank_mod', 'ranks'), $LANG_GF01['moderator'], $LANG_GF01['moderator']);
$user_levelname = $LANG_GF01['moderator'];
}
if (SEC_inGroup(1, $showtopic['uid'])) {
$user_level = sprintf($starimage, gf_getImage('rank_admin', 'ranks'), $LANG_GF01['admin'], $LANG_GF01['admin']);
$user_levelname = $LANG_GF01['admin'];
}
if ($userarray['photo'] != "") {
$avatar = USER_getPhoto($showtopic['uid'], '', '', $CONF_FORUM['avatar_width']);
$min_height = $min_height + 50;
}
$regdate = $LANG_GF01['REGISTERED'] . ': ' . strftime('%m/%d/%y', strtotime($userarray['regdate'])) . '<br>';
$numposts = $LANG_GF01['POSTS'] . ': ' . $posts;
if (DB_count($_TABLES['sessions'], 'uid', $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid={$showtopic['uid']}") == 1) {
$avatar .= '<br>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['ONLINE'];
} else {
$avatar .= '<br>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['OFFLINE'];
}
if ($userarray['sig'] != '') {
$sig = '<hr width="95%" size="1" style="color=:black; text-align:left; margin-left:0; margin-bottom:5;padding:0" noshade>';
$sig .= '<B>' . $userarray['sig'] . '</B>';
$min_height = $min_height + 30;
}
} else {
$uservalid = false;
$userlink = '<b>' . $showtopic['name'] . '</b>';
$userlink = '<font size="-2">' . $LANG_GF01['ANON'] . '</font>' . $showtopic['name'];
}
if ($CONF_FORUM['show_moods'] && $showtopic['mood'] != "") {
$moodimage = '<img align="absmiddle" src="' . gf_getImage($showtopic['mood'], 'moods') . '" title="' . $showtopic['mood'] . '"><br>';
$min_height = $min_height + 30;
}
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time3: $intervalTime");
// Handle Pre ver 2.5 quoting and New Line Formatting - consider adding this to a migrate function
if ($CONF_FORUM['pre2.5_mode']) {
// try to determine if we have an old post...
if (strstr($showtopic['comment'], '<pre class="forumCode">') !== false) {
$oldPost = 1;
}
if (strstr($showtopic['comment'], "[code]<code>") !== false) {
$oldPost = 1;
}
//.........这里部分代码省略.........
示例7: edituser
//.........这里部分代码省略.........
$preferences->set_var('lang_password_email_legend', $LANG04[129]);
$preferences->set_var('lang_personal_info_legend', $LANG04[130]);
$preferences->set_var('lang_resynch', $LANG04[166]);
$display_name = COM_getDisplayName($_USER['uid']);
//$preferences->set_var ('start_block_profile',
// COM_startBlock ($LANG04[1] . ' ' . $display_name));
//$preferences->set_var ('end_block', COM_endBlock ());
$preferences->set_var('profile_headline', $LANG04[1] . ' ' . $display_name);
if ($_CONF['allow_user_photo'] == 1) {
$preferences->set_var('enctype', 'enctype="multipart/form-data"');
} else {
$preferences->set_var('enctype', '');
}
$preferences->set_var('fullname_value', htmlspecialchars($A['fullname']));
$preferences->set_var('new_username_value', htmlspecialchars($_USER['username']));
if ($A['remoteservice'] == '') {
$preferences->set_var('password_value', '');
$preferences->parse('password_option', 'password', true);
$preferences->parse('current_password_option', 'current_password', true);
$preferences->set_var('resynch_option', '');
} else {
$preferences->set_var('password_option', '');
$preferences->set_var('current_password_option', '');
if ($_CONF['user_login_method']['oauth'] && strpos($_USER['remoteservice'], 'oauth.') === 0) {
// OAuth only supports re-synch at the moment
$preferences->set_var('resynch_checked', '');
$preferences->parse('resynch_option', 'resynch', true);
} else {
$preferences->set_var('resynch_option', '');
}
}
if ($_CONF['allow_username_change'] == 1) {
$preferences->parse('username_option', 'username', true);
} else {
$preferences->set_var('username_option', '');
}
$selection = '<select id="cooktime" name="cooktime">' . LB;
$selection .= COM_optionList($_TABLES['cookiecodes'], 'cc_value,cc_descr', $A['cookietimeout'], 0);
$selection .= '</select>';
$preferences->set_var('cooktime_selector', $selection);
$preferences->set_var('email_value', htmlspecialchars($A['email']));
$preferences->set_var('homepage_value', htmlspecialchars(COM_killJS($A['homepage'])));
$preferences->set_var('location_value', htmlspecialchars(strip_tags($A['location'])));
$preferences->set_var('signature_value', htmlspecialchars($A['sig']));
if ($_CONF['allow_user_photo'] == 1) {
$photo = USER_getPhoto($_USER['uid'], $A['photo'], $A['email'], -1);
if (empty($photo)) {
$preferences->set_var('display_photo', '');
} else {
if (empty($A['photo'])) {
// external avatar
$photo = '<br' . XHTML . '>' . $photo;
} else {
// uploaded photo - add delete option
$photo = '<br' . XHTML . '>' . $photo . '<br' . XHTML . '>' . $LANG04[79] . ' <input type="checkbox" name="delete_photo"' . XHTML . '>' . LB;
}
$preferences->set_var('display_photo', $photo);
}
if (empty($_CONF['image_lib'])) {
$scaling = $LANG04[162];
} else {
$scaling = $LANG04[161];
}
$preferences->set_var('photo_max_dimensions', sprintf($LANG04[160], $_CONF['max_photo_width'], $_CONF['max_photo_height'], $_CONF['max_photo_size'], $scaling));
$preferences->parse('userphoto_option', 'photo', true);
} else {
$preferences->set_var('userphoto_option', '');
}
$result = DB_query("SELECT about,pgpkey FROM {$_TABLES['userinfo']} WHERE uid = {$_USER['uid']}");
$A = DB_fetchArray($result);
$reqid = substr(md5(uniqid(rand(), 1)), 1, 16);
DB_change($_TABLES['users'], 'pwrequestid', $reqid, 'uid', $_USER['uid']);
$preferences->set_var('about_value', htmlspecialchars($A['about']));
$preferences->set_var('pgpkey_value', htmlspecialchars($A['pgpkey']));
$preferences->set_var('uid_value', $reqid);
$preferences->set_var('username_value', htmlspecialchars($_USER['username']));
if ($_CONF['allow_account_delete'] == 1) {
$preferences->set_var('lang_deleteaccount', $LANG04[156]);
$preferences->set_var('delete_text', $LANG04[95]);
$preferences->set_var('lang_button_delete', $LANG04[96]);
$preferences->set_var('delete_mode', 'confirmdelete');
$preferences->set_var('account_id', $reqid);
if (isset($LANG04[157])) {
$preferences->set_var('lang_deleteoption', $LANG04[157]);
} else {
$preferences->set_var('lang_deleteoption', $LANG04[156]);
}
$preferences->parse('delete_account_option', 'deleteaccount', false);
} else {
$preferences->set_var('delete_account_option', '');
}
// Call custom account form and edit function if enabled and exists
if ($_CONF['custom_registration'] and function_exists('CUSTOM_userEdit')) {
$preferences->set_var('customfields', CUSTOM_userEdit($_USER['uid']));
}
PLG_profileVariablesEdit($_USER['uid'], $preferences);
$retval = $preferences->finish($preferences->parse('output', 'profile'));
$retval .= PLG_profileBlocksEdit($_USER['uid']);
return $retval;
}
示例8: CMT_getComment
//.........这里部分代码省略.........
// get correct editor name
if ($A['uid'] == $B['uid']) {
$editname = $A['username'];
} else {
$editname = DB_getItem($_TABLES['users'], 'username', "uid={$B['uid']}");
}
// add edit info to text
$A['comment'] .= '<div class="comment-edit">' . $LANG03[30] . ' ' . strftime($_CONF['date'], $B['time']) . ' ' . $LANG03[31] . ' ' . $editname . '</div><!-- /COMMENTEDIT -->';
}
// determines indentation for current comment
if ($mode == 'threaded' || $mode == 'nested') {
$indent = ($A['indent'] - $A['pindent']) * $_CONF['comment_indent'];
}
// comment variables
$template->set_var('indent', $indent);
$template->set_var('author_name', strip_tags($A['username']));
$template->set_var('author_id', $A['uid']);
$template->set_var('cid', $A['cid']);
$template->set_var('cssid', $row % 2);
if ($A['uid'] > 1) {
$fullname = '';
if (!empty($A['fullname'])) {
$fullname = $A['fullname'];
}
$fullname = COM_getDisplayName($A['uid'], $A['username'], $fullname);
$template->set_var('author_fullname', $fullname);
$template->set_var('author', $fullname);
$alttext = $fullname;
$photo = '';
if ($_CONF['allow_user_photo']) {
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)';
}
$photo = USER_getPhoto($A['uid'], $A['photo'], $A['email']);
}
if (!empty($photo)) {
$template->set_var('author_photo', $photo);
$camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>';
$template->set_var('camera_icon', COM_createLink($camera_icon, $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']));
} else {
$template->set_var('author_photo', '');
$template->set_var('camera_icon', '');
}
$template->set_var('start_author_anchortag', '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">');
$template->set_var('end_author_anchortag', '</a>');
$template->set_var('author_link', COM_createLink($fullname, $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']));
} else {
//comment is from anonymous user
if (isset($A['name'])) {
$A['username'] = strip_tags($A['name']);
}
$template->set_var('author', $A['username']);
$template->set_var('author_fullname', $A['username']);
$template->set_var('author_link', $A['username']);
$template->set_var('author_photo', '');
$template->set_var('camera_icon', '');
$template->set_var('start_author_anchortag', '');
$template->set_var('end_author_anchortag', '');
}
// hide reply link from anonymous users if they can't post replies
$hidefromanon = false;
if (empty($_USER['username']) && ($_CONF['loginrequired'] == 1 || $_CONF['commentsloginrequired'] == 1)) {
$hidefromanon = true;
}
// this will hide HTML that should not be viewed in preview mode
if ($preview || $hidefromanon) {
示例9: showtopic
function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1)
{
global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02, $LANG_GF09;
global $highlight;
global $oldPost;
$oldPost = 0;
//$mytimer = new timerobject();
//$mytimer->setPercision(2);
//$mytimer->startTimer();
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time1: $intervalTime");
if (!class_exists('StringParser')) {
require_once $CONF_FORUM['path_include'] . 'bbcode/stringparser_bbcode.class.php';
}
$topictemplate = COM_newTemplate(CTL_plugin_templatePath('forum'));
$topictemplate->set_file(array('topictemplate' => 'topic.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml'));
$topictemplate->set_block('topictemplate', 'block_user_information');
$topictemplate->set_block('topictemplate', 'block_anon_user_information');
$topictemplate->set_block('topictemplate', 'location');
$topictemplate->set_block('topictemplate', 'ip_address');
$topictemplate->set_block('topictemplate', 'anon_ip_address');
$topictemplate->set_block('topictemplate', 'user_signature');
$topictemplate->set_block('topictemplate', 'mod_functions');
$blocks = array('block_user_name', 'block_anon_user_name', 'block_user_information', 'block_anon_user_information', 'user_signature', 'mod_functions');
foreach ($blocks as $block) {
$topictemplate->set_block('topictemplate', $block);
}
$topictemplate->set_block('forum_icons', 'topiclocked_icon');
$topictemplate->set_block('forum_icons', 'mood_icon');
$blocks = array('profile_link', 'pm_link', 'email_link', 'website_link', 'quotetopic_link', 'edittopic_link');
foreach ($blocks as $block) {
$topictemplate->set_block('forum_links', $block);
}
// if preview, only stripslashes is gpc=on, else assume from db so strip
if ($mode == 'preview') {
$showtopic['subject'] = COM_stripslashes($showtopic['subject']);
} else {
$showtopic['subject'] = stripslashes($showtopic['subject']);
}
$min_height = 50;
// Base minimum height of topic - will increase if avatar or sig is used
$date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']);
$sql = "SELECT u.*, ui.location FROM {$_TABLES['users']} u, {$_TABLES['userinfo']} ui \n \t\tWHERE u.uid = ui.uid \n \t\tAND u.uid = '{$showtopic['uid']}'";
$userQuery = DB_query($sql);
if ($showtopic['uid'] > 1 and DB_numRows($userQuery) == 1) {
$userarray = DB_fetchArray($userQuery);
$username = COM_getDisplayName($showtopic['uid']);
$userlink = "<a href=\"{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}\" ";
$userlink .= "class=\"authorname {$onetwo}\"><b>{$username}</b></a>";
$uservalid = true;
$postcount = DB_query("SELECT * FROM {$_TABLES['forum_topic']} WHERE uid='{$showtopic['uid']}'");
$posts = DB_numRows($postcount);
// STARS CODE
if (SEC_inGroup(1, $showtopic['uid'])) {
$user_level = showrank(7, $LANG_GF01['admin']);
$user_levelname = $LANG_GF01['admin'];
} else {
if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) {
$user_level = showrank(6, $LANG_GF01['moderator']);
$user_levelname = $LANG_GF01['moderator'];
} else {
if ($posts < $CONF_FORUM['level2']) {
$user_level = showrank(1, $CONF_FORUM['level1name']);
$user_levelname = $CONF_FORUM['level1name'];
} elseif ($posts >= $CONF_FORUM['level2'] && $posts < $CONF_FORUM['level3']) {
$user_level = showrank(2, $CONF_FORUM['level2name']);
$user_levelname = $CONF_FORUM['level2name'];
} elseif ($posts >= $CONF_FORUM['level3'] && $posts < $CONF_FORUM['level4']) {
$user_level = showrank(3, $CONF_FORUM['level3name']);
$user_levelname = $CONF_FORUM['level3name'];
} elseif ($posts >= $CONF_FORUM['level4'] && $posts < $CONF_FORUM['level5']) {
$user_level = showrank(4, $CONF_FORUM['level4name']);
$user_levelname = $CONF_FORUM['level4name'];
} elseif ($posts > $CONF_FORUM['level5']) {
$user_level = showrank(5, $CONF_FORUM['level5name']);
$user_levelname = $CONF_FORUM['level5name'];
}
}
}
// Still allow photo to be showen for users
if ($showtopic['uid'] > 1 and ($userarray['photo'] != "" or !empty($_CONF['default_photo']))) {
$avatar = USER_getPhoto($showtopic['uid'], '', '', $CONF_FORUM['avatar_width']);
$min_height = $min_height + 50;
} else {
$avatar = '';
}
$regdate = $LANG_GF01['REGISTERED'] . ': ' . strftime($_CONF['shortdate'], strtotime($userarray['regdate'])) . '<br' . XHTML . '>';
$numposts = $LANG_GF01['POSTS'] . ': ' . $posts;
if (DB_count($_TABLES['sessions'], 'uid', $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid={$showtopic['uid']}") == 1) {
$avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['ONLINE'];
} else {
$avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['OFFLINE'];
}
if ($userarray['sig'] != '') {
$sig = $userarray['sig'];
$min_height = $min_height + 30;
} else {
$sig = '';
}
} else {
//.........这里部分代码省略.........
示例10: USER_userinfoPanel
function USER_userinfoPanel($U, $newuser = 0)
{
global $_CONF, $_SYSTEM, $_TABLES, $_USER, $LANG_MYACCOUNT, $LANG04;
$uid = $U['uid'];
// set template
$userform = new Template($_CONF['path_layout'] . 'admin/user/');
$userform->set_file('user', 'userinfopanel.thtml');
$userform->set_var(array('lang_personal_info_legend' => $LANG04[130], 'lang_userinfo_help_title' => $LANG04[148], 'lang_userinfo_help' => $LANG04[149], 'lang_homepage' => $LANG04[6], 'lang_location' => $LANG04[106], 'lang_signature' => $LANG04[32], 'lang_about' => $LANG04[7], 'lang_pgpkey' => $LANG04[8], 'lang_social_follow' => $LANG04[198], 'lang_social_info' => $LANG04[199], 'lang_social_service' => $LANG04[200], 'lang_social_username' => $LANG04[201]));
$follow_me = SOC_followMeProfile($uid);
if (is_array($follow_me) && count($follow_me) > 0) {
$userform->set_block('user', 'social_links', 'sl');
$userform->set_var('social_followme_enabled', true);
foreach ($follow_me as $service) {
$userform->set_var('service_display_name', $service['service_display_name']);
$userform->set_var('service', $service['service']);
$userform->set_var('service_username', $service['service_username']);
$userform->parse('sl', 'social_links', true);
}
} else {
$userform->unset_var('social_followme_enabled');
}
if ($_CONF['allow_user_photo'] == 1) {
$userform->set_var('lang_userphoto', $LANG04[77]);
}
$userform->set_var('homepage_value', @htmlspecialchars(COM_killJS($U['homepage']), ENT_NOQUOTES, COM_getEncodingt()));
$userform->set_var('location_value', @htmlspecialchars(strip_tags($U['location']), ENT_NOQUOTES, COM_getEncodingt()));
$userform->set_var('signature_value', @htmlspecialchars($U['sig'], ENT_NOQUOTES, COM_getEncodingt()));
$userform->set_var('about_value', @htmlspecialchars($U['about'], ENT_NOQUOTES, COM_getEncodingt()));
$userform->set_var('pgpkey_value', @htmlspecialchars($U['pgpkey'], ENT_NOQUOTES, COM_getEncodingt()));
if ($_CONF['allow_user_photo'] == 1) {
if (!empty($uid) && $uid > 1) {
$photo = USER_getPhoto($uid, $U['photo'], $U['email'], -1);
if (empty($photo)) {
$userform->set_var('display_photo', '');
} else {
if (empty($U['photo'])) {
// external avatar
$photo = '<br/>' . $photo;
} else {
// uploaded photo - add delete option
$photo = '<br/>' . $photo . '<br/>' . $LANG04[79] . ' <input type="checkbox" name="delete_photo"/>' . LB;
}
$userform->set_var('display_photo', $photo);
}
} else {
$userform->set_var('display_photo', '');
}
}
if (!empty($uid) && $uid > 1) {
$userform->set_var('plugin_userinfo_personalinfo', PLG_profileEdit($uid, 'userinfo', 'personalinfo'));
$userform->set_var('plugin_userinfo', PLG_profileEdit($uid, 'userinfo'));
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userEdit')) {
$userform->set_var('customfields', CUSTOM_userEdit($uid));
}
}
$retval = $userform->finish($userform->parse('output', 'user'));
return $retval;
}
示例11: DB_getItem
}
$content .= "</form>";
break;
case 'change_user_photo':
//User id is set
if ($_CONF['allow_user_photo'] == 1 && $uid > 0) {
$username = DB_getItem($_TABLES['users'], 'username', "uid = {$uid}");
if ($username == '') {
$T->set_var('title', 'Change photo of user ' . $A['fullname'] . ' (' . $uid . ')');
$content = 'This user does not exist';
} else {
//Get user info
$result = DB_query("SELECT fullname,cookietimeout,email,homepage,sig,emailstories,about,location,pgpkey,photo,remoteservice FROM {$_TABLES['users']},{$_TABLES['userprefs']},{$_TABLES['userinfo']} WHERE {$_TABLES['users']}.uid = {$uid} AND {$_TABLES['userprefs']}.uid = {$uid} AND {$_TABLES['userinfo']}.uid = {$uid}");
$A = DB_fetchArray($result);
$T->set_var('title', 'Change photo of user ' . $A['fullname'] . ' (' . $uid . ')');
$photo = USER_getPhoto($uid, $A['photo'], $A['email'], -1);
if (empty($photo)) {
$display_photo = '';
} else {
$display_photo = '<br' . XHTML . '>' . $photo;
}
if (empty($_CONF['image_lib'])) {
$scaling = $LANG04[162];
} else {
$scaling = $LANG04[161];
}
$photo_max_dimensions = sprintf($LANG04[160], $_CONF['max_photo_width'], $_CONF['max_photo_height'], $_CONF['max_photo_size'], $scaling);
//Form for new photo
$content .= "<form method=\"post\" action=\"{$_CONF['site_admin_url']}/plugins/monitor/index.php\" enctype=\"multipart/form-data\">";
$content .= '<p>' . $display_photo . '</p><p>' . $photo_max_dimensions . '</p>';
$content .= '<p><input type="file" dir="ltr" id="photo" name="photo" size="30"' . XHTML . '></p>';
示例12: USER_showProfile
/**
* Shows a profile for a user
* This grabs the user profile for a given user and displays it
*
* @param int $uid User ID of profile to get
* @param boolean $preview whether being called as preview from My Account
* @param int $msg Message to display (if != 0)
* @param string $plugin optional plugin name for message
* @return string HTML for user profile page
*/
function USER_showProfile($uid, $preview = false, $msg = 0, $plugin = '')
{
global $_CONF, $_TABLES, $_USER, $_IMAGE_TYPE, $LANG01, $LANG04, $LANG09, $LANG28, $LANG_LOGIN, $LANG_ADMIN;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['profileloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_LOGIN[1]));
return $retval;
}
$result = DB_query("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,homepage,about,location,pgpkey,photo,email,status FROM {$_TABLES['userinfo']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['users']}.uid = {$uid}");
$numRows = DB_numRows($result);
if ($numRows == 0) {
// no such user
COM_handle404();
}
$A = DB_fetchArray($result);
if ($A['status'] == USER_ACCOUNT_DISABLED && !SEC_hasRights('user.edit')) {
COM_displayMessageAndAbort(30, '', 403, 'Forbidden');
}
if ($A['status'] != USER_ACCOUNT_ACTIVE && !SEC_hasRights('user.edit')) {
COM_handle404();
}
$display_name = COM_getDisplayName($uid, $A['username'], $A['fullname']);
$display_name = htmlspecialchars($display_name);
if (!$preview) {
if ($msg > 0) {
$retval .= COM_showMessage($msg, $plugin);
}
}
// format date/time to user preference
$currentTime = COM_getUserDateTimeFormat($A['regdate']);
$A['regdate'] = $currentTime[0];
$user_templates = COM_newTemplate($_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('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) {
if (empty($A['fullname'])) {
$userName = $A['username'];
$fullName = '';
} else {
$userName = $A['fullname'];
$fullName = $A['username'];
}
} else {
$userName = $A['username'];
$fullName = $A['fullname'];
}
$userName = htmlspecialchars($userName);
$fullName = htmlspecialchars($fullName);
if ($A['status'] == USER_ACCOUNT_DISABLED) {
$userName = sprintf('<s title="%s">%s</s>', $LANG28[42], $userName);
if (!empty($fullName)) {
$fullName = sprintf('<s title="%s">%s</s>', $LANG28[42], $fullName);
}
}
$user_templates->set_var('username', $userName);
$user_templates->set_var('user_fullname', $fullName);
if ($preview) {
$user_templates->set_var('edit_icon', '');
$user_templates->set_var('edit_link', '');
$user_templates->set_var('user_edit', '');
} elseif (!COM_isAnonUser() && $_USER['uid'] == $uid) {
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG01[48] . '" title="' . $LANG01[48] . '"' . XHTML . '>';
$edit_link_url = COM_createLink($edit_icon, $_CONF['site_url'] . '/usersettings.php');
$user_templates->set_var('edit_icon', $edit_icon);
$user_templates->set_var('edit_link', $edit_link_url);
$user_templates->set_var('user_edit', $edit_link_url);
} elseif (SEC_hasRights('user.edit')) {
$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_icon', $edit_icon);
$user_templates->set_var('edit_link', $edit_link_url);
$user_templates->set_var('user_edit', $edit_link_url);
}
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '(none)';
// user does not have a photo
}
$photo = USER_getPhoto($uid, $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', $uid);
$user_templates->set_var('uid', $uid);
if ($A['email'] != '') {
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->parse('email_option', 'email', true);
//.........这里部分代码省略.........
示例13: CMT_getComment
//.........这里部分代码省略.........
}
//add edit info to text
$dtObject = new Date($B['time'], $_USER['tzid']);
$A['comment'] .= LB . '<div class="comment-edit">' . $LANG03[30] . ' ' . $dtObject->format($_CONF['date'], true) . ' ' . $LANG03[31] . ' ' . $editname . '</div><!-- /COMMENTEDIT -->';
}
// determines indentation for current comment
if ($mode == 'threaded' || $mode == 'nested') {
$indent = ($A['indent'] - $A['pindent']) * $_CONF['comment_indent'];
}
// comment variables
if (!isset($A['uid']) || $A['uid'] == '') {
$A['uid'] = 1;
}
$template->set_var('indent', $indent);
$template->set_var('author_name', $filter->sanitizeUsername($A['username']));
$template->set_var('author_id', $A['uid']);
$template->set_var('cid', $A['cid']);
$template->set_var('cssid', $row % 2);
if ($sid_author_id != '' && $sid_author_id != 1 && $sid_author_id == $A['uid']) {
$template->set_var('author_match', '1');
} else {
$template->set_var('author_match', '');
}
if ($A['uid'] > 1) {
$fullname = COM_getDisplayName($A['uid'], $A['username'], isset($A['fullname']) ? $A['fullname'] : '');
$template->set_var('author_fullname', $fullname);
$template->set_var('author', $fullname);
$alttext = $fullname;
$photo = '';
if ($_CONF['allow_user_photo']) {
if (isset($A['photo']) && empty($A['photo'])) {
$A['photo'] = '';
}
$photo = USER_getPhoto($A['uid'], $A['photo'], $A['email']);
$photo_raw = USER_getPhoto($A['uid'], $A['photo'], $A['email'], 64, 0);
if (!empty($photo)) {
$template->set_var('author_photo', $photo);
$template->set_var('author_photo_raw', $photo_raw);
$camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""/>';
$template->set_var('camera_icon', COM_createLink($camera_icon, $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']));
} else {
$template->set_var('author_photo', '<img src="' . $_CONF['default_photo'] . '" alt="" class="userphoto"/>');
$template->set_var('author_photo_raw', $_CONF['default_photo']);
$template->set_var('camera_icon', '');
}
} else {
$template->set_var('author_photo_raw', '');
$template->set_var('author_photo', '');
$template->set_var('camera_icon', '');
}
$template->set_var('start_author_anchortag', '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">');
$template->set_var('end_author_anchortag', '</a>');
$template->set_var('author_link', COM_createLink($fullname, $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid']));
} else {
$username = $filter->sanitizeUsername($A['name']);
if ($username == '') {
$username = $LANG01[24];
}
$template->set_var('author', $username);
$template->set_var('author_fullname', $username);
$template->set_var('author_link', @htmlspecialchars($username, ENT_COMPAT, COM_getEncodingt()));
if ($_CONF['allow_user_photo']) {
$template->set_var('author_photo_raw', $_CONF['default_photo']);
$template->set_var('author_photo', '<img src="' . $_CONF['default_photo'] . '" alt="" class="userphoto"/>');
$template->set_var('camera_icon', '');
} else {
示例14: STORY_renderArticle
/**
* Takes an article class and renders HTML in the specified template and style.
*
* Formats the given article into HTML. Called by index.php, article.php,
* submit.php and admin/story.php (Preview mode for the last two).
*
* @param object $story The story to display, an instance of the Story class.
* @param string $index n = 'Compact display' for list of stories. p = 'Preview' mode. Else full display of article.
* @param string $storytpl The template to use to render the story.
* @param string $query A search query, if one was specified.
*
* @return string Article as formated HTML.
*
* Note: Formerly named COM_Article, and re-written totally since then.
*/
function STORY_renderArticle(&$story, $index = '', $storytpl = 'storytext.thtml', $query = '')
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG05, $LANG11, $LANG_TRB, $_IMAGE_TYPE, $mode, $_GROUPS, $ratedIds;
static $storycounter = 0;
if (empty($storytpl)) {
$storytpl = 'storytext.thtml';
}
$introtext = $story->displayElements('introtext');
$bodytext = $story->displayElements('bodytext');
if (!empty($query)) {
$introtext = COM_highlightQuery($introtext, $query);
$bodytext = COM_highlightQuery($bodytext, $query);
}
$article = new Template($_CONF['path_layout']);
$article->set_file(array('article' => $storytpl, 'featuredarticle' => 'featuredstorytext.thtml', 'archivearticle' => 'archivestorytext.thtml'));
if ($_CONF['hideviewscount'] != 1) {
$article->set_var('lang_views', $LANG01[106]);
$article->set_var('story_hits', $story->DisplayElements('hits'), false, true);
}
if ($_CONF['hidestorydate'] != 1) {
$article->set_var('story_date', $story->DisplayElements('date'), false, true);
// make sure date format is in user's preferred format
}
$articleUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
$article->set_var('article_url', $articleUrl);
$article->set_var('story_title', $story->DisplayElements('title'));
// begin instance caching...
if ($story->DisplayElements('featured') == 1) {
$article_filevar = 'featuredarticle';
} elseif ($story->DisplayElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE and $story->DisplayElements('expire') <= time()) {
$article_filevar = 'archivearticle';
} else {
$article_filevar = 'article';
}
$hash = CACHE_security_hash();
$instance_id = 'story_' . $story->getSid() . '_' . $index . '_' . $article_filevar . '_' . $hash . '_' . $_USER['theme'];
if ($index == 'p' || !empty($query) || !$article->check_instance($instance_id, $article_filevar)) {
// end of instance cache
$article->set_var('article_filevar', '');
$article->set_var('site_name', $_CONF['site_name']);
if ($_CONF['hidestorydate'] != 1) {
$article->set_var('story_date_short', $story->DisplayElements('shortdate'));
$article->set_var('story_date_only', $story->DisplayElements('dateonly'));
}
$article->set_var('story_id', $story->getSid());
$article->set_var('lang_posted_in', $LANG01['posted_in']);
if ($_CONF['contributedbyline'] == 1) {
$article->set_var('lang_contributed_by', $LANG01[1]);
$article->set_var('lang_by', $LANG01[95]);
$article->set_var('contributedby_uid', $story->DisplayElements('uid'));
$fullname = $story->DisplayElements('fullname');
$username = $story->DisplayElements('username');
$article->set_var('contributedby_user', $username);
if (empty($fullname)) {
$article->set_var('contributedby_fullname', $username);
} else {
$article->set_var('contributedby_fullname', $fullname);
}
$authorname = COM_getDisplayName($story->DisplayElements('uid'), $username, $fullname);
$article->set_var('author', $authorname);
$profileUrl = $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $story->DisplayElements('uid');
if ($story->DisplayElements('uid') > 1) {
$article->set_var('contributedby_url', $profileUrl);
$authorname = COM_createLink($authorname, $profileUrl, array('class' => 'storybyline'));
}
$article->set_var('contributedby_author', $authorname);
$photo = '';
if ($_CONF['allow_user_photo'] == 1) {
$authphoto = $story->DisplayElements('photo');
if (empty($authphoto)) {
$authphoto = '(none)';
// user does not have a photo
}
$photo = USER_getPhoto($story->DisplayElements('uid'), $authphoto, $story->DisplayElements('email'));
}
if (!empty($photo)) {
$article->set_var('contributedby_photo', $photo);
$article->set_var('author_photo', $photo);
$camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . '/>';
$article->set_var('camera_icon', COM_createLink($camera_icon, $profileUrl));
} else {
$article->set_var('contributedby_photo', '');
$article->set_var('author_photo', '');
$article->set_var('camera_icon', '');
}
//.........这里部分代码省略.........
示例15: FF_showtopic
function FF_showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1, $topictemplate)
{
global $_FF_CONF, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02, $_SYSTEM;
global $highlight;
global $forumfiles;
global $canPost;
$retval = '';
if (isset($showtopic['date'])) {
$dt = new Date($showtopic['date'], $_USER['tzid']);
} else {
$dt = new Date('now', $_USER['tzid']);
}
static $cacheUserArray = array();
static $_user_already_voted = array();
$oldPost = 0;
if (!class_exists('StringParser')) {
require_once $_CONF['path'] . 'lib/bbcode/stringparser_bbcode.class.php';
}
if ($mode == 'preview') {
$topictemplate->set_var(array('lang_postpreview' => $LANG_GF01['PREVIEW_HEADER'], 'preview' => true));
}
$min_height = 50;
// Base minimum height of topic - will increase if avatar or sig is used
$foundUser = 0;
if ($showtopic['uid'] > 1) {
if (isset($cacheUserArray[$showtopic['uid']])) {
$userarray = $cacheUserArray[$showtopic['uid']];
$username = $userarray['display_name'];
$location = $userarray['location'];
$posts = $userarray['posts'];
$user_level = $userarray['user_level'];
$user_levelname = $userarray['user_levelname'];
$avatar = $userarray['avatar'];
$onlinestatus = $userarray['onlinestatus'];
$min_height = $userarray['min_height'];
$regdate = $userarray['regdate'];
$numposts = $userarray['numposts'];
$foundUser = 1;
} else {
$sql = "SELECT users.*,userprefs.*,userinfo.*,gf_userinfo.rating,gf_userinfo.signature FROM {$_TABLES['users']} users LEFT JOIN {$_TABLES['userprefs']} userprefs ON users.uid=userprefs.uid LEFT JOIN {$_TABLES['userinfo']} userinfo ON users.uid=userinfo.uid LEFT JOIN {$_TABLES['ff_userinfo']} gf_userinfo ON users.uid=gf_userinfo.uid WHERE users.uid=" . (int) $showtopic['uid'];
$userQuery = DB_query($sql);
if (DB_numRows($userQuery) == 1) {
$userarray = DB_fetchArray($userQuery);
$username = COM_getDisplayName($showtopic['uid']);
$userarray['display_name'] = $username;
$postcount = DB_query("SELECT * FROM {$_TABLES['ff_topic']} WHERE uid='" . (int) $showtopic['uid'] . "'");
$posts = DB_numRows($postcount);
$userarray['posts'] = $posts;
$starimage = '<img src="%s" alt="' . $LANG_GF01['FORUM'] . ' %s" title="' . $LANG_GF01['FORUM'] . ' %s"/>';
if ($posts < $_FF_CONF['level2']) {
$user_level = sprintf($starimage, _ff_getImage('rank1', 'ranks'), $_FF_CONF['level1name'], $_FF_CONF['level1name']);
$user_levelname = $_FF_CONF['level1name'];
} elseif ($posts >= $_FF_CONF['level2'] && $posts < $_FF_CONF['level3']) {
$user_level = sprintf($starimage, _ff_getImage('rank2', 'ranks'), $_FF_CONF['level2name'], $_FF_CONF['level2name']);
$user_levelname = $_FF_CONF['level2name'];
} elseif ($posts >= $_FF_CONF['level3'] && $posts < $_FF_CONF['level4']) {
$user_level = sprintf($starimage, _ff_getImage('rank3', 'ranks'), $_FF_CONF['level3name'], $_FF_CONF['level3name']);
$user_levelname = $_FF_CONF['level3name'];
} elseif ($posts >= $_FF_CONF['level4'] && $posts < $_FF_CONF['level5']) {
$user_level = sprintf($starimage, _ff_getImage('rank4', 'ranks'), $_FF_CONF['level4name'], $_FF_CONF['level4name']);
$user_levelname = $_FF_CONF['level4name'];
} elseif ($posts > $_FF_CONF['level5']) {
$user_level = sprintf($starimage, _ff_getImage('rank5', 'ranks'), $_FF_CONF['level5name'], $_FF_CONF['level5name']);
$user_levelname = $_FF_CONF['level5name'];
}
if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) {
$user_level = sprintf($starimage, _ff_getImage('rank_mod', 'ranks'), $LANG_GF01['moderator'], $LANG_GF01['moderator']);
$user_levelname = $LANG_GF01['moderator'];
}
if (SEC_inGroup(1, $showtopic['uid'])) {
$user_level = sprintf($starimage, _ff_getImage('rank_admin', 'ranks'), $LANG_GF01['admin'], $LANG_GF01['admin']);
$user_levelname = $LANG_GF01['admin'];
}
$userarray['user_level'] = $user_level;
$userarray['user_levelname'] = $user_levelname;
if ($userarray['photo'] != "") {
$avatar = '<img src="' . USER_getPhoto($showtopic['uid'], '', '', '', '0') . '" alt="" title="" class="forum-userphoto" style="width:' . $_FF_CONF['avatar_width'] . 'px;"/>';
$min_height = $min_height + 150;
} else {
if (!isset($_CONF['default_photo']) || $_CONF['default_photo'] == '') {
$img = $_CONF['site_url'] . '/images/userphotos/default.jpg';
} else {
$img = $_CONF['default_photo'];
}
$avatar = '<img src="' . $img . '" alt="" title="" class="forum-userphoto" style="width:' . $_FF_CONF['avatar_width'] . 'px;"/>';
$min_height = $min_height + 150;
}
if ($_FF_CONF['enable_user_rating_system']) {
if ($showtopic['uid'] > 1) {
$min_height = $min_height + 10;
}
}
if (SEC_inGroup('Root') && function_exists('plugin_cclabel_nettools') && isset($showtopic['ip'])) {
$min_height = $min_height + 5;
}
$udt = new Date(strtotime($userarray['regdate']), $_USER['tzid']);
$regdate = $udt->format($_CONF['shortdate'], true) . '<br/>';
$numposts = $posts;
if (DB_count($_TABLES['sessions'], 'uid', (int) $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid=" . (int) $showtopic['uid'] . "") == 1) {
$onlinestatus = $LANG_GF01['ONLINE'];
//.........这里部分代码省略.........