} elseif ($exists and $input['overwrite']) { $ok = $ps->db->update($ps->t_config_overlays, $m, 'id', $exists); } else { // the map exists and overwrite is false $ignored[] = $m['map']; continue; } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } } if ($ignored) { $message = $cms->message('warning', array('message_title' => $cms->trans("Duplicate maps ignored"), 'message' => '<b>' . $cms->trans("The following maps were ignored since they exist already:") . '</b><br/>' . implode(', ', $ignored))); } if (!$form->has_errors() and !$message) { previouspage('overlays.php'); } } } else { // fill in defaults if ($id) { $form->input($overlay); } else { // default game:mod to currently configured values $form->input(array('gametype' => $ps->conf['main']['gametype'], 'modtype' => $ps->conf['main']['modtype'])); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Overlays', ps_url_wrapper('overlays.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie
if ($valid) { unset($input['blank'], $input['password2']); $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_logsources, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_logsources); // $input['idx'] = $ps->db->max($ps->t_config_logsources, 'idx') + 10; // last source $input['idx'] = 0; // first source $ok = $ps->db->insert($ps->t_config_logsources, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('logsources.php')); } /* $message = $cms->message('success', array( 'message_title' => $cms->trans("Update Successfull"), 'message' => $cms->trans("Log Source has been updated")) )); */ } } else { // fill in defaults if (!$test) { if ($id) { $form->input($log); if (empty($log['password'])) { $form->input['blank'] = 1;
include "../includes/common.php"; include "./common.php"; $cms->theme->assign('page', basename(__FILE__, '.php')); /* ct = conftype we're currently editing. Which can have multiple sections within it q = search query. if spcified, only conf variables that match will be displayed */ $validfields = array('submit', 'cancel', 'new', 'ct', 's', 'q', 'adv'); $cms->theme->assign_request_vars($validfields, true); $message = ''; $cms->theme->assign_by_ref('message', $message); if ($new) { gotopage(ps_url_wrapper(array('_amp' => '&', '_base' => 'var.php', 'ct' => $ct, 's' => $s))); } if ($cancel) { previouspage(ps_url_wrapper(array('_amp' => '&', '_base' => 'conf.php', 'ct' => $ct, 's' => $s))); } $where = ""; if ($q != '') { $_q = '%' . $ps->db->escape($q) . '%'; $where = "(var LIKE '{$_q}' OR label LIKE '{$_q}' OR help LIKE '{$_q}')"; } // get a list of conftype's available. Ignoring those that only have locked variables within them $list = $ps->db->fetch_rows(1, "SELECT conftype,section " . "FROM {$ps->t_config} " . "WHERE conftype <> 'info' AND locked <> 1 AND var IS NOT NULL " . ($where ? "AND {$where} " : "") . "GROUP BY conftype,section " . "HAVING COUNT(*) > 0 " . "ORDER BY conftype"); $sections = array(); foreach ($list as $c) { if (!$sections[$c['conftype']]) { $sections[$c['conftype']] = array(); } if ($c['section']) { $sections[$c['conftype']][] = $c['section'];
} unset($_u); } $valid = ($valid and !$form->has_errors()); if ($valid) { $ok = false; if ($id) { $ok = $u->update_user($input, $id); } else { $input['userid'] = $u->next_userid(); $ok = $u->insert_user($input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage('users.php'); } } } else { // fill in defaults if ($id) { $form->input($u->to_form_input()); } else { $form->set('accesslevel', $u->acl_user()); $form->set('confirmed', 1); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Users', ps_url_wrapper('users.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie
* * Version: $Id: themes.php 402 2008-04-21 14:55:05Z lifo $ */ define("PSYCHOSTATS_PAGE", true); include dirname(__FILE__) . "/includes/common.php"; $cms->init_theme($ps->conf['main']['theme'], $ps->conf['theme']); $ps->theme_setup($cms->theme); $cms->theme->page_title('PsychoStats - Theme Gallery'); // collect url parameters ... $validfields = array('t'); $cms->theme->assign_request_vars($validfields, true); $t = trim($t); $themes = $cms->theme->get_theme_list(); // update the user's theme if they selected one from the list if ($t) { if ($cms->theme->is_theme($t, true)) { $cms->session->opt('theme', $t); $cms->session->save_session_options(); } else { // report an error? // na... just silently ignore the language // trigger_error("Invalid theme specified!", E_USER_WARNING); } previouspage($PHP_SELF . "#" . ps_escape_html($t)); } // assign variables to the theme $cms->theme->assign(array('themes' => $themes, 'theme' => $cms->theme->theme)); // display the output $basename = basename(__FILE__, '.php'); //$cms->theme->add_js('js/themes.js'); $cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer');
if (empty($input['name'])) { $input['name'] = null; } if (empty($input['team'])) { $input['team'] = null; } if ($id) { $ok = $ps->db->update($ps->t_role, $input, 'roleid', $id); } else { $input['roleid'] = $ps->db->next_id($ps->t_role, 'roleid'); $ok = $ps->db->insert($ps->t_role, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('roles.php')); } } } else { // fill in defaults if ($id) { $form->input($role); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Roles', ps_url_wrapper('roles.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie // this will also be put into a 'hidden' field in the form if ($ps->conf['main']['security']['csrf_protection']) { $cms->session->key($form->key());
* it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * PsychoStats is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PsychoStats. If not, see <http://www.gnu.org/licenses/>. * * Version: $Id: logout.php 389 2008-04-18 15:04:10Z lifo $ */ define("PSYCHOSTATS_PAGE", true); define("PSYCHOSTATS_ADMIN_PAGE", true); define("PSYCHOSTATS_LOGOUT_PAGE", true); include "../includes/common.php"; include "./common.php"; $cms->theme->assign('page', basename(__FILE__, '.php')); $validfields = array('ref'); $cms->theme->assign_request_vars($validfields, true); // we don't want to actually log the user out of their session, just disable their ADMIN flag. if ($cms->user->admin_logged_in()) { $cms->session->is_admin(0); } previouspage(dirname(dirname($_SERVER['SCRIPT_NAME']))); // A page is never displayed for logout. Just redirect somewhere else. // display the output $basename = basename(__FILE__, '.php'); $cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer');
$input['port'] = null; } $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_servers, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_servers); $input['idx'] = $ps->db->max($ps->t_config_servers, 'idx') + 10; // last source // $input['idx'] = 0; // first source $ok = $ps->db->insert($ps->t_config_servers, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('servers.php')); } /* $message = $cms->message('success', array( 'message_title' => $cms->trans("Update Successfull"), 'message' => $cms->trans("Log Source has been updated")) )); */ } } else { // fill in defaults if (!$test) { if ($id) { $form->input($server); } else { // new servers should default to being enabled
if (!array_key_exists($k, $u)) { continue; } if ($plr_user->{$k}() != $u[$k]) { $changed = true; break; } } if ($changed) { $ok = $plr_user->update_user($u, $plr_user->userid()); } } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('players.php')); } } } else { // fill in defaults if ($id) { $plr['plrname'] = $plr['name']; $in = $plr; if ($plr_user->userid()) { $in = array_merge($in, $plr_user->to_form_input()); } else { $in['accesslevel'] = $plr_user->acl_user(); } $form->input($in); } else { // $form->set('accesslevel', $plr_user->acl_user());
if (empty($input['name'])) { $input['name'] = null; } if (empty($input['class'])) { $input['class'] = null; } if ($id) { $ok = $ps->db->update($ps->t_weapon, $input, 'weaponid', $id); } else { $input['weaponid'] = $ps->db->next_id($ps->t_weapon, 'weaponid'); $ok = $ps->db->insert($ps->t_weapon, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('weapons.php')); } } } else { // fill in defaults if ($id) { $form->input($weapon); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Weapons', ps_url_wrapper('weapons.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie // this will also be put into a 'hidden' field in the form if ($ps->conf['main']['security']['csrf_protection']) { $cms->session->key($form->key());
$locked = $input['locked'] ? 1 : 0; unset($input['locked']); $input['cc'] = strtoupper($input['cc']); if ($id) { $ok = $ps->db->update($ps->t_clan_profile, $input, 'clantag', $clan['clantag']); } else { $ok = $ps->db->insert($ps->t_clan_profile, $input); } // update 'locked' value, if changed if ($ok and $locked != $clan['locked']) { $ok = $ps->db->update($ps->t_clan, array('locked' => $locked), 'clantag', $clan['clantag']); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper(array('_amp' => '&', '_base' => 'clans.php'))); } } } else { // fill in defaults if ($id) { $clan['clanname'] = $clan['name']; $form->input($clan); } } // save a new form key in the users session cookie // this will also be put into a 'hidden' field in the form if ($ps->conf['main']['security']['csrf_protection']) { $cms->session->key($form->key()); } $allowed_html_tags = str_replace(',', ', ', $ps->conf['theme']['format']['allowed_html_tags']);
if ($input['modtype'] != '' and $input['gametype'] == '') { $form->error('gametype', $cms->trans("You must enter the game type")); } $valid = !$form->has_errors(); if ($valid) { $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_plrbonuses, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_plrbonuses); $ok = $ps->db->insert($ps->t_config_plrbonuses, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('bonuses.php')); } } } else { // fill in defaults if ($id) { $form->input($bonus); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Player Bonuses', ps_url_wrapper('bonuses.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie // this will also be put into a 'hidden' field in the form if ($ps->conf['main']['security']['csrf_protection']) { $cms->session->key($form->key());
} if ($valid) { $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_events, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_events); $input['idx'] = $ps->db->max($ps->t_config_events, 'idx') + 10; // last source // $input['idx'] = 0; // first source $ok = $ps->db->insert($ps->t_config_events, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('events.php')); } /* $message = $cms->message('success', array( 'message_title' => $cms->trans("Update Successfull"), 'message' => $cms->trans("Log Source has been updated")) )); */ } } else { // fill in defaults if ($id) { $form->input($event); } else { // new events should default to being enabled $form->input['ignore'] = 1;
$input['flipv'] = $input['flipv'] ? 1 : 0; $input['fliph'] = $input['fliph'] ? 1 : 0; $valid = !$form->has_errors(); if ($valid) { $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_overlays, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_overlays); $ok = $ps->db->insert($ps->t_config_overlays, $input); print $ps->db->lastcmd; } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('overlays.php')); } } } else { // fill in defaults if ($id) { $form->input($overlay); } else { // default game:mod to currently configured values $form->input(array('gametype' => $ps->conf['main']['gametype'], 'modtype' => $ps->conf['main']['modtype'])); } } $cms->crumb('Manage', ps_url_wrapper('manage.php')); $cms->crumb('Overlays', ps_url_wrapper('overlays.php')); $cms->crumb('Edit'); // save a new form key in the users session cookie
} if (!is_numeric($limit) || $limit < 0 || $limit > 500) { $limit = $DEFAULT_LIMIT; } $q = trim($q); // If a language is passed from GET/POST update the user's cookie. if (isset($cms->input['language'])) { if ($cms->theme->is_language($cms->input['language'])) { $cms->session->opt('language', $cms->input['language']); $cms->session->save_session_options(); } else { // report an error? // na... just silently ignore the language // trigger_error("Invalid theme specified!", E_USER_WARNING); } previouspage($PHP_SELF); } $total = array(); $results = array(); if ($q != '') { // a new search was requested (a query string was given) $search = $ps->init_search(); $matched = $ps->search_players($search, array('phrase' => $q, 'mode' => 'contains', 'status' => 'ranked')); $results = $ps->get_search($search); } else { if ($ps->is_search($search)) { // an existing search was requested (new page or sort) $results = $ps->get_search($search); } else { // no search, just fetch a list players $search = '';
if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } } else { $set = $input; $set['id'] = $ps->db->next_id($ps->t_config); if (strtolower($set['section']) == 'general') { $set['section'] = ''; } $ok = $ps->db->insert($ps->t_config, $set); if (!$ok) { $form->error('fatal', "Error inserting into database: " . $ps->db->errstr); } } if ($ok) { previouspage(ps_url_wrapper(array('_amp' => '&', '_base' => 'conf.php', 'ct' => $input['conftype'], 's' => $input['section']))); } } } else { if ($id) { foreach ($conf as $key => $v) { $form->input[$key] = $v; } } else { $form->input['conftype'] = $ct; $form->input['section'] = strtolower($s) == 'general' ? '' : $s; } } $cms->crumb("Config", ps_url_wrapper(array('_base' => 'conf.php', 'ct' => $ct))); $cms->crumb("Edit Option"); // save a new form key in the users session cookie
if (empty($input['gametype'])) { $input['gametype'] = null; } if (empty($input['modtype'])) { $input['modtype'] = null; } if ($id) { $ok = $ps->db->update($ps->t_config_awards, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_awards); $ok = $ps->db->insert($ps->t_config_awards, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('awards.php')); } } } else { // fill in defaults if ($id) { $form->input($award); } else { // new awards should default to being enabled $form->input['enabled'] = 1; $form->input['limit'] = 10; $form->input['order'] = 'desc'; $form->input['format'] = '%s'; $form->input['type'] = 'player'; } }
} if ($valid) { $ok = false; if ($id) { $ok = $ps->db->update($ps->t_config_clantags, $input, 'id', $id); } else { $input['id'] = $ps->db->next_id($ps->t_config_clantags); $input['idx'] = $ps->db->max($ps->t_config_clantags, 'idx') + 10; // last source // $input['idx'] = 0; // first source $ok = $ps->db->insert($ps->t_config_clantags, $input); } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); } else { previouspage(ps_url_wrapper('clantags.php')); } /* $message = $cms->message('success', array( 'message_title' => $cms->trans("Update Successfull"), 'message' => $cms->trans("Log Source has been updated")) )); */ } } else { // fill in defaults if (!$test) { if ($id) { $form->input($clantag); } }
if ($ok and $new) { foreach ($new as $a) { $ok = $ps->db->insert($ps->t_plr_aliases, array('id' => $ps->db->next_id($ps->t_plr_aliases, 'id'), 'uniqueid' => $input['uniqueid'], 'alias' => $a)); if (!$ok) { break; } } } if (!$ok) { $form->error('fatal', "Error updating database: " . $ps->db->errstr); $ps->db->rollback(); // cancel any changes made } else { $ps->db->commit(); // commit changes and stop transaction previouspage(ps_url_wrapper('aliases.php')); } /* $message = $cms->message('success', array( 'message_title' => $cms->trans("Update Successfull"), 'message' => $cms->trans("Aliases have been updated")) )); */ } } else { // fill in defaults if ($id) { $form->input($alias); } } $cms->crumb('Manage', ps_url_wrapper('manage.php'));
* (at your option) any later version. * * PsychoStats is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PsychoStats. If not, see <http://www.gnu.org/licenses/>. * * Version: $Id: logout.php 450 2008-05-20 11:34:52Z lifo $ */ define("PSYCHOSTATS_PAGE", true); include dirname(__FILE__) . "/includes/common.php"; $cms->init_theme($ps->conf['main']['theme'], $ps->conf['theme']); $ps->theme_setup($cms->theme); $validfields = array('ref'); $cms->theme->assign_request_vars($validfields, true); if (!$cms->user->logged_in()) { previouspage('index.php'); } $cms->session->online_status(0); // just redirect back to previous page //previouspage('index.php'); // assign variables to the theme $cms->theme->assign(array()); // display the output $basename = basename(__FILE__, '.php'); $cms->theme->add_css('css/forms.css'); $cms->theme->add_refresh($ref ? $ref : 'index.php'); $cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer');
$form->error('fatal', $cms->trans("User does not have permission to login")); $ps->errlog(sprintf("Failed login attempt for user '%s' (access denied) from IP [%s]", $input['username'], remote_addr())); $valid = false; } // If authenetication was valid then we'll set the users online flag and redirect to their previous page if (!$form->has_errors()) { // header("Cache-Control: no-cache, must-revalidate"); $cms->session->online_status(1, $u->userid()); if ($cms->input['autologin']) { $cms->session->save_login($u->userid(), $u->password()); } if (!empty($_REQUEST['ref']) and strpos($_REQUEST['ref'], 'loggedin') === false) { $_REQUEST['ref'] .= strpos($_REQUEST['ref'], '?') === false ? '?' : '&'; $_REQUEST['ref'] .= 'loggedin=1'; } previouspage(ps_url_wrapper('index.php')); } } //if ($ps->conf['main']['security']['csrf_protection']) $cms->session->key($form->key()); // assign variables to the theme $cms->theme->assign(array('errors' => $form->errors(), 'form' => $form->values(), 'form_key' => '')); // display the output $basename = basename(__FILE__, '.php'); $cms->theme->add_js('js/forms.js'); $cms->theme->add_css('css/forms.css'); $cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer'); // validator functions -------------------------------------------------------------------------- function user_exists($var, $value, &$form) { global $cms, $ps, $bad_pw_error; if (!$cms->user->username_exists($value)) {