From df312bdc1bd8f5c77de1e0d47feca2c0ab2e8cc1 Mon Sep 17 00:00:00 2001 From: ahwelp Date: Wed, 22 Jul 2020 03:34:33 -0300 Subject: [PATCH] More changes --- app/core/generator/GeneratorController.php | 259 +++++++++++++----- app/core/sanity/MigratorController.php | 198 +++++++++++++ app/core/sanity/Routes.php | 23 +- app/core/sanity/classes/Migrator.class.php | 183 ------------- app/core/template/Output.class.php | 3 +- .../template/classes/dashboard/Dashboard.php | 5 +- .../template/classes/dashboard/template.html | 2 + config/database.php | 40 +++ public/dist/script.js | 2 +- public/dist/style.css | 30 +- public/robots.txt | 2 + 11 files changed, 461 insertions(+), 286 deletions(-) create mode 100755 app/core/sanity/MigratorController.php delete mode 100755 app/core/sanity/classes/Migrator.class.php create mode 100755 config/database.php create mode 100644 public/robots.txt diff --git a/app/core/generator/GeneratorController.php b/app/core/generator/GeneratorController.php index d1f1673..c837242 100755 --- a/app/core/generator/GeneratorController.php +++ b/app/core/generator/GeneratorController.php @@ -7,7 +7,7 @@ class GeneratorController { private $langBase = <<addColumn("name", 'string', Array('null' => false)); - \$table->addColumn("time", 'timestamp', Array('null' => true, 'default'=>null)); - \$table->addColumn("areaid", 'integer', Array('null' => false)); + if (\$pluginversion < "0.0.1") { + \$table = Wrapper::get_table("{{PLUGIN_NAME}}"); + \$table->addColumn("name", "string", Array("null" => false)); + \$table->addColumn("time", "timestamp", Array("null" => true, "default"=>null)); + \$table->addColumn("areaid", "integer", Array("null" => false)); \$table->addTimestamps(); \$table->addSoftDelete(); \$table->create(); - Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.0'); + Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.0"); return; } - //if (\$pluginversion < '1.0.1') { - //\$table = Wrapper::get_table('{{PLUGIN_NAME}}'); - //Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.1'); + //if (\$pluginversion < "0.0.2") { + //\$table = Wrapper::get_table("{{PLUGIN_NAME}}"); + //Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.1"); //return; //} } + + function {{PLUGIN_NAME}}_rollback(\$pluginversion) { + if(\$pluginversion > "0.0.1"){ + \$table = Wrapper::get_table("{{PLUGIN_NAME}}"); + \$table->drop(); + return; + } + } EOL; private $versionBase = <<name = '{{PLUGIN_NAME}}'; - \$plugin->version = '0.0.1'; + \$plugin->name = "{{PLUGIN_NAME}}"; + \$plugin->version = "0.0.1"; - //\$plugin->require = Array( ["name" => "plugin_name", "version" => 'x.x.x'] ); + //\$plugin->require = Array( ["name" => "plugin_name", "version" => "x.x.x"] ); EOL; private $controllerBase = @@ -55,38 +63,93 @@ class GeneratorController { namespace {{NAMESPACE}}; use \{{NAMESPACE}}\Classes\{{OBJECT}} as {{OBJECT}}; - + use \App\Core\Template\Output as Output; + class {{CONTROLLER}} { - + + /** + * Index + * Show the main {{OBJECT}} list + */ function index(){ - + Output::setView('index'); + \$list = Array(); + + for(\$i = 0; \$i <= 10; \$i++){ + \$obj = Array(); + \$obj['id'] = \$i; + \$obj['value'] = md5(\$i); + \$obj['description'] = sha1(\$i); + \$list[] = \$obj; + } + Output::addValue('list', \$list ); + Output::render(); } + /** + * Create + * Render the main {{OBJECT}} formular + */ function create(){ - + Output::setView('form', ['id' => 0]); + Output::render(); } - function Store(){ + /** + * Store + * Store the param on the database + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function store({{OBJECT}} \${{OBJECT_LOWER}}){ } - function show({{OBJECT}} \{{OBJECT_LOWER}}){ + /** + * Show + * Render one register + * + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function show({{OBJECT}} \${{OBJECT_LOWER}}){ } - function edit({{OBJECT}} \{{OBJECT_LOWER}}){ + /** + * Edit + * Render the formular for a database {{OBJECT}} + * + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function edit({{OBJECT}} \${{OBJECT_LOWER}}){ } - function update({{OBJECT}} \{{OBJECT_LOWER}}){ + /** + * Update + * Store the changes of the param on the database + * + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function update({{OBJECT}} \${{OBJECT_LOWER}}){ } - function destroy({{OBJECT}} \{{OBJECT_LOWER}}){ + /** + * Destroy + * If the object has soft delete. + * + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function destroy({{OBJECT}} \${{OBJECT_LOWER}}){ } - - function purge({{OBJECT}} \{{OBJECT_LOWER}}){ + /** + * Purge + * Remove object even with soft delete. + * + * @param {{OBJECT}} \${{OBJECT_LOWER}} + */ + function purge({{OBJECT}} \${{OBJECT_LOWER}}){ } } @@ -103,15 +166,15 @@ class GeneratorController { class {{OBJECT}} extends Entity { - //const _idPolice = Array('type' => '', 'min' => 0, 'max' => 100000, 'step' => 2); + //const _idPolice = Array("type" => "", "min" => 0, "max" => 100000, "step" => 2); - const _tableName = '{{TABLE_NAME}}'; - //const _properties = Array('id', 'name'); + const _tableName = "{{TABLE_NAME}}"; + //const _properties = Array("id", "name"); //const _timestamps = true; //const _softdelete = true; - //const _connectionName = ''; + //const _connectionName = ""; } EOL; @@ -121,17 +184,64 @@ class GeneratorController { use Routes\RouteCollection as RouteCollection; - RouteCollection::group('/{{PLUGIN_NAME}}', function(){ - RouteCollection::get ('/', '\{{NAMESPACE}}\{{CONTROLLER}}@index'); - RouteCollection::get ('/', '\{{NAMESPACE}}\{{CONTROLLER}}@create'); - RouteCollection::post ('/', '\{{NAMESPACE}}\{{CONTROLLER}}@store'); - RouteCollection::get ('/[i:id]', '\{{NAMESPACE}}\{{CONTROLLER}}@show'); - RouteCollection::get ('/[i:id]/edit', '\{{NAMESPACE}}\{{CONTROLLER}}@edit'); - RouteCollection::put ('/[i:id]/edit', '\{{NAMESPACE}}\{{CONTROLLER}}@update'); - RouteCollection::delete('/[i:id]', '\{{NAMESPACE}}\{{CONTROLLER}}@destroy'); + RouteCollection::group("/{{PLUGIN_NAME}}", function(){ + RouteCollection::get ("/", "\{{NAMESPACE}}\{{CONTROLLER}}@index"); + RouteCollection::get ("/form", "\{{NAMESPACE}}\{{CONTROLLER}}@create"); + RouteCollection::post ("/", "\{{NAMESPACE}}\{{CONTROLLER}}@store"); + RouteCollection::get ("/[i:id]", "\{{NAMESPACE}}\{{CONTROLLER}}@show"); + RouteCollection::get ("/[i:id]/edit", "\{{NAMESPACE}}\{{CONTROLLER}}@edit"); + RouteCollection::put ("/[i:id]/edit", "\{{NAMESPACE}}\{{CONTROLLER}}@update"); + RouteCollection::delete("/[i:id]", "\{{NAMESPACE}}\{{CONTROLLER}}@destroy"); }); EOL; + private $indexTemplate = + <<Adicionar +
+ + + + + + + + + + + + {{#list}} + + + + + + + {{/list}} +
IdValueDescriptionActions
{{id}}{{value}}{{description}} + + + + +
+
+ EOL; + + private $formTemplate = + << + + + {{@ else: @}} +
+ + {{@ endif; @}} + +
+ EOL; + + private $ctagsHeader = <<langBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->langBase); $this->langBase = str_replace("{{PLUGIN_NAME_PRETTY}}", $plugin_name_pretty, $this->langBase); - file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/en.php', $this->langBase); - file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/'.APP_LANG.'.php', $this->langBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/en.php", $this->langBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/".APP_LANG.".php", $this->langBase); $this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->migrationBase); - file_put_contents(DIR_APP.$subname . '/' . $name . '/db/Migrate.php', $this->migrationBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/db/Migrate.php", $this->migrationBase); $this->routeBase = str_replace("{{NAMESPACE}}", $namespace, $this->routeBase); $this->routeBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->routeBase); $this->routeBase = str_replace("{{CONTROLLER}}", $controller, $this->routeBase); - file_put_contents(DIR_APP.$subname . '/' . $name . '/Routes.php', $this->routeBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/Routes.php", $this->routeBase); - $this->objectBase = str_replace("{{NAMESPACE}}", $namespace.'\Classes', $this->objectBase); + $this->objectBase = str_replace("{{NAMESPACE}}", $namespace."\Classes", $this->objectBase); $this->objectBase = str_replace("{{OBJECT}}", $object, $this->objectBase); $this->objectBase = str_replace("{{TABLE_NAME}}", $name, $this->objectBase); - file_put_contents(DIR_APP.$subname . '/' . $name . "/classes/$object.php", $this->objectBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/classes/$object.php", $this->objectBase); $this->controllerBase = str_replace("{{NAMESPACE}}", $namespace, $this->controllerBase); $this->controllerBase = str_replace("{{OBJECT}}", $object, $this->controllerBase); - $this->controllerBase = str_replace("{{OBJECT_LOWER}}",strlower($object), $this->controllerBase); + $this->controllerBase = str_replace("{{OBJECT_LOWER}}",strtolower($object), $this->controllerBase); $this->controllerBase = str_replace("{{CONTROLLER}}", $controller, $this->controllerBase); - file_put_contents(DIR_APP.$subname . '/' . $name . "/$controller.php", $this->controllerBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/$controller.php", $this->controllerBase); + $this->versionBase = str_replace("{{PLUGIN_NAME}}", $subname."_".$plugin_name, $this->versionBase); + file_put_contents(DIR_APP.$subname . "/" . $name . "/version.php", $this->versionBase); + + $this->indexTemplate = str_replace("{{ENDPOINT}}", $plugin_name, $this->indexTemplate); + file_put_contents(DIR_APP.$subname . "/" . $name . "/views/index.mustache", $this->indexTemplate); + + $this->formTemplate = str_replace("{{ENDPOINT}}", $plugin_name, $this->formTemplate); + file_put_contents(DIR_APP.$subname . "/" . $name . "/views/form.mustache", $this->formTemplate); + } function listRoutes(){ - echo str_pad('VERB', 10, ' ', STR_PAD_BOTH) . "||"; - echo str_pad('URI' , 35, ' ', STR_PAD_BOTH) . "||"; - echo str_pad('W', 5, ' ', STR_PAD_BOTH) . "||"; - echo str_pad('FUNCTION', 60, ' ', STR_PAD_BOTH) . "\n"; - echo str_pad('', 120, '-') . "\n"; + echo str_pad("VERB", 10, " ", STR_PAD_BOTH) . "||"; + echo str_pad("URI" , 35, " ", STR_PAD_BOTH) . "||"; + echo str_pad("W", 5, " ", STR_PAD_BOTH) . "||"; + echo str_pad("FUNCTION", 60, " ", STR_PAD_BOTH) . "\n"; + echo str_pad("", 120, "-") . "\n"; foreach(\Routes\RouteCollection::returnRoutes() as $route){ - echo str_pad(implode($route->_verb , ', '), 10, ' ', STR_PAD_BOTH) . "||"; - echo str_pad($route->_uri, 35, ' ', STR_PAD_RIGHT) . "||"; - echo str_pad($route->_weight, 5, ' ', STR_PAD_BOTH). "||"; - if( gettype($route->_callback[0]) == 'object' ){ - echo str_pad('Clousure', 60, ' ', STR_PAD_RIGHT); + echo str_pad(implode($route->_verb , ", "), 10, " ", STR_PAD_BOTH) . "||"; + echo str_pad($route->_uri, 35, " ", STR_PAD_RIGHT) . "||"; + echo str_pad($route->_weight, 5, " ", STR_PAD_BOTH). "||"; + if( gettype($route->_callback[0]) == "object" ){ + echo str_pad("Clousure", 60, " ", STR_PAD_RIGHT); }else{ - echo str_pad($route->_callback[0], 30, ' ', STR_PAD_RIGHT); + echo str_pad($route->_callback[0], 30, " ", STR_PAD_RIGHT); } echo "\n"; } @@ -210,19 +329,19 @@ class GeneratorController { function createTags(){ $outputs = shell_exec("grep -Rnsi '@ctag' . | sed s/\ //g | sed s/*@ctag/\ /g"); - $outputs = preg_split('/\R/', $outputs); + $outputs = preg_split("/\R/", $outputs); $return = $this->ctagsHeader . "\n"; foreach($outputs as $output){ - $line = explode(' ', str_replace('\\t', '', $output) ); - @$line = $line[1] . "\t " . str_replace('./', '', explode(':', $line[0])[0]) . "\t ".$line[1] . "\n"; - if( strpos($line, 'app/core/generator/GeneratorController.php') ){ + $line = explode(" ", str_replace("\\t", "", $output) ); + @$line = $line[1] . "\t " . str_replace("./", "", explode(":", $line[0])[0]) . "\t ".$line[1] . "\n"; + if( strpos($line, "app/core/generator/GeneratorController.php") ){ continue; } $return .= $line; //echo "Generating: ".$line."\n"; } - file_put_contents(DIR_ROOT.'tags', $return); + file_put_contents(DIR_ROOT."tags", $return); } } diff --git a/app/core/sanity/MigratorController.php b/app/core/sanity/MigratorController.php new file mode 100755 index 0000000..2d053e6 --- /dev/null +++ b/app/core/sanity/MigratorController.php @@ -0,0 +1,198 @@ +load_installed_plugins(); + $this->load_physical_plugins(); + } + + private static function newObj() { + if (!isset(self::$instance)) { + self::$instance = new MigratorController(); + } + return self::$instance; + } + + public static function getInstance() { + if (!isset(self::$instance)) { + return self::newObj(); + } + return self::$instance; + } + + public function sentinel() { + global $ROUTE; + + if (!is_file(DIR_CONFIG . 'modules.ini')) { + if (INSTALL_REQUIRE) { + $ROUTE->doBlock()->setHttpError(500); + } + file_put_contents(DIR_CONFIG . 'modules.ini', ''); + } + } + + private function save() { + $out = ''; + foreach ($this->instaled as $instaled) { + $out .= "[$instaled->name]\n"; + $out .= "name=$instaled->name\n"; + $out .= "version=$instaled->version\n\n"; + } + file_put_contents(DIR_CONFIG . '/modules.ini', $out); + } + + private function is_satisfy($name, $version) { + if (!isset($this->instaled[$name])) { + return false; + } + if ($this->instaled[$name]->version >= $version) { + return true; + } + return false; + } + + private function is_satisfy_array($array) { + foreach ($array as $item) { + if (!self::is_satisfy($item->name, $item->version)) { + return false; + } + } + return true; + } + + public function update_plugin_version($name, $version) { + echo "Atualizando $name para versão $version\n"; + if (isset($this->instaled[$name])) { + $this->instaled[$name]->version = $version; + return; + } + $this->instaled[$name] = new \stdClass(); + $this->instaled[$name]->name = $name; + $this->instaled[$name]->version = $version; + } + + private function load_installed_plugins() { + $installed = parse_ini_file(DIR_CONFIG . 'modules.ini', true); + + foreach ($installed as $key => $item) { + $installed[$key] = (object) $item; + } + + return $this->instaled = $installed; + } + + private function load_physical_plugins() { + $module_configs = Array(); + $plugins = Array(); + + $rdi = new \RecursiveDirectoryIterator(DIR_APP); + + foreach (new \RecursiveIteratorIterator($rdi) as $file) { + if (strpos($file, 'version.php')) { + $module_configs[] = str_replace('version.php', '', $file); + } + } + foreach ($module_configs as $module_config) { + $plugin = new \stdClass(); + include $module_config . 'version.php'; + $plugins[$plugin->name] = $plugin; + if (is_file($module_config . 'db/Migrate.php')) { + include $module_config . 'db/Migrate.php'; + } + } + $this->phisical = $plugins; + } + + public function physical_list() { + return $this->phisical; + } + + public function installed_list() { + return $this->instaled; + } + + public function instal_list() { + return $this->install; + } + + public function uninstal_list() { + return $this->uninstall; + } + + public function sort_plugins() { + foreach ($this->phisical as $key => $plugin) { + if (!isset($this->instaled[$key])) { + $this->install[] = $plugin; + continue; + } + if ($this->instaled[$key]->version < $plugin->version) { + $this->upgrade[] = $plugin; + continue; + } + if ($this->instaled[$key]->version > $plugin->version) { + $this->downgrade[] = $plugin; + continue; + } + $this->uninstall[] = $plugin; + } + } + + public function execute_plan() { + $status = false; + while (!$status) { + $this->sort_plugins(); + $status = true; + + foreach ($this->install as $key => $item) { + if (isset($item->require)) { + if (!self::is_satisfy_array($item->require)) { + $status = false; + continue; + } + } + if (!self::is_satisfy($item->name, $item->version)) { + if (!function_exists($item->name . '_upgrade')) { + $this->update_plugin_version($item->name, $item->version); + $this->upgrade[] = $item; + unset($this->install[$key]); + continue; + } + call_user_func($item->name . '_upgrade', 0); + $this->upgrade[] = $this->instaled[$item->name]; + unset($this->install[$key]); + $status = false; + } + } + + foreach ($this->upgrade as $item) { + if (isset($item->require)) { + if (!self::is_satisfy_array($item->require)) { + $status = false; + continue; + } + } + if (!self::is_satisfy($item->name, $item->version)) { + if (!function_exists($item->name . '_upgrade')) { + $this->update_plugin_version($item->name, $item->version); + continue; + } + call_user_func($item->name . '_upgrade', $this->instaled[$item->name]->version); + $status = false; + } + } + } + $this->save(); + } + +} diff --git a/app/core/sanity/Routes.php b/app/core/sanity/Routes.php index 68fbe89..95a5e69 100755 --- a/app/core/sanity/Routes.php +++ b/app/core/sanity/Routes.php @@ -1,27 +1,18 @@ execute_plan(); - + + Wrapper::set_driver(Connections::getConnection()); + App\Core\Sanity\MigratorController::getInstance()->execute_plan(); Wrapper::commit(); + })->middlewareIgnore('auth'); RouteCollection::add('*', '*', function() { - global $ROUTE; - if(INSTALL_REQUIRE){ - //App need to be installed - if (!is_file(DIR_CONFIG . 'modules.ini')) { - $ROUTE->doBlock()->setHttpError(500); - } - } - + App\Core\Sanity\MigratorController::getInstance()->sentinel(); }, -19)->doIgnore()->middlewareIgnore('auth'); \ No newline at end of file diff --git a/app/core/sanity/classes/Migrator.class.php b/app/core/sanity/classes/Migrator.class.php deleted file mode 100755 index 2fc3e1f..0000000 --- a/app/core/sanity/classes/Migrator.class.php +++ /dev/null @@ -1,183 +0,0 @@ -load_installed_plugins(); - $this->load_physical_plugins(); - } - - private static function newObj(){ - if (!isset( self::$instance )) { - self::$instance = new Migrator(); - } - return self::$instance; - } - - public static function getInstance(){ - if (!isset(self::$instance)) { - return self::newObj(); - } - return self::$instance; - } - - private function save(){ - $out = ''; - foreach ($this->instaled as $instaled){ - $out .= "[$instaled->name]\n"; - $out .= "name=$instaled->name\n"; - $out .= "version=$instaled->version\n\n"; - } - file_put_contents(DIR_CONFIG.'/modules.ini', $out); - } - - private function is_satisfy($name, $version){ - if(!isset($this->instaled[$name])){ - return false; - } - if($this->instaled[$name]->version >= $version){ - return true; - } - return false; - } - - private function is_satisfy_array($array){ - foreach ($array as $item){ - if( !self::is_satisfy($item->name, $item->version) ){ - return false; - } - } - return true; - } - - public function update_plugin_version($name, $version){ - echo "Atualizando $name para versão $version\n"; - if( isset($this->instaled[$name]) ){ - $this->instaled[$name]->version = $version; - return; - } - $this->instaled[$name] = new stdClass(); - $this->instaled[$name]->name = $name; - $this->instaled[$name]->version = $version; - } - - private function load_installed_plugins(){ - $installed = parse_ini_file(DIR_CONFIG.'/modules.ini', true); - - foreach ($installed as $key => $item) { - $installed[$key] = (object) $item; - } - - return $this->instaled = $installed; - } - - private function load_physical_plugins(){ - $module_configs = Array(); - $plugins = Array(); - - $rdi = new RecursiveDirectoryIterator(DIR_APP); - - foreach(new RecursiveIteratorIterator($rdi) as $file){ - if( strpos($file, 'version.php') ){ - $module_configs[] = str_replace('version.php','', $file); - } - } - foreach ($module_configs as $module_config) { - $plugin = new stdClass(); - include $module_config . 'version.php'; - $plugins[$plugin->name] = $plugin; - if(is_file( $module_config . 'db/Migrate.php') ){ - //echo 'aaaaaaaaaaaa'; - include $module_config . 'db/Migrate.php'; - } - } - $this->phisical = $plugins; - } - - public function physical_list(){ - return $this->phisical; - } - - public function installed_list(){ - return $this->instaled; - } - - public function instal_list(){ - return $this->install; - } - - public function uninstal_list(){ - return $this->uninstall; - } - - public function sort_plugins(){ - foreach ($this->phisical as $key => $plugin){ - if( !isset($this->instaled[$key]) ){ - $this->install[] = $plugin; - continue; - } - if( $this->instaled[$key]->version < $plugin->version){ - $this->upgrade[] = $plugin; - continue; - } - if( $this->instaled[$key]->version > $plugin->version){ - $this->downgrade[] = $plugin; - continue; - } - $this->uninstall[] = $plugin; - } - } - - public function execute_plan(){ - $status = false; - while(! $status ){ - $this->sort_plugins(); - $status = true; - - foreach ($this->install as $key => $item) { - if( isset($item->require) ){ - if( !self::is_satisfy_array($item->require) ){ $status = false; continue; } - } - if(!self::is_satisfy($item->name, $item->version) ){ - if(!function_exists($item->name.'_upgrade')){ - $this->update_plugin_version($item->name, $item->version); - $this->upgrade[] = $item; - unset($this->install[$key]); - continue; - } - call_user_func($item->name.'_upgrade', 0); - $this->upgrade[] = $this->instaled[$item->name]; - unset($this->install[$key]); - $status = false; - } - } - - foreach ($this->upgrade as $item) { - if( isset($item->require) ){ - if( !self::is_satisfy_array($item->require) ){ $status = false; continue; } - } - if(!self::is_satisfy($item->name, $item->version) ){ - if(!function_exists($item->name.'_upgrade')){ - $this->update_plugin_version($item->name, $item->version); - continue; - } - call_user_func($item->name.'_upgrade', $this->instaled[$item->name]->version); - $status = false; - } - } - } - $this->save(); - } - -} diff --git a/app/core/template/Output.class.php b/app/core/template/Output.class.php index acd3a2f..fcac54f 100755 --- a/app/core/template/Output.class.php +++ b/app/core/template/Output.class.php @@ -47,7 +47,8 @@ class Output { self::getInstance()->setView($name, $values, $location)->render(); } - public static function setView($name, $values = Array(), $location = null) { + public static function setView($name = '', $values = Array(), $location = null) { + if($name == ''){ return self::getInstance(); } $instance = self::getInstance(); $folder = ''; if (!$location) { diff --git a/app/core/template/classes/dashboard/Dashboard.php b/app/core/template/classes/dashboard/Dashboard.php index b8f629f..7f507fe 100755 --- a/app/core/template/classes/dashboard/Dashboard.php +++ b/app/core/template/classes/dashboard/Dashboard.php @@ -16,7 +16,7 @@ class Dashboard extends RenderableTemplate { global $DROPDOWN, $SIDEBAR; $head = ''; - $head .= ''; + $head .= ''; $head .= ''; @@ -31,7 +31,7 @@ class Dashboard extends RenderableTemplate { $head .= ''; $head .= ''; - $head .= ''; + $head .= ''; $head .= ''; $head .= ''; @@ -47,7 +47,6 @@ class Dashboard extends RenderableTemplate { $foot = ''; $foot .= ''; - $foot .= ''; $this->content = file_get_contents(__DIR__ . '/template.html'); diff --git a/app/core/template/classes/dashboard/template.html b/app/core/template/classes/dashboard/template.html index c330000..88d8e71 100755 --- a/app/core/template/classes/dashboard/template.html +++ b/app/core/template/classes/dashboard/template.html @@ -1,5 +1,7 @@ + + {{head}} diff --git a/config/database.php b/config/database.php new file mode 100755 index 0000000..11fd28d --- /dev/null +++ b/config/database.php @@ -0,0 +1,40 @@ + 'pgsql', + 'host' => 'localhost', + 'prefix' => '_urfat', + 'name' => 'urfat', + 'user' => 'urfat', + 'pass' => 'urfat']) + , "default"); +*/ + +/* + * Mysql + * + * Connections::addConnection(Connection::open([ + 'driver' => 'mysql', + 'host' => 'localhost', + 'prefix' => '_urfat', + 'name' => 'urfat', + 'user' => 'urfat', + 'pass' => 'urfat']) + , "default"); +*/ + + +/* + * Sqlite + * +Connections::addConnection(Connection::open([ + 'driver' => 'sqlite', + 'prefix' => '_urfat', + 'name' => 'database.db']) + , "default"); + */ \ No newline at end of file diff --git a/public/dist/script.js b/public/dist/script.js index c6ba78a..8251379 100755 --- a/public/dist/script.js +++ b/public/dist/script.js @@ -19,7 +19,7 @@ function log(message, importance = 0) { } if (importance === 2) { alert("LOG:: |" + message + "|"); -} + } } function isDefined(data) { diff --git a/public/dist/style.css b/public/dist/style.css index 3b4b64b..7f6c230 100755 --- a/public/dist/style.css +++ b/public/dist/style.css @@ -1,15 +1,11 @@ /* -Devel +*Devel */ table tr .selected{ background-color: #d9edf7; } -.hidden{ - display:none; -} - .no-scroll{ overflow: hidden; } @@ -40,6 +36,7 @@ body{ */ textarea{ resize: vertical; + min-height: 200px } .data-table table{ @@ -175,12 +172,12 @@ textarea{ } /* - _ _ ______ _____ ______ _____ - | | | | ____| /\ | __ \| ____| __ \ - | |__| | |__ / \ | | | | |__ | |__) | - | __ | __| / /\ \ | | | | __| | _ / - | | | | |____ / ____ \| |__| | |____| | \ \ - |_| |_|______/_/ \_\_____/|______|_| \_\ + _ _ ______ ^ _____ ______ _____ + | | | | ____| / \ | __ \| ____| __ \ + | |__| | |__ / \ | | | | |__ | |__) | + | __ | __| / /_\ \ | | | | __| | _ / + | | | | |____ / _____ \| |__| | |____| | \ \ + |_| |_|______/_/ \_\_____/|______|_| \_\ */ @@ -204,4 +201,13 @@ textarea{ border-radius: 0px !important; } -/*--*/ \ No newline at end of file +/* HELPER ---------------------------- */ + +.round-ball{ + border-radius: 60px !important; + font-size: 1.5em; + position: fixed; + padding: 20px; + bottom: 20px; + right: 20px; +} \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file