コード例 #1
0
ファイル: poly.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\CoreUtils;
CoreUtils::loadPage(array('title' => 'Poly', 'js' => array('jquery.ba-throttle-debounce', 'poly-editor', $do), 'css' => array('poly-editor', $do)));
コード例 #2
0
ファイル: admin.php プロジェクト: ponydevs/MLPVC-RR
                    $q[] = "by={$by}";
                    $title .= (!isset($type) ? 'Entries ' : '') . "by {$by} ";
                }
            } else {
                if (isset($q)) {
                    $q[] = 'by=' . CoreUtils::FIXPATH_EMPTY;
                }
            }
        }
        $q = array();
        if (isset($_GET['js'])) {
            $q[] = 'js=' . $_GET['js'];
        }
        process_filter($q);
        $Pagination = new Pagination('admin/logs', 20, $Database->count('log'));
        $heading = 'Global logs';
        if (!empty($title)) {
            $title .= '- ';
        }
        $title .= "Page {$Pagination->page} - {$heading}";
        CoreUtils::fixPath("/admin/logs/{$Pagination->page}" . (!empty($q) ? '?' . implode('&', $q) : ''));
        process_filter();
        $LogItems = $Database->orderBy('timestamp')->orderBy('entryid')->get('log', $Pagination->getLimit());
        if (isset($_GET['js'])) {
            $Pagination->respond(Logs::getTbody($LogItems), '#logs tbody');
        }
        CoreUtils::loadPage(array('title' => $title, 'view' => "{$do}-logs", 'css' => "{$do}-logs", 'js' => array("{$do}-logs", 'paginate')));
        break;
    default:
        CoreUtils::notFound();
}
コード例 #3
0
ファイル: components.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\CoreUtils;
CoreUtils::loadPage(array('title' => 'Components', 'no-robots'));
コード例 #4
0
ファイル: Episodes.php プロジェクト: ponydevs/MLPVC-RR
 /**
  * Loads the episode page
  *
  * @param null|int|Episode $force              If null: Parses $data and loads approperiate epaisode
  *                                             If array: Uses specified arra as Episode data
  * @param bool             $serverSideRedirect Handle redirection to the correct page on the server/client side
  */
 static function loadPage($force = null, $serverSideRedirect = true)
 {
     global $data, $CurrentEpisode, $Database, $PrevEpisode, $NextEpisode, $LinkedPost;
     if ($force instanceof Episode) {
         $CurrentEpisode = $force;
     } else {
         $EpData = self::parseID($data);
         if ($EpData['season'] === 0) {
             error_log("Attempted visit to {$data} from " . (!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '[unknown referrer]') . ', redirecting to /movie page');
             HTTP::redirect('/movie/' . $EpData['episode']);
         }
         $CurrentEpisode = empty($EpData) ? self::getLatest() : self::getActual($EpData['season'], $EpData['episode']);
     }
     if (empty($CurrentEpisode)) {
         CoreUtils::notFound();
     }
     $url = $CurrentEpisode->formatURL();
     if (!empty($LinkedPost)) {
         $url .= '#' . $LinkedPost->getID();
     }
     if ($serverSideRedirect) {
         CoreUtils::fixPath($url);
     }
     $js = array('imagesloaded.pkgd', 'jquery.ba-throttle-debounce', 'jquery.fluidbox', 'Chart', 'episode');
     if (Permission::sufficient('member')) {
         $js[] = 'episode-manage';
     }
     if (Permission::sufficient('staff')) {
         $js[] = 'moment-timezone';
         $js[] = 'episodes-manage';
     }
     if (!$CurrentEpisode->isMovie) {
         $PrevEpisode = $Database->where('no', $CurrentEpisode->no, '<')->where('season', 0, '!=')->orderBy('no', 'DESC')->getOne('episodes', 'season,episode,title,twoparter');
         $NextEpisode = $Database->where('no', $CurrentEpisode->no, '>')->where('season', 0, '!=')->orderBy('no', 'ASC')->getOne('episodes', 'season,episode,title,twoparter');
     } else {
         $PrevEpisode = $Database->where('season', 0)->where('episode', $CurrentEpisode->episode, '<')->orderBy('episode', 'DESC')->getOne('episodes', 'season,episode,title');
         $NextEpisode = $Database->where('season', 0)->where('episode', $CurrentEpisode->episode, '>')->orderBy('episode', 'ASC')->getOne('episodes', 'season,episode,title');
     }
     $heading = $CurrentEpisode->formatTitle();
     CoreUtils::loadPage(array('title' => "{$heading} - Vector Requests & Reservations", 'heading' => $heading, 'view' => 'episode', 'css' => 'episode', 'js' => $js, 'url' => $serverSideRedirect ? null : $url));
 }
コード例 #5
0
ファイル: colorguide.php プロジェクト: ponydevs/MLPVC-RR
        $ids = [];
        foreach ($search['hits']['hits'] as $hit) {
            $ids[] = $hit['_id'];
        }
        $Ponies = $CGDb->where('id IN (' . implode(',', $ids) . ')')->orderBy('order', 'ASC')->get('appearances');
    }
}
if (!$elasticAvail) {
    $_EntryCount = $CGDb->where('ishuman', $EQG)->where('id != 0')->count('appearances');
    $Pagination = new Pagination('cg', $AppearancesPerPage, $_EntryCount);
    $Ponies = Appearances::get($EQG, $Pagination->getLimit());
}
if (isset($_REQUEST['GOFAST'])) {
    if (empty($Ponies[0]['id'])) {
        Response::fail('The search returned no results.');
    }
    Response::done(array('goto' => "{$CGPath}/v/{$Ponies[0]['id']}-" . Appearances::getSafeLabel($Ponies[0])));
}
CoreUtils::fixPath("{$CGPath}/{$Pagination->page}" . (!empty($Restrictions) ? "?q={$SearchQuery}" : ''));
$heading = ($EQG ? 'EQG ' : '') . "{$Color} Guide";
$title .= "Page {$Pagination->page} - {$heading}";
if (isset($_GET['js'])) {
    $Pagination->respond(Appearances::getHTML($Ponies, NOWRAP), '#list');
}
$settings = array('title' => $title, 'heading' => $heading, 'css' => array($do), 'js' => array('jquery.qtip', 'jquery.ctxmenu', $do, 'paginate'));
if (Permission::sufficient('staff')) {
    $settings['css'] = array_merge($settings['css'], $GUIDE_MANAGE_CSS);
    $settings['js'] = array_merge($settings['js'], $GUIDE_MANAGE_JS);
}
CoreUtils::loadPage($settings);
コード例 #6
0
ファイル: index.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\Episodes;
use App\CoreUtils;
$CurrentEpisode = Episodes::getLatest();
if (empty($CurrentEpisode)) {
    CoreUtils::loadPage(array('title' => 'Home', 'view' => 'episode'));
}
Episodes::loadPage($CurrentEpisode);
コード例 #7
0
ファイル: users.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\CoreUtils;
use App\Permission;
if (!Permission::sufficient('staff')) {
    CoreUtils::notFound();
}
CoreUtils::loadPage(array('title' => 'Users', 'do-css'));
コード例 #8
0
ファイル: blending.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\CoreUtils;
use App\RegExp;
$HexPattern = preg_replace(new RegExp('^/(.*)/.*$'), '$1', $HEX_COLOR_REGEX->jsExport());
CoreUtils::loadPage(array('title' => "{$Color} Blending Calculator", 'do-css', 'do-js'));
コード例 #9
0
ファイル: browser.php プロジェクト: ponydevs/MLPVC-RR
<?php

use App\CoreUtils;
use App\Permission;
use App\RegExp;
/** @var $data string */
$AgentString = null;
if (is_numeric($data) && Permission::sufficient('developer')) {
    $SessionID = intval($data, 10);
    $Session = $Database->where('id', $SessionID)->getOne('sessions');
    if (!empty($Session)) {
        $AgentString = $Session['user_agent'];
    }
}
$browser = CoreUtils::detectBrowser($AgentString);
if (empty($browser['platform'])) {
    error_log('Could not find platform based on the following UA string: ' . preg_replace(new RegExp(INVERSE_PRINTABLE_ASCII_PATTERN), '', $AgentString));
}
CoreUtils::fixPath('/browser' . (!empty($Session) ? "/{$Session['id']}" : ''));
CoreUtils::loadPage(array('title' => 'Browser recognition test page', 'do-css', 'no-robots'));
コード例 #10
0
ファイル: about.php プロジェクト: ponydevs/MLPVC-RR
                    $Data['datasets'][] = $Dataset;
                }
                $ReservationData = $Database->rawQuery(str_replace('table_name', 'reservations', $query));
                if (!empty($ReservationData)) {
                    $Dataset = array('label' => 'Reservations', 'clrkey' => 1);
                    Statistics::processUsageData($ReservationData, $Dataset);
                    $Data['datasets'][] = $Dataset;
                }
                break;
            case 'approvals':
                $Labels = $Database->rawQuery("SELECT to_char(timestamp,'{$LabelFormat}') AS key\n\t\t\t\t\tFROM log\n\t\t\t\t\tWHERE timestamp > NOW() - INTERVAL '2 MONTHS' AND reftype = 'post_lock'\n\t\t\t\t\tGROUP BY key\n\t\t\t\t\tORDER BY MIN(timestamp)");
                Statistics::processLabels($Labels, $Data);
                $Approvals = $Database->rawQuery("SELECT\n\t\t\t\t\t\tto_char(MIN(timestamp),'{$LabelFormat}') AS key,\n\t\t\t\t\t\tCOUNT(*)::INT AS cnt\n\t\t\t\t\tFROM log\n\t\t\t\t\tWHERE timestamp > NOW() - INTERVAL '2 MONTHS' AND reftype = 'post_lock'\n\t\t\t\t\tGROUP BY to_char(timestamp,'{$LabelFormat}')\n\t\t\t\t\tORDER BY MIN(timestamp)");
                if (!empty($Approvals)) {
                    $Dataset = array('label' => 'Approved posts');
                    Statistics::processUsageData($Approvals, $Dataset);
                    $Data['datasets'][] = $Dataset;
                }
                break;
        }
        Statistics::postprocessTimedData($Data);
        CoreUtils::createUploadFolder($CachePath);
        file_put_contents($CachePath, JSON::encode($Data));
        Response::done(array('data' => $Data));
    }
    CoreUtils::notFound();
}
HTTP::pushResource('/about/stats-posts');
HTTP::pushResource('/about/stats-approvals');
CoreUtils::loadPage(array('title' => 'About', 'do-css', 'js' => array('Chart', $do)));