]> git.mxchange.org Git - friendica-addons.git/blobdiff - dav/friendica/main.php
Merge branch '3.6-release'
[friendica-addons.git] / dav / friendica / main.php
index 0974696c502d8828e0333f70a6c70eb4f2c9f6c3..2534ce9c104cc4451f9c069cf3b2c6b9ac8e9745 100644 (file)
@@ -152,7 +152,7 @@ function dav_content()
 {
        $a = get_app();
        if (!isset($a->user["uid"]) || $a->user["uid"] == 0) {
-               return login();
+               return Login::form();
        }
 
        $x = "";
@@ -168,7 +168,7 @@ function dav_content()
                                                $ret = wdcal_postEditPage("new", "", $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
                                                if ($ret["ok"]) notice($ret["msg"]);
                                                else info($ret["msg"]);
-                                               goaway($a->get_baseurl() . "/dav/wdcal/");
+                                               goaway('dav/wdcal/');
                                        }
                                        $o .= wdcal_getNewPage();
                                        return $o;
@@ -186,7 +186,7 @@ function dav_content()
                                                                $ret = wdcal_postEditPage($a->argv[3], $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
                                                                if ($ret["ok"]) notice($ret["msg"]);
                                                                else info($ret["msg"]);
-                                                               goaway($a->get_baseurl() . "/dav/wdcal/");
+                                                               goaway('dav/wdcal/');
                                                        }
                                                        $o .= wdcal_getEditPage($calendar_id, $a->argv[3]);
                                                        return $o;
@@ -200,7 +200,7 @@ function dav_content()
                        } else {
                                $server = dav_create_server(true, true, false);
                                $cals   = dav_get_current_user_calendars($server, DAV_ACL_READ);
-                               $x      = wdcal_printCalendar($cals, array(), $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
+                               $x      = wdcal_printCalendar($cals, [], $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
                        }
                }
        } catch (DAVVersionMismatchException $e) {
@@ -263,7 +263,7 @@ function dav_cron(&$a, &$b)
                q("UPDATE %s%snotifications SET `notified` = 1 WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["id"]);
                $event    = q("SELECT * FROM %s%sjqcalendar WHERE `calendarobject_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendarobject_id"]);
                $calendar = q("SELECT * FROM %s%scalendars WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendar_id"]);
-               $users    = array();
+               $users    = [];
                if (count($calendar) != 1 || count($event) == 0) continue;
                switch ($calendar[0]["namespace"]) {
                        case CALDAV_NAMESPACE_PRIVATE:
@@ -276,11 +276,11 @@ function dav_cron(&$a, &$b)
                        case "email":
                        case "display": // @TODO implement "Display"
                                foreach ($users as $user) {
-                                       $find      = array("%to%", "%event%", "%url%");
-                                       $repl      = array($user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/");
+                                       $find      = ["%to%", "%event%", "%url%"];
+                                       $repl      = [$user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/"];
                                        $text_text = str_replace($find, $repl, "Hi %to%!\n\nThe event \"%event%\" is about to begin:\n%url%");
                                        $text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>");
-                                       $params    = array(
+                                       $params    = [
                                                'fromName'             => FRIENDICA_PLATFORM,
                                                'fromEmail'            => L10n::t('noreply') . '@' . $a->get_hostname(),
                                                'replyTo'              => L10n::t('noreply') . '@' . $a->get_hostname(),
@@ -289,8 +289,7 @@ function dav_cron(&$a, &$b)
                                                'htmlVersion'          => $text_html,
                                                'textVersion'          => $text_text,
                                                'additionalMailHeader' => "",
-                                       );
-                                       require_once('include/Emailer.php');
+                                       ];
                                        Emailer::send($params);
                                }
                                break;