diff --git a/blackout/blackout.php b/blackout/blackout.php index 4fb824ef..3678969e 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -49,7 +49,6 @@ * THE SOFTWARE. */ -use Friendica\Core\Config; function blackout_install() { register_hook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); @@ -68,9 +67,9 @@ function blackout_redirect ($a, $b) { return true; // else... - $mystart = Config::get('blackout','begindate'); - $myend = Config::get('blackout','enddate'); - $myurl = Config::get('blackout','url'); + $mystart = get_config('blackout','begindate'); + $myend = get_config('blackout','enddate'); + $myurl = get_config('blackout','url'); $now = time(); $date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart); $date2 = DateTime::createFromFormat('Y-m-d G:i', $myend); @@ -88,11 +87,11 @@ function blackout_redirect ($a, $b) { } function blackout_plugin_admin(&$a, &$o) { - $mystart = Config::get('blackout','begindate'); + $mystart = get_config('blackout','begindate'); if (! is_string($mystart)) { $mystart = "YYYY-MM-DD:hhmm"; } - $myend = Config::get('blackout','enddate'); + $myend = get_config('blackout','enddate'); if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; } - $myurl = Config::get('blackout','url'); + $myurl = get_config('blackout','url'); if (! is_string($myurl)) { $myurl = "http://www.example.com"; } $t = get_markup_template( "admin.tpl", "addon/blackout/" ); @@ -115,7 +114,7 @@ function blackout_plugin_admin_post (&$a) { $begindate = trim($_POST['startdate']); $enddate = trim($_POST['enddate']); $url = trim($_POST['rurl']); - Config::set('blackout','begindate',$begindate); - Config::set('blackout','enddate',$enddate); - Config::set('blackout','url',$url); + set_config('blackout','begindate',$begindate); + set_config('blackout','enddate',$enddate); + set_config('blackout','url',$url); } diff --git a/blockem/blockem.php b/blockem/blockem.php index d8855886..223a1990 100755 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -9,8 +9,6 @@ * */ -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'); @@ -47,7 +45,7 @@ function blockem_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $words = PConfig::get(local_user(),'blockem','words'); + $words = get_pconfig(local_user(),'blockem','words'); if(! $words) $words = ''; @@ -76,7 +74,7 @@ function blockem_addon_settings_post(&$a,&$b) { return; if($_POST['blockem-submit']) { - PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words'])); + set_pconfig(local_user(),'blockem','words',trim($_POST['blockem-words'])); info( t('BLOCKEM Settings saved.') . EOL); } } @@ -84,7 +82,7 @@ function blockem_addon_settings_post(&$a,&$b) { function blockem_enotify_store(&$a,&$b) { - $words = PConfig::get($b['uid'],'blockem','words'); + $words = get_pconfig($b['uid'],'blockem','words'); if($words) { $arr = explode(',',$words); } @@ -117,7 +115,7 @@ function blockem_prepare_body(&$a,&$b) { $words = null; if(local_user()) { - $words = PConfig::get(local_user(),'blockem','words'); + $words = get_pconfig(local_user(),'blockem','words'); } if($words) { $arr = explode(',',$words); @@ -157,7 +155,7 @@ function blockem_conversation_start(&$a,&$b) { if(! local_user()) return; - $words = PConfig::get(local_user(),'blockem','words'); + $words = get_pconfig(local_user(),'blockem','words'); if($words) { $a->data['blockem'] = explode(',',$words); } @@ -209,7 +207,7 @@ function blockem_init(&$a) { if(! local_user()) return; - $words = PConfig::get(local_user(),'blockem','words'); + $words = get_pconfig(local_user(),'blockem','words'); if(array_key_exists('block',$_GET) && $_GET['block']) { if(strlen($words)) @@ -229,7 +227,7 @@ function blockem_init(&$a) { $words = implode(',',$newarr); } - PConfig::set(local_user(),'blockem','words',$words); + set_pconfig(local_user(),'blockem','words',$words); info( t('blockem settings updated') . EOL ); killme(); } diff --git a/blogger/blogger.php b/blogger/blogger.php index df79d195..892e8a45 100755 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -7,8 +7,6 @@ * */ -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'); @@ -36,9 +34,9 @@ function blogger_jot_nets(&$a,&$b) { if(! local_user()) return; - $bl_post = PConfig::get(local_user(),'blogger','post'); + $bl_post = get_pconfig(local_user(),'blogger','post'); if(intval($bl_post) == 1) { - $bl_defpost = PConfig::get(local_user(),'blogger','post_by_default'); + $bl_defpost = get_pconfig(local_user(),'blogger','post_by_default'); $selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to blogger') . '
'; @@ -57,17 +55,17 @@ function blogger_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'blogger','post'); + $enabled = get_pconfig(local_user(),'blogger','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'blogger','post_by_default'); + $def_enabled = get_pconfig(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 = 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'); /* Add some HTML to the existing form */ @@ -116,11 +114,11 @@ function blogger_settings_post(&$a,&$b) { if(x($_POST,'blogger-submit')) { - 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'])); + 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'])); } @@ -139,11 +137,11 @@ function blogger_post_local(&$a,&$b) { if($b['private'] || $b['parent']) return; - $bl_post = intval(PConfig::get(local_user(),'blogger','post')); + $bl_post = intval(get_pconfig(local_user(),'blogger','post')); $bl_enable = (($bl_post && x($_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(get_pconfig(local_user(),'blogger','post_by_default'))) $bl_enable = 1; if(! $bl_enable) @@ -169,9 +167,9 @@ function blogger_send(&$a,&$b) { return; - $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'); + $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'); if($bl_username && $bl_password && $bl_blog) { diff --git a/buffer/buffer.php b/buffer/buffer.php index f5f88e10..ca33708c 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -7,9 +7,6 @@ */ 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'); @@ -59,15 +56,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'), Config::get('buffer', 'client_id' ), ''), - '$client_secret' => array('client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''), + '$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' ), ''), )); } 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'])): ''); - Config::set('buffer','client_id',$client_id); - Config::set('buffer','client_secret',$client_secret); + set_config('buffer','client_id',$client_id); + set_config('buffer','client_secret',$client_secret); info( t('Settings updated.'). EOL ); } @@ -81,8 +78,8 @@ function buffer_connect(&$a) { session_start(); // Define the needed keys - $client_id = Config::get('buffer','client_id'); - $client_secret = Config::get('buffer','client_secret'); + $client_id = get_config('buffer','client_id'); + $client_secret = get_config('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"; @@ -95,7 +92,7 @@ function buffer_connect(&$a) { logger("buffer_connect: authenticated"); $o .= t("You are now authenticated to buffer. "); $o .= '
'.t("return to the connector page").''; - PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token); + set_pconfig(local_user(), 'buffer','access_token', $buffer->access_token); } return($o); @@ -105,9 +102,9 @@ function buffer_jot_nets(&$a,&$b) { if(! local_user()) return; - $buffer_post = PConfig::get(local_user(),'buffer','post'); + $buffer_post = get_pconfig(local_user(),'buffer','post'); if(intval($buffer_post) == 1) { - $buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default'); + $buffer_defpost = get_pconfig(local_user(),'buffer','post_by_default'); $selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Buffer') . '
'; @@ -125,11 +122,11 @@ function buffer_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'buffer','post'); + $enabled = get_pconfig(local_user(),'buffer','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'buffer','post_by_default'); + $def_enabled = get_pconfig(local_user(),'buffer','post_by_default'); $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ @@ -142,9 +139,9 @@ function buffer_settings(&$a,&$s) { $s .= '

'. t('Buffer Export').'

'; $s .= ''; - $client_id = Config::get("buffer", "client_id"); - $client_secret = Config::get("buffer", "client_secret"); - $access_token = PConfig::get(local_user(), "buffer", "access_token"); + $client_id = get_config("buffer", "client_id"); + $client_secret = get_config("buffer", "client_secret"); + $access_token = get_pconfig(local_user(), "buffer", "access_token"); $s .= '
'; if ($access_token == "") { @@ -201,12 +198,12 @@ function buffer_settings_post(&$a,&$b) { if(x($_POST,'buffer-submit')) { if(x($_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); + set_pconfig(local_user(),'buffer','access_token',''); + set_pconfig(local_user(),'buffer','post',false); + set_pconfig(local_user(),'buffer','post_by_default',false); } else { - PConfig::set(local_user(),'buffer','post',intval($_POST['buffer'])); - PConfig::set(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault'])); + set_pconfig(local_user(),'buffer','post',intval($_POST['buffer'])); + set_pconfig(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault'])); } } } @@ -217,11 +214,11 @@ function buffer_post_local(&$a,&$b) { return; } - $buffer_post = intval(PConfig::get(local_user(),'buffer','post')); + $buffer_post = intval(get_pconfig(local_user(),'buffer','post')); $buffer_enable = (($buffer_post && x($_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(get_pconfig(local_user(),'buffer','post_by_default'))) { $buffer_enable = 1; } @@ -251,9 +248,9 @@ function buffer_send(&$a,&$b) { //if($b['app'] == "Buffer") // return; - $client_id = Config::get("buffer", "client_id"); - $client_secret = Config::get("buffer", "client_secret"); - $access_token = PConfig::get($b['uid'], "buffer","access_token"); + $client_id = get_config("buffer", "client_id"); + $client_secret = get_config("buffer", "client_secret"); + $access_token = get_pconfig($b['uid'], "buffer","access_token"); if($access_token) { $buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token); @@ -295,7 +292,7 @@ function buffer_send(&$a,&$b) { break; case 'twitter': $send = ($b["extid"] != NETWORK_TWITTER); - $limit = 280; + $limit = 140; $markup = false; $includedlinks = true; $htmlmode = 8; diff --git a/communityhome/communityhome.php b/communityhome/communityhome.php index c8927822..ff3215d3 100755 --- a/communityhome/communityhome.php +++ b/communityhome/communityhome.php @@ -9,7 +9,6 @@ require_once('mod/community.php'); -use Friendica\Core\Config; function communityhome_install() { register_hook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home'); @@ -25,11 +24,11 @@ function communityhome_home(&$a, &$o){ // custom css $a->page['htmlhead'] .= ''; - if (!Config::get('communityhome','hidelogin')){ + if (!get_config('communityhome','hidelogin')){ $aside = array( '$tab_1' => t('Login'), '$tab_2' => t('OpenID'), - '$noOid' => Config::get('system','no_openid'), + '$noOid' => get_config('system','no_openid'), ); // login form @@ -39,15 +38,15 @@ function communityhome_home(&$a, &$o){ $aside = array( //'$tab_1' => t('Login'), //'$tab_2' => t('OpenID'), - //'$noOid' => Config::get('system','no_openid'), + //'$noOid' => get_config('system','no_openid'), ); // last 12 users - if (Config::get('communityhome','showlastusers')===true){ + if (get_config('communityhome','showlastusers')===true){ $aside['$lastusers_title'] = t('Latest users'); $aside['$lastusers_items'] = array(); $sql_extra = ""; - $publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " ); + $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " ); $order = " ORDER BY `register_date` DESC "; $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` @@ -74,7 +73,7 @@ function communityhome_home(&$a, &$o){ } // 12 most active users (by posts and contacts) // this query don't work on some mysql versions - if (Config::get('communityhome','showactiveusers')===true){ + if (get_config('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`, @@ -106,7 +105,7 @@ function communityhome_home(&$a, &$o){ } } // last 12 photos - if (Config::get('communityhome','showlastphotos')===true){ + if (get_config('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 @@ -145,7 +144,7 @@ function communityhome_home(&$a, &$o){ } // last 10 liked items - if (Config::get('communityhome','showlastlike')===true){ + if (get_config('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 @@ -199,14 +198,14 @@ function communityhome_home(&$a, &$o){ if(file_exists('home.html')) $o = file_get_contents('home.html'); - if (Config::get('communityhome','showcommunitystream')===true){ - $oldset = Config::get('system','community_page_style'); + if (get_config('communityhome','showcommunitystream')===true){ + $oldset = get_config('system','community_page_style'); if ($oldset == CP_NO_COMMUNITY_PAGE) - Config::set('system','community_page_style', CP_USERS_ON_SERVER); + set_config('system','community_page_style', CP_USERS_ON_SERVER); $o .= community_content($a,1); if ($oldset == CP_NO_COMMUNITY_PAGE) - Config::set('system','community_page_style', $oldset); + set_config('system','community_page_style', $oldset); } } diff --git a/curweather/curweather.php b/curweather/curweather.php index 2e64453e..71d95e46 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -13,16 +13,13 @@ 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 = PConfig::get(local_user(), 'curweather', 'last'); + $cdate = get_pconfig(local_user(), 'curweather', 'last'); $cached = unserialize($cached); if ($cdate + $cachetime > $now->getTimestamp()) { return $cached; @@ -59,7 +56,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) 'update' => (string)$res->lastupdate['value'], 'icon' => (string)$res->weather['icon'] ); - PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp()); + set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp()); Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR); return $r; } @@ -78,7 +75,7 @@ function curweather_uninstall() { function curweather_network_mod_init(&$fk_app,&$b) { - if(! intval(PConfig::get(local_user(),'curweather','curweather_enable'))) + if(! intval(get_pconfig(local_user(),'curweather','curweather_enable'))) return; $fk_app->page['htmlhead'] .= '' . "\r\n"; @@ -92,14 +89,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 = PConfig::get(local_user(), 'curweather', 'curweather_loc'); + $rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc'); // set the language to the browsers language and use metric units $lang = $_SESSION['language']; - $units = PConfig::get( local_user(), 'curweather', 'curweather_units'); - $appid = Config::get('curweather','appid'); - $cachetime = intval(Config::get('curweather','cachetime')); + $units = get_pconfig( local_user(), 'curweather', 'curweather_units'); + $appid = get_config('curweather','appid'); + $cachetime = intval(get_config('curweather','cachetime')); if ($units==="") $units = 'metric'; $ok = true; @@ -142,9 +139,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; - 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'])); + 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'])); info( t('Current Weather settings updated.') . EOL); } @@ -157,15 +154,15 @@ function curweather_plugin_settings(&$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'); - $appid = Config::get('curweather','appid'); + $curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc'); + $curweather_units = get_pconfig(local_user(), 'curweather', 'curweather_units'); + $appid = get_config('curweather','appid'); if ($appid=="") { $noappidtext = t('No APPID found, please contact your admin to obtain one.'); } else { $noappidtext = ''; } - $enable = intval(PConfig::get(local_user(),'curweather','curweather_enable')); + $enable = intval(get_pconfig(local_user(),'curweather','curweather_enable')); $enable_checked = (($enable) ? ' checked="checked" ' : ''); // load template and replace the macros @@ -188,16 +185,16 @@ function curweather_plugin_admin_post (&$a) { if(! is_site_admin()) return; if ($_POST['curweather-submit']) { - Config::set('curweather','appid',trim($_POST['appid'])); - Config::set('curweather','cachetime',trim($_POST['cachetime'])); + set_config('curweather','appid',trim($_POST['appid'])); + set_config('curweather','cachetime',trim($_POST['cachetime'])); info( t('Curweather settings saved.'.EOL)); } } function curweather_plugin_admin (&$a, &$o) { if(! is_site_admin()) return; - $appid = Config::get('curweather','appid'); - $cachetime = Config::get('curweather','cachetime'); + $appid = get_config('curweather','appid'); + $cachetime = get_config('curweather','cachetime'); $t = get_markup_template("admin.tpl", "addon/curweather/" ); $o = replace_macros ($t, array( '$submit' => t('Save Settings'), diff --git a/dav/common/wdcal_configuration.php b/dav/common/wdcal_configuration.php index 337451cb..c7b66fb1 100644 --- a/dav/common/wdcal_configuration.php +++ b/dav/common/wdcal_configuration.php @@ -1,7 +1,5 @@ page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; - switch (Config::get("system", "language")) { + switch (get_config("system", "language")) { case "de": $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; @@ -359,7 +357,7 @@ function wdcal_getSettingsPage(&$a) if (isset($_REQUEST["save"])) { check_form_security_token_redirectOnErr('/dav/settings/', 'calprop'); - PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]); + set_pconfig($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]); info(t('The new values have been saved.')); } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 9675d7a6..f637f468 100755 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -9,8 +9,6 @@ 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'); @@ -33,9 +31,9 @@ function diaspora_jot_nets(&$a,&$b) { if(! local_user()) return; - $diaspora_post = PConfig::get(local_user(),'diaspora','post'); + $diaspora_post = get_pconfig(local_user(),'diaspora','post'); if(intval($diaspora_post) == 1) { - $diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default'); + $diaspora_defpost = get_pconfig(local_user(),'diaspora','post_by_default'); $selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Diaspora') . '
'; @@ -68,9 +66,9 @@ function diaspora_queue_hook(&$a,&$b) { $userdata = $r[0]; - $handle = PConfig::get($userdata['uid'],'diaspora','handle'); - $password = PConfig::get($userdata['uid'],'diaspora','password'); - $aspect = PConfig::get($userdata['uid'],'diaspora','aspect'); + $handle = get_pconfig($userdata['uid'],'diaspora','handle'); + $password = get_pconfig($userdata['uid'],'diaspora','password'); + $aspect = get_pconfig($userdata['uid'],'diaspora','aspect'); $success = false; @@ -121,17 +119,17 @@ function diaspora_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'diaspora','post'); + $enabled = get_pconfig(local_user(),'diaspora','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'diaspora','post_by_default'); + $def_enabled = get_pconfig(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 = get_pconfig(local_user(), 'diaspora', 'handle'); + $password = get_pconfig(local_user(), 'diaspora', 'password'); + $aspect = get_pconfig(local_user(),'diaspora','aspect'); $status = ""; @@ -224,11 +222,11 @@ function diaspora_settings_post(&$a,&$b) { if(x($_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'])); + 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'])); } } @@ -247,11 +245,11 @@ function diaspora_post_local(&$a,&$b) { return; } - $diaspora_post = intval(PConfig::get(local_user(),'diaspora','post')); + $diaspora_post = intval(get_pconfig(local_user(),'diaspora','post')); $diaspora_enable = (($diaspora_post && x($_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(get_pconfig(local_user(),'diaspora','post_by_default'))) { $diaspora_enable = 1; } @@ -285,9 +283,9 @@ function diaspora_send(&$a,&$b) { logger('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 = get_pconfig($b['uid'],'diaspora','handle'); + $password = get_pconfig($b['uid'],'diaspora','password'); + $aspect = get_pconfig($b['uid'],'diaspora','aspect'); if ($handle && $password) { diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index c29a3b46..25f7ac87 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -9,8 +9,6 @@ * Author: Cat Gray */ -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'); @@ -33,9 +31,9 @@ function dwpost_jot_nets(&$a,&$b) { if(! local_user()) return; - $dw_post = PConfig::get(local_user(),'dwpost','post'); + $dw_post = get_pconfig(local_user(),'dwpost','post'); if(intval($dw_post) == 1) { - $dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default'); + $dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default'); $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Dreamwidth') . '
'; @@ -54,16 +52,16 @@ function dwpost_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'dwpost','post'); + $enabled = get_pconfig(local_user(),'dwpost','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $def_enabled = PConfig::get(local_user(),'dwpost','post_by_default'); + $def_enabled = get_pconfig(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 = get_pconfig(local_user(), 'dwpost', 'dw_username'); + $dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password'); /* Add some HTML to the existing form */ @@ -107,10 +105,10 @@ function dwpost_settings_post(&$a,&$b) { if(x($_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'])); + 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'])); } @@ -129,11 +127,11 @@ function dwpost_post_local(&$a,&$b) { if($b['private'] || $b['parent']) return; - $dw_post = intval(PConfig::get(local_user(),'dwpost','post')); + $dw_post = intval(get_pconfig(local_user(),'dwpost','post')); $dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0); - if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default'))) + if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default'))) $dw_enable = 1; if(! $dw_enable) @@ -170,8 +168,8 @@ function dwpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $dw_username = PConfig::get($b['uid'],'dwpost','dw_username'); - $dw_password = PConfig::get($b['uid'],'dwpost','dw_password'); + $dw_username = get_pconfig($b['uid'],'dwpost','dw_username'); + $dw_password = get_pconfig($b['uid'],'dwpost','dw_password'); $dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc'; if($dw_username && $dw_password && $dw_blog) { diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 8e668d88..a709c9b1 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -6,8 +6,6 @@ * Author: Thomas Willingham */ -use Friendica\Core\Config; - function forumdirectory_install() { register_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); } @@ -51,7 +49,7 @@ function forumdirectory_post(&$a) { function forumdirectory_content(&$a) { - if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) { + if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { notice( t('Public access denied.') . EOL); return; } @@ -67,7 +65,7 @@ function forumdirectory_content(&$a) { $tpl = get_markup_template('directory_header.tpl'); $globaldir = ''; - $gdirpath = Config::get('system','directory'); + $gdirpath = get_config('system','directory'); if(strlen($gdirpath)) { $globaldir = ''; @@ -89,7 +87,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 = ((Config::get('system','publish_all')) ? '' : " AND `publish` = 1 " ); + $publish = ((get_config('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 "); diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 2d0b98ca..de858744 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -7,7 +7,6 @@ * */ -use Friendica\Core\PConfig; function fromapp_install() { @@ -33,8 +32,8 @@ function fromapp_settings_post($a,$post) { if(! local_user() || (! x($_POST,'fromapp-submit'))) return; - PConfig::set(local_user(),'fromapp','app',$_POST['fromapp-input']); - PConfig::set(local_user(),'fromapp','force',intval($_POST['fromapp-force'])); + set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']); + set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force'])); info( t('Fromapp settings updated.') . EOL); } @@ -50,11 +49,11 @@ function fromapp_settings(&$a,&$s) { /* Get the current state of our config variable */ - $fromapp = PConfig::get(local_user(),'fromapp','app'); + $fromapp = get_pconfig(local_user(),'fromapp','app'); if($fromapp === false) $fromapp = ''; - $force = intval(PConfig::get(local_user(),'fromapp','force')); + $force = intval(get_pconfig(local_user(),'fromapp','force')); $force_enabled = (($force) ? ' checked="checked" ' : ''); @@ -91,8 +90,8 @@ function fromapp_post_hook(&$a,&$item) { if(local_user() != $item['uid']) return; - $app = PConfig::get(local_user(), 'fromapp', 'app'); - $force = intval(PConfig::get(local_user(), 'fromapp','force')); + $app = get_pconfig(local_user(), 'fromapp', 'app'); + $force = intval(get_pconfig(local_user(), 'fromapp','force')); if(($app === false) || (! strlen($app))) return; diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 984ab4b4..097bac18 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,9 +9,6 @@ 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'); @@ -42,9 +39,9 @@ function fromgplus_addon_settings(&$a,&$s) { if (count($result) > 0) return; - $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'); + $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'); $s .= ''; $s .= '

'. t('Google+ Mirror').'

'; @@ -79,11 +76,11 @@ function fromgplus_addon_settings_post(&$a,&$b) { return; if($_POST['fromgplus-submit']) { - PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account'])); + set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account'])); $enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0); - PConfig::set(local_user(),'fromgplus','enable', $enable); + set_pconfig(local_user(),'fromgplus','enable', $enable); $keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0); - PConfig::set(local_user(),'fromgplus', 'keywords', $keywords); + set_pconfig(local_user(),'fromgplus', 'keywords', $keywords); if (!$enable) del_pconfig(local_user(),'fromgplus','lastdate'); @@ -97,20 +94,20 @@ function fromgplus_plugin_admin(&$a, &$o){ $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$key' => array('key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')), + '$key' => array('key', t('Key'), trim(get_config('fromgplus', 'key')), t('')), )); } function fromgplus_plugin_admin_post(&$a){ $key = ((x($_POST,'key')) ? trim($_POST['key']) : ''); - Config::set('fromgplus','key',$key); + set_config('fromgplus','key',$key); info( t('Settings updated.'). EOL ); } function fromgplus_cron($a,$b) { - $last = Config::get('fromgplus','last_poll'); + $last = get_config('fromgplus','last_poll'); - $poll_interval = intval(Config::get('fromgplus','poll_interval')); + $poll_interval = intval(get_config('fromgplus','poll_interval')); if(! $poll_interval) $poll_interval = FROMGPLUS_DEFAULT_POLL_INTERVAL; @@ -127,7 +124,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 = PConfig::get($rr['uid'],'fromgplus','account'); + $account = get_pconfig($rr['uid'],'fromgplus','account'); if ($account) { logger('fromgplus: fetching for user '.$rr['uid']); fromgplus_fetch($a, $rr['uid']); @@ -137,7 +134,7 @@ function fromgplus_cron($a,$b) { logger('fromgplus: cron_end'); - Config::set('fromgplus','last_poll', time()); + set_config('fromgplus','last_poll', time()); } function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) { @@ -341,7 +338,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"]) && PConfig::get($uid, 'fromgplus', 'keywords')) { + if (isset($data["keywords"]) && get_pconfig($uid, 'fromgplus', 'keywords')) { $pagedata["keywords"] = $data["keywords"]; } break; @@ -432,8 +429,8 @@ function fromgplus_fetch($a, $uid) { // Special blank to identify postings from the googleplus connector $blank = html_entity_decode(" ", ENT_QUOTES, 'UTF-8'); - $account = PConfig::get($uid,'fromgplus','account'); - $key = Config::get('fromgplus','key'); + $account = get_pconfig($uid,'fromgplus','account'); + $key = get_config('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"); @@ -441,7 +438,7 @@ function fromgplus_fetch($a, $uid) { $activities = json_decode($result); - $initiallastdate = PConfig::get($uid,'fromgplus','lastdate'); + $initiallastdate = get_pconfig($uid,'fromgplus','lastdate'); $first_time = ($initiallastdate == ""); @@ -466,7 +463,7 @@ function fromgplus_fetch($a, $uid) { if ($lastdate < strtotime($item->published)) $lastdate = strtotime($item->published); - PConfig::set($uid,'fromgplus','lastdate', $lastdate); + set_pconfig($uid,'fromgplus','lastdate', $lastdate); if ($first_time) continue; @@ -508,7 +505,7 @@ function fromgplus_fetch($a, $uid) { case "activity": $post = fromgplus_html2bbcode($item->annotation)."\n"; - if (!intval(Config::get('system','old_share'))) { + if (!intval(get_config('system','old_share'))) { if (function_exists("share_header")) $post .= share_header($item->object->actor->displayName, $item->object->actor->url, @@ -558,5 +555,5 @@ function fromgplus_fetch($a, $uid) { } } if ($lastdate != 0) - PConfig::set($uid,'fromgplus','lastdate', $lastdate); + set_pconfig($uid,'fromgplus','lastdate', $lastdate); } diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 11643168..34f850cb 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -6,8 +6,6 @@ * Author: Michael Vogel */ -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'); @@ -23,11 +21,11 @@ function geocoordinates_resolve_item(&$item) { if((!$item["coord"]) || ($item["location"])) return; - $key = Config::get("geocoordinates", "api_key"); + $key = get_config("geocoordinates", "api_key"); if ($key == "") return; - $language = Config::get("geocoordinates", "language"); + $language = get_config("geocoordinates", "language"); if ($language == "") $language = "de"; @@ -82,16 +80,16 @@ function geocoordinates_plugin_admin(&$a,&$o) { $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$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' ), ''), + '$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' ), ''), )); } function geocoordinates_plugin_admin_post(&$a) { $api_key = ((x($_POST,'api_key')) ? notags(trim($_POST['api_key'])) : ''); - Config::set('geocoordinates','api_key',$api_key); + set_config('geocoordinates','api_key',$api_key); $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : ''); - Config::set('geocoordinates','language',$language); + set_config('geocoordinates','language',$language); info(t('Settings updated.'). EOL); } diff --git a/geonames/geonames.php b/geonames/geonames.php index 71e05c8b..c10653a7 100755 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -20,8 +20,6 @@ * */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; function geonames_install() { @@ -93,8 +91,8 @@ function geonames_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $geo_account = Config::get('geonames', 'username'); - $active = PConfig::get(local_user(), 'geonames', 'enable'); + $geo_account = get_config('geonames', 'username'); + $active = get_pconfig(local_user(), 'geonames', 'enable'); if((! $geo_account) || (! $active)) return; @@ -140,7 +138,7 @@ function geonames_post_hook($a, &$item) { function geonames_plugin_admin_post($a,$post) { if(! local_user() || (! x($_POST,'geonames-submit'))) return; - PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames'])); + set_pconfig(local_user(),'geonames','enable',intval($_POST['geonames'])); info( t('Geonames settings updated.') . EOL); } @@ -160,7 +158,7 @@ function geonames_plugin_admin(&$a,&$s) { if(! local_user()) return; - $geo_account = Config::get('geonames', 'username'); + $geo_account = get_config('geonames', 'username'); if(! $geo_account) return; @@ -171,7 +169,7 @@ function geonames_plugin_admin(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = PConfig::get(local_user(),'geonames','enable'); + $enabled = get_pconfig(local_user(),'geonames','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); diff --git a/gnot/gnot.php b/gnot/gnot.php index bbdf9d80..fcdc7319 100755 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -8,7 +8,6 @@ * */ -use Friendica\Core\PConfig; function gnot_install() { @@ -45,7 +44,7 @@ function gnot_settings_post($a,$post) { if(! local_user() || (! x($_POST,'gnot-submit'))) return; - PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot'])); + set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot'])); info( t('Gnot settings updated.') . EOL); } @@ -70,7 +69,7 @@ function gnot_settings(&$a,&$s) { /* Get the current state of our config variable */ - $gnot = intval(PConfig::get(local_user(),'gnot','enable')); + $gnot = intval(get_pconfig(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(get_pconfig($b['uid'], 'gnot','enable')))) return; if($b['type'] == NOTIFY_COMMENT) $b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']); diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index f1c89f9e..eb38db78 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -6,8 +6,6 @@ * Author: Klaus Weidenbach */ -use Friendica\Core\Config; - /** * Installs the plugin hook */ @@ -33,8 +31,8 @@ function gravatar_uninstall() { * @param &$b array */ function gravatar_lookup($a, &$b) { - $default_avatar = Config::get('gravatar', 'default_img'); - $rating = Config::get('gravatar', 'rating'); + $default_avatar = get_config('gravatar', 'default_img'); + $rating = get_config('gravatar', 'rating'); // setting default value if nothing configured if(! $default_avatar) @@ -59,8 +57,8 @@ function gravatar_lookup($a, &$b) { function gravatar_plugin_admin (&$a, &$o) { $t = get_markup_template( "admin.tpl", "addon/gravatar/" ); - $default_avatar = Config::get('gravatar', 'default_img'); - $rating = Config::get('gravatar', 'rating'); + $default_avatar = get_config('gravatar', 'default_img'); + $rating = get_config('gravatar', 'rating'); // set default values for first configuration if(! $default_avatar) @@ -108,8 +106,8 @@ function gravatar_plugin_admin_post (&$a) { $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon'); $rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g'); - Config::set('gravatar', 'default_img', $default_avatar); - Config::set('gravatar', 'rating', $rating); + set_config('gravatar', 'default_img', $default_avatar); + set_config('gravatar', 'rating', $rating); info( t('Gravatar settings updated.') .EOL); } ?> diff --git a/group_text/group_text.php b/group_text/group_text.php index febb87a7..29b0675f 100755 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -8,7 +8,6 @@ * */ -use Friendica\Core\PConfig; function group_text_install() { @@ -42,7 +41,7 @@ function group_text_uninstall() { function group_text_settings_post($a,$post) { if(! local_user() || (! x($_POST,'group_text-submit'))) return; - PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); + set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); info( t('Group Text settings updated.') . EOL); } @@ -68,7 +67,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 = get_pconfig(local_user(),'system','groupedit_image_limit'); $checked = (($enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index ddd517e2..e5428e82 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -9,8 +9,6 @@ require_once("mod/item.php"); require_once("include/items.php"); -use Friendica\Core\PConfig; - function ifttt_install() { register_hook('connector_settings', 'addon/ifttt/ifttt.php', 'ifttt_settings'); register_hook('connector_settings_post','addon/ifttt/ifttt.php', 'ifttt_settings_post'); @@ -32,11 +30,11 @@ function ifttt_settings(&$a,&$s) { if(! local_user()) return; - $key = PConfig::get(local_user(),'ifttt','key'); + $key = get_pconfig(local_user(),'ifttt','key'); if (!$key) { $key = substr(random_string(),0,20); - PConfig::set(local_user(),'ifttt','key', $key); + set_pconfig(local_user(),'ifttt','key', $key); } $s .= ''; @@ -104,7 +102,7 @@ function ifttt_post(&$a) { $key = $_REQUEST["key"]; // Check the key - if ($key != PConfig::get($uid,'ifttt','key')) { + if ($key != get_pconfig($uid,'ifttt','key')) { logger("Invalid key for user ".$uid, LOGGER_DEBUG); return; } diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index deeba042..3e57610a 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -9,8 +9,6 @@ * Author: Cat Gray */ -use Friendica\Core\PConfig; - function ijpost_install() { register_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); register_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); @@ -33,9 +31,9 @@ function ijpost_jot_nets(&$a,&$b) { if(! local_user()) return; - $ij_post = PConfig::get(local_user(),'ijpost','post'); + $ij_post = get_pconfig(local_user(),'ijpost','post'); if(intval($ij_post) == 1) { - $ij_defpost = PConfig::get(local_user(),'ijpost','post_by_default'); + $ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default'); $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Insanejournal') . '
'; @@ -54,16 +52,16 @@ function ijpost_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'ijpost','post'); + $enabled = get_pconfig(local_user(),'ijpost','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $def_enabled = PConfig::get(local_user(),'ijpost','post_by_default'); + $def_enabled = get_pconfig(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 = get_pconfig(local_user(), 'ijpost', 'ij_username'); + $ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password'); /* Add some HTML to the existing form */ @@ -106,10 +104,10 @@ function ijpost_settings_post(&$a,&$b) { if(x($_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'])); + set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost'])); + set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault'])); + set_pconfig(local_user(),'ijpost','ij_username',trim($_POST['ij_username'])); + set_pconfig(local_user(),'ijpost','ij_password',trim($_POST['ij_password'])); } @@ -128,11 +126,11 @@ function ijpost_post_local(&$a,&$b) { if($b['private'] || $b['parent']) return; - $ij_post = intval(PConfig::get(local_user(),'ijpost','post')); + $ij_post = intval(get_pconfig(local_user(),'ijpost','post')); $ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0); - if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ijpost','post_by_default'))) + if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default'))) $ij_enable = 1; if(! $ij_enable) @@ -169,8 +167,8 @@ function ijpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $ij_username = PConfig::get($b['uid'],'ijpost','ij_username'); - $ij_password = PConfig::get($b['uid'],'ijpost','ij_password'); + $ij_username = get_pconfig($b['uid'],'ijpost','ij_username'); + $ij_password = get_pconfig($b['uid'],'ijpost','ij_password'); $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc'; if($ij_username && $ij_password && $ij_blog) { diff --git a/impressum/impressum.php b/impressum/impressum.php index 867b6b9d..235c4147 100755 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -10,8 +10,6 @@ require_once('include/bbcode.php'); require_once('mod/proxy.php'); -use Friendica\Core\Config; - function impressum_install() { register_hook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); register_hook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); @@ -37,7 +35,7 @@ function obfuscate_email ($s) { return $s; } function impressum_footer($a, &$b) { - $text = proxy_parse_html(bbcode(Config::get('impressum','footer_text'), true)); + $text = proxy_parse_html(bbcode(get_config('impressum','footer_text'), true)); if (! $text == '') { $a->page['htmlhead'] .= ''; $b .= '
'; @@ -46,11 +44,11 @@ function impressum_footer($a, &$b) { } function impressum_show($a,&$b) { $b .= '

'.t('Impressum').'

'; - $owner = Config::get('impressum', 'owner'); - $owner_profile = Config::get('impressum','ownerprofile'); - $postal = proxy_parse_html(bbcode(Config::get('impressum', 'postal'), true)); - $notes = proxy_parse_html(bbcode(Config::get('impressum', 'notes'), true)); - $email = obfuscate_email( Config::get('impressum','email') ); + $owner = get_config('impressum', 'owner'); + $owner_profile = get_config('impressum','ownerprofile'); + $postal = proxy_parse_html(bbcode(get_config('impressum', 'postal'), true)); + $notes = proxy_parse_html(bbcode(get_config('impressum', 'notes'), true)); + $email = obfuscate_email( get_config('impressum','email') ); if (strlen($owner)) { if (strlen($owner_profile)) { $tmp = ''.$owner.''; @@ -80,23 +78,23 @@ function impressum_plugin_admin_post (&$a) { $notes = ((x($_POST, 'notes')) ? (trim($_POST['notes'])) : ''); $email = ((x($_POST, 'email')) ? notags(trim($_POST['email'])) : ''); $footer_text = ((x($_POST, 'footer_text')) ? (trim($_POST['footer_text'])) : ''); - Config::set('impressum','owner',strip_tags($owner)); - Config::set('impressum','ownerprofile',strip_tags($ownerprofile)); - Config::set('impressum','postal',strip_tags($postal)); - Config::set('impressum','email',strip_tags($email)); - Config::set('impressum','notes',strip_tags($notes)); - Config::set('impressum','footer_text',strip_tags($footer_text)); + set_config('impressum','owner',strip_tags($owner)); + set_config('impressum','ownerprofile',strip_tags($ownerprofile)); + set_config('impressum','postal',strip_tags($postal)); + set_config('impressum','email',strip_tags($email)); + set_config('impressum','notes',strip_tags($notes)); + set_config('impressum','footer_text',strip_tags($footer_text)); info( t('Settings updated.'). EOL ); } function impressum_plugin_admin (&$a, &$o) { $t = get_markup_template( "admin.tpl", "addon/impressum/" ); $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$owner' => array('owner', t('Site Owner'), Config::get('impressum','owner'), t('The page operators name.')), - '$ownerprofile' => array('ownerprofile', t('Site Owners Profile'), Config::get('impressum','ownerprofile'), t('Profile address of the operator.')), - '$postal' => array('postal', t('Postal Address'), Config::get('impressum','postal'), t('How to contact the operator via snail mail. You can use BBCode here.')), - '$notes' => array('notes', t('Notes'), Config::get('impressum','notes'), t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')), - '$email' => array('email', t('Email Address'), Config::get('impressum','email'), t('How to contact the operator via email. (will be displayed obfuscated)')), - '$footer_text' => array('footer_text', t('Footer note'), Config::get('impressum','footer_text'), t('Text for the footer. You can use BBCode here.')), + '$owner' => array('owner', t('Site Owner'), get_config('impressum','owner'), t('The page operators name.')), + '$ownerprofile' => array('ownerprofile', t('Site Owners Profile'), get_config('impressum','ownerprofile'), t('Profile address of the operator.')), + '$postal' => array('postal', t('Postal Address'), get_config('impressum','postal'), t('How to contact the operator via snail mail. You can use BBCode here.')), + '$notes' => array('notes', t('Notes'), get_config('impressum','notes'), t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')), + '$email' => array('email', t('Email Address'), get_config('impressum','email'), t('How to contact the operator via email. (will be displayed obfuscated)')), + '$footer_text' => array('footer_text', t('Footer note'), get_config('impressum','footer_text'), t('Text for the footer. You can use BBCode here.')), )); } diff --git a/irc/irc.php b/irc/irc.php index d1a36e08..0ac7be37 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -7,9 +7,6 @@ * Author: Tobias Diekershoff */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function irc_install() { register_hook('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); register_hook('plugin_settings', 'addon/irc/irc.php', 'irc_addon_settings'); @@ -32,8 +29,8 @@ function irc_addon_settings(&$a,&$s) { // $a->page['htmlhead'] .= '' . "\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 = get_pconfig( local_user(), 'irc','sitechats'); /* popular channels */ + $autochans = get_pconfig( local_user(), 'irc','autochans'); /* auto connect chans */ $t = get_markup_template( "settings.tpl", "addon/irc/" ); $s .= replace_macros($t, array( @@ -54,8 +51,8 @@ function irc_addon_settings_post(&$a,&$b) { return; if($_POST['irc-submit']) { - PConfig::set( local_user(), 'irc','autochans',trim($_POST['autochans'])); - PConfig::set( local_user(), 'irc','sitechats',trim($_POST['sitechats'])); + set_pconfig( local_user(), 'irc','autochans',trim($_POST['autochans'])); + set_pconfig( local_user(), 'irc','sitechats',trim($_POST['sitechats'])); /* upid pop-up thing */ info( t('IRC settings saved.') . EOL); } @@ -78,11 +75,11 @@ function irc_content(&$a) { /* set the list of popular channels */ if (local_user()) { - $sitechats = PConfig::get( local_user(), 'irc', 'sitechats'); + $sitechats = get_pconfig( local_user(), 'irc', 'sitechats'); if (!$sitechats) - $sitechats = Config::get('irc', 'sitechats'); + $sitechats = get_config('irc', 'sitechats'); } else { - $sitechats = Config::get('irc','sitechats'); + $sitechats = get_config('irc','sitechats'); } if($sitechats) $chats = explode(',',$sitechats); @@ -98,11 +95,11 @@ function irc_content(&$a) { /* setting the channel(s) to auto connect */ if (local_user()) { - $autochans = PConfig::get(local_user(), 'irc', 'autochans'); + $autochans = get_pconfig(local_user(), 'irc', 'autochans'); if (!$autochans) - $autochans = Config::get('irc','autochans'); + $autochans = get_config('irc','autochans'); } else { - $autochans = Config::get('irc','autochans'); + $autochans = get_config('irc','autochans'); } if($autochans) $channels = $autochans; @@ -125,15 +122,15 @@ function irc_plugin_admin_post (&$a) { return; if($_POST['irc-submit']) { - Config::set('irc','autochans',trim($_POST['autochans'])); - Config::set('irc','sitechats',trim($_POST['sitechats'])); + set_config('irc','autochans',trim($_POST['autochans'])); + set_config('irc','sitechats',trim($_POST['sitechats'])); /* stupid pop-up thing */ info( t('IRC settings saved.') . EOL); } } function irc_plugin_admin (&$a, &$o) { - $sitechats = Config::get('irc','sitechats'); /* popular channels */ - $autochans = Config::get('irc','autochans'); /* auto connect chans */ + $sitechats = get_config('irc','sitechats'); /* popular channels */ + $autochans = get_config('irc','autochans'); /* auto connect chans */ $t = get_markup_template( "admin.tpl", "addon/irc/" ); $o = replace_macros($t, array( '$submit' => t('Save Settings'), diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 90499153..370d2c7b 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -63,9 +63,6 @@ json({"status":"ok", "encrypted_address":"%s"}) */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function jappixmini_install() { register_hook('plugin_settings', 'addon/jappixmini/jappixmini.php', 'jappixmini_settings'); register_hook('plugin_settings_post', 'addon/jappixmini/jappixmini.php', 'jappixmini_settings_post'); @@ -79,20 +76,20 @@ register_hook('cron', 'addon/jappixmini/jappixmini.php', 'jappixmini_cron'); register_hook('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source'); // set standard configuration -$info_text = Config::get("jappixmini", "infotext"); -if (!$info_text) set_confConfig::setig("jappixmini", "infotext", +$info_text = get_config("jappixmini", "infotext"); +if (!$info_text) set_config("jappixmini", "infotext", "To get the chat working, you need to know a BOSH host which works with your Jabber account. ". "An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep ". "in mind that the BOSH server can read along all chat messages. If you know that your Jabber ". "server also provides an own BOSH server, it is much better to use this one!" ); -$bosh_proxy = Config::get("jappixmini", "bosh_proxy"); -if ($bosh_proxy==="") Config::set("jappixmini", "bosh_proxy", "1"); +$bosh_proxy = get_config("jappixmini", "bosh_proxy"); +if ($bosh_proxy==="") set_config("jappixmini", "bosh_proxy", "1"); // set addon version so that safe updates are possible later -$addon_version = Config::get("jappixmini", "version"); -if ($addon_version==="") Config::set("jappixmini", "version", "1"); +$addon_version = get_config("jappixmini", "version"); +if ($addon_version==="") set_config("jappixmini", "version", "1"); } @@ -116,33 +113,33 @@ function jappixmini_plugin_admin(&$a, &$o) { } // warn if cron job has not yet been executed - $cron_run = Config::get("jappixmini", "last_cron_execution"); + $cron_run = get_config("jappixmini", "last_cron_execution"); if (!$cron_run) $o .= "

Warning: The cron job has not yet been executed. If this message is still there after some time (usually 10 minutes), this means that autosubscribe and autoaccept will not work.

"; // bosh proxy - $bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy")); + $bosh_proxy = intval(get_config("jappixmini", "bosh_proxy")); $bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : ''; $o .= ''; $o .= '
'; // bosh address - $bosh_address = Config::get("jappixmini", "bosh_address"); + $bosh_address = get_config("jappixmini", "bosh_address"); $o .= '


'; $o .= '

'; // default server address - $default_server = Config::get("jappixmini", "default_server"); + $default_server = get_config("jappixmini", "default_server"); $o .= '


'; $o .= '

'; // default user name to friendica nickname - $default_user = intval(Config::get("jappixmini", "default_user")); + $default_user = intval(get_config("jappixmini", "default_user")); $default_user = intval($default_user) ? ' checked="checked"' : ''; $o .= ''; $o .= '
'; // info text field - $info_text = Config::get("jappixmini", "infotext"); + $info_text = get_config("jappixmini", "infotext"); $o .= '


'; $o .= '

'; @@ -159,11 +156,11 @@ function jappixmini_plugin_admin_post(&$a) { $default_user = intval($_REQUEST['jappixmini-defaultuser']); $bosh_address = $_REQUEST['jappixmini-address']; $default_server = $_REQUEST['jappixmini-server']; - Config::set("jappixmini", "infotext", $info_text); - Config::set("jappixmini", "bosh_proxy", $bosh_proxy); - Config::set("jappixmini", "bosh_address", $bosh_address); - Config::set("jappixmini", "default_server", $default_server); - Config::set("jappixmini", "default_user", $default_user); + set_config("jappixmini", "infotext", $info_text); + set_config("jappixmini", "bosh_proxy", $bosh_proxy); + set_config("jappixmini", "bosh_address", $bosh_address); + set_config("jappixmini", "default_server", $default_server); + set_config("jappixmini", "default_user", $default_user); } } @@ -209,18 +206,18 @@ function jappixmini_init(&$a) { $decrypt_func($signed_address, $trusted_address, $key); $now = intval(time()); - PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address"); + set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address"); } catch (Exception $e) { } // do not return an address if user deactivated plugin - $activated = PConfig::get($uid, 'jappixmini', 'activate'); + $activated = get_pconfig($uid, 'jappixmini', 'activate'); if (!$activated) killme(); // return the requested Jabber address try { - $username = PConfig::get($uid, 'jappixmini', 'username'); - $server = PConfig::get($uid, 'jappixmini', 'server'); + $username = get_pconfig($uid, 'jappixmini', 'username'); + $server = get_pconfig($uid, 'jappixmini', 'server'); $address = "$username@$server"; $encrypted_address = ""; @@ -244,38 +241,38 @@ function jappixmini_init(&$a) { function jappixmini_settings(&$a, &$s) { // addon settings for a user - $activate = PConfig::get(local_user(),'jappixmini','activate'); + $activate = get_pconfig(local_user(),'jappixmini','activate'); $activate = intval($activate) ? ' checked="checked"' : ''; - $dontinsertchat = PConfig::get(local_user(),'jappixmini','dontinsertchat'); + $dontinsertchat = get_pconfig(local_user(),'jappixmini','dontinsertchat'); $insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : ''); - $defaultbosh = Config::get("jappixmini", "bosh_address"); + $defaultbosh = get_config("jappixmini", "bosh_address"); if ($defaultbosh != "") - PConfig::set(local_user(),'jappixmini','bosh', $defaultbosh); + set_pconfig(local_user(),'jappixmini','bosh', $defaultbosh); - $username = PConfig::get(local_user(),'jappixmini','username'); + $username = get_pconfig(local_user(),'jappixmini','username'); $username = htmlentities($username); - $server = PConfig::get(local_user(),'jappixmini','server'); + $server = get_pconfig(local_user(),'jappixmini','server'); $server = htmlentities($server); - $bosh = PConfig::get(local_user(),'jappixmini','bosh'); + $bosh = get_pconfig(local_user(),'jappixmini','bosh'); $bosh = htmlentities($bosh); - $password = PConfig::get(local_user(),'jappixmini','password'); - $autosubscribe = PConfig::get(local_user(),'jappixmini','autosubscribe'); + $password = get_pconfig(local_user(),'jappixmini','password'); + $autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe'); $autosubscribe = intval($autosubscribe) ? ' checked="checked"' : ''; - $autoapprove = PConfig::get(local_user(),'jappixmini','autoapprove'); + $autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove'); $autoapprove = intval($autoapprove) ? ' checked="checked"' : ''; - $encrypt = intval(PConfig::get(local_user(),'jappixmini','encrypt')); + $encrypt = intval(get_pconfig(local_user(),'jappixmini','encrypt')); $encrypt_checked = $encrypt ? ' checked="checked"' : ''; $encrypt_disabled = $encrypt ? '' : ' disabled="disabled"'; if ($server == "") - $server = Config::get("jappixmini", "default_server"); + $server = get_config("jappixmini", "default_server"); - if (($username == "") && Config::get("jappixmini", "default_user")) + if (($username == "") && get_config("jappixmini", "default_user")) $username = $a->user["nickname"]; - $info_text = Config::get("jappixmini", "infotext"); + $info_text = get_config("jappixmini", "infotext"); $info_text = htmlentities($info_text); $info_text = str_replace("\n", "
", $info_text); @@ -412,22 +409,22 @@ function jappixmini_settings_post(&$a,&$b) { $purge = intval($b['jappixmini-purge']); $username = trim($b['jappixmini-username']); - $old_username = PConfig::get($uid,'jappixmini','username'); + $old_username = get_pconfig($uid,'jappixmini','username'); if ($username!=$old_username) $purge = 1; $server = trim($b['jappixmini-server']); - $old_server = PConfig::get($uid,'jappixmini','server'); + $old_server = get_pconfig($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); + set_pconfig($uid,'jappixmini','username',$username); + set_pconfig($uid,'jappixmini','server',$server); + set_pconfig($uid,'jappixmini','bosh',trim($b['jappixmini-bosh'])); + set_pconfig($uid,'jappixmini','password',trim($b['jappixmini-encrypted-password'])); + set_pconfig($uid,'jappixmini','autosubscribe',intval($b['jappixmini-autosubscribe'])); + set_pconfig($uid,'jappixmini','autoapprove',intval($b['jappixmini-autoapprove'])); + set_pconfig($uid,'jappixmini','activate',intval($b['jappixmini-activate'])); + set_pconfig($uid,'jappixmini','dontinsertchat',intval($b['jappixmini-dont-insertchat'])); + set_pconfig($uid,'jappixmini','encrypt',$encrypt); info( 'Jappix Mini settings saved.' ); if ($purge) { @@ -445,8 +442,8 @@ function jappixmini_script(&$a,&$s) { if ($_GET["mode"] == "minimal") return; - $activate = PConfig::get(local_user(),'jappixmini','activate'); - $dontinsertchat = PConfig::get(local_user(), 'jappixmini','dontinsertchat'); + $activate = get_pconfig(local_user(),'jappixmini','activate'); + $dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat'); if (!$activate || $dontinsertchat) return; $a->page['htmlhead'] .= ''."\r\n"; @@ -454,24 +451,24 @@ function jappixmini_script(&$a,&$s) { $a->page['htmlhead'] .= ''."\r\n"; - $username = PConfig::get(local_user(),'jappixmini','username'); + $username = get_pconfig(local_user(),'jappixmini','username'); $username = str_replace("'", "\\'", $username); - $server = PConfig::get(local_user(),'jappixmini','server'); + $server = get_pconfig(local_user(),'jappixmini','server'); $server = str_replace("'", "\\'", $server); - $bosh = PConfig::get(local_user(),'jappixmini','bosh'); + $bosh = get_pconfig(local_user(),'jappixmini','bosh'); $bosh = str_replace("'", "\\'", $bosh); - $encrypt = PConfig::get(local_user(),'jappixmini','encrypt'); + $encrypt = get_pconfig(local_user(),'jappixmini','encrypt'); $encrypt = intval($encrypt); - $password = PConfig::get(local_user(),'jappixmini','password'); + $password = get_pconfig(local_user(),'jappixmini','password'); $password = str_replace("'", "\\'", $password); - $autoapprove = PConfig::get(local_user(),'jappixmini','autoapprove'); + $autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove'); $autoapprove = intval($autoapprove); - $autosubscribe = PConfig::get(local_user(),'jappixmini','autosubscribe'); + $autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe'); $autosubscribe = intval($autosubscribe); // set proxy if necessary - $use_proxy = Config::get('jappixmini','bosh_proxy'); + $use_proxy = get_config('jappixmini','bosh_proxy'); if ($use_proxy) { $proxy = $a->get_baseurl().'/addon/jappixmini/proxy.php'; } @@ -508,7 +505,7 @@ function jappixmini_script(&$a,&$s) { // get nickname $r = q("SELECT `username` FROM `user` WHERE `uid`=$uid"); $nickname = json_encode($r[0]["username"]); - $groupchats = Config::get('jappixmini','groupchats'); + $groupchats = get_config('jappixmini','groupchats'); //if $groupchats has no value jappix_addon_start will produce a syntax error if(empty($groupchats)){ $groupchats = "{}"; @@ -540,7 +537,7 @@ function jappixmini_login(&$a, &$o) { function jappixmini_cron(&$a, $d) { // For autosubscribe/autoapprove, we need to maintain a list of jabber addresses of our contacts. - Config::set("jappixmini", "last_cron_execution", $d); + set_config("jappixmini", "last_cron_execution", $d); // go through list of users with jabber enabled $users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'"); @@ -574,7 +571,7 @@ function jappixmini_cron(&$a, $d) { } // check if jabber address already present - $present = PConfig::get($uid, "jappixmini", "id:".$dfrn_id); + $present = get_pconfig($uid, "jappixmini", "id:".$dfrn_id); $now = intval(time()); if ($present) { // $present has format "timestamp:jabber_address" @@ -593,9 +590,9 @@ function jappixmini_cron(&$a, $d) { $base = substr($request, 0, $pos)."/jappixmini?role=$role"; // construct own address - $username = PConfig::get($uid, 'jappixmini', 'username'); + $username = get_pconfig($uid, 'jappixmini', 'username'); if (!$username) continue; - $server = PConfig::get($uid, 'jappixmini', 'server'); + $server = get_pconfig($uid, 'jappixmini', 'server'); if (!$server) continue; $address = $username."@".$server; @@ -631,7 +628,7 @@ function jappixmini_cron(&$a, $d) { } // save address - PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address"); + set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address"); } } } diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 1418da95..148fde31 100755 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -16,8 +16,6 @@ * */ -use Friendica\Core\Config; - function js_upload_install() { register_hook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form'); @@ -47,7 +45,7 @@ function js_upload_form(&$a,&$b) { $cancel = t('Cancel'); $failed = t('Failed'); - $maximagesize = intval(Config::get('system','maximagesize')); + $maximagesize = intval(get_config('system','maximagesize')); $b['addon_text'] .= <<< EOT @@ -143,7 +141,7 @@ function js_upload_post_init(&$a,&$b) { // max file size in bytes - $sizeLimit = Config::get('system','maximagesize'); //6 * 1024 * 1024; + $sizeLimit = get_config('system','maximagesize'); //6 * 1024 * 1024; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); @@ -199,7 +197,7 @@ class qqUploadedFileXhr { function save() { $input = fopen("php://input", "r"); - $upload_dir = Config::get('system','tempdir'); + $upload_dir = get_config('system','tempdir'); if(! $upload_dir) $upload_dir = sys_get_temp_dir(); @@ -317,7 +315,7 @@ class qqFileUploader { // } - $maximagesize = Config::get('system','maximagesize'); + $maximagesize = get_config('system','maximagesize'); if(($maximagesize) && ($size > $maximagesize)) { return array('error' => t('Image exceeds size limit of ') . $maximagesize ); diff --git a/krynn/krynn.php b/krynn/krynn.php index ca2c426d..de968713 100755 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -10,7 +10,6 @@ *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere */ -use Friendica\Core\PConfig; function krynn_install() { @@ -82,7 +81,7 @@ function krynn_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'krynn', 'enable'); + $active = get_pconfig(local_user(), 'krynn', 'enable'); if(! $active) return; @@ -120,7 +119,7 @@ function krynn_settings_post($a,$post) { if(! local_user()) return; if($_POST['krynn-submit']) - PConfig::set(local_user(),'krynn','enable',intval($_POST['krynn'])); + set_pconfig(local_user(),'krynn','enable',intval($_POST['krynn'])); } @@ -144,7 +143,7 @@ function krynn_settings(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = PConfig::get(local_user(),'krynn','enable'); + $enabled = get_pconfig(local_user(),'krynn','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 0aa13620..d4fe942d 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -1,5 +1,4 @@ t("Language Filter"), - '$intro' => t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'), - '$enabled' => array('langfilter_enable', t('Use the language filter'), $enable_checked, ''), - '$languages' => array('langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')), - '$minconfidence' => array('langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')), - '$minlength' => array('langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')), - '$submit' => t('Save Settings'), + $t = get_markup_template("settings.tpl", "addon/langfilter/" ); + $s .= replace_macros ($t, array( + '$title' => t("Language Filter"), + '$intro' => t ('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'), + '$enabled' => array('langfilter_enable', t('Use the language filter'), $enable_checked, ''), + '$languages' => array('langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".') ), + '$minconfidence' => array('langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.') ), + '$minlength' => array('langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.') ), + '$submit' => t('Save Settings'), )); return; } - /* Save the settings * 1st check it's a logged in user calling * 2nd check the langfilter form is to be saved * 3rd save the settings to the DB for later usage */ - -function langfilter_addon_settings_post(App $a, &$b) -{ - if (!local_user()) { +function langfilter_addon_settings_post(&$a,&$b) { + if(! local_user()) return; - } - if ($_POST['langfilter-settings-submit']) { - PConfig::set(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages'])); - $enable = ((x($_POST, 'langfilter_enable')) ? intval($_POST['langfilter_enable']) : 0); - $disable = 1 - $enable; - PConfig::set(local_user(), 'langfilter', 'disable', $disable); - $minconfidence = 0 + $_POST['langfilter_minconfidence']; - if (!$minconfidence) { - $minconfidence = 0; - } elseif ($minconfidence < 0) { - $minconfidence = 0; - } elseif ($minconfidence > 100) { - $minconfidence = 100; - } - PConfig::set(local_user(), 'langfilter', 'minconfidence', $minconfidence / 100.0); + if($_POST['langfilter-settings-submit']) { + set_pconfig(local_user(),'langfilter','languages',trim($_POST['langfilter_languages'])); + $enable = ((x($_POST,'langfilter_enable')) ? intval($_POST['langfilter_enable']) : 0); + $disable = 1-$enable; + set_pconfig(local_user(),'langfilter','disable', $disable); + $minconfidence = 0+$_POST['langfilter_minconfidence']; + if ( ! $minconfidence ) $minconfidence = 0; + else if ( $minconfidence < 0 ) $minconfidence = 0; + else if ( $minconfidence > 100 ) $minconfidence = 100; + set_pconfig(local_user(),'langfilter','minconfidence', $minconfidence/100.0); - $minlength = 0 + $_POST['langfilter_minlength']; - if (!$minlength) { - $minlength = 32; - } elseif ($minlengt8h < 0) { - $minlength = 32; - } - PConfig::set(local_user(), 'langfilter', 'minlength', $minlength); + $minlength = 0+$_POST['langfilter_minlength']; + if ( ! $minlength ) $minlength = 32; + else if ( $minlength < 0 ) $minlength = 32; + set_pconfig(local_user(),'langfilter','minlength', $minlength); - info(t('Language Filter Settings saved.') . EOL); + info( t('Language Filter Settings saved.') . EOL); } } - /* Actually filter postings by their language * 1st check if the user wants to filter postings * 2nd get the user settings which languages shall be not filtered out @@ -112,71 +89,51 @@ function langfilter_addon_settings_post(App $a, &$b) * of the user, then collapse the posting, but provide a link to * expand it again. */ +function langfilter_prepare_body(&$a,&$b) { -function langfilter_prepare_body(App $a, &$b) -{ - $logged_user = local_user(); - if (!$logged_user) { - return; - } + $logged_user = local_user(); + if ( ! $logged_user ) return; - // Never filter own messages - // TODO: find a better way to extract this - $logged_user_profile = $a->config['system']['url'] . '/profile/' . $a->user['nickname']; - if ($logged_user_profile == $b['item']['author-link']) { - return; - } + # Never filter own messages + # TODO: find a better way to extract this + $logged_user_profile = $a->config['system']['url'] . '/profile/' . $a->user['nickname']; + if ( $logged_user_profile == $b['item']['author-link'] ) return; - // Don't filter if language filter is disabled - if (PConfig::get($logged_user, 'langfilter', 'disable')) { - return; - } + # Don't filter if language filter is disabled + if( get_pconfig($logged_user,'langfilter','disable') ) return; - // Don't filter if body lenght is below minimum - $minlen = PConfig::get(local_user(), 'langfilter', 'minlength'); - if (!$minlen) { - $minlen = 32; - } - if (strlen($b['item']['body']) < $minlen) { - return; - } + # Don't filter if body lenght is below minimum + $minlen = get_pconfig(local_user(),'langfilter','minlength'); + if ( ! $minlen ) $minlen = 32; + if ( strlen($b['item']['body']) < $minlen ) return; - $spoken_config = PConfig::get(local_user(), 'langfilter', 'languages'); - $minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence'); + $spoken_config = get_pconfig(local_user(),'langfilter','languages'); + $minconfidence = get_pconfig(local_user(),'langfilter','minconfidence'); - // Don't filter if no spoken languages are configured - if (!$spoken_config) - return; - $spoken_languages = explode(',', $spoken_config); + # Don't filter if no spoken languages are configured + if ( ! $spoken_config ) return; + $spoken_languages = explode(',', $spoken_config); - // Extract the language of the post - $opts = $b['item']['postopts']; - if (!$opts) { - // no options associated to post - return; - } - if (!preg_match('/\blang=([^;]*);([^:]*)/', $opts, $matches)) { - // no lang options associated to post - return; - } + # Extract the language of the post + $opts = $b['item']['postopts']; + if ( ! $opts ) return; # no options associated to post + if ( ! preg_match('/\blang=([^;]*);([^:]*)/', $opts, $matches ) ) + return; # no lang options associated to post - $lang = $matches[1]; - $confidence = $matches[2]; + $lang = $matches[1]; + $confidence = $matches[2]; - // Do not filter if language detection confidence is too low - if ($minconfidence && $confidence < $minconfidence) { - return; - } + # Do not filter if language detection confidence is too low + if ( $minconfidence && $confidence < $minconfidence ) return; - $iso2 = Text_LanguageDetect_ISO639::nameToCode2($lang); + $iso2 = Text_LanguageDetect_ISO639::nameToCode2($lang); - if (!$iso2) { - return; - } - $spoken = in_array($iso2, $spoken_languages); + if ( ! $iso2 ) return; + $spoken = in_array($iso2, $spoken_languages); - if (!$spoken) { - $rnd = random_string(8); - $b['html'] = ''; - } + if( ! $spoken ) { + $rnd = random_string(8); + $b['html'] = ''; + } } +?> diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 699d0dca..60273c3b 100755 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -54,8 +54,6 @@ require_once('include/user.php'); -use Friendica\Core\Config; - function ldapauth_install() { register_hook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); @@ -80,15 +78,15 @@ function ldapauth_hook_authenticate($a,&$b) { function ldapauth_authenticate($username,$password) { - $ldap_server = Config::get('ldapauth','ldap_server'); - $ldap_binddn = Config::get('ldapauth','ldap_binddn'); - $ldap_bindpw = Config::get('ldapauth','ldap_bindpw'); - $ldap_searchdn = Config::get('ldapauth','ldap_searchdn'); - $ldap_userattr = Config::get('ldapauth','ldap_userattr'); - $ldap_group = Config::get('ldapauth','ldap_group'); - $ldap_autocreateaccount = Config::get('ldapauth','ldap_autocreateaccount'); - $ldap_autocreateaccount_emailattribute = Config::get('ldapauth','ldap_autocreateaccount_emailattribute'); - $ldap_autocreateaccount_nameattribute = Config::get('ldapauth','ldap_autocreateaccount_nameattribute'); + $ldap_server = get_config('ldapauth','ldap_server'); + $ldap_binddn = get_config('ldapauth','ldap_binddn'); + $ldap_bindpw = get_config('ldapauth','ldap_bindpw'); + $ldap_searchdn = get_config('ldapauth','ldap_searchdn'); + $ldap_userattr = get_config('ldapauth','ldap_userattr'); + $ldap_group = get_config('ldapauth','ldap_group'); + $ldap_autocreateaccount = get_config('ldapauth','ldap_autocreateaccount'); + $ldap_autocreateaccount_emailattribute = get_config('ldapauth','ldap_autocreateaccount_emailattribute'); + $ldap_autocreateaccount_nameattribute = get_config('ldapauth','ldap_autocreateaccount_nameattribute'); if(! ((strlen($password)) && (function_exists('ldap_connect')) diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index e22c2b62..c58c707f 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -6,8 +6,6 @@ * Author: Michael Vogel */ -use Friendica\Core\Config; - function leistungsschutzrecht_install() { register_hook('cron', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_cron'); register_hook('getsiteinfo', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo'); @@ -117,12 +115,12 @@ function leistungsschutzrecht_fetchsites() { */ if (sizeof($sites)) { - Config::set('leistungsschutzrecht','sites',$sites); + set_config('leistungsschutzrecht','sites',$sites); } } function leistungsschutzrecht_is_member_site($url) { - $sites = Config::get('leistungsschutzrecht','sites'); + $sites = get_config('leistungsschutzrecht','sites'); if ($sites == "") return(false); @@ -144,7 +142,7 @@ function leistungsschutzrecht_is_member_site($url) { } function leistungsschutzrecht_cron($a,$b) { - $last = Config::get('leistungsschutzrecht','last_poll'); + $last = get_config('leistungsschutzrecht','last_poll'); if($last) { $next = $last + 86400; @@ -154,6 +152,6 @@ function leistungsschutzrecht_cron($a,$b) { } } leistungsschutzrecht_fetchsites(); - Config::set('leistungsschutzrecht','last_poll', time()); + set_config('leistungsschutzrecht','last_poll', time()); } ?> diff --git a/libertree/libertree.php b/libertree/libertree.php index 0ff512cf..c87a7104 100755 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -7,8 +7,6 @@ * Author: Tony Baldwin */ -use Friendica\Core\PConfig; - function libertree_install() { register_hook('post_local', 'addon/libertree/libertree.php', 'libertree_post_local'); register_hook('notifier_normal', 'addon/libertree/libertree.php', 'libertree_send'); @@ -30,9 +28,9 @@ function libertree_jot_nets(&$a,&$b) { if(! local_user()) return; - $ltree_post = PConfig::get(local_user(),'libertree','post'); + $ltree_post = get_pconfig(local_user(),'libertree','post'); if(intval($ltree_post) == 1) { - $ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default'); + $ltree_defpost = get_pconfig(local_user(),'libertree','post_by_default'); $selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to libertree') . '
'; @@ -51,16 +49,16 @@ function libertree_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'libertree','post'); + $enabled = get_pconfig(local_user(),'libertree','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'libertree','post_by_default'); + $def_enabled = get_pconfig(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 = get_pconfig(local_user(), 'libertree', 'libertree_api_token'); + $ltree_url = get_pconfig(local_user(), 'libertree', 'libertree_url'); /* Add some HTML to the existing form */ @@ -104,10 +102,10 @@ function libertree_settings_post(&$a,&$b) { if(x($_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'])); + set_pconfig(local_user(),'libertree','post',intval($_POST['libertree'])); + set_pconfig(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault'])); + set_pconfig(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token'])); + set_pconfig(local_user(),'libertree','libertree_url',trim($_POST['libertree_url'])); } @@ -129,11 +127,11 @@ function libertree_post_local(&$a,&$b) { return; } - $ltree_post = intval(PConfig::get(local_user(),'libertree','post')); + $ltree_post = intval(get_pconfig(local_user(),'libertree','post')); $ltree_enable = (($ltree_post && x($_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(get_pconfig(local_user(),'libertree','post_by_default'))) { $ltree_enable = 1; } @@ -165,8 +163,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 = get_pconfig($b['uid'],'libertree','libertree_api_token'); + $ltree_url = get_pconfig($b['uid'],'libertree','libertree_url'); $ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token"; $ltree_source = $a->get_hostname(); diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 4b87799f..d958dba4 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -6,8 +6,6 @@ * Author: Klaus Weidenbach */ -use Friendica\Core\Config; - /** * Installs the plugin hook */ @@ -38,11 +36,11 @@ function libravatar_uninstall() { * @param &$b array */ function libravatar_lookup($a, &$b) { - $default_avatar = Config::get('libravatar', 'default_img'); + $default_avatar = get_config('libravatar', 'default_img'); if (! $default_avatar) { // if not set, look up if there was one from the gravatar addon - $default_avatar = Config::get('gravatar', 'default_img'); + $default_avatar = get_config('gravatar', 'default_img'); // setting default avatar if nothing configured if (! $default_avatar) $default_avatar = 'identicon'; // default image will be a random pattern @@ -64,7 +62,7 @@ function libravatar_lookup($a, &$b) { function libravatar_plugin_admin (&$a, &$o) { $t = get_markup_template( "admin.tpl", "addon/libravatar" ); - $default_avatar = Config::get('libravatar', 'default_img'); + $default_avatar = get_config('libravatar', 'default_img'); // set default values for first configuration if(! $default_avatar) @@ -110,7 +108,7 @@ function libravatar_plugin_admin_post (&$a) { check_form_security_token('libravatarrsave'); $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon'); - Config::set('libravatar', 'default_img', $default_avatar); + set_config('libravatar', 'default_img', $default_avatar); info(t('Libravatar settings updated.') .EOL); } ?> diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 9f3af043..c8690c26 100755 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -9,8 +9,6 @@ * Author: Cat Gray */ -use Friendica\Core\PConfig; - function ljpost_install() { register_hook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); register_hook('notifier_normal', 'addon/ljpost/ljpost.php', 'ljpost_send'); @@ -33,9 +31,9 @@ function ljpost_jot_nets(&$a,&$b) { if(! local_user()) return; - $lj_post = PConfig::get(local_user(),'ljpost','post'); + $lj_post = get_pconfig(local_user(),'ljpost','post'); if(intval($lj_post) == 1) { - $lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default'); + $lj_defpost = get_pconfig(local_user(),'ljpost','post_by_default'); $selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to LiveJournal') . '
'; @@ -54,16 +52,16 @@ function ljpost_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'ljpost','post'); + $enabled = get_pconfig(local_user(),'ljpost','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $def_enabled = PConfig::get(local_user(),'ljpost','post_by_default'); + $def_enabled = get_pconfig(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 = get_pconfig(local_user(), 'ljpost', 'lj_username'); + $lj_password = get_pconfig(local_user(), 'ljpost', 'lj_password'); /* Add some HTML to the existing form */ @@ -101,10 +99,10 @@ function ljpost_settings_post(&$a,&$b) { if(x($_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'])); + set_pconfig(local_user(),'ljpost','post',intval($_POST['ljpost'])); + set_pconfig(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault'])); + set_pconfig(local_user(),'ljpost','lj_username',trim($_POST['lj_username'])); + set_pconfig(local_user(),'ljpost','lj_password',trim($_POST['lj_password'])); } @@ -123,11 +121,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(get_pconfig(local_user(),'ljpost','post')); $lj_enable = (($lj_post && x($_REQUEST,'ljpost_enable')) ? intval($_REQUEST['ljpost_enable']) : 0); - if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ljpost','post_by_default'))) + if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ljpost','post_by_default'))) $lj_enable = 1; if(! $lj_enable) @@ -164,13 +162,13 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username')); - $lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password')); - $lj_journal = xmlify(PConfig::get($b['uid'],'ljpost','lj_journal')); + $lj_username = xmlify(get_pconfig($b['uid'],'ljpost','lj_username')); + $lj_password = xmlify(get_pconfig($b['uid'],'ljpost','lj_password')); + $lj_journal = xmlify(get_pconfig($b['uid'],'ljpost','lj_journal')); // if(! $lj_journal) // $lj_journal = $lj_username; - $lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog')); + $lj_blog = xmlify(get_pconfig($b['uid'],'ljpost','lj_blog')); if(! strlen($lj_blog)) $lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc'); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 8ff5f69f..c3e4974d 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -6,9 +6,6 @@ * Author: Matthew Exon */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function mailstream_install() { register_hook('plugin_settings', 'addon/mailstream/mailstream.php', 'mailstream_plugin_settings'); register_hook('plugin_settings_post', 'addon/mailstream/mailstream.php', 'mailstream_plugin_settings_post'); @@ -16,37 +13,37 @@ function mailstream_install() { register_hook('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); register_hook('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron'); - if (Config::get('mailstream', 'dbversion') == '0.1') { + if (get_config('mailstream', 'dbversion') == '0.1') { q('ALTER TABLE `mailstream_item` DROP INDEX `uid`'); q('ALTER TABLE `mailstream_item` DROP INDEX `contact-id`'); q('ALTER TABLE `mailstream_item` DROP INDEX `plink`'); q('ALTER TABLE `mailstream_item` CHANGE `plink` `uri` char(255) NOT NULL'); - Config::set('mailstream', 'dbversion', '0.2'); + set_config('mailstream', 'dbversion', '0.2'); } - if (Config::get('mailstream', 'dbversion') == '0.2') { + if (get_config('mailstream', 'dbversion') == '0.2') { q('DELETE FROM `pconfig` WHERE `cat` = "mailstream" AND `k` = "delay"'); - Config::set('mailstream', 'dbversion', '0.3'); + set_config('mailstream', 'dbversion', '0.3'); } - if (Config::get('mailstream', 'dbversion') == '0.3') { + if (get_config('mailstream', 'dbversion') == '0.3') { q('ALTER TABLE `mailstream_item` CHANGE `created` `created` timestamp NOT NULL DEFAULT now()'); q('ALTER TABLE `mailstream_item` CHANGE `completed` `completed` timestamp NULL DEFAULT NULL'); - Config::set('mailstream', 'dbversion', '0.4'); + set_config('mailstream', 'dbversion', '0.4'); } - if (Config::get('mailstream', 'dbversion') == '0.4') { + if (get_config('mailstream', 'dbversion') == '0.4') { q('ALTER TABLE `mailstream_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'); - Config::set('mailstream', 'dbversion', '0.5'); + set_config('mailstream', 'dbversion', '0.5'); } - if (Config::get('mailstream', 'dbversion') == '0.5') { - Config::set('mailstream', 'dbversion', '1.0'); + if (get_config('mailstream', 'dbversion') == '0.5') { + set_config('mailstream', 'dbversion', '1.0'); } - if (Config::get('retriever', 'dbversion') != '1.0') { + if (get_config('retriever', 'dbversion') != '1.0') { $schema = file_get_contents(dirname(__file__).'/database.sql'); $arr = explode(';', $schema); foreach ($arr as $a) { $r = q($a); } - Config::set('mailstream', 'dbversion', '1.0'); + set_config('mailstream', 'dbversion', '1.0'); } } @@ -66,7 +63,7 @@ function mailstream_uninstall() { function mailstream_module() {} function mailstream_plugin_admin(&$a,&$o) { - $frommail = Config::get('mailstream', 'frommail'); + $frommail = get_config('mailstream', 'frommail'); $template = get_markup_template('admin.tpl', 'addon/mailstream/'); $config = array('frommail', t('From Address'), @@ -79,7 +76,7 @@ function mailstream_plugin_admin(&$a,&$o) { function mailstream_plugin_admin_post ($a) { if (x($_POST, 'frommail')) { - Config::set('mailstream', 'frommail', $_POST['frommail']); + set_config('mailstream', 'frommail', $_POST['frommail']); } } @@ -93,7 +90,7 @@ function mailstream_generate_id($a, $uri) { } function mailstream_post_hook(&$a, &$item) { - if (!PConfig::get($item['uid'], 'mailstream', 'enabled')) { + if (!get_pconfig($item['uid'], 'mailstream', 'enabled')) { return; } if (!$item['uid']) { @@ -105,7 +102,7 @@ function mailstream_post_hook(&$a, &$item) { if (!$item['uri']) { return; } - if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) { + if (get_pconfig($item['uid'], 'mailstream', 'nolikes')) { if ($item['verb'] == ACTIVITY_LIKE) { return; } @@ -142,7 +139,7 @@ function mailstream_get_user($uid) { } function mailstream_do_images($a, &$item, &$attachments) { - if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) { + if (!get_pconfig($item['uid'], 'mailstream', 'attachimg')) { return; } $attachments = array(); @@ -255,11 +252,11 @@ function mailstream_send($a, $message_id, $item, $user) { require_once('include/bbcode.php'); $attachments = array(); mailstream_do_images($a, $item, $attachments); - $frommail = Config::get('mailstream', 'frommail'); + $frommail = get_config('mailstream', 'frommail'); if ($frommail == "") { $frommail = 'friendica@localhost.local'; } - $address = PConfig::get($item['uid'], 'mailstream', 'address'); + $address = get_pconfig($item['uid'], 'mailstream', 'address'); if (!$address) { $address = $user['email']; } @@ -346,10 +343,10 @@ function mailstream_cron($a, $b) { } function mailstream_plugin_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 = get_pconfig(local_user(), 'mailstream', 'enabled'); + $address = get_pconfig(local_user(), 'mailstream', 'address'); + $nolikes = get_pconfig(local_user(), 'mailstream', 'nolikes'); + $attachimg= get_pconfig(local_user(), 'mailstream', 'attachimg'); $template = get_markup_template('settings.tpl', 'addon/mailstream/'); $s .= replace_macros($template, array( '$enabled' => array( @@ -377,25 +374,25 @@ function mailstream_plugin_settings(&$a,&$s) { function mailstream_plugin_settings_post($a,$post) { if ($_POST['mailstream_address'] != "") { - PConfig::set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']); + set_pconfig(local_user(), 'mailstream', 'address', $_POST['mailstream_address']); } else { del_pconfig(local_user(), 'mailstream', 'address'); } if ($_POST['mailstream_nolikes']) { - PConfig::set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']); + set_pconfig(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']); } else { del_pconfig(local_user(), 'mailstream', 'nolikes'); } if ($_POST['mailstream_enabled']) { - PConfig::set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']); + set_pconfig(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']); } else { del_pconfig(local_user(), 'mailstream', 'enabled'); } if ($_POST['mailstream_attachimg']) { - PConfig::set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']); + set_pconfig(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']); } else { del_pconfig(local_user(), 'mailstream', 'attachimg'); diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 695022e6..9bff86a2 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -8,9 +8,6 @@ * License: 3-clause BSD license */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function mathjax_install() { register_hook('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header'); register_hook('plugin_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings'); @@ -28,12 +25,12 @@ function mathjax_settings_post ($a, $post) { // don't check statusnet settings if statusnet submit button is not clicked if (!x($_POST,'mathjax-submit')) return; - PConfig::set(local_user(),'mathjax','use',intval($_POST['mathjax_use'])); + set_pconfig(local_user(),'mathjax','use',intval($_POST['mathjax_use'])); } function mathjax_settings (&$a, &$s) { if (! local_user()) return; - $use = PConfig::get(local_user(),'mathjax','use'); + $use = get_pconfig(local_user(),'mathjax','use'); $usetext = (($use) ? ' checked="checked" ' : ''); $s .= ''; $s .= '

MathJax '.t('Settings').'

'; @@ -56,13 +53,13 @@ function mathjax_settings (&$a, &$s) { function mathjax_page_header($a, &$b) { // if the visitor of the page is not a local_user, use MathJax // otherwise check the users settings. - $url = Config::get ('mathjax','baseurl'); + $url = get_config ('mathjax','baseurl'); if(! $url) $url = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; if (! local_user()) { $b .= ''; } else { - $use = PConfig::get(local_user(),'mathjax','use'); + $use = get_pconfig(local_user(),'mathjax','use'); if ($use) { $b .= ''; } @@ -70,17 +67,17 @@ function mathjax_page_header($a, &$b) { } function mathjax_plugin_admin_post (&$a) { $baseurl = ((x($_POST, 'baseurl')) ? trim($_POST['baseurl']) : 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); - Config::set('mathjax','baseurl',$baseurl); + set_config('mathjax','baseurl',$baseurl); info( t('Settings updated.'). EOL); } function mathjax_plugin_admin (&$a, &$o) { $t = get_markup_template( "admin.tpl", "addon/mathjax/" ); - if (Config::get('mathjax','baseurl','') == '') { - Config::set('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); + if (get_config('mathjax','baseurl','') == '') { + set_config('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); } $o = replace_macros( $t, array( '$submit' => t('Save Settings'), - '$baseurl' => array('baseurl', t('MathJax Base URL'), Config::get('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')), + '$baseurl' => array('baseurl', t('MathJax Base URL'), get_config('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')), )); } diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 13663336..d837efc2 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -9,8 +9,6 @@ require_once('include/bbcode.php'); -use Friendica\Core\Config; - function newmemberwidget_install () { register_hook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); logger('newmemberwidget installed'); @@ -24,11 +22,11 @@ function newmemberwidget_network_mod_init ( $a, $b) { $t = '
'.EOL; $t .= '

'.t('New Member').'

'.EOL; $t .= '' . t('Tips for New Members') . '
'.EOL; - if (Config::get('newmemberwidget','linkglobalsupport')==1) + if (get_config('newmemberwidget','linkglobalsupport')==1) $t .= ''.t('Global Support Forum').'
'.EOL; - if (Config::get('newmemberwidget','linklocalsupport')==1) - $t .= ''.t('Local Support Forum').'
'.EOL; - $ft = Config::get('newmemberwidget','freetext'); + if (get_config('newmemberwidget','linklocalsupport')==1) + $t .= ''.t('Local Support Forum').'
'.EOL; + $ft = get_config('newmemberwidget','freetext'); if (!trim($ft)=="") $t .= '

'.bbcode(trim($ft)).'

'; $t .= '
'; @@ -41,20 +39,20 @@ function newmemberwidget_plugin_admin_post( &$a ) { $lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : ""); $gs = intval($_POST['linkglobalsupport']); $ls = intval($_POST['linklocalsupport']); - Config::set ( 'newmemberwidget', 'freetext', trim($ft)); - Config::set ( 'newmemberwidget', 'linkglobalsupport', $gs); - Config::set ( 'newmemberwidget', 'linklocalsupport', $ls); - Config::set ( 'newmemberwidget', 'localsupport', trim($lsn)); + set_config ( 'newmemberwidget', 'freetext', trim($ft)); + set_config ( 'newmemberwidget', 'linkglobalsupport', $gs); + set_config ( 'newmemberwidget', 'linklocalsupport', $ls); + set_config ( 'newmemberwidget', 'localsupport', trim($lsn)); } function newmemberwidget_plugin_admin(&$a, &$o){ $t = get_markup_template('admin.tpl','addon/newmemberwidget'); $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$freetext' => array( "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")), - '$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), Config::get( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers)"), - '$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), Config::get( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')), - '$localsupportname' => array( "localsupportname", t('Name of the local support group'), Config::get( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')), + '$freetext' => array( "freetext", t("Message"), get_config( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")), + '$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), get_config( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers)"), + '$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), get_config( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')), + '$localsupportname' => array( "localsupportname", t('Name of the local support group'), get_config( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')), )); } diff --git a/notimeline/notimeline.php b/notimeline/notimeline.php index 33e66b13..c2bca211 100644 --- a/notimeline/notimeline.php +++ b/notimeline/notimeline.php @@ -8,7 +8,6 @@ * */ -use Friendica\Core\PConfig; function notimeline_install() { @@ -29,7 +28,7 @@ function notimeline_settings_post($a,$post) { if(! local_user() || (! x($_POST,'notimeline-submit'))) return; - PConfig::set(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline'])); + set_pconfig(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline'])); info( t('No Timeline settings updated.') . EOL); } @@ -44,7 +43,7 @@ function notimeline_settings(&$a,&$s) { /* Get the current state of our config variable */ - $notimeline = PConfig::get(local_user(),'system','no_wall_archive_widget'); + $notimeline = get_pconfig(local_user(),'system','no_wall_archive_widget'); if($notimeline === false) $notimeline = false; diff --git a/nsfw/README b/nsfw/README index e42c2128..624fb703 100755 --- a/nsfw/README +++ b/nsfw/README @@ -47,7 +47,25 @@ done with a single regex, which matches all of them: Another use case could be, that you are simply not interested in postings about christmas. - /christmas([-_ ]?(tree|time|eve|pudding))?/ + /christmas(?:[-_ ]?(?:tree|time|eve|pudding))?/ + + +ATTENTION: + +It is absolutely important, that you use grouping +parentheses instead of capturing parentheses!! + +Grouping parentheses are: + + (?: ) + +If you use capturing parentheses, which are + + ( ) + +it will produce errors and the regex won't work and +at least your targets will not get collapsed. + 3) diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 6d8acbf0..af383d20 100755 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -9,8 +9,6 @@ * */ -use Friendica\Core\PConfig; - function nsfw_install() { register_hook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body', 10); register_hook('plugin_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings'); @@ -71,8 +69,8 @@ function nsfw_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $enable_checked = (intval(PConfig::get(local_user(),'nsfw','disable')) ? '' : ' checked="checked" '); - $words = PConfig::get(local_user(),'nsfw','words'); + $enable_checked = (intval(get_pconfig(local_user(),'nsfw','disable')) ? '' : ' checked="checked" '); + $words = get_pconfig(local_user(),'nsfw','words'); if(! $words) $words = 'nsfw,'; @@ -106,10 +104,10 @@ function nsfw_addon_settings_post(&$a,&$b) { return; if($_POST['nsfw-submit']) { - PConfig::set(local_user(),'nsfw','words',trim($_POST['nsfw-words'])); + set_pconfig(local_user(),'nsfw','words',trim($_POST['nsfw-words'])); $enable = ((x($_POST,'nsfw-enable')) ? intval($_POST['nsfw-enable']) : 0); $disable = 1-$enable; - PConfig::set(local_user(),'nsfw','disable', $disable); + set_pconfig(local_user(),'nsfw','disable', $disable); info( t('NSFW Settings saved.') . EOL); } } @@ -118,11 +116,11 @@ function nsfw_prepare_body(&$a,&$b) { $words = null; - if(PConfig::get(local_user(),'nsfw','disable')) + if(get_pconfig(local_user(),'nsfw','disable')) return; if(local_user()) { - $words = PConfig::get(local_user(),'nsfw','words'); + $words = get_pconfig(local_user(),'nsfw','words'); } if($words) { $arr = explode(',',$words); diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index d7f43b4f..2f48a0d7 100755 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -8,7 +8,6 @@ * */ -use Friendica\Core\PConfig; function numfriends_install() { @@ -43,7 +42,7 @@ function numfriends_settings_post($a,$post) { if(! local_user() || (! x($_POST,'numfriends-submit'))) return; - PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); + set_pconfig(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); info( t('Numfriends settings updated.') . EOL); } @@ -68,7 +67,7 @@ function numfriends_settings(&$a,&$s) { /* Get the current state of our config variable */ - $numfriends = PConfig::get(local_user(),'system','display_friend_count'); + $numfriends = get_pconfig(local_user(),'system','display_friend_count'); if($numfriends === false) $numfriends = 24; diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 175e5862..13545169 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -11,8 +11,6 @@ require_once('include/cache.php'); -use Friendica\Core\Config; - function openstreetmap_install() { register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location'); @@ -59,19 +57,19 @@ function openstreetmap_location($a, &$item) { * ?mlat=lat&mlon=lon for markers. */ - $tmsserver = Config::get('openstreetmap', 'tmsserver'); + $tmsserver = get_config('openstreetmap', 'tmsserver'); if(! $tmsserver) $tmsserver = 'http://www.openstreetmap.org'; - $nomserver = Config::get('openstreetmap', 'nomserver'); + $nomserver = get_config('openstreetmap', 'nomserver'); if(! $nomserver) $nomserver = 'http://nominatim.openstreetmap.org/search.php'; - $zoom = Config::get('openstreetmap', 'zoom'); + $zoom = get_config('openstreetmap', 'zoom'); if(! $zoom) $zoom = 16; - $marker = Config::get('openstreetmap', 'marker'); + $marker = get_config('openstreetmap', 'marker'); if(! $marker) $marker = 0; @@ -102,7 +100,7 @@ function openstreetmap_location($a, &$item) { function openstreetmap_generate_named_map(&$a,&$b) { - $nomserver = Config::get('openstreetmap', 'nomserver'); + $nomserver = get_config('openstreetmap', 'nomserver'); if(! $nomserver) $nomserver = 'http://nominatim.openstreetmap.org/search.php'; $args = '?q=' . urlencode($b['location']) . '&format=json'; @@ -121,18 +119,18 @@ function openstreetmap_generate_named_map(&$a,&$b) { function openstreetmap_generate_map(&$a,&$b) { - $tmsserver = Config::get('openstreetmap', 'tmsserver'); + $tmsserver = get_config('openstreetmap', 'tmsserver'); if(! $tmsserver) $tmsserver = 'http://www.openstreetmap.org'; if(strpos(z_root(),'https:') !== false) $tmsserver = str_replace('http:','https:',$tmsserver); - $zoom = Config::get('openstreetmap', 'zoom'); + $zoom = get_config('openstreetmap', 'zoom'); if(! $zoom) $zoom = 16; - $marker = Config::get('openstreetmap', 'marker'); + $marker = get_config('openstreetmap', 'marker'); if(! $marker) $marker = 0; @@ -153,16 +151,16 @@ function openstreetmap_generate_map(&$a,&$b) { function openstreetmap_plugin_admin(&$a, &$o) { $t = get_markup_template("admin.tpl", "addon/openstreetmap/"); - $tmsserver = Config::get('openstreetmap', 'tmsserver'); + $tmsserver = get_config('openstreetmap', 'tmsserver'); if(! $tmsserver) $tmsserver = 'http://www.openstreetmap.org'; - $nomserver = Config::get('openstreetmap', 'nomserver'); + $nomserver = get_config('openstreetmap', 'nomserver'); if(! $nomserver) $nomserver = 'http://nominatim.openstreetmap.org/search.php'; - $zoom = Config::get('openstreetmap', 'zoom'); + $zoom = get_config('openstreetmap', 'zoom'); if(! $zoom) $zoom = 16; - $marker = Config::get('openstreetmap', 'marker'); + $marker = get_config('openstreetmap', 'marker'); if(! $marker) $marker = 0; @@ -179,10 +177,10 @@ function openstreetmap_plugin_admin_post(&$a) { $urlnom = ((x($_POST, 'nomserver')) ? notags(trim($_POST['nomserver'])) : ''); $zoom = ((x($_POST, 'zoom')) ? intval(trim($_POST['zoom'])) : '16'); $marker = ((x($_POST, 'marker')) ? intval(trim($_POST['marker'])) : '0'); - Config::set('openstreetmap', 'tmsserver', $urltms); - Config::set('openstreetmap', 'nomserver', $urlnom); - Config::set('openstreetmap', 'zoom', $zoom); - Config::set('openstreetmap', 'marker', $marker); + set_config('openstreetmap', 'tmsserver', $urltms); + set_config('openstreetmap', 'nomserver', $urlnom); + set_config('openstreetmap', 'zoom', $zoom); + set_config('openstreetmap', 'marker', $marker); info( t('Settings updated.') . EOL); } diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 977bee4e..173fc707 100755 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -10,8 +10,6 @@ * */ -use Friendica\Core\Config; - function pageheader_install() { register_hook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch'); register_hook('plugin_settings', 'addon/pageheader/pageheader.php', 'pageheader_addon_settings'); @@ -45,7 +43,7 @@ function pageheader_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $words = Config::get('pageheader','text'); + $words = get_config('pageheader','text'); if(! $words) $words = ''; @@ -68,7 +66,7 @@ function pageheader_addon_settings_post(&$a,&$b) { return; if($_POST['pageheader-submit']) { - Config::set('pageheader','text',trim(strip_tags($_POST['pageheader-words']))); + set_config('pageheader','text',trim(strip_tags($_POST['pageheader-words']))); info( t('pageheader Settings saved.') . EOL); } } @@ -78,7 +76,7 @@ function pageheader_fetch($a,&$b) { if(file_exists('pageheader.html')){ $s = file_get_contents('pageheader.html'); } else { - $s = Config::get('pageheader', 'text'); + $s = get_config('pageheader', 'text'); } $a->page['htmlhead'] .= ' t('Save Settings'), - '$piwikbaseurl' => array('baseurl', t('Piwik Base URL'), Config::get('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')), - '$siteid' => array('siteid', t('Site ID'), Config::get('piwik','siteid' ), ''), - '$optout' => array('optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''), - '$async' => array('async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''), + '$piwikbaseurl' => array('baseurl', t('Piwik Base URL'), get_config('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')), + '$siteid' => array('siteid', t('Site ID'), get_config('piwik','siteid' ), ''), + '$optout' => array('optout', t('Show opt-out cookie link?'), get_config('piwik','optout' ), ''), + '$async' => array('async', t('Asynchronous tracking'), get_config('piwik','async' ), ''), )); } function piwik_plugin_admin_post (&$a) { @@ -100,9 +98,9 @@ function piwik_plugin_admin_post (&$a) { $id = ((x($_POST, 'siteid')) ? trim($_POST['siteid']) : ''); $optout = ((x($_POST, 'optout')) ? trim($_POST['optout']) : ''); $async = ((x($_POST, 'async')) ? trim($_POST['async']) : ''); - Config::set('piwik', 'baseurl', $url); - Config::set('piwik', 'siteid', $id); - Config::set('piwik', 'optout', $optout); - Config::set('piwik', 'async', $async); + set_config('piwik', 'baseurl', $url); + set_config('piwik', 'siteid', $id); + set_config('piwik', 'optout', $optout); + set_config('piwik', 'async', $async); info( t('Settings updated.'). EOL); } diff --git a/planets/planets.php b/planets/planets.php index a8371c85..d40e6c61 100755 --- a/planets/planets.php +++ b/planets/planets.php @@ -7,7 +7,6 @@ * Author: Tony Baldwin */ -use Friendica\Core\PConfig; function planets_install() { @@ -79,7 +78,7 @@ function planets_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'planets', 'enable'); + $active = get_pconfig(local_user(), 'planets', 'enable'); if(! $active) return; @@ -117,7 +116,7 @@ function planets_settings_post($a,$post) { if(! local_user()) return; if($_POST['planets-submit']) - PConfig::set(local_user(),'planets','enable',intval($_POST['planets'])); + set_pconfig(local_user(),'planets','enable',intval($_POST['planets'])); } @@ -141,7 +140,7 @@ function planets_settings(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = PConfig::get(local_user(),'planets','enable'); + $enabled = get_pconfig(local_user(),'planets','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php index 6183c76d..fdc727b1 100644 --- a/pledgie/pledgie.php +++ b/pledgie/pledgie.php @@ -8,8 +8,6 @@ * */ -use Friendica\Core\Config; - function pledgie_install() { register_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); register_hook('plugin_settings', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings'); @@ -31,8 +29,8 @@ function pledgie_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $campaign = Config::get('pledgie-campaign','text'); - $describe = Config::get('pledgie-describe','text'); + $campaign = get_config('pledgie-campaign','text'); + $describe = get_config('pledgie-describe','text'); if(! $campaign) $campaign = ''; @@ -63,15 +61,15 @@ function pledgie_addon_settings_post(&$a,&$b) { return; if($_POST['pledgie-submit']) { - Config::set('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe']))); - Config::set('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign']))); + set_config('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe']))); + set_config('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign']))); info( t('pledgie Settings saved.') . EOL); } } function pledgie_active(&$a,&$b) { - $campaign = Config::get('pledgie-campaign','text'); - $describe = Config::get('pledgie-describe','text'); + $campaign = get_config('pledgie-campaign','text'); + $describe = get_config('pledgie-describe','text'); $b .= '
'; $b .= $describe . '
get_baseurl(); - $b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('system','sitename')); + $b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), get_config('system','sitename')); $b['subject'] = t('Your Friendica account is about to expire.'); $b['body'] = sprintf( t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days"), $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]"); } } function public_server_login($a,$b) { - $days = Config::get('public_server','expiredays'); + $days = get_config('public_server','expiredays'); if(! $days) return; $r = q("UPDATE user set account_expires_on = '%s' where uid = %d and account_expires_on > '0000-00-00 00:00:00'", @@ -150,12 +150,12 @@ function public_server_plugin_admin_post ( &$a ) { $flagusers = (( x($_POST, 'flagusers') ) ? notags(trim($_POST['flagusers'] )) : ''); $flagposts = (( x($_POST, 'flagposts') ) ? notags(trim($_POST['flagposts'] )) : ''); $flagpostsexpire = (( x($_POST, 'flagpostsexpire') ) ? notags(trim($_POST['flagpostsexpire'] )) : ''); - Config::set( 'public_server','expiredays',$expiredays ); - Config::set( 'public_server','expireposts',$expireposts ); - Config::set( 'public_server','nologin',$nologin ); - Config::set( 'public_server','flagusers',$flagusers); - Config::set( 'public_server','flagposts',$flagposts ); - Config::set( 'public_server','flagpostsexpire',$flagpostsexpire ); + set_config( 'public_server','expiredays',$expiredays ); + set_config( 'public_server','expireposts',$expireposts ); + set_config( 'public_server','nologin',$nologin ); + set_config( 'public_server','flagusers',$flagusers); + set_config( 'public_server','flagposts',$flagposts ); + set_config( 'public_server','flagpostsexpire',$flagpostsexpire ); info( t('Settings saved').EOL ); } function public_server_plugin_admin ( &$a, &$o) { @@ -165,12 +165,12 @@ function public_server_plugin_admin ( &$a, &$o) { '$submit' => t('Save Settings'), '$form_security_token' => $token, '$infotext' => t('Set any of these options to 0 to deactivate it.'), - '$expiredays' => Array( "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "), - '$expireposts' => Array( "expireposts", "Expire Posts", intval(Config::get('public_server','expireposts')), "Set the default days for posts to expire here"), - '$nologin' => Array( "nologin", "No Login", intval(Config::get('public_server','nologin')), "Remove users who have never logged in after nologin days "), - '$flagusers' => Array( "flagusers", "Flag users", intval(Config::get('public_server','flagusers')), "Remove users who last logged in over flagusers days ago"), - '$flagposts' => Array( "flagposts", "Flag posts", intval(Config::get('public_server','flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "), - '$flagpostsexpire' => Array( "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))), + '$expiredays' => Array( "expiredays","Expire Days", intval(get_config('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "), + '$expireposts' => Array( "expireposts", "Expire Posts", intval(get_config('public_server','expireposts')), "Set the default days for posts to expire here"), + '$nologin' => Array( "nologin", "No Login", intval(get_config('public_server','nologin')), "Remove users who have never logged in after nologin days "), + '$flagusers' => Array( "flagusers", "Flag users", intval(get_config('public_server','flagusers')), "Remove users who last logged in over flagusers days ago"), + '$flagposts' => Array( "flagposts", "Flag posts", intval(get_config('public_server','flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "), + '$flagpostsexpire' => Array( "flagpostsexpire", "Flag posts expire", intval(get_config('public_server','flagpostsexpire'))), )); } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 9bd08cf2..f70801a8 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -12,9 +12,6 @@ require_once('include/socgraph.php'); require_once("include/Photo.php"); require_once("mod/share.php"); -use Friendica\Core\Config; -use Friendica\Core\PConfig; - define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes function pumpio_install() { @@ -67,8 +64,8 @@ function pumpio_content(&$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 = get_pconfig($notification_data["uid"], 'pumpio','host'); + $username = get_pconfig($notification_data["uid"], "pumpio", "user"); $notification_data["profiles"][] = "https://".$hostname."/".$username; } @@ -80,7 +77,7 @@ function pumpio_registerclient(&$a, $host) { $params = array(); - $application_name = Config::get('pumpio', 'application_name'); + $application_name = get_config('pumpio', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); @@ -121,18 +118,18 @@ function pumpio_connect(&$a) { session_start(); // 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 = get_pconfig(local_user(), 'pumpio','consumer_key'); + $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret'); + $hostname = get_pconfig(local_user(), 'pumpio','host'); if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) { logger("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); + set_pconfig(local_user(), 'pumpio','consumer_key', $clientdata->client_id); + set_pconfig(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 = get_pconfig(local_user(), 'pumpio','consumer_key'); + $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret'); logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG); } @@ -169,8 +166,8 @@ function pumpio_connect(&$a) { if (($success = $client->Process())) { if (strlen($client->access_token)) { logger("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); + set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token); + set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret); } } $success = $client->Finalize($success); @@ -194,9 +191,9 @@ function pumpio_jot_nets(&$a,&$b) { if(! local_user()) return; - $pumpio_post = PConfig::get(local_user(),'pumpio','post'); + $pumpio_post = get_pconfig(local_user(),'pumpio','post'); if(intval($pumpio_post) == 1) { - $pumpio_defpost = PConfig::get(local_user(),'pumpio','post_by_default'); + $pumpio_defpost = get_pconfig(local_user(),'pumpio','post_by_default'); $selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to pumpio') . '
'; @@ -215,24 +212,24 @@ function pumpio_settings(&$a,&$s) { /* Get the current state of our config variables */ - $import_enabled = PConfig::get(local_user(),'pumpio','import'); + $import_enabled = get_pconfig(local_user(),'pumpio','import'); $import_checked = (($import_enabled) ? ' checked="checked" ' : ''); - $enabled = PConfig::get(local_user(),'pumpio','post'); + $enabled = get_pconfig(local_user(),'pumpio','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'pumpio','post_by_default'); + $def_enabled = get_pconfig(local_user(),'pumpio','post_by_default'); $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); - $public_enabled = PConfig::get(local_user(),'pumpio','public'); + $public_enabled = get_pconfig(local_user(),'pumpio','public'); $public_checked = (($public_enabled) ? ' checked="checked" ' : ''); - $mirror_enabled = PConfig::get(local_user(),'pumpio','mirror'); + $mirror_enabled = get_pconfig(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 = get_pconfig(local_user(), "pumpio", "host"); + $username = get_pconfig(local_user(), "pumpio", "user"); /* Add some HTML to the existing form */ @@ -256,8 +253,8 @@ function pumpio_settings(&$a,&$s) { 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 = get_pconfig(local_user(), "pumpio", "oauth_token"); + $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret"); $s .= '
'; if (($oauth_token == "") || ($oauth_token_secret == "")) { @@ -309,19 +306,19 @@ function pumpio_settings_post(&$a,&$b) { if(x($_POST,'pumpio-submit')) { if(x($_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', ''); + set_pconfig(local_user(),'pumpio','consumer_key',''); + set_pconfig(local_user(),'pumpio','consumer_secret',''); + set_pconfig(local_user(),'pumpio','oauth_token',''); + set_pconfig(local_user(),'pumpio','oauth_token_secret',''); + set_pconfig(local_user(),'pumpio','post',false); + set_pconfig(local_user(),'pumpio','import',false); + set_pconfig(local_user(),'pumpio','host',''); + set_pconfig(local_user(),'pumpio','user',''); + set_pconfig(local_user(),'pumpio','public',false); + set_pconfig(local_user(),'pumpio','mirror',false); + set_pconfig(local_user(),'pumpio','post_by_default',false); + set_pconfig(local_user(),'pumpio','lastdate', 0); + set_pconfig(local_user(),'pumpio','last_id', ''); } else { // filtering the username if it is filled wrong $user = $_POST['pumpio_user']; @@ -336,13 +333,13 @@ function pumpio_settings_post(&$a,&$b) { $host = trim($host); $host = str_replace(array("https://", "http://"), array("", ""), $host); - PConfig::set(local_user(),'pumpio','post',intval($_POST['pumpio'])); - PConfig::set(local_user(),'pumpio','import',$_POST['pumpio_import']); - PConfig::set(local_user(),'pumpio','host',$host); - PConfig::set(local_user(),'pumpio','user',$user); - PConfig::set(local_user(),'pumpio','public',$_POST['pumpio_public']); - PConfig::set(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']); - PConfig::set(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault'])); + set_pconfig(local_user(),'pumpio','post',intval($_POST['pumpio'])); + set_pconfig(local_user(),'pumpio','import',$_POST['pumpio_import']); + set_pconfig(local_user(),'pumpio','host',$host); + set_pconfig(local_user(),'pumpio','user',$user); + set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']); + set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']); + set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault'])); if (!$_POST['pumpio_mirror']) del_pconfig(local_user(),'pumpio','lastdate'); @@ -358,11 +355,11 @@ function pumpio_post_local(&$a, &$b) { return; } - $pumpio_post = intval(PConfig::get(local_user(), 'pumpio', 'post')); + $pumpio_post = intval(get_pconfig(local_user(), 'pumpio', 'post')); $pumpio_enable = (($pumpio_post && x($_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(get_pconfig(local_user(), 'pumpio', 'post_by_default'))) { $pumpio_enable = 1; } @@ -382,7 +379,7 @@ function pumpio_post_local(&$a, &$b) { function pumpio_send(&$a,&$b) { - if (!PConfig::get($b["uid"],'pumpio','import')) { + if (!get_pconfig($b["uid"],'pumpio','import')) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; } @@ -442,14 +439,14 @@ function pumpio_send(&$a,&$b) { // Support for native shares // http:///api//shares?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 = get_pconfig($b['uid'], "pumpio", "oauth_token"); + $oauth_token_secret = get_pconfig($b['uid'], "pumpio", "oauth_token_secret"); + $consumer_key = get_pconfig($b['uid'], "pumpio","consumer_key"); + $consumer_secret = get_pconfig($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 = get_pconfig($b['uid'], "pumpio", "host"); + $user = get_pconfig($b['uid'], "pumpio", "user"); + $public = get_pconfig($b['uid'], "pumpio", "public"); if($oauth_token && $oauth_token_secret) { @@ -519,7 +516,7 @@ function pumpio_send(&$a,&$b) { if($success) { if ($user->generator->displayName) - PConfig::set($b["uid"], "pumpio", "application_name", $user->generator->displayName); + set_pconfig($b["uid"], "pumpio", "application_name", $user->generator->displayName); $post_id = $user->object->id; logger('pumpio_send '.$username.': success '.$post_id); @@ -549,15 +546,15 @@ function pumpio_send(&$a,&$b) { function pumpio_action(&$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 (!get_pconfig($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 = get_pconfig($uid, 'pumpio', 'consumer_key'); + $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret'); + $otoken = get_pconfig($uid, 'pumpio', 'oauth_token'); + $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret'); + $hostname = get_pconfig($uid, 'pumpio','host'); + $username = get_pconfig($uid, "pumpio", "user"); $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($uri), @@ -628,9 +625,9 @@ function pumpio_sync(&$a) { if (!count($r)) return; - $last = Config::get('pumpio','last_poll'); + $last = get_config('pumpio','last_poll'); - $poll_interval = intval(Config::get('pumpio','poll_interval')); + $poll_interval = intval(get_config('pumpio','poll_interval')); if(! $poll_interval) $poll_interval = PUMPIO_DEFAULT_POLL_INTERVAL; @@ -651,7 +648,7 @@ function pumpio_sync(&$a) { } } - $abandon_days = intval(Config::get('system','account_abandon_days')); + $abandon_days = intval(get_config('system','account_abandon_days')); if ($abandon_days < 1) $abandon_days = 0; @@ -672,7 +669,7 @@ function pumpio_sync(&$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 = get_pconfig($rr['uid'],'pumpio','contact_check'); if($last_contact_check) $next_contact_check = $last_contact_check + 86400; else @@ -680,14 +677,14 @@ function pumpio_sync(&$a) { if($next_contact_check <= time()) { pumpio_getallusers($a, $rr["uid"]); - PConfig::set($rr['uid'],'pumpio','contact_check',time()); + set_pconfig($rr['uid'],'pumpio','contact_check',time()); } } } logger('pumpio: cron_end'); - Config::set('pumpio','last_poll', time()); + set_config('pumpio','last_poll', time()); } function pumpio_cron(&$a,$b) { @@ -696,20 +693,20 @@ function pumpio_cron(&$a,$b) { } function pumpio_fetchtimeline(&$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 = get_pconfig($uid, 'pumpio', 'consumer_key'); + $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret'); + $otoken = get_pconfig($uid, 'pumpio', 'oauth_token'); + $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret'); + $lastdate = get_pconfig($uid, 'pumpio', 'lastdate'); + $hostname = get_pconfig($uid, 'pumpio','host'); + $username = get_pconfig($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 = get_pconfig( $uid, 'pumpio', 'application_name'); if ($application_name == "") - $application_name = Config::get('pumpio', 'application_name'); + $application_name = get_config('pumpio', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); @@ -812,7 +809,7 @@ function pumpio_fetchtimeline(&$a, $uid) { } if ($lastdate != 0) - PConfig::set($uid,'pumpio','lastdate', $lastdate); + set_pconfig($uid,'pumpio','lastdate', $lastdate); } function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) { @@ -1212,7 +1209,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet $postarray['edited'] = $postarray['created']; if ($post->verb == "share") { - if (!intval(Config::get('system','wall-to-wall_share'))) { + if (!intval(get_config('system','wall-to-wall_share'))) { if (isset($post->object->author->displayName) && ($post->object->author->displayName != "")) $share_author = $post->object->author->displayName; elseif (isset($post->object->author->preferredUsername) && ($post->object->author->preferredUsername != "")) @@ -1321,13 +1318,13 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet function pumpio_fetchinbox(&$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 = get_pconfig($uid, 'pumpio', 'consumer_key'); + $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret'); + $otoken = get_pconfig($uid, 'pumpio', 'oauth_token'); + $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret'); + $lastdate = get_pconfig($uid, 'pumpio', 'lastdate'); + $hostname = get_pconfig($uid, 'pumpio','host'); + $username = get_pconfig($uid, "pumpio", "user"); $own_id = "https://".$hostname."/".$username; @@ -1352,7 +1349,7 @@ function pumpio_fetchinbox(&$a, $uid) { $client->access_token = $otoken; $client->access_token_secret = $osecret; - $last_id = PConfig::get($uid,'pumpio','last_id'); + $last_id = get_pconfig($uid,'pumpio','last_id'); $url = 'https://'.$hostname.'/api/user/'.$username.'/inbox'; @@ -1377,16 +1374,16 @@ function pumpio_fetchinbox(&$a, $uid) { foreach ($lastitems AS $item) pumpio_fetchallcomments($a, $uid, $item["uri"]); - PConfig::set($uid,'pumpio','last_id', $last_id); + set_pconfig($uid,'pumpio','last_id', $last_id); } function pumpio_getallusers(&$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 = get_pconfig($uid, 'pumpio', 'consumer_key'); + $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret'); + $otoken = get_pconfig($uid, 'pumpio', 'oauth_token'); + $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret'); + $hostname = get_pconfig($uid, 'pumpio','host'); + $username = get_pconfig($uid, "pumpio", "user"); $client = new oauth_client_class; $client->oauth_version = '1.0a'; @@ -1448,13 +1445,13 @@ function pumpio_queue_hook(&$a,&$b) { //logger('pumpio_queue: fetching userdata '.print_r($userdata, true)); - $oauth_token = PConfig::get($userdata['uid'], "pumpio", "oauth_token"); - $oauth_token_secret = PConfig::get($userdata['uid'], "pumpio", "oauth_token_secret"); - $consumer_key = PConfig::get($userdata['uid'], "pumpio","consumer_key"); - $consumer_secret = PConfig::get($userdata['uid'], "pumpio","consumer_secret"); + $oauth_token = get_pconfig($userdata['uid'], "pumpio", "oauth_token"); + $oauth_token_secret = get_pconfig($userdata['uid'], "pumpio", "oauth_token_secret"); + $consumer_key = get_pconfig($userdata['uid'], "pumpio","consumer_key"); + $consumer_secret = get_pconfig($userdata['uid'], "pumpio","consumer_secret"); - $host = PConfig::get($userdata['uid'], "pumpio", "host"); - $user = PConfig::get($userdata['uid'], "pumpio", "user"); + $host = get_pconfig($userdata['uid'], "pumpio", "host"); + $user = get_pconfig($userdata['uid'], "pumpio", "user"); $success = false; @@ -1512,7 +1509,7 @@ function pumpio_getreceiver(&$a, $b) { if(! strstr($b['postopts'],'pumpio')) return $receiver; - $public = PConfig::get($b['uid'], "pumpio", "public"); + $public = get_pconfig($b['uid'], "pumpio", "public"); if ($public) $receiver["to"][] = Array( @@ -1589,12 +1586,12 @@ function pumpio_getreceiver(&$a, $b) { } function pumpio_fetchallcomments(&$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 = get_pconfig($uid, 'pumpio', 'consumer_key'); + $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret'); + $otoken = get_pconfig($uid, 'pumpio', 'oauth_token'); + $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret'); + $hostname = get_pconfig($uid, 'pumpio','host'); + $username = get_pconfig($uid, "pumpio", "user"); logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id); diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 90826e54..2c98cba7 100755 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -20,8 +20,6 @@ * */ -use Friendica\Core\PConfig; - function qcomment_install() { register_hook('plugin_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); register_hook('plugin_settings_post', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings_post'); @@ -48,7 +46,7 @@ function qcomment_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $words = PConfig::get(local_user(),'qcomment','words'); + $words = get_pconfig(local_user(),'qcomment','words'); if($words === false) $words = t(':-)') . "\n" . t(':-(') . "\n" . t('lol'); @@ -73,7 +71,7 @@ function qcomment_addon_settings_post(&$a,&$b) { return; if($_POST['qcomment-submit']) { - PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words'])); + set_pconfig(local_user(),'qcomment','words',xmlify($_POST['qcomment-words'])); info( t('Quick Comment settings saved.') . EOL); } } diff --git a/randplace/randplace.php b/randplace/randplace.php index 96e5d3b2..27589b1c 100755 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -19,7 +19,6 @@ * */ -use Friendica\Core\PConfig; function randplace_install() { @@ -91,7 +90,7 @@ function randplace_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'randplace', 'enable'); + $active = get_pconfig(local_user(), 'randplace', 'enable'); if(! $active) return; @@ -136,7 +135,7 @@ function randplace_settings_post($a,$post) { if(! local_user()) return; if($_POST['randplace-submit']) - PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace'])); + set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace'])); } @@ -160,7 +159,7 @@ function randplace_settings(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = PConfig::get(local_user(),'randplace','enable'); + $enabled = get_pconfig(local_user(),'randplace','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index a1d1a8ec..5cba005a 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -7,8 +7,6 @@ * */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; function remote_permissions_install() { register_hook('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content'); @@ -27,7 +25,7 @@ function remote_permissions_settings(&$a,&$o) { if(! local_user()) return; - $global = Config::get("remote_perms", "global"); + $global = get_config("remote_perms", "global"); if($global == 1) return; @@ -37,7 +35,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 = get_pconfig(local_user(),'remote_perms','show'); /* Add some HTML to the existing form */ @@ -56,7 +54,7 @@ function remote_permissions_settings_post($a,$post) { if(! local_user() || (! x($_POST,'remote-perms-submit'))) return; - PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms'])); + set_pconfig(local_user(),'remote_perms','show',intval($_POST['remote-perms'])); info( t('Remote Permissions settings updated.') . EOL); } @@ -65,7 +63,7 @@ function remote_permissions_content($a, $item_copy) { if($item_copy['uid'] != local_user()) return; - if(Config::get('remote_perms','global') == 0) { + if(get_config('remote_perms','global') == 0) { // Admin has set Individual choice. We need to find // the original poster. First, get the contact's info $r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1", @@ -88,7 +86,7 @@ function remote_permissions_content($a, $item_copy) { if(! $r) return; - if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0) + if(get_pconfig($r[0]['uid'],'remote_perms','show') == 0) return; } @@ -196,14 +194,14 @@ function remote_permissions_plugin_admin(&$a, &$o){ $t = get_markup_template( "admin.tpl", "addon/remote_permissions/" ); $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1), - '$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0) + '$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), get_config('remote_perms', 'global') == 1), + '$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), get_config('remote_perms', 'global') == 0) )); } function remote_permissions_plugin_admin_post(&$a){ $choice = ((x($_POST,'remotepermschoice')) ? notags(trim($_POST['remotepermschoice'])) : ''); - Config::set('remote_perms','global',($choice == 1 ? 1 : 0)); + set_config('remote_perms','global',($choice == 1 ? 1 : 0)); info( t('Settings updated.'). EOL ); } diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 534568ca..034fdec7 100755 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -9,8 +9,6 @@ * */ -use Friendica\Core\Config; - function rendertime_install() { register_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); } @@ -47,7 +45,7 @@ function rendertime_page_end(&$a, &$o) { //round($a->performance["plugin"], 3) )."
"; - if (Config::get("rendertime", "callstack")) { + if (get_config("rendertime", "callstack")) { $o .= "
";
 			$o .= "\nDatabase Read:\n";
 			foreach ($a->callstack["database"] AS $func => $time) {
diff --git a/securemail/securemail.php b/securemail/securemail.php
index 95376696..b20eab9c 100644
--- a/securemail/securemail.php
+++ b/securemail/securemail.php
@@ -7,7 +7,6 @@
  */
 
 use Friendica\App;
-use Friendica\Core\PConfig;
 
 require_once 'include/Emailer.php';
 
@@ -56,8 +55,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(get_pconfig(local_user(), 'securemail', 'enable'));
+    $publickey = get_pconfig(local_user(), 'securemail', 'pkey');
 
     $t = get_markup_template('admin.tpl', 'addon/securemail/');
 
@@ -87,9 +86,9 @@ function securemail_settings_post(App &$a, array &$b){
     }
 
     if ($_POST['securemail-submit']) {
-        PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
+        set_pconfig(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
         $enable = ((x($_POST, 'securemail-enable')) ? 1 : 0);
-        PConfig::set(local_user(), 'securemail', 'enable', $enable);
+        set_pconfig(local_user(), 'securemail', 'enable', $enable);
         info(t('Secure Mail Settings saved.') . EOL);
 
         if ($_POST['securemail-submit'] == t('Save and send test')) {
@@ -119,12 +118,12 @@ function securemail_settings_post(App &$a, array &$b){
             );
 
             // enable addon for test
-            PConfig::set(local_user(), 'securemail', 'enable', 1);
+            set_pconfig(local_user(), 'securemail', 'enable', 1);
 
             $res = Emailer::send($params);
 
             // revert to saved value
-            PConfig::set(local_user(), 'securemail', 'enable', $enable);
+            set_pconfig(local_user(), 'securemail', 'enable', $enable);
 
             if ($res) {
                 info(t('Test email sent') . EOL);
@@ -152,12 +151,12 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
 
     $uid = $b['uid'];
 
-    $enable_checked = PConfig::get($uid, 'securemail', 'enable');
+    $enable_checked = get_pconfig($uid, 'securemail', 'enable');
     if (!$enable_checked) {
         return;
     }
 
-    $public_key_ascii = PConfig::get($uid, 'securemail', 'pkey');
+    $public_key_ascii = get_pconfig($uid, 'securemail', 'pkey');
 
     preg_match('/-----BEGIN ([A-Za-z ]+)-----/', $public_key_ascii, $matches);
     $marker = (empty($matches[1])) ? 'MESSAGE' : $matches[1];
diff --git a/showmore/showmore.php b/showmore/showmore.php
index af158a55..a9d8334f 100755
--- a/showmore/showmore.php
+++ b/showmore/showmore.php
@@ -8,8 +8,6 @@
  *
  */
 
-use Friendica\Core\PConfig;
-
 function showmore_install() {
 	register_hook('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body');
 	register_hook('plugin_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings');
@@ -31,8 +29,8 @@ function showmore_addon_settings(&$a,&$s) {
 
 	$a->page['htmlhead'] .= ''."\r\n";
 
-	$enable_checked = (intval(PConfig::get(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
-	$chars = PConfig::get(local_user(),'showmore','chars');
+	$enable_checked = (intval(get_pconfig(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
+	$chars = get_pconfig(local_user(),'showmore','chars');
 	if(!$chars)
 		$chars = '1100';
 
@@ -66,10 +64,10 @@ function showmore_addon_settings_post(&$a,&$b) {
 		return;
 
 	if($_POST['showmore-submit']) {
-		PConfig::set(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
+		set_pconfig(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
 		$enable = ((x($_POST,'showmore-enable')) ? intval($_POST['showmore-enable']) : 0);
 		$disable = 1-$enable;
-		PConfig::set(local_user(),'showmore','disable', $disable);
+		set_pconfig(local_user(),'showmore','disable', $disable);
 		info( t('Show More Settings saved.') . EOL);
 	}
 }
@@ -109,10 +107,10 @@ function get_body_length($body) {
 function showmore_prepare_body(&$a,&$b) {
 
 	$words = null;
-	if(PConfig::get(local_user(),'showmore','disable'))
+	if(get_pconfig(local_user(),'showmore','disable'))
 		return;
 
-	$chars = (int)PConfig::get(local_user(),'showmore','chars');
+	$chars = (int)get_pconfig(local_user(),'showmore','chars');
 	if(!$chars)
 		$chars = 1100;
 
diff --git a/startpage/startpage.php b/startpage/startpage.php
index c4324576..e0d822ac 100644
--- a/startpage/startpage.php
+++ b/startpage/startpage.php
@@ -7,7 +7,6 @@
  * 
  */
 
-use Friendica\Core\PConfig;
 
 function startpage_install() {
 	register_hook('home_init', 'addon/startpage/startpage.php', 'startpage_home_init');
@@ -28,7 +27,7 @@ function startpage_home_init($a, $b) {
 	if(! local_user())
 		return;
 
-	$page = PConfig::get(local_user(),'startpage','startpage');
+	$page = get_pconfig(local_user(),'startpage','startpage');
 	if(strlen($page)) {
 		$slash = ((strpos($page,'/') === 0) ? true : false);
 		if(stristr($page,'://'))
@@ -51,7 +50,7 @@ function startpage_settings_post($a,$post) {
 	if(! local_user())
 		return;
 	if($_POST['startpage-submit'])
-		PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
+		set_pconfig(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
 }
 
 
@@ -75,7 +74,7 @@ function startpage_settings(&$a,&$s) {
 
 	/* Get the current state of our config variable */
 
-	$page = PConfig::get(local_user(),'startpage','startpage');
+	$page = get_pconfig(local_user(),'startpage','startpage');
 
 
 	/* Add some HTML to the existing form */
diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php
index f7158a40..a004a624 100644
--- a/statusnet/statusnet.php
+++ b/statusnet/statusnet.php
@@ -47,9 +47,6 @@ require_once('library/twitteroauth.php');
 require_once('include/enotify.php');
 require_once("include/socgraph.php");
 
-use Friendica\Core\Config;
-use Friendica\Core\PConfig;
-
 class StatusNetOAuth extends TwitterOAuth {
     function get_maxlength() {
 	$config = $this->get($this->host . 'statusnet/config.json');
@@ -74,11 +71,11 @@ class StatusNetOAuth extends TwitterOAuth {
     $this->http_info = array();
     $ci = curl_init();
     /* Curl settings */
-    $prx = Config::get('system','proxy');
+    $prx = get_config('system','proxy');
     if(strlen($prx)) {
 	curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1);
 	curl_setopt($ci, CURLOPT_PROXY, $prx);
-	$prxusr = Config::get('system','proxyuser');
+	$prxusr = get_config('system','proxyuser');
 	if(strlen($prxusr))
 	    curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr);
     }
@@ -147,16 +144,16 @@ function statusnet_uninstall() {
 }
 
 function statusnet_check_item_notification($a, &$notification_data) {
-	$notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url');
+	$notification_data["profiles"][] = get_pconfig($notification_data["uid"], 'statusnet', 'own_url');
 }
 
 function statusnet_jot_nets(&$a,&$b) {
 	if(! local_user())
 		return;
 
-	$statusnet_post = PConfig::get(local_user(),'statusnet','post');
+	$statusnet_post = get_pconfig(local_user(),'statusnet','post');
 	if(intval($statusnet_post) == 1) {
-		$statusnet_defpost = PConfig::get(local_user(),'statusnet','post_by_default');
+		$statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default');
 		$selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : '');
 		$b .= '
' . t('Post to GNU Social') . '
'; @@ -193,16 +190,16 @@ function statusnet_settings_post ($a,$post) { * use them. All the data are available in the global config. * Check the API Url never the less and blame the admin if it's not working ^^ */ - $globalsn = Config::get('statusnet', 'sites'); + $globalsn = get_config('statusnet', 'sites'); foreach ( $globalsn as $asn) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl'] ) { $apibase = $asn['apiurl']; $c = fetch_url( $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'] ); + set_pconfig(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey'] ); + set_pconfig(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret'] ); + set_pconfig(local_user(), 'statusnet', 'baseapi', $asn['apiurl'] ); + //set_pconfig(local_user(), 'statusnet', 'application_name', $asn['applicationname'] ); } else { notice( t('Please contact your site administrator.
The provided API URL is not valid.').EOL.$asn['apiurl'].EOL ); } @@ -218,19 +215,19 @@ function statusnet_settings_post ($a,$post) { $c = fetch_url( $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'] ); + set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); + set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']); + set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase ); + //set_pconfig(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] ); } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; $c = fetch_url( $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 ); + set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); + set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']); + set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase ); } else { // still not the correct API base, let's do noting notice( t('We could not contact the GNU Social API with the Path you entered.').EOL ); @@ -240,29 +237,29 @@ function statusnet_settings_post ($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 = get_pconfig(local_user(), 'statusnet', 'baseapi'); + $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' ); + $csecret = get_pconfig(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); + set_pconfig(local_user(),'statusnet', 'oauthtoken', $token['oauth_token']); + set_pconfig(local_user(),'statusnet', 'oauthsecret', $token['oauth_token_secret']); + set_pconfig(local_user(),'statusnet', 'post', 1); + set_pconfig(local_user(),'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 goaway($a->get_baseurl().'/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'])); + set_pconfig(local_user(),'statusnet','post',intval($_POST['statusnet-enable'])); + set_pconfig(local_user(),'statusnet','post_by_default',intval($_POST['statusnet-default'])); + set_pconfig(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror'])); + set_pconfig(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import'])); + set_pconfig(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user'])); if (!intval($_POST['statusnet-mirror'])) del_pconfig(local_user(),'statusnet','lastid'); @@ -280,23 +277,23 @@ function statusnet_settings(&$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 = get_pconfig(local_user(), 'statusnet', 'baseapi'); + $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey'); + $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret'); + $otoken = get_pconfig(local_user(), 'statusnet', 'oauthtoken'); + $osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret'); + $enabled = get_pconfig(local_user(), 'statusnet', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $defenabled = PConfig::get(local_user(),'statusnet','post_by_default'); + $defenabled = get_pconfig(local_user(),'statusnet','post_by_default'); $defchecked = (($defenabled) ? ' checked="checked" ' : ''); - $mirrorenabled = PConfig::get(local_user(),'statusnet','mirror_posts'); + $mirrorenabled = get_pconfig(local_user(),'statusnet','mirror_posts'); $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : ''); - $import = PConfig::get(local_user(),'statusnet','import'); + $import = get_pconfig(local_user(),'statusnet','import'); $importselected = array("", "", ""); $importselected[$import] = ' selected="selected"'; - //$importenabled = PConfig::get(local_user(),'statusnet','import'); + //$importenabled = get_pconfig(local_user(),'statusnet','import'); //$importchecked = (($importenabled) ? ' checked="checked" ' : ''); - $create_userenabled = PConfig::get(local_user(),'statusnet','create_user'); + $create_userenabled = get_pconfig(local_user(),'statusnet','create_user'); $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); @@ -313,7 +310,7 @@ function statusnet_settings(&$a,&$s) { /*** * no consumer keys */ - $globalsn = Config::get('statusnet', 'sites'); + $globalsn = get_config('statusnet', 'sites'); /*** * lets check if we have one or more globally configured GNU Social * server OAuth credentials in the configuration. If so offer them @@ -440,11 +437,11 @@ function statusnet_post_local(&$a, &$b) { return; } - $statusnet_post = PConfig::get(local_user(),'statusnet','post'); + $statusnet_post = get_pconfig(local_user(),'statusnet','post'); $statusnet_enable = (($statusnet_post && x($_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(get_pconfig(local_user(),'statusnet','post_by_default'))) { $statusnet_enable = 1; } @@ -460,11 +457,11 @@ function statusnet_post_local(&$a, &$b) { } function statusnet_action($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 = get_pconfig($uid, 'statusnet', 'baseapi'); + $ckey = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); $connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret); @@ -490,12 +487,12 @@ function statusnet_post_hook(&$a,&$b) { * Post to GNU Social */ - if (!PConfig::get($b["uid"],'statusnet','import')) { + if (!get_pconfig($b["uid"],'statusnet','import')) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; } - $api = PConfig::get($b["uid"], 'statusnet', 'baseapi'); + $api = get_pconfig($b["uid"], 'statusnet', 'baseapi'); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); if($b['parent'] != $b['id']) { @@ -567,13 +564,13 @@ function statusnet_post_hook(&$a,&$b) { logger('GNU Socialpost invoked'); - PConfig::load($b['uid'], 'statusnet'); + load_pconfig($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 = get_pconfig($b['uid'], 'statusnet', 'baseapi'); + $ckey = get_pconfig($b['uid'], 'statusnet', 'consumerkey'); + $csecret = get_pconfig($b['uid'], 'statusnet', 'consumersecret'); + $otoken = get_pconfig($b['uid'], 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($b['uid'], 'statusnet', 'oauthsecret'); if($ckey && $csecret && $otoken && $osecret) { @@ -585,7 +582,7 @@ function statusnet_post_hook(&$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); + set_pconfig($b['uid'], 'statusnet', 'max_char', $max_char); $tempfile = ""; require_once("include/plaintext.php"); @@ -635,7 +632,7 @@ function statusnet_post_hook(&$a,&$b) { "\nmessage: ".$msg, LOGGER_DEBUG."\nOriginal post: ".print_r($b, true)."\nPost Data: ".print_r($postdata, true)); if ($result->source) - PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source)); + set_pconfig($b["uid"], "statusnet", "application_name", strip_tags($result->source)); if ($result->error) { logger('Send to GNU Social failed: "'.$result->error.'"'); @@ -681,13 +678,13 @@ function statusnet_plugin_admin_post(&$a){ } } - $sites = Config::set('statusnet','sites', $sites); + $sites = set_config('statusnet','sites', $sites); } function statusnet_plugin_admin(&$a, &$o){ - $sites = Config::get('statusnet','sites'); + $sites = get_config('statusnet','sites'); $sitesform=array(); if (is_array($sites)){ foreach($sites as $id=>$s){ @@ -723,7 +720,7 @@ function statusnet_prepare_body(&$a,&$b) { return; if ($b["preview"]) { - $max_char = PConfig::get(local_user(),'statusnet','max_char'); + $max_char = get_pconfig(local_user(),'statusnet','max_char'); if (intval($max_char) == 0) $max_char = 140; @@ -766,9 +763,9 @@ function statusnet_prepare_body(&$a,&$b) { } function statusnet_cron($a,$b) { - $last = Config::get('statusnet','last_poll'); + $last = get_config('statusnet','last_poll'); - $poll_interval = intval(Config::get('statusnet','poll_interval')); + $poll_interval = intval(get_config('statusnet','poll_interval')); if(! $poll_interval) $poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL; @@ -789,7 +786,7 @@ function statusnet_cron($a,$b) { } } - $abandon_days = intval(Config::get('system','account_abandon_days')); + $abandon_days = intval(get_config('system','account_abandon_days')); if ($abandon_days < 1) $abandon_days = 0; @@ -813,16 +810,16 @@ function statusnet_cron($a,$b) { logger('statusnet: cron_end'); - Config::set('statusnet','last_poll', time()); + set_config('statusnet','last_poll', time()); } function statusnet_fetchtimeline($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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); + $lastid = get_pconfig($uid, 'statusnet', 'lastid'); require_once('mod/item.php'); require_once('include/items.php'); @@ -830,9 +827,9 @@ function statusnet_fetchtimeline($a, $uid) { // 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 = get_pconfig( $uid, 'statusnet', 'application_name'); if ($application_name == "") - $application_name = Config::get('statusnet', 'application_name'); + $application_name = get_config('statusnet', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); @@ -911,7 +908,7 @@ function statusnet_fetchtimeline($a, $uid) { } } } - PConfig::set($uid, 'statusnet', 'lastid', $lastid); + set_pconfig($uid, 'statusnet', 'lastid', $lastid); } function statusnet_address($contact) { @@ -1057,11 +1054,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user) { } function statusnet_fetchuser($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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); require_once("addon/statusnet/codebird.php"); @@ -1102,7 +1099,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi logger("statusnet_createpost: start", LOGGER_DEBUG); - $api = PConfig::get($uid, 'statusnet', 'baseapi'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); $postarray = array(); @@ -1160,7 +1157,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi } // Is it me? - $own_url = PConfig::get($uid, 'statusnet', 'own_url'); + $own_url = get_pconfig($uid, 'statusnet', 'own_url'); if ($content->user->id == $own_url) { $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", @@ -1202,7 +1199,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi $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/", get_pconfig($uid, 'statusnet', 'baseapi')); $postarray['plink'] = $hostname.$content->id; $postarray['app'] = strip_tags($content->source); @@ -1321,12 +1318,12 @@ function statusnet_checknotification($a, $uid, $own_url, $top_item, $postarray) function statusnet_fetchhometimeline($a, $uid, $mode = 1) { $conversations = array(); - $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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); + $create_user = get_pconfig($uid, 'statusnet', 'create_user'); // "create_user" is deactivated, since currently you cannot add users manually by now $create_user = true; @@ -1373,7 +1370,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) { if ($mode == 1) { // Fetching timeline - $lastid = PConfig::get($uid, 'statusnet', 'lasthometimelineid'); + $lastid = get_pconfig($uid, 'statusnet', 'lasthometimelineid'); //$lastid = 1; $first_time = ($lastid == ""); @@ -1432,11 +1429,11 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) { } } - PConfig::set($uid, 'statusnet', 'lasthometimelineid', $lastid); + set_pconfig($uid, 'statusnet', 'lasthometimelineid', $lastid); } // Fetching mentions - $lastid = PConfig::get($uid, 'statusnet', 'lastmentionid'); + $lastid = get_pconfig($uid, 'statusnet', 'lastmentionid'); $first_time = ($lastid == ""); if ($lastid <> "") @@ -1513,16 +1510,16 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) { } } - PConfig::set($uid, 'statusnet', 'lastmentionid', $lastid); + set_pconfig($uid, 'statusnet', 'lastmentionid', $lastid); } function statusnet_complete_conversation($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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); + $own_url = get_pconfig($uid, 'statusnet', 'own_url'); require_once('library/twitteroauth.php'); @@ -1660,12 +1657,12 @@ function statusnet_convertmsg($a, $body, $no_tags = false) { } function statusnet_fetch_own_contact($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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); + $own_url = get_pconfig($uid, 'statusnet', 'own_url'); $contact_id = 0; @@ -1677,7 +1674,7 @@ function statusnet_fetch_own_contact($a, $uid) { // Fetching user data $user = $connection->get('account/verify_credentials'); - PConfig::set($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url)); + set_pconfig($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url)); $contact_id = statusnet_fetch_contact($uid, $user, true); @@ -1719,11 +1716,11 @@ function statusnet_is_retweet($a, $uid, $body) { if ($matches[1] != "") $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 = get_pconfig($uid, 'statusnet', 'consumerkey'); + $csecret = get_pconfig($uid, 'statusnet', 'consumersecret'); + $api = get_pconfig($uid, 'statusnet', 'baseapi'); + $otoken = get_pconfig($uid, 'statusnet', 'oauthtoken'); + $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); $id = preg_replace("=https?://".$hostname."/notice/(.*)=ism", "$1", $link); diff --git a/superblock/superblock.php b/superblock/superblock.php index c33c699d..c86c6aad 100755 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -9,8 +9,6 @@ * */ -use Friendica\Core\PConfig; - function superblock_install() { register_hook('plugin_settings', 'addon/superblock/superblock.php', 'superblock_addon_settings'); @@ -46,7 +44,7 @@ function superblock_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $words = PConfig::get(local_user(),'system','blocked'); + $words = get_pconfig(local_user(),'system','blocked'); if(! $words) { $words = ''; } @@ -74,14 +72,14 @@ function superblock_addon_settings_post(&$a,&$b) { return; if($_POST['superblock-submit']) { - PConfig::set(local_user(),'system','blocked',trim($_POST['superblock-words'])); + set_pconfig(local_user(),'system','blocked',trim($_POST['superblock-words'])); info( t('SUPERBLOCK Settings saved.') . EOL); } } function superblock_enotify_store(&$a,&$b) { - $words = PConfig::get($b['uid'],'system','blocked'); + $words = get_pconfig($b['uid'],'system','blocked'); if($words) { $arr = explode(',',$words); } @@ -113,7 +111,7 @@ function superblock_conversation_start(&$a,&$b) { if(! local_user()) return; - $words = PConfig::get(local_user(),'system','blocked'); + $words = get_pconfig(local_user(),'system','blocked'); if($words) { $a->data['superblock'] = explode(',',$words); } @@ -158,7 +156,7 @@ function superblock_init(&$a) { if(! local_user()) return; - $words = PConfig::get(local_user(),'system','blocked'); + $words = get_pconfig(local_user(),'system','blocked'); if(array_key_exists('block',$_GET) && $_GET['block']) { if(strlen($words)) @@ -166,7 +164,7 @@ function superblock_init(&$a) { $words .= trim($_GET['block']); } - PConfig::set(local_user(),'system','blocked',$words); + set_pconfig(local_user(),'system','blocked',$words); info( t('superblock settings updated') . EOL ); killme(); } diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index fc53bab8..9bbeb1d8 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -7,7 +7,7 @@ * Author: Mike Macgirvin */ -use Friendica\Core\Config; + function testdrive_install() { @@ -37,7 +37,7 @@ function testdrive_register_account($a,$b) { $uid = $b; - $days = Config::get('testdrive','expiredays'); + $days = get_config('testdrive','expiredays'); if(! $days) return; @@ -91,7 +91,7 @@ function testdrive_enotify(&$a, &$b) { if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM && x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') { $b['itemlink'] = $a->get_baseurl(); - $b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('system','sitename')); + $b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), get_config('system','sitename')); $b['subject'] = t('Your Friendica test account is about to expire.'); $b['body'] = sprintf( t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com."), $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server()); } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 0a22d143..50530401 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -11,9 +11,6 @@ require_once('library/OAuth1.php'); require_once('addon/tumblr/tumblroauth/tumblroauth.php'); -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function tumblr_install() { register_hook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local'); register_hook('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send'); @@ -63,16 +60,16 @@ function tumblr_plugin_admin(&$a, &$o){ $o = replace_macros($t, array( '$submit' => t('Save Settings'), // name, label, value, help, [extra values] - '$consumer_key' => array('consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''), - '$consumer_secret' => array('consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''), + '$consumer_key' => array('consumer_key', t('Consumer Key'), get_config('tumblr', 'consumer_key' ), ''), + '$consumer_secret' => array('consumer_secret', t('Consumer Secret'), get_config('tumblr', 'consumer_secret' ), ''), )); } function tumblr_plugin_admin_post(&$a){ $consumer_key = ((x($_POST,'consumer_key')) ? notags(trim($_POST['consumer_key'])) : ''); $consumer_secret = ((x($_POST,'consumer_secret')) ? notags(trim($_POST['consumer_secret'])): ''); - Config::set('tumblr','consumer_key',$consumer_key); - Config::set('tumblr','consumer_secret',$consumer_secret); + set_config('tumblr','consumer_key',$consumer_key); + set_config('tumblr','consumer_secret',$consumer_secret); info( t('Settings updated.'). EOL ); } @@ -84,8 +81,8 @@ function tumblr_connect($a) { //require_once('addon/tumblr/tumblroauth/tumblroauth.php'); // Define the needed keys - $consumer_key = Config::get('tumblr','consumer_key'); - $consumer_secret = Config::get('tumblr','consumer_secret'); + $consumer_key = get_config('tumblr','consumer_key'); + $consumer_secret = get_config('tumblr','consumer_secret'); // The callback URL is the script that gets called after the user authenticates with tumblr // In this example, it would be the included callback.php @@ -134,8 +131,8 @@ function tumblr_callback($a) { //require_once('addon/tumblr/tumblroauth/tumblroauth.php'); // Define the needed keys - $consumer_key = Config::get('tumblr','consumer_key'); - $consumer_secret = Config::get('tumblr','consumer_secret'); + $consumer_key = get_config('tumblr','consumer_key'); + $consumer_secret = get_config('tumblr','consumer_secret'); // Once the user approves your app at Tumblr, they are sent back to this script. // This script is passed two parameters in the URL, oauth_token (our Request Token) @@ -161,8 +158,8 @@ function tumblr_callback($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']); + set_pconfig(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']); + set_pconfig(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']); $o = t("You are now authenticated to tumblr."); $o .= '
'.t("return to the connector page").''; @@ -173,9 +170,9 @@ function tumblr_jot_nets(&$a,&$b) { if(! local_user()) return; - $tmbl_post = PConfig::get(local_user(),'tumblr','post'); + $tmbl_post = get_pconfig(local_user(),'tumblr','post'); if(intval($tmbl_post) == 1) { - $tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default'); + $tmbl_defpost = get_pconfig(local_user(),'tumblr','post_by_default'); $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Tumblr') . '
'; @@ -194,11 +191,11 @@ function tumblr_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'tumblr','post'); + $enabled = get_pconfig(local_user(),'tumblr','post'); $checked = (($enabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); - $def_enabled = PConfig::get(local_user(),'tumblr','post_by_default'); + $def_enabled = get_pconfig(local_user(),'tumblr','post_by_default'); $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); @@ -226,15 +223,15 @@ function tumblr_settings(&$a,&$s) { $s .= ''; $s .= '
'; - $oauth_token = PConfig::get(local_user(), "tumblr", "oauth_token"); - $oauth_token_secret = PConfig::get(local_user(), "tumblr", "oauth_token_secret"); + $oauth_token = get_pconfig(local_user(), "tumblr", "oauth_token"); + $oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret"); $s .= '
'; if (($oauth_token != "") && ($oauth_token_secret != "")) { - $page = PConfig::get(local_user(),'tumblr','page'); - $consumer_key = Config::get('tumblr','consumer_key'); - $consumer_secret = Config::get('tumblr','consumer_secret'); + $page = get_pconfig(local_user(),'tumblr','page'); + $consumer_key = get_config('tumblr','consumer_key'); + $consumer_secret = get_config('tumblr','consumer_secret'); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); @@ -268,9 +265,9 @@ function tumblr_settings_post(&$a,&$b) { if(x($_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'])); + set_pconfig(local_user(),'tumblr','post',intval($_POST['tumblr'])); + set_pconfig(local_user(),'tumblr','page',$_POST['tumblr_page']); + set_pconfig(local_user(),'tumblr','post_by_default',intval($_POST['tumblr_bydefault'])); } @@ -292,11 +289,11 @@ function tumblr_post_local(&$a, &$b) { return; } - $tmbl_post = intval(PConfig::get(local_user(),'tumblr','post')); + $tmbl_post = intval(get_pconfig(local_user(),'tumblr','post')); $tmbl_enable = (($tmbl_post && x($_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(get_pconfig(local_user(),'tumblr','post_by_default'))) { $tmbl_enable = 1; } @@ -325,9 +322,9 @@ function tumblr_send(&$a,&$b) { if($b['parent'] != $b['id']) 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 = get_pconfig($b['uid'], "tumblr", "oauth_token"); + $oauth_token_secret = get_pconfig($b['uid'], "tumblr", "oauth_token_secret"); + $page = get_pconfig($b['uid'], "tumblr", "page"); $tmbl_blog = 'blog/'.$page.'/post'; if($oauth_token && $oauth_token_secret && $tmbl_blog) { @@ -408,8 +405,8 @@ function tumblr_send(&$a,&$b) { if (trim($params['caption']) == "") $params['caption'] = bbcode("[quote]".$siteinfo["description"]."[/quote]", false, false, 4); - $consumer_key = Config::get('tumblr','consumer_key'); - $consumer_secret = Config::get('tumblr','consumer_secret'); + $consumer_key = get_config('tumblr','consumer_key'); + $consumer_secret = get_config('tumblr','consumer_secret'); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); diff --git a/twitter/twitter.php b/twitter/twitter.php index 31d3f4db..1fdcb89c 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -63,9 +63,6 @@ require_once('include/enotify.php'); require_once("include/socgraph.php"); -use Friendica\Core\Config; -use Friendica\Core\PConfig; - define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes function twitter_install() { @@ -106,7 +103,7 @@ function twitter_uninstall() { } function twitter_check_item_notification($a, &$notification_data) { - $own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id'); + $own_id = get_pconfig($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"]), @@ -130,10 +127,10 @@ function twitter_follow($a, &$contact) { $uid = $a->user["uid"]; - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); - $otoken = PConfig::get($uid, 'twitter', 'oauthtoken'); - $osecret = PConfig::get($uid, 'twitter', 'oauthsecret'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); require_once("addon/twitter/codebird.php"); @@ -160,9 +157,9 @@ function twitter_jot_nets(&$a,&$b) { if(! local_user()) return; - $tw_post = PConfig::get(local_user(),'twitter','post'); + $tw_post = get_pconfig(local_user(),'twitter','post'); if(intval($tw_post) == 1) { - $tw_defpost = PConfig::get(local_user(),'twitter','post_by_default'); + $tw_defpost = get_pconfig(local_user(),'twitter','post_by_default'); $selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Twitter') . '
'; @@ -181,46 +178,46 @@ function twitter_settings_post ($a,$post) { * 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'); + del_pconfig(local_user(), 'twitter', 'consumerkey'); + del_pconfig(local_user(), 'twitter', 'consumersecret'); + del_pconfig(local_user(), 'twitter', 'oauthtoken'); + del_pconfig(local_user(), 'twitter', 'oauthsecret'); + del_pconfig(local_user(), 'twitter', 'post'); + del_pconfig(local_user(), 'twitter', 'post_by_default'); + del_pconfig(local_user(), 'twitter', 'lastid'); + del_pconfig(local_user(), 'twitter', 'mirror_posts'); + del_pconfig(local_user(), 'twitter', 'import'); + del_pconfig(local_user(), 'twitter', 'create_user'); + del_pconfig(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 logger('got a Twitter PIN'); require_once('library/twitteroauth.php'); - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', '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 Twitter using these token // and secret to request a Access Token with the PIN $connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']); $token = $connection->getAccessToken( $_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); + set_pconfig(local_user(),'twitter', 'oauthtoken', $token['oauth_token']); + set_pconfig(local_user(),'twitter', 'oauthsecret', $token['oauth_token_secret']); + set_pconfig(local_user(),'twitter', 'post', 1); // reload the Addon Settings page, if we don't do it see Bug #42 goaway($a->get_baseurl().'/settings/connectors'); } 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'])); + set_pconfig(local_user(),'twitter','post',intval($_POST['twitter-enable'])); + set_pconfig(local_user(),'twitter','post_by_default',intval($_POST['twitter-default'])); + set_pconfig(local_user(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror'])); + set_pconfig(local_user(), 'twitter', 'import', intval($_POST['twitter-import'])); + set_pconfig(local_user(), 'twitter', 'create_user', intval($_POST['twitter-create_user'])); if (!intval($_POST['twitter-mirror'])) - PConfig::delete(local_user(),'twitter','lastid'); + del_pconfig(local_user(),'twitter','lastid'); info(t('Twitter settings updated.') . EOL); }} @@ -232,21 +229,21 @@ function twitter_settings(&$a,&$s) { /*** * 1) Check that we have global consumer key & secret * 2) If no OAuthtoken & stuff is present, generate button to get some - * 3) Checkbox for "Send public notices (280 chars only) + * 3) Checkbox for "Send public notices (140 chars only) */ - $ckey = Config::get('twitter', 'consumerkey' ); - $csecret = Config::get('twitter', 'consumersecret' ); - $otoken = PConfig::get(local_user(), 'twitter', 'oauthtoken' ); - $osecret = PConfig::get(local_user(), 'twitter', 'oauthsecret' ); - $enabled = PConfig::get(local_user(), 'twitter', 'post'); + $ckey = get_config('twitter', 'consumerkey' ); + $csecret = get_config('twitter', 'consumersecret' ); + $otoken = get_pconfig(local_user(), 'twitter', 'oauthtoken' ); + $osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' ); + $enabled = get_pconfig(local_user(), 'twitter', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $defenabled = PConfig::get(local_user(),'twitter','post_by_default'); + $defenabled = get_pconfig(local_user(),'twitter','post_by_default'); $defchecked = (($defenabled) ? ' checked="checked" ' : ''); - $mirrorenabled = PConfig::get(local_user(),'twitter','mirror_posts'); + $mirrorenabled = get_pconfig(local_user(),'twitter','mirror_posts'); $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : ''); - $importenabled = PConfig::get(local_user(),'twitter','import'); + $importenabled = get_pconfig(local_user(),'twitter','import'); $importchecked = (($importenabled) ? ' checked="checked" ' : ''); - $create_userenabled = PConfig::get(local_user(),'twitter','create_user'); + $create_userenabled = get_pconfig(local_user(),'twitter','create_user'); $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : ''); $css = (($enabled) ? '' : '-disabled'); @@ -347,11 +344,11 @@ function twitter_post_local(&$a, &$b) { return; } - $twitter_post = intval(PConfig::get(local_user(), 'twitter', 'post')); + $twitter_post = intval(get_pconfig(local_user(), 'twitter', 'post')); $twitter_enable = (($twitter_post && x($_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(get_pconfig(local_user(), 'twitter', 'post_by_default'))) { $twitter_enable = 1; } @@ -368,10 +365,10 @@ function twitter_post_local(&$a, &$b) { function twitter_action($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'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); require_once("addon/twitter/codebird.php"); @@ -405,7 +402,7 @@ function twitter_post_hook(&$a,&$b) { require_once("include/network.php"); - if (!PConfig::get($b["uid"],'twitter','import')) { + if (!get_pconfig($b["uid"],'twitter','import')) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; } @@ -473,12 +470,12 @@ function twitter_post_hook(&$a,&$b) { logger('twitter post invoked'); - PConfig::load($b['uid'], 'twitter'); + load_pconfig($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'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($b['uid'], 'twitter', 'oauthtoken'); + $osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret'); if($ckey && $csecret && $otoken && $osecret) { logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG); @@ -491,7 +488,7 @@ function twitter_post_hook(&$a,&$b) { require_once('include/bbcode.php'); $tweet = new TwitterOAuth($ckey,$csecret,$otoken,$osecret); - $max_char = 280; + $max_char = 140; require_once("include/plaintext.php"); $msgarr = plaintext($a, $b, $max_char, true, 8); $msg = $msgarr["text"]; @@ -535,7 +532,7 @@ function twitter_post_hook(&$a,&$b) { logger('twitter_post_with_media send, result: ' . print_r($result, true), LOGGER_DEBUG); if ($result->source) - Config::set("twitter", "application_name", strip_tags($result->source)); + set_config("twitter", "application_name", strip_tags($result->source)); if ($result->errors || $result->error) { logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); @@ -576,7 +573,7 @@ function twitter_post_hook(&$a,&$b) { logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG); if ($result->source) - Config::set("twitter", "application_name", strip_tags($result->source)); + set_config("twitter", "application_name", strip_tags($result->source)); if ($result->errors) { logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); @@ -609,9 +606,9 @@ function twitter_plugin_admin_post(&$a){ $consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : ''); $consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): ''); $applicationname = ((x($_POST, 'applicationname')) ? notags(trim($_POST['applicationname'])):''); - Config::set('twitter','consumerkey',$consumerkey); - Config::set('twitter','consumersecret',$consumersecret); - //Config::set('twitter','application_name',$applicationname); + set_config('twitter','consumerkey',$consumerkey); + set_config('twitter','consumersecret',$consumersecret); + //set_config('twitter','application_name',$applicationname); info( t('Settings updated.'). EOL ); } function twitter_plugin_admin(&$a, &$o){ @@ -620,16 +617,16 @@ function twitter_plugin_admin(&$a, &$o){ $o = replace_macros($t, array( '$submit' => t('Save Settings'), // name, label, value, help, [extra values] - '$consumerkey' => array('consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey' ), ''), - '$consumersecret' => array('consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret' ), ''), - //'$applicationname' => array('applicationname', t('Name of the Twitter Application'), Config::get('twitter','application_name'),t('Set this to the exact name you gave the app on twitter.com/apps to avoid mirroring postings from ~friendica back to ~friendica')) + '$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''), + '$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), ''), + //'$applicationname' => array('applicationname', t('Name of the Twitter Application'), get_config('twitter','application_name'),t('Set this to the exact name you gave the app on twitter.com/apps to avoid mirroring postings from ~friendica back to ~friendica')) )); } function twitter_cron($a,$b) { - $last = Config::get('twitter','last_poll'); + $last = get_config('twitter','last_poll'); - $poll_interval = intval(Config::get('twitter','poll_interval')); + $poll_interval = intval(get_config('twitter','poll_interval')); if(! $poll_interval) $poll_interval = TWITTER_DEFAULT_POLL_INTERVAL; @@ -650,7 +647,7 @@ function twitter_cron($a,$b) { } } - $abandon_days = intval(Config::get('system','account_abandon_days')); + $abandon_days = intval(get_config('system','account_abandon_days')); if ($abandon_days < 1) $abandon_days = 0; @@ -672,7 +669,7 @@ function twitter_cron($a,$b) { /* // To-Do // check for new contacts once a day - $last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check'); + $last_contact_check = get_pconfig($rr['uid'],'pumpio','contact_check'); if($last_contact_check) $next_contact_check = $last_contact_check + 86400; else @@ -680,7 +677,7 @@ function twitter_cron($a,$b) { if($next_contact_check <= time()) { pumpio_getallusers($a, $rr["uid"]); - PConfig::set($rr['uid'],'pumpio','contact_check',time()); + set_pconfig($rr['uid'],'pumpio','contact_check',time()); } */ @@ -689,12 +686,12 @@ function twitter_cron($a,$b) { logger('twitter: cron_end'); - Config::set('twitter','last_poll', time()); + set_config('twitter','last_poll', time()); } function twitter_expire($a,$b) { - $days = Config::get('twitter', 'expire'); + $days = get_config('twitter', 'expire'); if ($days == 0) return; @@ -729,7 +726,7 @@ function twitter_prepare_body(&$a,&$b) { return; if ($b["preview"]) { - $max_char = 280; + $max_char = 140; require_once("include/plaintext.php"); $item = $b["item"]; $item["plink"] = $a->get_baseurl()."/display/".$a->user["nickname"]."/".$item["parent"]; @@ -810,13 +807,13 @@ function twitter_do_mirrorpost($a, $uid, $post) { } function twitter_fetchtimeline($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'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); + $lastid = get_pconfig($uid, 'twitter', 'lastid'); - $application_name = Config::get('twitter', 'application_name'); + $application_name = get_config('twitter', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); @@ -848,7 +845,7 @@ function twitter_fetchtimeline($a, $uid) { foreach ($posts as $post) { if ($post->id_str > $lastid) { $lastid = $post->id_str; - PConfig::set($uid, 'twitter', 'lastid', $lastid); + set_pconfig($uid, 'twitter', 'lastid', $lastid); } if ($first_time) @@ -867,7 +864,7 @@ function twitter_fetchtimeline($a, $uid) { } } } - PConfig::set($uid, 'twitter', 'lastid', $lastid); + set_pconfig($uid, 'twitter', 'lastid', $lastid); } function twitter_queue_hook(&$a,&$b) { @@ -895,10 +892,10 @@ function twitter_queue_hook(&$a,&$b) { $user = $r[0]; - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); - $otoken = PConfig::get($user['uid'], 'twitter', 'oauthtoken'); - $osecret = PConfig::get($user['uid'], 'twitter', 'oauthsecret'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($user['uid'], 'twitter', 'oauthtoken'); + $osecret = get_pconfig($user['uid'], 'twitter', 'oauthsecret'); $success = false; @@ -1090,10 +1087,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) { } function twitter_fetchuser($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'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); require_once("addon/twitter/codebird.php"); @@ -1396,7 +1393,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing } // Is it me? - $own_id = PConfig::get($uid, 'twitter', 'own_id'); + $own_id = get_pconfig($uid, 'twitter', 'own_id'); if ($post->user->id_str == $own_id) { $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", @@ -1627,16 +1624,16 @@ function twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id) } function twitter_fetchhometimeline($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'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); + $create_user = get_pconfig($uid, 'twitter', 'create_user'); + $mirror_posts = get_pconfig($uid, 'twitter', 'mirror_posts'); logger("twitter_fetchhometimeline: Fetching for user ".$uid, LOGGER_DEBUG); - $application_name = Config::get('twitter', 'application_name'); + $application_name = get_config('twitter', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); @@ -1681,7 +1678,7 @@ function twitter_fetchhometimeline($a, $uid) { // Fetching timeline - $lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid'); + $lastid = get_pconfig($uid, 'twitter', 'lasthometimelineid'); $first_time = ($lastid == ""); @@ -1703,7 +1700,7 @@ function twitter_fetchhometimeline($a, $uid) { foreach ($posts as $post) { if ($post->id_str > $lastid) { $lastid = $post->id_str; - PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid); + set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid); } if ($first_time) @@ -1737,10 +1734,10 @@ function twitter_fetchhometimeline($a, $uid) { } } - PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid); + set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid); // Fetching mentions - $lastid = PConfig::get($uid, 'twitter', 'lastmentionid'); + $lastid = get_pconfig($uid, 'twitter', 'lastmentionid'); $first_time = ($lastid == ""); @@ -1819,16 +1816,16 @@ function twitter_fetchhometimeline($a, $uid) { } } - PConfig::set($uid, 'twitter', 'lastmentionid', $lastid); + set_pconfig($uid, 'twitter', 'lastmentionid', $lastid); } function twitter_fetch_own_contact($a, $uid) { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); - $otoken = PConfig::get($uid, 'twitter', 'oauthtoken'); - $osecret = PConfig::get($uid, 'twitter', 'oauthsecret'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); - $own_id = PConfig::get($uid, 'twitter', 'own_id'); + $own_id = get_pconfig($uid, 'twitter', 'own_id'); $contact_id = 0; @@ -1840,7 +1837,7 @@ function twitter_fetch_own_contact($a, $uid) { // Fetching user data $user = $connection->get('account/verify_credentials'); - PConfig::set($uid, 'twitter', 'own_id', $user->id_str); + set_pconfig($uid, 'twitter', 'own_id', $user->id_str); $contact_id = twitter_fetch_contact($uid, $user, true); @@ -1850,7 +1847,7 @@ function twitter_fetch_own_contact($a, $uid) { if(count($r)) $contact_id = $r[0]["id"]; else - PConfig::delete($uid, 'twitter', 'own_id'); + del_pconfig($uid, 'twitter', 'own_id'); } @@ -1889,10 +1886,10 @@ function twitter_is_retweet($a, $uid, $body) { logger('twitter_is_retweet: Retweeting id '.$id.' for user '.$uid, LOGGER_DEBUG); - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); - $otoken = PConfig::get($uid, 'twitter', 'oauthtoken'); - $osecret = PConfig::get($uid, 'twitter', 'oauthsecret'); + $ckey = get_config('twitter', 'consumerkey'); + $csecret = get_config('twitter', 'consumersecret'); + $otoken = get_pconfig($uid, 'twitter', 'oauthtoken'); + $osecret = get_pconfig($uid, 'twitter', 'oauthsecret'); require_once('library/twitteroauth.php'); $connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret); diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 4ea17f47..8b3a243e 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -7,8 +7,6 @@ * Author: Tobias Diekershoff */ -use Friendica\Core\Config; - function webrtc_install() { register_hook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu'); } @@ -26,12 +24,12 @@ function webrtc_plugin_admin (&$a, &$o) { $t = get_markup_template( "admin.tpl", "addon/webrtc/" ); $o = replace_macros( $t, array( '$submit' => t('Save Settings'), - '$webrtcurl' => array('webrtcurl', t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')), + '$webrtcurl' => array('webrtcurl', t('WebRTC Base URL'), get_config('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')), )); } function webrtc_plugin_admin_post (&$a) { $url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : ''); - Config::set('webrtc', 'webrtcurl', $url); + set_config('webrtc', 'webrtcurl', $url); info( t('Settings updated.'). EOL); } @@ -43,7 +41,7 @@ function webrtc_content(&$a) { $o = ''; /* landingpage to create chatrooms */ - $webrtcurl = Config::get('webrtc','webrtcurl'); + $webrtcurl = get_config('webrtc','webrtcurl'); /* embedd the landing page in an iframe */ $o .= '

'.t('Video Chat').'

'; diff --git a/widgets/widgets.php b/widgets/widgets.php index e6293244..72534ce3 100755 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -5,9 +5,8 @@ * Version: 1.0 * Author: Fabio Comuni */ - -use Friendica\Core\PConfig; - + + function widgets_install() { register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings'); register_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post'); @@ -33,8 +32,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 = get_pconfig(local_user(), 'widgets', 'key' ); + if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); } $widgets = array(); $d = dir(dirname(__file__)); diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 53bf83b8..21f986e0 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -25,7 +25,6 @@ * count only unseen elements which are not type=activity (likes and dislikes not seen as new elements) */ -use Friendica\Core\PConfig; function windowsphonepush_install() { @@ -88,13 +87,13 @@ function windowsphonepush_settings_post($a,$post) { if(! local_user() || (! x($_POST,'windowsphonepush-submit'))) return; $enable = intval($_POST['windowsphonepush']); - PConfig::set(local_user(),'windowsphonepush','enable',$enable); + set_pconfig(local_user(),'windowsphonepush','enable',$enable); if($enable) { - PConfig::set(local_user(),'windowsphonepush','counterunseen', 0); + set_pconfig(local_user(),'windowsphonepush','counterunseen', 0); } - PConfig::set(local_user(),'windowsphonepush','senditemtext',intval($_POST['windowsphonepush-senditemtext'])); + set_pconfig(local_user(),'windowsphonepush','senditemtext',intval($_POST['windowsphonepush-senditemtext'])); info( t('WindowsPhonePush settings updated.') . EOL); } @@ -115,13 +114,13 @@ function windowsphonepush_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'windowsphonepush','enable'); + $enabled = get_pconfig(local_user(),'windowsphonepush','enable'); $checked_enabled = (($enabled) ? ' checked="checked" ' : ''); - $senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext'); + $senditemtext = get_pconfig(local_user(), 'windowsphonepush', 'senditemtext'); $checked_senditemtext = (($senditemtext) ? ' checked="checked" ' : ''); - $device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url'); + $device_url = get_pconfig(local_user(), 'windowsphonepush', 'device_url'); /* Add some HTML to the existing form */ $s .= '
'; @@ -164,8 +163,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 = get_pconfig($rr['uid'], 'windowsphonepush', 'device_url'); + $lastpushid = get_pconfig($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) @@ -186,7 +185,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']); + set_pconfig($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']); break; case "QueueFull": // maximum of 30 messages reached, server rejects any further push notification until device reconnects @@ -209,7 +208,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 = get_pconfig($rr['uid'], 'windowsphonepush', 'senditemtext'); if ($senditemtext == 1) { // load item with the max id $item = q("SELECT `author-name` as author, `body` as body FROM `item` where `id` = %d", @@ -248,7 +247,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']); + set_pconfig($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']); } } } @@ -331,7 +330,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', ""); + set_pconfig(local_user(),'windowsphonepush','device_url', ""); logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now."); } @@ -394,11 +393,11 @@ function windowsphonepush_showsettings(&$a) { if(! local_user()) 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 = get_pconfig(local_user(), 'windowsphonepush', 'enable'); + $device_url = get_pconfig(local_user(), 'windowsphonepush', 'device_url'); + $senditemtext = get_pconfig(local_user(), 'windowsphonepush', 'senditemtext'); + $lastpushid = get_pconfig(local_user(), 'windowsphonepush', 'lastpushid'); + $counterunseen = get_pconfig(local_user(), 'windowsphonepush', 'counterunseen'); $addonversion = "2.0"; if (!$device_url) @@ -427,7 +426,7 @@ function windowsphonepush_updatesettings(&$a) { } // no updating if user hasn't enabled the plugin - $enable = PConfig::get(local_user(), 'windowsphonepush', 'enable'); + $enable = get_pconfig(local_user(), 'windowsphonepush', 'enable'); if(! $enable) { return "Plug-in not enabled"; } @@ -449,12 +448,12 @@ function windowsphonepush_updatesettings(&$a) { `v` = '" . $device_url . "'"); if(count($r)) { foreach($r as $rr) { - PConfig::set($rr['uid'], 'windowsphonepush', 'device_url', ''); + set_pconfig($rr['uid'], 'windowsphonepush', 'device_url', ''); logger("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); + set_pconfig(local_user(),'windowsphonepush','device_url', $device_url); // output the successfull update of the device URL to the logger for error analysis if necessary logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'"); return "Device-URL updated successfully!"; @@ -469,12 +468,12 @@ function windowsphonepush_updatecounterunseen() { } // no updating if user hasn't enabled the plugin - $enable = PConfig::get(local_user(), 'windowsphonepush', 'enable'); + $enable = get_pconfig(local_user(), 'windowsphonepush', 'enable'); if(! $enable) { return "Plug-in not enabled"; } - PConfig::set(local_user(),'windowsphonepush','counterunseen', 0); + set_pconfig(local_user(),'windowsphonepush','counterunseen', 0); return "Counter set to zero"; } diff --git a/wppost/wppost.php b/wppost/wppost.php index f1483101..fc9244af 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -7,8 +7,6 @@ * Author: Mike Macgirvin */ -use Friendica\Core\PConfig; - function wppost_install() { register_hook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local'); register_hook('notifier_normal', 'addon/wppost/wppost.php', 'wppost_send'); @@ -36,9 +34,9 @@ function wppost_jot_nets(&$a,&$b) { if(! local_user()) return; - $wp_post = PConfig::get(local_user(),'wppost','post'); + $wp_post = get_pconfig(local_user(),'wppost','post'); if(intval($wp_post) == 1) { - $wp_defpost = PConfig::get(local_user(),'wppost','post_by_default'); + $wp_defpost = get_pconfig(local_user(),'wppost','post_by_default'); $selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to Wordpress') . '
'; @@ -57,23 +55,23 @@ function wppost_settings(&$a,&$s) { /* Get the current state of our config variables */ - $enabled = PConfig::get(local_user(),'wppost','post'); + $enabled = get_pconfig(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 = get_pconfig(local_user(),'wppost','post_by_default'); + $back_enabled = get_pconfig(local_user(),'wppost','backlink'); + $shortcheck_enabled = get_pconfig(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 = get_pconfig(local_user(), 'wppost', 'wp_username'); + $wp_password = get_pconfig(local_user(), 'wppost', 'wp_password'); + $wp_blog = get_pconfig(local_user(), 'wppost', 'wp_blog'); + $wp_backlink_text = get_pconfig(local_user(), 'wppost', 'wp_backlink_text'); /* Add some HTML to the existing form */ @@ -135,17 +133,17 @@ function wppost_settings_post(&$a,&$b) { if(x($_POST,'wppost-submit')) { - PConfig::set(local_user(),'wppost','post',intval($_POST['wppost'])); - PConfig::set(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault'])); - 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'])); + set_pconfig(local_user(),'wppost','post',intval($_POST['wppost'])); + set_pconfig(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault'])); + set_pconfig(local_user(),'wppost','wp_username',trim($_POST['wp_username'])); + set_pconfig(local_user(),'wppost','wp_password',trim($_POST['wp_password'])); + set_pconfig(local_user(),'wppost','wp_blog',trim($_POST['wp_blog'])); + set_pconfig(local_user(),'wppost','backlink',trim($_POST['wp_backlink'])); + set_pconfig(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck'])); $wp_backlink_text = notags(trim($_POST['wp_backlink_text'])); $wp_backlink_text = bbcode($wp_backlink_text, false, false, 8); $wp_backlink_text = html2plain($wp_backlink_text, 0, true); - PConfig::set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text); + set_pconfig(local_user(),'wppost','wp_backlink_text', $wp_backlink_text); } @@ -167,11 +165,11 @@ function wppost_post_local(&$a, &$b) { return; } - $wp_post = intval(PConfig::get(local_user(),'wppost','post')); + $wp_post = intval(get_pconfig(local_user(),'wppost','post')); $wp_enable = (($wp_post && x($_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(get_pconfig(local_user(),'wppost','post_by_default'))) { $wp_enable = 1; } @@ -201,10 +199,10 @@ function wppost_send(&$a,&$b) { return; - $wp_username = xmlify(PConfig::get($b['uid'],'wppost','wp_username')); - $wp_password = xmlify(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 = xmlify(get_pconfig($b['uid'],'wppost','wp_username')); + $wp_password = xmlify(get_pconfig($b['uid'],'wppost','wp_password')); + $wp_blog = get_pconfig($b['uid'],'wppost','wp_blog'); + $wp_backlink_text = get_pconfig($b['uid'],'wppost','wp_backlink_text'); if ($wp_backlink_text == '') { $wp_backlink_text = t('Read the orig­i­nal post and com­ment stream on Friendica'); } @@ -217,7 +215,7 @@ function wppost_send(&$a,&$b) { $wptitle = trim($b['title']); - if (intval(PConfig::get($b['uid'],'wppost','shortcheck'))) { + if (intval(get_pconfig($b['uid'],'wppost','shortcheck'))) { // Checking, if its a post that is worth a blog post $postentry = false; $siteinfo = get_attached_data($b["body"]); @@ -278,7 +276,7 @@ function wppost_send(&$a,&$b) { $post = $title.$post; - $wp_backlink = intval(PConfig::get($b['uid'],'wppost','backlink')); + $wp_backlink = intval(get_pconfig($b['uid'],'wppost','backlink')); if($wp_backlink && $b['plink']) { $post .= EOL . EOL . '' . $wp_backlink_text . '' . EOL . EOL; diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index 473b9b8b..076b7b13 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -6,9 +6,6 @@ * Author: Michael Vogel */ -use Friendica\Core\Config; -use Friendica\Core\PConfig; - function xmpp_install() { register_hook('plugin_settings', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings'); register_hook('plugin_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings_post'); @@ -26,9 +23,9 @@ function xmpp_uninstall() { function xmpp_plugin_settings_post($a,$post) { if(! local_user() || (! x($_POST,'xmpp-settings-submit'))) return; - PConfig::set(local_user(),'xmpp','enabled',intval($_POST['xmpp_enabled'])); - PConfig::set(local_user(),'xmpp','individual',intval($_POST['xmpp_individual'])); - PConfig::set(local_user(),'xmpp','bosh_proxy',$_POST['xmpp_bosh_proxy']); + set_pconfig(local_user(),'xmpp','enabled',intval($_POST['xmpp_enabled'])); + set_pconfig(local_user(),'xmpp','individual',intval($_POST['xmpp_individual'])); + set_pconfig(local_user(),'xmpp','bosh_proxy',$_POST['xmpp_bosh_proxy']); info( t('XMPP settings updated.') . EOL); } @@ -44,13 +41,13 @@ function xmpp_plugin_settings(&$a,&$s) { /* Get the current state of our config variable */ - $enabled = intval(PConfig::get(local_user(),'xmpp','enabled')); + $enabled = intval(get_pconfig(local_user(),'xmpp','enabled')); $enabled_checked = (($enabled) ? ' checked="checked" ' : ''); - $individual = intval(PConfig::get(local_user(),'xmpp','individual')); + $individual = intval(get_pconfig(local_user(),'xmpp','individual')); $individual_checked = (($individual) ? ' checked="checked" ' : ''); - $bosh_proxy = PConfig::get(local_user(),"xmpp","bosh_proxy"); + $bosh_proxy = get_pconfig(local_user(),"xmpp","bosh_proxy"); /* Add some HTML to the existing form */ $s .= ''; @@ -66,13 +63,13 @@ function xmpp_plugin_settings(&$a,&$s) { $s .= ''; $s .= '
'; - if (Config::get("xmpp", "central_userbase")) { + if (get_config("xmpp", "central_userbase")) { $s .= ''; $s .= ''; $s .= '
'; } - if (!Config::get("xmpp", "central_userbase") || PConfig::get(local_user(),"xmpp","individual")) { + if (!get_config("xmpp", "central_userbase") || get_pconfig(local_user(),"xmpp","individual")) { $s .= ''; $s .= ' '; $s .= '
'; @@ -89,7 +86,7 @@ function xmpp_plugin_settings(&$a,&$s) { function xmpp_login($a,$b) { if (!$_SESSION["allow_api"]) { $password = substr(random_string(),0,16); - PConfig::set(local_user(), "xmpp", "password", $password); + set_pconfig(local_user(), "xmpp", "password", $password); } } @@ -98,16 +95,16 @@ function xmpp_plugin_admin(&$a, &$o){ $o = replace_macros($t, array( '$submit' => t('Save Settings'), - '$bosh_proxy' => array('bosh_proxy', t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''), - '$central_userbase' => array('central_userbase', t('Use central userbase'), Config::get('xmpp', 'central_userbase'), t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')), + '$bosh_proxy' => array('bosh_proxy', t('Jabber BOSH host'), get_config('xmpp', 'bosh_proxy'), ''), + '$central_userbase' => array('central_userbase', t('Use central userbase'), get_config('xmpp', 'central_userbase'), t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')), )); } function xmpp_plugin_admin_post(&$a){ $bosh_proxy = ((x($_POST,'bosh_proxy')) ? trim($_POST['bosh_proxy']) : ''); $central_userbase = ((x($_POST,'central_userbase')) ? intval($_POST['central_userbase']) : false); - Config::set('xmpp','bosh_proxy',$bosh_proxy); - Config::set('xmpp','central_userbase',$central_userbase); + set_config('xmpp','bosh_proxy',$bosh_proxy); + set_config('xmpp','central_userbase',$central_userbase); info( t('Settings updated.'). EOL ); } @@ -125,7 +122,7 @@ function xmpp_converse(&$a,&$s) { if ($a->is_mobile || $a->is_tablet) return; - if (!PConfig::get(local_user(),"xmpp","enabled")) + if (!get_pconfig(local_user(),"xmpp","enabled")) return; if (in_array($a->query_string, array("admin/federation/"))) @@ -134,14 +131,14 @@ function xmpp_converse(&$a,&$s) { $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\n"; - if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(),"xmpp","individual")) { - $bosh_proxy = Config::get("xmpp", "bosh_proxy"); + if (get_config("xmpp", "central_userbase") && !get_pconfig(local_user(),"xmpp","individual")) { + $bosh_proxy = get_config("xmpp", "bosh_proxy"); - $password = PConfig::get(local_user(), "xmpp", "password"); + $password = get_pconfig(local_user(), "xmpp", "password"); if ($password == "") { $password = substr(random_string(),0,16); - PConfig::set(local_user(), "xmpp", "password", $password); + set_pconfig(local_user(), "xmpp", "password", $password); } $jid = $a->user["nickname"]."@".$a->get_hostname()."/converse-".substr(random_string(),0,5);; @@ -152,7 +149,7 @@ function xmpp_converse(&$a,&$s) { password: '$password', allow_logout: false,"; } else { - $bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy"); + $bosh_proxy = get_pconfig(local_user(), "xmpp", "bosh_proxy"); $auto_login = ""; } diff --git a/yourls/yourls.php b/yourls/yourls.php index d5d6d234..beea2619 100755 --- a/yourls/yourls.php +++ b/yourls/yourls.php @@ -9,8 +9,6 @@ * */ -use Friendica\Core\Config; - function yourls_install() { register_hook('plugin_settings', 'addon/yourls/yourls.php', 'yourls_addon_settings'); register_hook('plugin_settings_post', 'addon/yourls/yourls.php', 'yourls_addon_settings_post'); @@ -21,10 +19,10 @@ function yourls_install() { function yourls_uninstall() { unregister_hook('plugin_settings', 'addon/yourls/yourls.php', 'yourls_addon_settings'); unregister_hook('plugin_settings_post', 'addon/yourls/yourls.php', 'yourls_addon_settings_post'); - Config::set('yourls','url1',trim($_POST[''])); - Config::set('yourls','username1',trim($_POST[''])); - Config::set('yourls','password1',trim($_POST[''])); - Config::set('yourls','ssl1',trim($_POST[''])); + set_config('yourls','url1',trim($_POST[''])); + set_config('yourls','username1',trim($_POST[''])); + set_config('yourls','password1',trim($_POST[''])); + set_config('yourls','ssl1',trim($_POST[''])); } @@ -43,15 +41,15 @@ function yourls_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $yourls_url = Config::get('yourls','url1'); - $yourls_username = Config::get('yourls','username1'); - $yourls_password = Config::get('yourls', 'password1'); - $ssl_enabled = Config::get('yourls','ssl1'); + $yourls_url = get_config('yourls','url1'); + $yourls_username = get_config('yourls','username1'); + $yourls_password = get_config('yourls', 'password1'); + $ssl_enabled = get_config('yourls','ssl1'); $ssl_checked = (($ssl_enabled) ? ' checked="checked" ' : ''); - $yourls_ssl = Config::get('yourls', 'ssl1'); + $yourls_ssl = get_config('yourls', 'ssl1'); $s .= ''; $s .= '

' . t('YourLS') . '

'; @@ -93,10 +91,10 @@ function yourls_addon_settings_post(&$a,&$b) { return; if($_POST['yourls-submit']) { - Config::set('yourls','url1',trim($_POST['yourls_url'])); - Config::set('yourls','username1',trim($_POST['yourls_username'])); - Config::set('yourls','password1',trim($_POST['yourls_password'])); - Config::set('yourls','ssl1',intval($_POST['yourls_ssl'])); + set_config('yourls','url1',trim($_POST['yourls_url'])); + set_config('yourls','username1',trim($_POST['yourls_username'])); + set_config('yourls','password1',trim($_POST['yourls_password'])); + set_config('yourls','ssl1',intval($_POST['yourls_ssl'])); info( t('yourls Settings saved.') . EOL); } }