[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-09-20 20:08:15 +0000 (Mon, 20 Sep 2004) $ |
---|
| 10 | // | last modifier : $Author: z0rglub $ |
---|
| 11 | // | revision : $Revision: 528 $ |
---|
| 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': |
---|
| 45 | /* if ( !is_numeric( $_GET['user_id'] ) ) $_GET['user_id'] = -1; |
---|
[217] | 46 | $query = 'SELECT status,username'; |
---|
[364] | 47 | $query.= ' FROM '.USERS_TABLE; |
---|
[217] | 48 | $query.= ' WHERE id = '.$_GET['user_id']; |
---|
| 49 | $query.= ';'; |
---|
| 50 | $result = mysql_query( $query ); |
---|
| 51 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 52 | { |
---|
| 53 | $row = mysql_fetch_array( $result ); |
---|
| 54 | $page['user_status'] = $row['status']; |
---|
| 55 | if ( $row['username'] == 'guest' ) $row['username'] = $lang['guest']; |
---|
| 56 | $page['user_username'] = $row['username']; |
---|
| 57 | $page_valide = true; |
---|
| 58 | $title = $lang['title_user_perm'].' "'.$page['user_username'].'"'; |
---|
| 59 | } |
---|
| 60 | else |
---|
| 61 | { |
---|
| 62 | $page_valide = false; |
---|
[393] | 63 | }*/ |
---|
| 64 | $title = $lang['title_user_perm']; |
---|
| 65 | //.' '.$_POST['username']; |
---|
| 66 | $page_valide = true; break; |
---|
[217] | 67 | case 'group_list' : |
---|
| 68 | $title = $lang['title_groups']; $page_valide = true; break; |
---|
| 69 | case 'group_perm' : |
---|
| 70 | if ( !is_numeric( $_GET['group_id'] ) ) $_GET['group_id'] = -1; |
---|
[393] | 71 | $query = 'SELECT name FROM '.GROUPS_TABLE; |
---|
[217] | 72 | $query.= ' WHERE id = '.$_GET['group_id']; |
---|
| 73 | $query.= ';'; |
---|
| 74 | $result = mysql_query( $query ); |
---|
| 75 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 76 | { |
---|
| 77 | $row = mysql_fetch_array( $result ); |
---|
| 78 | $title = $lang['title_group_perm'].' "'.$row['name'].'"'; |
---|
| 79 | $page_valide = true; |
---|
| 80 | } |
---|
| 81 | else |
---|
| 82 | { |
---|
| 83 | $page_valide = false; |
---|
| 84 | } |
---|
| 85 | break; |
---|
| 86 | case 'stats': |
---|
| 87 | $title = $lang['title_history']; $page_valide = true; break; |
---|
| 88 | case 'update': |
---|
| 89 | $title = $lang['title_update']; $page_valide = true; break; |
---|
| 90 | case 'configuration': |
---|
| 91 | $title = $lang['title_configuration']; $page_valide = true; break; |
---|
[394] | 92 | case 'admin_phpinfo': |
---|
| 93 | $title = $lang['phpinfos']; $page_valide = true; break; |
---|
[217] | 94 | case 'help': |
---|
| 95 | $title = $lang['title_instructions']; $page_valide = true; break; |
---|
| 96 | case 'cat_perm': |
---|
| 97 | $title = $lang['title_cat_perm']; |
---|
| 98 | if ( isset( $_GET['cat_id'] ) ) |
---|
| 99 | { |
---|
| 100 | check_cat_id( $_GET['cat_id'] ); |
---|
| 101 | if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) |
---|
| 102 | { |
---|
| 103 | $result = get_cat_info( $page['cat'] ); |
---|
| 104 | $name = get_cat_display_name( $result['name'],' > ', '' ); |
---|
| 105 | $title.= ' "'.$name.'"'; |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | $page_valide = true; |
---|
| 109 | break; |
---|
| 110 | case 'cat_list': |
---|
| 111 | $title = $lang['title_categories']; $page_valide = true; break; |
---|
| 112 | case 'cat_modify': |
---|
| 113 | $title = $lang['title_edit_cat']; $page_valide = true; break; |
---|
[403] | 114 | case 'admin_upload': |
---|
| 115 | $title = $lang['upload']; $page_valide = true; break; |
---|
[217] | 116 | case 'infos_images': |
---|
| 117 | $title = $lang['title_info_images']; $page_valide = true; break; |
---|
| 118 | case 'waiting': |
---|
| 119 | $title = $lang['title_waiting']; $page_valide = true; break; |
---|
| 120 | case 'thumbnail': |
---|
| 121 | $title = $lang['title_thumbnails']; |
---|
| 122 | if ( isset( $_GET['dir'] ) ) |
---|
| 123 | { |
---|
[393] | 124 | $title.= ' '.$lang['title_thumbnails_2'].' <span class="titreImg">'; |
---|
[217] | 125 | // $_GET['dir'] contains : |
---|
[228] | 126 | // ./galleries/vieux_lyon ou |
---|
| 127 | // ./galleries/vieux_lyon/visite ou |
---|
| 128 | // ./galleries/vieux_lyon/visite/truc ... |
---|
[217] | 129 | $dir = explode( "/", $_GET['dir'] ); |
---|
| 130 | $title.= $dir[2]; |
---|
[393] | 131 | for ( $i = 2; $i < sizeof( $dir ) - 1; $i++ ) |
---|
[217] | 132 | { |
---|
[393] | 133 | $title.= ' > '.$dir[$i+1]; |
---|
[217] | 134 | } |
---|
| 135 | $title.= "</span>"; |
---|
| 136 | } |
---|
| 137 | $page_valide = true; |
---|
| 138 | break; |
---|
| 139 | case 'comments' : |
---|
| 140 | $title = $lang['title_comments']; |
---|
| 141 | $page_valide = true; |
---|
| 142 | break; |
---|
| 143 | case 'picture_modify' : |
---|
| 144 | $title = $lang['title_picmod']; |
---|
| 145 | $page_valide = true; |
---|
| 146 | break; |
---|
[526] | 147 | case 'remote_site' : |
---|
| 148 | { |
---|
| 149 | $title = $lang['remote_sites']; |
---|
| 150 | $page_valide = true; |
---|
| 151 | break; |
---|
| 152 | } |
---|
[217] | 153 | default: |
---|
| 154 | $title = $lang['title_default']; break; |
---|
| 155 | } |
---|
| 156 | if ( $title == '' ) $title = $lang['title_default']; |
---|
[393] | 157 | |
---|
[217] | 158 | // waiting |
---|
[393] | 159 | $query = 'SELECT id FROM '.WAITING_TABLE; |
---|
[217] | 160 | $query.= " WHERE validated='false'"; |
---|
| 161 | $query.= ';'; |
---|
| 162 | $result = mysql_query( $query ); |
---|
| 163 | $nb_waiting = ''; |
---|
| 164 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 165 | { |
---|
| 166 | $nb_waiting = ' [ '.mysql_num_rows( $result ).' ]'; |
---|
| 167 | } |
---|
| 168 | // comments |
---|
[393] | 169 | $query = 'SELECT id FROM '.COMMENTS_TABLE; |
---|
[217] | 170 | $query.= " WHERE validated='false'"; |
---|
| 171 | $query.= ';'; |
---|
| 172 | $result = mysql_query( $query ); |
---|
[393] | 173 | $nb_comments = ''; |
---|
[217] | 174 | if ( mysql_num_rows( $result ) > 0 ) |
---|
| 175 | { |
---|
[393] | 176 | $nb_comments = ' [ '.mysql_num_rows( $result ).' ]'; |
---|
[217] | 177 | } |
---|
[393] | 178 | |
---|
| 179 | $link_start = PHPWG_ROOT_PATH.'admin.php?page='; |
---|
| 180 | //----------------------------------------------------- template initialization |
---|
| 181 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
| 182 | $template->set_filenames( array('admin'=>'admin.tpl') ); |
---|
| 183 | |
---|
| 184 | $template->assign_vars(array( |
---|
[394] | 185 | 'L_TITLE'=>$lang['admin_panel'], |
---|
| 186 | 'L_LINKS'=>$lang['links'], |
---|
| 187 | 'L_GALLERY_INDEX'=>$lang['gallery_index'], |
---|
| 188 | 'L_GENERAL'=>$lang['general'], |
---|
| 189 | 'L_DEFAULT'=>$lang['gallery_default'], |
---|
| 190 | 'L_PHPINFO'=>$lang['phpinfos'], |
---|
| 191 | 'L_HISTORY'=>$lang['history'], |
---|
| 192 | 'L_FAQ'=>$lang['instructions'], |
---|
[527] | 193 | 'L_CONFIGURATION'=>$lang['config'], |
---|
| 194 | 'L_CONFIG_GENERAL'=>$lang['general'], |
---|
| 195 | 'L_CONFIG_COMMENTS'=>$lang['comments'], |
---|
| 196 | 'L_CONFIG_DISPLAY'=>$lang['conf_default'], |
---|
| 197 | 'L_CONFIG_UPLOAD'=>$lang['upload'], |
---|
| 198 | 'L_CONFIG_SESSION'=>$lang['conf_cookie'], |
---|
| 199 | 'L_CONFIG_METADATA'=>$lang['metadata'], |
---|
[528] | 200 | 'L_SITES'=>$lang['remote_sites'], |
---|
[394] | 201 | 'L_CATEGORIES'=>$lang['categories'], |
---|
| 202 | 'L_MANAGE'=>$lang['manage'], |
---|
| 203 | 'L_UPLOAD'=>$lang['upload'], |
---|
| 204 | 'L_IMAGES'=>$lang['pictures'], |
---|
| 205 | 'L_WAITING'=>$lang['waiting'].$nb_waiting, |
---|
| 206 | 'L_COMMENTS'=>$lang['comments'].$nb_comments, |
---|
| 207 | 'L_THUMBNAILS'=>$lang['thumbnails'], |
---|
| 208 | 'L_IDENTIFY'=>$lang['identification'], |
---|
| 209 | 'L_USERS'=>$lang['users'], |
---|
| 210 | 'L_GROUPS'=>$lang['groups'], |
---|
| 211 | 'L_AUTH'=>$lang['permissions'], |
---|
| 212 | 'L_UPDATE'=>$lang['update'], |
---|
| 213 | |
---|
[527] | 214 | 'U_CONFIG_GENERAL'=>add_session_id($link_start.'configuration&section=general' ), |
---|
| 215 | 'U_CONFIG_COMMENTS'=>add_session_id($link_start.'configuration&section=comments' ), |
---|
| 216 | 'U_CONFIG_DISPLAY'=>add_session_id($link_start.'configuration&section=default' ), |
---|
| 217 | 'U_CONFIG_UPLOAD'=>add_session_id($link_start.'configuration&section=upload' ), |
---|
| 218 | 'U_CONFIG_SESSION'=>add_session_id($link_start.'configuration&section=session' ), |
---|
| 219 | 'U_CONFIG_METADATA'=>add_session_id($link_start.'configuration&section=metadata' ), |
---|
[528] | 220 | 'U_SITES'=>add_session_id($link_start.'remote_site'), |
---|
[394] | 221 | 'U_PHPINFO'=>add_session_id($link_start.'admin_phpinfo' ), |
---|
[393] | 222 | 'U_USERS'=>add_session_id($link_start.'user_search' ), |
---|
| 223 | 'U_GROUPS'=>add_session_id($link_start.'group_list' ), |
---|
| 224 | 'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ), |
---|
[403] | 225 | 'U_UPLOAD'=>add_session_id($link_start.'admin_upload' ), |
---|
[393] | 226 | 'U_WAITING'=>add_session_id($link_start.'waiting' ), |
---|
| 227 | 'U_COMMENTS'=>add_session_id($link_start.'comments' ), |
---|
[394] | 228 | 'U_CAT_UPDATE'=>add_session_id($link_start.'update&update=cats' ), |
---|
| 229 | 'U_IMG_UPDATE'=>add_session_id($link_start.'update&update=all' ), |
---|
[393] | 230 | 'U_THUMBNAILS'=>add_session_id($link_start.'thumbnail' ), |
---|
| 231 | 'U_HISTORY'=>add_session_id($link_start.'stats' ), |
---|
| 232 | 'U_FAQ'=>add_session_id($link_start.'help' ), |
---|
| 233 | 'U_RETURN'=>add_session_id(PHPWG_ROOT_PATH.'category.php') |
---|
| 234 | )); |
---|
| 235 | |
---|
| 236 | //--------------------------------------------------------------------- summary |
---|
| 237 | $link_start = PHPWG_ROOT_PATH.'admin.php?page='; |
---|
[217] | 238 | //------------------------------------------------------------- content display |
---|
| 239 | if ( $page_valide ) |
---|
| 240 | { |
---|
[393] | 241 | if ($_GET['page']=='comments') include ( PHPWG_ROOT_PATH.'comments.php'); |
---|
| 242 | else include ( PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php' ); |
---|
[217] | 243 | } |
---|
| 244 | else |
---|
| 245 | { |
---|
[393] | 246 | $template->assign_vars(array ('ADMIN_CONTENT'=> '<div style="text-align:center">'.$lang['default_message'].'</div>') ); |
---|
[217] | 247 | } |
---|
[393] | 248 | $template->pparse('admin'); |
---|
| 249 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[362] | 250 | ?> |
---|