Changeset 345 for trunk/comments.php
- Timestamp:
- Feb 2, 2004, 1:55:18 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/comments.php
r231 r345 18 18 ***************************************************************************/ 19 19 20 include_once( './include/init.inc.php' ); 20 //----------------------------------------------------------- include 21 $phpwg_root_path = './'; 22 include_once( $phpwg_root_path.'common.php' ); 23 21 24 //------------------------------------------------------------------- functions 22 25 function display_pictures( $mysql_result, $maxtime, $forbidden_cat_ids ) … … 47 50 $category_id = $subrow['category_id']; 48 51 49 if ( $array_cat_directories[$category_id] == '')52 if ( !isset($array_cat_directories[$category_id])) 50 53 { 51 54 $array_cat_directories[$category_id] = … … 134 137 } 135 138 //----------------------------------------------------- template initialization 136 $vtp = new VTemplate; 139 // 140 // Start output of page 141 // 142 $title= $lang['title_comments']; 143 include('include/page_header.php'); 144 137 145 $handle = $vtp->Open( './template/'.$user['template'].'/comments.vtp' ); 138 146 initialize_template(); 139 147 $tpl = array( 'title_comments','stats_last_days','search_return_main_page' ); 140 148 templatize_array( $tpl, 'lang', $handle ); 141 $vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] );142 149 //--------------------------------------------------- number of days to display 143 if ( isset( $_GET['last_days'] ) ) define( "MAX_DAYS", $_GET['last_days'] );144 else define( "MAX_DAYS", 0 );150 if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] ); 151 else define( 'MAX_DAYS', 0 ); 145 152 //----------------------------------------- non specific section initialization 146 153 $array_cat_directories = array(); … … 169 176 $query.= ' WHERE c.image_id = ic.image_id'; 170 177 $query.= ' AND date > '.$maxtime; 178 $query.= " AND validated = 'true'"; 171 179 // 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 ) 180 if ( $user['forbidden_categories'] != '' ) 174 181 { 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'].')'; 181 184 } 182 185 $query.= ' ORDER BY ic.image_id DESC'; 183 186 $query.= ';'; 184 187 $result = mysql_query( $query ); 185 display_pictures( $result, $maxtime, $ restricted_cats);188 display_pictures( $result, $maxtime, $user['restrictions'] ); 186 189 //----------------------------------------------------------- html code display 187 190 $code = $vtp->Display( $handle, 0 ); 188 191 echo $code; 192 include('include/page_tail.php'); 189 193 ?>
Note: See TracChangeset
for help on using the changeset viewer.