Esempio n. 1
0
<?php

require_once "ClassLoader.php";
Log::debug("START: /index.php");
$meta_title = "Blueprints Example";
$meta_description = "Example page using Blueprints";
$content = new Content();
$content->addFile("index.inc");
include "template.inc";
Log::debug("END: /index.php" . "\n");
<?php

require_once "ClassLoader.php";
echo "<h1>Testing Content.php and Element.php</h1>";
echo "Adding content to sections...<br/><br/>";
// No pre-defined sections
$content = new Content();
$content->add("<h1>Hello World</h1>");
$content->addText("How are you?", 0);
$content->addFile("include-me.inc", "main");
// add index based section
$content->addHtml("<div class='aside'>#1 in the tri-county</div>", "alt");
$content->addHtml("<div class='aside'>Father's Day Sale this weekend</div>", 1);
echo "<h2>Debug String</h2>";
echo "<pre>";
echo $content->debugStr();
echo "</pre>";
echo "<br/><br/>";
// retrieve all
echo "All content...<br/>";
$elements = $content->elements();
foreach ($elements as $e) {
    echo "[" . $e->contentType() . "]" . $e->data() . "<br/>";
}
// retrieve first section
echo "<br/><hr/><br/>First section content...<br/>";
$elements = $content->elements(0);
foreach ($elements as $e) {
    echo "[" . $e->contentType() . "]" . $e->data() . "<br/>";
}
// retrieve second section
Esempio n. 3
0
        if (Login::loggedIn($domain)) {
            // Retrieve 'login' from users Login Session
            $login = Login::who($domain);
            // Retrieve member data
            $memberBP = BlueprintReader::read("Member.entity.xml");
            $memberDAO = new EntityDAO($memberBP);
            $matches = $memberDAO->findWhere("login", $login);
            if (count($matches) > 0) {
                $member = $matches[0];
                // Add data to the users session
                Session::user("member_id", $member->getId());
                // Required by Guardian
                // Forward user
                Log::debug("* REDIRECTING TO: {$destination}\n");
                header("location: {$destination}");
                exit;
            } else {
                // Should never happen, since users password was just checked
                Log::error("* Member with login '{$login}' was not found.");
                $content->addHtml("<strong>Login Error</strong><br/>");
                $content->addHtml("Message: Member with login '{$login}' was not found.");
                $content->addFile("login.frm");
            }
        } else {
            Log::warning("* Can't 'init' invalid login session.");
        }
    }
}
$content->addFile("login.frm");
include "template.inc";
Log::debug("END: /etc/auth/login.php" . "\n");
<?php

require_once "ClassLoader.php";
Log::notice("START: /blueprints/entity.php");
Login::requireLogin("blueprints", "/blueprints/login.php");
$meta_title = "Blueprints";
$meta_description = "Blueprints";
$meta_keywords = "blueprints";
$nav = array();
$content = new Content();
$blueprintSignature = $_REQUEST["blueprint"];
if (empty($blueprintSignature)) {
    $nav[] = "home";
    $content->addHtml("<h1>Blueprints</h1>");
    $content->addFile("index.inc");
} else {
    $action = $_REQUEST["action"];
    if (empty($action)) {
        $action = "add";
    }
    try {
        switch ($action) {
            case "add":
                $content->addHtml("<h1>New {$blueprintSignature}</h1>");
                $js = "\n\t\t\t\t<!-- BEGIN: Javascript -->\n\t\t\t\t<script>\n\t\t\t\t\t\$().ready(function() {\n\t\t\t\t\t\t\$.fn.conduit.debug = true;\n\t\t\t\t\t\t\$('.bp-draft-rendering').conduit({\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\tclear: {\n\t\t\t\t\t\t\t\t\ttext: true,\n\t\t\t\t\t\t\t\t\tlabel: 'Clear',\n\t\t\t\t\t\t\t\t\ticon: 'ui-icon-cancel',\n\t\t\t\t\t\t\t\t\tclick: function(event) {\n\t\t\t\t\t\t\t\t\t\tvar \$rendering = event.data.\$rendering;\n\t\t\t\t\t\t\t\t\t\t\$rendering.conduit('clear');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsave: {\n\t\t\t\t\t\t\t\t\ttext: true,\n\t\t\t\t\t\t\t\t\tlabel: 'Save',\n\t\t\t\t\t\t\t\t\ticon: 'ui-icon-disk',\n\t\t\t\t\t\t\t\t\tclick: function(event) {\n\t\t\t\t\t\t\t\t\t\tvar \$rendering = event.data.\$rendering;\n\t\t\t\t\t\t\t\t\t\t\$rendering.conduit('save');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t\t<!-- END: Javascript -->\n\t\t\t\t";
                $content->addHtml($js);
                try {
                    $html = DraftingDesk::renderForm("FormDrafter", $blueprintSignature);
                    $content->addHtml("{$html}");
                } catch (Exception $e) {
                    $html = "<div class='.error'>Caught Exception: " . $e->getMessage() . "</div>";
<?php

require_once "ClassLoader.php";
$content = new Content();
$content->addFile("sortable.inc");
include "template.inc";