cleanup cosmetics

This commit is contained in:
Ian 2014-12-10 14:34:54 +01:00
parent ffe93c92fc
commit aca77bd482
22 changed files with 132 additions and 134 deletions

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -32,4 +32,4 @@ if (serendipity_isResponseClean($url)) {
} }
exit; exit;
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */
?> ?>

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -65,7 +65,7 @@ function memSnap($tshow = '') {
/** /**
* Set our own exeption handler to convert all errors into exeptions automatically * Set our own exeption handler to convert all errors into exeptions automatically
* function_exists() avoids 'cannot redeclare previously declared' fatal errors in XML feed context. * function_exists() avoids 'cannot redeclare previously declared' fatal errors in XML feed context.
* *
* See Notes about returning false * See Notes about returning false
* *
* @access public * @access public
@ -135,7 +135,7 @@ if (!function_exists('errorToExceptionHandler')) {
$str .= '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>'; $str .= '<p>' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '</p>';
#var_dump(headers_list()); #var_dump(headers_list());
if (headers_sent()) { if (headers_sent()) {
serendipity_die($str); // case HTTP headers: needs to halt with die() here, else it will path through and gets written underneath blog content, which hardly isn't seen by many users serendipity_die($str); // case HTTP headers: needs to halt with die() here, else it will path through and gets written underneath blog content, or into streamed js files, which hardly isn't seen by many users
} else { } else {
// see global include of function in plugin_api.inc.php // see global include of function in plugin_api.inc.php
// this also reacts on non eye-displayed errors with following small javascript, // this also reacts on non eye-displayed errors with following small javascript,
@ -412,7 +412,7 @@ if (function_exists('date_default_timezone_get')) {
/** /**
* In PHP 5.4, the default encoding of htmlspecialchar changed to UTF-8 and it will emit empty strings when given * In PHP 5.4, the default encoding of htmlspecialchar changed to UTF-8 and it will emit empty strings when given
* native encoded strings containing umlauts. This wrapper should to be used in the core until PHP 5.6 fixes the bug. * native encoded strings containing umlauts. This wrapper should to be used in the core until PHP 5.6 fixes the bug.
*/ */
function serendipity_specialchars($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) { function serendipity_specialchars($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) {
if ($flags == null) { if ($flags == null) {
if (defined('ENT_HTML401')) { if (defined('ENT_HTML401')) {
@ -429,13 +429,13 @@ function serendipity_specialchars($string, $flags = null, $encoding = LANG_CHARS
// would kill s9y blogs sometimes (https://github.com/s9y/Serendipity/issues/236) // would kill s9y blogs sometimes (https://github.com/s9y/Serendipity/issues/236)
$encoding = 'UTF-8'; $encoding = 'UTF-8';
} }
return htmlspecialchars($string, $flags, $encoding, $double_encode); return htmlspecialchars($string, $flags, $encoding, $double_encode);
} }
/** /**
* see serendipity_specialchars * see serendipity_specialchars
*/ */
function serendipity_entities($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) { function serendipity_entities($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) {
if ($flags == null) { if ($flags == null) {
if (defined('ENT_HTML401')) { if (defined('ENT_HTML401')) {
@ -454,7 +454,7 @@ function serendipity_entities($string, $flags = null, $encoding = LANG_CHARSET,
/** /**
* serendipity_specialchars * serendipity_specialchars
*/ */
function serendipity_entity_decode($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) { function serendipity_entity_decode($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) {
if ($flags == null) { if ($flags == null) {
# NOTE: ENT_SUBSTITUTE does not exist for this function, and the documentation does not specify that it will # NOTE: ENT_SUBSTITUTE does not exist for this function, and the documentation does not specify that it will

View File

@ -420,7 +420,7 @@ function persian_date_utf($format, $timestamp='') {
$output_str.=$format[$i]; $output_str.=$format[$i];
break; break;
} }
}else{ } else {
$i++; $i++;
$output_str.=$format[$i]; $output_str.=$format[$i];
} }
@ -480,7 +480,7 @@ function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='',
} }
*/ */
if($mon <= 0){ if ($mon <= 0){
// change sign // change sign
$mon = abs($mon); $mon = abs($mon);
@ -511,6 +511,6 @@ function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='',
$day += $j_days_in_month[$temp_month]; $day += $j_days_in_month[$temp_month];
} }
list($year, $mon, $day)=p2g($year, $mon, $day); list($year, $mon, $day) = p2g($year, $mon, $day);
return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst); return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst);
} }

View File

@ -689,19 +689,19 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
$counter_comments = serendipity_db_query("SELECT count(id) AS counter $counter_comments = serendipity_db_query("SELECT count(id) AS counter
FROM {$serendipity['dbPrefix']}comments FROM {$serendipity['dbPrefix']}comments
WHERE status = 'approved' WHERE status = 'approved'
AND type = 'NORMAL' AND type = 'NORMAL'
AND entry_id = " . (int)$entry_id . " AND entry_id = " . (int)$entry_id . "
GROUP BY entry_id", true); GROUP BY entry_id", true);
$counter_tb = serendipity_db_query("SELECT count(id) AS counter $counter_tb = serendipity_db_query("SELECT count(id) AS counter
FROM {$serendipity['dbPrefix']}comments FROM {$serendipity['dbPrefix']}comments
WHERE status = 'approved' WHERE status = 'approved'
AND (type = 'TRACKBACK' or type = 'PINGBACK') AND (type = 'TRACKBACK' or type = 'PINGBACK')
AND entry_id = " . (int)$entry_id . " AND entry_id = " . (int)$entry_id . "
GROUP BY entry_id", true); GROUP BY entry_id", true);
$query = "UPDATE {$serendipity['dbPrefix']}entries $query = "UPDATE {$serendipity['dbPrefix']}entries
SET comments = " . (int)$counter_comments['counter'] . ", SET comments = " . (int)$counter_comments['counter'] . ",
trackbacks = " . (int)$counter_tb['counter'] . ", trackbacks = " . (int)$counter_tb['counter'] . ",
last_modified = ". $lm ." last_modified = ". $lm ."
WHERE id = ". (int)$entry_id; WHERE id = ". (int)$entry_id;
@ -726,7 +726,7 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
if ($moderate) return -1; // comment set to pending if ($moderate) return -1; // comment set to pending
if (!$moderate) return 1; // comment set to approved if (!$moderate) return 1; // comment set to approved
} }
return true; return true;
} }

View File

@ -620,14 +620,14 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
$_SESSION['serendipityPassword'] = $serendipity['serendipityPassword'] = $password; $_SESSION['serendipityPassword'] = $serendipity['serendipityPassword'] = $password;
} }
$_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $username; $_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $username;
$_SESSION['serendipityRealname'] = $serendipity['serendipityRealname'] = $row['realname']; $_SESSION['serendipityRealname'] = $serendipity['serendipityRealname'] = $row['realname'];
$_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $row['email']; $_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $row['email'];
$_SESSION['serendipityAuthorid'] = $serendipity['authorid'] = $row['authorid']; $_SESSION['serendipityAuthorid'] = $serendipity['authorid'] = $row['authorid'];
$_SESSION['serendipityUserlevel'] = $serendipity['serendipityUserlevel'] = $row['userlevel']; $_SESSION['serendipityUserlevel'] = $serendipity['serendipityUserlevel'] = $row['userlevel'];
$_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true; $_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true;
$_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish']; $_SESSION['serendipityRightPublish'] = $serendipity['serendipityRightPublish'] = $row['right_publish'];
$_SESSION['serendipityHashType'] = $serendipity['serendipityHashType'] = $row['hashtype']; $_SESSION['serendipityHashType'] = $serendipity['serendipityHashType'] = $row['hashtype'];
serendipity_load_configuration($serendipity['authorid']); serendipity_load_configuration($serendipity['authorid']);
serendipity_setCookie('userDefLang', $serendipity['lang'], false); serendipity_setCookie('userDefLang', $serendipity['lang'], false);
@ -920,7 +920,7 @@ function serendipity_probeInstallation($item) {
$res['sqlite3oo'] = 'SQLite3 (OO) (Preferrably use PDO-SQlite!)'; $res['sqlite3oo'] = 'SQLite3 (OO) (Preferrably use PDO-SQlite!)';
} else { } else {
$res['sqlite3oo'] = 'SQLite3 (OO)'; $res['sqlite3oo'] = 'SQLite3 (OO)';
} }
} }
if (function_exists('sqlrcon_alloc')) { if (function_exists('sqlrcon_alloc')) {
$res['sqlrelay'] = 'SQLRelay'; $res['sqlrelay'] = 'SQLRelay';
@ -1378,7 +1378,7 @@ function &serendipity_fetchGroup($groupid) {
function &serendipity_getGroups($authorid, $sequence = false) { function &serendipity_getGroups($authorid, $sequence = false) {
global $serendipity; global $serendipity;
$_groups =& serendipity_db_query("SELECT g.id AS confkey, $_groups =& serendipity_db_query("SELECT g.id AS confkey,
g.name AS confvalue, g.name AS confvalue,
g.id AS id, g.id AS id,
g.name AS name g.name AS name

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -872,4 +872,3 @@ function is_utf8($string) {
. '|\xF4[\x80-\x8F][\x80-\xBF]{2}' # plane 16 . '|\xF4[\x80-\x8F][\x80-\xBF]{2}' # plane 16
. ')*$%xs', $string); . ')*$%xs', $string);
} }

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -336,7 +336,7 @@ function serendipity_removeDeadFiles_SPL($dir=null, $deadfiles=null, $purgedir=n
function serendipity_upgrader_rename_plugins() { function serendipity_upgrader_rename_plugins() {
global $serendipity; global $serendipity;
$plugs = serendipity_db_query("SELECT name FROM {$serendipity['dbPrefix']}plugins WHERE name LIKE '@%' OR name LIKE 'serendipity_html_nugget_plugin%'"); $plugs = serendipity_db_query("SELECT name FROM {$serendipity['dbPrefix']}plugins WHERE name LIKE '@%' OR name LIKE 'serendipity_html_nugget_plugin%'");
if (is_array($plugs)) { if (is_array($plugs)) {
@ -351,7 +351,7 @@ function serendipity_upgrader_rename_plugins() {
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}plugins SET name = '" . serendipity_db_escape_string($plugin['name']) . "', path = '" . serendipity_db_escape_string($pluginparts[0]) . "' WHERE name = '" . serendipity_db_escape_string($origname) . "'"); serendipity_db_query("UPDATE {$serendipity['dbPrefix']}plugins SET name = '" . serendipity_db_escape_string($plugin['name']) . "', path = '" . serendipity_db_escape_string($pluginparts[0]) . "' WHERE name = '" . serendipity_db_escape_string($origname) . "'");
} }
} }
$configs = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}config WHERE name LIKE '@%' OR name LIKE 'serendipity_html_nugget_plugin%'"); $configs = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}config WHERE name LIKE '@%' OR name LIKE 'serendipity_html_nugget_plugin%'");
if (is_array($configs)) { if (is_array($configs)) {
@ -397,4 +397,4 @@ function serendipity_upgrader_move_syndication_config() {
serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}config('name', 'value') VALUES ('feedCustom', '" . serendipity_db_escape_string($fburl) ."')"); serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}config('name', 'value') VALUES ('feedCustom', '" . serendipity_db_escape_string($fburl) ."')");
} }
} }
} }

View File

@ -1,4 +1,4 @@
<?php # <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -8,16 +8,15 @@ if (IN_serendipity !== true) {
include_once('serendipity_config.inc.php'); include_once('serendipity_config.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php'); include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
$uri_addData = array( $uri_addData = array(
'startpage' => false, 'startpage' => false,
'uriargs' => implode('/', serendipity_getUriArguments($uri, true)), 'uriargs' => implode('/', serendipity_getUriArguments($uri, true)),
'view' => $serendipity['view'], 'view' => $serendipity['view'],
'viewtype' => $serendipity['viewtype'] 'viewtype' => $serendipity['viewtype']
); );
if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendipity['indexFile']) && empty($serendipity['GET']['subpage'])) { if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendipity['indexFile']) && empty($serendipity['GET']['subpage'])) {
$uri_addData['startpage'] = true; $uri_addData['startpage'] = true;
} }

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,5 @@
<?php # $Id: plugin_api.inc.php 1168 2006-04-29 13:06:11Z garvinhicking $ <?php
# $Id: plugin_api.inc.php 1168 2006-04-29 13:06:11Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -8,9 +8,9 @@
@define('S9Y_TEMPLATE_SECUREDIR', $serendipity['serendipityPath'] . $serendipity['templatePath']); @define('S9Y_TEMPLATE_SECUREDIR', $serendipity['serendipityPath'] . $serendipity['templatePath']);
// Create a wrapper class extended from Smarty_Security - which allows access to S9Y-plugin and S9Y-template dirs // Create a wrapper class extended from Smarty_Security - which allows access to S9Y-plugin and S9Y-template dirs
class Serendipity_Smarty_Security_Policy extends Smarty_Security class Serendipity_Smarty_Security_Policy extends Smarty_Security
{ {
// these are the allowed functions only. - default as is // these are the allowed functions only. - default as is
public $php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time', 'nl2br', 'class_exists'); public $php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time', 'nl2br', 'class_exists');
// to disable all PHP functions // to disable all PHP functions
@ -24,7 +24,7 @@ class Serendipity_Smarty_Security_Policy extends Smarty_Security
public $allow_constants = true; public $allow_constants = true;
public $allow_super_globals = true; public $allow_super_globals = true;
// array of template directories that are considered secure. No need, as ...TemplateDir concidered secure implicitly. (unproofed) // array of template directories that are considered secure. No need, as ...TemplateDir concidered secure implicitly. (unproofed)
public $secure_dir = array(S9Y_TEMPLATE_SECUREDIR); // do we need this then? public $secure_dir = array(S9Y_TEMPLATE_SECUREDIR); // do we need this then?
@ -47,14 +47,14 @@ class Serendipity_Smarty_Security_Policy extends Smarty_Security
return true; return true;
} }
public static function test() public static function test()
{ {
var_dump(get_called_class()); var_dump(get_called_class());
} }
} }
// Create a wrapper class extended from Smarty // Create a wrapper class extended from Smarty
class Serendipity_Smarty extends Smarty class Serendipity_Smarty extends Smarty
{ {
// bc mode for plugins Smarty2 compat INCLUDE_ANY fetch() calls - to avoid an undefinied property error. // bc mode for plugins Smarty2 compat INCLUDE_ANY fetch() calls - to avoid an undefinied property error.
public $security_settings = false; public $security_settings = false;
@ -89,9 +89,9 @@ class Serendipity_Smarty extends Smarty
$instance = new Serendipity_Smarty(); $instance = new Serendipity_Smarty();
} }
return $instance; return $instance;
} }
public function __construct() public function __construct()
{ {
// Class Constructor. These automatically get set with each new instance. // Class Constructor. These automatically get set with each new instance.
parent::__construct(); parent::__construct();
@ -101,9 +101,9 @@ class Serendipity_Smarty extends Smarty
} }
// smarty (3.1.x) object main parameter setup // smarty (3.1.x) object main parameter setup
private function setParams() private function setParams()
{ {
global $serendipity; global $serendipity;
// some documentary from the smarty forum // some documentary from the smarty forum
/* /*

View File

@ -1,4 +1,5 @@
<?php # $Id: plugin_api.inc.php 1228 2006-06-01 11:18:53Z garvinhicking $ <?php
# $Id: plugin_api.inc.php 1228 2006-06-01 11:18:53Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -240,7 +241,7 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator {
echo "<serendipity>\n"; echo "<serendipity>\n";
ob_end_flush(); // This ends the started ob from index.php! ob_end_flush(); // This ends the started ob from index.php!
} }
function serendipity_smarty_emulator_xml() { function serendipity_smarty_emulator_xml() {
$this->__construct(); $this->__construct();
} }
@ -265,7 +266,7 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator {
return true; return true;
} }
/** /**
* Assign one or multiple template variable by reference - Smarty API Change > 3.0 * Assign one or multiple template variable by reference - Smarty API Change > 3.0
* *
@ -330,4 +331,3 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator {
} }
} }
} }

View File

@ -725,4 +725,4 @@
)); ));
return $res; return $res;
?> ?>

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -159,7 +159,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
if (isset($day) && !is_numeric($day)) { if (isset($day) && !is_numeric($day)) {
$day = date('d'); $day = date('d');
} }
switch($serendipity['calendar']) { switch($serendipity['calendar']) {
case 'gregorian': case 'gregorian':
@ -366,10 +366,10 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
exit; exit;
} else if (preg_match(PAT_PLUGIN, $uri, $matches)) { } else if (preg_match(PAT_PLUGIN, $uri, $matches)) {
$serendipity['view'] = 'plugin'; $serendipity['view'] = 'plugin';
if (strpos($matches[2], 'admin/') !== false) { if (strpos($matches[2], 'admin/') !== false) {
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} }
#echo $serendipity["handler"]["test.js"]; #echo $serendipity["handler"]["test.js"];
serendipity_plugin_api::hook_event('external_plugin', $matches[2]); serendipity_plugin_api::hook_event('external_plugin', $matches[2]);
@ -507,7 +507,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
} }
$uInfo = serendipity_fetchUsers($serendipity['GET']['viewAuthor']); $uInfo = serendipity_fetchUsers($serendipity['GET']['viewAuthor']);
if (!is_array($uInfo)) { if (!is_array($uInfo)) {
$serendipity['view'] = '404'; $serendipity['view'] = '404';
$serendipity['viewtype'] = '404_3'; $serendipity['viewtype'] = '404_3';
@ -566,9 +566,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
header('Content-type: application/javascript; charset=' . LANG_CHARSET); header('Content-type: application/javascript; charset=' . LANG_CHARSET);
$out = ""; $out = "";
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
// HOTFIX: The staticpage plugin spews out a 404 error in the genpage hook, // HOTFIX: The staticpage plugin spews out a 404 error in the genpage hook,
// because it assumes that all "normal" content pages could belong to it. // because it assumes that all "normal" content pages could belong to it.
// We need to override the header at this point (again), so that the files // We need to override the header at this point (again), so that the files
@ -577,7 +577,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
// or to make sure the "genpage" event hook is not called at this point. // or to make sure the "genpage" event hook is not called at this point.
header('HTTP/1.0 200 OK'); header('HTTP/1.0 200 OK');
header('Status: 200 OK'); header('Status: 200 OK');
if ($matches[1] == "serendipity_admin.js") { if ($matches[1] == "serendipity_admin.js") {
serendipity_plugin_api::hook_event('js_backend', $out); serendipity_plugin_api::hook_event('js_backend', $out);
} else { } else {

83
rss.php
View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -9,10 +9,10 @@ session_cache_limiter('public');
include('serendipity_config.inc.php'); include('serendipity_config.inc.php');
include(S9Y_INCLUDE_PATH . 'include/functions_rss.inc.php'); include(S9Y_INCLUDE_PATH . 'include/functions_rss.inc.php');
$version = $_GET['version']; $version = $_GET['version'];
$description = $serendipity['blogDescription']; $description = $serendipity['blogDescription'];
$title = $serendipity['blogTitle']; $title = $serendipity['blogTitle'];
$comments = FALSE; $comments = FALSE;
if (empty($version)) { if (empty($version)) {
list($version) = serendipity_discover_rss($_GET['file'], $_GET['ext']); list($version) = serendipity_discover_rss($_GET['file'], $_GET['ext']);
@ -87,27 +87,28 @@ if (isset($modified_since) &&
} }
switch ($_GET['type']) { switch ($_GET['type']) {
case 'comments_and_trackbacks': case 'comments_and_trackbacks':
case 'trackbacks': case 'trackbacks':
case 'comments': case 'comments':
$entries = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, $serendipity['RSSfetchLimit'], 'co.id desc', false, $_GET['type']); $entries = serendipity_fetchComments(isset($_GET['cid']) ? $_GET['cid'] : null, $serendipity['RSSfetchLimit'], 'co.id desc', false, $_GET['type']);
$description = $title . ' - ' . $description; $description = $title . ' - ' . $description;
if (isset($_GET['cid'])) { if (isset($_GET['cid'])) {
$title = $title . ' - ' . COMMENTS_FROM . ' "' . $latest_entry[0]['title'] . '"'; $title = $title . ' - ' . COMMENTS_FROM . ' "' . $latest_entry[0]['title'] . '"';
} else { } else {
$title = $title . ' - ' . COMMENTS; $title = $title . ' - ' . COMMENTS;
} }
$comments = TRUE; $comments = TRUE;
break; break;
case 'content':
default: case 'content':
if (isset($_GET['all']) && $_GET['all']) { default:
// Fetch all entries in reverse order for later importing. Fetch sticky entries as normal entries. if (isset($_GET['all']) && $_GET['all']) {
$entries = serendipity_fetchEntries(null, true, '', false, false, 'id ASC', '', false, true); // Fetch all entries in reverse order for later importing. Fetch sticky entries as normal entries.
} else { $entries = serendipity_fetchEntries(null, true, '', false, false, 'id ASC', '', false, true);
$entries = serendipity_fetchEntries(null, true, $serendipity['RSSfetchLimit'], false, (isset($modified_since) ? $modified_since : false), 'timestamp DESC', '', false, true); } else {
} $entries = serendipity_fetchEntries(null, true, $serendipity['RSSfetchLimit'], false, (isset($modified_since) ? $modified_since : false), 'timestamp DESC', '', false, true);
break; }
break;
} }
if (isset($serendipity['serendipityRealname'])) { if (isset($serendipity['serendipityRealname'])) {
@ -139,21 +140,21 @@ $metadata = array(
); );
if (serendipity_get_config_var('feedBannerURL') != '') { if (serendipity_get_config_var('feedBannerURL') != '') {
$img = serendipity_get_config_var('feedBannerURL'); $img = serendipity_get_config_var('feedBannerURL');
$w = serendipity_get_config_var('feedBannerWidth'); $w = serendipity_get_config_var('feedBannerWidth');
$h = serendipity_get_config_var('feedBannerHeight'); $h = serendipity_get_config_var('feedBannerHeight');
} elseif (($banner = serendipity_getTemplateFile('img/rss_banner.png', 'serendipityPath'))) { } elseif (($banner = serendipity_getTemplateFile('img/rss_banner.png', 'serendipityPath'))) {
$img = serendipity_getTemplateFile('img/rss_banner.png', 'baseURL'); $img = serendipity_getTemplateFile('img/rss_banner.png', 'baseURL');
$i = getimagesize($banner); $i = getimagesize($banner);
$w = $i[0]; $w = $i[0];
$h = $i[1]; $h = $i[1];
} else { } else {
$img = serendipity_getTemplateFile('img/s9y_banner_small.png', 'baseURL'); $img = serendipity_getTemplateFile('img/s9y_banner_small.png', 'baseURL');
$w = 100; $w = 100;
$h = 21; $h = 21;
} }
$metadata['additional_fields']['image'] = <<<IMAGE $metadata['additional_fields']['image'] = <<<IMAGE
<image> <image>
<url>$img</url> <url>$img</url>
<title>RSS: $title - $description</title> <title>RSS: $title - $description</title>
@ -163,12 +164,12 @@ if (serendipity_get_config_var('feedBannerURL') != '') {
</image> </image>
IMAGE; IMAGE;
$metadata['additional_fields']['image_atom1.0'] = <<<IMAGE $metadata['additional_fields']['image_atom1.0'] = <<<IMAGE
<icon>$img</icon> <icon>$img</icon>
IMAGE; IMAGE;
$metadata['additional_fields']['image_rss1.0_channel'] = '<image rdf:resource="' . $img . '" />'; $metadata['additional_fields']['image_rss1.0_channel'] = '<image rdf:resource="' . $img . '" />';
$metadata['additional_fields']['image_rss1.0_rdf'] = <<<IMAGE $metadata['additional_fields']['image_rss1.0_rdf'] = <<<IMAGE
<image rdf:about="$img"> <image rdf:about="$img">
<url>$img</url> <url>$img</url>
<title>RSS: $title - $description</title> <title>RSS: $title - $description</title>
@ -212,7 +213,7 @@ if (is_array($metadata['additional_fields'])) {
$metadata['additional_fields'][$aid] = $af; $metadata['additional_fields'][$aid] = $af;
} }
} }
$metadata['fullFeed'] = serendipity_get_config_var('feedFull', false); $metadata['fullFeed'] = serendipity_get_config_var('feedFull', false);
if ($metadata['fullFeed'] === 'client') { if ($metadata['fullFeed'] === 'client') {
if ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) { if ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) {
$metadata['fullFeed'] = true; $metadata['fullFeed'] = true;
@ -221,7 +222,7 @@ if ($metadata['fullFeed'] === 'client') {
} }
} }
if ($_GET['type'] == 'content' && if ($_GET['type'] == 'content' &&
!isset($_GET['category']) && !isset($_GET['category']) &&
!isset($serendipity['GET']['tag']) && !isset($serendipity['GET']['tag']) &&
serendipity_db_bool(serendipity_get_config_var('feedForceCustom', false)) && serendipity_db_bool(serendipity_get_config_var('feedForceCustom', false)) &&
@ -232,7 +233,7 @@ if ($_GET['type'] == 'content' &&
header('Location: ' . serendipity_get_config_var('feedCustom')); header('Location: ' . serendipity_get_config_var('feedCustom'));
exit; exit;
} }
$metadata['showMail'] = serendipity_db_bool(serendipity_get_config_var('show_mail', $metadata['showMail'])); $metadata['showMail'] = serendipity_db_bool(serendipity_get_config_var('show_mail', $metadata['showMail']));
$file_version = preg_replace('@[^0-9a-z\.-_]@i', '', $version); $file_version = preg_replace('@[^0-9a-z\.-_]@i', '', $version);
$metadata['template_file'] = serendipity_getTemplateFile('feed_' . $file_version . '.tpl', 'serendipityPath'); $metadata['template_file'] = serendipity_getTemplateFile('feed_' . $file_version . '.tpl', 'serendipityPath');

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -51,7 +51,6 @@ function serendipity_printStylesheet($file, $dir = '') {
@file_get_contents($file, 1)); @file_get_contents($file, 1));
} }
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
} else { } else {

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -252,7 +252,7 @@ if (!$use_installer) {
$admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, '', ''); $admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, '', '');
} }
if (!$serendipity['smarty']) serendipity_smarty_init(); if (!is_object($serendipity['smarty'])) serendipity_smarty_init();
$serendipity['smarty']->assignByRef('admin_vars', $admin_vars); $serendipity['smarty']->assignByRef('admin_vars', $admin_vars);
$serendipity['smarty']->display(serendipity_getTemplateFile('admin/index.tpl', 'serendipityPath')); $serendipity['smarty']->display(serendipity_getTemplateFile('admin/index.tpl', 'serendipityPath'));
} else { } else {

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -129,13 +129,13 @@ switch ($serendipity['GET']['step']) {
} }
break; break;
case 'directoryDoCreate': case 'directoryDoCreate':
case 'directoryDoDelete': case 'directoryDoDelete':
$is_created = true; $is_created = true;
if ($serendipity['GET']['step'] == 'directoryDoDelete') { if ($serendipity['GET']['step'] == 'directoryDoDelete') {
$is_deleted = true; $is_deleted = true;
} }
case 'directoryCreate': case 'directoryCreate':
$serendipity['GET']['adminAction'] = $serendipity['GET']['step']; $serendipity['GET']['adminAction'] = $serendipity['GET']['step'];
$media['case'] = 'external'; $media['case'] = 'external';
ob_start(); ob_start();
@ -303,4 +303,4 @@ $media = array_merge($serendipity['GET'], $media);
$serendipity['smarty']->assignByRef('media', $media); $serendipity['smarty']->assignByRef('media', $media);
$serendipity['smarty']->display(serendipity_getTemplateFile($showFile, 'serendipityPath')); $serendipity['smarty']->display(serendipity_getTemplateFile($showFile, 'serendipityPath'));
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -13,7 +13,7 @@ if (!headers_sent() && php_sapi_name() !== 'cli') {
session_name('s9y_' . md5(dirname(__FILE__))); session_name('s9y_' . md5(dirname(__FILE__)));
session_start(); session_start();
} }
// Prevent session fixation by only allowing sessions that have been sent by the server. // Prevent session fixation by only allowing sessions that have been sent by the server.
// Any session that does not contain our unique token will be regarded as foreign/fixated // Any session that does not contain our unique token will be regarded as foreign/fixated
// and be regenerated with a system-generated SID. // and be regenerated with a system-generated SID.
@ -44,12 +44,12 @@ if (defined('USE_MEMSNAP')) {
} }
// The version string // The version string
$serendipity['version'] = '2.0-rc1'; $serendipity['version'] = '2.0-rc1';
// Setting this to 'false' will enable debugging output. All alpha/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'. // Setting this to 'false' will enable debugging output. All alpha/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'])) { if (!isset($serendipity['production'])) {
$serendipity['production'] = ! preg_match('@\-(alpha|beta|cvs|rc).*@', $serendipity['version']); $serendipity['production'] = ! preg_match('@\-(alpha|beta|cvs|rc).*@', $serendipity['version']);
} }
// Set error reporting // Set error reporting
@ -66,10 +66,10 @@ $serendipity['errorhandler'] = 'errorToExceptionHandler';
// Default rewrite method // Default rewrite method
$serendipity['rewrite'] = 'none'; $serendipity['rewrite'] = 'none';
// Message container // Message container
$serendipity['messagestack'] = array(); $serendipity['messagestack'] = array();
// Can the user change the date of publishing for an entry? // Can the user change the date of publishing for an entry?
$serendipity['allowDateManipulation'] = true; $serendipity['allowDateManipulation'] = true;
@ -77,14 +77,14 @@ $serendipity['allowDateManipulation'] = true;
// How much time is allowed to pass since the publising of an entry, so that a comment to that entry // How much time is allowed to pass since the publising of an entry, so that a comment to that entry
// will update it's LastModified stamp? If the time is passed, a comment to an old entry will no longer // will update it's LastModified stamp? If the time is passed, a comment to an old entry will no longer
// push an article as being updated. // push an article as being updated.
$serendipity['max_last_modified'] = 60 * 60 * 24 * 7; $serendipity['max_last_modified'] = 60 * 60 * 24 * 7;
// Clients can send a If-Modified Header to the RSS Feed (Conditional Get) and receive all articles beyond // Clients can send a If-Modified Header to the RSS Feed (Conditional Get) and receive all articles beyond
// that date. However it is still limited by the number below of maximum entries // that date. However it is still limited by the number below of maximum entries
$serendipity['max_fetch_limit'] = 50; $serendipity['max_fetch_limit'] = 50;
// How many bytes are allowed for fetching trackbacks, so that no binary files get accidently trackbacked? // How many bytes are allowed for fetching trackbacks, so that no binary files get accidently trackbacked?
$serendipity['trackback_filelimit'] = 150 * 1024; $serendipity['trackback_filelimit'] = 150 * 1024;
if (!isset($serendipity['fetchLimit'])) { if (!isset($serendipity['fetchLimit'])) {
$serendipity['fetchLimit'] = 15; $serendipity['fetchLimit'] = 15;
@ -128,7 +128,7 @@ if (!isset($serendipity['template_backend'])) {
$serendipity['template_backend'] = '2k11'; $serendipity['template_backend'] = '2k11';
} }
/* Availiable languages */ /* Available languages */
if (!isset($serendipity['languages'])) { if (!isset($serendipity['languages'])) {
$serendipity['languages'] = array('en' => 'English', $serendipity['languages'] = array('en' => 'English',
'de' => 'German', 'de' => 'German',
@ -138,7 +138,7 @@ if (!isset($serendipity['languages'])) {
'fi' => 'Finnish', 'fi' => 'Finnish',
'cs' => 'Czech (Win-1250)', 'cs' => 'Czech (Win-1250)',
'cz' => 'Czech (ISO-8859-2)', 'cz' => 'Czech (ISO-8859-2)',
'sk' => 'Slovak', 'sk' => 'Slovak',
'nl' => 'Dutch', 'nl' => 'Dutch',
'is' => 'Icelandic', 'is' => 'Icelandic',
'tr' => 'Turkish', 'tr' => 'Turkish',
@ -270,7 +270,7 @@ if(is_callable($serendipity['errorhandler'], false, $callable_name)) {
if ($serendipity['production'] === 'debug') { 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. 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 { } else {
// Caution! If we want to have the same noshow effect as upper set error_reporting(E_ALL) in 'debug' mode, // 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. // 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)); set_error_handler($serendipity['errorhandler'], E_ALL & ~(E_NOTICE|E_STRICT));
} }
@ -316,7 +316,7 @@ if (isset($serendipity['logLevel']) && $serendipity['logLevel'] !== 'Off') {
} else { } else {
$log_level = Psr\Log\LogLevel::ERROR; $log_level = Psr\Log\LogLevel::ERROR;
} }
$serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level); $serendipity['logger'] = new Katzgrau\KLogger\Logger($serendipity['serendipityPath'] . '/templates_c/logs', $log_level);
} }
@ -411,8 +411,7 @@ $serendipity['permissionLevels'] = array(USERLEVEL_EDITOR => USERLEVEL_EDITOR_DE
USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC, USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC,
USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC); USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC);
// Redirect to the upgrader
// Redirect to the upgrader
if (IS_up2date === false && !defined('IN_upgrader')) { if (IS_up2date === false && !defined('IN_upgrader')) {
if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) { if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) {
$css_mode = 'serendipity_admin.css'; $css_mode = 'serendipity_admin.css';
@ -458,7 +457,7 @@ if (!isset($serendipity['imagemagick_thumb_parameters'])) {
$serendipity['imagemagick_thumb_parameters'] = ''; $serendipity['imagemagick_thumb_parameters'] = '';
// Set a variable like below in your serendpity_config_local.inc.php // Set a variable like below in your serendpity_config_local.inc.php
//$serendipity['imagemagick_thumb_parameters'] = '-modulate 105,140 -unsharp 0.5x0.5+1.0 -quality 75'; //$serendipity['imagemagick_thumb_parameters'] = '-modulate 105,140 -unsharp 0.5x0.5+1.0 -quality 75';
} }
serendipity_plugin_api::hook_event('frontend_configure', $serendipity); serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -37,4 +37,4 @@ if ($_REQUEST['cid'] != '' && $HTTP_RAW_POST_DATA != '') {
} }
} }
?> ?>