use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Model\Notify;
use Friendica\Module\Security\Login;
+/** @var array Array of URL parameters */
+const URL_TYPES = [
+ Notify::NETWORK => 'network',
+ Notify::SYSTEM => 'system',
+ Notify::HOME => 'home',
+ Notify::PERSONAL => 'personal',
+ Notify::INTRO => 'intros',
+];
+
+/** @var array Array of the allowed notifies and their printable name */
+const PRINT_TYPES = [
+ Notify::NETWORK => 'Network',
+ Notify::SYSTEM => 'System',
+ Notify::HOME => 'Home',
+ Notify::PERSONAL => 'Personal',
+ Notify::INTRO => 'Introductions',
+];
+
+/** @var array The array of access keys for notify pages */
+const ACCESS_KEYS = [
+ Notify::NETWORK => 'w',
+ Notify::SYSTEM => 'y',
+ Notify::HOME => 'h',
+ Notify::PERSONAL => 'r',
+ Notify::INTRO => 'i',
+];
+
function notifications_post(App $a)
{
if (!local_user()) {
$o = '';
// Get the nav tabs for the notification pages
- $tabs = $nm->getTabs();
+ $tabs = getTabs($this->args->get(1, ''));
$notif_content = [];
$notif_nocontent = '';
return $o;
}
+
+/**
+ * List of pages for the Notifications TabBar
+ *
+ * @param string $selected The selected notification tab
+ *
+ * @return array with with notifications TabBar data
+ * @throws Exception
+ */
+function getTabs(string $selected = '')
+{
+ $tabs = [];
+
+ foreach (URL_TYPES as $type => $url) {
+ $tabs[] = [
+ 'label' => $this->l10n->t(PRINT_TYPES[$type]),
+ 'url' => 'notifications/' . $url,
+ 'sel' => (($selected == $url) ? 'active' : ''),
+ 'id' => $type . '-tab',
+ 'accesskey' => ACCESS_KEYS[$type],
+ ];
+ }
+
+ return $tabs;
+}
const HOME = 'home';
const INTRO = 'intro';
- /** @var array Array of URL parameters */
- const URL_TYPES = [
- self::NETWORK => 'network',
- self::SYSTEM => 'system',
- self::HOME => 'home',
- self::PERSONAL => 'personal',
- self::INTRO => 'intros',
- ];
-
- /** @var array Array of the allowed notifies and their printable name */
- const PRINT_TYPES = [
- self::NETWORK => 'Network',
- self::SYSTEM => 'System',
- self::HOME => 'Home',
- self::PERSONAL => 'Personal',
- self::INTRO => 'Introductions',
- ];
-
- /** @var array The array of access keys for notify pages */
- const ACCESS_KEYS = [
- self::NETWORK => 'w',
- self::SYSTEM => 'y',
- self::HOME => 'h',
- self::PERSONAL => 'r',
- self::INTRO => 'i',
- ];
-
/** @var Database */
private $dba;
/** @var L10n */
return $this->dba->update('notify', ['seen' => $seen], ['uid' => local_user()]);
}
- /**
- * List of pages for the Notifications TabBar
- *
- * @return array with with notifications TabBar data
- * @throws Exception
- */
- public function getTabs()
- {
- $selected = $this->args->get(1, '');
-
- $tabs = [];
-
- foreach (self::URL_TYPES as $type => $url) {
- $tabs[] = [
- 'label' => $this->l10n->t(self::PRINT_TYPES[$type]),
- 'url' => 'notifications/' . $url,
- 'sel' => (($selected == $url) ? 'active' : ''),
- 'id' => $type . '-tab',
- 'accesskey' => self::ACCESS_KEYS[$type],
- ];
- }
-
- return $tabs;
- }
-
/**
* Format the notification query in an usable array
*