diff options
author | z0rglub <z0rglub@piwigo.org> | 2004-01-21 23:33:56 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2004-01-21 23:33:56 +0000 |
commit | 40a11658a9f54d04f94d3febc204d09a86622e3e (patch) | |
tree | 96fd59aed7a124f73faa74d25a0f76d6d8233da4 | |
parent | 5c5c69f9a03eb956399d1394decfb4092c4959da (diff) |
Php warnings correction
git-svn-id: http://piwigo.org/svn/branches/release-1_3@311 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/comments.php | 2 | ||||
-rw-r--r-- | admin/include/functions.php | 4 | ||||
-rw-r--r-- | admin/infos_images.php | 4 | ||||
-rw-r--r-- | admin/picture_modify.php | 17 | ||||
-rw-r--r-- | admin/user_list.php | 2 | ||||
-rw-r--r-- | category.php | 4 |
6 files changed, 22 insertions, 11 deletions
diff --git a/admin/comments.php b/admin/comments.php index 7036a2fb2..3484b7559 100644 --- a/admin/comments.php +++ b/admin/comments.php @@ -36,7 +36,7 @@ function display_pictures( $mysql_result, $maxtime, $validation_box = false ) $subresult = mysql_query( $query ); $subrow = mysql_fetch_array( $subresult ); - if ( $array_cat_directories[$subrow['cat_id']] == '' ) + if ( !isset( $array_cat_directories[$subrow['cat_id']] ) ) { $array_cat_directories[$subrow['cat_id']] = get_complete_dir( $subrow['cat_id'] ); diff --git a/admin/include/functions.php b/admin/include/functions.php index b049914dc..b761c36fe 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -404,7 +404,7 @@ function update_category( $id = 'all' ) $row = mysql_fetch_array( mysql_query( $query ) ); // if the category has no representative picture (ie // representative_picture_id == NULL) we don't update anything - if ( $row['representative_picture_id'] != '' ) + if ( isset( $row['representative_picture_id'] ) ) { $query = 'SELECT image_id'; $query.= ' FROM '.PREFIX_TABLE.'image_category'; @@ -691,7 +691,7 @@ function update_uppercats( $category_id ) array_push( $uppercats, $category_id ); $uppercat = $page['plain_structure'][$category_id]['id_uppercat']; - while ( $uppercat != '' ) + while ( $uppercat != 'NULL' ) { array_push( $uppercats, $uppercat ); $category_id = $page['plain_structure'][$category_id]['id_uppercat']; diff --git a/admin/infos_images.php b/admin/infos_images.php index 087216f47..4d0a6afc0 100644 --- a/admin/infos_images.php +++ b/admin/infos_images.php @@ -179,7 +179,9 @@ if ( isset( $page['cat'] ) ) $result = mysql_query( $query ); while ( $row = mysql_fetch_array( $result ) ) { - $specific_keywords = explode( ',', $row['keywords'] ); + if ( !isset( $row['keywords'] ) ) $specific_keywords = array(); + else $specific_keywords = explode( ',', $row['keywords'] ); + $common_keywords = get_keywords( $_POST['keywords_cat'] ); // first possiblity : adding the given keywords to all the pictures if ( $_POST['common_keywords'] == 'add' ) diff --git a/admin/picture_modify.php b/admin/picture_modify.php index beb295291..c167cf425 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -95,7 +95,8 @@ if ( isset( $_POST['submit'] ) ) } // if the user ask this picture to be not any more the representative, // we have to set the representative_picture_id of this category to NULL - else if ( $row['representative_picture_id'] == $_GET['image_id'] ) + else if ( isset( $row['representative_picture_id'] ) + and $row['representative_picture_id'] == $_GET['image_id'] ) { $query = 'UPDATE '.PREFIX_TABLE.'categories'; $query.= ' SET representative_picture_id = NULL'; @@ -186,12 +187,19 @@ if ( count( $errors ) != 0 ) $action = './admin.php?'.$_SERVER['QUERY_STRING']; $vtp->setVar( $sub, 'form_action', $action ); // retrieving direct information about picture -$query = 'SELECT file,date_available,date_creation,tn_ext,name,filesize'; -$query.= ',width,height,author,comment,keywords,storage_category_id'; +$infos = array( 'file','date_available','date_creation','tn_ext','name' + ,'filesize','width','height','author','comment','keywords' + ,'storage_category_id' ); +$query = 'SELECT '. implode( ',', $infos ); $query.= ' FROM '.PREFIX_TABLE.'images'; $query.= ' WHERE id = '.$_GET['image_id']; $query.= ';'; $row = mysql_fetch_array( mysql_query( $query ) ); + +foreach ( $infos as $info ) { + if ( !isset( $row[$info] ) ) $row[$info] = ''; +} + // picture title if ( $row['name'] == '' ) { @@ -314,7 +322,8 @@ while ( $row = mysql_fetch_array( $result ) ) $vtp->setVar( $sub, 'linked_category.invisible', $invisible_string ); } - if ( $row['representative_picture_id'] == $_GET['image_id'] ) + if ( isset( $row['representative_picture_id'] ) + and $row['representative_picture_id'] == $_GET['image_id'] ) { $vtp->setVar( $sub, 'linked_category.representative_checked', ' checked="checked"' ); diff --git a/admin/user_list.php b/admin/user_list.php index f759365b0..2f20a2795 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -58,7 +58,7 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) ) $query.= ';'; $row = mysql_fetch_array( mysql_query( $query ) ); // confirm user deletion ? - if ( $_GET['confirm'] != 1 ) + if ( !isset( $_GET['confirm'] ) ) { $vtp->addSession( $sub, 'deletion' ); $vtp->setVar( $sub, 'deletion.login', $row['username'] ); diff --git a/category.php b/category.php index 08c684709..20dfaed9f 100644 --- a/category.php +++ b/category.php @@ -285,8 +285,8 @@ if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 ) $file = get_filename_wo_extension( $row['file'] ); // name of the picture - if ( $row['name'] != '' ) $name = $row['name']; - else $name = str_replace( '_', ' ', $file ); + if ( isset( $row['name'] ) and $row['name'] != '' ) $name = $row['name']; + else $name = str_replace( '_', ' ', $file ); if ( $page['cat'] == 'search' ) { |