Changeset 393 for trunk/picture.php
- Timestamp:
- Mar 20, 2004, 1:52:37 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r375 r393 48 48 { 49 49 echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />'; 50 echo '<a href="'.add_session_id( './category.php' ).'">';50 echo '<a href="'.add_session_id( PHPWG_ROOT_PATH.'category.php' ).'">'; 51 51 echo $lang['thumbnails'].'</a></div>'; 52 52 exit(); … … 131 131 $picture[$j]['url'] = PHPWG_ROOT_PATH.'picture.php?image_id='.$row['id']; 132 132 $picture[$j]['url'].= '&cat='.$page['cat']; 133 if ( isset( $_GET['expand'] ) )134 $picture[$j]['url'].= '&expand='.$_GET['expand'];135 133 if ( $page['cat'] == 'search' ) 136 134 { … … 139 137 } 140 138 141 $url_home = './category.php?cat='.$page['cat'].'&';139 $url_home = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&'; 142 140 $url_home.= 'num='.$page['num']; 143 if (isset($_GET['expand']))144 $url_home.='&expand='.$_GET['expand'];145 141 if ( $page['cat'] == 'search' ) 146 142 { … … 191 187 } 192 188 193 // 194 // Start output of page 195 // 196 197 $title = $picture['current']['name']; 198 $refresh = 0; 199 if ( isset( $_GET['slideshow'] ) && $next) 200 { 201 $refresh= $_GET['slideshow']; 202 $url_link = $picture['next']['url']; 203 } 204 205 $title_img = $picture['current']['name']; 206 $title_nb = ''; 207 if (is_numeric( $page['cat'] )) 208 { 209 $title_img = replace_space(get_cat_display_name( $page['cat_name'], " > ","font-style:italic;" )); 210 $n = $page['num'] + 1; 211 $title_nb = "Photo".' '.$n.'/'; 212 $title_nb.= $page['cat_nb_images']; 213 //$title_img.= $picture['current']['name']; 214 } 215 else if ( $page['cat'] == 'search' ) 216 { 217 $title_img = replace_search( $title_img, $_GET['search'] ); 218 } 219 220 // calculation of width and height 221 if ( empty($picture['current']['width'])) 222 { 223 $taille_image = @getimagesize( $lien_image ); 224 $original_width = $taille_image[0]; 225 $original_height = $taille_image[1]; 226 } 227 else 228 { 229 $original_width = $picture['current']['width']; 230 $original_height = $picture['current']['height']; 231 } 232 233 $picture_size = get_picture_size( $original_width, $original_height, 234 $user['maxwidth'], $user['maxheight'] ); 235 236 include(PHPWG_ROOT_PATH.'include/page_header.php'); 237 $template->set_filenames(array('picture'=>'picture.tpl')); 238 initialize_template(); 239 240 $template->assign_vars(array( 241 'CATEGORY' => $title_img, 242 'PHOTO' => $title_nb, 243 'TITLE' => $picture['current']['name'], 244 'PREV_TITLE_IMG' => $picture['prev']['name'], 245 'NEXT_TITLE_IMG' => $picture['next']['name'], 246 'PREV_IMG' => $picture['prev']['thumbnail'], 247 'NEXT_IMG' => $picture['next']['thumbnail'], 248 'SRC_IMG' => $picture['current']['src'], 249 'ALT_IMG' => $picture['current']['file'], 250 'WIDTH_IMG' => $picture_size[0], 251 'HEIGHT_IMG' => $picture_size[1], 252 'COMMENT_IMG' => $picture['current']['comment'], 253 254 'L_SLIDESHOW' => $lang['slideshow'], 255 'L_TIME' => $lang['period_seconds'], 256 'L_STOP_SLIDESHOW' => $lang['slideshow_stop'], 257 'L_PREV_IMG' =>$lang['previous_image'].' : ', 258 'L_ADMIN' =>$lang['link_info_image'], 259 'L_BACK' =>$lang['back'], 260 'L_COMMENT_TITLE' =>$lang['comments_title'], 261 'L_ADD_COMMENT' =>$lang['comments_add'], 262 'L_DELETE_COMMENT' =>$lang['comments_del'], 263 'L_DELETE' =>$lang['delete'], 264 'L_SUBMIT' =>$lang['submit'], 265 'L_AUTHOR' =>$lang['author'], 266 267 'T_DEL_IMG' =>'./template/'.$user['template'].'/theme/delete.gif', 268 269 'U_PREV_IMG' => add_session_id($picture['prev']['url']), 270 'U_NEXT_IMG' => add_session_id($picture['next']['url']), 271 'U_HOME' => add_session_id($url_home), 272 'U_ADMIN' => add_session_id($url_admin), 273 'U_ADD_COMMENT' => add_session_id(str_replace( '&', '&', $_SERVER['REQUEST_URI'] )) 274 ) 275 ); 276 277 //-------------------------------------------------------- slideshow management 278 if ( isset( $_GET['slideshow'] ) ) 279 { 280 if ( !is_numeric( $_GET['slideshow'] ) ) $_GET['slideshow'] = $conf['slideshow_period'][0]; 281 282 $template->assign_block_vars('stop_slideshow', array( 283 'U_SLIDESHOW'=>add_session_id( $picture['current']['url'] ) 284 )); 285 } 286 else 287 { 288 $template->assign_block_vars('start_slideshow', array()); 289 foreach ( $conf['slideshow_period'] as $option ) 290 { 291 $template->assign_block_vars('start_slideshow.second', array( 292 'SLIDESHOW_SPEED'=>$option, 293 'U_SLIDESHOW'=>add_session_id( $picture['current']['url'].'&slideshow='.$option) 294 )); 295 } 296 } 297 298 if ($prev>=0) $template->assign_block_vars('previous', array()); 299 if ($next) $template->assign_block_vars('next', array()); 300 301 //--------------------------------------------------------- picture information 302 // author 303 if ( !empty($picture['current']['author']) ) 304 { 305 $template->assign_block_vars('info_line', array( 306 'INFO'=>$lang['author'], 307 'VALUE'=>$picture['current']['author'] 308 )); 309 } 310 // creation date 311 if ( !empty($picture['current']['date_creation']) ) 312 { 313 $template->assign_block_vars('info_line', array( 314 'INFO'=>$lang['creation_date'], 315 'VALUE'=>format_date( $picture['current']['date_creation'] ) 316 )); 317 } 318 // date of availability 319 $template->assign_block_vars('info_line', array( 320 'INFO'=>$lang['registration_date'], 321 'VALUE'=>format_date( $picture['current']['date_available'] ) 322 )); 323 // size in pixels 324 if ( $original_width != $picture_size[0] or $original_height != $picture_size[1] ) 325 { 326 $content = '[ <a href="'.$picture['current']['url'].'" title="'.$lang['true_size'].'">'; 327 $content.= $original_width.'*'.$original_height.'</a> ]'; 328 } 329 else 330 { 331 $content = $original_width.'*'.$original_height; 332 } 333 $template->assign_block_vars('info_line', array( 334 'INFO'=>$lang['size'], 335 'VALUE'=>$content 336 )); 337 // file 338 $template->assign_block_vars('info_line', array( 339 'INFO'=>$lang['file'], 340 'VALUE'=>$picture['current']['file'] 341 )); 342 // filesize 343 if ( empty($picture['current']['filesize'])) 344 { 345 $poids = floor ( filesize( $picture['current']['url'] ) / 1024 ); 346 } 347 else 348 { 349 $poids = $picture['current']['filesize']; 350 } 351 352 $template->assign_block_vars('info_line', array( 353 'INFO'=>$lang['filesize'], 354 'VALUE'=>$poids.' KB' 355 )); 356 // keywords 357 if ( !empty($picture['current']['keywords'])) 358 { 359 $keywords = explode( ',', $picture['current']['keywords'] ); 360 $content = ''; 361 $url = './category.php?cat=search'; 362 if ( isset( $_GET['expand'] ) ) $url.= '&expand='.$_GET['expand']; 363 $url.= '&mode=OR&search='; 364 foreach ( $keywords as $i => $keyword ) { 365 $local_url = add_session_id( $url.$keyword ); 366 if ( $i > 0 ) $content.= ','; 367 $content.= '<a href="'.$local_url.'">'.$keyword.'</a>'; 368 } 369 $template->assign_block_vars('info_line', array( 370 'INFO'=>$lang['keywords'], 371 'VALUE'=>$content 372 )); 373 } 374 // number of visits 375 $template->assign_block_vars('info_line', array( 376 'INFO'=>$lang['visited'], 377 'VALUE'=>$picture['current']['hit'].' '.$lang['times'] 378 )); 379 380 //------------------------------------------------------- favorite manipulation 381 if ( !$user['is_the_guest'] ) 382 { 383 // verify if the picture is already in the favorite of the user 384 $query = 'SELECT COUNT(*) AS nb_fav'; 385 $query.= ' FROM '.FAVORITES_TABLE.' WHERE image_id = '.$_GET['image_id']; 386 $query.= ' AND user_id = '.$user['id'].';'; 387 $result = mysql_query( $query ); 388 $row = mysql_fetch_array( $result ); 389 if (!$row['nb_fav']) 390 { 391 $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 392 if (isset($_GET['expand'])) 393 $url.= '&expand='.$_GET['expand']; 394 $url.='&add_fav=1'; 395 if ( $page['cat'] == 'search' ) 396 { 397 $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; 398 } 399 $template->assign_block_vars('favorite', array( 400 'FAVORITE_IMG' => './template/'.$user['template'].'/theme/favorite.gif', 401 'FAVORITE_HINT' =>$lang['add_favorites_hint'], 402 'FAVORITE_ALT' =>'[ '.$lang['add_favorites_alt'].' ]', 403 'U_FAVORITE'=> add_session_id( $url ) 404 )); 405 } 406 else 407 { 408 $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 409 $url.= '&expand='.$_GET['expand'].'&add_fav=0'; 410 $template->assign_block_vars('favorite', array( 411 'FAVORITE_IMG' => './template/'.$user['template'].'/theme/del_favorite.gif', 412 'FAVORITE_HINT' =>$lang['del_favorites_hint'], 413 'FAVORITE_ALT' =>'[ '.$lang['del_favorites_alt'].' ]', 414 'U_FAVORITE'=> add_session_id( $url ) 415 )); 416 } 417 } 418 //------------------------------------ admin link for information modifications 419 if ( $user['status'] == 'admin' ) 420 { 421 $template->assign_block_vars('modification', array()); 422 } 423 424 //---------------------------------------------------- users's comments display 425 if ( $conf['show_comments'] ) 426 { 427 // comment registeration 189 //--------------------------------------------------------- comment registeration 428 190 if ( isset( $_POST['content'] ) && !empty($_POST['content']) ) 429 191 { … … 498 260 mysql_query( $query ); 499 261 } 262 263 // 264 // Start output of page 265 // 266 267 $title = $picture['current']['name']; 268 $refresh = 0; 269 if ( isset( $_GET['slideshow'] ) && $next) 270 { 271 $refresh= $_GET['slideshow']; 272 $url_link = $picture['next']['url']; 273 } 274 275 $title_img = $picture['current']['name']; 276 $title_nb = ''; 277 if (is_numeric( $page['cat'] )) 278 { 279 $title_img = replace_space(get_cat_display_name( $page['cat_name'], " > ","font-style:italic;" )); 280 $n = $page['num'] + 1; 281 $title_nb = "Photo".' '.$n.'/'; 282 $title_nb.= $page['cat_nb_images']; 283 //$title_img.= $picture['current']['name']; 284 } 285 else if ( $page['cat'] == 'search' ) 286 { 287 $title_img = replace_search( $title_img, $_GET['search'] ); 288 } 289 290 // calculation of width and height 291 if ( empty($picture['current']['width'])) 292 { 293 $taille_image = @getimagesize( $lien_image ); 294 $original_width = $taille_image[0]; 295 $original_height = $taille_image[1]; 296 } 297 else 298 { 299 $original_width = $picture['current']['width']; 300 $original_height = $picture['current']['height']; 301 } 302 303 $picture_size = get_picture_size( $original_width, $original_height, 304 $user['maxwidth'], $user['maxheight'] ); 305 306 include(PHPWG_ROOT_PATH.'include/page_header.php'); 307 $template->set_filenames(array('picture'=>'picture.tpl')); 308 309 $template->assign_vars(array( 310 'CATEGORY' => $title_img, 311 'PHOTO' => $title_nb, 312 'TITLE' => $picture['current']['name'], 313 'PREV_TITLE_IMG' => $picture['prev']['name'], 314 'NEXT_TITLE_IMG' => $picture['next']['name'], 315 'PREV_IMG' => $picture['prev']['thumbnail'], 316 'NEXT_IMG' => $picture['next']['thumbnail'], 317 'SRC_IMG' => $picture['current']['src'], 318 'ALT_IMG' => $picture['current']['file'], 319 'WIDTH_IMG' => $picture_size[0], 320 'HEIGHT_IMG' => $picture_size[1], 321 'COMMENT_IMG' => $picture['current']['comment'], 322 323 'L_SLIDESHOW' => $lang['slideshow'], 324 'L_TIME' => $lang['period_seconds'], 325 'L_STOP_SLIDESHOW' => $lang['slideshow_stop'], 326 'L_PREV_IMG' =>$lang['previous_image'].' : ', 327 'L_ADMIN' =>$lang['link_info_image'], 328 'L_BACK' =>$lang['back'], 329 'L_COMMENT_TITLE' =>$lang['comments_title'], 330 'L_ADD_COMMENT' =>$lang['comments_add'], 331 'L_DELETE_COMMENT' =>$lang['comments_del'], 332 'L_DELETE' =>$lang['delete'], 333 'L_SUBMIT' =>$lang['submit'], 334 'L_AUTHOR' =>$lang['author'], 335 'L_COMMENT' =>$lang['comment'], 336 337 'T_DEL_IMG' =>PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/delete.gif', 338 339 'U_PREV_IMG' => add_session_id($picture['prev']['url']), 340 'U_NEXT_IMG' => add_session_id($picture['next']['url']), 341 'U_HOME' => add_session_id($url_home), 342 'U_ADMIN' => add_session_id($url_admin), 343 'U_ADD_COMMENT' => add_session_id(str_replace( '&', '&', $_SERVER['REQUEST_URI'] )) 344 ) 345 ); 346 347 //-------------------------------------------------------- slideshow management 348 if ( isset( $_GET['slideshow'] ) ) 349 { 350 if ( !is_numeric( $_GET['slideshow'] ) ) $_GET['slideshow'] = $conf['slideshow_period'][0]; 351 352 $template->assign_block_vars('stop_slideshow', array( 353 'U_SLIDESHOW'=>add_session_id( $picture['current']['url'] ) 354 )); 355 } 356 else 357 { 358 $template->assign_block_vars('start_slideshow', array()); 359 foreach ( $conf['slideshow_period'] as $option ) 360 { 361 $template->assign_block_vars('start_slideshow.second', array( 362 'SLIDESHOW_SPEED'=>$option, 363 'U_SLIDESHOW'=>add_session_id( $picture['current']['url'].'&slideshow='.$option) 364 )); 365 } 366 } 367 368 if ($prev>=0) $template->assign_block_vars('previous', array()); 369 if ($next) $template->assign_block_vars('next', array()); 370 371 //--------------------------------------------------------- picture information 372 // legend 373 if ( !empty($picture['current']['comment']) ) 374 { 375 $template->assign_block_vars('legend', array()); 376 } 377 378 // author 379 if ( !empty($picture['current']['author']) ) 380 { 381 $template->assign_block_vars('info_line', array( 382 'INFO'=>$lang['author'], 383 'VALUE'=>$picture['current']['author'] 384 )); 385 } 386 // creation date 387 if ( !empty($picture['current']['date_creation']) ) 388 { 389 $template->assign_block_vars('info_line', array( 390 'INFO'=>$lang['creation_date'], 391 'VALUE'=>format_date( $picture['current']['date_creation'] ) 392 )); 393 } 394 // date of availability 395 $template->assign_block_vars('info_line', array( 396 'INFO'=>$lang['registration_date'], 397 'VALUE'=>format_date( $picture['current']['date_available'] ) 398 )); 399 // size in pixels 400 if ( $original_width != $picture_size[0] or $original_height != $picture_size[1] ) 401 { 402 $content = '[ <a href="'.$picture['current']['url'].'" title="'.$lang['true_size'].'">'; 403 $content.= $original_width.'*'.$original_height.'</a> ]'; 404 } 405 else 406 { 407 $content = $original_width.'*'.$original_height; 408 } 409 $template->assign_block_vars('info_line', array( 410 'INFO'=>$lang['size'], 411 'VALUE'=>$content 412 )); 413 // file 414 $template->assign_block_vars('info_line', array( 415 'INFO'=>$lang['file'], 416 'VALUE'=>$picture['current']['file'] 417 )); 418 // filesize 419 if ( empty($picture['current']['filesize'])) 420 { 421 $poids = floor ( filesize( $picture['current']['url'] ) / 1024 ); 422 } 423 else 424 { 425 $poids = $picture['current']['filesize']; 426 } 427 428 $template->assign_block_vars('info_line', array( 429 'INFO'=>$lang['filesize'], 430 'VALUE'=>$poids.' KB' 431 )); 432 // keywords 433 if ( !empty($picture['current']['keywords'])) 434 { 435 $keywords = explode( ',', $picture['current']['keywords'] ); 436 $content = ''; 437 $url = PHPWG_ROOT_PATH.'category.php?cat=search'; 438 $url.= '&mode=OR&search='; 439 foreach ( $keywords as $i => $keyword ) { 440 $local_url = add_session_id( $url.$keyword ); 441 if ( $i > 0 ) $content.= ','; 442 $content.= '<a href="'.$local_url.'">'.$keyword.'</a>'; 443 } 444 $template->assign_block_vars('info_line', array( 445 'INFO'=>$lang['keywords'], 446 'VALUE'=>$content 447 )); 448 } 449 // number of visits 450 $template->assign_block_vars('info_line', array( 451 'INFO'=>$lang['visited'], 452 'VALUE'=>$picture['current']['hit'].' '.$lang['times'] 453 )); 454 455 //------------------------------------------------------- favorite manipulation 456 if ( !$user['is_the_guest'] ) 457 { 458 // verify if the picture is already in the favorite of the user 459 $query = 'SELECT COUNT(*) AS nb_fav'; 460 $query.= ' FROM '.FAVORITES_TABLE.' WHERE image_id = '.$_GET['image_id']; 461 $query.= ' AND user_id = '.$user['id'].';'; 462 $result = mysql_query( $query ); 463 $row = mysql_fetch_array( $result ); 464 if (!$row['nb_fav']) 465 { 466 $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 467 $url.='&add_fav=1'; 468 if ( $page['cat'] == 'search' ) 469 { 470 $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; 471 } 472 $template->assign_block_vars('favorite', array( 473 'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/favorite.gif', 474 'FAVORITE_HINT' =>$lang['add_favorites_hint'], 475 'FAVORITE_ALT' =>'[ '.$lang['add_favorites_alt'].' ]', 476 'U_FAVORITE'=> add_session_id( $url ) 477 )); 478 } 479 else 480 { 481 $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 482 $url.= '&add_fav=0'; 483 $template->assign_block_vars('favorite', array( 484 'FAVORITE_IMG' => PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/del_favorite.gif', 485 'FAVORITE_HINT' =>$lang['del_favorites_hint'], 486 'FAVORITE_ALT' =>'[ '.$lang['del_favorites_alt'].' ]', 487 'U_FAVORITE'=> add_session_id( $url ) 488 )); 489 } 490 } 491 //------------------------------------ admin link for information modifications 492 if ( $user['status'] == 'admin' ) 493 { 494 $template->assign_block_vars('modification', array()); 495 } 496 497 //---------------------------------------------------- users's comments display 498 if ( $conf['show_comments'] ) 499 { 500 500 // number of comment for this picture 501 501 $query = 'SELECT COUNT(*) AS nb_comments'; … … 506 506 507 507 // navigation bar creation 508 $url = './picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 509 if (isset($_GET['expand'])) 510 $url.= '&expand='.$_GET['expand']; 508 $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; 511 509 if ( $page['cat'] == 'search' ) 512 510 {
Note: See TracChangeset
for help on using the changeset viewer.