Changeset 345 for trunk/comments.php


Ignore:
Timestamp:
Feb 2, 2004, 1:55:18 AM (20 years ago)
Author:
gweltas
Message:

Merge of the 1.3.1 release
Creation of an unique include file (common.php)
Creation of an unique define file (include/constants.php)
Modification of the installation procedure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/comments.php

    r231 r345  
    1818 ***************************************************************************/
    1919
    20 include_once( './include/init.inc.php' );
     20//----------------------------------------------------------- include
     21$phpwg_root_path = './';
     22include_once( $phpwg_root_path.'common.php' );
     23
    2124//------------------------------------------------------------------- functions
    2225function display_pictures( $mysql_result, $maxtime, $forbidden_cat_ids )
     
    4750    $category_id = $subrow['category_id'];
    4851
    49     if ( $array_cat_directories[$category_id] == '' )
     52    if ( !isset($array_cat_directories[$category_id]))
    5053    {
    5154      $array_cat_directories[$category_id] =
     
    134137}
    135138//----------------------------------------------------- template initialization
    136 $vtp = new VTemplate;
     139//
     140// Start output of page
     141//
     142$title= $lang['title_comments'];
     143include('include/page_header.php');
     144
    137145$handle = $vtp->Open( './template/'.$user['template'].'/comments.vtp' );
    138146initialize_template();
    139147$tpl = array( 'title_comments','stats_last_days','search_return_main_page' );
    140148templatize_array( $tpl, 'lang', $handle );
    141 $vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] );
    142149//--------------------------------------------------- number of days to display
    143 if ( isset( $_GET['last_days'] ) ) define( "MAX_DAYS", $_GET['last_days'] );
    144 else                               define( "MAX_DAYS", 0 );
     150if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] );
     151else                               define( 'MAX_DAYS', 0 );
    145152//----------------------------------------- non specific section initialization
    146153$array_cat_directories = array();
     
    169176$query.= ' WHERE c.image_id = ic.image_id';
    170177$query.= ' AND date > '.$maxtime;
     178$query.= " AND validated = 'true'";
    171179// we must not show pictures of a forbidden category
    172 $restricted_cats = get_all_restrictions( $user['id'],$user['status'] );
    173 if ( count( $restricted_cats ) > 0 )
     180if ( $user['forbidden_categories'] != '' )
    174181{
    175   $query.= ' AND category_id NOT IN (';
    176   foreach ( $restricted_cats as $i => $restricted_cat ) {
    177     if ( $i > 0 ) $query.= ',';
    178     $query.= $restricted_cat;
    179   }
    180   $query.= ')';
     182  $query.= ' AND category_id NOT IN ';
     183  $query.= '('.$user['forbidden_categories'].')';
    181184}
    182185$query.= ' ORDER BY ic.image_id DESC';
    183186$query.= ';';
    184187$result = mysql_query( $query );
    185 display_pictures( $result, $maxtime, $restricted_cats );
     188display_pictures( $result, $maxtime, $user['restrictions'] );
    186189//----------------------------------------------------------- html code display
    187190$code = $vtp->Display( $handle, 0 );
    188191echo $code;
     192include('include/page_tail.php');
    189193?>
Note: See TracChangeset for help on using the changeset viewer.