diff --git a/api/api_default.php b/api/api_default.php index 36391df..7626bd4 100644 --- a/api/api_default.php +++ b/api/api_default.php @@ -6,27 +6,34 @@ abstract class api_default extends api_system { //https://developers.google.com/webmasters/ajax-crawling/docs/getting-started //mojotrollz.eu:80/web/flingit/?_escaped_fragment_=start%3Bhash.ce5504f67533ab3d881a32e1dcdd330aaeb27f19 public static function static__escaped_fragment_($_escaped_fragment_){ - $state = \SYSTEM\PAGE\State::get(1, $_escaped_fragment_,false); $html = new \DOMDocument(); - $html->loadHTML(static::default_page()->html($_escaped_fragment_)); + $html->loadHTML(static::default_page($_escaped_fragment_)); + $state = \SYSTEM\PAGE\State::get(static::get_apigroup(), $_escaped_fragment_,false); foreach($state as $row){ $frag = new \DOMDocument(); parse_str(\parse_url($row['url'],PHP_URL_QUERY), $params); - $frag->loadHTML(\SYSTEM\API\api::run('\SYSTEM\API\verify', static::get_class(), $params, 1, true, true)->html()); - $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(''); - $html->getElementsByTagName('head')[0]->appendChild($html->importNode($css_frag->documentElement,true)); + $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)); + $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(''); + $html->getElementsByTagName('head')[0]->appendChild($html->importNode($css_frag->documentElement,true)); + } } } - echo $html->saveHTML(); + echo $html->saveHTML(); + new \SYSTEM\LOG\COUNTER("API was called sucessfully."); die(); } - - public static function get_class(){ + public static function get_apigroup(){ + throw new \RuntimeException("Unimplemented");} + public static function get_class($params = null){ return self::class;} + public static function get_params($params){ + return $params;} public static function default_page($_escaped_fragment_ = null){ throw new \RuntimeException("Unimplemented");} diff --git a/dbd/sql/mysql/data/sai_api.sql b/dbd/sql/mysql/data/sai_api.sql index 494515f..f6ca346 100644 --- a/dbd/sql/mysql/data/sai_api.sql +++ b/dbd/sql/mysql/data/sai_api.sql @@ -5,6 +5,7 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1, 42, 1, 0, NULL, 'js', NULL); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (2, 42, 1, 0, NULL, 'css', NULL); -- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (3, 42, 0, 0, NULL, 'page', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5, 42, 4, -1, NULL, '_escaped_fragment_', 'STRING'); -- system_api INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (10, 42, 0, -1, NULL, 'call', NULL); diff --git a/sai/modules/saistart_sys_sai/tpl/content.tpl b/sai/modules/saistart_sys_sai/tpl/content.tpl index d502706..69b4aec 100644 --- a/sai/modules/saistart_sys_sai/tpl/content.tpl +++ b/sai/modules/saistart_sys_sai/tpl/content.tpl @@ -1,4 +1,4 @@ -Welcome to the SYSTEM Admin Interface - short SAI.
+Welcome to the SYSTEM Admin Interface - short SAI.
From here you can control and manage your Website.
diff --git a/sai/modules/saistart_sys_sai/tpl/saistart.tpl b/sai/modules/saistart_sys_sai/tpl/saistart.tpl index f82863b..e32a224 100644 --- a/sai/modules/saistart_sys_sai/tpl/saistart.tpl +++ b/sai/modules/saistart_sys_sai/tpl/saistart.tpl @@ -2,6 +2,6 @@

Design. Simple. Fast. Reliable. Innovative.

We write awesome code and we use SYSTEM and Twitter Bootstrap.

-
${content}
+
${content}
${login}
\ No newline at end of file diff --git a/sai/page/default_page.php b/sai/page/default_page.php index 32c1780..de3102a 100644 --- a/sai/page/default_page.php +++ b/sai/page/default_page.php @@ -1,9 +1,6 @@ '. - ''. + ''. ''; //''; return $result; @@ -45,10 +42,10 @@ class default_page extends \SYSTEM\PAGE\Page { private static function js(){ $result = ''. ''. - ''. + ''. ''. ''. - ''. + ''. ''. ''; return $result; @@ -67,19 +64,20 @@ class default_page extends \SYSTEM\PAGE\Page { return $result; } - public function html(){ - + public function html($_escaped_fragment_ = NULL){ $vars = array(); - $vars['css'] = $this->css(); - $vars['js'] = $this->js(); - + $vars['css'] = self::css(); + $vars['js'] = ''; + if(!$_escaped_fragment_){ + $vars['js'] = self::js();} $vars['menu_start'] = self::menu_start(); $vars['menu_sys'] = self::menu_sys(); $vars['menu_proj'] = self::menu_proj(); $vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG); $vars['title'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE); $vars['copyright'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT); - $vars['lang_switcher'] = self::lang_switcher(); + //$vars['lang_switcher'] = self::lang_switcher(); + $vars['lang_switcher'] = ''; $vars['PATH_LOCAL_IMG'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/img/'); $vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI)); diff --git a/sai/page/sai.tpl b/sai/page/sai.tpl index 3700d65..16349c1 100644 --- a/sai/page/sai.tpl +++ b/sai/page/sai.tpl @@ -2,7 +2,7 @@ ${title} - + ${css} ${js} @@ -30,6 +30,6 @@

- + diff --git a/sai/sai/SaiModule.php b/sai/sai/SaiModule.php index 703a019..e6583e4 100644 --- a/sai/sai/SaiModule.php +++ b/sai/sai/SaiModule.php @@ -1,12 +1,29 @@ html();} - +class SaiModule extends \SYSTEM\API\api_default{ + public static function get_apigroup(){ + return 42;} + public static function get_class($params = NULL){ + if(isset($params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD])){ + $classname = \str_replace('.', '\\', $params[\SYSTEM\SAI\saigui::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 $classname; + } else { + return NULL; + } + } + return self::class; + } + public static function get_params($params){ + $params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD]); + return $params;} + public static function default_page($_escaped_fragment_ = null){ + return (new \SYSTEM\SAI\default_page())->html($_escaped_fragment_);} public static function html_li_menu(){ throw new \RuntimeException("Unimplemented!");} //true or false -> if true no call to right_right() diff --git a/sai/sai/saigui.php b/sai/sai/saigui.php index 482e93b..4e50cd9 100644 --- a/sai/sai/saigui.php +++ b/sai/sai/saigui.php @@ -1,9 +1,7 @@