mirror of
https://github.com/e107inc/e107.git
synced 2025-04-19 20:21:51 +02:00
More work on ranking, minor forum bugfixes and improvements
This commit is contained in:
parent
de27eaffc5
commit
e34cd64541
@ -202,24 +202,32 @@ class e_ranks
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$userData = e107::getSystemUser($userId)->getData(); //get_user_data($userId);
|
||||
if(is_array($userId))
|
||||
{
|
||||
$userData = $userId;
|
||||
$userId = $userData['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$userData = e107::getSystemUser($userId)->getData(); //get_user_data($userId);
|
||||
}
|
||||
|
||||
if($userData['user_admin'])
|
||||
{
|
||||
if($userData['user_perms'] == '0')
|
||||
{
|
||||
//Main Site Admin
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][1])."' alt='".$this->_getName($this->ranks['special'][1])."' /><br />";
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][1])."' alt='".$this->_getName($this->ranks['special'][1])."' title='".$this->_getName($this->ranks['special'][1])."' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Site Admin
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][2])."' alt='".$this->_getName($this->ranks['special'][2])."' /><br />";
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][2])."' alt='".$this->_getName($this->ranks['special'][2])."' title='".$this->_getName($this->ranks['special'][2])."' />";
|
||||
}
|
||||
}
|
||||
elseif($moderator)
|
||||
{
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][3])."' alt='".$this->_getName($this->ranks['special'][3])."' /><br />";
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][3])."' alt='".$this->_getName($this->ranks['special'][3])."' title='".$this->_getName($this->ranks['special'][3])."' />";
|
||||
}
|
||||
|
||||
$userData['user_daysregged'] = max(1, round((time() - $userData['user_join']) / 86400));
|
||||
@ -241,7 +249,7 @@ class e_ranks
|
||||
{
|
||||
if($level >= $this->ranks['data'][$i]['thresh'] && $level < $this->ranks['data'][($i+1)]['thresh'])
|
||||
{
|
||||
$rank = $i;
|
||||
$rank = $i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -249,14 +257,15 @@ class e_ranks
|
||||
if($rank !== false)
|
||||
{
|
||||
$data['name'] = $this->_getName($this->ranks['data'][$rank]);
|
||||
$img_title = ($this->ranks['data'][$rank]['name'] ? "alt='{$data['name']}' title='{$data['name']}'" : '');
|
||||
$data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank])."' /><br />";
|
||||
$img_title = ($this->ranks['data'][$rank]['name'] ? " alt='{$data['name']}' title='{$data['name']}'" : ' alt = ""');
|
||||
$data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank])."'{$img_title} />";
|
||||
}
|
||||
$this->userRanks[$userId] = $data;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// TODO - custom ranking by array key - e.g. user_comments only
|
||||
private function _calcLevel(&$userData)
|
||||
{
|
||||
$forumCount = varset($userData['user_plugin_forum_posts'], 0) * 5;
|
||||
|
@ -58,7 +58,7 @@ class e107forum
|
||||
*/
|
||||
}
|
||||
|
||||
function loadPermList()
|
||||
private function loadPermList()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
if($tmp = $e107->ecache->retrieve_sys('forum_perms'))
|
||||
@ -67,13 +67,19 @@ class e107forum
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->getForumPermList();
|
||||
$this->_getForumPermList();
|
||||
$tmp = $e107->arrayStorage->WriteArray($this->permList, false);
|
||||
$e107->ecache->set_sys('forum_perms', $tmp);
|
||||
}
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
public function getForumPermList($what = null)
|
||||
{
|
||||
if(null !== $what) return (isset($this->permList[$what]) ? $this->permList[$what] : null);
|
||||
return $this->permList;
|
||||
}
|
||||
|
||||
private function setDefaults()
|
||||
{
|
||||
$this->prefs->set('show_topics', '1');
|
||||
@ -89,7 +95,7 @@ class e107forum
|
||||
$this->prefs->set('highlightsticky', '1');
|
||||
}
|
||||
|
||||
function getForumPermList()
|
||||
private function _getForumPermList()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
@ -1003,14 +1009,13 @@ class e107forum
|
||||
|
||||
function threadIncView($id)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$id = (int)$id;
|
||||
return $e107->sql->db_Update('forum_thread', 'thread_views=thread_views+1 WHERE thread_id='.$id);
|
||||
return e107::getDb()->db_Update('forum_thread', 'thread_views=thread_views+1 WHERE thread_id='.$id);
|
||||
}
|
||||
|
||||
function _forum_lp_update($lp_type, $lp_user, $lp_info, $lp_forum_id, $lp_forum_sub)
|
||||
{
|
||||
global $sql;
|
||||
$sql = e107::getDb();
|
||||
$sql->db_Update('forum', "{$lp_type}={$lp_type}+1, forum_lastpost_user='{$lp_user}', forum_lastpost_info = '{$lp_info}' WHERE forum_id='".intval($lp_forum_id)."' ");
|
||||
if($lp_forum_sub)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ $pm_installed = plugInstalled('pm');
|
||||
//Only increment thread views if not being viewed by thread starter
|
||||
if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo['thread_total_replies'] > 0) || !$thread->noInc)
|
||||
{
|
||||
$forum->threadIncview($threadId);
|
||||
$forum->threadIncview($thread->threadInfo['thread_id']);
|
||||
}
|
||||
|
||||
define('e_PAGETITLE', $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off').' / '.$e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off').' / '.LAN_01);
|
||||
@ -474,7 +474,12 @@ function rpg($user_join, $user_forums)
|
||||
class e107ForumThread
|
||||
{
|
||||
|
||||
var $message, $threadId, $forumId, $perPage, $noInc, $pages;
|
||||
public $message;
|
||||
public $threadId;
|
||||
public $forumId;
|
||||
public $perPage;
|
||||
public $noInc;
|
||||
public $pages;
|
||||
|
||||
function init()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user