X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=dav%2Ffriendica%2Fmain.php;h=2534ce9c104cc4451f9c069cf3b2c6b9ac8e9745;hb=f8c162cbfb777793891f885e019eb8eae319dce1;hp=f0af57c91727ef5924067805b739b9602ea20c31;hpb=575a285951f7fa0908177c873d00fe8879dd0ba2;p=friendica-addons.git diff --git a/dav/friendica/main.php b/dav/friendica/main.php index f0af57c9..2534ce9c 100644 --- a/dav/friendica/main.php +++ b/dav/friendica/main.php @@ -1,5 +1,7 @@ get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200); + $x = wdcal_printCalendar($cals, [], $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200); } } } catch (DAVVersionMismatchException $e) { - $x = t("The current version of this plugin has not been set up correctly. Please contact the system administrator of your installation of friendica to fix this."); + $x = L10n::t("The current version of this addon has not been set up correctly. Please contact the system administrator of your installation of friendica to fix this."); } return $x; } @@ -238,12 +240,12 @@ function dav_event_updated_hook(&$a, &$b) */ function dav_profile_tabs_hook(&$a, &$b) { - $b["tabs"][] = array( - "label" => t('Calendar'), + $b["tabs"][] = [ + "label" => L10n::t('Calendar'), "url" => $a->get_baseurl() . "/dav/wdcal/", "sel" => "", - "title" => t('Extended calendar with CalDAV-support'), - ); + "title" => L10n::t('Extended calendar with CalDAV-support'), + ]; } @@ -261,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: @@ -274,20 +276,20 @@ 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%!
\n
\nThe event \"%event%\" is about to begin:
\n%url%"); - $params = array( + $params = [ 'fromName' => FRIENDICA_PLATFORM, - 'fromEmail' => t('noreply') . '@' . $a->get_hostname(), - 'replyTo' => t('noreply') . '@' . $a->get_hostname(), + 'fromEmail' => L10n::t('noreply') . '@' . $a->get_hostname(), + 'replyTo' => L10n::t('noreply') . '@' . $a->get_hostname(), 'toEmail' => $user["email"], - 'messageSubject' => t("Notification: " . $event[0]["Summary"]), + 'messageSubject' => L10n::t("Notification: " . $event[0]["Summary"]), 'htmlVersion' => $text_html, 'textVersion' => $text_text, 'additionalMailHeader' => "", - ); + ]; Emailer::send($params); } break; @@ -301,24 +303,24 @@ function dav_cron(&$a, &$b) * @param App $a * @param null|object $o */ -function dav_plugin_admin_post(&$a = null, &$o = null) +function dav_addon_admin_post(&$a = null, &$o = null) { - check_form_security_token_redirectOnErr('/admin/plugins/dav', 'dav_admin_save'); + check_form_security_token_redirectOnErr('/admin/addons/dav', 'dav_admin_save'); dav_include_files(); require_once(__DIR__ . "/database-init.inc.php"); if (isset($_REQUEST["install"])) { $errs = dav_create_tables(); - if (count($errs) == 0) info(t('The database tables have been installed.') . EOL); - else notice(t("An error occurred during the installation.") . EOL); + if (count($errs) == 0) info(L10n::t('The database tables have been installed.') . EOL); + else notice(L10n::t("An error occurred during the installation.") . EOL); } if (isset($_REQUEST["upgrade"])) { $errs = dav_upgrade_tables(); if (count($errs) == 0) { renderAllCalDavEntries(); - info(t('The database tables have been updated.') . EOL); - } else notice(t("An error occurred during the update.") . EOL); + info(L10n::t('The database tables have been updated.') . EOL); + } else notice(L10n::t("An error occurred during the update.") . EOL); } } @@ -326,7 +328,7 @@ function dav_plugin_admin_post(&$a = null, &$o = null) * @param App $a * @param string $o */ -function dav_plugin_admin(&$a, &$o) +function dav_addon_admin(&$a, &$o) { dav_include_files(); require_once(__DIR__ . "/database-init.inc.php"); @@ -334,31 +336,31 @@ function dav_plugin_admin(&$a, &$o) $dbstatus = dav_check_tables(); $o = ''; - $o .= '' . t("No system-wide settings yet.") . '

'; + $o .= '' . L10n::t("No system-wide settings yet.") . '

'; - $o .= '

' . t('Database status') . '

'; + $o .= '

' . L10n::t('Database status') . '

'; switch ($dbstatus) { case 0: - $o .= t('Installed'); + $o .= L10n::t('Installed'); break; case 1: case 2: - $o .= "" . t('Upgrade needed') . "
" . t("Please back up all calendar data (the tables beginning with dav_*) before proceeding. While all calendar events should 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.") . "

"; + $o .= "" . L10n::t('Upgrade needed') . "
" . L10n::t("Please back up all calendar data (the tables beginning with dav_*) before proceeding. While all calendar events should 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.") . "

"; break; case -1: - $o .= t('Not installed') . "

"; + $o .= L10n::t('Not installed') . "

"; break; case -2: default: - $o .= t('Unknown') . "

" . t("Something really went wrong. I cannot recover from this state automatically, sorry. Please go to the database backend, back up the data, and delete all tables beginning with 'dav_' manually. Afterwards, this installation routine should be able to reinitialize the tables automatically."); + $o .= L10n::t('Unknown') . "

" . L10n::t("Something really went wrong. I cannot recover from this state automatically, sorry. Please go to the database backend, back up the data, and delete all tables beginning with 'dav_' manually. Afterwards, this installation routine should be able to reinitialize the tables automatically."); break; } $o .= "

"; - $o .= "

" . t("Troubleshooting") . "

"; - $o .= "

" . t("Manual creation of the database tables:") . "

"; - $o .= "" . t("Show SQL-statements") . "