-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.php
More file actions
37 lines (31 loc) · 1.18 KB
/
setup.php
File metadata and controls
37 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
// Prepare our various Tools
include 'Tools.class.php';
include 'Search.class.php';
// Load Models
include 'Model.class.php';
include 'Comment.class.php';
include 'Post.class.php';
checkInstall(); // Check install
new Tools(); // Load database
Search::indexAll(); // Index all Posts
echo "Setup complete."
// Set up the .htaccess rules
function checkInstall($redo=false) {
if(!file_exists("successful_install.txt") or $redo) {
// Prepare .htaccess rules
$rules = "RewriteEngine on\n";
$rules.= "RewriteCond $1 !^(index\.php|favicon\.ico|robots\.txt|images|javascript|css|phpinfo) [NC]\n";
$rules.= "RewriteRule ^(.*)$ ".str_replace('setup.php','',$_SERVER['REQUEST_URI'])."index.php?url=$1 [L]\n";
// Write the .htaccess rules
$ha = fopen(".htaccess", "w");
fwrite($ha, $rules);
fclose($ha);
// Report the successful install
$report = fopen("successful_install.txt", "w");
fwrite($report, "Installed the RAS blogg to the relative PATH ".$_SERVER['REQUEST_URI']."\n");
fclose($report);
return true;
} else return false;
}
?>