public function actionCreate()
 {
     $model = new ConfigFile();
     if (isset($_POST['ConfigFile'])) {
         $model->attributes = $_POST['ConfigFile'];
         if ($model->save()) {
             Yii::log('Created config file entry ' . $model->id);
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('view', array('model' => $model));
 }
Esempio n. 2
0
 /**
  * Saves the configuration file.
  *
  * @param string $code
  */
 public static function saveConfigFile($code)
 {
     return ConfigFile::save($code);
 }
Esempio n. 3
0
        $db->insert("settings", array("setting" => "website_email", "value" => $_POST['admin_email']));
        $db->insert("settings", array("setting" => "website_lang", "value" => "en_US"));
        $db->insert("settings", array("setting" => "show_archive", "value" => "true"));
        $conf = new ConfigFile();
        $config = array();
        $config['db'] = array();
        $config['security'] = array();
        $config['db']['name'] = $creds['database'];
        $config['db']['username'] = $creds['username'];
        $config['db']['password'] = $creds['password'];
        $config['db']['server'] = $creds['host'];
        $config['security']['salt_1'] = generateSalt();
        $config['security']['salt_2'] = generateSalt();
        $config['security']['salt_3'] = generateSalt();
        $conf->writeConfigArray($config);
        $conf->save();
        $path = dirname(__FILE__) . "/";
        $htaccess = "\nErrorDocument 400 " . $path . "error.php?error_code=400\nErrorDocument 401 " . $path . "error.php?error_code=401\nErrorDocument 403 " . $path . "error.php?error_code=403\nErrorDocument 404 " . $path . "error.php?error_code=404\nErrorDocument 500 " . $path . "error.php?error_code=500\nErrorDocument 503 " . $path . "error.php?error_code=503\n";
        $b = @file_put_contents(".htaccess", $htaccess);
        if (!$b) {
            die("Check if you CHMODDED .htaccess to 777. Can't edit it.");
        }
        $adminPW = generateSalt();
        $hash = sha1($config['security']['salt_2'] . $adminPW . $config['security']['salt_3'] . $config['security']['salt_1']);
        $db->insert("users", array("id" => 1, "name" => $_POST['username'], "email" => $_POST['admin_email'], "password" => $hash, "rank" => 3, "activated" => 1));
        $styleSettings = array("logo_url" => $_POST['website_url'] . "/themes/monk/images/logo.png", "footer_1_title" => "Footer 1", "footer_2_title" => "Footer 2", "footer_3_title" => "Footer 3", "footer_4_title" => "Footer 4", "footer_1_text" => "You can change this in your admin panel!", "footer_2_text" => "You can change this in your admin panel!", "footer_3_text" => "You can change this in your admin panel!", "footer_4_text" => "You can change this in your admin panel!");
        foreach ($styleSettings as $setting => $value) {
            $db->insert("style_data", array("style_main_class" => "MonkStyle", "setting" => $setting, "setting_type" => "string", "setting_value" => $value));
        }
        ?>
<html>