Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv23526
Modified Files:
LICENSE db.sql serendipity_admin_installer.inc.php
serendipity_config.inc.php serendipity_db.inc.php
serendipity_db_mysql.inc.php serendipity_functions.inc.php
Log Message:
holy mangled schemas batman.
first steps towards multiple weblog support. mostly hardcoded for now,
and entirely ugly, but the basis is in there.
All config is in the db, and has a weblog associated with it. remove
headers and comments that used '#'.
Check back later in the day for the finished version. :)
Index: LICENSE
===================================================================
RCS file: /cvsroot/php-blog/serendipity/LICENSE,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- LICENSE 28 Mar 2003 20:05:24 -0000 1.1.1.1
+++ LICENSE 31 Mar 2003 21:49:26 -0000 1.2
@@ -22,9 +22,3 @@
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
-
-######################################################################################
-serendipity (c) 2003 Jannis Hermanns <J...@ha...> www.jannis.to
-& the serendipity team: Sterling Hughes <ste...@bu...>
- Christian Mühlhaeuser <ch...@ch...>
\ No newline at end of file
Index: db.sql
===================================================================
RCS file: /cvsroot/php-blog/serendipity/db.sql,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- db.sql 31 Mar 2003 07:54:55 -0000 1.3
+++ db.sql 31 Mar 2003 21:49:26 -0000 1.4
@@ -2,6 +2,16 @@
# Table structure for table '{PREFIX}authors'
#
+create table {PREFIX}weblogs (
+ weblogid {AUTOINCREMENT}
+);
+
+create table {PREFIX}perms (
+ weblogid int(11) not null,
+ userid int(11) not null,
+ permid int(4) not null
+);
+
create table {PREFIX}authors (
username varchar(20) default null,
password varchar(32) default null,
@@ -44,7 +54,8 @@
exflag int(1) default null,
author varchar(20) default null,
authorid int(11) default null,
- categoryid int(11) default null
+ categoryid int(11) default null,
+ weblogid int(11) not null
);
CREATE FULLTEXT INDEX entry on {PREFIX}entries (title,body,extended);
@@ -57,7 +68,8 @@
id {AUTOINCREMENT},
entry_id int(10) {UNSIGNED} not null default '0',
link text,
- name text
+ name text,
+ weblogid int(11) not null
);
#
@@ -79,6 +91,7 @@
url varchar(128) NOT NULL default '',
day date NOT NULL,
count int(11) NOT NULL default '0',
+ weblogid int(11) not null,
PRIMARY KEY (url,day)
);
@@ -89,18 +102,21 @@
CREATE TABLE {PREFIX}css (
cssid {AUTOINCREMENT},
name varchar(40) default NULL,
- data text
+ data text,
+ weblogid int(11) not null
);
create table {PREFIX}config (
name varchar(255) not null primary key,
- value text not null
+ value text not null,
+ weblogid int(11) not null
);
CREATE TABLE {PREFIX}suppress (
url varchar(128) default NULL,
ip varchar(15) default NULL,
- last timestamp NOT NULL
+ last timestamp NOT NULL,
+ weblogid int(11) not null
);
CREATE unique INDEX url on {PREFIX}suppress (url, ip);
@@ -116,5 +132,6 @@
categoryid {AUTOINCREMENT},
category_name varchar(255) default NULL,
category_description text,
- authorid int(11) default NULL
+ authorid int(11) default NULL,
+ weblogid int(11) not null
);
Index: serendipity_admin_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_installer.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- serendipity_admin_installer.inc.php 28 Mar 2003 20:05:26 -0000 1.1.1.1
+++ serendipity_admin_installer.inc.php 31 Mar 2003 21:49:26 -0000 1.2
@@ -1,53 +1,42 @@
<?php
-
-##########################################################################
-# serendipity - another blogger... #
-##########################################################################
-# #
-# (c) 2003 Jannis Hermanns <J...@ha...> #
-# http://www.jannis.to/programming/serendipity.html #
-# #
-##########################################################################
-
-if (file_exists("./serendipity_config_local.inc.php") && IN_serendipity !== true) die ("Don't hack!");
umask(0000);
include_once('compat.php');
function serendipity_query_default($optname, $default)
{
switch ($optname) {
- case "serendipityPath":
- return dirname(__FILE__) . '/';
+ case "serendipityPath":
+ return dirname(__FILE__) . '/';
- case "serendipityHTTPPath":
- return dirname($_SERVER['PHP_SELF']) . '/';
+ case "serendipityHTTPPath":
+ return dirname($_SERVER['PHP_SELF']) . '/';
- case "baseURL":
- $ssl = $_SERVER['HTTPS'] == 'on';
- $port = $_SERVER['SERVER_PORT'];
+ case "baseURL":
+ $ssl = $_SERVER['HTTPS'] == 'on';
+ $port = $_SERVER['SERVER_PORT'];
- return sprintf("http%s://%s%s%s/",
- $ssl ? 's' : '',
- $_SERVER['HTTP_HOST'],
- (($ssl && $port != 443) || (!$ssl && $port != 80)) ? (':' . $port) : '',
- dirname($_SERVER['PHP_SELF'])
- );
+ return sprintf("http%s://%s%s%s/",
+ $ssl ? 's' : '',
+ $_SERVER['HTTP_HOST'],
+ (($ssl && $port != 443) || (!$ssl && $port != 80)) ? (':' . $port) : '',
+ dirname($_SERVER['PHP_SELF'])
+ );
- case "convert":
- $path = explode(":", $_ENV['PATH']);
- /* add some other possible locations to the path while we are at it,
- * as these are not always included in the apache path */
- $path[] = '/usr/X11R6/bin';
+ case "convert":
+ $path = explode(":", $_ENV['PATH']);
+ /* add some other possible locations to the path while we are at it,
+ * as these are not always included in the apache path */
+ $path[] = '/usr/X11R6/bin';
- foreach ($path as $dir) {
- if (@is_executable($dir . '/convert')) {
- return $dir . '/convert';
- }
+ foreach ($path as $dir) {
+ if (@is_executable($dir . '/convert')) {
+ return $dir . '/convert';
}
- return $default;
+ }
+ return $default;
- default:
- return $default;
+ default:
+ return $default;
}
}
@@ -94,7 +83,7 @@
echo "<input type='hidden' name='serendipity[adminModule]' value='installer'>";
echo "<input type='hidden' name='installAction' value='check'>";
echo "<br>";
- foreach ($t as $key=>$value) {
+ foreach ($t as $key => $value) {
echo "<b>$key:</b><br>";
echo "<table>";
for ($x=0; $x<count($value); $x++) {
@@ -103,14 +92,18 @@
echo "<td valign='top'>".$value[$x]["name"].":</td>";
echo "<td valign='top'>";
if ($value[$x]["type"] == "bool") {
- echo "<input type='radio' name='".$value[$x]["name"]."' value='true' ".(($value[$x]["default"]==true) ? "CHECKED" : "")."> Yes<br>";
- echo "<input type='radio' name='".$value[$x]["name"]."' value='false' ".(($value[$x]["default"]==true) ? "" : "CHECKED")."> No<br>";
+ echo "<input type='radio' name='".$value[$x]["name"]."' value='true' ";
+ echo (($value[$x]["default"]==true) ? "CHECKED" : "")."> Yes<br>";
+ echo "<input type='radio' name='".$value[$x]["name"]."' value='false' ";
+ echo (($value[$x]["default"]==true) ? "" : "CHECKED")."> No<br>";
}
else {
- echo "<input type='text' name='".$value[$x]["name"]."' value=\"".htmlentities($value[$x]["default"])."\">";
+ echo "<input type='text' name='".$value[$x]["name"]."' value=\"";
+ echo htmlentities($value[$x]["default"])."\">";
}
echo "</td>";
- echo "<td valign='top'><font color='#bbbbbb'>// ".$value[$x]["desc"]." (".$value[$x]["type"].")</font></td>";
+ echo "<td valign='top'><font color='#bbbbbb'>// ".$value[$x]["desc"];
+ echo " (".$value[$x]["type"].")</font></td>";
echo "</tr>";
}
echo "</table>";
@@ -146,156 +139,174 @@
return $queries;
}
-
switch ($_POST["installAction"]) {
+ case "check":
+ // Check dirs
+ if (!is_dir($_POST["serendipityPath"])) {
+ $errs[] = $_POST["serendipityPath"]." does not exist, create it.";
+ }
+ elseif (!is_writable($_POST["serendipityPath"])) {
+ $errs[] = "I can't write to ".$_POST["serendipityPath"]." check permissions!";
+ }
+ elseif (!is_dir($_POST["serendipityPath"].$_POST["uploadPath"])
+ && @mkdir($_POST["serendipityPath"].$_POST["uploadPath"], 0770) !== true) {
+ $errs[] = $_POST["serendipityPath"].$_POST["uploadPath"]." does not exist and I couldn't create it. You do it.";
+ }
- case "check":
-
-
- // Check dirs
- if (!is_dir($_POST["serendipityPath"])) {
- $errs[] = $_POST["serendipityPath"]." does not exist, create it.";
- }
- elseif (!is_writable($_POST["serendipityPath"])) {
- $errs[] = "I can't write to ".$_POST["serendipityPath"]." check permissions!";
- }
- elseif (!is_dir($_POST["serendipityPath"].$_POST["uploadPath"])
- && @mkdir($_POST["serendipityPath"].$_POST["uploadPath"], 0770) !== true) {
- $errs[] = $_POST["serendipityPath"].$_POST["uploadPath"]." does not exist and I couldn't create it. You do it.";
- }
-
- // Check paths
- elseif (!is_writable($_POST["serendipityPath"].$_POST["uploadPath"])) {
- $errs[] = "I can't write to ".$_POST["serendipityPath"].$_POST["uploadPath"]."!";
- $errs[] = " -> run <i>chmod g+rwx ".$_POST["serendipityPath"].$_POST["uploadPath"]."</i>";
- }
+ // Check paths
+ elseif (!is_writable($_POST["serendipityPath"].$_POST["uploadPath"])) {
+ $errs[] = "I can't write to ".$_POST["serendipityPath"].$_POST["uploadPath"]."!";
+ $errs[] = " -> run <i>chmod g+rwx ".$_POST["serendipityPath"].$_POST["uploadPath"]."</i>";
+ }
- // Attempt to create the archives directory
- if (!is_dir($_POST["serendipityPath"]."archives") &&
- @mkdir($_POST["serendipityPath"]."archives", 0770) !== true) {
- $errs[] = "Couldn't create the archives directory, you do it.";
- $errs[] = " -> Run <i>mkdir ".$_POST["serendipityPath"]."</i>";
- $errs[] = " -> and <i>chmod g+rwx ".$_POST["serendipityPath"]."archives</i>";
- }
+ // Attempt to create the archives directory
+ if (!is_dir($_POST["serendipityPath"]."archives") &&
+ @mkdir($_POST["serendipityPath"]."archives", 0770) !== true) {
+ $errs[] = "Couldn't create the archives directory, you do it.";
+ $errs[] = " -> Run <i>mkdir ".$_POST["serendipityPath"]."</i>";
+ $errs[] = " -> and <i>chmod g+rwx ".$_POST["serendipityPath"]."archives</i>";
+ }
- // Attempt to create the plugins dir
- if (!is_dir($_POST['serendipityPath'] . "plugins") &&
- @mkdir($_POST['serendipityPath'] . "plugins", 0770) !== true) {
- $errs[] = "Couldn't create the plugins directory, you do it.";
- $errs[] = " -> Run <i>mkdir ".$_POST["serendipityPath"]."</i>";
- $errs[] = " -> and <i>chmod g+rwx ".$_POST["serendipityPath"]."plugins</i>";
- }
+ // Attempt to create the plugins dir
+ if (!is_dir($_POST['serendipityPath'] . "plugins") &&
+ @mkdir($_POST['serendipityPath'] . "plugins", 0770) !== true) {
+ $errs[] = "Couldn't create the plugins directory, you do it.";
+ $errs[] = " -> Run <i>mkdir ".$_POST["serendipityPath"]."</i>";
+ $errs[] = " -> and <i>chmod g+rwx ".$_POST["serendipityPath"]."plugins</i>";
+ }
- $_POST['dbType'] = strtolower(basename($_POST['dbType']));
- foreach ($_POST as $k => $v) {
- if (substr($k, 0, 2) == 'db' || $k == 'serendipityPath') {
- $serendipity[$k] = $v;
- }
- }
- include_once $_POST['serendipityPath'] . '/serendipity_db_' . $_POST['dbType'] . '.inc.php';
+ $_POST['dbType'] = strtolower(basename($_POST['dbType']));
+ foreach ($_POST as $k => $v) {
+ if (substr($k, 0, 2) == 'db' || $k == 'serendipityPath') {
+ $serendipity[$k] = $v;
+ }
+ }
+ include_once $_POST['serendipityPath'] . '/serendipity_db_' . $_POST['dbType'] . '.inc.php';
- // Probe database (do it after the dir stuff, as we need to be able to create the
- // sqlite database)
- serendipity_db_probe($_POST, $errs);
+ // Probe database (do it after the dir stuff, as we need to be able to create the
+ // sqlite database)
+ serendipity_db_probe($_POST, $errs);
- // Check imagick
- if ($_POST["magick"] == "true" && !is_executable($_POST["convert"])) {
- $errs[] = "Can't execute convert binary!";
- }
+ // Check imagick
+ if ($_POST["magick"] == "true" && !is_executable($_POST["convert"])) {
+ $errs[] = "Can't execute convert binary!";
+ }
- // Something went wrong
- if (is_array($errs) && count($errs)) {
- echo "<font color='#ff0000'>".implode("<br>", $errs)."</font><p>";
- serendipity_printConfigTemplate(serendipity_parseTemplate("./serendipity_config_local.tpl"), $_POST);
- } else {
- echo "Everything seems to be alright, saving config...<p>";
- $f = implode("", file("./serendipity_config_local.tpl"));
- $p = serendipity_parseTemplate("./serendipity_config_local.tpl");
- foreach($p as $key=>$value) {
- for($x=0; $x<count($value); $x++) {
- $replace = "{".$value[$x]["name"]."|".$value[$x]["type"]."|".$value[$x]["distdefault"]."}";
- $f = str_replace($replace,
- str_replace("\"", "\\\"", $_POST[$value[$x]["name"]]), $f);
- //echo "Replacing $replace with ".$_POST[$value[$x]["name"]]."<br>";
- }
- }
- $fp = @fopen("./serendipity_config_local.inc.php", "w");
- if (!is_resource($fp)) {
- echo "<font color='#ff0000'>Error! Could not write to ./serendipity_config_local.inc.php.<br>";
- echo "Try <i>chown -R www:www ".$_POST["serendipityPath"]."</i><br>";
- echo "followed by <i>chmod 770 ".$serendipity_POST["serendipityPath"]."</i> (change www to the";
- echo "user your apache is running as).</font><br>";
- echo "After that you can press your browser's reload button.";
- }
- else {
- echo "Writing to config file...";
- fwrite($fp, $f);
- fclose($fp);
- echo "<b>Done.</b><br>";
- if (IN_serendipity!==true) {
- define('IN_serendipity', true);
+ // Something went wrong
+ if (is_array($errs) && count($errs)) {
+ echo "<font color='#ff0000'>".implode("<br>", $errs)."</font><p>";
+ serendipity_printConfigTemplate(serendipity_parseTemplate("./serendipity_config_local.tpl"), $_POST);
+ } else {
+ if (IN_serendipity!==true) {
+ define('IN_serendipity', true);
- // Create .htaccess
- $a = file("./htaccess.tpl");
- $fp = @fopen("./.htaccess", "w");
- if (!is_resource($fp)) {
- echo "<font color='#ff0000'>Error: Could not create .htaccess file, create it yourself:<pre>\n";
- echo implode("\n", $a);
- }
- else {
- for($x=0; $x<count($a); $x++) {
- fwrite($fp, str_replace("{PREFIX}", $_POST["serendipityHTTPPath"],$a[$x])."\n");
- }
- fclose($fp);
- }
+ // Create .htaccess
+ $a = file("./htaccess.tpl");
+ $fp = @fopen("./.htaccess", "w");
+ if (!is_resource($fp)) {
+ echo "<font color='#ff0000'>Error: Could not create .htaccess file, create it yourself:<pre>\n";
+ echo implode("\n", $a);
+ }
+ else {
+ for($x=0; $x<count($a); $x++) {
+ fwrite($fp, str_replace("{PREFIX}", $_POST["serendipityHTTPPath"],$a[$x])."\n");
+ }
+ fclose($fp);
+ }
- // Create tables
- echo "Attempting to setup Database...<br>";
- $queries = serendipity_parse_sql_tables('./db.sql');
- $queries = str_replace("{PREFIX}", $_POST['dbPrefix'], $queries);
- foreach ($queries as $query) {
- serendipity_db_schema_import($query);
- }
- if($_POST['want_mail'] == true) {
- $mail_comments = 1;
- } else {
- $mail_comments = 0;
- }
- $enc_pass = md5($_POST['pass']);
- $query = "INSERT INTO $_POST[dbPrefix]authors
+ // Create tables
+ echo "Attempting to setup Database...<br>";
+ $queries = serendipity_parse_sql_tables('./db.sql');
+ $queries = str_replace("{PREFIX}", $_POST['dbPrefix'], $queries);
+ foreach ($queries as $query) {
+ serendipity_db_schema_import($query);
+ }
+ if($_POST['want_mail'] == true) {
+ $mail_comments = 1;
+ } else {
+ $mail_comments = 0;
+ }
+ $enc_pass = md5($_POST['pass']);
+ $query = "INSERT INTO $_POST[dbPrefix]authors
(username, password, email, mail_comments)
VALUES('$_POST[user]',
'$enc_pass',
'$_POST[email]',
$mail_comments) ";
- serendipity_db_query($query);
+ serendipity_db_query($query);
- $text = serendipity_db_escape_string(file_get_contents('./serendipity.css'));
- $query = "INSERT into $_POST[dbPrefix]css (name, data) values ('default', '$text')";
- $res = serendipity_db_query($query);
- if (is_string($res)) {
- echo $res;
- }
+ $text = serendipity_db_escape_string(file_get_contents('./serendipity.css'));
+ $query = "INSERT into $_POST[dbPrefix]css (name, data, weblogid) values ('default', '$text', '1')";
+ $res = serendipity_db_query($query);
+ if (is_string($res)) {
+ echo $res;
+ }
- /* register default plugins */
-
- $GLOBALS['serendipity']['dbPrefix'] = $_POST['dbPrefix'];
- $GLOBALS['serendipity']['dbName'] = $_POST['dbName'];
- include_once "serendipity_plugin_api.php";
- serendipity_plugin_api::register_default_plugins();
+ // Save all basic config variables to the database
+ $p = serendipity_parseTemplate("./serendipity_config_local.tpl");
+ foreach($p as $key=>$value) {
+ foreach ($value as $entry) {
+ $query = "INSERT INTO {$_POST['dbPrefix']}config (name, value, weblogid) ";
+ $query .= "VALUES ('" . serendipity_db_escape_string($entry['name']) . "', '";
+ $query .= serendipity_db_escape_string($_POST[$entry['name']]) . "', '1');";
- echo "<p>Welcome to serendipity!</b><p>";
- echo "Write down your password: ".$_POST["pass"]." and <a href='".$_POST["serendipityHTTPPath"]."'>check out your blog</a>";
- session_destroy();
- }
- }
- }
- break;
+ serendipity_db_query($query);
+ }
+ }
- default:
- if (file_exists("./serendipity_config_local.inc.php")) $from = &$serendipity;
- else $from = false;
- serendipity_printConfigTemplate(serendipity_parseTemplate("./serendipity_config_local.tpl"), $from);
+ // Create a basic configuration file which gives enough information to open
+ // the database and get information from the database tables
+ $configfp = fopen("./serendipity_config_local.inc.php", "w");
+ if (!is_resource($fp)) {
+ echo '<font color="#ff0000">Error! Could not write to ./serendipity_config_local.inc.php</font><br>';
+ echo "Try <i>chown -R www:www {$_POST['serendipityPath']}</i><br>";
+ echo "followd by <i>chmod 770 {$_POST['serendipityPath']}</i> (change www to the";
+ echo "user apache runs as.)</font><br />";
+ echo "Once you've done this, hit your browser's \"reload\" button.";
+ exit();
+ }
+
+ fwrite($configfp, "<?php\n");
+ fwrite($configfp, "\$serendipity['dbName'] = '{$serendipity['dbName']}';\n");
+ fwrite($configfp, "\$serendipity['dbPrefix'] = '{$serendipity['dbPrefix']}';\n");
+ fwrite($configfp, "\$serendipity['dbHost'] = '{$serendipity['dbHOst']}';\n");
+ fwrite($configfp, "\$serendipity['dbUser'] = '{$serendipity['dbUser']}';\n");
+ fwrite($configfp, "\$serendipity['dbPass'] = '{$serendipity['dbPass']}';\n");
+ fwrite($configfp, "?>\n");
+
+ fclose($configfp);
+
+
+ /* register default plugins */
+ $GLOBALS['serendipity']['dbPrefix'] = $_POST['dbPrefix'];
+ $GLOBALS['serendipity']['dbName'] = $_POST['dbName'];
+ include_once "serendipity_plugin_api.php";
+ serendipity_plugin_api::register_default_plugins();
+
+ echo "<p>Welcome to serendipity!</b><p>";
+ echo "Write down your password: ".$_POST["pass"]." and <a href='".$_POST["serendipityHTTPPath"]."'>check out your blog</a>";
+ session_destroy();
+ }
+ }
+ break;
+
+ default:
+ if (file_exists("./serendipity_config_local.inc.php")) {
+ $from = &$serendipity;
+ }
+ else {
+ $from = false;
+ }
+
+ serendipity_printConfigTemplate(serendipity_parseTemplate("./serendipity_config_local.tpl"), $from);
}
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: t
+ * End:
+ */
?>
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- serendipity_config.inc.php 30 Mar 2003 15:38:08 -0000 1.2
+++ serendipity_config.inc.php 31 Mar 2003 21:49:26 -0000 1.3
@@ -1,61 +1,65 @@
<?php
-##########################################################################
-# serendipity - another blogger... #
-##########################################################################
-# #
-# (c) 2003 Jannis Hermanns <J...@ha...> #
-# http://www.jannis.to/programming/serendipity.html #
-# #
-##########################################################################
define('IN_serendipity', true);
include_once('compat.php');
// For security reasons (serendipity relies on register_globals on)
$serendipity = array();
-if (!file_exists("./serendipity_config_local.inc.php"))
- die ("serendipity is not yet installed! Go to the <a href='serendipity_admin.php'>Installation</a>");
-include_once('./serendipity_config_local.inc.php');
-
-// Put your emoticons here
-$serendipity["smiles"] = array(":'(" => $serendipity["serendipityHTTPPath"]."pixel/cry_smile.gif",
- ":-)" => $serendipity["serendipityHTTPPath"]."pixel/regular_smile.gif",
- ":-O" => $serendipity["serendipityHTTPPath"]."pixel/embaressed_smile.gif",
- ":O" => $serendipity["serendipityHTTPPath"]."pixel/embaressed_smile.gif",
- ":-(" => $serendipity["serendipityHTTPPath"]."pixel/sad_smile.gif",
- ":(" => $serendipity["serendipityHTTPPath"]."pixel/sad_smile.gif",
- ":)" => $serendipity["serendipityHTTPPath"]."pixel/regular_smile.gif",
- "8-)" => $serendipity["serendipityHTTPPath"]."pixel/shades_smile.gif",
- ":-D" => $serendipity["serendipityHTTPPath"]."pixel/teeth_smile.gif",
- ":D" => $serendipity["serendipityHTTPPath"]."pixel/teeth_smile.gif",
- "8)" => $serendipity["serendipityHTTPPath"]."pixel/shades_smile.gif",
- ":-P" => $serendipity["serendipityHTTPPath"]."pixel/tounge_smile.gif",
- ";-)" => $serendipity["serendipityHTTPPath"]."pixel/wink_smile.gif",
- ";)" => $serendipity["serendipityHTTPPath"]."pixel/wink_smile.gif",
- ":P" => $serendipity["serendipityHTTPPath"]."pixel/tounge_smile.gif",
- );
-// You're done :)
+if (!file_exists("./serendipity_config_local.inc.php")) {
+ die("Serendipity is not yet installed. Please <a href=\"serendipity_admin.php\">install</a> it now.");
+}
-/*************************************************************************
-* You shouldn't need to touch anything here. *
-*************************************************************************/
+// Load DB configuration information
+include_once("./serendipity_config_local.inc.php");
-include($serendipity["serendipityPath"]."/serendipity_functions.inc.php");
-if (serendipity_FUNCTIONS_LOADED!== true)
- die ("serendipity error: could not include serendipity_functions.inc.php - exiting");
+include_once("./serendipity_functions.inc.php");
+if (serendipity_FUNCTIONS_LOADED!== true) {
+ die("serendipity error: could not include serendipity_functions.inc.php - exiting");
+}
+// Connect to database
+if (!serendipity_db_connect()) {
+ die("serendipity error: unable to connect to database - exiting");
+}
-include($serendipity["serendipityPath"]."/serendipity_lang_".$serendipity["lang"].".inc.php");
-if (serendipity_LANG_LOADED !== true)
- die ("serendipity error: could not include serendipity_lang_".$serendipity["lang"].".inc.php - exiting");
+$translation = array(
+ "true" => true,
+ "false" => false
+ );
+// Load Configuration options from the database
+$rows = serendipity_db_query("SELECT name,value FROM {$serendipity['dbPrefix']}config WHERE weblogid='1'");
+foreach ($rows as $row) {
+ $serendipity[$row['name']] = isset($translation[$row['value']]) ? $translation[$row['value']] : $row['value'];
+}
-// Connect to database
-if (!serendipity_db_connect()) {
- die ("serendipity error: unable to connect to database - exiting");
+// Load basic language information
+include_once($serendipity["serendipityPath"]."/serendipity_lang_".$serendipity["lang"].".inc.php");
+if (serendipity_LANG_LOADED !== true) {
+ die("serendipity error: could not include serendipity_lang_".$serendipity["lang"].".inc.php - exiting");
}
+// A Set of emoticons to rewrite
+$serendipity["smiles"] = array(
+ ":'(" => $serendipity["serendipityHTTPPath"]."pixel/cry_smile.gif",
+ ":-)" => $serendipity["serendipityHTTPPath"]."pixel/regular_smile.gif",
+ ":-O" => $serendipity["serendipityHTTPPath"]."pixel/embaressed_smile.gif",
+ ":O" => $serendipity["serendipityHTTPPath"]."pixel/embaressed_smile.gif",
+ ":-(" => $serendipity["serendipityHTTPPath"]."pixel/sad_smile.gif",
+ ":(" => $serendipity["serendipityHTTPPath"]."pixel/sad_smile.gif",
+ ":)" => $serendipity["serendipityHTTPPath"]."pixel/regular_smile.gif",
+ "8-)" => $serendipity["serendipityHTTPPath"]."pixel/shades_smile.gif",
+ ":-D" => $serendipity["serendipityHTTPPath"]."pixel/teeth_smile.gif",
+ ":D" => $serendipity["serendipityHTTPPath"]."pixel/teeth_smile.gif",
+ "8)" => $serendipity["serendipityHTTPPath"]."pixel/shades_smile.gif",
+ ":-P" => $serendipity["serendipityHTTPPath"]."pixel/tounge_smile.gif",
+ ";-)" => $serendipity["serendipityHTTPPath"]."pixel/wink_smile.gif",
+ ";)" => $serendipity["serendipityHTTPPath"]."pixel/wink_smile.gif",
+ ":P" => $serendipity["serendipityHTTPPath"]."pixel/tounge_smile.gif",
+ );
+
+
// Avoid magic_quotes_gpc issues
// courtesy of il...@ph...
function serendipity_strip_quotes(&$var)
@@ -94,13 +98,27 @@
$serendipity["POST"] = &$_POST["serendipity"];
// We don't care who tells us what to do
-if (!$serendipity["GET"]["action"])
+if (!$serendipity["GET"]["action"]) {
$serendipity["GET"]["action"] = $serendipity["POST"]["action"];
-if (!$serendipity["GET"]["adminAction"])
+}
+
+if (!$serendipity["GET"]["adminAction"]) {
$serendipity["GET"]["adminAction"] = $serendipity["POST"]["adminAction"];
+}
// Some stuff...
-if (!$_SESSION["serendipityAuthedUser"]) $_SESSION["serendipityAuthedUser"] = false;
+if (!$_SESSION["serendipityAuthedUser"]) {
+ $_SESSION["serendipityAuthedUser"] = false;
+}
+
$serendipity["user"] = $_SESSION["serendipityUser"];
$serendipity["email"] = $_SESSION["serendipityEmail"];
+
+/**
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: t
+ * End:
+ */
?>
Index: serendipity_db.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- serendipity_db.inc.php 28 Mar 2003 20:05:24 -0000 1.1.1.1
+++ serendipity_db.inc.php 31 Mar 2003 21:49:27 -0000 1.2
@@ -1,6 +1,6 @@
-<?php # $Id$
+<?php
-include_once $serendipity['serendipityPath'] . "/serendipity_db_" . $serendipity['dbType'] . ".inc.php";
+include_once("./serendipity_db_" . $serendipity['dbType'] . ".inc.php");
function serendipity_db_update($table, $keys, $values)
{
Index: serendipity_db_mysql.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db_mysql.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- serendipity_db_mysql.inc.php 29 Mar 2003 16:13:08 -0000 1.2
+++ serendipity_db_mysql.inc.php 31 Mar 2003 21:49:27 -0000 1.3
@@ -75,6 +75,10 @@
{
global $serendipity;
+ if ($serendipity['dbConn']) {
+ return;
+ }
+
$serendipity['dbConn'] = mysql_connect($serendipity['dbHost'], $serendipity['dbUser'], $serendipity['dbPass']);
return $serendipity['dbConn'];
}
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- serendipity_functions.inc.php 31 Mar 2003 07:55:22 -0000 1.7
+++ serendipity_functions.inc.php 31 Mar 2003 21:49:27 -0000 1.8
@@ -1,18 +1,6 @@
<?php
-
-##########################################################################
-# serendipity - another blogger... #
-##########################################################################
-# #
-# (c) 2003 Jannis Hermanns <J...@ha...> #
-# http://www.jannis.to/programming/serendipity.html #
-# #
-##########################################################################
-
-if (IN_serendipity !== true) die ("Don't hack!");
-
-include_once "serendipity_db.inc.php";
-include_once "compat.php";
+include_once("./serendipity_db.inc.php");
+include_once("./compat.php");
$serendipity["imageList"] = array();
function serendipity_displayCommentForm($id) {
|