diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-26 03:32:13 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-26 03:32:13 +0000 |
commit | 00417ad9658bd68f347f45e1ef8c5327fed95648 (patch) | |
tree | f3b18fef0de27c0e0a54538179f2fce4cd576257 | |
parent | c56aeb1b7003ed10da98a8bbc8305a5cb90357a6 (diff) | |
download | ampache-00417ad9658bd68f347f45e1ef8c5327fed95648.tar.gz ampache-00417ad9658bd68f347f45e1ef8c5327fed95648.tar.bz2 ampache-00417ad9658bd68f347f45e1ef8c5327fed95648.zip |
fixed preg on file pattern, some work on flagging, editing stuff actually flags thing again...
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | lib/class/flag.class.php | 42 | ||||
-rw-r--r-- | lib/class/vainfo.class.php | 1 | ||||
-rw-r--r-- | server/ajax.server.php | 11 | ||||
-rw-r--r-- | templates/show_flagged.inc.php | 4 | ||||
-rw-r--r-- | 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')"; @@ -221,21 +212,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'); <th class="cel_status"><?php echo _('Status'); ?></th> <th class="cel_action"><?php echo _('Action'); ?></th> </tr> -<?php foreach ($flagged as $data) { $flag = new Flag($data); ?> +<?php foreach ($object_ids as $flag_id) { $flag = new Flag($flag_id); ?> <tr class="<?php echo flip_class(); ?>"> <td class="cel_object"><a href="<?php echo Config::get('web_path'); ?>/admin/flag.php?action=show_edit_song&song=<?php echo $flag->object_id; ?>"><?php $flag->print_name(); ?></a></td> <td class="cel_username"><?php echo scrub_out($flag->f_user_username); ?></td> @@ -58,7 +58,7 @@ $web_path = Config::get('web_path'); <?php } ?> </td> </tr> -<?php } if (!count($flagged)) { ?> +<?php } if (!count($object_ids)) { ?> <tr class="<?php echo flip_class(); ?>"> <td colspan="7" class="error"><?php echo _('No Records Found'); ?></td> </tr> 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 @@ <li id="sb_admin_ot_ClearCatStats"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_stats"><?php echo _('Clear Stats'); ?></a></li> <li id="sb_admin_ot_ManageFlagged"><a href="<?php echo $web_path; ?>/admin/flag.php"><?php echo _('Manage Flagged'); ?></a></li> <?php if (Config::get('shoutbox')) { ?> - <li id="sb_admin_ot_ManageShoutbox"><a href="<?php echo $web_path; ?>/admin/shout.php?action=show_manage"><?php echo _('Manage Shoutbox'); ?></a></li> + <li id="sb_admin_ot_ManageShoutbox"><a href="<?php echo $web_path; ?>/shout.php?action=show_manage"><?php echo _('Manage Shoutbox'); ?></a></li> <?php } ?> </ul> </li> |