Changeset 650
- Timestamp:
- Dec 20, 2004, 8:26:43 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r647 r650 331 331 // - all sessions linked to this user 332 332 // - all categories informations linked to this user 333 function delete_user( $user_id)333 function delete_user($user_id) 334 334 { 335 335 // destruction of the access linked to the user 336 $query = 'DELETE FROM '.PREFIX_TABLE.'user_access'; 337 $query.= ' WHERE user_id = '.$user_id; 338 $query.= ';'; 339 pwg_query( $query ); 336 $query = ' 337 DELETE FROM '.USER_ACCESS_TABLE.' 338 WHERE user_id = '.$user_id.' 339 ;'; 340 pwg_query($query); 340 341 341 342 // destruction of the group links for this user 342 $query = 'DELETE FROM '.PREFIX_TABLE.'user_group'; 343 $query.= ' WHERE user_id = '.$user_id; 344 $query.= ';'; 345 pwg_query( $query ); 343 $query = ' 344 DELETE FROM '.USER_GROUP_TABLE.' 345 WHERE user_id = '.$user_id.' 346 ;'; 347 pwg_query($query); 346 348 347 349 // destruction of the favorites associated with the user 348 $query = 'DELETE FROM '.PREFIX_TABLE.'favorites'; 349 $query.= ' WHERE user_id = '.$user_id; 350 $query.= ';'; 351 pwg_query( $query ); 350 $query = ' 351 DELETE FROM '.FAVORITES_TABLE.' 352 WHERE user_id = '.$user_id.' 353 ;'; 354 pwg_query($query); 352 355 353 356 // destruction of the sessions linked with the user 354 $query = 'DELETE FROM '.PREFIX_TABLE.'sessions'; 355 $query.= ' WHERE user_id = '.$user_id; 356 $query.= ';'; 357 pwg_query( $query ); 357 $query = ' 358 DELETE FROM '.SESSIONS_TABLE.' 359 WHERE user_id = '.$user_id.' 360 ;'; 361 pwg_query($query); 358 362 359 363 // destruction of the user 360 $query = 'DELETE FROM '.USERS_TABLE; 361 $query.= ' WHERE id = '.$user_id; 362 $query.= ';'; 363 pwg_query( $query ); 364 $query = ' 365 DELETE FROM '.USERS_TABLE.' 366 WHERE id = '.$user_id.' 367 ;'; 368 pwg_query($query); 364 369 } 365 370 -
trunk/admin/include/isadmin.inc.php
r593 r650 28 28 include( PHPWG_ROOT_PATH.'admin/include/functions.php' ); 29 29 30 $isadmin = true; 31 if ( $user['status'] != 'admin' ) 30 if ($user['status'] != 'admin') 32 31 { 33 32 echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />'; -
trunk/include/common.inc.php
r593 r650 26 26 // +-----------------------------------------------------------------------+ 27 27 28 if ( !defined("PHPWG_ROOT_PATH"))28 if (!defined('PHPWG_ROOT_PATH')) 29 29 { 30 die ("Hacking attempt!");30 die('Hacking attempt!'); 31 31 } 32 32 // determine the initial instant to indicate the generation time of this page … … 115 115 116 116 include(PHPWG_ROOT_PATH .'include/mysql.inc.php'); 117 if ( !defined("PHPWG_INSTALLED"))117 if (!defined('PHPWG_INSTALLED')) 118 118 { 119 header( 'Location: install.php');119 header('Location: install.php'); 120 120 exit; 121 121 } … … 126 126 include(PHPWG_ROOT_PATH . 'include/template.php'); 127 127 128 //129 128 // Database connection 130 //131 132 129 mysql_connect( $dbhost, $dbuser, $dbpasswd ) 133 130 or die ( "Could not connect to database server" ); … … 135 132 or die ( "Could not connect to database" ); 136 133 137 //138 // Obtain and encode users IP139 //140 if ( getenv( 'HTTP_X_FORWARDED_FOR' ) != '' )141 {142 $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ?143 $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );144 145 if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/",146 getenv('HTTP_X_FORWARDED_FOR'), $ip_list) )147 {148 $private_ip = array( '/^0\./'149 ,'/^127\.0\.0\.1/'150 ,'/^192\.168\..*/'151 ,'/^172\.16\..*/'152 ,'/^10.\.*/'153 ,'/^224.\.*/'154 ,'/^240.\.*/'155 );156 $client_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);157 }158 }159 else160 {161 $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ?162 $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );163 }164 $user_ip = encode_ip($client_ip);165 166 134 // 167 135 // Setup gallery wide options, if this fails then we output a CRITICAL_ERROR … … 172 140 FROM '.CONFIG_TABLE.' 173 141 ;'; 174 if ( !( $result = pwg_query( $query ) ))142 if (!($result = pwg_query($query))) 175 143 { 176 144 die("Could not query config information"); … … 195 163 } 196 164 197 //--------------- 198 // A partir d'ici il faudra dispatcher le code dans d'autres fichiers 199 //--------------- 200 201 include(PHPWG_ROOT_PATH . 'include/user.inc.php'); 165 include(PHPWG_ROOT_PATH.'include/user.inc.php'); 202 166 203 167 // displaying the username in the language of the connected user, instead of 204 168 // "guest" as you can find in the database 205 if ( $user['is_the_guest'] ) $user['username'] = $lang['guest']; 206 define('PREFIX_TABLE', $table_prefix); 169 if ($user['is_the_guest']) 170 { 171 $user['username'] = $lang['guest']; 172 } 207 173 ?> -
trunk/include/config.inc.php
r647 r650 159 159 $conf['info_nb_elements_page'] = 5; 160 160 161 // default_language : language used if language set in user database is not162 // available163 $conf['default_language'] = 'en_UK.iso-8859-1';164 165 161 // show_queries : for debug purpose, show queries and execution times 166 162 $conf['show_queries'] = false; -
trunk/include/functions_user.inc.php
r648 r650 172 172 } 173 173 174 //175 // Initialise user settings on page load176 function init_userprefs($userdata)177 {178 global $conf, $template, $lang, $lang_info;179 180 $language = (!empty($userdata['language']) && !$userdata['is_the_guest'] )?$userdata['language']:$conf['default_language'];181 182 if (!empty($userdata['template']) and !$userdata['is_the_guest'])183 {184 $template = $userdata['template'];185 }186 else187 {188 $template = $conf['default_template'];189 }190 191 if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language . '/common.lang.php')) )192 {193 $language = $conf['default_language'];194 }195 include_once(PHPWG_ROOT_PATH . 'language/' . $language . '/common.lang.php');196 197 198 if ($userdata['status'] == 'admin')199 {200 if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $language. '/admin.lang.php')) )201 {202 $language = $conf['default_language'];203 }204 include_once(PHPWG_ROOT_PATH . 'language/' . $language . '/admin.lang.php');205 include_once(PHPWG_ROOT_PATH . 'language/' . $language . '/faq.lang.php');206 }207 208 $template = setup_style($template);209 return;210 }211 212 174 function setup_style($style) 213 175 { … … 216 178 $template = new Template(PHPWG_ROOT_PATH . $template_path . $template_name); 217 179 return $template; 218 }219 220 function encode_ip($dotquad_ip)221 {222 $ip_sep = explode('.', $dotquad_ip);223 return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);224 }225 226 function decode_ip($int_ip)227 {228 $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));229 return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);230 180 } 231 181 -
trunk/include/user.inc.php
r648 r650 128 128 } 129 129 130 $isadmin = false;131 if ($user['status'] == 'admin')132 {133 $isadmin = true;134 }135 130 // calculation of the number of picture to display per page 136 131 $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; 137 132 138 init_userprefs($user); 133 if (empty($user['language']) 134 or !file_exists(PHPWG_ROOT_PATH.'language/'. 135 $user['language'].'/common.lang.php')) 136 { 137 $user['language'] = $conf['default_language']; 138 } 139 include_once(PHPWG_ROOT_PATH.'language/'.$user['language'].'/common.lang.php'); 140 141 // only if we are in the administration section 142 if (defined('IN_ADMIN') and IN_ADMIN) 143 { 144 $langdir = PHPWG_ROOT_PATH.'language/'.$user['language']; 145 if (!file_exists($langdir.'/admin.lang.php')) 146 { 147 $langdir = PHPWG_ROOT_PATH.'language/'.$conf['default_language']; 148 } 149 include_once($langdir.'/admin.lang.php'); 150 include_once($langdir.'/faq.lang.php'); 151 } 152 153 if (empty($user['template'])) 154 { 155 $user['template'] = $conf['default_template']; 156 } 157 $template = setup_style($user['template']); 139 158 ?>
Note: See TracChangeset
for help on using the changeset viewer.