Merge pull request #439 from zeroadam/Issue3873
Replace deprecated (P)Config functions with new syntax
This commit is contained in:
commit
c3e93f1ed9
|
@ -49,6 +49,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function blackout_install() {
|
||||
register_hook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
|
||||
|
@ -67,9 +68,9 @@ function blackout_redirect ($a, $b) {
|
|||
return true;
|
||||
|
||||
// else...
|
||||
$mystart = get_config('blackout','begindate');
|
||||
$myend = get_config('blackout','enddate');
|
||||
$myurl = get_config('blackout','url');
|
||||
$mystart = Config::get('blackout','begindate');
|
||||
$myend = Config::get('blackout','enddate');
|
||||
$myurl = Config::get('blackout','url');
|
||||
$now = time();
|
||||
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
|
||||
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
|
||||
|
@ -87,11 +88,11 @@ function blackout_redirect ($a, $b) {
|
|||
}
|
||||
|
||||
function blackout_plugin_admin(&$a, &$o) {
|
||||
$mystart = get_config('blackout','begindate');
|
||||
$mystart = Config::get('blackout','begindate');
|
||||
if (! is_string($mystart)) { $mystart = "YYYY-MM-DD:hhmm"; }
|
||||
$myend = get_config('blackout','enddate');
|
||||
$myend = Config::get('blackout','enddate');
|
||||
if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
|
||||
$myurl = get_config('blackout','url');
|
||||
$myurl = Config::get('blackout','url');
|
||||
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
|
||||
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
|
||||
|
||||
|
@ -114,7 +115,7 @@ function blackout_plugin_admin_post (&$a) {
|
|||
$begindate = trim($_POST['startdate']);
|
||||
$enddate = trim($_POST['enddate']);
|
||||
$url = trim($_POST['rurl']);
|
||||
set_config('blackout','begindate',$begindate);
|
||||
set_config('blackout','enddate',$enddate);
|
||||
set_config('blackout','url',$url);
|
||||
Config::set('blackout','begindate',$begindate);
|
||||
Config::set('blackout','enddate',$enddate);
|
||||
Config::set('blackout','url',$url);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function blockem_install() {
|
||||
register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
|
||||
register_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
|
||||
|
@ -45,7 +47,7 @@ function blockem_addon_settings(&$a,&$s) {
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
|
||||
$words = get_pconfig(local_user(),'blockem','words');
|
||||
$words = PConfig::get(local_user(),'blockem','words');
|
||||
if(! $words)
|
||||
$words = '';
|
||||
|
||||
|
@ -74,7 +76,7 @@ function blockem_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['blockem-submit']) {
|
||||
set_pconfig(local_user(),'blockem','words',trim($_POST['blockem-words']));
|
||||
PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words']));
|
||||
info( t('BLOCKEM Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +84,7 @@ function blockem_addon_settings_post(&$a,&$b) {
|
|||
|
||||
function blockem_enotify_store(&$a,&$b) {
|
||||
|
||||
$words = get_pconfig($b['uid'],'blockem','words');
|
||||
$words = PConfig::get($b['uid'],'blockem','words');
|
||||
if($words) {
|
||||
$arr = explode(',',$words);
|
||||
}
|
||||
|
@ -115,7 +117,7 @@ function blockem_prepare_body(&$a,&$b) {
|
|||
|
||||
$words = null;
|
||||
if(local_user()) {
|
||||
$words = get_pconfig(local_user(),'blockem','words');
|
||||
$words = PConfig::get(local_user(),'blockem','words');
|
||||
}
|
||||
if($words) {
|
||||
$arr = explode(',',$words);
|
||||
|
@ -155,7 +157,7 @@ function blockem_conversation_start(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$words = get_pconfig(local_user(),'blockem','words');
|
||||
$words = PConfig::get(local_user(),'blockem','words');
|
||||
if($words) {
|
||||
$a->data['blockem'] = explode(',',$words);
|
||||
}
|
||||
|
@ -207,7 +209,7 @@ function blockem_init(&$a) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$words = get_pconfig(local_user(),'blockem','words');
|
||||
$words = PConfig::get(local_user(),'blockem','words');
|
||||
|
||||
if(array_key_exists('block',$_GET) && $_GET['block']) {
|
||||
if(strlen($words))
|
||||
|
@ -227,7 +229,7 @@ function blockem_init(&$a) {
|
|||
$words = implode(',',$newarr);
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'blockem','words',$words);
|
||||
PConfig::set(local_user(),'blockem','words',$words);
|
||||
info( t('blockem settings updated') . EOL );
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function blogger_install() {
|
||||
register_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
|
||||
register_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
|
||||
|
@ -34,9 +36,9 @@ function blogger_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$bl_post = get_pconfig(local_user(),'blogger','post');
|
||||
$bl_post = PConfig::get(local_user(),'blogger','post');
|
||||
if(intval($bl_post) == 1) {
|
||||
$bl_defpost = get_pconfig(local_user(),'blogger','post_by_default');
|
||||
$bl_defpost = PConfig::get(local_user(),'blogger','post_by_default');
|
||||
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
|
||||
. t('Post to blogger') . '</div>';
|
||||
|
@ -55,17 +57,17 @@ function blogger_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'blogger','post');
|
||||
$enabled = PConfig::get(local_user(),'blogger','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'blogger','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'blogger','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$bl_username = get_pconfig(local_user(), 'blogger', 'bl_username');
|
||||
$bl_password = get_pconfig(local_user(), 'blogger', 'bl_password');
|
||||
$bl_blog = get_pconfig(local_user(), 'blogger', 'bl_blog');
|
||||
$bl_username = PConfig::get(local_user(), 'blogger', 'bl_username');
|
||||
$bl_password = PConfig::get(local_user(), 'blogger', 'bl_password');
|
||||
$bl_blog = PConfig::get(local_user(), 'blogger', 'bl_blog');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -114,11 +116,11 @@ function blogger_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'blogger-submit')) {
|
||||
|
||||
set_pconfig(local_user(),'blogger','post',intval($_POST['blogger']));
|
||||
set_pconfig(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
|
||||
set_pconfig(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
|
||||
set_pconfig(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
|
||||
set_pconfig(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
|
||||
PConfig::set(local_user(),'blogger','post',intval($_POST['blogger']));
|
||||
PConfig::set(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
|
||||
PConfig::set(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
|
||||
PConfig::set(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
|
||||
PConfig::set(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -137,11 +139,11 @@ function blogger_post_local(&$a,&$b) {
|
|||
if($b['private'] || $b['parent'])
|
||||
return;
|
||||
|
||||
$bl_post = intval(get_pconfig(local_user(),'blogger','post'));
|
||||
$bl_post = intval(PConfig::get(local_user(),'blogger','post'));
|
||||
|
||||
$bl_enable = (($bl_post && x($_REQUEST,'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0);
|
||||
|
||||
if($b['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default')))
|
||||
if($b['api_source'] && intval(PConfig::get(local_user(),'blogger','post_by_default')))
|
||||
$bl_enable = 1;
|
||||
|
||||
if(! $bl_enable)
|
||||
|
@ -167,9 +169,9 @@ function blogger_send(&$a,&$b) {
|
|||
return;
|
||||
|
||||
|
||||
$bl_username = xmlify(get_pconfig($b['uid'],'blogger','bl_username'));
|
||||
$bl_password = xmlify(get_pconfig($b['uid'],'blogger','bl_password'));
|
||||
$bl_blog = get_pconfig($b['uid'],'blogger','bl_blog');
|
||||
$bl_username = xmlify(PConfig::get($b['uid'],'blogger','bl_username'));
|
||||
$bl_password = xmlify(PConfig::get($b['uid'],'blogger','bl_password'));
|
||||
$bl_blog = PConfig::get($b['uid'],'blogger','bl_blog');
|
||||
|
||||
if($bl_username && $bl_password && $bl_blog) {
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
*/
|
||||
require('addon/buffer/bufferapp.php');
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function buffer_install() {
|
||||
register_hook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
|
||||
register_hook('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
|
||||
|
@ -56,15 +59,15 @@ function buffer_plugin_admin(&$a, &$o){
|
|||
$o = replace_macros($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
// name, label, value, help, [extra values]
|
||||
'$client_id' => array('client_id', t('Client ID'), get_config('buffer', 'client_id' ), ''),
|
||||
'$client_secret' => array('client_secret', t('Client Secret'), get_config('buffer', 'client_secret' ), ''),
|
||||
'$client_id' => array('client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''),
|
||||
'$client_secret' => array('client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''),
|
||||
));
|
||||
}
|
||||
function buffer_plugin_admin_post(&$a){
|
||||
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
|
||||
$client_secret = ((x($_POST,'client_secret')) ? notags(trim($_POST['client_secret'])): '');
|
||||
set_config('buffer','client_id',$client_id);
|
||||
set_config('buffer','client_secret',$client_secret);
|
||||
Config::set('buffer','client_id',$client_id);
|
||||
Config::set('buffer','client_secret',$client_secret);
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
|
@ -78,8 +81,8 @@ function buffer_connect(&$a) {
|
|||
session_start();
|
||||
|
||||
// Define the needed keys
|
||||
$client_id = get_config('buffer','client_id');
|
||||
$client_secret = get_config('buffer','client_secret');
|
||||
$client_id = Config::get('buffer','client_id');
|
||||
$client_secret = Config::get('buffer','client_secret');
|
||||
|
||||
// The callback URL is the script that gets called after the user authenticates with buffer
|
||||
$callback_url = $a->get_baseurl()."/buffer/connect";
|
||||
|
@ -92,7 +95,7 @@ function buffer_connect(&$a) {
|
|||
logger("buffer_connect: authenticated");
|
||||
$o .= t("You are now authenticated to buffer. ");
|
||||
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
|
||||
set_pconfig(local_user(), 'buffer','access_token', $buffer->access_token);
|
||||
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
|
||||
}
|
||||
|
||||
return($o);
|
||||
|
@ -102,9 +105,9 @@ function buffer_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$buffer_post = get_pconfig(local_user(),'buffer','post');
|
||||
$buffer_post = PConfig::get(local_user(),'buffer','post');
|
||||
if(intval($buffer_post) == 1) {
|
||||
$buffer_defpost = get_pconfig(local_user(),'buffer','post_by_default');
|
||||
$buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default');
|
||||
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to Buffer') . '</div>';
|
||||
|
@ -122,11 +125,11 @@ function buffer_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'buffer','post');
|
||||
$enabled = PConfig::get(local_user(),'buffer','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'buffer','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'buffer','post_by_default');
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -139,9 +142,9 @@ function buffer_settings(&$a,&$s) {
|
|||
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>';
|
||||
$s .= '</span>';
|
||||
|
||||
$client_id = get_config("buffer", "client_id");
|
||||
$client_secret = get_config("buffer", "client_secret");
|
||||
$access_token = get_pconfig(local_user(), "buffer", "access_token");
|
||||
$client_id = Config::get("buffer", "client_id");
|
||||
$client_secret = Config::get("buffer", "client_secret");
|
||||
$access_token = PConfig::get(local_user(), "buffer", "access_token");
|
||||
|
||||
$s .= '<div id="buffer-password-wrapper">';
|
||||
if ($access_token == "") {
|
||||
|
@ -198,12 +201,12 @@ function buffer_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'buffer-submit')) {
|
||||
if(x($_POST,'buffer_delete')) {
|
||||
set_pconfig(local_user(),'buffer','access_token','');
|
||||
set_pconfig(local_user(),'buffer','post',false);
|
||||
set_pconfig(local_user(),'buffer','post_by_default',false);
|
||||
PConfig::set(local_user(),'buffer','access_token','');
|
||||
PConfig::set(local_user(),'buffer','post',false);
|
||||
PConfig::set(local_user(),'buffer','post_by_default',false);
|
||||
} else {
|
||||
set_pconfig(local_user(),'buffer','post',intval($_POST['buffer']));
|
||||
set_pconfig(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
|
||||
PConfig::set(local_user(),'buffer','post',intval($_POST['buffer']));
|
||||
PConfig::set(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,11 +217,11 @@ function buffer_post_local(&$a,&$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$buffer_post = intval(get_pconfig(local_user(),'buffer','post'));
|
||||
$buffer_post = intval(PConfig::get(local_user(),'buffer','post'));
|
||||
|
||||
$buffer_enable = (($buffer_post && x($_REQUEST,'buffer_enable')) ? intval($_REQUEST['buffer_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(),'buffer','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'buffer','post_by_default'))) {
|
||||
$buffer_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -248,9 +251,9 @@ function buffer_send(&$a,&$b) {
|
|||
//if($b['app'] == "Buffer")
|
||||
// return;
|
||||
|
||||
$client_id = get_config("buffer", "client_id");
|
||||
$client_secret = get_config("buffer", "client_secret");
|
||||
$access_token = get_pconfig($b['uid'], "buffer","access_token");
|
||||
$client_id = Config::get("buffer", "client_id");
|
||||
$client_secret = Config::get("buffer", "client_secret");
|
||||
$access_token = PConfig::get($b['uid'], "buffer","access_token");
|
||||
|
||||
if($access_token) {
|
||||
$buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
require_once('mod/community.php');
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function communityhome_install() {
|
||||
register_hook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
|
||||
|
@ -24,11 +25,11 @@ function communityhome_home(&$a, &$o){
|
|||
// custom css
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
|
||||
|
||||
if (!get_config('communityhome','hidelogin')){
|
||||
if (!Config::get('communityhome','hidelogin')){
|
||||
$aside = array(
|
||||
'$tab_1' => t('Login'),
|
||||
'$tab_2' => t('OpenID'),
|
||||
'$noOid' => get_config('system','no_openid'),
|
||||
'$noOid' => Config::get('system','no_openid'),
|
||||
);
|
||||
|
||||
// login form
|
||||
|
@ -38,15 +39,15 @@ function communityhome_home(&$a, &$o){
|
|||
$aside = array(
|
||||
//'$tab_1' => t('Login'),
|
||||
//'$tab_2' => t('OpenID'),
|
||||
//'$noOid' => get_config('system','no_openid'),
|
||||
//'$noOid' => Config::get('system','no_openid'),
|
||||
);
|
||||
|
||||
// last 12 users
|
||||
if (get_config('communityhome','showlastusers')===true){
|
||||
if (Config::get('communityhome','showlastusers')===true){
|
||||
$aside['$lastusers_title'] = t('Latest users');
|
||||
$aside['$lastusers_items'] = array();
|
||||
$sql_extra = "";
|
||||
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||
$order = " ORDER BY `register_date` DESC ";
|
||||
|
||||
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
|
||||
|
@ -73,7 +74,7 @@ function communityhome_home(&$a, &$o){
|
|||
}
|
||||
// 12 most active users (by posts and contacts)
|
||||
// this query don't work on some mysql versions
|
||||
if (get_config('communityhome','showactiveusers')===true){
|
||||
if (Config::get('communityhome','showactiveusers')===true){
|
||||
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
|
||||
(SELECT COUNT(*) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
|
||||
(SELECT COUNT(*) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
|
||||
|
@ -105,7 +106,7 @@ function communityhome_home(&$a, &$o){
|
|||
}
|
||||
}
|
||||
// last 12 photos
|
||||
if (get_config('communityhome','showlastphotos')===true){
|
||||
if (Config::get('communityhome','showlastphotos')===true){
|
||||
$aside['$photos_title'] = t('Latest photos');
|
||||
$aside['$photos_items'] = array();
|
||||
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
||||
|
@ -144,7 +145,7 @@ function communityhome_home(&$a, &$o){
|
|||
}
|
||||
|
||||
// last 10 liked items
|
||||
if (get_config('communityhome','showlastlike')===true){
|
||||
if (Config::get('communityhome','showlastlike')===true){
|
||||
$aside['$like_title'] = t('Latest likes');
|
||||
$aside['$like_items'] = array();
|
||||
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
||||
|
@ -198,14 +199,14 @@ function communityhome_home(&$a, &$o){
|
|||
if(file_exists('home.html'))
|
||||
$o = file_get_contents('home.html');
|
||||
|
||||
if (get_config('communityhome','showcommunitystream')===true){
|
||||
$oldset = get_config('system','community_page_style');
|
||||
if (Config::get('communityhome','showcommunitystream')===true){
|
||||
$oldset = Config::get('system','community_page_style');
|
||||
if ($oldset == CP_NO_COMMUNITY_PAGE)
|
||||
set_config('system','community_page_style', CP_USERS_ON_SERVER);
|
||||
Config::set('system','community_page_style', CP_USERS_ON_SERVER);
|
||||
|
||||
$o .= community_content($a,1);
|
||||
|
||||
if ($oldset == CP_NO_COMMUNITY_PAGE)
|
||||
set_config('system','community_page_style', $oldset);
|
||||
Config::set('system','community_page_style', $oldset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,16 @@ require_once('include/network.php');
|
|||
require_once("mod/proxy.php");
|
||||
require_once('include/text.php');
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
// get the weather data from OpenWeatherMap
|
||||
function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) {
|
||||
$url = "http://api.openweathermap.org/data/2.5/weather?q=".$loc."&appid=".$appid."&lang=".$lang."&units=".$units."&mode=xml";
|
||||
$cached = Cache::get('curweather'.md5($url));
|
||||
$now = new DateTime();
|
||||
if (!is_null($cached)) {
|
||||
$cdate = get_pconfig(local_user(), 'curweather', 'last');
|
||||
$cdate = PConfig::get(local_user(), 'curweather', 'last');
|
||||
$cached = unserialize($cached);
|
||||
if ($cdate + $cachetime > $now->getTimestamp()) {
|
||||
return $cached;
|
||||
|
@ -56,7 +59,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
|
|||
'update' => (string)$res->lastupdate['value'],
|
||||
'icon' => (string)$res->weather['icon']
|
||||
);
|
||||
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
|
||||
return $r;
|
||||
}
|
||||
|
@ -75,7 +78,7 @@ function curweather_uninstall() {
|
|||
|
||||
function curweather_network_mod_init(&$fk_app,&$b) {
|
||||
|
||||
if(! intval(get_pconfig(local_user(),'curweather','curweather_enable')))
|
||||
if(! intval(PConfig::get(local_user(),'curweather','curweather_enable')))
|
||||
return;
|
||||
|
||||
$fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
|
||||
|
@ -89,14 +92,14 @@ function curweather_network_mod_init(&$fk_app,&$b) {
|
|||
// those parameters will be used to get: cloud status, temperature, preassure
|
||||
// and relative humidity for display, also the relevent area of the map is
|
||||
// linked from lat/log of the reply of OWMp
|
||||
$rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc');
|
||||
$rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
|
||||
|
||||
|
||||
// set the language to the browsers language and use metric units
|
||||
$lang = $_SESSION['language'];
|
||||
$units = get_pconfig( local_user(), 'curweather', 'curweather_units');
|
||||
$appid = get_config('curweather','appid');
|
||||
$cachetime = intval(get_config('curweather','cachetime'));
|
||||
$units = PConfig::get( local_user(), 'curweather', 'curweather_units');
|
||||
$appid = Config::get('curweather','appid');
|
||||
$cachetime = intval(Config::get('curweather','cachetime'));
|
||||
if ($units==="")
|
||||
$units = 'metric';
|
||||
$ok = true;
|
||||
|
@ -139,9 +142,9 @@ function curweather_network_mod_init(&$fk_app,&$b) {
|
|||
function curweather_plugin_settings_post($a,$post) {
|
||||
if(! local_user() || (! x($_POST,'curweather-settings-submit')))
|
||||
return;
|
||||
set_pconfig(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
|
||||
set_pconfig(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
|
||||
set_pconfig(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
|
||||
PConfig::set(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
|
||||
PConfig::set(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
|
||||
PConfig::set(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
|
||||
|
||||
info( t('Current Weather settings updated.') . EOL);
|
||||
}
|
||||
|
@ -154,15 +157,15 @@ function curweather_plugin_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = get_pconfig(local_user(), 'curweather', 'curweather_units');
|
||||
$appid = get_config('curweather','appid');
|
||||
$curweather_loc = PConfig::get(local_user(), 'curweather', 'curweather_loc');
|
||||
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
|
||||
$appid = Config::get('curweather','appid');
|
||||
if ($appid=="") {
|
||||
$noappidtext = t('No APPID found, please contact your admin to obtain one.');
|
||||
} else {
|
||||
$noappidtext = '';
|
||||
}
|
||||
$enable = intval(get_pconfig(local_user(),'curweather','curweather_enable'));
|
||||
$enable = intval(PConfig::get(local_user(),'curweather','curweather_enable'));
|
||||
$enable_checked = (($enable) ? ' checked="checked" ' : '');
|
||||
|
||||
// load template and replace the macros
|
||||
|
@ -185,16 +188,16 @@ function curweather_plugin_admin_post (&$a) {
|
|||
if(! is_site_admin())
|
||||
return;
|
||||
if ($_POST['curweather-submit']) {
|
||||
set_config('curweather','appid',trim($_POST['appid']));
|
||||
set_config('curweather','cachetime',trim($_POST['cachetime']));
|
||||
Config::set('curweather','appid',trim($_POST['appid']));
|
||||
Config::set('curweather','cachetime',trim($_POST['cachetime']));
|
||||
info( t('Curweather settings saved.'.EOL));
|
||||
}
|
||||
}
|
||||
function curweather_plugin_admin (&$a, &$o) {
|
||||
if(! is_site_admin())
|
||||
return;
|
||||
$appid = get_config('curweather','appid');
|
||||
$cachetime = get_config('curweather','cachetime');
|
||||
$appid = Config::get('curweather','appid');
|
||||
$cachetime = Config::get('curweather','cachetime');
|
||||
$t = get_markup_template("admin.tpl", "addon/curweather/" );
|
||||
$o = replace_macros ($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
abstract class wdcal_local
|
||||
{
|
||||
|
||||
|
@ -34,7 +36,7 @@ abstract class wdcal_local
|
|||
* @return wdcal_local
|
||||
*/
|
||||
static function getInstanceByUser($uid = 0) {
|
||||
$dateformat = get_pconfig($uid, "dav", "dateformat");
|
||||
$dateformat = PConfig::get($uid, "dav", "dateformat");
|
||||
$format = self::getInstance($dateformat);
|
||||
if ($format == null) $format = self::getInstance(self::LOCAL_US);
|
||||
return $format;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,7 +25,7 @@ function wdcal_addRequiredHeaders()
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/calendar.css' . '" media="all" />' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/main.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
switch (get_config("system", "language")) {
|
||||
switch (Config::get("system", "language")) {
|
||||
case "de":
|
||||
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/common/wdcal/js/wdCalendar_lang_DE.js"></script>' . "\r\n";
|
||||
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/jqueryui/jquery.ui.datepicker-de.js"></script>' . "\r\n";
|
||||
|
@ -357,7 +359,7 @@ function wdcal_getSettingsPage(&$a)
|
|||
|
||||
if (isset($_REQUEST["save"])) {
|
||||
check_form_security_token_redirectOnErr('/dav/settings/', 'calprop');
|
||||
set_pconfig($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
|
||||
PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
|
||||
info(t('The new values have been saved.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
require_once("addon/diaspora/Diaspora_Connection.php");
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function diaspora_install() {
|
||||
register_hook('post_local', 'addon/diaspora/diaspora.php', 'diaspora_post_local');
|
||||
register_hook('notifier_normal', 'addon/diaspora/diaspora.php', 'diaspora_send');
|
||||
|
@ -31,9 +33,9 @@ function diaspora_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$diaspora_post = get_pconfig(local_user(),'diaspora','post');
|
||||
$diaspora_post = PConfig::get(local_user(),'diaspora','post');
|
||||
if(intval($diaspora_post) == 1) {
|
||||
$diaspora_defpost = get_pconfig(local_user(),'diaspora','post_by_default');
|
||||
$diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default');
|
||||
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to Diaspora') . '</div>';
|
||||
|
@ -66,9 +68,9 @@ function diaspora_queue_hook(&$a,&$b) {
|
|||
|
||||
$userdata = $r[0];
|
||||
|
||||
$handle = get_pconfig($userdata['uid'],'diaspora','handle');
|
||||
$password = get_pconfig($userdata['uid'],'diaspora','password');
|
||||
$aspect = get_pconfig($userdata['uid'],'diaspora','aspect');
|
||||
$handle = PConfig::get($userdata['uid'],'diaspora','handle');
|
||||
$password = PConfig::get($userdata['uid'],'diaspora','password');
|
||||
$aspect = PConfig::get($userdata['uid'],'diaspora','aspect');
|
||||
|
||||
$success = false;
|
||||
|
||||
|
@ -119,17 +121,17 @@ function diaspora_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'diaspora','post');
|
||||
$enabled = PConfig::get(local_user(),'diaspora','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'diaspora','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'diaspora','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$handle = get_pconfig(local_user(), 'diaspora', 'handle');
|
||||
$password = get_pconfig(local_user(), 'diaspora', 'password');
|
||||
$aspect = get_pconfig(local_user(),'diaspora','aspect');
|
||||
$handle = PConfig::get(local_user(), 'diaspora', 'handle');
|
||||
$password = PConfig::get(local_user(), 'diaspora', 'password');
|
||||
$aspect = PConfig::get(local_user(),'diaspora','aspect');
|
||||
|
||||
$status = "";
|
||||
|
||||
|
@ -222,11 +224,11 @@ function diaspora_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'diaspora-submit')) {
|
||||
|
||||
set_pconfig(local_user(),'diaspora','post',intval($_POST['diaspora']));
|
||||
set_pconfig(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
|
||||
set_pconfig(local_user(),'diaspora','handle',trim($_POST['handle']));
|
||||
set_pconfig(local_user(),'diaspora','password',trim($_POST['password']));
|
||||
set_pconfig(local_user(),'diaspora','aspect',trim($_POST['aspect']));
|
||||
PConfig::set(local_user(),'diaspora','post',intval($_POST['diaspora']));
|
||||
PConfig::set(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
|
||||
PConfig::set(local_user(),'diaspora','handle',trim($_POST['handle']));
|
||||
PConfig::set(local_user(),'diaspora','password',trim($_POST['password']));
|
||||
PConfig::set(local_user(),'diaspora','aspect',trim($_POST['aspect']));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -245,11 +247,11 @@ function diaspora_post_local(&$a,&$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$diaspora_post = intval(get_pconfig(local_user(),'diaspora','post'));
|
||||
$diaspora_post = intval(PConfig::get(local_user(),'diaspora','post'));
|
||||
|
||||
$diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'diaspora','post_by_default'))) {
|
||||
$diaspora_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -283,9 +285,9 @@ function diaspora_send(&$a,&$b) {
|
|||
|
||||
logger('diaspora_send: prepare posting', LOGGER_DEBUG);
|
||||
|
||||
$handle = get_pconfig($b['uid'],'diaspora','handle');
|
||||
$password = get_pconfig($b['uid'],'diaspora','password');
|
||||
$aspect = get_pconfig($b['uid'],'diaspora','aspect');
|
||||
$handle = PConfig::get($b['uid'],'diaspora','handle');
|
||||
$password = PConfig::get($b['uid'],'diaspora','password');
|
||||
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
|
||||
|
||||
if ($handle && $password) {
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function dwpost_install() {
|
||||
register_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
|
||||
register_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send');
|
||||
|
@ -31,9 +33,9 @@ function dwpost_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$dw_post = get_pconfig(local_user(),'dwpost','post');
|
||||
$dw_post = PConfig::get(local_user(),'dwpost','post');
|
||||
if(intval($dw_post) == 1) {
|
||||
$dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default');
|
||||
$dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default');
|
||||
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
|
||||
. t('Post to Dreamwidth') . '</div>';
|
||||
|
@ -52,16 +54,16 @@ function dwpost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'dwpost','post');
|
||||
$enabled = PConfig::get(local_user(),'dwpost','post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'dwpost','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'dwpost','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$dw_username = get_pconfig(local_user(), 'dwpost', 'dw_username');
|
||||
$dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password');
|
||||
$dw_username = PConfig::get(local_user(), 'dwpost', 'dw_username');
|
||||
$dw_password = PConfig::get(local_user(), 'dwpost', 'dw_password');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -105,10 +107,10 @@ function dwpost_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'dwpost-submit')) {
|
||||
|
||||
set_pconfig(local_user(),'dwpost','post',intval($_POST['dwpost']));
|
||||
set_pconfig(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
|
||||
set_pconfig(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
|
||||
set_pconfig(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
|
||||
PConfig::set(local_user(),'dwpost','post',intval($_POST['dwpost']));
|
||||
PConfig::set(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
|
||||
PConfig::set(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
|
||||
PConfig::set(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -127,11 +129,11 @@ function dwpost_post_local(&$a,&$b) {
|
|||
if($b['private'] || $b['parent'])
|
||||
return;
|
||||
|
||||
$dw_post = intval(get_pconfig(local_user(),'dwpost','post'));
|
||||
$dw_post = intval(PConfig::get(local_user(),'dwpost','post'));
|
||||
|
||||
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
|
||||
|
||||
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default')))
|
||||
if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default')))
|
||||
$dw_enable = 1;
|
||||
|
||||
if(! $dw_enable)
|
||||
|
@ -168,8 +170,8 @@ function dwpost_send(&$a,&$b) {
|
|||
if($x && strlen($x[0]['timezone']))
|
||||
$tz = $x[0]['timezone'];
|
||||
|
||||
$dw_username = get_pconfig($b['uid'],'dwpost','dw_username');
|
||||
$dw_password = get_pconfig($b['uid'],'dwpost','dw_password');
|
||||
$dw_username = PConfig::get($b['uid'],'dwpost','dw_username');
|
||||
$dw_password = PConfig::get($b['uid'],'dwpost','dw_password');
|
||||
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
|
||||
|
||||
if($dw_username && $dw_password && $dw_blog) {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Author: Thomas Willingham <https://beardyunixer.com/profile/beardyunixer>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function forumdirectory_install() {
|
||||
register_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
|
||||
}
|
||||
|
@ -49,7 +51,7 @@ function forumdirectory_post(&$a) {
|
|||
|
||||
function forumdirectory_content(&$a) {
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -65,7 +67,7 @@ function forumdirectory_content(&$a) {
|
|||
$tpl = get_markup_template('directory_header.tpl');
|
||||
|
||||
$globaldir = '';
|
||||
$gdirpath = get_config('system','directory');
|
||||
$gdirpath = Config::get('system','directory');
|
||||
if(strlen($gdirpath)) {
|
||||
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
|
||||
. zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
|
||||
|
@ -87,7 +89,7 @@ function forumdirectory_content(&$a) {
|
|||
$search = dbesc($search);
|
||||
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
|
||||
|
||||
$publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
|
||||
$publish = ((Config::get('system','publish_all')) ? '' : " AND `publish` = 1 " );
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra ");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function fromapp_install() {
|
||||
|
||||
|
@ -32,8 +33,8 @@ function fromapp_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'fromapp-submit')))
|
||||
return;
|
||||
|
||||
set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']);
|
||||
set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
|
||||
PConfig::set(local_user(),'fromapp','app',$_POST['fromapp-input']);
|
||||
PConfig::set(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
|
||||
|
||||
info( t('Fromapp settings updated.') . EOL);
|
||||
}
|
||||
|
@ -49,11 +50,11 @@ function fromapp_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$fromapp = get_pconfig(local_user(),'fromapp','app');
|
||||
$fromapp = PConfig::get(local_user(),'fromapp','app');
|
||||
if($fromapp === false)
|
||||
$fromapp = '';
|
||||
|
||||
$force = intval(get_pconfig(local_user(),'fromapp','force'));
|
||||
$force = intval(PConfig::get(local_user(),'fromapp','force'));
|
||||
|
||||
$force_enabled = (($force) ? ' checked="checked" ' : '');
|
||||
|
||||
|
@ -90,8 +91,8 @@ function fromapp_post_hook(&$a,&$item) {
|
|||
if(local_user() != $item['uid'])
|
||||
return;
|
||||
|
||||
$app = get_pconfig(local_user(), 'fromapp', 'app');
|
||||
$force = intval(get_pconfig(local_user(), 'fromapp','force'));
|
||||
$app = PConfig::get(local_user(), 'fromapp', 'app');
|
||||
$force = intval(PConfig::get(local_user(), 'fromapp','force'));
|
||||
|
||||
if(($app === false) || (! strlen($app)))
|
||||
return;
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
require_once('mod/share.php');
|
||||
require_once('mod/parse_url.php');
|
||||
require_once('include/text.php');
|
||||
|
@ -39,9 +42,9 @@ function fromgplus_addon_settings(&$a,&$s) {
|
|||
if (count($result) > 0)
|
||||
return;
|
||||
|
||||
$enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
|
||||
$keywords_checked = (intval(get_pconfig(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
|
||||
$account = get_pconfig(local_user(),'fromgplus','account');
|
||||
$enable_checked = (intval(PConfig::get(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
|
||||
$keywords_checked = (intval(PConfig::get(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
|
||||
$account = PConfig::get(local_user(),'fromgplus','account');
|
||||
|
||||
$s .= '<span id="settings_fromgplus_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">';
|
||||
$s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. t('Google+ Mirror').'</h3>';
|
||||
|
@ -76,11 +79,11 @@ function fromgplus_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['fromgplus-submit']) {
|
||||
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
|
||||
PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
|
||||
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
|
||||
set_pconfig(local_user(),'fromgplus','enable', $enable);
|
||||
PConfig::set(local_user(),'fromgplus','enable', $enable);
|
||||
$keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0);
|
||||
set_pconfig(local_user(),'fromgplus', 'keywords', $keywords);
|
||||
PConfig::set(local_user(),'fromgplus', 'keywords', $keywords);
|
||||
|
||||
if (!$enable)
|
||||
del_pconfig(local_user(),'fromgplus','lastdate');
|
||||
|
@ -94,20 +97,20 @@ function fromgplus_plugin_admin(&$a, &$o){
|
|||
|
||||
$o = replace_macros($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
'$key' => array('key', t('Key'), trim(get_config('fromgplus', 'key')), t('')),
|
||||
'$key' => array('key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')),
|
||||
));
|
||||
}
|
||||
|
||||
function fromgplus_plugin_admin_post(&$a){
|
||||
$key = ((x($_POST,'key')) ? trim($_POST['key']) : '');
|
||||
set_config('fromgplus','key',$key);
|
||||
Config::set('fromgplus','key',$key);
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
function fromgplus_cron($a,$b) {
|
||||
$last = get_config('fromgplus','last_poll');
|
||||
$last = Config::get('fromgplus','last_poll');
|
||||
|
||||
$poll_interval = intval(get_config('fromgplus','poll_interval'));
|
||||
$poll_interval = intval(Config::get('fromgplus','poll_interval'));
|
||||
if(! $poll_interval)
|
||||
$poll_interval = FROMGPLUS_DEFAULT_POLL_INTERVAL;
|
||||
|
||||
|
@ -124,7 +127,7 @@ function fromgplus_cron($a,$b) {
|
|||
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() ");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$account = get_pconfig($rr['uid'],'fromgplus','account');
|
||||
$account = PConfig::get($rr['uid'],'fromgplus','account');
|
||||
if ($account) {
|
||||
logger('fromgplus: fetching for user '.$rr['uid']);
|
||||
fromgplus_fetch($a, $rr['uid']);
|
||||
|
@ -134,7 +137,7 @@ function fromgplus_cron($a,$b) {
|
|||
|
||||
logger('fromgplus: cron_end');
|
||||
|
||||
set_config('fromgplus','last_poll', time());
|
||||
Config::set('fromgplus','last_poll', time());
|
||||
}
|
||||
|
||||
function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
|
||||
|
@ -338,7 +341,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
|
|||
|
||||
// Add Keywords to page link
|
||||
$data = parseurl_getsiteinfo_cached($pagedata["url"], true);
|
||||
if (isset($data["keywords"]) && get_pconfig($uid, 'fromgplus', 'keywords')) {
|
||||
if (isset($data["keywords"]) && PConfig::get($uid, 'fromgplus', 'keywords')) {
|
||||
$pagedata["keywords"] = $data["keywords"];
|
||||
}
|
||||
break;
|
||||
|
@ -429,8 +432,8 @@ function fromgplus_fetch($a, $uid) {
|
|||
// Special blank to identify postings from the googleplus connector
|
||||
$blank = html_entity_decode(" ", ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$account = get_pconfig($uid,'fromgplus','account');
|
||||
$key = get_config('fromgplus','key');
|
||||
$account = PConfig::get($uid,'fromgplus','account');
|
||||
$key = Config::get('fromgplus','key');
|
||||
|
||||
$result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
|
||||
//$result = file_get_contents("google.txt");
|
||||
|
@ -438,7 +441,7 @@ function fromgplus_fetch($a, $uid) {
|
|||
|
||||
$activities = json_decode($result);
|
||||
|
||||
$initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
|
||||
$initiallastdate = PConfig::get($uid,'fromgplus','lastdate');
|
||||
|
||||
$first_time = ($initiallastdate == "");
|
||||
|
||||
|
@ -463,7 +466,7 @@ function fromgplus_fetch($a, $uid) {
|
|||
if ($lastdate < strtotime($item->published))
|
||||
$lastdate = strtotime($item->published);
|
||||
|
||||
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
|
||||
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
|
||||
|
||||
if ($first_time)
|
||||
continue;
|
||||
|
@ -505,7 +508,7 @@ function fromgplus_fetch($a, $uid) {
|
|||
case "activity":
|
||||
$post = fromgplus_html2bbcode($item->annotation)."\n";
|
||||
|
||||
if (!intval(get_config('system','old_share'))) {
|
||||
if (!intval(Config::get('system','old_share'))) {
|
||||
|
||||
if (function_exists("share_header"))
|
||||
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
|
||||
|
@ -555,5 +558,5 @@ function fromgplus_fetch($a, $uid) {
|
|||
}
|
||||
}
|
||||
if ($lastdate != 0)
|
||||
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
|
||||
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function geocoordinates_install() {
|
||||
register_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
|
||||
register_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
|
||||
|
@ -21,11 +23,11 @@ function geocoordinates_resolve_item(&$item) {
|
|||
if((!$item["coord"]) || ($item["location"]))
|
||||
return;
|
||||
|
||||
$key = get_config("geocoordinates", "api_key");
|
||||
$key = Config::get("geocoordinates", "api_key");
|
||||
if ($key == "")
|
||||
return;
|
||||
|
||||
$language = get_config("geocoordinates", "language");
|
||||
$language = Config::get("geocoordinates", "language");
|
||||
if ($language == "")
|
||||
$language = "de";
|
||||
|
||||
|
@ -80,16 +82,16 @@ function geocoordinates_plugin_admin(&$a,&$o) {
|
|||
|
||||
$o = replace_macros($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
'$api_key' => array('api_key', t('API Key'), get_config('geocoordinates', 'api_key' ), ''),
|
||||
'$language' => array('language', t('Language code (IETF format)'), get_config('geocoordinates', 'language' ), ''),
|
||||
'$api_key' => array('api_key', t('API Key'), Config::get('geocoordinates', 'api_key' ), ''),
|
||||
'$language' => array('language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language' ), ''),
|
||||
));
|
||||
}
|
||||
|
||||
function geocoordinates_plugin_admin_post(&$a) {
|
||||
$api_key = ((x($_POST,'api_key')) ? notags(trim($_POST['api_key'])) : '');
|
||||
set_config('geocoordinates','api_key',$api_key);
|
||||
Config::set('geocoordinates','api_key',$api_key);
|
||||
|
||||
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
|
||||
set_config('geocoordinates','language',$language);
|
||||
Config::set('geocoordinates','language',$language);
|
||||
info(t('Settings updated.'). EOL);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function geonames_install() {
|
||||
|
||||
|
@ -91,8 +93,8 @@ function geonames_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$geo_account = get_config('geonames', 'username');
|
||||
$active = get_pconfig(local_user(), 'geonames', 'enable');
|
||||
$geo_account = Config::get('geonames', 'username');
|
||||
$active = PConfig::get(local_user(), 'geonames', 'enable');
|
||||
|
||||
if((! $geo_account) || (! $active))
|
||||
return;
|
||||
|
@ -138,7 +140,7 @@ function geonames_post_hook($a, &$item) {
|
|||
function geonames_plugin_admin_post($a,$post) {
|
||||
if(! local_user() || (! x($_POST,'geonames-submit')))
|
||||
return;
|
||||
set_pconfig(local_user(),'geonames','enable',intval($_POST['geonames']));
|
||||
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));
|
||||
|
||||
info( t('Geonames settings updated.') . EOL);
|
||||
}
|
||||
|
@ -158,7 +160,7 @@ function geonames_plugin_admin(&$a,&$s) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$geo_account = get_config('geonames', 'username');
|
||||
$geo_account = Config::get('geonames', 'username');
|
||||
|
||||
if(! $geo_account)
|
||||
return;
|
||||
|
@ -169,7 +171,7 @@ function geonames_plugin_admin(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'geonames','enable');
|
||||
$enabled = PConfig::get(local_user(),'geonames','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function gnot_install() {
|
||||
|
||||
|
@ -44,7 +45,7 @@ function gnot_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'gnot-submit')))
|
||||
return;
|
||||
|
||||
set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot']));
|
||||
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
|
||||
info( t('Gnot settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -69,7 +70,7 @@ function gnot_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$gnot = intval(get_pconfig(local_user(),'gnot','enable'));
|
||||
$gnot = intval(PConfig::get(local_user(),'gnot','enable'));
|
||||
|
||||
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
|
||||
|
||||
|
@ -91,7 +92,7 @@ function gnot_settings(&$a,&$s) {
|
|||
|
||||
|
||||
function gnot_enotify_mail(&$a,&$b) {
|
||||
if((! $b['uid']) || (! intval(get_pconfig($b['uid'], 'gnot','enable'))))
|
||||
if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
|
||||
return;
|
||||
if($b['type'] == NOTIFY_COMMENT)
|
||||
$b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
/**
|
||||
* Installs the plugin hook
|
||||
*/
|
||||
|
@ -31,8 +33,8 @@ function gravatar_uninstall() {
|
|||
* @param &$b array
|
||||
*/
|
||||
function gravatar_lookup($a, &$b) {
|
||||
$default_avatar = get_config('gravatar', 'default_img');
|
||||
$rating = get_config('gravatar', 'rating');
|
||||
$default_avatar = Config::get('gravatar', 'default_img');
|
||||
$rating = Config::get('gravatar', 'rating');
|
||||
|
||||
// setting default value if nothing configured
|
||||
if(! $default_avatar)
|
||||
|
@ -57,8 +59,8 @@ function gravatar_lookup($a, &$b) {
|
|||
function gravatar_plugin_admin (&$a, &$o) {
|
||||
$t = get_markup_template( "admin.tpl", "addon/gravatar/" );
|
||||
|
||||
$default_avatar = get_config('gravatar', 'default_img');
|
||||
$rating = get_config('gravatar', 'rating');
|
||||
$default_avatar = Config::get('gravatar', 'default_img');
|
||||
$rating = Config::get('gravatar', 'rating');
|
||||
|
||||
// set default values for first configuration
|
||||
if(! $default_avatar)
|
||||
|
@ -106,8 +108,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');
|
||||
set_config('gravatar', 'default_img', $default_avatar);
|
||||
set_config('gravatar', 'rating', $rating);
|
||||
Config::set('gravatar', 'default_img', $default_avatar);
|
||||
Config::set('gravatar', 'rating', $rating);
|
||||
info( t('Gravatar settings updated.') .EOL);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function group_text_install() {
|
||||
|
||||
|
@ -41,7 +42,7 @@ function group_text_uninstall() {
|
|||
function group_text_settings_post($a,$post) {
|
||||
if(! local_user() || (! x($_POST,'group_text-submit')))
|
||||
return;
|
||||
set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
||||
PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
||||
|
||||
info( t('Group Text settings updated.') . EOL);
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ function group_text_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'system','groupedit_image_limit');
|
||||
$enabled = PConfig::get(local_user(),'system','groupedit_image_limit');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
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');
|
||||
|
@ -30,11 +32,11 @@ function ifttt_settings(&$a,&$s) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$key = get_pconfig(local_user(),'ifttt','key');
|
||||
$key = PConfig::get(local_user(),'ifttt','key');
|
||||
|
||||
if (!$key) {
|
||||
$key = substr(random_string(),0,20);
|
||||
set_pconfig(local_user(),'ifttt','key', $key);
|
||||
PConfig::set(local_user(),'ifttt','key', $key);
|
||||
}
|
||||
|
||||
$s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
|
||||
|
@ -102,7 +104,7 @@ function ifttt_post(&$a) {
|
|||
$key = $_REQUEST["key"];
|
||||
|
||||
// Check the key
|
||||
if ($key != get_pconfig($uid,'ifttt','key')) {
|
||||
if ($key != PConfig::get($uid,'ifttt','key')) {
|
||||
logger("Invalid key for user ".$uid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -31,9 +33,9 @@ function ijpost_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$ij_post = get_pconfig(local_user(),'ijpost','post');
|
||||
$ij_post = PConfig::get(local_user(),'ijpost','post');
|
||||
if(intval($ij_post) == 1) {
|
||||
$ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default');
|
||||
$ij_defpost = PConfig::get(local_user(),'ijpost','post_by_default');
|
||||
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
|
||||
. t('Post to Insanejournal') . '</div>';
|
||||
|
@ -52,16 +54,16 @@ function ijpost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'ijpost','post');
|
||||
$enabled = PConfig::get(local_user(),'ijpost','post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'ijpost','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'ijpost','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$ij_username = get_pconfig(local_user(), 'ijpost', 'ij_username');
|
||||
$ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password');
|
||||
$ij_username = PConfig::get(local_user(), 'ijpost', 'ij_username');
|
||||
$ij_password = PConfig::get(local_user(), 'ijpost', 'ij_password');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -104,10 +106,10 @@ function ijpost_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'ijpost-submit')) {
|
||||
|
||||
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']));
|
||||
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']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -126,11 +128,11 @@ function ijpost_post_local(&$a,&$b) {
|
|||
if($b['private'] || $b['parent'])
|
||||
return;
|
||||
|
||||
$ij_post = intval(get_pconfig(local_user(),'ijpost','post'));
|
||||
$ij_post = intval(PConfig::get(local_user(),'ijpost','post'));
|
||||
|
||||
$ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0);
|
||||
|
||||
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default')))
|
||||
if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ijpost','post_by_default')))
|
||||
$ij_enable = 1;
|
||||
|
||||
if(! $ij_enable)
|
||||
|
@ -167,8 +169,8 @@ function ijpost_send(&$a,&$b) {
|
|||
if($x && strlen($x[0]['timezone']))
|
||||
$tz = $x[0]['timezone'];
|
||||
|
||||
$ij_username = get_pconfig($b['uid'],'ijpost','ij_username');
|
||||
$ij_password = get_pconfig($b['uid'],'ijpost','ij_password');
|
||||
$ij_username = PConfig::get($b['uid'],'ijpost','ij_username');
|
||||
$ij_password = PConfig::get($b['uid'],'ijpost','ij_password');
|
||||
$ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
|
||||
|
||||
if($ij_username && $ij_password && $ij_blog) {
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
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');
|
||||
|
@ -35,7 +37,7 @@ function obfuscate_email ($s) {
|
|||
return $s;
|
||||
}
|
||||
function impressum_footer($a, &$b) {
|
||||
$text = proxy_parse_html(bbcode(get_config('impressum','footer_text'), true));
|
||||
$text = proxy_parse_html(bbcode(Config::get('impressum','footer_text'), true));
|
||||
if (! $text == '') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/impressum/impressum.css" media="all" />';
|
||||
$b .= '<div class="clear"></div>';
|
||||
|
@ -44,11 +46,11 @@ function impressum_footer($a, &$b) {
|
|||
}
|
||||
function impressum_show($a,&$b) {
|
||||
$b .= '<h3>'.t('Impressum').'</h3>';
|
||||
$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') );
|
||||
$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') );
|
||||
if (strlen($owner)) {
|
||||
if (strlen($owner_profile)) {
|
||||
$tmp = '<a href="'.$owner_profile.'">'.$owner.'</a>';
|
||||
|
@ -78,23 +80,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'])) : '');
|
||||
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));
|
||||
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));
|
||||
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'), 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.')),
|
||||
'$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.')),
|
||||
));
|
||||
}
|
||||
|
|
31
irc/irc.php
31
irc/irc.php
|
@ -7,6 +7,9 @@
|
|||
* Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -29,8 +32,8 @@ function irc_addon_settings(&$a,&$s) {
|
|||
// $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/irc/irc.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* setting popular channels, auto connect channels */
|
||||
$sitechats = get_pconfig( local_user(), 'irc','sitechats'); /* popular channels */
|
||||
$autochans = get_pconfig( local_user(), 'irc','autochans'); /* auto connect chans */
|
||||
$sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */
|
||||
$autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */
|
||||
|
||||
$t = get_markup_template( "settings.tpl", "addon/irc/" );
|
||||
$s .= replace_macros($t, array(
|
||||
|
@ -51,8 +54,8 @@ function irc_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['irc-submit']) {
|
||||
set_pconfig( local_user(), 'irc','autochans',trim($_POST['autochans']));
|
||||
set_pconfig( local_user(), 'irc','sitechats',trim($_POST['sitechats']));
|
||||
PConfig::set( local_user(), 'irc','autochans',trim($_POST['autochans']));
|
||||
PConfig::set( local_user(), 'irc','sitechats',trim($_POST['sitechats']));
|
||||
/* upid pop-up thing */
|
||||
info( t('IRC settings saved.') . EOL);
|
||||
}
|
||||
|
@ -75,11 +78,11 @@ function irc_content(&$a) {
|
|||
|
||||
/* set the list of popular channels */
|
||||
if (local_user()) {
|
||||
$sitechats = get_pconfig( local_user(), 'irc', 'sitechats');
|
||||
$sitechats = PConfig::get( local_user(), 'irc', 'sitechats');
|
||||
if (!$sitechats)
|
||||
$sitechats = get_config('irc', 'sitechats');
|
||||
$sitechats = Config::get('irc', 'sitechats');
|
||||
} else {
|
||||
$sitechats = get_config('irc','sitechats');
|
||||
$sitechats = Config::get('irc','sitechats');
|
||||
}
|
||||
if($sitechats)
|
||||
$chats = explode(',',$sitechats);
|
||||
|
@ -95,11 +98,11 @@ function irc_content(&$a) {
|
|||
|
||||
/* setting the channel(s) to auto connect */
|
||||
if (local_user()) {
|
||||
$autochans = get_pconfig(local_user(), 'irc', 'autochans');
|
||||
$autochans = PConfig::get(local_user(), 'irc', 'autochans');
|
||||
if (!$autochans)
|
||||
$autochans = get_config('irc','autochans');
|
||||
$autochans = Config::get('irc','autochans');
|
||||
} else {
|
||||
$autochans = get_config('irc','autochans');
|
||||
$autochans = Config::get('irc','autochans');
|
||||
}
|
||||
if($autochans)
|
||||
$channels = $autochans;
|
||||
|
@ -122,15 +125,15 @@ function irc_plugin_admin_post (&$a) {
|
|||
return;
|
||||
|
||||
if($_POST['irc-submit']) {
|
||||
set_config('irc','autochans',trim($_POST['autochans']));
|
||||
set_config('irc','sitechats',trim($_POST['sitechats']));
|
||||
Config::set('irc','autochans',trim($_POST['autochans']));
|
||||
Config::set('irc','sitechats',trim($_POST['sitechats']));
|
||||
/* stupid pop-up thing */
|
||||
info( t('IRC settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
function irc_plugin_admin (&$a, &$o) {
|
||||
$sitechats = get_config('irc','sitechats'); /* popular channels */
|
||||
$autochans = get_config('irc','autochans'); /* auto connect chans */
|
||||
$sitechats = Config::get('irc','sitechats'); /* popular channels */
|
||||
$autochans = Config::get('irc','autochans'); /* auto connect chans */
|
||||
$t = get_markup_template( "admin.tpl", "addon/irc/" );
|
||||
$o = replace_macros($t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
|
|
|
@ -63,6 +63,9 @@ 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');
|
||||
|
@ -76,20 +79,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 = get_config("jappixmini", "infotext");
|
||||
if (!$info_text) set_config("jappixmini", "infotext",
|
||||
$info_text = Config::get("jappixmini", "infotext");
|
||||
if (!$info_text) set_confConfig::setig("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 = get_config("jappixmini", "bosh_proxy");
|
||||
if ($bosh_proxy==="") set_config("jappixmini", "bosh_proxy", "1");
|
||||
$bosh_proxy = Config::get("jappixmini", "bosh_proxy");
|
||||
if ($bosh_proxy==="") Config::set("jappixmini", "bosh_proxy", "1");
|
||||
|
||||
// set addon version so that safe updates are possible later
|
||||
$addon_version = get_config("jappixmini", "version");
|
||||
if ($addon_version==="") set_config("jappixmini", "version", "1");
|
||||
$addon_version = Config::get("jappixmini", "version");
|
||||
if ($addon_version==="") Config::set("jappixmini", "version", "1");
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,33 +116,33 @@ function jappixmini_plugin_admin(&$a, &$o) {
|
|||
}
|
||||
|
||||
// warn if cron job has not yet been executed
|
||||
$cron_run = get_config("jappixmini", "last_cron_execution");
|
||||
$cron_run = Config::get("jappixmini", "last_cron_execution");
|
||||
if (!$cron_run) $o .= "<p><strong>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.</strong></p>";
|
||||
|
||||
// bosh proxy
|
||||
$bosh_proxy = intval(get_config("jappixmini", "bosh_proxy"));
|
||||
$bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy"));
|
||||
$bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : '';
|
||||
$o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>';
|
||||
$o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"'.$bosh_proxy.' /><br />';
|
||||
|
||||
// bosh address
|
||||
$bosh_address = get_config("jappixmini", "bosh_address");
|
||||
$bosh_address = Config::get("jappixmini", "bosh_address");
|
||||
$o .= '<p><label for="jappixmini-address">Adress of the default BOSH proxy. If enabled it overrides the user settings:</label><br />';
|
||||
$o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="'.$bosh_address.'" /></p>';
|
||||
|
||||
// default server address
|
||||
$default_server = get_config("jappixmini", "default_server");
|
||||
$default_server = Config::get("jappixmini", "default_server");
|
||||
$o .= '<p><label for="jappixmini-server">Adress of the default jabber server:</label><br />';
|
||||
$o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$default_server.'" /></p>';
|
||||
|
||||
// default user name to friendica nickname
|
||||
$default_user = intval(get_config("jappixmini", "default_user"));
|
||||
$default_user = intval(Config::get("jappixmini", "default_user"));
|
||||
$default_user = intval($default_user) ? ' checked="checked"' : '';
|
||||
$o .= '<label for="jappixmini-user">Set the default username to the nickname:</label>';
|
||||
$o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"'.$default_user.' /><br />';
|
||||
|
||||
// info text field
|
||||
$info_text = get_config("jappixmini", "infotext");
|
||||
$info_text = Config::get("jappixmini", "infotext");
|
||||
$o .= '<p><label for="jappixmini-infotext">Info text to help users with configuration (important if you want to provide your own BOSH host!):</label><br />';
|
||||
$o .= '<textarea id="jappixmini-infotext" name="jappixmini-infotext" rows="5" cols="50">'.htmlentities($info_text).'</textarea></p>';
|
||||
|
||||
|
@ -156,11 +159,11 @@ function jappixmini_plugin_admin_post(&$a) {
|
|||
$default_user = intval($_REQUEST['jappixmini-defaultuser']);
|
||||
$bosh_address = $_REQUEST['jappixmini-address'];
|
||||
$default_server = $_REQUEST['jappixmini-server'];
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,18 +209,18 @@ function jappixmini_init(&$a) {
|
|||
$decrypt_func($signed_address, $trusted_address, $key);
|
||||
|
||||
$now = intval(time());
|
||||
set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
|
||||
PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
// do not return an address if user deactivated plugin
|
||||
$activated = get_pconfig($uid, 'jappixmini', 'activate');
|
||||
$activated = PConfig::get($uid, 'jappixmini', 'activate');
|
||||
if (!$activated) killme();
|
||||
|
||||
// return the requested Jabber address
|
||||
try {
|
||||
$username = get_pconfig($uid, 'jappixmini', 'username');
|
||||
$server = get_pconfig($uid, 'jappixmini', 'server');
|
||||
$username = PConfig::get($uid, 'jappixmini', 'username');
|
||||
$server = PConfig::get($uid, 'jappixmini', 'server');
|
||||
$address = "$username@$server";
|
||||
|
||||
$encrypted_address = "";
|
||||
|
@ -241,38 +244,38 @@ function jappixmini_init(&$a) {
|
|||
function jappixmini_settings(&$a, &$s) {
|
||||
// addon settings for a user
|
||||
|
||||
$activate = get_pconfig(local_user(),'jappixmini','activate');
|
||||
$activate = PConfig::get(local_user(),'jappixmini','activate');
|
||||
$activate = intval($activate) ? ' checked="checked"' : '';
|
||||
$dontinsertchat = get_pconfig(local_user(),'jappixmini','dontinsertchat');
|
||||
$dontinsertchat = PConfig::get(local_user(),'jappixmini','dontinsertchat');
|
||||
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : '');
|
||||
|
||||
$defaultbosh = get_config("jappixmini", "bosh_address");
|
||||
$defaultbosh = Config::get("jappixmini", "bosh_address");
|
||||
|
||||
if ($defaultbosh != "")
|
||||
set_pconfig(local_user(),'jappixmini','bosh', $defaultbosh);
|
||||
PConfig::set(local_user(),'jappixmini','bosh', $defaultbosh);
|
||||
|
||||
$username = get_pconfig(local_user(),'jappixmini','username');
|
||||
$username = PConfig::get(local_user(),'jappixmini','username');
|
||||
$username = htmlentities($username);
|
||||
$server = get_pconfig(local_user(),'jappixmini','server');
|
||||
$server = PConfig::get(local_user(),'jappixmini','server');
|
||||
$server = htmlentities($server);
|
||||
$bosh = get_pconfig(local_user(),'jappixmini','bosh');
|
||||
$bosh = PConfig::get(local_user(),'jappixmini','bosh');
|
||||
$bosh = htmlentities($bosh);
|
||||
$password = get_pconfig(local_user(),'jappixmini','password');
|
||||
$autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe');
|
||||
$password = PConfig::get(local_user(),'jappixmini','password');
|
||||
$autosubscribe = PConfig::get(local_user(),'jappixmini','autosubscribe');
|
||||
$autosubscribe = intval($autosubscribe) ? ' checked="checked"' : '';
|
||||
$autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove');
|
||||
$autoapprove = PConfig::get(local_user(),'jappixmini','autoapprove');
|
||||
$autoapprove = intval($autoapprove) ? ' checked="checked"' : '';
|
||||
$encrypt = intval(get_pconfig(local_user(),'jappixmini','encrypt'));
|
||||
$encrypt = intval(PConfig::get(local_user(),'jappixmini','encrypt'));
|
||||
$encrypt_checked = $encrypt ? ' checked="checked"' : '';
|
||||
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"';
|
||||
|
||||
if ($server == "")
|
||||
$server = get_config("jappixmini", "default_server");
|
||||
$server = Config::get("jappixmini", "default_server");
|
||||
|
||||
if (($username == "") && get_config("jappixmini", "default_user"))
|
||||
if (($username == "") && Config::get("jappixmini", "default_user"))
|
||||
$username = $a->user["nickname"];
|
||||
|
||||
$info_text = get_config("jappixmini", "infotext");
|
||||
$info_text = Config::get("jappixmini", "infotext");
|
||||
$info_text = htmlentities($info_text);
|
||||
$info_text = str_replace("\n", "<br />", $info_text);
|
||||
|
||||
|
@ -409,22 +412,22 @@ function jappixmini_settings_post(&$a,&$b) {
|
|||
$purge = intval($b['jappixmini-purge']);
|
||||
|
||||
$username = trim($b['jappixmini-username']);
|
||||
$old_username = get_pconfig($uid,'jappixmini','username');
|
||||
$old_username = PConfig::get($uid,'jappixmini','username');
|
||||
if ($username!=$old_username) $purge = 1;
|
||||
|
||||
$server = trim($b['jappixmini-server']);
|
||||
$old_server = get_pconfig($uid,'jappixmini','server');
|
||||
$old_server = PConfig::get($uid,'jappixmini','server');
|
||||
if ($server!=$old_server) $purge = 1;
|
||||
|
||||
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);
|
||||
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);
|
||||
info( 'Jappix Mini settings saved.' );
|
||||
|
||||
if ($purge) {
|
||||
|
@ -442,8 +445,8 @@ function jappixmini_script(&$a,&$s) {
|
|||
if ($_GET["mode"] == "minimal")
|
||||
return;
|
||||
|
||||
$activate = get_pconfig(local_user(),'jappixmini','activate');
|
||||
$dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat');
|
||||
$activate = PConfig::get(local_user(),'jappixmini','activate');
|
||||
$dontinsertchat = PConfig::get(local_user(), 'jappixmini','dontinsertchat');
|
||||
if (!$activate || $dontinsertchat) return;
|
||||
|
||||
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&g=mini.xml"></script>'."\r\n";
|
||||
|
@ -451,24 +454,24 @@ function jappixmini_script(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>'."\r\n";
|
||||
|
||||
$username = get_pconfig(local_user(),'jappixmini','username');
|
||||
$username = PConfig::get(local_user(),'jappixmini','username');
|
||||
$username = str_replace("'", "\\'", $username);
|
||||
$server = get_pconfig(local_user(),'jappixmini','server');
|
||||
$server = PConfig::get(local_user(),'jappixmini','server');
|
||||
$server = str_replace("'", "\\'", $server);
|
||||
$bosh = get_pconfig(local_user(),'jappixmini','bosh');
|
||||
$bosh = PConfig::get(local_user(),'jappixmini','bosh');
|
||||
$bosh = str_replace("'", "\\'", $bosh);
|
||||
$encrypt = get_pconfig(local_user(),'jappixmini','encrypt');
|
||||
$encrypt = PConfig::get(local_user(),'jappixmini','encrypt');
|
||||
$encrypt = intval($encrypt);
|
||||
$password = get_pconfig(local_user(),'jappixmini','password');
|
||||
$password = PConfig::get(local_user(),'jappixmini','password');
|
||||
$password = str_replace("'", "\\'", $password);
|
||||
|
||||
$autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove');
|
||||
$autoapprove = PConfig::get(local_user(),'jappixmini','autoapprove');
|
||||
$autoapprove = intval($autoapprove);
|
||||
$autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe');
|
||||
$autosubscribe = PConfig::get(local_user(),'jappixmini','autosubscribe');
|
||||
$autosubscribe = intval($autosubscribe);
|
||||
|
||||
// set proxy if necessary
|
||||
$use_proxy = get_config('jappixmini','bosh_proxy');
|
||||
$use_proxy = Config::get('jappixmini','bosh_proxy');
|
||||
if ($use_proxy) {
|
||||
$proxy = $a->get_baseurl().'/addon/jappixmini/proxy.php';
|
||||
}
|
||||
|
@ -505,7 +508,7 @@ function jappixmini_script(&$a,&$s) {
|
|||
// get nickname
|
||||
$r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
|
||||
$nickname = json_encode($r[0]["username"]);
|
||||
$groupchats = get_config('jappixmini','groupchats');
|
||||
$groupchats = Config::get('jappixmini','groupchats');
|
||||
//if $groupchats has no value jappix_addon_start will produce a syntax error
|
||||
if(empty($groupchats)){
|
||||
$groupchats = "{}";
|
||||
|
@ -537,7 +540,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.
|
||||
|
||||
set_config("jappixmini", "last_cron_execution", $d);
|
||||
Config::set("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'");
|
||||
|
@ -571,7 +574,7 @@ function jappixmini_cron(&$a, $d) {
|
|||
}
|
||||
|
||||
// check if jabber address already present
|
||||
$present = get_pconfig($uid, "jappixmini", "id:".$dfrn_id);
|
||||
$present = PConfig::get($uid, "jappixmini", "id:".$dfrn_id);
|
||||
$now = intval(time());
|
||||
if ($present) {
|
||||
// $present has format "timestamp:jabber_address"
|
||||
|
@ -590,9 +593,9 @@ function jappixmini_cron(&$a, $d) {
|
|||
$base = substr($request, 0, $pos)."/jappixmini?role=$role";
|
||||
|
||||
// construct own address
|
||||
$username = get_pconfig($uid, 'jappixmini', 'username');
|
||||
$username = PConfig::get($uid, 'jappixmini', 'username');
|
||||
if (!$username) continue;
|
||||
$server = get_pconfig($uid, 'jappixmini', 'server');
|
||||
$server = PConfig::get($uid, 'jappixmini', 'server');
|
||||
if (!$server) continue;
|
||||
|
||||
$address = $username."@".$server;
|
||||
|
@ -628,7 +631,7 @@ function jappixmini_cron(&$a, $d) {
|
|||
}
|
||||
|
||||
// save address
|
||||
set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
|
||||
PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
|
||||
function js_upload_install() {
|
||||
register_hook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
|
||||
|
@ -45,7 +47,7 @@ function js_upload_form(&$a,&$b) {
|
|||
$cancel = t('Cancel');
|
||||
$failed = t('Failed');
|
||||
|
||||
$maximagesize = intval(get_config('system','maximagesize'));
|
||||
$maximagesize = intval(Config::get('system','maximagesize'));
|
||||
|
||||
$b['addon_text'] .= <<< EOT
|
||||
|
||||
|
@ -141,7 +143,7 @@ function js_upload_post_init(&$a,&$b) {
|
|||
|
||||
// max file size in bytes
|
||||
|
||||
$sizeLimit = get_config('system','maximagesize'); //6 * 1024 * 1024;
|
||||
$sizeLimit = Config::get('system','maximagesize'); //6 * 1024 * 1024;
|
||||
|
||||
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
|
||||
|
@ -197,7 +199,7 @@ class qqUploadedFileXhr {
|
|||
function save() {
|
||||
$input = fopen("php://input", "r");
|
||||
|
||||
$upload_dir = get_config('system','tempdir');
|
||||
$upload_dir = Config::get('system','tempdir');
|
||||
if(! $upload_dir)
|
||||
$upload_dir = sys_get_temp_dir();
|
||||
|
||||
|
@ -315,7 +317,7 @@ class qqFileUploader {
|
|||
// }
|
||||
|
||||
|
||||
$maximagesize = get_config('system','maximagesize');
|
||||
$maximagesize = Config::get('system','maximagesize');
|
||||
|
||||
if(($maximagesize) && ($size > $maximagesize)) {
|
||||
return array('error' => t('Image exceeds size limit of ') . $maximagesize );
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function krynn_install() {
|
||||
|
||||
|
@ -81,7 +82,7 @@ function krynn_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = get_pconfig(local_user(), 'krynn', 'enable');
|
||||
$active = PConfig::get(local_user(), 'krynn', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -119,7 +120,7 @@ function krynn_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['krynn-submit'])
|
||||
set_pconfig(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
PConfig::set(local_user(),'krynn','enable',intval($_POST['krynn']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,7 +144,7 @@ function krynn_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'krynn','enable');
|
||||
$enabled = PConfig::get(local_user(),'krynn','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
|
||||
require_once('include/user.php');
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
|
||||
function ldapauth_install() {
|
||||
register_hook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
|
||||
|
@ -78,15 +80,15 @@ function ldapauth_hook_authenticate($a,&$b) {
|
|||
|
||||
function ldapauth_authenticate($username,$password) {
|
||||
|
||||
$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');
|
||||
$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');
|
||||
|
||||
if(! ((strlen($password))
|
||||
&& (function_exists('ldap_connect'))
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -115,12 +117,12 @@ function leistungsschutzrecht_fetchsites() {
|
|||
*/
|
||||
|
||||
if (sizeof($sites)) {
|
||||
set_config('leistungsschutzrecht','sites',$sites);
|
||||
Config::set('leistungsschutzrecht','sites',$sites);
|
||||
}
|
||||
}
|
||||
|
||||
function leistungsschutzrecht_is_member_site($url) {
|
||||
$sites = get_config('leistungsschutzrecht','sites');
|
||||
$sites = Config::get('leistungsschutzrecht','sites');
|
||||
|
||||
if ($sites == "")
|
||||
return(false);
|
||||
|
@ -142,7 +144,7 @@ function leistungsschutzrecht_is_member_site($url) {
|
|||
}
|
||||
|
||||
function leistungsschutzrecht_cron($a,$b) {
|
||||
$last = get_config('leistungsschutzrecht','last_poll');
|
||||
$last = Config::get('leistungsschutzrecht','last_poll');
|
||||
|
||||
if($last) {
|
||||
$next = $last + 86400;
|
||||
|
@ -152,6 +154,6 @@ function leistungsschutzrecht_cron($a,$b) {
|
|||
}
|
||||
}
|
||||
leistungsschutzrecht_fetchsites();
|
||||
set_config('leistungsschutzrecht','last_poll', time());
|
||||
Config::set('leistungsschutzrecht','last_poll', time());
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Author: Tony Baldwin <https://free-haven.org/u/tony>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -28,9 +30,9 @@ function libertree_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$ltree_post = get_pconfig(local_user(),'libertree','post');
|
||||
$ltree_post = PConfig::get(local_user(),'libertree','post');
|
||||
if(intval($ltree_post) == 1) {
|
||||
$ltree_defpost = get_pconfig(local_user(),'libertree','post_by_default');
|
||||
$ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default');
|
||||
$selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to libertree') . '</div>';
|
||||
|
@ -49,16 +51,16 @@ function libertree_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'libertree','post');
|
||||
$enabled = PConfig::get(local_user(),'libertree','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'libertree','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'libertree','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$ltree_api_token = get_pconfig(local_user(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = get_pconfig(local_user(), 'libertree', 'libertree_url');
|
||||
$ltree_api_token = PConfig::get(local_user(), 'libertree', 'libertree_api_token');
|
||||
$ltree_url = PConfig::get(local_user(), 'libertree', 'libertree_url');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -102,10 +104,10 @@ function libertree_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'libertree-submit')) {
|
||||
|
||||
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']));
|
||||
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']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -127,11 +129,11 @@ function libertree_post_local(&$a,&$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$ltree_post = intval(get_pconfig(local_user(),'libertree','post'));
|
||||
$ltree_post = intval(PConfig::get(local_user(),'libertree','post'));
|
||||
|
||||
$ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(),'libertree','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'libertree','post_by_default'))) {
|
||||
$ltree_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -163,8 +165,8 @@ function libertree_send(&$a,&$b) {
|
|||
return;
|
||||
|
||||
|
||||
$ltree_api_token = get_pconfig($b['uid'],'libertree','libertree_api_token');
|
||||
$ltree_url = get_pconfig($b['uid'],'libertree','libertree_url');
|
||||
$ltree_api_token = PConfig::get($b['uid'],'libertree','libertree_api_token');
|
||||
$ltree_url = PConfig::get($b['uid'],'libertree','libertree_url');
|
||||
$ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
|
||||
$ltree_source = $a->get_hostname();
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
/**
|
||||
* Installs the plugin hook
|
||||
*/
|
||||
|
@ -36,11 +38,11 @@ function libravatar_uninstall() {
|
|||
* @param &$b array
|
||||
*/
|
||||
function libravatar_lookup($a, &$b) {
|
||||
$default_avatar = get_config('libravatar', 'default_img');
|
||||
$default_avatar = Config::get('libravatar', 'default_img');
|
||||
|
||||
if (! $default_avatar) {
|
||||
// if not set, look up if there was one from the gravatar addon
|
||||
$default_avatar = get_config('gravatar', 'default_img');
|
||||
$default_avatar = Config::get('gravatar', 'default_img');
|
||||
// setting default avatar if nothing configured
|
||||
if (! $default_avatar)
|
||||
$default_avatar = 'identicon'; // default image will be a random pattern
|
||||
|
@ -62,7 +64,7 @@ function libravatar_lookup($a, &$b) {
|
|||
function libravatar_plugin_admin (&$a, &$o) {
|
||||
$t = get_markup_template( "admin.tpl", "addon/libravatar" );
|
||||
|
||||
$default_avatar = get_config('libravatar', 'default_img');
|
||||
$default_avatar = Config::get('libravatar', 'default_img');
|
||||
|
||||
// set default values for first configuration
|
||||
if(! $default_avatar)
|
||||
|
@ -108,7 +110,7 @@ function libravatar_plugin_admin_post (&$a) {
|
|||
check_form_security_token('libravatarrsave');
|
||||
|
||||
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
|
||||
set_config('libravatar', 'default_img', $default_avatar);
|
||||
Config::set('libravatar', 'default_img', $default_avatar);
|
||||
info(t('Libravatar settings updated.') .EOL);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -31,9 +33,9 @@ function ljpost_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$lj_post = get_pconfig(local_user(),'ljpost','post');
|
||||
$lj_post = PConfig::get(local_user(),'ljpost','post');
|
||||
if(intval($lj_post) == 1) {
|
||||
$lj_defpost = get_pconfig(local_user(),'ljpost','post_by_default');
|
||||
$lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default');
|
||||
$selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> '
|
||||
. t('Post to LiveJournal') . '</div>';
|
||||
|
@ -52,16 +54,16 @@ function ljpost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'ljpost','post');
|
||||
$enabled = PConfig::get(local_user(),'ljpost','post');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'ljpost','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'ljpost','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$lj_username = get_pconfig(local_user(), 'ljpost', 'lj_username');
|
||||
$lj_password = get_pconfig(local_user(), 'ljpost', 'lj_password');
|
||||
$lj_username = PConfig::get(local_user(), 'ljpost', 'lj_username');
|
||||
$lj_password = PConfig::get(local_user(), 'ljpost', 'lj_password');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -99,10 +101,10 @@ function ljpost_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'ljpost-submit')) {
|
||||
|
||||
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']));
|
||||
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']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,11 +123,11 @@ function ljpost_post_local(&$a,&$b) {
|
|||
if($b['private'] || $b['parent'])
|
||||
return;
|
||||
|
||||
$lj_post = intval(get_pconfig(local_user(),'ljpost','post'));
|
||||
$lj_post = intval(PConfig::get(local_user(),'ljpost','post'));
|
||||
|
||||
$lj_enable = (($lj_post && x($_REQUEST,'ljpost_enable')) ? intval($_REQUEST['ljpost_enable']) : 0);
|
||||
|
||||
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ljpost','post_by_default')))
|
||||
if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ljpost','post_by_default')))
|
||||
$lj_enable = 1;
|
||||
|
||||
if(! $lj_enable)
|
||||
|
@ -162,13 +164,13 @@ function ljpost_send(&$a,&$b) {
|
|||
if($x && strlen($x[0]['timezone']))
|
||||
$tz = $x[0]['timezone'];
|
||||
|
||||
$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'));
|
||||
$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'));
|
||||
// if(! $lj_journal)
|
||||
// $lj_journal = $lj_username;
|
||||
|
||||
$lj_blog = xmlify(get_pconfig($b['uid'],'ljpost','lj_blog'));
|
||||
$lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog'));
|
||||
if(! strlen($lj_blog))
|
||||
$lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc');
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* Author: Matthew Exon <http://mat.exon.name>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -13,37 +16,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 (get_config('mailstream', 'dbversion') == '0.1') {
|
||||
if (Config::get('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');
|
||||
set_config('mailstream', 'dbversion', '0.2');
|
||||
Config::set('mailstream', 'dbversion', '0.2');
|
||||
}
|
||||
if (get_config('mailstream', 'dbversion') == '0.2') {
|
||||
if (Config::get('mailstream', 'dbversion') == '0.2') {
|
||||
q('DELETE FROM `pconfig` WHERE `cat` = "mailstream" AND `k` = "delay"');
|
||||
set_config('mailstream', 'dbversion', '0.3');
|
||||
Config::set('mailstream', 'dbversion', '0.3');
|
||||
}
|
||||
if (get_config('mailstream', 'dbversion') == '0.3') {
|
||||
if (Config::get('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');
|
||||
set_config('mailstream', 'dbversion', '0.4');
|
||||
Config::set('mailstream', 'dbversion', '0.4');
|
||||
}
|
||||
if (get_config('mailstream', 'dbversion') == '0.4') {
|
||||
if (Config::get('mailstream', 'dbversion') == '0.4') {
|
||||
q('ALTER TABLE `mailstream_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
|
||||
set_config('mailstream', 'dbversion', '0.5');
|
||||
Config::set('mailstream', 'dbversion', '0.5');
|
||||
}
|
||||
if (get_config('mailstream', 'dbversion') == '0.5') {
|
||||
set_config('mailstream', 'dbversion', '1.0');
|
||||
if (Config::get('mailstream', 'dbversion') == '0.5') {
|
||||
Config::set('mailstream', 'dbversion', '1.0');
|
||||
}
|
||||
|
||||
if (get_config('retriever', 'dbversion') != '1.0') {
|
||||
if (Config::get('retriever', 'dbversion') != '1.0') {
|
||||
$schema = file_get_contents(dirname(__file__).'/database.sql');
|
||||
$arr = explode(';', $schema);
|
||||
foreach ($arr as $a) {
|
||||
$r = q($a);
|
||||
}
|
||||
set_config('mailstream', 'dbversion', '1.0');
|
||||
Config::set('mailstream', 'dbversion', '1.0');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +66,7 @@ function mailstream_uninstall() {
|
|||
function mailstream_module() {}
|
||||
|
||||
function mailstream_plugin_admin(&$a,&$o) {
|
||||
$frommail = get_config('mailstream', 'frommail');
|
||||
$frommail = Config::get('mailstream', 'frommail');
|
||||
$template = get_markup_template('admin.tpl', 'addon/mailstream/');
|
||||
$config = array('frommail',
|
||||
t('From Address'),
|
||||
|
@ -76,7 +79,7 @@ function mailstream_plugin_admin(&$a,&$o) {
|
|||
|
||||
function mailstream_plugin_admin_post ($a) {
|
||||
if (x($_POST, 'frommail')) {
|
||||
set_config('mailstream', 'frommail', $_POST['frommail']);
|
||||
Config::set('mailstream', 'frommail', $_POST['frommail']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +93,7 @@ function mailstream_generate_id($a, $uri) {
|
|||
}
|
||||
|
||||
function mailstream_post_hook(&$a, &$item) {
|
||||
if (!get_pconfig($item['uid'], 'mailstream', 'enabled')) {
|
||||
if (!PConfig::get($item['uid'], 'mailstream', 'enabled')) {
|
||||
return;
|
||||
}
|
||||
if (!$item['uid']) {
|
||||
|
@ -102,7 +105,7 @@ function mailstream_post_hook(&$a, &$item) {
|
|||
if (!$item['uri']) {
|
||||
return;
|
||||
}
|
||||
if (get_pconfig($item['uid'], 'mailstream', 'nolikes')) {
|
||||
if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) {
|
||||
if ($item['verb'] == ACTIVITY_LIKE) {
|
||||
return;
|
||||
}
|
||||
|
@ -139,7 +142,7 @@ function mailstream_get_user($uid) {
|
|||
}
|
||||
|
||||
function mailstream_do_images($a, &$item, &$attachments) {
|
||||
if (!get_pconfig($item['uid'], 'mailstream', 'attachimg')) {
|
||||
if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
|
||||
return;
|
||||
}
|
||||
$attachments = array();
|
||||
|
@ -252,11 +255,11 @@ function mailstream_send($a, $message_id, $item, $user) {
|
|||
require_once('include/bbcode.php');
|
||||
$attachments = array();
|
||||
mailstream_do_images($a, $item, $attachments);
|
||||
$frommail = get_config('mailstream', 'frommail');
|
||||
$frommail = Config::get('mailstream', 'frommail');
|
||||
if ($frommail == "") {
|
||||
$frommail = 'friendica@localhost.local';
|
||||
}
|
||||
$address = get_pconfig($item['uid'], 'mailstream', 'address');
|
||||
$address = PConfig::get($item['uid'], 'mailstream', 'address');
|
||||
if (!$address) {
|
||||
$address = $user['email'];
|
||||
}
|
||||
|
@ -343,10 +346,10 @@ function mailstream_cron($a, $b) {
|
|||
}
|
||||
|
||||
function mailstream_plugin_settings(&$a,&$s) {
|
||||
$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');
|
||||
$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');
|
||||
$template = get_markup_template('settings.tpl', 'addon/mailstream/');
|
||||
$s .= replace_macros($template, array(
|
||||
'$enabled' => array(
|
||||
|
@ -374,25 +377,25 @@ function mailstream_plugin_settings(&$a,&$s) {
|
|||
|
||||
function mailstream_plugin_settings_post($a,$post) {
|
||||
if ($_POST['mailstream_address'] != "") {
|
||||
set_pconfig(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
|
||||
PConfig::set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
|
||||
}
|
||||
else {
|
||||
del_pconfig(local_user(), 'mailstream', 'address');
|
||||
}
|
||||
if ($_POST['mailstream_nolikes']) {
|
||||
set_pconfig(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
|
||||
PConfig::set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
|
||||
}
|
||||
else {
|
||||
del_pconfig(local_user(), 'mailstream', 'nolikes');
|
||||
}
|
||||
if ($_POST['mailstream_enabled']) {
|
||||
set_pconfig(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
|
||||
PConfig::set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
|
||||
}
|
||||
else {
|
||||
del_pconfig(local_user(), 'mailstream', 'enabled');
|
||||
}
|
||||
if ($_POST['mailstream_attachimg']) {
|
||||
set_pconfig(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
|
||||
PConfig::set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
|
||||
}
|
||||
else {
|
||||
del_pconfig(local_user(), 'mailstream', 'attachimg');
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
* 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');
|
||||
|
@ -25,12 +28,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;
|
||||
set_pconfig(local_user(),'mathjax','use',intval($_POST['mathjax_use']));
|
||||
PConfig::set(local_user(),'mathjax','use',intval($_POST['mathjax_use']));
|
||||
}
|
||||
function mathjax_settings (&$a, &$s) {
|
||||
if (! local_user())
|
||||
return;
|
||||
$use = get_pconfig(local_user(),'mathjax','use');
|
||||
$use = PConfig::get(local_user(),'mathjax','use');
|
||||
$usetext = (($use) ? ' checked="checked" ' : '');
|
||||
$s .= '<span id="settings_mathjax_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">';
|
||||
$s .= '<h3>MathJax '.t('Settings').'</h3>';
|
||||
|
@ -53,13 +56,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 = get_config ('mathjax','baseurl');
|
||||
$url = Config::get ('mathjax','baseurl');
|
||||
if(! $url)
|
||||
$url = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
||||
if (! local_user()) {
|
||||
$b .= '<script type="text/javascript" src="'.$url.'"></script>';
|
||||
} else {
|
||||
$use = get_pconfig(local_user(),'mathjax','use');
|
||||
$use = PConfig::get(local_user(),'mathjax','use');
|
||||
if ($use) {
|
||||
$b .= '<script type="text/javascript" src="'.$url.'"></script>';
|
||||
}
|
||||
|
@ -67,17 +70,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');
|
||||
set_config('mathjax','baseurl',$baseurl);
|
||||
Config::set('mathjax','baseurl',$baseurl);
|
||||
info( t('Settings updated.'). EOL);
|
||||
}
|
||||
function mathjax_plugin_admin (&$a, &$o) {
|
||||
$t = get_markup_template( "admin.tpl", "addon/mathjax/" );
|
||||
if (get_config('mathjax','baseurl','') == '') {
|
||||
set_config('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
|
||||
if (Config::get('mathjax','baseurl','') == '') {
|
||||
Config::set('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'), 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.')),
|
||||
'$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.')),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
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');
|
||||
|
@ -22,11 +24,11 @@ function newmemberwidget_network_mod_init ( $a, $b) {
|
|||
$t = '<div id="newmember_widget" class="widget">'.EOL;
|
||||
$t .= '<h3>'.t('New Member').'</h3>'.EOL;
|
||||
$t .= '<a href="newmember" id="newmemberwidget-tips">' . t('Tips for New Members') . '</a><br />'.EOL;
|
||||
if (get_config('newmemberwidget','linkglobalsupport')==1)
|
||||
if (Config::get('newmemberwidget','linkglobalsupport')==1)
|
||||
$t .= '<a href="https://forum.friendi.ca/profile/helpers" target="_new">'.t('Global Support Forum').'</a><br />'.EOL;
|
||||
if (get_config('newmemberwidget','linklocalsupport')==1)
|
||||
$t .= '<a href="'.$a->get_baseurl().'/profile/'.get_config('newmemberwidget','localsupport').'" target="_new">'.t('Local Support Forum').'</a><br />'.EOL;
|
||||
$ft = get_config('newmemberwidget','freetext');
|
||||
if (Config::get('newmemberwidget','linklocalsupport')==1)
|
||||
$t .= '<a href="'.$a->get_baseurl().'/profile/'.Config::get('newmemberwidget','localsupport').'" target="_new">'.t('Local Support Forum').'</a><br />'.EOL;
|
||||
$ft = Config::get('newmemberwidget','freetext');
|
||||
if (!trim($ft)=="")
|
||||
$t .= '<p>'.bbcode(trim($ft)).'</p>';
|
||||
$t .= '</div><div class="clear"></div>';
|
||||
|
@ -39,20 +41,20 @@ function newmemberwidget_plugin_admin_post( &$a ) {
|
|||
$lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : "");
|
||||
$gs = intval($_POST['linkglobalsupport']);
|
||||
$ls = intval($_POST['linklocalsupport']);
|
||||
set_config ( 'newmemberwidget', 'freetext', trim($ft));
|
||||
set_config ( 'newmemberwidget', 'linkglobalsupport', $gs);
|
||||
set_config ( 'newmemberwidget', 'linklocalsupport', $ls);
|
||||
set_config ( 'newmemberwidget', 'localsupport', trim($lsn));
|
||||
Config::set ( 'newmemberwidget', 'freetext', trim($ft));
|
||||
Config::set ( 'newmemberwidget', 'linkglobalsupport', $gs);
|
||||
Config::set ( 'newmemberwidget', 'linklocalsupport', $ls);
|
||||
Config::set ( '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"), 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?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"),
|
||||
'$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 <em>nickname</em> of the local support group here (i.e. helpers)')),
|
||||
'$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?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"),
|
||||
'$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 <em>nickname</em> of the local support group here (i.e. helpers)')),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function notimeline_install() {
|
||||
|
||||
|
@ -28,7 +29,7 @@ function notimeline_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'notimeline-submit')))
|
||||
return;
|
||||
|
||||
set_pconfig(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline']));
|
||||
PConfig::set(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline']));
|
||||
info( t('No Timeline settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ function notimeline_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$notimeline = get_pconfig(local_user(),'system','no_wall_archive_widget');
|
||||
$notimeline = PConfig::get(local_user(),'system','no_wall_archive_widget');
|
||||
if($notimeline === false)
|
||||
$notimeline = false;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -69,8 +71,8 @@ function nsfw_addon_settings(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/nsfw/nsfw.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$enable_checked = (intval(get_pconfig(local_user(),'nsfw','disable')) ? '' : ' checked="checked" ');
|
||||
$words = get_pconfig(local_user(),'nsfw','words');
|
||||
$enable_checked = (intval(PConfig::get(local_user(),'nsfw','disable')) ? '' : ' checked="checked" ');
|
||||
$words = PConfig::get(local_user(),'nsfw','words');
|
||||
if(! $words)
|
||||
$words = 'nsfw,';
|
||||
|
||||
|
@ -104,10 +106,10 @@ function nsfw_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['nsfw-submit']) {
|
||||
set_pconfig(local_user(),'nsfw','words',trim($_POST['nsfw-words']));
|
||||
PConfig::set(local_user(),'nsfw','words',trim($_POST['nsfw-words']));
|
||||
$enable = ((x($_POST,'nsfw-enable')) ? intval($_POST['nsfw-enable']) : 0);
|
||||
$disable = 1-$enable;
|
||||
set_pconfig(local_user(),'nsfw','disable', $disable);
|
||||
PConfig::set(local_user(),'nsfw','disable', $disable);
|
||||
info( t('NSFW Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -116,11 +118,11 @@ function nsfw_prepare_body(&$a,&$b) {
|
|||
|
||||
|
||||
$words = null;
|
||||
if(get_pconfig(local_user(),'nsfw','disable'))
|
||||
if(PConfig::get(local_user(),'nsfw','disable'))
|
||||
return;
|
||||
|
||||
if(local_user()) {
|
||||
$words = get_pconfig(local_user(),'nsfw','words');
|
||||
$words = PConfig::get(local_user(),'nsfw','words');
|
||||
}
|
||||
if($words) {
|
||||
$arr = explode(',',$words);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function numfriends_install() {
|
||||
|
||||
|
@ -42,7 +43,7 @@ function numfriends_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'numfriends-submit')))
|
||||
return;
|
||||
|
||||
set_pconfig(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
|
||||
PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
|
||||
info( t('Numfriends settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -67,7 +68,7 @@ function numfriends_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$numfriends = get_pconfig(local_user(),'system','display_friend_count');
|
||||
$numfriends = PConfig::get(local_user(),'system','display_friend_count');
|
||||
if($numfriends === false)
|
||||
$numfriends = 24;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
require_once('include/cache.php');
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
|
||||
function openstreetmap_install() {
|
||||
register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
|
||||
|
@ -57,19 +59,19 @@ function openstreetmap_location($a, &$item) {
|
|||
* ?mlat=lat&mlon=lon for markers.
|
||||
*/
|
||||
|
||||
$tmsserver = get_config('openstreetmap', 'tmsserver');
|
||||
$tmsserver = Config::get('openstreetmap', 'tmsserver');
|
||||
if(! $tmsserver)
|
||||
$tmsserver = 'http://www.openstreetmap.org';
|
||||
|
||||
$nomserver = get_config('openstreetmap', 'nomserver');
|
||||
$nomserver = Config::get('openstreetmap', 'nomserver');
|
||||
if(! $nomserver)
|
||||
$nomserver = 'http://nominatim.openstreetmap.org/search.php';
|
||||
|
||||
$zoom = get_config('openstreetmap', 'zoom');
|
||||
$zoom = Config::get('openstreetmap', 'zoom');
|
||||
if(! $zoom)
|
||||
$zoom = 16;
|
||||
|
||||
$marker = get_config('openstreetmap', 'marker');
|
||||
$marker = Config::get('openstreetmap', 'marker');
|
||||
if(! $marker)
|
||||
$marker = 0;
|
||||
|
||||
|
@ -100,7 +102,7 @@ function openstreetmap_location($a, &$item) {
|
|||
function openstreetmap_generate_named_map(&$a,&$b) {
|
||||
|
||||
|
||||
$nomserver = get_config('openstreetmap', 'nomserver');
|
||||
$nomserver = Config::get('openstreetmap', 'nomserver');
|
||||
if(! $nomserver)
|
||||
$nomserver = 'http://nominatim.openstreetmap.org/search.php';
|
||||
$args = '?q=' . urlencode($b['location']) . '&format=json';
|
||||
|
@ -119,18 +121,18 @@ function openstreetmap_generate_named_map(&$a,&$b) {
|
|||
|
||||
function openstreetmap_generate_map(&$a,&$b) {
|
||||
|
||||
$tmsserver = get_config('openstreetmap', 'tmsserver');
|
||||
$tmsserver = Config::get('openstreetmap', 'tmsserver');
|
||||
if(! $tmsserver)
|
||||
$tmsserver = 'http://www.openstreetmap.org';
|
||||
if(strpos(z_root(),'https:') !== false)
|
||||
$tmsserver = str_replace('http:','https:',$tmsserver);
|
||||
|
||||
|
||||
$zoom = get_config('openstreetmap', 'zoom');
|
||||
$zoom = Config::get('openstreetmap', 'zoom');
|
||||
if(! $zoom)
|
||||
$zoom = 16;
|
||||
|
||||
$marker = get_config('openstreetmap', 'marker');
|
||||
$marker = Config::get('openstreetmap', 'marker');
|
||||
if(! $marker)
|
||||
$marker = 0;
|
||||
|
||||
|
@ -151,16 +153,16 @@ function openstreetmap_generate_map(&$a,&$b) {
|
|||
|
||||
function openstreetmap_plugin_admin(&$a, &$o) {
|
||||
$t = get_markup_template("admin.tpl", "addon/openstreetmap/");
|
||||
$tmsserver = get_config('openstreetmap', 'tmsserver');
|
||||
$tmsserver = Config::get('openstreetmap', 'tmsserver');
|
||||
if(! $tmsserver)
|
||||
$tmsserver = 'http://www.openstreetmap.org';
|
||||
$nomserver = get_config('openstreetmap', 'nomserver');
|
||||
$nomserver = Config::get('openstreetmap', 'nomserver');
|
||||
if(! $nomserver)
|
||||
$nomserver = 'http://nominatim.openstreetmap.org/search.php';
|
||||
$zoom = get_config('openstreetmap', 'zoom');
|
||||
$zoom = Config::get('openstreetmap', 'zoom');
|
||||
if(! $zoom)
|
||||
$zoom = 16;
|
||||
$marker = get_config('openstreetmap', 'marker');
|
||||
$marker = Config::get('openstreetmap', 'marker');
|
||||
if(! $marker)
|
||||
$marker = 0;
|
||||
|
||||
|
@ -177,10 +179,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');
|
||||
set_config('openstreetmap', 'tmsserver', $urltms);
|
||||
set_config('openstreetmap', 'nomserver', $urlnom);
|
||||
set_config('openstreetmap', 'zoom', $zoom);
|
||||
set_config('openstreetmap', 'marker', $marker);
|
||||
Config::set('openstreetmap', 'tmsserver', $urltms);
|
||||
Config::set('openstreetmap', 'nomserver', $urlnom);
|
||||
Config::set('openstreetmap', 'zoom', $zoom);
|
||||
Config::set('openstreetmap', 'marker', $marker);
|
||||
info( t('Settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -43,7 +45,7 @@ function pageheader_addon_settings(&$a,&$s) {
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/pageheader/pageheader.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
|
||||
$words = get_config('pageheader','text');
|
||||
$words = Config::get('pageheader','text');
|
||||
if(! $words)
|
||||
$words = '';
|
||||
|
||||
|
@ -66,7 +68,7 @@ function pageheader_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['pageheader-submit']) {
|
||||
set_config('pageheader','text',trim(strip_tags($_POST['pageheader-words'])));
|
||||
Config::set('pageheader','text',trim(strip_tags($_POST['pageheader-words'])));
|
||||
info( t('pageheader Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +78,7 @@ function pageheader_fetch($a,&$b) {
|
|||
if(file_exists('pageheader.html')){
|
||||
$s = file_get_contents('pageheader.html');
|
||||
} else {
|
||||
$s = get_config('pageheader', 'text');
|
||||
$s = Config::get('pageheader', 'text');
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
* setting.
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function piwik_install() {
|
||||
register_hook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
||||
|
||||
|
@ -54,10 +56,10 @@ function piwik_analytics($a,&$b) {
|
|||
/*
|
||||
* Get the configuration variables from the .htconfig file.
|
||||
*/
|
||||
$baseurl = get_config('piwik','baseurl');
|
||||
$siteid = get_config('piwik','siteid');
|
||||
$optout = get_config('piwik','optout');
|
||||
$async = get_config('piwik','async');
|
||||
$baseurl = Config::get('piwik','baseurl');
|
||||
$siteid = Config::get('piwik','siteid');
|
||||
$optout = Config::get('piwik','optout');
|
||||
$async = Config::get('piwik','async');
|
||||
|
||||
/*
|
||||
* Add the Piwik tracking code for the site.
|
||||
|
@ -87,10 +89,10 @@ function piwik_plugin_admin (&$a, &$o) {
|
|||
$t = get_markup_template( "admin.tpl", "addon/piwik/" );
|
||||
$o = replace_macros( $t, array(
|
||||
'$submit' => t('Save Settings'),
|
||||
'$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' ), ''),
|
||||
'$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' ), ''),
|
||||
));
|
||||
}
|
||||
function piwik_plugin_admin_post (&$a) {
|
||||
|
@ -98,9 +100,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']) : '');
|
||||
set_config('piwik', 'baseurl', $url);
|
||||
set_config('piwik', 'siteid', $id);
|
||||
set_config('piwik', 'optout', $optout);
|
||||
set_config('piwik', 'async', $async);
|
||||
Config::set('piwik', 'baseurl', $url);
|
||||
Config::set('piwik', 'siteid', $id);
|
||||
Config::set('piwik', 'optout', $optout);
|
||||
Config::set('piwik', 'async', $async);
|
||||
info( t('Settings updated.'). EOL);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* Author: Tony Baldwin <https://free-haven.org/profile/tony>
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function planets_install() {
|
||||
|
||||
|
@ -78,7 +79,7 @@ function planets_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = get_pconfig(local_user(), 'planets', 'enable');
|
||||
$active = PConfig::get(local_user(), 'planets', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -116,7 +117,7 @@ function planets_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['planets-submit'])
|
||||
set_pconfig(local_user(),'planets','enable',intval($_POST['planets']));
|
||||
PConfig::set(local_user(),'planets','enable',intval($_POST['planets']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,7 +141,7 @@ function planets_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'planets','enable');
|
||||
$enabled = PConfig::get(local_user(),'planets','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -29,8 +31,8 @@ function pledgie_addon_settings(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/pledgie/pledgie.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$campaign = get_config('pledgie-campaign','text');
|
||||
$describe = get_config('pledgie-describe','text');
|
||||
$campaign = Config::get('pledgie-campaign','text');
|
||||
$describe = Config::get('pledgie-describe','text');
|
||||
|
||||
if(! $campaign)
|
||||
$campaign = '';
|
||||
|
@ -61,15 +63,15 @@ function pledgie_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['pledgie-submit']) {
|
||||
set_config('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe'])));
|
||||
set_config('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign'])));
|
||||
Config::set('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe'])));
|
||||
Config::set('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign'])));
|
||||
info( t('pledgie Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function pledgie_active(&$a,&$b) {
|
||||
$campaign = get_config('pledgie-campaign','text');
|
||||
$describe = get_config('pledgie-describe','text');
|
||||
$campaign = Config::get('pledgie-campaign','text');
|
||||
$describe = Config::get('pledgie-describe','text');
|
||||
$b .= '<div style="position: fixed; padding:5px; border-style:dotted; border-width:1px; background-color: white; line-height: 1; bottom: 5px; left: 20px; z-index: 1000; width: 150px; font-size: 12px;">';
|
||||
$b .= $describe . '<br/><a href="https://pledgie.com/campaigns/';
|
||||
$b .= $campaign;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
|
||||
*/
|
||||
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
|
||||
function public_server_install() {
|
||||
|
@ -31,8 +31,8 @@ function public_server_register_account($a,$b) {
|
|||
|
||||
$uid = $b;
|
||||
|
||||
$days = get_config('public_server','expiredays');
|
||||
$days_posts = get_config('public_server','expireposts');
|
||||
$days = Config::get('public_server','expiredays');
|
||||
$days_posts = Config::get('public_server','expireposts');
|
||||
if(! $days)
|
||||
return;
|
||||
|
||||
|
@ -80,7 +80,7 @@ function public_server_cron($a,$b) {
|
|||
user_remove($rr['uid']);
|
||||
|
||||
}
|
||||
$nologin = get_config('public_server','nologin');
|
||||
$nologin = Config::get('public_server','nologin');
|
||||
if($nologin) {
|
||||
$r = q("select uid from user where account_expired = 0 and login_date = '0000-00-00 00:00:00' and register_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00'",intval($nologin));
|
||||
if(count($r)) {
|
||||
|
@ -93,7 +93,7 @@ function public_server_cron($a,$b) {
|
|||
}
|
||||
|
||||
|
||||
$flagusers = get_config('public_server','flagusers');
|
||||
$flagusers = Config::get('public_server','flagusers');
|
||||
if($flagusers) {
|
||||
$r = q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and `page-flags` = 0",intval($flagusers));
|
||||
if(count($r)) {
|
||||
|
@ -105,8 +105,8 @@ function public_server_cron($a,$b) {
|
|||
}
|
||||
}
|
||||
|
||||
$flagposts = get_config('public_server','flagposts');
|
||||
$flagpostsexpire = get_config('public_server','flagpostsexpire');
|
||||
$flagposts = Config::get('public_server','flagposts');
|
||||
$flagpostsexpire = Config::get('public_server','flagpostsexpire');
|
||||
if ($flagposts && $flagpostsexpire) {
|
||||
$r = q("select uid from user where account_expired = 0 and login_date < UTC_TIMESTAMP() - INTERVAL %d DAY and account_expires_on = '0000-00-00 00:00:00' and expire = 0 and `page-flags` = 0",intval($flagposts));
|
||||
if(count($r)) {
|
||||
|
@ -126,14 +126,14 @@ function public_server_enotify(&$a, &$b) {
|
|||
if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
|
||||
&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') {
|
||||
$b['itemlink'] = $a->get_baseurl();
|
||||
$b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), get_config('system','sitename'));
|
||||
$b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('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 = get_config('public_server','expiredays');
|
||||
$days = Config::get('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'] )) : '');
|
||||
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 );
|
||||
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 );
|
||||
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(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'))),
|
||||
'$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'))),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ 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() {
|
||||
|
@ -64,8 +67,8 @@ function pumpio_content(&$a) {
|
|||
}
|
||||
|
||||
function pumpio_check_item_notification($a, &$notification_data) {
|
||||
$hostname = get_pconfig($notification_data["uid"], 'pumpio','host');
|
||||
$username = get_pconfig($notification_data["uid"], "pumpio", "user");
|
||||
$hostname = PConfig::get($notification_data["uid"], 'pumpio','host');
|
||||
$username = PConfig::get($notification_data["uid"], "pumpio", "user");
|
||||
|
||||
$notification_data["profiles"][] = "https://".$hostname."/".$username;
|
||||
}
|
||||
|
@ -77,7 +80,7 @@ function pumpio_registerclient(&$a, $host) {
|
|||
|
||||
$params = array();
|
||||
|
||||
$application_name = get_config('pumpio', 'application_name');
|
||||
$application_name = Config::get('pumpio', 'application_name');
|
||||
|
||||
if ($application_name == "")
|
||||
$application_name = $a->get_hostname();
|
||||
|
@ -118,18 +121,18 @@ function pumpio_connect(&$a) {
|
|||
session_start();
|
||||
|
||||
// Define the needed keys
|
||||
$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');
|
||||
$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');
|
||||
|
||||
if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) {
|
||||
logger("pumpio_connect: register client");
|
||||
$clientdata = pumpio_registerclient($a, $hostname);
|
||||
set_pconfig(local_user(), 'pumpio','consumer_key', $clientdata->client_id);
|
||||
set_pconfig(local_user(), 'pumpio','consumer_secret', $clientdata->client_secret);
|
||||
PConfig::set(local_user(), 'pumpio','consumer_key', $clientdata->client_id);
|
||||
PConfig::set(local_user(), 'pumpio','consumer_secret', $clientdata->client_secret);
|
||||
|
||||
$consumer_key = get_pconfig(local_user(), 'pumpio','consumer_key');
|
||||
$consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
|
||||
$consumer_key = PConfig::get(local_user(), 'pumpio','consumer_key');
|
||||
$consumer_secret = PConfig::get(local_user(), 'pumpio','consumer_secret');
|
||||
|
||||
logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
|
||||
}
|
||||
|
@ -166,8 +169,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);
|
||||
set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token);
|
||||
set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
||||
PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token);
|
||||
PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
||||
}
|
||||
}
|
||||
$success = $client->Finalize($success);
|
||||
|
@ -191,9 +194,9 @@ function pumpio_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$pumpio_post = get_pconfig(local_user(),'pumpio','post');
|
||||
$pumpio_post = PConfig::get(local_user(),'pumpio','post');
|
||||
if(intval($pumpio_post) == 1) {
|
||||
$pumpio_defpost = get_pconfig(local_user(),'pumpio','post_by_default');
|
||||
$pumpio_defpost = PConfig::get(local_user(),'pumpio','post_by_default');
|
||||
$selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to pumpio') . '</div>';
|
||||
|
@ -212,24 +215,24 @@ function pumpio_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$import_enabled = get_pconfig(local_user(),'pumpio','import');
|
||||
$import_enabled = PConfig::get(local_user(),'pumpio','import');
|
||||
$import_checked = (($import_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$enabled = get_pconfig(local_user(),'pumpio','post');
|
||||
$enabled = PConfig::get(local_user(),'pumpio','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'pumpio','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'pumpio','post_by_default');
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$public_enabled = get_pconfig(local_user(),'pumpio','public');
|
||||
$public_enabled = PConfig::get(local_user(),'pumpio','public');
|
||||
$public_checked = (($public_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$mirror_enabled = get_pconfig(local_user(),'pumpio','mirror');
|
||||
$mirror_enabled = PConfig::get(local_user(),'pumpio','mirror');
|
||||
$mirror_checked = (($mirror_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$servername = get_pconfig(local_user(), "pumpio", "host");
|
||||
$username = get_pconfig(local_user(), "pumpio", "user");
|
||||
$servername = PConfig::get(local_user(), "pumpio", "host");
|
||||
$username = PConfig::get(local_user(), "pumpio", "user");
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
@ -253,8 +256,8 @@ function pumpio_settings(&$a,&$s) {
|
|||
|
||||
if (($username != '') && ($servername != '')) {
|
||||
|
||||
$oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token");
|
||||
$oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret");
|
||||
$oauth_token = PConfig::get(local_user(), "pumpio", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get(local_user(), "pumpio", "oauth_token_secret");
|
||||
|
||||
$s .= '<div id="pumpio-password-wrapper">';
|
||||
if (($oauth_token == "") || ($oauth_token_secret == "")) {
|
||||
|
@ -306,19 +309,19 @@ function pumpio_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'pumpio-submit')) {
|
||||
if(x($_POST,'pumpio_delete')) {
|
||||
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', '');
|
||||
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', '');
|
||||
} else {
|
||||
// filtering the username if it is filled wrong
|
||||
$user = $_POST['pumpio_user'];
|
||||
|
@ -333,13 +336,13 @@ function pumpio_settings_post(&$a,&$b) {
|
|||
$host = trim($host);
|
||||
$host = str_replace(array("https://", "http://"), array("", ""), $host);
|
||||
|
||||
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']));
|
||||
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']));
|
||||
|
||||
if (!$_POST['pumpio_mirror'])
|
||||
del_pconfig(local_user(),'pumpio','lastdate');
|
||||
|
@ -355,11 +358,11 @@ function pumpio_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$pumpio_post = intval(get_pconfig(local_user(), 'pumpio', 'post'));
|
||||
$pumpio_post = intval(PConfig::get(local_user(), 'pumpio', 'post'));
|
||||
|
||||
$pumpio_enable = (($pumpio_post && x($_REQUEST,'pumpio_enable')) ? intval($_REQUEST['pumpio_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(), 'pumpio', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'pumpio', 'post_by_default'))) {
|
||||
$pumpio_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -379,7 +382,7 @@ function pumpio_post_local(&$a, &$b) {
|
|||
|
||||
function pumpio_send(&$a,&$b) {
|
||||
|
||||
if (!get_pconfig($b["uid"],'pumpio','import')) {
|
||||
if (!PConfig::get($b["uid"],'pumpio','import')) {
|
||||
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||
return;
|
||||
}
|
||||
|
@ -439,14 +442,14 @@ function pumpio_send(&$a,&$b) {
|
|||
// Support for native shares
|
||||
// http://<hostname>/api/<type>/shares?id=<the-object-id>
|
||||
|
||||
$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");
|
||||
$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");
|
||||
|
||||
$host = get_pconfig($b['uid'], "pumpio", "host");
|
||||
$user = get_pconfig($b['uid'], "pumpio", "user");
|
||||
$public = get_pconfig($b['uid'], "pumpio", "public");
|
||||
$host = PConfig::get($b['uid'], "pumpio", "host");
|
||||
$user = PConfig::get($b['uid'], "pumpio", "user");
|
||||
$public = PConfig::get($b['uid'], "pumpio", "public");
|
||||
|
||||
if($oauth_token && $oauth_token_secret) {
|
||||
|
||||
|
@ -516,7 +519,7 @@ function pumpio_send(&$a,&$b) {
|
|||
if($success) {
|
||||
|
||||
if ($user->generator->displayName)
|
||||
set_pconfig($b["uid"], "pumpio", "application_name", $user->generator->displayName);
|
||||
PConfig::set($b["uid"], "pumpio", "application_name", $user->generator->displayName);
|
||||
|
||||
$post_id = $user->object->id;
|
||||
logger('pumpio_send '.$username.': success '.$post_id);
|
||||
|
@ -546,15 +549,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 (!get_pconfig($uid,'pumpio','import'))
|
||||
if (!PConfig::get($uid,'pumpio','import'))
|
||||
return;
|
||||
|
||||
$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");
|
||||
$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");
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($uri),
|
||||
|
@ -625,9 +628,9 @@ function pumpio_sync(&$a) {
|
|||
if (!count($r))
|
||||
return;
|
||||
|
||||
$last = get_config('pumpio','last_poll');
|
||||
$last = Config::get('pumpio','last_poll');
|
||||
|
||||
$poll_interval = intval(get_config('pumpio','poll_interval'));
|
||||
$poll_interval = intval(Config::get('pumpio','poll_interval'));
|
||||
if(! $poll_interval)
|
||||
$poll_interval = PUMPIO_DEFAULT_POLL_INTERVAL;
|
||||
|
||||
|
@ -648,7 +651,7 @@ function pumpio_sync(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||
$abandon_days = intval(Config::get('system','account_abandon_days'));
|
||||
if ($abandon_days < 1)
|
||||
$abandon_days = 0;
|
||||
|
||||
|
@ -669,7 +672,7 @@ function pumpio_sync(&$a) {
|
|||
pumpio_fetchinbox($a, $rr['uid']);
|
||||
|
||||
// check for new contacts once a day
|
||||
$last_contact_check = get_pconfig($rr['uid'],'pumpio','contact_check');
|
||||
$last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check');
|
||||
if($last_contact_check)
|
||||
$next_contact_check = $last_contact_check + 86400;
|
||||
else
|
||||
|
@ -677,14 +680,14 @@ function pumpio_sync(&$a) {
|
|||
|
||||
if($next_contact_check <= time()) {
|
||||
pumpio_getallusers($a, $rr["uid"]);
|
||||
set_pconfig($rr['uid'],'pumpio','contact_check',time());
|
||||
PConfig::set($rr['uid'],'pumpio','contact_check',time());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger('pumpio: cron_end');
|
||||
|
||||
set_config('pumpio','last_poll', time());
|
||||
Config::set('pumpio','last_poll', time());
|
||||
}
|
||||
|
||||
function pumpio_cron(&$a,$b) {
|
||||
|
@ -693,20 +696,20 @@ function pumpio_cron(&$a,$b) {
|
|||
}
|
||||
|
||||
function pumpio_fetchtimeline(&$a, $uid) {
|
||||
$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");
|
||||
$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");
|
||||
|
||||
// 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 = get_pconfig( $uid, 'pumpio', 'application_name');
|
||||
$application_name = PConfig::get( $uid, 'pumpio', 'application_name');
|
||||
if ($application_name == "")
|
||||
$application_name = get_config('pumpio', 'application_name');
|
||||
$application_name = Config::get('pumpio', 'application_name');
|
||||
if ($application_name == "")
|
||||
$application_name = $a->get_hostname();
|
||||
|
||||
|
@ -809,7 +812,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
|
|||
}
|
||||
|
||||
if ($lastdate != 0)
|
||||
set_pconfig($uid,'pumpio','lastdate', $lastdate);
|
||||
PConfig::set($uid,'pumpio','lastdate', $lastdate);
|
||||
}
|
||||
|
||||
function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
|
||||
|
@ -1209,7 +1212,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
|||
$postarray['edited'] = $postarray['created'];
|
||||
|
||||
if ($post->verb == "share") {
|
||||
if (!intval(get_config('system','wall-to-wall_share'))) {
|
||||
if (!intval(Config::get('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 != ""))
|
||||
|
@ -1318,13 +1321,13 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
|||
|
||||
function pumpio_fetchinbox(&$a, $uid) {
|
||||
|
||||
$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");
|
||||
$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");
|
||||
|
||||
$own_id = "https://".$hostname."/".$username;
|
||||
|
||||
|
@ -1349,7 +1352,7 @@ function pumpio_fetchinbox(&$a, $uid) {
|
|||
$client->access_token = $otoken;
|
||||
$client->access_token_secret = $osecret;
|
||||
|
||||
$last_id = get_pconfig($uid,'pumpio','last_id');
|
||||
$last_id = PConfig::get($uid,'pumpio','last_id');
|
||||
|
||||
$url = 'https://'.$hostname.'/api/user/'.$username.'/inbox';
|
||||
|
||||
|
@ -1374,16 +1377,16 @@ function pumpio_fetchinbox(&$a, $uid) {
|
|||
foreach ($lastitems AS $item)
|
||||
pumpio_fetchallcomments($a, $uid, $item["uri"]);
|
||||
|
||||
set_pconfig($uid,'pumpio','last_id', $last_id);
|
||||
PConfig::set($uid,'pumpio','last_id', $last_id);
|
||||
}
|
||||
|
||||
function pumpio_getallusers(&$a, $uid) {
|
||||
$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");
|
||||
$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");
|
||||
|
||||
$client = new oauth_client_class;
|
||||
$client->oauth_version = '1.0a';
|
||||
|
@ -1445,13 +1448,13 @@ function pumpio_queue_hook(&$a,&$b) {
|
|||
|
||||
//logger('pumpio_queue: fetching userdata '.print_r($userdata, true));
|
||||
|
||||
$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");
|
||||
$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");
|
||||
|
||||
$host = get_pconfig($userdata['uid'], "pumpio", "host");
|
||||
$user = get_pconfig($userdata['uid'], "pumpio", "user");
|
||||
$host = PConfig::get($userdata['uid'], "pumpio", "host");
|
||||
$user = PConfig::get($userdata['uid'], "pumpio", "user");
|
||||
|
||||
$success = false;
|
||||
|
||||
|
@ -1509,7 +1512,7 @@ function pumpio_getreceiver(&$a, $b) {
|
|||
if(! strstr($b['postopts'],'pumpio'))
|
||||
return $receiver;
|
||||
|
||||
$public = get_pconfig($b['uid'], "pumpio", "public");
|
||||
$public = PConfig::get($b['uid'], "pumpio", "public");
|
||||
|
||||
if ($public)
|
||||
$receiver["to"][] = Array(
|
||||
|
@ -1586,12 +1589,12 @@ function pumpio_getreceiver(&$a, $b) {
|
|||
}
|
||||
|
||||
function pumpio_fetchallcomments(&$a, $uid, $id) {
|
||||
$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");
|
||||
$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");
|
||||
|
||||
logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id);
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -46,7 +48,7 @@ function qcomment_addon_settings(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/qcomment/qcomment.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$words = get_pconfig(local_user(),'qcomment','words');
|
||||
$words = PConfig::get(local_user(),'qcomment','words');
|
||||
if($words === false)
|
||||
$words = t(':-)') . "\n" . t(':-(') . "\n" . t('lol');
|
||||
|
||||
|
@ -71,7 +73,7 @@ function qcomment_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['qcomment-submit']) {
|
||||
set_pconfig(local_user(),'qcomment','words',xmlify($_POST['qcomment-words']));
|
||||
PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words']));
|
||||
info( t('Quick Comment settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function randplace_install() {
|
||||
|
||||
|
@ -90,7 +91,7 @@ function randplace_post_hook($a, &$item) {
|
|||
|
||||
/* Retrieve our personal config setting */
|
||||
|
||||
$active = get_pconfig(local_user(), 'randplace', 'enable');
|
||||
$active = PConfig::get(local_user(), 'randplace', 'enable');
|
||||
|
||||
if(! $active)
|
||||
return;
|
||||
|
@ -135,7 +136,7 @@ function randplace_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['randplace-submit'])
|
||||
set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace']));
|
||||
PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,7 +160,7 @@ function randplace_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'randplace','enable');
|
||||
$enabled = PConfig::get(local_user(),'randplace','enable');
|
||||
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -25,7 +27,7 @@ function remote_permissions_settings(&$a,&$o) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$global = get_config("remote_perms", "global");
|
||||
$global = Config::get("remote_perms", "global");
|
||||
if($global == 1)
|
||||
return;
|
||||
|
||||
|
@ -35,7 +37,7 @@ function remote_permissions_settings(&$a,&$o) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$remote_perms = get_pconfig(local_user(),'remote_perms','show');
|
||||
$remote_perms = PConfig::get(local_user(),'remote_perms','show');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
@ -54,7 +56,7 @@ function remote_permissions_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'remote-perms-submit')))
|
||||
return;
|
||||
|
||||
set_pconfig(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
|
||||
info( t('Remote Permissions settings updated.') . EOL);
|
||||
}
|
||||
|
||||
|
@ -63,7 +65,7 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if($item_copy['uid'] != local_user())
|
||||
return;
|
||||
|
||||
if(get_config('remote_perms','global') == 0) {
|
||||
if(Config::get('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",
|
||||
|
@ -86,7 +88,7 @@ function remote_permissions_content($a, $item_copy) {
|
|||
if(! $r)
|
||||
return;
|
||||
|
||||
if(get_pconfig($r[0]['uid'],'remote_perms','show') == 0)
|
||||
if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -194,14 +196,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'), 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)
|
||||
'$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)
|
||||
));
|
||||
}
|
||||
|
||||
function remote_permissions_plugin_admin_post(&$a){
|
||||
$choice = ((x($_POST,'remotepermschoice')) ? notags(trim($_POST['remotepermschoice'])) : '');
|
||||
set_config('remote_perms','global',($choice == 1 ? 1 : 0));
|
||||
Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function rendertime_install() {
|
||||
register_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
|
||||
}
|
||||
|
@ -45,7 +47,7 @@ function rendertime_page_end(&$a, &$o) {
|
|||
//round($a->performance["plugin"], 3)
|
||||
)."</div>";
|
||||
|
||||
if (get_config("rendertime", "callstack")) {
|
||||
if (Config::get("rendertime", "callstack")) {
|
||||
$o .= "<pre>";
|
||||
$o .= "\nDatabase Read:\n";
|
||||
foreach ($a->callstack["database"] AS $func => $time) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
require_once 'include/Emailer.php';
|
||||
|
||||
|
@ -55,8 +56,8 @@ function securemail_settings(App &$a, &$s){
|
|||
return;
|
||||
}
|
||||
|
||||
$enable = intval(get_pconfig(local_user(), 'securemail', 'enable'));
|
||||
$publickey = get_pconfig(local_user(), 'securemail', 'pkey');
|
||||
$enable = intval(PConfig::get(local_user(), 'securemail', 'enable'));
|
||||
$publickey = PConfig::get(local_user(), 'securemail', 'pkey');
|
||||
|
||||
$t = get_markup_template('admin.tpl', 'addon/securemail/');
|
||||
|
||||
|
@ -86,9 +87,9 @@ function securemail_settings_post(App &$a, array &$b){
|
|||
}
|
||||
|
||||
if ($_POST['securemail-submit']) {
|
||||
set_pconfig(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
$enable = ((x($_POST, 'securemail-enable')) ? 1 : 0);
|
||||
set_pconfig(local_user(), 'securemail', 'enable', $enable);
|
||||
PConfig::set(local_user(), 'securemail', 'enable', $enable);
|
||||
info(t('Secure Mail Settings saved.') . EOL);
|
||||
|
||||
if ($_POST['securemail-submit'] == t('Save and send test')) {
|
||||
|
@ -118,12 +119,12 @@ function securemail_settings_post(App &$a, array &$b){
|
|||
);
|
||||
|
||||
// enable addon for test
|
||||
set_pconfig(local_user(), 'securemail', 'enable', 1);
|
||||
PConfig::set(local_user(), 'securemail', 'enable', 1);
|
||||
|
||||
$res = Emailer::send($params);
|
||||
|
||||
// revert to saved value
|
||||
set_pconfig(local_user(), 'securemail', 'enable', $enable);
|
||||
PConfig::set(local_user(), 'securemail', 'enable', $enable);
|
||||
|
||||
if ($res) {
|
||||
info(t('Test email sent') . EOL);
|
||||
|
@ -151,12 +152,12 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
|
|||
|
||||
$uid = $b['uid'];
|
||||
|
||||
$enable_checked = get_pconfig($uid, 'securemail', 'enable');
|
||||
$enable_checked = PConfig::get($uid, 'securemail', 'enable');
|
||||
if (!$enable_checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_key_ascii = get_pconfig($uid, 'securemail', 'pkey');
|
||||
$public_key_ascii = PConfig::get($uid, 'securemail', 'pkey');
|
||||
|
||||
preg_match('/-----BEGIN ([A-Za-z ]+)-----/', $public_key_ascii, $matches);
|
||||
$marker = (empty($matches[1])) ? 'MESSAGE' : $matches[1];
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -29,8 +31,8 @@ function showmore_addon_settings(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/showmore/showmore.css'.'" media="all"/>'."\r\n";
|
||||
|
||||
$enable_checked = (intval(get_pconfig(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
|
||||
$chars = get_pconfig(local_user(),'showmore','chars');
|
||||
$enable_checked = (intval(PConfig::get(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
|
||||
$chars = PConfig::get(local_user(),'showmore','chars');
|
||||
if(!$chars)
|
||||
$chars = '1100';
|
||||
|
||||
|
@ -64,10 +66,10 @@ function showmore_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['showmore-submit']) {
|
||||
set_pconfig(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
|
||||
PConfig::set(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
|
||||
$enable = ((x($_POST,'showmore-enable')) ? intval($_POST['showmore-enable']) : 0);
|
||||
$disable = 1-$enable;
|
||||
set_pconfig(local_user(),'showmore','disable', $disable);
|
||||
PConfig::set(local_user(),'showmore','disable', $disable);
|
||||
info( t('Show More Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +109,10 @@ function get_body_length($body) {
|
|||
function showmore_prepare_body(&$a,&$b) {
|
||||
|
||||
$words = null;
|
||||
if(get_pconfig(local_user(),'showmore','disable'))
|
||||
if(PConfig::get(local_user(),'showmore','disable'))
|
||||
return;
|
||||
|
||||
$chars = (int)get_pconfig(local_user(),'showmore','chars');
|
||||
$chars = (int)PConfig::get(local_user(),'showmore','chars');
|
||||
if(!$chars)
|
||||
$chars = 1100;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function startpage_install() {
|
||||
register_hook('home_init', 'addon/startpage/startpage.php', 'startpage_home_init');
|
||||
|
@ -27,7 +28,7 @@ function startpage_home_init($a, $b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$page = get_pconfig(local_user(),'startpage','startpage');
|
||||
$page = PConfig::get(local_user(),'startpage','startpage');
|
||||
if(strlen($page)) {
|
||||
$slash = ((strpos($page,'/') === 0) ? true : false);
|
||||
if(stristr($page,'://'))
|
||||
|
@ -50,7 +51,7 @@ function startpage_settings_post($a,$post) {
|
|||
if(! local_user())
|
||||
return;
|
||||
if($_POST['startpage-submit'])
|
||||
set_pconfig(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
|
||||
PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +75,7 @@ function startpage_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$page = get_pconfig(local_user(),'startpage','startpage');
|
||||
$page = PConfig::get(local_user(),'startpage','startpage');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
|
|
@ -47,6 +47,9 @@ 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');
|
||||
|
@ -71,11 +74,11 @@ class StatusNetOAuth extends TwitterOAuth {
|
|||
$this->http_info = array();
|
||||
$ci = curl_init();
|
||||
/* Curl settings */
|
||||
$prx = get_config('system','proxy');
|
||||
$prx = Config::get('system','proxy');
|
||||
if(strlen($prx)) {
|
||||
curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1);
|
||||
curl_setopt($ci, CURLOPT_PROXY, $prx);
|
||||
$prxusr = get_config('system','proxyuser');
|
||||
$prxusr = Config::get('system','proxyuser');
|
||||
if(strlen($prxusr))
|
||||
curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr);
|
||||
}
|
||||
|
@ -144,16 +147,16 @@ function statusnet_uninstall() {
|
|||
}
|
||||
|
||||
function statusnet_check_item_notification($a, &$notification_data) {
|
||||
$notification_data["profiles"][] = get_pconfig($notification_data["uid"], 'statusnet', 'own_url');
|
||||
$notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url');
|
||||
}
|
||||
|
||||
function statusnet_jot_nets(&$a,&$b) {
|
||||
if(! local_user())
|
||||
return;
|
||||
|
||||
$statusnet_post = get_pconfig(local_user(),'statusnet','post');
|
||||
$statusnet_post = PConfig::get(local_user(),'statusnet','post');
|
||||
if(intval($statusnet_post) == 1) {
|
||||
$statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default');
|
||||
$statusnet_defpost = PConfig::get(local_user(),'statusnet','post_by_default');
|
||||
$selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to GNU Social') . '</div>';
|
||||
|
@ -190,16 +193,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 = get_config('statusnet', 'sites');
|
||||
$globalsn = Config::get('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) {
|
||||
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'] );
|
||||
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'] );
|
||||
} else {
|
||||
notice( t('Please contact your site administrator.<br />The provided API URL is not valid.').EOL.$asn['apiurl'].EOL );
|
||||
}
|
||||
|
@ -215,19 +218,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
|
||||
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'] );
|
||||
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'] );
|
||||
} 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
|
||||
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 );
|
||||
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 );
|
||||
} 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 );
|
||||
|
@ -237,29 +240,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 = get_pconfig(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' );
|
||||
$csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' );
|
||||
$api = PConfig::get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get(local_user(), 'statusnet', 'consumerkey' );
|
||||
$csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret' );
|
||||
// the token and secret for which the PIN was generated were hidden in the settings
|
||||
// form as token and token2, we need a new connection to GNU Social using these token
|
||||
// and secret to request a Access Token with the PIN
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']);
|
||||
$token = $connection->getAccessToken( $_POST['statusnet-pin'] );
|
||||
// ok, now that we have the Access Token, save them in the user config
|
||||
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);
|
||||
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);
|
||||
// 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
|
||||
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']));
|
||||
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']));
|
||||
|
||||
if (!intval($_POST['statusnet-mirror']))
|
||||
del_pconfig(local_user(),'statusnet','lastid');
|
||||
|
@ -277,23 +280,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 = 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');
|
||||
$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');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$defenabled = get_pconfig(local_user(),'statusnet','post_by_default');
|
||||
$defenabled = PConfig::get(local_user(),'statusnet','post_by_default');
|
||||
$defchecked = (($defenabled) ? ' checked="checked" ' : '');
|
||||
$mirrorenabled = get_pconfig(local_user(),'statusnet','mirror_posts');
|
||||
$mirrorenabled = PConfig::get(local_user(),'statusnet','mirror_posts');
|
||||
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
||||
$import = get_pconfig(local_user(),'statusnet','import');
|
||||
$import = PConfig::get(local_user(),'statusnet','import');
|
||||
$importselected = array("", "", "");
|
||||
$importselected[$import] = ' selected="selected"';
|
||||
//$importenabled = get_pconfig(local_user(),'statusnet','import');
|
||||
//$importenabled = PConfig::get(local_user(),'statusnet','import');
|
||||
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
||||
$create_userenabled = get_pconfig(local_user(),'statusnet','create_user');
|
||||
$create_userenabled = PConfig::get(local_user(),'statusnet','create_user');
|
||||
$create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
@ -310,7 +313,7 @@ function statusnet_settings(&$a,&$s) {
|
|||
/***
|
||||
* no consumer keys
|
||||
*/
|
||||
$globalsn = get_config('statusnet', 'sites');
|
||||
$globalsn = Config::get('statusnet', 'sites');
|
||||
/***
|
||||
* lets check if we have one or more globally configured GNU Social
|
||||
* server OAuth credentials in the configuration. If so offer them
|
||||
|
@ -437,11 +440,11 @@ function statusnet_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$statusnet_post = get_pconfig(local_user(),'statusnet','post');
|
||||
$statusnet_post = PConfig::get(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(get_pconfig(local_user(),'statusnet','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'statusnet','post_by_default'))) {
|
||||
$statusnet_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -457,11 +460,11 @@ function statusnet_post_local(&$a, &$b) {
|
|||
}
|
||||
|
||||
function statusnet_action($a, $uid, $pid, $action) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
$connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
|
||||
|
||||
|
@ -487,12 +490,12 @@ function statusnet_post_hook(&$a,&$b) {
|
|||
* Post to GNU Social
|
||||
*/
|
||||
|
||||
if (!get_pconfig($b["uid"],'statusnet','import')) {
|
||||
if (!PConfig::get($b["uid"],'statusnet','import')) {
|
||||
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||
return;
|
||||
}
|
||||
|
||||
$api = get_pconfig($b["uid"], 'statusnet', 'baseapi');
|
||||
$api = PConfig::get($b["uid"], 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
if($b['parent'] != $b['id']) {
|
||||
|
@ -564,13 +567,13 @@ function statusnet_post_hook(&$a,&$b) {
|
|||
|
||||
logger('GNU Socialpost invoked');
|
||||
|
||||
load_pconfig($b['uid'], 'statusnet');
|
||||
PConfig::load($b['uid'], 'statusnet');
|
||||
|
||||
$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');
|
||||
$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');
|
||||
|
||||
if($ckey && $csecret && $otoken && $osecret) {
|
||||
|
||||
|
@ -582,7 +585,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
|
||||
|
||||
set_pconfig($b['uid'], 'statusnet', 'max_char', $max_char);
|
||||
PConfig::set($b['uid'], 'statusnet', 'max_char', $max_char);
|
||||
|
||||
$tempfile = "";
|
||||
require_once("include/plaintext.php");
|
||||
|
@ -632,7 +635,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)
|
||||
set_pconfig($b["uid"], "statusnet", "application_name", strip_tags($result->source));
|
||||
PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
|
||||
|
||||
if ($result->error) {
|
||||
logger('Send to GNU Social failed: "'.$result->error.'"');
|
||||
|
@ -678,13 +681,13 @@ function statusnet_plugin_admin_post(&$a){
|
|||
}
|
||||
}
|
||||
|
||||
$sites = set_config('statusnet','sites', $sites);
|
||||
$sites = Config::set('statusnet','sites', $sites);
|
||||
|
||||
}
|
||||
|
||||
function statusnet_plugin_admin(&$a, &$o){
|
||||
|
||||
$sites = get_config('statusnet','sites');
|
||||
$sites = Config::get('statusnet','sites');
|
||||
$sitesform=array();
|
||||
if (is_array($sites)){
|
||||
foreach($sites as $id=>$s){
|
||||
|
@ -720,7 +723,7 @@ function statusnet_prepare_body(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if ($b["preview"]) {
|
||||
$max_char = get_pconfig(local_user(),'statusnet','max_char');
|
||||
$max_char = PConfig::get(local_user(),'statusnet','max_char');
|
||||
if (intval($max_char) == 0)
|
||||
$max_char = 140;
|
||||
|
||||
|
@ -763,9 +766,9 @@ function statusnet_prepare_body(&$a,&$b) {
|
|||
}
|
||||
|
||||
function statusnet_cron($a,$b) {
|
||||
$last = get_config('statusnet','last_poll');
|
||||
$last = Config::get('statusnet','last_poll');
|
||||
|
||||
$poll_interval = intval(get_config('statusnet','poll_interval'));
|
||||
$poll_interval = intval(Config::get('statusnet','poll_interval'));
|
||||
if(! $poll_interval)
|
||||
$poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL;
|
||||
|
||||
|
@ -786,7 +789,7 @@ function statusnet_cron($a,$b) {
|
|||
}
|
||||
}
|
||||
|
||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||
$abandon_days = intval(Config::get('system','account_abandon_days'));
|
||||
if ($abandon_days < 1)
|
||||
$abandon_days = 0;
|
||||
|
||||
|
@ -810,16 +813,16 @@ function statusnet_cron($a,$b) {
|
|||
|
||||
logger('statusnet: cron_end');
|
||||
|
||||
set_config('statusnet','last_poll', time());
|
||||
Config::set('statusnet','last_poll', time());
|
||||
}
|
||||
|
||||
function statusnet_fetchtimeline($a, $uid) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
require_once('mod/item.php');
|
||||
require_once('include/items.php');
|
||||
|
@ -827,9 +830,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 = get_pconfig( $uid, 'statusnet', 'application_name');
|
||||
$application_name = PConfig::get( $uid, 'statusnet', 'application_name');
|
||||
if ($application_name == "")
|
||||
$application_name = get_config('statusnet', 'application_name');
|
||||
$application_name = Config::get('statusnet', 'application_name');
|
||||
if ($application_name == "")
|
||||
$application_name = $a->get_hostname();
|
||||
|
||||
|
@ -908,7 +911,7 @@ function statusnet_fetchtimeline($a, $uid) {
|
|||
}
|
||||
}
|
||||
}
|
||||
set_pconfig($uid, 'statusnet', 'lastid', $lastid);
|
||||
PConfig::set($uid, 'statusnet', 'lastid', $lastid);
|
||||
}
|
||||
|
||||
function statusnet_address($contact) {
|
||||
|
@ -1054,11 +1057,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
|||
}
|
||||
|
||||
function statusnet_fetchuser($a, $uid, $screen_name = "", $user_id = "") {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
require_once("addon/statusnet/codebird.php");
|
||||
|
||||
|
@ -1099,7 +1102,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi
|
|||
|
||||
logger("statusnet_createpost: start", LOGGER_DEBUG);
|
||||
|
||||
$api = get_pconfig($uid, 'statusnet', 'baseapi');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$postarray = array();
|
||||
|
@ -1157,7 +1160,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi
|
|||
}
|
||||
|
||||
// Is it me?
|
||||
$own_url = get_pconfig($uid, 'statusnet', 'own_url');
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
|
||||
if ($content->user->id == $own_url) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -1199,7 +1202,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/", get_pconfig($uid, 'statusnet', 'baseapi'));
|
||||
$hostname = str_replace("/api/", "/notice/", PConfig::get($uid, 'statusnet', 'baseapi'));
|
||||
|
||||
$postarray['plink'] = $hostname.$content->id;
|
||||
$postarray['app'] = strip_tags($content->source);
|
||||
|
@ -1318,12 +1321,12 @@ function statusnet_checknotification($a, $uid, $own_url, $top_item, $postarray)
|
|||
function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
|
||||
$conversations = array();
|
||||
|
||||
$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');
|
||||
$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');
|
||||
|
||||
// "create_user" is deactivated, since currently you cannot add users manually by now
|
||||
$create_user = true;
|
||||
|
@ -1370,7 +1373,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
|
|||
|
||||
if ($mode == 1) {
|
||||
// Fetching timeline
|
||||
$lastid = get_pconfig($uid, 'statusnet', 'lasthometimelineid');
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lasthometimelineid');
|
||||
//$lastid = 1;
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
@ -1429,11 +1432,11 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
|
|||
|
||||
}
|
||||
}
|
||||
set_pconfig($uid, 'statusnet', 'lasthometimelineid', $lastid);
|
||||
PConfig::set($uid, 'statusnet', 'lasthometimelineid', $lastid);
|
||||
}
|
||||
|
||||
// Fetching mentions
|
||||
$lastid = get_pconfig($uid, 'statusnet', 'lastmentionid');
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lastmentionid');
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
if ($lastid <> "")
|
||||
|
@ -1510,16 +1513,16 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
|
|||
}
|
||||
}
|
||||
|
||||
set_pconfig($uid, 'statusnet', 'lastmentionid', $lastid);
|
||||
PConfig::set($uid, 'statusnet', 'lastmentionid', $lastid);
|
||||
}
|
||||
|
||||
function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $conversation) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
require_once('library/twitteroauth.php');
|
||||
|
||||
|
@ -1657,12 +1660,12 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
|
|||
}
|
||||
|
||||
function statusnet_fetch_own_contact($a, $uid) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
$contact_id = 0;
|
||||
|
||||
|
@ -1674,7 +1677,7 @@ function statusnet_fetch_own_contact($a, $uid) {
|
|||
// Fetching user data
|
||||
$user = $connection->get('account/verify_credentials');
|
||||
|
||||
set_pconfig($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url));
|
||||
PConfig::set($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url));
|
||||
|
||||
$contact_id = statusnet_fetch_contact($uid, $user, true);
|
||||
|
||||
|
@ -1716,11 +1719,11 @@ function statusnet_is_retweet($a, $uid, $body) {
|
|||
if ($matches[1] != "")
|
||||
$link = $matches[1];
|
||||
|
||||
$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');
|
||||
$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');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$id = preg_replace("=https?://".$hostname."/notice/(.*)=ism", "$1", $link);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function superblock_install() {
|
||||
|
||||
register_hook('plugin_settings', 'addon/superblock/superblock.php', 'superblock_addon_settings');
|
||||
|
@ -44,7 +46,7 @@ function superblock_addon_settings(&$a,&$s) {
|
|||
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
$words = get_pconfig(local_user(),'system','blocked');
|
||||
$words = PConfig::get(local_user(),'system','blocked');
|
||||
if(! $words) {
|
||||
$words = '';
|
||||
}
|
||||
|
@ -72,14 +74,14 @@ function superblock_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['superblock-submit']) {
|
||||
set_pconfig(local_user(),'system','blocked',trim($_POST['superblock-words']));
|
||||
PConfig::set(local_user(),'system','blocked',trim($_POST['superblock-words']));
|
||||
info( t('SUPERBLOCK Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function superblock_enotify_store(&$a,&$b) {
|
||||
|
||||
$words = get_pconfig($b['uid'],'system','blocked');
|
||||
$words = PConfig::get($b['uid'],'system','blocked');
|
||||
if($words) {
|
||||
$arr = explode(',',$words);
|
||||
}
|
||||
|
@ -111,7 +113,7 @@ function superblock_conversation_start(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$words = get_pconfig(local_user(),'system','blocked');
|
||||
$words = PConfig::get(local_user(),'system','blocked');
|
||||
if($words) {
|
||||
$a->data['superblock'] = explode(',',$words);
|
||||
}
|
||||
|
@ -156,7 +158,7 @@ function superblock_init(&$a) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$words = get_pconfig(local_user(),'system','blocked');
|
||||
$words = PConfig::get(local_user(),'system','blocked');
|
||||
|
||||
if(array_key_exists('block',$_GET) && $_GET['block']) {
|
||||
if(strlen($words))
|
||||
|
@ -164,7 +166,7 @@ function superblock_init(&$a) {
|
|||
$words .= trim($_GET['block']);
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'system','blocked',$words);
|
||||
PConfig::set(local_user(),'system','blocked',$words);
|
||||
info( t('superblock settings updated') . EOL );
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
|
||||
function testdrive_install() {
|
||||
|
@ -37,7 +37,7 @@ function testdrive_register_account($a,$b) {
|
|||
|
||||
$uid = $b;
|
||||
|
||||
$days = get_config('testdrive','expiredays');
|
||||
$days = Config::get('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.'), get_config('system','sitename'));
|
||||
$b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('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());
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
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');
|
||||
|
@ -60,16 +63,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'), get_config('tumblr', 'consumer_key' ), ''),
|
||||
'$consumer_secret' => array('consumer_secret', t('Consumer Secret'), get_config('tumblr', 'consumer_secret' ), ''),
|
||||
'$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' ), ''),
|
||||
));
|
||||
}
|
||||
|
||||
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'])): '');
|
||||
set_config('tumblr','consumer_key',$consumer_key);
|
||||
set_config('tumblr','consumer_secret',$consumer_secret);
|
||||
Config::set('tumblr','consumer_key',$consumer_key);
|
||||
Config::set('tumblr','consumer_secret',$consumer_secret);
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
|
@ -81,8 +84,8 @@ function tumblr_connect($a) {
|
|||
//require_once('addon/tumblr/tumblroauth/tumblroauth.php');
|
||||
|
||||
// Define the needed keys
|
||||
$consumer_key = get_config('tumblr','consumer_key');
|
||||
$consumer_secret = get_config('tumblr','consumer_secret');
|
||||
$consumer_key = Config::get('tumblr','consumer_key');
|
||||
$consumer_secret = Config::get('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
|
||||
|
@ -131,8 +134,8 @@ function tumblr_callback($a) {
|
|||
//require_once('addon/tumblr/tumblroauth/tumblroauth.php');
|
||||
|
||||
// Define the needed keys
|
||||
$consumer_key = get_config('tumblr','consumer_key');
|
||||
$consumer_secret = get_config('tumblr','consumer_secret');
|
||||
$consumer_key = Config::get('tumblr','consumer_key');
|
||||
$consumer_secret = Config::get('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)
|
||||
|
@ -158,8 +161,8 @@ function tumblr_callback($a) {
|
|||
}
|
||||
|
||||
// What's next? Now that we have an Access Token and Secret, we can make an API call.
|
||||
set_pconfig(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
|
||||
set_pconfig(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
|
||||
PConfig::set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
|
||||
PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
|
||||
|
||||
$o = t("You are now authenticated to tumblr.");
|
||||
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
|
||||
|
@ -170,9 +173,9 @@ function tumblr_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$tmbl_post = get_pconfig(local_user(),'tumblr','post');
|
||||
$tmbl_post = PConfig::get(local_user(),'tumblr','post');
|
||||
if(intval($tmbl_post) == 1) {
|
||||
$tmbl_defpost = get_pconfig(local_user(),'tumblr','post_by_default');
|
||||
$tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default');
|
||||
$selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to Tumblr') . '</div>';
|
||||
|
@ -191,11 +194,11 @@ function tumblr_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'tumblr','post');
|
||||
$enabled = PConfig::get(local_user(),'tumblr','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$def_enabled = get_pconfig(local_user(),'tumblr','post_by_default');
|
||||
$def_enabled = PConfig::get(local_user(),'tumblr','post_by_default');
|
||||
|
||||
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
@ -223,15 +226,15 @@ function tumblr_settings(&$a,&$s) {
|
|||
$s .= '<input id="tumblr-bydefault" type="checkbox" name="tumblr_bydefault" value="1" ' . $def_checked . '/>';
|
||||
$s .= '</div><div class="clear"></div>';
|
||||
|
||||
$oauth_token = get_pconfig(local_user(), "tumblr", "oauth_token");
|
||||
$oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret");
|
||||
$oauth_token = PConfig::get(local_user(), "tumblr", "oauth_token");
|
||||
$oauth_token_secret = PConfig::get(local_user(), "tumblr", "oauth_token_secret");
|
||||
|
||||
$s .= '<div id="tumblr-page-wrapper">';
|
||||
if (($oauth_token != "") && ($oauth_token_secret != "")) {
|
||||
|
||||
$page = get_pconfig(local_user(),'tumblr','page');
|
||||
$consumer_key = get_config('tumblr','consumer_key');
|
||||
$consumer_secret = get_config('tumblr','consumer_secret');
|
||||
$page = PConfig::get(local_user(),'tumblr','page');
|
||||
$consumer_key = Config::get('tumblr','consumer_key');
|
||||
$consumer_secret = Config::get('tumblr','consumer_secret');
|
||||
|
||||
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
|
||||
|
||||
|
@ -265,9 +268,9 @@ function tumblr_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'tumblr-submit')) {
|
||||
|
||||
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']));
|
||||
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']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,11 +292,11 @@ function tumblr_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$tmbl_post = intval(get_pconfig(local_user(),'tumblr','post'));
|
||||
$tmbl_post = intval(PConfig::get(local_user(),'tumblr','post'));
|
||||
|
||||
$tmbl_enable = (($tmbl_post && x($_REQUEST,'tumblr_enable')) ? intval($_REQUEST['tumblr_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(),'tumblr','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'tumblr','post_by_default'))) {
|
||||
$tmbl_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -322,9 +325,9 @@ function tumblr_send(&$a,&$b) {
|
|||
if($b['parent'] != $b['id'])
|
||||
return;
|
||||
|
||||
$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");
|
||||
$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");
|
||||
$tmbl_blog = 'blog/'.$page.'/post';
|
||||
|
||||
if($oauth_token && $oauth_token_secret && $tmbl_blog) {
|
||||
|
@ -405,8 +408,8 @@ function tumblr_send(&$a,&$b) {
|
|||
if (trim($params['caption']) == "")
|
||||
$params['caption'] = bbcode("[quote]".$siteinfo["description"]."[/quote]", false, false, 4);
|
||||
|
||||
$consumer_key = get_config('tumblr','consumer_key');
|
||||
$consumer_secret = get_config('tumblr','consumer_secret');
|
||||
$consumer_key = Config::get('tumblr','consumer_key');
|
||||
$consumer_secret = Config::get('tumblr','consumer_secret');
|
||||
|
||||
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
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() {
|
||||
|
@ -103,7 +106,7 @@ function twitter_uninstall() {
|
|||
}
|
||||
|
||||
function twitter_check_item_notification($a, &$notification_data) {
|
||||
$own_id = get_pconfig($notification_data["uid"], 'twitter', 'own_id');
|
||||
$own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
|
||||
|
||||
$own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||
intval($notification_data["uid"]),
|
||||
|
@ -127,10 +130,10 @@ function twitter_follow($a, &$contact) {
|
|||
|
||||
$uid = $a->user["uid"];
|
||||
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
require_once("addon/twitter/codebird.php");
|
||||
|
||||
|
@ -157,9 +160,9 @@ function twitter_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$tw_post = get_pconfig(local_user(),'twitter','post');
|
||||
$tw_post = PConfig::get(local_user(),'twitter','post');
|
||||
if(intval($tw_post) == 1) {
|
||||
$tw_defpost = get_pconfig(local_user(),'twitter','post_by_default');
|
||||
$tw_defpost = PConfig::get(local_user(),'twitter','post_by_default');
|
||||
$selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to Twitter') . '</div>';
|
||||
|
@ -194,27 +197,27 @@ function twitter_settings_post ($a,$post) {
|
|||
// 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 = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('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
|
||||
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);
|
||||
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);
|
||||
// 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
|
||||
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']));
|
||||
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']));
|
||||
|
||||
if (!intval($_POST['twitter-mirror']))
|
||||
del_pconfig(local_user(),'twitter','lastid');
|
||||
|
@ -231,19 +234,19 @@ function twitter_settings(&$a,&$s) {
|
|||
* 2) If no OAuthtoken & stuff is present, generate button to get some
|
||||
* 3) Checkbox for "Send public notices (140 chars only)
|
||||
*/
|
||||
$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');
|
||||
$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');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$defenabled = get_pconfig(local_user(),'twitter','post_by_default');
|
||||
$defenabled = PConfig::get(local_user(),'twitter','post_by_default');
|
||||
$defchecked = (($defenabled) ? ' checked="checked" ' : '');
|
||||
$mirrorenabled = get_pconfig(local_user(),'twitter','mirror_posts');
|
||||
$mirrorenabled = PConfig::get(local_user(),'twitter','mirror_posts');
|
||||
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
||||
$importenabled = get_pconfig(local_user(),'twitter','import');
|
||||
$importenabled = PConfig::get(local_user(),'twitter','import');
|
||||
$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
||||
$create_userenabled = get_pconfig(local_user(),'twitter','create_user');
|
||||
$create_userenabled = PConfig::get(local_user(),'twitter','create_user');
|
||||
$create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
@ -344,11 +347,11 @@ function twitter_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$twitter_post = intval(get_pconfig(local_user(), 'twitter', 'post'));
|
||||
$twitter_post = intval(PConfig::get(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(get_pconfig(local_user(), 'twitter', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'twitter', 'post_by_default'))) {
|
||||
$twitter_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -365,10 +368,10 @@ function twitter_post_local(&$a, &$b) {
|
|||
|
||||
function twitter_action($a, $uid, $pid, $action) {
|
||||
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
require_once("addon/twitter/codebird.php");
|
||||
|
||||
|
@ -402,7 +405,7 @@ function twitter_post_hook(&$a,&$b) {
|
|||
|
||||
require_once("include/network.php");
|
||||
|
||||
if (!get_pconfig($b["uid"],'twitter','import')) {
|
||||
if (!PConfig::get($b["uid"],'twitter','import')) {
|
||||
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||
return;
|
||||
}
|
||||
|
@ -470,12 +473,12 @@ function twitter_post_hook(&$a,&$b) {
|
|||
logger('twitter post invoked');
|
||||
|
||||
|
||||
load_pconfig($b['uid'], 'twitter');
|
||||
PConfig::load($b['uid'], 'twitter');
|
||||
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($b['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($b['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret');
|
||||
|
||||
if($ckey && $csecret && $otoken && $osecret) {
|
||||
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
|
||||
|
@ -532,7 +535,7 @@ function twitter_post_hook(&$a,&$b) {
|
|||
logger('twitter_post_with_media send, result: ' . print_r($result, true), LOGGER_DEBUG);
|
||||
|
||||
if ($result->source)
|
||||
set_config("twitter", "application_name", strip_tags($result->source));
|
||||
Config::set("twitter", "application_name", strip_tags($result->source));
|
||||
|
||||
if ($result->errors || $result->error) {
|
||||
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
|
||||
|
@ -573,7 +576,7 @@ function twitter_post_hook(&$a,&$b) {
|
|||
logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
|
||||
|
||||
if ($result->source)
|
||||
set_config("twitter", "application_name", strip_tags($result->source));
|
||||
Config::set("twitter", "application_name", strip_tags($result->source));
|
||||
|
||||
if ($result->errors) {
|
||||
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
|
||||
|
@ -606,9 +609,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'])):'');
|
||||
set_config('twitter','consumerkey',$consumerkey);
|
||||
set_config('twitter','consumersecret',$consumersecret);
|
||||
//set_config('twitter','application_name',$applicationname);
|
||||
Config::set('twitter','consumerkey',$consumerkey);
|
||||
Config::set('twitter','consumersecret',$consumersecret);
|
||||
//Config::set('twitter','application_name',$applicationname);
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
function twitter_plugin_admin(&$a, &$o){
|
||||
|
@ -617,16 +620,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'), 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'))
|
||||
'$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'))
|
||||
));
|
||||
}
|
||||
|
||||
function twitter_cron($a,$b) {
|
||||
$last = get_config('twitter','last_poll');
|
||||
$last = Config::get('twitter','last_poll');
|
||||
|
||||
$poll_interval = intval(get_config('twitter','poll_interval'));
|
||||
$poll_interval = intval(Config::get('twitter','poll_interval'));
|
||||
if(! $poll_interval)
|
||||
$poll_interval = TWITTER_DEFAULT_POLL_INTERVAL;
|
||||
|
||||
|
@ -647,7 +650,7 @@ function twitter_cron($a,$b) {
|
|||
}
|
||||
}
|
||||
|
||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||
$abandon_days = intval(Config::get('system','account_abandon_days'));
|
||||
if ($abandon_days < 1)
|
||||
$abandon_days = 0;
|
||||
|
||||
|
@ -669,7 +672,7 @@ function twitter_cron($a,$b) {
|
|||
/*
|
||||
// To-Do
|
||||
// check for new contacts once a day
|
||||
$last_contact_check = get_pconfig($rr['uid'],'pumpio','contact_check');
|
||||
$last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check');
|
||||
if($last_contact_check)
|
||||
$next_contact_check = $last_contact_check + 86400;
|
||||
else
|
||||
|
@ -677,7 +680,7 @@ function twitter_cron($a,$b) {
|
|||
|
||||
if($next_contact_check <= time()) {
|
||||
pumpio_getallusers($a, $rr["uid"]);
|
||||
set_pconfig($rr['uid'],'pumpio','contact_check',time());
|
||||
PConfig::set($rr['uid'],'pumpio','contact_check',time());
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -686,12 +689,12 @@ function twitter_cron($a,$b) {
|
|||
|
||||
logger('twitter: cron_end');
|
||||
|
||||
set_config('twitter','last_poll', time());
|
||||
Config::set('twitter','last_poll', time());
|
||||
}
|
||||
|
||||
function twitter_expire($a,$b) {
|
||||
|
||||
$days = get_config('twitter', 'expire');
|
||||
$days = Config::get('twitter', 'expire');
|
||||
|
||||
if ($days == 0)
|
||||
return;
|
||||
|
@ -807,13 +810,13 @@ function twitter_do_mirrorpost($a, $uid, $post) {
|
|||
}
|
||||
|
||||
function twitter_fetchtimeline($a, $uid) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
$application_name = get_config('twitter', 'application_name');
|
||||
$application_name = Config::get('twitter', 'application_name');
|
||||
|
||||
if ($application_name == "")
|
||||
$application_name = $a->get_hostname();
|
||||
|
@ -845,7 +848,7 @@ function twitter_fetchtimeline($a, $uid) {
|
|||
foreach ($posts as $post) {
|
||||
if ($post->id_str > $lastid) {
|
||||
$lastid = $post->id_str;
|
||||
set_pconfig($uid, 'twitter', 'lastid', $lastid);
|
||||
PConfig::set($uid, 'twitter', 'lastid', $lastid);
|
||||
}
|
||||
|
||||
if ($first_time)
|
||||
|
@ -864,7 +867,7 @@ function twitter_fetchtimeline($a, $uid) {
|
|||
}
|
||||
}
|
||||
}
|
||||
set_pconfig($uid, 'twitter', 'lastid', $lastid);
|
||||
PConfig::set($uid, 'twitter', 'lastid', $lastid);
|
||||
}
|
||||
|
||||
function twitter_queue_hook(&$a,&$b) {
|
||||
|
@ -892,10 +895,10 @@ function twitter_queue_hook(&$a,&$b) {
|
|||
|
||||
$user = $r[0];
|
||||
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($user['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($user['uid'], 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($user['uid'], 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($user['uid'], 'twitter', 'oauthsecret');
|
||||
|
||||
$success = false;
|
||||
|
||||
|
@ -1087,10 +1090,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
|||
}
|
||||
|
||||
function twitter_fetchuser($a, $uid, $screen_name = "", $user_id = "") {
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
require_once("addon/twitter/codebird.php");
|
||||
|
||||
|
@ -1393,7 +1396,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing
|
|||
}
|
||||
|
||||
// Is it me?
|
||||
$own_id = get_pconfig($uid, 'twitter', 'own_id');
|
||||
$own_id = PConfig::get($uid, 'twitter', 'own_id');
|
||||
|
||||
if ($post->user->id_str == $own_id) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -1624,16 +1627,16 @@ function twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id)
|
|||
}
|
||||
|
||||
function twitter_fetchhometimeline($a, $uid) {
|
||||
$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');
|
||||
$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');
|
||||
|
||||
logger("twitter_fetchhometimeline: Fetching for user ".$uid, LOGGER_DEBUG);
|
||||
|
||||
$application_name = get_config('twitter', 'application_name');
|
||||
$application_name = Config::get('twitter', 'application_name');
|
||||
|
||||
if ($application_name == "")
|
||||
$application_name = $a->get_hostname();
|
||||
|
@ -1678,7 +1681,7 @@ function twitter_fetchhometimeline($a, $uid) {
|
|||
|
||||
|
||||
// Fetching timeline
|
||||
$lastid = get_pconfig($uid, 'twitter', 'lasthometimelineid');
|
||||
$lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
|
@ -1700,7 +1703,7 @@ function twitter_fetchhometimeline($a, $uid) {
|
|||
foreach ($posts as $post) {
|
||||
if ($post->id_str > $lastid) {
|
||||
$lastid = $post->id_str;
|
||||
set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
}
|
||||
|
||||
if ($first_time)
|
||||
|
@ -1734,10 +1737,10 @@ function twitter_fetchhometimeline($a, $uid) {
|
|||
|
||||
}
|
||||
}
|
||||
set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
|
||||
|
||||
// Fetching mentions
|
||||
$lastid = get_pconfig($uid, 'twitter', 'lastmentionid');
|
||||
$lastid = PConfig::get($uid, 'twitter', 'lastmentionid');
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
|
@ -1816,16 +1819,16 @@ function twitter_fetchhometimeline($a, $uid) {
|
|||
}
|
||||
}
|
||||
|
||||
set_pconfig($uid, 'twitter', 'lastmentionid', $lastid);
|
||||
PConfig::set($uid, 'twitter', 'lastmentionid', $lastid);
|
||||
}
|
||||
|
||||
function twitter_fetch_own_contact($a, $uid) {
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
$own_id = get_pconfig($uid, 'twitter', 'own_id');
|
||||
$own_id = PConfig::get($uid, 'twitter', 'own_id');
|
||||
|
||||
$contact_id = 0;
|
||||
|
||||
|
@ -1837,7 +1840,7 @@ function twitter_fetch_own_contact($a, $uid) {
|
|||
// Fetching user data
|
||||
$user = $connection->get('account/verify_credentials');
|
||||
|
||||
set_pconfig($uid, 'twitter', 'own_id', $user->id_str);
|
||||
PConfig::set($uid, 'twitter', 'own_id', $user->id_str);
|
||||
|
||||
$contact_id = twitter_fetch_contact($uid, $user, true);
|
||||
|
||||
|
@ -1886,10 +1889,10 @@ function twitter_is_retweet($a, $uid, $body) {
|
|||
|
||||
logger('twitter_is_retweet: Retweeting id '.$id.' for user '.$uid, LOGGER_DEBUG);
|
||||
|
||||
$ckey = get_config('twitter', 'consumerkey');
|
||||
$csecret = get_config('twitter', 'consumersecret');
|
||||
$otoken = get_pconfig($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
|
||||
$ckey = Config::get('twitter', 'consumerkey');
|
||||
$csecret = Config::get('twitter', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
|
||||
|
||||
require_once('library/twitteroauth.php');
|
||||
$connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function webrtc_install() {
|
||||
register_hook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
|
||||
}
|
||||
|
@ -24,12 +26,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'), get_config('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'), Config::get('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'])) : '');
|
||||
set_config('webrtc', 'webrtcurl', $url);
|
||||
Config::set('webrtc', 'webrtcurl', $url);
|
||||
info( t('Settings updated.'). EOL);
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,7 @@ function webrtc_content(&$a) {
|
|||
$o = '';
|
||||
|
||||
/* landingpage to create chatrooms */
|
||||
$webrtcurl = get_config('webrtc','webrtcurl');
|
||||
$webrtcurl = Config::get('webrtc','webrtcurl');
|
||||
|
||||
/* embedd the landing page in an iframe */
|
||||
$o .= '<h2>'.t('Video Chat').'</h2>';
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
* Version: 1.0
|
||||
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrix/>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
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');
|
||||
|
@ -32,8 +33,8 @@ function widgets_settings(&$a,&$o) {
|
|||
return;
|
||||
|
||||
|
||||
$key = get_pconfig(local_user(), 'widgets', 'key' );
|
||||
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
|
||||
$key = PConfig::get(local_user(), 'widgets', 'key' );
|
||||
if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
|
||||
|
||||
$widgets = array();
|
||||
$d = dir(dirname(__file__));
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* count only unseen elements which are not type=activity (likes and dislikes not seen as new elements)
|
||||
*/
|
||||
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function windowsphonepush_install() {
|
||||
|
||||
|
@ -87,13 +88,13 @@ function windowsphonepush_settings_post($a,$post) {
|
|||
if(! local_user() || (! x($_POST,'windowsphonepush-submit')))
|
||||
return;
|
||||
$enable = intval($_POST['windowsphonepush']);
|
||||
set_pconfig(local_user(),'windowsphonepush','enable',$enable);
|
||||
PConfig::set(local_user(),'windowsphonepush','enable',$enable);
|
||||
|
||||
if($enable) {
|
||||
set_pconfig(local_user(),'windowsphonepush','counterunseen', 0);
|
||||
PConfig::set(local_user(),'windowsphonepush','counterunseen', 0);
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'windowsphonepush','senditemtext',intval($_POST['windowsphonepush-senditemtext']));
|
||||
PConfig::set(local_user(),'windowsphonepush','senditemtext',intval($_POST['windowsphonepush-senditemtext']));
|
||||
|
||||
info( t('WindowsPhonePush settings updated.') . EOL);
|
||||
}
|
||||
|
@ -114,13 +115,13 @@ function windowsphonepush_settings(&$a,&$s) {
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/windowsphonepush/windowsphonepush.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
/* Get the current state of our config variables */
|
||||
$enabled = get_pconfig(local_user(),'windowsphonepush','enable');
|
||||
$enabled = PConfig::get(local_user(),'windowsphonepush','enable');
|
||||
$checked_enabled = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$senditemtext = get_pconfig(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext');
|
||||
$checked_senditemtext = (($senditemtext) ? ' checked="checked" ' : '');
|
||||
|
||||
$device_url = get_pconfig(local_user(), 'windowsphonepush', 'device_url');
|
||||
$device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url');
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<div class="settings-block">';
|
||||
|
@ -163,8 +164,8 @@ function windowsphonepush_cron() {
|
|||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
// load stored information for the user-id of the current loop
|
||||
$device_url = get_pconfig($rr['uid'], 'windowsphonepush', 'device_url');
|
||||
$lastpushid = get_pconfig($rr['uid'], 'windowsphonepush', 'lastpushid');
|
||||
$device_url = PConfig::get($rr['uid'], 'windowsphonepush', 'device_url');
|
||||
$lastpushid = PConfig::get($rr['uid'], 'windowsphonepush', 'lastpushid');
|
||||
|
||||
// pushing only possible if device_url (the URI on Microsoft server) is available or not "NA" (which will be sent
|
||||
// by app if user has switched the server setting in app - sending blank not possible as this would return an update error)
|
||||
|
@ -185,7 +186,7 @@ function windowsphonepush_cron() {
|
|||
switch (trim($res_tile)) {
|
||||
case "Received":
|
||||
// ok, count has been pushed, let's save it in personal settings
|
||||
set_pconfig($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
|
||||
PConfig::set($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
|
||||
break;
|
||||
case "QueueFull":
|
||||
// maximum of 30 messages reached, server rejects any further push notification until device reconnects
|
||||
|
@ -208,7 +209,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 = get_pconfig($rr['uid'], 'windowsphonepush', 'senditemtext');
|
||||
$senditemtext = PConfig::get($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",
|
||||
|
@ -247,7 +248,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') {
|
||||
set_pconfig($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
|
||||
PConfig::set($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ function send_push($device_url, $headers, $msg) {
|
|||
// and log this fact
|
||||
$subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus');
|
||||
if ($subscriptionStatus == "Expired") {
|
||||
set_pconfig(local_user(),'windowsphonepush','device_url', "");
|
||||
PConfig::set(local_user(),'windowsphonepush','device_url', "");
|
||||
logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
|
||||
}
|
||||
|
||||
|
@ -393,11 +394,11 @@ function windowsphonepush_showsettings(&$a) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$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');
|
||||
$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');
|
||||
$addonversion = "2.0";
|
||||
|
||||
if (!$device_url)
|
||||
|
@ -426,7 +427,7 @@ function windowsphonepush_updatesettings(&$a) {
|
|||
}
|
||||
|
||||
// no updating if user hasn't enabled the plugin
|
||||
$enable = get_pconfig(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
if(! $enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
@ -448,12 +449,12 @@ function windowsphonepush_updatesettings(&$a) {
|
|||
`v` = '" . $device_url . "'");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
set_pconfig($rr['uid'], 'windowsphonepush', 'device_url', '');
|
||||
PConfig::set($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() . "'.");
|
||||
}
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'windowsphonepush','device_url', $device_url);
|
||||
PConfig::set(local_user(),'windowsphonepush','device_url', $device_url);
|
||||
// output the successfull update of the device URL to the logger for error analysis if necessary
|
||||
logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
|
||||
return "Device-URL updated successfully!";
|
||||
|
@ -468,12 +469,12 @@ function windowsphonepush_updatecounterunseen() {
|
|||
}
|
||||
|
||||
// no updating if user hasn't enabled the plugin
|
||||
$enable = get_pconfig(local_user(), 'windowsphonepush', 'enable');
|
||||
$enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
|
||||
if(! $enable) {
|
||||
return "Plug-in not enabled";
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'windowsphonepush','counterunseen', 0);
|
||||
PConfig::set(local_user(),'windowsphonepush','counterunseen', 0);
|
||||
return "Counter set to zero";
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -34,9 +36,9 @@ function wppost_jot_nets(&$a,&$b) {
|
|||
if(! local_user())
|
||||
return;
|
||||
|
||||
$wp_post = get_pconfig(local_user(),'wppost','post');
|
||||
$wp_post = PConfig::get(local_user(),'wppost','post');
|
||||
if(intval($wp_post) == 1) {
|
||||
$wp_defpost = get_pconfig(local_user(),'wppost','post_by_default');
|
||||
$wp_defpost = PConfig::get(local_user(),'wppost','post_by_default');
|
||||
$selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> '
|
||||
. t('Post to Wordpress') . '</div>';
|
||||
|
@ -55,23 +57,23 @@ function wppost_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variables */
|
||||
|
||||
$enabled = get_pconfig(local_user(),'wppost','post');
|
||||
$enabled = PConfig::get(local_user(),'wppost','post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
||||
$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_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_checked = (($def_enabled) ? ' checked="checked" ' : '');
|
||||
$back_checked = (($back_enabled) ? ' checked="checked" ' : '');
|
||||
$shortcheck_checked = (($shortcheck_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$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');
|
||||
$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');
|
||||
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
@ -133,17 +135,17 @@ function wppost_settings_post(&$a,&$b) {
|
|||
|
||||
if(x($_POST,'wppost-submit')) {
|
||||
|
||||
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']));
|
||||
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']));
|
||||
$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);
|
||||
set_pconfig(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
||||
PConfig::set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
||||
|
||||
}
|
||||
|
||||
|
@ -165,11 +167,11 @@ function wppost_post_local(&$a, &$b) {
|
|||
return;
|
||||
}
|
||||
|
||||
$wp_post = intval(get_pconfig(local_user(),'wppost','post'));
|
||||
$wp_post = intval(PConfig::get(local_user(),'wppost','post'));
|
||||
|
||||
$wp_enable = (($wp_post && x($_REQUEST,'wppost_enable')) ? intval($_REQUEST['wppost_enable']) : 0);
|
||||
|
||||
if ($b['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default'))) {
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(),'wppost','post_by_default'))) {
|
||||
$wp_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -199,10 +201,10 @@ function wppost_send(&$a,&$b) {
|
|||
return;
|
||||
|
||||
|
||||
$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');
|
||||
$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');
|
||||
if ($wp_backlink_text == '') {
|
||||
$wp_backlink_text = t('Read the original post and comment stream on Friendica');
|
||||
}
|
||||
|
@ -215,7 +217,7 @@ function wppost_send(&$a,&$b) {
|
|||
|
||||
$wptitle = trim($b['title']);
|
||||
|
||||
if (intval(get_pconfig($b['uid'],'wppost','shortcheck'))) {
|
||||
if (intval(PConfig::get($b['uid'],'wppost','shortcheck'))) {
|
||||
// Checking, if its a post that is worth a blog post
|
||||
$postentry = false;
|
||||
$siteinfo = get_attached_data($b["body"]);
|
||||
|
@ -276,7 +278,7 @@ function wppost_send(&$a,&$b) {
|
|||
|
||||
$post = $title.$post;
|
||||
|
||||
$wp_backlink = intval(get_pconfig($b['uid'],'wppost','backlink'));
|
||||
$wp_backlink = intval(PConfig::get($b['uid'],'wppost','backlink'));
|
||||
if($wp_backlink && $b['plink']) {
|
||||
$post .= EOL . EOL . '<a href="' . $b['plink'] . '">'
|
||||
. $wp_backlink_text . '</a>' . EOL . EOL;
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -23,9 +26,9 @@ function xmpp_uninstall() {
|
|||
function xmpp_plugin_settings_post($a,$post) {
|
||||
if(! local_user() || (! x($_POST,'xmpp-settings-submit')))
|
||||
return;
|
||||
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']);
|
||||
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']);
|
||||
|
||||
info( t('XMPP settings updated.') . EOL);
|
||||
}
|
||||
|
@ -41,13 +44,13 @@ function xmpp_plugin_settings(&$a,&$s) {
|
|||
|
||||
/* Get the current state of our config variable */
|
||||
|
||||
$enabled = intval(get_pconfig(local_user(),'xmpp','enabled'));
|
||||
$enabled = intval(PConfig::get(local_user(),'xmpp','enabled'));
|
||||
$enabled_checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$individual = intval(get_pconfig(local_user(),'xmpp','individual'));
|
||||
$individual = intval(PConfig::get(local_user(),'xmpp','individual'));
|
||||
$individual_checked = (($individual) ? ' checked="checked" ' : '');
|
||||
|
||||
$bosh_proxy = get_pconfig(local_user(),"xmpp","bosh_proxy");
|
||||
$bosh_proxy = PConfig::get(local_user(),"xmpp","bosh_proxy");
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
$s .= '<span id="settings_xmpp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">';
|
||||
|
@ -63,13 +66,13 @@ function xmpp_plugin_settings(&$a,&$s) {
|
|||
$s .= '<input id="xmpp-enabled" type="checkbox" name="xmpp_enabled" value="1" ' . $enabled_checked . '/>';
|
||||
$s .= '<div class="clear"></div>';
|
||||
|
||||
if (get_config("xmpp", "central_userbase")) {
|
||||
if (Config::get("xmpp", "central_userbase")) {
|
||||
$s .= '<label id="xmpp-individual-label" for="xmpp-individual">' . t('Individual Credentials') . '</label>';
|
||||
$s .= '<input id="xmpp-individual" type="checkbox" name="xmpp_individual" value="1" ' . $individual_checked . '/>';
|
||||
$s .= '<div class="clear"></div>';
|
||||
}
|
||||
|
||||
if (!get_config("xmpp", "central_userbase") || get_pconfig(local_user(),"xmpp","individual")) {
|
||||
if (!Config::get("xmpp", "central_userbase") || PConfig::get(local_user(),"xmpp","individual")) {
|
||||
$s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">'.t('Jabber BOSH host').'</label>';
|
||||
$s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="'.$bosh_proxy.'" />';
|
||||
$s .= '<div class="clear"></div>';
|
||||
|
@ -86,7 +89,7 @@ function xmpp_plugin_settings(&$a,&$s) {
|
|||
function xmpp_login($a,$b) {
|
||||
if (!$_SESSION["allow_api"]) {
|
||||
$password = substr(random_string(),0,16);
|
||||
set_pconfig(local_user(), "xmpp", "password", $password);
|
||||
PConfig::set(local_user(), "xmpp", "password", $password);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,16 +98,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'), 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.')),
|
||||
'$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.')),
|
||||
));
|
||||
}
|
||||
|
||||
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);
|
||||
set_config('xmpp','bosh_proxy',$bosh_proxy);
|
||||
set_config('xmpp','central_userbase',$central_userbase);
|
||||
Config::set('xmpp','bosh_proxy',$bosh_proxy);
|
||||
Config::set('xmpp','central_userbase',$central_userbase);
|
||||
info( t('Settings updated.'). EOL );
|
||||
}
|
||||
|
||||
|
@ -122,7 +125,7 @@ function xmpp_converse(&$a,&$s) {
|
|||
if ($a->is_mobile || $a->is_tablet)
|
||||
return;
|
||||
|
||||
if (!get_pconfig(local_user(),"xmpp","enabled"))
|
||||
if (!PConfig::get(local_user(),"xmpp","enabled"))
|
||||
return;
|
||||
|
||||
if (in_array($a->query_string, array("admin/federation/")))
|
||||
|
@ -131,14 +134,14 @@ function xmpp_converse(&$a,&$s) {
|
|||
$a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />'."\n";
|
||||
$a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>'."\n";
|
||||
|
||||
if (get_config("xmpp", "central_userbase") && !get_pconfig(local_user(),"xmpp","individual")) {
|
||||
$bosh_proxy = get_config("xmpp", "bosh_proxy");
|
||||
if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(),"xmpp","individual")) {
|
||||
$bosh_proxy = Config::get("xmpp", "bosh_proxy");
|
||||
|
||||
$password = get_pconfig(local_user(), "xmpp", "password");
|
||||
$password = PConfig::get(local_user(), "xmpp", "password");
|
||||
|
||||
if ($password == "") {
|
||||
$password = substr(random_string(),0,16);
|
||||
set_pconfig(local_user(), "xmpp", "password", $password);
|
||||
PConfig::set(local_user(), "xmpp", "password", $password);
|
||||
}
|
||||
|
||||
$jid = $a->user["nickname"]."@".$a->get_hostname()."/converse-".substr(random_string(),0,5);;
|
||||
|
@ -149,7 +152,7 @@ function xmpp_converse(&$a,&$s) {
|
|||
password: '$password',
|
||||
allow_logout: false,";
|
||||
} else {
|
||||
$bosh_proxy = get_pconfig(local_user(), "xmpp", "bosh_proxy");
|
||||
$bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy");
|
||||
|
||||
$auto_login = "";
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
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');
|
||||
|
@ -19,10 +21,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');
|
||||
set_config('yourls','url1',trim($_POST['']));
|
||||
set_config('yourls','username1',trim($_POST['']));
|
||||
set_config('yourls','password1',trim($_POST['']));
|
||||
set_config('yourls','ssl1',trim($_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['']));
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,15 +43,15 @@ function yourls_addon_settings(&$a,&$s) {
|
|||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/yourls/yourls.css' . '" media="all" />' . "\r\n";
|
||||
|
||||
|
||||
$yourls_url = get_config('yourls','url1');
|
||||
$yourls_username = get_config('yourls','username1');
|
||||
$yourls_password = get_config('yourls', 'password1');
|
||||
$ssl_enabled = get_config('yourls','ssl1');
|
||||
$yourls_url = Config::get('yourls','url1');
|
||||
$yourls_username = Config::get('yourls','username1');
|
||||
$yourls_password = Config::get('yourls', 'password1');
|
||||
$ssl_enabled = Config::get('yourls','ssl1');
|
||||
$ssl_checked = (($ssl_enabled) ? ' checked="checked" ' : '');
|
||||
|
||||
|
||||
|
||||
$yourls_ssl = get_config('yourls', 'ssl1');
|
||||
$yourls_ssl = Config::get('yourls', 'ssl1');
|
||||
|
||||
$s .= '<span id="settings_yourls_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">';
|
||||
$s .= '<h3>' . t('YourLS') . '</h3>';
|
||||
|
@ -91,10 +93,10 @@ function yourls_addon_settings_post(&$a,&$b) {
|
|||
return;
|
||||
|
||||
if($_POST['yourls-submit']) {
|
||||
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']));
|
||||
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']));
|
||||
info( t('yourls Settings saved.') . EOL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user