Changeset 26 for trunk/picture.php


Ignore:
Timestamp:
Jul 21, 2003, 9:47:14 PM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r21 r26  
    1717
    1818// 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 gallery
    2119//----------------------------------------------------------- personnal include
    2220include_once( './include/init.inc.php' );       
     
    148146
    149147$tpl = array( 'back','submit','comments_title','comments_del','delete',
    150               'comments_add','author' );
     148              'comments_add','author','slideshow','slideshow_stop',
     149              'period_seconds' );
    151150templatize_array( $tpl, 'lang', $handle );
     151$vtp->setGlobalVar( $handle, 'user_template', $user['template'] );
    152152$vtp->setGlobalVar( $handle, 'text_color', $user['couleur_text'] );
     153//-------------------------------------------------------- slideshow management
     154if ( 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}
     171else
     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}
    153192//------------------------------------------------------------------ page title
    154193if ( $page['name'] != '' )
     
    377416  $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] );
    378417  $vtp->setVar( $handle, 'favorite.src',
    379                 './theme/'.$user['theme'].'/favorite.gif' );
     418                './template/'.$user['template'].'/theme/favorite.gif' );
    380419  $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['add_favorites_alt'].' ]' );
    381420  $vtp->closeSession( $handle, 'favorite' );
     
    389428  $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] );
    390429  $vtp->setVar( $handle, 'favorite.src',
    391                 './theme/'.$user['theme'].'/del_favorite.gif' );
     430                './template/'.$user['template'].'/theme/del_favorite.gif' );
    392431  $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['del_favorites_alt'].' ]' );
    393432  $vtp->closeSession( $handle, 'favorite' );
     
    453492  $vtp->setGlobalVar( $handle, 'next.alt', $alt_thumbnail );
    454493  $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  }
    455503}
    456504else
     
    472520    }
    473521    $query = 'INSERT INTO '.PREFIX_TABLE.'comments';
    474     $query.= ' (author,date,image_id,content) VALUES';
     522    $query.= ' (author,date,image_id,content,validated) VALUES';
    475523    $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.= ');';
    477530    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' );
    478539  }
    479540  // comment deletion
     
    489550  $query = 'SELECT COUNT(*) AS nb_comments';
    490551  $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.= ';';
    492555  $row = mysql_fetch_array( mysql_query( $query ) );
    493556  $page['nb_comments'] = $row['nb_comments'];
     
    520583  $query.= ' FROM '.PREFIX_TABLE.'comments';
    521584  $query.= ' WHERE image_id = '.$page['id'];
     585  $query.= " AND validated = 'true'";
    522586  $query.= ' ORDER BY date ASC';
    523587  $query.= ' LIMIT '.$page['start'].', '.$conf['nb_comment_page'].';';
     
    531595    $displayed_date.= date( " j ", $row['date'] );
    532596    $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'] );
    534598    $vtp->setVar( $handle, 'comment.date', $displayed_date );
    535599    $vtp->setVar( $handle, 'comment.content', nl2br( $row['content'] ) );
Note: See TracChangeset for help on using the changeset viewer.