mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 02:18:48 +00: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
|
@ -11,6 +11,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Object\EMail\IEmail;
|
||||
|
||||
|
@ -38,12 +39,12 @@ function securemail_install()
|
|||
*/
|
||||
function securemail_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = intval(DI::pConfig()->get(local_user(), 'securemail', 'enable'));
|
||||
$publickey = DI::pConfig()->get(local_user(), 'securemail', 'pkey');
|
||||
$enabled = intval(DI::pConfig()->get(Session::getLocalUser(), 'securemail', 'enable'));
|
||||
$publickey = DI::pConfig()->get(Session::getLocalUser(), 'securemail', 'pkey');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/securemail/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
|
@ -74,20 +75,20 @@ function securemail_settings(App &$a, array &$data)
|
|||
*/
|
||||
function securemail_settings_post(App &$a, array &$b)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($_POST['securemail-submit']) || !empty($_POST['securemail-test'])) {
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
|
||||
$enable = (!empty($_POST['securemail-enable']) ? 1 : 0);
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'enable', $enable);
|
||||
|
||||
if (!empty($_POST['securemail-test'])) {
|
||||
$res = DI::emailer()->send(new SecureTestEmail(DI::app(), DI::config(), DI::pConfig(), DI::baseUrl()));
|
||||
|
||||
// revert to saved value
|
||||
DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
|
||||
DI::pConfig()->set(Session::getLocalUser(), 'securemail', 'enable', $enable);
|
||||
|
||||
if ($res) {
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Test email sent'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue