Permalink
Browse files

Several bugs fixed ...I hope so...

-Breeze::Load accepts default SMF source files now
-Breeze_Ajax:
	Check session on all the actions
-Breeze_Display:
	Add the user visitor permissions
	Removed the parser
	Added some changes to the html
-Breeze_Globals
	Changed the sanitize method a bit
-Breeze_Pagination
	Missing $scripturl global
-Breeze_Query
	removed the parser
-js/breeze.js
	disable the send button on click to prevent double clicks
	hange .append() to .prepend() on the status display
-Breeze.template
	Changing the html to prevent nested list
	Removed some hardcoded text strings
  • Loading branch information...
1 parent d4d7281 commit 20ed8183ed5379026e3bbff4da586adad0f2f8ef @MissAllSunday committed Mar 8, 2012
View
@@ -52,23 +52,27 @@ public function __construct()
* An attempt to load the static method(s) used across the mod
*
* @todo Implement some checks before loading the file.
- * @param string $method When $method is a string it contains a single file name.
- * @param array $method a comma separated list of all the file names to be loaded.
+ * @param string $file When $file is a string it contains a single file name.
+ * @param array $file a comma separated list of all the file names to be loaded.
+ * @param bool $smf special case used when trying to load an SMF source file for some resource or function
* @return void
*/
- public static function Load($method)
+ public static function Load($file, $smf = false)
{
global $sourcedir;
- if (empty($method))
+ if (empty($file))
return;
- if (is_array($method) && !empty($method))
- foreach($method as $m)
- require_once($sourcedir. Breeze::$BreezeFolder . 'Breeze_'.$m.'.php');
+ if (is_array($file) && !empty($file) && !$smf)
+ foreach($file as $f)
+ require_once($sourcedir. Breeze::$BreezeFolder . 'Breeze_'.$f.'.php');
+ elseif (!$smf)
+ require_once($sourcedir . Breeze::$BreezeFolder .'Breeze_'.$file.'.php');
+
else
- require_once($sourcedir . Breeze::$BreezeFolder .'Breeze_'.$method.'.php');
+ require_once($sourcedir .'/'.$file.'.php');
}
/**
View
@@ -84,6 +84,8 @@ public static function Post()
/* You aren't allowed in here, let's show you a nice message error... */
isAllowedTo('breeze_postStatus');
+ checkSession('post', '', false);
+
/* Set some values */
$context['Breeze']['ajax']['ok'] = '';
$context['Breeze']['ajax']['data'] = '';
@@ -134,6 +136,8 @@ public static function PostComment()
/* You aren't allowed in here, let's show you a nice message error... */
isAllowedTo('breeze_postComments');
+ checkSession('post', '', false);
+
/* By default it will show an error, we only do stuff if necesary */
$context['Breeze']['ajax']['ok'] = '';
View
@@ -53,7 +53,7 @@ function __construct($params, $type)
Breeze::Load(array(
'UserInfo',
'Subs',
- 'Parser'
+ 'Settings'
));
if (empty($params))
@@ -63,49 +63,80 @@ function __construct($params, $type)
$this->params = $params;
$this->type = $type;
- $this->parse = new Breeze_Parser();
$this->tools = new Breeze_Subs();
+ $this->text = Breeze_Settings::getInstance();
+
+ /* The visitor's permissions */
+ $this->permissions = array(
+ 'poststatus' => allowedTo('breeze_postStatus'),
+ 'postcomments' => allowedTo('breeze_postComments'),
+ 'deletestatus' => allowedTo('breeze_deleteStatus')
+ );
}
public function HTML()
{
global $scripturl, $user_info;
$this->UserInfo = Breeze_UserInfo::Profile($this->params['poster_id'], true);
-
- $this->params['body'] = $this->parse->Display($this->params['body']);
$this->params['time'] = $this->tools->TimeElapsed($this->params['time']);
switch ($this->type)
{
case 'status':
$this->ReturnArray = '
<li class="windowbg" id ="status_id_'. $this->params['id'] .'">
- <span class="topslice"><span></span></span>
- <div class="breeze_user_inner">
- <div class="breeze_user_status_avatar">
- '. $this->UserInfo .'
- </div>
- <div class="breeze_user_status_comment">
- '. $this->params['body'] .'
- <div class="breeze_options"><span class="time_elapsed">'. $this->params['time'] .'</span> <a href="javascript:void(0)" id="'. $this->params['id'] .'" class="breeze_delete_status">Delete</a> </div>
- <hr />
- <div id="comment_flash_'. $this->params['id'] .'"></div>';
-
- $this->ReturnArray .= '<ul class="breeze_comments_list">';
+ <span class="topslice">
+ <span></span>
+ </span>
+ <div class="breeze_user_inner">
+ <div class="breeze_user_status_avatar">
+ '. $this->UserInfo .'
+ </div>
+ <div class="breeze_user_status_comment">
+ '. $this->params['body'] .'
+ <div class="breeze_options"><span class="time_elapsed">'. $this->params['time'] .' </span>';
+
+ /* Delete link */
+ if ($this->permissions['deletestatus'])
+ $this->ReturnArray .= '| <a href="javascript:void(0)" id="'. $this->params['id'] .'" class="breeze_delete_status">'. $this->text->GetText('general_delete') .'</a>';
+
+ $this->ReturnArray .= '</div>
+ <hr />
+ <div id="comment_flash_'. $this->params['id'] .'"></div>';
+
+ $this->ReturnArray .= '<ul class="breeze_comments_list" id="comment_loadplace_'. $this->params['id'] .'">';
/* New status don't have comments... */
+ /* Display the new comments ^o^ */
$this->ReturnArray .= '
+ <li id="breeze_load_image_comment_'. $this->params['id'] .'" style="margin:auto; text-align:center;"></li>';
+
+ /* Close the list */
+ $this->ReturnArray .= '</ul>';
- <li><form action="'. $scripturl. '?action=breezeajax;sa=postcomment" method="post" name="formID_'. $this->params['id'] .'" id="formID_'. $this->params['id'] .'">
+ /* Display the form for new comments */
+ if ($this->permissions['postcomments'])
+ $this->ReturnArray .= '
+ <span><form action="'. $scripturl. '?action=breezeajax;sa=postcomment" method="post" name="formID_'. $this->params['id'] .'" id="formID_'. $this->params['id'] .'">
<textarea id="textboxcontent_'. $this->params['id'] .'" cols="40" rows="2"></textarea>
<input type="hidden" value="'. $this->params['poster_id'] .'" name="status_owner_id'. $this->params['id'] .'" id="status_owner_id'. $this->params['id'] .'" />
<input type="hidden" value="'. $this->params['owner_id'] .'" name="profile_owner_id'. $this->params['id'] .'" id="profile_owner_id'. $this->params['id'] .'" />
<input type="hidden" value="'. $this->params['id'] .'" name="status_id'. $this->params['id'] .'" id="status_id'. $this->params['id'] .'" />
<input type="hidden" value="'. $user_info['id'] .'" name="poster_comment_id'. $this->params['id'] .'" id="poster_comment_id'. $this->params['id'] .'" /><br />
<input type="submit" value="Comment" class="comment_submit" id="'. $this->params['id'] .'" />
- </form></li>';
+ </form></span>';
+
+
+ /* Close the div */
+ $this->ReturnArray .= '</div>
+ <div class="clear"></div>
+ </div>
+ <span class="botslice">
+ <span></span>
+ </span>
+ </li>';
break;
case 'comment':
$this->ReturnArray = '
View
@@ -42,7 +42,7 @@ class Breeze_Globals
{
private $request;
- function __construct($var)
+ public function __construct($var)
{
switch($var)
{
@@ -59,15 +59,15 @@ function __construct($var)
}
- function See($value)
+ public function See($value)
{
if (isset($this->request[$value]) && $this->Validate($this->request[$value]))
return $this->Sanitize($this->request[$value]);
else
return 'error_' . $value;
}
- function Raw($value)
+ public function Raw($value)
{
if (isset($this->request[$value]))
return $this->request[$value];
@@ -102,7 +102,7 @@ public function UnsetVar($var)
unset($this->request[$var]);
}
- public static function Sanitize($var)
+ public function Sanitize($var)
{
if (get_magic_quotes_gpc())
$var = stripslashes($var);
@@ -111,10 +111,7 @@ public static function Sanitize($var)
$var = (int) $var;
elseif (is_string($var))
- {
- $var = strtr(htmlspecialchars($var, ENT_QUOTES), array("\r" => '<br />', "\n" => '<br />', "\t" => '<br />'));
- $var = trim($var);
- }
+ $var = trim(strtr(htmlspecialchars($var, ENT_QUOTES), array("\r" => '<br />', "\n" => '<br />', "\t" => '&nbsp;&nbsp;&nbsp;&nbsp;')));
else
$var = 'error_' . $var;
@@ -116,6 +116,8 @@ public function PaginationArray()
/* Generating page links. */
private function GeneratePageLinks()
{
+ global $scripturl;
+
for ($i = $this->limit_number_start; $i <= $this->limit_number_end; $i++)
{
$this->page_cur = '<a href='. $this->LinkPrefix . $i . $this->LinkSufflix. '>'. $i .'</a>';
View
@@ -95,7 +95,7 @@ public static function getInstance()
* @param mixed $type the name of value(s) to be deleted
* @return void
*/
- private function KillCache($type)
+ public function KillCache($type)
{
if (!is_array($type))
$type = array($type);
@@ -319,13 +319,10 @@ protected function Status()
global $smcFunc;
Breeze::Load(array(
- 'Subs',
- 'UserInfo',
- 'Parser',
+ 'Subs'
));
$tools = new Breeze_Subs();
- $parser = new Breeze_Parser();
/* Use the cache please... */
if (($this->Status = cache_get_data('Breeze:Status', 120)) == null)
@@ -350,7 +347,7 @@ protected function Status()
'owner_id' => $row['status_owner_id'],
'poster_id' => $row['status_poster_id'],
'time' => $tools->TimeElapsed($row['status_time']),
- 'body' => $parser->Display($row['status_body'])
+ 'body' => $row['status_body']
);
}
@@ -424,13 +421,10 @@ protected function Comments()
global $smcFunc;
Breeze::Load(array(
- 'Subs',
- 'UserInfo',
- 'Parser',
+ 'Subs'
));
$tools = new Breeze_Subs();
- $parser = new Breeze_Parser();
/* Use the cache please... */
if (($this->Comments = cache_get_data('Breeze:Comments', 120)) == null)
@@ -457,7 +451,7 @@ protected function Comments()
'poster_id' => $row['comments_poster_id'],
'profile_owner_id' => $row['comments_profile_owner_id'],
'time' => $tools->TimeElapsed($row['comments_time']),
- 'body' => $parser->Display($row['comments_body'])
+ 'body' => $row['comments_body']
);
}
@@ -900,7 +894,6 @@ public function GetProfilevisits($profile, $time)
else
return array();
}
-}
/*
* The main method to load all the notifications
@@ -932,7 +925,7 @@ protected function Notifications()
'user' => $row['user'],
'type' => $row['type'],
'time' => $row['time'],
- 'read' => $row['read']
+ 'read' => $row['read'],
'content' => json_decode($row['content'])
);
}
@@ -968,6 +961,7 @@ public function InsertNotification($array)
$this->Query('notifications')->InsertData($data, $array, $indexes);
}
+}
/*
* Saturday is almost over
View
@@ -58,7 +58,6 @@ public static function Wall()
Breeze::Load(array(
'Settings',
'Subs',
- 'Globals',
'UserInfo',
'Modules',
'Query',
@@ -212,6 +211,7 @@ function Settings()
$query = Breeze_Query::getInstance();
$text = Breeze_Settings::getInstance();
$data = $query->GetSettingsByUser($context['member']['id']);
+ $globals = new Breeze_Globals('request');
if (!empty($data))
$already = true;
@@ -290,6 +290,9 @@ function Settings()
/* Saving? */
if (isset($_GET['save']))
{
+ /* Kill the Settings cache */
+ $query->KillCache('Settings');
+
$temp = $form->ReturnElementNames();
$save_data = array();
$save_data['user_id'] = $context['member']['id'];
@@ -3,7 +3,7 @@
/**
* Breeze_
*
- * The purpose of this file is to generate a div with the user common info, name, avatarm, post, icons, stuff like that.
+ * The purpose of this file is to generate a div with the user common info, name, avatar, post, icons, stuff like that.
* @package Breeze mod
* @version 1.0 Beta 1
* @author Jessica González <missallsunday@simplemachines.org>
Oops, something went wrong.

0 comments on commit 20ed818

Please sign in to comment.