1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-18 21:41:29 +02:00

More comment, user, usersetting fixes.

This commit is contained in:
CaMer0n
2012-06-19 12:53:48 +00:00
parent aa4e5c0ee7
commit 63ce10c606
7 changed files with 733 additions and 625 deletions

View File

@@ -101,13 +101,21 @@ class comment_shortcodes extends e_shortcode
function sc_comment_avatar($parm) function sc_comment_avatar($parm)
{ {
$height = e107::getPref("im_height");
$width = e107::getPref("im_width");
$tp = e107::getParser(); $tp = e107::getParser();
// //
return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}"); $text = $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}");
exit; $text .= "<div class='field-help' style='display;none;'>
<div class='left'>";
$text .= "<h2>".$this->sc_username()."</h2>";
// $text .= e107::getDate()-> // convert($this->var['user_lastvisit'],'short');
$text .= $this->sc_joined()."<br />".$this->sc_comments()."<br />".$this->sc_rating().$this->sc_location;
$text .= "
</div>
</div>";
return $text;
} }

View File

@@ -13,11 +13,12 @@
* *
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
$user_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
/*
SC_BEGIN TOTAL_CHATPOSTS class user_shortcodes extends e_shortcode
{
function sc_total_chatposts($parm) {
global $sql; global $sql;
if(!$chatposts = getcachedvars('total_chatposts')) if(!$chatposts = getcachedvars('total_chatposts'))
{ {
@@ -29,9 +30,12 @@ if(!$chatposts = getcachedvars('total_chatposts'))
cachevars('total_chatposts', $chatposts); cachevars('total_chatposts', $chatposts);
} }
return $chatposts; return $chatposts;
SC_END }
SC_BEGIN TOTAL_COMMENTPOSTS
function sc_total_commentposts($parm)
{
global $sql; global $sql;
if(!$commentposts = getcachedvars('total_commentposts')) if(!$commentposts = getcachedvars('total_commentposts'))
{ {
@@ -39,9 +43,12 @@ if(!$commentposts = getcachedvars('total_commentposts'))
cachevars('total_commentposts', $commentposts); cachevars('total_commentposts', $commentposts);
} }
return $commentposts; return $commentposts;
SC_END }
SC_BEGIN TOTAL_FORUMPOSTS
function sc_total_forumposts($parm)
{
global $sql; global $sql;
if(!$forumposts = getcachedvars('total_forumposts')) if(!$forumposts = getcachedvars('total_forumposts'))
{ {
@@ -49,31 +56,37 @@ if(!$forumposts = getcachedvars('total_forumposts'))
cachevars('total_forumposts', $forumposts); cachevars('total_forumposts', $forumposts);
} }
return $forumposts; return $forumposts;
SC_END }
SC_BEGIN USER_COMMENTPOSTS
global $user;
return $user['user_comments'];
SC_END
SC_BEGIN USER_FORUMPOSTS
global $user;
return $user['user_forums'];
SC_END
SC_BEGIN USER_CHATPOSTS function sc_user_commentposts($parm)
global $user; {
return $user['user_chats']; return $this->var['user_comments'];
SC_END }
SC_BEGIN USER_DOWNLOADS
global $sql,$user;
$downloads = $sql->db_Count("download_requests","(*)","where download_request_userid=".$user['user_id']);
return $downloads;
SC_END
SC_BEGIN USER_CHATPER
global $sql, $user; function sc_user_forumposts($parm)
{
return $this->var['user_forums'];
}
function sc_user_chatposts($parm)
{
return $this->var['user_chats'];
}
function sc_user_downloads($parm)
{
return e107::getDb()->db_Count("download_requests","(*)","where download_request_userid=".$this->var['user_id']);
}
function sc_user_chatper($parm)
{
$sql = e107::getDb();
if(!$chatposts = getcachedvars('total_chatposts')) if(!$chatposts = getcachedvars('total_chatposts'))
{ {
$chatposts = 0; // In case plugin not installed $chatposts = 0; // In case plugin not installed
@@ -83,34 +96,43 @@ if(!$chatposts = getcachedvars('total_chatposts'))
} }
cachevars('total_chatposts', $chatposts); cachevars('total_chatposts', $chatposts);
} }
return ($chatposts!=0) ? round(($user['user_chats']/$chatposts) * 100, 2): 0; return ($chatposts!=0) ? round(($this->var['user_chats']/$chatposts) * 100, 2): 0;
SC_END }
SC_BEGIN USER_COMMENTPER
global $sql, $user;
function sc_user_commentper($parm)
{
$sql = e107::getDb();
if(!$commentposts = getcachedvars('total_commentposts')) if(!$commentposts = getcachedvars('total_commentposts'))
{ {
$commentposts = $sql->db_Count("comments"); $commentposts = $sql->db_Count("comments");
cachevars('total_commentposts', $commentposts); cachevars('total_commentposts', $commentposts);
} }
return ($commentposts!=0) ? round(($user['user_comments']/$commentposts) * 100, 2): 0; return ($commentposts!=0) ? round(($this->var['user_comments']/$commentposts) * 100, 2): 0;
SC_END }
SC_BEGIN USER_FORUMPER
global $sql, $user;
function sc_user_forumper($parm)
{
$sql = e107::getDb();
if(!$forumposts = getcachedvars('total_forumposts')) if(!$forumposts = getcachedvars('total_forumposts'))
{ {
$forumposts = (isset($pref['plug_installed']['forum'])) ? $sql->db_Count("forum_t"): 0; $forumposts = (isset($pref['plug_installed']['forum'])) ? $sql->db_Count("forum_t"): 0;
cachevars('total_forumposts', $forumposts); cachevars('total_forumposts', $forumposts);
} }
return ($forumposts!==0) ? round(($user['user_forums']/$forumposts) * 100, 2): 0; return ($forumposts!==0) ? round(($this->var['user_forums']/$forumposts) * 100, 2): 0;
SC_END }
SC_BEGIN USER_LEVEL
global $user, $pref;
function sc_user_level($parm)
{
$pref = e107::getPref();
//FIXME - new level handler, currently commented to avoid parse errors //FIXME - new level handler, currently commented to avoid parse errors
//require_once(e_HANDLER."level_handler.php"); //require_once(e_HANDLER."level_handler.php");
//$ldata = get_level($user['user_id'], $user['user_forums'], $user['user_comments'], $user['user_chats'], $user['user_visits'], $user['user_join'], $user['user_admin'], $user['user_perms'], $pref); //$ldata = get_level($this->var['user_id'], $this->var['user_forums'], $this->var['user_comments'], $this->var['user_chats'], $this->var['user_visits'], $this->var['user_join'], $this->var['user_admin'], $this->var['user_perms'], $pref);
$ldata = array(); $ldata = array();
if (strstr($ldata[0], "IMAGE_rank_main_admin_image")) if (strstr($ldata[0], "IMAGE_rank_main_admin_image"))
{ {
@@ -124,39 +146,51 @@ else
{ {
return $USER_LEVEL = $ldata[1]; return $USER_LEVEL = $ldata[1];
} }
SC_END }
SC_BEGIN USER_LASTVISIT
global $user;
function sc_user_lastvisit($parm)
{
$gen = new convert; $gen = new convert;
return $user['user_currentvisit'] ? $gen->convert_date($user['user_currentvisit'], "long") : "<i>".LAN_USER_33."</i>"; return $this->var['user_currentvisit'] ? $gen->convert_date($this->var['user_currentvisit'], "long") : "<i>".LAN_USER_33."</i>";
SC_END }
SC_BEGIN USER_LASTVISIT_LAPSE
global $user;
function sc_user_lastvisit_lapse($parm)
{
$gen = new convert; $gen = new convert;
return $user['user_currentvisit'] ? "( ".$gen -> computeLapse($user['user_currentvisit'])." ".LAN_USER_34." )" : ''; return $this->var['user_currentvisit'] ? "( ".$gen -> computeLapse($this->var['user_currentvisit'])." ".LAN_USER_34." )" : '';
SC_END }
SC_BEGIN USER_VISITS
global $user;
return $user['user_visits'];
SC_END
SC_BEGIN USER_JOIN
global $user; function sc_user_visits($parm)
{
return $this->var['user_visits'];
}
function sc_user_join($parm)
{
$gen = new convert; $gen = new convert;
return $gen->convert_date($user['user_join'], "forum"); return $gen->convert_date($this->var['user_join'], "forum");
SC_END }
SC_BEGIN USER_DAYSREGGED
global $user;
function sc_user_daysregged($parm)
{
$gen = new convert; $gen = new convert;
return $gen -> computeLapse($user['user_join'])." ".LAN_USER_34; return $gen -> computeLapse($this->var['user_join'])." ".LAN_USER_34;
SC_END }
SC_BEGIN USER_REALNAME_ICON
function sc_user_realname_icon($parm)
{
if(defined("USER_REALNAME_ICON")) if(defined("USER_REALNAME_ICON"))
{ {
return USER_REALNAME_ICON; return USER_REALNAME_ICON;
@@ -166,15 +200,19 @@ if(file_exists(THEME."images/user_realname.png"))
return "<img src='".THEME_ABS."images/user_realname.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".THEME_ABS."images/user_realname.png' alt='' style='vertical-align:middle;' /> ";
} }
return "<img src='".e_IMAGE_ABS."user_icons/user_realname.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".e_IMAGE_ABS."user_icons/user_realname.png' alt='' style='vertical-align:middle;' /> ";
SC_END }
SC_BEGIN USER_REALNAME
global $user;
return $user['user_login'] ? $user['user_login'] : "<i>".LAN_USER_33."</i>";
SC_END
SC_BEGIN USER_EMAIL_ICON
function sc_user_realname($parm)
{
return $this->var['user_login'] ? $this->var['user_login'] : "<i>".LAN_USER_33."</i>";
}
function sc_user_email_icon($parm)
{
if(defined("USER_EMAIL_ICON")) if(defined("USER_EMAIL_ICON"))
{ {
return USER_EMAIL_ICON; return USER_EMAIL_ICON;
@@ -184,19 +222,28 @@ if(file_exists(THEME."images/email.png"))
return "<img src='".THEME_ABS."images/email.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".THEME_ABS."images/email.png' alt='' style='vertical-align:middle;' /> ";
} }
return "<img src='".e_IMAGE_ABS."generic/email.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".e_IMAGE_ABS."generic/email.png' alt='' style='vertical-align:middle;' /> ";
SC_END }
SC_BEGIN USER_EMAIL_LINK
function sc_user_email_link($parm)
{
global $user, $tp; global $user, $tp;
return ($user['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->parseTemplate("{email={$user['user_email']}-link}"); return ($this->var['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->parseTemplate("{email={$this->var['user_email']}-link}");
SC_END }
SC_BEGIN USER_EMAIL
global $user,$tp;
return ($user['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->toHTML($user['user_email'],"no_replace");
SC_END
SC_BEGIN USER_ICON
function sc_user_email($parm)
{
$tp = e107::getParser();
return ($this->var['user_hideemail'] && !ADMIN) ? "<i>".LAN_USER_35."</i>" : $tp->toHTML($this->var['user_email'],"no_replace");
}
function sc_user_icon($parm)
{
if(defined("USER_ICON")) if(defined("USER_ICON"))
{ {
return USER_ICON; return USER_ICON;
@@ -206,11 +253,14 @@ if(file_exists(THEME."images/user.png"))
return "<img src='".THEME_ABS."images/user.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".THEME_ABS."images/user.png' alt='' style='vertical-align:middle;' /> ";
} }
return "<img src='".e_IMAGE_ABS."user_icons/user.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".e_IMAGE_ABS."user_icons/user.png' alt='' style='vertical-align:middle;' /> ";
SC_END }
SC_BEGIN USER_ICON_LINK
global $user;
$uparams = array('id' => $user['user_id'], 'name' => $user['user_name']); function sc_user_icon_link($parm)
{
$uparams = array('id' => $this->var['user_id'], 'name' => $this->var['user_name']);
$url = e107::getUrl(); $url = e107::getUrl();
if(defined("USER_ICON")) if(defined("USER_ICON"))
{ {
@@ -225,34 +275,44 @@ else
$icon = "<img src='".e_IMAGE_ABS."user_icons/user.png' alt='' style='vertical-align:middle;' /> "; $icon = "<img src='".e_IMAGE_ABS."user_icons/user.png' alt='' style='vertical-align:middle;' /> ";
} }
return "<a href='".$url->create('user/profile/view', $uparams)."'>{$icon}</a>"; return "<a href='".$url->create('user/profile/view', $uparams)."'>{$icon}</a>";
SC_END
SC_BEGIN USER_ID
global $user;
return $user['user_id'];
SC_END
SC_BEGIN USER_NAME
global $user;
return $user['user_name'];
SC_END
SC_BEGIN USER_NAME_LINK
global $user;
$uparams = array('id' => $user['user_id'], 'name' => $user['user_name']);
$url = e107::getUrl();
return "<a href='".$url->create('user/profile/view', $uparams)."'>".$user['user_name']."</a>";
SC_END
SC_BEGIN USER_LOGINNAME
global $user;
if(ADMIN && getperms("4")) {
return $user['user_loginname'];
} }
SC_END
SC_BEGIN USER_BIRTHDAY_ICON
function sc_user_id($parm)
{
return $this->var['user_id'];
}
function sc_user_name($parm)
{
return $this->var['user_name'];
}
function sc_user_name_link($parm)
{
$uparams = array('id' => $this->var['user_id'], 'name' => $this->var['user_name']);
$url = e107::getUrl();
return "<a href='".$url->create('user/profile/view', $uparams)."'>".$this->var['user_name']."</a>";
}
function sc_user_loginname($parm)
{
if(ADMIN && getperms("4")) {
return $this->var['user_loginname'];
}
}
function sc_user_birthday_icon($parm)
{
if(defined("USER_BIRTHDAY_ICON")) if(defined("USER_BIRTHDAY_ICON"))
{ {
return USER_BIRTHDAY_ICON; return USER_BIRTHDAY_ICON;
@@ -262,11 +322,13 @@ if(file_exists(THEME."images/user_birthday.png"))
return "<img src='".THEME_ABS."images/user_birthday.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".THEME_ABS."images/user_birthday.png' alt='' style='vertical-align:middle;' /> ";
} }
return "<img src='".e_IMAGE_ABS."user_icons/user_birthday.png' alt='' style='vertical-align:middle;' /> "; return "<img src='".e_IMAGE_ABS."user_icons/user_birthday.png' alt='' style='vertical-align:middle;' /> ";
SC_END }
SC_BEGIN USER_BIRTHDAY
global $user;
if ($user['user_birthday'] != "" && $user['user_birthday'] != "0000-00-00" && preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $user['user_birthday'], $regs)) function sc_user_birthday($parm)
{
if ($this->var['user_birthday'] != "" && $this->var['user_birthday'] != "0000-00-00" && preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $this->var['user_birthday'], $regs))
{ {
return "$regs[3].$regs[2].$regs[1]"; return "$regs[3].$regs[2].$regs[1]";
} }
@@ -274,39 +336,53 @@ else
{ {
return "<i>".LAN_USER_33."</i>"; return "<i>".LAN_USER_33."</i>";
} }
SC_END
SC_BEGIN USER_SIGNATURE
global $tp, $user;
return $user['user_signature'] ? $tp->toHTML($user['user_signature'], TRUE) : "";
SC_END
SC_BEGIN USER_COMMENTS_LINK
global $user;
return $user['user_comments'] ? "<a href='".e_HTTP."userposts.php?0.comments.".$user['user_id']."'>".LAN_USER_36."</a>" : "";
SC_END
SC_BEGIN USER_FORUM_LINK
global $user;
return $user['user_forums'] ? "<a href='".e_HTTP."userposts.php?0.forums.".$user['user_id']."'>".LAN_USER_37."</a>" : "";
SC_END
SC_BEGIN USER_SENDPM
global $pref, $tp, $user;
if(isset($pref['plug_installed']['pm']) && ($user['user_id'] > 0))
{
return $tp->parseTemplate("{SENDPM={$user['user_id']}}");
} }
SC_END
SC_BEGIN USER_RATING
global $pref, $user;
function sc_user_signature($parm)
{
$tp = e107::getParser();
return $this->var['user_signature'] ? $tp->toHTML($this->var['user_signature'], TRUE) : "";
}
function sc_user_comments_link($parm)
{
return $this->var['user_comments'] ? "<a href='".e_HTTP."userposts.php?0.comments.".$this->var['user_id']."'>".LAN_USER_36."</a>" : "";
}
function sc_user_forum_link($parm)
{
global $user;
return $this->var['user_forums'] ? "<a href='".e_HTTP."userposts.php?0.forums.".$this->var['user_id']."'>".LAN_USER_37."</a>" : "";
}
function sc_user_sendpm($parm)
{
global $pref, $tp, $user;
if(isset($pref['plug_installed']['pm']) && ($this->var['user_id'] > 0))
{
return $tp->parseTemplate("{SENDPM={$this->var['user_id']}}");
}
}
function sc_user_rating($parm)
{
$pref = e107::getPref();
if($pref['profile_rate'] && USER) if($pref['profile_rate'] && USER)
{ {
include_once(e_HANDLER."rate_class.php"); include_once(e_HANDLER."rate_class.php");
$rater = new rater; $rater = new rater;
$ret = "<span>"; $ret = "<span>";
if($rating = $rater->getrating('user', $user['user_id'])) if($rating = $rater->getrating('user', $this->var['user_id']))
{ {
$num = $rating[1]; $num = $rating[1];
for($i=1; $i<= $num; $i++) for($i=1; $i<= $num; $i++)
@@ -314,45 +390,51 @@ if($pref['profile_rate'] && USER)
$ret .= "<img src='".e_IMAGE_ABS."user_icons/user_star.png' alt='' />"; $ret .= "<img src='".e_IMAGE_ABS."user_icons/user_star.png' alt='' />";
} }
} }
if(!$rater->checkrated('user', $user['user_id'])) if(!$rater->checkrated('user', $this->var['user_id']))
{ {
$ret .= " &nbsp; &nbsp;".$rater->rateselect('', 'user', $user['user_id']); $ret .= " &nbsp; &nbsp;".$rater->rateselect('', 'user', $this->var['user_id']);
} }
$ret .= "</span>"; $ret .= "</span>";
return $ret; return $ret;
} }
return ""; return "";
SC_END }
SC_BEGIN USER_UPDATE_LINK
global $user;
function sc_user_update_link($parm)
{
$url = e107::getUrl(); $url = e107::getUrl();
if (USERID == $user['user_id']) if (USERID == $this->var['user_id'])
{ {
//return "<a href='".$url->create('user/myprofile/edit')."'>".LAN_USER_38."</a>"; //return "<a href='".$url->create('user/myprofile/edit')."'>".LAN_USER_38."</a>";
return "<a href='usersettings.php' alt=''>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings return "<a href='usersettings.php' alt=''>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
} }
else if(ADMIN && getperms("4") && !$user['user_admin']) else if(ADMIN && getperms("4") && !$this->var['user_admin'])
{ {
return "<a href='".$url->create('user/profile/edit', array('id' => $user['user_id'], 'name' => $user['user_name']))."'>".LAN_USER_39."</a>"; return "<a href='".$url->create('user/profile/edit', array('id' => $this->var['user_id'], 'name' => $this->var['user_name']))."'>".LAN_USER_39."</a>";
}
} }
SC_END
SC_BEGIN USER_JUMP_LINK
global $sql, $user, $full_perms;
function sc_user_jump_link($parm)
{
global $full_perms;
$sql = e107::getDb();
if (!$full_perms) return; if (!$full_perms) return;
$url = e107::getUrl(); $url = e107::getUrl();
if(!$userjump = getcachedvars('userjump')) if(!$userjump = getcachedvars('userjump'))
{ {
// $sql->db_Select("user", "user_id, user_name", "`user_id` > ".intval($user['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 "); // $sql->db_Select("user", "user_id, user_name", "`user_id` > ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 ");
$sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` > ".intval($user['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 "); $sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` > ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id ASC LIMIT 1 ");
if ($row = $sql->db_Fetch()) if ($row = $sql->db_Fetch())
{ {
$userjump['next']['id'] = $row['user_id']; $userjump['next']['id'] = $row['user_id'];
$userjump['next']['name'] = $row['user_name']; $userjump['next']['name'] = $row['user_name'];
} }
// $sql->db_Select("user", "user_id, user_name", "`user_id` < ".intval($user['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 "); // $sql->db_Select("user", "user_id, user_name", "`user_id` < ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 ");
$sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` < ".intval($user['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 "); $sql->db_Select_gen("SELECT user_id, user_name FROM `#user` FORCE INDEX (PRIMARY) WHERE `user_id` < ".intval($this->var['user_id'])." AND `user_ban`=0 ORDER BY user_id DESC LIMIT 1 ");
if ($row = $sql->db_Fetch()) if ($row = $sql->db_Fetch())
{ {
$userjump['prev']['id'] = $row['user_id']; $userjump['prev']['id'] = $row['user_id'];
@@ -368,43 +450,39 @@ else
{ {
return isset($userjump['next']['id']) ? "[ <a href='".$url->create('user/profile/view', $userjump['next'])."'>".$userjump['next']['name']."</a> ] ".LAN_USER_41." &gt;&gt;" : "&nbsp;"; return isset($userjump['next']['id']) ? "[ <a href='".$url->create('user/profile/view', $userjump['next'])."'>".$userjump['next']['name']."</a> ] ".LAN_USER_41." &gt;&gt;" : "&nbsp;";
} }
SC_END }
SC_BEGIN USER_PICTURE
global $user;
if ($user['user_sess'] && file_exists(e_UPLOAD."avatars/".$user['user_sess'])) function sc_user_picture($parm)
{ {
return "<img src='".e_UPLOAD_ABS."public/avatars/".$user['user_sess']."' alt='' />"; if ($this->var['user_sess'] && file_exists(e_MEDIA."avatars/".$this->var['user_sess']))
{
//return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}", true);
return "<img src='".e_UPLOAD_ABS."public/avatars/".$this->var['user_sess']."' alt='' />";
} }
else else
{ {
return LAN_USER_42; return LAN_USER_42;
} }
SC_END
SC_BEGIN USER_AVATAR
global $user, $tp;
if ($user['user_image'])
{
return $tp->parseTemplate("{USER_AVATAR=".$user['user_image']."}", true);
} }
else
/* sc_USER_AVATAR - see single/user_avatar.php */
function sc_user_picture_name($parm)
{ {
return LAN_USER_42;
}
SC_END
SC_BEGIN USER_PICTURE_NAME
global $user;
if (ADMIN && getperms("4")) if (ADMIN && getperms("4"))
{ {
return $user['user_sess']; return $this->var['user_sess'];
}
} }
SC_END
SC_BEGIN USER_PICTURE_DELETE
if (USERID == $user['user_id'] || (ADMIN && getperms("4")))
function sc_user_picture_delete($parm)
{
if (USERID == $this->var['user_id'] || (ADMIN && getperms("4")))
{ {
return " return "
<form method='post' action='".e_SELF."?".e_QUERY."'> <form method='post' action='".e_SELF."?".e_QUERY."'>
@@ -412,11 +490,15 @@ if (USERID == $user['user_id'] || (ADMIN && getperms("4")))
</form> </form>
"; ";
} }
SC_END }
SC_BEGIN USER_EXTENDED_ALL
global $user, $tp, $sql;
function sc_user_extended_all($parm)
{
$sql = e107::getDb();
$tp = e107::getParser();
global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE; global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE;
$qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f $qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f
LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id
@@ -435,7 +517,7 @@ $ret = "";
foreach($ueCatList as $catnum => $cat) foreach($ueCatList as $catnum => $cat)
{ {
$key = $cat[0]['user_extended_struct_text'] ? $cat[0]['user_extended_struct_text'] : $cat[0]['user_extended_struct_name']; $key = $cat[0]['user_extended_struct_text'] ? $cat[0]['user_extended_struct_text'] : $cat[0]['user_extended_struct_name'];
$cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$user['user_id']}}", TRUE); $cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE);
if($cat_name != FALSE && count($ueFieldList[$catnum])) if($cat_name != FALSE && count($ueFieldList[$catnum]))
{ {
@@ -443,14 +525,14 @@ foreach($ueCatList as $catnum => $cat)
foreach($ueFieldList[$catnum] as $f) foreach($ueFieldList[$catnum] as $f)
{ {
$key = $f['user_extended_struct_name']; $key = $f['user_extended_struct_name'];
if($ue_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$user['user_id']}}", TRUE)) if($ue_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE))
{ {
$extended_record = str_replace("EXTENDED_ICON","USER_EXTENDED={$key}.icon", $EXTENDED_CATEGORY_TABLE); $extended_record = str_replace("EXTENDED_ICON","USER_EXTENDED={$key}.icon", $EXTENDED_CATEGORY_TABLE);
$extended_record = str_replace("{EXTENDED_NAME}", $tp->toHTML($ue_name,"","defs"), $extended_record); $extended_record = str_replace("{EXTENDED_NAME}", $tp->toHTML($ue_name,"","defs"), $extended_record);
$extended_record = str_replace("EXTENDED_VALUE","USER_EXTENDED={$key}.value.{$user['user_id']}", $extended_record); $extended_record = str_replace("EXTENDED_VALUE","USER_EXTENDED={$key}.value.{$this->var['user_id']}", $extended_record);
if(HIDE_EMPTY_FIELDS === TRUE) if(HIDE_EMPTY_FIELDS === TRUE)
{ {
$this_value = $tp->parseTemplate("{USER_EXTENDED={$key}.value.{$user['user_id']}}", TRUE); $this_value = $tp->parseTemplate("{USER_EXTENDED={$key}.value.{$this->var['user_id']}}", TRUE);
if($this_value != "") if($this_value != "")
{ {
$ret .= $tp->parseTemplate($extended_record, TRUE); $ret .= $tp->parseTemplate($extended_record, TRUE);
@@ -466,64 +548,41 @@ foreach($ueCatList as $catnum => $cat)
$ret .= $EXTENDED_CATEGORY_END; $ret .= $EXTENDED_CATEGORY_END;
} }
return $ret; return $ret;
SC_END
SC_BEGIN PROFILE_COMMENTS
global $user, $pref, $sql, $ns;
if($pref['profile_comments'])
{
$ret = e107::getSingleton('comment')->compose_comment('profile', 'comment', $user['user_id'], null, $user['user_name'], FALSE,true);
return $ns->tablerender($ret['caption'],$ret['comment_form']. $ret['comment'], 'profile_comments', TRUE);
include_once(e_HANDLER."comment_class.php");
$cobj = new comment;
$qry = "
SELECT c.*, u.*, ue.* FROM #comments AS c
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id
WHERE c.comment_item_id=".intval($user['user_id'])."
AND c.comment_type='profile'
AND c.comment_pid='0'
ORDER BY c.comment_datestamp
";
if($comment_total = $sql->db_Select_gen($qry))
{
while($row = $sql->db_Fetch())
{
$ret .= $cobj->render_comment($row);
} }
}
return $ns->tablerender(COMLAN_5, $ret, 'profile_comments', TRUE);
function sc_profile_comments($parm)
{
if(e107::getPref('profile_comments'))
{
$ret = e107::getComment()->compose_comment('profile', 'comment', $this->var['user_id'], null, $this->var['user_name'], FALSE,true);
return e107::getRender()->tablerender($ret['caption'],$ret['comment_form']. $ret['comment'], 'profile_comments', TRUE);
} }
return ""; return "";
SC_END }
SC_BEGIN PROFILE_COMMENT_FORM
function sc_profile_comment_form($parm) // deprecated.
{
return ; return ;
global $pref, $user;
if($pref['profile_comments'])
{
include_once(e_HANDLER."comment_class.php");
$cobj = new comment;
$ret = "";
if(ADMIN === TRUE)
{
$ret .= "<a href='".e_BASE.e_ADMIN."modcomment.php?profile.{$user['user_id']}'>".COMLAN_314."</a><br /><br />";
} }
$ret .= $cobj->form_comment("comment", "profile", $user['user_id'], $user['user_name'], "", TRUE);
return $ret;
}
SC_END
SC_BEGIN TOTAL_USERS
function sc_total_users($parm)
{
global $users_total; global $users_total;
return $users_total; return $users_total;
SC_END }
SC_BEGIN USER_FORM_RECORDS
function sc_user_form_records($parm)
{
global $records, $user_frm; global $records, $user_frm;
$ret = $user_frm->form_select_open("records"); $ret = $user_frm->form_select_open("records");
for($i=10; $i<=30; $i+=10) for($i=10; $i<=30; $i+=10)
@@ -533,10 +592,11 @@ for($i=10; $i<=30; $i+=10)
} }
$ret .= $user_frm->form_select_close(); $ret .= $user_frm->form_select_close();
return $ret; return $ret;
SC_END }
SC_BEGIN USER_FORM_ORDER function sc_user_form_order($parm)
{
global $order; global $order;
if ($order == "ASC") if ($order == "ASC")
{ {
@@ -553,26 +613,36 @@ else
</select>"; </select>";
} }
return $ret; return $ret;
SC_END }
SC_BEGIN USER_FORM_START function sc_user_form_start($parm)
{
global $from; global $from;
return " return "
<form method='post' action='".e_SELF."'> <form method='post' action='".e_SELF."'>
<p><input type='hidden' name='from' value='$from' /></p> <p><input type='hidden' name='from' value='$from' /></p>
"; ";
SC_END }
SC_BEGIN USER_FORM_END
function sc_user_form_end($parm)
{
return "</form>"; return "</form>";
SC_END }
SC_BEGIN USER_FORM_SUBMIT
function sc_user_form_submit($parm)
{
return "<input class='button' type='submit' name='submit' value='".LAN_USER_47."' />"; return "<input class='button' type='submit' name='submit' value='".LAN_USER_47."' />";
SC_END }
SC_BEGIN USER_EMBED_USERPROFILE
function sc_user_embed_userprofile($parm)
{
global $pref, $USER_EMBED_USERPROFILE_TEMPLATE, $embed_already_rendered; global $pref, $USER_EMBED_USERPROFILE_TEMPLATE, $embed_already_rendered;
//if no parm, it means we render ALL embedded contents //if no parm, it means we render ALL embedded contents
@@ -648,12 +718,16 @@ foreach($arr as $data){
} }
} }
return $ret; return $ret;
SC_END }
SC_BEGIN USER_CUSTOMTITLE
global $user;
return $user['user_customtitle'];
SC_END
*/
function sc_user_customtitle($parm)
{
return $this->var['user_customtitle'];
}
}
?> ?>

View File

@@ -44,7 +44,7 @@ function user_avatar_shortcode($parm='')
{ {
$img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"aw=".$width."&ah=".$height); $img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"aw=".$width."&ah=".$height);
$text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' /> $text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />
<div class='field-help' style='display;none'>User info here</div>"; ";
} }
else else
{ {

View File

@@ -75,7 +75,11 @@ $sc_style['LOGINNAME']['post'] = "</td></tr>\n";
$sc_style['SIGNATURE']['pre'] = "<tr><td style='width:40%;vertical-align:top' class='forumheader3'>".LAN_USER_71.req($pref['signup_option_signature'])."</td> $sc_style['SIGNATURE']['pre'] = "<tr><td style='width:40%;vertical-align:top' class='forumheader3'>".LAN_USER_71.req($pref['signup_option_signature'])."</td>
<td style='width:60%' class='forumheader2'>"; <td style='width:60%' class='forumheader2'>";
$sc_style['SIGNATURE_HELP']['pre'] = "</td></tr>"; //$sc_style['SIGNATURE']['pre'] = "<tr><td style='width:40%;vertical-align:top' class='forumheader3'></td>
// <td style='width:60%' class='forumheader2'>";
// $sc_style['SIGNATURE_HELP']['pre'] = "</td></tr>"; \
$sc_style['SIGNATURE_HELP']['post'] = "</td></tr>";
$USER_EXTENDED_CAT = "<tr><td colspan='2' class='forumheader'>{CATNAME}</td></tr>"; $USER_EXTENDED_CAT = "<tr><td colspan='2' class='forumheader'>{CATNAME}</td></tr>";

View File

@@ -133,6 +133,8 @@ div.bbcode { margin: 15px 0px; clear: both; } /* layout control via bbcodes */
/* default comments layout */ /* default comments layout */
.comment-box { padding-bottom:10px; margin-bottom:10px; border-top:1px solid #C0C0C0; } .comment-box { padding-bottom:10px; margin-bottom:10px; border-top:1px solid #C0C0C0; }
.comment-box-left { float:left; text-align:center; width:10%; min-width:100px } .comment-box-left { float:left; text-align:center; width:10%; min-width:100px }
@@ -145,7 +147,7 @@ div.comment-avatar { margin-top:5px; padding:10px 10px 0px 10px; }
img.user-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px 10px; -moz-box-shadow:#CCCCCC 0px 0px 10px; box-shadow:#CCCCCC 0px 0px 10px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } img.user-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px 10px; -moz-box-shadow:#CCCCCC 0px 0px 10px; box-shadow:#CCCCCC 0px 0px 10px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; }
.comment-box-right { width:85%; min-height: 70px; float:left; } .comment-box-right { width:auto; min-height: 70px; float:left; }
.comment-box-arrow { width:11px; height:26px; float:left; position:relative; top:5px; left:-18px; } .comment-box-arrow { width:11px; height:26px; float:left; position:relative; top:5px; left:-18px; }
@@ -155,7 +157,9 @@ img.user-avatar { max-width:128px; -webkit-box-shadow:#CCCCCC 0px 0px 1
.comment-replyxxx { position:relative; bottom:0px; right:-10px; padding:2px 5px; font-size:0.85em; background-color:#EBFAFF; border:1px solid #C6F1FF; border-bottom:0px none; border-right:0px none; -webkit-border-top-left-radius: 5px; -moz-border-radius-topleft: 5px; border-top-left-radius: 5px; } .comment-replyxxx { position:relative; bottom:0px; right:-10px; padding:2px 5px; font-size:0.85em; background-color:#EBFAFF; border:1px solid #C6F1FF; border-bottom:0px none; border-right:0px none; -webkit-border-top-left-radius: 5px; -moz-border-radius-topleft: 5px; border-top-left-radius: 5px; }
.comment-input { width:100% } .comment-input { width:100%; }
.comment-box-right textarea { border:1px solid red; width: 90%; resize: none; margin:0px auto;}
.comment-status { float:right; font-style: italic } .comment-status { float:right; font-style: italic }
@@ -179,7 +183,9 @@ div.e-comment-edit-save { margin-top:8px; padding: 5px }
.e-rate-up img { opacity: 0.4 } .e-rate-up img { opacity: 0.4 }
.e-rate-down img { opacity: 0.4 } .e-rate-down img { opacity: 0.4 }
#comments-container .comment-box:nth-child(even) {
background: red;
}
.divider { border-bottom: 1px solid silver; font-size: 18px; margin-bottom: 30px; position: relative; text-align: center; } .divider { border-bottom: 1px solid silver; font-size: 18px; margin-bottom: 30px; position: relative; text-align: center; }
.divider span { background: #fff; padding: 0 15px; position: relative; top: 10px; } .divider span { background: #fff; padding: 0 15px; position: relative; top: 10px; }

View File

@@ -21,7 +21,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
global $user; global $user;
$user['user_id'] = USERID; $user['user_id'] = USERID;
require_once(e_CORE."shortcodes/batch/user_shortcodes.php"); // require_once(e_CORE."shortcodes/batch/user_shortcodes.php");
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."form_handler.php");
if (isset($_POST['delp'])) if (isset($_POST['delp']))
@@ -45,6 +45,16 @@ if (isset($_POST['delp']))
$qs = explode(".", e_QUERY); $qs = explode(".", e_QUERY);
$self_page =($qs[0] == 'id' && intval($qs[1]) == USERID); $self_page =($qs[0] == 'id' && intval($qs[1]) == USERID);
include_once(e107::coreTemplatePath('user')); //correct way to load a core template.
$user_shortcodes = e107::getScBatch('user');
/*
if (file_exists(THEME."user_template.php")) if (file_exists(THEME."user_template.php"))
{ {
require_once(THEME."user_template.php"); require_once(THEME."user_template.php");
@@ -53,6 +63,8 @@ else
{ {
require_once(e_BASE.$THEMES_DIRECTORY."templates/user_template.php"); require_once(e_BASE.$THEMES_DIRECTORY."templates/user_template.php");
} }
*/
$user_frm = new form; $user_frm = new form;
require_once(HEADERF); require_once(HEADERF);
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); } if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
@@ -164,6 +176,7 @@ else
foreach ($userList as $row) foreach ($userList as $row)
{ {
$loop_uid = $row['user_id']; $loop_uid = $row['user_id'];
$text .= renderuser($row, "short"); $text .= renderuser($row, "short");
} }
$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes); $text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
@@ -193,6 +206,8 @@ function renderuser($uid, $mode = "verbose")
} }
} }
e107::getScBatch('user')->setVars($user);
if($mode == 'verbose') if($mode == 'verbose')
{ {
return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes); return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes);

View File

@@ -57,10 +57,11 @@ $userMethods = e107::getUserSession();
require_once (e_HANDLER.'ren_help.php'); require_once (e_HANDLER.'ren_help.php');
include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template. include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template.
include_once (e_CORE.'shortcodes/batch/usersettings_shortcodes.php'); // include_once (e_CORE.'shortcodes/batch/usersettings_shortcodes.php');
$usersettings_shortcodes = e107::getScBatch('usersettings'); $usersettings_shortcodes = e107::getScBatch('usersettings');
e107::js('inline'," e107::js('inline',"
function addtext_us(sc) function addtext_us(sc)
{ {