forked from friendica/friendica-addons
Compare commits
92 commits
Author | SHA1 | Date | |
---|---|---|---|
db10da2f02 | |||
995e81e951 | |||
cb2ab0684e | |||
|
5f557ed0ab | ||
a63fb08525 | |||
6cf388f141 | |||
|
c4bea164c7 | ||
04c402607b | |||
|
68ee5260b0 | ||
81a84fb895 | |||
|
729b6e5210 | ||
|
a71db771d9 | ||
|
2f89827dea | ||
|
8e778593ca | ||
|
5b623c8368 | ||
|
bda683c56b | ||
|
7fa2dfc608 | ||
|
c0971779c6 | ||
|
6b1b043dd8 | ||
|
984e7c5e5d | ||
|
d08a280ba6 | ||
|
ee1a917612 | ||
|
a53d5ae29b | ||
|
3cf53a334d | ||
|
81f232d57e | ||
|
1860e732ae | ||
|
cf8a7870f3 | ||
|
31198294c7 | ||
|
84659fc1ad | ||
|
5f7482d081 | ||
|
fff140ad43 | ||
|
cfb6b3123f | ||
|
b99ac65c0b | ||
|
89a673cc11 | ||
|
2fe37c6d4a | ||
|
5b13274bed | ||
|
82ed43f507 | ||
|
43c71412e4 | ||
fb9c10f8c5 | |||
|
1e68417278 | ||
|
7d02c9b53c | ||
|
b5c647bd5d | ||
|
1bd7cd6e71 | ||
|
def43f3167 | ||
|
b661448344 | ||
|
922bace555 | ||
|
4a2fc7884c | ||
|
9d172b7082 | ||
|
4527df602f | ||
|
15c21cebb1 | ||
|
b6a47699bf | ||
|
a41f8c13fe | ||
|
fccf361ef1 | ||
|
43ee267d38 | ||
|
3f89aa1806 | ||
|
50912fdc17 | ||
|
c04016b7d3 | ||
|
5f6f374f09 | ||
|
e86d15993b | ||
|
ace19814d7 | ||
|
fcec1a3d83 | ||
|
04afbe36e3 | ||
|
07993f7098 | ||
|
bee780552d | ||
|
5664bc84fb | ||
|
7246f3deda | ||
|
0204f54b0e | ||
72e7e2a5b7 | |||
|
5f2a9e9891 | ||
|
a6de4225c6 | ||
|
23227e5b0f | ||
|
7872400467 | ||
|
a5aaea5211 | ||
|
7453c6f41a | ||
|
9cb728d19a | ||
|
e488f597be | ||
|
1346a92505 | ||
|
9117626c6a | ||
|
90ffd40d58 | ||
93a91a95e9 | |||
|
fc0dda0cd9 | ||
|
d7d6a43655 | ||
|
c58ca7dcc9 | ||
|
6df91dd37b | ||
|
e9d3afb483 | ||
|
348c44c972 | ||
58180bd732 | |||
|
bf679262b0 | ||
c4e24833eb | |||
|
ecf0edb520 | ||
3a5acf95f7 | |||
|
2ea40dc897 |
106 changed files with 379 additions and 461 deletions
|
@ -1,6 +1,6 @@
|
|||
skip_clone: true
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
clone_friendica_base:
|
||||
image: alpine/git
|
||||
commands:
|
||||
|
|
|
@ -5,7 +5,7 @@ labels:
|
|||
|
||||
skip_clone: true
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
clone_friendica_base:
|
||||
image: alpine/git
|
||||
commands:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
skip_clone: true
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
clone_friendica_base:
|
||||
image: alpine/git
|
||||
commands:
|
||||
|
|
|
@ -17,7 +17,7 @@ labels:
|
|||
|
||||
skip_clone: true
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
clone_friendica_base:
|
||||
image: alpine/git
|
||||
commands:
|
||||
|
|
|
@ -5,7 +5,7 @@ labels:
|
|||
|
||||
skip_clone: true
|
||||
|
||||
pipeline:
|
||||
steps:
|
||||
clone_friendica_base:
|
||||
image: alpine/git
|
||||
commands:
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Hook;
|
||||
|
@ -42,7 +41,6 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
|
@ -192,9 +190,30 @@ function advancedcontentfilter_init()
|
|||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') {
|
||||
$slim = \Slim\Factory\AppFactory::create();
|
||||
|
||||
require __DIR__ . '/src/middlewares.php';
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$slim->addRoutingMiddleware();
|
||||
|
||||
$slim->addErrorMiddleware(true, true, true, DI::logger());
|
||||
|
||||
// register routes
|
||||
$slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('', 'advancedcontentfilter_get_rules');
|
||||
$app->post('', 'advancedcontentfilter_post_rules');
|
||||
|
||||
$app->get('/{id}', 'advancedcontentfilter_get_rules_id');
|
||||
$app->put('/{id}', 'advancedcontentfilter_put_rules_id');
|
||||
$app->delete('/{id}', 'advancedcontentfilter_delete_rules_id');
|
||||
});
|
||||
|
||||
$app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('/{guid}', 'advancedcontentfilter_get_variables_guid');
|
||||
});
|
||||
});
|
||||
|
||||
require __DIR__ . '/src/routes.php';
|
||||
$slim->run();
|
||||
|
||||
exit;
|
||||
|
@ -252,7 +271,7 @@ function advancedcontentfilter_content()
|
|||
'rule_expression' => DI::l10n()->t('Rule Expression'),
|
||||
'cancel' => DI::l10n()->t('Cancel'),
|
||||
],
|
||||
'$current_theme' => DI::app()->getCurrentTheme(),
|
||||
'$current_theme' => DI::appHelper()->getCurrentTheme(),
|
||||
'$rules' => DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])),
|
||||
'$form_security_token' => BaseModule::getFormSecurityToken()
|
||||
]);
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\DI;
|
||||
|
||||
/** @var $slim \Slim\App */
|
||||
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$slim->addRoutingMiddleware();
|
||||
|
||||
$errorMiddleware = $slim->addErrorMiddleware(true, true, true, DI::logger());
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* @var $slim Slim\App */
|
||||
$slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('', 'advancedcontentfilter_get_rules');
|
||||
$app->post('', 'advancedcontentfilter_post_rules');
|
||||
|
||||
$app->get('/{id}', 'advancedcontentfilter_get_rules_id');
|
||||
$app->put('/{id}', 'advancedcontentfilter_put_rules_id');
|
||||
$app->delete('/{id}', 'advancedcontentfilter_delete_rules_id');
|
||||
});
|
||||
|
||||
$app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('/{guid}', 'advancedcontentfilter_get_variables_guid');
|
||||
});
|
||||
});
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Fabio <https://kirgroup.com/profile/fabrixxm>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -73,7 +73,7 @@ function bluesky_install()
|
|||
|
||||
function bluesky_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('bluesky'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('bluesky'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function bluesky_check_item_notification(array &$notification_data)
|
||||
|
@ -603,6 +603,8 @@ function bluesky_create_activity(array $item, stdClass $parent = null)
|
|||
return;
|
||||
}
|
||||
|
||||
$post = [];
|
||||
|
||||
if ($item['verb'] == Activity::LIKE) {
|
||||
$record = [
|
||||
'subject' => $parent,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <mike@macgirvin.com>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -16,7 +15,7 @@ function calc_install() {
|
|||
|
||||
function calc_app_menu(array &$b)
|
||||
{
|
||||
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
|
||||
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,7 +295,7 @@ $o .= <<< EOT
|
|||
<h3>Calculator</h3>
|
||||
<br /><br />
|
||||
<table>
|
||||
<tbody><tr><td>
|
||||
<tbody><tr><td>
|
||||
<table bgcolor="#af9999" border="1">
|
||||
<tbody><tr><td>
|
||||
<table border="1" cellpadding="2" cellspacing="2">
|
||||
|
@ -323,7 +322,7 @@ $o .= <<< EOT
|
|||
<td><input name="multiplication" value=" * " onclick="multiplyNumbers()" type="button"></td>
|
||||
</tr><tr align="left" valign="middle">
|
||||
<td><input name="zero" value=" 0 " onclick="addDisplay(0)" type="button"></td>
|
||||
<td><input name="pi" value=" Pi " onclick="addDisplay(Math.PI)" type="button"> </td>
|
||||
<td><input name="pi" value=" Pi " onclick="addDisplay(Math.PI)" type="button"> </td>
|
||||
<td><input name="dot" value=" . " onclick='addDisplay(".")' type="button"></td>
|
||||
<td><input name="division" value=" / " onclick="divideNumbers()" type="button"></td>
|
||||
</tr><tr align="left" valign="middle">
|
||||
|
@ -345,13 +344,13 @@ $o .= <<< EOT
|
|||
</form>
|
||||
|
||||
<!--
|
||||
<TD VALIGN=top>
|
||||
<TD VALIGN=top>
|
||||
<B>NOTE:</B> All sine and cosine calculations are
|
||||
<br>done in radians. Remember to convert first
|
||||
<br>if using degrees.
|
||||
</TD>
|
||||
-->
|
||||
|
||||
|
||||
</td></tr></tbody></table>
|
||||
|
||||
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
* Author: Fabio <https://kirgroup.com/profile/fabrixxm>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
|
10
cld/cld.php
10
cld/cld.php
|
@ -22,6 +22,16 @@ function cld_detect_languages(array &$data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!class_exists('CLD2Detector')) {
|
||||
Logger::warning('CLD2Detector class does not exist.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!class_exists('CLD2Encoding')) {
|
||||
Logger::warning('CLD2Encoding class does not exist.');
|
||||
return;
|
||||
}
|
||||
|
||||
$cld2 = new \CLD2Detector();
|
||||
|
||||
$cld2->setEncodingHint(CLD2Encoding::UTF8); // optional, hints about text encoding
|
||||
|
|
|
@ -169,7 +169,6 @@ class UnitConvertor
|
|||
* @param string name of the source unit from which to convert
|
||||
* @param string name of the target unit to which we are converting
|
||||
* @param integer double precision of the end result
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function convert($value, $from_unit, $to_unit, $precision)
|
||||
|
@ -280,4 +279,4 @@ class UnitConvertor
|
|||
} // end func getConvSpecs
|
||||
|
||||
} // end class UnitConvertor
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
|
||||
function convert_install() {
|
||||
|
@ -26,7 +25,7 @@ function convert_content() {
|
|||
// @TODO Let's one day rewrite this to a modern composer package
|
||||
include 'UnitConvertor.php';
|
||||
|
||||
class TP_Converter extends UnitConvertor
|
||||
$conv = new class('en') extends UnitConvertor
|
||||
{
|
||||
public function __construct(string $lang = 'en')
|
||||
{
|
||||
|
@ -43,7 +42,7 @@ function convert_content() {
|
|||
|
||||
private function findBaseUnit($from, $to)
|
||||
{
|
||||
while (list($skey, $sval) = each($this->bases)) {
|
||||
foreach ($this->bases as $skey => $sval) {
|
||||
if ($skey == $from || $to == $skey || in_array($to, $sval) || in_array($from, $sval)) {
|
||||
return $skey;
|
||||
}
|
||||
|
@ -63,7 +62,7 @@ function convert_content() {
|
|||
$cells[] = $cell;
|
||||
|
||||
// We now have the base unit and value now lets produce the table;
|
||||
while (list($key, $val) = each($this->bases[$base_unit])) {
|
||||
foreach ($this->bases[$base_unit] as $val) {
|
||||
$cell ['value'] = $this->convert($value, $from_unit, $val, $precision) . ' ' . $val;
|
||||
$cell ['class'] = ($val == $from_unit || $val == $to_unit) ? 'framedred' : '';
|
||||
$cells[] = $cell;
|
||||
|
@ -86,9 +85,7 @@ function convert_content() {
|
|||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
$conv = new TP_Converter('en');
|
||||
};
|
||||
|
||||
$conversions = [
|
||||
'Temperature' => ['base' => 'Celsius',
|
||||
|
@ -176,15 +173,15 @@ function convert_content() {
|
|||
]
|
||||
];
|
||||
|
||||
while (list($key, $val) = each($conversions)) {
|
||||
foreach ($conversions as $key => $val) {
|
||||
$conv->addConversion($val['base'], $val['conv']);
|
||||
$list[$key][] = $val['base'];
|
||||
while (list($ukey, $uval) = each($val['conv'])) {
|
||||
foreach ($val['conv'] as $ukey => $uval) {
|
||||
$list[$key][] = $ukey;
|
||||
}
|
||||
}
|
||||
|
||||
$o .= '<h3>Unit Conversions</h3>';
|
||||
$o = '<h3>Unit Conversions</h3>';
|
||||
|
||||
if (isset($_POST['from_unit']) && isset($_POST['value'])) {
|
||||
$o .= ($conv->getTable(intval($_POST['value']), $_POST['from_unit'], $_POST['to_unit'], 5)) . '</p>';
|
||||
|
@ -202,10 +199,9 @@ function convert_content() {
|
|||
$o .= '<input name="value" type="text" id="value" value="' . $value . '" size="10" maxlength="10" />';
|
||||
$o .= '<select name="from_unit" size="12">';
|
||||
|
||||
reset($list);
|
||||
while(list($key, $val) = each($list)) {
|
||||
foreach ($list as $key => $val) {
|
||||
$o .= "\n\t<optgroup label=\"$key\">";
|
||||
while(list($ukey, $uval) = each($val)) {
|
||||
foreach ($val as $ukey => $uval) {
|
||||
$selected = (($uval == $_POST['from_unit']) ? ' selected="selected" ' : '');
|
||||
$o .= "\n\t\t<option value=\"$uval\" $selected >$uval</option>";
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Author: Peter Liebetrau <https://socivitas/profile/peerteer>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -29,10 +29,10 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
$now = new DateTime();
|
||||
|
||||
if (!is_null($cached)) {
|
||||
$cdate = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'last');
|
||||
$cdate = (int) DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'last');
|
||||
$cached = unserialize($cached);
|
||||
|
||||
if ($cdate + $cachetime > $now->getTimestamp()) {
|
||||
if ($cdate + (int) $cachetime > $now->getTimestamp()) {
|
||||
return $cached;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ use Friendica\Core\System;
|
|||
|
||||
class Diasphp {
|
||||
private $cookiejar;
|
||||
private $token_regex;
|
||||
private $pod;
|
||||
|
||||
function __construct($pod) {
|
||||
$this->token_regex = '/content="(.*?)" name="csrf-token/';
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
require_once 'addon/diaspora/Diaspora_Connection.php';
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Status: Unsupported
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -40,7 +39,7 @@ function fancybox_render(array &$b){
|
|||
function ($text) use ($gallery) {
|
||||
// This processes images inlined in posts
|
||||
// Frio / Vier hooks für lightbox are un-hooked in fancybox-config.js. So this works for them, too!
|
||||
//if (!in_array(DI::app()->getCurrentTheme(),['vier','frio']))
|
||||
//if (!in_array(DI::appHelper()->getCurrentTheme(),['vier','frio']))
|
||||
$text = preg_replace(
|
||||
'#<a[^>]*href="([^"]*)"[^>]*>(<img[^>]*src="[^"]*"[^>]*>)</a>#',
|
||||
'<a data-fancybox="' . $gallery . '" href="$1">$2</a>',
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -76,6 +75,6 @@ function fromapp_post_hook(&$item)
|
|||
|
||||
$apps = explode(',', $app);
|
||||
$item['app'] = trim($apps[mt_rand(0, count($apps)-1)]);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -35,7 +34,7 @@ function geonames_install()
|
|||
|
||||
function geonames_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function geonames_post_hook(array &$item)
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
* Description: Thread email comment notifications on Gmail and anonymise them
|
||||
* Version: 1.0
|
||||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -38,7 +37,7 @@ function gnot_settings_post($post) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Called from the Addon Setting form.
|
||||
* Called from the Addon Setting form.
|
||||
* Add our own settings info to the page.
|
||||
*/
|
||||
function gnot_settings(array &$data)
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Core\Config\Util\ConfigFileManager;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
* Installs the addon hook
|
||||
|
@ -28,7 +25,7 @@ function gravatar_install() {
|
|||
|
||||
function gravatar_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
* Note: Please use Circle Text instead
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -18,7 +17,7 @@ function highlightjs_install()
|
|||
|
||||
function highlightjs_head(string &$str)
|
||||
{
|
||||
if (DI::app()->getCurrentTheme() == 'frio') {
|
||||
if (DI::appHelper()->getCurrentTheme() == 'frio') {
|
||||
$style = 'bootstrap';
|
||||
} else {
|
||||
$style = 'default';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Version: 0.1
|
||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Content\PageInfo;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* License: 3-clause BSD license
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -56,7 +55,7 @@ function impressum_footer(string &$body)
|
|||
|
||||
function impressum_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function impressum_show(string &$body)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -77,10 +77,10 @@ class qqFileUploader {
|
|||
public function __construct(array $allowedExtensions = [], $sizeLimit = 10485760)
|
||||
{
|
||||
$allowedExtensions = array_map('strtolower', $allowedExtensions);
|
||||
|
||||
|
||||
$this->allowedExtensions = $allowedExtensions;
|
||||
$this->sizeLimit = $sizeLimit;
|
||||
|
||||
|
||||
$this->checkServerSettings();
|
||||
|
||||
if (isset($_GET['qqfile'])) {
|
||||
|
@ -88,7 +88,7 @@ class qqFileUploader {
|
|||
} elseif (isset($_FILES['qqfile'])) {
|
||||
$this->file = new qqUploadedFileForm();
|
||||
} else {
|
||||
$this->file = false;
|
||||
$this->file = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class qqFileUploader {
|
|||
|
||||
private function toBytes(string $str): int
|
||||
{
|
||||
$val = trim($str);
|
||||
$val = (int) trim($str);
|
||||
$last = strtolower($str[strlen($str) - 1]);
|
||||
|
||||
switch($last) {
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
usleep(100000);
|
||||
|
||||
$fileName;
|
||||
$fileSize;
|
||||
$fileName = '';
|
||||
$fileSize = 0;;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
$fileSize = (int)$headers['Content-Length'];
|
||||
|
@ -34,13 +34,13 @@ if ($fileSize > 9 * 1024){
|
|||
die ('{error: "server-error file size is bigger than 9kB"}');
|
||||
}
|
||||
|
||||
if (count($_GET)){
|
||||
if (count($_GET)){
|
||||
array_merge($_GET, array('fileName'=>$fileName));
|
||||
|
||||
|
||||
$response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName));
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
||||
} else {
|
||||
die ('{error: "server-error query params not passed"}');
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
sleep(4);
|
||||
|
||||
$fileName;
|
||||
$fileName = '';
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
|
@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){
|
|||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
|
@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){
|
|||
|
||||
if (count($_GET)){
|
||||
$_GET['success'] = true;
|
||||
echo json_encode(array_merge($_GET));
|
||||
echo json_encode(array_merge($_GET));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
usleep(300);
|
||||
|
||||
$fileName;
|
||||
$fileName = '';
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
|
@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){
|
|||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
|
@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){
|
|||
|
||||
if (count($_GET)){
|
||||
//return query params
|
||||
echo json_encode(array_merge($_GET, array('fileName'=>$fileName)));
|
||||
echo json_encode(array_merge($_GET, array('fileName'=>$fileName)));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ function js_upload_post_init(array &$b)
|
|||
// max file size in bytes
|
||||
$sizeLimit = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
|
||||
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
$uploader = new js_upload_qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
|
||||
$result = $uploader->handleUpload();
|
||||
|
||||
|
@ -101,7 +101,7 @@ function js_upload_post_end(int &$b)
|
|||
/**
|
||||
* Handle file uploads via XMLHttpRequest
|
||||
*/
|
||||
class qqUploadedFileXhr
|
||||
class js_upload_qqUploadedFileXhr
|
||||
{
|
||||
private $pathnm = '';
|
||||
|
||||
|
@ -155,7 +155,7 @@ class qqUploadedFileXhr
|
|||
/**
|
||||
* Handle file uploads via regular form post (uses the $_FILES array)
|
||||
*/
|
||||
class qqUploadedFileForm
|
||||
class js_upload_qqUploadedFileForm
|
||||
{
|
||||
/**
|
||||
* Save the file to the specified path
|
||||
|
@ -183,7 +183,7 @@ class qqUploadedFileForm
|
|||
}
|
||||
}
|
||||
|
||||
class qqFileUploader
|
||||
class js_upload_qqFileUploader
|
||||
{
|
||||
private $allowedExtensions;
|
||||
private $sizeLimit;
|
||||
|
@ -197,9 +197,9 @@ class qqFileUploader
|
|||
$this->sizeLimit = $sizeLimit;
|
||||
|
||||
if (isset($_GET['qqfile'])) {
|
||||
$this->file = new qqUploadedFileXhr();
|
||||
$this->file = new js_upload_qqUploadedFileXhr();
|
||||
} elseif (isset($_FILES['qqfile'])) {
|
||||
$this->file = new qqUploadedFileForm();
|
||||
$this->file = new js_upload_qqUploadedFileForm();
|
||||
} else {
|
||||
$this->file = false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Ryan <https://verya.pe/profile/ryan>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -92,7 +91,7 @@ function keycloakpassword_authenticate(array &$b)
|
|||
$client_id,
|
||||
$secret,
|
||||
$endpoint . '/logout',
|
||||
[ 'refresh_token' => res['refresh_token'] ]
|
||||
[ 'refresh_token' => $res['refresh_token'] ]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* License: MIT
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -148,6 +147,8 @@ function langfilter_prepare_body_content_filter(&$hook_data)
|
|||
|
||||
$iso639 = new Matriphe\ISO639\ISO639;
|
||||
|
||||
$confidence = null;
|
||||
|
||||
// Extract the language of the post
|
||||
if (!empty($hook_data['item']['language'])) {
|
||||
$languages = json_decode($hook_data['item']['language'], true);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
* The configuration options for this module are described in the config/ldapauth.config.php file
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -45,7 +44,7 @@ function ldapauth_install()
|
|||
|
||||
function ldapauth_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function ldapauth_hook_authenticate(array &$b)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
|
@ -149,7 +148,7 @@ function leistungsschutzrecht_is_member_site(string $url): bool
|
|||
$cleanedurlpart = explode('%', $urldata['host']);
|
||||
|
||||
$hostname = explode('.', $cleanedurlpart[0]);
|
||||
if (empty($hostname)) {
|
||||
if ($hostname === false || $hostname === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Tony Baldwin <https://free-haven.org/u/tony>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -217,7 +217,7 @@ class Services_Libravatar
|
|||
*
|
||||
* @param array $options Array of options for getUrl()
|
||||
*
|
||||
* @return void
|
||||
* @return array
|
||||
* @throws Exception When an invalid option is used
|
||||
*/
|
||||
protected function checkOptionsArray($options)
|
||||
|
@ -401,9 +401,8 @@ class Services_Libravatar
|
|||
*/
|
||||
protected function srvGet($domain, $https = false)
|
||||
{
|
||||
|
||||
// Are we going secure? Set up a fallback too.
|
||||
if (isset($https) && $https === true) {
|
||||
if ($https === true) {
|
||||
$subdomain = '_avatars-sec._tcp.';
|
||||
$fallback = 'seccdn.';
|
||||
} else {
|
||||
|
@ -426,6 +425,7 @@ class Services_Libravatar
|
|||
|
||||
$top = $srv[0];
|
||||
$sum = 0;
|
||||
$pri = [];
|
||||
|
||||
// Try to adhere to RFC2782's weighting algorithm, page 3
|
||||
// "arrange all SRV RRs (that have not been ordered yet) in any order,
|
||||
|
@ -462,6 +462,8 @@ class Services_Libravatar
|
|||
return $v['target'];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -26,7 +25,7 @@ function libravatar_install()
|
|||
|
||||
function libravatar_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -203,10 +202,12 @@ EOT;
|
|||
|
||||
Logger::debug('ljpost: data: ' . $xml);
|
||||
|
||||
$x = '';
|
||||
|
||||
if ($lj_blog !== 'test') {
|
||||
$x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString();
|
||||
}
|
||||
|
||||
Logger::info('posted to livejournal: ' . ($x) ? $x : '');
|
||||
Logger::info('posted to livejournal: ' . $x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ function mailstream_send(string $message_id, array $item, array $user): bool
|
|||
if (!$address) {
|
||||
$address = $user['email'];
|
||||
}
|
||||
$mail = new PHPmailer();
|
||||
$mail = new PHPMailer();
|
||||
try {
|
||||
$mail->XMailer = 'Friendica Mailstream Addon';
|
||||
$mail->SetFrom($frommail, mailstream_sender($item));
|
||||
|
|
|
@ -2690,10 +2690,10 @@ class PHPMailer
|
|||
if (!is_readable($path)) {
|
||||
throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
|
||||
}
|
||||
$magic_quotes = get_magic_quotes_runtime();
|
||||
$magic_quotes = false;
|
||||
if ($magic_quotes) {
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
set_magic_quotes_runtime(false);
|
||||
//set_magic_quotes_runtime(false);
|
||||
} else {
|
||||
//Doesn't exist in PHP 5.4, but we don't need to check because
|
||||
//get_magic_quotes_runtime always returns false in 5.4+
|
||||
|
@ -2705,7 +2705,7 @@ class PHPMailer
|
|||
$file_buffer = $this->encodeString($file_buffer, $encoding);
|
||||
if ($magic_quotes) {
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
set_magic_quotes_runtime($magic_quotes);
|
||||
//set_magic_quotes_runtime($magic_quotes);
|
||||
} else {
|
||||
ini_set('magic_quotes_runtime', $magic_quotes);
|
||||
}
|
||||
|
@ -3286,7 +3286,7 @@ class PHPMailer
|
|||
$result = 'localhost.localdomain';
|
||||
if (!empty($this->Hostname)) {
|
||||
$result = $this->Hostname;
|
||||
} elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
|
||||
} elseif (!empty($_SERVER['SERVER_NAME'])) {
|
||||
$result = $_SERVER['SERVER_NAME'];
|
||||
} elseif (function_exists('gethostname') && gethostname() !== false) {
|
||||
$result = gethostname();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* Version: 0.1
|
||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* License: 3-clause BSD license
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
* Status: Unsupported
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function membersince_install()
|
||||
|
@ -19,7 +19,19 @@ function membersince_install()
|
|||
|
||||
function membersince_display(array &$b)
|
||||
{
|
||||
if (DI::app()->getCurrentTheme() == 'frio') {
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
|
||||
if ($uid === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($uid, ['register_date']);
|
||||
|
||||
if ($user === false || !array_key_exists('register_date', $user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::appHelper()->getCurrentTheme() == 'frio') {
|
||||
// Works in Frio.
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
@ -39,7 +51,7 @@ function membersince_display(array &$b)
|
|||
$label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted');
|
||||
|
||||
// The div for the register date of the profile owner.
|
||||
$entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date']));
|
||||
$entry = $doc->createElement('div', DateTimeFormat::local($user['register_date']));
|
||||
$entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry');
|
||||
|
||||
$div->appendChild($hr);
|
||||
|
@ -50,6 +62,6 @@ function membersince_display(array &$b)
|
|||
$b = $doc->saveHTML();
|
||||
} else {
|
||||
// Works in Vier.
|
||||
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local(DI::app()->profile['register_date']) . "</dd>\n</dl>", $b, 1);
|
||||
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($user['register_date']) . "</dd>\n</dl>", $b, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* Status: Deprecated
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
|
||||
***/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\Addon\notifyall\NotifyAllEmail;
|
||||
use Friendica\App;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
@ -119,7 +118,9 @@ function nsfw_prepare_body_content_filter(&$hook_data)
|
|||
$word_list = ['nsfw'];
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$found = false;
|
||||
$tag_search = false;
|
||||
|
||||
if (count($word_list)) {
|
||||
$body = $hook_data['item']['title'] . "\n" . nsfw_extract_photos($hook_data['item']['body']);
|
||||
|
||||
|
@ -129,7 +130,6 @@ function nsfw_prepare_body_content_filter(&$hook_data)
|
|||
continue;
|
||||
}
|
||||
|
||||
$tag_search = false;
|
||||
switch ($word[0]) {
|
||||
case '/'; // Regular expression
|
||||
$found = @preg_match($word, $body);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -39,7 +38,7 @@ function numfriends_settings_post($post) {
|
|||
|
||||
/**
|
||||
*
|
||||
* Called from the Addon Setting form.
|
||||
* Called from the Addon Setting form.
|
||||
* Add our own settings info to the page.
|
||||
*
|
||||
*/
|
||||
|
@ -50,7 +49,7 @@ function numfriends_settings(array &$data)
|
|||
}
|
||||
|
||||
$numfriends = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'display_friend_count', 24);
|
||||
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$numfriends' => ['numfriends', DI::l10n()->t('How many contacts to display on profile sidebar'), $numfriends],
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Cache\Enum\Duration;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -37,7 +36,7 @@ function openstreetmap_install()
|
|||
|
||||
function openstreetmap_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function openstreetmap_alterheader(&$navHtml)
|
||||
|
|
|
@ -8,12 +8,8 @@
|
|||
*/
|
||||
|
||||
use Friendica\DI;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
* Version: 1.1
|
||||
* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
|
||||
* Hauke Altmann <https://snarl.de/profile/tugelblend>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Maintainer: Hypolite Petovan <hypolite@friendica.mrpetovan.com>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Object\EMail\IEmail;
|
||||
|
@ -25,7 +24,7 @@ function phpmailer_install()
|
|||
|
||||
function phpmailer_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
* setting.
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -51,7 +50,7 @@ function piwik_install() {
|
|||
|
||||
function piwik_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function piwik_analytics(string &$b)
|
||||
|
@ -76,7 +75,7 @@ function piwik_analytics(string &$b)
|
|||
* Add the Piwik tracking code for the site.
|
||||
* If async is set to true use asynchronous tracking
|
||||
*/
|
||||
|
||||
|
||||
$scriptAsyncValue = $async ? 'true' : 'false';
|
||||
$scriptPhpEndpoint = $shortendpoint ? 'js/' : 'piwik.php';
|
||||
$scriptJsEndpoint = $shortendpoint ? 'js/' : 'piwik.js';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Author: Tony Baldwin <https://free-haven.org/profile/tony>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace phpnut;
|
||||
|
||||
use CURLFile;
|
||||
|
||||
/**
|
||||
* phpnut.php
|
||||
* pnut.io PHP library
|
||||
|
@ -99,10 +101,14 @@ class phpnut
|
|||
// if processing stream_markers or any fast stream, decrease $sleepFor
|
||||
public $streamingSleepFor = 20000;
|
||||
|
||||
private $_clientId;
|
||||
|
||||
private $_clientSecret;
|
||||
|
||||
/**
|
||||
* Constructs an phpnut PHP object with the specified client ID and
|
||||
* client secret.
|
||||
* @param string $client_id The client ID you received from pnut.io when
|
||||
* @param string $client_id_or_token The client ID you received from pnut.io when
|
||||
* creating your app.
|
||||
* @param string $client_secret The client secret you received from
|
||||
* pnut.io when creating your app.
|
||||
|
@ -155,14 +161,14 @@ class phpnut
|
|||
* or not access to your app. Usually you would place this as a link for
|
||||
* the user to client, or a redirect to send them to the auth URL.
|
||||
* Also can be called after authentication for additional scopes
|
||||
* @param string $callbackUri Where you want the user to be directed
|
||||
* @param string $callback_uri Where you want the user to be directed
|
||||
* after authenticating with pnut.io. This must be one of the URIs
|
||||
* allowed by your pnut.io application settings.
|
||||
* @param array $scope An array of scopes (permissions) you wish to obtain
|
||||
* from the user. If you don't specify anything, you'll only receive
|
||||
* access to the user's basic profile (the default).
|
||||
*/
|
||||
public function getAuthUrl(?string $callback_uri=null, array|string|null $scope=null): string
|
||||
public function getAuthUrl(?string $callback_uri=null, array $scope=null): string
|
||||
{
|
||||
if (empty($this->_clientId)) {
|
||||
throw new phpnutException('You must specify your pnut client ID');
|
||||
|
@ -256,8 +262,10 @@ class phpnut
|
|||
/**
|
||||
* Check the scope of current token to see if it has required scopes
|
||||
* has to be done after a check
|
||||
*
|
||||
* @return int|array
|
||||
*/
|
||||
public function checkScopes(array $app_scopes): int|array
|
||||
public function checkScopes(array $app_scopes)
|
||||
{
|
||||
if (count($this->_scopes) === 0) {
|
||||
return -1; // _scope is empty
|
||||
|
@ -303,7 +311,7 @@ class phpnut
|
|||
{
|
||||
return $this->httpReq('delete', "{$this->_baseUrl}token");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve an app access token from the app.net API. This allows you
|
||||
* to access the API without going through the user access flow if you
|
||||
|
@ -314,7 +322,7 @@ class phpnut
|
|||
* @return string The app access token
|
||||
*/
|
||||
public function getAppAccessToken()
|
||||
{
|
||||
{
|
||||
if (empty($this->_clientId) || empty($this->_clientSecret)) {
|
||||
throw new phpnutException('You must specify your Pnut client ID and client secret');
|
||||
}
|
||||
|
@ -450,8 +458,10 @@ class phpnut
|
|||
/**
|
||||
* Internal function to handle all
|
||||
* HTTP requests (POST,PUT,GET,DELETE)
|
||||
*
|
||||
* @param string|array $params
|
||||
*/
|
||||
protected function httpReq(string $act, string $req, string|array $params=[], string $contentType='application/x-www-form-urlencoded')
|
||||
protected function httpReq(string $act, string $req, $params = [], string $contentType='application/x-www-form-urlencoded')
|
||||
{
|
||||
$ch = curl_init($req);
|
||||
$headers = [];
|
||||
|
@ -520,7 +530,7 @@ class phpnut
|
|||
} else {
|
||||
throw new phpnutException($response['error']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// look for response migration errors
|
||||
elseif (isset($response['meta'], $response['meta']['error_message'])) {
|
||||
|
@ -588,7 +598,7 @@ class phpnut
|
|||
{
|
||||
return $this->_last_request;
|
||||
}
|
||||
|
||||
|
||||
public function getLastResponse()
|
||||
{
|
||||
return $this->_last_response;
|
||||
|
@ -738,7 +748,7 @@ class phpnut
|
|||
* Delete a Post. The current user must be the same user who created the Post.
|
||||
* It returns the deleted Post on success.
|
||||
* @param integer $post_id The ID of the post to delete
|
||||
* @param array An associative array representing the post that was deleted
|
||||
* @return array An associative array representing the post that was deleted
|
||||
*/
|
||||
public function deletePost(int $post_id)
|
||||
{
|
||||
|
@ -752,7 +762,7 @@ class phpnut
|
|||
* Retrieve the Posts that are 'in reply to' a specific Post.
|
||||
* @param integer $post_id The ID of the post you want to retrieve replies for.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getPostThread(int $post_id, array $params=[])
|
||||
{
|
||||
|
@ -767,7 +777,7 @@ class phpnut
|
|||
* Retrieve revisions of a post. Currently only one can be created.
|
||||
* @param integer $post_id The ID of the post you want to retrieve previous revisions of.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getPostRevisions(int $post_id, array $params=[])
|
||||
{
|
||||
|
@ -781,13 +791,13 @@ class phpnut
|
|||
/**
|
||||
* Get the most recent Posts created by a specific User in reverse
|
||||
* chronological order (most recent first).
|
||||
* @param mixed $user_id Either the ID of the user you wish to retrieve posts by,
|
||||
* @param string|int $user_id $user_id Either the ID of the user you wish to retrieve posts by,
|
||||
* or the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserPosts(string|int $user_id='me', array $params=[])
|
||||
public function getUserPosts($user_id = 'me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -799,13 +809,13 @@ class phpnut
|
|||
/**
|
||||
* Get the most recent Posts mentioning by a specific User in reverse
|
||||
* chronological order (newest first).
|
||||
* @param mixed $user_id Either the ID of the user who is being mentioned, or
|
||||
* @param string|int $user_id Either the ID of the user who is being mentioned, or
|
||||
* the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserMentions(string|int $user_id='me', array $params=[])
|
||||
public function getUserMentions($user_id='me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -817,7 +827,7 @@ class phpnut
|
|||
/**
|
||||
* Get the currently authenticated user's recent messages
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserMessages(array $params=[])
|
||||
{
|
||||
|
@ -832,7 +842,7 @@ class phpnut
|
|||
* Return the 20 most recent posts from the current User and
|
||||
* the Users they follow.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserStream(array $params=[])
|
||||
{
|
||||
|
@ -847,7 +857,7 @@ class phpnut
|
|||
* Retrieve a list of all public Posts on pnut.io, often referred to as the
|
||||
* global stream.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getPublicPosts(array $params=[])
|
||||
{
|
||||
|
@ -860,7 +870,7 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Retrieve a list of "explore" streams
|
||||
* @return An array of associative arrays, each representing a single explore stream.
|
||||
* @return array An array of associative arrays, each representing a single explore stream.
|
||||
*/
|
||||
public function getPostExploreStreams()
|
||||
{
|
||||
|
@ -874,7 +884,7 @@ class phpnut
|
|||
* Retrieve a list of posts from an "explore" stream on pnut.io.
|
||||
* @param string $slug [<description>]
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getPostExploreStream(string $slug, array $params=[])
|
||||
{
|
||||
|
@ -916,10 +926,11 @@ class phpnut
|
|||
* are: count, before_id, since_id, include_muted, include_deleted,
|
||||
* and include_post_raw.
|
||||
* See https://github.com/phpnut/api-spec/blob/master/resources/posts.md#general-parameters
|
||||
* @param string|int $user_id
|
||||
* @return array An array of associative arrays, each representing a single
|
||||
* user who has bookmarked a post
|
||||
*/
|
||||
public function getBookmarked(string|int $user_id='me', array $params=[])
|
||||
public function getBookmarked($user_id='me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -967,7 +978,7 @@ class phpnut
|
|||
/**
|
||||
* Repost an existing Post object.
|
||||
* @param integer $post_id The id of the post
|
||||
* @return the reposted post
|
||||
* @return mixed the reposted post
|
||||
*/
|
||||
public function repost(int $post_id)
|
||||
{
|
||||
|
@ -980,7 +991,7 @@ class phpnut
|
|||
/**
|
||||
* Delete a post that the user has reposted.
|
||||
* @param integer $post_id The id of the post
|
||||
* @return the un-reposted post
|
||||
* @return mixed the un-reposted post
|
||||
*/
|
||||
public function deleteRepost(int $post_id)
|
||||
{
|
||||
|
@ -997,7 +1008,7 @@ class phpnut
|
|||
* This will likely change as the API evolves, as of this writing allowed keys
|
||||
* are: count, before_id, since_id, include_muted, include_deleted,
|
||||
* include_directed_posts, and include_raw.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function searchHashtags(string $hashtag, array $params=[])
|
||||
{
|
||||
|
@ -1044,7 +1055,7 @@ class phpnut
|
|||
* This will likely change as the API evolves, as of this writing allowed keys
|
||||
* are: count, before_id, since_id, include_muted, include_deleted,
|
||||
* and include_post_raw.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserPersonalStream(array $params=[])
|
||||
{
|
||||
|
@ -1063,7 +1074,7 @@ class phpnut
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the 20 most recent Posts from the current User's personalized stream
|
||||
* and mentions stream merged into one stream.
|
||||
|
@ -1071,7 +1082,7 @@ class phpnut
|
|||
* This will likely change as the API evolves, as of this writing allowed keys
|
||||
* are: count, before_id, since_id, include_muted, include_deleted,
|
||||
* include_directed_posts, and include_raw.
|
||||
* @return An array of associative arrays, each representing a single post.
|
||||
* @return array An array of associative arrays, each representing a single post.
|
||||
*/
|
||||
public function getUserUnifiedStream(array $params=[])
|
||||
{
|
||||
|
@ -1096,14 +1107,14 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Returns a specific user object.
|
||||
* @param mixed $user_id The ID of the user you want to retrieve, or the string "@-username", or the string
|
||||
* @param string|int $user_id The ID of the user you want to retrieve, or the string "@-username", or the string
|
||||
* "me" to retrieve data for the users you're currently authenticated as.
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* This will likely change as the API evolves, as of this writing allowed keys
|
||||
* are: include_raw|include_user_raw.
|
||||
* @return array An associative array representing the user data.
|
||||
*/
|
||||
public function getUser(string|int $user_id='me', array $params=[])
|
||||
public function getUser($user_id='me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -1131,10 +1142,10 @@ class phpnut
|
|||
/**
|
||||
* Add the specified user ID to the list of users followed.
|
||||
* Returns the User object of the user being followed.
|
||||
* @param integer $user_id The user ID of the user to follow.
|
||||
* @param string|int $user_id The user ID of the user to follow.
|
||||
* @return array An associative array representing the user you just followed.
|
||||
*/
|
||||
public function followUser(string|int $user_id)
|
||||
public function followUser($user_id)
|
||||
{
|
||||
return $this->httpReq(
|
||||
'put',
|
||||
|
@ -1145,10 +1156,10 @@ class phpnut
|
|||
/**
|
||||
* Removes the specified user ID to the list of users followed.
|
||||
* Returns the User object of the user being unfollowed.
|
||||
* @param integer $user_id The user ID of the user to unfollow.
|
||||
* @param string|int $user_id The user ID of the user to unfollow.
|
||||
* @return array An associative array representing the user you just unfollowed.
|
||||
*/
|
||||
public function unfollowUser(string|int $user_id)
|
||||
public function unfollowUser($user_id)
|
||||
{
|
||||
return $this->httpReq(
|
||||
'delete',
|
||||
|
@ -1158,13 +1169,13 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Returns an array of User objects the specified user is following.
|
||||
* @param mixed $user_id Either the ID of the user being followed, or
|
||||
* @param string|int $user_id Either the ID of the user being followed, or
|
||||
* the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @return array An array of associative arrays, each representing a single
|
||||
* user following $user_id
|
||||
*/
|
||||
public function getFollowing(string|int $user_id='me', array $params=[])
|
||||
public function getFollowing($user_id='me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -1172,31 +1183,31 @@ class phpnut
|
|||
. $this->buildQueryString($params)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of User ids the specified user is following.
|
||||
* @param mixed $user_id Either the ID of the user being followed, or
|
||||
* @param string|int $user_id Either the ID of the user being followed, or
|
||||
* the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @return array user ids the specified user is following.
|
||||
*/
|
||||
public function getFollowingIDs(string|int $user_id='me')
|
||||
public function getFollowingIDs($user_id='me')
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
"{$this->_baseUrl}users/{$user_id}/following?include_user=0"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of User objects for users following the specified user.
|
||||
* @param mixed $user_id Either the ID of the user being followed, or
|
||||
* @param string|int $user_id Either the ID of the user being followed, or
|
||||
* the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @return array An array of associative arrays, each representing a single
|
||||
* user following $user_id
|
||||
*/
|
||||
public function getFollowers(string|int $user_id='me', array $params=[])
|
||||
public function getFollowers($user_id='me', array $params=[])
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -1204,15 +1215,15 @@ class phpnut
|
|||
. $this->buildQueryString($params)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of User ids for users following the specified user.
|
||||
* @param mixed $user_id Either the ID of the user being followed, or
|
||||
* @param string|int $user_id Either the ID of the user being followed, or
|
||||
* the string "me", which will retrieve posts for the user you're authenticated
|
||||
* as.
|
||||
* @return array user ids for users following the specified user
|
||||
*/
|
||||
public function getFollowersIDs(string|int $user_id='me')
|
||||
public function getFollowersIDs($user_id='me')
|
||||
{
|
||||
return $this->httpReq(
|
||||
'get',
|
||||
|
@ -1236,9 +1247,9 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Mute a user
|
||||
* @param integer $user_id The user ID to mute
|
||||
* @param string|int $user_id The user ID to mute
|
||||
*/
|
||||
public function muteUser(string|int $user_id)
|
||||
public function muteUser($user_id)
|
||||
{
|
||||
return $this->httpReq(
|
||||
'put',
|
||||
|
@ -1248,9 +1259,9 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Unmute a user
|
||||
* @param integer $user_id The user ID to unmute
|
||||
* @param string|int $user_id The user ID to unmute
|
||||
*/
|
||||
public function unmuteUser(string|int $user_id)
|
||||
public function unmuteUser($user_id)
|
||||
{
|
||||
return $this->httpReq(
|
||||
'delete',
|
||||
|
@ -1285,10 +1296,10 @@ class phpnut
|
|||
|
||||
/**
|
||||
* List the users who match a specific search term
|
||||
* @param string $search The search query. Supports @username or #tag searches as
|
||||
* @param string $query The search query. Supports @username or #tag searches as
|
||||
* well as normal search terms. Searches username, display name, bio information.
|
||||
* Does not search posts.
|
||||
* @return array An array of associative arrays, each representing one user.
|
||||
* @return array|false An array of associative arrays, each representing one user.
|
||||
*/
|
||||
public function searchUsers(array $params=[], string $query='')
|
||||
{
|
||||
|
@ -1328,12 +1339,14 @@ class phpnut
|
|||
*/
|
||||
protected function updateUserImage(string $image, string $which='avatar')
|
||||
{
|
||||
$mimeType = '';
|
||||
|
||||
$test = @getimagesize($image);
|
||||
if ($test && array_key_exists('mime', $test)) {
|
||||
$mimeType = $test['mime'];
|
||||
}
|
||||
$data = [
|
||||
$which => new CurlFile($image, $mimeType)
|
||||
$which => new CURLFile($image, $mimeType)
|
||||
];
|
||||
return $this->httpReq(
|
||||
'post-raw',
|
||||
|
@ -1445,10 +1458,10 @@ class phpnut
|
|||
|
||||
/**
|
||||
* get an existing private message channel between multiple users
|
||||
* @param mixed $users Can be a comma- or space-separated string, or an array.
|
||||
* @param string|array $users Can be a comma- or space-separated string, or an array.
|
||||
* Usernames with @-symbol, or user ids.
|
||||
*/
|
||||
public function getExistingPM(string|array $users, array $params=[])
|
||||
public function getExistingPM($users, array $params=[])
|
||||
{
|
||||
if (is_string($users)) {
|
||||
$users = explode(',', str_replace(' ', ',', $users));
|
||||
|
@ -1561,7 +1574,7 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Retrieve a list of "explore" streams
|
||||
* @return An array of associative arrays, each representing a single explore stream.
|
||||
* @return array An array of associative arrays, each representing a single explore stream.
|
||||
*/
|
||||
public function getChannelExploreStreams()
|
||||
{
|
||||
|
@ -1575,7 +1588,7 @@ class phpnut
|
|||
* Retrieve a list of channels from an "explore" stream on pnut.io.
|
||||
* @param string $slug [<description>]
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
* @return An array of associative arrays, each representing a single channel.
|
||||
* @return array An array of associative arrays, each representing a single channel.
|
||||
*/
|
||||
public function getChannelExploreStream(string $slug, array $params=[])
|
||||
{
|
||||
|
@ -1585,7 +1598,7 @@ class phpnut
|
|||
. $this->buildQueryString($params)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mark channel inactive
|
||||
*/
|
||||
|
@ -1685,11 +1698,11 @@ class phpnut
|
|||
|
||||
/**
|
||||
* create message
|
||||
* @param $channelid numeric or "pm" for auto-channel (type=io.pnut.core.pm)
|
||||
* @param string|int $channelid numeric or "pm" for auto-channel (type=io.pnut.core.pm)
|
||||
* @param array $data array('text'=>'YOUR_MESSAGE') If a type=io.pnut.core.pm, then "destinations" key can be set to address as an array of people to send this PM too
|
||||
* @param array $params query parameters
|
||||
*/
|
||||
public function createMessage(string|int $channelid, array $data, array $params=[])
|
||||
public function createMessage($channelid, array $data, array $params=[])
|
||||
{
|
||||
if (isset($data['destinations'])) {
|
||||
if (is_string($data['destinations'])) {
|
||||
|
@ -1802,16 +1815,16 @@ class phpnut
|
|||
public function createFile($file, array $data, array $params=[])
|
||||
{
|
||||
if (!$file) {
|
||||
throw new PhpnutException('You must specify a path to a file');
|
||||
throw new phpnutException('You must specify a path to a file');
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
throw new PhpnutException('File path specified does not exist');
|
||||
throw new phpnutException('File path specified does not exist');
|
||||
}
|
||||
if (!is_readable($file)) {
|
||||
throw new PhpnutException('File path specified is not readable');
|
||||
throw new phpnutException('File path specified is not readable');
|
||||
}
|
||||
if (!array_key_exists('type', $data) || !$data['type']) {
|
||||
throw new PhpnutException('Type is required when creating a file');
|
||||
throw new phpnutException('Type is required when creating a file');
|
||||
}
|
||||
if (!array_key_exists('name', $data)) {
|
||||
$data['name'] = basename($file);
|
||||
|
@ -1823,7 +1836,7 @@ class phpnut
|
|||
$mimeType = null;
|
||||
}
|
||||
if (!array_key_exists('kind', $data)) {
|
||||
$test = @getimagesize($path);
|
||||
$test = @getimagesize($file);
|
||||
if ($test && array_key_exists('mime', $test)) {
|
||||
$data['kind'] = 'image';
|
||||
if (!$mimeType) {
|
||||
|
@ -1840,7 +1853,7 @@ class phpnut
|
|||
finfo_close($finfo);
|
||||
}
|
||||
if (!$mimeType) {
|
||||
throw new PhpnutException('Unable to determine mime type of file, try specifying it explicitly');
|
||||
throw new phpnutException('Unable to determine mime type of file, try specifying it explicitly');
|
||||
}
|
||||
$data['content'] = new \CurlFile($file, $mimeType);
|
||||
return $this->httpReq(
|
||||
|
@ -2001,7 +2014,7 @@ class phpnut
|
|||
$json = json_encode($data);
|
||||
return $this->httpReq(
|
||||
'post',
|
||||
$this->_baseUrl.'polls?'.$this->buildQueryString($params),
|
||||
$this->_baseUrl.'polls?'.$this->buildQueryString($params),
|
||||
$json,
|
||||
'application/json'
|
||||
);
|
||||
|
@ -2010,7 +2023,7 @@ class phpnut
|
|||
/**
|
||||
* Responds to a poll.
|
||||
* @param integer $poll_id The ID of the poll to respond to
|
||||
* @param array list of positions for the poll response
|
||||
* @param array $positions list of positions for the poll response
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
*/
|
||||
public function respondToPoll(int $poll_id, array $positions, array $params=[])
|
||||
|
@ -2019,7 +2032,7 @@ class phpnut
|
|||
return $this->httpReq(
|
||||
'put',
|
||||
$this->_baseUrl.'polls/'.urlencode($poll_id).'/response?'.$this->buildQueryString($params),
|
||||
$json,
|
||||
$json,
|
||||
'application/json'
|
||||
);
|
||||
}
|
||||
|
@ -2085,8 +2098,6 @@ class phpnut
|
|||
* List the polls that match a specific search term
|
||||
* @param array $params a list of filter, search query, and general Poll parameters
|
||||
* see: https://docs.pnut.io/resources/channels/search
|
||||
* @param string $query The search query. Supports
|
||||
* normal search terms.
|
||||
* @return array An array of associative arrays, each representing one poll.
|
||||
* or false on error
|
||||
*/
|
||||
|
@ -2118,7 +2129,7 @@ class phpnut
|
|||
$params
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get User Information
|
||||
*/
|
||||
|
@ -2129,7 +2140,7 @@ class phpnut
|
|||
"{$this->_baseUrl}token"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Application Authorized User IDs
|
||||
*/
|
||||
|
@ -2147,7 +2158,7 @@ class phpnut
|
|||
$params
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Application Authorized User Tokens
|
||||
*/
|
||||
|
@ -2166,14 +2177,12 @@ class phpnut
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Registers your function (or an array of object and method) to be called
|
||||
* whenever an event is received via an open pnut.io stream. Your function
|
||||
* will receive a single parameter, which is the object wrapper containing
|
||||
* the meta and data.
|
||||
* @param mixed A PHP callback (either a string containing the function name,
|
||||
* @param mixed $function A PHP callback (either a string containing the function name,
|
||||
* or an array where the first element is the class/object and the second
|
||||
* is the method).
|
||||
*/
|
||||
|
@ -2181,7 +2190,7 @@ class phpnut
|
|||
{
|
||||
$this->_streamCallback = $function;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens a stream that's been created for this user/app and starts sending
|
||||
* events/objects to your defined callback functions. You must define at
|
||||
|
@ -2231,10 +2240,9 @@ class phpnut
|
|||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close the currently open stream.
|
||||
* @return true;
|
||||
*/
|
||||
public function closeStream(): void
|
||||
{
|
||||
|
@ -2251,7 +2259,7 @@ class phpnut
|
|||
$this->_currentStream = null;
|
||||
$this->_multiStream = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all streams for the current access token.
|
||||
* @return array An array of stream definitions.
|
||||
|
@ -2263,7 +2271,7 @@ class phpnut
|
|||
"{$this->_baseUrl}streams"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a single stream specified by a stream ID. The stream must have been
|
||||
* created with the current access token.
|
||||
|
@ -2276,7 +2284,7 @@ class phpnut
|
|||
$this->_baseUrl.'streams/'.urlencode($streamId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a stream for the current app access token.
|
||||
*
|
||||
|
@ -2307,7 +2315,7 @@ class phpnut
|
|||
);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update stream for the current app access token
|
||||
*
|
||||
|
@ -2338,7 +2346,7 @@ class phpnut
|
|||
);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a stream if you no longer need it.
|
||||
*
|
||||
|
@ -2352,7 +2360,7 @@ class phpnut
|
|||
$this->_baseUrl.'streams/'.urlencode($streamId)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes all streams created by the current access token.
|
||||
*/
|
||||
|
@ -2363,7 +2371,7 @@ class phpnut
|
|||
"{$this->_baseUrl}streams"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal function used to process incoming chunks from the stream. This is only
|
||||
* public because it needs to be accessed by CURL. Do not call or use this function
|
||||
|
@ -2394,7 +2402,7 @@ class phpnut
|
|||
}
|
||||
return strlen($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens a long lived HTTP connection to the pnut.io servers, and sends data
|
||||
* received to the httpStreamReceive function. As a general rule you should not
|
||||
|
@ -2426,7 +2434,7 @@ class phpnut
|
|||
$this->_lastStreamActivity = time();
|
||||
curl_multi_add_handle($this->_multiStream, $this->_currentStream);
|
||||
}
|
||||
|
||||
|
||||
public function reconnectStream(): void
|
||||
{
|
||||
$this->closeStream();
|
||||
|
@ -2442,12 +2450,12 @@ class phpnut
|
|||
}
|
||||
$this->httpStream('get', $this->_streamUrl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process an open stream for x microseconds, then return. This is useful if you want
|
||||
* to be doing other things while processing the stream. If you just want to
|
||||
* consume the stream without other actions, you can call processForever() instead.
|
||||
* @param float @microseconds The number of microseconds to process for before
|
||||
* @param null|float $microseconds The number of microseconds to process for before
|
||||
* returning. There are 1,000,000 microseconds in a second.
|
||||
*
|
||||
* @return void
|
||||
|
@ -2487,7 +2495,7 @@ class phpnut
|
|||
}
|
||||
} while ($timeSoFar+$sleepFor < $microseconds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process an open stream forever. This function will never return, if you
|
||||
* want to perform other actions while consuming the stream, you should use
|
||||
|
|
|
@ -90,7 +90,7 @@ function pnut_connect()
|
|||
|
||||
function pnut_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('pnut'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('pnut'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function pnut_addon_admin(string &$o)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Keith Fernie <http://friendika.me4.it/profile/keith>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -29,7 +28,7 @@ function public_server_install()
|
|||
|
||||
function public_server_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function public_server_register_account($b)
|
||||
|
|
|
@ -109,9 +109,11 @@ class http_class
|
|||
var $connected_port = -1;
|
||||
var $connected_ssl = 0;
|
||||
|
||||
private $content_length_set;
|
||||
|
||||
/* Private methods - DO NOT CALL */
|
||||
|
||||
Function Tokenize($string,$separator="")
|
||||
private function Tokenize($string,$separator="")
|
||||
{
|
||||
if(!strcmp($separator,""))
|
||||
{
|
||||
|
@ -135,18 +137,18 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function CookieEncode($value, $name)
|
||||
private function CookieEncode($value, $name)
|
||||
{
|
||||
return($name ? str_replace("=", "%25", $value) : str_replace(";", "%3B", $value));
|
||||
}
|
||||
|
||||
Function SetError($error, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR)
|
||||
private function SetError($error, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR)
|
||||
{
|
||||
$this->error_code = $error_code;
|
||||
return($this->error=$error);
|
||||
}
|
||||
|
||||
Function SetPHPError($error, &$php_error_message, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR)
|
||||
private function SetPHPError($error, &$php_error_message, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR)
|
||||
{
|
||||
if(IsSet($php_error_message)
|
||||
&& strlen($php_error_message))
|
||||
|
@ -154,7 +156,7 @@ class http_class
|
|||
return($this->SetError($error, $error_code));
|
||||
}
|
||||
|
||||
Function SetDataAccessError($error,$check_connection=0)
|
||||
private function SetDataAccessError($error,$check_connection=0)
|
||||
{
|
||||
$this->error=$error;
|
||||
$this->error_code = HTTP_CLIENT_ERROR_COMMUNICATION_FAILURE;
|
||||
|
@ -174,7 +176,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function OutputDebug($message)
|
||||
private function OutputDebug($message)
|
||||
{
|
||||
if($this->log_debug)
|
||||
error_log($message);
|
||||
|
@ -188,7 +190,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function GetLine()
|
||||
private function GetLine()
|
||||
{
|
||||
for($line="";;)
|
||||
{
|
||||
|
@ -227,7 +229,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function PutLine($line)
|
||||
private function PutLine($line)
|
||||
{
|
||||
if($this->debug)
|
||||
$this->OutputDebug("C $line");
|
||||
|
@ -239,7 +241,7 @@ class http_class
|
|||
return(1);
|
||||
}
|
||||
|
||||
Function PutData($data)
|
||||
private function PutData($data)
|
||||
{
|
||||
if(strlen($data))
|
||||
{
|
||||
|
@ -254,7 +256,7 @@ class http_class
|
|||
return(1);
|
||||
}
|
||||
|
||||
Function FlushData()
|
||||
private function FlushData()
|
||||
{
|
||||
if(!fflush($this->connection))
|
||||
{
|
||||
|
@ -264,7 +266,7 @@ class http_class
|
|||
return(1);
|
||||
}
|
||||
|
||||
Function ReadChunkSize()
|
||||
private function ReadChunkSize()
|
||||
{
|
||||
if($this->remaining_chunk==0)
|
||||
{
|
||||
|
@ -289,7 +291,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function ReadBytes($length)
|
||||
private function ReadBytes($length)
|
||||
{
|
||||
if($this->use_curl)
|
||||
{
|
||||
|
@ -356,7 +358,7 @@ class http_class
|
|||
return($bytes);
|
||||
}
|
||||
|
||||
Function EndOfInput()
|
||||
private function EndOfInput()
|
||||
{
|
||||
if($this->use_curl)
|
||||
return($this->read_response>=strlen($this->response));
|
||||
|
@ -367,7 +369,7 @@ class http_class
|
|||
return(feof($this->connection));
|
||||
}
|
||||
|
||||
Function Resolve($domain, &$ip, $server_type)
|
||||
private function Resolve($domain, &$ip, $server_type)
|
||||
{
|
||||
if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',$domain))
|
||||
$ip=$domain;
|
||||
|
@ -385,7 +387,7 @@ class http_class
|
|||
return('');
|
||||
}
|
||||
|
||||
Function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP')
|
||||
private function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP')
|
||||
{
|
||||
$domain=$host_name;
|
||||
$port = $host_port;
|
||||
|
@ -552,7 +554,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function Disconnect()
|
||||
private function Disconnect()
|
||||
{
|
||||
if($this->debug)
|
||||
$this->OutputDebug("Disconnected from ".$this->connected_host);
|
||||
|
@ -569,7 +571,7 @@ class http_class
|
|||
|
||||
/* Public methods */
|
||||
|
||||
Function GetRequestArguments($url, &$arguments)
|
||||
public function GetRequestArguments($url, &$arguments)
|
||||
{
|
||||
$this->error = '';
|
||||
$this->error_code = HTTP_CLIENT_ERROR_NO_ERROR;
|
||||
|
@ -621,7 +623,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function Open($arguments)
|
||||
public function Open($arguments)
|
||||
{
|
||||
if(strlen($this->error))
|
||||
return($this->error);
|
||||
|
@ -750,7 +752,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function Close($force = 0)
|
||||
public function Close($force = 0)
|
||||
{
|
||||
if($this->state=="Disconnected")
|
||||
return("1 already disconnected");
|
||||
|
@ -767,7 +769,7 @@ class http_class
|
|||
return($this->Disconnect());
|
||||
}
|
||||
|
||||
Function PickCookies(&$cookies,$secure)
|
||||
private function PickCookies(&$cookies,$secure)
|
||||
{
|
||||
if(IsSet($this->cookies[$secure]))
|
||||
{
|
||||
|
@ -803,7 +805,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function GetFileDefinition($file, &$definition)
|
||||
private function GetFileDefinition($file, &$definition)
|
||||
{
|
||||
$name="";
|
||||
if(IsSet($file["FileName"]))
|
||||
|
@ -990,9 +992,6 @@ class http_class
|
|||
if(GetType($length=@filesize($file["FileName"]))!="integer")
|
||||
{
|
||||
$error="it was not possible to determine the length of the file ".$file["FileName"];
|
||||
if(IsSet($php_errormsg)
|
||||
&& strlen($php_errormsg))
|
||||
$error.=": ".$php_errormsg;
|
||||
if(!file_exists($file["FileName"]))
|
||||
$error="it was not possible to access the file ".$file["FileName"];
|
||||
return($error);
|
||||
|
@ -1007,7 +1006,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function ConnectFromProxy($arguments, &$headers)
|
||||
private function ConnectFromProxy($arguments, &$headers)
|
||||
{
|
||||
if(!$this->PutLine('CONNECT '.$this->host_name.':'.($this->host_port ? $this->host_port : 443).' HTTP/1.0')
|
||||
|| (strlen($this->user_agent)
|
||||
|
@ -1052,7 +1051,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function SendRequest($arguments)
|
||||
public function SendRequest($arguments)
|
||||
{
|
||||
if(strlen($this->error))
|
||||
return($this->error);
|
||||
|
@ -1440,7 +1439,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0)
|
||||
private function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0)
|
||||
{
|
||||
if(strlen($this->error))
|
||||
return($this->error);
|
||||
|
@ -1472,7 +1471,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function SendRequestBody($data, $end_of_data)
|
||||
private function SendRequestBody($data, $end_of_data)
|
||||
{
|
||||
if(strlen($this->error))
|
||||
return($this->error);
|
||||
|
@ -1508,7 +1507,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function ReadReplyHeadersResponse(&$headers)
|
||||
private function ReadReplyHeadersResponse(&$headers)
|
||||
{
|
||||
$headers=array();
|
||||
if(strlen($this->error))
|
||||
|
@ -1635,7 +1634,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function Redirect(&$headers)
|
||||
private function Redirect(&$headers)
|
||||
{
|
||||
if($this->follow_redirect)
|
||||
{
|
||||
|
@ -1678,7 +1677,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation)
|
||||
private function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation)
|
||||
{
|
||||
if($proxy)
|
||||
{
|
||||
|
@ -1697,9 +1696,10 @@ class http_class
|
|||
if(IsSet($headers[$authenticate_header])
|
||||
&& $this->sasl_authenticate)
|
||||
{
|
||||
if(function_exists("class_exists")
|
||||
&& !class_exists("sasl_client_class"))
|
||||
if(!class_exists('sasl_client_class'))
|
||||
{
|
||||
return($this->SetError("the SASL client class needs to be loaded to be able to authenticate".($proxy ? " with the proxy server" : "")." and access this site", HTTP_CLIENT_ERROR_INVALID_PARAMETERS));
|
||||
}
|
||||
if(GetType($headers[$authenticate_header])=="array")
|
||||
$authenticate=$headers[$authenticate_header];
|
||||
else
|
||||
|
@ -1719,7 +1719,7 @@ class http_class
|
|||
else
|
||||
$mechanisms[]=$mechanism;
|
||||
}
|
||||
$sasl=new sasl_client_class;
|
||||
$sasl=new \sasl_client_class();
|
||||
if(IsSet($user))
|
||||
$sasl->SetCredential("user",$user);
|
||||
if(IsSet($password))
|
||||
|
@ -1731,6 +1731,8 @@ class http_class
|
|||
$sasl->SetCredential("uri",$this->request_uri);
|
||||
$sasl->SetCredential("method",$this->request_method);
|
||||
$sasl->SetCredential("session",$this->session);
|
||||
$message = '';
|
||||
$interactions = [];
|
||||
do
|
||||
{
|
||||
$status=$sasl->Start($mechanisms,$message,$interactions);
|
||||
|
@ -1906,8 +1908,8 @@ class http_class
|
|||
}
|
||||
return("");
|
||||
}
|
||||
|
||||
Function ReadReplyHeaders(&$headers)
|
||||
|
||||
public function ReadReplyHeaders(&$headers)
|
||||
{
|
||||
if(strlen($error=$this->ReadReplyHeadersResponse($headers)))
|
||||
return($error);
|
||||
|
@ -1938,7 +1940,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function ReadReplyBody(&$body,$length)
|
||||
private function ReadReplyBody(&$body,$length)
|
||||
{
|
||||
$body="";
|
||||
if(strlen($this->error))
|
||||
|
@ -1980,7 +1982,7 @@ class http_class
|
|||
return("");
|
||||
}
|
||||
|
||||
Function ReadWholeReplyBody(&$body)
|
||||
public function ReadWholeReplyBody(&$body)
|
||||
{
|
||||
$body = '';
|
||||
for(;;)
|
||||
|
@ -1993,7 +1995,7 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0)
|
||||
private function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0)
|
||||
{
|
||||
$now=gmdate("Y-m-d H-i-s");
|
||||
$cookies=array();
|
||||
|
@ -2034,17 +2036,17 @@ class http_class
|
|||
}
|
||||
}
|
||||
|
||||
Function SavePersistentCookies(&$cookies, $domain='', $secure_only=0)
|
||||
private function SavePersistentCookies(&$cookies, $domain='', $secure_only=0)
|
||||
{
|
||||
$this->SaveCookies($cookies, $domain, $secure_only, 1);
|
||||
}
|
||||
|
||||
Function GetPersistentCookies(&$cookies, $domain='', $secure_only=0)
|
||||
private function GetPersistentCookies(&$cookies, $domain='', $secure_only=0)
|
||||
{
|
||||
$this->SavePersistentCookies($cookies, $domain, $secure_only);
|
||||
}
|
||||
|
||||
Function RestoreCookies($cookies, $clear=1)
|
||||
private function RestoreCookies($cookies, $clear=1)
|
||||
{
|
||||
$new_cookies=($clear ? array() : $this->cookies);
|
||||
for($secure_cookies=0, Reset($cookies); $secure_cookies<count($cookies); Next($cookies), $secure_cookies++)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Addon;
|
||||
|
@ -320,7 +319,7 @@ function pumpio_settings_post(array &$b)
|
|||
|
||||
function pumpio_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function pumpio_hook_fork(array &$b)
|
||||
|
@ -582,6 +581,8 @@ function pumpio_action(int $uid, string $uri, string $action, string $content =
|
|||
$uri = $orig_post['uri'];
|
||||
}
|
||||
|
||||
$objectType = '';
|
||||
|
||||
if (($orig_post['object-type'] != '') && (strstr($orig_post['object-type'], ActivityNamespace::ACTIVITY_SCHEMA))) {
|
||||
$objectType = str_replace(ActivityNamespace::ACTIVITY_SCHEMA, '', $orig_post['object-type']);
|
||||
} elseif (strstr($uri, '/api/comment/')) {
|
||||
|
@ -827,6 +828,7 @@ function pumpio_dounlike(int $uid, array $self, $post, string $own_id)
|
|||
}
|
||||
|
||||
$contactid = 0;
|
||||
$contact = [];
|
||||
|
||||
if (Strings::compareLink($post->actor->url, $own_id)) {
|
||||
$contactid = $self['id'];
|
||||
|
@ -1430,6 +1432,8 @@ function pumpio_fetchallcomments($uid, $id)
|
|||
|
||||
Logger::notice('pumpio_fetchallcomments: fetching comment for user ' . $uid . ', URL ' . $url);
|
||||
|
||||
$item = new \stdClass();
|
||||
|
||||
if (pumpio_reachable($url)) {
|
||||
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError' => true], $item);
|
||||
} else {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
|
|
@ -26,6 +26,7 @@ class RatioedPanel extends Active
|
|||
|
||||
$action = $this->parameters['action'] ?? '';
|
||||
$uid = $this->parameters['uid'] ?? 0;
|
||||
$user = [];
|
||||
|
||||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
use Friendica\Addon\s3_storage\src\S3Client;
|
||||
use Friendica\Addon\s3_storage\src\S3Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ namespace Friendica\Addon\s3_storage\src;
|
|||
|
||||
defined('AKEEBAENGINE') or define('AKEEBAENGINE', 1);
|
||||
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Configuration;
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Connector;
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Exception\CannotDeleteFile;
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Input;
|
||||
use Akeeba\S3\Configuration;
|
||||
use Akeeba\S3\Connector;
|
||||
use Akeeba\S3\Exception\CannotDeleteFile;
|
||||
use Akeeba\S3\Input;
|
||||
use Friendica\Core\Storage\Capability\ICanWriteToStorage;
|
||||
use Friendica\Core\Storage\Exception\StorageException;
|
||||
use Friendica\Util\Strings;
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace Friendica\Addon\s3_storage\src;
|
|||
|
||||
defined('AKEEBAENGINE') or define('AKEEBAENGINE', 1);
|
||||
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Configuration;
|
||||
use Akeeba\Engine\Postproc\Connector\S3v4\Connector;
|
||||
use Akeeba\S3\Configuration;
|
||||
use Akeeba\S3\Connector;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Storage\Capability\ICanConfigureStorage;
|
||||
|
|
|
@ -161,7 +161,7 @@ function saml_sso_reply()
|
|||
}
|
||||
|
||||
if (!empty($user['uid'])) {
|
||||
DI::auth()->setForUser(DI::app(), $user);
|
||||
DI::auth()->setForUser($user);
|
||||
}
|
||||
|
||||
if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Friendica\Addon\securemail;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
use Friendica\Addon\securemail\SecureTestEmail;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
|
@ -32,8 +31,6 @@ function securemail_install()
|
|||
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings 'addon_settings' hook
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @see App
|
||||
*/
|
||||
function securemail_settings(array &$data)
|
||||
{
|
||||
|
@ -67,8 +64,6 @@ function securemail_settings(array &$data)
|
|||
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings_post 'addon_settings_post' hook
|
||||
*
|
||||
* @param array $b hook data
|
||||
*
|
||||
* @see App
|
||||
*/
|
||||
function securemail_settings_post(array &$b)
|
||||
{
|
||||
|
@ -82,7 +77,7 @@ function securemail_settings_post(array &$b)
|
|||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'securemail', 'enable', $enable);
|
||||
|
||||
if (!empty($_POST['securemail-test'])) {
|
||||
$res = DI::emailer()->send(new SecureTestEmail(DI::app(), DI::config(), DI::pConfig(), DI::baseUrl()));
|
||||
$res = DI::emailer()->send(new SecureTestEmail(DI::config(), DI::pConfig(), DI::baseUrl()));
|
||||
|
||||
// revert to saved value
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'securemail', 'enable', $enable);
|
||||
|
@ -102,8 +97,6 @@ function securemail_settings_post(array &$b)
|
|||
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#emailer_send_prepare 'emailer_send_prepare' hook
|
||||
*
|
||||
* @param IEmail $email Email
|
||||
*
|
||||
* @see App
|
||||
*/
|
||||
function securemail_emailer_send_prepare(IEmail &$email)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
@ -79,6 +78,7 @@ function get_body_length($body)
|
|||
* Checking any possible syntax of the style attribute with xpath is impossible
|
||||
* So we just get any element with a style attribute, and check them with a regexp
|
||||
*/
|
||||
/** @var DOMNodeList $xr */
|
||||
$xr = $xpath->query('//*[@style]');
|
||||
foreach ($xr as $node) {
|
||||
if (preg_match('/.*display: *none *;.*/',$node->getAttribute('style'))) {
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
function showmore_dyn_install()
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
* Name: Smiley Pack (Español)
|
||||
* Description: Pack of smileys that make master too AOLish.
|
||||
* Version: 1.02
|
||||
* Author: Thomas Willingham (based on Mike Macgirvin's Adult Smile template)
|
||||
* Author: Thomas Willingham (based on Mike Macgirvin's Adult Smile template)
|
||||
* All smileys from sites offering them as Public Domain
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -19,7 +18,7 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
#Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever.
|
||||
|
||||
#Be careful with invocation strings. If you have a smiley called foo, and another called foobar, typing :foobar will call foo. Avoid this with clever naming, using ~ instead of :
|
||||
#Be careful with invocation strings. If you have a smiley called foo, and another called foobar, typing :foobar will call foo. Avoid this with clever naming, using ~ instead of :
|
||||
#when all else fails.
|
||||
|
||||
|
||||
|
@ -49,7 +48,7 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
$b['texts'][] = ':vaca';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/cow.gif' . '" alt="' . ':vaca' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':cangrejo';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/crab.gif' . '" alt="' . ':cangrejo' . '" />';
|
||||
|
||||
|
@ -70,7 +69,7 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
$b['texts'][] = ':caballo';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/horse.gif' . '" alt="' . ':caballo' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':loro';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/parrot.gif' . '" alt="' . ':loro' . '" />';
|
||||
|
||||
|
@ -107,7 +106,7 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
$b['texts'][] = ':cuna';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/babycot.gif' . '" alt="' . ':cuna' . '" />';
|
||||
|
||||
|
||||
|
||||
$b['texts'][] = ':embarazada';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/pregnant.gif' . '" alt="' . ':embarazada' . '" />';
|
||||
|
@ -116,10 +115,10 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/stork.gif' . '" alt="' . ':cigüeña' . '" />';
|
||||
|
||||
|
||||
#Confused Smileys
|
||||
#Confused Smileys
|
||||
$b['texts'][] = ':confundido';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/confused/confused.gif' . '" alt="' . ':confundido' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':encogehombros';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/confused/shrug.gif' . '" alt="' . ':encogehombros' . '" />';
|
||||
|
||||
|
@ -154,13 +153,13 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
$b['texts'][] = ':diabólico';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/devil.gif' . '" alt="' . ':diabólico' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':adbalancín';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/daseesaw.gif' . '" alt="' . ':adbalancín' . '" />';
|
||||
|
||||
$b['texts'][] = ':vuelvedemonio';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/turnevil.gif' . '" alt="' . ':vuelvedemonio' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':santo';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/saint.gif' . '" alt="' . ':santo' . '" />';
|
||||
|
||||
|
@ -242,7 +241,7 @@ function smiley_pack_smilies_es(array &$b) {
|
|||
|
||||
$b['texts'][] = ':billar';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/sport/snooker.gif' . '" alt="' . ':billar' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':tenis';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/sport/tennis.gif' . '" alt="' . ':tenis' . '" />';
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -23,7 +22,7 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
#Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever.
|
||||
|
||||
#Be careful with invocation strings. If you have a smiley called foo, and another called foobar, typing :foobar will call foo. Avoid this with clever naming, using ~ instead of :
|
||||
#Be careful with invocation strings. If you have a smiley called foo, and another called foobar, typing :foobar will call foo. Avoid this with clever naming, using ~ instead of :
|
||||
#when all else fails.
|
||||
|
||||
|
||||
|
@ -56,7 +55,7 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
$b['texts'][] = ':vache';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/cow.gif' . '" alt="' . ':vache' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':crabe';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/crab.gif' . '" alt="' . ':crabe' . '" />';
|
||||
|
||||
|
@ -74,7 +73,7 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
$b['texts'][] = ':cheval';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/horse.gif' . '" alt="' . ':cheval' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':perroquet';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/animals/parrot.gif' . '" alt="' . ':perroquet' . '" />';
|
||||
|
||||
|
@ -108,7 +107,7 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
$b['texts'][] = ':litbébé';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/babycot.gif' . '" alt="' . ':litbébé' . '" />';
|
||||
|
||||
|
||||
|
||||
$b['texts'][] = ':enceinte';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/pregnant.gif' . '" alt="' . ':enceinte' . '" />';
|
||||
|
@ -117,10 +116,10 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/babies/stork.gif' . '" alt="' . ':cigogne' . '" />';
|
||||
|
||||
|
||||
#Confused Smileys
|
||||
#Confused Smileys
|
||||
$b['texts'][] = ':paumé';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/confused/confused.gif' . '" alt="' . ':paumé' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':hausseépaules';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/confused/shrug.gif' . '" alt="' . ':hausseépaules' . '" />';
|
||||
|
||||
|
@ -152,13 +151,13 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
$b['texts'][] = ':démoniaque';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/devil.gif' . '" alt="' . ':démoniaque' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':bascule';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/daseesaw.gif' . '" alt="' . ':bascule' . '" />';
|
||||
|
||||
$b['texts'][] = ':possédé';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/turnevil.gif' . '" alt="' . ':possédé' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':tombe';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/devilangel/graveside.gif' . '" alt="' . ':tombe' . '" />';
|
||||
|
||||
|
@ -225,7 +224,7 @@ function smiley_pack_fr_smilies(array &$b)
|
|||
|
||||
$b['texts'][] = ':billard';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/sport/snooker.gif' . '" alt="' . ':billard' . '" />';
|
||||
|
||||
|
||||
$b['texts'][] = ':équitation';
|
||||
$b['icons'][] = '<img src="' . DI::baseUrl() . '/addon/smiley_pack/icons/sport/horseriding.gif' . '" alt="' . ':équitation' . '" />';
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Maintainer: Hypolite Petovan <https://friendica.mrpetovan.com/profile/hypolite>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -20,7 +19,7 @@ function smileybutton_install()
|
|||
function smileybutton_jot_tool(string &$body)
|
||||
{
|
||||
// Disable if theme is quattro
|
||||
if (DI::app()->getCurrentTheme() == 'quattro') {
|
||||
if (DI::appHelper()->getCurrentTheme() == 'quattro') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,7 @@ function smileybutton_jot_tool(string &$body)
|
|||
$s .= '</tr></table>';
|
||||
|
||||
//Add css to header
|
||||
$css_file = __DIR__ . '/view/' . DI::app()->getCurrentTheme() . '.css';
|
||||
$css_file = __DIR__ . '/view/' . DI::appHelper()->getCurrentTheme() . '.css';
|
||||
if (!file_exists($css_file)) {
|
||||
$css_file = __DIR__ . '/view/default.css';
|
||||
}
|
||||
|
@ -105,7 +104,7 @@ function smileybutton_jot_tool(string &$body)
|
|||
DI::page()->registerStylesheet($css_file);
|
||||
|
||||
//Get the correct image for the theme
|
||||
$image = 'addon/smileybutton/view/' . DI::app()->getCurrentTheme() . '.png';
|
||||
$image = 'addon/smileybutton/view/' . DI::appHelper()->getCurrentTheme() . '.png';
|
||||
if (!file_exists($image)) {
|
||||
$image = 'addon/smileybutton/view/default.png';
|
||||
}
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
* Description: Smily icons that could or should not be included in core
|
||||
* Version: 1.0
|
||||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*
|
||||
*
|
||||
* This is a template for how to extend the "smily" code.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
|
|
@ -31,11 +31,10 @@ use Friendica\Core\System;
|
|||
/**
|
||||
* Define constants
|
||||
*/
|
||||
$constants = explode(' ', 'OBJECT ARRAY JSON');
|
||||
foreach ($constants as $i => $id) {
|
||||
$id = 'CODEBIRD_RETURNFORMAT_' . $id;
|
||||
defined($id) or define($id, $i);
|
||||
}
|
||||
defined('CODEBIRD_RETURNFORMAT_ARRAY') or define('CODEBIRD_RETURNFORMAT_ARRAY', 0);
|
||||
defined('CODEBIRD_RETURNFORMAT_JSON') or define('CODEBIRD_RETURNFORMAT_JSON', 1);
|
||||
defined('CODEBIRD_RETURNFORMAT_OBJECT') or define('CODEBIRD_RETURNFORMAT_OBJECT', 2);
|
||||
|
||||
$constants = array(
|
||||
'CURLE_SSL_CERTPROBLEM' => 58,
|
||||
'CURLE_SSL_CACERT' => 60,
|
||||
|
@ -55,6 +54,8 @@ unset($id);
|
|||
*
|
||||
* @package codebird
|
||||
* @subpackage codebird-php
|
||||
*
|
||||
* @method object statuses_update(array $postdata)
|
||||
*/
|
||||
class CodebirdSN
|
||||
{
|
||||
|
@ -117,7 +118,7 @@ class CodebirdSN
|
|||
* Returns singleton class instance
|
||||
* Always use this method unless you're working with multiple authenticated users at once
|
||||
*
|
||||
* @return Codebird The instance
|
||||
* @return CodebirdSN The instance
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
|
@ -421,6 +422,7 @@ class CodebirdSN
|
|||
}
|
||||
break;
|
||||
case CODEBIRD_RETURNFORMAT_OBJECT:
|
||||
/** @var object $reply */
|
||||
$reply->httpstatus = $httpstatus;
|
||||
if ($httpstatus == 200) {
|
||||
self::setBearerToken($reply->access_token);
|
||||
|
@ -491,7 +493,7 @@ class CodebirdSN
|
|||
/**
|
||||
* Generates a (hopefully) unique random string
|
||||
*
|
||||
* @param int optional $length The length of the string to generate
|
||||
* @param int $length The optional length of the string to generate
|
||||
*
|
||||
* @return string The random string
|
||||
*/
|
||||
|
@ -506,9 +508,9 @@ class CodebirdSN
|
|||
/**
|
||||
* Generates an OAuth signature
|
||||
*
|
||||
* @param string $httpmethod Usually either 'GET' or 'POST' or 'DELETE'
|
||||
* @param string $method The API method to call
|
||||
* @param array optional $params The API call parameters, associative
|
||||
* @param string $httpmethod Usually either 'GET' or 'POST' or 'DELETE'
|
||||
* @param string $method The API method to call
|
||||
* @param array $params optional The API call parameters, associative
|
||||
*
|
||||
* @return string Authorization HTTP header
|
||||
*/
|
||||
|
@ -762,13 +764,13 @@ class CodebirdSN
|
|||
* @param string $method The API method to call
|
||||
* @param array $params The parameters to send along
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected function _buildMultipart($method, $params)
|
||||
{
|
||||
// well, files will only work in multipart methods
|
||||
if (! $this->_detectMultipart($method)) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
// only check specific parameters
|
||||
|
@ -783,18 +785,19 @@ class CodebirdSN
|
|||
);
|
||||
// method might have files?
|
||||
if (! in_array($method, array_keys($possible_files))) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$possible_files = explode(' ', $possible_files[$method]);
|
||||
|
||||
$data = '';
|
||||
|
||||
$multipart_border = '--------------------' . $this->_nonce();
|
||||
$multipart_request = '';
|
||||
foreach ($params as $key => $value) {
|
||||
// is it an array?
|
||||
if (is_array($value)) {
|
||||
throw new \Exception('Using URL-encoded parameters is not supported for uploading media.');
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for filenames
|
||||
|
@ -871,12 +874,12 @@ class CodebirdSN
|
|||
/**
|
||||
* Calls the API using cURL
|
||||
*
|
||||
* @param string $httpmethod The HTTP method to use for making the request
|
||||
* @param string $method The API method to call
|
||||
* @param string $method_template The templated API method to call
|
||||
* @param array optional $params The parameters to send along
|
||||
* @param bool optional $multipart Whether to use multipart/form-data
|
||||
* @param bool optional $app_only_auth Whether to use app-only bearer authentication
|
||||
* @param string $httpmethod The HTTP method to use for making the request
|
||||
* @param string $method The API method to call
|
||||
* @param string $method_template The templated API method to call
|
||||
* @param array $params optional The parameters to send along
|
||||
* @param bool $multipart optional Whether to use multipart/form-data
|
||||
* @param bool $app_only_auth optional Whether to use app-only bearer authentication
|
||||
*
|
||||
* @return mixed The API reply, encoded in the set return_format
|
||||
*/
|
||||
|
@ -918,7 +921,7 @@ class CodebirdSN
|
|||
$authorization = 'Authorization: Bearer ' . self::$_oauth_bearer_token;
|
||||
}
|
||||
$request_headers = array();
|
||||
if (isset($authorization)) {
|
||||
if ($authorization !== '') {
|
||||
$request_headers[] = $authorization;
|
||||
$request_headers[] = 'Expect:';
|
||||
}
|
||||
|
@ -959,6 +962,7 @@ class CodebirdSN
|
|||
$httpstatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$reply = $this->_parseApiReply($method_template, $reply);
|
||||
if ($this->_return_format == CODEBIRD_RETURNFORMAT_OBJECT) {
|
||||
/** @var object $reply */
|
||||
$reply->httpstatus = $httpstatus;
|
||||
} elseif ($this->_return_format == CODEBIRD_RETURNFORMAT_ARRAY) {
|
||||
$reply['httpstatus'] = $httpstatus;
|
||||
|
|
|
@ -52,11 +52,6 @@ class StatusNetOAuth extends TwitterOAuth
|
|||
*
|
||||
* Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object API results
|
||||
*/
|
||||
function http($url, $method, $postfields = NULL)
|
||||
|
|
|
@ -93,7 +93,7 @@ class TwitterOAuth
|
|||
/**
|
||||
* Get a request_token
|
||||
*
|
||||
* @param callback $oauth_callback
|
||||
* @param callable $oauth_callback
|
||||
* @return array
|
||||
*/
|
||||
function getRequestToken($oauth_callback = null)
|
||||
|
@ -112,8 +112,6 @@ class TwitterOAuth
|
|||
/**
|
||||
* Get the authorize URL
|
||||
*
|
||||
* @param array $token
|
||||
* @param bool $sign_in_with_tumblr
|
||||
* @return string
|
||||
*/
|
||||
function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
|
||||
|
|
|
@ -38,7 +38,6 @@ define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes
|
|||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php';
|
||||
|
||||
use CodebirdSN\CodebirdSN;
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\Plaintext;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -366,6 +365,8 @@ function statusnet_post_hook(array &$b)
|
|||
$otoken = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret');
|
||||
|
||||
$iscomment = null;
|
||||
|
||||
if ($ckey && $csecret && $otoken && $osecret) {
|
||||
$dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
$max_char = $dent->get_maxlength(); // max. length for a dent
|
||||
|
|
|
@ -26,6 +26,7 @@ function tesseract_ocr_detection(&$media)
|
|||
try {
|
||||
$languages = $ocr->availableLanguages();
|
||||
if ($languages) {
|
||||
/** @phpstan-ignore-next-line ignore call of \thiagoalessio\TesseractOCR\Option::lang() */
|
||||
$ocr->lang(implode('+', $languages));
|
||||
}
|
||||
$ocr->tempDir(System::getTempPath());
|
||||
|
@ -33,5 +34,5 @@ function tesseract_ocr_detection(&$media)
|
|||
$media['description'] = $ocr->run();
|
||||
} catch (\Throwable $th) {
|
||||
Logger::info('Error calling TesseractOCR', ['message' => $th->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -27,7 +26,7 @@ function testdrive_install()
|
|||
|
||||
function testdrive_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function testdrive_globaldir_update(array &$b)
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* Status: unsupported
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -30,7 +29,12 @@ function tictac_module() {}
|
|||
|
||||
function tictac_content() {
|
||||
|
||||
$o = '';
|
||||
$o = '';
|
||||
$dimen = 3;
|
||||
$handicap = 0;
|
||||
$mefirst = 0;
|
||||
$yours = '';
|
||||
$mine = '';
|
||||
|
||||
if($_POST['move']) {
|
||||
$handicap = DI::args()->get(1);
|
||||
|
@ -45,9 +49,6 @@ function tictac_content() {
|
|||
$handicap = DI::args()->get(1);
|
||||
$dimen = 3;
|
||||
}
|
||||
else {
|
||||
$dimen = 3;
|
||||
}
|
||||
|
||||
$o .= '<h3>' . DI::l10n()->t('3D Tic-Tac-Toe') . '</h3><br />';
|
||||
|
||||
|
@ -70,6 +71,7 @@ class tictac {
|
|||
private $dimen;
|
||||
private $first_move = true;
|
||||
private $handicap = 0;
|
||||
private $mefirst;
|
||||
private $yours;
|
||||
private $mine;
|
||||
private $winning_play;
|
||||
|
@ -161,10 +163,10 @@ class tictac {
|
|||
|
||||
];
|
||||
|
||||
function __construct($dimen,$handicap,$mefirst,$yours,$mine) {
|
||||
$this->dimen = 3;
|
||||
$this->handicap = (($handicap) ? 1 : 0);
|
||||
$this->mefirst = (($mefirst) ? 1 : 0);
|
||||
function __construct($dimen, $handicap, $mefirst, $yours, $mine) {
|
||||
$this->dimen = $dimen;
|
||||
$this->handicap = $handicap ? 1 : 0;
|
||||
$this->mefirst = $mefirst ? 1 : 0;
|
||||
$this->yours = str_replace('XXX','',$yours);
|
||||
$this->mine = $mine;
|
||||
$this->you = $this->parse_moves('you');
|
||||
|
@ -175,6 +177,7 @@ class tictac {
|
|||
}
|
||||
|
||||
function play() {
|
||||
$o = '';
|
||||
|
||||
if($this->first_move) {
|
||||
if(rand(0,1) == 1) {
|
||||
|
@ -226,6 +229,8 @@ class tictac {
|
|||
}
|
||||
|
||||
function parse_moves($player) {
|
||||
$str = '';
|
||||
|
||||
if($player == 'me')
|
||||
$str = $this->mine;
|
||||
if($player == 'you')
|
||||
|
@ -629,7 +634,7 @@ function winning_move() {
|
|||
function draw_board() {
|
||||
if(! strlen($this->yours))
|
||||
$this->yours = 'XXX';
|
||||
$o .= "<form action=\"tictac/{$this->handicap}/{$this->mefirst}/{$this->dimen}/{$this->yours}/{$this->mine}\" method=\"post\" />";
|
||||
$o = "<form action=\"tictac/{$this->handicap}/{$this->mefirst}/{$this->dimen}/{$this->yours}/{$this->mine}\" method=\"post\" />";
|
||||
for($x = 0; $x < $this->dimen; $x ++) {
|
||||
$o .= '<table>';
|
||||
for($y = 0; $y < $this->dimen; $y ++) {
|
||||
|
|
|
@ -65,7 +65,7 @@ function tumblr_install()
|
|||
|
||||
function tumblr_load_config(ConfigFileManager $loader)
|
||||
{
|
||||
DI::app()->getConfigCache()->load($loader->loadAddonConfig('tumblr'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('tumblr'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
|
||||
}
|
||||
|
||||
function tumblr_check_item_notification(array &$notification_data)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue