]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Profile/Schedule.php
Remove VCard for owner in Profile\Photos module
[friendica.git] / src / Module / Profile / Schedule.php
index ae76c57f1d1fc43f296630f44a1385f98a39f62a..10dd5339f8cd3fb5b48c2a5110a74caf6c3eb6e0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -29,12 +29,13 @@ use Friendica\DI;
 use Friendica\Model\Post;
 use Friendica\Module\BaseProfile;
 use Friendica\Network\HTTPException;
+use Friendica\Util\DateTimeFormat;
 
 class Schedule extends BaseProfile
 {
-       public static function post(array $parameters = [])
+       protected function post(array $request = [])
        {
-               if (!local_user()) {
+               if (!DI::userSession()->getLocalUserId()) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
                }
 
@@ -42,25 +43,25 @@ class Schedule extends BaseProfile
                        throw new HTTPException\BadRequestException();
                }
 
-               if (!DBA::exists('delayed-post', ['id' => $_REQUEST['delete'], 'uid' => local_user()])) {
+               if (!DBA::exists('delayed-post', ['id' => $_REQUEST['delete'], 'uid' => DI::userSession()->getLocalUserId()])) {
                        throw new HTTPException\NotFoundException();
                }
 
                Post\Delayed::deleteById($_REQUEST['delete']);
        }
 
-       public static function content(array $parameters = [])
+       protected function content(array $request = []): string
        {
-               if (!local_user()) {
+               if (!DI::userSession()->getLocalUserId()) {
                        throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
                }
 
                $a = DI::app();
 
-               $o = self::getTabsHTML($a, 'schedule', true, $a->user);
+               $o = self::getTabsHTML('schedule', true, $a->getLoggedInUserNickname(), false);
 
                $schedule = [];
-               $delayed = DBA::select('delayed-post', [], ['uid' => local_user()]);
+               $delayed = DBA::select('delayed-post', [], ['uid' => DI::userSession()->getLocalUserId()]);
                while ($row = DBA::fetch($delayed)) {
                        $parameter = Post\Delayed::getParametersForid($row['id']);
                        if (empty($parameter)) {
@@ -68,7 +69,7 @@ class Schedule extends BaseProfile
                        }
                        $schedule[] = [
                                'id'           => $row['id'],
-                               'scheduled_at' => $row['delayed'],
+                               'scheduled_at' => DateTimeFormat::local($row['delayed']),
                                'content'      => BBCode::toPlaintext($parameter['item']['body'], false)
                        ];
                }
@@ -79,7 +80,7 @@ class Schedule extends BaseProfile
                        '$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"),
                        '$baseurl'             => DI::baseUrl()->get(true),
                        '$title'               => DI::l10n()->t('Scheduled Posts'),
-                       '$nickname'            => $parameters['nickname'] ?? '',
+                       '$nickname'            => $this->parameters['nickname'] ?? '',
                        '$scheduled_at'        => DI::l10n()->t('Scheduled'),
                        '$content'             => DI::l10n()->t('Content'),
                        '$delete'              => DI::l10n()->t('Remove post'),