Issue 3873

Replace deprecated functions with new syntax
pull/439/head
Adam Magness 2017-11-06 18:55:24 -05:00
parent 72474dc2f6
commit 48dcbc6f3f
61 changed files with 1036 additions and 920 deletions

View File

@ -49,6 +49,7 @@
* THE SOFTWARE.
*/
use Friendica\Core\Config;
function blackout_install() {
register_hook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
@ -67,9 +68,9 @@ function blackout_redirect ($a, $b) {
return true;
// else...
$mystart = get_config('blackout','begindate');
$myend = get_config('blackout','enddate');
$myurl = get_config('blackout','url');
$mystart = Config::get('blackout','begindate');
$myend = Config::get('blackout','enddate');
$myurl = Config::get('blackout','url');
$now = time();
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
@ -87,11 +88,11 @@ function blackout_redirect ($a, $b) {
}
function blackout_plugin_admin(&$a, &$o) {
$mystart = get_config('blackout','begindate');
$mystart = Config::get('blackout','begindate');
if (! is_string($mystart)) { $mystart = "YYYY-MM-DD:hhmm"; }
$myend = get_config('blackout','enddate');
$myend = Config::get('blackout','enddate');
if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
$myurl = get_config('blackout','url');
$myurl = Config::get('blackout','url');
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
@ -114,7 +115,7 @@ function blackout_plugin_admin_post (&$a) {
$begindate = trim($_POST['startdate']);
$enddate = trim($_POST['enddate']);
$url = trim($_POST['rurl']);
set_config('blackout','begindate',$begindate);
set_config('blackout','enddate',$enddate);
set_config('blackout','url',$url);
Config::set('blackout','begindate',$begindate);
Config::set('blackout','enddate',$enddate);
Config::set('blackout','url',$url);
}

View File

@ -9,6 +9,8 @@
*
*/
use Friendica\Core\PConfig;
function blockem_install() {
register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
register_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
@ -45,7 +47,7 @@ function blockem_addon_settings(&$a,&$s) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
$words = get_pconfig(local_user(),'blockem','words');
$words = PConfig::get(local_user(),'blockem','words');
if(! $words)
$words = '';
@ -74,7 +76,7 @@ function blockem_addon_settings_post(&$a,&$b) {
return;
if($_POST['blockem-submit']) {
set_pconfig(local_user(),'blockem','words',trim($_POST['blockem-words']));
PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words']));
info( t('BLOCKEM Settings saved.') . EOL);
}
}
@ -82,7 +84,7 @@ function blockem_addon_settings_post(&$a,&$b) {
function blockem_enotify_store(&$a,&$b) {
$words = get_pconfig($b['uid'],'blockem','words');
$words = PConfig::get($b['uid'],'blockem','words');
if($words) {
$arr = explode(',',$words);
}
@ -115,7 +117,7 @@ function blockem_prepare_body(&$a,&$b) {
$words = null;
if(local_user()) {
$words = get_pconfig(local_user(),'blockem','words');
$words = PConfig::get(local_user(),'blockem','words');
}
if($words) {
$arr = explode(',',$words);
@ -155,7 +157,7 @@ function blockem_conversation_start(&$a,&$b) {
if(! local_user())
return;
$words = get_pconfig(local_user(),'blockem','words');
$words = PConfig::get(local_user(),'blockem','words');
if($words) {
$a->data['blockem'] = explode(',',$words);
}
@ -207,7 +209,7 @@ function blockem_init(&$a) {
if(! local_user())
return;
$words = get_pconfig(local_user(),'blockem','words');
$words = PConfig::get(local_user(),'blockem','words');
if(array_key_exists('block',$_GET) && $_GET['block']) {
if(strlen($words))
@ -227,7 +229,7 @@ function blockem_init(&$a) {
$words = implode(',',$newarr);
}
set_pconfig(local_user(),'blockem','words',$words);
PConfig::set(local_user(),'blockem','words',$words);
info( t('blockem settings updated') . EOL );
killme();
}

View File

@ -7,6 +7,8 @@
*
*/
use Friendica\Core\PConfig;
function blogger_install() {
register_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
register_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
@ -34,9 +36,9 @@ function blogger_jot_nets(&$a,&$b) {
if(! local_user())
return;
$bl_post = get_pconfig(local_user(),'blogger','post');
$bl_post = PConfig::get(local_user(),'blogger','post');
if(intval($bl_post) == 1) {
$bl_defpost = get_pconfig(local_user(),'blogger','post_by_default');
$bl_defpost = PConfig::get(local_user(),'blogger','post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. t('Post to blogger') . '</div>';
@ -55,17 +57,17 @@ function blogger_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'blogger','post');
$enabled = PConfig::get(local_user(),'blogger','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'blogger','post_by_default');
$def_enabled = PConfig::get(local_user(),'blogger','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$bl_username = get_pconfig(local_user(), 'blogger', 'bl_username');
$bl_password = get_pconfig(local_user(), 'blogger', 'bl_password');
$bl_blog = get_pconfig(local_user(), 'blogger', 'bl_blog');
$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');
/* Add some HTML to the existing form */
@ -114,11 +116,11 @@ function blogger_settings_post(&$a,&$b) {
if(x($_POST,'blogger-submit')) {
set_pconfig(local_user(),'blogger','post',intval($_POST['blogger']));
set_pconfig(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
set_pconfig(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
set_pconfig(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
set_pconfig(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
PConfig::set(local_user(),'blogger','post',intval($_POST['blogger']));
PConfig::set(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
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']));
}
@ -137,11 +139,11 @@ function blogger_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
$bl_post = intval(get_pconfig(local_user(),'blogger','post'));
$bl_post = intval(PConfig::get(local_user(),'blogger','post'));
$bl_enable = (($bl_post && x($_REQUEST,'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0);
if($b['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default')))
if($b['api_source'] && intval(PConfig::get(local_user(),'blogger','post_by_default')))
$bl_enable = 1;
if(! $bl_enable)
@ -167,9 +169,9 @@ function blogger_send(&$a,&$b) {
return;
$bl_username = xmlify(get_pconfig($b['uid'],'blogger','bl_username'));
$bl_password = xmlify(get_pconfig($b['uid'],'blogger','bl_password'));
$bl_blog = get_pconfig($b['uid'],'blogger','bl_blog');
$bl_username = xmlify(PConfig::get($b['uid'],'blogger','bl_username'));
$bl_password = xmlify(PConfig::get($b['uid'],'blogger','bl_password'));
$bl_blog = PConfig::get($b['uid'],'blogger','bl_blog');
if($bl_username && $bl_password && $bl_blog) {

View File

@ -7,6 +7,9 @@
*/
require('addon/buffer/bufferapp.php');
use Friendica\Core\Config;
use Friendica\Core\PConfig;
function buffer_install() {
register_hook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
register_hook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
@ -56,15 +59,15 @@ function buffer_plugin_admin(&$a, &$o){
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => array('client_id', t('Client ID'), get_config('buffer', 'client_id' ), ''),
'$client_secret' => array('client_secret', t('Client Secret'), get_config('buffer', 'client_secret' ), ''),
'$client_id' => array('client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''),
'$client_secret' => array('client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''),
));
}
function buffer_plugin_admin_post(&$a){
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
$client_secret = ((x($_POST,'client_secret')) ? notags(trim($_POST['client_secret'])): '');
set_config('buffer','client_id',$client_id);
set_config('buffer','client_secret',$client_secret);
Config::set('buffer','client_id',$client_id);
Config::set('buffer','client_secret',$client_secret);
info( t('Settings updated.'). EOL );
}
@ -78,8 +81,8 @@ function buffer_connect(&$a) {
session_start();
// Define the needed keys
$client_id = get_config('buffer','client_id');
$client_secret = get_config('buffer','client_secret');
$client_id = Config::get('buffer','client_id');
$client_secret = Config::get('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer
$callback_url = $a->get_baseurl()."/buffer/connect";
@ -92,7 +95,7 @@ function buffer_connect(&$a) {
logger("buffer_connect: authenticated");
$o .= t("You are now authenticated to buffer. ");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
set_pconfig(local_user(), 'buffer','access_token', $buffer->access_token);
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
}
return($o);
@ -102,9 +105,9 @@ function buffer_jot_nets(&$a,&$b) {
if(! local_user())
return;
$buffer_post = get_pconfig(local_user(),'buffer','post');
$buffer_post = PConfig::get(local_user(),'buffer','post');
if(intval($buffer_post) == 1) {
$buffer_defpost = get_pconfig(local_user(),'buffer','post_by_default');
$buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default');
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> '
. t('Post to Buffer') . '</div>';
@ -122,11 +125,11 @@ function buffer_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'buffer','post');
$enabled = PConfig::get(local_user(),'buffer','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'buffer','post_by_default');
$def_enabled = PConfig::get(local_user(),'buffer','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
@ -139,9 +142,9 @@ function buffer_settings(&$a,&$s) {
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>';
$s .= '</span>';
$client_id = get_config("buffer", "client_id");
$client_secret = get_config("buffer", "client_secret");
$access_token = get_pconfig(local_user(), "buffer", "access_token");
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$access_token = PConfig::get(local_user(), "buffer", "access_token");
$s .= '<div id="buffer-password-wrapper">';
if ($access_token == "") {
@ -198,12 +201,12 @@ function buffer_settings_post(&$a,&$b) {
if(x($_POST,'buffer-submit')) {
if(x($_POST,'buffer_delete')) {
set_pconfig(local_user(),'buffer','access_token','');
set_pconfig(local_user(),'buffer','post',false);
set_pconfig(local_user(),'buffer','post_by_default',false);
PConfig::set(local_user(),'buffer','access_token','');
PConfig::set(local_user(),'buffer','post',false);
PConfig::set(local_user(),'buffer','post_by_default',false);
} else {
set_pconfig(local_user(),'buffer','post',intval($_POST['buffer']));
set_pconfig(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
PConfig::set(local_user(),'buffer','post',intval($_POST['buffer']));
PConfig::set(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
}
}
}
@ -214,11 +217,11 @@ function buffer_post_local(&$a,&$b) {
return;
}
$buffer_post = intval(get_pconfig(local_user(),'buffer','post'));
$buffer_post = intval(PConfig::get(local_user(),'buffer','post'));
$buffer_enable = (($buffer_post && x($_REQUEST,'buffer_enable')) ? intval($_REQUEST['buffer_enable']) : 0);
if ($b['api_source'] && intval(get_pconfig(local_user(),'buffer','post_by_default'))) {
if ($b['api_source'] && intval(PConfig::get(local_user(),'buffer','post_by_default'))) {
$buffer_enable = 1;
}
@ -248,9 +251,9 @@ function buffer_send(&$a,&$b) {
//if($b['app'] == "Buffer")
// return;
$client_id = get_config("buffer", "client_id");
$client_secret = get_config("buffer", "client_secret");
$access_token = get_pconfig($b['uid'], "buffer","access_token");
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$access_token = PConfig::get($b['uid'], "buffer","access_token");
if($access_token) {
$buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);

View File

@ -9,6 +9,7 @@
require_once('mod/community.php');
use Friendica\Core\Config;
function communityhome_install() {
register_hook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
@ -24,11 +25,11 @@ function communityhome_home(&$a, &$o){
// custom css
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
if (!get_config('communityhome','hidelogin')){
if (!Config::get('communityhome','hidelogin')){
$aside = array(
'$tab_1' => t('Login'),
'$tab_2' => t('OpenID'),
'$noOid' => get_config('system','no_openid'),
'$noOid' => Config::get('system','no_openid'),
);
// login form
@ -38,15 +39,15 @@ function communityhome_home(&$a, &$o){
$aside = array(
//'$tab_1' => t('Login'),
//'$tab_2' => t('OpenID'),
//'$noOid' => get_config('system','no_openid'),
//'$noOid' => Config::get('system','no_openid'),
);
// last 12 users
if (get_config('communityhome','showlastusers')===true){
if (Config::get('communityhome','showlastusers')===true){
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
@ -73,7 +74,7 @@ function communityhome_home(&$a, &$o){
}
// 12 most active users (by posts and contacts)
// this query don't work on some mysql versions
if (get_config('communityhome','showactiveusers')===true){
if (Config::get('communityhome','showactiveusers')===true){
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
(SELECT COUNT(*) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
(SELECT COUNT(*) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
@ -105,7 +106,7 @@ function communityhome_home(&$a, &$o){
}
}
// last 12 photos
if (get_config('communityhome','showlastphotos')===true){
if (Config::get('communityhome','showlastphotos')===true){
$aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = array();
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
@ -144,7 +145,7 @@ function communityhome_home(&$a, &$o){
}
// last 10 liked items
if (get_config('communityhome','showlastlike')===true){
if (Config::get('communityhome','showlastlike')===true){
$aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = array();
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
@ -198,14 +199,14 @@ function communityhome_home(&$a, &$o){
if(file_exists('home.html'))
$o = file_get_contents('home.html');
if (get_config('communityhome','showcommunitystream')===true){
$oldset = get_config('system','community_page_style');
if (Config::get('communityhome','showcommunitystream')===true){
$oldset = Config::get('system','community_page_style');
if ($oldset == CP_NO_COMMUNITY_PAGE)
set_config('system','community_page_style', CP_USERS_ON_SERVER);
Config::set('system','community_page_style', CP_USERS_ON_SERVER);
$o .= community_content($a,1);
if ($oldset == CP_NO_COMMUNITY_PAGE)
set_config('system','community_page_style', $oldset);
Config::set('system','community_page_style', $oldset);
}
}

View File

@ -13,13 +13,16 @@ require_once('include/network.php');
require_once("mod/proxy.php");
require_once('include/text.php');
use Friendica\Core\Config;
use Friendica\Core\PConfig;
// get the weather data from OpenWeatherMap
function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) {
$url = "http://api.openweathermap.org/data/2.5/weather?q=".$loc."&appid=".$appid."&lang=".$lang."&units=".$units."&mode=xml";
$cached = Cache::get('curweather'.md5($url));
$now = new DateTime();
if (!is_null($cached)) {
$cdate = get_pconfig(local_user(), 'curweather', 'last');
$cdate = PConfig::get(local_user(), 'curweather', 'last');
$cached = unserialize($cached);
if ($cdate + $cachetime > $now->getTimestamp()) {
return $cached;
@ -56,7 +59,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
'update' => (string)$res->lastupdate['value'],
'icon' => (string)$res->weather['icon']
);
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
return $r;
}
@ -75,7 +78,7 @@ function curweather_uninstall() {
function curweather_network_mod_init(&$fk_app,&$b) {
if(! intval(get_pconfig(local_user(),'curweather','curweather_enable')))
if(! intval(PConfig::get(local_user(),'curweather','curweather_enable')))
return;
$fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
@ -89,14 +92,14 @@ function curweather_network_mod_init(&$fk_app,&$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 = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
// set the language to the browsers language and use metric units
$lang = $_SESSION['language'];
$units = get_pconfig( local_user(), 'curweather', 'curweather_units');
$appid = get_config('curweather','appid');
$cachetime = intval(get_config('curweather','cachetime'));
$units = PConfig::get( local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid');
$cachetime = intval(Config::get('curweather','cachetime'));
if ($units==="")
$units = 'metric';
$ok = true;
@ -139,9 +142,9 @@ function curweather_network_mod_init(&$fk_app,&$b) {
function curweather_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'curweather-settings-submit')))
return;
set_pconfig(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
set_pconfig(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
set_pconfig(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
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']));
info( t('Current Weather settings updated.') . EOL);
}
@ -154,15 +157,15 @@ function curweather_plugin_settings(&$a,&$s) {
/* Get the current state of our config variable */
$curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$curweather_units = get_pconfig(local_user(), 'curweather', 'curweather_units');
$appid = get_config('curweather','appid');
$curweather_loc = PConfig::get(local_user(), 'curweather', 'curweather_loc');
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid');
if ($appid=="") {
$noappidtext = t('No APPID found, please contact your admin to obtain one.');
} else {
$noappidtext = '';
}
$enable = intval(get_pconfig(local_user(),'curweather','curweather_enable'));
$enable = intval(PConfig::get(local_user(),'curweather','curweather_enable'));
$enable_checked = (($enable) ? ' checked="checked" ' : '');
// load template and replace the macros
@ -185,16 +188,16 @@ function curweather_plugin_admin_post (&$a) {
if(! is_site_admin())
return;
if ($_POST['curweather-submit']) {
set_config('curweather','appid',trim($_POST['appid']));
set_config('curweather','cachetime',trim($_POST['cachetime']));
Config::set('curweather','appid',trim($_POST['appid']));
Config::set('curweather','cachetime',trim($_POST['cachetime']));
info( t('Curweather settings saved.'.EOL));
}
}
function curweather_plugin_admin (&$a, &$o) {
if(! is_site_admin())
return;
$appid = get_config('curweather','appid');
$cachetime = get_config('curweather','cachetime');
$appid = Config::get('curweather','appid');
$cachetime = Config::get('curweather','cachetime');
$t = get_markup_template("admin.tpl", "addon/curweather/" );
$o = replace_macros ($t, array(
'$submit' => t('Save Settings'),

View File

@ -1,5 +1,7 @@
<?php
use Friendica\Core\PConfig;
abstract class wdcal_local
{
@ -34,7 +36,7 @@ abstract class wdcal_local
* @return wdcal_local
*/
static function getInstanceByUser($uid = 0) {
$dateformat = get_pconfig($uid, "dav", "dateformat");
$dateformat = PConfig::get($uid, "dav", "dateformat");
$format = self::getInstance($dateformat);
if ($format == null) $format = self::getInstance(self::LOCAL_US);
return $format;

View File

@ -1,5 +1,7 @@
<?php
use Friendica\Core\Config;
use Friendica\Core\PConfig;
/**
*
@ -23,7 +25,7 @@ function wdcal_addRequiredHeaders()
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/calendar.css' . '" media="all" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/main.css' . '" media="all" />' . "\r\n";
switch (get_config("system", "language")) {
switch (Config::get("system", "language")) {
case "de":
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/common/wdcal/js/wdCalendar_lang_DE.js"></script>' . "\r\n";
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/jqueryui/jquery.ui.datepicker-de.js"></script>' . "\r\n";
@ -357,7 +359,7 @@ function wdcal_getSettingsPage(&$a)
if (isset($_REQUEST["save"])) {
check_form_security_token_redirectOnErr('/dav/settings/', 'calprop');
set_pconfig($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
info(t('The new values have been saved.'));
}

View File

@ -9,6 +9,8 @@
require_once("addon/diaspora/Diaspora_Connection.php");
use Friendica\Core\PConfig;
function diaspora_install() {
register_hook('post_local', 'addon/diaspora/diaspora.php', 'diaspora_post_local');
register_hook('notifier_normal', 'addon/diaspora/diaspora.php', 'diaspora_send');
@ -31,9 +33,9 @@ function diaspora_jot_nets(&$a,&$b) {
if(! local_user())
return;
$diaspora_post = get_pconfig(local_user(),'diaspora','post');
$diaspora_post = PConfig::get(local_user(),'diaspora','post');
if(intval($diaspora_post) == 1) {
$diaspora_defpost = get_pconfig(local_user(),'diaspora','post_by_default');
$diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default');
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> '
. t('Post to Diaspora') . '</div>';
@ -66,9 +68,9 @@ function diaspora_queue_hook(&$a,&$b) {
$userdata = $r[0];
$handle = get_pconfig($userdata['uid'],'diaspora','handle');
$password = get_pconfig($userdata['uid'],'diaspora','password');
$aspect = get_pconfig($userdata['uid'],'diaspora','aspect');
$handle = PConfig::get($userdata['uid'],'diaspora','handle');
$password = PConfig::get($userdata['uid'],'diaspora','password');
$aspect = PConfig::get($userdata['uid'],'diaspora','aspect');
$success = false;
@ -119,17 +121,17 @@ function diaspora_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'diaspora','post');
$enabled = PConfig::get(local_user(),'diaspora','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'diaspora','post_by_default');
$def_enabled = PConfig::get(local_user(),'diaspora','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$handle = get_pconfig(local_user(), 'diaspora', 'handle');
$password = get_pconfig(local_user(), 'diaspora', 'password');
$aspect = get_pconfig(local_user(),'diaspora','aspect');
$handle = PConfig::get(local_user(), 'diaspora', 'handle');
$password = PConfig::get(local_user(), 'diaspora', 'password');
$aspect = PConfig::get(local_user(),'diaspora','aspect');
$status = "";
@ -222,11 +224,11 @@ function diaspora_settings_post(&$a,&$b) {
if(x($_POST,'diaspora-submit')) {
set_pconfig(local_user(),'diaspora','post',intval($_POST['diaspora']));
set_pconfig(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
set_pconfig(local_user(),'diaspora','handle',trim($_POST['handle']));
set_pconfig(local_user(),'diaspora','password',trim($_POST['password']));
set_pconfig(local_user(),'diaspora','aspect',trim($_POST['aspect']));
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']));
}
}
@ -245,11 +247,11 @@ function diaspora_post_local(&$a,&$b) {
return;
}
$diaspora_post = intval(get_pconfig(local_user(),'diaspora','post'));
$diaspora_post = intval(PConfig::get(local_user(),'diaspora','post'));
$diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0);
if ($b['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default'))) {
if ($b['api_source'] && intval(PConfig::get(local_user(),'diaspora','post_by_default'))) {
$diaspora_enable = 1;
}
@ -283,9 +285,9 @@ function diaspora_send(&$a,&$b) {
logger('diaspora_send: prepare posting', LOGGER_DEBUG);
$handle = get_pconfig($b['uid'],'diaspora','handle');
$password = get_pconfig($b['uid'],'diaspora','password');
$aspect = get_pconfig($b['uid'],'diaspora','aspect');
$handle = PConfig::get($b['uid'],'diaspora','handle');
$password = PConfig::get($b['uid'],'diaspora','password');
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
if ($handle && $password) {

View File

@ -9,6 +9,8 @@
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/
use Friendica\Core\PConfig;
function dwpost_install() {
register_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
register_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send');
@ -31,9 +33,9 @@ function dwpost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$dw_post = get_pconfig(local_user(),'dwpost','post');
$dw_post = PConfig::get(local_user(),'dwpost','post');
if(intval($dw_post) == 1) {
$dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default');
$dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Dreamwidth') . '</div>';
@ -52,16 +54,16 @@ function dwpost_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'dwpost','post');
$enabled = PConfig::get(local_user(),'dwpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'dwpost','post_by_default');
$def_enabled = PConfig::get(local_user(),'dwpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$dw_username = get_pconfig(local_user(), 'dwpost', 'dw_username');
$dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password');
$dw_username = PConfig::get(local_user(), 'dwpost', 'dw_username');
$dw_password = PConfig::get(local_user(), 'dwpost', 'dw_password');
/* Add some HTML to the existing form */
@ -105,10 +107,10 @@ function dwpost_settings_post(&$a,&$b) {
if(x($_POST,'dwpost-submit')) {
set_pconfig(local_user(),'dwpost','post',intval($_POST['dwpost']));
set_pconfig(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
set_pconfig(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
set_pconfig(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
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']));
}
@ -127,11 +129,11 @@ function dwpost_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
$dw_post = intval(get_pconfig(local_user(),'dwpost','post'));
$dw_post = intval(PConfig::get(local_user(),'dwpost','post'));
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default')))
if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default')))
$dw_enable = 1;
if(! $dw_enable)
@ -168,8 +170,8 @@ function dwpost_send(&$a,&$b) {
if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone'];
$dw_username = get_pconfig($b['uid'],'dwpost','dw_username');
$dw_password = get_pconfig($b['uid'],'dwpost','dw_password');
$dw_username = PConfig::get($b['uid'],'dwpost','dw_username');
$dw_password = PConfig::get($b['uid'],'dwpost','dw_password');
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
if($dw_username && $dw_password && $dw_blog) {

View File

@ -6,6 +6,8 @@
* Author: Thomas Willingham <https://beardyunixer.com/profile/beardyunixer>
*/
use Friendica\Core\Config;
function forumdirectory_install() {
register_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
}
@ -49,7 +51,7 @@ function forumdirectory_post(&$a) {
function forumdirectory_content(&$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
@ -65,7 +67,7 @@ function forumdirectory_content(&$a) {
$tpl = get_markup_template('directory_header.tpl');
$globaldir = '';
$gdirpath = get_config('system','directory');
$gdirpath = Config::get('system','directory');
if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
. zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
@ -87,7 +89,7 @@ function forumdirectory_content(&$a) {
$search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$publish = ((Config::get('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra ");

View File

@ -7,6 +7,7 @@
*
*/
use Friendica\Core\PConfig;
function fromapp_install() {
@ -32,8 +33,8 @@ function fromapp_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'fromapp-submit')))
return;
set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']);
set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
PConfig::set(local_user(),'fromapp','app',$_POST['fromapp-input']);
PConfig::set(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
info( t('Fromapp settings updated.') . EOL);
}
@ -49,11 +50,11 @@ function fromapp_settings(&$a,&$s) {
/* Get the current state of our config variable */
$fromapp = get_pconfig(local_user(),'fromapp','app');
$fromapp = PConfig::get(local_user(),'fromapp','app');
if($fromapp === false)
$fromapp = '';
$force = intval(get_pconfig(local_user(),'fromapp','force'));
$force = intval(PConfig::get(local_user(),'fromapp','force'));
$force_enabled = (($force) ? ' checked="checked" ' : '');
@ -90,8 +91,8 @@ function fromapp_post_hook(&$a,&$item) {
if(local_user() != $item['uid'])
return;
$app = get_pconfig(local_user(), 'fromapp', 'app');
$force = intval(get_pconfig(local_user(), 'fromapp','force'));
$app = PConfig::get(local_user(), 'fromapp', 'app');
$force = intval(PConfig::get(local_user(), 'fromapp','force'));
if(($app === false) || (! strlen($app)))
return;

View File

@ -9,6 +9,9 @@
define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
use Friendica\Core\Config;
use Friendica\Core\PConfig;
require_once('mod/share.php');
require_once('mod/parse_url.php');
require_once('include/text.php');
@ -39,9 +42,9 @@ function fromgplus_addon_settings(&$a,&$s) {
if (count($result) > 0)
return;
$enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$keywords_checked = (intval(get_pconfig(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
$account = get_pconfig(local_user(),'fromgplus','account');
$enable_checked = (intval(PConfig::get(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$keywords_checked = (intval(PConfig::get(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
$account = PConfig::get(local_user(),'fromgplus','account');
$s .= '<span id="settings_fromgplus_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">';
$s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. t('Google+ Mirror').'</h3>';
@ -76,11 +79,11 @@ function fromgplus_addon_settings_post(&$a,&$b) {
return;
if($_POST['fromgplus-submit']) {
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
set_pconfig(local_user(),'fromgplus','enable', $enable);
PConfig::set(local_user(),'fromgplus','enable', $enable);
$keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0);
set_pconfig(local_user(),'fromgplus', 'keywords', $keywords);
PConfig::set(local_user(),'fromgplus', 'keywords', $keywords);
if (!$enable)
del_pconfig(local_user(),'fromgplus','lastdate');
@ -94,20 +97,20 @@ function fromgplus_plugin_admin(&$a, &$o){
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$key' => array('key', t('Key'), trim(get_config('fromgplus', 'key')), t('')),
'$key' => array('key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')),
));
}
function fromgplus_plugin_admin_post(&$a){
$key = ((x($_POST,'key')) ? trim($_POST['key']) : '');
set_config('fromgplus','key',$key);
Config::set('fromgplus','key',$key);
info( t('Settings updated.'). EOL );
}
function fromgplus_cron($a,$b) {
$last = get_config('fromgplus','last_poll');
$last = Config::get('fromgplus','last_poll');
$poll_interval = intval(get_config('fromgplus','poll_interval'));
$poll_interval = intval(Config::get('fromgplus','poll_interval'));
if(! $poll_interval)
$poll_interval = FROMGPLUS_DEFAULT_POLL_INTERVAL;
@ -124,7 +127,7 @@ function fromgplus_cron($a,$b) {
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
$account = get_pconfig($rr['uid'],'fromgplus','account');
$account = PConfig::get($rr['uid'],'fromgplus','account');
if ($account) {
logger('fromgplus: fetching for user '.$rr['uid']);
fromgplus_fetch($a, $rr['uid']);
@ -134,7 +137,7 @@ function fromgplus_cron($a,$b) {
logger('fromgplus: cron_end');
set_config('fromgplus','last_poll', time());
Config::set('fromgplus','last_poll', time());
}
function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
@ -338,7 +341,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
// Add Keywords to page link
$data = parseurl_getsiteinfo_cached($pagedata["url"], true);
if (isset($data["keywords"]) && get_pconfig($uid, 'fromgplus', 'keywords')) {
if (isset($data["keywords"]) && PConfig::get($uid, 'fromgplus', 'keywords')) {
$pagedata["keywords"] = $data["keywords"];
}
break;
@ -429,8 +432,8 @@ function fromgplus_fetch($a, $uid) {
// Special blank to identify postings from the googleplus connector
$blank = html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8');
$account = get_pconfig($uid,'fromgplus','account');
$key = get_config('fromgplus','key');
$account = PConfig::get($uid,'fromgplus','account');
$key = Config::get('fromgplus','key');
$result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
//$result = file_get_contents("google.txt");
@ -438,7 +441,7 @@ function fromgplus_fetch($a, $uid) {
$activities = json_decode($result);
$initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
$initiallastdate = PConfig::get($uid,'fromgplus','lastdate');
$first_time = ($initiallastdate == "");
@ -463,7 +466,7 @@ function fromgplus_fetch($a, $uid) {
if ($lastdate < strtotime($item->published))
$lastdate = strtotime($item->published);
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
if ($first_time)
continue;
@ -505,7 +508,7 @@ function fromgplus_fetch($a, $uid) {
case "activity":
$post = fromgplus_html2bbcode($item->annotation)."\n";
if (!intval(get_config('system','old_share'))) {
if (!intval(Config::get('system','old_share'))) {
if (function_exists("share_header"))
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
@ -555,5 +558,5 @@ function fromgplus_fetch($a, $uid) {
}
}
if ($lastdate != 0)
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
}

View File

@ -6,6 +6,8 @@
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/
use Friendica\Core\Config;
function geocoordinates_install() {
register_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
register_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
@ -21,11 +23,11 @@ function geocoordinates_resolve_item(&$item) {
if((!$item["coord"]) || ($item["location"]))
return;
$key = get_config("geocoordinates", "api_key");
$key = Config::get("geocoordinates", "api_key");
if ($key == "")
return;
$language = get_config("geocoordinates", "language");
$language = Config::get("geocoordinates", "language");
if ($language == "")
$language = "de";
@ -80,16 +82,16 @@ function geocoordinates_plugin_admin(&$a,&$o) {
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$api_key' => array('api_key', t('API Key'), get_config('geocoordinates', 'api_key' ), ''),
'$language' => array('language', t('Language code (IETF format)'), get_config('geocoordinates', 'language' ), ''),
'$api_key' => array('api_key', t('API Key'), Config::get('geocoordinates', 'api_key' ), ''),
'$language' => array('language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language' ), ''),
));
}
function geocoordinates_plugin_admin_post(&$a) {
$api_key = ((x($_POST,'api_key')) ? notags(trim($_POST['api_key'])) : '');
set_config('geocoordinates','api_key',$api_key);
Config::set('geocoordinates','api_key',$api_key);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
set_config('geocoordinates','language',$language);
Config::set('geocoordinates','language',$language);
info(t('Settings updated.'). EOL);
}

View File

@ -20,6 +20,8 @@
*
*/
use Friendica\Core\Config;
use Friendica\Core\PConfig;
function geonames_install() {
@ -91,8 +93,8 @@ function geonames_post_hook($a, &$item) {
/* Retrieve our personal config setting */
$geo_account = get_config('geonames', 'username');
$active = get_pconfig(local_user(), 'geonames', 'enable');
$geo_account = Config::get('geonames', 'username');
$active = PConfig::get(local_user(), 'geonames', 'enable');
if((! $geo_account) || (! $active))
return;
@ -138,7 +140,7 @@ function geonames_post_hook($a, &$item) {
function geonames_plugin_admin_post($a,$post) {
if(! local_user() || (! x($_POST,'geonames-submit')))
return;
set_pconfig(local_user(),'geonames','enable',intval($_POST['geonames']));
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));
info( t('Geonames settings updated.') . EOL);
}
@ -158,7 +160,7 @@ function geonames_plugin_admin(&$a,&$s) {
if(! local_user())
return;
$geo_account = get_config('geonames', 'username');
$geo_account = Config::get('geonames', 'username');
if(! $geo_account)
return;
@ -169,7 +171,7 @@ function geonames_plugin_admin(&$a,&$s) {
/* Get the current state of our config variable */
$enabled = get_pconfig(local_user(),'geonames','enable');
$enabled = PConfig::get(local_user(),'geonames','enable');
$checked = (($enabled) ? ' checked="checked" ' : '');

View File

@ -8,6 +8,7 @@
*
*/
use Friendica\Core\PConfig;
function gnot_install() {
@ -44,7 +45,7 @@ function gnot_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'gnot-submit')))
return;
set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot']));
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
info( t('Gnot settings updated.') . EOL);
}
@ -69,7 +70,7 @@ function gnot_settings(&$a,&$s) {
/* Get the current state of our config variable */
$gnot = intval(get_pconfig(local_user(),'gnot','enable'));
$gnot = intval(PConfig::get(local_user(),'gnot','enable'));
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
@ -91,7 +92,7 @@ function gnot_settings(&$a,&$s) {
function gnot_enotify_mail(&$a,&$b) {
if((! $b['uid']) || (! intval(get_pconfig($b['uid'], 'gnot','enable'))))
if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
return;
if($b['type'] == NOTIFY_COMMENT)
$b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']);

View File

@ -6,6 +6,8 @@
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
*/
use Friendica\Core\Config;
/**