]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
escape_tags calls
[friendica.git] / mod / admin.php
index d4cbafe54bc99919feea859c52576eac3ca73182..730d21984d0f7c90fd816f91b0f2bb6addd39a93 100644 (file)
@@ -14,8 +14,10 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
+use Friendica\Core\Update;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
@@ -28,6 +30,7 @@ use Friendica\Module\Tos;
 use Friendica\Util\Arrays;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
 require_once 'include/enotify.php';
@@ -90,7 +93,7 @@ function admin_post(App $a)
 
                                $theme = $a->argv[2];
                                if (is_file("view/theme/$theme/config.php")) {
-                                       $orig_theme = $a->theme;
+                                       $orig_theme = Renderer::$theme;
                                        $orig_page = $a->page;
                                        $orig_session_theme = $_SESSION['theme'];
                                        require_once "view/theme/$theme/theme.php";
@@ -106,7 +109,7 @@ function admin_post(App $a)
                                        }
 
                                        $_SESSION['theme'] = $orig_session_theme;
-                                       $a->theme = $orig_theme;
+                                       Renderer::$theme = $orig_theme;
                                        $a->page = $orig_page;
                                }
 
@@ -174,7 +177,7 @@ function admin_content(App $a)
        //      apc_delete($toDelete);
        //}
        // Header stuff
-       $a->page['htmlhead'] .= replace_macros(get_markup_template('admin/settings_head.tpl'), []);
+       $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
 
        /*
         * Side bar links
@@ -225,8 +228,8 @@ function admin_content(App $a)
                $addons_admin[] = $addon;
        }
 
-       $t = get_markup_template('admin/aside.tpl');
-       $a->page['aside'] .= replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/aside.tpl');
+       $a->page['aside'] .= Renderer::replaceMacros($t, [
                '$admin' => $aside_tools,
                '$subpages' => $aside_sub,
                '$admtxt' => L10n::t('Admin'),
@@ -313,8 +316,8 @@ function admin_content(App $a)
 function admin_page_tos(App $a)
 {
        $tos = new Tos();
-       $t = get_markup_template('admin/tos.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/tos.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Terms of Service'),
                '$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
@@ -375,8 +378,8 @@ function admin_page_blocklist(App $a)
                        ];
                }
        }
-       $t = get_markup_template('admin/blocklist.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/blocklist.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Server Blocklist'),
                '$intro' => L10n::t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered domains you should also give a reason why you have blocked the remote server.'),
@@ -414,8 +417,8 @@ function admin_page_blocklist_post(App $a)
                //  Add new item to blocklist
                $blocklist = Config::get('system', 'blocklist');
                $blocklist[] = [
-                       'domain' => notags(trim($_POST['newentry_domain'])),
-                       'reason' => notags(trim($_POST['newentry_reason']))
+                       'domain' => Strings::removeTags(trim($_POST['newentry_domain'])),
+                       'reason' => Strings::removeTags(trim($_POST['newentry_reason']))
                ];
                Config::set('system', 'blocklist', $blocklist);
                info(L10n::t('Server added to blocklist.') . EOL);
@@ -424,8 +427,8 @@ function admin_page_blocklist_post(App $a)
                $blocklist = [];
                foreach ($_POST['domain'] as $id => $domain) {
                        // Trimming whitespaces as well as any lingering slashes
-                       $domain = notags(trim($domain, "\x00..\x1F/"));
-                       $reason = notags(trim($_POST['reason'][$id]));
+                       $domain = Strings::removeTags(trim($domain, "\x00..\x1F/"));
+                       $reason = Strings::removeTags(trim($_POST['reason'][$id]));
                        if (!x($_POST['delete'][$id])) {
                                $blocklist[] = [
                                        'domain' => $domain,
@@ -490,8 +493,8 @@ function admin_page_contactblock(App $a)
 
        $contacts = DBA::toArray($statement);
 
-       $t = get_markup_template('admin/contactblock.tpl');
-       $o = replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/contactblock.tpl');
+       $o = Renderer::replaceMacros($t, [
                // strings //
                '$title'       => L10n::t('Administration'),
                '$page'        => L10n::t('Remote Contact Blocklist'),
@@ -532,9 +535,9 @@ function admin_page_contactblock(App $a)
  */
 function admin_page_deleteitem(App $a)
 {
-       $t = get_markup_template('admin/deleteitem.tpl');
+       $t = Renderer::getMarkupTemplate('admin/deleteitem.tpl');
 
-       return replace_macros($t, [
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Delete Item'),
                '$submit' => L10n::t('Delete this Item'),
@@ -563,7 +566,7 @@ function admin_page_deleteitem_post(App $a)
        BaseModule::checkFormSecurityTokenRedirectOnError('/admin/deleteitem/', 'admin_deleteitem');
 
        if (x($_POST['page_deleteitem_submit'])) {
-               $guid = trim(notags($_POST['deleteitemguid']));
+               $guid = trim(Strings::removeTags($_POST['deleteitemguid']));
                // The GUID should not include a "/", so if there is one, we got an URL
                // and the last part of it is most likely the GUID.
                if (strpos($guid, '/')) {
@@ -725,8 +728,8 @@ function admin_page_federation(App $a)
        $hint = L10n::t('The <em>Auto Discovered Contact Directory</em> feature is not enabled, it will improve the data displayed here.');
 
        // load the template, replace the macros and return the page content
-       $t = get_markup_template('admin/federation.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/federation.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Federation Statistics'),
                '$intro' => $intro,
@@ -768,8 +771,8 @@ function admin_page_queue(App $a)
        }
        DBA::close($entries);
 
-       $t = get_markup_template('admin/queue.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/queue.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Inspect Queue'),
                '$count' => count($r),
@@ -819,8 +822,8 @@ function admin_page_workerqueue(App $a, $deferred)
        }
        DBA::close($entries);
 
-       $t = get_markup_template('admin/workerqueue.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/workerqueue.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => $sub_title,
                '$count' => count($r),
@@ -864,10 +867,10 @@ function admin_page_summary(App $a)
                }
        }
 
-       if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
+       if (Config::get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
                DBStructure::update(false, true);
        }
-       if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
+       if (Config::get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
                $showwarning = true;
                $warningtext[] = L10n::t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
        }
@@ -937,8 +940,8 @@ function admin_page_summary(App $a)
                                                  'memory_limit' => ini_get('memory_limit')],
                                'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
 
-       $t = get_markup_template('admin/summary.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/summary.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Summary'),
                '$queues' => $queues,
@@ -1046,16 +1049,16 @@ function admin_page_site_post(App $a)
        }
        // end relocate
 
-       $sitename               =       ((x($_POST,'sitename'))                 ? notags(trim($_POST['sitename']))              : '');
-       $hostname               =       ((x($_POST,'hostname'))                 ? notags(trim($_POST['hostname']))              : '');
-       $sender_email           =       ((x($_POST,'sender_email'))             ? notags(trim($_POST['sender_email']))          : '');
+       $sitename               =       ((x($_POST,'sitename'))                 ? Strings::removeTags(trim($_POST['sitename']))         : '');
+       $hostname               =       ((x($_POST,'hostname'))                 ? Strings::removeTags(trim($_POST['hostname']))         : '');
+       $sender_email           =       ((x($_POST,'sender_email'))             ? Strings::removeTags(trim($_POST['sender_email']))             : '');
        $banner                 =       ((x($_POST,'banner'))                   ? trim($_POST['banner'])                        : false);
-       $shortcut_icon          =       ((x($_POST,'shortcut_icon'))            ? notags(trim($_POST['shortcut_icon']))         : '');
-       $touch_icon             =       ((x($_POST,'touch_icon'))               ? notags(trim($_POST['touch_icon']))            : '');
+       $shortcut_icon          =       ((x($_POST,'shortcut_icon'))            ? Strings::removeTags(trim($_POST['shortcut_icon']))            : '');
+       $touch_icon             =       ((x($_POST,'touch_icon'))               ? Strings::removeTags(trim($_POST['touch_icon']))               : '');
        $info                   =       ((x($_POST,'info'))                     ? trim($_POST['info'])                          : false);
-       $language               =       ((x($_POST,'language'))                 ? notags(trim($_POST['language']))              : '');
-       $theme                  =       ((x($_POST,'theme'))                    ? notags(trim($_POST['theme']))                 : '');
-       $theme_mobile           =       ((x($_POST,'theme_mobile'))             ? notags(trim($_POST['theme_mobile']))          : '');
+       $language               =       ((x($_POST,'language'))                 ? Strings::removeTags(trim($_POST['language']))         : '');
+       $theme                  =       ((x($_POST,'theme'))                    ? Strings::removeTags(trim($_POST['theme']))                    : '');
+       $theme_mobile           =       ((x($_POST,'theme_mobile'))             ? Strings::removeTags(trim($_POST['theme_mobile']))             : '');
        $maximagesize           =       ((x($_POST,'maximagesize'))             ? intval(trim($_POST['maximagesize']))          :  0);
        $maximagelength         =       ((x($_POST,'maximagelength'))           ? intval(trim($_POST['maximagelength']))        :  MAX_IMAGE_LENGTH);
        $jpegimagequality       =       ((x($_POST,'jpegimagequality'))         ? intval(trim($_POST['jpegimagequality']))      :  JPEG_QUALITY);
@@ -1067,14 +1070,14 @@ function admin_page_site_post(App $a)
 
        $register_text          =       ((x($_POST,'register_text'))            ? strip_tags(trim($_POST['register_text']))             : '');
 
-       $allowed_sites          =       ((x($_POST,'allowed_sites'))            ? notags(trim($_POST['allowed_sites']))         : '');
-       $allowed_email          =       ((x($_POST,'allowed_email'))            ? notags(trim($_POST['allowed_email']))         : '');
-       $forbidden_nicknames    =       ((x($_POST,'forbidden_nicknames'))      ? strtolower(notags(trim($_POST['forbidden_nicknames'])))               : '');
+       $allowed_sites          =       ((x($_POST,'allowed_sites'))            ? Strings::removeTags(trim($_POST['allowed_sites']))            : '');
+       $allowed_email          =       ((x($_POST,'allowed_email'))            ? Strings::removeTags(trim($_POST['allowed_email']))            : '');
+       $forbidden_nicknames    =       ((x($_POST,'forbidden_nicknames'))      ? strtolower(Strings::removeTags(trim($_POST['forbidden_nicknames'])))          : '');
        $no_oembed_rich_content = x($_POST,'no_oembed_rich_content');
-       $allowed_oembed         =       ((x($_POST,'allowed_oembed'))           ? notags(trim($_POST['allowed_oembed']))                : '');
+       $allowed_oembed         =       ((x($_POST,'allowed_oembed'))           ? Strings::removeTags(trim($_POST['allowed_oembed']))           : '');
        $block_public           =       ((x($_POST,'block_public'))             ? True                                          : False);
        $force_publish          =       ((x($_POST,'publish_all'))              ? True                                          : False);
-       $global_directory       =       ((x($_POST,'directory'))                ? notags(trim($_POST['directory']))             : '');
+       $global_directory       =       ((x($_POST,'directory'))                ? Strings::removeTags(trim($_POST['directory']))                : '');
        $newuser_private                =       ((x($_POST,'newuser_private'))          ? True                                  : False);
        $enotify_no_content             =       ((x($_POST,'enotify_no_content'))       ? True                                  : False);
        $private_addons                 =       ((x($_POST,'private_addons'))           ? True                                  : False);
@@ -1089,8 +1092,8 @@ function admin_page_site_post(App $a)
        $max_author_posts_community_page        =       ((x($_POST,'max_author_posts_community_page'))  ? intval(trim($_POST['max_author_posts_community_page']))       : 0);
 
        $verifyssl              =       ((x($_POST,'verifyssl'))                ? True                                          : False);
-       $proxyuser              =       ((x($_POST,'proxyuser'))                ? notags(trim($_POST['proxyuser']))             : '');
-       $proxy                  =       ((x($_POST,'proxy'))                    ? notags(trim($_POST['proxy']))                 : '');
+       $proxyuser              =       ((x($_POST,'proxyuser'))                ? Strings::removeTags(trim($_POST['proxyuser']))                : '');
+       $proxy                  =       ((x($_POST,'proxy'))                    ? Strings::removeTags(trim($_POST['proxy']))                    : '');
        $timeout                =       ((x($_POST,'timeout'))                  ? intval(trim($_POST['timeout']))               : 60);
        $maxloadavg             =       ((x($_POST,'maxloadavg'))               ? intval(trim($_POST['maxloadavg']))            : 50);
        $maxloadavg_frontend    =       ((x($_POST,'maxloadavg_frontend'))      ? intval(trim($_POST['maxloadavg_frontend']))   : 50);
@@ -1114,16 +1117,16 @@ function admin_page_site_post(App $a)
        $dbclean_expire_days    =       ((x($_POST,'dbclean_expire_days'))      ? intval($_POST['dbclean_expire_days'])         : 0);
        $dbclean_unclaimed      =       ((x($_POST,'dbclean_unclaimed'))        ? intval($_POST['dbclean_unclaimed'])           : 0);
        $suppress_tags          =       ((x($_POST,'suppress_tags'))            ? True                                          : False);
-       $itemcache              =       ((x($_POST,'itemcache'))                ? notags(trim($_POST['itemcache']))             : '');
+       $itemcache              =       ((x($_POST,'itemcache'))                ? Strings::removeTags(trim($_POST['itemcache']))                : '');
        $itemcache_duration     =       ((x($_POST,'itemcache_duration'))       ? intval($_POST['itemcache_duration'])          : 0);
        $max_comments           =       ((x($_POST,'max_comments'))             ? intval($_POST['max_comments'])                : 0);
-       $temppath               =       ((x($_POST,'temppath'))                 ? notags(trim($_POST['temppath']))              : '');
-       $basepath               =       ((x($_POST,'basepath'))                 ? notags(trim($_POST['basepath']))              : '');
-       $singleuser             =       ((x($_POST,'singleuser'))               ? notags(trim($_POST['singleuser']))            : '');
+       $temppath               =       ((x($_POST,'temppath'))                 ? Strings::removeTags(trim($_POST['temppath']))         : '');
+       $basepath               =       ((x($_POST,'basepath'))                 ? Strings::removeTags(trim($_POST['basepath']))         : '');
+       $singleuser             =       ((x($_POST,'singleuser'))               ? Strings::removeTags(trim($_POST['singleuser']))               : '');
        $proxy_disabled         =       ((x($_POST,'proxy_disabled'))           ? True                                          : False);
        $only_tag_search        =       ((x($_POST,'only_tag_search'))          ? True                                          : False);
        $rino                   =       ((x($_POST,'rino'))                     ? intval($_POST['rino'])                        : 0);
-       $check_new_version_url  =       ((x($_POST, 'check_new_version_url'))   ?       notags(trim($_POST['check_new_version_url']))   : 'none');
+       $check_new_version_url  =       ((x($_POST, 'check_new_version_url'))   ?       Strings::removeTags(trim($_POST['check_new_version_url']))      : 'none');
 
        $worker_queues          =       ((x($_POST,'worker_queues'))            ? intval($_POST['worker_queues'])               : 10);
        $worker_dont_fork       =       ((x($_POST,'worker_dont_fork'))         ? True                                          : False);
@@ -1131,10 +1134,10 @@ function admin_page_site_post(App $a)
        $worker_frontend        =       ((x($_POST,'worker_frontend'))          ? True                                          : False);
 
        $relay_directly         =       ((x($_POST,'relay_directly'))           ? True                                          : False);
-       $relay_server           =       ((x($_POST,'relay_server'))             ? notags(trim($_POST['relay_server']))          : '');
+       $relay_server           =       ((x($_POST,'relay_server'))             ? Strings::removeTags(trim($_POST['relay_server']))             : '');
        $relay_subscribe        =       ((x($_POST,'relay_subscribe'))          ? True                                          : False);
-       $relay_scope            =       ((x($_POST,'relay_scope'))              ? notags(trim($_POST['relay_scope']))           : '');
-       $relay_server_tags      =       ((x($_POST,'relay_server_tags'))        ? notags(trim($_POST['relay_server_tags']))     : '');
+       $relay_scope            =       ((x($_POST,'relay_scope'))              ? Strings::removeTags(trim($_POST['relay_scope']))              : '');
+       $relay_server_tags      =       ((x($_POST,'relay_server_tags'))        ? Strings::removeTags(trim($_POST['relay_server_tags']))        : '');
        $relay_user_tags        =       ((x($_POST,'relay_user_tags'))          ? True                                          : False);
 
        // Has the directory url changed? If yes, then resubmit the existing profiles there
@@ -1448,8 +1451,8 @@ function admin_page_site(App $a)
                $optimize_max_tablesize = -1;
        }
 
-       $t = get_markup_template('admin/site.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/site.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Site'),
                '$submit' => L10n::t('Save Settings'),
@@ -1595,7 +1598,8 @@ function admin_page_dbsync(App $a)
                $retval = DBStructure::update(false, true);
                if ($retval === '') {
                        $o .= L10n::t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
-                       Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
+                       Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
+                       Config::set('database', 'last_successful_update_time', time());
                } else {
                        $o .= L10n::t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
                }
@@ -1612,9 +1616,9 @@ function admin_page_dbsync(App $a)
                if (function_exists($func)) {
                        $retval = $func();
 
-                       if ($retval === UPDATE_FAILED) {
+                       if ($retval === Update::FAILED) {
                                $o .= L10n::t("Executing %s failed with error: %s", $func, $retval);
-                       } elseif ($retval === UPDATE_SUCCESS) {
+                       } elseif ($retval === Update::SUCCESS) {
                                $o .= L10n::t('Update %s was successfully applied.', $func);
                                Config::set('database', $func, 'success');
                        } else {
@@ -1642,13 +1646,13 @@ function admin_page_dbsync(App $a)
        }
 
        if (!count($failed)) {
-               $o = replace_macros(get_markup_template('structure_check.tpl'), [
+               $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('structure_check.tpl'), [
                        '$base' => System::baseUrl(true),
                        '$banner' => L10n::t('No failed updates.'),
                        '$check' => L10n::t('Check database structure'),
                ]);
        } else {
-               $o = replace_macros(get_markup_template('failed_updates.tpl'), [
+               $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('failed_updates.tpl'), [
                        '$base' => System::baseUrl(true),
                        '$banner' => L10n::t('Failed Updates'),
                        '$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'),
@@ -1909,8 +1913,8 @@ function admin_page_users(App $a)
 
        $th_users = array_map(null, [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Type')], $valid_orders);
 
-       $t = get_markup_template('admin/users.tpl');
-       $o = replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/users.tpl');
+       $o = Renderer::replaceMacros($t, [
                // strings //
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Users'),
@@ -2025,9 +2029,9 @@ function admin_page_addons(App $a, array $addons_admin)
                        $func($a, $admin_form);
                }
 
-               $t = get_markup_template('admin/addon_details.tpl');
+               $t = Renderer::getMarkupTemplate('admin/addon_details.tpl');
 
-               return replace_macros($t, [
+               return Renderer::replaceMacros($t, [
                        '$title' => L10n::t('Administration'),
                        '$page' => L10n::t('Addons'),
                        '$toggle' => L10n::t('Toggle'),
@@ -2086,8 +2090,8 @@ function admin_page_addons(App $a, array $addons_admin)
                }
        }
 
-       $t = get_markup_template('admin/addons.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/addons.tpl');
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Addons'),
                '$submit' => L10n::t('Save Settings'),
@@ -2270,7 +2274,7 @@ function admin_page_themes(App $a)
 
                $admin_form = '';
                if (is_file("view/theme/$theme/config.php")) {
-                       $orig_theme = $a->theme;
+                       $orig_theme = Renderer::$theme;
                        $orig_page = $a->page;
                        $orig_session_theme = $_SESSION['theme'];
                        require_once "view/theme/$theme/theme.php";
@@ -2287,7 +2291,7 @@ function admin_page_themes(App $a)
                        }
 
                        $_SESSION['theme'] = $orig_session_theme;
-                       $a->theme = $orig_theme;
+                       Renderer::$theme = $orig_theme;
                        $a->page = $orig_page;
                }
 
@@ -2296,8 +2300,8 @@ function admin_page_themes(App $a)
                        $screenshot = null;
                }
 
-               $t = get_markup_template('admin/addon_details.tpl');
-               return replace_macros($t, [
+               $t = Renderer::getMarkupTemplate('admin/addon_details.tpl');
+               return Renderer::replaceMacros($t, [
                        '$title' => L10n::t('Administration'),
                        '$page' => L10n::t('Themes'),
                        '$toggle' => L10n::t('Toggle'),
@@ -2340,8 +2344,8 @@ function admin_page_themes(App $a)
                $addons[] = [$th['name'], (($th['allowed']) ? "on" : "off"), Theme::getInfo($th['name'])];
        }
 
-       $t = get_markup_template('admin/addons.tpl');
-       return replace_macros($t, [
+       $t = Renderer::getMarkupTemplate('admin/addons.tpl');
+       return Renderer::replaceMacros($t, [
                '$title'               => L10n::t('Administration'),
                '$page'                => L10n::t('Themes'),
                '$submit'              => L10n::t('Save Settings'),
@@ -2367,7 +2371,7 @@ function admin_page_logs_post(App $a)
        if (x($_POST, "page_logs")) {
                BaseModule::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
 
-               $logfile   = ((x($_POST,'logfile'))   ? notags(trim($_POST['logfile']))  : '');
+               $logfile   = ((x($_POST,'logfile'))   ? Strings::removeTags(trim($_POST['logfile']))  : '');
                $debugging = ((x($_POST,'debugging')) ? true                             : false);
                $loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel'])) : 0);
 
@@ -2414,9 +2418,9 @@ function admin_page_logs(App $a)
                $phplogenabled = L10n::t('PHP log currently disabled.');
        }
 
-       $t = get_markup_template('admin/logs.tpl');
+       $t = Renderer::getMarkupTemplate('admin/logs.tpl');
 
-       return replace_macros($t, [
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('Logs'),
                '$submit' => L10n::t('Save Settings'),
@@ -2455,7 +2459,7 @@ function admin_page_logs(App $a)
  */
 function admin_page_viewlogs(App $a)
 {
-       $t = get_markup_template('admin/viewlogs.tpl');
+       $t = Renderer::getMarkupTemplate('admin/viewlogs.tpl');
        $f = Config::get('system', 'logfile');
        $data = '';
 
@@ -2474,16 +2478,16 @@ function admin_page_viewlogs(App $a)
                                }
                                $seek = fseek($fp, 0 - $size, SEEK_END);
                                if ($seek === 0) {
-                                       $data = escape_tags(fread($fp, $size));
+                                       $data = Strings::escapeTags(fread($fp, $size));
                                        while (!feof($fp)) {
-                                               $data .= escape_tags(fread($fp, 4096));
+                                               $data .= Strings::escapeTags(fread($fp, 4096));
                                        }
                                }
                        }
                        fclose($fp);
                }
        }
-       return replace_macros($t, [
+       return Renderer::replaceMacros($t, [
                '$title' => L10n::t('Administration'),
                '$page' => L10n::t('View Logs'),
                '$data' => $data,
@@ -2561,8 +2565,8 @@ function admin_page_features(App $a)
                        }
                }
 
-               $tpl = get_markup_template('admin/settings_features.tpl');
-               $o = replace_macros($tpl, [
+               $tpl = Renderer::getMarkupTemplate('admin/settings_features.tpl');
+               $o = Renderer::replaceMacros($tpl, [
                        '$form_security_token' => BaseModule::getFormSecurityToken("admin_manage_features"),
                        '$title' => L10n::t('Manage Additional Features'),
                        '$features' => $arr,