1
roujinz
Yet another CBB 2.2 problem.
  • 2005/12/5 23:57

  • roujinz

  • Just popping in

  • Posts: 32

  • Since: 2005/10/5


Using latest XOOPS and CBB 2.2.

I am having problems trying to delete posts wether it be my own or someone elses. I recieve the following error message:
Quote:
Parse error: parse error, unexpected T_ELSE in /home/site/public_html/modules/newbb/delete.php on line 103


heres a few lines from my delete.php file:
Quote:
if ( $ok ) {
$isDeleteOne = (NEWBB_DELETEONE == $ok)? true : false;
if($forumpost->isTopic() && $topic->getVar("topic_replies")==0) $isDeleteOne=false;
if($isDeleteOne && $forumpost->isTopic() && $topic->getVar("topic_replies")>0){
$post_handler->emptyTopic($forumpost);
}else{
$post_handler->delete($forumpost, $isDeleteOne);
sync($forum, "forum");
sync($topic_id, "topic");
}

100: if ( $isDeleteOne )
101: insertlog("Post Deleted");
102: redirect_header("viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum", 2,_MD_POSTDELETED);
103: else
104: insertlog("Post Deleted");
redirect_header("viewforum.php?forum=$forum", 2, _MD_POSTSDELETED);
exit();



Anyone have any idea how to fix this?

Thanks!

2
roujinz
Re: Yet another CBB 2.2 problem.
  • 2005/12/13 6:38

  • roujinz

  • Just popping in

  • Posts: 32

  • Since: 2005/10/5


Bump Bump!

Any help?

3
davidthomas1
Re: Yet another CBB 2.2 problem.

Try editing the file and putting curly brackets around the if and else statements.

If the conditional statements are only one line, you don't need brackets. If they're more than one line, you need brackets.

You could try something like this :

if ( $isDeleteOne ){
insertlog("Post Deleted");
redirect_header("viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum"2,_MD_POSTDELETED);
}
else{
insertlog("Post Deleted");
redirect_header("viewforum.php?forum=$forum"2_MD_POSTSDELETED);
}
exit();


HIH (hope it helps)
みんなちがってみんないい。

XOOPS 2.0.13.2

4
roujinz
Re: Yet another CBB 2.2 problem.
  • 2005/12/13 19:54

  • roujinz

  • Just popping in

  • Posts: 32

  • Since: 2005/10/5


Ok so I tried your suggestion but it seems that somehwere along the way I screwed up some other lines. No I get the following error:
Quote:
Parse error: parse error, unexpected $ in /home/site/public_html/modules/newbb/delete.php on line 121


So in an effort to be a bit more detailed here is my entire delete.php file:
Quote:

<?php
// $Id: delete.php,v 1.5 2005/05/15 12:24:47 phppp Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// 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/,https://xoops.org/,http://www.xoopscube.jp/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //

include 'header.php';

$ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0;
foreach (array('forum', 'topic_id', 'post_id', 'order', 'pid', 'act') as $getint) {
${$getint} = isset($_POST[$getint]) ? intval($_POST[$getint]) : 0;

}
foreach (array('forum', 'topic_id', 'post_id', 'order', 'pid', 'act') as $getint) {
${$getint} = (${$getint})?${$getint}:(isset($_GET[$getint]) ? intval($_GET[$getint]) : 0);

}
$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] != 'flat') ? 'thread' : 'flat';
$viewmode = ($viewmode)?$viewmode: (isset($_POST['viewmode'])?$_POST['viewmode'] : 'flat');

if ( empty($forum) ) {
redirect_header("index.php", 2, _MD_ERRORFORUM);
exit();
}

$forum_handler =& xoops_getmodulehandler('forum', 'newbb');
$_forum =& $forum_handler->get($forum);
if (!$forum_handler->getPermission($_forum)){
redirect_header("index.php", 2, _MD_NORIGHTTOACCESS);
exit();
}

$isadmin = newbb_isAdmin($_forum);

$uid = is_object($xoopsUser)? $xoopsUser->getVar('uid'):0;

$post_handler =& xoops_getmodulehandler('post', 'newbb');
$forumpost =& $post_handler->get($post_id);

$topic_handler =& xoops_getmodulehandler('topic', 'newbb');
$topic = $topic_handler->get($topic_id);
$topic_status = $topic->getVar('topic_status');
if ( $topic_handler->getPermission($forum, $topic_status, 'delete')
&& ( $isadmin || $forumpost->checkIdentity() )){}
else{
redirect_header("viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum", 2, _MD_DELNOTALLOWED);
exit();
}

$post_handler =& xoops_getmodulehandler('post', 'newbb');
$forumpost =& $post_handler->get($post_id);

if (!$isadmin && !$forumpost->checkTimelimit('delete_timelimit'))
{
redirect_header("viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&order=$order&viewmode=$viewmode&pid=$pid",2,_MD_TIMEISUPDEL);
exit();
}

if ($xoopsModuleConfig['wol_enabled']){
$online_handler =& xoops_getmodulehandler('online', 'newbb');
$online_handler->init($_forum);
}

if ( $ok ) {
$isDeleteOne = (NEWBB_DELETEONE == $ok)? true : false;
if($forumpost->isTopic() && $topic->getVar("topic_replies")==0) $isDeleteOne=false;
if($isDeleteOne && $forumpost->isTopic() && $topic->getVar("topic_replies")>0){
$post_handler->emptyTopic($forumpost);
}else{
$post_handler->delete($forumpost, $isDeleteOne);
sync($forum, "forum");
sync($topic_id, "topic");
}

if ( $isDeleteOne ){
insertlog("Post Deleted");
redirect_header("viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum", 2, _MD_POSTDELETED);
}else {
insertlog("Post Deleted");
redirect_header("viewforum.php?forum=$forum", 2, _MD_POSTSDELETED);
exit();

if
(include XOOPS_ROOT_PATH."/header.php");
if ( $act == 1 )
{
xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => NEWBB_DELETEONE), 'delete.php', _MD_DEL_ONE);
}
if ( $act == 99 )
{
xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => NEWBB_DELETEONE), 'delete.php', _MD_DEL_ONE);
xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => NEWBB_DELETEALL), 'delete.php', _MD_DEL_RELATED);
}
}
include XOOPS_ROOT_PATH.'/footer.php';
?>


I do appreciate all the help! Thanks!!

PS. sorry for the big long quote, but i dont know how to add the scroll bars....

5
davidthomas1
Re: Yet another CBB 2.2 problem.

A couple of errors:

1) Missing end braces
2) Semi-colon attached to if statement declaration.

If corrected, the final code section might look like this :

if ( $isDeleteOne ){
insertlog("Post Deleted");
redirect_header("viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum"2_MD_POSTDELETED);
}else {
insertlog("Post Deleted");
redirect_header("viewforum.php?forum=$forum"2_MD_POSTSDELETED);
exit();
//add bracket here

if (include XOOPS_ROOT_PATH."/header.php"){ // delete semi-colon and add bracket here
if ( $act == )
{
xoops_confirm(array('post_id' => $post_id'viewmode' => $viewmode'order' => $order'forum' => $forum'topic_id' => $topic_id'ok' => NEWBB_DELETEONE), 'delete.php'_MD_DEL_ONE);
}
if ( 
$act == 99 )
{
xoops_confirm(array('post_id' => $post_id'viewmode' => $viewmode'order' => $order'forum' => $forum'topic_id' => $topic_id'ok' => NEWBB_DELETEONE), 'delete.php'_MD_DEL_ONE);
xoops_confirm(array('post_id' => $post_id'viewmode' => $viewmode'order' => $order'forum' => $forum'topic_id' => $topic_id'ok' => NEWBB_DELETEALL), 'delete.php'_MD_DEL_RELATED);
}
}
みんなちがってみんないい。

XOOPS 2.0.13.2

6
roujinz
Re: Yet another CBB 2.2 problem.
  • 2005/12/14 18:28

  • roujinz

  • Just popping in

  • Posts: 32

  • Since: 2005/10/5


Well it seems to be working now, so i believe that helped fix my problem. Thanks!

Login

Who's Online

157 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 157


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits