1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

More forum problems fixed, more to do

This commit is contained in:
secretr 2011-04-25 11:29:21 +00:00
parent d10a42a640
commit 1a562f6fa2
12 changed files with 161 additions and 146 deletions

View File

@ -311,7 +311,7 @@ class e107
// set base path, SSL is auto-detected
$this->set_base_path();
// cleanup QUERY_STRING and friends, set related constants
$this->set_request();
@ -957,7 +957,7 @@ class e107
{
return self::getSingleton('UserHandler', true);
}
/**
* Retrieve core session singleton object(s)
*
@ -1116,7 +1116,7 @@ class e107
{
return self::getSingleton('notify', true);
}
/**
* Retrieve Language handler singleton object
*
@ -1221,7 +1221,7 @@ class e107
/**
* Retrieve online users handler singleton object
* @return e_online
* @return e_ranks
*/
public static function getRank()
{
@ -1707,21 +1707,21 @@ class e107
$ret = ($force) ? include($path) : include_once($path);
return (isset($ret)) ? $ret : "";
}
/**
* Simplify importing of core Language files.
* All inputs are sanitized.
* Core Exceptions as e_LANGUAGE.'.php' and e_LANGUAGE.'_custom.php' are manually loaded. (see class2.php)
*
*
* Examples:
* <code><?php
* // import defeinitions from /e107_languages/[CurrentLanguage]/lan_comment.php</code>
* e107::coreLan('comment');
*
* e107::coreLan('comment');
*
* // import defeinitions from /e107_languages/[CurrentLanguage]/admin/lan_banlist.php
* e107::coreLan('banlist', true);
* </code>
*
* </code>
*
* @param string $fname filename without the extension part (e.g. 'comment')
* @param boolean $admin true if it's an administration language file
* @return void
@ -1730,50 +1730,50 @@ class e107
{
$cstring = 'corelan/'.e_LANGUAGE.'_'.$fname.($admin ? '_admin' : '_front');
if(e107::getRegistry($cstring)) return;
$fname = ($admin ? 'admin/' : '').'lan_'.preg_replace('/[^\w]/', '', $fname).'.php';
$path = e_LANGUAGEDIR.e_LANGUAGE.'/'.$fname;
e107::setRegistry($cstring, true);
self::includeLan($path, false);
}
/**
* Simplify importing of plugin Language files (following e107 plugin structure standards).
* All inputs are sanitized.
*
*
* Examples:
* <code><?php
* // import defeinitions from /e107_plugins/forum/languages/[CurrentLanguage]/lan_forum.php</code>
* e107::plugLan('forum', 'lan_forum');
*
* e107::plugLan('forum', 'lan_forum');
*
* // import defeinitions from /e107_plugins/featurebox/languages/[CurrentLanguage]_admin_featurebox.php</code>
* e107::plugLan('featurebox', 'admin_featurebox', true);
*
* e107::plugLan('featurebox', 'admin_featurebox', true);
*
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage].php
* e107::plugLan('myplug');
*
* e107::plugLan('myplug');
*
* // import defeinitions from /e107_plugins/myplug/languages/[CurrentLanguage].php
* e107::plugLan('myplug', 'admin/common');
* </code>
*
* e107::plugLan('myplug', 'admin/common');
* </code>
*
* @param string $plugin plugin name
* @param string $fname filename without the extension part (e.g. 'common')
* @param boolean $flat false (default, preferred) Language folder structure; true - prepend Language to file name
* @param boolean $flat false (default, preferred) Language folder structure; true - prepend Language to file name
* @return void
*/
public static function plugLan($plugin, $fname = '', $flat = false)
{
$cstring = 'pluglan/'.e_LANGUAGE.'_'.$plugin.'_'.$fname.($flat ? '_1' : '_0');
if(e107::getRegistry($cstring)) return;
$plugin = preg_replace('/[^\w]/', '', $plugin);
if($fname) $fname = e_LANGUAGE.($flat ? '_' : '/').preg_replace('#[^\w/]#', '', $fname);
else $fname = e_LANGUAGE;
$path = e_PLUGIN.$plugin.'/languages/'.$fname.'.php';
e107::setRegistry($cstring, true);
self::includeLan($path, false);
}
@ -1855,14 +1855,14 @@ class e107
*/
public function prepare_request($checkS = true)
{
// Block common bad agents / queries / php issues.
// Block common bad agents / queries / php issues.
array_walk($_SERVER, array('self', 'filter_request'), '_SERVER');
if (isset($_GET)) array_walk($_GET, array('self', 'filter_request'), '_GET');
if (isset($_POST)) array_walk($_POST, array('self', 'filter_request'), '_POST');
if (isset($_COOKIE)) array_walk($_COOKIE, array('self', 'filter_request'), '_COOKIE');
if (isset($_REQUEST)) array_walk($_REQUEST, array('self', 'filter_request'), '_REQUEST');
if (isset($_REQUEST)) array_walk($_REQUEST, array('self', 'filter_request'), '_REQUEST');
// TODO - better ajax detection method (headers when possible)
define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something...
@ -1902,7 +1902,7 @@ class e107
exit();
}
*/
// If url contains a .php in it, PHP_SELF is set wrong (imho), affecting all paths. We need to 'fix' it if it does.
$_SERVER['PHP_SELF'] = (($pos = stripos($_SERVER['PHP_SELF'], '.php')) !== false ? substr($_SERVER['PHP_SELF'], 0, $pos+4) : $_SERVER['PHP_SELF']);
@ -1925,41 +1925,41 @@ class e107
return $this;
}
/**
* Filter User Input - used by array_walk in prepare_request method above.
* Filter User Input - used by array_walk in prepare_request method above.
* @param string $input array value
* @param string $key array key
* @param string $type array type _SESSION, _GET etc.
* @return
* @param string $type array type _SESSION, _GET etc.
* @return
*/
public static function filter_request($input,$key,$type)
{
if (is_array($input))
{
return array_walk($input, array('self', 'filter_request'), $type);
}
return array_walk($input, array('self', 'filter_request'), $type);
}
if($type == "_SERVER")
{
{
if(($key == "QUERY_STRING") && strpos(strtolower($input),"=http")!==FALSE)
{
exit();
}
if(($key == "HTTP_USER_AGENT") && strpos($input,"libwww-perl")!==FALSE)
{
exit();
}
exit();
}
}
if(strpos(str_replace('.', '', $input), '22250738585072011') !== FALSE) // php-bug 53632
{
exit();
}
}
}
/**
* Set base system path
@ -2226,7 +2226,7 @@ class e107
* 3. any plugin file in a folder called admin/
* 4. any file that specifies $eplug_admin = TRUE; or ADMIN_AREA = TRUE;
* NOTE: USER_AREA = true; will force e_ADMIN_AREA to FALSE
*
*
* @param boolean $no_cbrace remove curly brackets from the url
* @return e107
*/
@ -2235,32 +2235,32 @@ class e107
//global $PLUGINS_DIRECTORY,$ADMIN_DIRECTORY, $eplug_admin;
$PLUGINS_DIRECTORY = $this->getFolder('plugins');
$ADMIN_DIRECTORY = $this->getFolder('admin');
// Outdated
/*$requestQry = '';
$requestUrl = $_SERVER['REQUEST_URI'];
if(strpos($_SERVER['REQUEST_URI'], '?') !== FALSE)
list($requestUrl, $requestQry) = explode("?", $_SERVER['REQUEST_URI'], 2); */
$eplug_admin = vartrue($GLOBALS['eplug_admin'], false);
$page = substr(strrchr($_SERVER['PHP_SELF'], '/'), 1);
define('e_PAGE', $page);
// Leave e_SELF BC, use e_REQUEST_SELF instead
/*// moved after page check - e_PAGE is important for BC
if($requestUrl && $requestUrl != $_SERVER['PHP_SELF'])
{
$_SERVER['PHP_SELF'] = $requestUrl;
}*/
}*/
$eSelf = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME'];
define('e_SELF', $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$eSelf);
// START New - request uri/url detection, XSS protection
$requestUri = $requestUrl = '';
if (isset($_SERVER['HTTP_X_REWRITE_URL']))
{
{
// check this first so IIS will catch
$requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
$requestUrl = $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$requestUri;
@ -2273,7 +2273,7 @@ class e107
$requestUrl = $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST'].$requestUri;
}
else
{
{
// go back to e_SELF
$requestUri = $eSelf;
$requestUrl = e_SELF;
@ -2292,14 +2292,14 @@ class e107
header('HTTP/1.1 403 Forbidden');
exit;
}
// e_MENU fix
if(e_MENU)
{
str_replace('['.e_MENU.']', '', $requestUri);
str_replace('['.e_MENU.']', '', $requestUrl);
}
// the last anti-XSS measure, XHTML compliant URL to be used in forms instead e_SELF
define('e_REQUEST_URL', str_replace(array("'", '"'), array('%27', '%22'), $requestUrl)); // full request url string (including domain)
define('e_REQUEST_SELF', array_shift(explode('?', e_REQUEST_URL))); // full URL without the QUERY string
@ -2343,7 +2343,7 @@ class e107
define('SITEURLBASE', $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST']);
define('SITEURL', SITEURLBASE.e_HTTP);
// login/signup
define('e_SIGNUP', SITEURL.(file_exists(e_BASE.'customsignup.php') ? 'customsignup.php' : 'signup.php'));
define('e_LOGIN', SITEURL.(file_exists(e_BASE.'customlogin.php') ? 'customlogin.php' : 'login.php'));
@ -2566,22 +2566,22 @@ class e107
if(!$this->_ip_cache)
{
$ip=$_SERVER['REMOTE_ADDR'];
if (getenv('HTTP_X_FORWARDED_FOR'))
if (getenv('HTTP_X_FORWARDED_FOR'))
{
if (preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', getenv('HTTP_X_FORWARDED_FOR'), $ip3))
if (preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', getenv('HTTP_X_FORWARDED_FOR'), $ip3))
{
$ip2 = array('#^0\..*#',
$ip2 = array('#^0\..*#',
'#^127\..*#', // Local loopbacks
'#^192\.168\..*#', // RFC1918 - Private Network
'#^172\.(?:1[6789]|2\d|3[01])\..*#', // RFC1918 - Private network
'#^10\..*#', // RFC1918 - Private Network
'#^169\.254\..*#', // RFC3330 - Link-local, auto-DHCP
'#^169\.254\..*#', // RFC3330 - Link-local, auto-DHCP
'#^2(?:2[456789]|[345][0-9])\..*#' // Single check for Class D and Class E
);
$ip = preg_replace($ip2, $ip3[1], $ip);
}
}
if ($ip == "")
}
if ($ip == "")
{
$ip = "x.x.x.x";
}

View File

@ -15,15 +15,18 @@ class plugin_forum_post_shortcodes extends e_shortcode
{
$parm = ($parm ? $parm : 10);
global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
$txt = $this->e107->tp->parseTemplate($LATESTPOSTS_START, true);
$start = max($this->threadInfo['thread_total_replies'] - $parm, 0);
$num = min($this->threadInfo['thread_total_replies'], $parm);
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], $start, $num);
for($i = count($tmp)-1; $i > 0; $i--)
$bach = e107::getScBatch('view', 'forum');
for($i = count($tmp); $i > 0; $i--)
{
setScVar('forum_shortcodes', 'postInfo', $tmp[$i]);
$bach->setScVar('postInfo', $tmp[$i-1]);
//setScVar('forum_shortcodes', 'postInfo', $tmp[$i]);
$txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_POST, true);
}
$txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_END, true);
@ -34,7 +37,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
{
global $THREADTOPIC_REPLY;
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], 0, 1);
setScVar('forum_shortcodes', 'postInfo', $tmp[0]);
e107::getScBatch('view', 'forum')->setScVar('postInfo', $tmp[0]);
return $this->e107->tp->parseTemplate($THREADTOPIC_REPLY, true);
}
@ -125,10 +128,10 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_postthreadas()
{
global $action, $thread_info;
global $action, $threadInfo;
if (MODERATOR && $action == "nt")
{
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_sticky']);
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $threadInfo['thread_sticky']); // no reference of 'head' $threadInfo['head']['thread_sticky']
return "<br /><span class='defaulttext'>".LAN_400."<input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1."&nbsp;<input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2."&nbsp;<input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
}
return '';
@ -136,9 +139,10 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_backlink()
{
global $forum, $thread_info, $eaction, $action;
$_tmp = '';
$forum->set_crumb(true, ($action == 'nt' ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406.' '.$thread_info['head']['thread_name'])), $_tmp);
global $forum, $threadInfo, $eaction, $action;
$_tmp = new e_vars();
// no reference of 'head' $threadInfo['head']['thread_name']
$forum->set_crumb(true, ($action == 'nt' ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406.' '.$threadInfo['thread_name'])), $_tmp);
return $_tmp->BREADCRUMB;
}
@ -150,7 +154,7 @@ class plugin_forum_post_shortcodes extends e_shortcode
function sc_emailnotify()
{
global $thread_info, $action, $eaction;
global $threadInfo, $action, $eaction;
$pref = e107::getPlugPref('forum');
@ -163,9 +167,10 @@ class plugin_forum_post_shortcodes extends e_shortcode
}
else
{
if(isset($thread_info))
if(isset($threadInfo))
{
$chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : '');
// no reference of 'head' $threadInfo['head']['thread_active']
$chk = ($threadInfo['thread_active'] == 99 ? "checked='checked'" : '');
}
else
{

View File

@ -27,8 +27,8 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_threaddatestamp()
{
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');
$gen = e107::getDateConvert();
return "<a id='post_{$this->postInfo['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 sc_post()
@ -271,6 +271,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
if (!$this->postInfo['post_user']) { return ''; }
$rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']);
// FIXME - level handler!!!
if(!$parm) { $parm = 'name'; }

View File

@ -15,7 +15,7 @@ function print_item($thread_id)
$count = 1;
unset($thread_info[0], $thread_info['head']);
foreach($thread_info as $reply)
{

View File

@ -5,7 +5,7 @@ function url_forum_forum($parms)
switch($parms['func'])
{
case 'view':
$page = (varset($parms['page']) ? '&p='.$parms['page'] : '');
$page = (varset($parms['page']) ? '&amp;p='.$parms['page'] : '');
return e_PLUGIN_ABS."forum/forum_viewforum.php?id={$parms['id']}{$page}";
break;
@ -26,7 +26,7 @@ function url_forum_forum($parms)
break;
case 'mfar':
return e_PLUGIN_ABS.'forum/forum.php?f=mfar&id='.$parms['id'];
return e_PLUGIN_ABS.'forum/forum.php?f=mfar&amp;id='.$parms['id'];
break;
}

View File

@ -6,65 +6,65 @@ function url_forum_thread($parms)
{
case 'nt':
return e_PLUGIN_ABS."forum/forum_post.php?f=nt&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_post.php?f=nt&amp;id={$parms['id']}";
break;
case 'rp':
return e_PLUGIN_ABS."forum/forum_post.php?f=rp&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_post.php?f=rp&amp;id={$parms['id']}";
break;
case 'view':
$page = (varset($parms['page']) ? '&p='.$parms['page'] : '');
$page = (varset($parms['page']) ? '&amp;p='.$parms['page'] : '');
return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}{$page}";
break;
case 'last':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}&last=1";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?id={$parms['id']}&amp;last=1";
break;
case 'post':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=post&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=post&amp;id={$parms['id']}";
break;
case 'report':
$page = (isset($parms['page']) ? (int)$parms['page'] : 0 );
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=report&id={$parms['id']}&post={$parms['post']}&p={$page}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=report&amp;id={$parms['id']}&amp;post={$parms['post']}&amp;p={$page}";
break;
case 'edit':
return e_PLUGIN_ABS."forum/forum_post.php?f=edit&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_post.php?f=edit&amp;id={$parms['id']}";
break;
case 'move':
return e_PLUGIN_ABS."forum/forum_conf.php?f=move&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_conf.php?f=move&amp;id={$parms['id']}";
break;
case 'split':
return e_PLUGIN_ABS."forum/forum_conf.php?f=split&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_conf.php?f=split&amp;id={$parms['id']}";
break;
case 'quote':
return e_PLUGIN_ABS."forum/forum_post.php?f=quote&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_post.php?f=quote&amp;id={$parms['id']}";
break;
case 'next':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=next&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=next&amp;id={$parms['id']}";
break;
case 'prev':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=prev&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=prev&amp;id={$parms['id']}";
break;
case 'track':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=track&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=track&amp;id={$parms['id']}";
break;
case 'untrack':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=untrack&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=untrack&amp;id={$parms['id']}";
break;
case 'track_toggle':
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=track_toggle&id={$parms['id']}";
return e_PLUGIN_ABS."forum/forum_viewtopic.php?f=track_toggle&amp;id={$parms['id']}";
break;
}

View File

@ -1154,31 +1154,29 @@ class e107forum
function set_crumb($forum_href=false, $thread_title='', &$templateVar)
{
$e107 = e107::getInstance();
global $FORUM_CRUMB, $forumInfo, $thread;
global $FORUM_CRUMB, $forumInfo, $threadInfo, $thread;
global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
if(!$forumInfo) { $forumInfo = $thread->threadInfo; }
// var_dump($forumInfo);
// var_dump($thread);
if(!$forumInfo && $thread) { $forumInfo = $thread->threadInfo; }
if(is_array($FORUM_CRUMB))
{
$search = array('{SITENAME}', '{SITENAME_HREF}');
$replace = array(SITENAME, "href='".$e107->url->getUrl('core:core', 'main', 'action=index')."'");
$replace = array(SITENAME, $e107->url->getUrl('core:core', 'main', 'action=index'));
$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
$search = array('{FORUMS_TITLE}', '{FORUMS_HREF}');
$replace = array(LAN_01, "href='".$e107->url->getUrl('forum', 'forum', 'func=main')."'");
$replace = array(LAN_01, $e107->url->getUrl('forum', 'forum', 'func=main'));
$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
$search = '{PARENT_TITLE}';
$replace = $e107->tp->toHTML($forumInfo['parent_name']);
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
if($forum_info['forum_sub'])
if($forumInfo['forum_sub'])
{
$search = array('{SUBPARENT_TITLE}', '{SUBPARENT_HREF}');
$replace = array(ltrim($forumInfo['sub_parent'], '*'), "href='".$e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_sub']}")."'");
$replace = array(ltrim($forumInfo['sub_parent'], '*'), $e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_sub']}"));
$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
}
else
@ -1187,11 +1185,13 @@ class e107forum
}
$search = array('{FORUM_TITLE}', '{FORUM_HREF}');
$replace = array(ltrim($forumInfo['forum_name'], '*'),"href='".$e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_id']}")."'");
// TODO - remove 'href=' from the return value
$replace = array(ltrim($forumInfo['forum_name'], '*'), $e107->url->getUrl('forum', 'forum', "func=view&id={$forumInfo['forum_id']}"));
$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
$search = array('{THREAD_TITLE}');
$replace = array($thread->threadInfo['thread_name']);
$threadInfo['thread_id'] = intval($threadInfo['thread_id']);
$search = array('{THREAD_TITLE}', '{THREAD_HREF}');
$replace = array($threadInfo['thread_name'], $e107->url->getUrl('forum', 'thread', "func=view&id={$threadInfo['thread_id']}")); // $thread->threadInfo - no reference found
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
$FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread';
@ -1201,17 +1201,17 @@ class e107forum
{
$dfltsep = ' :: ';
$BREADCRUMB = "<a class='forumlink' href='".e_BASE."index.php'>".SITENAME."</a>".$dfltsep."<a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_01."</a>".$dfltsep;
if($forum_info['sub_parent'])
if($forumInfo['sub_parent'])
{
$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == '*' ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
$forum_sub_parent = (substr($forumInfo['sub_parent'], 0, 1) == '*' ? substr($forumInfo['sub_parent'], 1) : $forumInfo['sub_parent']);
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forumInfo['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
}
$tmpFname = $forum_info['forum_name'];
$tmpFname = $forumInfo['forum_name'];
if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
if ($forum_href)
{
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'>".$e107->tp->toHTML($tmpFname, TRUE, 'no_hook,emotes_off')."</a>";
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forumInfo['forum_id']}'>".$e107->tp->toHTML($tmpFname, TRUE, 'no_hook,emotes_off')."</a>";
} else
{
$BREADCRUMB .= $tmpFname;

View File

@ -13,7 +13,11 @@
*/
require_once('../../class2.php');
$e107 = e107::getInstance();
$tp = e107::getParser();
$ns = e107::getRender();
if (!$e107->isInstalled('forum'))
{
header('Location: '.e_BASE.'index.php');
@ -45,6 +49,7 @@ switch($action)
case 'rp':
$threadInfo = $forum->threadGet($id, false);
$forumId = $threadInfo['thread_forum_id'];
$forumInfo = $forum->forumGet($forumId);
break;
case 'nt':
@ -94,7 +99,7 @@ if ($action != 'nt' && !$threadInfo['thread_active'] && !MODERATOR)
}
$forumInfo['forum_name'] = $tp->toHTML($forumInfo['forum_name'], true);
define('e_PAGETITLE', LAN_01.' / '.$forumInfo['forum_name'].' / '.($action == 'rp' ? LAN_02.$threadInfo['thread_name'] : LAN_03));
define('e_PAGETITLE', ($action == 'rp' ? LAN_02.$threadInfo['thread_name'] : LAN_03).' / '.$forumInfo['forum_name'].' / '.LAN_01);
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -40,8 +40,8 @@ $forum = new e107forum;
//$view = 25;
$view = $forum->prefs->get('threadspage', 25);
if(!$view) { $view = 25; }
$page = (varset($_GET['p']) ? $_GET['p'] : 0);
$threadFrom = $page * $view;
$page = (varset($_GET['p']) ? $_GET['p'] : 1);
$threadFrom = ($page - 1) * $view;
global $forum_info, $FORUM_CRUMB;
$fVars = new e_vars;
@ -83,7 +83,7 @@ $forumInfo['forum_name'] = $e107->tp->toHTML($forumInfo['forum_name'], true, 'no
$forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
$_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']);
define('e_PAGETITLE', LAN_01.' / '.$_forum_name);
define('e_PAGETITLE', $_forum_name.' / '.LAN_01);
//define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
//$modArray = $forum->forum_getmods($forum_info['forum_moderators']);
@ -411,25 +411,28 @@ function parse_thread($thread_info)
{
for($a = 0; $a <= 2; $a++)
{
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
$tVars->PAGES .= "<a href='{$url}'>".($a+1).'</a>';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$aa}");
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
$tVars->PAGES .= ' ... ';
for($a = $pages-3; $a <= $pages-1; $a++)
{
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
$tVars->PAGES .= "<a href='{$url}'>".($a+1).'</a>';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$aa}");
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
}
else
{
for($a = 0; $a <= ($pages-1); $a++)
{
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$a}");
$tVars->PAGES .= "<a href='{$url}'>".($a+1).'</a>';
$url = $e107->url->getUrl('forum', 'thread', "func=view&id={$thread_info['thread_id']}&page={$aa}");
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
}
$tVars->PAGES = LAN_316.' [&nbsp;'.$tVars->PAGES.'&nbsp;]';

View File

@ -14,8 +14,10 @@
*/
require_once ('../../class2.php');
$e107 = e107::getInstance();
$tp = e107::getParser();
$ns = e107::getRender();
if (!$e107->isInstalled('forum'))
{
@ -41,8 +43,8 @@ include_lan(e_PLUGIN . 'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php')
include_once (e_PLUGIN . 'forum/forum_class.php');
include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php');
$forum = new e107forum;
$thread = new e107ForumThread;
$forum = new e107forum();
$thread = new e107ForumThread();
if(isset($_GET['f']) && $_GET['f'] == 'post')
{
@ -82,7 +84,7 @@ if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo
$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'));
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);
$forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
define('MODERATOR', (USER && $forum->isModerator(USERID)));
@ -98,7 +100,7 @@ if (MODERATOR && isset($_POST['mod']))
$thread->threadInfo = $forum->threadGet($thread->threadId);
}
$postList = $forum->PostGet($thread->threadId, $thread->page * $thread->perPage, $thread->perPage);
$postList = $forum->PostGet($thread->threadId, ($thread->page - 1) * $thread->perPage, $thread->perPage);
$gen = new convert;
if ($thread->message)
@ -117,7 +119,7 @@ if (isset($thread->threadInfo['thread_options']['poll']))
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
}
//Load forum templates
// FIXME - new template paths!
if (file_exists(THEME . 'forum_design.php'))
{
include_once (THEME . 'forum_design.php');
@ -321,7 +323,7 @@ function showmodoptions()
else
{
$type = 'Post';
$ret = "<form method='post' action='" . e_SELF . '?' . e_QUERY . "' id='frmMod_{$postInfo['post_forum']}_{$postInfo['post_thread']}'>";
$ret = "<form method='post' action='" . e_SELF . '?' . e_QUERY . "' id='frmMod_{$postInfo['post_thread']}_{$postInfo['post_id']}'>";
$delId = $postInfo['post_id'];
}
@ -475,7 +477,7 @@ class e107ForumThread
$e107 = e107::getInstance();
$this->threadId = (int)varset($_GET['id']);
$this->perPage = (varset($_GET['perpage']) ? (int)$_GET['perpage'] : $forum->prefs->get('postspage'));
$this->page = (varset($_GET['p']) ? (int)$_GET['p'] : 0);
$this->page = (varset($_GET['p']) ? (int)$_GET['p'] : 1);
//If threadId doesn't exist, or not given, redirect to main forum page
if (!$this->threadId || !$this->threadInfo = $forum->threadGet($this->threadId))
@ -577,11 +579,12 @@ class e107ForumThread
if ($forum->prefs->get('reported_post_email'))
{
require_once (e_HANDLER . 'mail.php');
$report = LAN_422 . SITENAME . " : " . (substr(SITEURL, -1) == "/" ? SITEURL : SITEURL . "/") . $PLUGINS_DIRECTORY . "forum/forum_viewtopic.php?" . $thread_id . ".post\n" . LAN_425 . USERNAME . "\n" . $report_add;
$report = LAN_422 . SITENAME . " : " . (substr(SITEURL, -1) == "/" ? SITEURL : SITEURL . "/") . $e107->getFolder('plugins') . "forum/forum_viewtopic.php?" . $this->threadId . ".post\n" . LAN_425 . USERNAME . "\n" . $report_add;
$subject = LAN_421 . " " . SITENAME;
sendemail(SITEADMINEMAIL, $subject, $report);
}
$e107->sql->db_Insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$thread_info['head']['thread_name']}', " . intval($thread_id) . ", '{$report_add}'");
// no reference of 'head' $threadInfo['head']['thread_name']
$e107->sql->db_Insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$this->threadInfo['thread_name']}', " . intval($this->threadId) . ", '{$report_add}'");
define('e_PAGETITLE', LAN_01 . " / " . LAN_428);
$url = $e107->url->getUrl('forum', 'thread', 'func=post&id='.$postId);
$text = LAN_424 . "<br /><br /><a href='{$url}'>" . LAN_429 . '</a>';

View File

@ -227,21 +227,21 @@ $THREADTOPIC_REPLY = "
";
}
$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>";
$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' href='{SITENAME_HREF}'>{SITENAME}</a>";
$FORUM_CRUMB['sitename']['sep'] = " :: ";
$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' {FORUMS_HREF}>{FORUMS_TITLE}</a>";
$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' href='{FORUMS_HREF}'>{FORUMS_TITLE}</a>";
$FORUM_CRUMB['forums']['sep'] = " :: ";
$FORUM_CRUMB['parent']['value'] = "{PARENT_TITLE}";
$FORUM_CRUMB['parent']['sep'] = " :: ";
$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' {SUBPARENT_HREF}>{SUBPARENT_TITLE}</a>";
$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' href='{SUBPARENT_HREF}'>{SUBPARENT_TITLE}</a>";
$FORUM_CRUMB['subparent']['sep'] = " :: ";
$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' {FORUM_HREF}>{FORUM_TITLE}</a>";
$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORUM_TITLE}</a>";
$FORUM_CRUMB['forum']['sep'] = " :: ";
$FORUM_CRUMB['thread']['value'] = "{THREAD_TITLE}";
$FORUM_CRUMB['thread']['value'] = "<a class='forumlink' href='{THREAD_HREF}'>{THREAD_TITLE}</a>";
?>

View File

@ -2,16 +2,14 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2011 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_viewtopic_template.php,v $
* $Revision$
* $Date$
* $Author$
* $URL$
* $Id$
*/
if (!defined('e107_INIT')) { exit; }
@ -162,7 +160,7 @@ $FORUMEND = "<tr><td colspan='2' class='forumheader3' style='text-align:center'>
<table style='".USER_WIDTH."'>
<tr>
<td style='width:80%'><span class='mediumtext'>{GOTOPAGES}&nbsp;</span>
<td style='width:80%'>{GOTOPAGES}
</td>
<td style='width:20%; text-align: right; white-space: nowrap'>
{BUTTONS}
@ -287,18 +285,18 @@ $FORUMDELETEDSTYLE = "<tr>
</tr>";
$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>";
$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' href='{SITENAME_HREF}'>{SITENAME}</a>";
$FORUM_CRUMB['sitename']['sep'] = " :: ";
$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' {FORUMS_HREF}>{FORUMS_TITLE}</a>";
$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' href='{FORUMS_HREF}'>{FORUMS_TITLE}</a>";
$FORUM_CRUMB['forums']['sep'] = " :: ";
$FORUM_CRUMB['parent']['value'] = "{PARENT_TITLE}";
$FORUM_CRUMB['parent']['sep'] = " :: ";
$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' {SUBPARENT_HREF}>{SUBPARENT_TITLE}</a>";
$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' href='{SUBPARENT_HREF}'>{SUBPARENT_TITLE}</a>";
$FORUM_CRUMB['subparent']['sep'] = " :: ";
$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' {FORUM_HREF}>{FORUM_TITLE}</a>";
$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORUM_TITLE}</a>";
?>