mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 09:54:27 +02:00
Replace all functions from boot.php
This commit is contained in:
parent
5f1028a535
commit
5d8129600d
45 changed files with 577 additions and 535 deletions
|
@ -12,6 +12,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
function geonames_install()
|
||||
|
@ -48,11 +49,11 @@ function geonames_post_hook(App $a, array &$item)
|
|||
|
||||
Logger::notice('geonames invoked');
|
||||
|
||||
if (!local_user()) { /* non-zero if this is a logged in user of this system */
|
||||
if (!Session::getLocalUser()) { /* non-zero if this is a logged in user of this system */
|
||||
return;
|
||||
}
|
||||
|
||||
if (local_user() != $item['uid']) { /* Does this person own the post? */
|
||||
if (Session::getLocalUser() != $item['uid']) { /* Does this person own the post? */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,7 @@ function geonames_post_hook(App $a, array &$item)
|
|||
/* Retrieve our personal config setting */
|
||||
|
||||
$geo_account = DI::config()->get('geonames', 'username');
|
||||
$active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
|
||||
$active = DI::pConfig()->get(Session::getLocalUser(), 'geonames', 'enable');
|
||||
|
||||
if (!$geo_account || !$active) {
|
||||
return;
|
||||
|
@ -102,11 +103,11 @@ function geonames_post_hook(App $a, array &$item)
|
|||
*/
|
||||
function geonames_addon_settings_post(App $a, array $post)
|
||||
{
|
||||
if (!local_user() || empty($_POST['geonames-submit'])) {
|
||||
if (!Session::getLocalUser() || empty($_POST['geonames-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'geonames', 'enable', intval($_POST['geonames-enable']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +120,7 @@ function geonames_addon_settings_post(App $a, array $post)
|
|||
*/
|
||||
function geonames_addon_settings(App $a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,7 +129,7 @@ function geonames_addon_settings(App $a, array &$data)
|
|||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'geonames', 'enable'));
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/geonames/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue