From 907f39db4ab00de43016646660d9d1ca9c73d1f9 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Sat, 27 Jan 2024 13:05:41 +0100 Subject: initial commit --- admin.php | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 admin.php (limited to 'admin.php') diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..8e98db7 --- /dev/null +++ b/admin.php @@ -0,0 +1,216 @@ + +
+

CommuniEvents

+
+ +
+

 

  +

App-Informationen

+ + + + + + +
Benutzer: + user(); + if (!empty($user)) { + $url = $user->webappUrl(); + + if (!empty($url)) + echo ''; + + echo esc_html("{$user->name()} ({$user->id()})"); + + if (!empty($url)) + echo ''; + } else { + echo 'N/A (Zugangstoken falsch?)'; + } + ?> +
Hauptgruppe: + group(); + if (!empty($group)) { + $url = $group->webappUrl(); + + if (!empty($url)) + echo ''; + + echo esc_html("{$group->title()} ({$group->id()})"); + + if (!empty($url)) + echo ''; + } else { + echo 'N/A (Zugangstoken falsch?)'; + } + ?> +
Weitere Gruppen: + groups(); + $groups_html = array(); + foreach ($groups as $g) { + if ($g === $group) + continue; + + $html = ''; + $url = $g->webappUrl(); + + if (!empty($url)) + $html .= ''; + + $html .= esc_html("{$g->title()} ({$g->id()})"); + + if (!empty($url)) + $html .= ''; + + $groups_html[] = $html; + } + + echo implode(', ', $groups_html); + } + ?> +
CommuniApp: + webappUrl(); + if (!empty($url)) { + echo '' . esc_url($url) . ''; + } else { + echo 'N/A (Zugangstoken falsch?)'; + } + ?> +
+

 

  +

Synchronisation

+ prefix . 'communievents_events'; + + $evcount = $wpdb->get_var("SELECT COUNT(id) FROM $tablename", 0, 0); + $lastsync = $wpdb->get_var("SELECT MAX(lastsync) FROM $tablename", 0, 0); + $nextsync = wp_next_scheduled('communievents_cron_hook'); + + if ($lastsync) { + $lastsync_dt = new DateTime("@$lastsync"); + $lastsync_dt->setTimezone(wp_timezone()); + $lastsync_str = $lastsync_dt->format('Y-m-d H:i:s'); + } else { + $lastsync_str = "nie"; + } + + if ($nextsync) { + $nextsync_dt = new DateTime("@$nextsync"); + $nextsync_dt->setTimezone(wp_timezone()); + $nextsync_str = $nextsync_dt->format('Y-m-d H:i:s'); + } else { + $nextsync_str = "nie"; + } + ?> + + + + +
Anzahl Ereignisse: + +
Letzte Synchronisation: + +
Nächste Synchronisation: + +
+
+ + + + +
+
+

Das Token findest Du in deiner CommuniApp unter Admin BereichRest-Api

403)); + } + + check_admin_referer('communievents-admin-sync'); + + // disable output buffering so our headers_sent() trick works + while (ob_get_level() > 0) { + ob_end_flush(); + } + + communievents_scrape_events(); + + // no news is good news! unless the scraper did output something, + // immediately redirect to the admin page + if (!headers_sent()) { + header("Location: $_POST[backurl]"); + die(); + } + + ?> +

+ Bei der Synchronisierung ist ein Fehler aufgetreten! +

+
+ + + + +
+

+ Zurück +

+