/**
  * function show
  * render and return content
  */
 function show()
 {
     if (!INSTALLED) {
         if (file_exists(ROOT_PATH . '/api/Gogo.php')) {
             unlink(ROOT_PATH . '/api/Init.php');
             rename(ROOT_PATH . '/api/Gogo.php', ROOT_PATH . '/api/Init.php');
             return '<p>Installation 60% Done.. Please Click to Continue.<input class="confirm-button" onclick="document.location.href=\'/installation\'" type="submit" value="Next"></p>';
         } else {
             Adapter::set_instance(unserialize(DATABASE_SETTINGS));
             $i = Adapter::get_instance();
             $i->exec(file_get_contents(ROOT_PATH . '/etc/cms_sql/sql.sql'));
             return '<p>Installation Successfully! <input class="confirm-button" onclick="document.location.href=\'/administration\'" type="submit" value="Next"></p>';
         }
     }
     header("Location: /");
     return;
 }
Beispiel #2
0
 /**
  * function show
  * render and return content
  */
 function show()
 {
     if (!INSTALLED) {
         $database_settings = ['host' => Misc::escape_text($_POST['host_name']), 'user' => Misc::escape_text($_POST['host_user']), 'pass' => Misc::escape_text($_POST['host_pass']), 'name' => Misc::escape_text($_POST['host_db']), 'port' => Misc::escape_text($_POST['host_port']), 'type' => 'mysql'];
         @Adapter::set_instance($database_settings);
         if (array_key_exists('server_ver', Adapter::fetch_array(Adapter::query("SELECT * FROM server_status")))) {
             if (strpos(file_get_contents(ROOT_PATH . "/api/Gogo.php"), '$database_settings = array') == false) {
                 file_put_contents(ROOT_PATH . "/api/Gogo.php", "\n//database settings \n" . '$database_settings = ' . var_export($database_settings, true) . ';', FILE_APPEND);
                 header("Location: /settings");
                 return;
             }
         } else {
             header("Location: /error?db");
             return;
         }
         header("Location: /error?db");
         return;
     }
     header("Location: /");
     return;
 }
Beispiel #3
0
 /**
  * function start_database
  * create database socket
  */
 function start_database()
 {
     $this->database = Adapter::get_instance() != null ? Adapter::get_instance() : Adapter::set_instance(unserialize(DATABASE_SETTINGS));
 }