Example #1
0
 public static function static__escaped_fragment_($_escaped_fragment_)
 {
     \libxml_use_internal_errors(true);
     $html = new \DOMDocument();
     $html->loadHTML(static::default_page($_escaped_fragment_ ? $_escaped_fragment_ : true));
     if ($error = \libxml_get_last_error()) {
         //new \SYSTEM\LOG\ERROR('Parse Error: '.$error->message.' line:'.$error->line.' html: '.$html->saveHTML());
         \libxml_clear_errors();
     }
     $state = \SYSTEM\PAGE\State::get(static::get_apigroup(), $_escaped_fragment_ ? $_escaped_fragment_ : static::get_default_state(), false);
     foreach ($state as $row) {
         $frag = new \DOMDocument();
         parse_str(\parse_url($row['url'], PHP_URL_QUERY), $params);
         $class = static::get_class($params);
         if ($class) {
             $frag->loadHTML(\SYSTEM\API\api::run('\\SYSTEM\\API\\verify', $class, static::get_params($params), static::get_apigroup(), true, false));
             if ($error = \libxml_get_last_error()) {
                 //new \SYSTEM\LOG\ERROR('Parse Error: '.$error->message.' line:'.$error->line.' html: '.$frag->saveHTML());
                 \libxml_clear_errors();
             }
             $html->getElementById(substr($row['div'], 1))->appendChild($html->importNode($frag->documentElement, true));
             //Load subpage css
             foreach ($row['css'] as $css) {
                 $css_frag = new \DOMDocument();
                 $css_frag->loadHTML('<link href="' . $css . '" rel="stylesheet" type="text/css">');
                 $html->getElementsByTagName('head')[0]->appendChild($html->importNode($css_frag->documentElement, true));
             }
         }
     }
     echo $html->saveHTML();
     new \SYSTEM\LOG\COUNTER("API was called sucessfully.");
     die;
 }
Example #2
0
 public function html()
 {
     //register docu here, we require path so system must be started
     \SYSTEM\DOCU\docu::register(array('id' => 'system', 'inpath' => new \SYSTEM\PSYSTEM(), 'outpath' => new \SYSTEM\PSYSTEM('docu/system/'), 'inpath_md' => new \SYSTEM\PSYSTEM('docu/system/structure.xml'), 'outpath_md' => new \SYSTEM\PSYSTEM('docu/system_wiki/'), 'cachepath' => new \SYSTEM\PSYSTEM('docu/system/cache/'), 'ignore' => array('lib/animate/*', 'lib/bootstrap/*', 'lib/bootstrap_growl/*', 'lib/git/*', 'lib/jqbootstrapvalidation/*', 'lib/jquery/*', 'lib/lettering/*', 'lib/markdown/*', 'lib/minify/*', 'lib/phpdocumentor/*', 'lib/scssphp/*', 'lib/tablesorter/*', 'lib/texttilate/*', 'lib/tinymce/*'), 'sourcecode' => true, 'parseprivate' => false, 'title' => 'SYSTEM - PHP Framework'));
     \SYSTEM\SECURITY\Security::isLoggedIn();
     // refresh session
     //Direct JSON Input
     $pg = json_decode(file_get_contents("php://input"), true);
     if (!$pg) {
         $pg = array_merge($_POST, $_GET);
     }
     if (isset($pg[self::SAI_MOD_POSTFIELD])) {
         $classname = \str_replace('.', '\\', $pg[self::SAI_MOD_POSTFIELD]);
         $pg[self::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[self::SAI_MOD_POSTFIELD]);
         $mods = \SYSTEM\SAI\sai::getAllModules();
         if ($classname && \array_search($classname, $mods) !== false && (\call_user_func(array($classname, 'right_public')) || \call_user_func(array($classname, 'right_right')))) {
             return \SYSTEM\API\api::run('\\SYSTEM\\API\\verify', $classname, $pg, 42, true, false);
         } else {
             return '<meta http-equiv="refresh" content="0; url=./sai.php">You are no longer logged in. Page reload in 5sec...';
         }
     } else {
         return \SYSTEM\API\api::run('\\SYSTEM\\API\\verify', '\\SYSTEM\\SAI\\SaiModule', $pg, 42, false, true);
     }
 }