Code Search for Developers
 
 
  

admin.php from The Geronimo Project at Krugle


Show admin.php syntax highlighted

<?php 
define("VALID_PAGE", 1);
require(dirname(__FILE__) . "/includes/common.php");

// valid admin pages
$validpages = array('home','weapons','awards','roles','db','misc','icons');

// Valid fields 
$validfields = array('a');

globalize($validfields);
globalize(array('submit','cancel','themefile'));
if (get_magic_quotes_gpc()) {						// remove slashes from all valid variables
  foreach ($validfields as $field) {
    $$field = stripslashes($$field);
  }
}

// remove extra whitespace from all variables
foreach ($validfields as $field) {
  $$field = trim($$field);
}

if (empty($themefile) or !$conf['allowthemechange']) $themefile = 'admin';
if (empty($a) or !in_array($a, $validpages)) $a = 'home';

// If we're not logged in redirect the user to the login page, which will inturn redirect them back here after logging in
if (!user_logged_on()) {
  gotopage(URLROOT . "login.php?ref=" . urlencode($_SERVER['REQUEST_URI']));
}

// If the user clicked 'cancel' we'll redirect back to the previous page or index.php
if ($cancel) previouspage();

if (!is_numeric($plrid)) $plrid = $user['plrid'];
$iconlist = load_icons();
$errors = array();
$success = "";

// If the user is NOT an admin show FATAL ERROR
if (!user_is_admin()) {
  $smarty = new Theme($theme);
  $smarty->assign(array(
	'user_logged_on'	=> user_logged_on(),
	'errors'		=> array("fatal" => $lang->trans("You do not have permission to access this page")),
  ));
  $smarty->parse('admin_fatal.html');
  $smarty->showpage();
  include(DOCROOT . "/includes/footer.php");
  exit();
}


// ---------------------------------------------------------------------------------------------------------
// Load the table information so we can calculate how large the DB is
function gatherdata($extended=0) {
  global $data, $ps;
  $tables = $ps->table_status($conf['dbname']);
  $dbsize = 0;
  $datasize = 0;
  $indexsize = 0;
  $totalrecords = 0;
  foreach ($tables as $t) {
    $dbsize += doubleval($t['Data_length']) + doubleval($t['Index_length']);
    $datasize += doubleval($t['Data_length']);
    $indexsize += doubleval($t['Index_length']);
    $totalrecords += $t['Rows'];
  }
  $data['dbinfo']['tables'] 		= $tables;
  $data['dbinfo']['totalsize'] 		= $dbsize;
  $data['dbinfo']['totalrecords'] 	= $totalrecords;
  $data['dbinfo']['datasize'] 		= $datasize;
  $data['dbinfo']['indexsize'] 		= $indexsize;
  $data['dbinfo']['totaltables'] 	= count($tables);
  $data['dbinfo']['maxstatdate'] 	= $ps->max($ps->tblmapshistory, 'UNIX_TIMESTAMP(statdate)');
  $data['dbinfo']['minstatdate'] 	= $ps->min($ps->tblmapshistory, 'UNIX_TIMESTAMP(statdate)');
  $data['dbinfo']['statdatedays'] 	= $ps->count($ps->tblmapshistory, 'DISTINCT statdate');
  $data['dbinfo']['totalplayers']	= $ps->count($ps->tblplr);
  $data['dbinfo']['totalrankedplayers'] = $ps->count($ps->tblplr, '*', 'allowrank');

  if ($extended) {
    $data['dbinfo']['maxstatdate'] 		= $ps->max($ps->tblmapshistory, 'UNIX_TIMESTAMP(statdate)');
    $data['dbinfo']['minstatdate'] 		= $ps->min($ps->tblmapshistory, 'UNIX_TIMESTAMP(statdate)');
    $data['dbinfo']['statdatedays'] 		= $ps->count($ps->tblmapshistory, 'DISTINCT statdate');
    $data['dbinfo']['totalpasswords'] 		= $ps->count($ps->tblplrprofile, '*', "`password` != ''");
    $data['dbinfo']['totalusernames'] 		= $ps->count($ps->tblplrprofile, '*', "`username` != ''");
    $data['dbinfo']['totaladmins'] 		= $ps->count($ps->tblplrprofile, '*', "`accesslevel` >= " . ACL_ADMIN);
    $data['dbinfo']['totalclanadmins'] 		= $ps->count($ps->tblplrprofile, '*', "`accesslevel` >= " . ACL_CLANADMIN . " AND `accesslevel` < " . ACL_ADMIN);
    $data['dbinfo']['totalplrlogos'] 		= $ps->count($ps->tblplrprofile, '*', "`plrlogo` != ''");
    $data['dbinfo']['totalclanlogos'] 		= $ps->count($ps->tblclansprofile, '*', "`clanlogo` != ''");
  }
}
// ---------------------------------------------------------------------------------------------------------

// Load the theme and display it
$data = array(
	'adminpage'		=> $a,					// this will make the proper ADMIN page appear
	'a'			=> $a,
	'iconlist'		=> $iconlist,
	'errors'		=> $errors,
	'success'		=> $success,
);

$data['dbinfo'] = $ps->server_info();
$data['dbinfo']['dbname'] = $conf['dbname'];
$data['dbinfo']['dbhost'] = $conf['dbhost'];

//$adminfile = dirname(__FILE__) . DIRSLASH . "admin_$a.php";
$adminfile = "admin_$a.php";
if (file_exists(DOCROOT . $adminfile)) {
  include(DOCROOT . $adminfile);
} else {
  $errors['fatal'] = sprintf($lang->trans("Invalid admin file (%s) specified."), $a);
}

foreach ($validfields as $field) $data[$field] = $$field;		// insert variables into theme $data array
$smarty->assign($data);
$smarty->parse($themefile);
$smarty->showpage();

include(DOCROOT . "includes/footer.php");
?>




See more files for this project here

The Geronimo Project

The Geronimo project concists of two software :\n- Geronimo Hoshigo : a playable graphical user interface to play Go\n- Geronimo Margo : a artificial intelligence program which plays Go

Project homepage: http://sourceforge.net/projects/geronimo
Programming language(s): Java,Pascal,Perl,PHP
License: gpl2

  images/
    icons/
      andre.gif
      camp1.gif
      chick1.gif
      chuckskull.gif
      csmini.gif
      devl1.gif
      gun1.gif
      lambda.gif
      skull.gif
      smiley.gif
      splatt.gif
      tiki.gif
      v_1.gif
    weapons/
      large/
      cstrike_ak47.gif
      cstrike_aug.gif
      cstrike_awp.gif
      cstrike_deagle.gif
      cstrike_elite.gif
      cstrike_famas.gif
      cstrike_fiveseven.gif
      cstrike_g3sg1.gif
      cstrike_galil.gif
      cstrike_glock.gif
      cstrike_glock18.gif
      cstrike_grenade.gif
      cstrike_headshot.gif
      cstrike_hegrenade.gif
      cstrike_knife.gif
      cstrike_m249.gif
      cstrike_m3.gif
      cstrike_m4a1.gif
      cstrike_mac10.gif
      cstrike_mp5navy.gif
      cstrike_p228.gif
      cstrike_p90.gif
      cstrike_scout.gif
      cstrike_sg550.gif
      cstrike_sg552.gif
      cstrike_tank.gif
      cstrike_tmp.gif
      cstrike_train.gif
      cstrike_ump45.gif
      cstrike_usp.gif
      cstrike_xm1014.gif
      dod_30cal.gif
      dod_amerknife.gif
      dod_bar.gif
      dod_bayonet.gif
      dod_bazooka.gif
      dod_bren.gif
      dod_brit_knife.gif
      dod_colt.gif
      dod_enf_bayonet.gif
      dod_enfield.gif
      dod_fcarbine.gif
      dod_fg42.gif
      dod_garand.gif
      dod_garandbutt.gif
      dod_gerknife.gif
      dod_gewehr.gif
      dod_greasegun.gif
      dod_grenade.gif
      dod_grenade2.gif
      dod_k43.gif
      dod_kar.gif
      dod_luger.gif
      dod_m1carbine.gif
      dod_mg34.gif
      dod_mg42.gif
      dod_mills_bomb.gif
      dod_mortar.gif
      dod_mp40.gif
      dod_mp44.gif
      dod_piat.gif
      dod_pschreck.gif
      dod_scoped_enfield.gif
      dod_scoped_fg42.gif
      dod_scopedkar.gif
      dod_spade.gif
      dod_spring.gif
      dod_sten.gif
      dod_stick.gif
      dod_stickgrenade.gif
      dod_tank.gif
      dod_thompson.gif
      dod_webley.gif
      dod_world.gif
      ns_acidrocket.gif
      ns_bitegun.gif
      ns_charge.gif
      ns_claws.gif
      ns_devour.gif
      ns_divinewind.gif
      ns_grenade.gif
      ns_healingspray.gif
      ns_heavymachinegun.gif
      ns_knife.gif
      ns_leap.gif
      ns_machinegun.gif
      ns_offensechamber.gif
      ns_parasite.gif
      ns_pistol.gif
      ns_resourcetower.gif
      ns_shotgun.gif
      ns_siegeturret.gif
      ns_spikegun.gif
      ns_spitgunspit.gif
      ns_sporegunprojectile.gif
      ns_swipe.gif
      ns_team_advturretfactory.gif
      ns_team_turretfactory.gif
      ns_turret.gif
      ns_welder.gif
  includes/
    PQ/
    a.php
    adv_config.php
    class_PQ.php
    class_PS.php
    class_db.php
    class_session.php
    class_theme.php
    class_timer.php
    common.php
    footer.php
    functions.php
    locales.php
    panachart.README
    panachart.php
    pq_test.php
  smarty/
    core/
    plugins/
    Config_File.class.php
    Smarty.class.php
    Smarty_Compiler.class.php
    debug.tpl
  admin.php
  admin_awards.php
  admin_db.php
  admin_home.php
  admin_icons.php
  admin_misc.php
  admin_roles.php
  admin_weapons.php
  awards.php
  clan.php
  clanlist.php
  config.php
  editclan.php
  editplr.php
  imgplr.php
  imgserver.php
  imgskill.php
  index.php
  login.php
  logout.php
  map.php
  maplist.php
  motd.php
  player.php
  readme.txt
  server.php
  smalltopten.php
  techsupport.php
  testgd.php
  usersearch.php
  weapon.php
  weaponlist.php