<?php
-
/**
* @file mod/admin.php
*
* @brief Friendica admin
*/
use Friendica\App;
+use Friendica\Content\Feature;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\User;
-use Friendica\Network\Probe;
use Friendica\Object\Contact;
require_once 'include/enotify.php';
*/
function admin_post(App $a)
{
-
-
if (!is_site_admin()) {
return;
}
check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
if (x($_POST, 'page_contactblock_block')) {
- $net = Probe::uri($contact_url);
- if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
- notice(t('This contact doesn\'t seem to exist.'));
- }
- $nurl = normalise_link($net['url']);
- $r = dba::select('contact', ['id'], ['nurl' => $nurl, 'uid' => 0], ['limit' => 1]);
- if (DBM::is_result($r)) {
- Contact::block($r['id']);
+ $contact_id = Contact::getIdForURL($contact_url, 0);
+ if ($contact_id) {
+ Contact::block($contact_id);
notice(t('The contact has been blocked from the node'));
} else {
- notice(t('Could not find any contact entry for this URL (%s)', $nurl));
+ notice(t('Could not find any contact entry for this URL (%s)', $contact_url));
}
}
if (x($_POST, 'page_contactblock_unblock')) {
// strings //
'$title' => t('Administration'),
'$page' => t('Remote Contact Blocklist'),
- '$description' => t('This page allows you to prevent any message from a remote contact to reach your node. However, your node must have knowledge of the contact before you can block it.'),
+ '$description' => t('This page allows you to prevent any message from a remote contact to reach your node.'),
'$submit' => t('Block Remote Contact'),
'$select_all' => t('select all'),
'$select_none' => t('select none'),
'$baseurl' => System::baseUrl(true),
'$contacts' => $contacts,
+ '$total_contacts' => tt('%s total blocked contact', '%s total blocked contacts', $total),
'$paginate' => paginate($a),
'$contacturl' => ['contact_url', t("Profile URL"), '', t("URL of the remote contact to block.")],
));
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
'$shortcut_icon' => array('shortcut_icon', t("Shortcut icon"), Config::get('system','shortcut_icon'), t("Link to an icon that will be used for browsers.")),
'$touch_icon' => array('touch_icon', t("Touch icon"), Config::get('system','touch_icon'), t("Link to an icon that will be used for tablets and mobiles.")),
- '$info' => array('info', t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/siteinfo.'), get_server())),
+ '$info' => array('info', t('Additional Info'), $info, sprintf(t('For public servers: you can add additional information here that will be listed at %s/servers.'), get_server())),
'$language' => array('language', t("System language"), Config::get('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), Config::get('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), t("Theme for mobile devices"), $theme_choices_mobile),
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
if (!($nu_name === "") && !($nu_email === "") && !($nu_nickname === "")) {
- require_once 'include/user.php';
-
- $result = create_user(array('username' => $nu_name, 'email' => $nu_email,
+ $result = User::create(array('username' => $nu_name, 'email' => $nu_email,
'nickname' => $nu_nickname, 'verified' => 1, 'language' => $nu_language));
if (!$result['success']) {
notice($result['message']);
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
$arr = array();
- $features = get_features(false);
+ $features = Feature::get(false);
foreach ($features as $fname => $fdata) {
foreach (array_slice($fdata, 1) as $f) {
{
if ((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
- $features = get_features(false);
+ $features = Feature::get(false);
foreach ($features as $fname => $fdata) {
$arr[$fname] = array();