Ejemplo n.º 1
0
 public function install()
 {
     $user_pass = "******";
     echo "<h1>Installing Burge CMF</h1>";
     $this->log_manager_model->info("CMF_INSTALL");
     $this->load->model("module_manager_model");
     $this->module_manager_model->install_module("module_manager");
     $this->module_manager_model->install_module("user_manager");
     $this->load->model("user_manager_model");
     $props = array("user_name" => $user_pass, "user_email" => $user_pass, "user_pass" => $user_pass, "user_code" => 10);
     $this->user_manager_model->add_if_not_exist($props);
     $user = new User($user_pass);
     echo "Username: {$user_pass}<br>Pass: {$user_pass}<br>";
     echo "<h2>Login <a href='" . get_link("admin_login") . "'>here</a>.</h2>";
     $this->module_manager_model->install_module("access_manager");
     $this->module_manager_model->install_module("hit_counter");
     $this->module_manager_model->install_module("post_manager");
     $this->module_manager_model->install_module("log_manager");
     $this->module_manager_model->install_module("constant_manager");
     $default_lang = array_keys(LANGUAGES())[0];
     $modules_info = $this->module_manager_model->get_all_modules_info($default_lang);
     $modules = array();
     foreach ($modules_info as $md) {
         $modules[] = $md['module_id'];
     }
     $this->load->model("access_manager_model");
     $this->access_manager_model->set_allowed_modules_for_user($user->get_id(), $modules);
     return;
 }
Ejemplo n.º 2
0
 public function init()
 {
     if (self::$languages) {
         return;
     }
     self::$languages = LANGUAGES();
     if (!self::$languages) {
         log_message("error", "Language array hasn't been defined");
         return;
     }
     $index = substr_count(HOME_URL, '/') - 2;
     $parts = explode("/", trim($_SERVER['REQUEST_URI'], "/"));
     if (sizeof($parts) == $index) {
         $parts[] = "";
     }
     $parts[$index] = strtolower($parts[$index]);
     $i = 0;
     foreach (self::$languages as $key => $lang) {
         if (!$i++) {
             self::$default_language = $key;
         }
         if ($key === $parts[$index]) {
             self::$selected_language = $key;
             break;
         }
     }
     if (!self::$selected_language) {
         self::$selected_language = self::$default_language;
     } else {
         $new_uri = "";
         for ($i = 0; $i < sizeof($parts); $i++) {
             if ($i != $index) {
                 $new_uri .= "/" . $parts[$i];
             }
         }
         $_SERVER['REQUEST_URI'] = $new_uri;
     }
     //echo self::$selected_language."<br>".$_SERVER['REQUEST_URI']."<br>";
     self::$instance =& $this;
     return;
 }