Ejemplo n.º 1
0
// If custom page
if (substr($pageName, -4) == '.php') {
    unset($_GET[$token->getTokenName()]);
    unset($_POST[$token->getTokenName()]);
    $pageCreators = PluginHelper::delegate('__onCreatePage', array(substr($pageName, 0, strlen($pageName) - 4), $_GET));
    if (count($pageCreators) == 1) {
        // Get single page creator
        foreach ($pageCreators as $p) {
            $pageCreator = $p;
        }
        // Does it implement PageCreator?
        if (!$pageCreator instanceof PageCreator) {
            Functions::log(Functions::LOG_ERROR, get_class($pageCreator) . ' does not implement interface PageCreator');
        } else {
            Templates::assign('pageTitle', $pageCreator->getTitle());
            Templates::assign('customContent', $pageCreator->getContent());
            Templates::display('custom');
        }
        exit;
    } else {
        if (count($pageCreators) > 1) {
            // CLASH OF PLUGINS!!
            $errorMessage = 'Page Creator conflict for page ' . $pageName . ':<br /><br /><ul>';
            foreach ($pageCreators as $package => $pageCreator) {
                $errorMessage .= '<b>' . $package . '</b>: ' . get_class($pageCreator);
            }
            $errorMessage .= '</ul>';
            Functions::log(Functions::LOG_ERROR, $errorMessage);
            exit;
        }
    }
Ejemplo n.º 2
0
<?php

require 'base.php';
$categories = ForumCategory::getAllCategories();
Templates::assign('categories', $categories);
PluginHelper::delegate('__onPageDisplay', array($page));
Templates::display('forums');
Ejemplo n.º 3
0
<?php

include 'base.php';
$profileUser = UserReadOnly::fromID((int) $_GET['id']);
if (!$profileUser instanceof UserReadOnly) {
    $errorMessage = 'User does not exist.';
    echo ErrorMessage::setText($errorMessage, true);
} else {
    Templates::assign('profileUser', $profileUser);
}
Templates::display('user');