From aca77bd482d09eb3ca5be65a9506a046d45f531e Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 10 Dec 2014 14:34:54 +0100 Subject: [PATCH] cleanup cosmetics --- exit.php | 4 +- include/compat.inc.php | 14 ++-- include/functions_calendars.inc.php | 6 +- include/functions_comments.inc.php | 12 ++-- include/functions_config.inc.php | 20 +++--- include/functions_installer.inc.php | 2 +- include/functions_trackbacks.inc.php | 1 - include/functions_upgrader.inc.php | 8 +-- include/genpage.inc.php | 5 +- include/lang.inc.php | 2 +- include/plugin_api_extension.inc.php | 3 +- include/serendipity_smarty_class.inc.php | 22 +++---- include/template_api.inc.php | 8 +-- include/tpl/config_local.inc.php | 2 +- index.php | 16 ++--- rss.php | 83 ++++++++++++------------ serendipity.css.php | 3 +- serendipity_admin.php | 4 +- serendipity_admin_image_selector.php | 14 ++-- serendipity_config.inc.php | 31 +++++---- serendipity_xmlrpc.php | 2 +- wfwcomment.php | 4 +- 22 files changed, 132 insertions(+), 134 deletions(-) diff --git a/exit.php b/exit.php index fa6a013c..d8a09be5 100644 --- a/exit.php +++ b/exit.php @@ -1,4 +1,4 @@ - +?> \ No newline at end of file diff --git a/include/compat.inc.php b/include/compat.inc.php index da8d2e7d..e131407a 100644 --- a/include/compat.inc.php +++ b/include/compat.inc.php @@ -1,4 +1,4 @@ -' . $errStr . ' in ' . $errFile . ' on line ' . $errLine . '

'; #var_dump(headers_list()); 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 { // see global include of function in plugin_api.inc.php // 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 * 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) { if ($flags == null) { 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) $encoding = 'UTF-8'; } - + return htmlspecialchars($string, $flags, $encoding, $double_encode); } /** * see serendipity_specialchars - */ + */ function serendipity_entities($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) { if ($flags == null) { if (defined('ENT_HTML401')) { @@ -454,7 +454,7 @@ function serendipity_entities($string, $flags = null, $encoding = LANG_CHARSET, /** * serendipity_specialchars - */ + */ function serendipity_entity_decode($string, $flags = null, $encoding = LANG_CHARSET, $double_encode = true) { if ($flags == null) { # NOTE: ENT_SUBSTITUTE does not exist for this function, and the documentation does not specify that it will diff --git a/include/functions_calendars.inc.php b/include/functions_calendars.inc.php index cdd1ab7a..72a15101 100644 --- a/include/functions_calendars.inc.php +++ b/include/functions_calendars.inc.php @@ -420,7 +420,7 @@ function persian_date_utf($format, $timestamp='') { $output_str.=$format[$i]; break; } - }else{ + } else { $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 $mon = abs($mon); @@ -511,6 +511,6 @@ function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='', $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); } diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index a23e7445..b5d8ad5f 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -689,19 +689,19 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate = $counter_comments = serendipity_db_query("SELECT count(id) AS counter FROM {$serendipity['dbPrefix']}comments WHERE status = 'approved' - AND type = 'NORMAL' - AND entry_id = " . (int)$entry_id . " + AND type = 'NORMAL' + AND entry_id = " . (int)$entry_id . " GROUP BY entry_id", true); $counter_tb = serendipity_db_query("SELECT count(id) AS counter FROM {$serendipity['dbPrefix']}comments WHERE status = 'approved' - AND (type = 'TRACKBACK' or type = 'PINGBACK') - AND entry_id = " . (int)$entry_id . " + AND (type = 'TRACKBACK' or type = 'PINGBACK') + AND entry_id = " . (int)$entry_id . " GROUP BY entry_id", true); $query = "UPDATE {$serendipity['dbPrefix']}entries - SET comments = " . (int)$counter_comments['counter'] . ", + SET comments = " . (int)$counter_comments['counter'] . ", trackbacks = " . (int)$counter_tb['counter'] . ", last_modified = ". $lm ." 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 approved } - + return true; } diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index 45fd4f38..ca0dfb62 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -620,14 +620,14 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has $_SESSION['serendipityPassword'] = $serendipity['serendipityPassword'] = $password; } - $_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $username; - $_SESSION['serendipityRealname'] = $serendipity['serendipityRealname'] = $row['realname']; - $_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $row['email']; - $_SESSION['serendipityAuthorid'] = $serendipity['authorid'] = $row['authorid']; - $_SESSION['serendipityUserlevel'] = $serendipity['serendipityUserlevel'] = $row['userlevel']; - $_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true; - $_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish']; - $_SESSION['serendipityHashType'] = $serendipity['serendipityHashType'] = $row['hashtype']; + $_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $username; + $_SESSION['serendipityRealname'] = $serendipity['serendipityRealname'] = $row['realname']; + $_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $row['email']; + $_SESSION['serendipityAuthorid'] = $serendipity['authorid'] = $row['authorid']; + $_SESSION['serendipityUserlevel'] = $serendipity['serendipityUserlevel'] = $row['userlevel']; + $_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true; + $_SESSION['serendipityRightPublish'] = $serendipity['serendipityRightPublish'] = $row['right_publish']; + $_SESSION['serendipityHashType'] = $serendipity['serendipityHashType'] = $row['hashtype']; serendipity_load_configuration($serendipity['authorid']); serendipity_setCookie('userDefLang', $serendipity['lang'], false); @@ -920,7 +920,7 @@ function serendipity_probeInstallation($item) { $res['sqlite3oo'] = 'SQLite3 (OO) (Preferrably use PDO-SQlite!)'; } else { $res['sqlite3oo'] = 'SQLite3 (OO)'; - } + } } if (function_exists('sqlrcon_alloc')) { $res['sqlrelay'] = 'SQLRelay'; @@ -1378,7 +1378,7 @@ function &serendipity_fetchGroup($groupid) { function &serendipity_getGroups($authorid, $sequence = false) { 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.id AS id, g.name AS name diff --git a/include/functions_installer.inc.php b/include/functions_installer.inc.php index 30a093e3..aaf564ce 100644 --- a/include/functions_installer.inc.php +++ b/include/functions_installer.inc.php @@ -1,4 +1,4 @@ - false, 'uriargs' => implode('/', serendipity_getUriArguments($uri, true)), 'view' => $serendipity['view'], 'viewtype' => $serendipity['viewtype'] ); + if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendipity['indexFile']) && empty($serendipity['GET']['subpage'])) { $uri_addData['startpage'] = true; } diff --git a/include/lang.inc.php b/include/lang.inc.php index 0b9a08f3..9ead98dc 100644 --- a/include/lang.inc.php +++ b/include/lang.inc.php @@ -1,4 +1,4 @@ -\n"; ob_end_flush(); // This ends the started ob from index.php! } - + function serendipity_smarty_emulator_xml() { $this->__construct(); } @@ -265,7 +266,7 @@ class serendipity_smarty_emulator_xml extends serendipity_smarty_emulator { return true; } - + /** * 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 { } } } - diff --git a/include/tpl/config_local.inc.php b/include/tpl/config_local.inc.php index 7a95ffeb..b9f2a00b 100644 --- a/include/tpl/config_local.inc.php +++ b/include/tpl/config_local.inc.php @@ -725,4 +725,4 @@ )); return $res; -?> +?> \ No newline at end of file diff --git a/index.php b/index.php index a416e578..8ac4e7e6 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ - $img RSS: $title - $description @@ -163,12 +164,12 @@ if (serendipity_get_config_var('feedBannerURL') != '') { IMAGE; - $metadata['additional_fields']['image_atom1.0'] = <<$img IMAGE; - $metadata['additional_fields']['image_rss1.0_channel'] = ''; - $metadata['additional_fields']['image_rss1.0_rdf'] = <<'; +$metadata['additional_fields']['image_rss1.0_rdf'] = << $img RSS: $title - $description @@ -212,7 +213,7 @@ if (is_array($metadata['additional_fields'])) { $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 ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) { $metadata['fullFeed'] = true; @@ -221,7 +222,7 @@ if ($metadata['fullFeed'] === 'client') { } } -if ($_GET['type'] == 'content' && +if ($_GET['type'] == 'content' && !isset($_GET['category']) && !isset($serendipity['GET']['tag']) && serendipity_db_bool(serendipity_get_config_var('feedForceCustom', false)) && @@ -232,7 +233,7 @@ if ($_GET['type'] == 'content' && header('Location: ' . serendipity_get_config_var('feedCustom')); 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); $metadata['template_file'] = serendipity_getTemplateFile('feed_' . $file_version . '.tpl', 'serendipityPath'); diff --git a/serendipity.css.php b/serendipity.css.php index a2e431d2..d223e76d 100644 --- a/serendipity.css.php +++ b/serendipity.css.php @@ -1,4 +1,4 @@ -assignByRef('admin_vars', $admin_vars); $serendipity['smarty']->display(serendipity_getTemplateFile('admin/index.tpl', 'serendipityPath')); } else { diff --git a/serendipity_admin_image_selector.php b/serendipity_admin_image_selector.php index b3b982b6..10cd267a 100644 --- a/serendipity_admin_image_selector.php +++ b/serendipity_admin_image_selector.php @@ -1,4 +1,4 @@ -assignByRef('media', $media); $serendipity['smarty']->display(serendipity_getTemplateFile($showFile, 'serendipityPath')); -/* vim: set sts=4 ts=4 expandtab : */ \ No newline at end of file +/* vim: set sts=4 ts=4 expandtab : */ diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index 0d7001db..7c7a4ffd 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -1,4 +1,4 @@ - 'English', 'de' => 'German', @@ -138,7 +138,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', @@ -270,7 +270,7 @@ if(is_callable($serendipity['errorhandler'], false, $callable_name)) { 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, + // 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)); } @@ -316,7 +316,7 @@ if (isset($serendipity['logLevel']) && $serendipity['logLevel'] !== 'Off') { } else { $log_level = Psr\Log\LogLevel::ERROR; } - + $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_ADMIN => USERLEVEL_ADMIN_DESC); - -// Redirect to the upgrader +// Redirect to the upgrader if (IS_up2date === false && !defined('IN_upgrader')) { if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) { $css_mode = 'serendipity_admin.css'; @@ -458,7 +457,7 @@ if (!isset($serendipity['imagemagick_thumb_parameters'])) { $serendipity['imagemagick_thumb_parameters'] = ''; // 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_plugin_api::hook_event('frontend_configure', $serendipity); /* vim: set sts=4 ts=4 expandtab : */ diff --git a/serendipity_xmlrpc.php b/serendipity_xmlrpc.php index 3baeada4..75975a3a 100644 --- a/serendipity_xmlrpc.php +++ b/serendipity_xmlrpc.php @@ -1,4 +1,4 @@ - +?> \ No newline at end of file