Ejemplo n.º 1
0
 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");
 }
Ejemplo n.º 2
0
 function User_fleet_manuell()
 {
     $id = param_num("id");
     if ($id) {
         $user = getUserByID($id);
         if (!$user || $user['aid'] != $this->userdata['aid']) {
             $this->_header();
         }
         $this->template->assign("id", $id);
     } else {
         $id = $this->userdata['uid'];
     }
     $data = $_SESSION['steps'];
     #information message, step 2
     if ($data['fleetmanuell']) {
         #unset step
         unset($data['fleetmanuell']);
         $_SESSION['steps'] = $data;
         $this->forms['information']['url'] = $this->backtracking->backlink();
         $this->forms['information']['title'] = "Flotte updaten";
         $this->forms['information']['message'] = "Flotte aktualisiert";
         $this->forms['information']['style'] = "green";
         $this->show('message_information', "Flotte updaten");
     }
     $names = array("Jäger" => "jaeger", "Bomber" => "bomber", "Fregatten" => "fregatten", "Zerstörer" => "zerstoerer", "Kreuzer" => "kreuzer", "Schlachtschiffe" => "schlachter", "Träger" => "traeger", "Kleptoren" => "kleptoren", "Schutzschiffe" => "cancris");
     $fleets = user_fleet_list_byuser($id);
     $form = new formContainer();
     foreach ($names as $title => $name) {
         for ($i = 0; $i < 3; $i++) {
             $form->add(new formInput($name . $i, $title, "numeric"));
         }
     }
     if ($_POST['send'] && $_POST['next_x']) {
         $form->submit();
         if (!$form->hasErrors()) {
             $_result = array();
             foreach ($fleets as $fleet) {
                 foreach ($names as $title => $name) {
                     $_result[$fleet['fleetnum']][$name] = $form->get($name . $fleet['fleetnum']);
                 }
             }
             user_fleets_update($id, $_result);
             $_SESSION['steps']['fleetmanuell'] = 1;
             $this->_header("user.php?action=fleetmanuell&send");
         }
     } else {
         foreach ($fleets as $fleet) {
             $num = $fleet['fleetnum'];
             foreach ($names as $key => $name) {
                 $val =& $fleet[$name];
                 if ($val) {
                     $form->set($name . $num, $val);
                 } else {
                     $form->set($name . $num, 0);
                 }
             }
         }
     }
     #    $this->template->assign("errors",$errors);
     #    $this->template->assign("items",$items);
     $form->registerVars($this->template);
     $this->show("user_fleetupdate_manuell", "Flottenupdate");
 }
Ejemplo n.º 3
0
 function Attack_edit()
 {
     $attid = param_num("id");
     if (!$attid) {
         $this->_header();
     }
     $attplan = attack_get($attid);
     if (empty($attplan)) {
         $this->_header();
     }
     //rightcheck
     if ($this->userdata['uid'] != $attplan['owner'] && !$this->_checkUserRights("attorga")) {
         $this->_header();
     }
     if ($_SESSION['steps']['editattack']) {
         unset($_SESSION['steps']['editattack']);
         $this->forms['information']['action'] = "";
         $this->forms['information']['url'] = $this->backtracking->backlink();
         $this->forms['information']['title'] = "Angriffsplan bearbeiten";
         $this->forms['information']['message'] = "Daten wurden erfolgreich geändert!";
         $this->forms['information']['style'] = "green";
         $this->show('message_information', "Angriffsplan bearbeiten");
     }
     $form = new formContainer();
     $form->add(new formInput("title", "Titel", "string", true, 255));
     $form->add(new formInput("descr", "Beschreibung", "string", true, null, true));
     $form->add(new formInput("reserve_date", "Datum für die Reservierung", "date", false, 40, true, "'(\\d{1,2})\\.(\\d{1,2})\\.(\\d{2,4})'is"));
     $form->add(new formInput("reserve_time", "Startzeit für die Reservierung", "time", false, 40, true, "'(\\d{1,2}):(\\d{2})'is"));
     $form->add(new formRadio("hidden", "Plan verstecken", "numeric", array(1, 0)));
     if ($_POST['send']) {
         $form->submit();
         if (!$form->hasErrors()) {
             if ($form->get("reserve_date")) {
                 $date = $form->getregex("reserve_date");
                 $time = $form->getregex("reserve_time");
                 $reserve = mktime($time[1], $time[2], 0, $date[2], $date[1], $date[3]);
             }
             attack_edit($attid, $form->get("title"), $form->get("descr"), $reserve, $form->get("hidden"));
             $_SESSION['steps']['editattack'] = 1;
             $this->_header("attplan.php?action=edit&id={$attid}&send");
         }
     } else {
         $form->select("hidden", $attplan['hidden']);
         $form->set("title", $attplan['title']);
         $form->set("descr", $attplan['descr']);
         $form->set("reserve_date", date("d.m.Y", $attplan['access_time']));
         $form->set("reserve_time", date("H:i", $attplan['access_time']));
     }
     $form->registerVars(&$this->template);
     $this->template->assign("attplan", $attplan);
     $this->show("attplan_edit", "Attplaner");
 }
Ejemplo n.º 4
0
 function _listScans($option)
 {
     $gala = param_num("gala");
     $pos = param_num("pos");
     #scandetails
     if ($gala && $pos) {
         $this->scan_details($gala, $pos);
     }
     #scanlist
     $page = param_num("page", 1);
     $rows = 20;
     $link_options = array();
     if ($option == "targets") {
         $scanlistfilter =& $_SESSION['targetlistfilter'];
         $this->template->assign("showtargets", 1);
         $this->template->assign("scantitle", "Ziele suchen");
         #zielsuche
         if ($_REQUEST['subaction'] == 'newsearch' && $scanlistfilter) {
             unset($_SESSION['targetlistfilter']);
             unset($scanlistfilter);
         }
         /*      if ($_REQUEST['subaction'] == "search") {
                 $scanlistfilter['exen'] = param_num("exen");
                 $scanlistfilter['punkte'] = param_num("punkte");
               }
         			*/
         if (!$scanlistfilter || $_POST['subaction'] == "search") {
             $form = new formContainer();
             $form->add(new formInput("exen", "Exenmindestanzahl", "numeric", true, 10, true));
             $form->add(new formInput("macht", "Machtmindestwert", "numeric", true, 10, true));
             $form->add(new formCheckbox("hideold", "Alte Scans nicht berücksichtigen", "numeric", array(1), false));
             if ($_POST['send']) {
                 $form->submit();
                 if (!$form->hasErrors()) {
                     if ($form->get("macht")) {
                         $scanlistfilter['macht'] = $form->get("macht");
                     }
                     if ($form->get("exen")) {
                         $scanlistfilter['exen'] = $form->get("exen");
                     }
                     $scanlistfilter['sort'] = "exen";
                     $scanlistfilter['order'] = "desc";
                     $scanlistfilter['hassektor'] = "1";
                     $scanlistfilter['hideold'] = $form->get("hideold");
                     $scanlistfilter['except_galas'] = getGalaList(true);
                     $this->_header("scans.php?action=targets&send");
                 }
             } else {
                 $form->select("hideold", 1);
             }
             $form->registerVars($this->template);
             $this->show('scan_target_form', 'Ziele suchen');
         }
         #sortierung
         if ($_REQUEST['sort'] && $_REQUEST['order'] && $scanlistfilter) {
             $sort = trim($_REQUEST['sort']);
             $order = trim($_REQUEST['order']);
             if ($sort != 'koords' && $sort != 'exen') {
                 $sort = 'koords';
             }
             if ($order != "asc" && $order != "desc") {
                 $order = "asc";
             }
             $scanlistfilter['sort'] = $sort;
             $scanlistfilter['order'] = $order;
         }
         $link_options[] = "action=targets";
         $link2 = "?action=targets";
         #normale Scananzeige, galaweise
     } else {
         $scanlistfilter =& $_SESSION['scanlistfilter'];
         $this->template->assign("scantitle", "Scans");
         if (!$scanlistfilter) {
             $scanlistfilter['gala'] = 1;
             $scanlistfilter['sort'] = "koords";
             $scanlistfilter['order'] = "asc";
             $scanlistfilter['hideold'] = 1;
         }
         #alte einblenden/ausblenden
         if (isset($_REQUEST["hideold"]) && is_numeric($_REQUEST["hideold"])) {
             $scanlistfilter['hideold'] = $_REQUEST["hideold"];
         }
         $hideold = $scanlistfilter["hideold"];
         if ($hideold) {
             $title = "Alle Anzeigen";
             $subtitle = "Zeigt alle Scans an";
             $param = 0;
         } else {
             $title = "Alte Ausblenden";
             $subtitle = "Scans die älter als 1 Tag sind werden nicht angezeigt";
             $param = 1;
         }
         $this->template->assign("hideoldtitle", $title);
         $this->template->assign("hideoldparam", $param);
         $this->template->assign("hideoldsubtitle", $subtitle);
         #neue gala anzeigen
         if ($gala = param_num("gala")) {
             $scanlistfilter['gala'] = $gala;
         } else {
             $gala = $scanlistfilter["gala"];
         }
         if ($this->userdata["gid"] == 1) {
             $hideblock = false;
         } else {
             $hideblock = true;
         }
         $next = getNextGala($gala, $hideold, $hideblock);
         $prev = getPrevGala($gala, $hideold, $hideblock);
         if ($next && $prev) {
             #gala suche anzeigen
             $this->template->assign("showform", 1);
         }
         #zeigen beide auf die selbe, -> die aktuelle
         if ($next == $prev && $next == $gala) {
             unset($prev);
             unset($next);
         }
         $this->template->assign("prev", $prev);
         $this->template->assign("next", $next);
         #sortierung
         if ($_REQUEST['sort'] && $_REQUEST['order'] && $scanlistfilter) {
             $sort = trim($_REQUEST['sort']);
             $order = trim($_REQUEST['order']);
             if ($sort != 'koords' && $sort != 'exen') {
                 $sort = 'koords';
             }
             if ($order != "asc" && $order != "desc") {
                 $order = "asc";
             }
             $scanlistfilter['sort'] = $sort;
             $scanlistfilter['order'] = $order;
         }
         $link_options[] = "gala=" . $scanlistfilter['gala'];
     }
     #mili & news ausklappen
     $expand = param_num("expand");
     #scans holen
     $this->forms['scanlist'][$scanlistfilter['sort']][$scanlistfilter['order']] = '_active';
     $scanlist = listScans($scanlistfilter, &$pages, &$page, $rows);
     for ($i = 0; $i < count($scanlist); $i++) {
         $scanlist[$i]['backlink'] = "&backlink=" . urlencode("scans.php?" . join("&", $link_options) . "#" . $scanlist[$i]['sid']);
         $scanlist[$i]['expand_backlink'] = "&backlink=" . urlencode("scans.php?" . join("&", $link_options) . "&expand=" . $scanlist[$i]['sid'] . "#" . $scanlist[$i]['sid']);
         #mili oder news ausklappen
         if ($scanlist[$i]['sid'] == $expand) {
             $scanlist[$i]['expand'] = 1;
         }
         if ($scanlist[$i]['uid']) {
             if ($scanlist[$i]['uid'] == $this->userdata['uid']) {
                 $scanlist[$i]['atter_class'] = "green";
             } else {
                 $scanlist[$i]['atter_class'] = "red";
             }
         }
         $scanlist[$i] = scan_format($scanlist[$i]);
     }
     $this->forms['scanlist']['pages'] = showPageBar($page, $pages, "scans.php" . $link2, "page", "menu");
     $this->forms['scanlist']['gala'] = $scanlistfilter['gala'];
     $this->template->assign('scanlist', $scanlist);
     $this->template->assign('page', $page);
     $this->show('scan_list', 'Scans');
 }