Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20254
Modified Files:
Tag: branch_0_6
serendipity_admin_plugins.inc.php
serendipity_admin_upgrader.inc.php serendipity_db.inc.php
serendipity_functions_config.inc.php serendipity_lang.inc.php
serendipity_plugin_api.php serendipity_sidebar_items.php
Log Message:
MFH:
* Upgrader kills the current session for possible changes inside session
data on upgrade
* Fixed wrong comparison operator - bug reported by tom, where nl2br plugin
has "reversed" logic.
This is because (true != 'false') evaluates to true. Plugin config did not
evaluate radio values correctly.
* Fixed textile plugin not enabled by default after adding it as a plugin
* Comments plugin now correctly wordwraps
* Couple of linebreak fixes (*sigh*)
PLEASE TEST THE PLUGIN-STUFF! Needs to be verified working for rc2...
Index: serendipity_lang.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang.inc.php,v
retrieving revision 1.10
retrieving revision 1.10.4.1
diff -u -d -r1.10 -r1.10.4.1
--- serendipity_lang.inc.php 21 Mar 2004 16:35:32 -0000 1.10
+++ serendipity_lang.inc.php 13 Apr 2004 10:01:12 -0000 1.10.4.1
@@ -28,4 +28,4 @@
}
/* vim: set sts=4 ts=4 expandtab : */
-?>
+?>
\ No newline at end of file
Index: serendipity_functions_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions_config.inc.php,v
retrieving revision 1.5
retrieving revision 1.5.14.1
diff -u -d -r1.5 -r1.5.14.1
--- serendipity_functions_config.inc.php 4 Sep 2003 16:23:46 -0000 1.5
+++ serendipity_functions_config.inc.php 13 Apr 2004 10:01:12 -0000 1.5.14.1
@@ -11,10 +11,14 @@
}
}
-function serendipity_get_config_var($name, $defval = false) {
+function serendipity_get_config_var($name, $defval = false, $empty = false) {
global $serendipity;
- if ( isset($serendipity['CONFIG'][$name]) ) {
- return $serendipity['CONFIG'][$name];
+ if (isset($serendipity['CONFIG'][$name])) {
+ if ($empty && gettype($serendipity['CONFIG'][$name]) == 'string' && $serendipity['CONFIG'][$name] === '') {
+ return $defval;
+ } else {
+ return $serendipity['CONFIG'][$name];
+ }
} else {
return $defval;
}
Index: serendipity_admin_plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_plugins.inc.php,v
retrieving revision 1.20.4.2
retrieving revision 1.20.4.3
diff -u -d -r1.20.4.2 -r1.20.4.3
--- serendipity_admin_plugins.inc.php 7 Apr 2004 12:38:18 -0000 1.20.4.2
+++ serendipity_admin_plugins.inc.php 13 Apr 2004 10:01:06 -0000 1.20.4.3
@@ -254,12 +254,17 @@
$cbag = new serendipity_property_bag;
$plugin->introspect_config_item($config_item, $cbag);
- $cname = htmlspecialchars($cbag->get('name'));
- $cdesc = htmlspecialchars($cbag->get('description'));
- $value = $plugin->get_config($config_item);
- $hvalue = (isset($_POST['serendipity']['plugin'][$config_item]) ? htmlspecialchars($_POST['serendipity']['plugin'][$config_item]) : htmlspecialchars($value));
- $radio = array();
- $select = array();
+ $cname = htmlspecialchars($cbag->get('name'));
+ $cdesc = htmlspecialchars($cbag->get('description'));
+ $value = $plugin->get_config($config_item, 'unset');
+ $is_unset = false;
+ if ($value == 'unset') {
+ $is_unset = true;
+ $value = $plugin->get_config($config_item, false, true);
+ }
+ $hvalue = (isset($_POST['serendipity']['plugin'][$config_item]) ? htmlspecialchars($_POST['serendipity']['plugin'][$config_item]) : htmlspecialchars($value));
+ $radio = array();
+ $select = array();
switch ($cbag->get('type')) {
case 'seperator':
@@ -340,7 +345,7 @@
<?php
}
?>
- <input type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo ($radio_value == $hvalue ? 'checked="checked"' : ''); ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" />
+ <input type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo (($radio_value == $hvalue || ($radio_value == 'true' && $hvalue == true) || ($radio_value == 'false' && $is_unset == false && $hvalue == false)) ? 'checked="checked"' : ''); ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" />
<label for="serendipity_plugin_<?php echo $id; ?>"><?php echo htmlspecialchars($radio['desc'][$radio_index]); ?></label>
<?php
if ($counter == $per_row) {
Index: serendipity_sidebar_items.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_sidebar_items.php,v
retrieving revision 1.52.4.1
retrieving revision 1.52.4.2
diff -u -d -r1.52.4.1 -r1.52.4.2
--- serendipity_sidebar_items.php 7 Apr 2004 12:38:18 -0000 1.52.4.1
+++ serendipity_sidebar_items.php 13 Apr 2004 10:01:12 -0000 1.52.4.2
@@ -270,7 +270,7 @@
$cache = '';
}
- if ($this->get_config('show_0.91') != 'false') {
+ if (serendipity_db_bool($this->get_config('show_0.91', true))) {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=0.91<?php echo $cache; ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" <?php echo ($serendipity['XHTML11'] ? 'style="border: 0px"' : 'border="0"'); ?> alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=0.91<?php echo $cache; ?>">RSS 0.91 feed</a>
@@ -278,7 +278,7 @@
<?php
}
- if ($this->get_config('show_1.0') != 'false') {
+ if (serendipity_db_bool($this->get_config('show_1.0', true))) {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=1.0<?php echo $cache; ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" <?php echo ($serendipity['XHTML11'] ? 'style="border: 0px"' : 'border="0"'); ?> alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=1.0<?php echo $cache; ?>">RSS 1.0 feed</a>
@@ -286,7 +286,7 @@
<?php
}
- if ($this->get_config('show_2.0') != 'false') {
+ if (serendipity_db_bool($this->get_config('show_2.0', true))) {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0<?php echo $cache; ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" <?php echo ($serendipity['XHTML11'] ? 'style="border: 0px"' : 'border="0"'); ?> alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0<?php echo $cache; ?>">RSS 2.0 feed</a>
@@ -294,7 +294,7 @@
<?php
}
- if ($this->get_config('show_atom0.3') != 'false') {
+ if (serendipity_db_bool($this->get_config('show_atom0.3', true))) {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=atom0.3<?php echo $cache; ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" <?php echo ($serendipity['XHTML11'] ? 'style="border: 0px"' : 'border="0"'); ?> alt="ATOM/XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=atom0.3<?php echo $cache; ?>">ATOM 0.3 feed</a>
@@ -302,7 +302,7 @@
<?php
}
- if ($this->get_config('show_2.0c') != 'false') {
+ if (serendipity_db_bool($this->get_config('show_2.0c', true))) {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0&type=comments<?php echo $cache; ?>"><img src="<?php echo serendipity_getTemplateFile('img/xml.gif'); ?>" <?php echo ($serendipity['XHTML11'] ? 'style="border: 0px"' : 'border="0"'); ?> alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0&type=comments<?php echo $cache; ?>"><?php echo ($serendipity['XHTML11'] ? '<span style="white-space: nowrap">' : '<nobr>'); ?>RSS 2.0 <?php echo COMMENTS; ?><?php echo ($serendipity['XHTML11'] ? '</span>' : '</nobr>'); ?></a>
Index: serendipity_db.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db.inc.php,v
retrieving revision 1.10
retrieving revision 1.10.4.1
diff -u -d -r1.10 -r1.10.4.1
--- serendipity_db.inc.php 21 Mar 2004 16:35:32 -0000 1.10
+++ serendipity_db.inc.php 13 Apr 2004 10:01:11 -0000 1.10.4.1
@@ -49,7 +49,7 @@
function serendipity_db_bool ($val)
{
- if(($val === true) || ($val == 'true') || ($val == 't'))
+ if(($val === true) || ($val == 'true') || ($val == 't') || ($val == '1'))
return true;
#elseif (($val === false || $val == 'false' || $val == 'f'))
else
Index: serendipity_plugin_api.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_plugin_api.php,v
retrieving revision 1.16
retrieving revision 1.16.4.1
diff -u -d -r1.16 -r1.16.4.1
--- serendipity_plugin_api.php 23 Mar 2004 16:11:34 -0000 1.16
+++ serendipity_plugin_api.php 13 Apr 2004 10:01:12 -0000 1.16.4.1
@@ -35,7 +35,7 @@
serendipity_plugin_api::create_plugin_instance($class_name);
}
}
-
+
serendipity_plugin_api::create_plugin_instance('serendipity_event_s9ymarkup', null, 'event');
serendipity_plugin_api::create_plugin_instance('serendipity_event_emoticate', null, 'event');
serendipity_plugin_api::create_plugin_instance('serendipity_event_nl2br', null, 'event');
@@ -69,7 +69,7 @@
} else {
$nextidx = 0;
}
-
+
serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}plugins (name, sort_order, placement) values ('$key', $nextidx, '$default_placement')");
/* Check for multiple dependencies */
@@ -77,7 +77,7 @@
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
$plugin->register_dependencies(false);
-
+
return $key;
}
@@ -95,7 +95,7 @@
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}config where name LIKE '$plugin_instance_id/%'");
}
-
+
function remove_plugin_value($plugin_instance_id, $where)
{
global $serendipity;
@@ -103,7 +103,7 @@
foreach($where AS $key) {
$where_sql[] = "(name LIKE '{$plugin_instance_id}/{$key}_%' AND value = '')";
}
-
+
$query = "DELETE FROM {$serendipity['dbPrefix']}config
WHERE " . implode(' OR ', $where_sql);
@@ -144,27 +144,27 @@
if ($f{0} == '.' || $f == 'CVS') {
continue;
}
-
+
if ($event_only && strncmp($f, 'serendipity_event_', 18) != 0) {
continue;
}
-
+
if (!$event_only && strncmp($f, 'serendipity_event_', 18) == 0) {
continue;
}
-
+
$existing = array_search('@' . $f, $classes);
if ($existing !== null && $existing !== false) {
// If an external plugin/event already exists as internal, remove the internal reference because its redundant
unset($classes[$existing]);
}
-
+
if (file_exists($ppath . '/' . $f . '/' . $f . '.php')) {
$classes[] = $f;
}
}
}
-
+
/* LOCAL third-party classes next */
$local_ppath = $serendipity['serendipityPath'] . 'plugins';
if ($ppath != $local_ppath) {
@@ -174,21 +174,21 @@
if ($f{0} == '.' || $f == 'CVS') {
continue;
}
-
+
if ($event_only && strncmp($f, 'serendipity_event_', 18) != 0) {
continue;
}
-
+
if (!$event_only && strncmp($f, 'serendipity_event_', 18) == 0) {
continue;
}
-
+
$existing = array_search('@' . $f, $classes);
if ($existing !== null && $existing !== false) {
// If an external plugin/event already exists as internal, remove the internal reference because its redundant
unset($classes[$existing]);
}
-
+
$existing = array_search($f, $classes);
if ($existing !== null && $existing !== false) {
// A local plugin will be preferred over general plugins
@@ -201,7 +201,7 @@
}
}
}
-
+
return $classes;
}
@@ -301,14 +301,14 @@
echo "</$tagname>\n";
}
-
+
function get_plugin_title(&$plugin, $default_title = '')
{
global $serendipity;
// Generate plugin output. Make sure that by probing the plugin, no events are actually called. After that,
// restore setting of 'no_events'.
-
+
$ne = (isset($serendipity['no_events']) && $serendipity['no_events'] ? TRUE : FALSE);
$serendipity['no_events'] = TRUE;
ob_start();
@@ -323,13 +323,13 @@
$title = $plugin->instance;
}
}
-
+
return $title;
}
function &get_event_plugins($instance = false) {
global $serendipity;
-
+
if (!isset($serendipity['event_plugins']) || !is_array($serendipity['event_plugins'])) {
$plugins = serendipity_plugin_api::enum_plugins('event');
$serendipity['event_plugins'] = array();
@@ -358,7 +358,7 @@
return $serendipity['event_plugins'];
}
}
-
+
function hook_event($event_name, &$eventData) {
global $serendipity;
@@ -366,7 +366,7 @@
// $serendipity['no_events'] = TRUE;
if (!isset($serendipity['no_events']) || !$serendipity['no_events']) {
$plugins = &serendipity_plugin_api::get_event_plugins();
-
+
if (is_array($plugins)) {
foreach($plugins AS $plugin => $plugin_data) {
$bag = &$plugin_data['b'];
@@ -374,17 +374,17 @@
}
}
}
-
+
return true;
}
function exists($instance_id) {
global $serendipity;
-
+
if (!strstr($instance_id, ':')) {
$instance_id .= ':';
}
-
+
$existing = serendipity_db_query("SELECT name FROM {$serendipity['dbPrefix']}plugins WHERE name LIKE '%$instance_id%'");
if (is_array($existing) && !empty($existing[0][0])) {
@@ -498,13 +498,12 @@
$title = 'Sample!';
echo 'This is a sample!';
}
-
+
/* Fetches a configuration value for this plugin */
- function get_config($name, $defaultvalue = null)
+ function get_config($name, $defaultvalue = null, $empty = true)
{
$name = $this->instance . '/' . $name;
-
- return serendipity_get_config_var($name, $defaultvalue);
+ return serendipity_get_config_var($name, $defaultvalue, $empty);
}
function set_config($name, $value)
@@ -523,17 +522,17 @@
// serendipity_plugin_api::remove_plugin_value($this->instance, array('title', 'description'));
return true;
}
-
+
function register_dependencies($remove = false)
{
global $serendipity;
-
+
if (isset($this->dependencies) && is_array($this->dependencies)) {
-
+
if ($remove) {
$dependencies = @explode(';', $this->get_config('dependencies'));
$modes = @explode(';', $this->get_config('dependency_modes'));
-
+
if (!empty($dependencies) && is_array($dependencies)) {
foreach($dependencies AS $idx => $dependency) {
if ($modes[$idx] == 'remove' && serendipity_plugin_api::exists($dependency)) {
@@ -558,7 +557,7 @@
$modes[] = $mode;
}
-
+
$this->set_config('dependencies', implode(';', $keys));
$this->set_config('dependency_modes', implode(';', $modes));
}
Index: serendipity_admin_upgrader.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_upgrader.inc.php,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -d -r1.6 -r1.6.4.1
--- serendipity_admin_upgrader.inc.php 4 Apr 2004 15:34:36 -0000 1.6
+++ serendipity_admin_upgrader.inc.php 13 Apr 2004 10:01:11 -0000 1.6.4.1
@@ -25,7 +25,7 @@
@ksort($sqlfiles);
if ($serendipity['GET']['action'] == 'ignore') {
- /* Todo: Don't know what to put here? */
+ /* Todo: Don't know what to put here? */
} elseif ($serendipity['GET']['action'] == 'upgrade') {
@@ -53,7 +53,7 @@
}
}
}
-
+
if (is_array($errors)) {
echo DIAGNOSTIC_ERROR . '<br /><br />';
echo '<span style="color: #FF0000">- ' . implode('<br />', $errors) . '</span><br /><br />';
@@ -69,6 +69,8 @@
printf(SERENDIPITY_UPGRADER_NOW_UPGRADED, $serendipity['version']);
}
printf(SERENDIPITY_UPGRADER_RETURN_HERE, '<a href="'. $serendipity['serendipityHTTPPath'] .'">', '</a>');
+ $_SESSION['serendipityAuthedUser'] = false;
+ session_destroy();
} else {
echo SERENDIPITY_UPGRADER_WELCOME . '<br />';
printf(SERENDIPITY_UPGRADER_PURPOSE . '<br />', $serendipity['versionInstalled']);
@@ -109,7 +111,7 @@
echo '<br /><strong>0.6 - Template/CSS changes</strong>';
echo '<br />[INFO] A home-link has been added to the page headers. For that, two new CSS classes have been introduced: #homelink1 (header), homelink2 (subheader).<br />';
echo 'If you have a custom template, you need to adapt to those changes. To make themlook like your header previously has, insert this in your style.css:<br /><br />';
-
+
echo '<pre>a.homelink1,
a.homelink1:hover,
a.homelink1:link,
@@ -130,9 +132,9 @@
}
/*
-
+
Add more versions here using:
-
+
if ([version_compare]) {
[Desc]
$taskCount++;
@@ -155,4 +157,4 @@
<br /><input type="button" value="<?php echo SERENDIPITY_UPGRADER_CONSIDER_DONE ?>" onClick="location.href='<?php echo $abortLoc ?>'">
<?php }
}
-?>
\ No newline at end of file
+?>
|