Use globals instead of $a->data
This commit is contained in:
parent
cc8aeb11de
commit
d902f6808d
|
@ -12,6 +12,8 @@ use Friendica\Core\Hook;
|
|||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
global $blockem_words;
|
||||
|
||||
function blockem_install()
|
||||
{
|
||||
Hook::register('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
|
||||
|
@ -141,6 +143,8 @@ function blockem_display_item(App $a, array &$b = null)
|
|||
|
||||
function blockem_conversation_start(App $a, array &$b)
|
||||
{
|
||||
global $blockem_words;
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
@ -148,7 +152,7 @@ function blockem_conversation_start(App $a, array &$b)
|
|||
$words = DI::pConfig()->get(local_user(), 'blockem', 'words');
|
||||
|
||||
if ($words) {
|
||||
$a->data['blockem'] = explode(',', $words);
|
||||
$blockem_words = explode(',', $words);
|
||||
}
|
||||
|
||||
DI::page()['htmlhead'] .= <<< EOT
|
||||
|
@ -171,6 +175,8 @@ EOT;
|
|||
|
||||
function blockem_item_photo_menu(App $a, array &$b)
|
||||
{
|
||||
global $blockem_words;
|
||||
|
||||
if (!local_user() || $b['item']['self']) {
|
||||
return;
|
||||
}
|
||||
|
@ -178,8 +184,8 @@ function blockem_item_photo_menu(App $a, array &$b)
|
|||
$blocked = false;
|
||||
$author = $b['item']['author-link'];
|
||||
|
||||
if (!empty($a->data['blockem'])) {
|
||||
foreach($a->data['blockem'] as $bloke) {
|
||||
if (!empty($blockem_words)) {
|
||||
foreach($blockem_words as $bloke) {
|
||||
if (Strings::compareLink($bloke,$author)) {
|
||||
$blocked = true;
|
||||
break;
|
||||
|
|
|
@ -18,6 +18,8 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
global $forumdirectory_search;
|
||||
|
||||
function forumdirectory_install()
|
||||
{
|
||||
Hook::register('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
|
||||
|
@ -42,13 +44,17 @@ function forumdirectory_init(App $a)
|
|||
|
||||
function forumdirectory_post(App $a)
|
||||
{
|
||||
global $forumdirectory_search;
|
||||
|
||||
if (!empty($_POST['search'])) {
|
||||
$a->data['search'] = $_POST['search'];
|
||||
$forumdirectory_search = $_POST['search'];
|
||||
}
|
||||
}
|
||||
|
||||
function forumdirectory_content(App $a)
|
||||
{
|
||||
global $forumdirectory_search;
|
||||
|
||||
if ((DI::config()->get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
|
||||
notice(DI::l10n()->t('Public access denied.') . EOL);
|
||||
return;
|
||||
|
@ -59,8 +65,8 @@ function forumdirectory_content(App $a)
|
|||
|
||||
Nav::setSelected('directory');
|
||||
|
||||
if (!empty($a->data['search'])) {
|
||||
$search = Strings::escapeTags(trim($a->data['search']));
|
||||
if (!empty($forumdirectory_search)) {
|
||||
$search = Strings::escapeTags(trim($forumdirectory_search));
|
||||
} else {
|
||||
$search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
global $js_upload_jsonresponse;
|
||||
global $js_upload_result;
|
||||
|
||||
function js_upload_install()
|
||||
{
|
||||
Hook::register('photo_upload_form', __FILE__, 'js_upload_form');
|
||||
|
@ -42,6 +45,8 @@ function js_upload_form(App $a, array &$b)
|
|||
|
||||
function js_upload_post_init(App $a, &$b)
|
||||
{
|
||||
global $js_upload_result, $js_upload_jsonresponse;
|
||||
|
||||
// list of valid extensions
|
||||
$allowedExtensions = ['jpeg', 'gif', 'png', 'jpg'];
|
||||
|
||||
|
@ -53,7 +58,7 @@ function js_upload_post_init(App $a, &$b)
|
|||
$result = $uploader->handleUpload();
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
$a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
|
||||
$js_upload_jsonresponse = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'], Logger::DEBUG);
|
||||
|
@ -61,12 +66,14 @@ function js_upload_post_init(App $a, &$b)
|
|||
exit();
|
||||
}
|
||||
|
||||
$a->data['upload_result'] = $result;
|
||||
$js_upload_result = $result;
|
||||
}
|
||||
|
||||
function js_upload_post_file(App $a, &$b)
|
||||
{
|
||||
$result = $a->data['upload_result'];
|
||||
global $js_upload_result;
|
||||
|
||||
$result = $js_upload_result;
|
||||
|
||||
$b['src'] = $result['path'];
|
||||
$b['filename'] = $result['filename'];
|
||||
|
@ -76,9 +83,11 @@ function js_upload_post_file(App $a, &$b)
|
|||
|
||||
function js_upload_post_end(App $a, &$b)
|
||||
{
|
||||
global $js_upload_jsonresponse;
|
||||
|
||||
Logger::log('upload_post_end');
|
||||
if (!empty($a->data['upload_jsonresponse'])) {
|
||||
echo $a->data['upload_jsonresponse'];
|
||||
if (!empty($js_upload_jsonresponse)) {
|
||||
echo $js_upload_jsonresponse;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue