diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-02-27 01:56:16 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-02-27 01:56:16 +0000 |
commit | 47512ce6a64fa356214c162a8313480c6aed41d2 (patch) | |
tree | a0e35e2f89ef789f380adc5b8951444c189de4e7 /upload.php | |
parent | bfb4b15d2f75835033d9bbb865edd77dcb282bb6 (diff) |
- refactoring page['category'] before 1.7 release
page['category'] is not an id anymore, but an associative array of category info
all of page['cat_xxx'] or page['uppercats'] merged into one
simplifies calls to make_index_url
give plugins a clean start for page variables for version 1.7
git-svn-id: http://piwigo.org/svn/trunk@1861 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | upload.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/upload.php b/upload.php index 16dba838b..380abc46d 100644 --- a/upload.php +++ b/upload.php @@ -132,13 +132,10 @@ if (is_numeric($_GET['cat'])) if (isset($page['category'])) { check_restrictions( $page['category'] ); - $result = get_cat_info( $page['category'] ); - $page['cat_dir'] = get_complete_dir( $page['category'] ); - $page['cat_site_id'] = $result['site_id']; - $page['cat_name'] = $result['name']; - $page['cat_uploadable'] = $result['uploadable']; + $category = get_cat_info( $page['category'] ); + $category['cat_dir'] = get_complete_dir( $page['category'] ); - if (url_is_remote($page['cat_dir']) or !$page['cat_uploadable']) + if (url_is_remote($category['cat_dir']) or !$category['uploadable']) { die('Fatal: you take a wrong way, bye bye'); } @@ -154,7 +151,7 @@ if ( isset( $_GET['waiting_id'] ) ) // verfying fields if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) ) { - $path = $page['cat_dir'].$_FILES['picture']['name']; + $path = $category['cat_dir'].$_FILES['picture']['name']; if ( @is_file( $path ) ) { array_push( $error, l10n('upload_file_exists') ); @@ -241,7 +238,7 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) ) $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") ); $extension = get_extension( $_FILES['picture']['name'] ); - if (($path = mkget_thumbnail_dir($page['cat_dir'], $error)) != false) + if (($path = mkget_thumbnail_dir($category['cat_dir'], $error)) != false) { $path.= '/'.$conf['prefix_thumbnail'].$file.'.'.$extension; $result = validate_upload( $path, $conf['upload_maxfilesize'], @@ -285,7 +282,7 @@ if ( isset( $page['waiting_id'] ) ) else { $advise_title = l10n('upload_advise'); - $advise_title.= get_cat_display_name($page['cat_name']); + $advise_title.= get_cat_display_name($category['upper_names']); } $template->assign_vars( @@ -302,7 +299,7 @@ $template->assign_vars( 'F_ACTION' => $u_form, - 'U_RETURN' => make_index_url(array('category' => $page['category'])), + 'U_RETURN' => make_index_url(array('category' => $category)), ) ); |