From 855398f63e4215ed16413a89f781dd2f6cffa231 Mon Sep 17 00:00:00 2001 From: gweltas Date: Thu, 15 Jan 2004 00:11:00 +0000 Subject: Corretion of PHP warnings git-svn-id: http://piwigo.org/svn/branches/release-1_3@279 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 2 +- admin/picture_modify.php | 4 ++-- category.php | 21 +++++++++++---------- picture.php | 9 +++++---- profile.php | 12 ++---------- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/admin/include/functions.php b/admin/include/functions.php index ecab3782f..ea2669cb0 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -431,7 +431,7 @@ function update_category( $id = 'all' ) function check_date_format( $date ) { // date arrives at this format : DD/MM/YYYY - list($day,$month,$year) = explode( '/', $date ); + @list($day,$month,$year) = explode( '/', $date ); return @checkdate( $month, $day, $year ); } diff --git a/admin/picture_modify.php b/admin/picture_modify.php index 31c89c438..beb295291 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -85,7 +85,7 @@ if ( isset( $_POST['submit'] ) ) // if the user ask the picture to be the representative picture of its // category, the category is updated in the database (without wondering // if this picture was already the representative one) - if ( $_POST['representative-'.$row['category_id']] == 1 ) + if ( isset($_POST['representative-'.$row['category_id']]) ) { $query = 'UPDATE '.PREFIX_TABLE.'categories'; $query.= ' SET representative_picture_id = '.$_GET['image_id']; @@ -144,7 +144,7 @@ if ( isset( $_POST['submit'] ) ) $result = mysql_query( $query ); while ( $row = mysql_fetch_array( $result ) ) { - if ( $_POST['dissociate-'.$row['category_id']] == 1 ) + if ( isset($_POST['dissociate-'.$row['category_id']]) ) { $query = 'DELETE FROM '.PREFIX_TABLE.'image_category'; $query.= ' WHERE image_id = '.$_GET['image_id']; diff --git a/category.php b/category.php index cb6b48777..ffcece01d 100644 --- a/category.php +++ b/category.php @@ -462,21 +462,22 @@ if ( isset ( $page['cat'] ) ) $vtp->setVar( $handle, 'cat_infos.cat_name', get_cat_display_name( $page['cat_name'], ' - ', 'font-style:italic;' ) ); + // upload a picture in the category + if ( $page['cat_site_id'] == 1 + and $conf['upload_available'] + and $page['cat_uploadable'] ) + { + $vtp->addSession( $handle, 'upload' ); + $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; + $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) ); + $vtp->closeSession( $handle, 'upload' ); + } } else { $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] ); } - // upload a picture in the category - if ( $page['cat_site_id'] == 1 - and $conf['upload_available'] - and $page['cat_uploadable'] ) - { - $vtp->addSession( $handle, 'upload' ); - $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; - $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) ); - $vtp->closeSession( $handle, 'upload' ); - } + $vtp->closeSession( $handle, 'cat_infos' ); } //------------------------------------------------------------ log informations diff --git a/picture.php b/picture.php index 783a324fa..49aa9fd70 100644 --- a/picture.php +++ b/picture.php @@ -234,7 +234,7 @@ if ( $page['num'] >= 1 ) $result = mysql_query( $query ); $row = mysql_fetch_array( $result ); - if ( $array_cat_directories[$row['storage_category_id']] == '' ) + if ( !isset($array_cat_directories[$row['storage_category_id']]) ) { $array_cat_directories[$row['storage_category_id']] = get_complete_dir( $row['storage_category_id'] ); @@ -281,7 +281,7 @@ else $intitule_cat = $page['title']; } -if ( $array_cat_directories[$page['storage_category_id']] == '' ) +if ( !isset($array_cat_directories[$page['storage_category_id']]) ) { $array_cat_directories[$page['storage_category_id']] = get_complete_dir( $page['storage_category_id'] ); @@ -289,7 +289,7 @@ if ( $array_cat_directories[$page['storage_category_id']] == '' ) $cat_directory = $array_cat_directories[$page['storage_category_id']]; $n = $page['num'] + 1; -$intitule_titre = replace_space( $intitule_cat." - " ).$n.'/'. +$intitule_titre = replace_space( $intitule_cat." - " ).$n.'/'; $intitule_titre.= $page['cat_nb_images']."
"; if ( $page['name'] != "" ) { @@ -722,7 +722,8 @@ if ( $conf['show_comments'] ) if ( !$user['is_the_guest'] ) { $vtp->addSession( $handle, 'author_known' ); - $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] ); + if (isset($user['pseudo'])) + $vtp->setVar( $handle, 'author_known.value', $user['pseudo'] ); $vtp->closeSession( $handle, 'author_known' ); } else diff --git a/profile.php b/profile.php index 95f9733aa..b900d1be3 100644 --- a/profile.php +++ b/profile.php @@ -115,11 +115,7 @@ if ( isset( $_POST['submit'] ) ) mysql_query( $query ); } // redirection - $url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand']; - if ( $page['cat'] == 'search' ) - { - $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; - } + $url = 'category.php'; if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true ); header( 'Request-URI: '.$url ); header( 'Content-Location: '.$url ); @@ -135,11 +131,7 @@ $tpl = array( 'customize_page_title','customize_title','password','new', 'reg_confirm','submit','create_cookie' ); templatize_array( $tpl, 'lang', $handle ); //----------------------------------------------------------------- form action -$url = './profile.php?cat='.$page['cat'].'&expand='.$page['expand']; -if ( $page['cat'] == 'search' ) -{ - $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; -} +$url = './profile.php'; $vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) ); //-------------------------------------------------------------- errors display if ( count( $errors ) != 0 ) -- cgit v1.2.3