mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-19 21:03:41 +00:00
Merge pull request #487 from MrPetovan/task/switch-to-array-new-style
Use short form array syntax everywhere
This commit is contained in:
commit
461b3db9f4
68 changed files with 869 additions and 869 deletions
|
@ -96,13 +96,13 @@ function blackout_plugin_admin(&$a, &$o) {
|
||||||
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
|
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
|
||||||
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
|
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$rurl' => array("rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"),
|
'$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"],
|
||||||
'$startdate' => array("startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"),
|
'$startdate' => ["startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"],
|
||||||
'$enddate' => array("enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""),
|
'$enddate' => ["enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""],
|
||||||
|
|
||||||
));
|
]);
|
||||||
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
|
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
|
||||||
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
|
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
|
||||||
if ($date2 < $date1) {
|
if ($date2 < $date1) {
|
||||||
|
|
|
@ -218,7 +218,7 @@ function blockem_init(&$a) {
|
||||||
}
|
}
|
||||||
if(array_key_exists('unblock',$_GET) && $_GET['unblock']) {
|
if(array_key_exists('unblock',$_GET) && $_GET['unblock']) {
|
||||||
$arr = explode(',',$words);
|
$arr = explode(',',$words);
|
||||||
$newarr = array();
|
$newarr = [];
|
||||||
|
|
||||||
if(count($arr)) {
|
if(count($arr)) {
|
||||||
foreach($arr as $x) {
|
foreach($arr as $x) {
|
||||||
|
|
|
@ -57,12 +57,12 @@ function buffer_content(&$a) {
|
||||||
function buffer_plugin_admin(&$a, &$o){
|
function buffer_plugin_admin(&$a, &$o){
|
||||||
$t = get_markup_template( "admin.tpl", "addon/buffer/" );
|
$t = get_markup_template( "admin.tpl", "addon/buffer/" );
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
// name, label, value, help, [extra values]
|
// name, label, value, help, [extra values]
|
||||||
'$client_id' => array('client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''),
|
'$client_id' => ['client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''],
|
||||||
'$client_secret' => array('client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''),
|
'$client_secret' => ['client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
function buffer_plugin_admin_post(&$a){
|
function buffer_plugin_admin_post(&$a){
|
||||||
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
|
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
|
||||||
|
@ -369,7 +369,7 @@ function buffer_send(App $a, &$b)
|
||||||
elseif ($profile->service == "google")
|
elseif ($profile->service == "google")
|
||||||
$post["text"] .= html_entity_decode(" ", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon
|
$post["text"] .= html_entity_decode(" ", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon
|
||||||
|
|
||||||
$message = array();
|
$message = [];
|
||||||
$message["text"] = $post["text"];
|
$message["text"] = $post["text"];
|
||||||
$message["profile_ids[]"] = $profile->id;
|
$message["profile_ids[]"] = $profile->id;
|
||||||
$message["shorten"] = false;
|
$message["shorten"] = false;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
public $ok = false;
|
public $ok = false;
|
||||||
|
|
||||||
private $endpoints = array(
|
private $endpoints = [
|
||||||
'/user' => 'get',
|
'/user' => 'get',
|
||||||
|
|
||||||
'/profiles' => 'get',
|
'/profiles' => 'get',
|
||||||
|
@ -37,9 +37,9 @@
|
||||||
|
|
||||||
'/info/configuration' => 'get',
|
'/info/configuration' => 'get',
|
||||||
|
|
||||||
);
|
];
|
||||||
|
|
||||||
public $errors = array(
|
public $errors = [
|
||||||
'invalid-endpoint' => 'The endpoint you supplied does not appear to be valid.',
|
'invalid-endpoint' => 'The endpoint you supplied does not appear to be valid.',
|
||||||
|
|
||||||
'403' => 'Permission denied.',
|
'403' => 'Permission denied.',
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
'1042' => 'User did not save successfully.',
|
'1042' => 'User did not save successfully.',
|
||||||
'1050' => 'Client could not be found.',
|
'1050' => 'Client could not be found.',
|
||||||
'1051' => 'No authorization to access client.',
|
'1051' => 'No authorization to access client.',
|
||||||
);
|
];
|
||||||
|
|
||||||
function __construct($client_id = '', $client_secret = '', $callback_url = '', $access_token = '') {
|
function __construct($client_id = '', $client_secret = '', $callback_url = '', $access_token = '') {
|
||||||
if ($client_id) $this->set_client_id($client_id);
|
if ($client_id) $this->set_client_id($client_id);
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
if (!$ok) return $this->error('invalid-endpoint');
|
if (!$ok) return $this->error('invalid-endpoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$data || !is_array($data)) $data = array();
|
if (!$data || !is_array($data)) $data = [];
|
||||||
$data['access_token'] = $this->access_token;
|
$data['access_token'] = $this->access_token;
|
||||||
|
|
||||||
$method = $this->endpoints[$done_endpoint]; //get() or post()
|
$method = $this->endpoints[$done_endpoint]; //get() or post()
|
||||||
|
@ -130,17 +130,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function error($error) {
|
function error($error) {
|
||||||
return (object) array('error' => $this->errors[$error]);
|
return (object) ['error' => $this->errors[$error]];
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_access_token_url() {
|
function create_access_token_url() {
|
||||||
$data = array(
|
$data = [
|
||||||
'code' => $this->code,
|
'code' => $this->code,
|
||||||
'grant_type' => 'authorization_code',
|
'grant_type' => 'authorization_code',
|
||||||
'client_id' => $this->client_id,
|
'client_id' => $this->client_id,
|
||||||
'client_secret' => $this->client_secret,
|
'client_secret' => $this->client_secret,
|
||||||
'redirect_uri' => $this->callback_url,
|
'redirect_uri' => $this->callback_url,
|
||||||
);
|
];
|
||||||
|
|
||||||
$obj = $this->post($this->access_token_url, $data);
|
$obj = $this->post($this->access_token_url, $data);
|
||||||
$this->access_token = $obj->access_token;
|
$this->access_token = $obj->access_token;
|
||||||
|
@ -150,15 +150,15 @@
|
||||||
|
|
||||||
function req($url = '', $data = '', $post = true) {
|
function req($url = '', $data = '', $post = true) {
|
||||||
if (!$url) return false;
|
if (!$url) return false;
|
||||||
if (!$data || !is_array($data)) $data = array();
|
if (!$data || !is_array($data)) $data = [];
|
||||||
|
|
||||||
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
|
$options = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false];
|
||||||
|
|
||||||
if ($post) {
|
if ($post) {
|
||||||
$options += array(
|
$options += [
|
||||||
CURLOPT_POST => $post,
|
CURLOPT_POST => $post,
|
||||||
CURLOPT_POSTFIELDS => $data
|
CURLOPT_POSTFIELDS => $data
|
||||||
);
|
];
|
||||||
} else {
|
} else {
|
||||||
$url .= '?' . http_build_query($data);
|
$url .= '?' . http_build_query($data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,27 +62,27 @@ function communityhome_home(&$a, &$o){
|
||||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
|
||||||
|
|
||||||
if (!Config::get('communityhome','hidelogin')){
|
if (!Config::get('communityhome','hidelogin')){
|
||||||
$aside = array(
|
$aside = [
|
||||||
'$tab_1' => t('Login'),
|
'$tab_1' => t('Login'),
|
||||||
'$tab_2' => t('OpenID'),
|
'$tab_2' => t('OpenID'),
|
||||||
'$noOid' => Config::get('system','no_openid'),
|
'$noOid' => Config::get('system','no_openid'),
|
||||||
);
|
];
|
||||||
|
|
||||||
// login form
|
// login form
|
||||||
$aside['$login_title'] = t('Login');
|
$aside['$login_title'] = t('Login');
|
||||||
$aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
|
$aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
|
||||||
} else {
|
} else {
|
||||||
$aside = array(
|
$aside = [
|
||||||
//'$tab_1' => t('Login'),
|
//'$tab_1' => t('Login'),
|
||||||
//'$tab_2' => t('OpenID'),
|
//'$tab_2' => t('OpenID'),
|
||||||
//'$noOid' => Config::get('system','no_openid'),
|
//'$noOid' => Config::get('system','no_openid'),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// last 12 users
|
// last 12 users
|
||||||
if (Config::get('communityhome','showlastusers')){
|
if (Config::get('communityhome','showlastusers')){
|
||||||
$aside['$lastusers_title'] = t('Latest users');
|
$aside['$lastusers_title'] = t('Latest users');
|
||||||
$aside['$lastusers_items'] = array();
|
$aside['$lastusers_items'] = [];
|
||||||
$sql_extra = "";
|
$sql_extra = "";
|
||||||
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
|
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
|
||||||
$order = " ORDER BY `register_date` DESC ";
|
$order = " ORDER BY `register_date` DESC ";
|
||||||
|
@ -99,12 +99,12 @@ function communityhome_home(&$a, &$o){
|
||||||
$photo = 'thumb';
|
$photo = 'thumb';
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||||
$entry = replace_macros($tpl,array(
|
$entry = replace_macros($tpl,[
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$profile_link' => $profile_link,
|
'$profile_link' => $profile_link,
|
||||||
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
|
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
|
||||||
'$alt_text' => $rr['name'],
|
'$alt_text' => $rr['name'],
|
||||||
));
|
]);
|
||||||
$aside['$lastusers_items'][] = $entry;
|
$aside['$lastusers_items'][] = $entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,17 +127,17 @@ function communityhome_home(&$a, &$o){
|
||||||
LIMIT 0,10");
|
LIMIT 0,10");
|
||||||
if($r && count($r)) {
|
if($r && count($r)) {
|
||||||
$aside['$activeusers_title'] = t('Most active users');
|
$aside['$activeusers_title'] = t('Most active users');
|
||||||
$aside['$activeusers_items'] = array();
|
$aside['$activeusers_items'] = [];
|
||||||
|
|
||||||
$photo = 'thumb';
|
$photo = 'thumb';
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||||
$entry = replace_macros($tpl,array(
|
$entry = replace_macros($tpl,[
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$profile_link' => $profile_link,
|
'$profile_link' => $profile_link,
|
||||||
'$photo' => $rr[$photo],
|
'$photo' => $rr[$photo],
|
||||||
'$photo_user' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
|
'$photo_user' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
|
||||||
));
|
]);
|
||||||
$aside['$activeusers_items'][] = $entry;
|
$aside['$activeusers_items'][] = $entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ function communityhome_home(&$a, &$o){
|
||||||
// last 12 photos
|
// last 12 photos
|
||||||
if (Config::get('communityhome','showlastphotos')){
|
if (Config::get('communityhome','showlastphotos')){
|
||||||
$aside['$photos_title'] = t('Latest photos');
|
$aside['$photos_title'] = t('Latest photos');
|
||||||
$aside['$photos_items'] = array();
|
$aside['$photos_items'] = [];
|
||||||
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
|
||||||
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
|
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
|
||||||
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
|
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
|
||||||
|
@ -169,13 +169,13 @@ function communityhome_home(&$a, &$o){
|
||||||
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
|
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
|
||||||
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
|
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
|
||||||
|
|
||||||
$entry = replace_macros($tpl,array(
|
$entry = replace_macros($tpl,[
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$profile_link' => $photo_page,
|
'$profile_link' => $photo_page,
|
||||||
'$photo' => $photo_url,
|
'$photo' => $photo_url,
|
||||||
'$photo_user' => $rr['username'],
|
'$photo_user' => $rr['username'],
|
||||||
'$photo_title' => $rr['desc']
|
'$photo_title' => $rr['desc']
|
||||||
));
|
]);
|
||||||
|
|
||||||
$aside['$photos_items'][] = $entry;
|
$aside['$photos_items'][] = $entry;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ function communityhome_home(&$a, &$o){
|
||||||
// last 10 liked items
|
// last 10 liked items
|
||||||
if (Config::get('communityhome','showlastlike')){
|
if (Config::get('communityhome','showlastlike')){
|
||||||
$aside['$like_title'] = t('Latest likes');
|
$aside['$like_title'] = t('Latest likes');
|
||||||
$aside['$like_items'] = array();
|
$aside['$like_items'] = [];
|
||||||
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
|
||||||
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
|
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
|
||||||
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
|
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
|
||||||
|
@ -215,7 +215,7 @@ function communityhome_home(&$a, &$o){
|
||||||
default:
|
default:
|
||||||
if ($rr['resource-id']){
|
if ($rr['resource-id']){
|
||||||
$post_type = t('photo');
|
$post_type = t('photo');
|
||||||
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
$m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
||||||
$rr['plink'] = $m[1];
|
$rr['plink'] = $m[1];
|
||||||
} else {
|
} else {
|
||||||
$post_type = t('status');
|
$post_type = t('status');
|
||||||
|
|
|
@ -92,16 +92,16 @@ include("UnitConvertor.php");
|
||||||
$conv = new TP_Converter('en');
|
$conv = new TP_Converter('en');
|
||||||
|
|
||||||
|
|
||||||
$conversions = array(
|
$conversions = [
|
||||||
'Temperature'=>array('base' =>'Celsius',
|
'Temperature'=>['base' =>'Celsius',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'Fahrenheit'=>array('ratio'=>1.8, 'offset'=>32),
|
'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32],
|
||||||
'Kelvin'=>array('ratio'=>1, 'offset'=>273),
|
'Kelvin'=>['ratio'=>1, 'offset'=>273],
|
||||||
'Reaumur'=>0.8
|
'Reaumur'=>0.8
|
||||||
)
|
]
|
||||||
),
|
],
|
||||||
'Weight' => array('base' =>'kg',
|
'Weight' => ['base' =>'kg',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'g'=>1000,
|
'g'=>1000,
|
||||||
'mg'=>1000000,
|
'mg'=>1000000,
|
||||||
't'=>0.001,
|
't'=>0.001,
|
||||||
|
@ -112,10 +112,10 @@ $conversions = array(
|
||||||
'cwt(US)' => 0.022046,
|
'cwt(US)' => 0.022046,
|
||||||
'ton (US)' => 0.0011023,
|
'ton (US)' => 0.0011023,
|
||||||
'ton (UK)' => 0.0009842
|
'ton (UK)' => 0.0009842
|
||||||
)
|
]
|
||||||
),
|
],
|
||||||
'Distance' => array('base' =>'km',
|
'Distance' => ['base' =>'km',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'm'=>1000,
|
'm'=>1000,
|
||||||
'dm'=>10000,
|
'dm'=>10000,
|
||||||
'cm'=>100000,
|
'cm'=>100000,
|
||||||
|
@ -127,10 +127,10 @@ $conversions = array(
|
||||||
'yd'=>1093.6,
|
'yd'=>1093.6,
|
||||||
'furlong'=>4.970969537898672,
|
'furlong'=>4.970969537898672,
|
||||||
'fathom'=>546.8066491688539
|
'fathom'=>546.8066491688539
|
||||||
)
|
]
|
||||||
),
|
],
|
||||||
'Area' => array('base' =>'km 2',
|
'Area' => ['base' =>'km 2',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'ha'=>100,
|
'ha'=>100,
|
||||||
'acre'=>247.105,
|
'acre'=>247.105,
|
||||||
'm 2'=>pow(1000,2),
|
'm 2'=>pow(1000,2),
|
||||||
|
@ -142,10 +142,10 @@ $conversions = array(
|
||||||
'in 2'=>pow(39370,2),
|
'in 2'=>pow(39370,2),
|
||||||
'ft 2'=>pow(3280.8,2),
|
'ft 2'=>pow(3280.8,2),
|
||||||
'yd 2'=>pow(1093.6,2),
|
'yd 2'=>pow(1093.6,2),
|
||||||
)
|
]
|
||||||
),
|
],
|
||||||
'Volume' => array('base' =>'m 3',
|
'Volume' => ['base' =>'m 3',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'in 3'=>61023.6,
|
'in 3'=>61023.6,
|
||||||
'ft 3'=>35.315,
|
'ft 3'=>35.315,
|
||||||
'cm 3'=>pow(10,6),
|
'cm 3'=>pow(10,6),
|
||||||
|
@ -165,18 +165,18 @@ $conversions = array(
|
||||||
'barrel petroleum'=>1000/158.99,
|
'barrel petroleum'=>1000/158.99,
|
||||||
'Register Tons'=>2.832,
|
'Register Tons'=>2.832,
|
||||||
'Ocean Tons'=>1.1327
|
'Ocean Tons'=>1.1327
|
||||||
)
|
]
|
||||||
),
|
],
|
||||||
'Speed' =>array('base' =>'kmph',
|
'Speed' =>['base' =>'kmph',
|
||||||
'conv'=>array(
|
'conv'=>[
|
||||||
'mps'=>0.0001726031,
|
'mps'=>0.0001726031,
|
||||||
'milesph'=>0.62137,
|
'milesph'=>0.62137,
|
||||||
'knots'=>0.53996,
|
'knots'=>0.53996,
|
||||||
'mach STP'=>0.0008380431,
|
'mach STP'=>0.0008380431,
|
||||||
'c (warp)'=>9.265669e-10
|
'c (warp)'=>9.265669e-10
|
||||||
)
|
]
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
while (list($key,$val) = each($conversions)) {
|
while (list($key,$val) = each($conversions)) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
|
||||||
} else {
|
} else {
|
||||||
$desc = (string)$res->weather['value'].', '.(string)$res->clouds['name'];
|
$desc = (string)$res->weather['value'].', '.(string)$res->clouds['name'];
|
||||||
}
|
}
|
||||||
$r = array(
|
$r = [
|
||||||
'city'=> (string) $res->city['name'][0],
|
'city'=> (string) $res->city['name'][0],
|
||||||
'country' => (string) $res->city->country[0],
|
'country' => (string) $res->city->country[0],
|
||||||
'lat' => (string) $res->city->coord['lat'],
|
'lat' => (string) $res->city->coord['lat'],
|
||||||
|
@ -59,7 +59,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
|
||||||
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
|
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
|
||||||
'update' => (string)$res->lastupdate['value'],
|
'update' => (string)$res->lastupdate['value'],
|
||||||
'icon' => (string)$res->weather['icon']
|
'icon' => (string)$res->weather['icon']
|
||||||
);
|
];
|
||||||
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||||
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
|
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
|
||||||
return $r;
|
return $r;
|
||||||
|
@ -111,7 +111,7 @@ function curweather_network_mod_init(&$fk_app,&$b) {
|
||||||
|
|
||||||
if ($ok) {
|
if ($ok) {
|
||||||
$t = get_markup_template("widget.tpl", "addon/curweather/" );
|
$t = get_markup_template("widget.tpl", "addon/curweather/" );
|
||||||
$curweather = replace_macros ($t, array(
|
$curweather = replace_macros ($t, [
|
||||||
'$title' => t("Current Weather"),
|
'$title' => t("Current Weather"),
|
||||||
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
|
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
|
||||||
'$city' => $res['city'],
|
'$city' => $res['city'],
|
||||||
|
@ -119,20 +119,20 @@ function curweather_network_mod_init(&$fk_app,&$b) {
|
||||||
'$lat' => $res['lat'],
|
'$lat' => $res['lat'],
|
||||||
'$description' => $res['descripion'],
|
'$description' => $res['descripion'],
|
||||||
'$temp' => $res['temperature'],
|
'$temp' => $res['temperature'],
|
||||||
'$relhumidity' => array('caption'=>t('Relative Humidity'), 'val'=>$res['humidity']),
|
'$relhumidity' => ['caption'=>t('Relative Humidity'), 'val'=>$res['humidity']],
|
||||||
'$pressure' => array('caption'=>t('Pressure'), 'val'=>$res['pressure']),
|
'$pressure' => ['caption'=>t('Pressure'), 'val'=>$res['pressure']],
|
||||||
'$wind' => array('caption'=>t('Wind'), 'val'=> $res['wind']),
|
'$wind' => ['caption'=>t('Wind'), 'val'=> $res['wind']],
|
||||||
'$lastupdate' => t('Last Updated').': '.$res['update'].'UTC',
|
'$lastupdate' => t('Last Updated').': '.$res['update'].'UTC',
|
||||||
'$databy' => t('Data by'),
|
'$databy' => t('Data by'),
|
||||||
'$showonmap' => t('Show on map')
|
'$showonmap' => t('Show on map')
|
||||||
));
|
]);
|
||||||
} else {
|
} else {
|
||||||
$t = get_markup_template('widget-error.tpl', 'addon/curweather/');
|
$t = get_markup_template('widget-error.tpl', 'addon/curweather/');
|
||||||
$curweather = replace_macros( $t, array(
|
$curweather = replace_macros( $t, [
|
||||||
'$problem' => t('There was a problem accessing the weather data. But have a look'),
|
'$problem' => t('There was a problem accessing the weather data. But have a look'),
|
||||||
'$rpt' => $rpt,
|
'$rpt' => $rpt,
|
||||||
'$atOWM' => t('at OpenWeatherMap')
|
'$atOWM' => t('at OpenWeatherMap')
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fk_app->page['aside'] = $curweather.$fk_app->page['aside'];
|
$fk_app->page['aside'] = $curweather.$fk_app->page['aside'];
|
||||||
|
@ -171,15 +171,15 @@ function curweather_plugin_settings(&$a,&$s) {
|
||||||
|
|
||||||
// load template and replace the macros
|
// load template and replace the macros
|
||||||
$t = get_markup_template("settings.tpl", "addon/curweather/" );
|
$t = get_markup_template("settings.tpl", "addon/curweather/" );
|
||||||
$s = replace_macros ($t, array(
|
$s = replace_macros ($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$header' => t('Current Weather').' '.t('Settings'),
|
'$header' => t('Current Weather').' '.t('Settings'),
|
||||||
'$noappidtext' => $noappidtext,
|
'$noappidtext' => $noappidtext,
|
||||||
'$info' => t('Enter either the name of your location or the zip code.'),
|
'$info' => t('Enter either the name of your location or the zip code.'),
|
||||||
'$curweather_loc' => array( 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ),
|
'$curweather_loc' => [ 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ],
|
||||||
'$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in °C or °F'), array('metric'=>'°C', 'imperial'=>'°F')),
|
'$curweather_units' => [ 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in °C or °F'), ['metric'=>'°C', 'imperial'=>'°F']],
|
||||||
'$enabled' => array( 'curweather_enable', t('Show weather data'), $enable, '')
|
'$enabled' => [ 'curweather_enable', t('Show weather data'), $enable, '']
|
||||||
));
|
]);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,9 +200,9 @@ function curweather_plugin_admin (&$a, &$o) {
|
||||||
$appid = Config::get('curweather','appid');
|
$appid = Config::get('curweather','appid');
|
||||||
$cachetime = Config::get('curweather','cachetime');
|
$cachetime = Config::get('curweather','cachetime');
|
||||||
$t = get_markup_template("admin.tpl", "addon/curweather/" );
|
$t = get_markup_template("admin.tpl", "addon/curweather/" );
|
||||||
$o = replace_macros ($t, array(
|
$o = replace_macros ($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$cachetime' => array('cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), array('0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes'))),
|
'$cachetime' => ['cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes')]],
|
||||||
'$appid' => array('appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap'))
|
'$appid' => ['appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap')]
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@ define("CALDAV_NAMESPACE_PRIVATE", 1);
|
||||||
define("CALDAV_FRIENDICA_MINE", "friendica-mine");
|
define("CALDAV_FRIENDICA_MINE", "friendica-mine");
|
||||||
define("CALDAV_FRIENDICA_CONTACTS", "friendica-contacts");
|
define("CALDAV_FRIENDICA_CONTACTS", "friendica-contacts");
|
||||||
|
|
||||||
$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = array(CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS);
|
$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = [CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS];
|
||||||
$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CalDAV_Backend_Friendica");
|
$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CalDAV_Backend_Friendica"];
|
||||||
|
|
||||||
define("CARDDAV_NAMESPACE_PRIVATE", 1);
|
define("CARDDAV_NAMESPACE_PRIVATE", 1);
|
||||||
define("CARDDAV_FRIENDICA_CONTACT", "friendica");
|
define("CARDDAV_FRIENDICA_CONTACT", "friendica");
|
||||||
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = array(CARDDAV_FRIENDICA_CONTACT);
|
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = [CARDDAV_FRIENDICA_CONTACT];
|
||||||
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CardDAV_Backend_Friendica");
|
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CardDAV_Backend_Friendica"];
|
||||||
|
|
||||||
$GLOBALS["CALDAV_ACL_PLUGIN_CLASS"] = "Sabre_DAVACL_Plugin_Friendica";
|
$GLOBALS["CALDAV_ACL_PLUGIN_CLASS"] = "Sabre_DAVACL_Plugin_Friendica";
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ function dav_compat_principal2namespace($principalUri = "")
|
||||||
|
|
||||||
if (strpos($principalUri, "principals/users/") !== 0) return null;
|
if (strpos($principalUri, "principals/users/") !== 0) return null;
|
||||||
$username = substr($principalUri, strlen("principals/users/"));
|
$username = substr($principalUri, strlen("principals/users/"));
|
||||||
return array("namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username));
|
return ["namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,13 +200,13 @@ function wdcal_calendar_factory_by_id($calendar_id)
|
||||||
*/
|
*/
|
||||||
function wdcal_create_std_calendars_get_statements($user_id, $withcheck = true)
|
function wdcal_create_std_calendars_get_statements($user_id, $withcheck = true)
|
||||||
{
|
{
|
||||||
$stms = array();
|
$stms = [];
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$uris = array(
|
$uris = [
|
||||||
'private' => t("Private Calendar"),
|
'private' => t("Private Calendar"),
|
||||||
CALDAV_FRIENDICA_MINE => t("Friendica Events: Mine"),
|
CALDAV_FRIENDICA_MINE => t("Friendica Events: Mine"),
|
||||||
CALDAV_FRIENDICA_CONTACTS => t("Friendica Events: Contacts"),
|
CALDAV_FRIENDICA_CONTACTS => t("Friendica Events: Contacts"),
|
||||||
);
|
];
|
||||||
foreach ($uris as $uri => $name) {
|
foreach ($uris as $uri => $name) {
|
||||||
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
||||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
|
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
|
||||||
|
@ -242,12 +242,12 @@ function wdcal_create_std_calendars()
|
||||||
*/
|
*/
|
||||||
function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = true)
|
function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = true)
|
||||||
{
|
{
|
||||||
$stms = array();
|
$stms = [];
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$uris = array(
|
$uris = [
|
||||||
'private' => t("Private Addresses"),
|
'private' => t("Private Addresses"),
|
||||||
CARDDAV_FRIENDICA_CONTACT => t("Friendica Contacts"),
|
CARDDAV_FRIENDICA_CONTACT => t("Friendica Contacts"),
|
||||||
);
|
];
|
||||||
foreach ($uris as $uri => $name) {
|
foreach ($uris as $uri => $name) {
|
||||||
$cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
$cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
||||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
|
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
function dav_get_update_statements($from_version)
|
function dav_get_update_statements($from_version)
|
||||||
{
|
{
|
||||||
$stms = array();
|
$stms = [];
|
||||||
|
|
||||||
if ($from_version == 1) {
|
if ($from_version == 1) {
|
||||||
$stms[] = "ALTER TABLE `dav_calendarobjects`
|
$stms[] = "ALTER TABLE `dav_calendarobjects`
|
||||||
|
@ -30,7 +30,7 @@ function dav_get_update_statements($from_version)
|
||||||
`dav_locks` ,
|
`dav_locks` ,
|
||||||
`dav_notifications` ;";
|
`dav_notifications` ;";
|
||||||
|
|
||||||
$stms = array_merge($stms, dav_get_create_statements(array("dav_calendarobjects")));
|
$stms = array_merge($stms, dav_get_create_statements(["dav_calendarobjects"]));
|
||||||
|
|
||||||
$user_ids = q("SELECT DISTINCT `uid` FROM %s%scalendars", CALDAV_SQL_DB, CALDAV_SQL_PREFIX);
|
$user_ids = q("SELECT DISTINCT `uid` FROM %s%scalendars", CALDAV_SQL_DB, CALDAV_SQL_PREFIX);
|
||||||
foreach ($user_ids as $user) $stms = array_merge($stms, wdcal_create_std_calendars_get_statements($user["uid"], false));
|
foreach ($user_ids as $user) $stms = array_merge($stms, wdcal_create_std_calendars_get_statements($user["uid"], false));
|
||||||
|
@ -43,7 +43,7 @@ function dav_get_update_statements($from_version)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($from_version, array(1, 2))) {
|
if (in_array($from_version, [1, 2])) {
|
||||||
$stms[] = "CREATE TABLE IF NOT EXISTS `dav_addressbooks` (
|
$stms[] = "CREATE TABLE IF NOT EXISTS `dav_addressbooks` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`namespace` mediumint(9) NOT NULL,
|
`namespace` mediumint(9) NOT NULL,
|
||||||
|
@ -80,9 +80,9 @@ function dav_get_update_statements($from_version)
|
||||||
* @param array $except
|
* @param array $except
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function dav_get_create_statements($except = array())
|
function dav_get_create_statements($except = [])
|
||||||
{
|
{
|
||||||
$arr = array();
|
$arr = [];
|
||||||
|
|
||||||
if (!in_array("dav_caldav_log", $except)) $arr[] = "CREATE TABLE IF NOT EXISTS `dav_caldav_log` (
|
if (!in_array("dav_caldav_log", $except)) $arr[] = "CREATE TABLE IF NOT EXISTS `dav_caldav_log` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
@ -240,7 +240,7 @@ function dav_check_tables()
|
||||||
function dav_create_tables()
|
function dav_create_tables()
|
||||||
{
|
{
|
||||||
$stms = dav_get_create_statements();
|
$stms = dav_get_create_statements();
|
||||||
$errors = array();
|
$errors = [];
|
||||||
|
|
||||||
foreach ($stms as $st) { // @TODO Friendica-dependent
|
foreach ($stms as $st) { // @TODO Friendica-dependent
|
||||||
dba::e($st);
|
dba::e($st);
|
||||||
|
@ -258,10 +258,10 @@ function dav_create_tables()
|
||||||
function dav_upgrade_tables()
|
function dav_upgrade_tables()
|
||||||
{
|
{
|
||||||
$ver = dav_check_tables();
|
$ver = dav_check_tables();
|
||||||
if (!in_array($ver, array(1, 2))) return array("Unknown error");
|
if (!in_array($ver, [1, 2])) return ["Unknown error"];
|
||||||
$stms = dav_get_update_statements($ver);
|
$stms = dav_get_update_statements($ver);
|
||||||
|
|
||||||
$errors = array();
|
$errors = [];
|
||||||
|
|
||||||
foreach ($stms as $st) { // @TODO Friendica-dependent
|
foreach ($stms as $st) { // @TODO Friendica-dependent
|
||||||
dba::e($st);
|
dba::e($st);
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
|
|
||||||
$summary = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
|
$summary = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
"jq_id" => $row["id"],
|
"jq_id" => $row["id"],
|
||||||
"ev_id" => $row["id"],
|
"ev_id" => $row["id"],
|
||||||
"summary" => escape_tags($summary),
|
"summary" => escape_tags($summary),
|
||||||
|
@ -142,7 +142,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
"url_detail" => $base_path . "/events/event/" . $row["id"],
|
"url_detail" => $base_path . "/events/event/" . $row["id"],
|
||||||
"url_edit" => "",
|
"url_edit" => "",
|
||||||
"special_type" => ($row["type"] == "birthday" ? "birthday" : ""),
|
"special_type" => ($row["type"] == "birthday" ? "birthday" : ""),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
|
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
|
||||||
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
|
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
|
||||||
}
|
}
|
||||||
$ret = array();
|
$ret = [];
|
||||||
|
|
||||||
$r = q("SELECT * FROM `event` WHERE `uid` = %d " . $sql_where . " ORDER BY `start`", IntVal($calendar["namespace_id"]));
|
$r = q("SELECT * FROM `event` WHERE `uid` = %d " . $sql_where . " ORDER BY `start`", IntVal($calendar["namespace_id"]));
|
||||||
|
|
||||||
|
@ -214,21 +214,21 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
|
||||||
public function getCalendarsForUser($principalUri)
|
public function getCalendarsForUser($principalUri)
|
||||||
{
|
{
|
||||||
$n = dav_compat_principal2namespace($principalUri);
|
$n = dav_compat_principal2namespace($principalUri);
|
||||||
if ($n["namespace"] != $this->getNamespace()) return array();
|
if ($n["namespace"] != $this->getNamespace()) return [];
|
||||||
|
|
||||||
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), IntVal($n["namespace_id"]));
|
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), IntVal($n["namespace_id"]));
|
||||||
$ret = array();
|
$ret = [];
|
||||||
foreach ($cals as $cal) {
|
foreach ($cals as $cal) {
|
||||||
if (!in_array($cal["uri"], $GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"])) continue;
|
if (!in_array($cal["uri"], $GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"])) continue;
|
||||||
|
|
||||||
$dat = array(
|
$dat = [
|
||||||
"id" => $cal["id"],
|
"id" => $cal["id"],
|
||||||
"uri" => $cal["uri"],
|
"uri" => $cal["uri"],
|
||||||
"principaluri" => $principalUri,
|
"principaluri" => $principalUri,
|
||||||
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0',
|
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0',
|
||||||
'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array("VEVENT")),
|
'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(["VEVENT"]),
|
||||||
"calendar_class" => "Sabre_CalDAV_Calendar_Virtual",
|
"calendar_class" => "Sabre_CalDAV_Calendar_Virtual",
|
||||||
);
|
];
|
||||||
foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field];
|
foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field];
|
||||||
|
|
||||||
$ret[] = $dat;
|
$ret[] = $dat;
|
||||||
|
|
|
@ -46,13 +46,13 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
|
||||||
{
|
{
|
||||||
$uid = dav_compat_principal2uid($principalUri);
|
$uid = dav_compat_principal2uid($principalUri);
|
||||||
|
|
||||||
$addressBooks = array();
|
$addressBooks = [];
|
||||||
|
|
||||||
$books = q("SELECT id, ctag FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
$books = q("SELECT id, ctag FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
|
||||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CARDDAV_NAMESPACE_PRIVATE, IntVal($uid), dbesc(CARDDAV_FRIENDICA_CONTACT));
|
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CARDDAV_NAMESPACE_PRIVATE, IntVal($uid), dbesc(CARDDAV_FRIENDICA_CONTACT));
|
||||||
$ctag = $books[0]["ctag"];
|
$ctag = $books[0]["ctag"];
|
||||||
|
|
||||||
$addressBooks[] = array(
|
$addressBooks[] = [
|
||||||
'id' => $books[0]["id"],
|
'id' => $books[0]["id"],
|
||||||
'uri' => "friendica",
|
'uri' => "friendica",
|
||||||
'principaluri' => $principalUri,
|
'principaluri' => $principalUri,
|
||||||
|
@ -61,7 +61,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
|
||||||
'{http://calendarserver.org/ns/}getctag' => $ctag,
|
'{http://calendarserver.org/ns/}getctag' => $ctag,
|
||||||
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
|
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
|
||||||
new Sabre_CardDAV_Property_SupportedAddressData(),
|
new Sabre_CardDAV_Property_SupportedAddressData(),
|
||||||
);
|
];
|
||||||
|
|
||||||
return $addressBooks;
|
return $addressBooks;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
|
||||||
{
|
{
|
||||||
$name = explode(" ", $contact["name"]);
|
$name = explode(" ", $contact["name"]);
|
||||||
$first_name = $last_name = "";
|
$first_name = $last_name = "";
|
||||||
$middle_name = array();
|
$middle_name = [];
|
||||||
$num = count($name);
|
$num = count($name);
|
||||||
for ($i = 0; $i < $num && $first_name == ""; $i++) if ($name[$i] != "") {
|
for ($i = 0; $i < $num && $first_name == ""; $i++) if ($name[$i] != "") {
|
||||||
$first_name = $name[$i];
|
$first_name = $name[$i];
|
||||||
|
@ -114,14 +114,14 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
|
||||||
}
|
}
|
||||||
|
|
||||||
$vcard = vcard_source_compile($vcarddata);
|
$vcard = vcard_source_compile($vcarddata);
|
||||||
return array(
|
return [
|
||||||
"id" => $contact["id"],
|
"id" => $contact["id"],
|
||||||
"carddata" => $vcard,
|
"carddata" => $vcard,
|
||||||
"uri" => $contact["id"] . ".vcf",
|
"uri" => $contact["id"] . ".vcf",
|
||||||
"lastmodified" => wdcal_mySql2PhpTime($vcarddata->last_update),
|
"lastmodified" => wdcal_mySql2PhpTime($vcarddata->last_update),
|
||||||
"etag" => md5($vcard),
|
"etag" => md5($vcard),
|
||||||
"size" => strlen($vcard),
|
"size" => strlen($vcard),
|
||||||
);
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
|
||||||
*/
|
*/
|
||||||
public function getUsers()
|
public function getUsers()
|
||||||
{
|
{
|
||||||
return array($this->currentUser);
|
return [$this->currentUser];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,16 +61,16 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
|
||||||
{
|
{
|
||||||
|
|
||||||
// This backend only support principals in one collection
|
// This backend only support principals in one collection
|
||||||
if ($prefixPath !== $this->prefix) return array();
|
if ($prefixPath !== $this->prefix) return [];
|
||||||
|
|
||||||
$users = array();
|
$users = [];
|
||||||
|
|
||||||
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($this->authBackend->getCurrentUser()) );
|
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($this->authBackend->getCurrentUser()) );
|
||||||
foreach ($r as $t) {
|
foreach ($r as $t) {
|
||||||
$users[] = array(
|
$users[] = [
|
||||||
'uri' => $this->prefix . '/' . strtolower($t['nickname']),
|
'uri' => $this->prefix . '/' . strtolower($t['nickname']),
|
||||||
'{DAV:}displayname' => $t['nickname'],
|
'{DAV:}displayname' => $t['nickname'],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $users;
|
return $users;
|
||||||
|
@ -94,24 +94,24 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
|
||||||
if ($prefixPath !== $this->prefix) return null;
|
if ($prefixPath !== $this->prefix) return null;
|
||||||
|
|
||||||
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($userName) );
|
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($userName) );
|
||||||
if (count($r) == 0) return array();
|
if (count($r) == 0) return [];
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'uri' => $this->prefix . '/' . strtolower($r[0]['nickname']),
|
'uri' => $this->prefix . '/' . strtolower($r[0]['nickname']),
|
||||||
'{DAV:}displayname' => $r[0]['nickname'],
|
'{DAV:}displayname' => $r[0]['nickname'],
|
||||||
);
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getGroupMemberSet($principal)
|
function getGroupMemberSet($principal)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGroupMembership($principal)
|
function getGroupMembership($principal)
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ function wdcal_import_user_ics($calendar_id) {
|
||||||
/** @var Sabre\VObject\Component\VCalendar $vObject */
|
/** @var Sabre\VObject\Component\VCalendar $vObject */
|
||||||
$vObject = Sabre\VObject\Reader::read($text);
|
$vObject = Sabre\VObject\Reader::read($text);
|
||||||
$comp = $vObject->getComponents();
|
$comp = $vObject->getComponents();
|
||||||
$imported = array();
|
$imported = [];
|
||||||
foreach ($comp as $c) try {
|
foreach ($comp as $c) try {
|
||||||
/** @var Sabre\VObject\Component\VEvent $c */
|
/** @var Sabre\VObject\Component\VEvent $c */
|
||||||
$uid = $c->__get("UID")->value;
|
$uid = $c->__get("UID")->value;
|
||||||
|
@ -171,18 +171,18 @@ function wdcal_import_user_ics($calendar_id) {
|
||||||
* @param bool $show_nav
|
* @param bool $show_nav
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = array(), $show_nav = true)
|
function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = [], $show_nav = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$localization = wdcal_local::getInstanceByUser($a->user["uid"]);
|
$localization = wdcal_local::getInstanceByUser($a->user["uid"]);
|
||||||
|
|
||||||
if (count($calendars_selected) == 0) foreach ($calendars as $c) {
|
if (count($calendars_selected) == 0) foreach ($calendars as $c) {
|
||||||
$prop = $c->getProperties(array("id"));
|
$prop = $c->getProperties(["id"]);
|
||||||
$calendars_selected[] = $prop["id"];
|
$calendars_selected[] = $prop["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$opts = array(
|
$opts = [
|
||||||
"view" => $view,
|
"view" => $view,
|
||||||
"theme" => $theme,
|
"theme" => $theme,
|
||||||
"readonly" => $readonly,
|
"readonly" => $readonly,
|
||||||
|
@ -194,7 +194,7 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
|
||||||
"date_format_dm3" => $localization->dateformat_js_dm3(),
|
"date_format_dm3" => $localization->dateformat_js_dm3(),
|
||||||
"date_format_full" => $localization->dateformat_datepicker_js(),
|
"date_format_full" => $localization->dateformat_datepicker_js(),
|
||||||
"baseurl" => $a->get_baseurl() . "/dav/wdcal/",
|
"baseurl" => $a->get_baseurl() . "/dav/wdcal/",
|
||||||
);
|
];
|
||||||
|
|
||||||
$x = '
|
$x = '
|
||||||
<script>
|
<script>
|
||||||
|
@ -207,7 +207,7 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
|
||||||
<div class="calselect"><strong>Available Calendars:</strong>';
|
<div class="calselect"><strong>Available Calendars:</strong>';
|
||||||
|
|
||||||
foreach ($calendars as $cal) {
|
foreach ($calendars as $cal) {
|
||||||
$cal_id = $cal->getProperties(array("id", DAV_DISPLAYNAME));
|
$cal_id = $cal->getProperties(["id", DAV_DISPLAYNAME]);
|
||||||
$x .= '<label style="margin-left: 10px; margin-right: 10px;"><input type="checkbox" name="cals[]" value="' . $cal_id["id"] . '"';
|
$x .= '<label style="margin-left: 10px; margin-right: 10px;"><input type="checkbox" name="cals[]" value="' . $cal_id["id"] . '"';
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($calendars_selected as $pre) if ($pre["id"] == $cal_id["id"]) $found = true;
|
foreach ($calendars_selected as $pre) if ($pre["id"] == $cal_id["id"]) $found = true;
|
||||||
|
|
|
@ -198,7 +198,7 @@ function dav_content()
|
||||||
} else {
|
} else {
|
||||||
$server = dav_create_server(true, true, false);
|
$server = dav_create_server(true, true, false);
|
||||||
$cals = dav_get_current_user_calendars($server, DAV_ACL_READ);
|
$cals = dav_get_current_user_calendars($server, DAV_ACL_READ);
|
||||||
$x = wdcal_printCalendar($cals, array(), $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
|
$x = wdcal_printCalendar($cals, [], $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DAVVersionMismatchException $e) {
|
} catch (DAVVersionMismatchException $e) {
|
||||||
|
@ -238,12 +238,12 @@ function dav_event_updated_hook(&$a, &$b)
|
||||||
*/
|
*/
|
||||||
function dav_profile_tabs_hook(&$a, &$b)
|
function dav_profile_tabs_hook(&$a, &$b)
|
||||||
{
|
{
|
||||||
$b["tabs"][] = array(
|
$b["tabs"][] = [
|
||||||
"label" => t('Calendar'),
|
"label" => t('Calendar'),
|
||||||
"url" => $a->get_baseurl() . "/dav/wdcal/",
|
"url" => $a->get_baseurl() . "/dav/wdcal/",
|
||||||
"sel" => "",
|
"sel" => "",
|
||||||
"title" => t('Extended calendar with CalDAV-support'),
|
"title" => t('Extended calendar with CalDAV-support'),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ function dav_cron(&$a, &$b)
|
||||||
q("UPDATE %s%snotifications SET `notified` = 1 WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["id"]);
|
q("UPDATE %s%snotifications SET `notified` = 1 WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["id"]);
|
||||||
$event = q("SELECT * FROM %s%sjqcalendar WHERE `calendarobject_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendarobject_id"]);
|
$event = q("SELECT * FROM %s%sjqcalendar WHERE `calendarobject_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendarobject_id"]);
|
||||||
$calendar = q("SELECT * FROM %s%scalendars WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendar_id"]);
|
$calendar = q("SELECT * FROM %s%scalendars WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendar_id"]);
|
||||||
$users = array();
|
$users = [];
|
||||||
if (count($calendar) != 1 || count($event) == 0) continue;
|
if (count($calendar) != 1 || count($event) == 0) continue;
|
||||||
switch ($calendar[0]["namespace"]) {
|
switch ($calendar[0]["namespace"]) {
|
||||||
case CALDAV_NAMESPACE_PRIVATE:
|
case CALDAV_NAMESPACE_PRIVATE:
|
||||||
|
@ -274,11 +274,11 @@ function dav_cron(&$a, &$b)
|
||||||
case "email":
|
case "email":
|
||||||
case "display": // @TODO implement "Display"
|
case "display": // @TODO implement "Display"
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$find = array("%to%", "%event%", "%url%");
|
$find = ["%to%", "%event%", "%url%"];
|
||||||
$repl = array($user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/");
|
$repl = [$user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/"];
|
||||||
$text_text = str_replace($find, $repl, "Hi %to%!\n\nThe event \"%event%\" is about to begin:\n%url%");
|
$text_text = str_replace($find, $repl, "Hi %to%!\n\nThe event \"%event%\" is about to begin:\n%url%");
|
||||||
$text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>");
|
$text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>");
|
||||||
$params = array(
|
$params = [
|
||||||
'fromName' => FRIENDICA_PLATFORM,
|
'fromName' => FRIENDICA_PLATFORM,
|
||||||
'fromEmail' => t('noreply') . '@' . $a->get_hostname(),
|
'fromEmail' => t('noreply') . '@' . $a->get_hostname(),
|
||||||
'replyTo' => t('noreply') . '@' . $a->get_hostname(),
|
'replyTo' => t('noreply') . '@' . $a->get_hostname(),
|
||||||
|
@ -287,7 +287,7 @@ function dav_cron(&$a, &$b)
|
||||||
'htmlVersion' => $text_html,
|
'htmlVersion' => $text_html,
|
||||||
'textVersion' => $text_text,
|
'textVersion' => $text_text,
|
||||||
'additionalMailHeader' => "",
|
'additionalMailHeader' => "",
|
||||||
);
|
];
|
||||||
Emailer::send($params);
|
Emailer::send($params);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Diaspora_Connection {
|
||||||
return ($this->tls) ? 'https' : 'http';
|
return ($this->tls) ? 'https' : 'http';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function doHttpRequest($url, $data = array(), $headers = array()) {
|
private function doHttpRequest($url, $data = [], $headers = []) {
|
||||||
if (0 === strpos($url, '/')) {
|
if (0 === strpos($url, '/')) {
|
||||||
$url = $this->getScheme() . '://' . $this->host . $url;
|
$url = $this->getScheme() . '://' . $this->host . $url;
|
||||||
}
|
}
|
||||||
|
@ -122,14 +122,14 @@ class Diaspora_Connection {
|
||||||
return $this->last_http_result;
|
return $this->last_http_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function doHttpDelete($url, $data = array(), $headers = array()) {
|
private function doHttpDelete($url, $data = [], $headers = []) {
|
||||||
$this->http_method = 'DELETE';
|
$this->http_method = 'DELETE';
|
||||||
$this->doHttpRequest($url, $data, $headers);
|
$this->doHttpRequest($url, $data, $headers);
|
||||||
$this->http_method = null; // reset for next request
|
$this->http_method = null; // reset for next request
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseAuthenticityToken($str) {
|
private function parseAuthenticityToken($str) {
|
||||||
$m = array();
|
$m = [];
|
||||||
preg_match('/<meta (?:name="csrf-token" content="(.*?)"|content="(.*?)" name="csrf-token")/', $str, $m);
|
preg_match('/<meta (?:name="csrf-token" content="(.*?)"|content="(.*?)" name="csrf-token")/', $str, $m);
|
||||||
if (empty($m[1]) && !empty($m[2])) {
|
if (empty($m[1]) && !empty($m[2])) {
|
||||||
$token = $m[2];
|
$token = $m[2];
|
||||||
|
@ -151,11 +151,11 @@ class Diaspora_Connection {
|
||||||
public function logIn() {
|
public function logIn() {
|
||||||
$this->doHttpRequest('/users/sign_in');
|
$this->doHttpRequest('/users/sign_in');
|
||||||
|
|
||||||
$params = array(
|
$params = [
|
||||||
'user[username]' => $this->user,
|
'user[username]' => $this->user,
|
||||||
'user[password]' => $this->password,
|
'user[password]' => $this->password,
|
||||||
'authenticity_token' => $this->csrf_token
|
'authenticity_token' => $this->csrf_token
|
||||||
);
|
];
|
||||||
$this->doHttpRequest('/users/sign_in', $params);
|
$this->doHttpRequest('/users/sign_in', $params);
|
||||||
$this->doHttpRequest('/stream');
|
$this->doHttpRequest('/stream');
|
||||||
return (200 === $this->last_http_result->info['http_code']) ? true : false;
|
return (200 === $this->last_http_result->info['http_code']) ? true : false;
|
||||||
|
@ -163,14 +163,14 @@ class Diaspora_Connection {
|
||||||
|
|
||||||
public function getAspects() {
|
public function getAspects() {
|
||||||
$this->doHttpRequest('/bookmarklet');
|
$this->doHttpRequest('/bookmarklet');
|
||||||
$m = array();
|
$m = [];
|
||||||
preg_match('/"aspects"\:(\[.+?\])/', $this->last_http_result->response, $m);
|
preg_match('/"aspects"\:(\[.+?\])/', $this->last_http_result->response, $m);
|
||||||
return (!empty($m[1])) ? json_decode($m[1]) : false;
|
return (!empty($m[1])) ? json_decode($m[1]) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServices() {
|
public function getServices() {
|
||||||
$this->doHttpRequest('/bookmarklet');
|
$this->doHttpRequest('/bookmarklet');
|
||||||
$m = array();
|
$m = [];
|
||||||
preg_match('/"configured_services"\:(\[.+?\])/', $this->last_http_result->response, $m);
|
preg_match('/"configured_services"\:(\[.+?\])/', $this->last_http_result->response, $m);
|
||||||
return (!empty($m[1])) ? json_decode($m[1]) : false;
|
return (!empty($m[1])) ? json_decode($m[1]) : false;
|
||||||
}
|
}
|
||||||
|
@ -196,24 +196,24 @@ class Diaspora_Connection {
|
||||||
return $this->readJsonResponse($this->last_http_result->response);
|
return $this->readJsonResponse($this->last_http_result->response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postStatusMessage($msg, $aspect_ids = 'all_aspects', $additional_data = array()) {
|
public function postStatusMessage($msg, $aspect_ids = 'all_aspects', $additional_data = []) {
|
||||||
$data = array(
|
$data = [
|
||||||
'aspect_ids' => $aspect_ids,
|
'aspect_ids' => $aspect_ids,
|
||||||
'status_message' => array(
|
'status_message' => [
|
||||||
'text' => $msg,
|
'text' => $msg,
|
||||||
'provider_display_name' => $this->provider
|
'provider_display_name' => $this->provider
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
if (!empty($additional_data)) {
|
if (!empty($additional_data)) {
|
||||||
$data += $additional_data;
|
$data += $additional_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = array(
|
$headers = [
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
'Accept: application/json',
|
'Accept: application/json',
|
||||||
'X-CSRF-Token: ' . $this->csrf_token
|
'X-CSRF-Token: ' . $this->csrf_token
|
||||||
);
|
];
|
||||||
|
|
||||||
$this->http_method = 'POST';
|
$this->http_method = 'POST';
|
||||||
$this->doHttpRequest('/status_messages', json_encode($data), $headers);
|
$this->doHttpRequest('/status_messages', json_encode($data), $headers);
|
||||||
|
@ -228,18 +228,18 @@ class Diaspora_Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postPhoto($file) {
|
public function postPhoto($file) {
|
||||||
$params = array(
|
$params = [
|
||||||
'photo[pending]' => 'true',
|
'photo[pending]' => 'true',
|
||||||
'qqfile' => basename($file)
|
'qqfile' => basename($file)
|
||||||
);
|
];
|
||||||
$query_string = '?' . http_build_query($params);
|
$query_string = '?' . http_build_query($params);
|
||||||
$headers = array(
|
$headers = [
|
||||||
'Accept: application/json',
|
'Accept: application/json',
|
||||||
'X-Requested-With: XMLHttpRequest',
|
'X-Requested-With: XMLHttpRequest',
|
||||||
'X-CSRF-Token: ' . $this->csrf_token,
|
'X-CSRF-Token: ' . $this->csrf_token,
|
||||||
'X-File-Name: ' . basename($file),
|
'X-File-Name: ' . basename($file),
|
||||||
'Content-Type: application/octet-stream',
|
'Content-Type: application/octet-stream',
|
||||||
);
|
];
|
||||||
if ($size = @filesize($file)) {
|
if ($size = @filesize($file)) {
|
||||||
$headers[] = "Content-Length: $size";
|
$headers[] = "Content-Length: $size";
|
||||||
}
|
}
|
||||||
|
@ -249,14 +249,14 @@ class Diaspora_Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deletePost($id) {
|
public function deletePost($id) {
|
||||||
$headers = array('X-CSRF-Token: ' . $this->csrf_token);
|
$headers = ['X-CSRF-Token: ' . $this->csrf_token];
|
||||||
$this->doHttpDelete("/posts/$id", array(), $headers);
|
$this->doHttpDelete("/posts/$id", [], $headers);
|
||||||
return (204 === $this->last_http_result->info['http_code']) ? true : false;
|
return (204 === $this->last_http_result->info['http_code']) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteComment($id) {
|
public function deleteComment($id) {
|
||||||
$headers = array('X-CSRF-Token: ' . $this->csrf_token);
|
$headers = ['X-CSRF-Token: ' . $this->csrf_token];
|
||||||
$this->doHttpDelete("/comments/$id", array(), $headers);
|
$this->doHttpDelete("/comments/$id", [], $headers);
|
||||||
return (204 === $this->last_http_result->info['http_code']) ? true : false;
|
return (204 === $this->last_http_result->info['http_code']) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ function diaspora_send(&$a,&$b) {
|
||||||
logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
|
logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
|
||||||
|
|
||||||
require_once('include/bb2diaspora.php');
|
require_once('include/bb2diaspora.php');
|
||||||
$tag_arr = array();
|
$tag_arr = [];
|
||||||
$tags = '';
|
$tags = '';
|
||||||
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ function diaspora_send(&$a,&$b) {
|
||||||
if (count($r))
|
if (count($r))
|
||||||
$a->contact = $r[0]["id"];
|
$a->contact = $r[0]["id"];
|
||||||
|
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $body));
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
add_to_queue($a->contact,NETWORK_DIASPORA2,$s);
|
add_to_queue($a->contact,NETWORK_DIASPORA2,$s);
|
||||||
notice(t('Diaspora post failed. Queued for retry.').EOL);
|
notice(t('Diaspora post failed. Queued for retry.').EOL);
|
||||||
|
|
|
@ -221,7 +221,7 @@ EOT;
|
||||||
logger('dwpost: data: ' . $xml, LOGGER_DATA);
|
logger('dwpost: data: ' . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
if($dw_blog !== 'test')
|
if($dw_blog !== 'test')
|
||||||
$x = post_url($dw_blog,$xml,array("Content-Type: text/xml"));
|
$x = post_url($dw_blog,$xml,["Content-Type: text/xml"]);
|
||||||
logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ if($numlines < 0)
|
||||||
function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
|
function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
|
||||||
global $db;
|
global $db;
|
||||||
$rnd = mt_rand();
|
$rnd = mt_rand();
|
||||||
$r = array();
|
$r = [];
|
||||||
|
|
||||||
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
|
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
|
||||||
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
|
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
|
||||||
|
@ -80,7 +80,7 @@ function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
|
||||||
$eqsql = '';
|
$eqsql = '';
|
||||||
|
|
||||||
if($equal) {
|
if($equal) {
|
||||||
$catsavail = array();
|
$catsavail = [];
|
||||||
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
|
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
|
||||||
$typesql
|
$typesql
|
||||||
$adultsql
|
$adultsql
|
||||||
|
@ -120,7 +120,7 @@ function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
|
||||||
function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
|
function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
|
||||||
global $db;
|
global $db;
|
||||||
$rnd = mt_rand();
|
$rnd = mt_rand();
|
||||||
$r = array();
|
$r = [];
|
||||||
|
|
||||||
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
|
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
|
||||||
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
|
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
|
||||||
|
@ -195,23 +195,23 @@ function fortune_to_html($s) {
|
||||||
// So for now, just remove them.
|
// So for now, just remove them.
|
||||||
|
|
||||||
$s = str_replace(
|
$s = str_replace(
|
||||||
array("&",
|
["&",
|
||||||
"<",
|
"<",
|
||||||
">",
|
">",
|
||||||
'"',
|
'"',
|
||||||
"\007",
|
"\007",
|
||||||
"\t",
|
"\t",
|
||||||
"\r",
|
"\r",
|
||||||
"\n"),
|
"\n"],
|
||||||
|
|
||||||
array("&",
|
["&",
|
||||||
"<",
|
"<",
|
||||||
">",
|
">",
|
||||||
""",
|
""",
|
||||||
"",
|
"",
|
||||||
" ",
|
" ",
|
||||||
"",
|
"",
|
||||||
"<br />"),
|
"<br />"],
|
||||||
$s);
|
$s);
|
||||||
// Replace pseudo diacritics
|
// Replace pseudo diacritics
|
||||||
// These were used to produce accented characters. For instance an accented
|
// These were used to produce accented characters. For instance an accented
|
||||||
|
|
|
@ -75,7 +75,7 @@ function forumdirectory_content(&$a) {
|
||||||
|
|
||||||
$admin = '';
|
$admin = '';
|
||||||
|
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, [
|
||||||
'$search' => $search,
|
'$search' => $search,
|
||||||
'$globaldir' => $globaldir,
|
'$globaldir' => $globaldir,
|
||||||
'$desc' => t('Find on this site'),
|
'$desc' => t('Find on this site'),
|
||||||
|
@ -83,7 +83,7 @@ function forumdirectory_content(&$a) {
|
||||||
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
|
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
|
||||||
'$sitedir' => t('Site Directory'),
|
'$sitedir' => t('Site Directory'),
|
||||||
'$submit' => t('Find')
|
'$submit' => t('Find')
|
||||||
));
|
]);
|
||||||
|
|
||||||
if($search)
|
if($search)
|
||||||
$search = dbesc($search);
|
$search = dbesc($search);
|
||||||
|
@ -168,7 +168,7 @@ function forumdirectory_content(&$a) {
|
||||||
# $tpl = file_get_contents( dirname(__file__).'/forumdirectory_item.tpl');
|
# $tpl = file_get_contents( dirname(__file__).'/forumdirectory_item.tpl');
|
||||||
$tpl = get_markup_template( 'forumdirectory_item.tpl', 'addon/forumdirectory/' );
|
$tpl = get_markup_template( 'forumdirectory_item.tpl', 'addon/forumdirectory/' );
|
||||||
|
|
||||||
$entry = replace_macros($tpl,array(
|
$entry = replace_macros($tpl,[
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$profile_link' => $profile_link,
|
'$profile_link' => $profile_link,
|
||||||
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
|
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
|
||||||
|
@ -184,9 +184,9 @@ function forumdirectory_content(&$a) {
|
||||||
'$homepage' => $homepage,
|
'$homepage' => $homepage,
|
||||||
'$about' => $about,
|
'$about' => $about,
|
||||||
|
|
||||||
));
|
]);
|
||||||
|
|
||||||
$arr = array('contact' => $rr, 'entry' => $entry);
|
$arr = ['contact' => $rr, 'entry' => $entry];
|
||||||
|
|
||||||
unset($profile);
|
unset($profile);
|
||||||
unset($location);
|
unset($location);
|
||||||
|
|
|
@ -96,10 +96,10 @@ function fromgplus_addon_settings_post(&$a,&$b) {
|
||||||
function fromgplus_plugin_admin(&$a, &$o){
|
function fromgplus_plugin_admin(&$a, &$o){
|
||||||
$t = get_markup_template("admin.tpl", "addon/fromgplus/");
|
$t = get_markup_template("admin.tpl", "addon/fromgplus/");
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$key' => array('key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')),
|
'$key' => ['key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fromgplus_plugin_admin_post(&$a){
|
function fromgplus_plugin_admin_post(&$a){
|
||||||
|
@ -198,13 +198,13 @@ function fromgplus_html2bbcode($html) {
|
||||||
|
|
||||||
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
|
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$bbcode = str_ireplace(array("\n"), array(""), $bbcode);
|
$bbcode = str_ireplace(["\n"], [""], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
|
$bbcode = str_ireplace(["<b>", "</b>"], ["[b]", "[/b]"], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
|
$bbcode = str_ireplace(["<i>", "</i>"], ["[i]", "[/i]"], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
|
$bbcode = str_ireplace(["<s>", "</s>"], ["[s]", "[/s]"], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<br />"), array("\n"), $bbcode);
|
$bbcode = str_ireplace(["<br />"], ["\n"], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<br/>"), array("\n"), $bbcode);
|
$bbcode = str_ireplace(["<br/>"], ["\n"], $bbcode);
|
||||||
$bbcode = str_ireplace(array("<br>"), array("\n"), $bbcode);
|
$bbcode = str_ireplace(["<br>"], ["\n"], $bbcode);
|
||||||
|
|
||||||
$bbcode = trim(strip_tags($bbcode));
|
$bbcode = trim(strip_tags($bbcode));
|
||||||
return($bbcode);
|
return($bbcode);
|
||||||
|
@ -219,7 +219,7 @@ function fromgplus_parse_query($var)
|
||||||
$var = parse_url($var, PHP_URL_QUERY);
|
$var = parse_url($var, PHP_URL_QUERY);
|
||||||
$var = html_entity_decode($var);
|
$var = html_entity_decode($var);
|
||||||
$var = explode('&', $var);
|
$var = explode('&', $var);
|
||||||
$arr = array();
|
$arr = [];
|
||||||
|
|
||||||
foreach($var as $val) {
|
foreach($var as $val) {
|
||||||
$x = explode('=', $val);
|
$x = explode('=', $val);
|
||||||
|
@ -240,7 +240,7 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
|
||||||
//$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
|
//$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
|
||||||
$image = $image->url;
|
$image = $image->url;
|
||||||
|
|
||||||
$cleaned = array();
|
$cleaned = [];
|
||||||
|
|
||||||
$queryvar = fromgplus_parse_query($fullImage);
|
$queryvar = fromgplus_parse_query($fullImage);
|
||||||
if ($queryvar['url'] != "")
|
if ($queryvar['url'] != "")
|
||||||
|
@ -266,12 +266,12 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
|
||||||
if ($cleaned["full"] != "")
|
if ($cleaned["full"] != "")
|
||||||
$infoFull = Image::getInfoFromURL($cleaned["full"]);
|
$infoFull = Image::getInfoFromURL($cleaned["full"]);
|
||||||
else
|
else
|
||||||
$infoFull = array("0" => 0, "1" => 0);
|
$infoFull = ["0" => 0, "1" => 0];
|
||||||
|
|
||||||
if ($cleaned["preview"] != "")
|
if ($cleaned["preview"] != "")
|
||||||
$infoPreview = Image::getInfoFromURL($cleaned["preview"]);
|
$infoPreview = Image::getInfoFromURL($cleaned["preview"]);
|
||||||
else
|
else
|
||||||
$infoFull = array("0" => 0, "1" => 0);
|
$infoFull = ["0" => 0, "1" => 0];
|
||||||
|
|
||||||
if (($infoPreview[0] >= $infoFull[0]) && ($infoPreview[1] >= $infoFull[1])) {
|
if (($infoPreview[0] >= $infoFull[0]) && ($infoPreview[1] >= $infoFull[1])) {
|
||||||
$temp = $cleaned["full"];
|
$temp = $cleaned["full"];
|
||||||
|
@ -304,7 +304,7 @@ function fromgplus_cleantext($text) {
|
||||||
$text = strip_tags($text);
|
$text = strip_tags($text);
|
||||||
$text = html_entity_decode($text, ENT_QUOTES);
|
$text = html_entity_decode($text, ENT_QUOTES);
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
$text = str_replace(array("\n", "\r", " ", $trash), array("", "", "", ""), $text);
|
$text = str_replace(["\n", "\r", " ", $trash], ["", "", "", ""], $text);
|
||||||
return($text);
|
return($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
|
||||||
|
|
||||||
$post = "";
|
$post = "";
|
||||||
$quote = "";
|
$quote = "";
|
||||||
$pagedata = array();
|
$pagedata = [];
|
||||||
$pagedata["type"] = "";
|
$pagedata["type"] = "";
|
||||||
|
|
||||||
foreach ($item->object->attachments as $attachment) {
|
foreach ($item->object->attachments as $attachment) {
|
||||||
|
|
|
@ -86,11 +86,11 @@ function geocoordinates_plugin_admin(&$a, &$o)
|
||||||
|
|
||||||
$t = get_markup_template("admin.tpl", "addon/geocoordinates/");
|
$t = get_markup_template("admin.tpl", "addon/geocoordinates/");
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$api_key' => array('api_key', t('API Key'), Config::get('geocoordinates', 'api_key' ), ''),
|
'$api_key' => ['api_key', t('API Key'), Config::get('geocoordinates', 'api_key' ), ''],
|
||||||
'$language' => array('language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language' ), ''),
|
'$language' => ['language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language' ), ''],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function geocoordinates_plugin_admin_post(&$a)
|
function geocoordinates_plugin_admin_post(&$a)
|
||||||
|
|
|
@ -69,19 +69,19 @@ function gravatar_plugin_admin (&$a, &$o) {
|
||||||
$rating = 'g'; // suitable for display on all websites with any audience type
|
$rating = 'g'; // suitable for display on all websites with any audience type
|
||||||
|
|
||||||
// Available options for the select boxes
|
// Available options for the select boxes
|
||||||
$default_avatars = array(
|
$default_avatars = [
|
||||||
'mm' => t('generic profile image'),
|
'mm' => t('generic profile image'),
|
||||||
'identicon' => t('random geometric pattern'),
|
'identicon' => t('random geometric pattern'),
|
||||||
'monsterid' => t('monster face'),
|
'monsterid' => t('monster face'),
|
||||||
'wavatar' => t('computer generated face'),
|
'wavatar' => t('computer generated face'),
|
||||||
'retro' => t('retro arcade style face'),
|
'retro' => t('retro arcade style face'),
|
||||||
);
|
];
|
||||||
$ratings = array(
|
$ratings = [
|
||||||
'g' => 'g',
|
'g' => 'g',
|
||||||
'pg' => 'pg',
|
'pg' => 'pg',
|
||||||
'r' => 'r',
|
'r' => 'r',
|
||||||
'x' => 'x'
|
'x' => 'x'
|
||||||
);
|
];
|
||||||
|
|
||||||
// Check if Libravatar is enabled and show warning
|
// Check if Libravatar is enabled and show warning
|
||||||
$r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1",
|
$r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1",
|
||||||
|
@ -93,11 +93,11 @@ function gravatar_plugin_admin (&$a, &$o) {
|
||||||
|
|
||||||
// output Gravatar settings
|
// output Gravatar settings
|
||||||
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">';
|
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">';
|
||||||
$o .= replace_macros( $t, array(
|
$o .= replace_macros( $t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars),
|
'$default_avatar' => ['avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars],
|
||||||
'$rating' => array('rating', t('Rating of images'), $rating, t('Select the appropriate avatar rating for your site. See README'), $ratings),
|
'$rating' => ['rating', t('Rating of images'), $rating, t('Select the appropriate avatar rating for your site. See README'), $ratings],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -120,13 +120,13 @@ function ifttt_post(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = array();
|
$item = [];
|
||||||
|
|
||||||
if (isset($_REQUEST['type'])) {
|
if (isset($_REQUEST['type'])) {
|
||||||
$item['type'] = $_REQUEST['type'];
|
$item['type'] = $_REQUEST['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($item['type'], array('status', 'link', 'photo'))) {
|
if (!in_array($item['type'], ['status', 'link', 'photo'])) {
|
||||||
logger('Unknown item type ' . $item['type'], LOGGER_DEBUG);
|
logger('Unknown item type ' . $item['type'], LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ EOT;
|
||||||
logger('ijpost: data: ' . $xml, LOGGER_DATA);
|
logger('ijpost: data: ' . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
if($ij_blog !== 'test')
|
if($ij_blog !== 'test')
|
||||||
$x = post_url($ij_blog,$xml,array("Content-Type: text/xml"));
|
$x = post_url($ij_blog,$xml,["Content-Type: text/xml"]);
|
||||||
logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ function impressum_plugin_admin_post (&$a) {
|
||||||
}
|
}
|
||||||
function impressum_plugin_admin (&$a, &$o) {
|
function impressum_plugin_admin (&$a, &$o) {
|
||||||
$t = get_markup_template( "admin.tpl", "addon/impressum/" );
|
$t = get_markup_template( "admin.tpl", "addon/impressum/" );
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$owner' => array('owner', t('Site Owner'), Config::get('impressum','owner'), t('The page operators name.')),
|
'$owner' => ['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.')),
|
'$ownerprofile' => ['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.')),
|
'$postal' => ['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.')),
|
'$notes' => ['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)')),
|
'$email' => ['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.')),
|
'$footer_text' => ['footer_text', t('Footer note'), Config::get('impressum','footer_text'), t('Text for the footer. You can use BBCode here.')],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
18
irc/irc.php
18
irc/irc.php
|
@ -36,13 +36,13 @@ function irc_addon_settings(&$a,&$s) {
|
||||||
$autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */
|
$autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */
|
||||||
|
|
||||||
$t = get_markup_template( "settings.tpl", "addon/irc/" );
|
$t = get_markup_template( "settings.tpl", "addon/irc/" );
|
||||||
$s .= replace_macros($t, array(
|
$s .= replace_macros($t, [
|
||||||
'$header' => t('IRC Settings'),
|
'$header' => t('IRC Settings'),
|
||||||
'$info' => t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
|
'$info' => t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$autochans' => array( 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')),
|
'$autochans' => [ 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')],
|
||||||
'$sitechats' => array( 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') )
|
'$sitechats' => [ 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
|
||||||
));
|
]);
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -87,7 +87,7 @@ function irc_content(&$a) {
|
||||||
if($sitechats)
|
if($sitechats)
|
||||||
$chats = explode(',',$sitechats);
|
$chats = explode(',',$sitechats);
|
||||||
else
|
else
|
||||||
$chats = array('friendica','chat','chatback','hottub','ircbar','dateroom','debian');
|
$chats = ['friendica','chat','chatback','hottub','ircbar','dateroom','debian'];
|
||||||
|
|
||||||
|
|
||||||
$a->page['aside'] .= '<div class="widget"><h3>' . t('Popular Channels') . '</h3><ul>';
|
$a->page['aside'] .= '<div class="widget"><h3>' . t('Popular Channels') . '</h3><ul>';
|
||||||
|
@ -135,9 +135,9 @@ function irc_plugin_admin (&$a, &$o) {
|
||||||
$sitechats = Config::get('irc','sitechats'); /* popular channels */
|
$sitechats = Config::get('irc','sitechats'); /* popular channels */
|
||||||
$autochans = Config::get('irc','autochans'); /* auto connect chans */
|
$autochans = Config::get('irc','autochans'); /* auto connect chans */
|
||||||
$t = get_markup_template( "admin.tpl", "addon/irc/" );
|
$t = get_markup_template( "admin.tpl", "addon/irc/" );
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$autochans' => array( 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')),
|
'$autochans' => [ 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')],
|
||||||
'$sitechats' => array( 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') )
|
'$sitechats' => [ 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,10 +246,10 @@ function jappixmini_init()
|
||||||
|
|
||||||
$encrypted_address_hex = bin2hex($encrypted_address);
|
$encrypted_address_hex = bin2hex($encrypted_address);
|
||||||
|
|
||||||
$answer = Array(
|
$answer = [
|
||||||
"status" => "ok",
|
"status" => "ok",
|
||||||
"encrypted_address" => $encrypted_address_hex
|
"encrypted_address" => $encrypted_address_hex
|
||||||
);
|
];
|
||||||
|
|
||||||
$answer_json = json_encode($answer);
|
$answer_json = json_encode($answer);
|
||||||
echo $answer_json;
|
echo $answer_json;
|
||||||
|
@ -514,7 +514,7 @@ function jappixmini_script(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a list of jabber accounts of the contacts
|
// get a list of jabber accounts of the contacts
|
||||||
$contacts = Array();
|
$contacts = [];
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
|
$rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP headers
|
// HTTP headers
|
||||||
$headers = array('User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data));
|
$headers = ['User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data)];
|
||||||
|
|
||||||
// CURL is better if available
|
// CURL is better if available
|
||||||
if(function_exists('curl_init'))
|
if(function_exists('curl_init'))
|
||||||
|
@ -112,11 +112,11 @@ if($use_curl) {
|
||||||
// Built-in stream functions
|
// Built-in stream functions
|
||||||
else {
|
else {
|
||||||
// HTTP parameters
|
// HTTP parameters
|
||||||
$parameters = array('http' => array(
|
$parameters = ['http' => [
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'content' => $data
|
'content' => $data
|
||||||
)
|
]
|
||||||
);
|
];
|
||||||
|
|
||||||
$parameters['http']['header'] = $headers;
|
$parameters['http']['header'] = $headers;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ function js_upload_post_init(&$a,&$b) {
|
||||||
|
|
||||||
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
|
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
|
||||||
|
|
||||||
$allowedExtensions = array("jpeg","gif","png","jpg");
|
$allowedExtensions = ["jpeg","gif","png","jpg"];
|
||||||
|
|
||||||
// max file size in bytes
|
// max file size in bytes
|
||||||
|
|
||||||
|
@ -264,11 +264,11 @@ class qqUploadedFileForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
class qqFileUploader {
|
class qqFileUploader {
|
||||||
private $allowedExtensions = array();
|
private $allowedExtensions = [];
|
||||||
private $sizeLimit = 10485760;
|
private $sizeLimit = 10485760;
|
||||||
private $file;
|
private $file;
|
||||||
|
|
||||||
function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
|
function __construct(array $allowedExtensions = [], $sizeLimit = 10485760){
|
||||||
$allowedExtensions = array_map("strtolower", $allowedExtensions);
|
$allowedExtensions = array_map("strtolower", $allowedExtensions);
|
||||||
|
|
||||||
$this->allowedExtensions = $allowedExtensions;
|
$this->allowedExtensions = $allowedExtensions;
|
||||||
|
@ -302,13 +302,13 @@ class qqFileUploader {
|
||||||
function handleUpload(){
|
function handleUpload(){
|
||||||
|
|
||||||
if (!$this->file){
|
if (!$this->file){
|
||||||
return array('error' => t('No files were uploaded.'));
|
return ['error' => t('No files were uploaded.')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$size = $this->file->getSize();
|
$size = $this->file->getSize();
|
||||||
|
|
||||||
if ($size == 0) {
|
if ($size == 0) {
|
||||||
return array('error' => t('Uploaded file is empty'));
|
return ['error' => t('Uploaded file is empty')];
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($size > $this->sizeLimit) {
|
// if ($size > $this->sizeLimit) {
|
||||||
|
@ -320,7 +320,7 @@ class qqFileUploader {
|
||||||
$maximagesize = Config::get('system','maximagesize');
|
$maximagesize = Config::get('system','maximagesize');
|
||||||
|
|
||||||
if(($maximagesize) && ($size > $maximagesize)) {
|
if(($maximagesize) && ($size > $maximagesize)) {
|
||||||
return array('error' => t('Image exceeds size limit of ') . $maximagesize );
|
return ['error' => t('Image exceeds size limit of ') . $maximagesize ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,21 +331,21 @@ class qqFileUploader {
|
||||||
|
|
||||||
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
|
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
|
||||||
$these = implode(', ', $this->allowedExtensions);
|
$these = implode(', ', $this->allowedExtensions);
|
||||||
return array('error' => t('File has an invalid extension, it should be one of ') . $these . '.');
|
return ['error' => t('File has an invalid extension, it should be one of ') . $these . '.'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->file->save()){
|
if ($this->file->save()){
|
||||||
return array(
|
return [
|
||||||
'success'=>true,
|
'success'=>true,
|
||||||
'path' => $this->file->getPath(),
|
'path' => $this->file->getPath(),
|
||||||
'filename' => $filename . '.' . $ext
|
'filename' => $filename . '.' . $ext
|
||||||
);
|
];
|
||||||
} else {
|
} else {
|
||||||
return array(
|
return [
|
||||||
'error'=> t('Upload was cancelled, or server error encountered'),
|
'error'=> t('Upload was cancelled, or server error encountered'),
|
||||||
'path' => $this->file->getPath(),
|
'path' => $this->file->getPath(),
|
||||||
'filename' => $filename . '.' . $ext
|
'filename' => $filename . '.' . $ext
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ function krynn_post_hook($a, &$item) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$krynn = array('Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti');
|
$krynn = ['Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti'];
|
||||||
|
|
||||||
$planet = array_rand($krynn,1);
|
$planet = array_rand($krynn,1);
|
||||||
$item['location'] = $krynn[$planet];
|
$item['location'] = $krynn[$planet];
|
||||||
|
|
|
@ -52,15 +52,15 @@ function langfilter_addon_settings(App $a, &$s)
|
||||||
}
|
}
|
||||||
|
|
||||||
$t = get_markup_template("settings.tpl", "addon/langfilter/");
|
$t = get_markup_template("settings.tpl", "addon/langfilter/");
|
||||||
$s .= replace_macros($t, array(
|
$s .= replace_macros($t, [
|
||||||
'$title' => t("Language Filter"),
|
'$title' => t("Language Filter"),
|
||||||
'$intro' => t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'),
|
'$intro' => t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'),
|
||||||
'$enabled' => array('langfilter_enable', t('Use the language filter'), $enable_checked, ''),
|
'$enabled' => ['langfilter_enable', t('Use the language filter'), $enable_checked, ''],
|
||||||
'$languages' => array('langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')),
|
'$languages' => ['langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')],
|
||||||
'$minconfidence' => array('langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')),
|
'$minconfidence' => ['langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')],
|
||||||
'$minlength' => array('langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')),
|
'$minlength' => ['langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')],
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
));
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $
|
||||||
$results = get_existing_account($username);
|
$results = get_existing_account($username);
|
||||||
if (empty($results)) {
|
if (empty($results)) {
|
||||||
if (strlen($email) > 0 && strlen($name) > 0) {
|
if (strlen($email) > 0 && strlen($name) > 0) {
|
||||||
$arr = array('username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1);
|
$arr = ['username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
User::create($arr);
|
User::create($arr);
|
||||||
|
|
|
@ -36,7 +36,7 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function leistungsschutzrecht_cuttext($text) {
|
function leistungsschutzrecht_cuttext($text) {
|
||||||
$text = str_replace(array("\r", "\n"), array(" ", " "), $text);
|
$text = str_replace(["\r", "\n"], [" ", " "], $text);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$oldtext = $text;
|
$oldtext = $text;
|
||||||
|
@ -73,9 +73,9 @@ function leistungsschutzrecht_fetchsites() {
|
||||||
$sitelist = fetch_url($url);
|
$sitelist = fetch_url($url);
|
||||||
$siteurls = explode(',', $sitelist);
|
$siteurls = explode(',', $sitelist);
|
||||||
|
|
||||||
$whitelist = array('tagesschau.de', 'heute.de', 'wdr.de');
|
$whitelist = ['tagesschau.de', 'heute.de', 'wdr.de'];
|
||||||
|
|
||||||
$sites = array();
|
$sites = [];
|
||||||
foreach ($siteurls AS $site) {
|
foreach ($siteurls AS $site) {
|
||||||
if (!in_array($site, $whitelist)) {
|
if (!in_array($site, $whitelist)) {
|
||||||
$sites[$site] = $site;
|
$sites[$site] = $site;
|
||||||
|
|
|
@ -185,7 +185,7 @@ function libertree_send(&$a,&$b) {
|
||||||
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
|
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
|
||||||
|
|
||||||
require_once('include/bb2diaspora.php');
|
require_once('include/bb2diaspora.php');
|
||||||
$tag_arr = array();
|
$tag_arr = [];
|
||||||
$tags = '';
|
$tags = '';
|
||||||
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
||||||
|
|
||||||
|
@ -223,11 +223,11 @@ function libertree_send(&$a,&$b) {
|
||||||
$body = "## ".html_entity_decode($title)."\n\n".$body;
|
$body = "## ".html_entity_decode($title)."\n\n".$body;
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = [
|
||||||
'text' => $body,
|
'text' => $body,
|
||||||
'source' => $ltree_source
|
'source' => $ltree_source
|
||||||
// 'token' => $ltree_api_token
|
// 'token' => $ltree_api_token
|
||||||
);
|
];
|
||||||
|
|
||||||
$result = post_url($ltree_blog,$params);
|
$result = post_url($ltree_blog,$params);
|
||||||
logger('libertree: ' . $result);
|
logger('libertree: ' . $result);
|
||||||
|
|
|
@ -71,13 +71,13 @@ function libravatar_plugin_admin (&$a, &$o) {
|
||||||
$default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash
|
$default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash
|
||||||
|
|
||||||
// Available options for the select boxes
|
// Available options for the select boxes
|
||||||
$default_avatars = array(
|
$default_avatars = [
|
||||||
'mm' => t('generic profile image'),
|
'mm' => t('generic profile image'),
|
||||||
'identicon' => t('random geometric pattern'),
|
'identicon' => t('random geometric pattern'),
|
||||||
'monsterid' => t('monster face'),
|
'monsterid' => t('monster face'),
|
||||||
'wavatar' => t('computer generated face'),
|
'wavatar' => t('computer generated face'),
|
||||||
'retro' => t('retro arcade style face'),
|
'retro' => t('retro arcade style face'),
|
||||||
);
|
];
|
||||||
|
|
||||||
// Show warning if PHP version is too old
|
// Show warning if PHP version is too old
|
||||||
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||||
|
@ -97,10 +97,10 @@ function libravatar_plugin_admin (&$a, &$o) {
|
||||||
|
|
||||||
// output Libravatar settings
|
// output Libravatar settings
|
||||||
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("libravatarsave") .'">';
|
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("libravatarsave") .'">';
|
||||||
$o .= replace_macros( $t, array(
|
$o .= replace_macros( $t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars),
|
'$default_avatar' => ['avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -234,7 +234,7 @@ EOT;
|
||||||
logger('ljpost: data: ' . $xml, LOGGER_DATA);
|
logger('ljpost: data: ' . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
if($lj_blog !== 'test')
|
if($lj_blog !== 'test')
|
||||||
$x = post_url($lj_blog,$xml,array("Content-Type: text/xml"));
|
$x = post_url($lj_blog,$xml,["Content-Type: text/xml"]);
|
||||||
logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,13 +69,13 @@ function mailstream_module() {}
|
||||||
function mailstream_plugin_admin(&$a,&$o) {
|
function mailstream_plugin_admin(&$a,&$o) {
|
||||||
$frommail = Config::get('mailstream', 'frommail');
|
$frommail = Config::get('mailstream', 'frommail');
|
||||||
$template = get_markup_template('admin.tpl', 'addon/mailstream/');
|
$template = get_markup_template('admin.tpl', 'addon/mailstream/');
|
||||||
$config = array('frommail',
|
$config = ['frommail',
|
||||||
t('From Address'),
|
t('From Address'),
|
||||||
$frommail,
|
$frommail,
|
||||||
t('Email address that stream items will appear to be from.'));
|
t('Email address that stream items will appear to be from.')];
|
||||||
$o .= replace_macros($template, array(
|
$o .= replace_macros($template, [
|
||||||
'$frommail' => $config,
|
'$frommail' => $config,
|
||||||
'$submit' => t('Save Settings')));
|
'$submit' => t('Save Settings')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailstream_plugin_admin_post ($a) {
|
function mailstream_plugin_admin_post ($a) {
|
||||||
|
@ -146,18 +146,18 @@ function mailstream_do_images($a, &$item, &$attachments) {
|
||||||
if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
|
if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$attachments = array();
|
$attachments = [];
|
||||||
$baseurl = $a->get_baseurl();
|
$baseurl = $a->get_baseurl();
|
||||||
preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1);
|
preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1);
|
||||||
preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2);
|
preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2);
|
||||||
foreach (array_merge($matches1[3], $matches2[1]) as $url) {
|
foreach (array_merge($matches1[3], $matches2[1]) as $url) {
|
||||||
$redirects;
|
$redirects;
|
||||||
$cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-');
|
$cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-');
|
||||||
$attachments[$url] = array(
|
$attachments[$url] = [
|
||||||
'data' => fetch_url($url, true, $redirects, 0, Null, $cookiejar),
|
'data' => fetch_url($url, true, $redirects, 0, Null, $cookiejar),
|
||||||
'guid' => hash("crc32", $url),
|
'guid' => hash("crc32", $url),
|
||||||
'filename' => basename($url),
|
'filename' => basename($url),
|
||||||
'type' => $a->get_curl_content_type());
|
'type' => $a->get_curl_content_type()];
|
||||||
if (strlen($attachments[$url]['data'])) {
|
if (strlen($attachments[$url]['data'])) {
|
||||||
$item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']);
|
$item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']);
|
||||||
continue;
|
continue;
|
||||||
|
@ -254,7 +254,7 @@ function mailstream_send($a, $message_id, $item, $user) {
|
||||||
}
|
}
|
||||||
require_once(dirname(__file__).'/phpmailer/class.phpmailer.php');
|
require_once(dirname(__file__).'/phpmailer/class.phpmailer.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
$attachments = array();
|
$attachments = [];
|
||||||
mailstream_do_images($a, $item, $attachments);
|
mailstream_do_images($a, $item, $attachments);
|
||||||
$frommail = Config::get('mailstream', 'frommail');
|
$frommail = Config::get('mailstream', 'frommail');
|
||||||
if ($frommail == "") {
|
if ($frommail == "") {
|
||||||
|
@ -285,10 +285,10 @@ function mailstream_send($a, $message_id, $item, $user) {
|
||||||
$template = get_markup_template('mail.tpl', 'addon/mailstream/');
|
$template = get_markup_template('mail.tpl', 'addon/mailstream/');
|
||||||
$item['body'] = bbcode($item['body']);
|
$item['body'] = bbcode($item['body']);
|
||||||
$item['url'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item['id'];
|
$item['url'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item['id'];
|
||||||
$mail->Body = replace_macros($template, array(
|
$mail->Body = replace_macros($template, [
|
||||||
'$upstream' => t('Upstream'),
|
'$upstream' => t('Upstream'),
|
||||||
'$local' => t('Local'),
|
'$local' => t('Local'),
|
||||||
'$item' => $item));
|
'$item' => $item]);
|
||||||
mailstream_html_wrap($mail->Body);
|
mailstream_html_wrap($mail->Body);
|
||||||
if (!$mail->Send()) {
|
if (!$mail->Send()) {
|
||||||
throw new Exception($mail->ErrorInfo);
|
throw new Exception($mail->ErrorInfo);
|
||||||
|
@ -352,28 +352,28 @@ function mailstream_plugin_settings(&$a,&$s) {
|
||||||
$nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
|
$nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
|
||||||
$attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
|
$attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
|
||||||
$template = get_markup_template('settings.tpl', 'addon/mailstream/');
|
$template = get_markup_template('settings.tpl', 'addon/mailstream/');
|
||||||
$s .= replace_macros($template, array(
|
$s .= replace_macros($template, [
|
||||||
'$enabled' => array(
|
'$enabled' => [
|
||||||
'mailstream_enabled',
|
'mailstream_enabled',
|
||||||
t('Enabled'),
|
t('Enabled'),
|
||||||
$enabled),
|
$enabled],
|
||||||
'$address' => array(
|
'$address' => [
|
||||||
'mailstream_address',
|
'mailstream_address',
|
||||||
t('Email Address'),
|
t('Email Address'),
|
||||||
$address,
|
$address,
|
||||||
t("Leave blank to use your account email address")),
|
t("Leave blank to use your account email address")],
|
||||||
'$nolikes' => array(
|
'$nolikes' => [
|
||||||
'mailstream_nolikes',
|
'mailstream_nolikes',
|
||||||
t('Exclude Likes'),
|
t('Exclude Likes'),
|
||||||
$nolikes,
|
$nolikes,
|
||||||
t("Check this to omit mailing \"Like\" notifications")),
|
t("Check this to omit mailing \"Like\" notifications")],
|
||||||
'$attachimg' => array(
|
'$attachimg' => [
|
||||||
'mailstream_attachimg',
|
'mailstream_attachimg',
|
||||||
t('Attach Images'),
|
t('Attach Images'),
|
||||||
$attachimg,
|
$attachimg,
|
||||||
t("Download images in posts and attach them to the email. Useful for reading email while offline.")),
|
t("Download images in posts and attach them to the email. Useful for reading email while offline.")],
|
||||||
'$title' => t('Mail Stream Settings'),
|
'$title' => t('Mail Stream Settings'),
|
||||||
'$submit' => t('Save Settings')));
|
'$submit' => t('Save Settings')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailstream_plugin_settings_post($a,$post) {
|
function mailstream_plugin_settings_post($a,$post) {
|
||||||
|
|
|
@ -79,8 +79,8 @@ function mathjax_plugin_admin (&$a, &$o) {
|
||||||
Config::set('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
|
Config::set('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
|
||||||
}
|
}
|
||||||
|
|
||||||
$o = replace_macros( $t, array(
|
$o = replace_macros( $t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$baseurl' => array('baseurl', t('MathJax Base URL'), Config::get('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')),
|
'$baseurl' => ['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.')],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,22 +16,22 @@ function morepokes_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function morepokes_poke_verbs($a,&$b) {
|
function morepokes_poke_verbs($a,&$b) {
|
||||||
$b['bitchslap'] = array('bitchslapped', t('bitchslap'), t('bitchslapped'));
|
$b['bitchslap'] = ['bitchslapped', t('bitchslap'), t('bitchslapped')];
|
||||||
$b['shag'] = array('shag', t('shag'), t('shagged'));
|
$b['shag'] = ['shag', t('shag'), t('shagged')];
|
||||||
$b['somethingobscenelybiological'] = array('something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to'));
|
$b['somethingobscenelybiological'] = ['something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to')];
|
||||||
$b['newpokefeature'] = array('pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to'));
|
$b['newpokefeature'] = ['pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to')];
|
||||||
$b['declareundyinglove'] = array('declared undying love for', t('declare undying love for'), t('declared undying love for'));
|
$b['declareundyinglove'] = ['declared undying love for', t('declare undying love for'), t('declared undying love for')];
|
||||||
$b['patent'] = array('patented', t('patent'), t('patented'));
|
$b['patent'] = ['patented', t('patent'), t('patented')];
|
||||||
$b['strokebeard'] = array('stroked their beard at', t('stroke beard'), t('stroked their beard at'));
|
$b['strokebeard'] = ['stroked their beard at', t('stroke beard'), t('stroked their beard at')];
|
||||||
$b['bemoan'] = array('bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to'));
|
$b['bemoan'] = ['bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to')];
|
||||||
$b['hugs'] = array('hugged', t('hug'), t('hugged'));
|
$b['hugs'] = ['hugged', t('hug'), t('hugged')];
|
||||||
$b['kiss'] = array('kissed', t('kiss'), t('kissed'));
|
$b['kiss'] = ['kissed', t('kiss'), t('kissed')];
|
||||||
$b['raiseeyebrows'] = array('raised their eyebrows at', t('raise eyebrows at'), t('raised their eyebrows at'));
|
$b['raiseeyebrows'] = ['raised their eyebrows at', t('raise eyebrows at'), t('raised their eyebrows at')];
|
||||||
$b['insult'] = array('insulted', t('insult'), t('insulted'));
|
$b['insult'] = ['insulted', t('insult'), t('insulted')];
|
||||||
$b['praise'] = array('praised', t('praise'), t('praised'));
|
$b['praise'] = ['praised', t('praise'), t('praised')];
|
||||||
$b['bedubiousof'] = array('was dubious of', t('be dubious of'), t('was dubious of'));
|
$b['bedubiousof'] = ['was dubious of', t('be dubious of'), t('was dubious of')];
|
||||||
$b['eat'] = array('ate', t('eat'), t('ate'));
|
$b['eat'] = ['ate', t('eat'), t('ate')];
|
||||||
$b['giggleandfawn'] = array('giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at'));
|
$b['giggleandfawn'] = ['giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at')];
|
||||||
$b['doubt'] = array('doubted', t('doubt'), t('doubted'));
|
$b['doubt'] = ['doubted', t('doubt'), t('doubted')];
|
||||||
$b['glare'] = array('glared at', t('glare'), t('glared at'));
|
$b['glare'] = ['glared at', t('glare'), t('glared at')];
|
||||||
;}
|
;}
|
||||||
|
|
|
@ -49,12 +49,12 @@ function newmemberwidget_plugin_admin_post( &$a ) {
|
||||||
|
|
||||||
function newmemberwidget_plugin_admin(&$a, &$o){
|
function newmemberwidget_plugin_admin(&$a, &$o){
|
||||||
$t = get_markup_template('admin.tpl','addon/newmemberwidget');
|
$t = get_markup_template('admin.tpl','addon/newmemberwidget');
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$freetext' => array( "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")),
|
'$freetext' => [ "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>)"),
|
'$linkglobalsupport' => [ "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.')),
|
'$linklocalsupport' => [ "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)')),
|
'$localsupportname' => [ "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)')],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,15 @@ function notifyall_post(&$a) {
|
||||||
$subject = $_REQUEST['subject'];
|
$subject = $_REQUEST['subject'];
|
||||||
|
|
||||||
|
|
||||||
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r", "\\n"),array( "", "\n"), $text))),ENT_QUOTES,'UTF-8'));
|
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(["\\r", "\\n"],[ "", "\n"], $text))),ENT_QUOTES,'UTF-8'));
|
||||||
|
|
||||||
$htmlversion = bbcode(stripslashes(str_replace(array("\\r","\\n"), array("","<br />\n"),$text)));
|
$htmlversion = bbcode(stripslashes(str_replace(["\\r","\\n"], ["","<br />\n"],$text)));
|
||||||
|
|
||||||
// if this is a test, send it only to the admin(s)
|
// if this is a test, send it only to the admin(s)
|
||||||
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
|
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
|
||||||
if ( intval($_REQUEST['test'])) {
|
if ( intval($_REQUEST['test'])) {
|
||||||
$email = $a->config['admin_email'];
|
$email = $a->config['admin_email'];
|
||||||
$email = "'" . str_replace(array(" ",","), array("","','"), $email) . "'";
|
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
|
||||||
}
|
}
|
||||||
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
|
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ function notifyall_post(&$a) {
|
||||||
foreach($recips as $recip) {
|
foreach($recips as $recip) {
|
||||||
|
|
||||||
|
|
||||||
Emailer::send(array(
|
Emailer::send([
|
||||||
'fromName' => $sender_name,
|
'fromName' => $sender_name,
|
||||||
'fromEmail' => $sender_email,
|
'fromEmail' => $sender_email,
|
||||||
'replyTo' => $sender_email,
|
'replyTo' => $sender_email,
|
||||||
|
@ -81,7 +81,7 @@ function notifyall_post(&$a) {
|
||||||
'messageSubject' => $subject,
|
'messageSubject' => $subject,
|
||||||
'htmlVersion' => $htmlversion,
|
'htmlVersion' => $htmlversion,
|
||||||
'textVersion' => $textversion
|
'textVersion' => $textversion
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
notice( t('Emails sent'));
|
notice( t('Emails sent'));
|
||||||
|
@ -94,13 +94,13 @@ function notifyall_content(&$a) {
|
||||||
|
|
||||||
$title = t('Send email to all members of this Friendica instance.');
|
$title = t('Send email to all members of this Friendica instance.');
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('notifyall_form.tpl','addon/notifyall/'),array(
|
$o = replace_macros(get_markup_template('notifyall_form.tpl','addon/notifyall/'),[
|
||||||
'$title' => $title,
|
'$title' => $title,
|
||||||
'$text' => htmlspecialchars($_REQUEST['text']),
|
'$text' => htmlspecialchars($_REQUEST['text']),
|
||||||
'$subject' => array('subject',t('Message subject'),$_REQUEST['subject'],''),
|
'$subject' => ['subject',t('Message subject'),$_REQUEST['subject'],''],
|
||||||
'$test' => array('test',t('Test mode (only send to administrator)'), 0,''),
|
'$test' => ['test',t('Test mode (only send to administrator)'), 0,''],
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit')
|
||||||
));
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ function nsfw_prepare_body(&$a,&$b) {
|
||||||
$arr = explode(',',$words);
|
$arr = explode(',',$words);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$arr = array('nsfw');
|
$arr = ['nsfw'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
|
|
|
@ -120,7 +120,7 @@ function openstreetmap_generate_named_map(&$a, &$b)
|
||||||
$j = json_decode($x['body'],true);
|
$j = json_decode($x['body'],true);
|
||||||
|
|
||||||
if($j && is_array($j) && $j[0]['lat'] && $j[0]['lon']) {
|
if($j && is_array($j) && $j[0]['lat'] && $j[0]['lon']) {
|
||||||
$arr = array('lat' => $j[0]['lat'],'lon' => $j[0]['lon'],'location' => $b['location'], 'html' => '');
|
$arr = ['lat' => $j[0]['lat'],'lon' => $j[0]['lon'],'location' => $b['location'], 'html' => ''];
|
||||||
openstreetmap_generate_map($a,$arr);
|
openstreetmap_generate_map($a,$arr);
|
||||||
$b['html'] = $arr['html'];
|
$b['html'] = $arr['html'];
|
||||||
}
|
}
|
||||||
|
@ -183,13 +183,13 @@ function openstreetmap_plugin_admin(&$a, &$o)
|
||||||
$marker = 0;
|
$marker = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
'$tmsserver' => array('tmsserver', t('Tile Server URL'), $tmsserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')),
|
'$tmsserver' => ['tmsserver', t('Tile Server URL'), $tmsserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')],
|
||||||
'$nomserver' => array('nomserver', t('Nominatim (reverse geocoding) Server URL'), $nomserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')),
|
'$nomserver' => ['nomserver', t('Nominatim (reverse geocoding) Server URL'), $nomserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')],
|
||||||
'$zoom' => array('zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest, also depends on tile server)')),
|
'$zoom' => ['zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest, also depends on tile server)')],
|
||||||
'$marker' => array('marker', t('Include marker on map'), $marker, t('Include a marker on the map.')),
|
'$marker' => ['marker', t('Include marker on map'), $marker, t('Include a marker on the map.')],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openstreetmap_plugin_admin_post(&$a)
|
function openstreetmap_plugin_admin_post(&$a)
|
||||||
|
|
|
@ -87,13 +87,13 @@ function piwik_analytics($a,&$b) {
|
||||||
}
|
}
|
||||||
function piwik_plugin_admin (&$a, &$o) {
|
function piwik_plugin_admin (&$a, &$o) {
|
||||||
$t = get_markup_template( "admin.tpl", "addon/piwik/" );
|
$t = get_markup_template( "admin.tpl", "addon/piwik/" );
|
||||||
$o = replace_macros( $t, array(
|
$o = replace_macros( $t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$piwikbaseurl' => array('baseurl', t('Piwik Base URL'), Config::get('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')),
|
'$piwikbaseurl' => ['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' ), ''),
|
'$siteid' => ['siteid', t('Site ID'), Config::get('piwik','siteid' ), ''],
|
||||||
'$optout' => array('optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''),
|
'$optout' => ['optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''],
|
||||||
'$async' => array('async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''),
|
'$async' => ['async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
function piwik_plugin_admin_post (&$a) {
|
function piwik_plugin_admin_post (&$a) {
|
||||||
$url = ((x($_POST, 'baseurl')) ? notags(trim($_POST['baseurl'])) : '');
|
$url = ((x($_POST, 'baseurl')) ? notags(trim($_POST['baseurl'])) : '');
|
||||||
|
|
|
@ -93,7 +93,7 @@ function planets_post_hook($a, &$item) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$planets = array('Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin');
|
$planets = ['Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'];
|
||||||
|
|
||||||
$planet = array_rand($planets,1);
|
$planet = array_rand($planets,1);
|
||||||
$item['location'] = $planets[$planet];
|
$item['location'] = $planets[$planet];
|
||||||
|
|
|
@ -55,7 +55,7 @@ function public_server_cron($a,$b) {
|
||||||
|
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
notification(array(
|
notification([
|
||||||
'uid' => $rr['uid'],
|
'uid' => $rr['uid'],
|
||||||
'type' => NOTIFY_SYSTEM,
|
'type' => NOTIFY_SYSTEM,
|
||||||
'system_type' => 'public_server_expire',
|
'system_type' => 'public_server_expire',
|
||||||
|
@ -65,7 +65,7 @@ function public_server_cron($a,$b) {
|
||||||
'source_name' => t('Administrator'),
|
'source_name' => t('Administrator'),
|
||||||
'source_link' => $a->get_baseurl(),
|
'source_link' => $a->get_baseurl(),
|
||||||
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
|
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
|
||||||
));
|
]);
|
||||||
|
|
||||||
q("update user set expire_notification_sent = '%s' where uid = %d",
|
q("update user set expire_notification_sent = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -161,16 +161,16 @@ function public_server_plugin_admin_post ( &$a ) {
|
||||||
function public_server_plugin_admin ( &$a, &$o) {
|
function public_server_plugin_admin ( &$a, &$o) {
|
||||||
$token = get_form_security_token("publicserver");
|
$token = get_form_security_token("publicserver");
|
||||||
$t = get_markup_template( "admin.tpl", "addon/public_server");
|
$t = get_markup_template( "admin.tpl", "addon/public_server");
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$form_security_token' => $token,
|
'$form_security_token' => $token,
|
||||||
'$infotext' => t('Set any of these options to 0 to deactivate it.'),
|
'$infotext' => t('Set any of these options to 0 to deactivate it.'),
|
||||||
'$expiredays' => Array( "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "),
|
'$expiredays' => [ "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"),
|
'$expireposts' => [ "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 "),
|
'$nologin' => [ "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"),
|
'$flagusers' => [ "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 "),
|
'$flagposts' => [ "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'))),
|
'$flagpostsexpire' => [ "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ function pumpio_registerclient(&$a, $host) {
|
||||||
|
|
||||||
$url = "https://".$host."/api/client/register";
|
$url = "https://".$host."/api/client/register";
|
||||||
|
|
||||||
$params = array();
|
$params = [];
|
||||||
|
|
||||||
$application_name = Config::get('pumpio', 'application_name');
|
$application_name = Config::get('pumpio', 'application_name');
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ function pumpio_settings_post(&$a,&$b) {
|
||||||
// Filtering the hostname if someone is entering it with "http"
|
// Filtering the hostname if someone is entering it with "http"
|
||||||
$host = $_POST['pumpio_host'];
|
$host = $_POST['pumpio_host'];
|
||||||
$host = trim($host);
|
$host = trim($host);
|
||||||
$host = str_replace(array("https://", "http://"), array("", ""), $host);
|
$host = str_replace(["https://", "http://"], ["", ""], $host);
|
||||||
|
|
||||||
PConfig::set(local_user(),'pumpio','post',intval($_POST['pumpio']));
|
PConfig::set(local_user(),'pumpio','post',intval($_POST['pumpio']));
|
||||||
PConfig::set(local_user(),'pumpio','import',$_POST['pumpio_import']);
|
PConfig::set(local_user(),'pumpio','import',$_POST['pumpio_import']);
|
||||||
|
@ -470,14 +470,14 @@ function pumpio_send(&$a,&$b) {
|
||||||
|
|
||||||
$content = bbcode($b['body'], false, false, 4);
|
$content = bbcode($b['body'], false, false, 4);
|
||||||
|
|
||||||
$params = array();
|
$params = [];
|
||||||
|
|
||||||
$params["verb"] = "post";
|
$params["verb"] = "post";
|
||||||
|
|
||||||
if (!$iscomment) {
|
if (!$iscomment) {
|
||||||
$params["object"] = array(
|
$params["object"] = [
|
||||||
'objectType' => "note",
|
'objectType' => "note",
|
||||||
'content' => $content);
|
'content' => $content];
|
||||||
|
|
||||||
if ($title != "")
|
if ($title != "")
|
||||||
$params["object"]["displayName"] = $title;
|
$params["object"]["displayName"] = $title;
|
||||||
|
@ -495,16 +495,16 @@ function pumpio_send(&$a,&$b) {
|
||||||
$params["bcc"] = $receiver["bcc"];
|
$params["bcc"] = $receiver["bcc"];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$inReplyTo = array("id" => $orig_post["uri"],
|
$inReplyTo = ["id" => $orig_post["uri"],
|
||||||
"objectType" => "note");
|
"objectType" => "note"];
|
||||||
|
|
||||||
if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
|
if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
|
||||||
$inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
|
$inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
|
||||||
|
|
||||||
$params["object"] = array(
|
$params["object"] = [
|
||||||
'objectType' => "comment",
|
'objectType' => "comment",
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'inReplyTo' => $inReplyTo);
|
'inReplyTo' => $inReplyTo];
|
||||||
|
|
||||||
if ($title != "")
|
if ($title != "")
|
||||||
$params["object"]["displayName"] = $title;
|
$params["object"]["displayName"] = $title;
|
||||||
|
@ -523,7 +523,7 @@ function pumpio_send(&$a,&$b) {
|
||||||
$url = 'https://'.$host.'/api/user/'.$user.'/feed';
|
$url = 'https://'.$host.'/api/user/'.$user.'/feed';
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
|
$success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ function pumpio_send(&$a,&$b) {
|
||||||
if (count($r))
|
if (count($r))
|
||||||
$a->contact = $r[0]["id"];
|
$a->contact = $r[0]["id"];
|
||||||
|
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $params));
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
|
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
|
||||||
notice(t('Pump.io post failed. Queued for retry.').EOL);
|
notice(t('Pump.io post failed. Queued for retry.').EOL);
|
||||||
|
@ -595,9 +595,9 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
|
||||||
$objectType = "image";
|
$objectType = "image";
|
||||||
|
|
||||||
$params["verb"] = $action;
|
$params["verb"] = $action;
|
||||||
$params["object"] = array('id' => $uri,
|
$params["object"] = ['id' => $uri,
|
||||||
"objectType" => $objectType,
|
"objectType" => $objectType,
|
||||||
"content" => $content);
|
"content" => $content];
|
||||||
|
|
||||||
$client = new oauth_client_class;
|
$client = new oauth_client_class;
|
||||||
$client->oauth_version = '1.0a';
|
$client->oauth_version = '1.0a';
|
||||||
|
@ -612,7 +612,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
|
||||||
$url = 'https://'.$hostname.'/api/user/'.$username.'/feed';
|
$url = 'https://'.$hostname.'/api/user/'.$username.'/feed';
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
|
$success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
|
||||||
if (count($r))
|
if (count($r))
|
||||||
$a->contact = $r[0]["id"];
|
$a->contact = $r[0]["id"];
|
||||||
|
|
||||||
$s = serialize(array('url' => $url, 'item' => $orig_post["id"], 'post' => $params));
|
$s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
|
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
|
||||||
notice(t('Pump.io like failed. Queued for retry.').EOL);
|
notice(t('Pump.io like failed. Queued for retry.').EOL);
|
||||||
|
@ -742,7 +742,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
|
||||||
$username = $user.'@'.$host;
|
$username = $user.'@'.$host;
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
|
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
|
||||||
if ($first_time)
|
if ($first_time)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$receiptians = array();
|
$receiptians = [];
|
||||||
if (@is_array($post->cc))
|
if (@is_array($post->cc))
|
||||||
$receiptians = array_merge($receiptians, $post->cc);
|
$receiptians = array_merge($receiptians, $post->cc);
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$likedata = array();
|
$likedata = [];
|
||||||
$likedata['parent'] = $orig_post['id'];
|
$likedata['parent'] = $orig_post['id'];
|
||||||
$likedata['verb'] = ACTIVITY_LIKE;
|
$likedata['verb'] = ACTIVITY_LIKE;
|
||||||
$likedata['gravity'] = 3;
|
$likedata['gravity'] = 3;
|
||||||
|
@ -977,10 +977,10 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
|
||||||
|
|
||||||
function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
||||||
|
|
||||||
GContact::update(array("url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
|
GContact::update(["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
|
||||||
"photo" => $contact->image->url, "name" => $contact->displayName, "hide" => true,
|
"photo" => $contact->image->url, "name" => $contact->displayName, "hide" => true,
|
||||||
"nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
|
"nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
|
||||||
"about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)));
|
"about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)]);
|
||||||
$cid = Contact::getIdForURL($contact->url, $uid);
|
$cid = Contact::getIdForURL($contact->url, $uid);
|
||||||
|
|
||||||
if ($no_insert)
|
if ($no_insert)
|
||||||
|
@ -1101,7 +1101,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
if (!strstr("post|share|update", $post->verb))
|
if (!strstr("post|share|update", $post->verb))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$receiptians = array();
|
$receiptians = [];
|
||||||
if (@is_array($post->cc))
|
if (@is_array($post->cc))
|
||||||
$receiptians = array_merge($receiptians, $post->cc);
|
$receiptians = array_merge($receiptians, $post->cc);
|
||||||
|
|
||||||
|
@ -1113,7 +1113,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
if ($receiver->id == "http://activityschema.org/collection/public")
|
if ($receiver->id == "http://activityschema.org/collection/public")
|
||||||
$public = true;
|
$public = true;
|
||||||
|
|
||||||
$postarray = array();
|
$postarray = [];
|
||||||
$postarray['network'] = NETWORK_PUMPIO;
|
$postarray['network'] = NETWORK_PUMPIO;
|
||||||
$postarray['gravity'] = 0;
|
$postarray['gravity'] = 0;
|
||||||
$postarray['uid'] = $uid;
|
$postarray['uid'] = $uid;
|
||||||
|
@ -1294,7 +1294,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
|
|
||||||
$conv_parent = $conv['parent'];
|
$conv_parent = $conv['parent'];
|
||||||
|
|
||||||
notification(array(
|
notification([
|
||||||
'type' => NOTIFY_COMMENT,
|
'type' => NOTIFY_COMMENT,
|
||||||
'notify_flags' => $user[0]['notify-flags'],
|
'notify_flags' => $user[0]['notify-flags'],
|
||||||
'language' => $user[0]['language'],
|
'language' => $user[0]['language'],
|
||||||
|
@ -1309,7 +1309,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
|
||||||
'verb' => ACTIVITY_POST,
|
'verb' => ACTIVITY_POST,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $conv_parent,
|
'parent' => $conv_parent,
|
||||||
));
|
]);
|
||||||
|
|
||||||
// only send one notification
|
// only send one notification
|
||||||
break;
|
break;
|
||||||
|
@ -1362,7 +1362,7 @@ function pumpio_fetchinbox(&$a, $uid) {
|
||||||
$url .= '?since='.urlencode($last_id);
|
$url .= '?since='.urlencode($last_id);
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
|
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -1403,7 +1403,7 @@ function pumpio_getallusers(&$a, $uid) {
|
||||||
$url = 'https://'.$hostname.'/api/user/'.$username.'/following';
|
$url = 'https://'.$hostname.'/api/user/'.$username.'/following';
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
|
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -1411,7 +1411,7 @@ function pumpio_getallusers(&$a, $uid) {
|
||||||
$url = 'https://'.$hostname.'/api/user/'.$username.'/following?count='.$users->totalItems;
|
$url = 'https://'.$hostname.'/api/user/'.$username.'/following?count='.$users->totalItems;
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
|
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1478,7 @@ function pumpio_queue_hook(&$a,&$b) {
|
||||||
$client->client_secret = $consumer_secret;
|
$client->client_secret = $consumer_secret;
|
||||||
|
|
||||||
if (pumpio_reachable($z['url']))
|
if (pumpio_reachable($z['url']))
|
||||||
$success = $client->CallAPI($z['url'], 'POST', $z['post'], array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
|
$success = $client->CallAPI($z['url'], 'POST', $z['post'], ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -1507,7 +1507,7 @@ function pumpio_queue_hook(&$a,&$b) {
|
||||||
|
|
||||||
function pumpio_getreceiver(&$a, $b) {
|
function pumpio_getreceiver(&$a, $b) {
|
||||||
|
|
||||||
$receiver = array();
|
$receiver = [];
|
||||||
|
|
||||||
if (!$b["private"]) {
|
if (!$b["private"]) {
|
||||||
|
|
||||||
|
@ -1517,9 +1517,9 @@ function pumpio_getreceiver(&$a, $b) {
|
||||||
$public = PConfig::get($b['uid'], "pumpio", "public");
|
$public = PConfig::get($b['uid'], "pumpio", "public");
|
||||||
|
|
||||||
if ($public)
|
if ($public)
|
||||||
$receiver["to"][] = Array(
|
$receiver["to"][] = [
|
||||||
"objectType" => "collection",
|
"objectType" => "collection",
|
||||||
"id" => "http://activityschema.org/collection/public");
|
"id" => "http://activityschema.org/collection/public"];
|
||||||
} else {
|
} else {
|
||||||
$cids = explode("><", $b["allow_cid"]);
|
$cids = explode("><", $b["allow_cid"]);
|
||||||
$gids = explode("><", $b["allow_gid"]);
|
$gids = explode("><", $b["allow_gid"]);
|
||||||
|
@ -1534,11 +1534,11 @@ function pumpio_getreceiver(&$a, $b) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
$receiver["bcc"][] = Array(
|
$receiver["bcc"][] = [
|
||||||
"displayName" => $r[0]["name"],
|
"displayName" => $r[0]["name"],
|
||||||
"objectType" => "person",
|
"objectType" => "person",
|
||||||
"preferredUsername" => $r[0]["nick"],
|
"preferredUsername" => $r[0]["nick"],
|
||||||
"url" => $r[0]["url"]);
|
"url" => $r[0]["url"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($gids AS $gid) {
|
foreach ($gids AS $gid) {
|
||||||
|
@ -1552,11 +1552,11 @@ function pumpio_getreceiver(&$a, $b) {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($r AS $row)
|
foreach ($r AS $row)
|
||||||
$receiver["bcc"][] = Array(
|
$receiver["bcc"][] = [
|
||||||
"displayName" => $row["name"],
|
"displayName" => $row["name"],
|
||||||
"objectType" => "person",
|
"objectType" => "person",
|
||||||
"preferredUsername" => $row["nick"],
|
"preferredUsername" => $row["nick"],
|
||||||
"url" => $row["url"]);
|
"url" => $row["url"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1577,11 +1577,11 @@ function pumpio_getreceiver(&$a, $b) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
$receiver["to"][] = Array(
|
$receiver["to"][] = [
|
||||||
"displayName" => $r[0]["name"],
|
"displayName" => $r[0]["name"],
|
||||||
"objectType" => "person",
|
"objectType" => "person",
|
||||||
"preferredUsername" => $r[0]["nick"],
|
"preferredUsername" => $r[0]["nick"],
|
||||||
"url" => $r[0]["url"]);
|
"url" => $r[0]["url"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1628,7 +1628,7 @@ function pumpio_fetchallcomments(&$a, $uid, $id) {
|
||||||
logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
|
logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
|
||||||
|
|
||||||
if (pumpio_reachable($url))
|
if (pumpio_reachable($url))
|
||||||
$success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $item);
|
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $item);
|
||||||
else
|
else
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
|
@ -1697,7 +1697,7 @@ function pumpio_fetchallcomments(&$a, $uid, $id) {
|
||||||
|
|
||||||
|
|
||||||
function pumpio_reachable($url) {
|
function pumpio_reachable($url) {
|
||||||
$data = z_fetch_url($url, false, $redirects, array('timeout'=>10));
|
$data = z_fetch_url($url, false, $redirects, ['timeout'=>10]);
|
||||||
return(intval($data['return_code']) != 0);
|
return(intval($data['return_code']) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ function randplace_post_hook($a, &$item) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$cities = array();
|
$cities = [];
|
||||||
$zones = timezone_identifiers_list();
|
$zones = timezone_identifiers_list();
|
||||||
foreach($zones as $zone) {
|
foreach($zones as $zone) {
|
||||||
if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/')))
|
if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/')))
|
||||||
|
|
|
@ -43,12 +43,12 @@ function remote_permissions_settings(&$a,&$o) {
|
||||||
|
|
||||||
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
|
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
|
||||||
$t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
|
$t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
|
||||||
$o .= replace_macros($t, array(
|
$o .= replace_macros($t, [
|
||||||
'$remote_perms_title' => t('Remote Permissions Settings'),
|
'$remote_perms_title' => t('Remote Permissions Settings'),
|
||||||
'$remote_perms_label' => t('Allow recipients of your private posts to see the other recipients of the posts'),
|
'$remote_perms_label' => t('Allow recipients of your private posts to see the other recipients of the posts'),
|
||||||
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
|
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
|
||||||
'$submit' => t('Save Settings')
|
'$submit' => t('Save Settings')
|
||||||
));
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ function remote_permissions_content($a, $item_copy) {
|
||||||
if(($item_copy['private'] == 1) && (! strlen($item_copy['allow_cid'])) && (! strlen($item_copy['allow_gid']))
|
if(($item_copy['private'] == 1) && (! strlen($item_copy['allow_cid'])) && (! strlen($item_copy['allow_gid']))
|
||||||
&& (! strlen($item_copy['deny_cid'])) && (! strlen($item_copy['deny_gid']))) {
|
&& (! strlen($item_copy['deny_cid'])) && (! strlen($item_copy['deny_gid']))) {
|
||||||
|
|
||||||
$allow_names = array();
|
$allow_names = [];
|
||||||
|
|
||||||
// Check for the original post here -- that's the only way
|
// Check for the original post here -- that's the only way
|
||||||
// to definitely get all of the recipients
|
// to definitely get all of the recipients
|
||||||
|
@ -124,8 +124,8 @@ function remote_permissions_content($a, $item_copy) {
|
||||||
$deny_groups = expand_acl($item['deny_gid']);
|
$deny_groups = expand_acl($item['deny_gid']);
|
||||||
|
|
||||||
$o = t('Visible to:') . '<br />';
|
$o = t('Visible to:') . '<br />';
|
||||||
$allow = array();
|
$allow = [];
|
||||||
$deny = array();
|
$deny = [];
|
||||||
|
|
||||||
if(count($allowed_groups)) {
|
if(count($allowed_groups)) {
|
||||||
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
|
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
|
||||||
|
@ -167,7 +167,7 @@ function remote_permissions_content($a, $item_copy) {
|
||||||
if(! $r)
|
if(! $r)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$allow = array();
|
$allow = [];
|
||||||
foreach($r as $rr)
|
foreach($r as $rr)
|
||||||
$allow[] = $rr['uid'];
|
$allow[] = $rr['uid'];
|
||||||
|
|
||||||
|
@ -194,11 +194,11 @@ function remote_permissions_content($a, $item_copy) {
|
||||||
|
|
||||||
function remote_permissions_plugin_admin(&$a, &$o){
|
function remote_permissions_plugin_admin(&$a, &$o){
|
||||||
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
|
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1),
|
'$global' => ['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)
|
'$individual' => ['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){
|
function remote_permissions_plugin_admin_post(&$a){
|
||||||
|
|
|
@ -28,7 +28,7 @@ function rendertime_page_end(&$a, &$o) {
|
||||||
|
|
||||||
$duration = microtime(true)-$a->performance["start"];
|
$duration = microtime(true)-$a->performance["start"];
|
||||||
|
|
||||||
$ignored_modules = array("fbrowser");
|
$ignored_modules = ["fbrowser"];
|
||||||
$ignored = in_array($a->module, $ignored_modules);
|
$ignored = in_array($a->module, $ignored_modules);
|
||||||
|
|
||||||
if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
|
if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
|
||||||
|
|
|
@ -60,13 +60,13 @@ function securemail_settings(App &$a, &$s){
|
||||||
|
|
||||||
$t = get_markup_template('admin.tpl', 'addon/securemail/');
|
$t = get_markup_template('admin.tpl', 'addon/securemail/');
|
||||||
|
|
||||||
$s .= replace_macros($t, array(
|
$s .= replace_macros($t, [
|
||||||
'$title' => t('"Secure Mail" Settings'),
|
'$title' => t('"Secure Mail" Settings'),
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$test' => t('Save and send test'), //NOTE: update also in 'post'
|
'$test' => t('Save and send test'), //NOTE: update also in 'post'
|
||||||
'$enable' => array('securemail-enable', t('Enable Secure Mail'), $enable, ''),
|
'$enable' => ['securemail-enable', t('Enable Secure Mail'), $enable, ''],
|
||||||
'$publickey' => array('securemail-pkey', t('Public key'), $publickey, t('Your public PGP key, ascii armored format'), 'rows="10"')
|
'$publickey' => ['securemail-pkey', t('Public key'), $publickey, t('Your public PGP key, ascii armored format'), 'rows="10"']
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ function securemail_settings_post(App &$a, array &$b){
|
||||||
$subject = 'Friendica - Secure Mail - Test';
|
$subject = 'Friendica - Secure Mail - Test';
|
||||||
$message = 'This is a test message from your Friendica Secure Mail addon.';
|
$message = 'This is a test message from your Friendica Secure Mail addon.';
|
||||||
|
|
||||||
$params = array(
|
$params = [
|
||||||
'uid' => local_user(),
|
'uid' => local_user(),
|
||||||
'fromName' => $sitename,
|
'fromName' => $sitename,
|
||||||
'fromEmail' => $sender_email,
|
'fromEmail' => $sender_email,
|
||||||
|
@ -115,7 +115,7 @@ function securemail_settings_post(App &$a, array &$b){
|
||||||
'messageSubject' => $subject,
|
'messageSubject' => $subject,
|
||||||
'htmlVersion' => "<p>{$message}</p>",
|
'htmlVersion' => "<p>{$message}</p>",
|
||||||
'textVersion' => $message,
|
'textVersion' => $message,
|
||||||
);
|
];
|
||||||
|
|
||||||
// enable addon for test
|
// enable addon for test
|
||||||
PConfig::set(local_user(), 'securemail', 'enable', 1);
|
PConfig::set(local_user(), 'securemail', 'enable', 1);
|
||||||
|
@ -164,11 +164,11 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
|
||||||
|
|
||||||
$key = OpenPGP_Message::parse($public_key);
|
$key = OpenPGP_Message::parse($public_key);
|
||||||
|
|
||||||
$data = new OpenPGP_LiteralDataPacket($b['textVersion'], array(
|
$data = new OpenPGP_LiteralDataPacket($b['textVersion'], [
|
||||||
'format' => 'u',
|
'format' => 'u',
|
||||||
'filename' => 'encrypted.gpg'
|
'filename' => 'encrypted.gpg'
|
||||||
));
|
]);
|
||||||
$encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message(array($data)));
|
$encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data]));
|
||||||
$armored_encrypted = wordwrap(
|
$armored_encrypted = wordwrap(
|
||||||
OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE'),
|
OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE'),
|
||||||
64,
|
64,
|
||||||
|
|
|
@ -156,7 +156,7 @@ function showmore_cutitem($text, $limit) {
|
||||||
@$doc->loadHTML($doctype."<html><body>".$text."</body></html>");
|
@$doc->loadHTML($doctype."<html><body>".$text."</body></html>");
|
||||||
|
|
||||||
$text = $doc->saveHTML();
|
$text = $doc->saveHTML();
|
||||||
$text = str_replace(array("<html><body>", "</body></html>", $doctype), array("", "", ""), $text);
|
$text = str_replace(["<html><body>", "</body></html>", $doctype], ["", "", ""], $text);
|
||||||
|
|
||||||
return($text);
|
return($text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ function show_button($a, &$b) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$texts = array(
|
$texts = [
|
||||||
'<3',
|
'<3',
|
||||||
'</3',
|
'</3',
|
||||||
':-)',
|
':-)',
|
||||||
|
@ -66,9 +66,9 @@ function show_button($a, &$b) {
|
||||||
'~friendica',
|
'~friendica',
|
||||||
'red#'
|
'red#'
|
||||||
|
|
||||||
);
|
];
|
||||||
|
|
||||||
$icons = array(
|
$icons = [
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
||||||
|
@ -92,10 +92,10 @@ function show_button($a, &$b) {
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" />',
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" />',
|
||||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red" />'
|
'<img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red" />'
|
||||||
);
|
];
|
||||||
|
|
||||||
// Call hooks to get aditional smileies from other addons
|
// Call hooks to get aditional smileies from other addons
|
||||||
$params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed
|
$params = ['texts' => $texts, 'icons' => $icons, 'string' => ""]; //changed
|
||||||
call_hooks('smilie', $params);
|
call_hooks('smilie', $params);
|
||||||
|
|
||||||
//Generate html for smiley list
|
//Generate html for smiley list
|
||||||
|
|
|
@ -97,7 +97,7 @@ class StatusNetOAuth extends TwitterOAuth
|
||||||
*/
|
*/
|
||||||
function http($url, $method, $postfields = NULL)
|
function http($url, $method, $postfields = NULL)
|
||||||
{
|
{
|
||||||
$this->http_info = array();
|
$this->http_info = [];
|
||||||
$ci = curl_init();
|
$ci = curl_init();
|
||||||
/* Curl settings */
|
/* Curl settings */
|
||||||
$prx = Config::get('system', 'proxy');
|
$prx = Config::get('system', 'proxy');
|
||||||
|
@ -113,9 +113,9 @@ class StatusNetOAuth extends TwitterOAuth
|
||||||
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
|
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
|
||||||
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
|
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
|
||||||
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
|
||||||
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
|
curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']);
|
||||||
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
|
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
|
||||||
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
|
curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']);
|
||||||
curl_setopt($ci, CURLOPT_HEADER, FALSE);
|
curl_setopt($ci, CURLOPT_HEADER, FALSE);
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
|
@ -331,7 +331,7 @@ function statusnet_settings(App $a, &$s)
|
||||||
$mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
|
$mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
|
||||||
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
||||||
$import = PConfig::get(local_user(), 'statusnet', 'import');
|
$import = PConfig::get(local_user(), 'statusnet', 'import');
|
||||||
$importselected = array("", "", "");
|
$importselected = ["", "", ""];
|
||||||
$importselected[$import] = ' selected="selected"';
|
$importselected[$import] = ' selected="selected"';
|
||||||
//$importenabled = PConfig::get(local_user(),'statusnet','import');
|
//$importenabled = PConfig::get(local_user(),'statusnet','import');
|
||||||
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
||||||
|
@ -662,9 +662,9 @@ function statusnet_post_hook(App $a, &$b)
|
||||||
$img_str = fetch_url($image);
|
$img_str = fetch_url($image);
|
||||||
$tempfile = tempnam(get_temppath(), "cache");
|
$tempfile = tempnam(get_temppath(), "cache");
|
||||||
file_put_contents($tempfile, $img_str);
|
file_put_contents($tempfile, $img_str);
|
||||||
$postdata = array("status" => $msg, "media[]" => $tempfile);
|
$postdata = ["status" => $msg, "media[]" => $tempfile];
|
||||||
} else {
|
} else {
|
||||||
$postdata = array("status" => $msg);
|
$postdata = ["status" => $msg];
|
||||||
}
|
}
|
||||||
|
|
||||||
// and now dent it :-)
|
// and now dent it :-)
|
||||||
|
@ -708,7 +708,7 @@ function statusnet_post_hook(App $a, &$b)
|
||||||
|
|
||||||
function statusnet_plugin_admin_post(App $a)
|
function statusnet_plugin_admin_post(App $a)
|
||||||
{
|
{
|
||||||
$sites = array();
|
$sites = [];
|
||||||
|
|
||||||
foreach ($_POST['sitename'] as $id => $sitename) {
|
foreach ($_POST['sitename'] as $id => $sitename) {
|
||||||
$sitename = trim($sitename);
|
$sitename = trim($sitename);
|
||||||
|
@ -725,13 +725,13 @@ function statusnet_plugin_admin_post(App $a)
|
||||||
$key != "" &&
|
$key != "" &&
|
||||||
!x($_POST['delete'][$id])) {
|
!x($_POST['delete'][$id])) {
|
||||||
|
|
||||||
$sites[] = Array(
|
$sites[] = [
|
||||||
'sitename' => $sitename,
|
'sitename' => $sitename,
|
||||||
'apiurl' => $apiurl,
|
'apiurl' => $apiurl,
|
||||||
'consumersecret' => $secret,
|
'consumersecret' => $secret,
|
||||||
'consumerkey' => $key,
|
'consumerkey' => $key,
|
||||||
//'applicationname' => $applicationname
|
//'applicationname' => $applicationname
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,34 +741,34 @@ function statusnet_plugin_admin_post(App $a)
|
||||||
function statusnet_plugin_admin(App $a, &$o)
|
function statusnet_plugin_admin(App $a, &$o)
|
||||||
{
|
{
|
||||||
$sites = Config::get('statusnet', 'sites');
|
$sites = Config::get('statusnet', 'sites');
|
||||||
$sitesform = array();
|
$sitesform = [];
|
||||||
if (is_array($sites)) {
|
if (is_array($sites)) {
|
||||||
foreach ($sites as $id => $s) {
|
foreach ($sites as $id => $s) {
|
||||||
$sitesform[] = Array(
|
$sitesform[] = [
|
||||||
'sitename' => Array("sitename[$id]", "Site name", $s['sitename'], ""),
|
'sitename' => ["sitename[$id]", "Site name", $s['sitename'], ""],
|
||||||
'apiurl' => Array("apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29")),
|
'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29")],
|
||||||
'secret' => Array("secret[$id]", "Secret", $s['consumersecret'], ""),
|
'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""],
|
||||||
'key' => Array("key[$id]", "Key", $s['consumerkey'], ""),
|
'key' => ["key[$id]", "Key", $s['consumerkey'], ""],
|
||||||
//'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
|
//'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
|
||||||
'delete' => Array("delete[$id]", "Delete", False, "Check to delete this preset"),
|
'delete' => ["delete[$id]", "Delete", False, "Check to delete this preset"],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* empty form to add new site */
|
/* empty form to add new site */
|
||||||
$id++;
|
$id++;
|
||||||
$sitesform[] = Array(
|
$sitesform[] = [
|
||||||
'sitename' => Array("sitename[$id]", t("Site name"), "", ""),
|
'sitename' => ["sitename[$id]", t("Site name"), "", ""],
|
||||||
'apiurl' => Array("apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29")),
|
'apiurl' => ["apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29")],
|
||||||
'secret' => Array("secret[$id]", t("Consumer Secret"), "", ""),
|
'secret' => ["secret[$id]", t("Consumer Secret"), "", ""],
|
||||||
'key' => Array("key[$id]", t("Consumer Key"), "", ""),
|
'key' => ["key[$id]", t("Consumer Key"), "", ""],
|
||||||
//'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""),
|
//'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""),
|
||||||
);
|
];
|
||||||
|
|
||||||
$t = get_markup_template("admin.tpl", "addon/statusnet/");
|
$t = get_markup_template("admin.tpl", "addon/statusnet/");
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$sites' => $sitesform,
|
'$sites' => $sitesform,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusnet_prepare_body(App $a, &$b)
|
function statusnet_prepare_body(App $a, &$b)
|
||||||
|
@ -902,7 +902,7 @@ function statusnet_fetchtimeline(App $a, $uid)
|
||||||
|
|
||||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||||
|
|
||||||
$parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false);
|
$parameters = ["exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false];
|
||||||
|
|
||||||
$first_time = ($lastid == "");
|
$first_time = ($lastid == "");
|
||||||
|
|
||||||
|
@ -1006,11 +1006,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GContact::update(array("url" => $contact->statusnet_profile_url,
|
GContact::update(["url" => $contact->statusnet_profile_url,
|
||||||
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
|
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
|
||||||
"name" => $contact->name, "nick" => $contact->screen_name,
|
"name" => $contact->name, "nick" => $contact->screen_name,
|
||||||
"location" => $contact->location, "about" => $contact->description,
|
"location" => $contact->location, "about" => $contact->description,
|
||||||
"addr" => statusnet_address($contact), "generation" => 3));
|
"addr" => statusnet_address($contact), "generation" => 3]);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = [];
|
||||||
|
|
||||||
if ($screen_name != "") {
|
if ($screen_name != "") {
|
||||||
$parameters["screen_name"] = $screen_name;
|
$parameters["screen_name"] = $screen_name;
|
||||||
|
@ -1174,7 +1174,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||||
|
|
||||||
$postarray = array();
|
$postarray = [];
|
||||||
$postarray['network'] = NETWORK_STATUSNET;
|
$postarray['network'] = NETWORK_STATUSNET;
|
||||||
$postarray['gravity'] = 0;
|
$postarray['gravity'] = 0;
|
||||||
$postarray['uid'] = $uid;
|
$postarray['uid'] = $uid;
|
||||||
|
@ -1195,7 +1195,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$contactid = 0;
|
$contactid = 0;
|
||||||
|
@ -1244,7 +1244,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
$postarray['owner-link'] = $r[0]["url"];
|
$postarray['owner-link'] = $r[0]["url"];
|
||||||
$postarray['owner-avatar'] = $r[0]["photo"];
|
$postarray['owner-avatar'] = $r[0]["photo"];
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't create accounts of people who just comment something
|
// Don't create accounts of people who just comment something
|
||||||
|
@ -1263,7 +1263,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
if (($contactid == 0) && !$only_existing_contact) {
|
if (($contactid == 0) && !$only_existing_contact) {
|
||||||
$contactid = $self['id'];
|
$contactid = $self['id'];
|
||||||
} elseif ($contactid <= 0) {
|
} elseif ($contactid <= 0) {
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$postarray['contact-id'] = $contactid;
|
$postarray['contact-id'] = $contactid;
|
||||||
|
@ -1361,7 +1361,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
|
||||||
|
|
||||||
$conv_parent = $conv['parent'];
|
$conv_parent = $conv['parent'];
|
||||||
|
|
||||||
notification(array(
|
notification([
|
||||||
'type' => NOTIFY_COMMENT,
|
'type' => NOTIFY_COMMENT,
|
||||||
'notify_flags' => $user[0]['notify-flags'],
|
'notify_flags' => $user[0]['notify-flags'],
|
||||||
'language' => $user[0]['language'],
|
'language' => $user[0]['language'],
|
||||||
|
@ -1376,7 +1376,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
|
||||||
'verb' => ACTIVITY_POST,
|
'verb' => ACTIVITY_POST,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $conv_parent,
|
'parent' => $conv_parent,
|
||||||
));
|
]);
|
||||||
|
|
||||||
// only send one notification
|
// only send one notification
|
||||||
break;
|
break;
|
||||||
|
@ -1386,7 +1386,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
|
||||||
|
|
||||||
function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
||||||
{
|
{
|
||||||
$conversations = array();
|
$conversations = [];
|
||||||
|
|
||||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||||
|
@ -1435,7 +1435,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true);
|
$parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true];
|
||||||
//$parameters["count"] = 200;
|
//$parameters["count"] = 200;
|
||||||
|
|
||||||
if ($mode == 1) {
|
if ($mode == 1) {
|
||||||
|
@ -1569,7 +1569,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
||||||
|
|
||||||
if (($item != 0) && !function_exists("check_item_notification")) {
|
if (($item != 0) && !function_exists("check_item_notification")) {
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
notification(array(
|
notification([
|
||||||
'type' => NOTIFY_TAGSELF,
|
'type' => NOTIFY_TAGSELF,
|
||||||
'notify_flags' => $u[0]['notify-flags'],
|
'notify_flags' => $u[0]['notify-flags'],
|
||||||
'language' => $u[0]['language'],
|
'language' => $u[0]['language'],
|
||||||
|
@ -1584,7 +1584,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
||||||
'verb' => ACTIVITY_TAG,
|
'verb' => ACTIVITY_TAG,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $parent_id,
|
'parent' => $parent_id,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1711,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($no_tags) {
|
if ($no_tags) {
|
||||||
return array("body" => $body, "tags" => "");
|
return ["body" => $body, "tags" => ""];
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_tags = '';
|
$str_tags = '';
|
||||||
|
@ -1739,7 +1739,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array("body" => $body, "tags" => $str_tags);
|
return ["body" => $body, "tags" => $str_tags];
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusnet_fetch_own_contact(App $a, $uid)
|
function statusnet_fetch_own_contact(App $a, $uid)
|
||||||
|
|
|
@ -58,7 +58,7 @@ function testdrive_cron($a,$b) {
|
||||||
|
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
notification(array(
|
notification([
|
||||||
'uid' => $rr['uid'],
|
'uid' => $rr['uid'],
|
||||||
'type' => NOTIFY_SYSTEM,
|
'type' => NOTIFY_SYSTEM,
|
||||||
'system_type' => 'testdrive_expire',
|
'system_type' => 'testdrive_expire',
|
||||||
|
@ -68,7 +68,7 @@ function testdrive_cron($a,$b) {
|
||||||
'source_name' => t('Administrator'),
|
'source_name' => t('Administrator'),
|
||||||
'source_link' => $a->get_baseurl(),
|
'source_link' => $a->get_baseurl(),
|
||||||
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
|
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
|
||||||
));
|
]);
|
||||||
|
|
||||||
q("update user set expire_notification_sent = '%s' where uid = %d",
|
q("update user set expire_notification_sent = '%s' where uid = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
|
|
@ -77,7 +77,7 @@ class tictac {
|
||||||
private $you;
|
private $you;
|
||||||
private $me;
|
private $me;
|
||||||
private $debug = 1;
|
private $debug = 1;
|
||||||
private $crosses = array('011','101','110','112','121','211');
|
private $crosses = ['011','101','110','112','121','211'];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
'001','010','011','012','021',
|
'001','010','011','012','021',
|
||||||
|
@ -85,82 +85,82 @@ class tictac {
|
||||||
'201','210','211','212','221');
|
'201','210','211','212','221');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $corners = array(
|
private $corners = [
|
||||||
'000','002','020','022',
|
'000','002','020','022',
|
||||||
'200','202','220','222');
|
'200','202','220','222'];
|
||||||
|
|
||||||
private $planes = array(
|
private $planes = [
|
||||||
array('000','001','002','010','011','012','020','021','022'), // horiz 1
|
['000','001','002','010','011','012','020','021','022'], // horiz 1
|
||||||
array('100','101','102','110','111','112','120','121','122'), // 2
|
['100','101','102','110','111','112','120','121','122'], // 2
|
||||||
array('200','201','202','210','211','212','220','221','222'), // 3
|
['200','201','202','210','211','212','220','221','222'], // 3
|
||||||
array('000','010','020','100','110','120','200','210','220'), // vert left
|
['000','010','020','100','110','120','200','210','220'], // vert left
|
||||||
array('000','001','002','100','101','102','200','201','202'), // vert top
|
['000','001','002','100','101','102','200','201','202'], // vert top
|
||||||
array('002','012','022','102','112','122','202','212','222'), // vert right
|
['002','012','022','102','112','122','202','212','222'], // vert right
|
||||||
array('020','021','022','120','121','122','220','221','222'), // vert bot
|
['020','021','022','120','121','122','220','221','222'], // vert bot
|
||||||
array('010','011','012','110','111','112','210','211','212'), // left vertx
|
['010','011','012','110','111','112','210','211','212'], // left vertx
|
||||||
array('001','011','021','101','111','221','201','211','221'), // top vertx
|
['001','011','021','101','111','221','201','211','221'], // top vertx
|
||||||
array('000','001','002','110','111','112','220','221','222'), // diag top
|
['000','001','002','110','111','112','220','221','222'], // diag top
|
||||||
array('020','021','022','110','111','112','200','201','202'), // diag bot
|
['020','021','022','110','111','112','200','201','202'], // diag bot
|
||||||
array('000','010','020','101','111','121','202','212','222'), // diag left
|
['000','010','020','101','111','121','202','212','222'], // diag left
|
||||||
array('002','012','022','101','111','121','200','210','220'), // diag right
|
['002','012','022','101','111','121','200','210','220'], // diag right
|
||||||
array('002','011','020','102','111','120','202','211','220'), // diag x
|
['002','011','020','102','111','120','202','211','220'], // diag x
|
||||||
array('000','011','022','100','111','122','200','211','222') // diag x
|
['000','011','022','100','111','122','200','211','222'] // diag x
|
||||||
|
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
private $winner = array(
|
private $winner = [
|
||||||
array('000','001','002'), // board 0 winners - left corner across
|
['000','001','002'], // board 0 winners - left corner across
|
||||||
array('000','010','020'), // down
|
['000','010','020'], // down
|
||||||
array('000','011','022'), // diag
|
['000','011','022'], // diag
|
||||||
array('001','011','021'), // middle-top down
|
['001','011','021'], // middle-top down
|
||||||
array('010','011','012'), // middle-left across
|
['010','011','012'], // middle-left across
|
||||||
array('002','011','020'), // right-top diag
|
['002','011','020'], // right-top diag
|
||||||
array('002','012','022'), // right-top down
|
['002','012','022'], // right-top down
|
||||||
array('020','021','022'), // bottom-left across
|
['020','021','022'], // bottom-left across
|
||||||
array('100','101','102'), // board 1 winners
|
['100','101','102'], // board 1 winners
|
||||||
array('100','110','120'),
|
['100','110','120'],
|
||||||
array('100','111','122'),
|
['100','111','122'],
|
||||||
array('101','111','121'),
|
['101','111','121'],
|
||||||
array('110','111','112'),
|
['110','111','112'],
|
||||||
array('102','111','120'),
|
['102','111','120'],
|
||||||
array('102','112','122'),
|
['102','112','122'],
|
||||||
array('120','121','122'),
|
['120','121','122'],
|
||||||
array('200','201','202'), // board 2 winners
|
['200','201','202'], // board 2 winners
|
||||||
array('200','210','220'),
|
['200','210','220'],
|
||||||
array('200','211','222'),
|
['200','211','222'],
|
||||||
array('201','211','221'),
|
['201','211','221'],
|
||||||
array('210','211','212'),
|
['210','211','212'],
|
||||||
array('202','211','220'),
|
['202','211','220'],
|
||||||
array('202','212','222'),
|
['202','212','222'],
|
||||||
array('220','221','222'),
|
['220','221','222'],
|
||||||
array('000','100','200'), // top-left corner 3d
|
['000','100','200'], // top-left corner 3d
|
||||||
array('000','101','202'),
|
['000','101','202'],
|
||||||
array('000','110','220'),
|
['000','110','220'],
|
||||||
array('000','111','222'),
|
['000','111','222'],
|
||||||
array('001','101','201'), // top-middle 3d
|
['001','101','201'], // top-middle 3d
|
||||||
array('001','111','221'),
|
['001','111','221'],
|
||||||
array('002','102','202'), // top-right corner 3d
|
['002','102','202'], // top-right corner 3d
|
||||||
array('002','101','200'),
|
['002','101','200'],
|
||||||
array('002','112','222'),
|
['002','112','222'],
|
||||||
array('002','111','220'),
|
['002','111','220'],
|
||||||
array('010','110','210'), // left-middle 3d
|
['010','110','210'], // left-middle 3d
|
||||||
array('010','111','212'),
|
['010','111','212'],
|
||||||
array('011','111','211'), // middle-middle 3d
|
['011','111','211'], // middle-middle 3d
|
||||||
array('012','112','212'), // right-middle 3d
|
['012','112','212'], // right-middle 3d
|
||||||
array('012','111','210'),
|
['012','111','210'],
|
||||||
array('020','120','220'), // bottom-left corner 3d
|
['020','120','220'], // bottom-left corner 3d
|
||||||
array('020','110','200'),
|
['020','110','200'],
|
||||||
array('020','121','222'),
|
['020','121','222'],
|
||||||
array('020','111','202'),
|
['020','111','202'],
|
||||||
array('021','121','221'), // bottom-middle 3d
|
['021','121','221'], // bottom-middle 3d
|
||||||
array('021','111','201'),
|
['021','111','201'],
|
||||||
array('022','122','222'), // bottom-right corner 3d
|
['022','122','222'], // bottom-right corner 3d
|
||||||
array('022','121','220'),
|
['022','121','220'],
|
||||||
array('022','112','202'),
|
['022','112','202'],
|
||||||
array('022','111','200')
|
['022','111','200']
|
||||||
|
|
||||||
);
|
];
|
||||||
|
|
||||||
function __construct($dimen,$handicap,$mefirst,$yours,$mine) {
|
function __construct($dimen,$handicap,$mefirst,$yours,$mine) {
|
||||||
$this->dimen = 3;
|
$this->dimen = 3;
|
||||||
|
@ -231,7 +231,7 @@ class tictac {
|
||||||
$str = $this->mine;
|
$str = $this->mine;
|
||||||
if($player == 'you')
|
if($player == 'you')
|
||||||
$str = $this->yours;
|
$str = $this->yours;
|
||||||
$ret = array();
|
$ret = [];
|
||||||
while(strlen($str)) {
|
while(strlen($str)) {
|
||||||
$ret[] = substr($str,0,3);
|
$ret[] = substr($str,0,3);
|
||||||
$str = substr($str,3);
|
$str = substr($str,3);
|
||||||
|
@ -338,7 +338,7 @@ function winning_move() {
|
||||||
else {
|
else {
|
||||||
$r = $this->get_corners($this->me);
|
$r = $this->get_corners($this->me);
|
||||||
if(count($r) > 1) {
|
if(count($r) > 1) {
|
||||||
$w1 = array(); $w2 = array();
|
$w1 = []; $w2 = [];
|
||||||
foreach($this->winner as $w) {
|
foreach($this->winner as $w) {
|
||||||
if(in_array('111',$w))
|
if(in_array('111',$w))
|
||||||
continue;
|
continue;
|
||||||
|
@ -388,14 +388,14 @@ function winning_move() {
|
||||||
|
|
||||||
|
|
||||||
// find all the winners containing my points.
|
// find all the winners containing my points.
|
||||||
$mywinners = array();
|
$mywinners = [];
|
||||||
foreach($this->winner as $w)
|
foreach($this->winner as $w)
|
||||||
foreach($this->me as $m)
|
foreach($this->me as $m)
|
||||||
if((in_array($m,$w)) && (! in_array($w,$mywinners)))
|
if((in_array($m,$w)) && (! in_array($w,$mywinners)))
|
||||||
$mywinners[] = $w;
|
$mywinners[] = $w;
|
||||||
|
|
||||||
// find all the rules where my points are in the center.
|
// find all the rules where my points are in the center.
|
||||||
$trythese = array();
|
$trythese = [];
|
||||||
if(count($mywinners)) {
|
if(count($mywinners)) {
|
||||||
foreach($mywinners as $w) {
|
foreach($mywinners as $w) {
|
||||||
foreach($this->me as $m) {
|
foreach($this->me as $m) {
|
||||||
|
@ -406,7 +406,7 @@ function winning_move() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$myplanes = array();
|
$myplanes = [];
|
||||||
for($p = 0; $p < count($this->planes); $p ++) {
|
for($p = 0; $p < count($this->planes); $p ++) {
|
||||||
if($this->handicap && in_array('111',$this->planes[$p]))
|
if($this->handicap && in_array('111',$this->planes[$p]))
|
||||||
continue;
|
continue;
|
||||||
|
@ -418,7 +418,7 @@ function winning_move() {
|
||||||
shuffle($myplanes);
|
shuffle($myplanes);
|
||||||
|
|
||||||
// find all winners which share an endpoint, and which are uncontested
|
// find all winners which share an endpoint, and which are uncontested
|
||||||
$candidates = array();
|
$candidates = [];
|
||||||
if(count($trythese) && count($myplanes)) {
|
if(count($trythese) && count($myplanes)) {
|
||||||
foreach($trythese as $t) {
|
foreach($trythese as $t) {
|
||||||
foreach($this->winner as $w) {
|
foreach($this->winner as $w) {
|
||||||
|
@ -452,7 +452,7 @@ function winning_move() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// find opponents planes
|
// find opponents planes
|
||||||
$yourplanes = array();
|
$yourplanes = [];
|
||||||
for($p = 0; $p < count($this->planes); $p ++) {
|
for($p = 0; $p < count($this->planes); $p ++) {
|
||||||
if($this->handicap && in_array('111',$this->planes[$p]))
|
if($this->handicap && in_array('111',$this->planes[$p]))
|
||||||
continue;
|
continue;
|
||||||
|
@ -540,7 +540,7 @@ function winning_move() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_corners($a) {
|
function get_corners($a) {
|
||||||
$total = array();
|
$total = [];
|
||||||
if(count($a))
|
if(count($a))
|
||||||
foreach($a as $b)
|
foreach($a as $b)
|
||||||
if(in_array($b,$this->corners))
|
if(in_array($b,$this->corners))
|
||||||
|
@ -575,7 +575,7 @@ function winning_move() {
|
||||||
|
|
||||||
function my_best_plane() {
|
function my_best_plane() {
|
||||||
|
|
||||||
$second_choice = array();
|
$second_choice = [];
|
||||||
shuffle($this->planes);
|
shuffle($this->planes);
|
||||||
for($p = 0; $p < count($this->planes); $p ++ ) {
|
for($p = 0; $p < count($this->planes); $p ++ ) {
|
||||||
$contested = 0;
|
$contested = 0;
|
||||||
|
@ -620,7 +620,7 @@ function winning_move() {
|
||||||
if($freeplane)
|
if($freeplane)
|
||||||
return($pl[$p]);
|
return($pl[$p]);
|
||||||
}
|
}
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function fullboard() {
|
function fullboard() {
|
||||||
|
|
|
@ -60,12 +60,12 @@ function tumblr_content(&$a) {
|
||||||
function tumblr_plugin_admin(&$a, &$o){
|
function tumblr_plugin_admin(&$a, &$o){
|
||||||
$t = get_markup_template( "admin.tpl", "addon/tumblr/" );
|
$t = get_markup_template( "admin.tpl", "addon/tumblr/" );
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
// name, label, value, help, [extra values]
|
// name, label, value, help, [extra values]
|
||||||
'$consumer_key' => array('consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''),
|
'$consumer_key' => ['consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''],
|
||||||
'$consumer_secret' => array('consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''),
|
'$consumer_secret' => ['consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tumblr_plugin_admin_post(&$a){
|
function tumblr_plugin_admin_post(&$a){
|
||||||
|
@ -240,12 +240,12 @@ function tumblr_settings(&$a,&$s) {
|
||||||
|
|
||||||
$userinfo = $tum_oauth->get('user/info');
|
$userinfo = $tum_oauth->get('user/info');
|
||||||
|
|
||||||
$blogs = array();
|
$blogs = [];
|
||||||
|
|
||||||
$s .= '<label id="tumblr-page-label" for="tumblr-page">' . t('Post to page:') . '</label>';
|
$s .= '<label id="tumblr-page-label" for="tumblr-page">' . t('Post to page:') . '</label>';
|
||||||
$s .= '<select name="tumblr_page" id="tumblr-page">';
|
$s .= '<select name="tumblr_page" id="tumblr-page">';
|
||||||
foreach($userinfo->response->user->blogs as $blog) {
|
foreach($userinfo->response->user->blogs as $blog) {
|
||||||
$blogurl = substr(str_replace(array("http://", "https://"), array("", ""), $blog->url), 0, -1);
|
$blogurl = substr(str_replace(["http://", "https://"], ["", ""], $blog->url), 0, -1);
|
||||||
if ($page == $blogurl)
|
if ($page == $blogurl)
|
||||||
$s .= "<option value='".$blogurl."' selected>".$blogurl."</option>";
|
$s .= "<option value='".$blogurl."' selected>".$blogurl."</option>";
|
||||||
else
|
else
|
||||||
|
@ -344,7 +344,7 @@ function tumblr_send(&$a,&$b) {
|
||||||
|
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
$tag_arr = array();
|
$tag_arr = [];
|
||||||
$tags = '';
|
$tags = '';
|
||||||
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
|
||||||
|
|
||||||
|
@ -361,11 +361,11 @@ function tumblr_send(&$a,&$b) {
|
||||||
|
|
||||||
$siteinfo = get_attached_data($b["body"]);
|
$siteinfo = get_attached_data($b["body"]);
|
||||||
|
|
||||||
$params = array(
|
$params = [
|
||||||
'state' => 'published',
|
'state' => 'published',
|
||||||
'tags' => $tags,
|
'tags' => $tags,
|
||||||
'tweet' => 'off',
|
'tweet' => 'off',
|
||||||
'format' => 'html');
|
'format' => 'html'];
|
||||||
|
|
||||||
if (!isset($siteinfo["type"]))
|
if (!isset($siteinfo["type"]))
|
||||||
$siteinfo["type"] = "";
|
$siteinfo["type"] = "";
|
||||||
|
|
|
@ -151,7 +151,7 @@ function twitter_follow(App $a, &$contact)
|
||||||
$cb->setConsumerKey($ckey, $csecret);
|
$cb->setConsumerKey($ckey, $csecret);
|
||||||
$cb->setToken($otoken, $osecret);
|
$cb->setToken($otoken, $osecret);
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = [];
|
||||||
$parameters["screen_name"] = $nickname;
|
$parameters["screen_name"] = $nickname;
|
||||||
|
|
||||||
$user = $cb->friendships_create($parameters);
|
$user = $cb->friendships_create($parameters);
|
||||||
|
@ -331,24 +331,24 @@ function twitter_settings(App $a, &$s)
|
||||||
</div>';
|
</div>';
|
||||||
$s .= '<div class="clear"></div>';
|
$s .= '<div class="clear"></div>';
|
||||||
|
|
||||||
$s .= replace_macros($field_checkbox, array(
|
$s .= replace_macros($field_checkbox, [
|
||||||
'$field' => array('twitter-enable', t('Allow posting to Twitter'), $enabled, t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.'))
|
'$field' => ['twitter-enable', t('Allow posting to Twitter'), $enabled, t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
|
||||||
));
|
]);
|
||||||
if ($a->user['hidewall']) {
|
if ($a->user['hidewall']) {
|
||||||
$s .= '<p>' . t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
|
$s .= '<p>' . t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
|
||||||
}
|
}
|
||||||
$s .= replace_macros($field_checkbox, array(
|
$s .= replace_macros($field_checkbox, [
|
||||||
'$field' => array('twitter-default', t('Send public postings to Twitter by default'), $defenabled, '')
|
'$field' => ['twitter-default', t('Send public postings to Twitter by default'), $defenabled, '']
|
||||||
));
|
]);
|
||||||
$s .= replace_macros($field_checkbox, array(
|
$s .= replace_macros($field_checkbox, [
|
||||||
'$field' => array('twitter-mirror', t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '')
|
'$field' => ['twitter-mirror', t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '']
|
||||||
));
|
]);
|
||||||
$s .= replace_macros($field_checkbox, array(
|
$s .= replace_macros($field_checkbox, [
|
||||||
'$field' => array('twitter-import', t('Import the remote timeline'), $importenabled, '')
|
'$field' => ['twitter-import', t('Import the remote timeline'), $importenabled, '']
|
||||||
));
|
]);
|
||||||
$s .= replace_macros($field_checkbox, array(
|
$s .= replace_macros($field_checkbox, [
|
||||||
'$field' => array('twitter-create_user', t('Automatically create contacts'), $create_userenabled, '')
|
'$field' => ['twitter-create_user', t('Automatically create contacts'), $create_userenabled, '']
|
||||||
));
|
]);
|
||||||
|
|
||||||
$s .= '<div class="clear"></div>';
|
$s .= '<div class="clear"></div>';
|
||||||
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
|
||||||
|
@ -399,7 +399,7 @@ function twitter_action(App $a, $uid, $pid, $action)
|
||||||
$cb->setConsumerKey($ckey, $csecret);
|
$cb->setConsumerKey($ckey, $csecret);
|
||||||
$cb->setToken($otoken, $osecret);
|
$cb->setToken($otoken, $osecret);
|
||||||
|
|
||||||
$post = array('id' => $pid);
|
$post = ['id' => $pid];
|
||||||
|
|
||||||
logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
|
logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
$cb->setConsumerKey($ckey, $csecret);
|
$cb->setConsumerKey($ckey, $csecret);
|
||||||
$cb->setToken($otoken, $osecret);
|
$cb->setToken($otoken, $osecret);
|
||||||
|
|
||||||
$post = array('status' => $msg, 'media[]' => $tempfile);
|
$post = ['status' => $msg, 'media[]' => $tempfile];
|
||||||
|
|
||||||
if ($iscomment) {
|
if ($iscomment) {
|
||||||
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
|
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
|
||||||
|
@ -604,7 +604,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
}
|
}
|
||||||
// -----------------
|
// -----------------
|
||||||
$url = 'statuses/update';
|
$url = 'statuses/update';
|
||||||
$post = array('status' => $msg, 'weighted_character_count' => 'true');
|
$post = ['status' => $msg, 'weighted_character_count' => 'true'];
|
||||||
|
|
||||||
if ($iscomment) {
|
if ($iscomment) {
|
||||||
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
|
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
|
||||||
|
@ -625,7 +625,7 @@ function twitter_post_hook(App $a, &$b)
|
||||||
$a->contact = $r[0]["id"];
|
$a->contact = $r[0]["id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $post));
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
|
||||||
require_once 'include/queue_fn.php';
|
require_once 'include/queue_fn.php';
|
||||||
add_to_queue($a->contact, NETWORK_TWITTER, $s);
|
add_to_queue($a->contact, NETWORK_TWITTER, $s);
|
||||||
notice(t('Twitter post failed. Queued for retry.') . EOL);
|
notice(t('Twitter post failed. Queued for retry.') . EOL);
|
||||||
|
@ -653,12 +653,12 @@ function twitter_plugin_admin(App $a, &$o)
|
||||||
{
|
{
|
||||||
$t = get_markup_template("admin.tpl", "addon/twitter/");
|
$t = get_markup_template("admin.tpl", "addon/twitter/");
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
// name, label, value, help, [extra values]
|
// name, label, value, help, [extra values]
|
||||||
'$consumerkey' => array('consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey'), ''),
|
'$consumerkey' => ['consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey'), ''],
|
||||||
'$consumersecret' => array('consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''),
|
'$consumersecret' => ['consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''],
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function twitter_cron(App $a, $b)
|
function twitter_cron(App $a, $b)
|
||||||
|
@ -737,9 +737,9 @@ function twitter_expire(App $a, $b)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_exists('dba', 'delete')) {
|
if (method_exists('dba', 'delete')) {
|
||||||
$r = dba::select('item', array('id'), array('deleted' => true, 'network' => NETWORK_TWITTER));
|
$r = dba::select('item', ['id'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
|
||||||
while ($row = dba::fetch($r)) {
|
while ($row = dba::fetch($r)) {
|
||||||
dba::delete('item', array('id' => $row['id']));
|
dba::delete('item', ['id' => $row['id']]);
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
} else {
|
} else {
|
||||||
|
@ -825,13 +825,13 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
|
||||||
|
|
||||||
if (is_object($post->retweeted_status)) {
|
if (is_object($post->retweeted_status)) {
|
||||||
// We don't support nested shares, so we mustn't show quotes as shares on retweets
|
// We don't support nested shares, so we mustn't show quotes as shares on retweets
|
||||||
$item = twitter_createpost($a, $uid, $post->retweeted_status, array('id' => 0), false, false, true);
|
$item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true);
|
||||||
|
|
||||||
$datarray['body'] = "\n" . share_header($item['author-name'], $item['author-link'], $item['author-avatar'], "", $item['created'], $item['plink']);
|
$datarray['body'] = "\n" . share_header($item['author-name'], $item['author-link'], $item['author-avatar'], "", $item['created'], $item['plink']);
|
||||||
|
|
||||||
$datarray['body'] .= $item['body'] . '[/share]';
|
$datarray['body'] .= $item['body'] . '[/share]';
|
||||||
} else {
|
} else {
|
||||||
$item = twitter_createpost($a, $uid, $post, array('id' => 0), false, false, false);
|
$item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false);
|
||||||
|
|
||||||
$datarray['body'] = $item['body'];
|
$datarray['body'] = $item['body'];
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ function twitter_fetchtimeline(App $a, $uid)
|
||||||
require_once 'library/twitteroauth.php';
|
require_once 'library/twitteroauth.php';
|
||||||
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
|
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
|
||||||
|
|
||||||
$parameters = array("exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
|
$parameters = ["exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
|
||||||
|
|
||||||
$first_time = ($lastid == "");
|
$first_time = ($lastid == "");
|
||||||
|
|
||||||
|
@ -1004,11 +1004,11 @@ function twitter_fetch_contact($uid, $contact, $create_user)
|
||||||
|
|
||||||
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
|
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
|
||||||
|
|
||||||
GContact::update(array("url" => "https://twitter.com/" . $contact->screen_name,
|
GContact::update(["url" => "https://twitter.com/" . $contact->screen_name,
|
||||||
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
|
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
|
||||||
"name" => $contact->name, "nick" => $contact->screen_name,
|
"name" => $contact->name, "nick" => $contact->screen_name,
|
||||||
"location" => $contact->location, "about" => $contact->description,
|
"location" => $contact->location, "about" => $contact->description,
|
||||||
"addr" => $contact->screen_name . "@twitter.com", "generation" => 2));
|
"addr" => $contact->screen_name . "@twitter.com", "generation" => 2]);
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||||
intval($uid), dbesc("twitter::" . $contact->id_str));
|
intval($uid), dbesc("twitter::" . $contact->id_str));
|
||||||
|
@ -1149,7 +1149,7 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = [];
|
||||||
|
|
||||||
if ($screen_name != "") {
|
if ($screen_name != "") {
|
||||||
$parameters["screen_name"] = $screen_name;
|
$parameters["screen_name"] = $screen_name;
|
||||||
|
@ -1261,10 +1261,10 @@ function twitter_expand_entities(App $a, $body, $item, $no_tags = false, $pictur
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($no_tags) {
|
if ($no_tags) {
|
||||||
return array("body" => $body, "tags" => "", "plain" => $plain);
|
return ["body" => $body, "tags" => "", "plain" => $plain];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags_arr = array();
|
$tags_arr = [];
|
||||||
|
|
||||||
foreach ($item->entities->hashtags AS $hashtag) {
|
foreach ($item->entities->hashtags AS $hashtag) {
|
||||||
$url = "#[url=" . $a->get_baseurl() . "/search?tag=" . rawurlencode($hashtag->text) . "]" . $hashtag->text . "[/url]";
|
$url = "#[url=" . $a->get_baseurl() . "/search?tag=" . rawurlencode($hashtag->text) . "]" . $hashtag->text . "[/url]";
|
||||||
|
@ -1319,7 +1319,7 @@ function twitter_expand_entities(App $a, $body, $item, $no_tags = false, $pictur
|
||||||
|
|
||||||
$tags = implode($tags_arr, ",");
|
$tags = implode($tags_arr, ",");
|
||||||
}
|
}
|
||||||
return array("body" => $body, "tags" => $tags, "plain" => $plain);
|
return ["body" => $body, "tags" => $tags, "plain" => $plain];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1351,7 +1351,7 @@ function twitter_media_entities($post, &$postarray)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a pure media post, first search for all media urls
|
// This is a pure media post, first search for all media urls
|
||||||
$media = array();
|
$media = [];
|
||||||
foreach ($post->extended_entities->media AS $medium) {
|
foreach ($post->extended_entities->media AS $medium) {
|
||||||
switch ($medium->type) {
|
switch ($medium->type) {
|
||||||
case 'photo':
|
case 'photo':
|
||||||
|
@ -1388,7 +1388,7 @@ function twitter_media_entities($post, &$postarray)
|
||||||
|
|
||||||
function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact, $noquote)
|
function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact, $noquote)
|
||||||
{
|
{
|
||||||
$postarray = array();
|
$postarray = [];
|
||||||
$postarray['network'] = NETWORK_TWITTER;
|
$postarray['network'] = NETWORK_TWITTER;
|
||||||
$postarray['gravity'] = 0;
|
$postarray['gravity'] = 0;
|
||||||
$postarray['uid'] = $uid;
|
$postarray['uid'] = $uid;
|
||||||
|
@ -1404,7 +1404,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
||||||
|
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
|
logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$contactid = 0;
|
$contactid = 0;
|
||||||
|
@ -1453,7 +1453,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
||||||
$postarray['owner-avatar'] = $r[0]["photo"];
|
$postarray['owner-avatar'] = $r[0]["photo"];
|
||||||
} else {
|
} else {
|
||||||
logger("No self contact for user " . $uid, LOGGER_DEBUG);
|
logger("No self contact for user " . $uid, LOGGER_DEBUG);
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't create accounts of people who just comment something
|
// Don't create accounts of people who just comment something
|
||||||
|
@ -1475,7 +1475,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
|
||||||
$contactid = $self['id'];
|
$contactid = $self['id'];
|
||||||
} elseif ($contactid <= 0) {
|
} elseif ($contactid <= 0) {
|
||||||
logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
|
logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$postarray['contact-id'] = $contactid;
|
$postarray['contact-id'] = $contactid;
|
||||||
|
@ -1599,7 +1599,7 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
|
||||||
|
|
||||||
$conv_parent = $conv['parent'];
|
$conv_parent = $conv['parent'];
|
||||||
|
|
||||||
notification(array(
|
notification([
|
||||||
'type' => NOTIFY_COMMENT,
|
'type' => NOTIFY_COMMENT,
|
||||||
'notify_flags' => $user[0]['notify-flags'],
|
'notify_flags' => $user[0]['notify-flags'],
|
||||||
'language' => $user[0]['language'],
|
'language' => $user[0]['language'],
|
||||||
|
@ -1614,7 +1614,7 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
|
||||||
'verb' => ACTIVITY_POST,
|
'verb' => ACTIVITY_POST,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $conv_parent,
|
'parent' => $conv_parent,
|
||||||
));
|
]);
|
||||||
|
|
||||||
// only send one notification
|
// only send one notification
|
||||||
break;
|
break;
|
||||||
|
@ -1626,10 +1626,10 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_
|
||||||
{
|
{
|
||||||
logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
|
logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
|
||||||
|
|
||||||
$posts = array();
|
$posts = [];
|
||||||
|
|
||||||
while ($post->in_reply_to_status_id_str != "") {
|
while ($post->in_reply_to_status_id_str != "") {
|
||||||
$parameters = array("trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str);
|
$parameters = ["trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str];
|
||||||
|
|
||||||
$post = $connection->get('statuses/show', $parameters);
|
$post = $connection->get('statuses/show', $parameters);
|
||||||
|
|
||||||
|
@ -1725,7 +1725,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
|
$parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
|
||||||
//$parameters["count"] = 200;
|
//$parameters["count"] = 200;
|
||||||
// Fetching timeline
|
// Fetching timeline
|
||||||
$lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
|
$lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
|
||||||
|
@ -1857,7 +1857,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
|
|
||||||
if (($item != 0) && !function_exists("check_item_notification")) {
|
if (($item != 0) && !function_exists("check_item_notification")) {
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
notification(array(
|
notification([
|
||||||
'type' => NOTIFY_TAGSELF,
|
'type' => NOTIFY_TAGSELF,
|
||||||
'notify_flags' => $u[0]['notify-flags'],
|
'notify_flags' => $u[0]['notify-flags'],
|
||||||
'language' => $u[0]['language'],
|
'language' => $u[0]['language'],
|
||||||
|
@ -1872,7 +1872,7 @@ function twitter_fetchhometimeline(App $a, $uid)
|
||||||
'verb' => ACTIVITY_TAG,
|
'verb' => ACTIVITY_TAG,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $parent_id
|
'parent' => $parent_id
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ function viewsrc_item_photo_menu(&$a,&$b) {
|
||||||
} else
|
} else
|
||||||
$item_id = $b['item']['id'];
|
$item_id = $b['item']['id'];
|
||||||
|
|
||||||
$b['menu'] = array_merge( array( t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id), $b['menu']);
|
$b['menu'] = array_merge( [ t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id], $b['menu']);
|
||||||
|
|
||||||
//if((! local_user()) || (local_user() != $b['item']['uid']))
|
//if((! local_user()) || (local_user() != $b['item']['uid']))
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -24,10 +24,10 @@ function webrtc_app_menu($a,&$b) {
|
||||||
|
|
||||||
function webrtc_plugin_admin (&$a, &$o) {
|
function webrtc_plugin_admin (&$a, &$o) {
|
||||||
$t = get_markup_template( "admin.tpl", "addon/webrtc/" );
|
$t = get_markup_template( "admin.tpl", "addon/webrtc/" );
|
||||||
$o = replace_macros( $t, array(
|
$o = replace_macros( $t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$webrtcurl' => array('webrtcurl', t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')),
|
'$webrtcurl' => ['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) {
|
function webrtc_plugin_admin_post (&$a) {
|
||||||
$url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : '');
|
$url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : '');
|
||||||
|
|
|
@ -8,11 +8,11 @@ function friendheader_widget_help() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function friendheader_widget_args(){
|
function friendheader_widget_args(){
|
||||||
return Array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function friendheader_widget_size(){
|
function friendheader_widget_size(){
|
||||||
return Array('780px','140px');
|
return ['780px','140px'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ function friends_widget_help() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function friends_widget_args(){
|
function friends_widget_args(){
|
||||||
return Array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function friends_widget_size(){
|
function friends_widget_size(){
|
||||||
return Array('100%','200px');
|
return ['100%','200px'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ function like_widget_help() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function like_widget_args(){
|
function like_widget_args(){
|
||||||
return Array("KEY");
|
return ["KEY"];
|
||||||
}
|
}
|
||||||
|
|
||||||
function like_widget_size(){
|
function like_widget_size(){
|
||||||
return Array('60px','20px');
|
return ['60px','20px'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ function like_widget_content(&$a, $conf){
|
||||||
|
|
||||||
# $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
|
# $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
|
||||||
$t = get_markup_template("widget_like.tpl", "addon/widgets/");
|
$t = get_markup_template("widget_like.tpl", "addon/widgets/");
|
||||||
$o .= replace_macros($t, array(
|
$o .= replace_macros($t, [
|
||||||
'$like' => $likes,
|
'$like' => $likes,
|
||||||
'$strlike' => sprintf( tt("%d person likes this", "%d people like this", $likes), $likes),
|
'$strlike' => sprintf( tt("%d person likes this", "%d people like this", $likes), $likes),
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ function like_widget_content(&$a, $conf){
|
||||||
'$strdislike'=> sprintf( tt("%d person doesn't like this", "%d people don't like this", $dislikes), $dislikes),
|
'$strdislike'=> sprintf( tt("%d person doesn't like this", "%d people don't like this", $dislikes), $dislikes),
|
||||||
|
|
||||||
'$baseurl' => $a->get_baseurl(),
|
'$baseurl' => $a->get_baseurl(),
|
||||||
));
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ function widgets_settings(&$a,&$o) {
|
||||||
$key = PConfig::get(local_user(), 'widgets', 'key' );
|
$key = PConfig::get(local_user(), 'widgets', 'key' );
|
||||||
if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
|
if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
|
||||||
|
|
||||||
$widgets = array();
|
$widgets = [];
|
||||||
$d = dir(dirname(__file__));
|
$d = dir(dirname(__file__));
|
||||||
while(false !== ($f = $d->read())) {
|
while(false !== ($f = $d->read())) {
|
||||||
if(substr($f,0,7)=="widget_") {
|
if(substr($f,0,7)=="widget_") {
|
||||||
|
@ -44,7 +44,7 @@ function widgets_settings(&$a,&$o) {
|
||||||
$w=$m[1];
|
$w=$m[1];
|
||||||
if ($w!=""){
|
if ($w!=""){
|
||||||
require_once($f);
|
require_once($f);
|
||||||
$widgets[] = array($w, call_user_func($w."_widget_name"));
|
$widgets[] = [$w, call_user_func($w."_widget_name")];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ function widgets_settings(&$a,&$o) {
|
||||||
|
|
||||||
# $t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
# $t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
||||||
$t = get_markup_template("settings.tpl", "addon/widgets/");
|
$t = get_markup_template("settings.tpl", "addon/widgets/");
|
||||||
$o .= replace_macros($t, array(
|
$o .= replace_macros($t, [
|
||||||
'$submit' => t('Generate new key'),
|
'$submit' => t('Generate new key'),
|
||||||
'$baseurl' => $a->get_baseurl(),
|
'$baseurl' => $a->get_baseurl(),
|
||||||
'$title' => "Widgets",
|
'$title' => "Widgets",
|
||||||
|
@ -62,7 +62,7 @@ function widgets_settings(&$a,&$o) {
|
||||||
'$key' => $key,
|
'$key' => $key,
|
||||||
'$widgets_h' => t('Widgets available'),
|
'$widgets_h' => t('Widgets available'),
|
||||||
'$widgets' => $widgets,
|
'$widgets' => $widgets,
|
||||||
));
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ function widgets_content(&$a) {
|
||||||
if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
|
if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$conf = array();
|
$conf = [];
|
||||||
$conf['uid'] = $r[0]['uid'];
|
$conf['uid'] = $r[0]['uid'];
|
||||||
foreach($r as $e) { $conf[$e['k']]=$e['v']; }
|
foreach($r as $e) { $conf[$e['k']]=$e['v']; }
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ function widgets_content(&$a) {
|
||||||
$widget_size = call_user_func($a->argv[1].'_widget_size');
|
$widget_size = call_user_func($a->argv[1].'_widget_size');
|
||||||
|
|
||||||
$script = file_get_contents(dirname(__file__)."/widgets.js");
|
$script = file_get_contents(dirname(__file__)."/widgets.js");
|
||||||
$o .= replace_macros($script, array(
|
$o .= replace_macros($script, [
|
||||||
'$entrypoint' => $a->get_baseurl()."/widgets/".$a->argv[1]."/cb/",
|
'$entrypoint' => $a->get_baseurl()."/widgets/".$a->argv[1]."/cb/",
|
||||||
'$key' => $conf['key'],
|
'$key' => $conf['key'],
|
||||||
'$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),
|
'$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),
|
||||||
|
@ -146,7 +146,7 @@ function widgets_content(&$a) {
|
||||||
'$width' => $widget_size[0],
|
'$width' => $widget_size[0],
|
||||||
'$height' => $widget_size[1],
|
'$height' => $widget_size[1],
|
||||||
'$type' => $a->argv[1],
|
'$type' => $a->argv[1],
|
||||||
));
|
]);
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['p'])) {
|
if (isset($_GET['p'])) {
|
||||||
|
|
|
@ -247,10 +247,10 @@ function send_tile_update($device_url, $image_url, $count, $title, $priority = 1
|
||||||
"</wp:Tile> " .
|
"</wp:Tile> " .
|
||||||
"</wp:Notification>";
|
"</wp:Notification>";
|
||||||
|
|
||||||
$result = send_push($device_url, array(
|
$result = send_push($device_url, [
|
||||||
'X-WindowsPhone-Target: token',
|
'X-WindowsPhone-Target: token',
|
||||||
'X-NotificationClass: ' . $priority,
|
'X-NotificationClass: ' . $priority,
|
||||||
), $msg);
|
], $msg);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,10 +269,10 @@ function send_toast($device_url, $title, $message, $priority = 2)
|
||||||
"</wp:Toast>" .
|
"</wp:Toast>" .
|
||||||
"</wp:Notification>";
|
"</wp:Notification>";
|
||||||
|
|
||||||
$result = send_push($device_url, array(
|
$result = send_push($device_url, [
|
||||||
'X-WindowsPhone-Target: toast',
|
'X-WindowsPhone-Target: toast',
|
||||||
'X-NotificationClass: ' . $priority,
|
'X-NotificationClass: ' . $priority,
|
||||||
), $msg);
|
], $msg);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,11 +284,11 @@ function send_push($device_url, $headers, $msg)
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + array(
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + [
|
||||||
'Content-Type: text/xml',
|
'Content-Type: text/xml',
|
||||||
'charset=utf-8',
|
'charset=utf-8',
|
||||||
'Accept: application/*',
|
'Accept: application/*',
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
|
||||||
|
|
||||||
|
@ -336,13 +336,13 @@ function windowsphonepush_content(App $a)
|
||||||
case "update_settings":
|
case "update_settings":
|
||||||
$ret = windowsphonepush_updatesettings($a);
|
$ret = windowsphonepush_updatesettings($a);
|
||||||
header("Content-Type: application/json; charset=utf-8");
|
header("Content-Type: application/json; charset=utf-8");
|
||||||
echo json_encode(array('status' => $ret));
|
echo json_encode(['status' => $ret]);
|
||||||
killme();
|
killme();
|
||||||
break;
|
break;
|
||||||
case "update_counterunseen":
|
case "update_counterunseen":
|
||||||
$ret = windowsphonepush_updatecounterunseen();
|
$ret = windowsphonepush_updatecounterunseen();
|
||||||
header("Content-Type: application/json; charset=utf-8");
|
header("Content-Type: application/json; charset=utf-8");
|
||||||
echo json_encode(array('status' => $ret));
|
echo json_encode(['status' => $ret]);
|
||||||
killme();
|
killme();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -374,13 +374,13 @@ function windowsphonepush_showsettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
echo json_encode(array('uid' => local_user(),
|
echo json_encode(['uid' => local_user(),
|
||||||
'enable' => $enable,
|
'enable' => $enable,
|
||||||
'device_url' => $device_url,
|
'device_url' => $device_url,
|
||||||
'senditemtext' => $senditemtext,
|
'senditemtext' => $senditemtext,
|
||||||
'lastpushid' => $lastpushid,
|
'lastpushid' => $lastpushid,
|
||||||
'counterunseen' => $counterunseen,
|
'counterunseen' => $counterunseen,
|
||||||
'addonversion' => $addonversion));
|
'addonversion' => $addonversion]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update_settings is used to transfer the device_url from WP device to the Friendica server
|
/* update_settings is used to transfer the device_url from WP device to the Friendica server
|
||||||
|
|
|
@ -233,7 +233,7 @@ function wppost_send(&$a,&$b) {
|
||||||
|
|
||||||
// Is it a link to an aricle, a video or a photo?
|
// Is it a link to an aricle, a video or a photo?
|
||||||
if (isset($siteinfo["type"])) {
|
if (isset($siteinfo["type"])) {
|
||||||
if (in_array($siteinfo["type"], array("link", "audio", "video", "photo"))) {
|
if (in_array($siteinfo["type"], ["link", "audio", "video", "photo"])) {
|
||||||
$postentry = true;
|
$postentry = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,11 +103,11 @@ function xmpp_plugin_admin(App $a, &$o)
|
||||||
{
|
{
|
||||||
$t = get_markup_template("admin.tpl", "addon/xmpp/");
|
$t = get_markup_template("admin.tpl", "addon/xmpp/");
|
||||||
|
|
||||||
$o = replace_macros($t, array(
|
$o = replace_macros($t, [
|
||||||
'$submit' => t('Save Settings'),
|
'$submit' => t('Save Settings'),
|
||||||
'$bosh_proxy' => array('bosh_proxy', t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''),
|
'$bosh_proxy' => ['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.')),
|
'$central_userbase' => ['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()
|
function xmpp_plugin_admin_post()
|
||||||
|
@ -142,7 +142,7 @@ function xmpp_converse(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($a->query_string, array("admin/federation/"))) {
|
if (in_array($a->query_string, ["admin/federation/"])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function xmpp_converse(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($a->argv[0], array("manage", "logout"))) {
|
if (in_array($a->argv[0], ["manage", "logout"])) {
|
||||||
$additional_commands = "converse.user.logout();\n";
|
$additional_commands = "converse.user.logout();\n";
|
||||||
} else {
|
} else {
|
||||||
$additional_commands = "";
|
$additional_commands = "";
|
||||||
|
|
Loading…
Reference in a new issue