/** * API::API_UpdatePrices() * Using EVE Marketdata for now only. * @return */ function API_UpdatePrices($args) { if ($args <= 999999) { $args = 10000002; //Default to Jita(The Forge) } $url = "http://eve-marketdata.com/api/item_prices.xml?type_ids=44,3683,3689,9832,9848,16274,17889,17887,17888,16273,16272,4247,4051,4312,4246®ion_ids=" . $args; $xml = $this->API_Connect2($url); if (!$xml) { return false; } $fail = 0; $time = time(); $dbconn =& DBGetConn(true); $count = 0; foreach ($xml->xpath('//price') as $row) { $sql = "UPDATE " . TBL_PREFIX . "prices\n SET Value = '" . Eve::VarPrepForStore($row) . "'\n WHERE typeID = '" . Eve::VarPrepForStore($row['id']) . "'"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { Eve::SessionSetVar('errormsg', 'Could not update prices! ; ' . $dbconn->ErrorMsg()); return false; } $count = $count + 1; } return $count; }
function AddNewMoonMaterial($args) { if (!$args) { Eve::SessionSetVar('errormsg', 'No Arguments!'); return false; } $userinfo = POSMGMT::GetUserInfo(); $characterID = $userinfo['eve_id']; $dbconn =& DBGetConn(true); $sql = "INSERT INTO " . TBL_PREFIX . "moonmaterials (moonID,\n material_id,\n abundance,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t notes,\n taken,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t characterID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t datetime)\n VALUES ('" . Eve::VarPrepForStore($args['moonID']) . "',\n '" . Eve::VarPrepForStore($args['material_id']) . "',\n '" . Eve::VarPrepForStore($args['abundance']) . "',\n '" . Eve::VarPrepForStore($args['notes']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t '" . Eve::VarPrepForStore($args['taken']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t '" . Eve::VarPrepForStore($characterID) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t '" . Eve::VarPrepForStore(time()) . "')"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { Eve::SessionSetVar('errormsg', $dbconn->ErrorMsg() . $sql); return false; } return true; }
$eveRender->Assign('IS_IGB', false); } $eveRender->Assign('done', true); $eveRender->Display('install/install.tpl'); exit; } elseif ($step == 3) { $name = $eve->VarCleanFromInput('name'); $pass = $eve->VarCleanFromInput('pass'); $email = $eve->VarCleanFromInput('email'); if (empty($pass) || empty($email)) { $eve->SessionSetVar('errormsg', 'Please fill all the fields of the form!'); $eve->RedirectUrl('install.php?step=2'); } $time = time(); $dbhash = $posmgmt->newpasswordhash($pass); $sql = "INSERT INTO " . TBL_PREFIX . "user\n SET eve_id = '1',\n name = '" . $eve->VarPrepForStore('Admin') . "',\n pass = '******',\n email = '" . $eve->VarPrepForStore($email) . "',\n access = '5',\n datetime = '" . $eve->VarPrepForStore($time) . "'"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { $eve->SessionSetVar('errormsg', $dbconn->ErrorMsg() . '<br />' . $query); $eve->RedirectUrl('install.php?step=2'); } $eve->SessionSetVar('statusmsg', 'Admin Registered'); $eve->RedirectUrl('install.php?step=4'); } elseif ($step == 4) { $regions = $posmgmt->GetAllRegions(); $regionID = $eve->VarCleanFromInput('regionID'); $do = $eve->VarCleanFromInput('do'); if ($do) { echo $do(); exit; }
$eveRender->Assign('action', 'getuserinfo'); $eveRender->Display('register.tpl'); exit; } if ($allianceID = 0 || empty($allianceName)) { unset($allianceID); unset($allianceName); } $time = time(); //Password Hash $password = $posmgmt->newpasswordhash($pass); //New Password hashing method // Is a User with the same characterID already registered? $sql = "SELECT * FROM " . TBL_PREFIX . "user WHERE eve_id = " . $characterID; $result = mysql_query($sql) or die('Could not look for already existing User;' . mysql_error()); if (mysql_num_rows($result) != 0) { // Update Userinfo $sql = "UPDATE " . TBL_PREFIX . "user\n\t\t\tSET name = '" . $eve->VarPrepForStore($charname) . "',\n\t\t\t pass = '******',\n\t\t\t corp = '" . $eve->VarPrepForStore($corporationName) . "',\n\t\t\t email= '" . $eve->VarPrepForStore($email) . "',\n\t\t\t alliance_id = '" . $eve->VarPrepForStore($allianceID) . "',\n\t\t\t datetime = '" . $time . "'\n\t\t\tWHERE eve_id = " . $characterID; $result = mysql_query($sql) or die('Could not update user;' . mysql_error()); $eve->SessionSetVar('errormsg', 'You are already registered! updating Userinfo for ' . $charname . '!'); $eve->RedirectUrl('login.php'); } // Create new User. $sql = "INSERT INTO " . TBL_PREFIX . "user (`eve_id`, `name`, `pass`, `corp`, `alliance_id`, `email`, `access`, `datetime`)\n\t\tVALUES (\n\t\t\t'" . $eve->VarPrepForStore($characterID) . "',\n\t\t\t'" . $eve->VarPrepForStore($charname) . "',\n\t\t\t'" . $eve->VarPrepForStore($password) . "',\n\t\t\t'" . $eve->VarPrepForStore($corporationName) . "',\n\t\t\t'" . $eve->VarPrepForStore($allianceID) . "',\n\t\t\t'" . $eve->VarPrepForStore($email) . "',\n\t\t\t0,\n\t\t\t'" . $time . "')"; $result = mysql_query($sql) or die('Could not create user;' . mysql_error()); $eve->SessionSetVar('statusmsg', 'User Created - Welcome ' . $charname); $eve->RedirectUrl('login.php'); } } } $eveRender->Display('register.tpl');
$dbconn =& DBGetConn(true); foreach ($structs as $struct) { $structvalue = $eve->VarCleanFromInput('s_id' . $struct['id']); if ($structvalue != 0) { for ($x = 1; $x <= $structvalue; $x++) { $structures[] = $struct['id']; } } } $n = count($structures); foreach ($structures as $struc) { $s_id = $struc; //$_POST['s_id' . $n]; if ($s_id >= "1") { $nextId = $dbconn->GenId(TBL_PREFIX . 'pos_structures'); $sql = "INSERT INTO " . TBL_PREFIX . "pos_structures VALUES ('" . $eve->VarPrepForStore($nextId) . "', '" . $eve->VarPrepForStore((int) $pos_id) . "', '" . $eve->VarPrepForStore($s_id) . "', 1)"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { echo 'That doesnt work; ' . $dbconn->ErrorMsg(); return false; } $newId = $dbconn->PO_Insert_ID(TBL_PREFIX . 'pos_structures', 'id'); $time = time(); if ($s_id == 17621) { $hangar_id = $newId; //mysql_insert_id(); $sql = "INSERT INTO " . TBL_PREFIX . "pos_hanger VALUES ('{$hangar_id}','" . $pos_id . "','0','0','0','0','0','0','0','0','0','0')"; mysql_query($sql); $sql = "INSERT INTO " . TBL_PREFIX . "update_log VALUES ('NULL', '" . $eve->VarPrepForStore($eve_id) . "', '" . $eve->VarPrepForStore($hangar_id) . "', '3', 'Add Hanger', '" . $time . "')"; $result = mysql_query($sql) or die('Could not insert values into update_log; ' . mysql_error()); }
/** * POSMGMT::ModuleDelVar() * * @param string $modname * @param string $name * @return */ function ModuleDelVar($modname = '', $name = '') { $modname = isset($modname) ? (string) $modname : ''; $name = isset($name) ? (string) $name : ''; if (empty($name) || empty($modname)) { return false; } $dbconn =& DBGetConn(true); if (isset($GLOBALS['modconfig'][$modname][$name])) { unset($GLOBALS['modconfig'][$modname][$name]); } $sql = "DELETE FROM " . TBL_PREFIX . "module_vars\n WHERE name = '" . Eve::VarPrepForStore($name) . "'\n AND modname = '" . Eve::VarPrepForStore($modname) . "'"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { Eve::SessionSetVar('errormsg', $dbconn->ErrorMsg() . $sql); return false; } return true; }
function UpdateSiloAmount($args) { global $eve; if (!isset($args['structure_id']) || !is_numeric($args['structure_id'])) { return false; } if (!isset($args['new_amount']) || !is_numeric($args['new_amount'])) { return false; } $dbconn =& DBGetConn(true); $sql = "UPDATE " . TBL_PREFIX . "silo_info SET material_ammount = '" . Eve::VarPrepForStore($args['new_amount']) . "' WHERE silo_id = '" . Eve::VarPrepForStore($args['structure_id']) . "'"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { echo $dbconn->ErrorMsg() . $sql; return false; } $time = time(); $sql = "INSERT INTO " . TBL_PREFIX . "update_log VALUES ('NULL', '1', '" . Eve::VarPrepForStore($args['structure_id']) . "', '2', 'Update Silo', '" . Eve::VarPrepForStore($time) . "')"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { echo $dbconn->ErrorMsg() . $sql; return false; } $filter_regionID = $eve->VarCleanFromInput('filter_regionID'); $filter_systemID = $eve->VarCleanFromInput('filter_systemID'); $filter_pos_id = $eve->VarCleanFromInput('filter_pos_id'); $url = 'production.php'; //if ($filter_systemID || $filter_regionID) { $eve->RedirectUrl('production.php?filter_regionID=' . $filter_regionID . '&filter_systemID=' . $filter_systemID . '&filter_pos_id=' . $filter_pos_id); }