1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 13:11:52 +02:00

Some more code clean-up (global pointers, $this->e107->, $sql)

This commit is contained in:
Moc 2013-03-26 12:33:03 +01:00
parent f65708cd5a
commit 61f9077026
6 changed files with 139 additions and 142 deletions

View File

@ -28,7 +28,7 @@ class forumAdmin
$var['main']['link'] = e_SELF;
$var['cat']['text'] = FORLAN_83;
$var['cat']['link'] = e_SELF.'?cat';
if ($sql->db_Select('forum', 'forum_id', "forum_parent='0' LIMIT 1"))
if ($sql->select('forum', 'forum_id', "forum_parent='0' LIMIT 1"))
{
$var['create']['text'] = FORLAN_77;
$var['create']['link'] = e_SELF.'?create';
@ -57,10 +57,10 @@ class forumAdmin
$id = (int)$id;
$confirm = isset($_POST['confirm']) ? true : false;
if($sql->db_Select('forum', '*', "forum_id = {$id}"))
if($sql->select('forum', '*', "forum_id = {$id}"))
{
$txt = "";
$row = $sql->db_Fetch();
$row = $sql->fetch();
if($row['forum_parent'] == 0)
{
$txt .= $this->delete_parent($id, $confirm);
@ -91,7 +91,7 @@ class forumAdmin
$ns = e107::getRender();
//$ret = '';
if($sql->db_Select('forum', 'forum_id', "forum_parent = {$id} AND forum_sub = 0"))
if($sql->select('forum', 'forum_id', "forum_parent = {$id} AND forum_sub = 0"))
{
$fList = $sql->db_getList();
foreach($fList as $f)
@ -101,7 +101,7 @@ class forumAdmin
}
if($confirm)
{
if($sql->db_Delete('forum', "forum_id = {$id}"))
if($sql->delete('forum', "forum_id = {$id}"))
{
//$ret .= 'Forum parent successfully deleted';
$mes->addSuccess(LAN_DELETED);
@ -126,7 +126,7 @@ class forumAdmin
$forumId = (int)$forumId;
// echo "id = $forumId <br />";
// Check for any sub forums
if($sql->db_Select('forum', 'forum_id', "forum_sub = {$forumId}"))
if($sql->select('forum', 'forum_id', "forum_sub = {$forumId}"))
{
$list = $sql->db_getList();
foreach($list as $f)
@ -136,7 +136,7 @@ class forumAdmin
}
require_once(e_PLUGIN.'forum/forum_class.php');
$f = new e107Forum;
if($sql->db_Select('forum_thread', 'thread_id','thread_forum_id='.$forumId))
if($sql->delect('forum_thread', 'thread_id','thread_forum_id='.$forumId))
{
$list = $sql->db_getList();
foreach($list as $t)
@ -144,7 +144,7 @@ class forumAdmin
$f->threadDelete($t['thread_id'], false);
}
}
return $sql->db_Delete('forum', 'forum_id = '.$forumId);
return $sql->delete('forum', 'forum_id = '.$forumId);
}
function delete_forum($id, $confirm = false)
@ -155,7 +155,7 @@ class forumAdmin
$mes = e107::getMessage();
//$ret = '';
if($sql->db_Select('forum', 'forum_id', 'forum_sub = '.$id))
if($sql->select('forum', 'forum_id', 'forum_sub = '.$id))
{
$fList = $sql->db_getList();
foreach($fList as $f)
@ -177,8 +177,8 @@ class forumAdmin
}
}
$sql->db_Select('forum', 'forum_name, forum_threads, forum_replies', 'forum_id = '.$id);
$row = $sql->db_Fetch();
$sql->select('forum', 'forum_name, forum_threads, forum_replies', 'forum_id = '.$id);
$row = $sql->fetch();
//return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
$mes->addInfo("Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads and {$row['forum_replies']} replies."); //FIXME combine multiple info's into one message
@ -207,8 +207,8 @@ class forumAdmin
//return $ret;
}
$sql->db_Select('forum', '*', 'forum_id = '.$id);
$row = $sql->db_Fetch();
$sql->select('forum', '*', 'forum_id = '.$id);
$row = $sql->fetch();
//return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
$mes->addInfo("Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies."); // FIXME show just once on confirm and not LAN_DELETED
$ns->tablerender($caption, $mes->render() . $text);
@ -240,27 +240,27 @@ class forumAdmin
<form method='post' action='".e_SELF.'?'.e_QUERY."'>
<table class='table adminlist'>
<tr>
<td>".LAN_ID."</td>
<td>".LAN_NAME."</td>
<td>".LAN_DESCRIPTION."</td>
<td>".FORLAN_37."</td>
<td>".FORLAN_20."</td>
<td>".LAN_ID."</td>
<td>".LAN_NAME."</td>
<td>".LAN_DESCRIPTION."</td>
<td>".FORLAN_37."</td>
<td>".FORLAN_20."</td>
</tr>
";
if($sql->db_Select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC"))
if($sql->select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC"))
{
$subList = $sql->db_getList();
foreach($subList as $sub)
{
$txt .= "
<tr>
<td style='vertical-align:top'>{$sub['forum_id']}</td>
<td style='vertical-align:top'><input class='tbox' type='text' name='subname[{$sub['forum_id']}]' value='{$sub['forum_name']}' size='30' maxlength='255' /></td>
<td style='vertical-align:top'><textarea cols='60' rows='2' class='tbox' name='subdesc[{$sub['forum_id']}]'>{$sub['forum_description']}</textarea></td>
<td style='vertical-align:top'><input class='tbox' type='text' name='suborder[{$sub['forum_id']}]' value='{$sub['forum_order']}' size='3' maxlength='4' /></td>
<td style='vertical-align:top; text-align:center'>
<a href='".e_SELF."?delete.{$sub['forum_id']}'>".ADMIN_DELETE_ICON."</a>
</td>
<td style='vertical-align:top'>{$sub['forum_id']}</td>
<td style='vertical-align:top'><input class='tbox' type='text' name='subname[{$sub['forum_id']}]' value='{$sub['forum_name']}' size='30' maxlength='255' /></td>
<td style='vertical-align:top'><textarea cols='60' rows='2' class='tbox' name='subdesc[{$sub['forum_id']}]'>{$sub['forum_description']}</textarea></td>
<td style='vertical-align:top'><input class='tbox' type='text' name='suborder[{$sub['forum_id']}]' value='{$sub['forum_order']}' size='3' maxlength='4' /></td>
<td style='vertical-align:top; text-align:center'>
<a href='".e_SELF."?delete.{$sub['forum_id']}'>".ADMIN_DELETE_ICON."</a>
</td>
</tr>
";
}
@ -323,7 +323,7 @@ class forumAdmin
$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
}
if (!$parent_amount = $sql->db_Select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC"))
if (!$parent_amount = $sql->select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC"))
{
//$text .= "<tr><td style='text-align:center' colspan='3'>".FORLAN_29."</td></tr>";
$mes->addInfo(FORLAN_29);
@ -336,7 +336,7 @@ class forumAdmin
<th colspan='2'>".FORLAN_28."</th>
<th>".LAN_OPTIONS."</th>
</tr>";
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
while ($row = $sql->fetch(MYSQL_ASSOC))
{
$parentList[] = $row;
}
@ -370,7 +370,7 @@ class forumAdmin
}
$text .= "</td></tr>";
$forumCount = $sql->db_Select('forum', '*', "forum_parent='".$parent['forum_id']."' AND forum_sub = 0 ORDER BY forum_order ASC");
$forumCount = $sql->select('forum', '*', "forum_parent='".$parent['forum_id']."' AND forum_sub = 0 ORDER BY forum_order ASC");
if (!$forumCount)
{
$text .= "<td colspan='4' style='text-align:center'>".FORLAN_29."</td>";
@ -378,7 +378,7 @@ class forumAdmin
else
{
$forumList = array();
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
while ($row = $sql->fetch(MYSQL_ASSOC))
{
$forumList[] = $row;
}
@ -387,10 +387,10 @@ class forumAdmin
$text .= "
<tr>
<td style='width:5%; text-align:center'>".IMAGE_new."</td>\n<td style='width:55%'><a href='".$e107->url->create('forum/forum/view', $forum)."'>".$tp->toHTML($forum['forum_name'])."</a>";
// <td style='width:5%; text-align:center'>".IMAGE_new."</td>\n<td style='width:55%'><a href='".e_PLUGIN."forum/forum_viewforum.php?{$forum['forum_id']}'>".$e107->tp->toHTML($forum['forum_name'])."</a>";
// <td style='width:5%; text-align:center'>".IMAGE_new."</td>\n<td style='width:55%'><a href='".e_PLUGIN."forum/forum_viewforum.php?{$forum['forum_id']}'>".$tp->toHTML($forum['forum_name'])."</a>";
$text .= "
<br /><span class='smallblacktext'>".$e107->tp->toHTML($forum['forum_description'])."&nbsp;</span>
<br /><span class='smallblacktext'>".$tp->toHTML($forum['forum_description'])."&nbsp;</span>
<br /><b>".FORLAN_140.":</b> ".$e107->user_class->uc_get_classname($forum['forum_class'])."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".$e107->user_class->uc_get_classname($forum['forum_postclass'])."
</td>
@ -449,9 +449,9 @@ class forumAdmin
$id = (int)$id;
if ($sub_action == 'edit' && !$_POST['update_parent'])
{
if ($sql->db_Select('forum', '*', "forum_id=$id"))
if ($sql->select('forum', '*', "forum_id=$id"))
{
$row = $sql->db_Fetch(MYSQL_ASSOC);
$row = $sql->fetch(MYSQL_ASSOC);
}
}
else
@ -514,9 +514,9 @@ class forumAdmin
$id = (int)$id;
if ($sub_action == 'edit' && !$_POST['update_forum'])
{
if ($sql->db_Select('forum', '*', "forum_id=$id"))
if ($sql->select('forum', '*', "forum_id=$id"))
{
$fInfo = $sql->db_Fetch(MYSQL_ASSOC);
$fInfo = $sql->fetch(MYSQL_ASSOC);
}
}
else
@ -537,9 +537,9 @@ class forumAdmin
<td>".FORLAN_22.":</td>
<td>";
$sql->db_Select('forum', '*', 'forum_parent=0');
$sql->select('forum', '*', 'forum_parent=0');
$text .= "<select name='forum_parent' class='tbox'>\n";
while (list($fid, $fname) = $sql->db_Fetch(MYSQL_NUM))
while (list($fid, $fname) = $sql->fetch(MYSQL_NUM))
{
$sel = ($fid == vartrue($fInfor['forum_parent']) ? "selected='selected'" : '');
$text .= "<option value='{$fid}' {$sel}>{$fname}</option>\n";
@ -625,7 +625,7 @@ class forumAdmin
<tr>
<td>
";
if($sql->db_Select("forum", "*", "1 ORDER BY forum_order"))
if($sql->select("forum", "*", "1 ORDER BY forum_order"))
{
$fList = $sql->db_getList();
foreach($fList as $f)
@ -676,7 +676,6 @@ class forumAdmin
$ns = e107::getRender();
$sql = e107::getDb();
$e107 = e107::getInstance();
//$emessage = eMessage::getInstance();
$frm = e107::getForm();
$mes = e107::getMessage();
@ -829,10 +828,10 @@ class forumAdmin
$mes = e107::getMessage();
if ($sub_action) {
$sql -> db_Select("generic", "*", "gen_id='".$sub_action."'");
$row = $sql -> db_Fetch();
$sql -> db_Select("user", "*", "user_id='". $row['gen_user_id']."'");
$user = $sql -> db_Fetch();
$sql->select("generic", "*", "gen_id='".$sub_action."'");
$row = $sql->fetch();
$sql->select("user", "*", "user_id='". $row['gen_user_id']."'");
$user = $sql->fetch();
$con = new convert;
$text = "
<table class='table adminlist'>
@ -875,7 +874,7 @@ class forumAdmin
}
else
{
if ($reported_total = $sql->db_Select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'"))
if ($reported_total = $sql->select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'"))
{
$text .= "
<table class='table adminlist'>
@ -883,7 +882,7 @@ class forumAdmin
<td>".FORLAN_170."</td>
<td>".LAN_OPTIONS."</td>
</tr>";
while ($row = $sql->db_Fetch())
while ($row = $sql->fetch())
{
$text .= "<tr>
<td<a href='".e_SELF."?sr.".$row['gen_id']."'>".FORLAN_171." #".$row['gen_intdata']."</a></td>
@ -911,7 +910,7 @@ class forumAdmin
$sql = e107::getDB();
$frm = e107::getForm();
// $sql -> db_Select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
// $sql->select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
$qry = "
SELECT f.forum_id, f.forum_name, sp.forum_name AS sub_parent, fp.forum_name AS forum_parent
FROM #forum AS f
@ -920,8 +919,8 @@ class forumAdmin
WHERE f.forum_parent != 0
ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC
";
$sql -> db_Select_gen($qry);
$forums = $sql -> db_getList();
$sql->gen($qry);
$forums = $sql->db_getList();
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
@ -1026,30 +1025,30 @@ class forumAdmin
$tp = e107::getParser();
$frm = e107::getForm();
$sql->db_Select("wmessage");
list($null) = $sql->db_Fetch();
list($null) = $sql->db_Fetch();
list($null) = $sql->db_Fetch();
list($id, $guestrules, $wm_active4) = $sql->db_Fetch();
list($id, $memberrules, $wm_active5) = $sql->db_Fetch();
list($id, $adminrules, $wm_active6) = $sql->db_Fetch();
$sql->select("wmessage");
list($null) = $sql->fetch();
list($null) = $sql->fetch();
list($null) = $sql->fetch();
list($id, $guestrules, $wm_active4) = $sql->fetch();
list($id, $memberrules, $wm_active5) = $sql->fetch();
list($id, $adminrules, $wm_active6) = $sql->fetch();
if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'"))
if($sql->select('generic','*',"gen_type='forum_rules_guest'"))
{
$guest_rules = $sql->db_Fetch();
$guest_rules = $sql->fetch();
}
if($sql->db_Select('generic','*',"gen_type='forum_rules_member'"))
if($sql->select('generic','*',"gen_type='forum_rules_member'"))
{
$member_rules = $sql->db_Fetch();
$member_rules = $sql->fetch();
}
if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'"))
if($sql->select('generic','*',"gen_type='forum_rules_admin'"))
{
$admin_rules = $sql->db_Fetch();
$admin_rules = $sql->fetch();
}
$guesttext = $tp->toFORM(vartrue($guest_rules['gen_chardata']));
$guesttext = $tp->toFORM(vartrue($guest_rules['gen_chardata']));
$membertext = $tp->toFORM(vartrue($member_rules['gen_chardata']));
$admintext = $tp->toFORM(vartrue($admin_rules['gen_chardata']));
$admintext = $tp->toFORM(vartrue($admin_rules['gen_chardata']));
$text = "
<form method='post' action='".e_SELF."?rules' id='wmform'>

View File

@ -1503,6 +1503,7 @@ class e107forum
function set_crumb($forum_href=false, $thread_title='', &$templateVar)
{
$e107 = e107::getInstance();
$tp = e107::getParser();
global $FORUM_CRUMB, $forumInfo, $threadInfo, $thread;
global $BREADCRUMB,$BACKLINK; // Eventually we should deprecate BACKLINK
@ -1511,21 +1512,21 @@ class e107forum
if(is_array($FORUM_CRUMB))
{
$search = array('{SITENAME}', '{SITENAME_HREF}');
$replace = array(SITENAME, $e107->url->create('/'));
$replace = array(SITENAME, e107::getUrl()->create('/'));
$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
$search = array('{FORUMS_TITLE}', '{FORUMS_HREF}');
$replace = array(LAN_01, $e107->url->create('forum/forum/main'));
$replace = array(LAN_01, e107::getUrl()->create('forum/forum/main'));
$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
$search = '{PARENT_TITLE}';
$replace = $e107->tp->toHTML($forumInfo['parent_name']);
$replace = $tp->toHTML($forumInfo['parent_name']);
$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
if($forumInfo['forum_sub'])
{
$search = array('{SUBPARENT_TITLE}', '{SUBPARENT_HREF}');
$replace = array(ltrim($forumInfo['sub_parent'], '*'), $e107->url->create('forum/forum/view', "id={$forumInfo['forum_sub']}")); // XXX forum sub name
$replace = array(ltrim($forumInfo['sub_parent'], '*'), e107::getUrl()->create('forum/forum/view', "id={$forumInfo['forum_sub']}")); // XXX forum sub name
$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
}
else
@ -1535,17 +1536,17 @@ class e107forum
$search = array('{FORUM_TITLE}', '{FORUM_HREF}');
// TODO - remove 'href=' from the return value
$replace = array(ltrim($forumInfo['forum_name'], '*'), $e107->url->create('forum/forum/view', $forumInfo));
$replace = array(ltrim($forumInfo['forum_name'], '*'), e107::getUrl()->create('forum/forum/view', $forumInfo));
$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
$threadInfo['thread_id'] = intval($threadInfo['thread_id']);
$search = array('{THREAD_TITLE}', '{THREAD_HREF}');
$replace = array(vartrue($threadInfo['thread_name']), $e107->url->create('forum/thread/view', $threadInfo)); // $thread->threadInfo - no reference found
$replace = array(vartrue($threadInfo['thread_name']), e107::getUrl()->create('forum/thread/view', $threadInfo)); // $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';
// $FORUM_CRUMB['style'] = 'bootstrap';
$BREADCRUMB = $e107->tp->parseTemplate('{BREADCRUMB=FORUM_CRUMB}', true);
$BREADCRUMB = $tp->parseTemplate('{BREADCRUMB=FORUM_CRUMB}', true);
}
else
{
@ -1561,7 +1562,7 @@ class e107forum
if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
if ($forum_href)
{
$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forumInfo['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']}'>".$tp->toHTML($tmpFname, TRUE, 'no_hook,emotes_off')."</a>";
} else
{
$BREADCRUMB .= $tmpFname;

View File

@ -2,14 +2,10 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $URL$
* $Id$
*/
require_once('../../class2.php');
@ -19,6 +15,10 @@ if (!$e107->isInstalled('forum'))
header('Location: '.e_BASE.'index.php');
exit;
}
$ns = e107::getRender();
$tp = e107::getParser();
require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum;
@ -28,7 +28,7 @@ $e_sub_cat = 'forum';
if(!USER || !isset($_GET['f']) || !isset($_GET['id']))
{
header('location:'.$e107->url->create('/'), array(), array('encode' => false, 'full' => 1));
header('location:'.$e107::getUrl()->create('/'), array(), array('encode' => false, 'full' => 1));
exit;
}
@ -51,7 +51,7 @@ $modList = $forum->forumGetMods($threadInfo->forum_moderators);
//If user is not a moderator of indicated forum, redirect to index page
if(!in_array(USERID, array_keys($modList)))
{
header('location:'.$e107->url->create('/'), array(), array('encode' => false, 'full' => 1));
header('location:'.$e107::getUrl()->create('/'), array(), array('encode' => false, 'full' => 1));
exit;
}
@ -59,12 +59,12 @@ require_once(HEADERF);
if (isset($_POST['deletepollconfirm']))
{
$sql->db_Delete("poll", "poll_id='".intval($thread_parent)."' ");
$sql->db_Select("forum_t", "*", "thread_id='".$thread_id."' ");
$row = $sql->db_Fetch();
$sql->delete("poll", "poll_id='".intval($thread_parent)."' ");
$sql->select("forum_t", "*", "thread_id='".$thread_id."' ");
$row = $sql->fetch();
extract($row);
$thread_name = str_replace("[poll] ", "", $thread_name);
$sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
$sql->update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
$message = FORCONF_5;
$url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
}
@ -83,7 +83,7 @@ if (isset($_POST['move']))
}
elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != '')
{
$newThreadTitle = $e107->tp->toDB($_POST['newtitle']);
$newThreadTitle = $tp->toDB($_POST['newtitle']);
$newThreadTitleType = 1;
}
@ -93,7 +93,7 @@ if (isset($_POST['move']))
$forum->threadMove($threadId, $toForum, $newThreadTitle, $newThreadTitleType);
$message = FORCONF_9;// XXX _URL_ thread name
$url = $e107->url->create('forum/thread/view', 'id='.$threadId);
$url = $e107::getUrl()->create('forum/thread/view', 'id='.$threadId);
}
if (isset($_POST['movecancel']))
@ -104,7 +104,7 @@ if (isset($_POST['movecancel']))
$message = FORCONF_10;
// $url = e_PLUGIN."forum/forum_viewforum.php?".$info['forum_id'];
$url = $e107->url->create('forum/forum/view', 'id='.$postInfo[0]['post_forum']);// XXX _URL_ thread name
$url = $e107::getUrl()->create('forum/forum/view', 'id='.$postInfo[0]['post_forum']);// XXX _URL_ thread name
}
if ($message)
@ -161,8 +161,7 @@ if ($action == 'move')
$sql->gen($qry);
$fList = $sql->db_getList();
$text = "
<form class='forum-horizontal' method='post' action='".e_SELF.'?'.e_QUERY."'>
<div style='text-align:center'>
@ -205,9 +204,7 @@ if ($action == 'move')
</div>
</form>";
$ns = e107::getRender();
$tp = e107::getParser();
$threadName = $tp->toHTML($threadInfo['thread_name'], true);
$threadText = $tp->toHTML($postInfo[0]['post_entry'], true);

View File

@ -2,14 +2,12 @@
/*
* e107 website system
*
* Copyright (C) 2008-2011 e107 Inc (e107.org)
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Forum Posting
*
* $URL$
* $Id$
*/
require_once('../../class2.php');
@ -28,7 +26,7 @@ if (!$e107->isInstalled('forum'))
if (isset($_POST['fjsubmit']))
{
header('Location:'.$e107->url->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), '', 'full=1&encode=0'));
header('Location:'.e107::getUrl()->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), '', 'full=1&encode=0'));
exit;
}
@ -37,7 +35,7 @@ $forum = new e107forum();
if (!e_QUERY || !isset($_GET['id']))
{
header('Location:'.$e107->url->create('forum/forum/main', array(), 'full=1&encode=0'));
header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -66,7 +64,7 @@ switch($action)
break;
default:
header("Location:".$e107->url->create('forum/forum/main', array(), 'full=1&encode=0'));
header("Location:".e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -331,11 +329,11 @@ if (isset($_POST['newthread']) || isset($_POST['reply']))
$postInfo = $forum->postGet($newPostId, 'post');
$forumInfo = $forum->forumGet($postInfo['post_forum']);
$threadLink = $e107->url->create('forum/thread/last', $postInfo);
$forumLink = $e107->url->create('forum/forum/view', $forumInfo);
$threadLink = e107::getUrl()->create('forum/thread/last', $postInfo);
$forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo);
if ($forum->prefs->get('redirect'))
{
header('location:'.$e107->url->create('forum/thread/last', $postInfo, array('encode' => false, 'full' => true)));
header('location:'.e107::getUrl()->create('forum/thread/last', $postInfo, array('encode' => false, 'full' => true)));
exit;
}
else
@ -405,7 +403,7 @@ if (isset($_POST['update_thread']))
$forum->threadUpdate($postInfo['post_thread'], $threadVals);
$forum->postUpdate($postInfo['post_id'], $postVals);
$e107cache->clear('newforumposts');
$url = $e107->url->create('forum/thread/post', array('name'=>$threadVals['thread_name'], 'id' => $postInfo['post_id'], 'thread' => $postInfo['post_thread']), array('encode'=>false));
$url = e107::getUrl()->create('forum/thread/post', array('name'=>$threadVals['thread_name'], 'id' => $postInfo['post_id'], 'thread' => $postInfo['post_thread']), array('encode'=>false));
header('location:'.$url);
exit;
}
@ -432,7 +430,7 @@ if (isset($_POST['update_reply']))
$forum->postUpdate($postInfo['post_id'], $postVals);
$e107cache->clear('newforumposts');
$url = $e107->url->create('forum/thread/post', "id={$postInfo['post_id']}", 'encode=0&full=1'); // XXX what data is available, find thread name
$url = e107::getUrl()->create('forum/thread/post', "id={$postInfo['post_id']}", 'encode=0&full=1'); // XXX what data is available, find thread name
header('location:'.$url);
exit;
}
@ -460,10 +458,10 @@ if ($action == 'edit' || $action == 'quote')
if (!isset($_POST['fpreview']))
{
$post = $e107->tp->toForm($postInfo['post_entry']);
$post = $tp->toForm($postInfo['post_entry']);
if($postInfo['post_datestamp'] == $postInfo['thread_datestamp'])
{
$subject = $e107->tp->toForm($postInfo['thread_name']);
$subject = $tp->toForm($postInfo['thread_name']);
}
}

View File

@ -30,13 +30,13 @@ include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
if (isset($_POST['fjsubmit']))
{
// TODO - load from DB and find forum_name
header('location:'.$e107->url->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), '', 'full=1&encode=0'));
header('location:'.e107::getUrl()->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), '', 'full=1&encode=0'));
exit;
}
if (!e_QUERY)
{
header('Location:'.$e107->url->create('forum/forum/main', array(), 'full=1&encode=0'));
header('Location:'.e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -62,7 +62,7 @@ $forumId = (int)$_REQUEST['id'];
if (!$forum->checkPerm($forumId, 'view'))
{
header('Location:'.$e107->url->create('forum/forum/main'));
header('Location:'.e107::getUrl()->create('forum/forum/main'));
exit;
}
@ -106,8 +106,8 @@ if(is_array($FORUM_VIEWFORUM_TEMPLATE) && (e_BOOTSTRAP === true)) // New v2.x bo
$forumInfo['forum_name'] = $e107->tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
$forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
$forumInfo['forum_name'] = $tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
$forumInfo['forum_description'] = $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', $_forum_name.' / '.LAN_01);
@ -174,15 +174,15 @@ if ($pages)
$urlparms['page'] = '[FROM]';
$url = rawurlencode(e107::getUrl()->create('forum/forum/view', $urlparms));
$parms = "total={$pages}&type=page&current={$page}&url=".$url."&caption=off";
$fVars->THREADPAGES = $e107->tp->parseTemplate("{NEXTPREV={$parms}}");
$fVars->THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
unset($urlparms);
}
}
if($forum->checkPerm($forumId, 'post'))
{
$fVars->NEWTHREADBUTTON = "<a href='".$e107->url->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump($e107->url->create('forum/thread/new', array('id' => $forumId))); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
$fVars->NEWTHREADBUTTON = "<a href='".e107::getUrl()->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump(e107::getUrl()->create('forum/thread/new', array('id' => $forumId))); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
}
if(e_BOOTSTRAP !== true)
@ -368,7 +368,7 @@ require_once(FOOTERF);
function parse_thread($thread_info)
{
global $forum, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $menu_pref, $threadsViewed;
global $tp;
$tp = e107::getParser();
$tVars = new e_vars;
$e107 = e107::getInstance();
$text = '';
@ -390,7 +390,7 @@ function parse_thread($thread_info)
if($thread_info['lastpost_username'])
{
// XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
$url = $e107->url->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
$url = e107::getUrl()->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
$tVars->LASTPOST = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
$tVars->LASTPOSTUSER = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
}
@ -398,8 +398,8 @@ function parse_thread($thread_info)
{
if(!$thread_info['thread_lastuser'])
{
$tVars->LASTPOST = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
$tVars->LASTPOSTUSER = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
$tVars->LASTPOST = $tp->toHTML($thread_info['thread_lastuser_anon']);
$tVars->LASTPOSTUSER = $tp->toHTML($thread_info['thread_lastuser_anon']);
}
else
{
@ -439,7 +439,7 @@ function parse_thread($thread_info)
$tVars->ICON = IMAGE_closed;
}
$thread_name = strip_tags($e107->tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
$thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
if(isset($thread_info['thread_options']['poll']))
{
$thread_name = '['.FORLAN_23.'] ' . $thread_name;
@ -464,7 +464,7 @@ function parse_thread($thread_info)
{
$title = '';
}
$tVars->THREADNAME = "<a {$title} href='".$e107->url->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name))."'>{$thread_name}</a>";
$tVars->THREADNAME = "<a {$title} href='".e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name))."'>{$thread_name}</a>";
// FIXME - pages -> convert to nextprev shortcode
$pages = ceil(($tVars->REPLIES)/$forum->prefs->get('postspage'));
$urlparms = $thread_info;
@ -477,7 +477,7 @@ function parse_thread($thread_info)
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$urlparms['page'] = $aa;
$url = $e107->url->create('forum/thread/view', $urlparms);
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
$tVars->PAGES .= ' ... ';
@ -486,7 +486,7 @@ function parse_thread($thread_info)
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$urlparms['page'] = $aa;
$url = $e107->url->create('forum/thread/view', $urlparms);
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
}
@ -497,7 +497,7 @@ function parse_thread($thread_info)
$aa = $a + 1;
$tVars->PAGES .= $tVars->PAGES ? ' ' : '';
$urlparms['page'] = $aa;
$url = $e107->url->create('forum/thread/view', $urlparms);
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$tVars->PAGES .= "<a href='{$url}'>{$aa}</a>";
}
}
@ -513,14 +513,14 @@ function parse_thread($thread_info)
if (MODERATOR)
{
// FIXME _URL_ thread name
// $e107->url->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
// e107::getUrl()->create('forum/forum/view', "id={$thread_info['thread_forum_id']}")
// USED self instead
$tVars->ADMIN_ICONS = "
<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'><div>
<input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" />
".($thread_info['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> ")."
".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> " : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> "). "
<a href='".$e107->url->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a>
<a href='".e107::getUrl()->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a>
</div></form>
';
@ -533,13 +533,13 @@ function parse_thread($thread_info)
if($thread_info['user_name'])
{
$tVars->POSTER = "<a href='".$e107->url->create('user/profile/view', array('id' => $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name']."</a>";
$tVars->POSTER = "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $thread_info['thread_user'], 'name' => $thread_info['user_name']))."'>".$thread_info['user_name']."</a>";
}
else
{
if($thread_info['thread_user_anon'])
{
$tVars->POSTER = $e107->tp->toHTML($thread_info['thread_user_anon']);
$tVars->POSTER = $tp->toHTML($thread_info['thread_user_anon']);
}
else
{
@ -590,12 +590,13 @@ function parse_thread($thread_info)
function parse_sub($subInfo)
{
global $FORUM_VIEW_SUB, $gen, $newflag_list, $tp;
global $FORUM_VIEW_SUB, $gen, $newflag_list;
$tp = e107::getParser();
$tVars = new e_vars;
$e107 = e107::getInstance();
$forumName = $e107->tp->toHTML($subInfo['forum_name'], true);
$tVars->SUB_FORUMTITLE = "<a href='".$e107->url->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
$tVars->SUB_DESCRIPTION = $e107->tp->toHTML($subInfo['forum_description'], false, 'no_hook');
$forumName = $tp->toHTML($subInfo['forum_name'], true);
$tVars->SUB_FORUMTITLE = "<a href='".e107::getUrl()->create('forum/forum/view', $subInfo)."'>{$forumName}</a>";
$tVars->SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook');
$tVars->SUB_THREADS = $subInfo['forum_threads'];
$tVars->SUB_REPLIES = $subInfo['forum_replies'];
@ -611,7 +612,7 @@ function parse_sub($subInfo)
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
{
$tVars->NEWFLAG = "<a href='".$e107->url->create('forum/forum/mfar', 'id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
$tVars->NEWFLAG = "<a href='".e107::getUrl()->create('forum/forum/mfar', 'id='.$subInfo['forum_id'])."'>".IMAGE_new.'</a>';
}
else
{
@ -621,12 +622,12 @@ function parse_sub($subInfo)
if($subInfo['forum_lastpost_info'])
{
$tmp = explode('.', $subInfo['forum_lastpost_info']);
$lp_thread = "<a href='".$e107->url->create('forum/thread/last', array('id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
$lp_thread = "<a href='".e107::getUrl()->create('forum/thread/last', array('id' => $tmp[1]))."'>".IMAGE_post2.'</a>';
$lp_date = $gen->convert_date($tmp[0], 'forum');
if($subInfo['user_name'])
{
$lp_name = "<a href='".$e107->url->create('user/profile/view', array('id' => $subInfo['forum_lastpost_user'], 'name' => $subInfo['user_name']))."'>{$subInfo['user_name']}</a>";
$lp_name = "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $subInfo['forum_lastpost_user'], 'name' => $subInfo['user_name']))."'>{$subInfo['user_name']}</a>";
}
else
{
@ -674,7 +675,7 @@ function fadminoptions($thread_info)
//FIXME - not fully working.
$moveUrl = $e107->url->create('forum/thread/move', "id=".$thread_info['thread_id']);
$moveUrl = e107::getUrl()->create('forum/thread/move', "id=".$thread_info['thread_id']);
$lockUnlock = ($thread_info['thread_active'] ) ? 'lock' : 'unlock';
$stickUnstick = ($thread_info['thread_sticky'] == 1) ? 'unstick' : 'stick';
$id = intval($thread_info['thread_id']);
@ -697,7 +698,7 @@ function fadminoptions($thread_info)
$text .= "<li>".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> Lock" : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> Unlock"). "
</li>";
$text .= "<li><a href='".$e107->url->create('forum/thread/move', "id={$thread_info['thread_id']}")."'>Move</a></li>";
$text .= "<li><a href='".e107::getUrl()->create('forum/thread/move', "id={$thread_info['thread_id']}")."'>Move</a></li>";
*/
$text .= "</ul></div>";

View File

@ -24,7 +24,7 @@ if (!$e107->isInstalled('forum'))
if (isset($_POST['fjsubmit']))
{
header('location:' . $e107->url->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), 'full=1&encode=0'));
header('location:' . e107::getUrl()->create('forum/forum/view', array('id'=>(int) $_POST['forumjump']), 'full=1&encode=0'));
exit;
}
$highlight_search = isset($_POST['highlight_search']);
@ -32,7 +32,7 @@ $highlight_search = isset($_POST['highlight_search']);
if (!e_QUERY)
{
//No parameters given, redirect to forum home
header('Location:' . $e107->url->create('forum/forum/main', array(), 'full=1&encode=0'));
header('Location:' . e107::getUrl()->create('forum/forum/main', array(), 'full=1&encode=0'));
exit;
}
@ -96,7 +96,7 @@ if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo
$forum->threadIncview($thread->threadInfo['thread_id']);
}
define('e_PAGETITLE', strip_tags($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);
define('e_PAGETITLE', strip_tags($tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off')).' / '.$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)));
@ -187,7 +187,7 @@ $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
//$tVars->BREADCRUMB = $crumbs['breadcrumb'];
//$tVars->BACKLINK = $tVars->BREADCRUMB;
//$tVars->FORUM_CRUMB = $crumbs['forum_crumb'];
$tVars->THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
$tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
$tVars->NEXTPREV = "<a class='btn btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>&laquo; " . LAN_389 . "</a>";
// $tVars->NEXTPREV .= ' | ';
$tVars->NEXTPREV .= "<a class='btn btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_390 . " &raquo;</a>";
@ -349,13 +349,13 @@ foreach ($postList as $postInfo)
}
e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo);
$forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n";
$forrep .= $tp->parseTemplate($_style, true, $forum_shortcodes) . "\n";
}
else
{
$postInfo['thread_start'] = true;
e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo);
$forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, vartrue($forum_shortcodes)) . "\n";
$forthr = $tp->parseTemplate($FORUMTHREADSTYLE, true, vartrue($forum_shortcodes)) . "\n";
}
}
unset($loop_uid);
@ -645,7 +645,8 @@ class e107ForumThread
$e107 = e107::getInstance();
$ns = e107::getRender();
$sql = e107::getDb();
$tp = e107::getParser();
if (!isset($_GET['f']))
{
return;
@ -698,7 +699,7 @@ class e107ForumThread
if (isset($_POST['report_thread']))
{
$report_add = $e107->tp->toDB($_POST['report_add']);
$report_add = $tp->toDB($_POST['report_add']);
if ($forum->prefs->get('reported_post_email'))
{
require_once (e_HANDLER . 'mail.php');