News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Unable to post new / reply to / reply to with quote topics

Started by Pause, January 22, 2005, 11:35:14 AM

Previous topic - Next topic

Pause

Well, recently I decided to install the Visual Warning Mod by hand, but believe me - it was time-consuming, but I finally got it done, but now I get this error if I try to quote/modify/reply to a post or start a new topic...
QuoteParse error: parse error, unexpected T_ELSEIF in /home/***/public_html/forums/Sources/Post.php on line 163
This is what I have about there...
// They've posted, so they can make the view count go up one if they really want. (this is to keep views >= replies...)
$_SESSION['last_read_topic'] = 0;

$newTopic = false;
}
elseif(!isset($_REQUEST['msg']) && !$user_info['is_admin'] && $user_info['warning'] == 2){
$idtostore = $topic == null ? -1 : $topic;
$request = db_query("
INSERT INTO {$db_prefix}postmoderation
(ID_MEMBER, ID_TOPIC, ID_BOARD, subject, posterName,
posterEmail, posterTime, posterIP, body, icon,smiliesEnabled, ID_POLL)
VALUES ($ID_MEMBER, '$idtostore', '$board', '$_POST[subject]',
'$_POST[guestname]', '$_POST[email]', " . time() . ", '$_SERVER[REMOTE_ADDR]',
'$_POST[message]','$_POST[icon]', " . (isset($_POST['ns']) ? '0' : '1') . ", $ID_POLL)", __FILE__, __LINE__);
if ($modSettings['returnToPost'] == '1' && $topic != '')
redirectexit("$scripturl?topic=$threadid;start=new");
else
redirectexit("$scripturl?board=$board");
}

I put it there because it seemed to be the right place to put it - as Post.php has changed slightly since Beta 4...

* Mattitude apologises for putting it here as it probably should be dealt in the Visual Warning Topic, but he hasn't had a reply for there since his reply, and needs to get the post function working...
"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion

Oldiesmann

Can you post some lines before and after what you posted? It looks like maybe that last } is in the wrong place...

Pause

Quote from: Oldiesmann on January 22, 2005, 01:15:29 PM
Can you post some lines before and after what you posted? It looks like maybe that last } is in the wrong place...
Lines 88-200 - hopefully that helps...

function Post()
{
global $txt, $scripturl, $topic, $db_prefix, $modSettings, $board, $ID_MEMBER, $user_info;
global $sc, $board_info, $context, $settings, $sourcedir, $options;

loadLanguage('Post');

$context['show_spellchecking'] = $modSettings['enableSpellChecking'] && function_exists('pspell_new');
if ($user_info['warning'] > 2)
fatal_error($txt['visual_been_muted']);
if ($user_info['warning'] == 2)
$context['warning'] = 1;

// You can't reply with a poll... hacker.
if (isset($_REQUEST['poll']) && !empty($topic) && !isset($_REQUEST['msg']))
unset($_REQUEST['poll']);

// Posting an event?
$context['make_event'] = isset($_REQUEST['calendar']);

// You must be posting to *some* board.
if (empty($board) && !$context['make_event'])
fatal_lang_error('smf232', false);

require_once($sourcedir . '/Subs-Post.php');

if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_post';
else
loadTemplate('Post');

// Check if it's locked.  It isn't locked if no topic is specified.
if (!empty($topic))
{
$request = db_query("
SELECT
t.locked, IFNULL(ln.ID_TOPIC, 0) AS notify, t.isSticky, t.ID_POLL, t.numReplies, mf.ID_MEMBER,
t.ID_FIRST_MSG, mf.subject, GREATEST(ml.posterTime, ml.modifiedTime) AS lastPostTime
FROM {$db_prefix}topics AS t
LEFT JOIN {$db_prefix}log_notify AS ln ON (ln.ID_TOPIC = t.ID_TOPIC AND ln.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}messages AS mf ON (mf.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}messages AS ml ON (ml.ID_MSG = t.ID_LAST_MSG)
WHERE t.ID_TOPIC = $topic
LIMIT 1", __FILE__, __LINE__);
list ($locked, $context['notify'], $sticky, $pollID, $context['num_replies'], $ID_MEMBER_POSTER, $ID_FIRST_MSG, $first_subject, $lastPostTime) = mysql_fetch_row($request);
mysql_free_result($request);

// If this topic already has a poll, they sure can't add another.
if (isset($_REQUEST['poll']) && $pollID > 0)
unset($_REQUEST['poll']);

if (empty($_REQUEST['msg']))
{
if ($user_info['is_guest'] && !allowedTo('post_reply_any'))
is_not_guest();

if ($ID_MEMBER_POSTER != $ID_MEMBER)
isAllowedTo('post_reply_any');
elseif (!allowedTo('post_reply_any'))
isAllowedTo('post_reply_own');
}

$context['can_lock'] = allowedTo('lock_any') || ($ID_MEMBER == $ID_MEMBER_POSTER && allowedTo('lock_own'));
$context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);

$context['notify'] = !empty($context['notify']);
$context['sticky'] = isset($_REQUEST['subject']) ? !empty($_REQUEST['sticky']) : $sticky;
}
else
{
if (!$context['make_event'])
isAllowedTo('post_new');

$locked = 0;
$context['can_lock'] = allowedTo(array('lock_any', 'lock_own'));
$context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);

$context['notify'] = !empty($context['notify']);
$context['sticky'] = !empty($_REQUEST['sticky']);
}
$context['can_move'] = allowedTo('move_any');
$context['can_notify'] = allowedTo('mark_any_notify');
$context['can_announce'] = allowedTo('announce_topic');
$context['locked'] = !empty($locked) || !empty($_REQUEST['lock']);

// An array to hold all the attachments for this topic.
$context['current_attachments'] = array();

// Don't allow a post if it's locked and you aren't all powerful.
if ($locked && !allowedTo('moderate_board'))
fatal_lang_error(90, false);

// Check the users permissions - is the user allowed to add or post a poll?
if (isset($_REQUEST['poll']) && $modSettings['pollMode'] == '1')
{
// New topic, new poll.
if (empty($topic))
isAllowedTo('poll_post');
// This is an old topic - but it is yours!  Can you add to it?
elseif ($ID_MEMBER == $ID_MEMBER_POSTER && !allowedTo('poll_add_any'))
isAllowedTo('poll_add_own');
// If you're not the owner, can you add to any poll?
else
isAllowedTo('poll_add_any');

// Set up the poll options.
$context['poll_options'] = array(
'max_votes' => empty($_POST['poll_max_votes']) ? '1' : $_POST['poll_max_votes'],
'hide' => empty($_POST['poll_hide']) ? 0 : $_POST['poll_hide'],
'expire' => !isset($_POST['poll_expire']) ? '' : $_POST['poll_expire'],
'change_vote' => isset($_POST['poll_change_vote'])
);

"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion

Oldiesmann

I don't know what to tell you... The code you posted in the first message isn't even anywhere in the section that you posted in your last message... According to my calculations, if you posted lines 88-200 above, then line 163 would be the one beginning with $context['can_sticky']...

Pause

Quote from: Oldiesmann on January 23, 2005, 02:24:56 PM
I don't know what to tell you... The code you posted in the first message isn't even anywhere in the section that you posted in your last message... According to my calculations, if you posted lines 88-200 above, then line 163 would be the one beginning with $context['can_sticky']...
Here's the whole of it then, hopefully it'll make more sense then - knowing my luck, I probably calculated the wrong place to edit...

[Edit - Nevermind, just turned out there was one bit I hadn't added - not it works again]
"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion

Advertisement: