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;
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';
$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";
}
$_SESSION['theme'] = $orig_session_theme;
- $a->theme = $orig_theme;
+ Renderer::$theme = $orig_theme;
$a->page = $orig_page;
}
// 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
$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'),
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.')],
];
}
}
- $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.'),
// 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);
$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,
$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'),
*/
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'),
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, '/')) {
$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,
}
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),
}
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),
}
}
- 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.');
}
'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,
}
// 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);
$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);
$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);
$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);
$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
$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'),
$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 />";
}
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 {
}
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.'),
$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'),
$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'),
}
}
- $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'),
$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";
}
$_SESSION['theme'] = $orig_session_theme;
- $a->theme = $orig_theme;
+ Renderer::$theme = $orig_theme;
$a->page = $orig_page;
}
$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'),
$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'),
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);
$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'),
*/
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 = '';
}
$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,
}
}
- $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,