Changeset 26 for trunk/picture.php
- Timestamp:
- Jul 21, 2003, 9:47:14 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r21 r26 17 17 18 18 // this page shows the image full size 19 // (or resized to the max size the user has chosen)20 // and two thumbnail : previous and next picture of your gallery21 19 //----------------------------------------------------------- personnal include 22 20 include_once( './include/init.inc.php' ); … … 148 146 149 147 $tpl = array( 'back','submit','comments_title','comments_del','delete', 150 'comments_add','author' ); 148 'comments_add','author','slideshow','slideshow_stop', 149 'period_seconds' ); 151 150 templatize_array( $tpl, 'lang', $handle ); 151 $vtp->setGlobalVar( $handle, 'user_template', $user['template'] ); 152 152 $vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] ); 153 //-------------------------------------------------------- slideshow management 154 if ( isset( $_GET['slideshow'] ) ) 155 { 156 if ( !is_numeric( $_GET['slideshow'] ) ) 157 $_GET['slideshow'] = $conf['slideshow_period'][0]; 158 $vtp->addSession( $handle, 'stop_slideshow' ); 159 $url = './picture.php'; 160 $url.= '?image_id='.$page['id']; 161 $url.= '&cat='.$page['cat']; 162 $url.= '&expand='.$_GET['expand']; 163 if ( $page['cat'] == 'search' ) 164 { 165 $url.= '&search='.$_GET['search']; 166 $url.= '&mode='.$_GET['mode']; 167 } 168 $vtp->setVar( $handle, 'stop_slideshow.url', add_session_id( $url ) ); 169 $vtp->closeSession( $handle, 'stop_slideshow' ); 170 } 171 else 172 { 173 $vtp->addSession( $handle, 'start_slideshow' ); 174 foreach ( $conf['slideshow_period'] as $option ) { 175 $vtp->addSession( $handle, 'second' ); 176 $vtp->setVar( $handle, 'second.option', $option ); 177 $url = './picture.php'; 178 $url.= '?image_id='.$page['id']; 179 $url.= '&cat='.$page['cat']; 180 $url.= '&expand='.$_GET['expand']; 181 if ( $page['cat'] == 'search' ) 182 { 183 $url.= '&search='.$_GET['search']; 184 $url.= '&mode='.$_GET['mode']; 185 } 186 $url.= '&slideshow='.$option; 187 $vtp->setVar( $handle, 'second.url', add_session_id( $url ) ); 188 $vtp->closeSession( $handle, 'second' ); 189 } 190 $vtp->closeSession( $handle, 'start_slideshow' ); 191 } 153 192 //------------------------------------------------------------------ page title 154 193 if ( $page['name'] != '' ) … … 377 416 $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] ); 378 417 $vtp->setVar( $handle, 'favorite.src', 379 './t heme/'.$user['theme'].'/favorite.gif' );418 './template/'.$user['template'].'/theme/favorite.gif' ); 380 419 $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['add_favorites_alt'].' ]' ); 381 420 $vtp->closeSession( $handle, 'favorite' ); … … 389 428 $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] ); 390 429 $vtp->setVar( $handle, 'favorite.src', 391 './t heme/'.$user['theme'].'/del_favorite.gif' );430 './template/'.$user['template'].'/theme/del_favorite.gif' ); 392 431 $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['del_favorites_alt'].' ]' ); 393 432 $vtp->closeSession( $handle, 'favorite' ); … … 453 492 $vtp->setGlobalVar( $handle, 'next.alt', $alt_thumbnail ); 454 493 $vtp->closeSession( $handle, 'next' ); 494 // slideshow 495 if ( isset( $_GET['slideshow'] ) ) 496 { 497 $vtp->addSession( $handle, 'refresh' ); 498 $vtp->setVar( $handle, 'refresh.time', 2 ); 499 $url = $url_link.'&slideshow='.$_GET['slideshow']; 500 $vtp->setVar( $handle, 'refresh.url', add_session_id( $url ) ); 501 $vtp->closeSession( $handle, 'refresh' ); 502 } 455 503 } 456 504 else … … 472 520 } 473 521 $query = 'INSERT INTO '.PREFIX_TABLE.'comments'; 474 $query.= ' (author,date,image_id,content ) VALUES';522 $query.= ' (author,date,image_id,content,validated) VALUES'; 475 523 $query.= " ('".$author."',".time().",".$page['id']; 476 $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."');"; 524 $query.= ",'".htmlspecialchars( $_POST['content'], ENT_QUOTES)."'"; 525 if ( !$conf['comments_validation'] or $user['status'] == 'admin' ) 526 $query.= ",'true'"; 527 else 528 $query.= ",'false'"; 529 $query.= ');'; 477 530 mysql_query( $query ); 531 $vtp->addSession( $handle, 'information' ); 532 $message = $lang['comment_added']; 533 if ( $conf['comments_validation'] and $user['status'] != 'admin' ) 534 { 535 $message.= '<br />'.$lang['comment_to_validate']; 536 } 537 $vtp->setVar( $handle, 'information.content', $message ); 538 $vtp->closeSession( $handle, 'information' ); 478 539 } 479 540 // comment deletion … … 489 550 $query = 'SELECT COUNT(*) AS nb_comments'; 490 551 $query.= ' FROM '.PREFIX_TABLE.'comments'; 491 $query.= ' WHERE image_id = '.$page['id'].';'; 552 $query.= ' WHERE image_id = '.$page['id']; 553 $query.= " AND validated = 'true'"; 554 $query.= ';'; 492 555 $row = mysql_fetch_array( mysql_query( $query ) ); 493 556 $page['nb_comments'] = $row['nb_comments']; … … 520 583 $query.= ' FROM '.PREFIX_TABLE.'comments'; 521 584 $query.= ' WHERE image_id = '.$page['id']; 585 $query.= " AND validated = 'true'"; 522 586 $query.= ' ORDER BY date ASC'; 523 587 $query.= ' LIMIT '.$page['start'].', '.$conf['nb_comment_page'].';'; … … 531 595 $displayed_date.= date( " j ", $row['date'] ); 532 596 $displayed_date.= $lang['month'][date( "n", $row['date'] )]; 533 $displayed_date.= date( " Y G:i", $row['date'] );597 $displayed_date.= date( ' Y G:i', $row['date'] ); 534 598 $vtp->setVar( $handle, 'comment.date', $displayed_date ); 535 599 $vtp->setVar( $handle, 'comment.content', nl2br( $row['content'] ) );
Note: See TracChangeset
for help on using the changeset viewer.