Exemplo n.º 1
0
            $html .= '<form id=add_target name=add_target method=post action="' . edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false))) . '">';
            $html .= "<tr><td></td></tr>";
            $html .= "<tr><td><input type=text id=add_name name=add_name size=30 maxlength=30></td><td align=center><input type=radio name=add_type id=add_type value=0 checked></td><td align=center><input type=radio name=add_type id=add_type value=1></td><td align=center><input type=radio name=add_type id=add_type value=2></td><td align=center><input type=radio name=add_type id=add_type value=3></td><td align=center><input type=submit id=submit name=submit value=Add></td></tr>";
        }
        $html .= "</table>";
        $html .= "</form>";
    }
}
// add
if (edkURI::getArg('op') == "add") {
    if ($_POST['detail_submit']) {
        $contract = new Contract();
        $contract->add($_POST['ctr_name'], $_POST['ctr_started'], $_POST['ctr_ended'], $_POST['ctr_comment']);
        header("Location: " . htmlspecialchars_decode(edkuri::build(array(array('ctr_id', $contract->getID(), false), array('op', 'edit', false)))));
    }
    $page->setTitle("Administration - Add Campaign");
    $html .= "<div class=block-header2>Details</div>";
    $html .= '<form id=detail_edit name=detail_edit method=post action="' . edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'add', false))) . '">';
    $html .= "<table class=kb-table width=98%>";
    $html .= "<tr><td width=80><b>Name:</b></td><td><input type=text name=ctr_name id=ctr_name size=40 maxlength=40></td></tr>";
    $html .= "<tr><td width=80><b>Start date:</b></td><td><input type=text name=ctr_started id=ctr_started size=10 maxlength=10 value=\"" . kbdate("Y-m-d") . "\"> (yyyy-mm-dd)</td></tr>";
    $html .= "<tr><td width-80><b>End date:</b></td><td><input type=text name=ctr_ended id=ctr_ended size=10 maxlength=10> (yyyy-mm-dd or blank)</td></tr>";
    $html .= "<tr><td><b>Comment:</b></td><td><input type='text' name='ctr_comment' size='100'/></td></tr>";
    $html .= "<tr><td></td></tr>";
    $html .= "<tr><td></td><td><input type=submit name=detail_submit value=\"Save\"></td></tr>";
    $html .= "</table>";
    $html .= "</form>";
}
$page->addContext($menubox->generate());
$page->setContent($html);
$page->generate();
Exemplo n.º 2
0
/**
 *
 * @return string
 */
function getYear()
{
    if (config::get('show_monthly')) {
        return gmdate('Y');
    }
    $test = kbdate('o');
    if ($test == 'o') {
        $day = gmdate('j');
        $week = gmdate('W');
        if ($week == 1 && $day > 14) {
            return gmdate('Y') - 1;
        } else {
            if ($week > 50 && $day < 8) {
                return gmdate('Y') + 1;
            }
        }
        return gmdate('Y');
    }
    return $test;
}
Exemplo n.º 3
0
 /**
  * Add a comment to a kill.
  *
  * The kill id is set when the Comments object is constructed.
  * @param string $name The name of the comment poster.
  * @param string $text The text of the comment to post.
  */
 function addComment($name, $text)
 {
     $comment = $this->bbencode(trim($text));
     $name = trim($name);
     $qryP = new DBPreparedQuery();
     $sql = "INSERT INTO kb3_comments (`kll_id`,`site`, `comment`,`name`,`posttime`, `ip`)\n                       VALUES (?, ?, ?, ?, ?, ?)";
     $qryP->prepare($sql);
     $site = KB_SITE;
     $date = kbdate('Y-m-d H:i:s');
     $ip = logger::getip();
     $params = array('isssss', &$this->id_, &$site, &$comment, &$name, &$date, &$ip);
     $qryP->bind_params($params);
     $qryP->execute();
     $id = $qryP->getInsertID();
     $this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 'name' => $name, 'comment' => $comment, 'id' => $id);
     // create comment_added event
     event::call('comment_added', $this);
 }
Exemplo n.º 4
0
 public static function setTime($week = 0, $year = 0, $month = 0)
 {
     if ($week) {
         $w = $week;
     } else {
         $w = (int) kbdate("W");
     }
     if ($month) {
         $m = $month;
     } else {
         $m = (int) kbdate("m");
     }
     if ($year) {
         $y = $year;
     } else {
         $y = (int) kbdate("o");
     }
     if ($m < 10) {
         $m = "0" . $m;
     }
     if ($w < 10) {
         $w = "0" . $w;
     }
     self::$year = $y;
     self::$month = $m;
     self::$week = $w;
 }
Exemplo n.º 5
0
 /**
  * Set up the menu.
  *
  * Additional options that have been set are added to the menu.
  */
 function menuSetup()
 {
     if ($this->month == 12) {
         $nmonth = 1;
         $nyear = $this->year + 1;
     } else {
         $nmonth = $this->month + 1;
         $nyear = $this->year;
     }
     if ($this->month == 1) {
         $pmonth = 12;
         $pyear = $this->year - 1;
     } else {
         $pmonth = $this->month - 1;
         $pyear = $this->year;
     }
     $this->addMenuItem("caption", "Navigation");
     $this->addMenuItem("link", "Previous month ", edkURI::build(array('y', $pyear, true), array('m', $pmonth, true)));
     if (!($this->month == kbdate("m") - 1 && $this->year == kbdate("Y"))) {
         $this->addMenuItem("link", "Next month", edkURI::build(array('y', $nyear, true), array('m', $nmonth, true)));
     }
 }
Exemplo n.º 6
0
function post()
{
    global $page;
    if (config::get("post_password") == '' || crypt($_POST['password'], config::get("post_password")) == config::get("post_password") || $page->isAdmin()) {
        $parser = new Parser($_POST['killmail']);
        // Filtering
        if (config::get('filter_apply')) {
            $filterdate = config::get('filter_date');
            $year = substr($_POST['killmail'], 0, 4);
            $month = substr($_POST['killmail'], 5, 2);
            $day = substr($_POST['killmail'], 8, 2);
            $killstamp = mktime(0, 0, 0, $month, $day, $year);
            if ($killstamp < $filterdate) {
                $killid = -3;
            } else {
                $killid = $parser->parse(true, null, false);
            }
        } else {
            $killid = $parser->parse(true, null, false);
        }
        if ($killid <= 0) {
            if ($killid == 0) {
                $html = "Killmail is malformed.<br/>";
                if ($errors = $parser->getError()) {
                    foreach ($errors as $error) {
                        $html .= 'Error: ' . $error[0];
                        if ($error[1]) {
                            $html .= ' The text leading to this error was: "' . $error[1] . '"';
                        }
                        $html .= '<br/>';
                    }
                }
            } elseif ($killid == -1) {
                $url = edkURI::page('kill_detail', $parser->getDupeID(), 'kll_id');
                $html = "That killmail has already been posted <a href=\"" . edkURI::page('kill_detail', $parser->getDupeID(), 'kll_id') . "\">here</a>.";
            } elseif ($killid == -2) {
                $html = "You are not authorized to post this killmail.";
            } elseif ($killid == -3) {
                $filterdate = kbdate("j F Y", config::get("filter_date"));
                $html = "You are not allowed to post killmails older than" . " {$filterdate}.";
            } elseif ($killid == -4) {
                $html = "That mail has been deleted. Kill id was " . $parser->getDupeID();
                if ($page->isAdmin()) {
                    $html .= '<br />
<form id="postform" name="postform" class="f_killmail" method="post" action="' . edkURI::page('post') . '">
	<input type="hidden" name="killmail" id="killmail" value = "' . htmlentities($_POST['killmail']) . '"/>
	<input type="hidden" name="kll_id" id="kill_id" value = "' . $parser->getDupeID() . '"/>
	<input type="hidden" name="undelete" id="undelete" value = "1"/>
<input id="submit" name="submit" type="submit" value="Undelete" />
</form>';
                }
            }
        } else {
            if (config::get('post_mailto') != "") {
                $mailer = new PHPMailer();
                $kill = new Kill($killid);
                if (!($server = config::get('post_mailserver'))) {
                    $server = 'localhost';
                }
                $mailer->From = "mailer@" . config::get('post_mailhost');
                $mailer->FromName = config::get('post_mailhost');
                $mailer->Subject = "Killmail #" . $killid;
                $mailer->Host = $server;
                $mailer->Port = 25;
                $mailer->Helo = $server;
                $mailer->Mailer = "smtp";
                $mailer->AddReplyTo("no_reply@" . config::get('post_mailhost'), "No-Reply");
                $mailer->Sender = "mailer@" . config::get('post_mailhost');
                $mailer->Body = $_POST['killmail'];
                $mailer->AddAddress(config::get('post_mailhost'));
                $mailer->Send();
            }
            logger::logKill($killid);
            header("Location: " . htmlspecialchars_decode(edkURI::page('kill_detail', $killid, 'kll_id')));
            exit;
        }
    } else {
        $html = "Invalid password.";
    }
    return $html;
}
 function setTime($week = 0, $year = 0, $month = 0, $start = 0, $end = 0)
 {
     // Set week.
     if ($week && $year) {
         $this->setWeek($week, $year);
         $this->month = 0;
     } elseif ($month && $year) {
         $this->setMonth($month, $year);
         $this->week = 0;
     } else {
         if (config::get('show_monthly')) {
             $this->setMonth(kbdate('m'), kbdate('Y'));
         } else {
             $this->setWeek(kbdate('W'), kbdate('o'));
         }
     }
 }
Exemplo n.º 8
0
 /**
  * Set the current time to use for this page.
  *
  * @param integer $week
  * @param integer $year
  * @param integer $month
  */
 function setTime($week = 0, $year = 0, $month = 0, $day = 0)
 {
     if ($day && $month && $year) {
         $this->setDay($day, $month, $year);
         $this->week = 0;
     } else {
         if ($week && $year) {
             $this->setWeek($week, $year);
             $this->month = 0;
         } elseif ($month && $year) {
             $this->setMonth($month, $year);
             $this->week = 0;
         } else {
             if (config::get('show_monthly')) {
                 $this->setMonth(kbdate('m'), kbdate('Y'));
             } else {
                 $this->setWeek(kbdate('W'), kbdate('o'));
             }
         }
     }
 }
Exemplo n.º 9
0
 public static function killListAlliance($allianceDetail)
 {
     require_once "toplist/class.expensivekills.php";
     require_once "toptable/class.expensivekill.php";
     global $smarty;
     // arguments for URL building
     $args = array();
     if ($allianceDetail->all_external_id) {
         $args[] = array('all_ext_id', $allianceDetail->all_external_id, true);
     } else {
         $args[] = array('all_id', $allianceDetail->all_id, true);
     }
     // get context information
     $all_id = $allianceDetail->getAlliance()->getID();
     $view = $allianceDetail->getView();
     $month = $allianceDetail->getMonth();
     $year = $allianceDetail->getYear();
     $pmonth = $smarty->get_template_vars('pmonth');
     $pyear = $smarty->get_template_vars('pyear');
     $nmonth = $smarty->get_template_vars('nmonth');
     $nyear = $smarty->get_template_vars('nyear');
     $monthname = kbdate("F", strtotime("2000-" . $month . "-2"));
     if ($view == 'expensive_kills') {
         $smarty->assign('title', "Most Expensive Kills");
         $smarty->assign('month', $monthname);
         $smarty->assign('year', $year);
         $smarty->assign('pmonth', $pmonth);
         $smarty->assign('pyear', $pyear);
         $smarty->assign('nmonth', $nmonth);
         $smarty->assign('nyear', $nyear);
         $smarty->assign('all_id', $all_id);
         $smarty->assign('value_class', 'kl-kill');
         $smarty->assign('url_previous', edkURI::build($args, array('view', 'expensive_kills', true), array('y', $pyear, true), array('m', $pmonth, true)));
         $smarty->assign('url_next', edkURI::build($args, array('view', 'expensive_kills', true), array('y', $nyear, true), array('m', $nmonth, true)));
         $list = new TopList_ExpensiveKills();
         $list->addInvolvedAlliance($allianceDetail->getAlliance());
         $list->setPodsNoobShips(TRUE);
         $list->setMonth($month);
         $list->setYear($year);
         $table = new TopTable_ExpensiveKill($list, "ISK");
         $smarty->assign('monthly_stats', $table->generate());
         $list = new TopList_ExpensiveKills();
         $list->addInvolvedAlliance($allianceDetail->getAlliance());
         $list->setPodsNoobShips(TRUE);
         $table = new TopTable_ExpensiveKill($list, "ISK");
         $smarty->assign('total_stats', $table->generate());
         return $smarty->fetch(getcwd() . "/mods/most_expensive_toplist/templates/detail_kl_expensive.tpl");
     } else {
         if ($view == 'expensive_losses') {
             $smarty->assign('title', "Most Expensive Losses");
             $smarty->assign('month', $monthname);
             $smarty->assign('year', $year);
             $smarty->assign('pmonth', $pmonth);
             $smarty->assign('pyear', $pyear);
             $smarty->assign('nmonth', $nmonth);
             $smarty->assign('nyear', $nyear);
             $smarty->assign('all_id', $all_id);
             $smarty->assign('value_class', 'kl-loss');
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'expensive_losses', true), array('y', $pyear, true), array('m', $pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'expensive_losses', true), array('y', $nyear, true), array('m', $nmonth, true)));
             $list = new TopList_ExpensiveKills();
             $list->addVictimAlliance($allianceDetail->getAlliance());
             $list->setPodsNoobShips(TRUE);
             $list->setMonth($month);
             $list->setYear($year);
             $table = new TopTable_ExpensiveKill($list, "ISK");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_ExpensiveKills();
             $list->addVictimAlliance($allianceDetail->getAlliance());
             $list->setPodsNoobShips(TRUE);
             $table = new TopTable_ExpensiveKill($list, "ISK");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(getcwd() . "/mods/most_expensive_toplist/templates/detail_kl_expensive.tpl");
         }
     }
 }
Exemplo n.º 10
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  */
 function start()
 {
     $this->page = new Page();
     $this->all_id = (int) edkURI::getArg('all_id');
     $this->all_external_id = (int) edkURI::getArg('all_ext_id');
     if (!$this->all_id && !$this->all_external_id) {
         $this->all_id = (int) edkURI::getArg('id', 1);
         // And now a bit of magic to test if this is an external ID
         if ($this->all_id > 500000 && $this->all_id < 500021 || $this->all_id > 1000000) {
             $this->all_external_id = $this->all_id;
             $this->all_id = 0;
         }
     }
     $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     // Search engines should only index the main view.
     if ($this->view) {
         $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     }
     if (!$this->all_id && !$this->all_external_id) {
         $html = 'No valid alliance id specified.';
         $this->page->setContent($html);
         $this->page->generate();
         exit;
     }
     if (!$this->all_id && $this->all_external_id) {
         $this->alliance = new Alliance($this->all_external_id, true);
         $this->all_id = $this->alliance->getID();
         if (!$this->all_id) {
             echo 'No valid alliance id specified.';
             exit;
         }
     } else {
         $this->alliance = Cacheable::factory('Alliance', $this->all_id);
         $this->all_external_id = $this->alliance->getExternalID();
     }
     $this->page->addHeader("<link rel='canonical' href='" . $this->alliance->getDetailsURL() . "' />");
     if ($this->view) {
         $this->year = (int) edkURI::getArg('y', 3);
         $this->month = (int) edkURI::getArg('m', 4);
     } else {
         $this->year = (int) edkURI::getArg('y', 2);
         $this->month = (int) edkURI::getArg('m', 3);
     }
     if (!$this->month) {
         $this->month = kbdate('m');
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 12) {
         $this->nmonth = 1;
         $this->nyear = $this->year + 1;
     } else {
         $this->nmonth = $this->month + 1;
         $this->nyear = $this->year;
     }
     if ($this->month == 1) {
         $this->pmonth = 12;
         $this->pyear = $this->year - 1;
     } else {
         $this->pmonth = $this->month - 1;
         $this->pyear = $this->year;
     }
     $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2"));
     global $smarty;
     $smarty->assign('monthname', $this->monthname);
     $smarty->assign('year', $this->year);
     $smarty->assign('pmonth', $this->pmonth);
     $smarty->assign('pyear', $this->pyear);
     $smarty->assign('nmonth', $this->nmonth);
     $smarty->assign('nyear', $this->nyear);
     if ($this->alliance->isFaction()) {
         $this->page->setTitle(Language::get('page_faction_det') . ' - ' . $this->alliance->getName());
     } else {
         $this->page->setTitle(Language::get('page_all_det') . ' - ' . $this->alliance->getName());
     }
     $smarty->assign('all_name', $this->alliance->getName());
     $smarty->assign('all_id', $this->alliance->getID());
 }
Exemplo n.º 11
0
    $year = kbdate('Y');
}
$nyear = $year + 1;
$pyear = $year - 1;
// week 53 fix
$month = kbdate('n');
if ($month == 12 && $week == 01) {
    $week = 53;
}
$region = 0;
if ($region_set > 0) {
    $using = " using filters for regions";
} else {
    $using = " using most active region per month";
}
if ($year == kbdate('Y')) {
    $html .= '<div id="page-title">Graphical view of this years activity' . $using . '</div><br />';
} else {
    $html .= '<div id="page-title">Graphical view of ' . $year . ' activity' . $using . '</div><br />';
}
$html .= '<table class=kb-table width="100%" border=0 cellspacing="1"> ';
for ($i = 1; $i <= 12; $i++) {
    if ($region_set == 0) {
        $sql2 = "select reg.reg_id, count(distinct kll.kll_id) as kills \n\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\twhere kll.kll_system_id = sys.sys_id \n\t\t\t\tand inv.ind_kll_id = kll.kll_id";
        if (count(config::get('cfg_allianceid'))) {
            $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") ";
        }
        if (count(config::get('cfg_corpid'))) {
            $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") ";
        }
        if (count(config::get('cfg_pilotid'))) {
Exemplo n.º 12
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page('Corporation details');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->crp_id = (int) edkURI::getArg('crp_id');
     if (!$this->crp_id) {
         $this->crp_external_id = (int) edkURI::getArg('crp_ext_id');
         if (!$this->crp_external_id) {
             $id = (int) edkURI::getArg('id', 1);
             // True for NPC corps too, but NPC alliances recorded as corps
             // fail here. Use Jedi mind tricks?
             if ($id > 1000000) {
                 $this->crp_external_id = $id;
             } else {
                 $this->crp_id = $id;
             }
         }
     }
     $this->view = preg_replace('/[^a-zA-Z0-9_-]/', '', edkURI::getArg('view', 2));
     if ($this->view) {
         $this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
     }
     if (!$this->crp_id) {
         if ($this->crp_external_id) {
             $this->corp = new Corporation($this->crp_external_id, true);
             $this->crp_id = $this->corp->getID();
         } else {
             $html = 'That corporation does not exist.';
             $this->page->setContent($html);
             $this->page->generate();
             exit;
         }
     } else {
         $this->corp = Cacheable::factory('Corporation', $this->crp_id);
         $this->crp_external_id = $this->corp->getExternalID();
     }
     if ($this->crp_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_ext_id', $this->crp_external_id, true)) . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::build(array('crp_id', $this->crp_id, true)) . "' />");
     }
     $this->alliance = $this->corp->getAlliance();
     if ($this->view) {
         $this->year = (int) edkURI::getArg('y', 3);
         $this->month = (int) edkURI::getArg('m', 4);
     } else {
         $this->year = (int) edkURI::getArg('y', 2);
         $this->month = (int) edkURI::getArg('m', 3);
     }
     if (!$this->month) {
         $this->month = kbdate('m');
     }
     if (!$this->year) {
         $this->year = kbdate('Y');
     }
     if ($this->month == 12) {
         $this->nmonth = 1;
         $this->nyear = $this->year + 1;
     } else {
         $this->nmonth = $this->month + 1;
         $this->nyear = $this->year;
     }
     if ($this->month == 1) {
         $this->pmonth = 12;
         $this->pyear = $this->year - 1;
     } else {
         $this->pmonth = $this->month - 1;
         $this->pyear = $this->year;
     }
     $this->monthname = kbdate("F", strtotime("2000-" . $this->month . "-2"));
 }