Changeset 312


Ignore:
Timestamp:
Jan 22, 2004, 11:46:46 PM (20 years ago)
Author:
z0rglub
Message:
  • Php warnings correction
  • code refactoring
Location:
branches/release-1_3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/release-1_3/picture.php

    r303 r312  
    181181  $next_lien_thumbnail.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
    182182 
    183   if ( $row['name'] != "" )
     183  if ( isset( $row['name'] ) and $row['name'] != '' )
    184184  {
    185185    $next_alt_thumbnail = $row['name'];
     
    191191  $next_title = $lang['next_image']." : ".$next_alt_thumbnail;
    192192
    193   $next_url_link = './picture.php?image_id='.$row['id'].'&cat='.$page['cat'];
    194   $next_url_link.= '&expand='.$_GET['expand'];
     193  $next_url_link = './picture.php?image_id='.$row['id'];
     194  $next_url_link.= '&cat='.$page['cat'];
     195  if ( isset( $_GET['expand'] ) )
     196    $next_url_link.= '&expand='.$_GET['expand'];
    195197  if ( $page['cat'] == 'search' )
    196198  {
     
    291293
    292294  $prev_title = $lang['previous_image'].' : ';
    293   $alt_thumbnaill = '';
    294   if ( $row['name'] != '' ) $alt_thumbnail = $row['name'];
    295   else                      $alt_thumbnail = $file;
     295
     296  if ( isset( $row['name'] ) and $row['name'] != '' )
     297    $alt_thumbnail = $row['name'];
     298  else
     299    $alt_thumbnail = $file;
     300
    296301  $prev_title.= $alt_thumbnail;
    297302 
    298303  $url_link = './picture.php?image_id='.$row['id'].'&cat='.$page['cat'];
    299   $url_link.= '&expand='.$_GET['expand'];
     304  if ( isset( $_GET['expand'] ) ) $url_link.= '&expand='.$_GET['expand'];
    300305  if ( $page['cat'] == 'search' )
    301306  {
     
    471476  $keywords = explode( ',', $page['keywords'] );
    472477  $content = '';
    473   $url = './category.php?cat=search&expand='.$_GET['expand'];
     478  $url = './category.php?cat=search';
     479  if ( isset( $_GET['expand'] ) ) $url.= '&expand='.$_GET['expand'];
    474480  $url.= '&mode=OR&search=';
    475481  foreach ( $keywords as $i => $keyword ) {
     
    490496{
    491497  // verify if the picture is already in the favorite of the user
    492   $query = 'SELECT COUNT(*) AS nb_fav FROM '.PREFIX_TABLE.'favorites WHERE image_id = '.$page['id'];
     498  $query = 'SELECT COUNT(*) AS nb_fav';
     499  $query.= ' FROM '.PREFIX_TABLE.'favorites';
     500  $query.= ' WHERE image_id = '.$page['id'];
    493501  $query.= ' AND user_id = '.$user['id'].';';
    494502  $result = mysql_query( $query );
    495503  $row = mysql_fetch_array( $result );
    496504  if (!$row['nb_fav'])
    497 {
    498   $url = './picture.php?cat='.$page['cat'].'&image_id='.$page['id'];
    499   if (isset($_GET['expand']))
    500           $url.= '&expand='.$_GET['expand'];
    501   $url.='&add_fav=1';
    502   if ( $page['cat'] == 'search' )
    503   {
    504     $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
    505   }
    506   $vtp->addSession( $handle, 'favorite' );
    507   $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
    508   $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] );
    509   $vtp->setVar( $handle, 'favorite.src',
    510                 './template/'.$user['template'].'/theme/favorite.gif' );
    511   $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['add_favorites_alt'].' ]' );
    512   $vtp->closeSession( $handle, 'favorite' );
    513 }
    514 else
    515 {
    516   $url = './picture.php?cat='.$page['cat'].'&image_id='.$page['id'];
    517   $url.= '&expand='.$_GET['expand'].'&add_fav=0';
    518   $vtp->addSession( $handle, 'favorite' );
    519   $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
    520   $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] );
    521   $vtp->setVar( $handle, 'favorite.src',
    522                 './template/'.$user['template'].'/theme/del_favorite.gif' );
    523   $vtp->setVar( $handle, 'favorite.alt','[ '.$lang['del_favorites_alt'].' ]' );
    524   $vtp->closeSession( $handle, 'favorite' );
    525 }
     505  {
     506    $url = './picture.php?cat='.$page['cat'].'&image_id='.$page['id'];
     507    if (isset($_GET['expand']))
     508      $url.= '&expand='.$_GET['expand'];
     509    $url.='&add_fav=1';
     510    if ( $page['cat'] == 'search' )
     511    {
     512      $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
     513    }
     514    $vtp->addSession( $handle, 'favorite' );
     515    $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
     516    $vtp->setVar( $handle, 'favorite.title', $lang['add_favorites_hint'] );
     517    $vtp->setVar( $handle, 'favorite.src',
     518                  './template/'.$user['template'].'/theme/favorite.gif' );
     519    $vtp->setVar($handle,'favorite.alt','[ '.$lang['add_favorites_alt'].' ]');
     520    $vtp->closeSession( $handle, 'favorite' );
     521  }
     522  else
     523  {
     524    $url = './picture.php?cat='.$page['cat'].'&image_id='.$page['id'];
     525    $url.= '&expand='.$_GET['expand'].'&add_fav=0';
     526    $vtp->addSession( $handle, 'favorite' );
     527    $vtp->setVar( $handle, 'favorite.link', add_session_id( $url ) );
     528    $vtp->setVar( $handle, 'favorite.title', $lang['del_favorites_hint'] );
     529    $vtp->setVar( $handle, 'favorite.src',
     530                  './template/'.$user['template'].'/theme/del_favorite.gif' );
     531    $vtp->setVar($handle,'favorite.alt','[ '.$lang['del_favorites_alt'].' ]');
     532    $vtp->closeSession( $handle, 'favorite' );
     533  }
    526534}
    527535//------------------------------------ admin link for information modifications
  • branches/release-1_3/profile.php

    r290 r312  
    6868  }
    6969  $mail_error = validate_mail_address( $_POST['mail_address'] );
    70   if ( $mail_error != '' )
    71   {
    72     array_push( $errors, $mail_error );
    73   }
    74   if ( $_POST['use_new_pwd'] == 1 )
    75   {
    76     // password must be the same as its confirmation
    77     if ( $_POST['password'] != $_POST['passwordConf'] )
    78     {
    79       array_push( $errors, $lang['reg_err_pass'] );
    80     }
    81   }
    82 
     70  if ( $mail_error != '' ) array_push( $errors, $mail_error );
     71  // password must be the same as its confirmation
     72  if ( isset( $_POST['use_new_pwd'] )
     73       and $_POST['password'] != $_POST['passwordConf'] )
     74    array_push( $errors, $lang['reg_err_pass'] );
     75 
    8376  if ( count( $errors ) == 0 )
    8477  {
     
    9689    mysql_query( $query );
    9790
    98     if ( $_POST['use_new_pwd'] == 1 )
     91    if ( isset( $_POST['use_new_pwd'] ) )
    9992    {
    10093      $query = 'UPDATE '.PREFIX_TABLE.'users';
     
    10497      mysql_query( $query );
    10598    }
    106     if ( $_POST['create_cookie'] == 1 )
     99    if ( isset( $_POST['create_cookie'] ) )
    107100    {
    108101      setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
     
    117110    // redirection
    118111    $url = 'category.php';
    119     if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true );
     112    if ( isset( $_POST['create_cookie'] ) ) $url = add_session_id( $url,true );
    120113    header( 'Request-URI: '.$url ); 
    121114    header( 'Content-Location: '.$url ); 
Note: See TracChangeset for help on using the changeset viewer.