Port from master

This commit is contained in:
Garvin Hicking 2013-01-21 10:06:09 +01:00
parent 88f69a298e
commit 53ea38aa3c
15 changed files with 73 additions and 24 deletions

View File

@ -8,6 +8,14 @@ Version 2.0 ()
Version 1.7 ()
------------------------------------------------------------------------
* rc2: Alter entries.tpl to add the line:
{assign var="entry" value=$entry scope=parent}
for proper propagation of $entry to sub-templates.
* rc2: Alter error reporting to only fail when 'debug' mode is enabled,
so that "normal" blog installations will not fail on specific
E_STRICT warnings that are not important.
* Allow entryproperties plugin to define defaults for custom fields
* Onyx, Net_URL classes: Remove PHP4 style constructor due to

View File

@ -161,6 +161,26 @@ $tasks = array(array('version' => '0.5.1',
'title' => 'Introduce author groups',
'desc' => 'This version introduces customizable user groups. Your existing users will be migrated into the new default groups.'),
array('version' => '1.7-rc2',
'type' => 'PLUGIN_NOTICE',
'function' => '',
'title' => '<b>PLUGIN NOTICE:</b> Due to PHP 5.2+\'s raised error reporting, every Serendipity event plugin needs to conform to the core plugin API method signature.',
'desc' => '<p>All internal and spartacus plugins have been updated to reflect this change. The most important signatures are:</p>'
. '<p><strong>function uninstall(&$propbag)</strong><br />'
. '<strong>function event_hook($event, &$bag, &$eventData, $addData = null)</strong></p>'
. '<p>Older plugins specifically did not always include the <strong>$addData</strong> signature. Make sure this exists.
If after installation you get uncircumventable errors, you can make sure to set <strong>$serendipity[\'product\'] = true;</strong> in your <strong>serendipity_config_local.inc.php</strong> file. This should lower error reporting to a way that will not interfere with incompatible problem. But this is no solution in the long run, you need to update your plugins.
Also, the serendipity_event_browsercompatibility plugin has been removed, because it\'s functionality was no longer required. You should uninstall that plugin if you are currently using it.</p>'),
array('version' => '1.7-rc2',
'type' => 'TEMPLATE_NOTICE',
'function' => '',
'title' => '<b>TEMPLATE_NOTICE:</b> The template file "entries.tpl" needs a specific assignment',
'desc' => 'To transport the $entry variable to sub-templates like comments.tpl and trackbacks.tpl.
All internal and spartacus templates have been updated, so make sure you are using a recent version of your blog\'s template.
If you have your own custom template, be sure within your {foreach from=$dategroup.entries item="entry"} loop has this line after it:
<strong>{assign var="entry" value=$entry scope=parent}</strong>'),
);
/* Fetch SQL files which needs to be run */

View File

@ -82,6 +82,7 @@ if (!function_exists('errorToExceptionHandler')) {
global $serendipity;
$rep = ini_get('error_reporting');
// respect user has set php error_reporting to not display any errors at all
if (!($rep & $errStr)) { return false; }
// user used @ to specify ignoring all errors or $php_errormsg messages returned with error_reporting = 0
@ -90,6 +91,9 @@ if (!function_exists('errorToExceptionHandler')) {
if ($serendipity['production'] === true && ini_get('display_errors') == 0) { return false; }
// any other errors go here - throw errors as exception
if ($serendipity['production'] === 'debug') {
// We don't want the notices
echo '<p> == FULL DEBUG ERROR MODE == </p>';
echo '<pre>';
// trying to be as detailled as possible
@ -100,10 +104,17 @@ if (!function_exists('errorToExceptionHandler')) {
echo '</pre>'; // if throw new ... endtag is not set, it still looks better and browsers don't care
}
if ($serendipity['production'] !== true) {
$args = func_get_args();
// Several plugins might not adapt to proper style. This should not completely kill our execution.
if ($serendipity['production'] !== 'debug' && preg_match('@Declaration.*should be compatible with@i', $args[1])) {
#if (!headers_sent()) echo "<strong>Compatibility warning:</strong> Please upgrade file old '{$args[2]}', it contains incompatible signatures.<br/>Details: {$args[1]}<br/>";
return false;
}
$e = new Exception;
echo '<p> == TESTING ERROR MODE == </p>';
echo '<pre>';
print_r(func_get_args());
print_r($args);
print_r($e);
throw new ErrorException("Serendipity error: " . $errStr); // tracepath = all;
echo '</pre>'; // if throw new ... endtag is not set, it still looks better and browsers don't care

View File

@ -49,7 +49,7 @@ function serendipity_db_in_sql($col, &$search_ids, $type = ' OR ') {
function serendipity_db_connect() {
global $serendipity;
$host = port = '';
$host = $port = '';
if (strlen($serendipity['dbHost'])) {
if (false !== strstr($serendipity['dbHost'], ':')) {
$tmp = explode(':', $serendipity['dbHost']);

View File

@ -53,7 +53,7 @@ function serendipity_db_connect() {
$function = 'pg_connect';
}
$host = port = '';
$host = $port = '';
if (strlen($serendipity['dbHost'])) {
if (false !== strstr($serendipity['dbHost'], ':')) {
$tmp = explode(':', $serendipity['dbHost']);

View File

@ -1,4 +1,4 @@
<?php // (experimental) serendipity_smarty_class.inc.php 2012-06-13 16:09 Ian
<?php // (experimental) serendipity_smarty_class.inc.php 2012-01-03 14:11 Ian
// define secure_dir and trusted_dirs for Serendipity_Smarty_Security_Policy class.
@define('S9Y_TEMPLATE_FALLBACK', $serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default');
@ -309,10 +309,8 @@ class Serendipity_Smarty extends Smarty
}
// set smarty error reporting. General error_reporting is set in serendipity/serendipity_config.inc.php
$this->error_reporting = E_ALL & ~E_NOTICE ^ E_STRICT;
$this->error_reporting = E_ALL & ~(E_NOTICE|E_STRICT);
// we use our own error_handler and get in conflicts with smarty?
#$this->muteExpectedErrors();
}
/*

View File

@ -49,34 +49,21 @@ $serendipity['version'] = '2.0-alpha1';
// Setting this to 'false' will enable debugging output. All alpa/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'.
if (!isset($serendipity['production'])) {
$serendipity['production'] = (preg_match('@\-(alpha|beta|cvs)@', $serendipity['version']) ? false : true);
$serendipity['production'] = (preg_match('@\-(alpha|beta|cvs|rc)@', $serendipity['version']) ? false : true);
}
// Set error reporting
// TODO: E_STRICT throws problematic errors due to "hook_event" being a static function, but all of our plugins don't really define that...
error_reporting(E_ALL & ~E_NOTICE ^ E_STRICT);
error_reporting(E_ALL & ~(E_STRICT|E_NOTICE));
if ($serendipity['production'] !== true) {
if ($serendipity['production'] === 'debug') {
error_reporting(E_ALL);
}
@ini_set('display_errors', 'on');
}
// The serendipity errorhandler string
$serendipity['errorhandler'] = 'errorToExceptionHandler';
//[internal callback function]: errorToExceptionHandler()
if(is_callable($serendipity['errorhandler'], false, $callable_name)) {
// set serendipity global error to exeption handler
#if ($serendipity['production'] === 'debug') {
# set_error_handler($serendipity['errorhandler'], E_ALL);
#} else {
// Caution! If we want to have the same noshow effect as upper set error_reporting(E_ALL) in 'debug' mode,
// do not clone it to set_error_handler(E_ALL), else everythimg is haltet to debug, which makes using debug obsolet.
set_error_handler($serendipity['errorhandler'], E_ALL & ~E_NOTICE ^ E_STRICT);
#}
}
// Default rewrite method
$serendipity['rewrite'] = 'none';
@ -146,7 +133,7 @@ if (!isset($serendipity['languages'])) {
'fi' => 'Finnish',
'cs' => 'Czech (Win-1250)',
'cz' => 'Czech (ISO-8859-2)',
'sk' => 'Slovak',
'sk' => 'Slovak',
'nl' => 'Dutch',
'is' => 'Icelandic',
'tr' => 'Turkish',
@ -266,6 +253,22 @@ if (!is_readable($local_config)) {
include($local_config);
if ($serendipity['production'] === 'debug') {
error_reporting(E_ALL &~E_NOTICE | E_STRICT);
}
//[internal callback function]: errorToExceptionHandler()
if(is_callable($serendipity['errorhandler'], false, $callable_name)) {
// set serendipity global error to exeption handler
if ($serendipity['production'] === 'debug') {
set_error_handler($serendipity['errorhandler'], error_reporting()); // Yes, DEBUG mode should actually report E_STRICT errors! In PHP 5.4s is contained in E_ALL already, but not in PHP 5.2.
} else {
// Caution! If we want to have the same noshow effect as upper set error_reporting(E_ALL) in 'debug' mode,
// do not clone it to set_error_handler(E_ALL), else everythimg is haltet to debug, which makes using debug obsolet.
set_error_handler($serendipity['errorhandler'], E_ALL & ~(E_NOTICE|E_STRICT));
}
}
define('IS_up2date', version_compare($serendipity['version'], $serendipity['versionInstalled'], '<='));
/*

View File

@ -1,6 +1,7 @@
{serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<article id="post_{$entry.id}" class="clearfix serendipity_entry{if $dategroup.is_sticky} sticky{/if}">
<header class="clearfix">
<h2><a href="{$entry.link}">{$entry.title}</a></h2>

View File

@ -12,6 +12,7 @@
{/if}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<h4 class="entry-title serendipity_title"><a href="{$entry.link}" rel="bookmark">{$entry.title}</a></h4>
<div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if}">

View File

@ -2,6 +2,7 @@
{serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<div class="serendipity_Entry_Date">
{if $dategroup.is_sticky}

View File

@ -6,6 +6,7 @@
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
{if $dategroup.is_sticky}
<h3 class="serendipity_date">{$CONST.STICKY_POSTINGS}</h3>

View File

@ -3,6 +3,7 @@
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<div class="serendipity_Entry_Date">
<div class="serendipity_Entry_Header">

View File

@ -10,6 +10,8 @@
{/if}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
<div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if}">

View File

@ -3,6 +3,7 @@
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<div class="post">
<h2 id="post-{$entry.id}"><a href="{$entry.link}">{$entry.title}</a></h2>
{if !$is_single_entry}<div class="small">{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY}</div>{/if}

View File

@ -8,6 +8,7 @@
{/if}
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}
<div class="post">
<h3 class="storytitle" id="post-{$entry.id}"><a href="{$entry.link}" rel="bookmark" title="Permanent Link: {$entry.title}">{$entry.title}</a></h3>