[217] | 1 | <?php |
---|
[354] | 2 | // +-----------------------------------------------------------------------+ |
---|
[362] | 3 | // | admin.php | |
---|
[354] | 4 | // +-----------------------------------------------------------------------+ |
---|
| 5 | // | application : PhpWebGallery <http://phpwebgallery.net> | |
---|
[362] | 6 | // | branch : BSF (Best So Far) | |
---|
[354] | 7 | // +-----------------------------------------------------------------------+ |
---|
| 8 | // | file : $RCSfile$ |
---|
| 9 | // | last update : $Date: 2004-10-30 15:42:29 +0000 (Sat, 30 Oct 2004) $ |
---|
| 10 | // | last modifier : $Author: z0rglub $ |
---|
| 11 | // | revision : $Revision: 587 $ |
---|
| 12 | // +-----------------------------------------------------------------------+ |
---|
| 13 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 14 | // | it under the terms of the GNU General Public License as published by | |
---|
| 15 | // | the Free Software Foundation | |
---|
| 16 | // | | |
---|
| 17 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 18 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 20 | // | General Public License for more details. | |
---|
| 21 | // | | |
---|
| 22 | // | You should have received a copy of the GNU General Public License | |
---|
| 23 | // | along with this program; if not, write to the Free Software | |
---|
| 24 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 25 | // | USA. | |
---|
| 26 | // +-----------------------------------------------------------------------+ |
---|
[217] | 27 | |
---|
[345] | 28 | //----------------------------------------------------------- include |
---|
[364] | 29 | define('PHPWG_ROOT_PATH','./'); |
---|
[393] | 30 | define('IN_ADMIN', true); |
---|
[364] | 31 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
[393] | 32 | include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); |
---|
| 33 | |
---|
[217] | 34 | //--------------------------------------- validating page and creation of title |
---|
| 35 | $page_valide = false; |
---|
| 36 | $title = ''; |
---|
[345] | 37 | if (isset( $_GET['page'] )) |
---|
[217] | 38 | switch ( $_GET['page'] ) |
---|
| 39 | { |
---|
| 40 | case 'user_list': |
---|
| 41 | $title = $lang['title_liste_users']; $page_valide = true; break; |
---|
| 42 | case 'user_modify': |
---|
| 43 | $title = $lang['title_modify']; $page_valide = true; break; |
---|
[393] | 44 | case 'user_search': |
---|
[539] | 45 | $username=''; |
---|
| 46 | if (isset($_POST['username'])) $username=$_POST['username']; |
---|
| 47 | $title = $lang['title_user_perm'].' '.$username; |
---|
[393] | 48 | $page_valide = true; break; |
---|
[217] | 49 | case 'group_list' : |
---|
| 50 | $title = $lang['title_groups']; $page_valide = true; break; |
---|
| 51 | case 'group_perm' : |
---|
| 52 | if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1; |
---|
[393] | 53 | $query = 'SELECT name FROM '.GROUPS_TABLE; |
---|
[217] | 54 | $query.= ' WHERE id = '.$_GET['group_id']; |
---|
| 55 | $query.= ';'; |
---|
[587] | 56 | $result = pwg_query( $query ); |
---|
[217] | 57 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 58 | { |
---|
| 59 | $row = mysql_fetch_array( $result ); |
---|
| 60 | $title = $lang['title_group_perm'].' "'.$row['name'].'"'; |
---|
| 61 | $page_valide = true; |
---|
| 62 | } |
---|
| 63 | else |
---|
| 64 | { |
---|
| 65 | $page_valide = false; |
---|
| 66 | } |
---|
| 67 | break; |
---|
| 68 | case 'stats': |
---|
| 69 | $title = $lang['title_history']; $page_valide = true; break; |
---|
| 70 | case 'update': |
---|
| 71 | $title = $lang['title_update']; $page_valide = true; break; |
---|
| 72 | case 'configuration': |
---|
| 73 | $title = $lang['title_configuration']; $page_valide = true; break; |
---|
[394] | 74 | case 'admin_phpinfo': |
---|
| 75 | $title = $lang['phpinfos']; $page_valide = true; break; |
---|
[217] | 76 | case 'help': |
---|
| 77 | $title = $lang['title_instructions']; $page_valide = true; break; |
---|
| 78 | case 'cat_perm': |
---|
| 79 | $title = $lang['title_cat_perm']; |
---|
| 80 | if ( isset( $_GET['cat_id'] ) ) |
---|
| 81 | { |
---|
| 82 | check_cat_id( $_GET['cat_id'] ); |
---|
| 83 | if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) |
---|
| 84 | { |
---|
| 85 | $result = get_cat_info( $page['cat'] ); |
---|
| 86 | $name = get_cat_display_name( $result['name'],' > ', '' ); |
---|
| 87 | $title.= ' "'.$name.'"'; |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | $page_valide = true; |
---|
| 91 | break; |
---|
| 92 | case 'cat_list': |
---|
| 93 | $title = $lang['title_categories']; $page_valide = true; break; |
---|
| 94 | case 'cat_modify': |
---|
| 95 | $title = $lang['title_edit_cat']; $page_valide = true; break; |
---|
[403] | 96 | case 'admin_upload': |
---|
| 97 | $title = $lang['upload']; $page_valide = true; break; |
---|
[217] | 98 | case 'infos_images': |
---|
| 99 | $title = $lang['title_info_images']; $page_valide = true; break; |
---|
| 100 | case 'waiting': |
---|
| 101 | $title = $lang['title_waiting']; $page_valide = true; break; |
---|
| 102 | case 'thumbnail': |
---|
| 103 | $title = $lang['title_thumbnails']; |
---|
| 104 | if ( isset( $_GET['dir'] ) ) |
---|
| 105 | { |
---|
[393] | 106 | $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">'; |
---|
[217] | 107 | // $_GET['dir'] contains : |
---|
[228] | 108 | // ./galleries/vieux_lyon ou |
---|
| 109 | // ./galleries/vieux_lyon/visite ou |
---|
| 110 | // ./galleries/vieux_lyon/visite/truc ... |
---|
[217] | 111 | $dir = explode( "/", $_GET['dir'] ); |
---|
| 112 | $title.= $dir[2]; |
---|
[393] | 113 | for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ ) |
---|
[217] | 114 | { |
---|
[393] | 115 | $title.= ' > '.$dir[$i+1]; |
---|
[217] | 116 | } |
---|
| 117 | $title.= "</span>"; |
---|
| 118 | } |
---|
| 119 | $page_valide = true; |
---|
| 120 | break; |
---|
| 121 | case 'comments' : |
---|
| 122 | $title = $lang['title_comments']; |
---|
| 123 | $page_valide = true; |
---|
| 124 | break; |
---|
| 125 | case 'picture_modify' : |
---|
| 126 | $title = $lang['title_picmod']; |
---|
| 127 | $page_valide = true; |
---|
| 128 | break; |
---|
[526] | 129 | case 'remote_site' : |
---|
| 130 | { |
---|
| 131 | $title = $lang['remote_sites']; |
---|
| 132 | $page_valide = true; |
---|
| 133 | break; |
---|
| 134 | } |
---|
[217] | 135 | default: |
---|
| 136 | $title = $lang['title_default']; break; |
---|
| 137 | } |
---|
| 138 | if ( $title == '' ) $title = $lang['title_default']; |
---|
[393] | 139 | |
---|
[217] | 140 | // waiting |
---|
[393] | 141 | $query = 'SELECT id FROM '.WAITING_TABLE; |
---|
[217] | 142 | $query.= " WHERE validated='false'"; |
---|
| 143 | $query.= ';'; |
---|
[587] | 144 | $result = pwg_query( $query ); |
---|
[217] | 145 | $nb_waiting = ''; |
---|
| 146 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 147 | { |
---|
| 148 | $nb_waiting = ' [ '.mysql_num_rows( $result ).' ]'; |
---|
| 149 | } |
---|
| 150 | // comments |
---|
[393] | 151 | $query = 'SELECT id FROM '.COMMENTS_TABLE; |
---|
[217] | 152 | $query.= " WHERE validated='false'"; |
---|
| 153 | $query.= ';'; |
---|
[587] | 154 | $result = pwg_query( $query ); |
---|
[393] | 155 | $nb_comments = ''; |
---|
[217] | 156 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 157 | { |
---|
[393] | 158 | $nb_comments = ' [ '.mysql_num_rows( $result ).' ]'; |
---|
[217] | 159 | } |
---|
[393] | 160 | |
---|
| 161 | $link_start = PHPWG_ROOT_PATH.'admin.php?page='; |
---|
| 162 | //----------------------------------------------------- template initialization |
---|
| 163 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
| 164 | $template->set_filenames( array('admin'=>'admin.tpl') ); |
---|
| 165 | |
---|
| 166 | $template->assign_vars(array( |
---|
[394] | 167 | 'L_TITLE'=>$lang['admin_panel'], |
---|
| 168 | 'L_LINKS'=>$lang['links'], |
---|
| 169 | 'L_GALLERY_INDEX'=>$lang['gallery_index'], |
---|
| 170 | 'L_GENERAL'=>$lang['general'], |
---|
| 171 | 'L_DEFAULT'=>$lang['gallery_default'], |
---|
| 172 | 'L_PHPINFO'=>$lang['phpinfos'], |
---|
| 173 | 'L_HISTORY'=>$lang['history'], |
---|
| 174 | 'L_FAQ'=>$lang['instructions'], |
---|
[527] | 175 | 'L_CONFIGURATION'=>$lang['config'], |
---|
| 176 | 'L_CONFIG_GENERAL'=>$lang['general'], |
---|
| 177 | 'L_CONFIG_COMMENTS'=>$lang['comments'], |
---|
| 178 | 'L_CONFIG_DISPLAY'=>$lang['conf_default'], |
---|
| 179 | 'L_CONFIG_UPLOAD'=>$lang['upload'], |
---|
| 180 | 'L_CONFIG_SESSION'=>$lang['conf_cookie'], |
---|
| 181 | 'L_CONFIG_METADATA'=>$lang['metadata'], |
---|
[528] | 182 | 'L_SITES'=>$lang['remote_sites'], |
---|
[394] | 183 | 'L_CATEGORIES'=>$lang['categories'], |
---|
| 184 | 'L_MANAGE'=>$lang['manage'], |
---|
| 185 | 'L_UPLOAD'=>$lang['upload'], |
---|
| 186 | 'L_IMAGES'=>$lang['pictures'], |
---|
| 187 | 'L_WAITING'=>$lang['waiting'].$nb_waiting, |
---|
| 188 | 'L_COMMENTS'=>$lang['comments'].$nb_comments, |
---|
| 189 | 'L_THUMBNAILS'=>$lang['thumbnails'], |
---|
| 190 | 'L_IDENTIFY'=>$lang['identification'], |
---|
| 191 | 'L_USERS'=>$lang['users'], |
---|
| 192 | 'L_GROUPS'=>$lang['groups'], |
---|
| 193 | 'L_AUTH'=>$lang['permissions'], |
---|
| 194 | 'L_UPDATE'=>$lang['update'], |
---|
| 195 | |
---|
[527] | 196 | 'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&section=general' ), |
---|
| 197 | 'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&section=comments' ), |
---|
| 198 | 'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&section=default' ), |
---|
| 199 | 'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&section=upload' ), |
---|
| 200 | 'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&section=session' ), |
---|
| 201 | 'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&section=metadata' ), |
---|
[528] | 202 | 'U_SITES'=>add_session_id($link_start.'remote_site'), |
---|
[394] | 203 | 'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ), |
---|
[393] | 204 | 'U_USERS'=>add_session_id($link_start.'user_search' ), |
---|
| 205 | 'U_GROUPS'=>add_session_id($link_start.'group_list' ), |
---|
| 206 | 'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ), |
---|
[403] | 207 | 'U_UPLOAD'=>add_session_id($link_start.'admin_upload' ), |
---|
[393] | 208 | 'U_WAITING'=>add_session_id($link_start.'waiting' ), |
---|
| 209 | 'U_COMMENTS'=>add_session_id($link_start.'comments' ), |
---|
[394] | 210 | 'U_CAT_UPDATE'=>add_session_id($link_start.'update&update=cats' ), |
---|
| 211 | 'U_IMG_UPDATE'=>add_session_id($link_start.'update&update=all' ), |
---|
[393] | 212 | 'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ), |
---|
| 213 | 'U_HISTORY'=>add_session_id($link_start.'stats' ), |
---|
| 214 | 'U_FAQ'=>add_session_id($link_start.'help' ), |
---|
| 215 | 'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php') |
---|
| 216 | )); |
---|
| 217 | |
---|
| 218 | //--------------------------------------------------------------------- summary |
---|
| 219 | $link_start = PHPWG_ROOT_PATH.'admin.php?page='; |
---|
[217] | 220 | //------------------------------------------------------------- content display |
---|
| 221 | if ( $page_valide ) |
---|
| 222 | { |
---|
[393] | 223 | if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php'); |
---|
| 224 | else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' ); |
---|
[217] | 225 | } |
---|
| 226 | else |
---|
| 227 | { |
---|
[393] | 228 | $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') ); |
---|
[217] | 229 | } |
---|
[393] | 230 | $template->pparse('admin'); |
---|
| 231 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[362] | 232 | ?> |
---|