Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29726
Modified Files:
Tag: branch_0_6
serendipity_admin_installer.inc.php
Log Message:
* Better detection of serendipityPath variable
Index: serendipity_admin_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_installer.inc.php,v
retrieving revision 1.59.4.1
retrieving revision 1.59.4.2
diff -u -d -r1.59.4.1 -r1.59.4.2
--- serendipity_admin_installer.inc.php 7 Apr 2004 12:38:18 -0000 1.59.4.1
+++ serendipity_admin_installer.inc.php 13 Apr 2004 10:55:04 -0000 1.59.4.2
@@ -11,7 +11,13 @@
function serendipity_query_default($optname, $default) {
switch ($optname) {
case 'serendipityPath':
- return $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';
+ $test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';
+ $test_path2 = dirname(__FILE__);
+ if (file_exists($test_path . 'serendipity_entries.php')) {
+ return $test_path1;
+ } else {
+ return $test_path2;
+ }
case 'serendipityHTTPPath':
return rtrim(dirname($_SERVER['PHP_SELF']), '/') .'/';
@@ -108,7 +114,7 @@
if ($name == 'rewrite' && $default == $value && isset($serendipity['rewrite_default']) && $serendipity['rewrite_default'] != '') {
$value = $serendipity['rewrite_default'];
}
-
+
switch ($type) {
case 'bool' :
$value = serendipity_get_bool($value);
@@ -126,8 +132,8 @@
echo '<select name="'. $name .'">';
for ($x=0; $x<sizeof($res[1]); $x++) {
printf('<option value="%s"%s>%s</option>'. "\n",
- $res[1][$x],
- (($res[1][$x] == $value) ? ' selected="selected"' : ''),
+ $res[1][$x],
+ (($res[1][$x] == $value) ? ' selected="selected"' : ''),
$res[2][$x]);
}
echo '</select>';
@@ -144,7 +150,7 @@
if (!isset($serendipity['XHTML11'])) {
$serendipity['XHTML11'] = FALSE;
}
-
+
// If not yet installed, do some magic:
$abort = false;
if (IS_installed !== true) {
@@ -172,13 +178,13 @@
}
fclose($sock);
}
-
+
if (preg_match('@^HTTP/\d\.\d 200@', $response)) {
$serendipity['rewrite_default'] = 'errordocs';
} else {
$serendipity['rewrite_default'] = 'none';
}
-
+
if (!empty($old_htacces)) {
$fp = @fopen('./.htaccess', 'w');
fwrite($fp, $old_htaccess);
@@ -188,7 +194,7 @@
}
}
}
-
+
if ($abort === false) {
?>
<script type="text/javascript" language="JavaScript">
@@ -259,7 +265,7 @@
if (@is_array($from)) {
$value[$x]['value'] = $from[$value[$x]['name']];
}
-
+
/* If the value is never assigned in the valuelist, then use our default value */
if (!isset($from[$value[$x]['name']])) {
$value[$x]['value'] = $value[$x]['default'];
@@ -311,7 +317,7 @@
$in_table = 1;
$def = $line;
}
-
+
if (preg_match('#^create\s*(\{fulltext\}|unique)\s*index#i', $line)) {
array_push($queries, $line);
}
@@ -319,7 +325,7 @@
}
fclose($fp);
}
-
+
return $queries;
}
@@ -327,7 +333,7 @@
global $serendipity, $umask;
$errs = array();
-
+
// Check dirs
if (!is_dir($_POST['serendipityPath'])) {
$errs[] = sprintf(DIRECTORY_NON_EXISTANT, $_POST['serendipityPath']);
@@ -363,7 +369,7 @@
@include_once($_POST['serendipityPath'] . 'serendipity_db.inc.php');
// For shared installations, probe the file on include path
@include_once(S9Y_INCLUDE_PATH . 'serendipity_db.inc.php');
-
+
if (S9Y_DB_INCLUDED) {
serendipity_db_probe($_POST, $errs);
}
@@ -430,7 +436,7 @@
function serendipity_installFiles() {
global $serendipity;
-
+
$htaccess = @file_get_contents('./.htaccess');
if ($_POST['rewrite'] == 'rewrite') {
@@ -506,14 +512,14 @@
foreach($p as $key => $entry) {
serendipity_set_config_var($entry['name'], $_POST[$entry['name']]);
}
-
- return serendipity_updateLocalConfig($_POST['dbName'],
- $_POST['dbPrefix'],
- $_POST['dbHost'],
- $_POST['dbUser'],
- $_POST['dbPass'],
- $_POST['dbType'],
- 'serendipity_config_local.inc.php',
+
+ return serendipity_updateLocalConfig($_POST['dbName'],
+ $_POST['dbPrefix'],
+ $_POST['dbHost'],
+ $_POST['dbUser'],
+ $_POST['dbPass'],
+ $_POST['dbType'],
+ 'serendipity_config_local.inc.php',
$_POST['serendipityPath']);
}
|