diff options
Diffstat (limited to '')
-rw-r--r-- | include/category_subcats.inc.php | 9 | ||||
-rw-r--r-- | include/functions.inc.php | 15 | ||||
-rw-r--r-- | include/page_tail.php | 17 |
3 files changed, 24 insertions, 17 deletions
diff --git a/include/category_subcats.inc.php b/include/category_subcats.inc.php index 7e6d080d8..4ee5929ea 100644 --- a/include/category_subcats.inc.php +++ b/include/category_subcats.inc.php @@ -69,7 +69,14 @@ while ($row = mysql_fetch_array($result)) SELECT path, tn_ext FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGES_TABLE.' AS i ON i.id = c.representative_picture_id - WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\' + WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\''; + // we must not show pictures of a forbidden category + if ($user['forbidden_categories'] != '') + { + $query.= ' + AND c.id NOT IN ('.$user['forbidden_categories'].')'; + } + $query.= ' ORDER BY RAND() LIMIT 0,1 ;'; diff --git a/include/functions.inc.php b/include/functions.inc.php index 915a1b6b6..adbbce358 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -461,24 +461,23 @@ function pwg_write_debug() function pwg_query($query) { - global $conf; + global $conf,$count_queries,$queries_time; $start = get_moment(); $result = mysql_query($query); - + + $time = get_moment() - $start; + $count_queries++; + $queries_time+= $time; + if ($conf['show_queries']) { - global $count_queries,$queries_time; - - $time = get_moment() - $start; - $count_queries++; - $output = ''; $output.= '<pre>['.$count_queries.'] '."\n".$query; - $queries_time+= $time; $output.= "\n".'(this query time : '.number_format( $time, 3, '.', ' ').' s)</b>'; $output.= "\n".'(total SQL time : '.number_format( $queries_time, 3, '.', ' ').' s)'; $output.= '</pre>'; + echo $output; } diff --git a/include/page_tail.php b/include/page_tail.php index 1092daefc..8ea329f4d 100644 --- a/include/page_tail.php +++ b/include/page_tail.php @@ -26,26 +26,27 @@ // +-----------------------------------------------------------------------+ $template->set_filenames(array('tail'=>'footer.tpl')); -//------------------------------------------------------------- generation time - -$time = get_elapsed_time( $t2, get_moment() ); - $template->assign_vars( array( - 'TIME' => $time, 'VERSION' => PHPWG_VERSION, 'MAIL'=>$conf['mail_webmaster'], 'L_GEN_TIME' => $lang['generation_time'], + 'L_SQL_QUERIES_IN' => $lang['sql_queries_in'], 'L_SEND_MAIL' => $lang['send_mail'], 'L_TITLE_MAIL' => $lang['title_send_mail'], 'L_WEBMASTER'=>$lang['webmaster'], - )); - +//------------------------------------------------------------- generation time if ($conf['show_gt']) { - $template->assign_block_vars('debug', array()); + $time = get_elapsed_time( $t2, get_moment() ); + + $template->assign_block_vars( + 'debug', + array('TIME' => $time, + 'NB_QUERIES' => $count_queries, + 'SQL_TIME' => number_format($queries_time, 3, '.', ' ').' s')); } // |