public function editAction()
 {
     $pageId = Request::getParam('pageId');
     if ($pageId === false) {
         $this->doesNotExist();
         return;
     }
     $properties = $this->pages->getProperties($pageId);
     if ($properties === false) {
         $this->doesNotExist();
         return;
     }
     if (!$this->helpers->canAccessPage($pageId, Acl::ACTION_EDIT)) {
         $this->accessDenied();
         return;
     }
     $this->view->assign('pageId', $pageId);
     $pages = DataStructure::pagesArray();
     if (isset($pages[$properties['template-id']])) {
         $this->view->assign('pageDataStructure', $pages[$properties['template-id']]['structure']);
         /*Helpers::dump($pages[$properties['template-id']]['structure']);
           die();*/
     }
     $isGlobalElementsPage = false;
     if ($properties['template-id'] == Pages::GLOBAL_ELEMENTS) {
         $isGlobalElementsPage = true;
     }
     $this->view->assign('isGlobalElementsPage', $isGlobalElementsPage);
 }
 public static function load($reload = false)
 {
     if ($reload) {
         unset(self::$pages);
         self::$pages = null;
         unset(self::$pages_object);
         self::$pages_object = null;
         unset(self::$elements);
         self::$elements = null;
         unset(self::$elements_object);
         self::$elements_object = null;
     }
     if (self::$pages == null) {
         self::$pages = self::loadArray(APPLICATION_ROOT . 'system/custom/data-structure/pages.php', true);
         foreach (self::$pages as $key => $page) {
             self::$pages[$key]['structure'] = self::loadArray(APPLICATION_ROOT . 'system/custom/data-structure/pages/' . $page['structure'], true);
         }
         self::$elements = self::loadArray(APPLICATION_ROOT . 'system/custom/data-structure/elements.php', false);
         if (count(self::$elements) > 0) {
             foreach (self::$elements as $key => $element) {
                 self::$elements[$key]['structure'] = self::loadArray(APPLICATION_ROOT . 'system/custom/data-structure/elements/' . $element['structure'], true);
             }
         }
         self::$pages_object = new RecursiveArrayObject(self::$pages);
         self::$elements_object = new RecursiveArrayObject(self::$elements);
     }
 }
 private function getPageStructure($template_id)
 {
     if ($this->pages_structure == null) {
         $this->pages_structure = DataStructure::pagesArray();
     }
     if (isset($this->pages_structure[$template_id]['structure'])) {
         return $this->pages_structure[$template_id]['structure'];
     }
     return null;
 }
 public function getAction()
 {
     $id = Request::postParam('pageId');
     // �berpr�fen, ob die Lebenswichtigen Parameter gesetzt sind
     if ($id === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     // �berpr�fen, ob die Seite �berhaupt (noch) existiert
     $properties = $this->pages->getProperties($id);
     if ($properties === false) {
         $this->error(self::RESULT_ERROR_DOES_NOT_EXIST);
         return;
     }
     // Nutzerrechte �berpr�fen
     if (!$this->helpers->canAccessPage($id, Acl::ACTION_EDIT)) {
         $this->error(self::RESULT_ERROR_NOT_AUHTORIZED);
         return;
     }
     // Daten der gew�nschten Seite laden (kommt als JSON-encodierter String)
     $data = $this->pages->getData($id);
     if ($data === false) {
         $this->error();
         return;
     }
     $decoded_data = json_decode($data);
     // Die Struktur-Arrays f�r diese Seite und die verf�gbaren Elemente laden
     $pages_structure = DataStructure::pagesArray();
     if (!isset($pages_structure[$properties['template-id']]['structure'])) {
         $this->customError('A template with the ID "' . $properties['template-id'] . '" does not exist.');
         return;
     }
     $page_structure = $pages_structure[$properties['template-id']]['structure'];
     $elements = DataStructure::elementsArray();
     // Plugins aufrufen, die m�glicherweise noch was zu den Parametern der Daten-Felder hinzuzuf�gen haben...
     $parameters = array('pageId' => $id, 'templateId' => $properties['template-id']);
     $this->applyPluginsToDataFieldsParametersPage(Plugins::LOAD_PAGE_DATA_FIELD_PARAMETERS, $parameters, $page_structure);
     $this->applyPluginsToDataFieldsParametersElements(Plugins::LOAD_PAGE_DATA_FIELD_PARAMETERS, $parameters, $elements);
     // Die Ausgabe in ein Array packen
     $return = array('pageContent' => $decoded_data, 'pageStructure' => $page_structure, 'elements' => $elements);
     // Yo.
     $this->success($return);
 }
 public function walkElementContainer(&$data, $structure, $parameters)
 {
     if (is_array($data)) {
         if (count($data) > 0) {
             $elements_structure = DataStructure::elementsArray();
             for ($element_index = 0; $element_index < count($data); $element_index++) {
                 $element_data =& $data[$element_index]['content'];
                 $element_id = $data[$element_index]['elementId'];
                 $element_parameters = array('elementId' => $element_id, 'elementIndex' => $element_index);
                 $element_parameters = array_merge($parameters, $element_parameters);
                 if (!isset($elements_structure[$element_id])) {
                     Helpers::fatalError('DataModifier: A element with the ID [' . $element_id . '] does not exist.');
                 }
                 $element_structure = $elements_structure[$element_id]['structure'];
                 $this->modifyFields($element_data, $element_structure, $element_parameters);
                 $this->walkFields($element_data, $element_structure, $element_parameters);
             }
         }
     }
 }
Exemplo n.º 6
0
    if ($toFileInt > 0) {
        $toFile = TRUE;
    }
}
//echo $json
set_error_handler(function () {
    die("Json processing error :(. I cannot tell you were exactly so please use third-party parser to check your json.");
});
//
//function myErrorHandler($errno, $errstr, $errfile, $errline) {
//    echo "<b>Custom error:</b> [$errno] $errstr<br>";
//    echo " Error on line $errline in $errfile<br>";
//}
//set_error_handler("myErrorHandler");
require 'engine.php';
$map = new DataStructure();
$map->setSystem($system);
$map->setSerializedNames($addSeriazedNames);
$json_array = json_decode($json, TRUE);
$depth = 0;
$stack = array();
require 'dateTest.php';
function getTypeName($val, $argument = null)
{
    $type = gettype($val);
    global $detectDateMode;
    switch ($type) {
        case "string":
            if ($detectDateMode == 1 && isDate($val)) {
                return "Date";
            } else {
Exemplo n.º 7
0
        $configuration_ok = false;
    } else {
        if (!is_array($config['languages']['list'])) {
            $configuration_ok = false;
        } else {
            if (count($config['languages']['list']) < 1) {
                $configuration_ok = false;
            }
        }
    }
    if (!$configuration_ok) {
        Helpers::fatalError('The system is not properly configured (in /system/custom/config/main.config.php)', true);
    }
}
// Datenstruktur, Plugins, Module, Modifikatoren laden
DataStructure::load();
Plugins::load();
FrontendModules::load();
DataModifiers::load();
// Frontend-Controller-Klassen-Datei laden
$controller_file_name = Config::get()->frontendController->classFile;
if (!file_exists($controller_file_name)) {
    Helpers::fatalError('Frontend controller class file not found (' . $controller_file_name . ' doesn\'t exist)!', true);
}
require_once $controller_file_name;
// Klasse instanziieren
$controller_class_name = Config::get()->frontendController->className;
if (!class_exists($controller_class_name)) {
    Helpers::fatalError('Frontend controller class not found (class "' . $controller_class_name . '" doesn\'t exist in ' . $controller_file_name . ')!', true);
}
$controller = new $controller_class_name();
Exemplo n.º 8
0
 public function infoAction()
 {
     $id = Request::postParam('pageId');
     $languageId = Request::postParam('languageId');
     // �berpr�fen, ob die Lebenswichtigen Parameter gesetzt sind
     if ($id === null || $languageId === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     // �berpr�fen, ob die Seite �berhaupt (noch) existiert
     $properties = $this->pages->getProperties($id);
     if ($properties === false) {
         $this->error(self::RESULT_ERROR_DOES_NOT_EXIST);
         return;
     }
     // Name des Templates auslesen
     $pages = DataStructure::pagesArray();
     if ($properties['template-id'] === null) {
         $template_name = Translate::get('Link / Redirection');
     } else {
         if (isset($pages[$properties['template-id']])) {
             $template_name = $pages[$properties['template-id']]['name'];
         } else {
             $template_name = Translate::get('Unknown');
         }
     }
     // Infos sammeln
     $result = array(array('description' => Translate::get('Title'), 'value' => $this->pages->getAnyCaption($id, $languageId)), array('description' => Translate::get('Status'), 'value' => $this->getStatusString($properties['status'])), array('description' => Translate::get('Active'), 'value' => $properties['active'] > 0 ? Translate::get('Yes') : Translate::get('No')), array('description' => Translate::get('Visible'), 'value' => $this->pages->isPageVisible($id, $languageId) ? Translate::get('Yes') : Translate::get('No')), array('description' => Translate::get('Last change'), 'value' => $this->getDateString($properties['last-change-date']) . '&nbsp;&nbsp;(' . Translate::get('by') . ' ' . $this->getUserName($properties['last-change-user-id'], $properties['last-change-user-name']) . ')'), array('description' => Translate::get('Created'), 'value' => $this->getDateString($properties['creation-date']) . '&nbsp;&nbsp;(' . Translate::get('by') . ' ' . $this->getUserName($properties['creation-user-id'], $properties['creation-user-name']) . ')'), array('description' => Translate::get('Subpages'), 'value' => $this->pages->getSubpageCount($id)), array('description' => Translate::get('Template'), 'value' => $template_name));
     // Infos zur�ckgeben
     $this->success(array('infos' => $result));
 }
 public function getArray($language_id = null, $smarty = null, $parameters = null)
 {
     // Wenn keine Sprache angegeben, Standard-Sprache annehmen
     if ($language_id === null) {
         $language_id = Config::get()->languages->standard;
     }
     // Die "rohen" Daten laden
     $input = $this->getArrayRaw();
     $output = null;
     if ($input !== null) {
         // Seiten-Eigenschaften laden
         $page_id = $this->loaded_page_id;
         $page_properties = $this->pages->getProperties($page_id);
         if ($page_properties === false) {
             return null;
         }
         // Daten-Struktur für diese Seite laden
         $pages_structure = DataStructure::pagesArray();
         if (!isset($pages_structure[$page_properties['template-id']]['structure'])) {
             Helpers::debugError('A page template with the ID "' . $page_properties['template-id'] . '" does not exist!');
             return null;
         }
         $page_structure = $pages_structure[$page_properties['template-id']]['structure'];
         // Der Pfad zu den zugehörigen Dateien (Bilder) einer Seite unterscheiden sich
         // je nachdem, ob die veröffentlichte oder die editierte Version der Seite angefragt wurde
         if ($this->isPublished()) {
             $page_files = $this->pages->getPageFilesPublishedFolder($page_id, $page_properties);
             $page_files_url = $this->pages->getPageFilesPublishedUrl($page_id, $page_properties);
         } else {
             $page_files = $this->pages->getPageFilesEditFolder($page_id, $page_properties);
             $page_files_url = $this->pages->getPageFilesEditUrl($page_id, $page_properties);
         }
         $page_url = $this->pages->getPageUrl($page_id, $language_id, $page_properties);
         // Die Parameter für die Plugins und Modifikatoren zusammenstellen
         // ggf. werden einige oder alle dieser Parameter über die Variable $parameters
         // wieder überschrieben
         if (!is_array($parameters)) {
             $parameters = array();
         }
         $standard_parameters = array('preview' => !$this->isPublished(), 'pageId' => $page_id, 'languageId' => $language_id, 'templateId' => $page_properties['template-id'], 'uniqueId' => $page_properties['unique-id'], 'pageUrl' => $page_url, 'pageFiles' => $page_files, 'pageFilesUrl' => $page_files_url);
         if ($smarty !== null) {
             $standard_parameters['smarty'] = $smarty;
         }
         $parameters = array_merge($standard_parameters, $parameters);
         // Das Ausgabe-Array wird ggf. durch Plugins und
         // höchstwahrscheinlich durch die Modifikatoren geändert
         $output = $input;
         if ($smarty !== null) {
             $this->pages->applyPluginsToDataFields(Plugins::ASSIGN_PAGE_DATA_FIELD, $parameters, $output, $page_properties);
         }
         DataModifiers::applyAll($output, $page_structure, $parameters);
     }
     return $output;
 }
        ?>
 edit-template-id"
                                            data-saved-value="<?php 
        if ($var->properties['template-id'] == null) {
            echo 'NULL';
        } else {
            echo $var->properties['template-id'];
        }
        ?>
"<?php 
    }
    ?>
">
                                    <?php 
    $counter = 0;
    $templates = DataStructure::pagesArray();
    foreach ($templates as $template_id => $template) {
        if ($template_id != Pages::GLOBAL_ELEMENTS) {
            ?>
                                            <option
                                                value="<?php 
            echo $template_id;
            ?>
"<?php 
            if ($template_id == $var->properties['template-id']) {
                echo ' selected';
            }
            ?>
><?php 
            echo $template['name'];
            ?>
 public function getPage($page_id, $language_id, $preview = false)
 {
     // Smarty initialisieren
     $smarty = new Template();
     // Seiten-Infos laden
     $pages = new Pages();
     $page_properties = $pages->getProperties($page_id);
     if ($page_properties === false) {
         Helpers::fatalError('A page with the ID "' . $page_id . '" does not exist!');
     }
     // Wenn die Vorschau-Version der Seite angefordert wurde,
     // überprüfen, ob überhaupt eine editierte Version der Seite existiert,
     // wenn nicht, Vorschau-Modus ignorieren
     if ($preview) {
         if ($page_properties['status'] == Pages::STATUS_PUBLISHED) {
             $preview = false;
         }
     }
     // Seiteneigenes Verzeichnis abhängig von $preview auslesen
     if ($preview) {
         $page_files = $pages->getPageFilesEditFolder($page_id, $page_properties);
         $page_files_url = $pages->getPageFilesEditUrl($page_id, $page_properties);
     } else {
         $page_files = $pages->getPageFilesPublishedFolder($page_id, $page_properties);
         $page_files_url = $pages->getPageFilesPublishedUrl($page_id, $page_properties);
     }
     $page_url = $pages->getPageUrl($page_id, $language_id, $page_properties);
     // Grundlegende Variablen zuweisen, die zwar mit dem Inhalt nichts zu tun haben, aber wichtig sind :-)
     $smarty->assign('baseUrl', Config::get()->baseUrl);
     $smarty->assign('publicUrl', Config::get()->baseUrl . 'system/custom/frontend/public/');
     $smarty->assign('pageUrl', $page_url);
     $smarty->assign('pageId', $page_id);
     $smarty->assign('languageId', $language_id);
     $smarty->assign('templateId', $page_properties['template-id']);
     $smarty->assign('uniqueId', $page_properties['unique-id']);
     $smarty->assign('pageFiles', $page_files);
     $smarty->assign('pageFilesUrl', $page_files_url);
     $languages = Config::get()->languages->list->getArrayCopy();
     foreach ($languages as $key => $value) {
         $languages[$key]['id'] = $key;
     }
     $smarty->assign('languages', $languages);
     // Seiten-Struktur laden
     $pages_structure = DataStructure::pagesArray();
     if (!isset($pages_structure[$page_properties['template-id']]['structure'])) {
         Helpers::fatalError('A page template with the ID "' . $page_properties['template-id'] . '" does not exist!');
     }
     $page_structure = $pages_structure[$page_properties['template-id']]['structure'];
     // Die folgenden Parameter werden an die Modifikatoren und Plugins übergeben
     $parameters = array('preview' => $preview, 'pageId' => $page_id, 'languageId' => $language_id, 'templateId' => $page_properties['template-id'], 'uniqueId' => $page_properties['unique-id'], 'pageUrl' => $page_url, 'pageFiles' => $page_files, 'pageFilesUrl' => $page_files_url, 'smarty' => $smarty);
     // Seiten-Inhalt laden
     $content_object = new PageContent();
     if (!$content_object->load($page_id, !$preview)) {
         Helpers::fatalError('The content of the page with the ID "' . $page_id . '" could not be loaded!');
     }
     $page_content = $content_object->getArray($language_id, $smarty, $parameters);
     // Globale Elemente laden
     $this->loadGlobalElementsPage($smarty, $language_id);
     $this->assignGlobalElementsToSmarty($smarty, $language_id);
     // Inhalte zuweisen
     foreach ($page_structure as $block_id => $block) {
         if ($block['type'] == 'datablock') {
             $block_data = null;
             if (isset($page_content[$block_id])) {
                 $block_data = $page_content[$block_id];
             }
             $smarty->assign($block_id, $block_data);
         } elseif ($block['type'] == 'container') {
             $container_content = '';
             if (isset($page_content[$block_id])) {
                 if (is_array($page_content[$block_id])) {
                     foreach ($page_content[$block_id] as $container_element_key => $container_element) {
                         $container_content = $container_content . $this->getElement($page_id, $language_id, $container_element['elementId'], $container_element['content'], $preview);
                     }
                 }
             }
             $smarty->assign($block_id, $container_content);
         }
     }
     // registrierte Plugins aufrufen, vielleicht hat ja noch jemand etwas hinzuzufügen :-)
     Plugins::call(Plugins::ASSIGN_PAGE_DATA, $parameters);
     // Smarty-Template für die Template-ID der aktuellen Seite zurückgeben
     $page_template = $pages_structure[$page_properties['template-id']];
     return $smarty->fetch('file:[pages]' . $page_template['template']);
 }
Exemplo n.º 12
0
 public function isGlobalElementsPageTemplateAvailable()
 {
     $templates = DataStructure::pages();
     if (isset($templates[self::GLOBAL_ELEMENTS])) {
         return true;
     }
     return false;
 }