From d93674485dfc23779d608865a1b5192c50fd06c7 Mon Sep 17 00:00:00 2001 From: Ian Date: Sat, 19 Mar 2016 17:18:11 +0100 Subject: [PATCH] cleaups --- include/admin/templates.inc.php | 18 ++++++++++++------ include/functions_comments.inc.php | 8 ++++---- include/functions_config.inc.php | 4 ++-- include/functions_entries.inc.php | 4 ++-- include/functions_plugins_admin.inc.php | 2 +- .../serendipity_plugin_recententries.php | 6 ++++-- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/include/admin/templates.inc.php b/include/admin/templates.inc.php index 03483d56..c14af305 100644 --- a/include/admin/templates.inc.php +++ b/include/admin/templates.inc.php @@ -10,22 +10,26 @@ if (!serendipity_checkPermission('adminTemplates')) { return; } -class template_option { +class template_option +{ var $config = null; var $values = null; var $keys = null; - function introspect_config_item($item, &$bag) { + function introspect_config_item($item, &$bag) + { foreach($this->config[$item] AS $key => $val) { $bag->add($key, $val); } } - function get_config($item) { + function get_config($item) + { return $this->values[$item]; } - function set_config($item, $value) { + function set_config($item, $value) + { global $serendipity; serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options @@ -48,12 +52,14 @@ class template_option { return true; } - function import(&$config) { + function import(&$config) + { foreach($config AS $key => $item) { $this->config[$item['var']] = $item; $this->keys[$item['var']] = $item['var']; } } + } $data = array(); @@ -187,7 +193,7 @@ foreach ($stack as $theme => $info) { if (file_exists($serendipity["serendipityPath"] . $serendipity["templatePath"] . $theme . "/preview${backendId}_fullsize.jpg")) { $data["templates"][$theme]["fullsize${backendId}_preview"] = $serendipity["baseURL"] . $serendipity["templatePath"] . $theme . "/preview${backendId}_fullsize.jpg"; - } elseif (!empty($info["preview{$backendId}_fullsizeURL"])) { // preview{$backendId}_fullsizeURL is not actually set yet in spartacus + } elseif (!empty($info["preview{$backendId}_fullsizeURL"])) { // preview{$backendId}_fullsizeURL is not actually set in spartacus yet if (file_exists($serendipity["serendipityPath"] . "/templates_c/template_cache/". $theme ."{$backendId}.jpg")) { $data["templates"][$theme]["fullsize${backendId}_preview"] = $serendipity["baseURL"] . "templates_c/template_cache/". $theme ."{$backendId}.jpg"; } else { diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index 7a7d0977..51919ebc 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -789,11 +789,11 @@ function serendipity_insertComment($id, $commentInfo, $type = 'NORMAL', $source if (!empty($ca['status'])) { $commentInfo['status'] = $ca['status']; } - + if ($serendipity['serendipityAuthedUser']) { - $authorReply = true; - $authorEmail = $serendipity['serendipityEmail']; - } + $authorReply = true; + $authorEmail = $serendipity['serendipityEmail']; + } $title = serendipity_db_escape_string(isset($commentInfo['title']) ? $commentInfo['title'] : ''); $comments = $commentInfo['comment']; diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index 1cddf095..c4d52f98 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -1202,7 +1202,7 @@ function serendipity_getPermissionNames() { * * This function caches all permission chacks in static function variables to not * fetch all permissions time and again. - * The permission checks are performed agains the values of each group. If a privilege + * The permission checks are performed against the values of each group. If a privilege * is set in one of the groups the author is a user of, the function returns true. * If a privilege is not set, the userlevel of an author is checked to act for backwards-compatibility. * @@ -2082,7 +2082,7 @@ function serendipity_setFormToken($type = 'form') { global $serendipity; if ($type == 'form') { - return ''; + return ''."\n"; } elseif ($type == 'url') { return 'serendipity[token]=' . md5(session_id()); } else { diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 3f33490d..e7bdf664 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -1226,7 +1226,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm 'is_comment_added' => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'true' ? true: false), 'is_comment_moderate' => (isset($serendipity['GET']['csuccess']) && $serendipity['GET']['csuccess'] == 'moderate' ? true: false) ); - + if ($serendipity['serendipityAuthedUser'] === true) { $userData = array(); $userData['name'] = $serendipity['realname']; @@ -1235,7 +1235,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm } else { $userData = $serendipity['POST']; } - + $serendipity['smarty']->assign($comment_add_data); serendipity_displayCommentForm( $entry['id'], diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php index d8ce0a39..c00a8e8a 100644 --- a/include/functions_plugins_admin.inc.php +++ b/include/functions_plugins_admin.inc.php @@ -446,7 +446,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam $assign_plugin_config($data); break; - + case 'hidden': $data['ctype'] = 'hidden'; $data['cbag_value'] = $cbag->get('value'); diff --git a/plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php b/plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php index 3088a950..eada5e92 100644 --- a/plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php +++ b/plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php @@ -9,10 +9,12 @@ if (IN_serendipity !== true) { @serendipity_plugin_api::load_language(dirname(__FILE__)); -class serendipity_plugin_recententries extends serendipity_plugin { +class serendipity_plugin_recententries extends serendipity_plugin +{ var $title = PLUGIN_RECENTENTRIES_TITLE; - function introspect(&$propbag) { + function introspect(&$propbag) + { $this->title = $this->get_config('title', $this->title); $propbag->add('name', PLUGIN_RECENTENTRIES_TITLE);