1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-12 10:40:20 +01:00
php-e107/e107_plugins/forum/forum_conf.php

194 lines
5.6 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
2009-11-17 13:48:46 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright (C) 2008-2009 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)
*
*
*
* $URL$
* $Id$
2009-11-17 13:48:46 +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;
}
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';
if(!USER || !isset($_GET['f']) || !isset($_GET['id']))
{
header('location:'.$e107->url->create('/'), array(), array('encode' => false, 'full' => 1));
exit;
}
$id = (int)$_GET['id'];
$action = $_GET['f'];
2006-12-02 04:36:16 +00:00
$qry = "
SELECT t.*, f.*, fp.forum_id AS forum_parent_id FROM #forum_t as t
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}
";
$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
{
header('location:'.$e107->url->create('/'), array(), array('encode' => false, 'full' => 1));
2006-12-02 04:36:16 +00:00
exit;
}
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();
extract($row);
$thread_name = str_replace("[poll] ", "", $thread_name);
$sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
$message = FORCONF_5;
$url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
if (isset($_POST['move']))
{
// print_a($_POST);
require_once(e_PLUGIN.'forum/forum_class.php');
2006-12-02 04:36:16 +00:00
$forum = new e107forum;
$newThreadTitle = '';
2006-12-02 04:36:16 +00:00
if($_POST['rename_thread'] == 'add')
{
$newThreadTitle = '['.FORCONF_27.']';
$newThreadTitleType = 0;
2006-12-02 04:36:16 +00:00
}
elseif($_POST['rename_thread'] == 'rename' && trim($_POST['newtitle']) != '')
2006-12-02 04:36:16 +00:00
{
$newThreadTitle = $e107->tp->toDB($_POST['newtitle']);
$newThreadTitleType = 1;
2006-12-02 04:36:16 +00:00
}
$threadId = $_GET['id'];
$toForum = $_POST['forum_move'];
$forum->threadMove($threadId, $toForum, $newThreadTitle, $newThreadTitleType);
$message = FORCONF_9;// XXX _URL_ thread name
$url = $e107->url->create('forum/thread/view', 'id='.$threadId);
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
if (isset($_POST['movecancel']))
{
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'];
$url = $e107->url->create('forum/forum/view', 'id='.$postInfo[0]['post_forum']);// XXX _URL_ thread name
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
if ($message)
{
$text = "<div style='text-align:center'>".$message."
<br />
<a href='$url'>".FORCONF_11.'</a>
</div>';
$ns->tablerender(FORCONF_12, $text);
2006-12-02 04:36:16 +00:00
require_once(FOOTERF);
exit;
}
2006-12-02 04:36:16 +00:00
if ($action == "delete_poll")
{
$text = "<div style='text-align:center'>
".FORCONF_13."
2006-12-02 04:36:16 +00:00
<br /><br />
<form method='post' action='".e_SELF."?".e_QUERY."'>
2013-03-10 19:44:54 -07:00
<input class='btn button' type='submit' name='deletecancel' value='".FORCONF_14."' />
<input class='btn button' type='submit' name='deletepollconfirm' value='".FORCONF_15."' />
2006-12-02 04:36:16 +00:00
</form>
</div>";
$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;
}
if ($action == 'move')
2006-12-02 04:36:16 +00:00
{
$postInfo = $forum->postGet($id, 0, 1);
2006-12-02 04:36:16 +00:00
$text = "
<form method='post' action='".e_SELF.'?'.e_QUERY."'>
2006-12-02 04:36:16 +00:00
<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>
<tr>
<td style='text-align:right'>".FORCONF_24.": </td>
2006-12-02 04:36:16 +00:00
<td style='text-align:left'>
<select name='forum_move' class='tbox'>";
$qry = "
SELECT f.forum_id, f.forum_name, fp.forum_name AS forum_parent, sp.forum_name AS sub_parent
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
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
";
$e107->sql->db_Select_gen($qry);
$fList = $e107->sql->db_getList();
2006-12-02 04:36:16 +00:00
foreach($fList as $f)
{
if(substr($f['forum_name'], 0, 1) != '*')
2006-12-02 04:36:16 +00:00
{
$f['sub_parent'] = ltrim($f['sub_parent'], '*');
$for_name = $f['forum_parent'].' -> ';
$for_name .= ($f['sub_parent'] ? $f['sub_parent'].' -> ' : '');
$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>
<td colspan='2'><br />
<b>".FORCONF_32."</b><br />
<input type='radio' name='rename_thread' checked='checked' value='none' /> ".FORCONF_28."<br />
<input type='radio' name='rename_thread' value='add' /> ".FORCONF_29.' ['.FORCONF_27.'] '.FORCONF_30."<br />
<input type='radio' name='rename_thread' value='rename' /> ".FORCONF_31." <input type='text' class='tbox' name='newtitle' size='60' maxlength='250' value='".$tp->toForm($info['thread_name'])."'/>
2006-12-02 04:36:16 +00:00
</td>
</tr>
<tr style='vertical-align: top;'>
<td colspan='2' style='text-align:center'><br />
2013-03-10 19:44:54 -07:00
<input class='btn button' type='submit' name='move' value='".FORCONF_25."' />
<input class='btn button' type='submit' name='movecancel' value='".FORCONF_14."' />
2006-12-02 04:36:16 +00:00
</td>
</tr>
</table>
</div>
</form><br />";
$text = $e107->ns->tablerender($e107->tp->toHTML($threadInfo['thread_name']), $e107->tp->toHTML($postInfo[0]['post_entry']), '', true).$ns->tablerender('', $text, '', true);
$e107->ns->tablerender(FORCONF_25, $text);
2006-12-02 04:36:16 +00:00
}
require_once(FOOTERF);
?>