Permalink
Browse files

Breeze 1.0 Beta 2

-Buddy system
-Notification system
-UI improvements
-JavaScript improvements
  • Loading branch information...
MissAllSunday committed Mar 16, 2012
1 parent 9f0d1a3 commit 98d0488ab826836b5405bc331d97295340a874fe
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is, the main file, handles the hooks, the actions, permissions, load needed files, etc.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is, a procedural set of functions that handles the admin pages for Breeze
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is to replace the default buddy action in SMF with one that provides more functionality.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -90,16 +90,16 @@ public static function Buddy()
$sa->Raw('u')
);
- /* Load all the members up. */
- loadMemberData($user_load, false, 'profile');
+ /* Load all the members up. */
+ loadMemberData($user_load, false, 'profile');
- /* Setup the context for each buddy. */
- $temp_users_load = array();
- foreach ($user_load as $buddy)
- {
- loadMemberContext($buddy);
- $temp_users_load[$buddy] = $memberContext[$buddy];
- }
+ /* Setup the context for each buddy. */
+ $temp_users_load = array();
+ foreach ($user_load as $buddy)
+ {
+ loadMemberContext($buddy);
+ $temp_users_load[$buddy] = $memberContext[$buddy];
+ }
$params = array(
'user' => $sa->Raw('u'),
@@ -110,7 +110,8 @@ public static function Buddy()
'message' => sprintf($settings->GetText('buddy_messagerequest_message'), $temp_users_load[$user_info['id']]['link']),
'url' => $scripturl .'?action=profile;area=breezebuddies;u='. $sa->Raw('u'),
'from_link' => $temp_users_load[$user_info['id']]['link'],
- 'from_id' => $user_info['id']
+ 'from_id' => $user_info['id'],
+ 'from_buddies' => $user_info['buddies']
)
);
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is to perform the queries made by breeze, it only executes, no logic here.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -5,7 +5,7 @@
*
* The purpose of this file is to create proper html based on the type and the info it got.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -5,7 +5,7 @@
*
* The purpose of this file is to show a general wall where user can see tatus and updates from other users or buddies
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -5,7 +5,7 @@
*
* The purpose of this file is
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -61,7 +61,7 @@ public function __construct($var)
public function See($value)
{
- if (isset($this->request[$value]) && $this->Validate($this->request[$value]))
+ if ($this->Validate($value))
return $this->Sanitize($this->request[$value]);
else
return 'error_' . $value;
@@ -78,7 +78,7 @@ public function Raw($value)
public function Validate($var)
{
- if (!empty($var))
+ if (isset($this->request[$var]))
return true;
else
return false;
@@ -5,7 +5,7 @@
*
* The purpose of this file is to show all the current, enable modules for the users.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -5,7 +5,7 @@
*
* The purpose of this file is to fetch all notifications for X user
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -69,11 +69,26 @@ function __construct()
public function Create($params)
{
+ global $user_info;
+
+ /* Set this as false by default */
+ $double_request = false;
+
/* if the type is buddy then let's do a check to avoid duplicate entries */
- /* if (!empty($params) && in_array($params['type'], $this->types) && $params['type'] == $this->types['buddy']) */
-
-
if (!empty($params) && in_array($params['type'], $this->types))
+ {
+ /* Load all the Notifications */
+ $temp = $this->query->GetNotifications();
+
+ foreach ($temp as $t)
+ if ($t['user'] == $params['user'] && $t['content']->from_id == $user_info['id'])
+ $double_request = true;
+ }
+
+ if ($double_request)
+ fatal_lang_error('BreezeMod_buddyrequest_error_doublerequest', false);
+
+ elseif (!empty($params) && in_array($params['type'], $this->types) && !$double_request)
{
$this->params = $params;
$this->query->InsertNotification($this->params);
@@ -5,7 +5,7 @@
*
* The purpose of this file is to create a pagination from an array of items
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is to identify something in a tezt string and convert that to something different, for example, a url into an actual html link.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is to have all queries made by this mod in a single place, probably the most important file and the biggest one too.
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
@@ -91,7 +91,7 @@ public static function getInstance()
* Cleans the old cache value
*
* Disclaimer: Killing in breeze world means replace the existing cache data with a null value so SMF generates a new cache...
- * @access private
+ * @access public
* @param mixed $type the name of value(s) to be deleted
* @return void
*/
@@ -926,7 +926,7 @@ protected function Notifications()
/* Populate the array like a boss! */
while ($row = $smcFunc['db_fetch_assoc']($result))
{
- $this->Notifications[$row['user']] = array(
+ $this->Notifications[$row['id']] = array(
'id' => $row['id'],
'user' => $row['user'],
'type' => $row['type'],
@@ -943,6 +943,11 @@ protected function Notifications()
return $this->Notifications;
}
+ public function GetNotifications()
+ {
+ return $this->Notifications();
+ }
+
public function InsertNotification($array)
{
/* We dont need this anymore */
@@ -969,6 +974,9 @@ public function InsertNotification($array)
public function MarkAsReadNotification($id)
{
+ /* We dont need this anymore */
+ $this->KillCache('Notifications');
+
/* Mark as read */
$params = array(
'set' => 'read = {int:read}',
@@ -986,6 +994,9 @@ public function MarkAsReadNotification($id)
public function DeleteNotification($id)
{
+ /* We dont need this anymore */
+ $this->KillCache('Notifications');
+
/* Delete! */
$params = array(
'where' => 'id = {int:id}'
@@ -5,7 +5,7 @@
*
* The purpose of this file is to extract the settings and text strings from the SMF arrays for a better and cleaner handling
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
View
@@ -5,7 +5,7 @@
*
* The purpose of this file is to provide some tools used across the mod
* @package Breeze mod
- * @version 1.0 Beta 1
+ * @version 1.0 Beta 2
* @author Jessica González <missallsunday@simplemachines.org>
* @copyright Copyright (c) 2012, Jessica González
* @license http://www.mozilla.org/MPL/MPL-1.1.html
Oops, something went wrong.

0 comments on commit 98d0488

Please sign in to comment.