mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Added setScVar() function to shortcode handler, modified forum and news to use new function. More work on new level handler, implemented it in forum shortcodes.
This commit is contained in:
parent
c3aa41f55f
commit
6633e23f94
@ -9,8 +9,8 @@
|
||||
* Administration Area - Users
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $
|
||||
* $Revision: 1.30 $
|
||||
* $Date: 2009-01-18 16:47:41 $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2009-01-25 17:44:12 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@ -1594,7 +1594,7 @@ function show_ranks()
|
||||
$fieldList['core'] = array(
|
||||
'comments' => USRLAN_201,
|
||||
'visits' => USRLAN_202,
|
||||
'days' => USRLAN_203
|
||||
'daysregged' => USRLAN_203
|
||||
);
|
||||
|
||||
foreach($e107->extended_struct as $field)
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/level_handler.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2009-01-18 16:47:41 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2009-01-25 17:44:13 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -118,6 +118,7 @@ class e107UserRank
|
||||
{
|
||||
|
||||
var $ranks = array();
|
||||
var $userRanks = array();
|
||||
|
||||
function e107UserRank()
|
||||
{
|
||||
@ -166,22 +167,26 @@ class e107UserRank
|
||||
}
|
||||
}
|
||||
|
||||
function _getImage($info)
|
||||
function _getImage(&$info)
|
||||
{
|
||||
if($info['lan_pfx'])
|
||||
$img = $info['image'];
|
||||
if($info['lan_pfx'] && strpos('_', $info['image']))
|
||||
{
|
||||
$_tmp = explode('_', $info['image'], 2);
|
||||
return e_LANGUAGE.'_'.$tmp[1];
|
||||
$img = e_LANGUAGE.'_'.$_tmp[1];
|
||||
}
|
||||
return $info['image'];
|
||||
return e_IMAGE_ABS.'ranks/'.$img;
|
||||
}
|
||||
|
||||
function getRanks($userId)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
if(!$userId && USER) { $userId = USERID; }
|
||||
if($ret = getcachedvars('userRankInfo_'.$userId)) { return $ret; }
|
||||
|
||||
if(isset($this->userRanks[$userId]))
|
||||
{
|
||||
return $this->userRanks[$userId];
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$userData = get_user_data($userId);
|
||||
if($userData['user_admin'])
|
||||
@ -189,16 +194,16 @@ class e107UserRank
|
||||
if($userData['user_perms'] == '0')
|
||||
{
|
||||
//Main Site Admin
|
||||
$ret['special'] = "<img src='".$this->_getImage($this->ranks['special'][1]['image'])."' /><br />";
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][1])."' /><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
//Site Admin
|
||||
$ret['special'] = "<img src='".$this->_getImage($this->ranks['special'][2]['image'])."' /><br />";
|
||||
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][2])."' /><br />";
|
||||
}
|
||||
}
|
||||
|
||||
$userData['daysregged'] = max(1, round((time() - $userData['user_join']) / 86400));
|
||||
$userData['user_daysregged'] = max(1, round((time() - $userData['user_join']) / 86400));
|
||||
$level = $this->_calcLevel($userData);
|
||||
|
||||
$lastRank = count($this->ranks['data']) - 1;
|
||||
@ -209,7 +214,7 @@ class e107UserRank
|
||||
}
|
||||
elseif($level >= $this->ranks['data'][$lastRank]['thresh'])
|
||||
{
|
||||
$rank = 9;
|
||||
$rank = $lastRank;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -226,28 +231,27 @@ class e107UserRank
|
||||
{
|
||||
$data['name'] = '[ '.$e107->tp->toHTML($this->ranks['data'][$rank]['name'], FALSE, 'defs').' ]';
|
||||
$img_title = ($this->ranks['data'][$rank]['name'] ? "title='".$this->ranks['data'][$rank]['name']."'" : '');
|
||||
$data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank]['image'])."' /><br />";
|
||||
|
||||
cachevars('userRankInfo_'.$userId, $data);
|
||||
return $data;
|
||||
$data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank])."' /><br />";
|
||||
}
|
||||
$this->userRanks[$userId] = $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
function _calcLevel(&$userData)
|
||||
{
|
||||
var_dump($this->ranks['config']);
|
||||
global $pref;
|
||||
$value = 0;
|
||||
$calc = $this->ranks['config']['calc'];
|
||||
$calc = $pref['ranks_calc'];
|
||||
$search = array();
|
||||
$replace = array();
|
||||
foreach($this->ranks['config']['fields'] as $f)
|
||||
foreach(explode(',', $pref['ranks_flist']) as $f)
|
||||
{
|
||||
$search[] = $f['name'];
|
||||
$replace[] = $userData[$f['name']];
|
||||
$search[] = '{'.$f.'}';
|
||||
$replace[] = $userData['user_'.$f];
|
||||
}
|
||||
$calc = str_replace($search, $replace, $calc);
|
||||
$calc = '$userLevelValue = '.str_replace($search, $replace, $calc).';';
|
||||
$value = eval($calc);
|
||||
return $value;
|
||||
return $userLevelValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
* News handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2009-01-18 00:27:10 $
|
||||
* $Author: secretr $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2009-01-25 17:44:13 $
|
||||
* $Author: mcfly_e107 $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -236,8 +236,8 @@ class news {
|
||||
$loop_uid = $news['news_author'];
|
||||
|
||||
require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
|
||||
$e107->tp->e_sc->scClasses['news_shortcodes']->news_item = $news;
|
||||
$e107->tp->e_sc->scClasses['news_shortcodes']->param = $param;
|
||||
setScVar('news_shortcodes', 'news_item', $news);
|
||||
setScVar('news_shortcodes', 'param', $param);
|
||||
$text = $e107->tp->parseTemplate($NEWS_PARSE, true);
|
||||
|
||||
if ($mode == 'return')
|
||||
|
@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
| $Revision: 1.23 $
|
||||
| $Date: 2009-01-16 01:02:41 $
|
||||
| $Revision: 1.24 $
|
||||
| $Date: 2009-01-25 17:44:13 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -25,6 +25,21 @@ function register_shortcode($classFunc, $codes, $path='', $force=false)
|
||||
$e107 = e107::getInstance();
|
||||
$sc = &$e107->tp->e_sc;
|
||||
|
||||
//If codes is set to true, let's go get a list of shortcode methods
|
||||
if(is_bool($codes) && $codes === true)
|
||||
{
|
||||
$codes = array();
|
||||
$tmp = get_class_methods($classFunc);
|
||||
foreach($tmp as $c)
|
||||
{
|
||||
if(strpos($c, 'get_') === 0)
|
||||
{
|
||||
$codes[] = substr($c, 4);
|
||||
}
|
||||
}
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
//We only register these shortcodes if they have not already been registered in some manner
|
||||
//ie theme or other plugin .sc files
|
||||
if(is_array($codes))
|
||||
@ -48,6 +63,12 @@ function register_shortcode($classFunc, $codes, $path='', $force=false)
|
||||
}
|
||||
}
|
||||
|
||||
function setScVar($scName, $scVar, &$value)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$e107->tp->e_sc->scClasses[$scName]->$scVar = $value;
|
||||
}
|
||||
|
||||
function initShortcodeClass($class)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
@ -235,10 +256,16 @@ class e_shortcode
|
||||
}
|
||||
$this->scClasses[$_class] = new $_class;
|
||||
}
|
||||
if(is_callable(array($_class, $_method)))
|
||||
if(method_exists($this->scClasses[$_class], $_method))
|
||||
{
|
||||
|
||||
$ret = $this->scClasses[$_class]->$_method($parm, $sc_mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $_class.'::'.$_method.' NOT FOUND!<br />';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'func':
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Message Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
|
||||
* $Revision: 1.37 $
|
||||
* $Date: 2009-01-10 04:39:54 $
|
||||
* $Revision: 1.38 $
|
||||
* $Date: 2009-01-25 17:44:13 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@ -22,6 +22,8 @@ class e107forum
|
||||
var $permList = array();
|
||||
var $fieldTypes = array();
|
||||
var $userViewed = array();
|
||||
var $modArray = array();
|
||||
var $e107;
|
||||
|
||||
function e107forum()
|
||||
{
|
||||
@ -47,7 +49,7 @@ class e107forum
|
||||
$this->fieldTypes['forum_thread']['thread_options'] = 'escape';
|
||||
|
||||
$this->fieldTypes['forum']['forum_lastpost_user'] = 'int';
|
||||
|
||||
$this->e107 = e107::getInstance();
|
||||
}
|
||||
|
||||
function loadPermList()
|
||||
@ -613,22 +615,30 @@ class e107forum
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function forumGetMods($uclass = e_UC_ADMIN)
|
||||
function forumGetMods($uclass = e_UC_ADMIN, $force=false)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
if(count($this->modArray) && !$force)
|
||||
{
|
||||
return $this->modArray;
|
||||
}
|
||||
if($uclass == e_UC_ADMIN || trim($uclass) == '')
|
||||
{
|
||||
$e107->sql->db_Select('user', 'user_id, user_name','user_admin = 1 ORDER BY user_name ASC');
|
||||
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
||||
$this->e107->sql->db_Select('user', 'user_id, user_name','user_admin = 1 ORDER BY user_name ASC');
|
||||
while($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[$row['user_id']] = $row['user_name'];
|
||||
$this->modArray[$row['user_id']] = $row['user_name'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $e107->user_class->get_users_in_class($uclass, 'user_name', true);
|
||||
$this->modArray = $this->e107->user_class->get_users_in_class($uclass, 'user_name', true);
|
||||
}
|
||||
return $ret;
|
||||
return $this->modArray;
|
||||
}
|
||||
|
||||
function isModerator($uid)
|
||||
{
|
||||
return ($uid && in_array($uid, array_keys($this->modArray)));
|
||||
}
|
||||
|
||||
function forumGetForumList()
|
||||
|
@ -1,34 +1,21 @@
|
||||
<?php
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/*
|
||||
$codes = array(
|
||||
'top','joined','threaddatestamp','post','postdeleted','attachments','privmessage',
|
||||
'avatar','anon_ip','ip','poster','emailimg','emailitem','signature','profileimg',
|
||||
'posts','visits','customtitle','website','websiteimg','editimg','quoteimg','reportimg',
|
||||
'rpg','memberid','level','modoptions','lastedit','lasteditby','poll','newflag'
|
||||
);
|
||||
*/
|
||||
|
||||
$codes = array();
|
||||
$tmp = get_class_methods('forum_shortcodes');
|
||||
foreach($tmp as $c)
|
||||
{
|
||||
if(strpos($c, 'get_') === 0)
|
||||
{
|
||||
$codes[] = substr($c, 4);
|
||||
}
|
||||
}
|
||||
register_shortcode('forum_shortcodes', $codes);
|
||||
register_shortcode('forum_shortcodes', true);
|
||||
initShortcodeClass('forum_shortcodes');
|
||||
|
||||
class forum_shortcodes
|
||||
{
|
||||
|
||||
var $e107;
|
||||
var $postInfo;
|
||||
var $thread;
|
||||
var $forum;
|
||||
|
||||
function forum_shortcodes()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->postInfo = array();
|
||||
}
|
||||
|
||||
function get_top()
|
||||
@ -38,32 +25,30 @@ class forum_shortcodes
|
||||
|
||||
function get_joined()
|
||||
{
|
||||
global $postInfo, $gen;
|
||||
if ($postInfo['post_user'])
|
||||
global $gen;
|
||||
if ($this->postInfo['post_user'])
|
||||
{
|
||||
return LAN_06.': '.$gen->convert_date($postInfo['user_join'], 'forum').'<br />';
|
||||
return LAN_06.': '.$gen->convert_date($this->postInfo['user_join'], 'forum').'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
function get_threaddatestamp()
|
||||
{
|
||||
global $postInfo, $gen;
|
||||
return "<a id='post_{$post_info['post_id']}' href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'post', 'id' => $postInfo['post_id']))."'>".IMAGE_post."</a> ".$gen->convert_date($postInfo['post_datestamp'], 'forum');
|
||||
global $gen;
|
||||
return "<a id='post_{$this->post_info['post_id']}' href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'post', 'id' => $this->postInfo['post_id']))."'>".IMAGE_post."</a> ".$gen->convert_date($this->postInfo['post_datestamp'], 'forum');
|
||||
}
|
||||
|
||||
function get_post()
|
||||
{
|
||||
global $postInfo;
|
||||
$emote = (isset($postInfo['post_options']['no_emote']) ? ',emotes_off' : '');
|
||||
return $this->e107->tp->toHTML($postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$post_info['user_class']);
|
||||
$emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : '');
|
||||
return $this->e107->tp->toHTML($this->postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$this->postInfo['user_class']);
|
||||
}
|
||||
|
||||
function get_postdeleted()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['post_status'])
|
||||
if($this->postInfo['post_status'])
|
||||
{
|
||||
$info = unserialize($postInfo['post_options']);
|
||||
$info = unserialize($this->postInfo['post_options']);
|
||||
return "
|
||||
Post delete on: {$info['deldate']}<br />
|
||||
reason: {$info['delreason']}
|
||||
@ -74,10 +59,9 @@ class forum_shortcodes
|
||||
|
||||
function get_attachments()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['post_attachments'])
|
||||
if($this->postInfo['post_attachments'])
|
||||
{
|
||||
$attachments = explode(',', $postInfo['post_attachments']);
|
||||
$attachments = explode(',', $this->postInfo['post_attachments']);
|
||||
$txt = '';
|
||||
foreach($attachments as $a)
|
||||
{
|
||||
@ -107,30 +91,28 @@ class forum_shortcodes
|
||||
|
||||
function get_privmessage()
|
||||
{
|
||||
global $postInfo;
|
||||
if(plugInstalled('pm') && ($postInfo['post_user'] > 0))
|
||||
if(plugInstalled('pm') && ($this->postInfo['post_user'] > 0))
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{SENDPM={$postInfo['post_user']}}");
|
||||
return $this->e107->tp->parseTemplate("{SENDPM={$this->postInfo['post_user']}}");
|
||||
}
|
||||
}
|
||||
|
||||
function get_avatar()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['post_user'])
|
||||
if ($this->postInfo['post_user'])
|
||||
{
|
||||
if(!$avatar = getcachedvars('forum_avatar_'.$postInfo['post_user']))
|
||||
if(!$avatar = getcachedvars('forum_avatar_'.$this->postInfo['post_user']))
|
||||
{
|
||||
if ($postInfo['user_image'])
|
||||
if ($this->postInfo['user_image'])
|
||||
{
|
||||
require_once(e_HANDLER.'avatar_handler.php');
|
||||
$avatar = "<div class='spacer'><img src='".avatar($postInfo['user_image'])."' alt='' /></div><br />";
|
||||
$avatar = "<div class='spacer'><img src='".avatar($this->postInfo['user_image'])."' alt='' /></div><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$avatar = '';
|
||||
}
|
||||
cachevars('forum_avatar_'.$postInfo['post_user'], $avatar);
|
||||
cachevars('forum_avatar_'.$this->postInfo['post_user'], $avatar);
|
||||
}
|
||||
return $avatar;
|
||||
}
|
||||
@ -140,43 +122,39 @@ class forum_shortcodes
|
||||
|
||||
function get_anon_ip()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['post_user_anon'] && (ADMIN || MODERATOR))
|
||||
if($this->postInfo['post_user_anon'] && (ADMIN || MODERATOR))
|
||||
{
|
||||
return $this->e107->ipDecode($postInfo['post_ip']);
|
||||
return $this->e107->ipDecode($this->postInfo['post_ip']);
|
||||
}
|
||||
}
|
||||
|
||||
function get_ip()
|
||||
{
|
||||
global $postInfo;
|
||||
if((ADMIN || MODERATOR) && !$postInfo['user_admin'])
|
||||
if((ADMIN || MODERATOR) && !$this->postInfo['user_admin'])
|
||||
{
|
||||
return $this->e107->ipDecode($postInfo['post_ip']);
|
||||
return $this->e107->ipDecode($this->postInfo['post_ip']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_poster()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['user_name'])
|
||||
if($this->postInfo['user_name'])
|
||||
{
|
||||
return "<a href='".$this->e107->url->getUrl('core:user', 'main', array('func' => 'profile', 'id' => $postInfo['post_user']))."'>{$postInfo['user_name']}</a>";
|
||||
return "<a href='".$this->e107->url->getUrl('core:user', 'main', array('func' => 'profile', 'id' => $this->postInfo['post_user']))."'>{$this->postInfo['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<b>'.$this->e107->tp->toHTML($postInfo['post_user_anon']).'</b>';
|
||||
return '<b>'.$this->e107->tp->toHTML($this->postInfo['post_user_anon']).'</b>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_emailimg()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['user_name'])
|
||||
if($this->postInfo['user_name'])
|
||||
{
|
||||
return (!$post_info['user_hideemail'] ? $this->e107->tp->parseTemplate("{EMAILTO={$postInfo['user_email']}}") : '');
|
||||
return (!$this->postInfo['user_hideemail'] ? $this->e107->tp->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : '');
|
||||
}
|
||||
return '';
|
||||
|
||||
@ -184,168 +162,145 @@ class forum_shortcodes
|
||||
|
||||
function get_emailitem()
|
||||
{
|
||||
if($postInfo['thread_start'])
|
||||
if($this->postInfo['thread_start'])
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{EMAIL_ITEM=".FORLAN_101."^plugin:forum.{$postInfo['post_thread']}}");
|
||||
return $this->e107->tp->parseTemplate("{EMAIL_ITEM=".FORLAN_101."^plugin:forum.{$this->postInfo['post_thread']}}");
|
||||
}
|
||||
}
|
||||
|
||||
function get_printitem()
|
||||
{
|
||||
global $postInfo;
|
||||
if($postInfo['thread_start'])
|
||||
if($this->postInfo['thread_start'])
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{PRINT_ITEM=".FORLAN_102."^plugin:forum.{$postInfo['post_thread']}}");
|
||||
return $this->e107->tp->parseTemplate("{PRINT_ITEM=".FORLAN_102."^plugin:forum.{$this->postInfo['post_thread']}}");
|
||||
}
|
||||
}
|
||||
|
||||
function get_signature()
|
||||
{
|
||||
if(!USER) { return ''; }
|
||||
global $postInfo, $pref;
|
||||
global $pref;
|
||||
static $forum_sig_shown;
|
||||
if(varsettrue($pref['forum_sig_once']))
|
||||
{
|
||||
$_tmp = 'forum_sig_shown_'.$postInfo['post_user'];
|
||||
$_tmp = 'forum_sig_shown_'.$this->postInfo['post_user'];
|
||||
if(getcachedvars($_tmp)) { return ''; }
|
||||
cachevars($_tmp, 1);
|
||||
}
|
||||
return ($postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".$this->e107->tp->toHTML($postInfo['user_signature'], true).'</span>' : '');
|
||||
return ($this->postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".$this->e107->tp->toHTML($this->postInfo['user_signature'], true).'</span>' : '');
|
||||
|
||||
}
|
||||
|
||||
function get_profileimg()
|
||||
{
|
||||
global $postInfo;
|
||||
if (USER && $postInfo['user_name'])
|
||||
if (USER && $this->postInfo['user_name'])
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{PROFILE={$postInfo['post_user']}}");
|
||||
return $this->e107->tp->parseTemplate("{PROFILE={$this->postInfo['post_user']}}");
|
||||
}
|
||||
}
|
||||
|
||||
function get_posts()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['post_user'])
|
||||
if ($this->postInfo['post_user'])
|
||||
{
|
||||
return LAN_67.': '.(int)$postInfo['user_plugin_forum_posts'].'<br />';
|
||||
return LAN_67.': '.(int)$this->postInfo['user_plugin_forum_posts'].'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
function get_visits()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['user_name'])
|
||||
if ($this->postInfo['user_name'])
|
||||
{
|
||||
return LAN_09.': '.$postInfo['user_visits'].'<br />';
|
||||
return LAN_09.': '.$this->postInfo['user_visits'].'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
function get_customtitle()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['user_customtitle'])
|
||||
if ($this->postInfo['user_customtitle'])
|
||||
{
|
||||
return $this->e107->tp->toHTML($postInfo['user_customtitle']).'<br />';
|
||||
return $this->e107->tp->toHTML($this->postInfo['user_customtitle']).'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
function get_website()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['user_homepage']) {
|
||||
return LAN_08.': '.$postInfo['user_homepage'].'<br />';
|
||||
if ($this->postInfo['user_homepage']) {
|
||||
return LAN_08.': '.$this->postInfo['user_homepage'].'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
function get_websiteimg()
|
||||
{
|
||||
global $postInfo;
|
||||
if ($postInfo['user_homepage'] && $postInfo['user_homepage'] != 'http://')
|
||||
if ($this->postInfo['user_homepage'] && $this->postInfo['user_homepage'] != 'http://')
|
||||
{
|
||||
return "<a href='{$postInfo['user_homepage']}'>".IMAGE_website.'</a>';
|
||||
return "<a href='{$this->postInfo['user_homepage']}'>".IMAGE_website.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
function get_editimg()
|
||||
{
|
||||
global $postInfo, $threadInfo;
|
||||
if (USER && $postInfo['post_user'] == USERID && $threadInfo['thread_active'])
|
||||
if (USER && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active'])
|
||||
{
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'edit', 'id' => $postInfo['post_id']))."'>".IMAGE_edit.'</a> ';
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'edit', 'id' => $this->postInfo['post_id']))."'>".IMAGE_edit.'</a> ';
|
||||
}
|
||||
}
|
||||
|
||||
function get_quoteimg()
|
||||
{
|
||||
global $postInfo, $forum;
|
||||
if($forum->checkperm($postInfo['post_forum'], 'post'))
|
||||
if($this->forum->checkperm($this->postInfo['post_forum'], 'post'))
|
||||
{
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'quote', 'id' => $postInfo['post_id']))."'>".IMAGE_quote.'</a> ';
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'quote', 'id' => $this->postInfo['post_id']))."'>".IMAGE_quote.'</a> ';
|
||||
}
|
||||
}
|
||||
|
||||
function get_reportimg()
|
||||
{
|
||||
global $postInfo, $page;
|
||||
global $page;
|
||||
if (USER) {
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', 'func=report&id='.$postInfo['post_thread'])."'>".IMAGE_report.'</a> ';
|
||||
return "<a href='".$this->e107->url->getUrl('forum', 'thread', 'func=report&id='.$this->postInfo['post_thread'])."'>".IMAGE_report.'</a> ';
|
||||
}
|
||||
}
|
||||
|
||||
function get_rpg()
|
||||
{
|
||||
global $postInfo;
|
||||
return rpg($postInfo['user_join'],$postInfo['user_plugin_forum_posts']);
|
||||
return rpg($this->postInfo['user_join'], $this->postInfo['user_plugin_forum_posts']);
|
||||
}
|
||||
|
||||
function get_memberid()
|
||||
{
|
||||
global $post_info, $ldata, $pref, $forum_info;
|
||||
if ($post_info['anon']) { return ''; }
|
||||
|
||||
$fmod = ($post_info['user_class'] != '' && check_class($forum_info['forum_moderators'], $post_info['user_class'], TRUE));
|
||||
if(!$fmod && $forum_info['forum_moderators'] == e_UC_ADMIN)
|
||||
{
|
||||
$fmod = $post_info['user_admin'];
|
||||
}
|
||||
if (!array_key_exists($post_info['user_id'],$ldata)) {
|
||||
$ldata[$post_info['user_id']] = get_level($post_info['user_id'], $post_info['user_forums'], $post_info['user_comments'], $post_info['user_chats'], $post_info['user_visits'], $post_info['user_join'], $post_info['user_admin'], $post_info['user_perms'], $pref, $fmod);
|
||||
}
|
||||
return $ldata[$post_info['user_id']][0];
|
||||
|
||||
if (!$this->postInfo['post_user']) { return FALSE; }
|
||||
return "<span class='smalltext'>".LAN_195.' #'.$this->postInfo['post_user'].'</span>';
|
||||
}
|
||||
|
||||
function get_level()
|
||||
function get_level($parm)
|
||||
{
|
||||
global $post_info, $ldata, $pref, $forum_info;
|
||||
if ($post_info['anon']) { return ''; }
|
||||
$fmod = ($post_info['user_class'] != "" && check_class($forum_info['forum_moderators'], $post_info['user_class'], TRUE));
|
||||
if(!$fmod && $forum_info['forum_moderators'] == e_UC_ADMIN)
|
||||
{
|
||||
$fmod = $post_info['user_admin'];
|
||||
}
|
||||
if (!array_key_exists($post_info['user_id'],$ldata)) {
|
||||
$ldata[$post_info['user_id']] = get_level($post_info['user_id'], $post_info['user_forums'], $post_info['user_comments'], $post_info['user_chats'], $post_info['user_visits'], $post_info['user_join'], $post_info['user_admin'], $post_info['user_perms'], $pref, $fmod);
|
||||
}
|
||||
if($parm == 'pic')
|
||||
{
|
||||
return $ldata[$post_info['user_id']]['pic'];
|
||||
}
|
||||
if($parm == 'name')
|
||||
{
|
||||
return $ldata[$post_info['user_id']]['name'];
|
||||
}
|
||||
if($parm == 'special')
|
||||
{
|
||||
return $ldata[$post_info['user_id']]['special'];
|
||||
}
|
||||
if($parm == 'userid')
|
||||
{
|
||||
return $ldata[$post_info['user_id']]['userid'];
|
||||
}
|
||||
return $ldata[$post_info['user_id']][1];
|
||||
global $pref;
|
||||
if (!$this->postInfo['post_user']) { return ''; }
|
||||
|
||||
$rankInfo = $this->e107->userRank->getRanks($this->postInfo['post_user']);
|
||||
if(!$parm) { $parm = 'name'; }
|
||||
|
||||
switch($parm)
|
||||
{
|
||||
|
||||
case 'userid' :
|
||||
return $this->get_memberid();
|
||||
break;
|
||||
|
||||
case 'special':
|
||||
if(isset($rankInfo['special'])) { return $rankInfo['special']; }
|
||||
if($this->forum->isModerator($this->postInfo['post_user']))
|
||||
{
|
||||
return "<div class='spacer'>".IMAGE_rank_moderator_image.'</div>';
|
||||
}
|
||||
return '';
|
||||
break;
|
||||
|
||||
default:
|
||||
return varset($rankInfo[$parm], '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function get_modoptions()
|
||||
@ -358,25 +313,24 @@ class forum_shortcodes
|
||||
|
||||
function get_lastedit()
|
||||
{
|
||||
global $postInfo, $gen;
|
||||
if ($postInfo['post_edit_datestamp'])
|
||||
global $gen;
|
||||
if ($this->postInfo['post_edit_datestamp'])
|
||||
{
|
||||
return $gen->convert_date($postInfo['post_edit_datestamp'],'forum');
|
||||
return $gen->convert_date($this->postInfo['post_edit_datestamp'],'forum');
|
||||
}
|
||||
}
|
||||
|
||||
function get_lasteditby()
|
||||
{
|
||||
global $postInfo;
|
||||
if(isset($postInfo['edit_name']))
|
||||
if(isset($this->postInfo['edit_name']))
|
||||
{
|
||||
if($parm == 'link')
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$url = $e107->url->getUrl('core:user', 'main', 'func=profile&id='.$postInfo['post_edit_user']);
|
||||
return "<a href='{$url}'>{$postInfo['edit_name']}</a>";
|
||||
$url = $e107->url->getUrl('core:user', 'main', 'func=profile&id='.$this->postInfo['post_edit_user']);
|
||||
return "<a href='{$url}'>{$this->postInfo['edit_name']}</a>";
|
||||
}
|
||||
return $postInfo['edit_name'];
|
||||
return $this->postInfo['edit_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Message Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
|
||||
* $Revision: 1.19 $
|
||||
* $Date: 2008-12-20 23:59:00 $
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 2009-01-25 17:44:13 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@ -59,20 +59,23 @@ if(isset($_GET['f']))
|
||||
if($_GET['f'] != 'last') { $thread->init(); }
|
||||
}
|
||||
|
||||
require_once (e_HANDLER . 'level_handler.php');
|
||||
if (!is_object($e107->userRank)) { $e107->userRank = new e107UserRank; }
|
||||
require_once (e_PLUGIN . 'forum/forum_shortcodes.php');
|
||||
setScVar('forum_shortcodes', 'thread', $thread);
|
||||
|
||||
$pm_installed = plugInstalled('pm');
|
||||
|
||||
|
||||
//Only increment thread views if not being viewed by thread starter
|
||||
if (USER && (USERID != $threadInfo['thread_user'] || $threadInfo['thread_total_replies'] > 0) || !$thread->noInc)
|
||||
if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo['thread_total_replies'] > 0) || !$thread->noInc)
|
||||
{
|
||||
$forum->threadIncview($threadId);
|
||||
}
|
||||
|
||||
define('e_PAGETITLE', LAN_01 . ' / ' . $e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off') . " / " . $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'));
|
||||
$modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
|
||||
define('MODERATOR', (USER && is_array($modArray) && in_array(USERID, array_keys($modArray))));
|
||||
$forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
|
||||
define('MODERATOR', (USER && $forum->isModerator(USERID)));
|
||||
setScVar('forum_shortcodes', 'forum', $forum);
|
||||
|
||||
if (MODERATOR && isset($_POST['mod']))
|
||||
{
|
||||
@ -83,7 +86,6 @@ if (MODERATOR && isset($_POST['mod']))
|
||||
|
||||
$postList = $forum->PostGet($thread->threadId, $thread->page * $thread->perPage, $thread->perPage);
|
||||
|
||||
require_once (e_HANDLER . 'level_handler.php');
|
||||
$gen = new convert;
|
||||
if ($thread->message)
|
||||
{
|
||||
@ -155,7 +157,7 @@ if ($pref['forum_track'] && USER)
|
||||
";
|
||||
}
|
||||
|
||||
$MODERATORS = LAN_321 . implode(', ', $modArray);
|
||||
$MODERATORS = LAN_321 . implode(', ', $forum->modArray);
|
||||
|
||||
$THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : '');
|
||||
|
||||
@ -186,7 +188,6 @@ if (!$FORUMREPLYSTYLE) $FORUMREPLYSTYLE = $FORUMTHREADSTYLE;
|
||||
$alt = false;
|
||||
|
||||
$i = $thread->page;
|
||||
global $postInfo;
|
||||
foreach ($postList as $postInfo)
|
||||
{
|
||||
if($postInfo['post_options'])
|
||||
@ -214,11 +215,13 @@ foreach ($postList as $postInfo)
|
||||
{
|
||||
$_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE);
|
||||
}
|
||||
setScVar('forum_shortcodes', 'postInfo', $postInfo);
|
||||
$forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$postInfo['thread_start'] = true;
|
||||
setScVar('forum_shortcodes', 'postInfo', $postInfo);
|
||||
$forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes) . "\n";
|
||||
}
|
||||
}
|
||||
@ -440,7 +443,7 @@ function rpg($user_join, $user_forums)
|
||||
class e107ForumThread
|
||||
{
|
||||
|
||||
var $message, $threadId, $threadInfo, $forumId, $perPage, $noInc, $pages;
|
||||
var $message, $threadId, $forumId, $perPage, $noInc, $pages;
|
||||
|
||||
function init()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user