function Incoming_addatter() { $checkfleet = array("jaeger" => "Jäger", "bomber" => "Bomber", "fregatten" => "Fregatten", "zerstoerer" => "Zerstörer", "kreuzer" => "Kreuzer", "schlachter" => "Schlachter", "traeger" => "Träger", "kleptoren" => "Kleptoren", "cancris" => "Cancris", "prec" => "Scangenauigkeit", "svs" => "Scanverstärker"); if ($_SESSION['steps']['addatter']) { unset($_SESSION['steps']['addatter']); $this->forms['information']['url'] = $this->backtracking->backlink(); $this->forms['information']['action'] = ""; $this->forms['information']['title'] = "Incoming melden"; $this->forms['information']['message'] = "Inc eingetragen"; $this->forms['information']['style'] = "green"; $this->show('message_information', "Incoming melden"); } $form = new formContainer(); foreach ($checkfleet as $key => $value) { $form->add(new formInput($key, $value, "numeric", true, 20, true)); } $form->add(new formInput("gala", "Zielgalaxie", "numeric", true, 20)); $form->add(new formInput("pos", "Zielposition", "numeric", true, 20)); $form->add(new formInput("agala", "Angreifergalaxie", "numeric", true, 20)); $form->add(new formInput("apos", "Angreiferposition", "numeric", true, 20)); $form->add(new formInput("time", "ETA bis zur Ankunft", "string", true, 255)); $form->add(new formSelectBox("fleet", "Flottennummer", "numeric", array(array("title" => "Flotte 1", "value" => "1"), array("title" => "Flotte 2", "value" => "2")), false)); if ($_POST['send']) { $form->submit(); if (!$form->hasErrors() && strlen($form->get("time"))) { $time = $form->get("time"); if (preg_match("/^(\\d+?):(\\d+?)\$/i", $time, $result)) { $eta = $result[1] * 60 + $result[2]; } elseif (is_numeric($time)) { $eta = $time; } else { $form->setError("time"); $form->addError("ETA: Ungültige Zeit"); } } $tgala = $form->get("gala"); $tpos = $form->get("pos"); $gala = $form->get("agala"); $pos = $form->get("apos"); $fleetnum = $form->get("fleet"); #user existiert nicht if (!$form->hasErrors() && !($user = user_get_bypos($tgala, $tpos))) { $form->setError(array("gala", "pos")); $form->adderror("User existiert nicht"); } if (!$form->hasErrors() && ($user = user_get_bypos($gala, $pos))) { $form->setError(array("agala", "apos")); $form->adderror("Angreifer ist Metamitglied!"); } foreach ($checkfleet as $key => $item) { if (strlen($form->get($key)) > 0) { if (isset($fleetdata)) { $fleetdata = array(); } $fleetdata[$key] = $form->get($key); } } if (!$form->hasErrors() && (!$form->get("fleet") && $fleetdata)) { $form->adderror("Flottendaten ohne Flottennummer ist nicht zulässig!"); $form->setError("fleet"); } if (!$form->hasErrors() && count(fleetstatus_get_bykoords($gala, $pos)) == 2) { $form->adderror("Es sind bereits 2 Flotten von {$gala}:{$pos} eingetragen"); $form->setError("fleet"); } if (!$form->hasErrors() && $fleetnum && ($info = fleetstatus_get_bykoords($gala, $pos, $fleetnum))) { $form->adderror("Angreifer bereits eingetragen: attet (" . $info['tgala'] . ":" . $info['tpos'] . ")"); $form->setError("fleet"); $form->setError("agala"); $form->setError("apos"); } if (!$form->hasErrors()) { atter_add($form->get("agala"), $form->get("apos"), $form->get("gala"), $form->get("pos"), $form->get("fleet"), $eta, $fleetdata); $_SESSION['steps']['addatter'] = 1; $this->_header("takscreen.php?action=addatter&send"); } } $form->registerVars($this->template); $this->show('takscreen_atter_add', "Incoming melden"); }
/** * @return unknown * @param $nick unknown * @param $password unknown * @param $email unknown * @param $phone unknown * @param $koords unknown * @desc Enter description here... */ function addUser($nick, $login, $password, $gid, $gala, $pos, $ircauth) { Assert::isNumeric($gid); Assert::isId($gala); Assert::isId($pos); $nick = mysql_real_escape_string($nick); $login = mysql_real_escape_string($login); $ircauth = mysql_real_escape_string($ircauth); $user = insertsql("insert into user (nick,login,password,gid,gala,pos,changepw,ircauth) values ('{$nick}','{$login}','" . md5($password) . "',{$gid},{$gala},{$pos},1,'{$ircauth}')"); for ($i = 0; $i < 3; $i++) { if ($i > 0) { $status = fleetstatus_get_bykoords($gala, $pos, $i); } if ($status['fid']) { $fid = $status['fid']; } else { $fid = fleet_add(); } insertsql("insert into user_fleet (gala,pos,fid,fleetnum) values ({$gala},{$pos},{$fid},{$i})"); } $position = getScan(array("gala" => $gala, "pos" => $pos)); if ($position) { scan_update_nick($gala, $pos, $nick); } else { scan_add($gala, $pos, array("nick" => $nick)); } return $user; }
/** * �ndert die Nummer der Flotte beim Flottenstatus. * * Dabei wird beachtet, ob es bereits einen Eintrag f�r die Nummer gibt, und ob es sich * um eine interne Flotte handelt. ggf. werden die Flottendaten vertauscht. * * @param (int|array) $fsid flottenstatus id * @param int $fleetnum neue Flottennummer */ function fleetstatus_change_fleetnum($fsid, $fleetnum) { if (is_array($fsid)) { $fsid = $fsid['fsid']; } if (!is_numeric($fsid)) { return false; } $status = fleetstatus_get($fsid); if ($status['fleetnum'] != $fleetnum) { $check = fleetstatus_get_bykoords($status['gala'], $status['pos'], $fleetnum); if ($check) { // es existiert ein anderer eintrag mit der flottennummer, flottendaten/nummern werden vertauscht fleetstatus_update($check['fsid'], array("fleetnum" => $status['fleetnum'], "fid" => $status['fid'])); $fid = $check['fid']; } else { // kein anderer eintrag da, check obs ne interne flotte is if ($user = user_fleet_get($status['gala'], $status['pos'], $fleetnum)) { // flottendaten der internen flotte werden geladen $fid = $user['fid']; } else { // is eine externe // flottendaten bleiben erhalten $fid = $status['fid']; } } #_dump("fsid: $fsid, fleetnum: $fleetnum,fid: $fid <br>"); fleetstatus_update($fsid, array("fleetnum" => $fleetnum, "fid" => $fid)); } }