Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv383
Modified Files:
serendipity_config.inc.php serendipity_config_local.tpl
serendipity_db.inc.php
Log Message:
o Code-cleanup
o Added 'Force XHTML11' config option [not used yet]
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- serendipity_config.inc.php 7 Jul 2003 19:29:11 -0000 1.13
+++ serendipity_config.inc.php 8 Jul 2003 09:00:16 -0000 1.14
@@ -1,70 +1,74 @@
<?php
define('IN_serendipity', true);
include_once('compat.php');
-ini_set("session.use_trans_sid",0);
+ini_set('session.use_trans_sid', 0);
+
$serendipity['production'] = 1;
// Rewrite always on
$serendipity['rewrite'] = true;
// We need this if people want to upgrade s9y
+
if (!isset($serendipity['templatePath'])) {
- $serendipity['templatePath'] = 'templates/';
+ $serendipity['templatePath'] = 'templates/';
}
if (!isset($serendipity['serendipityPath'])) {
- $serendipity['serendipityPath'] = './';
+ $serendipity['serendipityPath'] = './';
}
if (!file_exists("{$serendipity['serendipityPath']}serendipity_config_local.inc.php")) {
- die("Serendipity is not yet installed. Please <a href=\"serendipity_admin.php\">install</a> it now.");
+ die('Serendipity is not yet installed. Please <a href="serendipity_admin.php">install</a> it now.');
}
// Load DB configuration information
include_once("{$serendipity['serendipityPath']}serendipity_config_local.inc.php");
-
include_once("{$serendipity['serendipityPath']}serendipity_functions.inc.php");
+
if (serendipity_FUNCTIONS_LOADED!== true) {
- die("serendipity error: could not include serendipity_functions.inc.php - exiting");
+ 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");
+ die('serendipity error: unable to connect to database - exiting');
}
$translation = array(
- "true" => true,
- "false" => false
- );
+ 'true' => true,
+ 'false' => false
+ );
// Load Configuration options from the database
$rows = serendipity_db_query("SELECT name,value FROM {$serendipity['dbPrefix']}config");
foreach ($rows as $row) {
- $serendipity[$row['name']] = isset($translation[$row['value']]) ? $translation[$row['value']] : $row['value'];
+ $serendipity[$row['name']] = isset($translation[$row['value']]) ? $translation[$row['value']] : $row['value'];
}
// Load basic language information
-include_once($serendipity["serendipityPath"]."/serendipity_lang_".$serendipity["lang"].".inc.php");
+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");
+ 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",
- );
+include_once('./serendipity_smiles.inc.php');
+
+$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
@@ -72,61 +76,64 @@
function serendipity_strip_quotes(&$var)
{
if (is_array($var)) {
- foreach ($var as $k => $v) {
- if (is_array($v)) {
- array_walk($var[$k], 'serendipity_strip_quotes');
- } else {
- $var[$k] = stripslashes($v);
- }
- }
+ foreach ($var as $k => $v) {
+ if (is_array($v)) {
+ array_walk($var[$k], 'serendipity_strip_quotes');
+ } else {
+ $var[$k] = stripslashes($v);
+ }
+ }
} else {
$var = stripslashes($var);
}
}
-if (ini_get("magic_quotes_gpc")) {
+if (ini_get('magic_quotes_gpc')) {
if (@count($_GET)) {
- array_walk($_GET, 'serendipity_strip_quotes');
+ array_walk($_GET, 'serendipity_strip_quotes');
}
+
if (@count($_POST)) {
- array_walk($_POST, 'serendipity_strip_quotes');
+ array_walk($_POST, 'serendipity_strip_quotes');
}
+
if (@count($_COOKIES)) {
array_walk($_COOKIES, 'serendipity_strip_quotes');
}
+
if (@count($_FILES)) {
- array_walk($_FILES, 'serendipity_strip_quotes');
+ array_walk($_FILES, 'serendipity_strip_quotes');
}
}
-
// Merge get and post into the serendipity array
-$serendipity["GET"] = &$_GET["serendipity"];
-$serendipity["POST"] = &$_POST["serendipity"];
-$serendipity["COOKIE"] = &$_COOKIE["serendipity"];
+$serendipity['GET'] = &$_GET['serendipity'];
+$serendipity['POST'] = &$_POST['serendipity'];
+$serendipity['COOKIE'] = &$_COOKIE['serendipity'];
+
// We want our config vars cached... will save us lots of SQL queries
$sql = "SELECT * FROM {$serendipity['dbPrefix']}config";
$rs = serendipity_db_query($sql);
foreach ($rs as $var) {
- $serendipity["CONFIG"][$var['name']] = $var['value'];
+ $serendipity['CONFIG'][$var['name']] = $var['value'];
}
// We don't care who tells us what to do
-if (!$serendipity["GET"]["action"]) {
- $serendipity["GET"]["action"] = $serendipity["POST"]["action"];
+if (!$serendipity['GET']['action']) {
+ $serendipity['GET']['action'] = $serendipity['POST']['action'];
}
-if (!$serendipity["GET"]["adminAction"]) {
- $serendipity["GET"]["adminAction"] = $serendipity["POST"]["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"];
+$serendipity['user'] = $_SESSION['serendipityUser'];
+$serendipity['email'] = $_SESSION['serendipityEmail'];
/**
* Local Variables:
Index: serendipity_config_local.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config_local.tpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- serendipity_config_local.tpl 22 Jun 2003 19:21:06 -0000 1.7
+++ serendipity_config_local.tpl 8 Jul 2003 09:00:17 -0000 1.8
@@ -1,38 +1,39 @@
<?php
// Database Settings
-$serendipity["dbType"] = "{Database type|dbType|string|mysql}"; // Database type (mysql|postgres)
-$serendipity["dbHost"] = "{Database host|dbHost|string|localhost}"; // MySQL host
-$serendipity["dbUser"] = "{Database user|dbUser|string|serendipity}"; // Username
-$serendipity["dbPass"] = "{Database password|dbPass|string|serendipity}"; // Password
-$serendipity["dbName"] = "{Database name|dbName|string|serendipity}"; // Name of your database
-$serendipity["dbPrefix"] = "{Database prefix|dbPrefix|string|serendipity_}"; // Prefix for the table names, i.e. serendipity_
+$serendipity['dbType'] = '{Database type|dbType|string|mysql}'; // Database type (mysql|postgres)
+$serendipity['dbHost'] = '{Database host|dbHost|string|localhost}'; // MySQL host
+$serendipity['dbUser'] = '{Database user|dbUser|string|serendipity}'; // Username
+$serendipity['dbPass'] = '{Database password|dbPass|string|serendipity}'; // Password
+$serendipity['dbName'] = '{Database name|dbName|string|serendipity}'; // Name of your database
+$serendipity['dbPrefix'] = '{Database prefix|dbPrefix|string|serendipity_}'; // Prefix for the table names, i.e. serendipity_
// Paths (note: don't forget trailing slashes for directories!!!!)
-$serendipity["serendipityPath"] = "{Full path|serendipityPath|string|/webroot/serendipity/}"; // The full and aboslute path to your serendipity installation.
-$serendipity["uploadPath"] = "{Upload path|uploadPath|string|uploads/}"; // All uploads will go here, relative to the 'Full path' - typically 'uploads/'
-$serendipity["serendipityHTTPPath"] = "{Relative path|serendipityHTTPPath|string|/serendipity/}"; // Path to serendipity for your browser, typically '/serendipity/'
-$serendipity["templatePath"] = "{Relative template path|templatePath|string|templates/}"; // The path to the folder containing your templates - Relative to the 'relative path'
-$serendipity["uploadHTTPPath"] = "{Relative upload path|uploadHTTPPath|string|uploads/}"; // Path to your uploads for browsers - Relative to the 'relative path'.
-$serendipity["baseURL"] = "{URL to blog|baseURL|string|http://www.example.com/serendipity/}"; // Base URL to your serendipity installation
+$serendipity['serendipityPath'] = '{Full path|serendipityPath|string|/webroot/serendipity/}'; // The full and aboslute path to your serendipity installation.
+$serendipity['uploadPath'] = '{Upload path|uploadPath|string|uploads/}'; // All uploads will go here, relative to the 'Full path' - typically 'uploads/'
+$serendipity['serendipityHTTPPath'] = '{Relative path|serendipityHTTPPath|string|/serendipity/}'; // Path to serendipity for your browser, typically '/serendipity/'
+$serendipity['templatePath'] = '{Relative template path|templatePath|string|templates/}'; // The path to the folder containing your templates - Relative to the 'relative path'
+$serendipity['uploadHTTPPath'] = '{Relative upload path|uploadHTTPPath|string|uploads/}'; // Path to your uploads for browsers - Relative to the 'relative path'.
+$serendipity['baseURL'] = '{URL to blog|baseURL|string|http://www.example.com/serendipity/}'; // Base URL to your serendipity installation
// General settings
-$serendipity["user"] = "{Admin username|user|string|John Doe}"; // Username for admin login
-$serendipity["pass"] = "{Admin password|pass|protected|john}"; // Password for admin login
-$serendipity["email"] = "{Admin email|email|string|j}"; // Email for admin login
-$serendipity["want_mail"] = "{Send mails to admin?|want_mail|bool|true}"; // Do you want to receive emails when comments are posted to your entries?
-$serendipity["extCSS"] = "{External Stylesheet|extCSS|string|none}"; // You can define a stylesheet uri here, aditionally to the settings adjustable in the admin interface (enter 'none' if you don't need this)
-$serendipity["wysiwyg"] = "{Use WYSIWYG editor|wysiwyg|bool|0}"; // Do you want to use the WYSIWYG editor (CAUTION: only turn this on if you use Microsoft's Internet Explorer!!!)?
+$serendipity['user'] = '{Admin username|user|string|John Doe}'; // Username for admin login
+$serendipity['pass'] = '{Admin password|pass|protected|john}'; // Password for admin login
+$serendipity['email'] = '{Admin email|email|string|j}'; // Email for admin login
+$serendipity['want_mail'] = '{Send mails to admin?|want_mail|bool|true}'; // Do you want to receive emails when comments are posted to your entries?
+$serendipity['extCSS'] = '{External Stylesheet|extCSS|string|none}'; // You can define a stylesheet uri here, aditionally to the settings adjustable in the admin interface (enter 'none' if you don't need this)
+$serendipity['wysiwyg'] = '{Use WYSIWYG editor|wysiwyg|bool|0}'; // Do you want to use the WYSIWYG editor (CAUTION: only turn this on if you use Microsoft's Internet Explorer!!!)?
+$serendipity['XHTML11'] = '{Force XHTML 1.1 compliance|XHTML11|bool|0}'; // Do you want to force XHTML 1.1 compliance (may cause problems for back-/frontend on older 4th generation browsers)
-$serendipity["blogTitle"] = "{Blog name|blogTitle|string|John Doe's personal blog}"; // The title of your blog
-$serendipity["blogDescription"] = "{Blog description|blogDescription|string|Welcome to my blog...}"; // Description of your blog
-$serendipity["lang"] = "{Language file|lang|string|en}"; // Language (for 'en' you need serendipity_lang_en.inc.php).
-$serendipity["track_exits"] = "{Track exit URLs|track_exits|bool|1}"; // Do you want to track exit targets?
+$serendipity['blogTitle'] = '{Blog name|blogTitle|string|John Doe\'s personal blog}'; // The title of your blog
+$serendipity['blogDescription'] = '{Blog description|blogDescription|string|Welcome to my blog...}'; // Description of your blog
+$serendipity['lang'] = '{Language file|lang|string|en}'; // Language (for 'en' you need serendipity_lang_en.inc.php).
+$serendipity['track_exits'] = '{Track exit URLs|track_exits|bool|1}'; // Do you want to track exit targets?
// Imageconversion Settings
-$serendipity["magick"] = "{Use Imagemagick|magick|bool|0}"; // Do you have image magick installed
-$serendipity["convert"] = "{Path to convert binary|convert|string|/usr/local/bin/convert}"; // Full path & name of your image magick convert binary
-$serendipity["thumbSuffix"] = "{Thumbnail suffix|thumbSuffix|string|serendipityThumb}"; // Thumbnails will be named original.Suffix.ext
-$serendipity["thumbSize"] = "{Thumbnail dimensions|thumbSize|int|110}"; // Dimensions of auto-generated thumbnails
+$serendipity['magick'] = '{Use Imagemagick|magick|bool|0}'; // Do you have image magick installed
+$serendipity['convert'] = '{Path to convert binary|convert|string|/usr/local/bin/convert}'; // Full path & name of your image magick convert binary
+$serendipity['thumbSuffix'] = '{Thumbnail suffix|thumbSuffix|string|serendipityThumb}'; // Thumbnails will be named original.Suffix.ext
+$serendipity['thumbSize'] = '{Thumbnail dimensions|thumbSize|int|110}'; // Dimensions of auto-generated thumbnails
?>
Index: serendipity_db.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- serendipity_db.inc.php 7 Jul 2003 19:29:11 -0000 1.3
+++ serendipity_db.inc.php 8 Jul 2003 09:00:17 -0000 1.4
@@ -1,42 +1,47 @@
-<?php
+<?php
-include_once("./serendipity_db_" . $serendipity['dbType'] . ".inc.php");
+include_once("./serendipity_db_{$serendipity['dbType']}.inc.php");
function serendipity_db_update($table, $keys, $values)
{
- global $serendipity;
+ global $serendipity;
- $set = "";
- foreach ($values as $k => $v) {
- if (strlen($set))
- $set .= ", ";
- $set .= "$k='" . serendipity_db_escape_string($v) . "'";
- }
- $where = "";
- foreach ($keys as $k => $v) {
- if (strlen($where))
- $where .= " AND ";
- $where .= "$k='" . serendipity_db_escape_string($v) . "'";
- }
- if (strlen($where)) {
- $where = " WHERE $where";
- }
- return serendipity_db_query("UPDATE $serendipity[dbPrefix]$table SET $set $where");
+ $set = '';
+
+ foreach ($values as $k => $v) {
+ if (strlen($set))
+ $set .= ', ';
+ $set .= $k . '="' . serendipity_db_escape_string($v) . '"';
+ }
+
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if (strlen($where))
+ $where .= ' AND ';
+ $where .= $k . '="' . serendipity_db_escape_string($v) . '"';
+ }
+
+ if (strlen($where)) {
+ $where = " WHERE $where";
+ }
+
+ return serendipity_db_query("UPDATE {$serendipity['dbPrefix']}$table SET $set $where");
}
function serendipity_db_insert($table, $values)
{
- global $serendipity;
+ global $serendipity;
- $names = implode(",", array_keys($values));
+ $names = implode(',', array_keys($values));
+
+ $vals = '';
+ foreach ($values as $k => $v) {
+ if (strlen($vals))
+ $vals .= ', ';
+ $vals .= '"' . serendipity_db_escape_string($v) . '"';
+ }
- $vals = "";
- foreach ($values as $k => $v) {
- if (strlen($vals))
- $vals .= ", ";
- $vals .= "'" . serendipity_db_escape_string($v) . "'";
- }
- return serendipity_db_query("INSERT INTO $serendipity[dbPrefix]$table ($names) values ($vals)");
+ return serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}$table ($names) values ($vals)");
}
/* vim: set sts=4 ts=4 expandtab : */
|