CONTEXT:
//
// //
// This program is distributed in the hope that it will be useful,
LAST READ OFFSET STARTS HERE
//
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
include('admin_header.php');
$op = '';
$ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0;
foreach (array('approved', 'topic_id', 'post_id') as $getint) {
${$getint} = isset($_POST[$getint]) ? intval($_POST[$getint]) : 0;
}
foreach (array('approved', 'topic_id', 'post_id') as $getint) {
${$getint} = (${$getint})?${$getint}:(isset($_GET[$getint]) ? intval($_GET[$getint]) : 0);
}
if (isset($_GET['op'])) $op = $_GET['op'];
if (isset($_POST['op'])) $op = $_POST['op'];
switch ($op) {
case "del":
$post_handler = &xoops_getmodulehandler('post', 'newbb');
if (!empty($ok)) {
if (!empty($post_id)) {
$post = &$post_handler->get($post_id);
if ($ok == 2 && isset($post)) {
$post_handler->delete($post, true);
}
sync($post->getVar('forum_id'), "forum");
sync($post->getVar('topic_id'), "topic");
}
if ($post->istopic()) {
redirect_header("index.php", 2, _AM_NEWBB_POSTSDELETED);
exit();
} else {
redirect_header("index.php", 2, _AM_NEWBB_POSTSDELETED);
exit();
}
} else {
xoops_cp_header();
xoops_confirm(array('post_id' => $post_id, 'op' => 'del', 'ok' => 2), 'index.php', _AM_NEWBB_DEL_ONE);
xoops_cp_footer();
}
exit();
break;
case "approve":
if (isset($post_id) && $post_id > 0) {
$post_handler = &xoops_getmodulehandler('post', 'newbb');
if ($post_handler->approve($post_id)) {
redirect_header("index.php", 1, _AM_NEWBB_POSTAPPROVED);
} else {
redirect_header("index.php", 1, _AM_NEWBB_POSTNOTAPPROVED);
}
} elseif (isset($topic_id) && $topic_id > 0) {
$topic_handler = &xoops_getmodulehandler('topic', 'newbb');
if ($topic_handler->approve($topic_id)) {
redirect_header("index.php", 1, _AM_NEWBB_TOPICAPPROVED);
} else {
redirect_header("index.php", 1, _AM_NEWBB_TOPICNOTAPPROVED);
}
}
exit();
break;
/* removed */
case "mod":
if (empty($post_id)) {
redirect_header("index.php", 2, _MD_ERRORPOST);
exit();
} else {
xoops_cp_header();
newbb_adminmenu(0, "");
echo "
";
$post_handler = &xoops_getmodulehandler('post', 'newbb');
$forumpost = &$post_handler->get($post_id);
$forum_handler =& xoops_getmodulehandler('forum', 'newbb');
$forum = $forum_handler->get($forumpost->getVar('forum_id'));
$pid = $forumpost->getVar('pid');
$dohtml = $forumpost->getVar('dohtml');
$dosmiley = $forumpost->getVar('dosmiley');
$doxcode = $forumpost->getVar('doxcode');
$icon = $forumpost->getVar('icon');
$attachsig = $forumpost->getVar('attachsig');
$topic_id=$forumpost->getVar('topic_id');
$istopic = ( $forumpost->istopic() )?1:0;
$isedit =1;
$subject_pre="";
$subject=$forumpost->getVar('subject', "E");
$message=$forumpost->getVar('post_text', "E");
$poster_name=$forumpost->getVar('poster_name', "E");
$attachments=$forumpost->getAttachment();
$post_karma=$forumpost->getVar('post_karma');
$require_reply=$forumpost->getVar('require_reply');
$hidden = "";
$admin_form_action = "admin_post.php";
include '../include/forumform.inc.php';
xoops_cp_footer();
}
exit();
break;
/* */
case "createdir":
if (isset($_GET['path'])) $path = $_GET['path'];
$res = newbb_admin_mkdir($path);
$msg = ($res)?_AM_NEWBB_DIRCREATED:_AM_NEWBB_DIRNOTCREATED;
redirect_header('index.php', 2, $msg . ': ' . $path);
exit();
break;
case "setperm":
$res = newbb_admin_chmod($path);
$msg = ($res)?_AM_NEWBB_PERMSET:_AM_NEWBB_PERMNOTSET;
redirect_header('index.php', 2, $msg . ': ' . $path);
exit();
break;
case "senddigest":
$digest_handler = &xoops_getmodulehandler('digest', 'newbb');
$res = $digest_handler->process(true);
$msg = ($res)?_AM_NEWBB_DIGEST_FAILED:_AM_NEWBB_DIGEST_SENT;
redirect_header('index.php', 2, $msg);
exit();
break;
case "default":
default:
xoops_cp_header();
newbb_adminmenu(0, "Index");
$imageLibs = newbb_getImageLibs();
echo "