From 7b2b81dd0f38354b2025ec2d4d147b913b31bc8b Mon Sep 17 00:00:00 2001 From: Git Date: Thu, 17 Oct 2013 08:00:50 +0000 Subject: [PATCH] Empty commit --- classes/forums.class.php | 4 +- classes/notificationsmanager.class.php | 152 ++-- classes/notificationsmanagerview.class.php | 36 +- classes/view.class.php | 2 +- design/privatefooter.php | 9 +- design/privateheader.php | 41 +- docs/CHANGES.txt | 6 + sections/rules/ratio.php | 24 +- static/functions/user_notifications.js | 50 +- static/functions/user_settings.js | 8 +- .../opendyslexic/fonts/OpenDyslexic-Bold.otf | Bin 35572 -> 48996 bytes .../fonts/OpenDyslexic-BoldItalic.otf | Bin 59204 -> 75084 bytes .../fonts/OpenDyslexic-Italic.otf | Bin 58264 -> 71876 bytes .../fonts/OpenDyslexic-Regular.otf | Bin 43212 -> 46464 bytes .../fonts/OpenDyslexicMono-Regular.otf | Bin 0 -> 53888 bytes .../fonts/opendyslexic-bold-webfont.eot | Bin 24418 -> 21052 bytes .../fonts/opendyslexic-bold-webfont.svg | 452 +++++----- .../fonts/opendyslexic-bold-webfont.ttf | Bin 49620 -> 40076 bytes .../fonts/opendyslexic-bold-webfont.woff | Bin 27964 -> 24608 bytes .../fonts/opendyslexic-bolditalic-webfont.eot | Bin 42880 -> 39976 bytes .../fonts/opendyslexic-bolditalic-webfont.svg | 452 +++++----- .../fonts/opendyslexic-bolditalic-webfont.ttf | Bin 84144 -> 73928 bytes .../opendyslexic-bolditalic-webfont.woff | Bin 48900 -> 44852 bytes .../fonts/opendyslexic-italic-webfont.eot | Bin 37040 -> 35448 bytes .../fonts/opendyslexic-italic-webfont.svg | 641 +++++++++----- .../fonts/opendyslexic-italic-webfont.ttf | Bin 72352 -> 65920 bytes .../fonts/opendyslexic-italic-webfont.woff | Bin 40604 -> 38992 bytes .../fonts/opendyslexic-regular-webfont.eot | Bin 22476 -> 20631 bytes .../fonts/opendyslexic-regular-webfont.svg | 822 +++++++++++++----- .../fonts/opendyslexic-regular-webfont.ttf | Bin 47700 -> 40644 bytes .../fonts/opendyslexic-regular-webfont.woff | Bin 25988 -> 24080 bytes .../opendyslexicmono-regular-webfont.eot | Bin 0 -> 26857 bytes .../opendyslexicmono-regular-webfont.svg | 243 ++++++ .../opendyslexicmono-regular-webfont.ttf | Bin 0 -> 53204 bytes .../opendyslexicmono-regular-webfont.woff | Bin 0 -> 31128 bytes static/styles/opendyslexic/style.css | 104 ++- 36 files changed, 1972 insertions(+), 1074 deletions(-) create mode 100644 static/styles/opendyslexic/fonts/OpenDyslexicMono-Regular.otf create mode 100644 static/styles/opendyslexic/fonts/opendyslexicmono-regular-webfont.eot create mode 100644 static/styles/opendyslexic/fonts/opendyslexicmono-regular-webfont.svg create mode 100644 static/styles/opendyslexic/fonts/opendyslexicmono-regular-webfont.ttf create mode 100644 static/styles/opendyslexic/fonts/opendyslexicmono-regular-webfont.woff diff --git a/classes/forums.class.php b/classes/forums.class.php index f29e12b8..aebb5556 100644 --- a/classes/forums.class.php +++ b/classes/forums.class.php @@ -259,7 +259,9 @@ public static function get_last_read($Forums) { * @return boolean */ public static function add_topic_note($TopicID, $Note, $UserID = null) { - $UserID = $UserID ?: G::$LoggedUser['ID']; + if ($UserID === null) { + $UserID = G::$LoggedUser['ID']; + } $QueryID = G::$DB->get_query_id(); G::$DB->query("INSERT INTO forums_topic_notes (TopicID, AuthorID, AddedTime, Body) VALUES ($TopicID, $UserID, '" . sqltime() . "', '" . db_string($Note) . "')"); G::$DB->set_query_id($QueryID); diff --git a/classes/notificationsmanager.class.php b/classes/notificationsmanager.class.php index b27505a8..82c84dbb 100644 --- a/classes/notificationsmanager.class.php +++ b/classes/notificationsmanager.class.php @@ -1,98 +1,103 @@ "information", - "critical" => "error", - "warning" => "warning", - "info" => "confirmation"); + 'important' => self::IMPORTANT, + 'critical' => self::CRITICAL, + 'warning' => self::WARNING, + 'info' => self::INFO); // Types. These names must correspond to column names in users_notifications_settings - const NEWS = "News"; - const BLOG = "Blog"; - const STAFFBLOG = "StaffBlog"; - const STAFFPM = "StaffPM"; - const INBOX = "Inbox"; - const QUOTES = "Quotes"; - const SUBSCRIPTIONS = "Subscriptions"; - const TORRENTS = "Torrents"; - const COLLAGES = "Collages"; - const SITEALERTS = "SiteAlerts"; - const FORUMALERTS = "ForumAlerts"; - const REQUESTALERTS = "RequestAlerts"; - const COLLAGEALERTS = "CollageAlerts"; - const TORRENTALERTS = "TorrentAlerts"; - const GLOBALNOTICE = "Global"; - + const NEWS = 'News'; + const BLOG = 'Blog'; + const STAFFBLOG = 'StaffBlog'; + const STAFFPM = 'StaffPM'; + const INBOX = 'Inbox'; + const QUOTES = 'Quotes'; + const SUBSCRIPTIONS = 'Subscriptions'; + const TORRENTS = 'Torrents'; + const COLLAGES = 'Collages'; + const SITEALERTS = 'SiteAlerts'; + const FORUMALERTS = 'ForumAlerts'; + const REQUESTALERTS = 'RequestAlerts'; + const COLLAGEALERTS = 'CollageAlerts'; + const TORRENTALERTS = 'TorrentAlerts'; + const GLOBALNOTICE = 'Global'; public static $Types = array( - "News", - "Blog", - "StaffPM", - "Inbox", - "Quotes", - "Subscriptions", - "Torrents", - "Collages", - "SiteAlerts", - "ForumAlerts", - "RequestAlerts", - "CollageAlerts", - "TorrentAlerts"); + 'News', + 'Blog', + 'StaffPM', + 'Inbox', + 'Quotes', + 'Subscriptions', + 'Torrents', + 'Collages', + 'SiteAlerts', + 'ForumAlerts', + 'RequestAlerts', + 'CollageAlerts', + 'TorrentAlerts'); private $UserID; private $Notifications; private $Settings; + private $Skipped; function __construct($UserID, $Skip = array(), $Load = true, $AutoSkip = true) { $this->UserID = $UserID; $this->Notifications = array(); $this->Settings = self::get_settings($UserID); + $this->Skipped = $Skip; if ($AutoSkip) { foreach ($this->Settings as $Key => $Value) { // Skip disabled and traditional settings - if ($Value == 0 || $Value == 2) { - $Skip[] = $Key; + if ($Value == self::OPT_DISABLED || $Value == self::OPT_TRADITIONAL) { + $this->Skipped[$Key] = true; } } } if ($Load) { $this->load_global_notification(); - if (!in_array(self::NEWS, $Skip)) { + if (!isset($this->Skipped[self::NEWS])) { $this->load_news(); } - if (!in_array(self::BLOG, $Skip)) { + if (!isset($this->Skipped[self::BLOG])) { $this->load_blog(); } - // if (!in_array(self::STAFFBLOG, $Skip)) { + // if (!isset($this->Skipped[self::STAFFBLOG])) { // $this->load_staff_blog(); // } - if (!in_array(self::STAFFPM, $Skip)) { + if (!isset($this->Skipped[self::STAFFPM])) { $this->load_staff_pms(); } - if (!in_array(self::INBOX, $Skip)) { + if (!isset($this->Skipped[self::INBOX])) { $this->load_inbox(); } - if (!in_array(self::TORRENTS, $Skip)) { + if (!isset($this->Skipped[self::TORRENTS])) { $this->load_torrent_notifications(); } - if (!in_array(self::COLLAGES, $Skip)) { + if (!isset($this->Skipped[self::COLLAGES])) { $this->load_collage_subscriptions(); } - if (!in_array(self::QUOTES, $Skip)) { + if (!isset($this->Skipped[self::QUOTES])) { $this->load_quote_notifications(); } - if (!in_array(self::SUBSCRIPTIONS, $Skip)) { + if (!isset($this->Skipped[self::SUBSCRIPTIONS])) { $this->load_subscriptions(); } - $this->load_one_reads(); - + // $this->load_one_reads(); // The code that sets these notices is commented out. } } @@ -106,7 +111,11 @@ public function clear_notifications_array() { } private function create_notification($Type, $ID, $Message, $URL, $Importance) { - $this->Notifications[$Type] = array("contents" => array("id" => (int) $ID, "message" => $Message, "url" => $URL, "importance" => $Importance)); + $this->Notifications[$Type] = array( + 'id' => (int)$ID, + 'message' => $Message, + 'url' => $URL, + 'importance' => $Importance); } public static function notify_user($UserID, $Type, $Message, $URL, $Importance) { @@ -191,7 +200,7 @@ public function load_global_notification() { if ($GlobalNotification) { $Read = G::$Cache->get_value('user_read_global_' . G::$LoggedUser['ID']); if (!$Read) { - $this->create_notification(self::GLOBALNOTICE, null, $GlobalNotification['Message'], $GlobalNotification['URL'], $GlobalNotification['Importance']); + $this->create_notification(self::GLOBALNOTICE, 0, $GlobalNotification['Message'], $GlobalNotification['URL'], $GlobalNotification['Importance']); } } } @@ -304,7 +313,7 @@ public function load_staff_blog() { G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600); } if ($SBlogReadTime < $LatestSBlogTime) { - $this->create_notification(self::STAFFBLOG, '', 'New Staff Blog Post!', 'staffblog.php', self::IMPORTANT); + $this->create_notification(self::STAFFBLOG, 0, 'New Staff Blog Post!', 'staffblog.php', self::IMPORTANT); } } } @@ -325,7 +334,7 @@ public function load_staff_pms() { if ($NewStaffPMs > 0) { $Title = 'You have new ' . ($NewStaffPMs == 1 ? 'a' : $NewStaffPMs) . ' Staff PM' . ($NewStaffPMs > 1 ? 's' : ''); - $this->create_notification(self::STAFFPM, '', $Title, 'staffpm.php', self::INFO); + $this->create_notification(self::STAFFPM, 0, $Title, 'staffpm.php', self::INFO); } } @@ -346,7 +355,7 @@ public function load_inbox() { if ($NewMessages > 0) { $Title = 'You have ' . ($NewMessages == 1 ? 'a' : $NewMessages) . ' new message' . ($NewMessages > 1 ? 's' : ''); - $this->create_notification(self::INBOX, '', $Title, Inbox::get_inbox_link(), self::INFO); + $this->create_notification(self::INBOX, 0, $Title, Inbox::get_inbox_link(), self::INFO); } } @@ -367,7 +376,7 @@ public function load_torrent_notifications() { } if ($NewNotifications > 0) { $Title = 'You have ' . ($NewNotifications == 1 ? 'a' : $NewNotifications) . ' new torrent notification' . ($NewNotifications > 1 ? 's' : ''); - $this->create_notification(self::TORRENTS, '', $Title, 'torrents.php?action=notify', self::INFO); + $this->create_notification(self::TORRENTS, 0, $Title, 'torrents.php?action=notify', self::INFO); } } @@ -390,7 +399,7 @@ public function load_collage_subscriptions() { } if ($NewCollages > 0) { $Title = 'You have ' . ($NewCollages == 1 ? 'a' : $NewCollages) . ' new collage update' . ($NewCollages > 1 ? 's' : ''); - $this->create_notification(self::COLLAGES, '', $Title, 'userhistory.php?action=subscribed_collages', self::INFO); + $this->create_notification(self::COLLAGES, 0, $Title, 'userhistory.php?action=subscribed_collages', self::INFO); } } } @@ -400,7 +409,7 @@ public function load_quote_notifications() { $QuoteNotificationsCount = Subscriptions::has_new_quote_notifications(); if ($QuoteNotificationsCount > 0) { $Title = 'New quote' . ($QuoteNotificationsCount > 1 ? 's' : ''); - $this->create_notification(self::QUOTES, null, $Title, 'userhistory.php?action=quote_notifications', self::INFO); + $this->create_notification(self::QUOTES, 0, $Title, 'userhistory.php?action=quote_notifications', self::INFO); } } } @@ -409,12 +418,10 @@ public function load_subscriptions() { $SubscriptionsCount = Subscriptions::has_new_subscriptions(); if ($SubscriptionsCount > 0) { $Title = 'New subscription' . ($SubscriptionsCount > 1 ? 's' : ''); - $this->create_notification(self::SUBSCRIPTIONS, null, $Title, 'userhistory.php?action=subscriptions', self::INFO); + $this->create_notification(self::SUBSCRIPTIONS, 0, $Title, 'userhistory.php?action=subscriptions', self::INFO); } } - - public static function clear_news($News) { $QueryID = G::$DB->get_query_id(); if (!$News) { @@ -590,6 +597,8 @@ public static function clear_subscriptions() { G::$DB->set_query_id($QueryID); } +/* + // TODO: Figure out what these functions are supposed to do and fix them public static function send_notification($UserID, $ID, $Type, $Message, $URL, $Importance = 'alert', $AutoExpire = false) { $Notifications = G::$Cache->get_value("user_cache_notifications_$UserID"); if (empty($Notifications)) { @@ -599,7 +608,6 @@ public static function send_notification($UserID, $ID, $Type, $Message, $URL, $I G::$Cache->cache_value("user_cache_notifications_$UserID", $Notifications, 0); } - public static function clear_notification($UserID, $Index) { $Notifications = G::$Cache->get_value("user_cache_notifications_$UserID"); if (count($Notifications)) { @@ -608,6 +616,7 @@ public static function clear_notification($UserID, $Index) { G::$Cache->cache_value("user_cache_notifications_$UserID", $Notifications, 0); } } +*/ public static function get_settings($UserID) { $Results = G::$Cache->get_value("users_notifications_settings_$UserID"); @@ -630,15 +639,14 @@ public static function save_settings($UserID, $Settings) { $Settings = array_intersect_key($_POST, array_flip(preg_grep('/^notifications_/', array_keys($_POST)))); } $Update = array(); - $Types = self::$Types; - foreach ($Types as $Type) { + foreach (self::$Types as $Type) { $Popup = array_key_exists("notifications_$Type" . '_popup', $Settings); $Traditional = array_key_exists("notifications_$Type" . '_traditional', $Settings); - $Result = 0; + $Result = self::OPT_DISABLED; if ($Popup) { - $Result = 1; + $Result = self::OPT_POPUP; } elseif ($Traditional) { - $Result = 2; + $Result = self::OPT_TRADITIONAL; } $Update[] = "$Type = $Result"; } @@ -654,6 +662,14 @@ public static function save_settings($UserID, $Settings) { } public function is_traditional($Type) { - return $this->Settings[$Type] == 2; + return $this->Settings[$Type] == self::OPT_TRADITIONAL; + } + + public function is_skipped($Type) { + return isset($this->Skipped[$Type]); + } + + public function use_noty() { + return in_array(self::OPT_POPUP, $this->Settings); } } diff --git a/classes/notificationsmanagerview.class.php b/classes/notificationsmanagerview.class.php index 504848ef..69efe6c3 100644 --- a/classes/notificationsmanagerview.class.php +++ b/classes/notificationsmanagerview.class.php @@ -4,15 +4,19 @@ class NotificationsManagerView { private static $Settings; public static function load_js() { + $JSIncludes = array( + 'noty/noty.js', + 'noty/layouts/bottomRight.js', + 'noty/themes/default.js', + 'user_notifications.js'); + foreach ($JSIncludes as $JSInclude) { + $Path = STATIC_SERVER."functions/$JSInclude"; ?> - - - - + @@ -126,27 +130,27 @@ public static function render_settings($Settings) { - /> - + - name="notifications__popup" id="notifications__popup" /> - + ' . $Contents['message'] . ''; + return "$Contents[message]"; } } diff --git a/classes/view.class.php b/classes/view.class.php index 047e3a5c..c8e9f774 100644 --- a/classes/view.class.php +++ b/classes/view.class.php @@ -42,7 +42,7 @@ public static function show_header($PageTitle = '', $JSIncludes = '', $CSSInclud * ['disclaimer'] = [boolean] (False) Displays the disclaimer in the footer */ public static function show_footer($Options = array()) { - global $ScriptStartTime, $SessionID, $UserSessions, $Debug, $Time; + global $ScriptStartTime, $SessionID, $UserSessions, $Debug, $Time, $Mobile; if (!is_array(G::$LoggedUser)) { require(SERVER_ROOT.'/design/publicfooter.php'); } else { diff --git a/design/privatefooter.php b/design/privatefooter.php index 0e5a3d97..5338d013 100644 --- a/design/privatefooter.php +++ b/design/privatefooter.php @@ -54,7 +54,14 @@ - +
diff --git a/design/privateheader.php b/design/privateheader.php index 6e86ac18..5ac1eb28 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -147,7 +147,6 @@ styles/mobile/style.js" type="text/javascript"> get_notifications(); +$UseNoty = $NotificationsManager->use_noty(); +$NewSubscriptions = false; +$NotificationSpans = array(); +foreach ($Notifications as $Type => $Notification) { + if ($Type === NotificationsManager::SUBSCRIPTIONS) { + $NewSubscriptions = true; + } + if ($UseNoty) { + $NotificationSpans[] = "$Notification[message]"; + } +} +if ($UseNoty && !empty($NotificationSpans)) { + NotificationsManagerView::load_js(); +} +if ($NotificationsManager->is_skipped(NotificationsManager::SUBSCRIPTIONS)) { + $NewSubscriptions = Subscriptions::has_new_subscriptions(); +} ?> @@ -233,7 +254,7 @@ -