mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-28 22:53:20 +00:00
Merge pull request #946 from nupplaphil/task/di_pconfig
[various] Move PConfig to DI::pConfig()
This commit is contained in:
commit
bbaf463a20
42 changed files with 636 additions and 681 deletions
|
@ -10,7 +10,6 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -46,7 +45,7 @@ function blockem_addon_settings (App $a, &$s)
|
|||
/* Add our stylesheet to the page so we can make our settings look nice */
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$words = PConfig::get(local_user(), 'blockem', 'words');
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
|
||||
if (!$words) {
|
||||
$words = '';
|
||||
|
@ -79,14 +78,14 @@ function blockem_addon_settings_post(App $a, array &$b)
|
|||
}
|
||||
|
||||
if (!empty($_POST['blockem-submit'])) {
|
||||
PConfig::set(local_user(), 'blockem', 'words', trim($_POST['blockem-words']));
|
||||
DI::pConfig()->set(local_user(), 'blockem', 'words', trim($_POST['blockem-words']));
|
||||
info(L10n::t('BLOCKEM Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function blockem_enotify_store(App $a, array &$b)
|
||||
{
|
||||
$words = PConfig::get($b['uid'], 'blockem', 'words');
|
||||
$words = DI::pConfig()->get($b['uid'], 'blockem', 'words');
|
||||
|
||||
if ($words) {
|
||||
$arr = explode(',', $words);
|
||||
|
@ -123,7 +122,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
|
|||
$profiles_string = null;
|
||||
|
||||
if (local_user()) {
|
||||
$profiles_string = PConfig::get(local_user(), 'blockem', 'words');
|
||||
$profiles_string = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
}
|
||||
|
||||
if ($profiles_string) {
|
||||
|
@ -159,7 +158,7 @@ function blockem_conversation_start(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$words = PConfig::get(local_user(), 'blockem', 'words');
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
|
||||
if ($words) {
|
||||
$a->data['blockem'] = explode(',', $words);
|
||||
|
@ -217,7 +216,7 @@ function blockem_init(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$words = PConfig::get(local_user(), 'blockem', 'words');
|
||||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
|
||||
if (array_key_exists('block', $_GET) && $_GET['block']) {
|
||||
if (strlen($words)) {
|
||||
|
@ -242,7 +241,7 @@ function blockem_init(App $a)
|
|||
$words = implode(',', $newarr);
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'blockem', 'words', $words);
|
||||
DI::pConfig()->set(local_user(), 'blockem', 'words', $words);
|
||||
info(L10n::t('blockem settings updated') . EOL);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -48,13 +47,13 @@ function blogger_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'blogger', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'blogger', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'blogger_enable',
|
||||
L10n::t('Post to blogger'),
|
||||
PConfig::get(local_user(), 'blogger', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'blogger', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -73,17 +72,17 @@ function blogger_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(), 'blogger', 'post');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'blogger', 'post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(), 'blogger', 'post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'blogger', 'post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$bl_username = PConfig::get(local_user(), 'blogger', 'bl_username');
|
||||
$bl_password = PConfig::get(local_user(), 'blogger', 'bl_password');
|
||||
$bl_blog = PConfig::get(local_user(), 'blogger', 'bl_blog');
|
||||
$bl_username = DI::pConfig()->get(local_user(), 'blogger', 'bl_username');
|
||||
$bl_password = DI::pConfig()->get(local_user(), 'blogger', 'bl_password');
|
||||
$bl_blog = DI::pConfig()->get(local_user(), 'blogger', 'bl_blog');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<span id="settings_blogger_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
|
||||
|
@ -127,11 +126,11 @@ function blogger_settings(App $a, &$s)
|
|||
function blogger_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['blogger-submit'])) {
|
||||
PConfig::set(local_user(), 'blogger', 'post', $_POST['blogger'] ?? false);
|
||||
PConfig::set(local_user(), 'blogger', 'post_by_default', $_POST['bl_bydefault'] ?? false);
|
||||
PConfig::set(local_user(), 'blogger', 'bl_username', trim($_POST['bl_username']));
|
||||
PConfig::set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password']));
|
||||
PConfig::set(local_user(), 'blogger', 'bl_blog', trim($_POST['bl_blog']));
|
||||
DI::pConfig()->set(local_user(), 'blogger', 'post', $_POST['blogger'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'blogger', 'post_by_default', $_POST['bl_bydefault'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'blogger', 'bl_username', trim($_POST['bl_username']));
|
||||
DI::pConfig()->set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password']));
|
||||
DI::pConfig()->set(local_user(), 'blogger', 'bl_blog', trim($_POST['bl_blog']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,11 +165,11 @@ function blogger_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$bl_post = intval(PConfig::get(local_user(), 'blogger', 'post'));
|
||||
$bl_post = intval(DI::pConfig()->get(local_user(), 'blogger', 'post'));
|
||||
|
||||
$bl_enable = (($bl_post && !empty($_REQUEST['blogger_enable'])) ? intval($_REQUEST['blogger_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'blogger', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'blogger', 'post_by_default'))) {
|
||||
$bl_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -199,9 +198,9 @@ function blogger_send(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$bl_username = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_username'));
|
||||
$bl_password = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_password'));
|
||||
$bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog');
|
||||
$bl_username = XML::escape(DI::pConfig()->get($b['uid'], 'blogger', 'bl_username'));
|
||||
$bl_password = XML::escape(DI::pConfig()->get($b['uid'], 'blogger', 'bl_password'));
|
||||
$bl_blog = DI::pConfig()->get($b['uid'], 'blogger', 'bl_blog');
|
||||
|
||||
if ($bl_username && $bl_password && $bl_blog) {
|
||||
$title = '<title>' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '</title>';
|
||||
|
|
|
@ -13,7 +13,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -121,7 +120,7 @@ function buffer_connect(App $a)
|
|||
Logger::log("buffer_connect: authenticated");
|
||||
$o = L10n::t("You are now authenticated to buffer. ");
|
||||
$o .= '<br /><a href="' . DI::baseUrl()->get() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
|
||||
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
|
||||
DI::pConfig()->set(local_user(), 'buffer','access_token', $buffer->access_token);
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
@ -133,13 +132,13 @@ function buffer_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'buffer', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'buffer', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'buffer_enable',
|
||||
L10n::t('Post to Buffer'),
|
||||
PConfig::get(local_user(), 'buffer', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'buffer', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -157,11 +156,11 @@ function buffer_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'buffer','post');
|
||||
$enabled = DI::pConfig()->get(local_user(),'buffer','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(),'buffer','post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(),'buffer','post_by_default');
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -176,7 +175,7 @@ function buffer_settings(App $a, &$s)
|
|||
|
||||
$client_id = Config::get("buffer", "client_id");
|
||||
$client_secret = Config::get("buffer", "client_secret");
|
||||
$access_token = PConfig::get(local_user(), "buffer", "access_token");
|
||||
$access_token = DI::pConfig()->get(local_user(), "buffer", "access_token");
|
||||
|
||||
$s .= '<div id="buffer-password-wrapper">';
|
||||
|
||||
|
@ -236,12 +235,12 @@ function buffer_settings_post(App $a, array &$b)
|
|||
{
|
||||
if (!empty($_POST['buffer-submit'])) {
|
||||
if (!empty($_POST['buffer_delete'])) {
|
||||
PConfig::set(local_user(), 'buffer', 'access_token' , '');
|
||||
PConfig::set(local_user(), 'buffer', 'post' , false);
|
||||
PConfig::set(local_user(), 'buffer', 'post_by_default', false);
|
||||
DI::pConfig()->set(local_user(), 'buffer', 'access_token' , '');
|
||||
DI::pConfig()->set(local_user(), 'buffer', 'post' , false);
|
||||
DI::pConfig()->set(local_user(), 'buffer', 'post_by_default', false);
|
||||
} else {
|
||||
PConfig::set(local_user(), 'buffer', 'post' , intval($_POST['buffer'] ?? false));
|
||||
PConfig::set(local_user(), 'buffer', 'post_by_default', intval($_POST['buffer_bydefault'] ?? false));
|
||||
DI::pConfig()->set(local_user(), 'buffer', 'post' , intval($_POST['buffer'] ?? false));
|
||||
DI::pConfig()->set(local_user(), 'buffer', 'post_by_default', intval($_POST['buffer_bydefault'] ?? false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,11 +251,11 @@ function buffer_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$buffer_post = intval(PConfig::get(local_user(),'buffer','post'));
|
||||
$buffer_post = intval(DI::pConfig()->get(local_user(),'buffer','post'));
|
||||
|
||||
$buffer_enable = (($buffer_post && !empty($_REQUEST['buffer_enable'])) ? intval($_REQUEST['buffer_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'buffer','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'buffer','post_by_default'))) {
|
||||
$buffer_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -313,7 +312,7 @@ function buffer_send(App $a, array &$b)
|
|||
|
||||
$client_id = Config::get("buffer", "client_id");
|
||||
$client_secret = Config::get("buffer", "client_secret");
|
||||
$access_token = PConfig::get($b['uid'], "buffer","access_token");
|
||||
$access_token = DI::pConfig()->get($b['uid'], "buffer","access_token");
|
||||
$callback_url = "";
|
||||
|
||||
if ($access_token) {
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -63,7 +62,7 @@ function catavatar_addon_settings(App $a, &$s)
|
|||
'$usecat' => L10n::t('Use Cat as Avatar'),
|
||||
'$morecat' => L10n::t('More Random Cat!'),
|
||||
'$emailcat' => L10n::t('Reset to email Cat'),
|
||||
'$seed' => PConfig::get(local_user(), 'catavatar', 'seed', false),
|
||||
'$seed' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false),
|
||||
'$header' => L10n::t('Cat Avatar Settings'),
|
||||
]);
|
||||
}
|
||||
|
@ -82,7 +81,7 @@ function catavatar_addon_settings_post(App $a, &$s)
|
|||
'account_expired' => false, 'account_removed' => false];
|
||||
$user = DBA::selectFirst('user', ['email'], $condition);
|
||||
|
||||
$seed = PConfig::get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email']))));
|
||||
$seed = DI::pConfig()->get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email']))));
|
||||
|
||||
if (!empty($_POST['catavatar-usecat'])) {
|
||||
$url = DI::baseUrl()->get() . '/catavatar/' . local_user() . '?ts=' . time();
|
||||
|
@ -124,11 +123,11 @@ function catavatar_addon_settings_post(App $a, &$s)
|
|||
}
|
||||
|
||||
if (!empty($_POST['catavatar-morecat'])) {
|
||||
PConfig::set(local_user(), 'catavatar', 'seed', time());
|
||||
DI::pConfig()->set(local_user(), 'catavatar', 'seed', time());
|
||||
}
|
||||
|
||||
if (!empty($_POST['catavatar-emailcat'])) {
|
||||
PConfig::delete(local_user(), 'catavatar', 'seed');
|
||||
DI::pConfig()->delete(local_user(), 'catavatar', 'seed');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +181,7 @@ function catavatar_content(App $a)
|
|||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
$seed = PConfig::get($uid, "catavatar", "seed", md5(trim(strtolower($user['email']))));
|
||||
$seed = DI::pConfig()->get($uid, "catavatar", "seed", md5(trim(strtolower($user['email']))));
|
||||
|
||||
// ...Or start generation
|
||||
ob_start();
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
|
@ -43,7 +41,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
$now = new DateTime();
|
||||
|
||||
if (!is_null($cached)) {
|
||||
$cdate = PConfig::get(local_user(), 'curweather', 'last');
|
||||
$cdate = DI::pConfig()->get(local_user(), 'curweather', 'last');
|
||||
$cached = unserialize($cached);
|
||||
|
||||
if ($cdate + $cachetime > $now->getTimestamp()) {
|
||||
|
@ -92,7 +90,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
'icon' => (string) $res->weather['icon'],
|
||||
];
|
||||
|
||||
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
Cache::set('curweather'.md5($url), serialize($r), Cache::HOUR);
|
||||
|
||||
return $r;
|
||||
|
@ -100,7 +98,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
|
||||
function curweather_network_mod_init(App $a, &$b)
|
||||
{
|
||||
if (!intval(PConfig::get(local_user(), 'curweather', 'curweather_enable'))) {
|
||||
if (!intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -115,11 +113,11 @@ function curweather_network_mod_init(App $a, &$b)
|
|||
// those parameters will be used to get: cloud status, temperature, preassure
|
||||
// and relative humidity for display, also the relevent area of the map is
|
||||
// linked from lat/log of the reply of OWMp
|
||||
$rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
|
||||
$rpt = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
|
||||
|
||||
// Set the language to the browsers language or default and use metric units
|
||||
$lang = Session::get('language', Config::get('system', 'language'));
|
||||
$units = PConfig::get( local_user(), 'curweather', 'curweather_units');
|
||||
$units = DI::pConfig()->get( local_user(), 'curweather', 'curweather_units');
|
||||
$appid = Config::get('curweather', 'appid');
|
||||
$cachetime = intval(Config::get('curweather', 'cachetime'));
|
||||
|
||||
|
@ -170,9 +168,9 @@ function curweather_addon_settings_post(App $a, $post)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'curweather', 'curweather_loc' , trim($_POST['curweather_loc']));
|
||||
PConfig::set(local_user(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable']));
|
||||
PConfig::set(local_user(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_loc' , trim($_POST['curweather_loc']));
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable']));
|
||||
DI::pConfig()->set(local_user(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
|
||||
|
||||
info(L10n::t('Current Weather settings updated.') . EOL);
|
||||
}
|
||||
|
@ -184,8 +182,8 @@ function curweather_addon_settings(App $a, &$s)
|
|||
}
|
||||
|
||||
/* Get the current state of our config variable */
|
||||
$curweather_loc = PConfig::get(local_user(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
|
||||
$curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units');
|
||||
$appid = Config::get('curweather', 'appid');
|
||||
|
||||
if ($appid == "") {
|
||||
|
@ -194,7 +192,7 @@ function curweather_addon_settings(App $a, &$s)
|
|||
$noappidtext = '';
|
||||
}
|
||||
|
||||
$enable = intval(PConfig::get(local_user(), 'curweather', 'curweather_enable'));
|
||||
$enable = intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'));
|
||||
$enable_checked = (($enable) ? ' checked="checked" ' : '');
|
||||
|
||||
// load template and replace the macros
|
||||
|
|
|
@ -14,8 +14,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\DI;
|
||||
|
@ -46,13 +44,13 @@ function diaspora_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'diaspora', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'diaspora', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'diaspora_enable',
|
||||
L10n::t('Post to Diaspora'),
|
||||
PConfig::get(local_user(), 'diaspora', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'diaspora', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -70,17 +68,17 @@ function diaspora_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'diaspora','post');
|
||||
$enabled = DI::pConfig()->get(local_user(),'diaspora','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(),'diaspora','post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(),'diaspora','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$handle = PConfig::get(local_user(), 'diaspora', 'handle');
|
||||
$password = PConfig::get(local_user(), 'diaspora', 'password');
|
||||
$aspect = PConfig::get(local_user(),'diaspora','aspect');
|
||||
$handle = DI::pConfig()->get(local_user(), 'diaspora', 'handle');
|
||||
$password = DI::pConfig()->get(local_user(), 'diaspora', 'password');
|
||||
$aspect = DI::pConfig()->get(local_user(),'diaspora','aspect');
|
||||
|
||||
$status = "";
|
||||
|
||||
|
@ -174,11 +172,11 @@ function diaspora_settings(App $a, &$s)
|
|||
function diaspora_settings_post(App $a, &$b)
|
||||
{
|
||||
if (!empty($_POST['diaspora-submit'])) {
|
||||
PConfig::set(local_user(),'diaspora', 'post' , intval($_POST['diaspora']));
|
||||
PConfig::set(local_user(),'diaspora', 'post_by_default', intval($_POST['diaspora_bydefault']));
|
||||
PConfig::set(local_user(),'diaspora', 'handle' , trim($_POST['handle']));
|
||||
PConfig::set(local_user(),'diaspora', 'password' , trim($_POST['password']));
|
||||
PConfig::set(local_user(),'diaspora', 'aspect' , trim($_POST['aspect']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'post' , intval($_POST['diaspora']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'post_by_default', intval($_POST['diaspora_bydefault']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'handle' , trim($_POST['handle']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'password' , trim($_POST['password']));
|
||||
DI::pConfig()->set(local_user(),'diaspora', 'aspect' , trim($_POST['aspect']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,11 +209,11 @@ function diaspora_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$diaspora_post = intval(PConfig::get(local_user(),'diaspora','post'));
|
||||
$diaspora_post = intval(DI::pConfig()->get(local_user(),'diaspora','post'));
|
||||
|
||||
$diaspora_enable = (($diaspora_post && !empty($_REQUEST['diaspora_enable'])) ? intval($_REQUEST['diaspora_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'diaspora','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'diaspora','post_by_default'))) {
|
||||
$diaspora_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -258,9 +256,9 @@ function diaspora_send(App $a, array &$b)
|
|||
|
||||
Logger::log('diaspora_send: prepare posting', Logger::DEBUG);
|
||||
|
||||
$handle = PConfig::get($b['uid'],'diaspora','handle');
|
||||
$password = PConfig::get($b['uid'],'diaspora','password');
|
||||
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
|
||||
$handle = DI::pConfig()->get($b['uid'],'diaspora','handle');
|
||||
$password = DI::pConfig()->get($b['uid'],'diaspora','password');
|
||||
$aspect = DI::pConfig()->get($b['uid'],'diaspora','aspect');
|
||||
|
||||
if ($handle && $password) {
|
||||
Logger::log('diaspora_send: all values seem to be okay', Logger::DEBUG);
|
||||
|
|
|
@ -11,12 +11,11 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -44,7 +43,7 @@ function discourse_settings(App $a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(PConfig::get(local_user(), 'discourse', 'enabled'));
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'discourse', 'enabled'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/discourse/');
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
|
@ -60,7 +59,7 @@ function discourse_settings_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'discourse', 'enabled', intval($_POST['enabled']));
|
||||
DI::pConfig()->set(local_user(), 'discourse', 'enabled', intval($_POST['enabled']));
|
||||
}
|
||||
|
||||
function discourse_email_getmessage(App $a, &$message)
|
||||
|
@ -69,7 +68,7 @@ function discourse_email_getmessage(App $a, &$message)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!PConfig::get($message['item']['uid'], 'discourse', 'enabled')) {
|
||||
if (!DI::pConfig()->get($message['item']['uid'], 'discourse', 'enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -44,13 +43,13 @@ function dwpost_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'dwpost', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'dwpost', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'dwpost_enable',
|
||||
L10n::t('Post to Dreamwidth'),
|
||||
PConfig::get(local_user(), 'dwpost', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'dwpost', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -67,16 +66,16 @@ function dwpost_settings(App $a, &$s)
|
|||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/dwpost/dwpost.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* Get the current state of our config variables */
|
||||
$enabled = PConfig::get(local_user(), 'dwpost', 'post');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'dwpost', 'post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(), 'dwpost', 'post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'dwpost', 'post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$dw_username = PConfig::get(local_user(), 'dwpost', 'dw_username');
|
||||
$dw_password = PConfig::get(local_user(), 'dwpost', 'dw_password');
|
||||
$dw_username = DI::pConfig()->get(local_user(), 'dwpost', 'dw_username');
|
||||
$dw_password = DI::pConfig()->get(local_user(), 'dwpost', 'dw_password');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<span id="settings_dwpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_dwpost_expanded\'); openClose(\'settings_dwpost_inflated\');">';
|
||||
|
@ -115,10 +114,10 @@ function dwpost_settings(App $a, &$s)
|
|||
function dwpost_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['dwpost-submit'])) {
|
||||
PConfig::set(local_user(), 'dwpost', 'post', intval($_POST['dwpost']));
|
||||
PConfig::set(local_user(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
|
||||
PConfig::set(local_user(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
|
||||
PConfig::set(local_user(), 'dwpost', 'dw_password', trim($_POST['dw_password']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'post', intval($_POST['dwpost']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
|
||||
DI::pConfig()->set(local_user(), 'dwpost', 'dw_password', trim($_POST['dw_password']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,11 +136,11 @@ function dwpost_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$dw_post = intval(PConfig::get(local_user(),'dwpost','post'));
|
||||
$dw_post = intval(DI::pConfig()->get(local_user(),'dwpost','post'));
|
||||
|
||||
$dw_enable = (($dw_post && !empty($_REQUEST['dwpost_enable'])) ? intval($_REQUEST['dwpost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'dwpost','post_by_default'))) {
|
||||
$dw_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -185,8 +184,8 @@ function dwpost_send(App $a, array &$b)
|
|||
$tz = $x[0]['timezone'];
|
||||
}
|
||||
|
||||
$dw_username = PConfig::get($b['uid'],'dwpost','dw_username');
|
||||
$dw_password = PConfig::get($b['uid'],'dwpost','dw_password');
|
||||
$dw_username = DI::pConfig()->get($b['uid'],'dwpost','dw_username');
|
||||
$dw_password = DI::pConfig()->get($b['uid'],'dwpost','dw_password');
|
||||
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
|
||||
|
||||
if ($dw_username && $dw_password && $dw_blog) {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function fromapp_install()
|
||||
|
@ -35,8 +34,8 @@ function fromapp_settings_post($a, $post)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'fromapp', 'app', $_POST['fromapp-input']);
|
||||
PConfig::set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
|
||||
DI::pConfig()->set(local_user(), 'fromapp', 'app', $_POST['fromapp-input']);
|
||||
DI::pConfig()->set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
|
||||
|
||||
info(L10n::t('Fromapp settings updated.') . EOL);
|
||||
}
|
||||
|
@ -53,9 +52,9 @@ function fromapp_settings(&$a, &$s)
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$fromapp = PConfig::get(local_user(), 'fromapp', 'app', '');
|
||||
$fromapp = DI::pConfig()->get(local_user(), 'fromapp', 'app', '');
|
||||
|
||||
$force = intval(PConfig::get(local_user(), 'fromapp', 'force'));
|
||||
$force = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
|
||||
|
||||
$force_enabled = (($force) ? ' checked="checked" ' : '');
|
||||
|
||||
|
@ -94,8 +93,8 @@ function fromapp_post_hook(&$a, &$item)
|
|||
return;
|
||||
}
|
||||
|
||||
$app = PConfig::get(local_user(), 'fromapp', 'app');
|
||||
$force = intval(PConfig::get(local_user(), 'fromapp', 'force'));
|
||||
$app = DI::pConfig()->get(local_user(), 'fromapp', 'app');
|
||||
$force = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
|
||||
|
||||
if (is_null($app) || (! strlen($app))) {
|
||||
return;
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\ConfigFileLoader;
|
||||
|
@ -67,7 +66,7 @@ function geonames_post_hook(App $a, array &$item)
|
|||
/* Retrieve our personal config setting */
|
||||
|
||||
$geo_account = Config::get('geonames', 'username');
|
||||
$active = PConfig::get(local_user(), 'geonames', 'enable');
|
||||
$active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
|
||||
|
||||
if (!$geo_account || !$active) {
|
||||
return;
|
||||
|
@ -110,7 +109,7 @@ function geonames_addon_settings_post(App $a, array $post)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
DI::pConfig()->set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
|
||||
info(L10n::t('Geonames settings updated.'));
|
||||
}
|
||||
|
@ -140,7 +139,7 @@ function geonames_addon_settings(App $a, &$s)
|
|||
DI::page()->registerStylesheet($stylesheetPath);
|
||||
|
||||
/* Get the current state of our config variable */
|
||||
$enabled = intval(PConfig::get(local_user(), 'geonames', 'enable'));
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', __DIR__);
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -49,7 +48,7 @@ function gnot_settings_post($a,$post) {
|
|||
if(! local_user() || empty($_POST['gnot-submit']))
|
||||
return;
|
||||
|
||||
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
|
||||
DI::pConfig()->set(local_user(),'gnot','enable',intval($_POST['gnot']));
|
||||
info(L10n::t('Gnot settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -74,7 +73,7 @@ function gnot_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$gnot = intval(PConfig::get(local_user(),'gnot','enable'));
|
||||
$gnot = intval(DI::pConfig()->get(local_user(),'gnot','enable'));
|
||||
|
||||
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
|
||||
|
||||
|
@ -92,7 +91,7 @@ function gnot_settings(&$a,&$s) {
|
|||
|
||||
|
||||
function gnot_enotify_mail(&$a,&$b) {
|
||||
if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
|
||||
if((! $b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable'))))
|
||||
return;
|
||||
if($b['type'] == NOTIFY_COMMENT)
|
||||
$b['subject'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function group_text_install() {
|
||||
|
@ -43,7 +42,7 @@ function group_text_uninstall() {
|
|||
function group_text_settings_post($a,$post) {
|
||||
if(! local_user() || empty($_POST['group_text-submit']))
|
||||
return;
|
||||
PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
||||
DI::pConfig()->set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
||||
|
||||
info(L10n::t('Group Text settings updated.') . EOL);
|
||||
}
|
||||
|
@ -69,7 +68,7 @@ function group_text_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'system','groupedit_image_limit');
|
||||
$enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -46,11 +45,11 @@ function ifttt_settings(App $a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$key = PConfig::get(local_user(), 'ifttt', 'key');
|
||||
$key = DI::pConfig()->get(local_user(), 'ifttt', 'key');
|
||||
|
||||
if (!$key) {
|
||||
$key = Strings::getRandomHex(20);
|
||||
PConfig::set(local_user(), 'ifttt', 'key', $key);
|
||||
DI::pConfig()->set(local_user(), 'ifttt', 'key', $key);
|
||||
}
|
||||
|
||||
$s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
|
||||
|
@ -89,7 +88,7 @@ function ifttt_settings(App $a, &$s)
|
|||
function ifttt_settings_post()
|
||||
{
|
||||
if (!empty($_POST['ifttt-submit']) && isset($_POST['ifttt-rekey'])) {
|
||||
PConfig::delete(local_user(), 'ifttt', 'key');
|
||||
DI::pConfig()->delete(local_user(), 'ifttt', 'key');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +118,7 @@ function ifttt_post(App $a)
|
|||
$key = $_REQUEST['key'];
|
||||
|
||||
// Check the key
|
||||
if ($key != PConfig::get($uid, 'ifttt', 'key')) {
|
||||
if ($key != DI::pConfig()->get($uid, 'ifttt', 'key')) {
|
||||
Logger::log('Invalid key for user ' . $uid, Logger::DEBUG);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -42,13 +41,13 @@ function ijpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'ijpost', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'ijpost', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'ijpost_enable',
|
||||
L10n::t('Post to Insanejournal'),
|
||||
PConfig::get(local_user(), 'ijpost', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -66,16 +65,16 @@ function ijpost_settings(&$a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(), 'ijpost', 'post');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'ijpost', 'post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(), 'ijpost', 'post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$ij_username = PConfig::get(local_user(), 'ijpost', 'ij_username');
|
||||
$ij_password = PConfig::get(local_user(), 'ijpost', 'ij_password');
|
||||
$ij_username = DI::pConfig()->get(local_user(), 'ijpost', 'ij_username');
|
||||
$ij_password = DI::pConfig()->get(local_user(), 'ijpost', 'ij_password');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<span id="settings_ijpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ijpost_expanded\'); openClose(\'settings_ijpost_inflated\');">';
|
||||
|
@ -113,10 +112,10 @@ function ijpost_settings(&$a, &$s)
|
|||
function ijpost_settings_post(&$a, &$b)
|
||||
{
|
||||
if (!empty($_POST['ijpost-submit'])) {
|
||||
PConfig::set(local_user(), 'ijpost', 'post', intval($_POST['ijpost']));
|
||||
PConfig::set(local_user(), 'ijpost', 'post_by_default', intval($_POST['ij_bydefault']));
|
||||
PConfig::set(local_user(), 'ijpost', 'ij_username', trim($_POST['ij_username']));
|
||||
PConfig::set(local_user(), 'ijpost', 'ij_password', trim($_POST['ij_password']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'post', intval($_POST['ijpost']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'post_by_default', intval($_POST['ij_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'ij_username', trim($_POST['ij_username']));
|
||||
DI::pConfig()->set(local_user(), 'ijpost', 'ij_password', trim($_POST['ij_password']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,11 +135,11 @@ function ijpost_post_local(&$a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$ij_post = intval(PConfig::get(local_user(), 'ijpost', 'post'));
|
||||
$ij_post = intval(DI::pConfig()->get(local_user(), 'ijpost', 'post'));
|
||||
|
||||
$ij_enable = (($ij_post && !empty($_REQUEST['ijpost_enable'])) ? intval($_REQUEST['ijpost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'ijpost', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'ijpost', 'post_by_default'))) {
|
||||
$ij_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -183,8 +182,8 @@ function ijpost_send(&$a, &$b)
|
|||
$tz = $x[0]['timezone'];
|
||||
}
|
||||
|
||||
$ij_username = PConfig::get($b['uid'], 'ijpost', 'ij_username');
|
||||
$ij_password = PConfig::get($b['uid'], 'ijpost', 'ij_password');
|
||||
$ij_username = DI::pConfig()->get($b['uid'], 'ijpost', 'ij_username');
|
||||
$ij_password = DI::pConfig()->get($b['uid'], 'ijpost', 'ij_password');
|
||||
$ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
|
||||
|
||||
if ($ij_username && $ij_password && $ij_blog) {
|
||||
|
|
13
irc/irc.php
13
irc/irc.php
|
@ -10,7 +10,6 @@
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -36,8 +35,8 @@ function irc_addon_settings(&$a,&$s) {
|
|||
// DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/irc/irc.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* setting popular channels, auto connect channels */
|
||||
$sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */
|
||||
$autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */
|
||||
$sitechats = DI::pConfig()->get( local_user(), 'irc','sitechats'); /* popular channels */
|
||||
$autochans = DI::pConfig()->get( local_user(), 'irc','autochans'); /* auto connect chans */
|
||||
|
||||
$t = Renderer::getMarkupTemplate( "settings.tpl", "addon/irc/" );
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
|
@ -59,10 +58,10 @@ function irc_addon_settings_post(&$a, &$b) {
|
|||
|
||||
if(!empty($_POST['irc-submit'])) {
|
||||
if (isset($_POST['autochans'])) {
|
||||
PConfig::set(local_user(), 'irc', 'autochans', trim(($_POST['autochans'])));
|
||||
DI::pConfig()->set(local_user(), 'irc', 'autochans', trim(($_POST['autochans'])));
|
||||
}
|
||||
if (isset($_POST['sitechats'])) {
|
||||
PConfig::set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats']));
|
||||
DI::pConfig()->set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats']));
|
||||
}
|
||||
/* upid pop-up thing */
|
||||
info(L10n::t('IRC settings saved.') . EOL);
|
||||
|
@ -86,7 +85,7 @@ function irc_content(&$a) {
|
|||
|
||||
/* set the list of popular channels */
|
||||
if (local_user()) {
|
||||
$sitechats = PConfig::get( local_user(), 'irc', 'sitechats');
|
||||
$sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats');
|
||||
if (!$sitechats)
|
||||
$sitechats = Config::get('irc', 'sitechats');
|
||||
} else {
|
||||
|
@ -106,7 +105,7 @@ function irc_content(&$a) {
|
|||
|
||||
/* setting the channel(s) to auto connect */
|
||||
if (local_user()) {
|
||||
$autochans = PConfig::get(local_user(), 'irc', 'autochans');
|
||||
$autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');
|
||||
if (!$autochans)
|
||||
$autochans = Config::get('irc','autochans');
|
||||
} else {
|
||||
|
|
|
@ -67,7 +67,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -231,21 +230,21 @@ function jappixmini_init()
|
|||
$decrypt_func($signed_address, $trusted_address, $key);
|
||||
|
||||
$now = intval(time());
|
||||
PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
|
||||
DI::pConfig()->set($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
// do not return an address if user deactivated addon
|
||||
$activated = PConfig::get($uid, 'jappixmini', 'activate');
|
||||
$activated = DI::pConfig()->get($uid, 'jappixmini', 'activate');
|
||||
if (!$activated) {
|
||||
exit();
|
||||
}
|
||||
|
||||
// return the requested Jabber address
|
||||
try {
|
||||
$username = PConfig::get($uid, 'jappixmini', 'username');
|
||||
$server = PConfig::get($uid, 'jappixmini', 'server');
|
||||
$username = DI::pConfig()->get($uid, 'jappixmini', 'username');
|
||||
$server = DI::pConfig()->get($uid, 'jappixmini', 'server');
|
||||
$address = "$username@$server";
|
||||
|
||||
$encrypted_address = "";
|
||||
|
@ -269,29 +268,29 @@ function jappixmini_init()
|
|||
function jappixmini_settings(App $a, &$s)
|
||||
{
|
||||
// addon settings for a user
|
||||
$activate = PConfig::get(local_user(), 'jappixmini', 'activate');
|
||||
$activate = DI::pConfig()->get(local_user(), 'jappixmini', 'activate');
|
||||
$activate = intval($activate) ? ' checked="checked"' : '';
|
||||
$dontinsertchat = PConfig::get(local_user(), 'jappixmini', 'dontinsertchat');
|
||||
$dontinsertchat = DI::pConfig()->get(local_user(), 'jappixmini', 'dontinsertchat');
|
||||
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : '');
|
||||
|
||||
$defaultbosh = Config::get("jappixmini", "bosh_address");
|
||||
|
||||
if ($defaultbosh != "") {
|
||||
PConfig::set(local_user(), 'jappixmini', 'bosh', $defaultbosh);
|
||||
DI::pConfig()->set(local_user(), 'jappixmini', 'bosh', $defaultbosh);
|
||||
}
|
||||
|
||||
$username = PConfig::get(local_user(), 'jappixmini', 'username');
|
||||
$username = DI::pConfig()->get(local_user(), 'jappixmini', 'username');
|
||||
$username = htmlentities($username);
|
||||
$server = PConfig::get(local_user(), 'jappixmini', 'server');
|
||||
$server = DI::pConfig()->get(local_user(), 'jappixmini', 'server');
|
||||
$server = htmlentities($server);
|
||||
$bosh = PConfig::get(local_user(), 'jappixmini', 'bosh');
|
||||
$bosh = DI::pConfig()->get(local_user(), 'jappixmini', 'bosh');
|
||||
$bosh = htmlentities($bosh);
|
||||
$password = PConfig::get(local_user(), 'jappixmini', 'password');
|
||||
$autosubscribe = PConfig::get(local_user(), 'jappixmini', 'autosubscribe');
|
||||
$password = DI::pConfig()->get(local_user(), 'jappixmini', 'password');
|
||||
$autosubscribe = DI::pConfig()->get(local_user(), 'jappixmini', 'autosubscribe');
|
||||
$autosubscribe = intval($autosubscribe) ? ' checked="checked"' : '';
|
||||
$autoapprove = PConfig::get(local_user(), 'jappixmini', 'autoapprove');
|
||||
$autoapprove = DI::pConfig()->get(local_user(), 'jappixmini', 'autoapprove');
|
||||
$autoapprove = intval($autoapprove) ? ' checked="checked"' : '';
|
||||
$encrypt = intval(PConfig::get(local_user(), 'jappixmini', 'encrypt'));
|
||||
$encrypt = intval(DI::pConfig()->get(local_user(), 'jappixmini', 'encrypt'));
|
||||
$encrypt_checked = $encrypt ? ' checked="checked"' : '';
|
||||
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"';
|
||||
|
||||
|
@ -445,26 +444,26 @@ function jappixmini_settings_post(App $a, &$b)
|
|||
$purge = intval($b['jappixmini-purge']);
|
||||
|
||||
$username = trim($b['jappixmini-username']);
|
||||
$old_username = PConfig::get($uid, 'jappixmini', 'username');
|
||||
$old_username = DI::pConfig()->get($uid, 'jappixmini', 'username');
|
||||
if ($username != $old_username) {
|
||||
$purge = 1;
|
||||
}
|
||||
|
||||
$server = trim($b['jappixmini-server']);
|
||||
$old_server = PConfig::get($uid, 'jappixmini', 'server');
|
||||
$old_server = DI::pConfig()->get($uid, 'jappixmini', 'server');
|
||||
if ($server != $old_server) {
|
||||
$purge = 1;
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'jappixmini', 'username' , $username);
|
||||
PConfig::set($uid, 'jappixmini', 'server' , $server);
|
||||
PConfig::set($uid, 'jappixmini', 'bosh' , trim($b['jappixmini-bosh']));
|
||||
PConfig::set($uid, 'jappixmini', 'password' , trim($b['jappixmini-encrypted-password']));
|
||||
PConfig::set($uid, 'jappixmini', 'autosubscribe' , intval($b['jappixmini-autosubscribe']));
|
||||
PConfig::set($uid, 'jappixmini', 'autoapprove' , intval($b['jappixmini-autoapprove']));
|
||||
PConfig::set($uid, 'jappixmini', 'activate' , intval($b['jappixmini-activate']));
|
||||
PConfig::set($uid, 'jappixmini', 'dontinsertchat', intval($b['jappixmini-dont-insertchat']));
|
||||
PConfig::set($uid, 'jappixmini', 'encrypt' , $encrypt);
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'username' , $username);
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'server' , $server);
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'bosh' , trim($b['jappixmini-bosh']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'password' , trim($b['jappixmini-encrypted-password']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'autosubscribe' , intval($b['jappixmini-autosubscribe']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'autoapprove' , intval($b['jappixmini-autoapprove']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'activate' , intval($b['jappixmini-activate']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'dontinsertchat', intval($b['jappixmini-dont-insertchat']));
|
||||
DI::pConfig()->set($uid, 'jappixmini', 'encrypt' , $encrypt);
|
||||
info('Jappix Mini settings saved.');
|
||||
|
||||
if ($purge) {
|
||||
|
@ -485,8 +484,8 @@ function jappixmini_script(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$activate = PConfig::get(local_user(), 'jappixmini', 'activate');
|
||||
$dontinsertchat = PConfig::get(local_user(), 'jappixmini', 'dontinsertchat');
|
||||
$activate = DI::pConfig()->get(local_user(), 'jappixmini', 'activate');
|
||||
$dontinsertchat = DI::pConfig()->get(local_user(), 'jappixmini', 'dontinsertchat');
|
||||
if (!$activate || $dontinsertchat) {
|
||||
return;
|
||||
}
|
||||
|
@ -496,20 +495,20 @@ function jappixmini_script(App $a)
|
|||
|
||||
DI::page()['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
|
||||
|
||||
$username = PConfig::get(local_user(), 'jappixmini', 'username');
|
||||
$username = DI::pConfig()->get(local_user(), 'jappixmini', 'username');
|
||||
$username = str_replace("'", "\\'", $username);
|
||||
$server = PConfig::get(local_user(), 'jappixmini', 'server');
|
||||
$server = DI::pConfig()->get(local_user(), 'jappixmini', 'server');
|
||||
$server = str_replace("'", "\\'", $server);
|
||||
$bosh = PConfig::get(local_user(), 'jappixmini', 'bosh');
|
||||
$bosh = DI::pConfig()->get(local_user(), 'jappixmini', 'bosh');
|
||||
$bosh = str_replace("'", "\\'", $bosh);
|
||||
$encrypt = PConfig::get(local_user(), 'jappixmini', 'encrypt');
|
||||
$encrypt = DI::pConfig()->get(local_user(), 'jappixmini', 'encrypt');
|
||||
$encrypt = intval($encrypt);
|
||||
$password = PConfig::get(local_user(), 'jappixmini', 'password');
|
||||
$password = DI::pConfig()->get(local_user(), 'jappixmini', 'password');
|
||||
$password = str_replace("'", "\\'", $password);
|
||||
|
||||
$autoapprove = PConfig::get(local_user(), 'jappixmini', 'autoapprove');
|
||||
$autoapprove = DI::pConfig()->get(local_user(), 'jappixmini', 'autoapprove');
|
||||
$autoapprove = intval($autoapprove);
|
||||
$autosubscribe = PConfig::get(local_user(), 'jappixmini', 'autosubscribe');
|
||||
$autosubscribe = DI::pConfig()->get(local_user(), 'jappixmini', 'autosubscribe');
|
||||
$autosubscribe = intval($autosubscribe);
|
||||
|
||||
// set proxy if necessary
|
||||
|
@ -619,7 +618,7 @@ function jappixmini_cron(App $a, $d)
|
|||
}
|
||||
|
||||
// check if jabber address already present
|
||||
$present = PConfig::get($uid, "jappixmini", "id:" . $dfrn_id);
|
||||
$present = DI::pConfig()->get($uid, "jappixmini", "id:" . $dfrn_id);
|
||||
$now = intval(time());
|
||||
if ($present) {
|
||||
// $present has format "timestamp:jabber_address"
|
||||
|
@ -642,11 +641,11 @@ function jappixmini_cron(App $a, $d)
|
|||
$base = substr($request, 0, $pos) . "/jappixmini?role=$role";
|
||||
|
||||
// construct own address
|
||||
$username = PConfig::get($uid, 'jappixmini', 'username');
|
||||
$username = DI::pConfig()->get($uid, 'jappixmini', 'username');
|
||||
if (!$username) {
|
||||
continue;
|
||||
}
|
||||
$server = PConfig::get($uid, 'jappixmini', 'server');
|
||||
$server = DI::pConfig()->get($uid, 'jappixmini', 'server');
|
||||
if (!$server) {
|
||||
continue;
|
||||
}
|
||||
|
@ -692,7 +691,7 @@ function jappixmini_cron(App $a, $d)
|
|||
}
|
||||
|
||||
// save address
|
||||
PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
|
||||
DI::pConfig()->set($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function krynn_install() {
|
||||
|
@ -85,7 +84,7 @@ function krynn_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = PConfig::get(local_user(), 'krynn', 'enable');
|
||||
$active = DI::pConfig()->get(local_user(), 'krynn', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -123,7 +122,7 @@ function krynn_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['krynn-submit'])
|
||||
PConfig::set(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
DI::pConfig()->set(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,7 +146,7 @@ function krynn_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'krynn','enable');
|
||||
$enabled = DI::pConfig()->get(local_user(),'krynn','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\App;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -47,10 +46,10 @@ function langfilter_addon_settings(App $a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$enable_checked = (intval(PConfig::get(local_user(), 'langfilter', 'disable')) ? '' : ' checked="checked" ');
|
||||
$languages = PConfig::get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence') * 100;
|
||||
$minlength = PConfig::get(local_user(), 'langfilter', 'minlength');
|
||||
$enable_checked = (intval(DI::pConfig()->get(local_user(), 'langfilter', 'disable')) ? '' : ' checked="checked" ');
|
||||
$languages = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence') * 100;
|
||||
$minlength = DI::pConfig()->get(local_user(), 'langfilter', 'minlength');
|
||||
|
||||
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/langfilter/");
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
|
@ -79,10 +78,10 @@ function langfilter_addon_settings_post(App $a, &$b)
|
|||
}
|
||||
|
||||
if (!empty($_POST['langfilter-settings-submit'])) {
|
||||
PConfig::set(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages']));
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages']));
|
||||
$enable = (!empty($_POST['langfilter_enable']) ? intval($_POST['langfilter_enable']) : 0);
|
||||
$disable = 1 - $enable;
|
||||
PConfig::set(local_user(), 'langfilter', 'disable', $disable);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'disable', $disable);
|
||||
$minconfidence = 0 + $_POST['langfilter_minconfidence'];
|
||||
if (!$minconfidence) {
|
||||
$minconfidence = 0;
|
||||
|
@ -91,7 +90,7 @@ function langfilter_addon_settings_post(App $a, &$b)
|
|||
} elseif ($minconfidence > 100) {
|
||||
$minconfidence = 100;
|
||||
}
|
||||
PConfig::set(local_user(), 'langfilter', 'minconfidence', $minconfidence / 100.0);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'minconfidence', $minconfidence / 100.0);
|
||||
|
||||
$minlength = 0 + $_POST['langfilter_minlength'];
|
||||
if (!$minlength) {
|
||||
|
@ -99,7 +98,7 @@ function langfilter_addon_settings_post(App $a, &$b)
|
|||
} elseif ($minlength < 0) {
|
||||
$minlength = 32;
|
||||
}
|
||||
PConfig::set(local_user(), 'langfilter', 'minlength', $minlength);
|
||||
DI::pConfig()->set(local_user(), 'langfilter', 'minlength', $minlength);
|
||||
|
||||
info(L10n::t('Language Filter Settings saved.') . EOL);
|
||||
}
|
||||
|
@ -129,14 +128,14 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
}
|
||||
|
||||
// Don't filter if language filter is disabled
|
||||
if (PConfig::get($logged_user, 'langfilter', 'disable')) {
|
||||
if (DI::pConfig()->get($logged_user, 'langfilter', 'disable')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$naked_body = BBCode::toPlaintext($hook_data['item']['body'], false);
|
||||
|
||||
// Don't filter if body lenght is below minimum
|
||||
$minlen = PConfig::get(local_user(), 'langfilter', 'minlength', 32);
|
||||
$minlen = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32);
|
||||
if (!$minlen) {
|
||||
$minlen = 32;
|
||||
}
|
||||
|
@ -145,8 +144,8 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
return;
|
||||
}
|
||||
|
||||
$read_languages_string = PConfig::get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence');
|
||||
$read_languages_string = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
|
||||
$minconfidence = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence');
|
||||
|
||||
// Don't filter if no spoken languages are configured
|
||||
if (!$read_languages_string) {
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -42,13 +41,13 @@ function libertree_jot_nets(App &$a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'libertree', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'libertree', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'libertree_enable',
|
||||
L10n::t('Post to libertree'),
|
||||
PConfig::get(local_user(), 'libertree', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'libertree', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -66,16 +65,16 @@ function libertree_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'libertree','post');
|
||||
$enabled = DI::pConfig()->get(local_user(),'libertree','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(),'libertree','post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(),'libertree','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$ltree_api_token = PConfig::get(local_user(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = PConfig::get(local_user(), 'libertree', 'libertree_url');
|
||||
$ltree_api_token = DI::pConfig()->get(local_user(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = DI::pConfig()->get(local_user(), 'libertree', 'libertree_url');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -119,10 +118,10 @@ function libertree_settings_post(&$a,&$b) {
|
|||
|
||||
if(!empty($_POST['libertree-submit'])) {
|
||||
|
||||
PConfig::set(local_user(),'libertree','post',intval($_POST['libertree']));
|
||||
PConfig::set(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
|
||||
PConfig::set(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
|
||||
PConfig::set(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
|
||||
DI::pConfig()->set(local_user(),'libertree','post',intval($_POST['libertree']));
|
||||
DI::pConfig()->set(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
|
||||
DI::pConfig()->set(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
|
||||
DI::pConfig()->set(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -159,11 +158,11 @@ function libertree_post_local(&$a,&$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$ltree_post = intval(PConfig::get(local_user(),'libertree','post'));
|
||||
$ltree_post = intval(DI::pConfig()->get(local_user(),'libertree','post'));
|
||||
|
||||
$ltree_enable = (($ltree_post && !empty($_REQUEST['libertree_enable'])) ? intval($_REQUEST['libertree_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'libertree','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'libertree','post_by_default'))) {
|
||||
$ltree_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -204,8 +203,8 @@ function libertree_send(&$a,&$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$ltree_api_token = PConfig::get($b['uid'],'libertree','libertree_api_token');
|
||||
$ltree_url = PConfig::get($b['uid'],'libertree','libertree_url');
|
||||
$ltree_api_token = DI::pConfig()->get($b['uid'],'libertree','libertree_api_token');
|
||||
$ltree_url = DI::pConfig()->get($b['uid'],'libertree','libertree_url');
|
||||
$ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
|
||||
$ltree_source = DI::baseUrl()->getHostname();
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -42,13 +41,13 @@ function ljpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(),'ljpost','post')) {
|
||||
if (DI::pConfig()->get(local_user(),'ljpost','post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'ljpost_enable',
|
||||
L10n::t('Post to LiveJournal'),
|
||||
PConfig::get(local_user(),'ljpost','post_by_default')
|
||||
DI::pConfig()->get(local_user(),'ljpost','post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -66,16 +65,16 @@ function ljpost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'ljpost','post');
|
||||
$enabled = DI::pConfig()->get(local_user(),'ljpost','post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(),'ljpost','post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(),'ljpost','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$lj_username = PConfig::get(local_user(), 'ljpost', 'lj_username');
|
||||
$lj_password = PConfig::get(local_user(), 'ljpost', 'lj_password');
|
||||
$lj_username = DI::pConfig()->get(local_user(), 'ljpost', 'lj_username');
|
||||
$lj_password = DI::pConfig()->get(local_user(), 'ljpost', 'lj_password');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -113,10 +112,10 @@ function ljpost_settings_post(&$a,&$b) {
|
|||
|
||||
if(!empty($_POST['ljpost-submit'])) {
|
||||
|
||||
PConfig::set(local_user(),'ljpost','post',intval($_POST['ljpost']));
|
||||
PConfig::set(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
|
||||
PConfig::set(local_user(),'ljpost','lj_username',trim($_POST['lj_username']));
|
||||
PConfig::set(local_user(),'ljpost','lj_password',trim($_POST['lj_password']));
|
||||
DI::pConfig()->set(local_user(),'ljpost','post',intval($_POST['ljpost']));
|
||||
DI::pConfig()->set(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
|
||||
DI::pConfig()->set(local_user(),'ljpost','lj_username',trim($_POST['lj_username']));
|
||||
DI::pConfig()->set(local_user(),'ljpost','lj_password',trim($_POST['lj_password']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -135,11 +134,11 @@ function ljpost_post_local(&$a,&$b) {
|
|||
if($b['private'] || $b['parent'])
|
||||
return;
|
||||
|
||||
$lj_post = intval(PConfig::get(local_user(),'ljpost','post'));
|
||||
$lj_post = intval(DI::pConfig()->get(local_user(),'ljpost','post'));
|
||||
|
||||
$lj_enable = (($lj_post && !empty($_REQUEST['ljpost_enable'])) ? intval($_REQUEST['ljpost_enable']) : 0);
|
||||
|
||||
if($b['api_source'] && intval(PConfig::get(local_user(),'ljpost','post_by_default')))
|
||||
if($b['api_source'] && intval(DI::pConfig()->get(local_user(),'ljpost','post_by_default')))
|
||||
$lj_enable = 1;
|
||||
|
||||
if(! $lj_enable)
|
||||
|
@ -176,13 +175,13 @@ function ljpost_send(&$a,&$b) {
|
|||
if($x && strlen($x[0]['timezone']))
|
||||
$tz = $x[0]['timezone'];
|
||||
|
||||
$lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username'));
|
||||
$lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password'));
|
||||
$lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal'));
|
||||
$lj_username = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_username'));
|
||||
$lj_password = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_password'));
|
||||
$lj_journal = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_journal'));
|
||||
// if(! $lj_journal)
|
||||
// $lj_journal = $lj_username;
|
||||
|
||||
$lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog'));
|
||||
$lj_blog = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_blog'));
|
||||
if(! strlen($lj_blog))
|
||||
$lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc');
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -103,7 +102,7 @@ function mailstream_generate_id($a, $uri) {
|
|||
}
|
||||
|
||||
function mailstream_post_hook(&$a, &$item) {
|
||||
if (!PConfig::get($item['uid'], 'mailstream', 'enabled')) {
|
||||
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) {
|
||||
Logger::debug('mailstream: not enabled for item ' . $item['id']);
|
||||
return;
|
||||
}
|
||||
|
@ -123,7 +122,7 @@ function mailstream_post_hook(&$a, &$item) {
|
|||
Logger::debug('mailstream: no plink for item ' . $item['id']);
|
||||
return;
|
||||
}
|
||||
if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) {
|
||||
if (DI::pConfig()->get($item['uid'], 'mailstream', 'nolikes')) {
|
||||
if ($item['verb'] == Activity::LIKE) {
|
||||
Logger::debug('mailstream: like item ' . $item['id']);
|
||||
return;
|
||||
|
@ -159,7 +158,7 @@ function mailstream_get_user($uid) {
|
|||
}
|
||||
|
||||
function mailstream_do_images($a, &$item, &$attachments) {
|
||||
if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
|
||||
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'attachimg')) {
|
||||
return;
|
||||
}
|
||||
$attachments = [];
|
||||
|
@ -282,7 +281,7 @@ function mailstream_send(\Friendica\App $a, $message_id, $item, $user) {
|
|||
if ($frommail == "") {
|
||||
$frommail = 'friendica@localhost.local';
|
||||
}
|
||||
$address = PConfig::get($item['uid'], 'mailstream', 'address');
|
||||
$address = DI::pConfig()->get($item['uid'], 'mailstream', 'address');
|
||||
if (!$address) {
|
||||
$address = $user['email'];
|
||||
}
|
||||
|
@ -369,10 +368,10 @@ function mailstream_cron($a, $b) {
|
|||
}
|
||||
|
||||
function mailstream_addon_settings(&$a,&$s) {
|
||||
$enabled = PConfig::get(local_user(), 'mailstream', 'enabled');
|
||||
$address = PConfig::get(local_user(), 'mailstream', 'address');
|
||||
$nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
|
||||
$attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'mailstream', 'enabled');
|
||||
$address = DI::pConfig()->get(local_user(), 'mailstream', 'address');
|
||||
$nolikes = DI::pConfig()->get(local_user(), 'mailstream', 'nolikes');
|
||||
$attachimg= DI::pConfig()->get(local_user(), 'mailstream', 'attachimg');
|
||||
$template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
|
||||
$s .= Renderer::replaceMacros($template, [
|
||||
'$enabled' => [
|
||||
|
@ -400,28 +399,28 @@ function mailstream_addon_settings(&$a,&$s) {
|
|||
|
||||
function mailstream_addon_settings_post($a,$post) {
|
||||
if ($_POST['mailstream_address'] != "") {
|
||||
PConfig::set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
|
||||
}
|
||||
else {
|
||||
PConfig::delete(local_user(), 'mailstream', 'address');
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'address');
|
||||
}
|
||||
if ($_POST['mailstream_nolikes']) {
|
||||
PConfig::set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
|
||||
}
|
||||
else {
|
||||
PConfig::delete(local_user(), 'mailstream', 'nolikes');
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'nolikes');
|
||||
}
|
||||
if ($_POST['mailstream_enabled']) {
|
||||
PConfig::set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
|
||||
}
|
||||
else {
|
||||
PConfig::delete(local_user(), 'mailstream', 'enabled');
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'enabled');
|
||||
}
|
||||
if ($_POST['mailstream_attachimg']) {
|
||||
PConfig::set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
|
||||
DI::pConfig()->set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
|
||||
}
|
||||
else {
|
||||
PConfig::delete(local_user(), 'mailstream', 'attachimg');
|
||||
DI::pConfig()->delete(local_user(), 'mailstream', 'attachimg');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
|
||||
function markdown_install() {
|
||||
Hook::register('post_local_start', __FILE__, 'markdown_post_local_start');
|
||||
|
@ -25,7 +24,7 @@ function markdown_addon_settings(App $a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(PConfig::get(local_user(), 'markdown', 'enabled'));
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'markdown', 'enabled'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/markdown/');
|
||||
$s .= Renderer::replaceMacros($t, [
|
||||
|
@ -41,11 +40,11 @@ function markdown_addon_settings_post(App $a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'markdown', 'enabled', intval($_POST['enabled']));
|
||||
DI::pConfig()->set(local_user(), 'markdown', 'enabled', intval($_POST['enabled']));
|
||||
}
|
||||
|
||||
function markdown_post_local_start(App $a, &$request) {
|
||||
if (empty($request['body']) || !PConfig::get(local_user(), 'markdown', 'enabled')) {
|
||||
if (empty($request['body']) || !DI::pConfig()->get(local_user(), 'markdown', 'enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -40,7 +39,7 @@ function mathjax_settings_post($a)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'mathjax', 'use', intval($_POST['mathjax_use']));
|
||||
DI::pConfig()->set(local_user(), 'mathjax', 'use', intval($_POST['mathjax_use']));
|
||||
}
|
||||
|
||||
function mathjax_settings(App $a, &$s)
|
||||
|
@ -49,7 +48,7 @@ function mathjax_settings(App $a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$use = PConfig::get(local_user(), 'mathjax', 'use', false);
|
||||
$use = DI::pConfig()->get(local_user(), 'mathjax', 'use', false);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings.tpl', __DIR__);
|
||||
$s .= Renderer::replaceMacros($tpl, [
|
||||
|
@ -64,7 +63,7 @@ function mathjax_footer(App $a, &$b)
|
|||
{
|
||||
// if the visitor of the page is not a local_user, use MathJax
|
||||
// otherwise check the users settings.
|
||||
if (!local_user() || PConfig::get(local_user(), 'mathjax', 'use', false)) {
|
||||
if (!local_user() || DI::pConfig()->get(local_user(), 'mathjax', 'use', false)) {
|
||||
DI::page()->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
|
||||
DI::page()->registerFooterScript(__DIR__ . '/mathjax.js');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function notimeline_install()
|
||||
|
@ -30,7 +29,7 @@ function notimeline_settings_post($a, $post)
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
|
||||
info(L10n::t('No Timeline settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -46,7 +45,7 @@ function notimeline_settings(&$a, &$s)
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$notimeline = PConfig::get(local_user(), 'system', 'no_wall_archive_widget', false);
|
||||
$notimeline = DI::pConfig()->get(local_user(), 'system', 'no_wall_archive_widget', false);
|
||||
|
||||
$notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function nsfw_install()
|
||||
|
@ -68,8 +67,8 @@ function nsfw_addon_settings(&$a, &$s)
|
|||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/nsfw/nsfw.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$enable_checked = (intval(PConfig::get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" ');
|
||||
$words = PConfig::get(local_user(), 'nsfw', 'words');
|
||||
$enable_checked = (intval(DI::pConfig()->get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" ');
|
||||
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words');
|
||||
if (!$words) {
|
||||
$words = 'nsfw,';
|
||||
}
|
||||
|
@ -103,10 +102,10 @@ function nsfw_addon_settings_post(&$a, &$b)
|
|||
}
|
||||
|
||||
if (!empty($_POST['nsfw-submit'])) {
|
||||
PConfig::set(local_user(), 'nsfw', 'words', trim($_POST['nsfw-words']));
|
||||
DI::pConfig()->set(local_user(), 'nsfw', 'words', trim($_POST['nsfw-words']));
|
||||
$enable = (!empty($_POST['nsfw-enable']) ? intval($_POST['nsfw-enable']) : 0);
|
||||
$disable = 1 - $enable;
|
||||
PConfig::set(local_user(), 'nsfw', 'disable', $disable);
|
||||
DI::pConfig()->set(local_user(), 'nsfw', 'disable', $disable);
|
||||
info(L10n::t('NSFW Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -114,12 +113,12 @@ function nsfw_addon_settings_post(&$a, &$b)
|
|||
function nsfw_prepare_body_content_filter(\Friendica\App $a, &$hook_data)
|
||||
{
|
||||
$words = null;
|
||||
if (PConfig::get(local_user(), 'nsfw', 'disable')) {
|
||||
if (DI::pConfig()->get(local_user(), 'nsfw', 'disable')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
$words = PConfig::get(local_user(), 'nsfw', 'words');
|
||||
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words');
|
||||
}
|
||||
|
||||
if ($words) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function numfriends_install() {
|
||||
|
@ -41,7 +40,7 @@ function numfriends_settings_post($a,$post) {
|
|||
if(! local_user() || empty($_POST['numfriends-submit']))
|
||||
return;
|
||||
|
||||
PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
|
||||
DI::pConfig()->set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
|
||||
info( L10n::t('Numfriends settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,7 @@ function numfriends_settings(&$a, &$s)
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$numfriends = PConfig::get(local_user(), 'system', 'display_friend_count', 24);
|
||||
$numfriends = DI::pConfig()->get(local_user(), 'system', 'display_friend_count', 24);
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function planets_install() {
|
||||
|
@ -82,7 +81,7 @@ function planets_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = PConfig::get(local_user(), 'planets', 'enable');
|
||||
$active = DI::pConfig()->get(local_user(), 'planets', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -120,7 +119,7 @@ function planets_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['planets-submit'])
|
||||
PConfig::set(local_user(),'planets','enable',intval($_POST['planets']));
|
||||
DI::pConfig()->set(local_user(),'planets','enable',intval($_POST['planets']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,7 +143,7 @@ function planets_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'planets','enable');
|
||||
$enabled = DI::pConfig()->get(local_user(),'planets','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -91,8 +90,8 @@ function pumpio_content(App $a)
|
|||
|
||||
function pumpio_check_item_notification($a, &$notification_data)
|
||||
{
|
||||
$hostname = PConfig::get($notification_data["uid"], 'pumpio', 'host');
|
||||
$username = PConfig::get($notification_data["uid"], "pumpio", "user");
|
||||
$hostname = DI::pConfig()->get($notification_data["uid"], 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($notification_data["uid"], "pumpio", "user");
|
||||
|
||||
$notification_data["profiles"][] = "https://".$hostname."/".$username;
|
||||
}
|
||||
|
@ -143,18 +142,18 @@ function pumpio_registerclient(App $a, $host)
|
|||
function pumpio_connect(App $a)
|
||||
{
|
||||
// Define the needed keys
|
||||
$consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret');
|
||||
$hostname = PConfig::get(local_user(), 'pumpio', 'host');
|
||||
$consumer_key = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_secret');
|
||||
$hostname = DI::pConfig()->get(local_user(), 'pumpio', 'host');
|
||||
|
||||
if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) {
|
||||
Logger::log("pumpio_connect: register client");
|
||||
$clientdata = pumpio_registerclient($a, $hostname);
|
||||
PConfig::set(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
||||
PConfig::set(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
||||
|
||||
$consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret');
|
||||
$consumer_key = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_key');
|
||||
$consumer_secret = DI::pConfig()->get(local_user(), 'pumpio', 'consumer_secret');
|
||||
|
||||
Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, Logger::DEBUG);
|
||||
}
|
||||
|
@ -191,8 +190,8 @@ function pumpio_connect(App $a)
|
|||
if (($success = $client->Process())) {
|
||||
if (strlen($client->access_token)) {
|
||||
Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, Logger::DEBUG);
|
||||
PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token);
|
||||
PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
||||
DI::pConfig()->set(local_user(), "pumpio", "oauth_token", $client->access_token);
|
||||
DI::pConfig()->set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
||||
}
|
||||
}
|
||||
$success = $client->Finalize($success);
|
||||
|
@ -219,13 +218,13 @@ function pumpio_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'pumpio', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'pumpio', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'pumpio_enable',
|
||||
L10n::t('Post to pumpio'),
|
||||
PConfig::get(local_user(), 'pumpio', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -243,24 +242,24 @@ function pumpio_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$import_enabled = PConfig::get(local_user(), 'pumpio', 'import');
|
||||
$import_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'import');
|
||||
$import_checked = (($import_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$enabled = PConfig::get(local_user(), 'pumpio', 'post');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'pumpio', 'post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(), 'pumpio', 'post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default');
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$public_enabled = PConfig::get(local_user(), 'pumpio', 'public');
|
||||
$public_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'public');
|
||||
$public_checked = (($public_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$mirror_enabled = PConfig::get(local_user(), 'pumpio', 'mirror');
|
||||
$mirror_enabled = DI::pConfig()->get(local_user(), 'pumpio', 'mirror');
|
||||
$mirror_checked = (($mirror_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$servername = PConfig::get(local_user(), "pumpio", "host");
|
||||
$username = PConfig::get(local_user(), "pumpio", "user");
|
||||
$servername = DI::pConfig()->get(local_user(), "pumpio", "host");
|
||||
$username = DI::pConfig()->get(local_user(), "pumpio", "user");
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
@ -283,8 +282,8 @@ function pumpio_settings(App $a, &$s)
|
|||
$s .= '</div><div class="clear"></div>';
|
||||
|
||||
if (($username != '') && ($servername != '')) {
|
||||
$oauth_token = PConfig::get(local_user(), "pumpio", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get(local_user(), "pumpio", "oauth_token_secret");
|
||||
$oauth_token = DI::pConfig()->get(local_user(), "pumpio", "oauth_token");
|
||||
$oauth_token_secret = DI::pConfig()->get(local_user(), "pumpio", "oauth_token_secret");
|
||||
|
||||
$s .= '<div id="pumpio-password-wrapper">';
|
||||
if (($oauth_token == "") || ($oauth_token_secret == "")) {
|
||||
|
@ -335,19 +334,19 @@ function pumpio_settings_post(App $a, array &$b)
|
|||
{
|
||||
if (!empty($_POST['pumpio-submit'])) {
|
||||
if (!empty($_POST['pumpio_delete'])) {
|
||||
PConfig::set(local_user(), 'pumpio', 'consumer_key' , '');
|
||||
PConfig::set(local_user(), 'pumpio', 'consumer_secret' , '');
|
||||
PConfig::set(local_user(), 'pumpio', 'oauth_token' , '');
|
||||
PConfig::set(local_user(), 'pumpio', 'oauth_token_secret', '');
|
||||
PConfig::set(local_user(), 'pumpio', 'post' , false);
|
||||
PConfig::set(local_user(), 'pumpio', 'import' , false);
|
||||
PConfig::set(local_user(), 'pumpio', 'host' , '');
|
||||
PConfig::set(local_user(), 'pumpio', 'user' , '');
|
||||
PConfig::set(local_user(), 'pumpio', 'public' , false);
|
||||
PConfig::set(local_user(), 'pumpio', 'mirror' , false);
|
||||
PConfig::set(local_user(), 'pumpio', 'post_by_default' , false);
|
||||
PConfig::set(local_user(), 'pumpio', 'lastdate' , 0);
|
||||
PConfig::set(local_user(), 'pumpio', 'last_id' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_key' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'consumer_secret' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'oauth_token_secret', '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'import' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'host' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'user' , '');
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'public' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'mirror' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post_by_default' , false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'lastdate' , 0);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'last_id' , '');
|
||||
} else {
|
||||
// filtering the username if it is filled wrong
|
||||
$user = $_POST['pumpio_user'];
|
||||
|
@ -364,16 +363,16 @@ function pumpio_settings_post(App $a, array &$b)
|
|||
$host = trim($host);
|
||||
$host = str_replace(["https://", "http://"], ["", ""], $host);
|
||||
|
||||
PConfig::set(local_user(), 'pumpio', 'post' , $_POST['pumpio'] ?? false);
|
||||
PConfig::set(local_user(), 'pumpio', 'import' , $_POST['pumpio_import'] ?? false);
|
||||
PConfig::set(local_user(), 'pumpio', 'host' , $host);
|
||||
PConfig::set(local_user(), 'pumpio', 'user' , $user);
|
||||
PConfig::set(local_user(), 'pumpio', 'public' , $_POST['pumpio_public'] ?? false);
|
||||
PConfig::set(local_user(), 'pumpio', 'mirror' , $_POST['pumpio_mirror'] ?? false);
|
||||
PConfig::set(local_user(), 'pumpio', 'post_by_default', $_POST['pumpio_bydefault'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post' , $_POST['pumpio'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'import' , $_POST['pumpio_import'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'host' , $host);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'user' , $user);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'public' , $_POST['pumpio_public'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'mirror' , $_POST['pumpio_mirror'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'pumpio', 'post_by_default', $_POST['pumpio_bydefault'] ?? false);
|
||||
|
||||
if (!empty($_POST['pumpio_mirror'])) {
|
||||
PConfig::delete(local_user(), 'pumpio', 'lastdate');
|
||||
DI::pConfig()->delete(local_user(), 'pumpio', 'lastdate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +403,7 @@ function pumpio_hook_fork(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get($post['uid'], 'pumpio', 'import')) {
|
||||
if (DI::pConfig()->get($post['uid'], 'pumpio', 'import')) {
|
||||
// Don't fork if it isn't a reply to a pump.io post
|
||||
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::PUMPIO])) {
|
||||
Logger::log('No pump.io parent found for item ' . $post['id']);
|
||||
|
@ -426,11 +425,11 @@ function pumpio_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$pumpio_post = intval(PConfig::get(local_user(), 'pumpio', 'post'));
|
||||
$pumpio_post = intval(DI::pConfig()->get(local_user(), 'pumpio', 'post'));
|
||||
|
||||
$pumpio_enable = (($pumpio_post && !empty($_REQUEST['pumpio_enable'])) ? intval($_REQUEST['pumpio_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'pumpio', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'pumpio', 'post_by_default'))) {
|
||||
$pumpio_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -447,7 +446,7 @@ function pumpio_post_local(App $a, array &$b)
|
|||
|
||||
function pumpio_send(App $a, array &$b)
|
||||
{
|
||||
if (!PConfig::get($b["uid"], 'pumpio', 'import') && ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) {
|
||||
if (!DI::pConfig()->get($b["uid"], 'pumpio', 'import') && ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -517,14 +516,14 @@ function pumpio_send(App $a, array &$b)
|
|||
// Support for native shares
|
||||
// http://<hostname>/api/<type>/shares?id=<the-object-id>
|
||||
|
||||
$oauth_token = PConfig::get($b['uid'], "pumpio", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get($b['uid'], "pumpio", "oauth_token_secret");
|
||||
$consumer_key = PConfig::get($b['uid'], "pumpio","consumer_key");
|
||||
$consumer_secret = PConfig::get($b['uid'], "pumpio","consumer_secret");
|
||||
$oauth_token = DI::pConfig()->get($b['uid'], "pumpio", "oauth_token");
|
||||
$oauth_token_secret = DI::pConfig()->get($b['uid'], "pumpio", "oauth_token_secret");
|
||||
$consumer_key = DI::pConfig()->get($b['uid'], "pumpio","consumer_key");
|
||||
$consumer_secret = DI::pConfig()->get($b['uid'], "pumpio","consumer_secret");
|
||||
|
||||
$host = PConfig::get($b['uid'], "pumpio", "host");
|
||||
$user = PConfig::get($b['uid'], "pumpio", "user");
|
||||
$public = PConfig::get($b['uid'], "pumpio", "public");
|
||||
$host = DI::pConfig()->get($b['uid'], "pumpio", "host");
|
||||
$user = DI::pConfig()->get($b['uid'], "pumpio", "user");
|
||||
$public = DI::pConfig()->get($b['uid'], "pumpio", "public");
|
||||
|
||||
if ($oauth_token && $oauth_token_secret) {
|
||||
$title = trim($b['title']);
|
||||
|
@ -597,7 +596,7 @@ function pumpio_send(App $a, array &$b)
|
|||
|
||||
if ($success) {
|
||||
if ($user->generator->displayName) {
|
||||
PConfig::set($b["uid"], "pumpio", "application_name", $user->generator->displayName);
|
||||
DI::pConfig()->set($b["uid"], "pumpio", "application_name", $user->generator->displayName);
|
||||
}
|
||||
|
||||
$post_id = $user->object->id;
|
||||
|
@ -616,16 +615,16 @@ function pumpio_send(App $a, array &$b)
|
|||
function pumpio_action(App $a, $uid, $uri, $action, $content = "")
|
||||
{
|
||||
// Don't do likes and other stuff if you don't import the timeline
|
||||
if (!PConfig::get($uid, 'pumpio', 'import')) {
|
||||
if (!DI::pConfig()->get($uid, 'pumpio', 'import')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ckey = PConfig::get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = PConfig::get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = PConfig::get($uid, 'pumpio', 'host');
|
||||
$username = PConfig::get($uid, "pumpio", "user");
|
||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
$orig_post = Item::selectFirst([], ['uri' => $uri, 'uid' => $uid]);
|
||||
|
||||
|
@ -731,7 +730,7 @@ function pumpio_sync(App $a)
|
|||
pumpio_fetchinbox($a, $rr['uid']);
|
||||
|
||||
// check for new contacts once a day
|
||||
$last_contact_check = PConfig::get($rr['uid'], 'pumpio', 'contact_check');
|
||||
$last_contact_check = DI::pConfig()->get($rr['uid'], 'pumpio', 'contact_check');
|
||||
if ($last_contact_check) {
|
||||
$next_contact_check = $last_contact_check + 86400;
|
||||
} else {
|
||||
|
@ -740,7 +739,7 @@ function pumpio_sync(App $a)
|
|||
|
||||
if ($next_contact_check <= time()) {
|
||||
pumpio_getallusers($a, $rr["uid"]);
|
||||
PConfig::set($rr['uid'], 'pumpio', 'contact_check', time());
|
||||
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -757,18 +756,18 @@ function pumpio_cron(App $a, $b)
|
|||
|
||||
function pumpio_fetchtimeline(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = PConfig::get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$lastdate = PConfig::get($uid, 'pumpio', 'lastdate');
|
||||
$hostname = PConfig::get($uid, 'pumpio', 'host');
|
||||
$username = PConfig::get($uid, "pumpio", "user");
|
||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$lastdate = DI::pConfig()->get($uid, 'pumpio', 'lastdate');
|
||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
// get the application name for the pump.io app
|
||||
// 1st try personal config, then system config and fallback to the
|
||||
// hostname of the node if neither one is set.
|
||||
$application_name = PConfig::get($uid, 'pumpio', 'application_name');
|
||||
$application_name = DI::pConfig()->get($uid, 'pumpio', 'application_name');
|
||||
if ($application_name == "") {
|
||||
$application_name = Config::get('pumpio', 'application_name');
|
||||
}
|
||||
|
@ -882,7 +881,7 @@ function pumpio_fetchtimeline(App $a, $uid)
|
|||
}
|
||||
|
||||
if ($lastdate != 0) {
|
||||
PConfig::set($uid, 'pumpio', 'lastdate', $lastdate);
|
||||
DI::pConfig()->set($uid, 'pumpio', 'lastdate', $lastdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1308,13 +1307,13 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
|||
|
||||
function pumpio_fetchinbox(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = PConfig::get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$lastdate = PConfig::get($uid, 'pumpio', 'lastdate');
|
||||
$hostname = PConfig::get($uid, 'pumpio', 'host');
|
||||
$username = PConfig::get($uid, "pumpio", "user");
|
||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$lastdate = DI::pConfig()->get($uid, 'pumpio', 'lastdate');
|
||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
$own_id = "https://".$hostname."/".$username;
|
||||
|
||||
|
@ -1339,7 +1338,7 @@ function pumpio_fetchinbox(App $a, $uid)
|
|||
$client->access_token = $otoken;
|
||||
$client->access_token_secret = $osecret;
|
||||
|
||||
$last_id = PConfig::get($uid, 'pumpio', 'last_id');
|
||||
$last_id = DI::pConfig()->get($uid, 'pumpio', 'last_id');
|
||||
|
||||
$url = 'https://'.$hostname.'/api/user/'.$username.'/inbox';
|
||||
|
||||
|
@ -1372,17 +1371,17 @@ function pumpio_fetchinbox(App $a, $uid)
|
|||
pumpio_fetchallcomments($a, $uid, $item["uri"]);
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'pumpio', 'last_id', $last_id);
|
||||
DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id);
|
||||
}
|
||||
|
||||
function pumpio_getallusers(App &$a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = PConfig::get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = PConfig::get($uid, 'pumpio', 'host');
|
||||
$username = PConfig::get($uid, "pumpio", "user");
|
||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
$client = new oauth_client_class;
|
||||
$client->oauth_version = '1.0a';
|
||||
|
@ -1432,7 +1431,7 @@ function pumpio_getreceiver(App $a, array $b)
|
|||
return $receiver;
|
||||
}
|
||||
|
||||
$public = PConfig::get($b['uid'], "pumpio", "public");
|
||||
$public = DI::pConfig()->get($b['uid'], "pumpio", "public");
|
||||
|
||||
if ($public) {
|
||||
$receiver["to"][] = [
|
||||
|
@ -1510,12 +1509,12 @@ function pumpio_getreceiver(App $a, array $b)
|
|||
|
||||
function pumpio_fetchallcomments(App $a, $uid, $id)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = PConfig::get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = PConfig::get($uid, 'pumpio', 'host');
|
||||
$username = PConfig::get($uid, "pumpio", "user");
|
||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||
$username = DI::pConfig()->get($uid, "pumpio", "user");
|
||||
|
||||
Logger::log("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -45,7 +44,7 @@ function qcomment_addon_settings(&$a, &$s)
|
|||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/qcomment/qcomment.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$words = PConfig::get(local_user(), 'qcomment', 'words', L10n::t(':-)') . "\n" . L10n::t(':-(') . "\n" . L10n::t('lol'));
|
||||
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words', L10n::t(':-)') . "\n" . L10n::t(':-(') . "\n" . L10n::t('lol'));
|
||||
|
||||
$s .= '<div class="settings-block">';
|
||||
$s .= '<h3>' . L10n::t('Quick Comment Settings') . '</h3>';
|
||||
|
@ -68,7 +67,7 @@ function qcomment_addon_settings_post(&$a, &$b)
|
|||
}
|
||||
|
||||
if ($_POST['qcomment-submit']) {
|
||||
PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
|
||||
DI::pConfig()->set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
|
||||
info(L10n::t('Quick Comment settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
function randplace_install() {
|
||||
|
@ -94,7 +93,7 @@ function randplace_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = PConfig::get(local_user(), 'randplace', 'enable');
|
||||
$active = DI::pConfig()->get(local_user(), 'randplace', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -139,7 +138,7 @@ function randplace_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['randplace-submit'])
|
||||
PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace']));
|
||||
DI::pConfig()->set(local_user(),'randplace','enable',intval($_POST['randplace']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,7 +162,7 @@ function randplace_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'randplace','enable');
|
||||
$enabled = DI::pConfig()->get(local_user(),'randplace','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -43,7 +42,7 @@ function remote_permissions_settings(&$a,&$o) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$remote_perms = PConfig::get(local_user(),'remote_perms','show');
|
||||
$remote_perms = DI::pConfig()->get(local_user(),'remote_perms','show');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
@ -62,7 +61,7 @@ function remote_permissions_settings_post($a,$post) {
|
|||
if(! local_user() || empty($_POST['remote-perms-submit']))
|
||||
return;
|
||||
|
||||
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
DI::pConfig()->set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
info(L10n::t('Remote Permissions settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -94,7 +93,7 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if(! $r)
|
||||
return;
|
||||
|
||||
if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0)
|
||||
if(DI::pConfig()->get($r[0]['uid'],'remote_perms','show') == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Emailer;
|
||||
|
@ -54,8 +53,8 @@ function securemail_settings(App &$a, &$s)
|
|||
return;
|
||||
}
|
||||
|
||||
$enable = intval(PConfig::get(local_user(), 'securemail', 'enable'));
|
||||
$publickey = PConfig::get(local_user(), 'securemail', 'pkey');
|
||||
$enable = intval(DI::pConfig()->get(local_user(), 'securemail', 'enable'));
|
||||
$publickey = DI::pConfig()->get(local_user(), 'securemail', 'pkey');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/securemail/');
|
||||
|
||||
|
@ -85,9 +84,9 @@ function securemail_settings_post(App &$a, array &$b)
|
|||
}
|
||||
|
||||
if ($_POST['securemail-submit']) {
|
||||
PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
$enable = (!empty($_POST['securemail-enable']) ? 1 : 0);
|
||||
PConfig::set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
info(L10n::t('Secure Mail Settings saved.') . EOL);
|
||||
|
||||
if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
|
||||
|
@ -117,12 +116,12 @@ function securemail_settings_post(App &$a, array &$b)
|
|||
];
|
||||
|
||||
// enable addon for test
|
||||
PConfig::set(local_user(), 'securemail', 'enable', 1);
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', 1);
|
||||
|
||||
$res = Emailer::send($params);
|
||||
|
||||
// revert to saved value
|
||||
PConfig::set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
|
||||
if ($res) {
|
||||
info(L10n::t('Test email sent') . EOL);
|
||||
|
@ -151,12 +150,12 @@ function securemail_emailer_send_prepare(App &$a, array &$b)
|
|||
|
||||
$uid = $b['uid'];
|
||||
|
||||
$enable_checked = PConfig::get($uid, 'securemail', 'enable');
|
||||
$enable_checked = DI::pConfig()->get($uid, 'securemail', 'enable');
|
||||
if (!$enable_checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_key_ascii = PConfig::get($uid, 'securemail', 'pkey');
|
||||
$public_key_ascii = DI::pConfig()->get($uid, 'securemail', 'pkey');
|
||||
|
||||
preg_match('/-----BEGIN ([A-Za-z ]+)-----/', $public_key_ascii, $matches);
|
||||
$marker = empty($matches[1]) ? 'MESSAGE' : $matches[1];
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -37,8 +36,8 @@ function showmore_addon_settings(&$a, &$s)
|
|||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/showmore/showmore.css'.'" media="all"/>'."\r\n";
|
||||
|
||||
$enable_checked = (intval(PConfig::get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"');
|
||||
$chars = PConfig::get(local_user(), 'showmore', 'chars', 1100);
|
||||
$enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"');
|
||||
$chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
|
||||
|
||||
$s .= '<span id="settings_showmore_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">';
|
||||
$s .= '<h3>' . L10n::t('"Show more" Settings').'</h3>';
|
||||
|
@ -71,10 +70,10 @@ function showmore_addon_settings_post(&$a, &$b)
|
|||
}
|
||||
|
||||
if (!empty($_POST['showmore-submit'])) {
|
||||
PConfig::set(local_user(), 'showmore', 'chars', trim($_POST['showmore-chars']));
|
||||
DI::pConfig()->set(local_user(), 'showmore', 'chars', trim($_POST['showmore-chars']));
|
||||
$enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0);
|
||||
$disable = 1-$enable;
|
||||
PConfig::set(local_user(), 'showmore', 'disable', $disable);
|
||||
DI::pConfig()->set(local_user(), 'showmore', 'disable', $disable);
|
||||
info(L10n::t('Show More Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -119,11 +118,11 @@ function showmore_prepare_body(\Friendica\App $a, &$hook_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'showmore', 'disable')) {
|
||||
if (DI::pConfig()->get(local_user(), 'showmore', 'disable')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$chars = (int) PConfig::get(local_user(), 'showmore', 'chars', 1100);
|
||||
$chars = (int) DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
|
||||
|
||||
if (get_body_length($hook_data['html']) > $chars) {
|
||||
$found = true;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
function startpage_install() {
|
||||
|
@ -31,7 +29,7 @@ function startpage_home_init($a, $b)
|
|||
return;
|
||||
}
|
||||
|
||||
$page = PConfig::get(local_user(), 'startpage', 'startpage');
|
||||
$page = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
|
||||
if (strlen($page)) {
|
||||
DI::baseUrl()->redirect($page);
|
||||
}
|
||||
|
@ -54,7 +52,7 @@ function startpage_settings_post($a, $post)
|
|||
}
|
||||
|
||||
if (!empty($_POST['startpage-submit'])) {
|
||||
PConfig::set(local_user(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
|
||||
DI::pConfig()->set(local_user(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +74,7 @@ function startpage_settings(&$a, &$s)
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$page = PConfig::get(local_user(), 'startpage', 'startpage');
|
||||
$page = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -97,8 +96,8 @@ function statusnet_uninstall()
|
|||
|
||||
function statusnet_check_item_notification(App $a, &$notification_data)
|
||||
{
|
||||
if (PConfig::get($notification_data["uid"], 'statusnet', 'post')) {
|
||||
$notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url');
|
||||
if (DI::pConfig()->get($notification_data["uid"], 'statusnet', 'post')) {
|
||||
$notification_data["profiles"][] = DI::pConfig()->get($notification_data["uid"], 'statusnet', 'own_url');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,13 +107,13 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'statusnet', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'statusnet', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'statusnet_enable',
|
||||
L10n::t('Post to GNU Social'),
|
||||
PConfig::get(local_user(), 'statusnet', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -134,18 +133,18 @@ function statusnet_settings_post(App $a, $post)
|
|||
/* * *
|
||||
* if the GNU Social-disconnect checkbox is set, clear the GNU Social configuration
|
||||
*/
|
||||
PConfig::delete(local_user(), 'statusnet', 'consumerkey');
|
||||
PConfig::delete(local_user(), 'statusnet', 'consumersecret');
|
||||
PConfig::delete(local_user(), 'statusnet', 'post');
|
||||
PConfig::delete(local_user(), 'statusnet', 'post_by_default');
|
||||
PConfig::delete(local_user(), 'statusnet', 'oauthtoken');
|
||||
PConfig::delete(local_user(), 'statusnet', 'oauthsecret');
|
||||
PConfig::delete(local_user(), 'statusnet', 'baseapi');
|
||||
PConfig::delete(local_user(), 'statusnet', 'lastid');
|
||||
PConfig::delete(local_user(), 'statusnet', 'mirror_posts');
|
||||
PConfig::delete(local_user(), 'statusnet', 'import');
|
||||
PConfig::delete(local_user(), 'statusnet', 'create_user');
|
||||
PConfig::delete(local_user(), 'statusnet', 'own_url');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'consumerkey');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'consumersecret');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'post');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'post_by_default');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'oauthtoken');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'oauthsecret');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'baseapi');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'mirror_posts');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'import');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'create_user');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'own_url');
|
||||
} else {
|
||||
if (isset($_POST['statusnet-preconf-apiurl'])) {
|
||||
/* * *
|
||||
|
@ -159,10 +158,10 @@ function statusnet_settings_post(App $a, $post)
|
|||
$apibase = $asn['apiurl'];
|
||||
$c = Network::fetchUrl($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
PConfig::set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
|
||||
PConfig::set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
|
||||
PConfig::set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
|
||||
//PConfig::set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
|
||||
//DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
|
||||
} else {
|
||||
notice(L10n::t('Please contact your site administrator.<br />The provided API URL is not valid.') . EOL . $asn['apiurl'] . EOL);
|
||||
}
|
||||
|
@ -178,19 +177,19 @@ function statusnet_settings_post(App $a, $post)
|
|||
$c = Network::fetchUrl($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
// ok the API path is correct, let's save the settings
|
||||
PConfig::set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
PConfig::set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
//PConfig::set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
//DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
|
||||
} else {
|
||||
// the API path is not correct, maybe missing trailing / ?
|
||||
$apibase = $apibase . '/';
|
||||
$c = Network::fetchUrl($apibase . 'statusnet/version.xml');
|
||||
if (strlen($c) > 0) {
|
||||
// ok the API path is now correct, let's save the settings
|
||||
PConfig::set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
PConfig::set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
|
||||
} else {
|
||||
// still not the correct API base, let's do noting
|
||||
notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL);
|
||||
|
@ -200,32 +199,32 @@ function statusnet_settings_post(App $a, $post)
|
|||
} else {
|
||||
if (isset($_POST['statusnet-pin'])) {
|
||||
// if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
|
||||
$api = PConfig::get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
// the token and secret for which the PIN was generated were hidden in the settings
|
||||
// form as token and token2, we need a new connection to GNU Social using these token
|
||||
// and secret to request a Access Token with the PIN
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']);
|
||||
$token = $connection->getAccessToken($_POST['statusnet-pin']);
|
||||
// ok, now that we have the Access Token, save them in the user config
|
||||
PConfig::set(local_user(), 'statusnet', 'oauthtoken', $token['oauth_token']);
|
||||
PConfig::set(local_user(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
|
||||
PConfig::set(local_user(), 'statusnet', 'post', 1);
|
||||
PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post', 1);
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post_taglinks', 1);
|
||||
// reload the Addon Settings page, if we don't do it see Bug #42
|
||||
DI::baseUrl()->redirect('settings/connectors');
|
||||
} else {
|
||||
// if no PIN is supplied in the POST variables, the user has changed the setting
|
||||
// to post a dent for every new __public__ posting to the wall
|
||||
PConfig::set(local_user(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
|
||||
PConfig::set(local_user(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
|
||||
PConfig::set(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
|
||||
PConfig::set(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
|
||||
PConfig::set(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
|
||||
DI::pConfig()->set(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
|
||||
|
||||
if (!intval($_POST['statusnet-mirror']))
|
||||
PConfig::delete(local_user(), 'statusnet', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
|
||||
|
||||
info(L10n::t('GNU Social settings updated.') . EOL);
|
||||
}
|
||||
|
@ -246,23 +245,23 @@ function statusnet_settings(App $a, &$s)
|
|||
* allow the user to cancel the connection process at this step
|
||||
* 3) Checkbox for "Send public notices (respect size limitation)
|
||||
*/
|
||||
$api = PConfig::get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get(local_user(), 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get(local_user(), 'statusnet', 'oauthsecret');
|
||||
$enabled = PConfig::get(local_user(), 'statusnet', 'post');
|
||||
$api = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get(local_user(), 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(local_user(), 'statusnet', 'oauthsecret');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'statusnet', 'post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$defenabled = PConfig::get(local_user(), 'statusnet', 'post_by_default');
|
||||
$defenabled = DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default');
|
||||
$defchecked = (($defenabled) ? ' checked="checked" ' : '');
|
||||
$mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
|
||||
$mirrorenabled = DI::pConfig()->get(local_user(), 'statusnet', 'mirror_posts');
|
||||
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
||||
$import = PConfig::get(local_user(), 'statusnet', 'import');
|
||||
$import = DI::pConfig()->get(local_user(), 'statusnet', 'import');
|
||||
$importselected = ["", "", ""];
|
||||
$importselected[$import] = ' selected="selected"';
|
||||
//$importenabled = PConfig::get(local_user(),'statusnet','import');
|
||||
//$importenabled = DI::pConfig()->get(local_user(),'statusnet','import');
|
||||
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
||||
$create_userenabled = PConfig::get(local_user(), 'statusnet', 'create_user');
|
||||
$create_userenabled = DI::pConfig()->get(local_user(), 'statusnet', 'create_user');
|
||||
$create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
@ -423,7 +422,7 @@ function statusnet_hook_fork(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get($post['uid'], 'statusnet', 'import')) {
|
||||
if (DI::pConfig()->get($post['uid'], 'statusnet', 'import')) {
|
||||
// Don't fork if it isn't a reply to a GNU Social post
|
||||
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::STATUSNET])) {
|
||||
Logger::log('No GNU Social parent found for item ' . $post['id']);
|
||||
|
@ -449,11 +448,11 @@ function statusnet_post_local(App $a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
|
||||
$statusnet_post = DI::pConfig()->get(local_user(), 'statusnet', 'post');
|
||||
$statusnet_enable = (($statusnet_post && !empty($_REQUEST['statusnet_enable'])) ? intval($_REQUEST['statusnet_enable']) : 0);
|
||||
|
||||
// if API is used, default to the chosen settings
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'statusnet', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default'))) {
|
||||
$statusnet_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -470,11 +469,11 @@ function statusnet_post_local(App $a, &$b)
|
|||
|
||||
function statusnet_action(App $a, $uid, $pid, $action)
|
||||
{
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
|
@ -499,12 +498,12 @@ function statusnet_post_hook(App $a, &$b)
|
|||
/**
|
||||
* Post to GNU Social
|
||||
*/
|
||||
if (!PConfig::get($b["uid"], 'statusnet', 'import')) {
|
||||
if (!DI::pConfig()->get($b["uid"], 'statusnet', 'import')) {
|
||||
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||
return;
|
||||
}
|
||||
|
||||
$api = PConfig::get($b["uid"], 'statusnet', 'baseapi');
|
||||
$api = DI::pConfig()->get($b["uid"], 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
if ($b['parent'] != $b['id']) {
|
||||
|
@ -580,13 +579,13 @@ function statusnet_post_hook(App $a, &$b)
|
|||
|
||||
Logger::log('GNU Socialpost invoked');
|
||||
|
||||
PConfig::load($b['uid'], 'statusnet');
|
||||
DI::pConfig()->load($b['uid'], 'statusnet');
|
||||
|
||||
$api = PConfig::get($b['uid'], 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get($b['uid'], 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($b['uid'], 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get($b['uid'], 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($b['uid'], 'statusnet', 'oauthsecret');
|
||||
$api = DI::pConfig()->get($b['uid'], 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get($b['uid'], 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($b['uid'], 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret');
|
||||
|
||||
if ($ckey && $csecret && $otoken && $osecret) {
|
||||
// If it's a repeated message from GNU Social then do a native retweet and exit
|
||||
|
@ -597,7 +596,7 @@ function statusnet_post_hook(App $a, &$b)
|
|||
$dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
$max_char = $dent->get_maxlength(); // max. length for a dent
|
||||
|
||||
PConfig::set($b['uid'], 'statusnet', 'max_char', $max_char);
|
||||
DI::pConfig()->set($b['uid'], 'statusnet', 'max_char', $max_char);
|
||||
|
||||
$tempfile = "";
|
||||
$msgarr = ItemContent::getPlaintextPost($b, $max_char, true, 7);
|
||||
|
@ -642,7 +641,7 @@ function statusnet_post_hook(App $a, &$b)
|
|||
"\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), Logger::DEBUG);
|
||||
|
||||
if (!empty($result->source)) {
|
||||
PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
|
||||
DI::pConfig()->set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
|
||||
}
|
||||
|
||||
if (!empty($result->error)) {
|
||||
|
@ -730,7 +729,7 @@ function statusnet_prepare_body(App $a, &$b)
|
|||
}
|
||||
|
||||
if ($b["preview"]) {
|
||||
$max_char = PConfig::get(local_user(), 'statusnet', 'max_char');
|
||||
$max_char = DI::pConfig()->get(local_user(), 'statusnet', 'max_char');
|
||||
if (intval($max_char) == 0) {
|
||||
$max_char = 140;
|
||||
}
|
||||
|
@ -822,18 +821,18 @@ function statusnet_cron(App $a, $b)
|
|||
|
||||
function statusnet_fetchtimeline(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lastid');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lastid');
|
||||
|
||||
require_once 'mod/item.php';
|
||||
// get the application name for the SN app
|
||||
// 1st try personal config, then system config and fallback to the
|
||||
// hostname of the node if neither one is set.
|
||||
$application_name = PConfig::get($uid, 'statusnet', 'application_name');
|
||||
$application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name');
|
||||
if ($application_name == "") {
|
||||
$application_name = Config::get('statusnet', 'application_name');
|
||||
}
|
||||
|
@ -925,7 +924,7 @@ function statusnet_fetchtimeline(App $a, $uid)
|
|||
}
|
||||
}
|
||||
}
|
||||
PConfig::set($uid, 'statusnet', 'lastid', $lastid);
|
||||
DI::pConfig()->set($uid, 'statusnet', 'lastid', $lastid);
|
||||
}
|
||||
|
||||
function statusnet_address($contact)
|
||||
|
@ -1056,11 +1055,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
|||
|
||||
function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php';
|
||||
|
||||
|
@ -1103,7 +1102,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
{
|
||||
Logger::log("statusnet_createpost: start", Logger::DEBUG);
|
||||
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$postarray = [];
|
||||
|
@ -1149,7 +1148,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
}
|
||||
|
||||
// Is it me?
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
if ($content->user->id == $own_url) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -1193,7 +1192,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
$postarray['author-avatar'] = $content->user->profile_image_url;
|
||||
|
||||
// To-Do: Maybe unreliable? Can the api be entered without trailing "/"?
|
||||
$hostname = str_replace("/api/", "/notice/", PConfig::get($uid, 'statusnet', 'baseapi'));
|
||||
$hostname = str_replace("/api/", "/notice/", DI::pConfig()->get($uid, 'statusnet', 'baseapi'));
|
||||
|
||||
$postarray['plink'] = $hostname . $content->id;
|
||||
$postarray['app'] = strip_tags($content->source);
|
||||
|
@ -1237,12 +1236,12 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
{
|
||||
$conversations = [];
|
||||
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$create_user = PConfig::get($uid, 'statusnet', 'create_user');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$create_user = DI::pConfig()->get($uid, 'statusnet', 'create_user');
|
||||
|
||||
// "create_user" is deactivated, since currently you cannot add users manually by now
|
||||
$create_user = true;
|
||||
|
@ -1290,7 +1289,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
|
||||
if ($mode == 1) {
|
||||
// Fetching timeline
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lasthometimelineid');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lasthometimelineid');
|
||||
//$lastid = 1;
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
@ -1350,11 +1349,11 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
}
|
||||
}
|
||||
}
|
||||
PConfig::set($uid, 'statusnet', 'lasthometimelineid', $lastid);
|
||||
DI::pConfig()->set($uid, 'statusnet', 'lasthometimelineid', $lastid);
|
||||
}
|
||||
|
||||
// Fetching mentions
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lastmentionid');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lastmentionid');
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
if ($lastid != "") {
|
||||
|
@ -1401,17 +1400,17 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
}
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'statusnet', 'lastmentionid', $lastid);
|
||||
DI::pConfig()->set($uid, 'statusnet', 'lastmentionid', $lastid);
|
||||
}
|
||||
|
||||
function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nick, $conversation)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
|
@ -1547,12 +1546,12 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
|||
|
||||
function statusnet_fetch_own_contact(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
$contact_id = 0;
|
||||
|
||||
|
@ -1566,7 +1565,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
|
|||
return false;
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'statusnet', 'own_url', Strings::normaliseLink($user->statusnet_profile_url));
|
||||
DI::pConfig()->set($uid, 'statusnet', 'own_url', Strings::normaliseLink($user->statusnet_profile_url));
|
||||
|
||||
$contact_id = statusnet_fetch_contact($uid, $user, true);
|
||||
} else {
|
||||
|
@ -1575,7 +1574,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
|
|||
if (DBA::isResult($r)) {
|
||||
$contact_id = $r[0]["id"];
|
||||
} else {
|
||||
PConfig::delete($uid, 'statusnet', 'own_url');
|
||||
DI::pConfig()->delete($uid, 'statusnet', 'own_url');
|
||||
}
|
||||
}
|
||||
return $contact_id;
|
||||
|
@ -1613,11 +1612,11 @@ function statusnet_is_retweet(App $a, $uid, $body)
|
|||
$link = $matches[1];
|
||||
}
|
||||
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$id = preg_replace("=https?://" . $hostname . "/notice/(.*)=ism", "$1", $link);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -40,7 +39,7 @@ function superblock_addon_settings(&$a, &$s)
|
|||
|
||||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$words = PConfig::get(local_user(), 'system', 'blocked');
|
||||
$words = DI::pConfig()->get(local_user(), 'system', 'blocked');
|
||||
if (!$words) {
|
||||
$words = '';
|
||||
}
|
||||
|
@ -69,14 +68,14 @@ function superblock_addon_settings_post(&$a, &$b)
|
|||
}
|
||||
|
||||
if (!empty($_POST['superblock-submit'])) {
|
||||
PConfig::set(local_user(), 'system', 'blocked',trim($_POST['superblock-words']));
|
||||
DI::pConfig()->set(local_user(), 'system', 'blocked',trim($_POST['superblock-words']));
|
||||
info(L10n::t('SUPERBLOCK Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function superblock_enotify_store(&$a,&$b) {
|
||||
|
||||
$words = PConfig::get($b['uid'], 'system', 'blocked');
|
||||
$words = DI::pConfig()->get($b['uid'], 'system', 'blocked');
|
||||
if ($words) {
|
||||
$arr = explode(',', $words);
|
||||
} else {
|
||||
|
@ -108,7 +107,7 @@ function superblock_conversation_start(&$a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$words = PConfig::get(local_user(), 'system', 'blocked');
|
||||
$words = DI::pConfig()->get(local_user(), 'system', 'blocked');
|
||||
if ($words) {
|
||||
$a->data['superblock'] = explode(',', $words);
|
||||
}
|
||||
|
@ -155,7 +154,7 @@ function superblock_init(&$a)
|
|||
return;
|
||||
}
|
||||
|
||||
$words = PConfig::get(local_user(), 'system', 'blocked');
|
||||
$words = DI::pConfig()->get(local_user(), 'system', 'blocked');
|
||||
|
||||
if (array_key_exists('block', $_GET) && $_GET['block']) {
|
||||
if (strlen($words))
|
||||
|
@ -163,7 +162,7 @@ function superblock_init(&$a)
|
|||
$words .= trim($_GET['block']);
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'system', 'blocked', $words);
|
||||
DI::pConfig()->set(local_user(), 'system', 'blocked', $words);
|
||||
info(L10n::t('superblock settings updated') . EOL );
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -185,8 +184,8 @@ function tumblr_callback(App $a)
|
|||
}
|
||||
|
||||
// What's next? Now that we have an Access Token and Secret, we can make an API call.
|
||||
PConfig::set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
|
||||
PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
|
||||
DI::pConfig()->set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
|
||||
|
||||
$o = L10n::t("You are now authenticated to tumblr.");
|
||||
$o .= '<br /><a href="' . DI::baseUrl()->get() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
|
||||
|
@ -200,13 +199,13 @@ function tumblr_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(),'tumblr','post')) {
|
||||
if (DI::pConfig()->get(local_user(),'tumblr','post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'tumblr_enable',
|
||||
L10n::t('Post to Tumblr'),
|
||||
PConfig::get(local_user(),'tumblr','post_by_default')
|
||||
DI::pConfig()->get(local_user(),'tumblr','post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -224,11 +223,11 @@ function tumblr_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(), 'tumblr', 'post');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'tumblr', 'post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(), 'tumblr', 'post_by_default');
|
||||
$def_enabled = DI::pConfig()->get(local_user(), 'tumblr', 'post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
@ -258,13 +257,13 @@ function tumblr_settings(App $a, &$s)
|
|||
$s .= '<input id="tumblr-bydefault" type="checkbox" name="tumblr_bydefault" value="1" ' . $def_checked . '/>';
|
||||
$s .= '</div><div class="clear"></div>';
|
||||
|
||||
$oauth_token = PConfig::get(local_user(), "tumblr", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get(local_user(), "tumblr", "oauth_token_secret");
|
||||
$oauth_token = DI::pConfig()->get(local_user(), "tumblr", "oauth_token");
|
||||
$oauth_token_secret = DI::pConfig()->get(local_user(), "tumblr", "oauth_token_secret");
|
||||
|
||||
$s .= '<div id="tumblr-page-wrapper">';
|
||||
|
||||
if (($oauth_token != "") && ($oauth_token_secret != "")) {
|
||||
$page = PConfig::get(local_user(), 'tumblr', 'page');
|
||||
$page = DI::pConfig()->get(local_user(), 'tumblr', 'page');
|
||||
$consumer_key = Config::get('tumblr', 'consumer_key');
|
||||
$consumer_secret = Config::get('tumblr', 'consumer_secret');
|
||||
|
||||
|
@ -300,9 +299,9 @@ function tumblr_settings(App $a, &$s)
|
|||
function tumblr_settings_post(App $a, array &$b)
|
||||
{
|
||||
if (!empty($_POST['tumblr-submit'])) {
|
||||
PConfig::set(local_user(), 'tumblr', 'post', intval($_POST['tumblr']));
|
||||
PConfig::set(local_user(), 'tumblr', 'page', $_POST['tumblr_page']);
|
||||
PConfig::set(local_user(), 'tumblr', 'post_by_default', intval($_POST['tumblr_bydefault']));
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'post', intval($_POST['tumblr']));
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'page', $_POST['tumblr_page']);
|
||||
DI::pConfig()->set(local_user(), 'tumblr', 'post_by_default', intval($_POST['tumblr_bydefault']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,11 +336,11 @@ function tumblr_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$tmbl_post = intval(PConfig::get(local_user(), 'tumblr', 'post'));
|
||||
$tmbl_post = intval(DI::pConfig()->get(local_user(), 'tumblr', 'post'));
|
||||
|
||||
$tmbl_enable = (($tmbl_post && !empty($_REQUEST['tumblr_enable'])) ? intval($_REQUEST['tumblr_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'tumblr', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'tumblr', 'post_by_default'))) {
|
||||
$tmbl_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -380,9 +379,9 @@ function tumblr_send(App $a, array &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$oauth_token = PConfig::get($b['uid'], "tumblr", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get($b['uid'], "tumblr", "oauth_token_secret");
|
||||
$page = PConfig::get($b['uid'], "tumblr", "page");
|
||||
$oauth_token = DI::pConfig()->get($b['uid'], "tumblr", "oauth_token");
|
||||
$oauth_token_secret = DI::pConfig()->get($b['uid'], "tumblr", "oauth_token_secret");
|
||||
$page = DI::pConfig()->get($b['uid'], "tumblr", "page");
|
||||
$tmbl_blog = 'blog/' . $page . '/post';
|
||||
|
||||
if ($oauth_token && $oauth_token_secret && $tmbl_blog) {
|
||||
|
|
|
@ -73,7 +73,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
|
@ -142,7 +141,7 @@ function twitter_load_config(App $a, ConfigFileLoader $loader)
|
|||
|
||||
function twitter_check_item_notification(App $a, array &$notification_data)
|
||||
{
|
||||
$own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
|
||||
$own_id = DI::pConfig()->get($notification_data["uid"], 'twitter', 'own_id');
|
||||
|
||||
$own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||
intval($notification_data["uid"]),
|
||||
|
@ -170,8 +169,8 @@ function twitter_follow(App $a, array &$contact)
|
|||
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
// If the addon is not configured (general or for this user) quit here
|
||||
if (empty($ckey) || empty($csecret) || empty($otoken) || empty($osecret)) {
|
||||
|
@ -199,13 +198,13 @@ function twitter_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'twitter', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'twitter', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'twitter_enable',
|
||||
L10n::t('Post to Twitter'),
|
||||
PConfig::get(local_user(), 'twitter', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'twitter', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -227,17 +226,17 @@ function twitter_settings_post(App $a)
|
|||
* if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
|
||||
* from the user configuration
|
||||
*/
|
||||
PConfig::delete(local_user(), 'twitter', 'consumerkey');
|
||||
PConfig::delete(local_user(), 'twitter', 'consumersecret');
|
||||
PConfig::delete(local_user(), 'twitter', 'oauthtoken');
|
||||
PConfig::delete(local_user(), 'twitter', 'oauthsecret');
|
||||
PConfig::delete(local_user(), 'twitter', 'post');
|
||||
PConfig::delete(local_user(), 'twitter', 'post_by_default');
|
||||
PConfig::delete(local_user(), 'twitter', 'lastid');
|
||||
PConfig::delete(local_user(), 'twitter', 'mirror_posts');
|
||||
PConfig::delete(local_user(), 'twitter', 'import');
|
||||
PConfig::delete(local_user(), 'twitter', 'create_user');
|
||||
PConfig::delete(local_user(), 'twitter', 'own_id');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'consumerkey');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'consumersecret');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'oauthtoken');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'oauthsecret');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'post');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'post_by_default');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'mirror_posts');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'import');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'create_user');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'own_id');
|
||||
} else {
|
||||
if (isset($_POST['twitter-pin'])) {
|
||||
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
|
||||
|
@ -255,9 +254,9 @@ function twitter_settings_post(App $a)
|
|||
$connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']);
|
||||
$token = $connection->oauth("oauth/access_token", ["oauth_verifier" => $_POST['twitter-pin']]);
|
||||
// ok, now that we have the Access Token, save them in the user config
|
||||
PConfig::set(local_user(), 'twitter', 'oauthtoken', $token['oauth_token']);
|
||||
PConfig::set(local_user(), 'twitter', 'oauthsecret', $token['oauth_token_secret']);
|
||||
PConfig::set(local_user(), 'twitter', 'post', 1);
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'oauthtoken', $token['oauth_token']);
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'oauthsecret', $token['oauth_token_secret']);
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post', 1);
|
||||
} catch(Exception $e) {
|
||||
info($e->getMessage());
|
||||
} catch(TwitterOAuthException $e) {
|
||||
|
@ -268,14 +267,14 @@ function twitter_settings_post(App $a)
|
|||
} else {
|
||||
// if no PIN is supplied in the POST variables, the user has changed the setting
|
||||
// to post a tweet for every new __public__ posting to the wall
|
||||
PConfig::set(local_user(), 'twitter', 'post', intval($_POST['twitter-enable']));
|
||||
PConfig::set(local_user(), 'twitter', 'post_by_default', intval($_POST['twitter-default']));
|
||||
PConfig::set(local_user(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror']));
|
||||
PConfig::set(local_user(), 'twitter', 'import', intval($_POST['twitter-import']));
|
||||
PConfig::set(local_user(), 'twitter', 'create_user', intval($_POST['twitter-create_user']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post', intval($_POST['twitter-enable']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'post_by_default', intval($_POST['twitter-default']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'import', intval($_POST['twitter-import']));
|
||||
DI::pConfig()->set(local_user(), 'twitter', 'create_user', intval($_POST['twitter-create_user']));
|
||||
|
||||
if (!intval($_POST['twitter-mirror'])) {
|
||||
PConfig::delete(local_user(), 'twitter', 'lastid');
|
||||
DI::pConfig()->delete(local_user(), 'twitter', 'lastid');
|
||||
}
|
||||
|
||||
info(L10n::t('Twitter settings updated.') . EOL);
|
||||
|
@ -296,14 +295,14 @@ function twitter_settings(App $a, &$s)
|
|||
*/
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get(local_user(), 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get(local_user(), 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get(local_user(), 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(local_user(), 'twitter', 'oauthsecret');
|
||||
|
||||
$enabled = intval(PConfig::get(local_user(), 'twitter', 'post'));
|
||||
$defenabled = intval(PConfig::get(local_user(), 'twitter', 'post_by_default'));
|
||||
$mirrorenabled = intval(PConfig::get(local_user(), 'twitter', 'mirror_posts'));
|
||||
$importenabled = intval(PConfig::get(local_user(), 'twitter', 'import'));
|
||||
$create_userenabled = intval(PConfig::get(local_user(), 'twitter', 'create_user'));
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'post'));
|
||||
$defenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'post_by_default'));
|
||||
$mirrorenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'mirror_posts'));
|
||||
$importenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'import'));
|
||||
$create_userenabled = intval(DI::pConfig()->get(local_user(), 'twitter', 'create_user'));
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
|
@ -427,7 +426,7 @@ function twitter_hook_fork(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get($post['uid'], 'twitter', 'import')) {
|
||||
if (DI::pConfig()->get($post['uid'], 'twitter', 'import')) {
|
||||
// Don't fork if it isn't a reply to a twitter post
|
||||
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::TWITTER])) {
|
||||
Logger::notice('No twitter parent found', ['item' => $post['id']]);
|
||||
|
@ -453,11 +452,11 @@ function twitter_post_local(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$twitter_post = intval(PConfig::get(local_user(), 'twitter', 'post'));
|
||||
$twitter_post = intval(DI::pConfig()->get(local_user(), 'twitter', 'post'));
|
||||
$twitter_enable = (($twitter_post && !empty($_REQUEST['twitter_enable'])) ? intval($_REQUEST['twitter_enable']) : 0);
|
||||
|
||||
// if API is used, default to the chosen settings
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'twitter', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'twitter', 'post_by_default'))) {
|
||||
$twitter_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -476,8 +475,8 @@ function twitter_action(App $a, $uid, $pid, $action)
|
|||
{
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
|
@ -506,7 +505,7 @@ function twitter_action(App $a, $uid, $pid, $action)
|
|||
function twitter_post_hook(App $a, array &$b)
|
||||
{
|
||||
// Post to Twitter
|
||||
if (!PConfig::get($b["uid"], 'twitter', 'import')
|
||||
if (!DI::pConfig()->get($b["uid"], 'twitter', 'import')
|
||||
&& ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) {
|
||||
return;
|
||||
}
|
||||
|
@ -588,12 +587,12 @@ function twitter_post_hook(App $a, array &$b)
|
|||
|
||||
Logger::notice('twitter post invoked', ['id' => $b['id'], 'guid' => $b['guid']]);
|
||||
|
||||
PConfig::load($b['uid'], 'twitter');
|
||||
DI::pConfig()->load($b['uid'], 'twitter');
|
||||
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($b['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($b['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($b['uid'], 'twitter', 'oauthsecret');
|
||||
|
||||
if ($ckey && $csecret && $otoken && $osecret) {
|
||||
Logger::log('twitter: we have customer key and oauth stuff, going to send.', Logger::DEBUG);
|
||||
|
@ -784,7 +783,7 @@ function twitter_cron(App $a)
|
|||
/*
|
||||
// To-Do
|
||||
// check for new contacts once a day
|
||||
$last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check');
|
||||
$last_contact_check = DI::pConfig()->get($rr['uid'],'pumpio','contact_check');
|
||||
if($last_contact_check)
|
||||
$next_contact_check = $last_contact_check + 86400;
|
||||
else
|
||||
|
@ -792,7 +791,7 @@ function twitter_cron(App $a)
|
|||
|
||||
if($next_contact_check <= time()) {
|
||||
pumpio_getallusers($a, $rr["uid"]);
|
||||
PConfig::set($rr['uid'],'pumpio','contact_check',time());
|
||||
DI::pConfig()->set($rr['uid'],'pumpio','contact_check',time());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -933,9 +932,9 @@ function twitter_fetchtimeline(App $a, $uid)
|
|||
{
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$lastid = PConfig::get($uid, 'twitter', 'lastid');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
$lastid = DI::pConfig()->get($uid, 'twitter', 'lastid');
|
||||
|
||||
$application_name = Config::get('twitter', 'application_name');
|
||||
|
||||
|
@ -978,7 +977,7 @@ function twitter_fetchtimeline(App $a, $uid)
|
|||
foreach ($posts as $post) {
|
||||
if ($post->id_str > $lastid) {
|
||||
$lastid = $post->id_str;
|
||||
PConfig::set($uid, 'twitter', 'lastid', $lastid);
|
||||
DI::pConfig()->set($uid, 'twitter', 'lastid', $lastid);
|
||||
}
|
||||
|
||||
if ($first_time) {
|
||||
|
@ -1003,7 +1002,7 @@ function twitter_fetchtimeline(App $a, $uid)
|
|||
}
|
||||
}
|
||||
}
|
||||
PConfig::set($uid, 'twitter', 'lastid', $lastid);
|
||||
DI::pConfig()->set($uid, 'twitter', 'lastid', $lastid);
|
||||
Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
|
||||
}
|
||||
|
||||
|
@ -1099,8 +1098,8 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
|||
{
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
intval($uid));
|
||||
|
@ -1421,7 +1420,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
|
|||
}
|
||||
|
||||
// Is it me?
|
||||
$own_id = PConfig::get($uid, 'twitter', 'own_id');
|
||||
$own_id = DI::pConfig()->get($uid, 'twitter', 'own_id');
|
||||
|
||||
if ($post->user->id_str == $own_id) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -1604,7 +1603,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
|
|||
|
||||
if (!empty($posts)) {
|
||||
foreach ($posts as $post) {
|
||||
$postarray = twitter_createpost($a, $uid, $post, $self, false, !PConfig::get($uid, 'twitter', 'create_user'), false);
|
||||
$postarray = twitter_createpost($a, $uid, $post, $self, false, !DI::pConfig()->get($uid, 'twitter', 'create_user'), false);
|
||||
|
||||
if (empty($postarray['body'])) {
|
||||
continue;
|
||||
|
@ -1623,10 +1622,10 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
{
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$create_user = PConfig::get($uid, 'twitter', 'create_user');
|
||||
$mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
$create_user = DI::pConfig()->get($uid, 'twitter', 'create_user');
|
||||
$mirror_posts = DI::pConfig()->get($uid, 'twitter', 'mirror_posts');
|
||||
|
||||
Logger::log("Fetching timeline for user " . $uid, Logger::DEBUG);
|
||||
|
||||
|
@ -1665,7 +1664,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
$parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended", "include_ext_alt_text" => true];
|
||||
//$parameters["count"] = 200;
|
||||
// Fetching timeline
|
||||
$lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
|
||||
$lastid = DI::pConfig()->get($uid, 'twitter', 'lasthometimelineid');
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
|
@ -1698,7 +1697,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
foreach ($posts as $post) {
|
||||
if ($post->id_str > $lastid) {
|
||||
$lastid = $post->id_str;
|
||||
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
DI::pConfig()->set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
}
|
||||
|
||||
if ($first_time) {
|
||||
|
@ -1743,12 +1742,12 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
Logger::log('User ' . $uid . ' posted home timeline item ' . $item);
|
||||
}
|
||||
}
|
||||
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
DI::pConfig()->set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
|
||||
Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
|
||||
|
||||
// Fetching mentions
|
||||
$lastid = PConfig::get($uid, 'twitter', 'lastmentionid');
|
||||
$lastid = DI::pConfig()->get($uid, 'twitter', 'lastmentionid');
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
|
@ -1798,7 +1797,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
|||
}
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'twitter', 'lastmentionid', $lastid);
|
||||
DI::pConfig()->set($uid, 'twitter', 'lastmentionid', $lastid);
|
||||
|
||||
Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
|
||||
}
|
||||
|
@ -1807,10 +1806,10 @@ function twitter_fetch_own_contact(App $a, $uid)
|
|||
{
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
$own_id = PConfig::get($uid, 'twitter', 'own_id');
|
||||
$own_id = DI::pConfig()->get($uid, 'twitter', 'own_id');
|
||||
|
||||
$contact_id = 0;
|
||||
|
||||
|
@ -1824,7 +1823,7 @@ function twitter_fetch_own_contact(App $a, $uid)
|
|||
return false;
|
||||
}
|
||||
|
||||
PConfig::set($uid, 'twitter', 'own_id', $user->id_str);
|
||||
DI::pConfig()->set($uid, 'twitter', 'own_id', $user->id_str);
|
||||
|
||||
$contact_id = twitter_fetch_contact($uid, $user, true);
|
||||
} else {
|
||||
|
@ -1834,7 +1833,7 @@ function twitter_fetch_own_contact(App $a, $uid)
|
|||
if (DBA::isResult($r)) {
|
||||
$contact_id = $r[0]["id"];
|
||||
} else {
|
||||
PConfig::delete($uid, 'twitter', 'own_id');
|
||||
DI::pConfig()->delete($uid, 'twitter', 'own_id');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1882,8 +1881,8 @@ function twitter_is_retweet(App $a, $uid, $body)
|
|||
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
|
||||
$result = $connection->post('statuses/retweet/' . $id);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -30,7 +29,7 @@ function widgets_settings_post(){
|
|||
if(! local_user())
|
||||
return;
|
||||
if (isset($_POST['widgets-submit'])){
|
||||
PConfig::delete(local_user(), 'widgets', 'key');
|
||||
DI::pConfig()->delete(local_user(), 'widgets', 'key');
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +39,8 @@ function widgets_settings(&$a,&$o) {
|
|||
return;
|
||||
|
||||
|
||||
$key = PConfig::get(local_user(), 'widgets', 'key' );
|
||||
if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
|
||||
$key = DI::pConfig()->get(local_user(), 'widgets', 'key' );
|
||||
if ($key=='') { $key = mt_rand(); DI::pConfig()->set(local_user(), 'widgets', 'key', $key); }
|
||||
|
||||
$widgets = [];
|
||||
$d = dir(dirname(__file__));
|
||||
|
|
|
@ -32,7 +32,6 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -86,13 +85,13 @@ function windowsphonepush_settings_post($a, $post)
|
|||
return;
|
||||
}
|
||||
$enable = intval($_POST['windowsphonepush']);
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'enable', $enable);
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'enable', $enable);
|
||||
|
||||
if ($enable) {
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
|
||||
|
||||
info(L10n::t('WindowsPhonePush settings updated.') . EOL);
|
||||
}
|
||||
|
@ -110,13 +109,13 @@ function windowsphonepush_settings(&$a, &$s)
|
|||
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/windowsphonepush/windowsphonepush.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* Get the current state of our config variables */
|
||||
$enabled = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$checked_enabled = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$senditemtext = DI::pConfig()->get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$checked_senditemtext = (($senditemtext) ? ' checked="checked" ' : '');
|
||||
|
||||
$device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url');
|
||||
$device_url = DI::pConfig()->get(local_user(), 'windowsphonepush', 'device_url');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<div class="settings-block">';
|
||||
|
@ -154,8 +153,8 @@ function windowsphonepush_cron()
|
|||
if (count($r)) {
|
||||
foreach ($r as $rr) {
|
||||
// load stored information for the user-id of the current loop
|
||||
$device_url = PConfig::get($rr['uid'], 'windowsphonepush', 'device_url');
|
||||
$lastpushid = PConfig::get($rr['uid'], 'windowsphonepush', 'lastpushid');
|
||||
$device_url = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'device_url');
|
||||
$lastpushid = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'lastpushid');
|
||||
|
||||
// pushing only possible if device_url (the URI on Microsoft server) is available or not "NA" (which will be sent
|
||||
// by app if user has switched the server setting in app - sending blank not possible as this would return an update error)
|
||||
|
@ -174,7 +173,7 @@ function windowsphonepush_cron()
|
|||
switch (trim($res_tile)) {
|
||||
case "Received":
|
||||
// ok, count has been pushed, let's save it in personal settings
|
||||
PConfig::set($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
|
||||
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
|
||||
break;
|
||||
case "QueueFull":
|
||||
// maximum of 30 messages reached, server rejects any further push notification until device reconnects
|
||||
|
@ -197,7 +196,7 @@ function windowsphonepush_cron()
|
|||
if (intval($count[0]['max']) > intval($lastpushid)) {
|
||||
// user can define if he wants to see the text of the item in the push notification
|
||||
// this has been implemented as the device_url is not a https uri (not so secure)
|
||||
$senditemtext = PConfig::get($rr['uid'], 'windowsphonepush', 'senditemtext');
|
||||
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
|
||||
if ($senditemtext == 1) {
|
||||
// load item with the max id
|
||||
$item = Item::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]);
|
||||
|
@ -232,7 +231,7 @@ function windowsphonepush_cron()
|
|||
// further log information done on count pushing with send_tile (see above)
|
||||
$res_toast = send_toast($device_url, $author, $body);
|
||||
if (trim($res_toast) === 'Received') {
|
||||
PConfig::set($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
|
||||
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +305,7 @@ function send_push($device_url, $headers, $msg)
|
|||
// and log this fact
|
||||
$subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus');
|
||||
if ($subscriptionStatus == "Expired") {
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'device_url', "");
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'device_url', "");
|
||||
Logger::log("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
|
||||
}
|
||||
|
||||
|
@ -365,11 +364,11 @@ function windowsphonepush_showsettings()
|
|||
return;
|
||||
}
|
||||
|
||||
$enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
$device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url');
|
||||
$senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$lastpushid = PConfig::get(local_user(), 'windowsphonepush', 'lastpushid');
|
||||
$counterunseen = PConfig::get(local_user(), 'windowsphonepush', 'counterunseen');
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
$device_url = DI::pConfig()->get(local_user(), 'windowsphonepush', 'device_url');
|
||||
$senditemtext = DI::pConfig()->get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$lastpushid = DI::pConfig()->get(local_user(), 'windowsphonepush', 'lastpushid');
|
||||
$counterunseen = DI::pConfig()->get(local_user(), 'windowsphonepush', 'counterunseen');
|
||||
$addonversion = "2.0";
|
||||
|
||||
if (!$device_url) {
|
||||
|
@ -400,7 +399,7 @@ function windowsphonepush_updatesettings()
|
|||
}
|
||||
|
||||
// no updating if user hasn't enabled the addon
|
||||
$enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
if (!$enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
@ -422,12 +421,12 @@ function windowsphonepush_updatesettings()
|
|||
`v` = '" . $device_url . "'");
|
||||
if (count($r)) {
|
||||
foreach ($r as $rr) {
|
||||
PConfig::set($rr['uid'], 'windowsphonepush', 'device_url', '');
|
||||
DI::pConfig()->set($rr['uid'], 'windowsphonepush', 'device_url', '');
|
||||
Logger::log("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
|
||||
}
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'device_url', $device_url);
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'device_url', $device_url);
|
||||
// output the successfull update of the device URL to the logger for error analysis if necessary
|
||||
Logger::log("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
|
||||
return "Device-URL updated successfully!";
|
||||
|
@ -441,12 +440,12 @@ function windowsphonepush_updatecounterunseen()
|
|||
}
|
||||
|
||||
// no updating if user hasn't enabled the addon
|
||||
$enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
|
||||
if (!$enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
DI::pConfig()->set(local_user(), 'windowsphonepush', 'counterunseen', 0);
|
||||
return "Counter set to zero";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\Content\Text\HTML;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -50,13 +49,13 @@ function wppost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(),'wppost','post')) {
|
||||
if (DI::pConfig()->get(local_user(),'wppost','post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'wppost_enable',
|
||||
L10n::t('Post to Wordpress'),
|
||||
PConfig::get(local_user(),'wppost','post_by_default')
|
||||
DI::pConfig()->get(local_user(),'wppost','post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -74,23 +73,23 @@ function wppost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = PConfig::get(local_user(),'wppost','post');
|
||||
$enabled = DI::pConfig()->get(local_user(),'wppost','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = PConfig::get(local_user(),'wppost','post_by_default');
|
||||
$back_enabled = PConfig::get(local_user(),'wppost','backlink');
|
||||
$shortcheck_enabled = PConfig::get(local_user(),'wppost','shortcheck');
|
||||
$def_enabled = DI::pConfig()->get(local_user(),'wppost','post_by_default');
|
||||
$back_enabled = DI::pConfig()->get(local_user(),'wppost','backlink');
|
||||
$shortcheck_enabled = DI::pConfig()->get(local_user(),'wppost','shortcheck');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
$back_checked = (($back_enabled) ? ' checked="checked" ' : '');
|
||||
$shortcheck_checked = (($shortcheck_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$wp_username = PConfig::get(local_user(), 'wppost', 'wp_username');
|
||||
$wp_password = PConfig::get(local_user(), 'wppost', 'wp_password');
|
||||
$wp_blog = PConfig::get(local_user(), 'wppost', 'wp_blog');
|
||||
$wp_backlink_text = PConfig::get(local_user(), 'wppost', 'wp_backlink_text');
|
||||
$wp_username = DI::pConfig()->get(local_user(), 'wppost', 'wp_username');
|
||||
$wp_password = DI::pConfig()->get(local_user(), 'wppost', 'wp_password');
|
||||
$wp_blog = DI::pConfig()->get(local_user(), 'wppost', 'wp_blog');
|
||||
$wp_backlink_text = DI::pConfig()->get(local_user(), 'wppost', 'wp_backlink_text');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -151,17 +150,17 @@ function wppost_settings(&$a,&$s) {
|
|||
function wppost_settings_post(&$a,&$b) {
|
||||
|
||||
if(!empty($_POST['wppost-submit'])) {
|
||||
PConfig::set(local_user(),'wppost','post',intval($_POST['wppost']));
|
||||
PConfig::set(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault'] ?? false));
|
||||
PConfig::set(local_user(),'wppost','wp_username',trim($_POST['wp_username']));
|
||||
PConfig::set(local_user(),'wppost','wp_password',trim($_POST['wp_password']));
|
||||
PConfig::set(local_user(),'wppost','wp_blog',trim($_POST['wp_blog']));
|
||||
PConfig::set(local_user(),'wppost','backlink',trim($_POST['wp_backlink'] ?? ''));
|
||||
PConfig::set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
|
||||
DI::pConfig()->set(local_user(),'wppost','post',intval($_POST['wppost']));
|
||||
DI::pConfig()->set(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault'] ?? false));
|
||||
DI::pConfig()->set(local_user(),'wppost','wp_username',trim($_POST['wp_username']));
|
||||
DI::pConfig()->set(local_user(),'wppost','wp_password',trim($_POST['wp_password']));
|
||||
DI::pConfig()->set(local_user(),'wppost','wp_blog',trim($_POST['wp_blog']));
|
||||
DI::pConfig()->set(local_user(),'wppost','backlink',trim($_POST['wp_backlink'] ?? ''));
|
||||
DI::pConfig()->set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
|
||||
$wp_backlink_text = Strings::escapeTags(trim($_POST['wp_backlink_text']));
|
||||
$wp_backlink_text = BBCode::convert($wp_backlink_text, false, 8);
|
||||
$wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true);
|
||||
PConfig::set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
||||
DI::pConfig()->set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -197,11 +196,11 @@ function wppost_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$wp_post = intval(PConfig::get(local_user(),'wppost','post'));
|
||||
$wp_post = intval(DI::pConfig()->get(local_user(),'wppost','post'));
|
||||
|
||||
$wp_enable = (($wp_post && !empty($_REQUEST['wppost_enable'])) ? intval($_REQUEST['wppost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'wppost','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(),'wppost','post_by_default'))) {
|
||||
$wp_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -240,10 +239,10 @@ function wppost_send(&$a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$wp_username = XML::escape(PConfig::get($b['uid'], 'wppost', 'wp_username'));
|
||||
$wp_password = XML::escape(PConfig::get($b['uid'], 'wppost', 'wp_password'));
|
||||
$wp_blog = PConfig::get($b['uid'],'wppost','wp_blog');
|
||||
$wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text');
|
||||
$wp_username = XML::escape(DI::pConfig()->get($b['uid'], 'wppost', 'wp_username'));
|
||||
$wp_password = XML::escape(DI::pConfig()->get($b['uid'], 'wppost', 'wp_password'));
|
||||
$wp_blog = DI::pConfig()->get($b['uid'],'wppost','wp_blog');
|
||||
$wp_backlink_text = DI::pConfig()->get($b['uid'],'wppost','wp_backlink_text');
|
||||
if ($wp_backlink_text == '') {
|
||||
$wp_backlink_text = L10n::t('Read the original post and comment stream on Friendica');
|
||||
}
|
||||
|
@ -251,7 +250,7 @@ function wppost_send(&$a, &$b)
|
|||
if ($wp_username && $wp_password && $wp_blog) {
|
||||
$wptitle = trim($b['title']);
|
||||
|
||||
if (intval(PConfig::get($b['uid'], 'wppost', 'shortcheck'))) {
|
||||
if (intval(DI::pConfig()->get($b['uid'], 'wppost', 'shortcheck'))) {
|
||||
// Checking, if its a post that is worth a blog post
|
||||
$postentry = false;
|
||||
$siteinfo = BBCode::getAttachedData($b["body"]);
|
||||
|
@ -312,7 +311,7 @@ function wppost_send(&$a, &$b)
|
|||
|
||||
$post = $title.$post;
|
||||
|
||||
$wp_backlink = intval(PConfig::get($b['uid'],'wppost','backlink'));
|
||||
$wp_backlink = intval(DI::pConfig()->get($b['uid'],'wppost','backlink'));
|
||||
if($wp_backlink && $b['plink']) {
|
||||
$post .= EOL . EOL . '<a href="' . $b['plink'] . '">'
|
||||
. $wp_backlink_text . '</a>' . EOL . EOL;
|
||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\App;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -38,9 +37,9 @@ function xmpp_addon_settings_post()
|
|||
return;
|
||||
}
|
||||
|
||||
PConfig::set(local_user(), 'xmpp', 'enabled', $_POST['xmpp_enabled'] ?? false);
|
||||
PConfig::set(local_user(), 'xmpp', 'individual', $_POST['xmpp_individual'] ?? false);
|
||||
PConfig::set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy'] ?? '');
|
||||
DI::pConfig()->set(local_user(), 'xmpp', 'enabled', $_POST['xmpp_enabled'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'xmpp', 'individual', $_POST['xmpp_individual'] ?? false);
|
||||
DI::pConfig()->set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy'] ?? '');
|
||||
|
||||
info(L10n::t('XMPP settings updated.') . EOL);
|
||||
}
|
||||
|
@ -57,13 +56,13 @@ function xmpp_addon_settings(App $a, &$s)
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = intval(PConfig::get(local_user(), 'xmpp', 'enabled'));
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'xmpp', 'enabled'));
|
||||
$enabled_checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$individual = intval(PConfig::get(local_user(), 'xmpp', 'individual'));
|
||||
$individual = intval(DI::pConfig()->get(local_user(), 'xmpp', 'individual'));
|
||||
$individual_checked = (($individual) ? ' checked="checked" ' : '');
|
||||
|
||||
$bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy");
|
||||
$bosh_proxy = DI::pConfig()->get(local_user(), "xmpp", "bosh_proxy");
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<span id="settings_xmpp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">';
|
||||
|
@ -85,7 +84,7 @@ function xmpp_addon_settings(App $a, &$s)
|
|||
$s .= '<div class="clear"></div>';
|
||||
}
|
||||
|
||||
if (!Config::get("xmpp", "central_userbase") || PConfig::get(local_user(), "xmpp", "individual")) {
|
||||
if (!Config::get("xmpp", "central_userbase") || DI::pConfig()->get(local_user(), "xmpp", "individual")) {
|
||||
$s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">' . L10n::t('Jabber BOSH host') . '</label>';
|
||||
$s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="' . $bosh_proxy . '" />';
|
||||
$s .= '<div class="clear"></div>';
|
||||
|
@ -102,7 +101,7 @@ function xmpp_login()
|
|||
{
|
||||
if (empty($_SESSION['allow_api'])) {
|
||||
$password = Strings::getRandomHex(16);
|
||||
PConfig::set(local_user(), 'xmpp', 'password', $password);
|
||||
DI::pConfig()->set(local_user(), 'xmpp', 'password', $password);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ function xmpp_converse(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!PConfig::get(local_user(), "xmpp", "enabled")) {
|
||||
if (!DI::pConfig()->get(local_user(), "xmpp", "enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -158,14 +157,14 @@ function xmpp_converse(App $a)
|
|||
DI::page()['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n";
|
||||
DI::page()['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n";
|
||||
|
||||
if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(), "xmpp", "individual")) {
|
||||
if (Config::get("xmpp", "central_userbase") && !DI::pConfig()->get(local_user(), "xmpp", "individual")) {
|
||||
$bosh_proxy = Config::get("xmpp", "bosh_proxy");
|
||||
|
||||
$password = PConfig::get(local_user(), "xmpp", "password", '', true);
|
||||
$password = DI::pConfig()->get(local_user(), "xmpp", "password", '', true);
|
||||
|
||||
if ($password == "") {
|
||||
$password = Strings::getRandomHex(16);
|
||||
PConfig::set(local_user(), "xmpp", "password", $password);
|
||||
DI::pConfig()->set(local_user(), "xmpp", "password", $password);
|
||||
}
|
||||
|
||||
$jid = $a->user["nickname"] . "@" . DI::baseUrl()->getHostname() . "/converse-" . Strings::getRandomHex(5);
|
||||
|
@ -176,7 +175,7 @@ function xmpp_converse(App $a)
|
|||
password: '$password',
|
||||
allow_logout: false,";
|
||||
} else {
|
||||
$bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy");
|
||||
$bosh_proxy = DI::pConfig()->get(local_user(), "xmpp", "bosh_proxy");
|
||||
|
||||
$auto_login = "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue