/** * Fetches the information for this blog from the database since we are going to need it * almost everywhere. */ function _getBlogInfo() { // see if we're using subdomains $config =& Config::getConfig(); if ($config->getValue("subdomains_enabled")) { $subdomainInfo = Subdomains::getSubdomainInfoFromRequest(); if ($subdomainInfo["username"] != "" && $this->_request->getValue('blogUserName') == "") { $this->_request->setValue('blogUserName', $subdomainInfo["username"]); } if ($subdomainInfo["blogname"] != "" && $this->_request->getValue('blogName') == "") { $this->_request->setValue('blogName', $subdomainInfo["blogname"]); } } $blogId = $this->_request->getValue('blogId'); $blogName = $this->_request->getValue('blogName'); $userId = $this->_request->getValue('userId'); $userName = $this->_request->getValue('blogUserName'); // if there is a "blogId" parameter, it takes precedence over the // "user" parameter. if (!$blogId && !$blogName) { // check if there was a user parameter if (!empty($userName)) { // if so, check to which blogs the user belongs $users = new Users(); $userInfo = $users->getUserInfoFromUsername($userName); // if the user exists and is valid... if ($userInfo) { $userBlogs = $users->getUsersBlogs($userInfo->getId(), BLOG_STATUS_ACTIVE); // check if he or she belogs to any blog. If he or she does, simply // get the first one (any better rule for this?) if (!empty($userBlogs)) { $blogId = $userBlogs[0]->getId(); } else { $blogId = $this->_config->getValue('default_blog_id'); } } else { $blogId = $this->_config->getValue('default_blog_id'); } } else { // if there is no user parameter, we take the blogId from the session if ($this->_session->getValue('blogId') != '') { $blogId = $this->_session->getValue('blogId'); } else { // get the default blog id from the database $blogId = $this->_config->getValue('default_blog_id'); } } } // fetch the BlogInfo object $blogs = new Blogs(); if ($blogId) { $this->_blogInfo = $blogs->getBlogInfo($blogId); } else { $this->_blogInfo = $blogs->getBlogInfoByName($blogName); } }
<?php global $mdb; $page = 1; $pageTitle = ''; $pageType = 'index'; $requestUriPager = ''; $serverName = $_SERVER['SERVER_NAME']; global $baseAddr, $fullAddr; if ($serverName != $baseAddr) { $numDays = 7; $p = Subdomains::getSubdomainParameters($serverName); $page = max(1, min(25, $page)); $p['page'] = $page; $columnName = key($p); $id = (int) reset($p); if (sizeof($p) <= 1) { $app->redirect($fullAddr, 302); } $topPoints = array(); $topPods = array(); $p['kills'] = true; $p['pastSeconds'] = $numDays * 86400; $top = array(); $top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTopPilots($p)); $top[] = $columnName != 'corporationID' ? Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTopCorps($p)) : array(); $top[] = $columnName != 'corporationID' && $columnName != 'allianceID' ? Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTopAllis($p)) : array(); $top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTopShips($p)); $top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTopSystems($p)); $requestUriPager = str_replace('ID', '', $columnName) . "/{$id}/"; $p['limit'] = 5;
if ($banner) { $banner = str_replace('http://i.imgur.com/', 'https://i.imgur.com/', $banner); $banner = str_replace('http://imgur.com/', 'https://imgur.com/', $banner); //$twig->addGlobal("headerImage", $banner); } $adfree = false; //Db::queryField("select count(*) count from zz_subdomains where adfreeUntil >= now() and subdomain = :server", "count", array(":server" => $_SERVER["SERVER_NAME"]), 60); $adfree |= false; //Db::queryField("select count(*) count from zz_subdomains where adfreeUntil >= now() and alias = :server", "count", array(":server" => $_SERVER["SERVER_NAME"]), 60); if ($adfree) { $twig->addGlobal('showAds', false); } else { $twig->addGlobal('showAds', $showAds); } $_SERVER['SERVER_NAME'] = 'zkillboard.com'; Subdomains::getSubdomainParameters($_SERVER['SERVER_NAME']); $twig->addGlobal('KillboardName', isset($killboardName) ? $killboardName : 'zKillboard'); // Set the style used side wide to the user selected one, or the config default $twig->addGlobal('style', UserConfig::get('style', $style)); $twig->addExtension(new UserGlobals()); $twig->addFunction(new Twig_SimpleFunction('pageTimer', 'Util::pageTimer')); $twig->addFunction(new Twig_SimpleFunction('queryCount', 'Db::getQueryCount')); $twig->addFunction(new Twig_SimpleFunction('isActive', 'Util::isActive')); $twig->addFunction(new Twig_SimpleFunction('pluralize', 'Util::pluralize')); $twig->addFunction(new Twig_SimpleFunction('formatIsk', 'Util::formatIsk')); $twig->addFunction(new Twig_SimpleFunction('shortNum', 'Util::formatIsk')); $twig->addFunction(new Twig_SimpleFunction('shortString', 'Util::shortString')); $twig->addFunction(new Twig_SimpleFunction('truncate', 'Util::truncate')); $twig->addFunction(new Twig_SimpleFunction('chart', 'Chart::addChart')); $twig->addFunction(new Twig_SimpleFunction('getMonth', 'Util::getMonth')); $twig->addFunction(new Twig_SimpleFunction('getLongMonth', 'Util::getLongMonth'));
} /** * Script that shows a summary page with the 'n' most recent additions * of all blogs in one page. Therefore, it is called a "Summary" :) */ include_once PLOG_CLASS_PATH . "class/controller/controller.class.php"; include_once PLOG_CLASS_PATH . "class/net/http/httpvars.class.php"; include_once PLOG_CLASS_PATH . "class/misc/version.class.php"; include_once PLOG_CLASS_PATH . "class/data/validator/usernamevalidator.class.php"; include_once PLOG_CLASS_PATH . "class/net/http/subdomains.class.php"; include_once PLOG_CLASS_PATH . "class/net/http/session/sessionmanager.class.php"; define("SUMMARY_DEFAULT_BLOGS_PER_PAGE", 25); // check if the url is coming for a subdomain because if it is... we should // redirect to index.php because it is not coming to us! $config =& Config::getConfig(); if ($config->getValue("subdomains_enabled") && Subdomains::isSubdomainUrl()) { $indexPage = $config->getValue("script_name", "index.php"); include_once PLOG_CLASS_PATH . $indexPage; die; } /** * our very own controller class... overwrite a few methods for our convenience! */ class SummaryController extends Controller { function SummaryController() { global $_actionMap; $this->Controller($_actionMap, "op"); $this->setActionFolderPath(PLOG_CLASS_PATH . "class/summary/action/"); }