News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Quick edit error

Started by Antero, June 30, 2007, 01:45:11 PM

Previous topic - Next topic

Antero

SMF Version: SMF 1.1.3
I noticed from the error logs that few users are getting this error after I upgraded to 1.1.3.

First line is obviously referring to the message.

http://nerokala.com/forum/index.php?action=quotefast;quote=438030;sesc;modify;xml
Tietokantavirhe (Database error): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
LIMIT 1' at line 8
Tiedosto (File): /home/nerokala/public_html/forum/Sources/Post.php
Rivi (Line): 2038


Edit: First I thought it was just IE7, but it happens when you try to edit your posts with the "quick edit" button and are a regular user (non admin/moderator), all browsers. When you click the button nothing happens.

I checked the console and FF2 gives this error:

Error: XMLDoc.getElementsByTagName("message")[0] has no properties
http://nerokala.com/forum/Themes/default/xml_topic.js
Line: 62

Line = cur_msg_id = XMLDoc.getElementsByTagName("message")[0].getAttribute("id");

And when you try to click the button twice or more then this:

Error: element has no properties
http://nerokala.com/forum/Themes/default/script.js?fin11
Line: 240
 
Line = if (typeof(element.innerHTML) != 'undefined')

I'm using my own custom theme but this applied with the default SMF theme too. Haven't got any mods and I've used SMF since Yabb SE. I tried to reupload all the files and also updated my own themes templates (just using custom index.template and post.template), but the error is still there.

PHP versio: 4.4.7
MySQL versio: 4.1.11-Debian_4sarge7-log

Any solutions? Seems to be something to do with JavaScript. Thanks.

iso

#1
I have the same error here (comes with update to smf 1.1.3), would nice if anyone have a solution.


PHP Version: 5.2.3-0.dotdeb.0
MySQL Version: 5.0.41-Dotdeb_1.dotdeb.1-log


Only change in Post.php was:

<operation>
<search position="before"><![CDATA[ if ($func['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')
$post_errors[] = 'no_message';]]></search>
<add><![CDATA[
if (strpos($_POST['message'],'Versioninfo') && $topic!=10)
fatal_error('Bitte verwende das Thema <a href="http://forum.miranda-im.de/index.php?topic=10">Versioninfo: Welche Plugins nutzt ihr?</a> oder den <a href="http://www.miranda-vi.org/">Service zum Upload der Versioninfo von Wombat</a>! und verlinke den Link der Antwort anschlie&#223;end in deinem <a href="http://forum.miranda-im.de/index.php?action=profile;sa=forumProfile">Profil</a> (Profil-Einstellungen&#8594;Profil&#8594;Version Information).<br />
Der Grund hierf&#252;r ist, dass sonst die Forensuche hunderte Einzelbeitr&#228;ge anzeigen w&#252;rde.<br>Siehe auch: <a href="http://miranda-im.de/mediawiki/index.php?title=FAQ_Versionsinfo_in_das_Forum_stellen">Wie erstelle ich eine Versionsinfo?</a>',false);

]]></add>
</operation>


But with smf 1.1.2 it will work fine, so i dont think it have anythink to do with this mod. It's only happens with a login as an user, not for mods or admins.


Thanks in advance.



Edit: Error exists also without the Mod.

Antero

Edited my post a bit, but any ideas what might cause this? Thanks.

Rudolf

Can you post the code around line 2038 from Post.php? +/- 10 lines
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Antero

Quote from: Rudolf on July 04, 2007, 10:39:58 AM
Can you post the code around line 2038 from Post.php? +/- 10 lines

Here. The line is LIMIT 1", __FILE__, __LINE__);


$moderate_boards = boardsAllowedTo('moderate_board');

$request = db_query("
SELECT IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime, m.body, m.ID_TOPIC, m.subject, t.locked
FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b, {$db_prefix}topics AS t)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE m.ID_MSG = " . (int) $_REQUEST['quote'] . "
AND b.ID_BOARD = m.ID_BOARD
AND t.ID_TOPIC = m.ID_TOPIC
AND $user_info[query_see_board]" . (!isset($_REQUEST['modify']) || (!empty($moderate_boards) && $moderate_boards[0] == 0) ? '' : '
AND (t.locked = 0' . (empty($moderate_boards) ? '' : ' OR b.ID_BOARD IN (' . implode(', ', $moderate_boards)) . ')' . ')') . "
LIMIT 1", __FILE__, __LINE__);
$context['close_window'] = mysql_num_rows($request) == 0;

$context['sub_template'] = 'quotefast';
if (mysql_num_rows($request) != 0)
{
$row = mysql_fetch_assoc($request);
mysql_free_result($request);

// Remove special formatting we don't want anymore.
$row['body'] = un_preparsecode($row['body']);

// Censor the message!
censorText($row['body']);

$row['body'] = preg_replace('~<br(?: /)?' . '>~i', "\n", $row['body']);

dlomneck

#5

Antero

Any clues yet what might cause this? I have tried to locate but haven't really found any solution. I doubt, but could it have any effect that it seems that I upgraded my 1.1.2 board with the upgrade-package? I was quite sure that I did it with update-package as supposed but noticed later that I had done it with the upgrade-package, maybe I was too exited while downloading. :P I always update my forum by uploading files manually via ssh, but as mentioned no mistakes there as I have reuploaded source and theme files and the error still stands. Plus checking the file versions tells that everythings up to date.

The weirdest part is that it works great with users that have moderator/admin status (of course because they always have rights to modify anyones posts, which I believe overrides the users quick modify function). Before updating to 1.1.3 it worked fine with everyone, script.js and xml_topic.js didn't seem to have any changes. But I know that there were these issues with the quick edit that were fixed in SMF 1.1.3

  • Quick edit wasn't updating the subject correctly if it was the first message.
  • Quick edit didn't check whether a topic was being locked

They both naturally work fine. But there were plenty changes (added lines) around the line that error log gives.

I don't know if this helps any but here's some comparison between 1.1.2 and 1.1.3 from Post.php. I'm not really any pro with this coding stuff so I can't say if there's something wrong or not. Not that it's some critical error, but would be nice to get it fixed somehow. :)

Here's the lines from 1.1.2 Post.php starting from line 2024

  checkSession('get');

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

   $request = db_query("
      SELECT IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime, m.body, m.ID_TOPIC, m.subject
      FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
      WHERE m.ID_MSG = " . (int) $_REQUEST['quote'] . "
         AND b.ID_BOARD = m.ID_BOARD
         AND $user_info[query_see_board]
      LIMIT 1", __FILE__, __LINE__);
   $context['close_window'] = mysql_num_rows($request) == 0;

   if (mysql_num_rows($request) != 0)
   {
      $row = mysql_fetch_assoc($request);
      mysql_free_result($request);


And here's from 1.1.3 Post.php starting from line 2023

  checkSession('get');

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

   $moderate_boards = boardsAllowedTo('moderate_board');

   $request = db_query("
      SELECT IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime, m.body, m.ID_TOPIC, m.subject, t.locked
      FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b, {$db_prefix}topics AS t)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
      WHERE m.ID_MSG = " . (int) $_REQUEST['quote'] . "
         AND b.ID_BOARD = m.ID_BOARD
         AND t.ID_TOPIC = m.ID_TOPIC
         AND $user_info[query_see_board]" . (!isset($_REQUEST['modify']) || (!empty($moderate_boards) && $moderate_boards[0] == 0) ? '' : '
        AND (t.locked = 0' . (empty($moderate_boards) ? '' : ' OR b.ID_BOARD IN (' . implode(', ', $moderate_boards)) . ')' . ')') . "
      LIMIT 1", __FILE__, __LINE__);
   $context['close_window'] = mysql_num_rows($request) == 0;

   $context['sub_template'] = 'quotefast';
   if (mysql_num_rows($request) != 0)
   {
      $row = mysql_fetch_assoc($request);
      mysql_free_result($request);


Thanks again.

Nao 尚

#7
Hello!

I'm a bit surprised no one has commented this yet... It's an error that basically makes quick edit unavailable to any non-admin members. I discovered it myself today and stumbled upon this thread when looking for a solution. Since no one has been posted, here is mine.

The problem lies within this new line of code (notice the parenthesis in bold):

AND (t.locked = 0' . (empty($moderate_boards) ? '' : ' OR b.ID_BOARD IN (' . implode(', ', $moderate_boards)) . ')' . ')') . "

It should be like this instead:

AND (t.locked = 0' . (empty($moderate_boards) ? '' : ' OR b.ID_BOARD IN (' . implode(', ', $moderate_boards) . ')') . ')') . "

Well, at least it works for me, now. It's simply a matter of moving a parenthesis a bit further to the right! Maybe the SMF team should issue an official patch for this, I don't know... Or just point out this error and tell admins how to fix it!

(Still the best forum system out there, by the way! It was worth working for a full day on my code to update it to v1.1.3! Hopefully version 2.0 will have a patch for v1.1.3 users :D)
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

greyknight17


Nao 尚

Well... It should be made more visible ;) I didn't find it myself...
Are there any other bugs in 1.1.3 that we should be aware of?
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

greyknight17

Probably...

If you search in more detail or using better keywords, I'm sure you will find them. How did you think I found out? ;)

Nao 尚

Well, sometimes you get lucky... Sometimes you just don't. It's like Google. Choosing the right keywords is crucial. In this case, I made a search on "locked=0" because I had already found my own solution and I wanted to find this specific line of code to see if it had been fixed. (It's quite strange that the other topic didn't appear in my results...)

The problem, really, is that there should be a pinned topic somewhere on the community boards that gathers all the potential issues in the latest version, and their fixes when they're available. It would be a very good idea to help people have the best possible experience with SMF... Don't you think?
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

greyknight17

How about having them here? :D  It's listed there in the Bug Report section ;)

Advertisement: