Example #1
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page();
     $this->plt_id = (int) edkURI::getArg('plt_id');
     if (!$this->plt_id) {
         $this->plt_external_id = (int) edkURI::getArg('plt_ext_id');
         if (!$this->plt_external_id) {
             $id = (int) edkURI::getArg('id', 1);
             // Arbitrary number bigger than we expect to reach locally
             if ($id > 1000000) {
                 $this->plt_external_id = $id;
             } else {
                 $this->plt_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->plt_id) {
         if ($this->plt_external_id) {
             $this->pilot = new Pilot(0, $this->plt_external_id);
             $this->plt_id = $this->pilot->getID();
         } else {
             $html = 'That pilot doesn\'t exist.';
             $this->page->generate($html);
             exit;
         }
     } else {
         $this->pilot = Cacheable::factory('Pilot', $this->plt_id);
         $this->plt_external_id = $this->pilot->getExternalID();
     }
     $this->page->setTitle('Pilot details - ' . $this->pilot->getName());
     if (!$this->pilot->exists()) {
         $html = 'That pilot doesn\'t exist.';
         $this->page->setContent($html);
         $this->page->generate();
         exit;
     }
     if ($this->plt_external_id) {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_external_id, 'plt_ext_id') . "' />");
     } else {
         $this->page->addHeader("<link rel='canonical' href='" . edkURI::page('pilot_detail', $this->plt_id, 'plt_id') . "' />");
     }
     $this->corp = $this->pilot->getCorp();
     $this->alliance = $this->corp->getAlliance();
 }
 /**
  * The generate functions outputs the correct headers for
  * this `AJAXPage`, adds `$this->getHttpStatusCode()` code to the root attribute
  * before calling the parent generate function and generating
  * the `$this->_Result` XMLElement
  *
  * @return string
  */
 public function generate($page = null)
 {
     // Set the actual status code in the xml response
     $this->_Result->setAttribute('status', $this->getHttpStatusCode());
     parent::generate($page);
     return $this->_Result->generate(true);
 }
Example #3
0
 function formatPage()
 {
     require_once CORE_DIR . "/page/page.php";
     $page = new Page();
     $page->headVars['page']['title'] = "/" . BOARD_DIR . "/ - " . TITLE . " - Catalog";
     array_push($page->headVars['css']['extra'], "stylesheets/catalog.css");
     return $page->generate($this->format());
 }
Example #4
0
 public function generate()
 {
     $result = $this->Proc->process($this->_xml, $this->_xsl, $this->_param, $this->_registered_php_functions);
     if ($this->Proc->isErrors()) {
         return false;
     }
     parent::generate();
     return $result;
 }
Example #5
0
 public function generate()
 {
     switch ($this->_status) {
         case self::STATUS_OK:
             $status_message = '200 OK';
             break;
         case self::STATUS_BAD:
         case self::STATUS_ERROR:
             $status_message = '400 Bad Request';
             break;
         case self::STATUS_UNAUTHORISED:
             $status_message = '401 Unauthorized';
             break;
     }
     $this->addHeaderToPage('HTTP/1.0 ' . $status_message);
     $this->_Result->setAttribute('status', $this->_status);
     parent::generate();
     return $this->_Result->generate(true);
 }
Example #6
0
$page = new Page('Administration - Mods');
$page->setAdmin();
if (isset($_POST['set_mods']) && $_POST['set_mods']) {
    foreach ($_POST as $key => $val) {
        if (substr($key, 0, 4) == "mod_" && $val == "on") {
            if (substr($key, 4, strlen($key) - 4) != 'item_values') {
                $activemods .= substr($key, 4, strlen($key) - 4) . ",";
            }
        }
    }
    $activemods = substr($activemods, 0, strlen($activemods) - 1);
    config::set("mods_active", $activemods);
}
$activemods = explode(",", config::get("mods_active"));
$rows = array();
if ($handle = opendir('mods')) {
    $modlist = array();
    while ($file = readdir($handle)) {
        if (is_dir("mods/{$file}") && $file != ".." & $file != "." & $file != ".svn") {
            $rows[$file] = array('name' => $file, 'url' => edkURI::page("settings_{$file}"), 'checked' => in_array($file, $activemods), 'settings' => file_exists("mods/{$file}/settings.php"));
        }
    }
    ksort($rows);
    closedir($handle);
}
$smarty->assign('rows', $rows);
$smarty->assign('url', edkURI::page("admin_mods"));
$page->setContent($smarty->fetch(get_tpl('admin_mods')));
$page->addContext($menubox->generate());
$page->generate();
Example #7
0
 /**
  * The generate function calls the `__build()` function before appending
  * all the current page's headers and then finally calling the `$Html's`
  * generate function which generates a HTML DOM from all the
  * XMLElement children.
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     $this->__build();
     parent::generate($page);
     return $this->Html->generate(true);
 }
Example #8
0
 /**
  * The generate functions outputs the correct headers for
  * this `TextPage`, before calling the parent generate function and
  * returning the `$this->_Result` string
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     parent::generate($page);
     return $this->_Result;
 }
Example #9
0
 /**
  * The generate function calls on the `XsltProcess` to transform the
  * XML with the given XSLT passing any parameters or functions
  * If no errors occur, the parent generate function is called to add
  * the page headers and a string containing the transformed result
  * is result.
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     $result = $this->Proc->process($this->_xml, $this->_xsl, $this->_param, $this->_registered_php_functions);
     if ($this->Proc->isErrors()) {
         $this->setHttpStatus(Page::HTTP_STATUS_ERROR);
         return false;
     }
     parent::generate($page);
     return $result;
 }
Example #10
0
File: log.php Project: Bossgod/3ch
 function generate_all()
 {
     $this->update_cache();
     require_once CORE_DIR . "/page/page.php";
     $pageC = new Page();
     $profile = microtime();
     //Basic profiling.
     for ($page = 1; $page <= ceil(count($this->cache['THREADS']) / PAGE_DEF); $page++) {
         //Generate Index pages.
         $pageC->headVars['page']['title'] = "/" . BOARD_DIR . "/ - " . TITLE;
         $temp = $pageC->generate($this->generate("index", $page, false));
         $logfilename = $page == 1 ? PHP_SELF2 : $page - 1 . PHP_EXT;
         echo "Writing out Index {$page} ({$logfilename})... ";
         $this->print_page($logfilename, $temp);
         echo "Done!<br>";
     }
     foreach ($this->cache['THREADS'] as $no) {
         $pageC->headVars['page']['title'] = "/" . BOARD_DIR . "/" . (!empty($this->cache[$no]['sub']) ? " - " . $this->cache[$no]['sub'] : '') . " - " . TITLE;
         $logfilename = RES_DIR . $no . PHP_EXT;
         echo "Writing out #{$no} ({$logfilename})... ";
         $temp = $pageC->generate($this->generate("thread", $no, false));
         $this->print_page($logfilename, $temp);
         echo "Done!<br>";
     }
     echo sprintf("<br>Took %f", microtime() - $profile) . " seconds.";
 }
 */
/**
 * Made by Agustino and HyperBeanie
 * If you use and like these tools, please donate some isk!
 */
$plt_id = $_GET['plt_id'];
// Make the pilot
$pilot = new Pilot($plt_id);
$page = new Page('Administration - Killmail export - ' . $pilot->getName());
$page->setAdmin();
$corp = $pilot->getCorp();
$alliance = $corp->getAlliance();
// Do the check
if (!$pilot->exists()) {
    $html = "That pilot doesn't exist.";
    $page->generate($html);
    exit;
}
$html .= "<form><textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>";
// Setup the lists
$klist = new KillList();
$klist->setOrdered(true);
$klist->addInvolvedPilot($pilot);
$klist->rewind();
while ($kll_id = $klist->getKill()) {
    $kill = new Kill($kll_id->getID());
    $html .= "\"";
    $html .= $kill->getRawMail();
    $html .= "\",\n\n";
}
// Losses
 function generate()
 {
     $this->__build();
     parent::generate();
     return $this->Html->generate(true);
 }
Example #13
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());
 }
Example #14
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"));
 }