- Timestamp:
- Feb 7, 2004, 12:50:26 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 7 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/about.php
r345 r351 28 28 include('include/page_header.php'); 29 29 30 $ handle = $vtp->Open( './template/'.$user['template'].'/about.vtp');30 $template->set_filenames(array('about'=>'about.tpl')); 31 31 initialize_template(); 32 32 33 $tpl = array('about_title','about_message','about_return'); 34 templatize_array( $tpl, 'lang', $handle ); 35 $vtp->setVar( $handle, 'user_template', $user['template'] ); 33 $template->assign_vars(array( 34 'PAGE_TITLE' => $title, 35 'L_ABOUT' => $lang['about_message'], 36 'L_RETURN' => $lang['about_return'], 37 'U_RETURN' => add_session_id('./category.php?'.$_SERVER['QUERY_STRING']) 38 ) 39 ); 36 40 37 $url = './category.php?'.$_SERVER['QUERY_STRING']; 38 $vtp->setVar( $handle, 'back_url', add_session_id( $url ) ); 39 //----------------------------------------------------------- html code display 40 $code = $vtp->Display( $handle, 0 ); 41 echo $code; 41 $template->pparse('about'); 42 42 include('include/page_tail.php'); 43 43 ?> -
trunk/admin/include/isadmin.inc.php
r345 r351 21 21 22 22 $isadmin = true; 23 include_once( './language/'.$user['language'].' .php' );23 include_once( './language/'.$user['language'].'/lang_admin.php' ); 24 24 25 25 if ( $user['status'] != 'admin' ) -
trunk/category.php
r345 r351 1 1 <?php 2 / ***************************************************************************3 * category.php * 4 * ------------------- * 5 * application : PhpWebGallery 1.3 <http://phpwebgallery.net> * 6 * author : Pierrick LE GALL <pierrick@z0rglub.com> * 7 * * 8 * $Id$ 9 * * 10 ***************************************************************************/ 11 12 / ***************************************************************************13 * * 14 * This program is free software; you can redistribute it and/or modify * 15 * it under the terms of the GNU General Public License as published by * 16 * the Free Software Foundation; * 17 * * 18 ***************************************************************************/ 2 // +-----------------------------------------------------------------------+ 3 // | category.php | 4 // +-----------------------------------------------------------------------+ 5 // | application : PhpWebGallery <http://phpwebgallery.net> | 6 // | branch : 1.4 | 7 // | author : Pierrick LE GALL <pierrick@z0rglub.com> | 8 // +-----------------------------------------------------------------------+ 9 // | file : $RCSfile$ 10 // | last update : $Date$ 11 // | last modifier : $Author$ 12 // | revision : $Revision$ 13 // +-----------------------------------------------------------------------+ 14 // | This program is free software; you can redistribute it and/or modify | 15 // | it under the terms of the GNU General Public License as published by | 16 // | the Free Software Foundation; | 17 // +-----------------------------------------------------------------------+ 18 19 19 //----------------------------------------------------------- include 20 20 $phpwg_root_path = './'; … … 109 109 include('include/page_header.php'); 110 110 111 $ handle = $vtp->Open( './template/'.$user['template'].'/category.vtp');111 $template->set_filenames( array('category'=>'category.tpl') ); 112 112 initialize_template(); 113 $tpl = array( 114 'categories','hint_category','sub-cat','images_available','total', 115 'title_menu','nb_image_category','send_mail','title_send_mail', 116 'connected_user','recent_image','days', 117 'favorite_cat_hint','favorite_cat','stats','most_visited_cat_hint', 118 'most_visited_cat','recent_cat','recent_cat_hint','upload_picture', 119 'comments' ); 120 templatize_array( $tpl, 'lang', $handle ); 121 122 $tpl = array( 'mail_webmaster','webmaster','top_number'); 123 templatize_array( $tpl, 'conf', $handle ); 124 125 $tpl = array( 'short_period','long_period','lien_collapsed', 'username' ); 126 templatize_array( $tpl, 'user', $handle ); 127 128 $tpl = array( 'navigation_bar','cat_comment','cat_nb_images' ); 129 templatize_array( $tpl, 'page', $handle ); 130 131 // special global template vars 132 $vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) ); 133 $icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ); 134 $vtp->setGlobalVar( $handle, 'icon_long', $icon_long ); 135 $nb_total_pictures = count_user_total_images(); 136 $vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures ); 137 138 //------------------------------------------------------------- categories menu 139 $vtp->setVar( $handle, 'home_url', add_session_id( 'category.php' ) ); 140 // normal categories 113 114 //-------------------------------------------------------------- category title 115 $cat_title = $lang['no_category']; 116 if ( isset ( $page['cat'] ) ) 117 { 118 if ( is_numeric( $page['cat'] ) ) 119 { 120 $cat_title = get_cat_display_name( $page['cat_name'], '<br />', 121 'font-style:italic;' ); 122 } 123 else 124 { 125 if ( $page['cat'] == 'search' ) 126 { 127 $page['title'].= ' : <span style="font-style:italic;">'; 128 $page['title'].= $_GET['search']."</span>"; 129 } 130 $page['title'] = replace_space( $page['title'] ); 131 } 132 } 133 134 $template->assign_vars(array( 135 'NB_PICTURE' => count_user_total_images(), 136 'TITLE' => $cat_title, 137 'USERNAME' => $user['username'], 138 139 'S_TOP'=>$conf['top_number'], 140 'S_SHORT_PERIOD'=>$user['short_period'], 141 'S_LONG_PERIOD'=>$user['long_period'], 142 'S_WEBMASTER'=>$conf['webmaster'], 143 'S_MAIL'=>$conf['mail_webmaster'], 144 145 'L_CATEGORIES' => $lang['categories'], 146 'L_HINT_CATEGORY' => $lang['hint_category'], 147 'L_SUBCAT' => $lang['sub-cat'], 148 'L_IMG_AVAILABLE' => $lang['images_available'], 149 'L_TOTAL' => $lang['total'], 150 'L_FAVORITE_HINT' => $lang['favorite_cat_hint'], 151 'L_FAVORITE' => $lang['favorite_cat'], 152 'L_STATS' => $lang['stats'], 153 'L_MOST_VISITED_HINT' => $lang['most_visited_cat_hint'], 154 'L_MOST_VISITED' => $lang['most_visited_cat'], 155 'L_RECENT_HINT' => $lang['recent_cat_hint'], 156 'L_RECENT' => $lang['recent_cat'], 157 'L_SUMMARY' => $lang['title_menu'], 158 'L_UPLOAD' => $lang['upload_picture'], 159 'L_COMMENT' => $lang['comments'], 160 'L_NB_IMG' => $lang['nb_image_category'], 161 'L_USER' => $lang['connected_user'], 162 'L_RECENT_IMAGE' => $lang['recent_image'], 163 'L_DAYS' => $lang['days'], 164 'L_SEND_MAIL' => $lang['send_mail'], 165 'L_TITLE_MAIL' => $lang['title_send_mail'], 166 167 'T_COLLAPSED' => $user['lien_collapsed'], 168 'T_SHORT'=>get_icon( time() ), 169 'T_LONG'=>get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ), 170 171 'U_HOME' => add_session_id( 'category.php' ), 172 'U_FAVORITE' => add_session_id( './category.php?cat=fav&expand='.$page['expand'] ), 173 'U_MOST_VISITED'=>add_session_id( './category.php?cat=most_visited&expand='.$page['expand'] ), 174 'U_RECENT'=>add_session_id( './category.php?cat=recent&expand='.$page['expand'] ) 175 ) 176 ); 177 141 178 foreach ( $page['structure'] as $category ) { 142 179 // display category is a function relative to the template 143 display_category( $category, ' ', $handle ); 144 } 145 // favorites cat 180 display_category( $category, ' '); 181 } 182 183 // favorites management 146 184 if ( !$user['is_the_guest'] ) 147 185 { 148 $vtp->addSession( $handle, 'favorites' );149 $url = './category.php?cat=fav&expand='.$page['expand'];150 $vtp->setVar( $handle, 'favorites.url', add_session_id( $url ) );151 186 // searching the number of favorite picture 152 187 $query = 'SELECT COUNT(*) AS count'; 153 $query.= ' FROM '.FAVORITES_TABLE; 154 $query.= ' WHERE user_id = '.$user['id'].';'; 188 $query.= ' FROM '.FAVORITES_TABLE.' WHERE user_id = '.$user['id'].';'; 155 189 $result = mysql_query( $query ); 156 190 $row = mysql_fetch_array( $result ); 157 $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] ); 158 $vtp->closeSession( $handle, 'favorites' ); 159 } 160 // most visited pictures category 161 $url = './category.php?cat=most_visited&expand='.$page['expand']; 162 $vtp->setGlobalVar( $handle, 'most_visited_url', add_session_id( $url ) ); 163 // recent pictures 164 $url = './category.php?cat=recent&expand='.$page['expand']; 165 $vtp->setGlobalVar( $handle, 'recent_url', add_session_id( $url ) ); 191 $template->assign_block_vars('favorites', array ('NB_FAV'=>$row['count']) ); 192 } 166 193 //--------------------------------------------------------------------- summary 167 $vtp->addSession( $handle, 'summary' ); 168 $vtp->setVar( $handle, 'summary.url', './identification.php' ); 194 $sum_title = ''; 195 $sum_name=''; 196 $sum_url = ''; 169 197 if ( !$user['is_the_guest'] ) 170 198 { 171 $ vtp->setVar( $handle, 'summary.title', '');172 $ vtp->setVar( $handle, 'summary.name',replace_space($lang['change_login']));199 $sum_name=replace_space($lang['logout']); 200 $sum_url = 'category.php?act=logout'; 173 201 } 174 202 else 175 203 { 176 $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] ); 177 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['menu_login'])); 178 } 179 $vtp->closeSession( $handle, 'summary' ); 180 // links for registered users 204 $sum_title = $lang['hint_login']; 205 $sum_name=replace_space( $lang['menu_login']); 206 $sum_url = 'identification.php'; 207 } 208 $template->assign_block_vars('summary', array( 209 'TITLE'=>$sum_title, 210 'NAME'=>$sum_name, 211 'U_SUMMARY'=>add_session_id( $sum_url ), 212 ) 213 ); 214 215 // customization link 181 216 if ( !$user['is_the_guest'] ) 182 217 { 183 // logout link 184 $vtp->addSession( $handle, 'summary' ); 185 $vtp->setVar( $handle, 'summary.url', './category.php?act=logout' ); 186 $vtp->setVar( $handle, 'summary.title', '' ); 187 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) ); 188 $vtp->closeSession( $handle, 'summary' ); 189 // customization link 190 $vtp->addSession( $handle, 'summary' ); 191 $url = './profile.php'; 192 if (isset($page['cat']) && isset($page['expand'])) 193 $url.='?cat='.$page['cat'].'&expand='.$page['expand']; 194 if ( isset($page['cat']) && $page['cat'] == 'search' ) 195 { 196 $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; 197 } 198 $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) ); 199 $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] ); 200 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) ); 201 $vtp->closeSession( $handle, 'summary' ); 202 } 218 $template->assign_block_vars('summary', array( 219 'TITLE'=>$lang['hint_customize'], 220 'NAME'=>$lang['customize'], 221 'U_SUMMARY'=>add_session_id('profile.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] )), 222 )); 223 } 224 203 225 // search link 204 $vtp->addSession( $handle, 'summary' ); 205 $vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) ); 206 $vtp->setVar( $handle, 'summary.title', $lang['hint_search'] ); 207 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) ); 208 $vtp->closeSession( $handle, 'summary' ); 226 $template->assign_block_vars('summary', array( 227 'TITLE'=>$lang['hint_search'], 228 'NAME'=>$lang['search'], 229 'U_SUMMARY'=>add_session_id( 'search.php' ), 230 )); 231 209 232 // comments link 210 $vtp->addSession( $handle, 'summary' ); 211 $vtp->setVar( $handle, 'summary.url', add_session_id( './comments.php' ) ); 212 $vtp->setVar( $handle, 'summary.title', $lang['hint_comments'] ); 213 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['comments'] ) ); 214 $vtp->closeSession( $handle, 'summary' ); 233 $template->assign_block_vars('summary', array( 234 'TITLE'=>$lang['hint_comments'], 235 'NAME'=>$lang['comments'], 236 'U_SUMMARY'=>add_session_id( 'comments.php' ), 237 )); 238 215 239 // about link 216 $ vtp->addSession( $handle, 'summary' );217 $vtp->setVar( $handle, 'summary.url', './about.php?'. 218 str_replace( '&', '&', $_SERVER['QUERY_STRING'] ) ); 219 $vtp->setVar( $handle, 'summary.title', $lang['hint_about'] ); 220 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ));221 $vtp->closeSession( $handle, 'summary' ); 240 $template->assign_block_vars('summary', array( 241 'TITLE'=>$lang['hint_about'], 242 'NAME'=>$lang['about'], 243 'U_SUMMARY'=>add_session_id( 'about.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] ) ) 244 )); 245 222 246 // administration link 223 247 if ( $user['status'] == 'admin' ) 224 248 { 225 $vtp->addSession( $handle, 'summary' ); 226 $vtp->setVar( $handle, 'summary.url', 227 add_session_id( './admin.php' ) ); 228 $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] ); 229 $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) ); 230 $vtp->closeSession( $handle, 'summary' ); 231 } 232 //-------------------------------------------------------------- category title 233 if ( isset ( $page['cat'] ) ) 234 { 235 if ( is_numeric( $page['cat'] ) ) 236 { 237 $cat_title = get_cat_display_name( $page['cat_name'], '<br />', 238 'font-style:italic;' ); 239 $vtp->setGlobalVar( $handle, "cat_title", $cat_title ); 240 } 241 else 242 { 243 if ( $page['cat'] == 'search' ) 244 { 245 $page['title'].= ' : <span style="font-style:italic;">'; 246 $page['title'].= $_GET['search']."</span>"; 247 } 248 $page['title'] = replace_space( $page['title'] ); 249 $vtp->setGlobalVar( $handle, "cat_title", $page['title'] ); 250 } 251 } 252 else 253 { 254 $vtp->setGlobalVar( $handle, "cat_title", 255 replace_space( $lang['no_category'] ) ); 256 } 249 $template->assign_block_vars('summary', array( 250 'TITLE'=>$lang['hint_admin'], 251 'NAME'=>$lang['admin'], 252 'U_SUMMARY'=>add_session_id( 'admin.php' ) 253 )); 254 } 255 257 256 //------------------------------------------------------------------ thumbnails 258 if ( isset( $page['cat'] ) and$page['cat_nb_images'] != 0 )257 if ( isset( $page['cat'] ) && $page['cat_nb_images'] != 0 ) 259 258 { 260 259 $array_cat_directories = array(); … … 270 269 $result = mysql_query( $query ); 271 270 272 $ vtp->addSession( $handle, 'thumbnails');273 $vtp->addSession( $handle, 'line' ); 271 $template->assign_block_vars('thumbnails', array()); 272 274 273 // iteration counter to use a new <tr> every "$nb_image_line" pictures 275 $cell_number = 1;274 $cell_number = 0; 276 275 // iteration counter to be sure not to create too much lines in the table 277 $line_number = 1; 276 $line_number = 0; 277 278 278 while ( $row = mysql_fetch_array( $result ) ) 279 279 { … … 316 316 list( $year,$month,$day ) = explode( '-', $row['date_available'] ); 317 317 $date = mktime( 0, 0, 0, $month, $day, $year ); 318 // sending vars to display 319 $vtp->addSession( $handle, 'thumbnail' ); 320 $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); 321 $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url ); 322 $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] ); 323 $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); 324 $vtp->setVar( $handle, 'thumbnail.name', $name ); 325 $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); 326 327 if ( $conf['show_comments'] and $user['show_nb_comments'] ) 318 319 // sending vars to display 320 if (!$cell_number && ( $line_number< $user['nb_line_page'])) 321 { 322 $template->assign_block_vars('thumbnails.line', array()); 323 $cell_number = 0; 324 $line_number++; 325 } 326 if ( $cell_number++ == $user['nb_image_line'] -1) $cell_number = 0; 327 328 $template->assign_block_vars('thumbnails.line.thumbnail', array( 329 'IMAGE'=>$thumbnail_url, 330 'IMAGE_ALT'=>$row['file'], 331 'IMAGE_TITLE'=>$thumbnail_title, 332 'IMAGE_NAME'=>$name, 333 'IMAGE_TS'=>get_icon( $date ), 334 335 'U_IMG_LINK'=>add_session_id( $url_link ) 336 )); 337 338 if ( $conf['show_comments'] && $user['show_nb_comments'] ) 328 339 { 329 340 $vtp->addSession( $handle, 'nb_comments' ); … … 336 347 $vtp->closeSession( $handle, 'nb_comments' ); 337 348 } 338 339 $vtp->closeSession( $handle, 'thumbnail' ); 340 341 if ( $cell_number++ == $user['nb_image_line'] ) 342 { 343 // creating a new line 344 $vtp->closeSession( $handle, 'line' ); 345 // the number of the next cell is 1 346 $cell_number = 1; 347 // we only create a new line if it does not exceed the maximum line 348 // per page for the logged user 349 if ( $line_number++ < $user['nb_line_page'] ) 350 { 351 $vtp->addSession( $handle, 'line' ); 352 } 353 } 354 } 355 $vtp->closeSession( $handle, 'thumbnails' ); 349 } 356 350 } 357 351 //-------------------------------------------------------------- empty category 358 elseif ( ( isset( $page['cat'] ) 359 and is_numeric( $page['cat'] ) 360 and $page['cat_nb_images'] == 0 361 and $page['plain_structure'][$page['cat']]['nb_sub_categories'] > 0) 362 or (!isset($_GET['cat']))) 363 { 364 $vtp->addSession( $handle, 'thumbnails' ); 365 $vtp->addSession( $handle, 'line' ); 366 352 else 353 { 367 354 $subcats=array(); 368 355 if (isset($page['cat'])) $subcats = get_non_empty_subcat_ids( $page['cat'] ); 369 356 else $subcats = get_non_empty_subcat_ids( '' ); 370 $cell_number = 1;357 $cell_number = 0; 371 358 $i = 0; 372 foreach ( $subcats as $subcat_id => $non_empty_id ) { 359 360 $template->assign_block_vars('thumbnails', array()); 361 362 foreach ( $subcats as $subcat_id => $non_empty_id ) 363 { 373 364 $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"'; 374 365 $name.= ' alt=">"/> '; … … 421 412 422 413 // sending vars to display 423 $vtp->addSession( $handle, 'thumbnail' ); 424 $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); 425 $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_link ); 426 $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] ); 427 $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); 428 $vtp->setVar( $handle, 'thumbnail.name', $name ); 429 $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); 430 $vtp->closeSession( $handle, 'thumbnail' ); 431 432 if ( $cell_number++ == $user['nb_image_line'] ) 433 { 434 $vtp->closeSession( $handle, 'line' ); 435 $cell_number = 1; 436 // we open a new line if the subcat was not the last one 437 if ( $i++ < count( $subcats ) - 1 ) 438 { 439 $vtp->addSession( $handle, 'line' ); 440 } 441 } 442 } 443 if ( $i < count( $subcats ) - 1 ) 444 { 445 $vtp->closeSession( $handle, 'line' ); 446 } 447 $vtp->closeSession( $handle, 'thumbnails' ); 414 if (!$cell_number && $i < count( $subcats )) 415 { 416 $template->assign_block_vars('thumbnails.line', array()); 417 $cell_number = 0; 418 $i++; 419 } 420 if ( $cell_number++ == $user['nb_image_line'] -1) $cell_number = 0; 421 422 $template->assign_block_vars('thumbnails.line.thumbnail', array( 423 'IMAGE'=>$thumbnail_link, 424 'IMAGE_ALT'=>$image_row['file'], 425 'IMAGE_TITLE'=>$thumbnail_title, 426 'IMAGE_NAME'=>$name, 427 'IMAGE_TS'=>get_icon( $date ), 428 429 'U_IMG_LINK'=>add_session_id( $url_link ) 430 )); 431 } 448 432 } 449 433 //------------------------------------------------------- category informations 450 434 if ( isset ( $page['cat'] ) ) 451 435 { 452 $vtp->addSession( $handle, 'cat_infos' ); 453 // navigation bar 454 if ( $page['navigation_bar'] != '' ) 455 { 456 $vtp->addSession( $handle, 'navigation' ); 457 $vtp->closeSession( $handle, 'navigation' ); 458 } 459 // category comment 460 if ( isset( $page['comment'] ) and $page['comment'] != '' ) 461 { 462 $vtp->addSession( $handle, 'comment' ); 463 $vtp->setVar( $handle, 'comment.cat_comment', $page['comment'] ); 464 $vtp->closeSession( $handle, 'comment' ); 465 } 436 $cat_name=''; 466 437 // total number of pictures in the category 467 438 if ( is_numeric( $page['cat'] ) ) 468 439 { 469 $vtp->setVar( $handle, 'cat_infos.cat_name', 470 get_cat_display_name( $page['cat_name'], ' - ', 471 'font-style:italic;' ) ); 440 $cat_name=get_cat_display_name( $page['cat_name'],' - ','font-style:italic;' ); 472 441 // upload a picture in the category 473 442 if ( $page['cat_site_id'] == 1 … … 475 444 and $page['cat_uploadable'] ) 476 445 { 477 $vtp->addSession( $handle, 'upload' );478 446 $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; 479 $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) ); 480 $vtp->closeSession( $handle, 'upload' ); 447 $template->assign_block_vars('upload',array('U_UPLOAD'=>add_session_id( $url ))); 481 448 } 482 449 } 483 450 else 484 451 { 485 $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] ); 486 } 487 488 $vtp->closeSession( $handle, 'cat_infos' ); 452 $cat_name= $page['title']; 453 } 454 $template->assign_block_vars('cat_infos',array( 455 'CAT_NAME'=>$cat_name, 456 'NB_IMG_CAT' => $page['cat_nb_images'] 457 )); 458 459 // navigation bar 460 if ( $page['navigation_bar'] != '' ) 461 { 462 $template->assign_block_vars('cat_infos.navigation',array('NAV_BAR' => $page['navigation_bar'])); 463 } 464 // category comment 465 if ( isset( $page['comment'] ) and $page['comment'] != '' ) 466 { 467 $template->assign_block_vars('cat_infos.navigation',array('COMMENTS' => $page['cat_comment'])); 468 } 489 469 } 490 470 //------------------------------------------------------------ log informations 491 471 pwg_log( 'category', $page['title'] ); 492 472 mysql_close(); 493 //----------------------------------------------------------- html code display 494 $code = $vtp->Display( $handle, 0 ); 495 echo $code; 496 473 474 $template->pparse('category'); 497 475 include('include/page_tail.php'); 498 476 ?> -
trunk/common.php
r345 r351 31 31 if( !get_magic_quotes_gpc() ) 32 32 { 33 if( is_array($HTTP_GET_VARS) ) 33 if( is_array($HTTP_GET_VARS) ) 34 { 35 while( list($k, $v) = each($HTTP_GET_VARS) ) 36 { 37 if( is_array($HTTP_GET_VARS[$k]) ) 38 { 39 while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) 40 { 41 $HTTP_GET_VARS[$k][$k2] = addslashes($v2); 42 } 43 @reset($HTTP_GET_VARS[$k]); 44 } 45 else 46 { 47 $HTTP_GET_VARS[$k] = addslashes($v); 48 } 49 } 50 @reset($HTTP_GET_VARS); 51 } 52 53 if( is_array($HTTP_POST_VARS) ) 54 { 55 while( list($k, $v) = each($HTTP_POST_VARS) ) 34 56 { 35 while( list($k, $v) = each($HTTP_GET_VARS) ) 57 if( is_array($HTTP_POST_VARS[$k]) ) 58 { 59 while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) 36 60 { 37 if( is_array($HTTP_GET_VARS[$k]) ) 38 { 39 while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) 40 { 41 $HTTP_GET_VARS[$k][$k2] = addslashes($v2); 42 } 43 @reset($HTTP_GET_VARS[$k]); 44 } 45 else 46 { 47 $HTTP_GET_VARS[$k] = addslashes($v); 48 } 61 $HTTP_POST_VARS[$k][$k2] = addslashes($v2); 49 62 } 50 @reset($HTTP_GET_VARS); 51 } 52 53 if( is_array($HTTP_POST_VARS) ) 54 { 55 while( list($k, $v) = each($HTTP_POST_VARS) ) 56 { 57 if( is_array($HTTP_POST_VARS[$k]) ) 58 { 59 while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) 60 { 61 $HTTP_POST_VARS[$k][$k2] = addslashes($v2); 62 } 63 @reset($HTTP_POST_VARS[$k]); 64 } 65 else 66 { 67 $HTTP_POST_VARS[$k] = addslashes($v); 68 } 69 } 70 @reset($HTTP_POST_VARS); 71 } 72 73 if( is_array($HTTP_COOKIE_VARS) ) 74 { 75 while( list($k, $v) = each($HTTP_COOKIE_VARS) ) 76 { 77 if( is_array($HTTP_COOKIE_VARS[$k]) ) 78 { 79 while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) 80 { 81 $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); 82 } 83 @reset($HTTP_COOKIE_VARS[$k]); 84 } 85 else 86 { 87 $HTTP_COOKIE_VARS[$k] = addslashes($v); 88 } 89 } 90 @reset($HTTP_COOKIE_VARS); 91 } 63 @reset($HTTP_POST_VARS[$k]); 64 } 65 else 66 { 67 $HTTP_POST_VARS[$k] = addslashes($v); 68 } 69 } 70 @reset($HTTP_POST_VARS); 71 } 72 73 if( is_array($HTTP_COOKIE_VARS) ) 74 { 75 while( list($k, $v) = each($HTTP_COOKIE_VARS) ) 76 { 77 if( is_array($HTTP_COOKIE_VARS[$k]) ) 78 { 79 while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) 80 { 81 $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); 82 } 83 @reset($HTTP_COOKIE_VARS[$k]); 84 } 85 else 86 { 87 $HTTP_COOKIE_VARS[$k] = addslashes($v); 88 } 89 } 90 @reset($HTTP_COOKIE_VARS); 91 } 92 92 } 93 93 … … 112 112 include($phpwg_root_path . 'include/constants.php'); 113 113 include($phpwg_root_path . 'include/functions.inc.php'); 114 include($phpwg_root_path . 'include/template.php'); 114 115 include($phpwg_root_path . 'include/vtemplate.class.php'); 115 116 include($phpwg_root_path . 'include/config.inc.php'); … … 129 130 if( getenv('HTTP_X_FORWARDED_FOR') != '' ) 130 131 { 131 132 133 134 135 136 137 132 $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); 133 134 if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip_list) ) 135 { 136 $private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10.\.*/', '/^224.\.*/', '/^240.\.*/'); 137 $client_ip = preg_replace($private_ip, $client_ip, $ip_list[1]); 138 } 138 139 } 139 140 else 140 141 { 141 142 } 143 //$user_ip = encode_ip($client_ip);142 $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR ); 143 } 144 $user_ip = encode_ip($client_ip); 144 145 145 146 // … … 151 152 if( !($result = mysql_query($sql)) ) 152 153 { 153 154 die("Could not query config information"); 154 155 } 155 156 … … 192 193 include($phpwg_root_path . 'include/user.inc.php'); 193 194 194 // calculation of the number of picture to display per page195 $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];196 197 $isadmin = false;198 if ($user['status'] == 'admin') $isadmin =true;199 include_once( './language/'.$user['language'].'.php' );200 195 // displaying the username in the language of the connected user, instead of 201 196 // "guest" as you can find in the database -
trunk/include/config.inc.php
r345 r351 46 46 $conf['max_LOV_categories'] = 50; 47 47 48 $conf['default_lang'] = 'francais'; 49 $conf['default_style'] = 'default'; 50 48 51 ?> -
trunk/include/functions.inc.php
r345 r351 258 258 while ( $file = readdir ( $opendir ) ) 259 259 { 260 if ( is_file ( $rep_language.$file ) 261 and $file != "index.php" 262 and strrchr ( $file, "." ) == ".php" ) 260 if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') ) 263 261 { 264 $languages[$i++] = 265 substr ( $file, 0, strlen ( $file ) 266 - strlen ( strrchr ( $file, "." ) ) ); 262 $languages[$i++] =$file; 267 263 } 268 264 } … … 455 451 $debug.= "\n"; 456 452 } 453 454 // 455 // Initialise user settings on page load 456 function init_userprefs($userdata) 457 { 458 global $conf, $template, $lang, $phpwg_root_path; 459 460 $style = $conf['default_style']; 461 if ( !$userdata['is_the_guest'] ) 462 { 463 if ( !empty($userdata['language'])) 464 { 465 $conf['default_lang'] = $userdata['language']; 466 } 467 if ( !empty($userdata['template'])) 468 { 469 $style = $userdata['template']; 470 } 471 } 472 473 if ( !file_exists(@realpath($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php')) ) 474 { 475 $conf['default_lang'] = 'english'; 476 } 477 478 include_once($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php'); 479 $template= setup_style($style); 480 481 return; 482 } 483 484 function setup_style($style) 485 { 486 global $phpwg_root_path; 487 488 $template_path = 'template/' ; 489 $template_name = $style ; 490 491 $template = new Template($phpwg_root_path . $template_path . $template_name); 492 return $template; 493 } 494 495 function encode_ip($dotquad_ip) 496 { 497 $ip_sep = explode('.', $dotquad_ip); 498 return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); 499 } 500 501 function decode_ip($int_ip) 502 { 503 $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); 504 return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); 505 } 506 457 507 ?> -
trunk/include/page_header.php
r345 r351 1 1 <?php 2 /*************************************************************************** 3 * page_header.php * 4 * ------------------ * 5 * application : PhpWebGallery 1.4 <http://phpwebgallery.net> * 6 * author : Pierrick LE GALL <pierrick@z0rglub.com> * 7 * * 8 * $Id$ 9 * * 10 ***************************************************************************/ 2 11 12 /*************************************************************************** 13 * * 14 * This program is free software; you can redistribute it and/or modify * 15 * it under the terms of the GNU General Public License as published by * 16 * the Free Software Foundation; * 17 * * 18 ***************************************************************************/ 19 3 20 // 4 21 // Start output of page 5 22 // 6 $vtp = new VTemplate; 7 $handle = $vtp->Open( './template/'.$user['template'].'/header.vtp' ); 8 $vtp->setGlobalVar( $handle, 'charset', $lang['charset'] ); 9 $vtp->setGlobalVar( $handle, 'style', './template/'.$user['template'].'/'.$user['template'].'.css'); 23 $template->set_filenames(array('header'=>'header.tpl')); 10 24 11 // refresh 12 if ( isset( $refresh ) && $refresh >0 && isset($url_link)) 25 $template->assign_vars(array( 26 'S_CONTENT_ENCODING' => $lang['charset'], 27 'T_STYLE' => './template/'.$user['template'].'/'.$user['template'].'.css', 28 'PAGE_TITLE' => $title) 29 ); 30 31 // refresh 32 if ( isset( $refresh ) && $refresh >0 && isset($url_link)) 13 33 { 14 $vtp->addSession( $handle, 'refresh' );15 $vtp->setVar( $handle, 'refresh.time', $refresh );16 34 $url = $url_link.'&slideshow='.$refresh; 17 $vtp->setVar( $handle, 'refresh.url', add_session_id( $url ) ); 18 $vtp->closeSession( $handle, 'refresh' ); 35 $template->assign_vars(array( 36 'S_REFRESH_TIME' => $refresh, 37 'U_REFRESH' => add_session_id( $url ) 38 ) 39 ); 40 $template->assign_block_vars('refresh', array()); 19 41 } 20 21 $vtp->setGlobalVar( $handle, 'title', $title );22 $vtp->setVarF( $handle, 'header', './template/'.$user['template'].'/header.htm' );23 42 24 // 25 // Generate the page 26 // 43 // Work around for "current" Apache 2 + PHP module which seems to not 44 // cope with private cache control setting 45 if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2')) 46 { 47 header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0'); 48 } 49 else 50 { 51 header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); 52 } 53 header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); 54 header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 27 55 28 $ code = $vtp->Display( $handle, 0);29 echo $code;56 $template->pparse('header'); 57 $vtp=new VTemplate; 30 58 ?> -
trunk/include/page_tail.php
r345 r351 1 1 <?php 2 $ handle = $vtp->Open( './template/'.$user['template'].'/footer.vtp');2 $template->set_filenames(array('tail'=>'footer.tpl')); 3 3 4 4 //------------------------------------------------------------- generation time 5 5 6 $time = get_elapsed_time( $t2, get_moment() ); 6 $vtp->setGlobalVar( $handle, 'time', $time );7 7 8 $vtp->setGlobalVar( $handle, 'generation_time', $lang['generation_time'] ); 9 $vtp->setGlobalVar( $handle, 'version', $conf['version'] ); 10 $vtp->setGlobalVar( $handle, 'site_url', $conf['site_url'] ); 11 $vtp->setVarF( $handle, 'footer', './template/'.$user['template'].'/footer.htm' ); 8 $template->assign_vars(array( 9 'L_GEN_TIME' => $lang['generation_time'], 10 'S_TIME' => $time, 11 'S_VERSION' => $conf['version'], 12 'U_SITE' => add_session_id( $conf['site_url'] ) 13 ) 14 ); 15 16 if (DEBUG) 17 { 18 $template->assign_block_vars('debug', array()); 19 } 12 20 13 21 // … … 15 23 // 16 24 17 $code = $vtp->Display( $handle, 0 ); 18 echo $code; 25 $template->pparse('tail'); 19 26 ?> -
trunk/include/user.inc.php
r345 r351 117 117 $user['restrictions'] = explode( ',', $user['forbidden_categories'] ); 118 118 if ( $user['restrictions'][0] == '' ) $user['restrictions'] = array(); 119 $isadmin = false; 120 if ($user['status'] == 'admin') $isadmin =true; 121 // calculation of the number of picture to display per page 122 $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; 123 124 init_userprefs($user); 119 125 ?> -
trunk/profile.php
r345 r351 1 1 <?php 2 /*************************************************************************** 3 * profile.php * 4 * ------------------- * 5 * application : PhpWebGallery 1.3 <http://phpwebgallery.net> * 6 * author : Pierrick LE GALL <pierrick@z0rglub.com> * 7 * * 8 * $Id$ 9 * * 10 ***************************************************************************/ 2 // +-----------------------------------------------------------------------+ 3 // | profile.php | 4 // +-----------------------------------------------------------------------+ 5 // | application : PhpWebGallery <http://phpwebgallery.net> | 6 // | branch : 1.4 | 7 // | author : Pierrick LE GALL <pierrick@z0rglub.com> | 8 // +-----------------------------------------------------------------------+ 9 // | file : $RCSfile$ 10 // | last update : $Date$ 11 // | last modifier : $Author$ 12 // | revision : $Revision$ 13 // +-----------------------------------------------------------------------+ 14 // | This program is free software; you can redistribute it and/or modify | 15 // | it under the terms of the GNU General Public License as published by | 16 // | the Free Software Foundation; | 17 // +-----------------------------------------------------------------------+ 11 18 12 /***************************************************************************13 * *14 * This program is free software; you can redistribute it and/or modify *15 * it under the terms of the GNU General Public License as published by *16 * the Free Software Foundation; *17 * *18 ***************************************************************************/19 19 // customize appearance of the site for a user 20 20 //----------------------------------------------------------- include -
trunk/template/default/htmlfunctions.inc.php
r345 r351 18 18 ***************************************************************************/ 19 19 20 //include( PREFIX_INCLUDE.'./template/'.$user['template'].'/theme/conf.php' );21 20 $user['lien_expanded']='./template/'.$user['template'].'/theme/expanded.gif'; 22 21 $user['lien_collapsed']='./template/'.$user['template'].'/theme/collapsed.gif'; 23 //include_once( PREFIX_INCLUDE.'./template/'.$user['template'].'/style.inc.php');24 22 25 23 function get_icon( $date_comparaison ) … … 105 103 return '<table style="width:'; 106 104 } 107 /*108 function get_frame_begin()109 {110 return ';">111 <tr>112 <td style="border:1px dashed gray;width:100%;padding:5px;background-color:white;">';113 }114 115 function get_frame_end()116 {117 return '118 </td>119 </tr>120 </table>';121 }122 */123 105 124 106 function get_frame_begin() … … 159 141 function initialize_template() 160 142 { 161 global $vtp, $handle, $user, $lang; 162 163 // $vtp->setGlobalVar( $handle, 'charset', $lang['charset'] ); 164 //$vtp->setGlobalVar( $handle, 'style', $user['style'] ); 143 global $template, $user, $lang; 144 145 $template->assign_vars(array( 146 'F_START' => get_frame_start(), 147 'F_BEGIN' => get_frame_begin(), 148 'F_END' => get_frame_end() 149 ) 150 ); 151 152 153 global $vtp, $handle; 154 if (isset($handle)) 155 { 165 156 $vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() ); 166 157 $vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() ); 167 158 $vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() ); 168 //$vtp->setVarF( $handle, 'header', 169 // './template/'.$user['template'].'/header.htm' ); 170 //$vtp->setVarF( $handle, 'footer', 171 // './template/'.$user['template'].'/footer.htm' ); 172 } 173 174 function display_category( $category, $indent, $handle ) 175 { 176 global $user,$lang,$vtp; 177 178 $vtp->addSession( $handle, 'category' ); 179 $vtp->setVar( $handle, 'category.indent', $indent ); 159 } 160 } 161 162 function display_category( $category, $indent ) 163 { 164 global $user,$lang,$template, $vtp, $handle; 165 166 $style=''; 167 $url = './category.php?cat='.$category['id']; 168 $url.= '&expand='.$category['expand_string']; 169 $name = $category['name']; 170 if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] ); 171 if ( $category['id_uppercat'] == '' ) 172 { 173 $style = 'font-weight:bold;'; 174 } 175 176 $template->assign_block_vars('category', array( 177 'LINK_NAME' => $name, 178 'INDENT' => $indent, 179 'NB_SUBCATS'=>$category['nb_sub_categories'], 180 'TOTAL_CAT'=>$category['nb_images'], 181 'CAT_ICON'=>get_icon($category['date_last']), 182 183 'T_NAME'=>$style, 184 'U_LINK' => add_session_id($url))); 185 180 186 if ( $user['expand'] or $category['nb_sub_categories'] == 0 ) 181 187 { 182 $vtp->addSession( $handle, 'bullet_wo_link' ); 183 $vtp->setVar( $handle, 'bullet_wo_link.bullet_url', 184 $user['lien_collapsed'] ); 185 $vtp->closeSession( $handle, 'bullet_wo_link' ); 188 $template->assign_block_vars('category.bulletnolink', array('BULLET_IMAGE' => $user['lien_collapsed'])); 186 189 } 187 190 else 188 191 { 189 $vtp->addSession( $handle, 'bullet_w_link' ); 190 $url = './category.php'; 191 if (isset($page['cat'])) 192 $url = './category.php'; 193 if (isset($page['cat'])) 192 194 { 193 $url .='?cat='.$page['cat'];194 $url.= '&expand='.$category['expand_string'];195 $url .='?cat='.$page['cat']; 196 $url.= '&expand='.$category['expand_string']; 195 197 } 196 198 else if ($category['expand_string']<>'') 197 199 { 198 200 $url.= '?expand='.$category['expand_string']; 199 201 } 200 $vtp->setVar( $handle, 'bullet_w_link.bullet_link', add_session_id($url) ); 201 if ( $category['expanded'] ) 202 { 203 $vtp->setVar( $handle, 'bullet_w_link.bullet_url', 204 $user['lien_expanded'] ); 202 203 if ( $category['expanded'] ) 204 { 205 $img=$user['lien_expanded']; 205 206 } 206 207 else 207 208 { 208 $vtp->setVar( $handle, 'bullet_w_link.bullet_url', 209 $user['lien_collapsed'] ); 210 } 211 $vtp->closeSession( $handle, 'bullet_w_link' ); 212 } 213 214 $url = './category.php?cat='.$category['id']; 215 $url.= '&expand='.$category['expand_string']; 216 $vtp->setVar( $handle, 'category.link_url', add_session_id( $url ) ); 217 218 $name = $category['name']; 219 if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] ); 220 $vtp->setVar( $handle, 'category.link_name', $name ); 221 222 if ( $category['id_uppercat'] == '' ) 223 { 224 $vtp->setVar( $handle, 'category.name_style', 'font-weight:bold;' ); 225 } 226 if ( $category['nb_sub_categories'] > 0 ) 227 { 228 $vtp->addSession( $handle, 'subcat' ); 229 $vtp->setVar( $handle,'subcat.nb_subcats',$category['nb_sub_categories'] ); 230 $vtp->closeSession( $handle, 'subcat' ); 231 } 232 $vtp->setVar( $handle, 'category.total_cat', $category['nb_images'] ); 233 $vtp->setVar( $handle, 'category.cat_icon',get_icon($category['date_last'])); 234 $vtp->closeSession( $handle, 'category' ); 209 $img=$user['lien_collapsed']; 210 } 211 212 $template->assign_block_vars('category.bulletlink', array( 213 'BULLET_IMAGE' => $img, 214 'U_BULLET_LINK'=> add_session_id($url) 215 )); 216 } 235 217 236 218 // recursive call … … 238 220 { 239 221 foreach ( $category['subcats'] as $subcat ) { 240 display_category( $subcat, $indent.str_repeat( ' ', 2 ), $handle ); 222 $template->assign_block_vars('category.subcat', array()); 223 display_category( $subcat, $indent.str_repeat( ' ', 2 )); 241 224 } 242 225 }
Note: See TracChangeset
for help on using the changeset viewer.