1
0

Php8 fixes for ()

* init empty vars to avoid PHP8 warnings

* removed debug output for serendipity_session_destroy()

* init smarty fixed for PHP8

* removed optional parameters for PHP 8

* 2k11 template fixes, maybe updating smarty will solve everything

* init or test undefined variables for PHP 8

* remove only existing files

* make sure string is not empty before comparing the first letter

* check if SMARTY_DIR was already defined

* use mb_language('uni') for unicode

* fixed image filter bug

* Smarty debug fixed in external lib

* fixed archive bug

* fixed entries bug

* updated plugin versions

Co-authored-by: surrim <surrim@happyhydro.org>
This commit is contained in:
surrim
2021-07-18 22:14:23 +02:00
committed by GitHub
parent 1b162d33a8
commit 9a60f9a494
35 changed files with 217 additions and 127 deletions

@ -375,7 +375,7 @@ $data['formtoken'] = serendipity_setFormToken();
$data['get']['filter'] = $serendipity['GET']['filter']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
$data['commentReplied'] = false;
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -65,7 +65,7 @@ if ($_POST['installAction'] == 'check' && serendipity_checkFormToken()) {
$data['config'] = serendipity_printConfigTemplate(serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE), $serendipity, false, true);
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -4,7 +4,7 @@ if (IN_serendipity !== true) {
die ('Don\'t hack!');
}
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -32,7 +32,7 @@ if (isset($_POST['SAVE_NEW']) && serendipity_checkFormToken()) {
/* Edit a group */
if (isset($_POST['SAVE_EDIT']) && serendipity_checkFormToken()) {
$perms = serendipity_getAllPermissionNames();
serendipity_updateGroupConfig($serendipity['POST']['group'], $perms, $serendipity['POST'], false, $serendipity['POST']['forbidden_plugins'], $serendipity['POST']['forbidden_hooks']);
serendipity_updateGroupConfig($serendipity['POST']['group'], $perms, $serendipity['POST'], false, ($serendipity['POST']['forbidden_plugins'] ?? null), ($serendipity['POST']['forbidden_hooks'] ?? null));
$data['save_edit'] = true;
$data['name'] = $serendipity['POST']['name'];
}

@ -10,7 +10,7 @@ if (!serendipity_checkPermission('adminImages')) {
$data = array();
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}
@ -518,8 +518,8 @@ switch ($serendipity['GET']['adminAction']) {
$use_dir = $newDir;
}
serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'], $use_dir);
serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'], $use_dir);
serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'] ?? null, $use_dir);
serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'] ?? null, $use_dir);
$data['print_SETTINGS_SAVED_AT'] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
}

@ -252,7 +252,7 @@ if (isset($serendipity['GET']['importFrom']) && serendipity_checkFormToken()) {
$data['list'] = $list;
}
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -258,7 +258,7 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
return true;
}
function importCategories($parentid = 0, $new_parentid = 0, $b2db) {
function importCategories($parentid = 0, $new_parentid = 0, $b2db = null) {
if (is_null($parentid)) {
$where = 'WHERE ISNULL(cat_parent_ID)';
} else {

@ -265,7 +265,7 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
return true;
}
function importCategories($parentid = 0, $new_parentid = 0, $ltdb) {
function importCategories($parentid = 0, $new_parentid = 0, $ltdb = null) {
if (is_null($parentid)) {
$where = 'WHERE parent_id = 0';
} else {

@ -240,7 +240,7 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
return true;
}
function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb) {
function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb = null) {
$where = "WHERE parent = '" . mysqli_escape_string($parentid) . "'";
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}categories

@ -218,7 +218,7 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
return true;
}
function importCategories($parentname = 'root', $parentid = 0, $txpdb) {
function importCategories($parentname = 'root', $parentid = 0, $txpdb = null) {
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}txp_category
WHERE parent = '" . mysqli_escape_string($parentname) . "' AND type = 'article'", $txpdb);
if (!$res) {

@ -121,7 +121,7 @@ $data['config'] = serendipity_printConfigTemplate($template, $from, true, false)
$add = array('internal' => true);
serendipity_plugin_api::hook_event('backend_sidebar_entries_event_display_profiles', $from, $add);
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -36,7 +36,7 @@ class template_option
WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
AND name = '" . serendipity_db_escape_string($item) . "'");
if ($this->config[$item]['scope'] == 'global') {
if (($this->config[$item]['scope'] ?? '') == 'global') {
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
WHERE okey = 't_global'
AND name = '" . serendipity_db_escape_string($item) . "'");

@ -484,7 +484,7 @@ if (($showAbort && $serendipity['GET']['action'] == 'ignore') || $serendipity['G
$data['get']['action'] = $serendipity['GET']['action']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
$data['templatePath'] = $serendipity['templatePath'];
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}

@ -359,8 +359,7 @@ function serendipity_logout() {
* @return null
*/
function serendipity_session_destroy() {
echo "session destroy";
$no_smarty = $_SESSION['no_smarty'];
$no_smarty = $_SESSION['no_smarty'] ?? null;
@session_destroy();
session_start();
session_regenerate_id();
@ -800,7 +799,7 @@ function serendipity_is_iframe() {
global $serendipity;
if ($serendipity['GET']['is_iframe'] ?? false && is_array($_SESSION['save_entry'])) {
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
// We need smarty also in the iframe to load a template's config.inc.php and register possible event hooks.
serendipity_smarty_init();
}

@ -41,7 +41,7 @@ function serendipity_fetchCategoryRange($categoryid) {
$res = array(array('category_left' => 0, 'category_right' => 0));
}
if ($res[0]['hide_sub'] == 1) {
if (($res[0]['hide_sub'] ?? null) == 1) {
// Set ranges only to own category. Patch by netmorix
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_left']);
} else {
@ -354,6 +354,9 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
}
serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('noCache' => $noCache, 'noSticky' => $noSticky, 'source' => 'entries'));
if (!isset($cond['addkey'])) {
$cond['addkey'] = '';
}
if (is_null($select_key)) {
$select_key = "{$cond['distinct']}
@ -394,6 +397,12 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe
ON ec.categoryid = c.categoryid";
}
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
if (!isset($cond['and'])) {
$cond['and'] = '';
}
if ($joinown) {
$cond['joins'] .= $joinown;
}
@ -587,6 +596,9 @@ function &serendipity_fetchEntry($key, $val, $full = true, $fetchDrafts = 'false
$cond['single_orderby'] = '';
}
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
$querystring = "SELECT e.id,
e.title,
e.timestamp,
@ -894,6 +906,12 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('source' => 'search', 'term' => $term));
serendipity_ACL_SQL($cond, 'limited');
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
if (!isset($cond['addkey'])) {
$cond['addkey'] = '';
}
$serendipity['fullCountQuery'] = "
FROM
{$serendipity['dbPrefix']}entries e
@ -1078,7 +1096,7 @@ function serendipity_getTotalEntries() {
function serendipity_printEntries($entries, $extended = 0, $preview = false, $smarty_block = 'ENTRIES', $smarty_fetch = true, $use_hooks = true, $use_footer = true, $use_grouped_array = false) {
global $serendipity;
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init(); // if not set, start Smarty templating to avoid member function "method()" on a non-object errors (was draft preview error, now at line 1239)
}
@ -1113,17 +1131,22 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
if ($use_grouped_array === false) {
// Use grouping by date (default)
$dategroup = array();
for ($x = 0, $num_entries = count($entries); $x < $num_entries; $x++) {
if (!empty($entries[$x]['properties']['ep_is_sticky']) && serendipity_db_bool($entries[$x]['properties']['ep_is_sticky'])) {
$entries[$x]['is_sticky'] = true;
$key = 'sticky';
} else {
$key = date('Ymd', serendipity_serverOffsetHour($entries[$x]['timestamp']));
}
$num_entries = count($entries);
foreach ($entries as $i => &$entry) {
if ($i !== 'id') {
if (!empty($entry['properties']['ep_is_sticky']) && serendipity_db_bool($entry['properties']['ep_is_sticky'])) {
$entry['is_sticky'] = true;
$key = 'sticky';
} else {
$key = date('Ymd', serendipity_serverOffsetHour($entry['timestamp']));
}
$dategroup[$key]['date'] = $entries[$x]['timestamp'];
$dategroup[$key]['is_sticky'] = (isset($entries[$x]['is_sticky']) && (serendipity_db_bool($entries[$x]['is_sticky']) ? true : false));
$dategroup[$key]['entries'][] = &$entries[$x];
$dategroup[$key]['date'] = $entry['timestamp'];
$dategroup[$key]['is_sticky'] = (isset($entry['is_sticky']) && (serendipity_db_bool($entry['is_sticky']) ? true : false));
$dategroup[$key]['entries'][] = &$entry;
} else {
$num_entries--;
}
}
} elseif ($use_grouped_array === 'plugin') {
// Let a plugin do the grouping
@ -1144,7 +1167,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
}
if (!empty($entry['properties']['ep_cache_body'])) {
$entry['pre_body'] = $entry['body'];
$entry['pre_body'] = $entry['body'] ?? null;
$entry['body'] = &$entry['properties']['ep_cache_body'];
$entry['is_cached'] = true;
}
@ -1160,7 +1183,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
}
if (!empty($entry['properties']['ep_cache_extended'])) {
$entry['pre_extended'] = $entry['extended'];
$entry['pre_extended'] = $entry['extended'] ?? null;
$entry['extended'] = &$entry['properties']['ep_cache_extended'];
$entry['is_cached'] = true;
}
@ -1721,7 +1744,7 @@ function serendipity_printArchives() {
ON e.id = ec.entryid
LEFT JOIN {$serendipity['dbPrefix']}category c
ON ec.categoryid = c.categoryid" : "") .
$sql_condition['joins'] .
($sql_condition['joins'] ?? '') .
" WHERE isdraft = 'false'"
. ($sql_condition['and'] ?? '')
. (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND timestamp <= " . serendipity_db_time() : '')

@ -158,7 +158,7 @@ function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = arr
$template_vars['entry_template'] = serendipity_getTemplateFile('admin/entries.tpl', 'serendipityPath');
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}
$serendipity['smarty']->registerPlugin('modifier', 'emit_htmlarea_code', 'serendipity_emit_htmlarea_code');

@ -107,13 +107,12 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
$cond['parts']['keywords'] = " AND (mk.property IN ('" . serendipity_db_implode("', '", $keywords, 'string') . "'))\n";
$cond['joinparts']['keywords'] = true;
}
$cond['parts']['filter'] = '';
foreach($filter AS $f => $fval) {
if (! (isset($orderfields[$f]) || $f == "fileCategory") || empty($fval)) {
continue;
}
$cond['parts']['filter'] = '';
if (is_array($fval)) {
if (empty($fval['from']) || empty($fval['to'])) {
continue;
@ -187,6 +186,9 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
$cond['orderkey'] = "''";
}
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
if ($cond['joinparts']['properties'] ?? false) {
$cond['joins'] .= "\n LEFT OUTER JOIN {$serendipity['dbPrefix']}mediaproperties AS bp
ON (bp.mediaid = i.id AND bp.property_group = 'base_property' AND bp.property = '{$cond['orderproperty']}')\n";
@ -211,6 +213,9 @@ function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $
$cond['distinct'] = '';
}
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
$basequery = "FROM {$serendipity['dbPrefix']}images AS i
LEFT OUTER JOIN {$serendipity['dbPrefix']}authors AS a
ON i.authorid = a.authorid
@ -283,6 +288,9 @@ function serendipity_fetchImageFromDatabase($id, $mode = 'read') {
serendipity_ACL_SQL($cond, false, 'directory', $mode);
}
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
$rs = serendipity_db_query("SELECT {$cond['distinct']} i.id, i.name, i.extension, i.mime, i.size, i.dimensions_width, i.dimensions_height, i.date, i.thumbnail_name, i.authorid, i.path, i.hotlink, i.realname
FROM {$serendipity['dbPrefix']}images AS i
{$cond['joins']}
@ -409,7 +417,7 @@ function serendipity_deleteImage($id) {
$dfnThumb = $file['path'] . $file['name'] . (!empty($thumb['fthumb']) ? '.' . $thumb['fthumb'] : '') . (empty($file['extension']) ? '' : '.' . $file['extension']);
$dfThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $dfnThumb;
if (@unlink($dfThumb)) {
if (file_exists($dfThumb) && @unlink($dfThumb)) {
$messages .= sprintf('<span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> ' . DELETE_THUMBNAIL . "</span>\n", $dfnThumb);
}
}
@ -1233,6 +1241,9 @@ function serendipity_syncThumbs($deleteThumbs = false) {
AND extension = '" . serendipity_db_escape_string($f[1]) . "'"
);
serendipity_ACL_SQL($cond, false, 'directory');
if (!isset($cond['joins'])) {
$cond['joins'] = '';
}
$rs = serendipity_db_query("SELECT *
FROM {$serendipity['dbPrefix']}images AS i
@ -3202,8 +3213,8 @@ function serendipity_prepareMedia(&$file, $url = '') {
/* If it is an image, and the thumbnail exists */
if ($file['is_image'] && file_exists($file['full_thumb'])) {
$file['thumbWidth'] = $file['dim'][0];
$file['thumbHeight'] = $file['dim'][1];
$file['thumbWidth'] = $file['dim'][0] ?? null;
$file['thumbHeight'] = $file['dim'][1] ?? null;
} elseif ($file['is_image'] && $file['hotlink']) {
$sizes = serendipity_calculate_aspect_size($file['dimensions_width'], $file['dimensions_height'], $serendipity['thumbSize'], $serendipity['thumbConstraint']);
$file['thumbWidth'] = $sizes[0];
@ -3265,7 +3276,7 @@ function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lin
$form_hidden .= ' <input type="hidden" name="serendipity[adminModule]" value="media">'."\n";
}
if (!is_object($serendipity['smarty'])) {
if (!is_object($serendipity['smarty'] ?? null)) {
serendipity_smarty_init();
}
$order_fields = serendipity_getImageFields();

@ -497,7 +497,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
// I can't get it to work unless there's a class of
// pluginmanager_container on the ol, either.
// The drag-n-drop returns the list of IDs in order.
$data['sequencejs_output'] = $sequencejs_output = $serendipity['sequencejs_output'];
$data['sequencejs_output'] = $sequencejs_output = $serendipity['sequencejs_output'] ?? null;
if (!$sequencejs_output) {
$serendipity['sequencejs_output'] = true;
}

@ -37,33 +37,35 @@ function locateHiddenVariables($_args) {
continue;
}
if ($v[0] == 'P') { /* Page */
$page = substr($v, 1);
if (is_numeric($page)) {
$serendipity['GET']['page'] = $page;
unset($_args[$k]);
unset($serendipity['uriArguments'][$k]);
}
} elseif ($v[0] == 'A') { /* Author */
$url_author = substr($v, 1);
if (is_numeric($url_author)) {
$serendipity['GET']['viewAuthor'] = (int)$url_author;
unset($_args[$k]);
}
} elseif ($v == 'summary') { /* Summary */
$serendipity['short_archives'] = true;
if (! array_key_exists('head_subtitle', $serendipity)) {
$serendipity['head_subtitle'] = '';
}
$serendipity['head_subtitle'] .= SUMMARY . ' - ';
unset($_args[$k]);
} elseif ($v[0] == 'C') { /* category */
$cat = substr($v, 1);
if (is_numeric($cat)) {
$serendipity['GET']['category'] = $cat;
unset($_args[$k]);
}
}
if (strlen($v) > 0) {
if ($v[0] == 'P') { /* Page */
$page = substr($v, 1);
if (is_numeric($page)) {
$serendipity['GET']['page'] = $page;
unset($_args[$k]);
unset($serendipity['uriArguments'][$k]);
}
} elseif ($v[0] == 'A') { /* Author */
$url_author = substr($v, 1);
if (is_numeric($url_author)) {
$serendipity['GET']['viewAuthor'] = (int)$url_author;
unset($_args[$k]);
}
} elseif ($v == 'summary') { /* Summary */
$serendipity['short_archives'] = true;
if (! array_key_exists('head_subtitle', $serendipity)) {
$serendipity['head_subtitle'] = '';
}
$serendipity['head_subtitle'] .= SUMMARY . ' - ';
unset($_args[$k]);
} elseif ($v[0] == 'C') { /* category */
$cat = substr($v, 1);
if (is_numeric($cat)) {
$serendipity['GET']['category'] = $cat;
unset($_args[$k]);
}
}
}
}
return $_args;
}
@ -396,14 +398,13 @@ function serveArchives() {
$serendipity['view'] = 'archives';
$_args = locateHiddenVariables($serendipity['uriArguments']);
/* We must always *assume* that Year, Month and Day are the first 3 arguments */
$year = $_args[0] ?? null;
$month = $_args[1] ?? null;
$day = $_args[2] ?? null;
if ($year == "archives") {
unset($year);
}
$year = $_args[1] ?? null;
$month = $_args[2] ?? null;
$day = $_args[3] ?? null;
//if ($year == "archives") {
// unset($year);
//}
$serendipity['GET']['action'] = 'read';
$serendipity['GET']['hidefooter'] = true;
@ -473,10 +474,13 @@ function serveArchives() {
$serendipity['range'] = array($ts, $te);
if ($serendipity['GET']['action'] == 'read') {
if ($serendipity['GET']['category']) {
if ($serendipity['GET']['category'] ?? false) {
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
$serendipity['head_title'] = $cInfo['category_name'];
}
if (!isset($serendipity['head_subtitle'])) {
$serendipity['head_subtitle'] = '';
}
$serendipity['head_subtitle'] .= sprintf(ENTRIES_FOR, $date);
}

@ -284,19 +284,40 @@ function serendipity_smarty_fetchPrintEntries($params, $smarty) {
$serendipity['short_archives'] = $params['short_archives'];
}
$old_var['skip_smarty_hooks'] = $serendipity['skip_smarty_hooks'];
$old_var['skip_smarty_hooks'] = $serendipity['skip_smarty_hooks'] ?? null;
$serendipity['skip_smarty_hooks'] = $params['skip_smarty_hooks'];
$old_var['skip_smarty_hook'] = $serendipity['skip_smarty_hook'];
$old_var['skip_smarty_hook'] = $serendipity['skip_smarty_hook'] ?? null;
$serendipity['skip_smarty_hook'] = $params['skip_smarty_hook'];
foreach($restore_var_GET_keys AS $key) {
if (!empty($params[$key])) {
$old_var['GET'][$key] = $serendipity['GET'][$key];
$old_var['GET'][$key] = $serendipity['GET'][$key] ?? null;
$serendipity['GET'][$key] = $params[$key];
}
}
$param_keys = array(
'full',
'limit',
'fetchDrafts',
'modified_since',
'orderby',
'filter_sql',
'noCache',
'noSticky',
'select_key',
'group_by',
'returncode',
'joinauthors',
'joincategories',
'joinown'
);
foreach ($param_keys as $param_key) {
if (!isset($params[$param_key])) {
$params[$param_key] = null;
}
}
if (!empty($params['id'])) {
$entry = serendipity_fetchEntry(
'id',
@ -366,7 +387,7 @@ function serendipity_smarty_fetchPrintEntries($params, $smarty) {
$serendipity['short_archives'] = $old_var['short_archives'];
}
if (is_array($old_var['GET'])) {
if (is_array($old_var['GET'] ?? null)) {
foreach($old_var['GET'] AS $key => $val) {
$serendipity['GET'][$key] = $val;
}
@ -917,7 +938,9 @@ function serendipity_smarty_init($vars = array()) {
#@define('MEMCACHE_EXTENSION_LOADED', (class_exists('Memcached',false) || class_exists('Memcache',false)) && (extension_loaded("memcached") || extension_loaded("memcache")));
// Default Smarty Engine will be used
@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
if (!defined('SMARTY_DIR')) {
@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
}
if (!class_exists('Smarty')) {
include_once SMARTY_DIR . 'Smarty.class.php';
}

@ -53,7 +53,7 @@ if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) {
// Needs to be included here because we need access to constant LANG_CHARSET definied in languages (not available for compat.inc.php)
if (function_exists('mb_language')) {
@mb_language($serendipity['lang']);
@mb_language('uni'); // TODO: test for non-unicode installations
}
if (function_exists('mb_internal_encoding')) {