diff --git a/docs/NEWS-2.0-temp b/docs/NEWS-2.0-temp index de6c01f2..13321f79 100644 --- a/docs/NEWS-2.0-temp +++ b/docs/NEWS-2.0-temp @@ -16,7 +16,8 @@ * New additional option to render smarty-functions: serendipity_smarty_show($template, $data) -* A number of functions now returns their result instead of echoing them (TODO: Make that "all functions"): +* A number of functions now returns their result instead of echoing them (TODO: a bunch of image- and +trackback-functions still use echo for messages"): serendipity_plugin_config serendipity_printEntryForm serendipity_printEntries @@ -24,6 +25,12 @@ serendipity_showPropertyForm showMediaLibrary serendipity_guessInput + memSnap + serendipity_displayTopUrlList + serendipity_displayTopExits + serendipity_displayTopReferrers + serendipity_printConfigTemplate + show_plugins * Functions removed from the core: serendipity_printConfigJS @@ -77,4 +84,6 @@ * jQuery in the backend no longer runs in noConflict-mode. Use $(...) instead of jQuery(...) -* The entryproperty-plugin will now always delete its cache on uninstall, not only if the cache is activated then \ No newline at end of file +* The entryproperty-plugin will now always delete its cache on uninstall, not only if the cache is activated then + +* serendipity_is_iframe now really only checks for iframe and doesn't also echo it \ No newline at end of file diff --git a/include/admin/configuration.inc.php b/include/admin/configuration.inc.php index 16d25f44..272eebda 100644 --- a/include/admin/configuration.inc.php +++ b/include/admin/configuration.inc.php @@ -68,10 +68,7 @@ switch ($_POST['installAction'] && serendipity_checkFormToken()) { default: $from = &$serendipity; $t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE); - ob_start(); - serendipity_printConfigTemplate($t, $from, false, true); - $data['config'] = ob_get_contents(); - ob_end_clean(); + $data['config'] = serendipity_printConfigTemplate($t, $from, false, true); break; } diff --git a/include/admin/installer.inc.php b/include/admin/installer.inc.php index 08f4f56c..e49f9481 100644 --- a/include/admin/installer.inc.php +++ b/include/admin/installer.inc.php @@ -325,17 +325,11 @@ if ( (int)$serendipity['GET']['step'] == 0 ) { } elseif ( $serendipity['GET']['step'] == '2a' ) { $config = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE, null, array('simpleInstall')); - ob_start(); - serendipity_printConfigTemplate($config, $from, true, false, false); - $data['ob_serendipity_printConfigTemplate'] = ob_get_contents(); - ob_end_clean(); + $data['ob_serendipity_printConfigTemplate'] = serendipity_printConfigTemplate($config, $from, true, false, false); } elseif ( $serendipity['GET']['step'] == '2b' ) { $config = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE); - ob_start(); - serendipity_printConfigTemplate($config, $from, true, false, false); - $data['ob_serendipity_printConfigTemplate'] = ob_get_contents(); - ob_end_clean(); + $data['ob_serendipity_printConfigTemplate'] = serendipity_printConfigTemplate($config, $from, true, false, false); } elseif ( $serendipity['GET']['step'] == '3' ) { $serendipity['dbPrefix'] = $_POST['dbPrefix']; diff --git a/include/admin/personal.inc.php b/include/admin/personal.inc.php index 0ee678bc..abab029a 100644 --- a/include/admin/personal.inc.php +++ b/include/admin/personal.inc.php @@ -105,10 +105,7 @@ $user = serendipity_fetchUsers($serendipity['authorid']); $from = $user[0]; $from['groups'] = serendipity_getGroups($serendipity['authorid']); unset($from['password']); -ob_start(); -serendipity_printConfigTemplate($template, $from, true, false); -$data['config'] = ob_get_contents(); -ob_get_clean(); +$data['config'] = serendipity_printConfigTemplate($template, $from, true, false); $add = array('internal' => true); diff --git a/include/admin/plugins.inc.php b/include/admin/plugins.inc.php index 81057c85..ef1f1099 100644 --- a/include/admin/plugins.inc.php +++ b/include/admin/plugins.inc.php @@ -389,20 +389,14 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) { $data['backend_plugins_sidebar_header'] = ob_get_contents(); ob_end_clean(); - ob_start(); - show_plugins(false, $sidebars); - $data['sidebar_plugins'] = ob_get_contents(); - ob_end_clean(); + $data['sidebar_plugins'] = show_plugins(false, $sidebars); ob_start(); serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity); $data['backend_plugins_event_header'] = ob_get_contents(); ob_end_clean(); - ob_start(); - show_plugins(true); - $data['event_plugins'] = ob_get_contents(); - ob_end_clean(); + $data['event_plugins'] = show_plugins(true); if (count($serendipity['memSnaps']) > 0) { $data['$memsnaps'] = $serendipity['memSnaps']; @@ -410,10 +404,6 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) { } -if (!is_object($serendipity['smarty'])) { - serendipity_smarty_init(); -} - echo serendipity_smarty_show('admin/plugins.inc.tpl', $data); /* vim: set sts=4 ts=4 expandtab : */ diff --git a/include/admin/users.inc.php b/include/admin/users.inc.php index 2d10abb4..57786aa6 100644 --- a/include/admin/users.inc.php +++ b/include/admin/users.inc.php @@ -228,10 +228,7 @@ if ( ($serendipity['GET']['adminAction'] == 'edit' && serendipity_checkPermissio $from['groups'] = array(); } - ob_start(); - serendipity_printConfigTemplate($config, $from, true, false, true, true); - $data['config'] = ob_get_contents(); - ob_end_clean(); + $data['config'] = serendipity_printConfigTemplate($config, $from, true, false, true, true); } elseif ($serendipity['GET']['adminAction'] == 'delete' && serendipity_checkPermission('adminUsersDelete')) { $user = serendipity_fetchUsers($serendipity['GET']['userid']); @@ -246,11 +243,6 @@ if ( ($serendipity['GET']['adminAction'] == 'edit' && serendipity_checkPermissio } } -if (!is_object($serendipity['smarty'])) { - serendipity_smarty_init(); -} - - echo serendipity_smarty_show('admin/users.inc.tpl', $data); /* vim: set sts=4 ts=4 expandtab : */ diff --git a/include/compat.inc.php b/include/compat.inc.php index 2c0a6ac1..12f6ac0b 100644 --- a/include/compat.inc.php +++ b/include/compat.inc.php @@ -58,8 +58,8 @@ function memSnap($tshow = '') { } $current = memory_get_usage(); - echo '[' . date('d.m.Y H:i') . '] ' . number_format($current - $memUsage, 2, ',', '.') . ' label "' . $tshow . '", totalling ' . number_format($current, 2, ',', '.') . '
' . "\n"; $memUsage = $current; + return '[' . date('d.m.Y H:i') . '] ' . number_format($current - $memUsage, 2, ',', '.') . ' label "' . $tshow . '", totalling ' . number_format($current, 2, ',', '.') . '
' . "\n"; } /** diff --git a/include/functions.inc.php b/include/functions.inc.php index 39240e88..5cfc80aa 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -856,7 +856,7 @@ function serendipity_track_url($list, $url, $entry_id = 0) { * @return string List of Top referrers */ function serendipity_displayTopReferrers($limit = 10, $use_links = true, $interval = 7) { - serendipity_displayTopUrlList('referrers', $limit, $use_links, $interval); + return serendipity_displayTopUrlList('referrers', $limit, $use_links, $interval); } /** @@ -870,7 +870,7 @@ function serendipity_displayTopReferrers($limit = 10, $use_links = true, $interv * @return string List of Top exits */ function serendipity_displayTopExits($limit = 10, $use_links = true, $interval = 7) { - serendipity_displayTopUrlList('exits', $limit, $use_links, $interval); + return serendipity_displayTopUrlList('exits', $limit, $use_links, $interval); } /** @@ -913,18 +913,18 @@ function serendipity_displayTopUrlList($list, $limit, $use_links = true, $interv } $rows = serendipity_db_query($query); - echo ""; + $output = ""; if (is_array($rows)) { foreach ($rows as $row) { if ($use_links) { - printf( + $output .= sprintf( '%2$s (%3$s)', htmlspecialchars($row['scheme']), htmlspecialchars($row['host']), htmlspecialchars($row['total']) ); } else { - printf( + $output .= sprintf( '%1$s (%2$s)', htmlspecialchars($row['host']), htmlspecialchars($row['total']) @@ -932,7 +932,8 @@ function serendipity_displayTopUrlList($list, $limit, $use_links = true, $interv } } } - echo ""; + $output .= ""; + return $output; } /** diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index f543cadf..1b233555 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -110,6 +110,7 @@ function serendipity_set_config_var($name, $val, $authorid = 0) { } if (is_string($r)) { + # if $r is a string, it is the error-message from the insert echo $r; } } @@ -737,18 +738,6 @@ function serendipity_is_iframe() { global $serendipity; if ($serendipity['GET']['is_iframe'] && is_array($_SESSION['save_entry'])) { - include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php'; - // An iframe may NOT contain and tags, that's why we emit different headers here than on serendipity_admin.php - - // We need to restore GET/POST variables to that depending plugins inside the iframe - // can still fetch all that variables; and we also tighten security by not allowing - // to pass any different GET/POST variables to our iframe. - $iframe_mode = $serendipity['GET']['iframe_mode']; - $serendipity['POST'] = &$_SESSION['save_entry_POST']; - $serendipity['GET'] = &$_SESSION['save_entry_POST']; // GET-Vars are the same as POST to ensure compatibility. - $serendipity['hidefooter'] = true; - ignore_user_abort(true); - echo serendipity_iframe($_SESSION['save_entry'], $iframe_mode); return true; } return false; diff --git a/include/functions_installer.inc.php b/include/functions_installer.inc.php index 9c1d88c1..28170ccf 100644 --- a/include/functions_installer.inc.php +++ b/include/functions_installer.inc.php @@ -494,7 +494,7 @@ function serendipity_printConfigTemplate($config, $from = false, $noForm = false } } $data['config'] = $config; - echo serendipity_smarty_show('admin/config_template.tpl', $data); + return serendipity_smarty_show('admin/config_template.tpl', $data); } /** diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php index 0835ed38..6b865fe6 100644 --- a/include/functions_plugins_admin.inc.php +++ b/include/functions_plugins_admin.inc.php @@ -203,7 +203,7 @@ function show_plugins($event_only = false, $sidebars = null) } $data['total'] = $i; - echo serendipity_smarty_show('admin/show_plugins.fnc.tpl', $data); + return serendipity_smarty_show('admin/show_plugins.fnc.tpl', $data); } /** @@ -625,10 +625,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam if ($showExample && method_exists($plugin, 'example') ) { $data['showExample'] = true; - ob_start(); - echo $plugin->example(); - $data['plugin_example'] = ob_get_contents(); - ob_end_clean(); + $data['plugin_example'] = $plugin->example(); } if ($spawnNuggets && isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) { diff --git a/plugins/serendipity_event_statistics/serendipity_event_statistics.php b/plugins/serendipity_event_statistics/serendipity_event_statistics.php index e2f594e3..29a05b81 100644 --- a/plugins/serendipity_event_statistics/serendipity_event_statistics.php +++ b/plugins/serendipity_event_statistics/serendipity_event_statistics.php @@ -14,7 +14,7 @@ class serendipity_event_statistics extends serendipity_event $propbag->add('description', PLUGIN_EVENT_STATISTICS_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Arnan de Gans, Garvin Hicking, Fredrik Sandberg, kalkin'); - $propbag->add('version', '1.51'); + $propbag->add('version', '1.52'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -532,11 +532,11 @@ class serendipity_event_statistics extends serendipity_event
-
+

-
+

$max_items)); ?> diff --git a/plugins/serendipity_plugin_topexits/serendipity_plugin_topexits.php b/plugins/serendipity_plugin_topexits/serendipity_plugin_topexits.php index 9ffa13d8..03a14751 100644 --- a/plugins/serendipity_plugin_topexits/serendipity_plugin_topexits.php +++ b/plugins/serendipity_plugin_topexits/serendipity_plugin_topexits.php @@ -9,7 +9,7 @@ class serendipity_plugin_topexits extends serendipity_plugin { $propbag->add('description', SHOWS_TOP_EXIT); $propbag->add('stackable', false); $propbag->add('author', 'Serendipity Team'); - $propbag->add('version', '1.0'); + $propbag->add('version', '1.1'); $propbag->add('configuration', array('limit', 'use_links', 'interval')); $propbag->add('groups', array('STATISTICS')); } @@ -62,7 +62,7 @@ class serendipity_plugin_topexits extends serendipity_plugin { $use_links = serendipity_db_bool($use_links); } - serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7)); + echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7)); } } diff --git a/plugins/serendipity_plugin_topreferrers/serendipity_plugin_topreferrers.php b/plugins/serendipity_plugin_topreferrers/serendipity_plugin_topreferrers.php index 782b3f44..b7677608 100644 --- a/plugins/serendipity_plugin_topreferrers/serendipity_plugin_topreferrers.php +++ b/plugins/serendipity_plugin_topreferrers/serendipity_plugin_topreferrers.php @@ -9,7 +9,7 @@ class serendipity_plugin_topreferrers extends serendipity_plugin { $propbag->add('description', SHOWS_TOP_SITES); $propbag->add('stackable', false); $propbag->add('author', 'Serendipity Team'); - $propbag->add('version', '1.1'); + $propbag->add('version', '1.2'); $propbag->add('configuration', array('limit', 'use_links', 'interval')); $propbag->add('groups', array('STATISTICS')); } @@ -61,7 +61,7 @@ class serendipity_plugin_topreferrers extends serendipity_plugin { } else { $use_links = serendipity_db_bool($use_links); } - serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7)); + echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7)); } } diff --git a/serendipity_admin.php b/serendipity_admin.php index 57392ac1..6bf6c155 100644 --- a/serendipity_admin.php +++ b/serendipity_admin.php @@ -37,6 +37,18 @@ if (isset($serendipity['GET']['adminModule']) && $serendipity['GET']['adminModul // If we are inside an iframe, halt the script if (serendipity_is_iframe() !== false) { + include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php'; + // An iframe may NOT contain and tags, that's why we emit different headers here than on serendipity_admin.php + + // We need to restore GET/POST variables to that depending plugins inside the iframe + // can still fetch all that variables; and we also tighten security by not allowing + // to pass any different GET/POST variables to our iframe. + $iframe_mode = $serendipity['GET']['iframe_mode']; + $serendipity['POST'] = &$_SESSION['save_entry_POST']; + $serendipity['GET'] = &$_SESSION['save_entry_POST']; // GET-Vars are the same as POST to ensure compatibility. + $serendipity['hidefooter'] = true; + ignore_user_abort(true); + echo serendipity_iframe($_SESSION['save_entry'], $iframe_mode); return true; } diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index 745e320f..8325c097 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -41,7 +41,7 @@ if (!defined('IN_serendipity')) { include(S9Y_INCLUDE_PATH . 'include/compat.inc.php'); if (defined('USE_MEMSNAP')) { - memSnap('Framework init'); + echo memSnap('Framework init'); } // The version string @@ -296,7 +296,7 @@ if (!serendipity_db_connect()) { */ if (defined('USE_MEMSNAP')) { - memSnap('Framework init'); + echo memSnap('Framework init'); } serendipity_load_configuration();