forked from florianoverkamp/yourls-abusedesk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-gsb
executable file
·41 lines (33 loc) · 1.08 KB
/
install-gsb
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
38
39
40
41
#!/usr/bin/php
<?php
//
// Safebrowsing installer for Abusedesk plugin for Yourls - URL Shortener
// Copyright (c) 2010, Florian Overkamp <[email protected]>
//
require_once( dirname(__FILE__).'/../../../includes/load-yourls.php' );
require_once("config.php");
$tempinstaller = 'install-gsb-rewrite.php';
if(!file_exists("phpgsb")) {
system("svn co http://phpgsb.googlecode.com/svn/trunk/ phpgsb");
} else {
system("svn up phpgsb");
}
$installer = file("phpgsb/install.php");
$myinstaller = fopen($tempinstaller, 'w');
foreach($installer as $line) {
if(strpos($line, 'phpgsb.class.php') > 0) {
// the class itself resides in the subdirectory
$line = 'require("phpgsb/phpgsb.class.php");' . "\n";
}
if(strpos($line, 'new phpGSB') > 0) {
// found the instantiator
// now replace the settings @@@ YOURLS_DB_NAME
$line = '$phpgsb = new phpGSB("' . YOURLS_DB_NAME . '", "' . YOURLS_DB_USER . '", "' . YOURLS_DB_PASS . '", "' . YOURLS_DB_HOST . '", true);' . "\n";
}
fwrite($myinstaller, $line);
}
fclose($myinstaller);
system("php $tempinstaller");
echo "\n";
unlink($tempinstaller);
?>