3 * This function is beign used to load info that's needed for the settings page.
4 * check if the person who wants to view this page is a mod/admin or the user to whom te settings belong himself, if this is not the case, he will be redirected to an error page.
5 * it will return a lot of information of that user, that's being used for loading the template.
6 * @author Daan Janssens, mentored by Matthew Lagoe
9 if(WebUsers
::isLoggedIn()){
10 //in case id-GET param set it's value as target_id, if no id-param is given, ue the session id.
11 if(isset($_GET['id'])){
12 if(($_GET['id'] != $_SESSION['id']) && (!Ticket_User
::isMod(unserialize($_SESSION['ticket_user']))) ){
14 $_SESSION['error_code'] = "403";
15 header("Cache-Control: max-age=1");
16 header("Location: index.php?page=error");
17 throw new SystemExit();
19 $webUser = new Webusers($_GET['id']);
20 $result = $webUser->getInfo();
21 if(Ticket_User
::isMod(unserialize($_SESSION['ticket_user'])) && ($_GET['id']!= $_SESSION['id'])){
22 $result['changesOther'] = "TRUE";
24 $result['target_id'] = $_GET['id'];
25 $result['current_mail'] = $webUser->getEmail();
26 $result['target_username'] = $webUser->getUsername();
29 $webUser = new Webusers($_SESSION['id']);
30 $result = $webUser->getInfo();
31 $result['target_id'] = $_SESSION['id'];
32 $result['current_mail'] = $webUser->getEmail();
33 $result['target_username'] = $webUser->getUsername();
37 $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL
);
38 $result['target_username'] = filter_var($result['target_username'], FILTER_SANITIZE_STRING
);
39 $result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING
);
40 $result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING
);
41 $result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING
);
42 $result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT
);
43 $result['ReceiveMail'] = filter_var($result['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT
);
44 $result['country_array'] = getCountryArray();
45 global $INGAME_WEBPATH;
46 $result['ingame_webpath'] = $INGAME_WEBPATH;
49 $dbl = new DBLayer("lib");
50 $statement = $dbl->executeWithoutParams("SELECT * FROM settings");
51 $rows = $statement->fetchAll();
53 foreach ($rows as &$value) {
54 $result[$value['Setting']] = $value['Value'];
59 //ERROR: not logged in!
60 header("Location: index.php");
61 header("Cache-Control: max-age=1");
62 throw new SystemExit();
67 function getCountryArray(){
70 'AA'=>'None Selected',
74 'AS'=>'American Samoa',
79 'AG'=>'Antigua And Barbuda',
97 'BA'=>'Bosnia And Herzegovina',
99 'BV'=>'Bouvet Island',
101 'IO'=>'British Indian Ocean Territory',
104 'BF'=>'Burkina Faso',
110 'KY'=>'Cayman Islands',
111 'CF'=>'Central African Republic',
115 'CX'=>'Christmas Island',
116 'CC'=>'Cocos (Keeling) Islands',
120 'CK'=>'Cook Islands',
122 'CI'=>'Cote D\'Ivorie (Ivory Coast)',
123 'HR'=>'Croatia (Hrvatska)',
126 'CZ'=>'Czech Republic',
127 'CD'=>'Democratic Republic Of Congo (Zaire)',
131 'DO'=>'Dominican Republic',
136 'GQ'=>'Equatorial Guinea',
140 'FK'=>'Falkland Islands (Malvinas)',
141 'FO'=>'Faroe Islands',
145 'FX'=>'France, Metropolitan',
146 'GF'=>'French Guinea',
147 'PF'=>'French Polynesia',
148 'TF'=>'French Southern Territories',
162 'GW'=>'Guinea-Bissau',
165 'HM'=>'Heard And McDonald Islands',
191 'LI'=>'Liechtenstein',
202 'MH'=>'Marshall Islands',
215 'MM'=>'Myanmar (Burma)',
220 'AN'=>'Netherlands Antilles',
221 'NC'=>'New Caledonia',
227 'NF'=>'Norfolk Island',
229 'MP'=>'Northern Mariana Islands',
235 'PG'=>'Papua New Guinea',
248 'SH'=>'Saint Helena',
249 'KN'=>'Saint Kitts And Nevis',
251 'PM'=>'Saint Pierre And Miquelon',
252 'VC'=>'Saint Vincent And The Grenadines',
254 'ST'=>'Sao Tome And Principe',
255 'SA'=>'Saudi Arabia',
258 'SL'=>'Sierra Leone',
260 'SK'=>'Slovak Republic',
262 'SB'=>'Solomon Islands',
264 'ZA'=>'South Africa',
265 'GS'=>'South Georgia And South Sandwich Islands',
271 'SJ'=>'Svalbard And Jan Mayen',
283 'TT'=>'Trinidad And Tobago',
286 'TM'=>'Turkmenistan',
287 'TC'=>'Turks And Caicos Islands',
291 'AE'=>'United Arab Emirates',
292 'UK'=>'United Kingdom',
293 'US'=>'United States',
294 'UM'=>'United States Minor Outlying Islands',
298 'VA'=>'Vatican City (Holy See)',
301 'VG'=>'Virgin Islands (British)',
302 'VI'=>'Virgin Islands (US)',
303 'WF'=>'Wallis And Futuna Islands',
304 'EH'=>'Western Sahara',
305 'WS'=>'Western Samoa',