Merge remote-tracking branch 'upstream/develop' into item-permissions

This commit is contained in:
Michael 2018-01-20 19:51:23 +00:00
commit 745bc7cf3f
117 changed files with 1336 additions and 1249 deletions

View file

@ -8,8 +8,10 @@
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
@ -56,16 +58,16 @@ function admin_post(App $a)
case 'users':
admin_page_users_post($a);
break;
case 'plugins':
case 'addons':
if ($a->argc > 2 &&
is_file("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php")) {
@include_once("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php");
if (function_exists($a->argv[2] . '_plugin_admin_post')) {
$func = $a->argv[2] . '_plugin_admin_post';
if (function_exists($a->argv[2] . '_addon_admin_post')) {
$func = $a->argv[2] . '_addon_admin_post';
$func($a);
}
}
$return_path = 'admin/plugins/' . $a->argv[2];
$return_path = 'admin/addons/' . $a->argv[2];
break;
case 'themes':
if ($a->argc < 2) {
@ -170,7 +172,7 @@ function admin_content(App $a)
$aside_sub = [
'site' => ["admin/site/" , t("Site") , "site"],
'users' => ["admin/users/" , t("Users") , "users"],
'plugins' => ["admin/plugins/" , t("Plugins") , "plugins"],
'addons' => ["admin/addons/" , t("Addons") , "addons"],
'themes' => ["admin/themes/" , t("Themes") , "themes"],
'features' => ["admin/features/" , t("Additional features") , "features"],
'dbsync' => ["admin/dbsync/" , t('DB updates') , "dbsync"],
@ -181,15 +183,15 @@ function admin_content(App $a)
'deleteitem' => ["admin/deleteitem/" , t('Delete Item') , 'deleteitem'],
];
/* get plugins admin page */
/* get addons admin page */
$r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
$aside_tools['plugins_admin'] = [];
$aside_tools['addons_admin'] = [];
foreach ($r as $h) {
$plugin = $h['name'];
$aside_tools['plugins_admin'][] = ["admin/plugins/" . $plugin, $plugin, "plugin"];
// temp plugins with admin
$a->plugins_admin[] = $plugin;
$addon = $h['name'];
$aside_tools['addons_admin'][] = ["admin/addons/" . $addon, $addon, "addon"];
// temp addons with admin
$a->addons_admin[] = $addon;
}
$aside_tools['logs'] = ["admin/logs/", t("Logs"), "logs"];
@ -202,7 +204,7 @@ function admin_content(App $a)
'$admin' => $aside_tools,
'$subpages' => $aside_sub,
'$admtxt' => t('Admin'),
'$plugadmtxt' => t('Plugin Features'),
'$plugadmtxt' => t('Addon Features'),
'$logtxt' => t('Logs'),
'$diagnosticstxt' => t('diagnostics'),
'$h_pending' => t('User registrations waiting for confirmation'),
@ -220,8 +222,8 @@ function admin_content(App $a)
case 'users':
$o = admin_page_users($a);
break;
case 'plugins':
$o = admin_page_plugins($a);
case 'addons':
$o = admin_page_addons($a);
break;
case 'themes':
$o = admin_page_themes($a);
@ -779,7 +781,7 @@ function admin_page_summary(App $a)
'$platform' => FRIENDICA_PLATFORM,
'$codename' => FRIENDICA_CODENAME,
'$build' => Config::get('system', 'build'),
'$plugins' => [t('Active plugins'), $a->plugins],
'$addons' => [t('Active addons'), $a->addons],
'$showwarning' => $showwarning,
'$warningtext' => $warningtext
]);
@ -1723,54 +1725,54 @@ function admin_page_users(App $a)
}
/**
* @brief Plugins admin page
* @brief Addons admin page
*
* This function generates the admin panel page for managing plugins on the
* friendica node. If a plugin name is given a single page showing the details
* This function generates the admin panel page for managing addons on the
* friendica node. If an addon name is given a single page showing the details
* for this addon is generated. If no name is given, a list of available
* plugins is shown.
* addons is shown.
*
* The template used for displaying the list of plugins and the details of the
* plugin are the same as used for the templates.
* The template used for displaying the list of addons and the details of the
* addon are the same as used for the templates.
*
* The returned string returned hulds the HTML code of the page.
*
* @param App $a
* @return string
*/
function admin_page_plugins(App $a)
function admin_page_addons(App $a)
{
/*
* Single plugin
* Single addon
*/
if ($a->argc == 3) {
$plugin = $a->argv[2];
if (!is_file("addon/$plugin/$plugin.php")) {
$addon = $a->argv[2];
if (!is_file("addon/$addon/$addon.php")) {
notice(t("Item not found."));
return '';
}
if (x($_GET, "a") && $_GET['a'] == "t") {
check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
check_form_security_token_redirectOnErr('/admin/addons', 'admin_themes', 't');
// Toggle plugin status
$idx = array_search($plugin, $a->plugins);
// Toggle addon status
$idx = array_search($addon, $a->addons);
if ($idx !== false) {
unset($a->plugins[$idx]);
uninstall_plugin($plugin);
info(t("Plugin %s disabled.", $plugin));
unset($a->addons[$idx]);
Addon::uninstall($addon);
info(t("Addon %s disabled.", $addon));
} else {
$a->plugins[] = $plugin;
install_plugin($plugin);
info(t("Plugin %s enabled.", $plugin));
$a->addons[] = $addon;
Addon::install($addon);
info(t("Addon %s enabled.", $addon));
}
Config::set("system", "addon", implode(", ", $a->plugins));
goaway('admin/plugins');
Config::set("system", "addon", implode(", ", $a->addons));
goaway('admin/addons');
return ''; // NOTREACHED
}
// display plugin details
if (in_array($plugin, $a->plugins)) {
// display addon details
if (in_array($addon, $a->addons)) {
$status = "on";
$action = t("Disable");
} else {
@ -1779,16 +1781,16 @@ function admin_page_plugins(App $a)
}
$readme = Null;
if (is_file("addon/$plugin/README.md")) {
$readme = Markdown::convert(file_get_contents("addon/$plugin/README.md"), false);
} elseif (is_file("addon/$plugin/README")) {
$readme = "<pre>" . file_get_contents("addon/$plugin/README") . "</pre>";
if (is_file("addon/$addon/README.md")) {
$readme = Markdown::convert(file_get_contents("addon/$addon/README.md"), false);
} elseif (is_file("addon/$addon/README")) {
$readme = "<pre>" . file_get_contents("addon/$addon/README") . "</pre>";
}
$admin_form = "";
if (in_array($plugin, $a->plugins_admin)) {
@require_once("addon/$plugin/$plugin.php");
$func = $plugin . '_plugin_admin';
if (in_array($addon, $a->addons_admin)) {
@require_once("addon/$addon/$addon.php");
$func = $addon . '_addon_admin';
$func($a, $admin_form);
}
@ -1796,20 +1798,20 @@ function admin_page_plugins(App $a)
return replace_macros($t, [
'$title' => t('Administration'),
'$page' => t('Plugins'),
'$page' => t('Addons'),
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
'$baseurl' => System::baseUrl(true),
'$plugin' => $plugin,
'$addon' => $addon,
'$status' => $status,
'$action' => $action,
'$info' => get_plugin_info($plugin),
'$info' => Addon::getInfo($addon),
'$str_author' => t('Author: '),
'$str_maintainer' => t('Maintainer: '),
'$admin_form' => $admin_form,
'$function' => 'plugins',
'$function' => 'addons',
'$screenshot' => '',
'$readme' => $readme,
@ -1818,52 +1820,52 @@ function admin_page_plugins(App $a)
}
/*
* List plugins
* List addons
*/
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');
check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/addons', 'admin_themes', 't');
Addon::reload();
info("Addons reloaded");
goaway(System::baseUrl() . '/admin/addons');
}
$plugins = [];
$addons = [];
$files = glob("addon/*/");
if (is_array($files)) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id) = array_map("trim", explode("/", $file));
$info = get_plugin_info($id);
$show_plugin = true;
$info = Addon::getInfo($id);
$show_addon = true;
// If the addon is unsupported, then only show it, when it is enabled
if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
$show_plugin = false;
if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->addons)) {
$show_addon = false;
}
// Override the above szenario, when the admin really wants to see outdated stuff
if (Config::get("system", "show_unsupported_addons")) {
$show_plugin = true;
$show_addon = true;
}
if ($show_plugin) {
$plugins[] = [$id, (in_array($id, $a->plugins) ? "on" : "off"), $info];
if ($show_addon) {
$addons[] = [$id, (in_array($id, $a->addons) ? "on" : "off"), $info];
}
}
}
}
$t = get_markup_template('admin/plugins.tpl');
$t = get_markup_template('admin/addons.tpl');
return replace_macros($t, [
'$title' => t('Administration'),
'$page' => t('Plugins'),
'$page' => t('Addons'),
'$submit' => t('Save Settings'),
'$reload' => t('Reload active plugins'),
'$reload' => t('Reload active addons'),
'$baseurl' => System::baseUrl(true),
'$function' => 'plugins',
'$plugins' => $plugins,
'$pcount' => count($plugins),
'$noplugshint' => t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
'$function' => 'addons',
'$addons' => $addons,
'$pcount' => count($addons),
'$noplugshint' => t('There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addon registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
'$form_security_token' => get_form_security_token("admin_themes"),
]);
}
@ -1938,7 +1940,7 @@ function rebuild_theme_table($themes)
* themes is generated.
*
* The template used for displaying the list of themes and the details of the
* themes are the same as used for the plugins.
* themes are the same as used for the addons.
*
* The returned string contains the HTML code of the admin panel page.
*
@ -2006,10 +2008,10 @@ function admin_page_themes(App $a)
toggle_theme($themes, $theme, $result);
$s = rebuild_theme_table($themes);
if ($result) {
install_theme($theme);
Theme::install($theme);
info(sprintf('Theme %s enabled.', $theme));
} else {
uninstall_theme($theme);
Theme::uninstall($theme);
info(sprintf('Theme %s disabled.', $theme));
}
@ -2057,7 +2059,7 @@ function admin_page_themes(App $a)
$a->page = $orig_page;
}
$screenshot = [get_theme_screenshot($theme), t('Screenshot')];
$screenshot = [Theme::getScreenshot($theme), t('Screenshot')];
if (!stristr($screenshot[0], $theme)) {
$screenshot = null;
}
@ -2069,10 +2071,10 @@ function admin_page_themes(App $a)
'$toggle' => t('Toggle'),
'$settings' => t('Settings'),
'$baseurl' => System::baseUrl(true),
'$plugin' => $theme,
'$addon' => $theme,
'$status' => $status,
'$action' => $action,
'$info' => get_theme_info($theme),
'$info' => Theme::getInfo($theme),
'$function' => 'themes',
'$admin_form' => $admin_form,
'$str_author' => t('Author: '),
@ -2084,14 +2086,13 @@ 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');
foreach ($themes as $th) {
if ($th['allowed']) {
uninstall_theme($th['name']);
install_theme($th['name']);
Theme::uninstall($th['name']);
Theme::install($th['name']);
}
}
info("Themes reloaded");
@ -2102,12 +2103,12 @@ function admin_page_themes(App $a)
* List themes
*/
$plugins = [];
$addons = [];
foreach ($themes as $th) {
$plugins[] = [$th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name'])];
$addons[] = [$th['name'], (($th['allowed']) ? "on" : "off"), Theme::getInfo($th['name'])];
}
$t = get_markup_template('admin/plugins.tpl');
$t = get_markup_template('admin/addons.tpl');
return replace_macros($t, [
'$title' => t('Administration'),
'$page' => t('Themes'),
@ -2115,7 +2116,7 @@ function admin_page_themes(App $a)
'$reload' => t('Reload active themes'),
'$baseurl' => System::baseUrl(true),
'$function' => 'themes',
'$plugins' => $plugins,
'$addons' => $addons,
'$pcount' => count($themes),
'$noplugshint' => t('No themes found on the system. They should be placed in %1$s', '<code>/view/themes</code>'),
'$experimental' => t('[Experimental]'),

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -173,7 +174,7 @@ function contacts_post(App $a)
return; // NOTREACHED
}
call_hooks('contact_edit_post', $_POST);
Addon::callHooks('contact_edit_post', $_POST);
$profile_id = intval($_POST['profile-assign']);
if ($profile_id) {
@ -662,7 +663,7 @@ function contacts_content(App $a)
$arr = ['contact' => $contact, 'output' => $o];
call_hooks('contact_edit', $arr);
Addon::callHooks('contact_edit', $arr);
return $arr['output'];
}

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
@ -174,7 +175,7 @@ function directory_content(App $a) {
$arr = ['contact' => $rr, 'entry' => $entry];
call_hooks('directory_item', $arr);
Addon::callHooks('directory_item', $arr);
unset($profile);
unset($location);

View file

@ -4,6 +4,7 @@
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
@ -94,8 +95,8 @@ function editpost_content(App $a) {
call_hooks('jot_tool', $jotplugins);
//call_hooks('jot_networks', $jotnets);
Addon::callHooks('jot_tool', $jotplugins);
//Addon::callHooks('jot_networks', $jotnets);
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Database\DBM;
@ -25,12 +26,12 @@ function friendica_init(App $a) {
$admin = false;
}
$visible_plugins = [];
if (is_array($a->plugins) && count($a->plugins)) {
$visible_addons = [];
if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (DBM::is_result($r)) {
foreach($r as $rr) {
$visible_plugins[] = $rr['name'];
$visible_addons[] = $rr['name'];
}
}
}
@ -50,7 +51,7 @@ function friendica_init(App $a) {
$data = [
'version' => FRIENDICA_VERSION,
'url' => System::baseUrl(),
'plugins' => $visible_plugins,
'addons' => $visible_addons,
'locked_features' => $locked_features,
'register_policy' => $register_policy[$a->config['register_policy']],
'admin' => $admin,
@ -83,19 +84,19 @@ function friendica_content(App $a) {
$o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
$o .= '</p>' . PHP_EOL;
$visible_plugins = [];
if (is_array($a->plugins) && count($a->plugins)) {
$visible_addons = [];
if (is_array($a->addons) && count($a->addons)) {
$r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
if (DBM::is_result($r)) {
foreach($r as $rr) {
$visible_plugins[] = $rr['name'];
$visible_addons[] = $rr['name'];
}
}
}
if (count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
$sorted = $visible_plugins;
if (count($visible_addons)) {
$o .= '<p>' . t('Installed addons/addons/apps:') . '</p>' . PHP_EOL;
$sorted = $visible_addons;
$s = '';
sort($sorted);
foreach ($sorted as $p) {
@ -108,7 +109,7 @@ function friendica_content(App $a) {
}
$o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
} else {
$o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
$o .= '<p>' . t('No installed addons/addons/apps') . '</p>' . PHP_EOL;
}
$blocklist = Config::get('system', 'blocklist');
@ -121,7 +122,7 @@ function friendica_content(App $a) {
$o .= '</tbody></table></div>' . PHP_EOL;
}
call_hooks('about_hook', $o);
Addon::callHooks('about_hook', $o);
return $o;
}

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Module\Login;
@ -9,7 +10,7 @@ if(! function_exists('home_init')) {
function home_init(App $a) {
$ret = [];
call_hooks('home_init',$ret);
Addon::callHooks('home_init',$ret);
if (local_user() && ($a->user['nickname'])) {
goaway(System::baseUrl()."/network");
@ -46,7 +47,7 @@ function home_content(App $a) {
$login = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
$content = '';
call_hooks("home_content",$content);
Addon::callHooks("home_content",$content);
$tpl = get_markup_template('home.tpl');

View file

@ -15,6 +15,7 @@
* information.
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -50,7 +51,8 @@ function item_post(App $a) {
killme();
}
call_hooks('post_local_start', $_REQUEST);
Addon::callHooks('post_local_start', $_REQUEST);
logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA);
$api_source = defaults($_REQUEST, 'api_source', false);
@ -637,7 +639,7 @@ function item_post(App $a) {
$datarray['object'] = $object;
/*
* These fields are for the convenience of plugins...
* These fields are for the convenience of addons...
* 'self' if true indicates the owner is posting on their own wall
* If parent is 0 it is a top-level post.
*/
@ -679,10 +681,10 @@ function item_post(App $a) {
killme();
}
call_hooks('post_local',$datarray);
Addon::callHooks('post_local',$datarray);
if (x($datarray, 'cancel')) {
logger('mod_item: post cancelled by plugin.');
logger('mod_item: post cancelled by addon.');
if ($return_path) {
goaway($return_path);
}
@ -792,7 +794,7 @@ function item_post(App $a) {
}
}
call_hooks('post_local_end', $datarray);
Addon::callHooks('post_local_end', $datarray);
if (strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc);

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Database\DBM;
function lockview_content(App $a) {
@ -28,7 +29,7 @@ function lockview_content(App $a) {
}
$item = $r[0];
call_hooks('lockview_content', $item);
Addon::callHooks('lockview_content', $item);
if($item['uid'] != local_user()) {
echo t('Remote privacy information not available.') . '<br />';

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Database\DBM;
@ -91,7 +92,7 @@ function manage_post(App $a) {
}
$ret = [];
call_hooks('home_init',$ret);
Addon::callHooks('home_init',$ret);
goaway( System::baseUrl() . "/profile/" . $a->user['nickname'] );
// NOTREACHED

View file

@ -7,6 +7,7 @@ use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Content\Nav;
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
@ -388,7 +389,7 @@ function network_content(App $a, $update = 0) {
/// @TODO Is this really necessary? $a is already available to hooks
$arr = ['query' => $a->query_string];
call_hooks('network_content_init', $arr);
Addon::callHooks('network_content_init', $arr);
$nouveau = false;
@ -1006,7 +1007,7 @@ function network_tabs(App $a)
}
$arr = ['tabs' => $tabs];
call_hooks('network_tabs', $arr);
Addon::callHooks('network_tabs', $arr);
$tpl = get_markup_template('common_tabs.tpl');

View file

@ -6,11 +6,10 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
require_once 'include/plugin.php';
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
'href' => System::baseUrl().'/nodeinfo/1.0']]];
@ -72,48 +71,48 @@ function nodeinfo_init(App $a) {
$nodeinfo['usage']['localPosts'] = (int)Config::get('nodeinfo', 'local_posts');
$nodeinfo['usage']['localComments'] = (int)Config::get('nodeinfo', 'local_comments');
if (plugin_enabled('appnet')) {
if (Addon::isEnabled('appnet')) {
$nodeinfo['services']['inbound'][] = 'appnet';
}
if (plugin_enabled('appnet') || plugin_enabled('buffer')) {
if (Addon::isEnabled('appnet') || Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'appnet';
}
if (plugin_enabled('blogger')) {
if (Addon::isEnabled('blogger')) {
$nodeinfo['services']['outbound'][] = 'blogger';
}
if (plugin_enabled('dwpost')) {
if (Addon::isEnabled('dwpost')) {
$nodeinfo['services']['outbound'][] = 'dreamwidth';
}
if (plugin_enabled('fbpost') || plugin_enabled('buffer')) {
if (Addon::isEnabled('fbpost') || Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'facebook';
}
if (plugin_enabled('statusnet')) {
if (Addon::isEnabled('statusnet')) {
$nodeinfo['services']['inbound'][] = 'gnusocial';
$nodeinfo['services']['outbound'][] = 'gnusocial';
}
if (plugin_enabled('gpluspost') || plugin_enabled('buffer')) {
if (Addon::isEnabled('gpluspost') || Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'google';
}
if (plugin_enabled('ijpost')) {
if (Addon::isEnabled('ijpost')) {
$nodeinfo['services']['outbound'][] = 'insanejournal';
}
if (plugin_enabled('libertree')) {
if (Addon::isEnabled('libertree')) {
$nodeinfo['services']['outbound'][] = 'libertree';
}
if (plugin_enabled('buffer')) {
if (Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'linkedin';
}
if (plugin_enabled('ljpost')) {
if (Addon::isEnabled('ljpost')) {
$nodeinfo['services']['outbound'][] = 'livejournal';
}
if (plugin_enabled('buffer')) {
if (Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'pinterest';
}
if (plugin_enabled('posterous')) {
if (Addon::isEnabled('posterous')) {
$nodeinfo['services']['outbound'][] = 'posterous';
}
if (plugin_enabled('pumpio')) {
if (Addon::isEnabled('pumpio')) {
$nodeinfo['services']['inbound'][] = 'pumpio';
$nodeinfo['services']['outbound'][] = 'pumpio';
}
@ -121,13 +120,13 @@ function nodeinfo_init(App $a) {
if ($smtp) {
$nodeinfo['services']['outbound'][] = 'smtp';
}
if (plugin_enabled('tumblr')) {
if (Addon::isEnabled('tumblr')) {
$nodeinfo['services']['outbound'][] = 'tumblr';
}
if (plugin_enabled('twitter') || plugin_enabled('buffer')) {
if (Addon::isEnabled('twitter') || Addon::isEnabled('buffer')) {
$nodeinfo['services']['outbound'][] = 'twitter';
}
if (plugin_enabled('wppost')) {
if (Addon::isEnabled('wppost')) {
$nodeinfo['services']['outbound'][] = 'wordpress';
}
$nodeinfo['metadata']['protocols'] = $nodeinfo['protocols'];
@ -137,7 +136,7 @@ function nodeinfo_init(App $a) {
$nodeinfo['metadata']['services'] = $nodeinfo['services'];
if (plugin_enabled('twitter')) {
if (Addon::isEnabled('twitter')) {
$nodeinfo['metadata']['services']['inbound'][] = 'twitter';
}
}
@ -153,22 +152,22 @@ function nodeinfo_cron() {
$a = get_app();
// If the plugin 'statistics_json' is enabled then disable it and actrivate nodeinfo.
if (plugin_enabled('statistics_json')) {
// If the addon 'statistics_json' is enabled then disable it and actrivate nodeinfo.
if (Addon::isEnabled('statistics_json')) {
Config::set('system', 'nodeinfo', true);
$plugin = 'statistics_json';
$plugins = Config::get('system', 'addon');
$plugins_arr = [];
$addon = 'statistics_json';
$addons = Config::get('system', 'addon');
$addons_arr = [];
if ($plugins) {
$plugins_arr = explode(',',str_replace(' ', '',$plugins));
if ($addons) {
$addons_arr = explode(',',str_replace(' ', '',$addons));
$idx = array_search($plugin, $plugins_arr);
$idx = array_search($addon, $addons_arr);
if ($idx !== false) {
unset($plugins_arr[$idx]);
uninstall_plugin($plugin);
Config::set('system', 'addon', implode(', ',$plugins_arr));
unset($addons_arr[$idx]);
Addon::uninstall($addon);
Config::set('system', 'addon', implode(', ',$addons_arr));
}
}
}

View file

@ -14,8 +14,6 @@ function nogroup_init(App $a)
return;
}
require_once 'include/contact_widgets.php';
if (! x($a->page, 'aside')) {
$a->page['aside'] = '';
}

View file

@ -11,6 +11,7 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Util\ParseUrl;
require_once("include/items.php");
@ -91,7 +92,7 @@ function parse_url_content(App $a) {
$arr = ["url" => $url, "text" => ""];
call_hooks("parse_link", $arr);
Addon::callHooks("parse_link", $arr);
if (strlen($arr["text"])) {
echo $arr["text"];

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
@ -720,7 +721,7 @@ function photos_post(App $a)
// default post action - upload a photo
call_hooks('photo_post_init', $_POST);
Addon::callHooks('photo_post_init', $_POST);
// Determine the album to use
$album = x($_REQUEST, 'album') ? notags(trim($_REQUEST['album'])) : '';
@ -770,7 +771,7 @@ function photos_post(App $a)
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
call_hooks('photo_post_file', $ret);
Addon::callHooks('photo_post_file', $ret);
if (x($ret, 'src') && x($ret, 'filesize')) {
$src = $ret['src'];
@ -808,7 +809,7 @@ function photos_post(App $a)
}
@unlink($src);
$foo = 0;
call_hooks('photo_post_end', $foo);
Addon::callHooks('photo_post_end', $foo);
return;
}
@ -824,7 +825,7 @@ function photos_post(App $a)
notice(t('Image exceeds size limit of %s', formatBytes($maximagesize)) . EOL);
@unlink($src);
$foo = 0;
call_hooks('photo_post_end', $foo);
Addon::callHooks('photo_post_end', $foo);
return;
}
@ -832,7 +833,7 @@ function photos_post(App $a)
notice(t('Image file is empty.') . EOL);
@unlink($src);
$foo = 0;
call_hooks('photo_post_end', $foo);
Addon::callHooks('photo_post_end', $foo);
return;
}
@ -847,7 +848,7 @@ function photos_post(App $a)
notice(t('Unable to process image.') . EOL);
@unlink($src);
$foo = 0;
call_hooks('photo_post_end',$foo);
Addon::callHooks('photo_post_end',$foo);
killme();
}
@ -937,7 +938,7 @@ function photos_post(App $a)
Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id);
}
call_hooks('photo_post_end', intval($item_id));
Addon::callHooks('photo_post_end', intval($item_id));
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
// if they do not wish to be redirected
@ -1103,7 +1104,7 @@ function photos_content(App $a)
'addon_text' => $uploader,
'default_upload' => true];
call_hooks('photo_upload_form',$ret);
Addon::callHooks('photo_upload_form',$ret);
$default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []);
$default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\System;
use Friendica\Core\PConfig;
@ -138,7 +139,7 @@ function ping_init(App $a)
if (DBM::is_result($items_unseen)) {
$arr = ['items' => $items_unseen];
call_hooks('network_ping', $arr);
Addon::callHooks('network_ping', $arr);
foreach ($items_unseen as $item) {
if ($item['wall']) {

View file

@ -7,7 +7,7 @@
* If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb.
* parent is a special argument which let's you attach this activity as a comment to an existing conversation, which
* may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the more pokes
* plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
* addon version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
*
* private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
*
@ -15,6 +15,7 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -142,7 +143,7 @@ function poke_init(App $a) {
}
call_hooks('post_local_end', $arr);
Addon::callHooks('post_local_end', $arr);
Worker::add(PRIORITY_HIGH, "Notifier", "like", $post_id);

View file

@ -1,12 +1,13 @@
<?php
use Friendica\App;
use Friendica\Core\Theme;
function pretheme_init(App $a) {
if ($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
$info = get_theme_info($theme);
$info = Theme::getInfo($theme);
if ($info) {
// unfortunately there will be no translation for this string
$desc = $info['description'];
@ -17,7 +18,7 @@ function pretheme_init(App $a) {
$version = '';
$credits = '';
}
echo json_encode(['img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits]);
echo json_encode(['img' => Theme::getScreenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits]);
}
killme();

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Content\Nav;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -180,7 +181,7 @@ function profile_content(App $a, $update = 0)
if ($tab === 'profile') {
$o .= Profile::getAdvanced($a);
call_hooks('profile_advanced', $o);
Addon::callHooks('profile_advanced', $o);
return $o;
}

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -178,7 +179,7 @@ function profiles_post(App $a) {
$namechanged = false;
call_hooks('profile_post', $_POST);
Addon::callHooks('profile_post', $_POST);
if (($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -743,7 +744,7 @@ function profiles_content(App $a) {
]);
$arr = ['profile' => $r[0], 'entry' => $o];
call_hooks('profile_edit', $arr);
Addon::callHooks('profile_edit', $arr);
return $o;
} else {

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -20,7 +21,7 @@ function register_post(App $a)
$blocked = 1;
$arr = ['post' => $_POST];
call_hooks('register_post', $arr);
Addon::callHooks('register_post', $arr);
$max_dailies = intval(Config::get('system', 'max_daily_registrations'));
if ($max_dailies) {
@ -241,7 +242,7 @@ function register_content(App $a)
$arr = ['template' => $tpl];
call_hooks('register_form', $arr);
Addon::callHooks('register_form', $arr);
$tpl = $arr['template'];

View file

@ -5,6 +5,7 @@
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Core\Config;
@ -76,7 +77,7 @@ function settings_init(App $a)
];
$tabs[] = [
'label' => t('Plugins'),
'label' => t('Addons'),
'url' => 'settings/addon',
'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
'accesskey' => 'l',
@ -169,23 +170,25 @@ function settings_post(App $a)
icon='%s',
uid=%d
WHERE client_id='%s'",
dbesc($key),
dbesc($secret),
dbesc($name),
dbesc($redirect),
dbesc($icon),
local_user(),
dbesc($key));
dbesc($key),
dbesc($secret),
dbesc($name),
dbesc($redirect),
dbesc($icon),
local_user(),
dbesc($key)
);
} else {
q("INSERT INTO clients
(client_id, pw, name, redirect_uri, icon, uid)
VALUES ('%s', '%s', '%s', '%s', '%s',%d)",
dbesc($key),
dbesc($secret),
dbesc($name),
dbesc($redirect),
dbesc($icon),
local_user());
dbesc($key),
dbesc($secret),
dbesc($name),
dbesc($redirect),
dbesc($icon),
local_user()
);
}
}
goaway(System::baseUrl(true)."/settings/oauth/");
@ -195,12 +198,12 @@ function settings_post(App $a)
if (($a->argc > 1) && ($a->argv[1] == 'addon')) {
check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
call_hooks('plugin_settings_post', $_POST);
Addon::callHooks('addon_settings_post', $_POST);
return;
}
if (($a->argc > 1) && ($a->argv[1] == 'connectors')) {
if (($a->argc > 1) && ($a->argv[1] == 'connectors'))
{
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if (x($_POST, 'general-submit')) {
@ -277,7 +280,7 @@ function settings_post(App $a)
}
}
call_hooks('connector_settings_post', $_POST);
Addon::callHooks('connector_settings_post', $_POST);
return;
}
@ -351,7 +354,7 @@ function settings_post(App $a)
intval(local_user())
);
call_hooks('display_settings_post', $_POST);
Addon::callHooks('display_settings_post', $_POST);
goaway('settings/display');
return; // NOTREACHED
}
@ -364,7 +367,7 @@ function settings_post(App $a)
goaway('settings');
}
call_hooks('settings_post', $_POST);
Addon::callHooks('settings_post', $_POST);
if (x($_POST, 'password') || x($_POST, 'confirm')) {
$newpass = $_POST['password'];
@ -748,18 +751,18 @@ function settings_content(App $a)
if (($a->argc > 1) && ($a->argv[1] === 'addon')) {
$settings_addons = "";
$r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
$r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' ");
if (!DBM::is_result($r)) {
$settings_addons = t('No Plugin settings configured');
$settings_addons = t('No Addon settings configured');
}
call_hooks('plugin_settings', $settings_addons);
Addon::callHooks('addon_settings', $settings_addons);
$tpl = get_markup_template('settings/addons.tpl');
$o .= replace_macros($tpl, [
'$form_security_token' => get_form_security_token("settings_addon"),
'$title' => t('Plugin Settings'),
'$title' => t('Addon Settings'),
'$settings_addons' => $settings_addons
]);
return $o;
@ -799,7 +802,7 @@ function settings_content(App $a)
}
$settings_connectors = '';
call_hooks('connector_settings', $settings_connectors);
Addon::callHooks('connector_settings', $settings_connectors);
if (is_site_admin()) {
$diasp_enabled = t('Built-in support for %s connectivity is %s', t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? t('enabled') : t('disabled')));
@ -871,7 +874,7 @@ function settings_content(App $a)
'$submit' => t('Save Settings'),
]);
call_hooks('display_settings', $o);
Addon::callHooks('display_settings', $o);
return $o;
}
@ -1284,7 +1287,7 @@ function settings_content(App $a)
]);
call_hooks('settings_form', $o);
Addon::callHooks('settings_form', $o);
$o .= '</form>' . "\r\n";

View file

@ -5,10 +5,9 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
require_once("include/plugin.php");
function statistics_json_init(App $a) {
if (!Config::get("system", "nodeinfo")) {
@ -28,19 +27,19 @@ function statistics_json_init(App $a) {
];
$statistics["services"] = [];
$statistics["services"]["appnet"] = plugin_enabled("appnet");
$statistics["services"]["blogger"] = plugin_enabled("blogger");
$statistics["services"]["buffer"] = plugin_enabled("buffer");
$statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
$statistics["services"]["facebook"] = plugin_enabled("fbpost");
$statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
$statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
$statistics["services"]["libertree"] = plugin_enabled("libertree");
$statistics["services"]["livejournal"] = plugin_enabled("ljpost");
$statistics["services"]["pumpio"] = plugin_enabled("pumpio");
$statistics["services"]["twitter"] = plugin_enabled("twitter");
$statistics["services"]["tumblr"] = plugin_enabled("tumblr");
$statistics["services"]["wordpress"] = plugin_enabled("wppost");
$statistics["services"]["appnet"] = Addon::isEnabled("appnet");
$statistics["services"]["blogger"] = Addon::isEnabled("blogger");
$statistics["services"]["buffer"] = Addon::isEnabled("buffer");
$statistics["services"]["dreamwidth"] = Addon::isEnabled("dwpost");
$statistics["services"]["facebook"] = Addon::isEnabled("fbpost");
$statistics["services"]["gnusocial"] = Addon::isEnabled("statusnet");
$statistics["services"]["googleplus"] = Addon::isEnabled("gpluspost");
$statistics["services"]["libertree"] = Addon::isEnabled("libertree");
$statistics["services"]["livejournal"] = Addon::isEnabled("ljpost");
$statistics["services"]["pumpio"] = Addon::isEnabled("pumpio");
$statistics["services"]["twitter"] = Addon::isEnabled("twitter");
$statistics["services"]["tumblr"] = Addon::isEnabled("tumblr");
$statistics["services"]["wordpress"] = Addon::isEnabled("wppost");
$statistics["appnet"] = $statistics["services"]["appnet"];
$statistics["blogger"] = $statistics["services"]["blogger"];

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Database\DBM;
@ -156,7 +157,7 @@ EOT;
$arr['id'] = $post_id;
call_hooks('post_local_end', $arr);
Addon::callHooks('post_local_end', $arr);
killme();

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -213,7 +214,7 @@ EOT;
$arr['id'] = $post_id;
call_hooks('post_local_end', $arr);
Addon::callHooks('post_local_end', $arr);
Worker::add(PRIORITY_HIGH, "Notifier", "tag", $post_id);

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Database\DBM;
@ -40,7 +41,7 @@ function uexport_content(App $a) {
['uexport/account', t('Export account'), t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')],
['uexport/backup', t('Export all'), t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')],
];
call_hooks('uexport_options', $options);
Addon::callHooks('uexport_options', $options);
$tpl = get_markup_template("uexport.tpl");
return replace_macros($tpl, [

View file

@ -3,6 +3,7 @@
* @file mod/xrd.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Protocol\Salmon;
@ -109,7 +110,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
);
$arr = ['user' => $r, 'xml' => $o];
call_hooks('personal_xrd', $arr);
Addon::callHooks('personal_xrd', $arr);
echo $arr['xml'];
killme();