[5089] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[5089] | 4 | // +-----------------------------------------------------------------------+ |
---|
| 5 | // | Copyright(C) 2010 Pierrick LE GALL http://piwigo.org | |
---|
| 6 | // +-----------------------------------------------------------------------+ |
---|
| 7 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 8 | // | it under the terms of the GNU General Public License as published by | |
---|
| 9 | // | the Free Software Foundation | |
---|
| 10 | // | | |
---|
| 11 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 12 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 13 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 14 | // | General Public License for more details. | |
---|
| 15 | // | | |
---|
| 16 | // | You should have received a copy of the GNU General Public License | |
---|
| 17 | // | along with this program; if not, write to the Free Software | |
---|
| 18 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 19 | // | USA. | |
---|
| 20 | // +-----------------------------------------------------------------------+ |
---|
| 21 | |
---|
| 22 | if( !defined("PHPWG_ROOT_PATH") ) |
---|
| 23 | { |
---|
| 24 | die ("Hacking attempt!"); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 28 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
| 29 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); |
---|
| 30 | |
---|
| 31 | define( |
---|
| 32 | 'PHOTOS_ADD_BASE_URL', |
---|
| 33 | get_root_url().'admin.php?page=photos_add' |
---|
| 34 | ); |
---|
| 35 | |
---|
| 36 | // +-----------------------------------------------------------------------+ |
---|
| 37 | // | Check Access and exit when user status is not ok | |
---|
| 38 | // +-----------------------------------------------------------------------+ |
---|
| 39 | |
---|
| 40 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 41 | |
---|
| 42 | // +-----------------------------------------------------------------------+ |
---|
| 43 | // | Load configuration | |
---|
| 44 | // +-----------------------------------------------------------------------+ |
---|
| 45 | |
---|
[8249] | 46 | prepare_upload_configuration(); |
---|
[5089] | 47 | |
---|
[8249] | 48 | $upload_form_config = get_upload_form_config(); |
---|
[5089] | 49 | |
---|
| 50 | // +-----------------------------------------------------------------------+ |
---|
| 51 | // | Tabs | |
---|
| 52 | // +-----------------------------------------------------------------------+ |
---|
| 53 | |
---|
| 54 | $tabs = array( |
---|
| 55 | array( |
---|
| 56 | 'code' => 'direct', |
---|
[5285] | 57 | 'label' => l10n('Upload Photos'), |
---|
[5089] | 58 | ), |
---|
| 59 | array( |
---|
| 60 | 'code' => 'settings', |
---|
[5285] | 61 | 'label' => l10n('Settings'), |
---|
[5182] | 62 | ), |
---|
| 63 | array( |
---|
| 64 | 'code' => 'ploader', |
---|
[5285] | 65 | 'label' => l10n('Piwigo Uploader'), |
---|
[5182] | 66 | ), |
---|
[5089] | 67 | ); |
---|
| 68 | |
---|
[6365] | 69 | if ($conf['enable_synchronization']) |
---|
| 70 | { |
---|
| 71 | array_push( |
---|
| 72 | $tabs, |
---|
| 73 | array( |
---|
| 74 | 'code' => 'ftp', |
---|
| 75 | 'label' => l10n('FTP + Synchronization'), |
---|
| 76 | ) |
---|
| 77 | ); |
---|
| 78 | } |
---|
| 79 | |
---|
[5089] | 80 | $tab_codes = array_map( |
---|
| 81 | create_function('$a', 'return $a["code"];'), |
---|
| 82 | $tabs |
---|
| 83 | ); |
---|
| 84 | |
---|
| 85 | if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes)) |
---|
| 86 | { |
---|
| 87 | $page['tab'] = $_GET['section']; |
---|
| 88 | } |
---|
| 89 | else |
---|
| 90 | { |
---|
| 91 | $page['tab'] = $tabs[0]['code']; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | $tabsheet = new tabsheet(); |
---|
| 95 | foreach ($tabs as $tab) |
---|
| 96 | { |
---|
| 97 | $tabsheet->add( |
---|
| 98 | $tab['code'], |
---|
[5285] | 99 | $tab['label'], |
---|
[5089] | 100 | PHOTOS_ADD_BASE_URL.'&section='.$tab['code'] |
---|
| 101 | ); |
---|
| 102 | } |
---|
| 103 | $tabsheet->select($page['tab']); |
---|
| 104 | $tabsheet->assign(); |
---|
| 105 | |
---|
| 106 | // +-----------------------------------------------------------------------+ |
---|
| 107 | // | template init | |
---|
| 108 | // +-----------------------------------------------------------------------+ |
---|
| 109 | |
---|
| 110 | $template->set_filenames( |
---|
| 111 | array( |
---|
[5960] | 112 | 'photos_add' => 'photos_add_'.$page['tab'].'.tpl' |
---|
[5089] | 113 | ) |
---|
| 114 | ); |
---|
| 115 | |
---|
| 116 | // +-----------------------------------------------------------------------+ |
---|
| 117 | // | Load the tab | |
---|
| 118 | // +-----------------------------------------------------------------------+ |
---|
| 119 | |
---|
| 120 | include(PHPWG_ROOT_PATH.'admin/photos_add_'.$page['tab'].'.php'); |
---|
| 121 | ?> |
---|