Friendica';
}
$banner = htmlspecialchars($banner);
- $info = Config::get('config','info');
+ $info = Config::get('config', 'info');
$info = htmlspecialchars($info);
// Automatically create temporary paths
@@ -1156,7 +1247,7 @@ function admin_page_site(App $a) {
}
$diaspora_able = ($a->get_path() == "");
- $optimize_max_tablesize = Config::get('system','optimize_max_tablesize', 100);
+ $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', 100);
if ($optimize_max_tablesize < -1) {
$optimize_max_tablesize = -1;
@@ -1166,7 +1257,7 @@ function admin_page_site(App $a) {
$optimize_max_tablesize = 100;
}
- $t = get_markup_template("admin_site.tpl");
+ $t = get_markup_template('admin/site.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Site'),
@@ -1179,7 +1270,7 @@ function admin_page_site(App $a) {
'$portable_contacts' => t('Auto Discovered Contact Directory'),
'$performance' => t('Performance'),
'$worker_title' => t('Worker'),
- '$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
+ '$relocate' => t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
'$baseurl' => System::baseUrl(true),
// name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), $a->config['sitename'],''),
@@ -1264,9 +1355,7 @@ function admin_page_site(App $a) {
'$worker_frontend' => array('worker_frontend', t('Enable frontend worker'), Config::get('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), System::baseUrl())),
'$form_security_token' => get_form_security_token("admin_site")
-
));
-
}
/**
@@ -1280,18 +1369,18 @@ function admin_page_site(App $a) {
*
* @param App $a
* @return string
- **/
-function admin_page_dbsync(App $a) {
-
+ * */
+function admin_page_dbsync(App $a)
+{
$o = '';
if ($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
- Config::set('database', 'update_'.intval($a->argv[3]), 'success');
- $curr = Config::get('system','build');
+ Config::set('database', 'update_' . intval($a->argv[3]), 'success');
+ $curr = Config::get('system', 'build');
if (intval($curr) == intval($a->argv[3])) {
- Config::set('system','build',intval($curr) + 1);
+ Config::set('system', 'build', intval($curr) + 1);
}
- info(t('Update has been marked successful').EOL);
+ info(t('Update has been marked successful') . EOL);
goaway('admin/dbsync');
}
@@ -1299,11 +1388,10 @@ function admin_page_dbsync(App $a) {
require_once("include/dbstructure.php");
$retval = update_structure(false, true);
if (!$retval) {
- $o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION)."$users"; killme();
@@ -1563,7 +1644,7 @@ function admin_page_users(App $a) {
t('Normal Account'),
t('Automatic Follower Account'),
t('Public Forum Account'),
- t('Automatic Friend Account')
+ t('Automatic Friend Account')
);
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
@@ -1572,7 +1653,7 @@ function admin_page_users(App $a) {
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
$e['is_admin'] = in_array($e['email'], $adminlist);
$e['is_deletable'] = (intval($e['uid']) != local_user());
- $e['deleted'] = ($e['account_removed']?relative_date($e['account_expires_on']):False);
+ $e['deleted'] = ($e['account_removed'] ? relative_date($e['account_expires_on']) : False);
return $e;
};
$users = array_map($_setup_users, $users);
@@ -1587,7 +1668,7 @@ function admin_page_users(App $a) {
while (count($users)) {
$new_user = array();
foreach (array_pop($users) as $k => $v) {
- $k = str_replace('-','_',$k);
+ $k = str_replace('-', '_', $k);
$new_user[$k] = $v;
}
if ($new_user['deleted']) {
@@ -1602,12 +1683,10 @@ function admin_page_users(App $a) {
array_push($users, array_pop($tmp_users));
}
- $th_users = array_map(null,
- array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
- $valid_orders
+ $th_users = array_map(null, array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), $valid_orders
);
- $t = get_markup_template("admin_users.tpl");
+ $t = get_markup_template('admin/users.tpl');
$o = replace_macros($t, array(
// strings //
'$title' => t('Administration'),
@@ -1617,7 +1696,7 @@ function admin_page_users(App $a) {
'$h_pending' => t('User registrations waiting for confirm'),
'$h_deleted' => t('User waiting for permanent deletion'),
'$th_pending' => array(t('Request date'), t('Name'), t('Email')),
- '$no_pending' => t('No registrations.'),
+ '$no_pending' => t('No registrations.'),
'$pendingnotetext' => t('Note from the user'),
'$approve' => t('Approve'),
'$deny' => t('Deny'),
@@ -1653,7 +1732,6 @@ function admin_page_users(App $a) {
return $o;
}
-
/**
* @brief Plugins admin page
*
@@ -1670,8 +1748,8 @@ function admin_page_users(App $a) {
* @param App $a
* @return string
*/
-function admin_page_plugins(App $a) {
-
+function admin_page_plugins(App $a)
+{
/*
* Single plugin
*/
@@ -1682,7 +1760,7 @@ function admin_page_plugins(App $a) {
return '';
}
- if (x($_GET,"a") && $_GET['a']=="t") {
+ if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
// Toggle plugin status
@@ -1696,7 +1774,7 @@ function admin_page_plugins(App $a) {
install_plugin($plugin);
info(sprintf(t("Plugin %s enabled."), $plugin));
}
- Config::set("system","addon", implode(", ",$a->plugins));
+ Config::set("system", "addon", implode(", ", $a->plugins));
goaway('admin/plugins');
return ''; // NOTREACHED
}
@@ -1705,27 +1783,29 @@ function admin_page_plugins(App $a) {
require_once('library/markdown.php');
if (in_array($plugin, $a->plugins)) {
- $status="on"; $action= t("Disable");
+ $status = "on";
+ $action = t("Disable");
} else {
- $status="off"; $action= t("Enable");
+ $status = "off";
+ $action = t("Enable");
}
- $readme=Null;
+ $readme = Null;
if (is_file("addon/$plugin/README.md")) {
$readme = file_get_contents("addon/$plugin/README.md");
$readme = Markdown($readme, false);
} elseif (is_file("addon/$plugin/README")) {
- $readme = "". file_get_contents("addon/$plugin/README") ."";
+ $readme = "" . file_get_contents("addon/$plugin/README") . "";
}
- $admin_form="";
+ $admin_form = "";
if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)) {
@require_once("addon/$plugin/$plugin.php");
- $func = $plugin.'_plugin_admin';
+ $func = $plugin . '_plugin_admin';
$func($a, $admin_form);
}
- $t = get_markup_template("admin_plugins_details.tpl");
+ $t = get_markup_template('admin/plugins_details.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
@@ -1750,17 +1830,14 @@ function admin_page_plugins(App $a) {
));
}
-
-
/*
* List plugins
*/
-
- if (x($_GET,"a") && $_GET['a']=="r") {
- check_form_security_token_redirectOnErr(System::baseUrl().'/admin/plugins', 'admin_themes', 't');
+ if (x($_GET, "a") && $_GET['a'] == "r") {
+ check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
reload_plugins();
info("Plugins reloaded");
- goaway(System::baseUrl().'/admin/plugins');
+ goaway(System::baseUrl() . '/admin/plugins');
}
$plugins = array();
@@ -1768,12 +1845,12 @@ function admin_page_plugins(App $a) {
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
- list($tmp, $id)=array_map("trim", explode("/",$file));
+ list($tmp, $id) = array_map("trim", explode("/", $file));
$info = get_plugin_info($id);
$show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
- if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
+ if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
$show_plugin = false;
}
@@ -1783,13 +1860,13 @@ function admin_page_plugins(App $a) {
}
if ($show_plugin) {
- $plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
+ $plugins[] = array($id, (in_array($id, $a->plugins) ? "on" : "off"), $info);
}
}
}
}
- $t = get_markup_template("admin_plugins.tpl");
+ $t = get_markup_template('admin/plugins.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Plugins'),
@@ -1809,14 +1886,14 @@ function admin_page_plugins(App $a) {
* @param string $th
* @param int $result
*/
-function toggle_theme(&$themes,$th,&$result) {
- for($x = 0; $x < count($themes); $x ++) {
+function toggle_theme(&$themes, $th, &$result)
+{
+ for ($x = 0; $x < count($themes); $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
$themes[$x]['allowed'] = 0;
$result = 0;
- }
- else {
+ } else {
$themes[$x]['allowed'] = 1;
$result = 1;
}
@@ -1829,13 +1906,13 @@ function toggle_theme(&$themes,$th,&$result) {
* @param string $th
* @return int
*/
-function theme_status($themes,$th) {
- for($x = 0; $x < count($themes); $x ++) {
+function theme_status($themes, $th)
+{
+ for ($x = 0; $x < count($themes); $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
return 1;
- }
- else {
+ } else {
return 0;
}
}
@@ -1843,12 +1920,12 @@ function theme_status($themes,$th) {
return 0;
}
-
/**
* @param array $themes
* @return string
*/
-function rebuild_theme_table($themes) {
+function rebuild_theme_table($themes)
+{
$o = '';
if (count($themes)) {
foreach ($themes as $th) {
@@ -1863,7 +1940,6 @@ function rebuild_theme_table($themes) {
return $o;
}
-
/**
* @brief Themes admin page
*
@@ -1880,10 +1956,10 @@ function rebuild_theme_table($themes) {
* @param App $a
* @return string
*/
-function admin_page_themes(App $a) {
-
- $allowed_themes_str = Config::get('system','allowed_themes');
- $allowed_themes_raw = explode(',',$allowed_themes_str);
+function admin_page_themes(App $a)
+{
+ $allowed_themes_str = Config::get('system', 'allowed_themes');
+ $allowed_themes_raw = explode(',', $allowed_themes_str);
$allowed_themes = array();
if (count($allowed_themes_raw)) {
foreach ($allowed_themes_raw as $x) {
@@ -1900,16 +1976,16 @@ function admin_page_themes(App $a) {
$f = basename($file);
// Is there a style file?
- $theme_files = glob('view/theme/'.$f.'/style.*');
+ $theme_files = glob('view/theme/' . $f . '/style.*');
// If not then quit
if (count($theme_files) == 0) {
continue;
}
- $is_experimental = intval(file_exists($file.'/experimental'));
- $is_supported = 1-(intval(file_exists($file.'/unsupported')));
- $is_allowed = intval(in_array($f,$allowed_themes));
+ $is_experimental = intval(file_exists($file . '/experimental'));
+ $is_supported = 1 - (intval(file_exists($file . '/unsupported')));
+ $is_allowed = intval(in_array($f, $allowed_themes));
if ($is_allowed || $is_supported || Config::get("system", "show_unsupported_themes")) {
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
@@ -1917,7 +1993,7 @@ function admin_page_themes(App $a) {
}
}
- if (! count($themes)) {
+ if (!count($themes)) {
notice(t('No themes found.'));
return '';
}
@@ -1928,38 +2004,40 @@ function admin_page_themes(App $a) {
if ($a->argc == 3) {
$theme = $a->argv[2];
- if (! is_dir("view/theme/$theme")) {
+ if (!is_dir("view/theme/$theme")) {
notice(t("Item not found."));
return '';
}
- if (x($_GET,"a") && $_GET['a']=="t") {
+ if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/themes', 'admin_themes', 't');
// Toggle theme status
- toggle_theme($themes,$theme,$result);
+ toggle_theme($themes, $theme, $result);
$s = rebuild_theme_table($themes);
if ($result) {
install_theme($theme);
- info(sprintf('Theme %s enabled.',$theme));
+ info(sprintf('Theme %s enabled.', $theme));
} else {
uninstall_theme($theme);
- info(sprintf('Theme %s disabled.',$theme));
+ info(sprintf('Theme %s disabled.', $theme));
}
- Config::set('system','allowed_themes',$s);
+ Config::set('system', 'allowed_themes', $s);
goaway('admin/themes');
return ''; // NOTREACHED
}
// display theme details
- require_once('library/markdown.php');
+ require_once 'library/markdown.php';
- if (theme_status($themes,$theme)) {
- $status="on"; $action= t("Disable");
+ if (theme_status($themes, $theme)) {
+ $status = "on";
+ $action = t("Disable");
} else {
- $status="off"; $action= t("Enable");
+ $status = "off";
+ $action = t("Enable");
}
$readme = Null;
@@ -1967,12 +2045,14 @@ function admin_page_themes(App $a) {
$readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme, false);
} elseif (is_file("view/theme/$theme/README")) {
- $readme = "". file_get_contents("view/theme/$theme/README") ."";
+ $readme = "" . file_get_contents("view/theme/$theme/README") . "";
}
$admin_form = "";
if (is_file("view/theme/$theme/config.php")) {
- function __get_theme_admin_form(App $a, $theme) {
+
+ function __get_theme_admin_form(App $a, $theme)
+ {
$orig_theme = $a->theme;
$orig_page = $a->page;
$orig_session_theme = $_SESSION['theme'];
@@ -1981,7 +2061,7 @@ function admin_page_themes(App $a) {
$_SESSION['theme'] = $theme;
- $init = $theme."_init";
+ $init = $theme . "_init";
if (function_exists($init)) {
$init($a);
}
@@ -1998,11 +2078,11 @@ function admin_page_themes(App $a) {
}
$screenshot = array(get_theme_screenshot($theme), t('Screenshot'));
- if (! stristr($screenshot[0],$theme)) {
+ if (!stristr($screenshot[0], $theme)) {
$screenshot = null;
}
- $t = get_markup_template("admin_plugins_details.tpl");
+ $t = get_markup_template('admin/plugins_details.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Themes'),
@@ -2026,8 +2106,8 @@ function admin_page_themes(App $a) {
// reload active themes
- if (x($_GET,"a") && $_GET['a']=="r") {
- check_form_security_token_redirectOnErr(System::baseUrl().'/admin/themes', 'admin_themes', 't');
+ if (x($_GET, "a") && $_GET['a'] == "r") {
+ check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/themes', 'admin_themes', 't');
if ($themes) {
foreach ($themes as $th) {
if ($th['allowed']) {
@@ -2037,7 +2117,7 @@ function admin_page_themes(App $a) {
}
}
info("Themes reloaded");
- goaway(System::baseUrl().'/admin/themes');
+ goaway(System::baseUrl() . '/admin/themes');
}
/*
@@ -2047,12 +2127,11 @@ function admin_page_themes(App $a) {
$xthemes = array();
if ($themes) {
foreach ($themes as $th) {
- $xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
+ $xthemes[] = array($th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
}
}
-
- $t = get_markup_template("admin_plugins.tpl");
+ $t = get_markup_template('admin/plugins.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Themes'),
@@ -2069,23 +2148,23 @@ function admin_page_themes(App $a) {
));
}
-
/**
* @brief Prosesses data send by Logs admin page
*
* @param App $a
*/
-function admin_page_logs_post(App $a) {
- if (x($_POST,"page_logs")) {
+function admin_page_logs_post(App $a)
+{
+ if (x($_POST, "page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
$logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
$debugging = ((x($_POST,'debugging')) ? true : false);
$loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
- Config::set('system','logfile', $logfile);
- Config::set('system','debugging', $debugging);
- Config::set('system','loglevel', $loglevel);
+ Config::set('system', 'logfile', $logfile);
+ Config::set('system', 'debugging', $debugging);
+ Config::set('system', 'loglevel', $loglevel);
}
info(t("Log settings updated."));
@@ -2109,8 +2188,8 @@ function admin_page_logs_post(App $a) {
* @param App $a
* @return string
*/
-function admin_page_logs(App $a) {
-
+function admin_page_logs(App $a)
+{
$log_choices = array(
LOGGER_NORMAL => 'Normal',
LOGGER_TRACE => 'Trace',
@@ -2125,7 +2204,7 @@ function admin_page_logs(App $a) {
$phplogenabled = t('PHP log currently disabled.');
}
- $t = get_markup_template("admin_logs.tpl");
+ $t = get_markup_template('admin/logs.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
@@ -2133,13 +2212,11 @@ function admin_page_logs(App $a) {
'$submit' => t('Save Settings'),
'$clear' => t('Clear'),
'$baseurl' => System::baseUrl(true),
- '$logname' => Config::get('system','logfile'),
-
+ '$logname' => Config::get('system', 'logfile'),
// name, label, value, help string, extra data...
- '$debugging' => array('debugging', t("Enable Debugging"),Config::get('system','debugging'), ""),
- '$logfile' => array('logfile', t("Log file"), Config::get('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
- '$loglevel' => array('loglevel', t("Log level"), Config::get('system','loglevel'), "", $log_choices),
-
+ '$debugging' => array('debugging', t("Enable Debugging"), Config::get('system', 'debugging'), ""),
+ '$logfile' => array('logfile', t("Log file"), Config::get('system', 'logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
+ '$loglevel' => array('loglevel', t("Log level"), Config::get('system', 'loglevel'), "", $log_choices),
'$form_security_token' => get_form_security_token("admin_logs"),
'$phpheader' => t("PHP logging"),
'$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
@@ -2166,9 +2243,10 @@ function admin_page_logs(App $a) {
* @param App $a
* @return string
*/
-function admin_page_viewlogs(App $a) {
- $t = get_markup_template("admin_viewlogs.tpl");
- $f = Config::get('system','logfile');
+function admin_page_viewlogs(App $a)
+{
+ $t = get_markup_template('admin/viewlogs.tpl');
+ $f = Config::get('system', 'logfile');
$data = '';
if (!file_exists($f)) {
@@ -2184,11 +2262,11 @@ function admin_page_viewlogs(App $a) {
if ($size > 5000000 || $size < 0) {
$size = 5000000;
}
- $seek = fseek($fp,0-$size,SEEK_END);
+ $seek = fseek($fp, 0 - $size, SEEK_END);
if ($seek === 0) {
- $data = escape_tags(fread($fp,$size));
- while (! feof($fp)) {
- $data .= escape_tags(fread($fp,4096));
+ $data = escape_tags(fread($fp, $size));
+ while (!feof($fp)) {
+ $data .= escape_tags(fread($fp, 4096));
}
}
}
@@ -2199,7 +2277,7 @@ function admin_page_viewlogs(App $a) {
'$title' => t('Administration'),
'$page' => t('View Logs'),
'$data' => $data,
- '$logname' => Config::get('system','logfile')
+ '$logname' => Config::get('system', 'logfile')
));
}
@@ -2208,11 +2286,11 @@ function admin_page_viewlogs(App $a) {
*
* @param App $a
*/
-function admin_page_features_post(App $a) {
-
+function admin_page_features_post(App $a)
+{
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
- logger('postvars: '.print_r($_POST,true),LOGGER_DATA);
+ logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
$arr = array();
$features = get_features(false);
@@ -2256,8 +2334,8 @@ function admin_page_features_post(App $a) {
* @param App $a
* @return string
*/
-function admin_page_features(App $a) {
-
+function admin_page_features(App $a)
+{
if ((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
$features = get_features(false);
@@ -2265,17 +2343,16 @@ function admin_page_features(App $a) {
foreach ($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
- foreach (array_slice($fdata,1) as $f) {
-
+ foreach (array_slice($fdata, 1) as $f) {
$set = Config::get('feature', $f[0], $f[3]);
$arr[$fname][1][] = array(
- array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'), t('On'))),
- array('featurelock_' .$f[0],sprintf(t('Lock feature %s'),$f[1]),(($f[4] !== false) ? "1" : ''),'',array(t('Off'), t('On')))
+ array('feature_' . $f[0], $f[1], $set, $f[2], array(t('Off'), t('On'))),
+ array('featurelock_' . $f[0], sprintf(t('Lock feature %s'), $f[1]), (($f[4] !== false) ? "1" : ''), '', array(t('Off'), t('On')))
);
}
}
- $tpl = get_markup_template("admin_settings_features.tpl");
+ $tpl = get_markup_template('admin/settings_features.tpl');
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("admin_manage_features"),
'$title' => t('Manage Additional Features'),
diff --git a/src/Object/Contact.php b/src/Object/Contact.php
index 23c3649df..34519401c 100644
--- a/src/Object/Contact.php
+++ b/src/Object/Contact.php
@@ -822,7 +822,33 @@ class Contact extends BaseObject
}
/**
- * @brief Updates the avatar links in a contact only if needed
+ * @brief Blocks a contact
+ *
+ * @param int $uid
+ * @return bool
+ */
+ public static function block($uid)
+ {
+ $return = dba::update('contact', ['blocked' => true], ['id' => $uid]);
+
+ return $return;
+ }
+
+ /**
+ * @brief Unblocks a contact
+ *
+ * @param int $uid
+ * @return bool
+ */
+ public static function unblock($uid)
+ {
+ $return = dba::update('contact', ['blocked' => false], ['id' => $uid]);
+
+ return $return;
+ }
+
+ /**
+ * @brief Updates the avatar links in a contact only if needed
*
* @param string $avatar Link to avatar picture
* @param int $uid User id of contact owner
diff --git a/util/global_community_block.php b/util/global_community_block.php
index cb6789e45..ab586b651 100755
--- a/util/global_community_block.php
+++ b/util/global_community_block.php
@@ -1,6 +1,5 @@
#!/usr/bin/env php
".$argv[0]." https://example.com/profiles/bob\r\n";
+ echo "$> " . $argv[0] . " https://example.com/profiles/bob\r\n";
echo "\r\n";
exit(0);
}
-use Friendica\Database\DBM;
-use Friendica\Network\Probe;
+use Friendica\BaseObject;
+use Friendica\Object\Contact;
require_once 'boot.php';
require_once 'include/dba.php';
require_once 'include/text.php';
-$a = get_app();
-require_once '.htconfig.php';
+$a = get_app();;
+BaseObject::setApp($a);
+
+require_once '.htconfig.php';
dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
-/**
- * 1. make nurl from last parameter
- * 2. check DB (contact) if there is a contact with uid=0 and that nurl, get the ID
- * 3. set the flag hidden=1 for the contact entry with the found ID
- **/
-$net = Probe::uri($argv[1]);
-if (in_array($net['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
- echo 'This account seems not to exist.';
+$contact_id = Contact::getIdForURL($argv[1], 0);
+if (!$contact_id) {
+ echo t('Could not find any contact entry for this URL (%s)', $nurl);
echo "\r\n";
exit(1);
}
-$nurl = normalise_link($net['url']);
-$r = dba::select('contact', array('id'), array('nurl' => $nurl, 'uid' => 0), array('limit' => 1));
-if (DBM::is_result($r)) {
- dba::update('contact', array('blocked' => true), array('id' => $r['id']));
- echo "NOTICE: The account should be blocked from the node now\r\n";
-} else {
- echo "NOTICE: Could not find any entry for this URL (".$nurl.")\r\n";
-}
-
-?>
+Contact::block($contact_id);
+echo t('The contact has been blocked from the node');
+echo "\r\n";
+exit(0);
diff --git a/view/templates/admin_aside.tpl b/view/templates/admin/aside.tpl
similarity index 100%
rename from view/templates/admin_aside.tpl
rename to view/templates/admin/aside.tpl
diff --git a/view/templates/admin_blocklist.tpl b/view/templates/admin/blocklist.tpl
similarity index 100%
rename from view/templates/admin_blocklist.tpl
rename to view/templates/admin/blocklist.tpl
diff --git a/view/templates/admin/contactblock.tpl b/view/templates/admin/contactblock.tpl
new file mode 100644
index 000000000..152550f01
--- /dev/null
+++ b/view/templates/admin/contactblock.tpl
@@ -0,0 +1,63 @@
+
+
+ {{$title}} - {{$page}}
+ {{$description}}
+
+
+ {{$h_newblock}}
+
+
diff --git a/view/templates/admin_deleteitem.tpl b/view/templates/admin/deleteitem.tpl
similarity index 100%
rename from view/templates/admin_deleteitem.tpl
rename to view/templates/admin/deleteitem.tpl
diff --git a/view/templates/admin_federation.tpl b/view/templates/admin/federation.tpl
similarity index 100%
rename from view/templates/admin_federation.tpl
rename to view/templates/admin/federation.tpl
diff --git a/view/templates/admin_logs.tpl b/view/templates/admin/logs.tpl
similarity index 100%
rename from view/templates/admin_logs.tpl
rename to view/templates/admin/logs.tpl
diff --git a/view/templates/admin_plugins.tpl b/view/templates/admin/plugins.tpl
similarity index 100%
rename from view/templates/admin_plugins.tpl
rename to view/templates/admin/plugins.tpl
diff --git a/view/templates/admin_plugins_details.tpl b/view/templates/admin/plugins_details.tpl
similarity index 100%
rename from view/templates/admin_plugins_details.tpl
rename to view/templates/admin/plugins_details.tpl
diff --git a/view/templates/admin_queue.tpl b/view/templates/admin/queue.tpl
similarity index 100%
rename from view/templates/admin_queue.tpl
rename to view/templates/admin/queue.tpl
diff --git a/view/templates/admin_settings_features.tpl b/view/templates/admin/settings_features.tpl
similarity index 100%
rename from view/templates/admin_settings_features.tpl
rename to view/templates/admin/settings_features.tpl
diff --git a/view/templates/admin_settings_head.tpl b/view/templates/admin/settings_head.tpl
similarity index 100%
rename from view/templates/admin_settings_head.tpl
rename to view/templates/admin/settings_head.tpl
diff --git a/view/templates/admin_site.tpl b/view/templates/admin/site.tpl
similarity index 100%
rename from view/templates/admin_site.tpl
rename to view/templates/admin/site.tpl
diff --git a/view/templates/admin_summary.tpl b/view/templates/admin/summary.tpl
similarity index 100%
rename from view/templates/admin_summary.tpl
rename to view/templates/admin/summary.tpl
diff --git a/view/templates/admin_users.tpl b/view/templates/admin/users.tpl
similarity index 100%
rename from view/templates/admin_users.tpl
rename to view/templates/admin/users.tpl
diff --git a/view/templates/admin_viewlogs.tpl b/view/templates/admin/viewlogs.tpl
similarity index 100%
rename from view/templates/admin_viewlogs.tpl
rename to view/templates/admin/viewlogs.tpl
diff --git a/view/theme/frio/js/mod_admin.js b/view/theme/frio/js/mod_admin.js
new file mode 100644
index 000000000..b9fc46781
--- /dev/null
+++ b/view/theme/frio/js/mod_admin.js
@@ -0,0 +1,31 @@
+/**
+ * @brief Javascript for the admin module
+ */
+$(function() {
+ $('body').on('click', '.selectall', function() {
+ selectall($(this).data('selectAll'));
+ });
+ $('body').on('click', '.selectnone', function() {
+ selectnone($(this).data('selectNone'));
+ });
+
+ $('body').on('change', 'input[type=checkbox].select', function() {
+ $this = $(this);
+ if ($this.prop('checked')) {
+ selectall($this.data('selectClass'));
+ $this.attr('title', $this.data('selectNone'));
+ } else {
+ selectnone($this.data('selectClass'));
+ $this.attr('title', $this.data('selectAll'));
+ }
+ });
+
+ function selectall(cls) {
+ $('.' + cls).prop('checked', true);
+ return false;
+ }
+ function selectnone(cls) {
+ $('.' + cls).prop('checked', false);
+ return false;
+ }
+});
diff --git a/view/theme/frio/templates/admin_aside.tpl b/view/theme/frio/templates/admin/aside.tpl
similarity index 100%
rename from view/theme/frio/templates/admin_aside.tpl
rename to view/theme/frio/templates/admin/aside.tpl
diff --git a/view/theme/frio/templates/admin/contactblock.tpl b/view/theme/frio/templates/admin/contactblock.tpl
new file mode 100644
index 000000000..f330854bc
--- /dev/null
+++ b/view/theme/frio/templates/admin/contactblock.tpl
@@ -0,0 +1,60 @@
+
+
+ {{$title}} - {{$page}}
+ {{$description}}
+
+
+ {{$h_newblock}}
+
+
diff --git a/view/theme/frost-mobile/templates/admin_aside.tpl b/view/theme/frost-mobile/templates/admin/aside.tpl
similarity index 100%
rename from view/theme/frost-mobile/templates/admin_aside.tpl
rename to view/theme/frost-mobile/templates/admin/aside.tpl
diff --git a/view/theme/frost-mobile/templates/admin_site.tpl b/view/theme/frost-mobile/templates/admin/site.tpl
similarity index 100%
rename from view/theme/frost-mobile/templates/admin_site.tpl
rename to view/theme/frost-mobile/templates/admin/site.tpl
diff --git a/view/theme/frost-mobile/templates/admin_users.tpl b/view/theme/frost-mobile/templates/admin/users.tpl
similarity index 100%
rename from view/theme/frost-mobile/templates/admin_users.tpl
rename to view/theme/frost-mobile/templates/admin/users.tpl
diff --git a/view/theme/frost/templates/admin_aside.tpl b/view/theme/frost/templates/admin/aside.tpl
similarity index 100%
rename from view/theme/frost/templates/admin_aside.tpl
rename to view/theme/frost/templates/admin/aside.tpl
diff --git a/view/theme/frost/templates/admin_site.tpl b/view/theme/frost/templates/admin/site.tpl
similarity index 100%
rename from view/theme/frost/templates/admin_site.tpl
rename to view/theme/frost/templates/admin/site.tpl
diff --git a/view/theme/frost/templates/admin_users.tpl b/view/theme/frost/templates/admin/users.tpl
similarity index 100%
rename from view/theme/frost/templates/admin_users.tpl
rename to view/theme/frost/templates/admin/users.tpl
diff --git a/view/theme/quattro/templates/admin_users.tpl b/view/theme/quattro/templates/admin/users.tpl
similarity index 100%
rename from view/theme/quattro/templates/admin_users.tpl
rename to view/theme/quattro/templates/admin/users.tpl