Exemplo n.º 1
0
 /**
  * Manage posts
  *
  * Calls the appropriate admin function based on the given command under the
  * posts area.<br />
  * Current available actions: list, edit, del, add.
  *
  * @return array When appropriate, a new display array for the parent site
  *               instance.
  */
 function adminPosts()
 {
     /*
           switch ($this->action) {
              case 'list': // default
                 $this->listPosts(@$this->parameters[0]);
                 break;
              case 'edit':
                 break;
              case 'edit-go':
                 break;
              case 'del':
                 break;
              case 'del-go':
                 break;
              case 'add':
                 break;
              case 'add-go':
                 break;
           }
     */
     $this->site->display = array('index');
     $this->site->display();
 }
Exemplo n.º 2
0
            // archive , array (month, year)
            $display = array('archive', array(@$path[3], @$path[2]));
            break;
        case 'about':
            // about , what
            $display = array('about', @$path[2]);
            break;
        case 'comments':
            // comments, postid, reply?, reply to what?
            $display = array('comments', $path[2], @$path[3], @$path[4]);
            break;
        case 'rss':
            // rdf feed
            $display = array('rss');
            break;
        case 'admin':
            // TODO admin
            $display = array('admin', $path[2], @$path[3], @$path[4], @$path[5]);
            break;
        default:
            // index
            $display = array('index');
            break;
    }
    $site->display = $display;
}
// display stuff
$site->display();
// say goodbye
$site->db->_Database();
/* Simba says Roar! */
Exemplo n.º 3
0
$current_page = isset($_GET['page']) ? $_GET['page'] : NULL;
##Make sure the table encoding settings are right
if ($config->get("runtime_character_set_alter", "database")) {
    $db->setCharacterSet($config->get("character_encoding", "database"));
    $db->setCharacterEncoding($config->get("character_set", "database"));
}
$Site = new Site($current_page, $db, $config, $profiler);
## Determine if we have requested debug mode
define('__IN_DEBUG_MODE__', $Site->isLoggedIn() && isset($_GET['debug']) ? true : false);
$profiler->sample("Page Initialization", PROFILE_LAP);
## Set a default content header
$Site->addHeaderToPage("Content-Type", "text/html; charset=UTF-8");
## We dont want to see error messages if in debug mode
$Site->setVerbose(__IN_DEBUG_MODE__ ? false : true);
#Render the page
$Site->display();
if (!__IN_DEBUG_MODE__) {
    print $Site->getTransformed();
} else {
    $active = 'xml';
    $xml = General::sanitize($Site->getXML());
    $xsl = str_replace("\r\n", "\n", trim($Site->getXSL()));
    $xsl = General::sanitize($xsl);
    $output = General::sanitize($Site->getTransformed());
    $xml = $xml != "" ? General::str2array($xml, false) : NULL;
    $xsl = $xsl != "" ? General::str2array($xsl) : NULL;
    $output = $output != "" ? General::str2array($output, false) : NULL;
    $page_name = $db->fetchVar("title", 0, "SELECT `title` FROM `tbl_pages` WHERE `handle` = '" . $Site->_page . "'");
    $page_id = $db->fetchVar("id", 0, "SELECT `id` FROM `tbl_pages` WHERE `handle` = '" . $Site->_page . "'");
    $type = $_GET['line_numbers'] == 'false' ? 'ul' : 'ol';
    $result = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
require_once LIBRARY . "/class.site.php";
require_once TOOLKIT . "/class.profiler.php";
require_once TOOLKIT . "/class.xmlrepair.php";
$active = "xml";
switch ($_REQUEST['type']) {
    case "page":
        $profiler = new Profiler();
        $Site = new Site($page_handle, $DB, $Admin->_config, $profiler, false);
        $page_name = $DB->fetchVar("title", 0, "SELECT `title` FROM `tbl_pages` WHERE `handle` = '" . $Site->_page . "'");
        $profiler->sample("Page Initialization", PROFILE_LAP);
        ##Use preview mode
        if ($_GET['mode'] == 'preview') {
            $Site->togglePreviewMode();
        }
        #Render the page
        $output = $Site->display(array(), 'TRANSFORMED', false);
        $xml = $Site->buildXML(NULL, NULL, true, false);
        $xsl = $Site->display(array(), "XSL", false);
        #Record the render time
        $profiler->sample("Total Page Render Time");
        break;
    case "datasource":
        $DSM = new DatasourceManager(array('parent' => &$Admin));
        $obXML = new XMLElement("data");
        $obXML->setIncludeHeader(true);
        ##DATASOURCES
        $dsParam = array("indent-depth" => 2, "caching" => false, "indent" => true, "preview" => true);
        $ds =& $DSM->create($page_handle, array('parent' => $this, 'env' => array()));
        $result = $ds->preview($dsParam);
        if (@is_object($result)) {
            $xml = trim($result->generate(true, 0));