summaryrefslogtreecommitdiffstats
path: root/lib/class/shoutbox.class.php
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-03-14 20:14:52 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-03-14 20:14:52 +0000
commit1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc (patch)
tree54655ff3e692a71a17f1d37cd97374b263557ca1 /lib/class/shoutbox.class.php
parentef48bf3fbdca2a4d25f5d025f4c6ad23905e5369 (diff)
downloadampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.gz
ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.bz2
ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.zip
Cosmetics: remove trailing whitespace
Diffstat (limited to 'lib/class/shoutbox.class.php')
-rw-r--r--lib/class/shoutbox.class.php152
1 files changed, 76 insertions, 76 deletions
diff --git a/lib/class/shoutbox.class.php b/lib/class/shoutbox.class.php
index 2de151d4..6c1bf145 100644
--- a/lib/class/shoutbox.class.php
+++ b/lib/class/shoutbox.class.php
@@ -22,19 +22,19 @@
class shoutBox {
- public $id;
+ public $id;
/**
* Constructor
* This pulls the shoutbox information from the database and returns
* a constructed object, uses user_shout table
*/
- public function __construct($shout_id) {
+ public function __construct($shout_id) {
// Load the data from the database
$this->_get_info($shout_id);
- return true;
+ return true;
} // Constructor
@@ -42,48 +42,48 @@ class shoutBox {
* _get_info
* does the db call, reads from the user_shout table
*/
- private function _get_info($shout_id) {
+ private function _get_info($shout_id) {
- $sticky_id = Dba::escape($shout_id);
+ $sticky_id = Dba::escape($shout_id);
- $sql = "SELECT * FROM `user_shout` WHERE `id`='$shout_id'";
- $db_results = Dba::read($sql);
+ $sql = "SELECT * FROM `user_shout` WHERE `id`='$shout_id'";
+ $db_results = Dba::read($sql);
- $data = Dba::fetch_assoc($db_results);
+ $data = Dba::fetch_assoc($db_results);
- foreach ($data as $key=>$value) {
- $this->$key = $value;
- }
+ foreach ($data as $key=>$value) {
+ $this->$key = $value;
+ }
- return true;
+ return true;
} // _get_info
/**
- * get_top
+ * get_top
* This returns the top user_shouts, shoutbox objects are always shown regardless and count against the total
* number of objects shown
*/
- public static function get_top($limit) {
+ public static function get_top($limit) {
- $shouts = self::get_sticky();
+ $shouts = self::get_sticky();
// If we've already got too many stop here
- if (count($shouts) > $limit) {
- $shouts = array_slice($shouts,0,$limit);
- return $shouts;
- }
+ if (count($shouts) > $limit) {
+ $shouts = array_slice($shouts,0,$limit);
+ return $shouts;
+ }
// Only get as many as we need
- $limit = intval($limit) - count($shouts);
- $sql = "SELECT * FROM `user_shout` WHERE `sticky`='0' ORDER BY `date` DESC LIMIT $limit";
- $db_results = Dba::read($sql);
+ $limit = intval($limit) - count($shouts);
+ $sql = "SELECT * FROM `user_shout` WHERE `sticky`='0' ORDER BY `date` DESC LIMIT $limit";
+ $db_results = Dba::read($sql);
- while ($row = Dba::fetch_assoc($db_results)) {
- $shouts[] = $row['id'];
- }
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $shouts[] = $row['id'];
+ }
- return $shouts;
+ return $shouts;
} // get_top
@@ -91,18 +91,18 @@ class shoutBox {
* get_sticky
* This returns all current sticky shoutbox items
*/
- public static function get_sticky() {
+ public static function get_sticky() {
- $sql = "SELECT * FROM `user_shout` WHERE `sticky`='1' ORDER BY `date` DESC";
+ $sql = "SELECT * FROM `user_shout` WHERE `sticky`='1' ORDER BY `date` DESC";
$db_results = Dba::read($sql);
- $results = array();
+ $results = array();
- while ($row = Dba::fetch_assoc($db_results)) {
- $results[] = $row['id'];
- }
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $results[] = $row['id'];
+ }
- return $results;
+ return $results;
} // get_sticky
@@ -110,67 +110,67 @@ class shoutBox {
* get_object
* This takes a type and an ID and returns a created object
*/
- public static function get_object($type,$object_id) {
+ public static function get_object($type,$object_id) {
- $allowed_objects = array('song','genre','album','artist','radio');
+ $allowed_objects = array('song','genre','album','artist','radio');
- if (!in_array($type,$allowed_objects)) {
- return false;
- }
+ if (!in_array($type,$allowed_objects)) {
+ return false;
+ }
- $object = new $type($object_id);
+ $object = new $type($object_id);
- return $object;
+ return $object;
} // get_object
/**
* get_image
- * This returns an image tag if the type of object we're currently rolling with
+ * This returns an image tag if the type of object we're currently rolling with
* has an image assoicated with it
*/
- public function get_image() {
+ public function get_image() {
- switch ($this->object_type) {
- case 'album':
- $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $this->object_id . "&amp;thumb=1\" />";
- break;
- case 'artist':
+ switch ($this->object_type) {
+ case 'album':
+ $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $this->object_id . "&amp;thumb=1\" />";
+ break;
+ case 'artist':
break;
- case 'song':
- $song = new Song($this->object_id);
- $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $song->album . "&amp;thumb=1\" />";
+ case 'song':
+ $song = new Song($this->object_id);
+ $image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . Config::get('web_path') . "/image.php?id=" . $song->album . "&amp;thumb=1\" />";
break;
- default:
+ default:
// Rien a faire
- break;
+ break;
} // end switch
- return $image_string;
+ return $image_string;
} // get_image
/**
* create
- * This takes a key'd array of data as input and inserts a new shoutbox entry, it returns the auto_inc id
+ * This takes a key'd array of data as input and inserts a new shoutbox entry, it returns the auto_inc id
*/
- public static function create($data) {
+ public static function create($data) {
- $user = Dba::escape($GLOBALS['user']->id);
- $text = Dba::escape(strip_tags($data['comment']));
- $date = time();
- $sticky = make_bool($data['sticky']);
- $object_id = Dba::escape($data['object_id']);
- $object_type = Dba::escape($data['object_type']);
+ $user = Dba::escape($GLOBALS['user']->id);
+ $text = Dba::escape(strip_tags($data['comment']));
+ $date = time();
+ $sticky = make_bool($data['sticky']);
+ $object_id = Dba::escape($data['object_id']);
+ $object_type = Dba::escape($data['object_type']);
- $sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`) " .
- "VALUES ('$user','$date','$text','$sticky','$object_id','$object_type')";
- $db_results = Dba::write($sql);
+ $sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`) " .
+ "VALUES ('$user','$date','$text','$sticky','$object_id','$object_type')";
+ $db_results = Dba::write($sql);
- $insert_id = Dba::insert_id();
+ $insert_id = Dba::insert_id();
- return $insert_id;
+ return $insert_id;
} // create
@@ -178,16 +178,16 @@ class shoutBox {
* update
* This takes a key'd array of data as input and updates a shoutbox entry
*/
- public static function update($data) {
+ public static function update($data) {
- $id = Dba::escape($data['shout_id']);
- $text = Dba::escape(strip_tags($data['comment']));
- $sticky = make_bool($data['sticky']);
+ $id = Dba::escape($data['shout_id']);
+ $text = Dba::escape(strip_tags($data['comment']));
+ $sticky = make_bool($data['sticky']);
$sql = "UPDATE `user_shout` SET `text`='$text', `sticky`='$sticky' WHERE `id`='$id'";
- $db_results = Dba::write($sql);
+ $db_results = Dba::write($sql);
- return true;
+ return true;
} // create
@@ -195,12 +195,12 @@ class shoutBox {
* format
* this function takes the object and reformats some values
*/
-
+
public function format() {
$this->sticky = ($this->sticky == "0") ? 'No' : 'Yes';
$this->date = date("m\/d\/Y - H:i", $this->date);
return true;
-
+
} //format
/**
@@ -211,10 +211,10 @@ class shoutBox {
public function delete($shout_id) {
// Delete the shoutbox post
- $shout_id = Dba::escape($shout_id);
+ $shout_id = Dba::escape($shout_id);
$sql = "DELETE FROM `user_shout` WHERE `id`='$shout_id'";
$db_results = Dba::write($sql);
-
+
} // delete
} // shoutBox class