2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2009-11-17 13:48:46 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2013-03-26 12:33:03 +01:00
|
|
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
2009-11-17 13:48:46 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
require_once('../../class2.php');
|
2011-03-13 14:15:51 +00:00
|
|
|
$e107 = e107::getInstance();
|
|
|
|
if (!$e107->isInstalled('forum'))
|
|
|
|
{
|
|
|
|
header('Location: '.e_BASE.'index.php');
|
|
|
|
exit;
|
|
|
|
}
|
2013-03-26 12:33:03 +01:00
|
|
|
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$tp = e107::getParser();
|
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
require_once(e_PLUGIN.'forum/forum_class.php');
|
|
|
|
$forum = new e107forum;
|
|
|
|
|
2009-11-19 09:46:14 +00:00
|
|
|
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php');
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
$e_sub_cat = 'forum';
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
if(!USER || !isset($_GET['f']) || !isset($_GET['id']))
|
|
|
|
{
|
2013-03-26 12:33:03 +01:00
|
|
|
header('location:'.$e107::getUrl()->create('/'), array(), array('encode' => false, 'full' => 1));
|
2008-12-17 04:22:37 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = (int)$_GET['id'];
|
|
|
|
$action = $_GET['f'];
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
$qry = "
|
2013-04-15 12:44:56 +02:00
|
|
|
SELECT t.*, f.*, fp.forum_id AS forum_parent_id FROM #forum_thread as t
|
2006-12-02 04:36:16 +00:00
|
|
|
LEFT JOIN #forum AS f ON t.thread_forum_id = f.forum_id
|
|
|
|
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
|
|
|
|
WHERE t.thread_id = {$thread_id}
|
|
|
|
";
|
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
$threadInfo = $forum->threadGet($id);
|
|
|
|
$modList = $forum->forumGetMods($threadInfo->forum_moderators);
|
|
|
|
|
|
|
|
//var_dump($threadInfo);
|
|
|
|
//var_dump($modList);
|
|
|
|
|
|
|
|
//If user is not a moderator of indicated forum, redirect to index page
|
|
|
|
if(!in_array(USERID, array_keys($modList)))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2013-03-26 12:33:03 +01:00
|
|
|
header('location:'.$e107::getUrl()->create('/'), array(), array('encode' => false, 'full' => 1));
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once(HEADERF);
|
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
if (isset($_POST['deletepollconfirm']))
|
|
|
|
{
|
2013-03-26 12:33:03 +01:00
|
|
|
$sql->delete("poll", "poll_id='".intval($thread_parent)."' ");
|
2013-04-15 12:44:56 +02:00
|
|
|
$sql->select("forum_thread", "*", "thread_id='".$thread_id."' ");
|
2013-03-26 12:33:03 +01:00
|
|
|
$row = $sql->fetch();
|
2006-12-02 04:36:16 +00:00
|
|
|
extract($row);
|
|
|
|
$thread_name = str_replace("[poll] ", "", $thread_name);
|
2013-04-15 12:44:56 +02:00
|
|
|
$sql->update("forum_thread", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
|
2008-12-17 18:48:02 +00:00
|
|
|
$message = FORCONF_5;
|
2007-01-20 16:18:12 +00:00
|
|
|
$url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
if (isset($_POST['move']))
|
|
|
|
{
|
2008-12-17 18:48:02 +00:00
|
|
|
// print_a($_POST);
|
|
|
|
require_once(e_PLUGIN.'forum/forum_class.php');
|
2006-12-02 04:36:16 +00:00
|
|
|
$forum = new e107forum;
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2010-03-13 20:38:40 +00:00
|
|
|
$newThreadTitle = '';
|
2006-12-02 04:36:16 +00:00
|
|
|
if($_POST['rename_thread'] == 'add')
|
|
|
|
{
|
2010-03-13 20:38:40 +00:00
|
|
|
$newThreadTitle = '['.FORCONF_27.']';
|
|
|
|
$newThreadTitleType = 0;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != '')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2013-03-26 12:33:03 +01:00
|
|
|
$newThreadTitle = $tp->toDB($_POST['newtitle']);
|
2010-03-13 20:38:40 +00:00
|
|
|
$newThreadTitleType = 1;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2010-03-13 20:38:40 +00:00
|
|
|
$threadId = $_GET['id'];
|
|
|
|
$toForum = $_POST['forum_move'];
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2010-03-13 20:38:40 +00:00
|
|
|
$forum->threadMove($threadId, $toForum, $newThreadTitle, $newThreadTitleType);
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2011-11-28 14:19:19 +00:00
|
|
|
$message = FORCONF_9;// XXX _URL_ thread name
|
2013-03-26 12:33:03 +01:00
|
|
|
$url = $e107::getUrl()->create('forum/thread/view', 'id='.$threadId);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
if (isset($_POST['movecancel']))
|
|
|
|
{
|
2008-12-17 18:48:02 +00:00
|
|
|
require_once(e_PLUGIN.'forum/forum_class.php');
|
|
|
|
$forum = new e107forum;
|
|
|
|
$postInfo = $forum->postGet($id, 0, 1);
|
|
|
|
|
|
|
|
$message = FORCONF_10;
|
|
|
|
// $url = e_PLUGIN."forum/forum_viewforum.php?".$info['forum_id'];
|
2013-03-26 12:33:03 +01:00
|
|
|
$url = $e107::getUrl()->create('forum/forum/view', 'id='.$postInfo[0]['post_forum']);// XXX _URL_ thread name
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
if ($message)
|
|
|
|
{
|
|
|
|
$text = "<div style='text-align:center'>".$message."
|
|
|
|
<br />
|
2008-12-17 18:48:02 +00:00
|
|
|
<a href='$url'>".FORCONF_11.'</a>
|
|
|
|
</div>';
|
|
|
|
$ns->tablerender(FORCONF_12, $text);
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once(FOOTERF);
|
|
|
|
exit;
|
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
if ($action == "delete_poll")
|
|
|
|
{
|
|
|
|
$text = "<div style='text-align:center'>
|
2008-12-17 18:48:02 +00:00
|
|
|
".FORCONF_13."
|
2006-12-02 04:36:16 +00:00
|
|
|
<br /><br />
|
|
|
|
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
2014-02-07 07:33:33 -08:00
|
|
|
<input class='btn btn-default button' type='submit' name='deletecancel' value='".FORCONF_14."' />
|
|
|
|
<input class='btn btn-default button' type='submit' name='deletepollconfirm' value='".FORCONF_15."' />
|
2006-12-02 04:36:16 +00:00
|
|
|
</form>
|
|
|
|
</div>";
|
2008-12-17 18:48:02 +00:00
|
|
|
$ns->tablerender(FORCONF_16, $text);
|
2007-09-26 19:28:47 +00:00
|
|
|
require_once(FOOTERF);
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2008-12-17 04:22:37 +00:00
|
|
|
if ($action == 'move')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2008-12-17 04:22:37 +00:00
|
|
|
$postInfo = $forum->postGet($id, 0, 1);
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* <form class="form-horizontal">
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="inputEmail">Email</label>
|
|
|
|
<div class="controls">
|
|
|
|
<input type="text" id="inputEmail" placeholder="Email">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
*/
|
|
|
|
|
|
|
|
$frm = e107::getForm();
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$qry = "
|
|
|
|
SELECT f.forum_id, f.forum_name, fp.forum_name AS forum_parent, sp.forum_name AS sub_parent
|
2008-12-17 04:22:37 +00:00
|
|
|
FROM `#forum` AS f
|
|
|
|
LEFT JOIN `#forum` AS fp ON f.forum_parent = fp.forum_id
|
|
|
|
LEFT JOIN `#forum` AS sp ON f.forum_sub = sp.forum_id
|
2006-12-02 04:36:16 +00:00
|
|
|
WHERE f.forum_parent != 0
|
2008-12-17 18:48:02 +00:00
|
|
|
AND f.forum_id != ".(int)$threadInfo['thread_forum_id']."
|
2006-12-02 04:36:16 +00:00
|
|
|
ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC
|
|
|
|
";
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
$sql->gen($qry);
|
|
|
|
$fList = $sql->db_getList();
|
2013-03-26 12:33:03 +01:00
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
$text = "
|
|
|
|
<form class='forum-horizontal' method='post' action='".e_SELF.'?'.e_QUERY."'>
|
|
|
|
<div style='text-align:center'>
|
|
|
|
<table class='table table-striped' style='".ADMIN_WIDTH."'>
|
|
|
|
<tr>
|
|
|
|
<td>".FORCONF_24.": </td>
|
|
|
|
<td>
|
|
|
|
<select name='forum_move' class='tbox'>";
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
foreach($fList as $f)
|
|
|
|
{
|
2008-12-17 04:22:37 +00:00
|
|
|
if(substr($f['forum_name'], 0, 1) != '*')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2008-12-17 04:22:37 +00:00
|
|
|
$f['sub_parent'] = ltrim($f['sub_parent'], '*');
|
2013-03-12 20:35:04 -07:00
|
|
|
$for_name = $f['forum_parent'].' > ';
|
|
|
|
$for_name .= ($f['sub_parent'] ? $f['sub_parent'].' > ' : '');
|
2008-12-17 04:22:37 +00:00
|
|
|
$for_name .= $f['forum_name'];
|
|
|
|
$text .= "<option value='{$f['forum_id']}'>".$for_name."</option>";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$text .= "</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2013-03-12 20:35:04 -07:00
|
|
|
<td >".FORCONF_32."</td>
|
|
|
|
<td><div class='radio'>
|
|
|
|
".$frm->radio('rename_thread','none',true, 'label='.FORCONF_28)."
|
|
|
|
".$frm->radio('rename_thread', 'add', false, array('label'=> FORCONF_29.' ['.FORCONF_27.'] '.FORCONF_30)). "
|
|
|
|
<div class='form-inline'>".$frm->radio('rename_thread','rename', false, array('label'=>FORCONF_31))."
|
|
|
|
".$frm->text('newtitle', $tp->toForm($threadInfo['thread_name']), 250)."
|
|
|
|
</div>
|
|
|
|
</div></td>
|
2006-12-02 04:36:16 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2013-03-12 20:35:04 -07:00
|
|
|
<div class='center'>
|
|
|
|
<input class='btn btn-primary button' type='submit' name='move' value='".FORCONF_25."' />
|
2014-02-07 07:33:33 -08:00
|
|
|
<input class='btn btn-default button' type='submit' name='movecancel' value='".FORCONF_14."' />
|
2013-03-12 20:35:04 -07:00
|
|
|
</div>
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
</div>
|
2013-03-12 20:35:04 -07:00
|
|
|
</form>";
|
2013-03-26 12:33:03 +01:00
|
|
|
|
2013-03-12 20:35:04 -07:00
|
|
|
|
|
|
|
$threadName = $tp->toHTML($threadInfo['thread_name'], true);
|
|
|
|
$threadText = $tp->toHTML($postInfo[0]['post_entry'], true);
|
|
|
|
|
|
|
|
$text .= "<h3>".$threadName."</h3><div>".$threadText."</div>"; // $e107->ns->tablerender(, ), '', true).$ns->tablerender('', $text, '', true);
|
|
|
|
$ns->tablerender(FORCONF_25, $text);
|
2008-12-17 18:48:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
require_once(FOOTERF);
|
|
|
|
?>
|