6$settings_file = "../config.php";
7$htaccess_file = "../.htaccess";
8$phpass_file = '../dropplets/includes/phpass.php';
10// Get existing settings.
11if (file_exists($settings_file)) {
12 include($settings_file);
14if (file_exists($phpass_file))
16 include($phpass_file);
17 $hasher = new PasswordHash(8,FALSE);
19function settings_format($name, $value) {
20 return sprintf("\$%s = \"%s\";", $name, $value);
23/*-----------------------------------------------------------------------------------*/
24/* Save Submitted Settings
25/*-----------------------------------------------------------------------------------*/
27// Should allow this only on first install or after the user is authenticated
28// but this doesn't quite work. So back to default.
29if ($_POST["submit"] == "submit" && (!file_exists($settings_file) || isset($_SESSION['user'])))
31 // Get submitted setup values.
32 if (isset($_POST["blog_email"])) {
33 $blog_email = $_POST["blog_email"];
35 if (isset($_POST["blog_twitter"])) {
36 $blog_twitter = $_POST["blog_twitter"];
38 if (isset($_POST["blog_url"])) {
39 $blog_url = $_POST["blog_url"];
41 if (isset($_POST["blog_title"])) {
42 $blog_title = $_POST["blog_title"];
44 if (isset($_POST["meta_description"])) {
45 $meta_description = $_POST["meta_description"];
47 if (isset($_POST["intro_title"])) {
48 $intro_title = $_POST["intro_title"];
50 if (isset($_POST["intro_text"])) {
51 $intro_text = $_POST["intro_text"];
53 if (isset($_POST["template"])) {
54 $template = $_POST["template"];
57 // There must always be a $password, but it can be changed optionally in the
58 // settings, so you might not always get it in $_POST.
59 if (!isset($password) || !empty($_POST["password"])) {
60 $password = $hasher->HashPassword($_POST["password"]);
63 if(!isset($header_inject)) {
67 if(isset($_POST["header_inject"])) {
68 $header_inject = addslashes($_POST["header_inject"]);
71 if(!isset($footer_inject)) {
75 if(isset($_POST["footer_inject"])) {
76 $footer_inject = addslashes($_POST["footer_inject"]);
80 $dir .= str_replace('dropplets/save.php', '', $_SERVER["REQUEST_URI"]);
82 // Output submitted setup values.
84 $config[] = settings_format("blog_email", $blog_email);
85 $config[] = settings_format("blog_twitter", $blog_twitter);
86 $config[] = settings_format("blog_url", $blog_url);
87 $config[] = settings_format("blog_title", $blog_title);
88 $config[] = settings_format("meta_description", $meta_description);
89 $config[] = settings_format("intro_title", $intro_title);
90 $config[] = settings_format("intro_text", $intro_text);
91 $config[] = "\$password = '".$password."';";
92 $config[] = settings_format("header_inject", $header_inject);
93 $config[] = settings_format("footer_inject", $footer_inject);
94 $config[] = settings_format("template", $template);
96 // Create the settings file.
97 file_put_contents($settings_file, implode("\n", $config));
99 // Generate the .htaccess file on initial setup only.
100 if (!file_exists($htaccess_file)) {
102 // Parameters for the htaccess file.
103 $htaccess[] = "# Pretty Permalinks";
104 $htaccess[] = "RewriteRule ^(images)($|/) - [L]";
105 $htaccess[] = "RewriteCond %{REQUEST_URI} !^action=logout [NC]";
106 $htaccess[] = "RewriteCond %{REQUEST_URI} !^action=login [NC]";
107 $htaccess[] = "Options +FollowSymLinks -MultiViews";
108 $htaccess[] = "RewriteEngine on";
109 $htaccess[] = "RewriteBase " . $dir;
110 $htaccess[] = "RewriteCond %{REQUEST_URI} !index\.php";
111 $htaccess[] = "RewriteCond %{REQUEST_FILENAME} !-f";
112 $htaccess[] = "RewriteRule ^(.*)$ index.php?filename=$1 [NC,QSA,L]";
114 // Generate the .htaccess file.
115 file_put_contents($htaccess_file, implode("\n", $htaccess));
119 header("Location: " . $blog_url);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list