decir/viewtopic.php
changeset 6 3f66ec435f08
parent 4 c31210950118
equal deleted inserted replaced
5:6eea55374f5b 6:3f66ec435f08
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    10  *
    10  *
    11  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    11  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    12  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    12  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    13  */
    13  */
    14  
    14 
    15 require('common.php');
    15 require('common.php');
    16 require('bbcode.php');
    16 require('bbcode.php');
    17 require('functions_viewtopic.php');
    17 require('functions_viewtopic.php');
    18 
    18 
    19 global $whos_online;
    19 global $whos_online;
    25   
    25   
    26   if(empty($pid))
    26   if(empty($pid))
    27   {
    27   {
    28     $template->header();
    28     $template->header();
    29     echo '<p>Invalid topic ID</p>';
    29     echo '<p>Invalid topic ID</p>';
    30     $template->footer();
    30     decir_show_footers();
       
    31 $template->footer();
    31     return;
    32     return;
    32   }
    33   }
    33   
    34   
    34   $q = $db->sql_query('SELECT topic_id FROM '.table_prefix.'decir_posts WHERE post_id='.$pid.';');
    35   $q = $db->sql_query('SELECT topic_id FROM '.table_prefix.'decir_posts WHERE post_id='.$pid.';');
    35   if ( !$q )
    36   if ( !$q )
    46   
    47   
    47   if(empty($tid))
    48   if(empty($tid))
    48   {
    49   {
    49     $template->header();
    50     $template->header();
    50     echo '<p>Invalid topic ID</p>';
    51     echo '<p>Invalid topic ID</p>';
    51     $template->footer();
    52     decir_show_footers();
       
    53 $template->footer();
    52     return;
    54     return;
    53   }
    55   }
    54 }
    56 }
    55 
    57 
    56 $q = $db->sql_query('SELECT t.forum_id, t.topic_title, f.forum_name, f.forum_id, t.topic_id, t.topic_deleted, t.topic_deletor, t.topic_delete_reason, u.username AS deletor FROM '.table_prefix.'decir_topics AS t
    58 $q = $db->sql_query('SELECT t.forum_id, t.topic_title, f.forum_name, f.forum_id, t.topic_id, t.topic_deleted, t.topic_deletor, t.topic_delete_reason, u.username AS deletor FROM '.table_prefix.'decir_topics AS t
   190 // log the hit
   192 // log the hit
   191 $time = time();
   193 $time = time();
   192 $q = $db->sql_query('INSERT INTO '.table_prefix."decir_hits(user_id, topic_id, timestamp) VALUES($session->user_id, $tid, $time);");
   194 $q = $db->sql_query('INSERT INTO '.table_prefix."decir_hits(user_id, topic_id, timestamp) VALUES($session->user_id, $tid, $time);");
   193 $q = $db->sql_query('UPDATE '.table_prefix."decir_topics SET num_views = num_views + 1 WHERE topic_id = $tid;");
   195 $q = $db->sql_query('UPDATE '.table_prefix."decir_topics SET num_views = num_views + 1 WHERE topic_id = $tid;");
   194 
   196 
       
   197 decir_show_footers();
   195 $template->footer();
   198 $template->footer();
   196 
   199 
   197 ?>
   200 ?>