]> git.mxchange.org Git - friendica-addons.git/blobdiff - dav/friendica/main.php
Addons hadn't been changed for the moved emailer class
[friendica-addons.git] / dav / friendica / main.php
index 712b6c7b84da57ba8ffa9ba5c29ee505c69a2138..006dce957f1212f9c97b39a46cd53e583cf0ebb0 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+use Friendica\Util\Emailer;
 
 require_once('include/security.php');
 
@@ -159,7 +160,7 @@ function dav_content()
                                if ($a->argv[2] == "new") {
                                        $o = "";
                                        if (isset($_REQUEST["save"])) {
-                                               check_form_security_token_redirectOnErr($a->get_baseurl() . "/dav/wdcal/", "caledit");
+                                               check_form_security_token_redirectOnErr("/dav/wdcal/", "caledit");
                                                $ret = wdcal_postEditPage("new", "", $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
                                                if ($ret["ok"]) notice($ret["msg"]);
                                                else info($ret["msg"]);
@@ -177,7 +178,7 @@ function dav_content()
                                                if (isset($a->argv[4]) && $a->argv[4] == "edit") {
                                                        $o = "";
                                                        if (isset($_REQUEST["save"])) {
-                                                               check_form_security_token_redirectOnErr($a->get_baseurl() . "/dav/wdcal/", "caledit");
+                                                               check_form_security_token_redirectOnErr("/dav/wdcal/", "caledit");
                                                                $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"]);
@@ -253,6 +254,7 @@ function dav_cron(&$a, &$b)
        dav_include_files();
 
        $r = q("SELECT * FROM %s%snotifications WHERE `notified` = 0 AND `alert_date` <= NOW()", CALDAV_SQL_DB, CALDAV_SQL_PREFIX);
+    if (is_array($r)) {
        foreach ($r as $not) {
                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"]);
@@ -284,12 +286,12 @@ function dav_cron(&$a, &$b)
                                                'textVersion'          => $text_text,
                                                'additionalMailHeader' => "",
                                        );
-                                       require_once('include/enotify.php');
-                                       enotify::send($params);
+                                       Emailer::send($params);
                                }
                                break;
                }
        }
+    }
 }
 
 
@@ -339,6 +341,7 @@ function dav_plugin_admin(&$a, &$o)
                        $o .= t('Installed');
                        break;
                case 1:
+               case 2:
                        $o .= "<strong>" . t('Upgrade needed') . "</strong><br>" . t("Please back up all calendar data (the tables beginning with dav_*) before proceeding. While all calendar events <i>should</i> be converted to the new database structure, it's always safe to have a backup. Below, you can have a look at the database-queries that will be made when pressing the 'update'-button.") . "<br><br><input type='submit' name='upgrade' value='" . t('Upgrade') . "'>";
                        break;
                case -1:
@@ -355,8 +358,8 @@ function dav_plugin_admin(&$a, &$o)
        $o .= "<h4>" . t("Manual creation of the database tables:") . "</h4>";
        $o .= "<a href='#' onClick='\$(\"#sqlstatements\").show(); return false;'>" . t("Show SQL-statements") . "</a><blockquote style='display: none;' id='sqlstatements'><pre>";
        switch ($dbstatus) {
-               case 1:
-                       $tables = dav_get_update_statements(1);
+               case 1: case 2:
+                       $tables = dav_get_update_statements($dbstatus);
                        foreach ($tables as $t) $o .= escape_tags($t . ";\n\n");
                        break;
                default: