phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
[SEO PREMOD 3.0.1] Problem when viewing poll & print

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB SEO Premod
::  
Author Message
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Sun May 18, 2008 10:02 am    Post subject: [SEO PREMOD 3.0.1] Problem when viewing poll & print

Hey,

I have a PHP warning at the top of the page when i view poll results (i have not voted on yet). The URL looks like this:
/phpBB3/viewtopic.php?f=1&t=23107&view=viewpoll

Quote:
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 195: Undefined index: forum_id
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 199: Undefined index: forum_id
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3591: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3593: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3594: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3595: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)


If i look at the lines mentioned i see this:
Code:
   // Check for global announcement correctness?
   if ((!isset($row) || !$row['forum_id']) && !$forum_id)
   {
      trigger_error('NO_TOPIC');
   }
   else if (isset($row) && $row['forum_id'])
   {
      $forum_id = $row['forum_id'];
   }


Any ideas on how to correct this ?

thx


Last edited by GoBieN on Fri May 23, 2008 4:34 pm; edited 2 times in total
Back to top
Visit poster's website
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 790

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon May 19, 2008 12:52 am    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

With apologies for the length of this excerpt, here's the based phpBB-seo premod code:

Code:
// Find topic id if user requested a newer or older topic
if ($view && !$post_id)
{
   if (!$forum_id)
   {
      $sql = 'SELECT forum_id
         FROM ' . TOPICS_TABLE . "
         WHERE topic_id = $topic_id";
      $result = $db->sql_query($sql);
      $forum_id = (int) $db->sql_fetchfield('forum_id');
      $db->sql_freeresult($result);

      if (!$forum_id)
      {
         trigger_error('NO_TOPIC');
      }
   }

   if ($view == 'unread')
   {
      // Get topic tracking info
      $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);

      $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;

      $sql = 'SELECT post_id, topic_id, forum_id
         FROM ' . POSTS_TABLE . "
         WHERE topic_id = $topic_id
            " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . "
            AND post_time > $topic_last_read
         ORDER BY post_time ASC";
      $result = $db->sql_query_limit($sql, 1);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if (!$row)
      {
         $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id
            FROM ' . TOPICS_TABLE . '
            WHERE topic_id = ' . $topic_id;
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $db->sql_freeresult($result);
      }

      if (!$row)
      {
         // Setup user environment so we can process lang string
         $user->setup('viewtopic');

         trigger_error('NO_TOPIC');
      }

      $post_id = $row['post_id'];
      $topic_id = $row['topic_id'];
   }
   else if ($view == 'next' || $view == 'previous')
   {
      $sql_condition = ($view == 'next') ? '>' : '<';
      $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC';

      $sql = 'SELECT forum_id, topic_last_post_time
         FROM ' . TOPICS_TABLE . '
         WHERE topic_id = ' . $topic_id;
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if (!$row)
      {
         $user->setup('viewtopic');
         // OK, the topic doesn't exist. This error message is not helpful, but technically correct.
         trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS');
      }
      else
      {
         $sql = 'SELECT topic_id, forum_id
            FROM ' . TOPICS_TABLE . '
            WHERE forum_id = ' . $row['forum_id'] . "
               AND topic_moved_id = 0
               AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}
               " . (($auth->acl_get('m_approve', $row['forum_id'])) ? '' : 'AND topic_approved = 1') . "
            ORDER BY topic_last_post_time $sql_ordering";
         $result = $db->sql_query_limit($sql, 1);
         $row = $db->sql_fetchrow($result);
         $db->sql_freeresult($result);

         if (!$row)
         {
            $user->setup('viewtopic');
            trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS');
         }
         else
         {
            $topic_id = $row['topic_id'];

            // Check for global announcement correctness?
            if (!$row['forum_id'] && !$forum_id)
            {
               trigger_error('NO_TOPIC');
            }
            else if ($row['forum_id'])
            {
               $forum_id = $row['forum_id'];
            }
         }
      }
   }

   // Check for global announcement correctness?
   if ((!isset($row) || !$row['forum_id']) && !$forum_id)
   {
      trigger_error('NO_TOPIC');
   }
   else if (isset($row) && $row['forum_id'])
   {
      $forum_id = $row['forum_id'];
   }
}


The error says the returned row does not include the column 'forum_id'. All the $sql = assignments I see above include forum_id in the SELECT statement. Have you modified it?

You should find the cause, but FYI... you will not get this warning once you remove the debug constants from your config.php:

Code:
@define('DEBUG', true);
@define('DEBUG_EXTRA', true);

_________________
Dan Kehn
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Wed May 21, 2008 9:11 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

I checked the SQL statements, and all are fine.
After that i added a check in every IF to see wich SQL was executed.
Looks like none !

Code:
$stringstan = "Hassan ";

// Find topic id if user requested a newer or older topic
if ($view && !$post_id)
{
   if (!$forum_id)
   {   
      $stringstan .= "een ";
      $sql = 'SELECT forum_id
         FROM ' . TOPICS_TABLE . "
         WHERE topic_id = $topic_id";
      $result = $db->sql_query($sql);
      $forum_id = (int) $db->sql_fetchfield('forum_id');
      $db->sql_freeresult($result);

      if (!$forum_id)
      {
         trigger_error('NO_TOPIC');
      }
   }

   if ($view == 'unread')
   {
      $stringstan .= "broodje ";
      // Get topic tracking info
      $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);

      $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;

      $sql = 'SELECT post_id, topic_id, forum_id
         FROM ' . POSTS_TABLE . "
         WHERE topic_id = $topic_id
            " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . "
            AND post_time > $topic_last_read
         ORDER BY post_time ASC";
      $result = $db->sql_query_limit($sql, 1);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if (!$row)
      {
         $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id
            FROM ' . TOPICS_TABLE . '
            WHERE topic_id = ' . $topic_id;
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $db->sql_freeresult($result);
      }

      if (!$row)
      {
         // Setup user environment so we can process lang string
         $user->setup('viewtopic');

         trigger_error('NO_TOPIC');
      }

      $post_id = $row['post_id'];
      $topic_id = $row['topic_id'];
   }
   else if ($view == 'next' || $view == 'previous')
   {
      $stringstan .= "aap ";    
      $sql_condition = ($view == 'next') ? '>' : '<';
      $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC';

      $sql = 'SELECT forum_id, topic_last_post_time
         FROM ' . TOPICS_TABLE . '
         WHERE topic_id = ' . $topic_id;
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      if (!$row)
      {
         $user->setup('viewtopic');
         // OK, the topic doesn't exist. This error message is not helpful, but technically correct.
         trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS');
      }
      else
      {
         $sql = 'SELECT topic_id, forum_id
            FROM ' . TOPICS_TABLE . '
            WHERE forum_id = ' . $row['forum_id'] . "
               AND topic_moved_id = 0
               AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}
               " . (($auth->acl_get('m_approve', $row['forum_id'])) ? '' : 'AND topic_approved = 1') . "
            ORDER BY topic_last_post_time $sql_ordering";
         $result = $db->sql_query_limit($sql, 1);
         $row = $db->sql_fetchrow($result);
         $db->sql_freeresult($result);

         if (!$row)
         {
            $user->setup('viewtopic');
            trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS');
         }
         else
         {
            $topic_id = $row['topic_id'];

            // Check for global announcement correctness?
            if (!$row['forum_id'] && !$forum_id)
            {
               trigger_error('NO_TOPIC');
            }
            else if ($row['forum_id'])
            {
               $forum_id = $row['forum_id'];
            }
         }
      }
   }
   //die($stringstan);
   $filename = 'stan.txt';
   $somecontent = "--START--  " . $_SERVER['PHP_SELF'] . "  ---  " . $stringstan . " --END--  \n";

   // Let's make sure the file exists and is writable first.
   if (is_writable($filename))
   {
      // In our example we're opening $filename in append mode.
      // The file pointer is at the bottom of the file hence
      // that's where $somecontent will go when we fwrite() it.
      if (!$handle = fopen($filename, 'a'))
      {
         trigger_error('NO_MODE', E_USER_ERROR);
         exit;
      }

      // Write $somecontent to our opened file.
      if (fwrite($handle, $somecontent) === FALSE)
      {
         trigger_error('NO_MODE', E_USER_ERROR);
         exit;
      }    
      fclose($handle);
   }
   else
   {
      trigger_error('NO_MODE', E_USER_ERROR);
   }

   // Check for global announcement correctness?
   if ((!isset($row) || !$row['forum_id']) && !$forum_id)
   {
      trigger_error('NO_TOPIC');
   }
   else if (isset($row) && $row['forum_id'])
   {
      $forum_id = $row['forum_id'];
   }
}


Gives this as result in my txt file:
BEGIN
--START-- /phpBB3/viewtopic.php --- Hassan --END--

So to conclude, the SQL statements above are never executed !
So the problem mut be higer on up ?
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Thu May 22, 2008 6:54 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

Not only polls, print to:
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 227: Undefined index: forum_id
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 231: Undefined index: forum_id
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3591: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3593: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3594: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3595: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2989)
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Sat May 31, 2008 1:20 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

Problem here is, I could not reproduce the bug yet. Do you have this issue on only one forum, have you tried on another one ?

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Sat May 31, 2008 4:24 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

This is my test forum based on premod 3.0.1

http://www.honda-camino.be/premod/viewtopic.php?f=2&t=2&view=viewpoll
Quote:
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 194: Undefined index: forum_id
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 198: Undefined index: forum_id


Granted my live forum is a copy of the test board, so i will install another !
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon Jun 02, 2008 12:20 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

This forum is modded, I don't have the bug on a regular install.
Could you post a zip with your viewtopic.php file ?

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon Jun 02, 2008 4:09 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

http://www.camino-tuning.be/phpBB3/viewtopic.zip

thanks for the trouble.
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon Jun 09, 2008 11:41 am    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

Sorry for delay,

so I checked your file, and apart from the stargate portal code, there is nothing different from the premod's original.

Looking at the line mentioned by your error message, it looks like you are not using the exact same file on your test board (http://www.honda-camino.be/premod/viewtopic.php?f=2&t=2&view=viewpoll), could you post here line 194 and 198 of your viewtopic.php file ?

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon Jun 09, 2008 4:45 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

lines 193 until 202:
Code:
   // Check for global announcement correctness?
   if ((!isset($row) || !$row['forum_id']) && !$forum_id)
   {
      trigger_error('NO_TOPIC');
   }
   else if (isset($row) && $row['forum_id'])
   {
      $forum_id = $row['forum_id'];
   }
}


And here i zipped the entire file:
http://www.honda-camino.be/root/viewtopic2.zip

There is a difference bewteen the files, that is because after your advise (higher up in this topic) with the different if/else structures, I modified the code of my live board viewtopic.php to add a debug to TXT file system. To see which if/else structures was being called when the error shows up.
This resulted in 30 extra lines.

Thanks for your help.


Last edited by GoBieN on Mon Jun 09, 2008 5:23 pm; edited 1 time in total
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Mon Jun 09, 2008 5:19 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

PS: You are right it is not a fault of phpbbseo premod.
I installed a 2nd test board with premod package, and i have no error.
So it has to be something with another mod. I understand if you stop putting energy in to this since it's not related to phpbbseo.

http://www.honda-camino.be/phpBB3/viewtopic.php?f=2&t=2&start=0&view=viewpoll
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Thu Jun 26, 2008 7:47 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

I still haven't found the solution for this.
But i guess it's not a big problem.
I just don't want to turn debug off, because i prefer to see the errors instead of hearing some time later that something is wrong ...
Back to top
Visit poster's website
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 3103

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Fri Jun 27, 2008 8:17 am    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

GoBieN wrote:
I still haven't found the solution for this.
But i guess it's not a big problem.
I just don't want to turn debug off, because i prefer to see the errors instead of hearing some time later that something is wrong ...


You're right about debugging.
Honestly, looking at your file did not help me to find out where could this be coming from.

The forum id must be unset somewhere in the code since all the code required to grabb it is there (and you'd have the same error on all topic page otherwise).
Since it's in the end working, you could replace :

Code:
   else if (isset($row) && $row['forum_id'])


with :

Code:
   else if (isset($row) && @$row['forum_id'])


or with :

Code:
   else if (!empty($row['forum_id']))


Since this code is supposed to make sure that $row['forum_id'] was set, it should be able to deal with the case where it isn't without throwing a notice.

_________________
Back to top
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

[SEO PREMOD 3.0.1] Problem when viewing poll & printPosted: Sat Jun 28, 2008 3:05 pm    Post subject: Re: [SEO PREMOD 3.0.1] Problem when viewing poll & print

SeO wrote:
GoBieN wrote:
I still haven't found the solution for this.
But i guess it's not a big problem.
I just don't want to turn debug off, because i prefer to see the errors instead of hearing some time later that something is wrong ...


You're right about debugging.
Honestly, looking at your file did not help me to find out where could this be coming from.

The forum id must be unset somewhere in the code since all the code required to grabb it is there (and you'd have the same error on all topic page otherwise).
Since it's in the end working, you could replace :

Code:
   else if (isset($row) && $row['forum_id'])


with :

Code:
   else if (isset($row) && @$row['forum_id'])


or with :

Code:
   else if (!empty($row['forum_id']))


Since this code is supposed to make sure that $row['forum_id'] was set, it should be able to deal with the case where it isn't without throwing a notice.


thanks for the good advice, i will use the @ solution Wink
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 SEO TooLKit  » phpBB SEO Premod
Page 1 of 1

Navigation Similar Topics

Jump to: