/var/www/technexus/src/Controllers/Blog.php
'Total' => $total,
'path' => $this->path,
'isLoggedIn' => App::$App->is_loggedin(),
'Sidebar' => $this->getSidebarData(),
];
/**
* Show "Go Back" button only if the results are >= limit
* or
* If query param after is present
*/
if (($count === static::LIMIT || $total > static::LIMIT) || isset($get['after'])) {
$data['before'] = $BlogPosts[$count-1]->Created;
}
/**
* Show "Go Forward" button if before query param is present
*/
if (isset($get['before'])) {
$data['after'] = $BlogPosts[0]->Created;
}
if (isset($get['after'])) {
}
return new Response(new TwigBuilder('blog/posts.twig', $data));
}
/**
* Displays a given year of blog posts
*
* @param string $year
* @link project://views/blog/posts.twig
* @link project://views/templates/post.twig
*/
public function year($year): ResponseInterface
{
$BlogPosts = BlogPost::getAllByWhere(array_merge($this->conditions(), [
sprintf('YEAR(`Created`)=%d', $year),
]), [
Arguments
/var/www/technexus/src/Controllers/Blog.php
'Total' => $total,
'path' => $this->path,
'isLoggedIn' => App::$App->is_loggedin(),
'Sidebar' => $this->getSidebarData(),
];
/**
* Show "Go Back" button only if the results are >= limit
* or
* If query param after is present
*/
if (($count === static::LIMIT || $total > static::LIMIT) || isset($get['after'])) {
$data['before'] = $BlogPosts[$count-1]->Created;
}
/**
* Show "Go Forward" button if before query param is present
*/
if (isset($get['before'])) {
$data['after'] = $BlogPosts[0]->Created;
}
if (isset($get['after'])) {
}
return new Response(new TwigBuilder('blog/posts.twig', $data));
}
/**
* Displays a given year of blog posts
*
* @param string $year
* @link project://views/blog/posts.twig
* @link project://views/templates/post.twig
*/
public function year($year): ResponseInterface
{
$BlogPosts = BlogPost::getAllByWhere(array_merge($this->conditions(), [
sprintf('YEAR(`Created`)=%d', $year),
]), [
/var/www/technexus/src/Controllers/Blog.php
{
$this->request = $request;
switch ($action = $this->shiftPath()) {
case 'admin':
return (new Admin())->handle($request);
case 'api':
return (new API())->handle($request);
case 'media':
return (new Media())->handle($request);
case 'logout':
return $this->logout();
case '.rss':
return (new RSS())->handle($request);
case '':
return $this->home($request);
break;
case 'topics':
return $this->topics();
case ctype_digit($action):
// year of posts
if (strlen($action) == 4) {
$year = $action;
}
// month of posts
if (ctype_digit($this->peekPath()) && strlen($this->peekPath()) == 2) {
$month = $this->shiftPath();
}
// single post
$permalink = $this->peekPath()?$this->shiftPath():null;
// yearly digest
if (empty($permalink) && empty($month)) {
return $this->year($year);
/var/www/technexus/src/Controllers/Main.php
* @uses Blog::handleRequest()
* @return void
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/site.LOCK')) {
echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/down.html');
exit;
}
/*
* This is to make sure any page that loads
* through Apache's ErrorDocument returns 200
* instead of 404.
*/
header('HTTP/1.0 200 OK');
//header('X-Powered-By: PHP/' . phpversion() . ' Div Framework (http://emr.ge) Henry\'s Revision');
$blog = new Blog();
return $blog->handle($request);
}
}
/var/www/technexus/src/App.php
return true;
}
}
return false;
}
/**
* Gets difference between process start and now in microseconds.
*
* @return void
*/
public function getLoadTime()
{
return (microtime(true)-DIVERGENCE_START);
}
public function handleRequest()
{
$main = new Main();
$response = $main->handle(ServerRequest::fromGlobals());
(new Emitter($response))->emit();
}
}
/var/www/technexus/bootstrap/router.php
<?php
/**
* This file is part of the Divergence package.
*
* (c) Henry Paradiz <henry.paradiz@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app->handleRequest();
/var/www/technexus/public/index.php
<?php
require(__DIR__.'/../bootstrap/autoload.php');
require(__DIR__.'/../bootstrap/app.php');
require(__DIR__.'/../bootstrap/router.php');
Arguments
"/var/www/technexus/bootstrap/router.php"