From 00417ad9658bd68f347f45e1ef8c5327fed95648 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Wed, 26 Dec 2007 03:32:13 +0000 Subject: fixed preg on file pattern, some work on flagging, editing stuff actually flags thing again... --- docs/CHANGELOG | 1 + lib/class/flag.class.php | 42 +++++++++-------------------------------- lib/class/vainfo.class.php | 1 + server/ajax.server.php | 11 ++++++++++- templates/show_flagged.inc.php | 4 ++-- templates/sidebar_admin.inc.php | 2 +- 6 files changed, 24 insertions(+), 37 deletions(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index e5b36598..71e58b7c 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Beta2 + - Replaced " " with "\s" on Pattern Match Logic - Removed extra space on default Last.FM username/password - Fixed LastFM plugin username and password checking to not even try if there is no username or password diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php index 56256a39..f27d7fc6 100644 --- a/lib/class/flag.class.php +++ b/lib/class/flag.class.php @@ -26,7 +26,6 @@ */ class Flag { - /* DB based variables */ public $id; public $user; public $object_id; @@ -46,25 +45,17 @@ class Flag { */ public function __construct($flag_id=0) { - $this->id = intval($flag_id); + if (!$flag_id) { return false; } - if (!$this->id) { return false; } + $info = $this->_get_info($flag_id); - $info = $this->_get_info(); + foreach ($info as $key=>$value) { + $this->$key = $value; + } - $this->user = $info['user']; - $this->object_id = $info['object_id']; - $this->object_type = $info['object_type']; - $this->comment = $info['comment']; - $this->flag = $info['flag']; - $this->date = $info['date']; - $this->approved = $info['approved']; - $f_user = $this->format_user(); - $this->f_user_fullname = $f_user['fullname']; - $this->f_user_username = $f_user['username']; return true; - } // flag + } // Constructor /** * _get_info @@ -72,7 +63,7 @@ class Flag { */ private function _get_info() { - $id = Dba::escape($this->id); + $id = Dba::escape($flag_id); $sql = "SELECT * FROM `flagged` WHERE `id`='$id'"; $db_results = Dba::query($sql); @@ -121,7 +112,7 @@ class Flag { } // get_total /** - * get_flagged + * get_all * This returns an array of ids of flagged songs if no limit is passed * it gets everything */ @@ -182,7 +173,7 @@ class Flag { $approved = '0'; /* If they are an content manager or higher, it's auto approved */ - if ($GLOBALS['user']->has_access('75')) { $approved = '1'; } + if (Access::check('interface','75')) { $approved = '1'; } $sql = "INSERT INTO `flagged` (`object_id`,`object_type`,`flag`,`comment`,`date`,`approved`,`user`) VALUES " . " ('$id','$type','$flag','$comment','$time','$approved','$user')"; @@ -220,21 +211,6 @@ class Flag { } // approve - /** - * format_user - * This formats username etc - */ - function format_user() { - - $sql = "SELECT * FROM user WHERE id = '$this->user'"; - $db_results = mysql_query($sql, dbh()); - - $f_user = mysql_fetch_assoc($db_results); - - return $f_user; - - } // format_user - /** * format_name * This function formats and sets the $this->name variable and $this->title diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index 34447277..5a595f2b 100644 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -482,6 +482,7 @@ class vainfo { $preg_pattern = preg_quote($pattern); $preg_pattern = preg_replace("/\%\w/","(.+)",$preg_pattern); $preg_pattern = str_replace("/","\/",$preg_pattern); + $preg_pattern = str_replace(" ","\s",$preg_pattern); $preg_pattern = "/" . $preg_pattern . "\..+$/"; preg_match($preg_pattern,$filename,$matches); /* Cut out the Full line, we don't need that */ diff --git a/server/ajax.server.php b/server/ajax.server.php index c83a0328..cd71ab83 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -143,7 +143,7 @@ switch ($_REQUEST['action']) { } // Make sure we've got them rights - if (!$GLOBALS['user']->has_access($level) || Config::get('demo_mode')) { + if (!Access::check('interface',$level) || Config::get('demo_mode')) { exit; } @@ -151,24 +151,33 @@ switch ($_REQUEST['action']) { case 'album': $key = 'album_' . $_POST['id']; $album = new Album($_POST['id']); + $songs = $album->get_songs(); $new_id = $album->update($_POST); if ($new_id != $_POST['id']) { $album = new Album($new_id); + foreach ($songs as $song_id) { + Flag::add($song_id,'song','retag','Inline Album Update'); + } } $album->format(); break; case 'artist': $key = 'artist_' . $_POST['id']; $artist = new Artist($_POST['id']); + $songs = $artist->get_songs(); $new_id = $artist->update($_POST); if ($new_id != $_POST['id']) { $artist = new Artist($new_id); + foreach ($songs as $song_id) { + Flag::add($song_id,'song','retag','Inline Artist Update'); + } } $artist->format(); break; case 'song': $key = 'song_' . $_POST['id']; $song = new Song($_POST['id']); + Flag::add($song->id,'song','retag','Inline Single Song Update'); $song->update($_POST); $song->format(); break; diff --git a/templates/show_flagged.inc.php b/templates/show_flagged.inc.php index 39c93c0e..218226a2 100644 --- a/templates/show_flagged.inc.php +++ b/templates/show_flagged.inc.php @@ -39,7 +39,7 @@ $web_path = Config::get('web_path'); - + print_name(); ?> f_user_username); ?> @@ -58,7 +58,7 @@ $web_path = Config::get('web_path'); - + diff --git a/templates/sidebar_admin.inc.php b/templates/sidebar_admin.inc.php index 843a1de3..45630bca 100644 --- a/templates/sidebar_admin.inc.php +++ b/templates/sidebar_admin.inc.php @@ -26,7 +26,7 @@
  • -
  • +
  • -- cgit