diff options
-rw-r--r-- | admin/catalog.php | 7 | ||||
-rw-r--r-- | browse.php | 6 | ||||
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rwxr-xr-x | docs/README | 30 | ||||
-rw-r--r-- | lib/class/album.class.php | 2 | ||||
-rw-r--r-- | lib/class/browse.class.php | 7 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 11 | ||||
-rw-r--r-- | lib/class/database_object.abstract.php | 27 | ||||
-rw-r--r-- | lib/class/tag.class.php | 36 | ||||
-rw-r--r-- | lib/class/vauth.class.php | 10 | ||||
-rw-r--r-- | lib/init.php | 8 | ||||
-rw-r--r-- | lib/xmlrpc.php | 2 | ||||
-rw-r--r-- | templates/show_edit_album_row.inc.php | 5 | ||||
-rw-r--r-- | templates/show_manage_catalogs.inc.php | 16 | ||||
-rw-r--r-- | templates/show_random.inc.php | 3 | ||||
-rw-r--r-- | templates/show_stats.inc.php | 27 | ||||
-rw-r--r-- | templates/show_tagcloud.inc.php | 7 | ||||
-rw-r--r-- | templates/sidebar_home.inc.php | 11 | ||||
-rw-r--r-- | themes/classic/templates/default.css | 3 |
19 files changed, 161 insertions, 59 deletions
diff --git a/admin/catalog.php b/admin/catalog.php index 3700600d..f60f6789 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -171,6 +171,13 @@ switch ($_REQUEST['action']) { $body = ''; show_confirmation($title,$body,$url); break; + case 'update_from': + if (Config::get('demo_mode')) { break; } + // First see if we need to do an add + if ($_POST['add_path'] != '/' AND strlen($_POST['add_path'])) { + + } + break; case 'add_catalog': /* Wah Demo! */ if (Config::get('demo_mode')) { break; } @@ -59,7 +59,11 @@ switch($_REQUEST['action']) { break; case 'tag': Browse::set_sort('count','ASC'); - $tags = Browse::get_objects(); + // This one's a doozy + Browse::set_simple_browse(0); + Browse::save_objects(Tag::get_tags(Config::get('offset_limit'),array())); + $keys = array_keys(Browse::get_saved()); + Tag::build_cache($keys); Browse::show_objects(); break; case 'artist': diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 094bf4d0..123e1eb0 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.5-Alpha1 + - Fix http auth session issues, where every request blew away the + old session information - Many other minor improvements (Thx Dipsol) - Fixed warnings in caching code (Thx Dipsol) - Massive text cleanup (Thx Dipsol) diff --git a/docs/README b/docs/README index 817108bc..295f86c9 100755 --- a/docs/README +++ b/docs/README @@ -32,7 +32,7 @@ Contents: A) Supported File-Types Ampache currently supports the following audio file types. If - you would like ampache to support an additional file type please + you would like Ampache to support an additional file type please contact us on irc, or the forums and we will investigate adding them. Thanks @@ -93,28 +93,17 @@ Contents: D) A Special Thanks: Thanks to those who've helped us make Ampache so useable: - Scott Kveton - Head Nacho, inventer of all that is Ampache + Scott Kveton - Original create of Ampache 2001 - 2003 Robert Hopson - Libglue, Playlists, Ogg support.. and much more Andy Morgan - Sage / Voice of Reason RosenSama - Previous Developer - Randall Ehren (Initial XML-RPC) - s1amson (lots of beta testing) - Caleb Crome (bug fixes and enhancements) - Mike Payson - Jon Disnard - Adriaan Peters (numerous patches and bug fixes) - Rob Kaandorp (time calculation fix) - Ian Cote (MP3.php tweaks) - Kurt Lieber (random fixes) - Maan Bsat (random fixes) latka (from media.tangent.org site) for orphaned song ideas Lamar Hansford (README/INSTALL improvements) & Upload Lacy Morrow (Flash Player) - And many many more... 2. Getting all the components - Apache >= 1.3.x http://www.apache.org OR other webserver + Apache >= 1.3.x http://www.apache.org OR other web server PHP >= 5.1.x http://www.php.net PHP5-Mysql PHP5-Session @@ -125,10 +114,8 @@ Contents: 3. Setting Up - Ampache: - If you're upgrading from 3.0 to 3.1 you will not be able to re-use - your database or config.php files. You will need to follow the entire - Ampache install guidelines oultined in the INSTALL file. + Please see the included INSTALL file or if possible the wiki + for the most update to date instructions, http://ampache.org/wiki 3a. Upgrading Your Ampache Install @@ -138,10 +125,13 @@ Contents: will be handled by the /update.php script. There is no need to insert the /sql/ampache.sql if you have an existing installation. + Please see MIGRATION for specific instructions based on the version + 4. License This Application falls under the Standard GPL v2. See Licence - included with this tar file + included with this tar file. Credit for code is listed in the + changelog. 5. Contact Info @@ -155,5 +145,5 @@ Contents: Wiki: http://ampache.org/wiki Demo: http://ampache.org/demo - Ampache Development Team + -Karl Vollmer vollmer@ampache.org diff --git a/lib/class/album.class.php b/lib/class/album.class.php index 6b49eabe..c38bb927 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -725,7 +725,7 @@ class Album extends database_object { $current_id = $this->id; - if ($artist != $this->artist_id AND $artist > 0) { + if ($artist != $this->artist_id AND $artist) { // Update every song $songs = $this->get_songs(); foreach ($songs as $song_id) { diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 4f6b6bcc..36f05597 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -222,7 +222,6 @@ class Browse { $valid_array = array('show_art','starts_with','alpha_match'); break; case 'artist': - case 'genre': case 'song': case 'live_stream': $valid_array = array('alpha_match','starts_with'); @@ -233,6 +232,9 @@ class Browse { array_push($valid_array,'playlist_type'); } break; + case 'tag': + $valid_array = array('object_type'); + break; default: $valid_array = array(); break; @@ -542,6 +544,9 @@ class Browse { case 'shoutbox': $sql = "SELECT `user_shout`.`id` FROM `user_shout` "; break; + case 'tag': + $sql = "SELECT `tag`.`id` FROM `tag` LEFT JOIN `tag_map` ON `tag_map`.`tag_id`=`tag`.`id` "; + break; case 'playlist_song': case 'song': default: diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index ec679b43..4929bb1e 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -106,6 +106,17 @@ class Catalog { } // _create_filecache /** + * get_from_path + * Try to figure out which catalog path most closely resembles this one + * This is useful when creating a new catalog to make sure we're not doubling up here + */ + public static function get_from_path($path) { + + // Break it down into its component parts and start looking for a catalog + + } // get_from_path + + /** * format * This makes the object human readable */ diff --git a/lib/class/database_object.abstract.php b/lib/class/database_object.abstract.php index 5c6020c6..ed83d198 100644 --- a/lib/class/database_object.abstract.php +++ b/lib/class/database_object.abstract.php @@ -34,10 +34,6 @@ abstract class database_object { /** * get_info * retrieves the info from the database and puts it in the cache - * - * @param string $id - * @param string $table_name - * @return array */ public function get_info($id,$table_name='') { @@ -65,6 +61,9 @@ abstract class database_object { * this checks the cache to see if the specified object is there */ public static function is_cached($index,$id) { + + // Make sure we've got some parents here before we dive below + if (!isset(self::$object_cache) || !isset(self::$object_cache[$index])) { return false; } return isset(self::$object_cache[$index][$id]); @@ -73,10 +72,6 @@ abstract class database_object { /** * get_from_cache * This attempts to retrive the specified object from the cache we've got here - * - * @param string $index - * @param string $id - * @return array */ public static function get_from_cache($index,$id) { @@ -97,23 +92,11 @@ abstract class database_object { /** * add_to_cache * This adds the specified object to the specified index in the cache - * - * @param string $index - * @param string $id - * @param array $data - * @return boolean */ public static function add_to_cache($index,$id,$data) { - $hasbeenset = false; - - // Set the data if it is set - if (isset($data)) { - self::$object_cache[$index][$id] = $data; - $hasbeenset = true; - } - - return $hasbeenset; + self::$object_cache[$index][$id] = $data; + } // add_to_cache } // end database_object diff --git a/lib/class/tag.class.php b/lib/class/tag.class.php index 9f079102..0350e438 100644 --- a/lib/class/tag.class.php +++ b/lib/class/tag.class.php @@ -70,14 +70,14 @@ class Tag extends database_object { */ public function format($type=0,$object_id=0) { - if (!self::validate_type($type)) { return false; } + if ($type AND !self::validate_type($type)) { return false; } if ($type) { $this->set_object($type,$object_id); } $size = 3 + ($this->weight-1) - ($this->count-1); - if ($size > 4) { $size = 4; } + if (abs($size) > 4) { $size = 4; } if ($this->owner == $GLOBALS['user']->id) { $action = '?page=tag&action=remove_tag&type=' . scrub_out($type) . '&tag_id=' . intval($this->id) . '&object_id=' . intval($object_id); @@ -89,6 +89,7 @@ class Tag extends database_object { } $class .= 'tag_size' . $size; + $this->f_class = $class; $this->f_name = Ajax::text($action,$this->name,'modify_tag_' . $this->id . '_' . $object_id,'',$class); @@ -361,7 +362,36 @@ class Tag extends database_object { return $results; - } // get_object_tags + } // get_object_tags + + /** + * get_tags + * This is a non-object non type depedent function that just returns tags + * we've got, it can take filters (this is used by the tag cloud) + */ + public static function get_tags($limit,$filters=array()) { + + $sql = "SELECT `tag_map`.`tag_id`,COUNT(`tag_map`.`object_id`) AS `count` " . + "FROM `tag_map` " . + "LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " . + "GROUP BY `tag`.`name` ORDER BY `count` DESC " . + "LIMIT $limit"; + $db_results = Dba::read($sql); + + $results = array(); + + while ($row = Dba::fetch_assoc($db_results)) { + if ($row['count'] > $top) { $top = $row['count']; } + $results[$row['tag_id']] = array('id'=>$row['tag_id'],'count'=>$row['count']); + $count+= $row['count']; + } + + // Do something with this + $min = $row['count']; + + return $results; + + } // get_tags /** * filter_with_prefs diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php index 7bf4d16c..b9aeee6a 100644 --- a/lib/class/vauth.class.php +++ b/lib/class/vauth.class.php @@ -149,6 +149,9 @@ class vauth { // If no key is passed try to find the session id $key = $key ? $key : session_id(); + + // Nuke the cookie before all else + self::destroy($key); // Do a quick check to see if this is an AJAX'd logout request // if so use the iframe to redirect @@ -169,7 +172,6 @@ class vauth { echo xml_from_array($results); } - self::destroy($key); /* Redirect them to the login page */ if (AJAX_INCLUDE != '1') { @@ -648,7 +650,7 @@ class vauth { public static function http_auth($username) { /* Check if the user exists */ - if ($user = new User($username)) { + if ($user = User::get_from_username($username)) { $results['success'] = true; $results['type'] = 'mysql'; $results['username'] = $username; @@ -658,8 +660,8 @@ class vauth { } /* If not then we auto-create the entry as a user.. :S */ - $user->create($username,$username,'',md5(rand()),'25'); - $user = new User($username); + $user_id = $user->create($username,$username,'',md5(rand()),'25'); + $user = new User($user_id); $results['success'] = true; $results['type'] = 'mysql'; diff --git a/lib/init.php b/lib/init.php index 6a030fc9..736b5b24 100644 --- a/lib/init.php +++ b/lib/init.php @@ -85,7 +85,7 @@ if (!count($results)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.5-Alpha1 (Build 004)'; +$results['version'] = '3.5-Alpha1 (Build 005)'; $results['int_config_version'] = '7'; $results['raw_web_path'] = $results['web_path']; @@ -168,12 +168,14 @@ set_memory_limit($results['memory_limit']); /**** END Set PHP Vars ****/ -/* We have to check for HTTP Auth */ -if (in_array("http",$results['auth_methods'])) { +/* We have to check for HTTP Auth, only run this if we don't have an ampache session cookie */ +$session_name = Config::get('session_name'); +if (in_array("http",$results['auth_methods']) AND empty($_COOKIE[$session_name])) { $username = scrub_in($_SERVER['PHP_AUTH_USER']); $results = vauth::http_auth($username); + // We've found someone or were able to create them, go ahead and generate the session if ($results['success']) { vauth::create_cookie(); vauth::session_create($results); diff --git a/lib/xmlrpc.php b/lib/xmlrpc.php index a0c3d2b8..b3a2612f 100644 --- a/lib/xmlrpc.php +++ b/lib/xmlrpc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/templates/show_edit_album_row.inc.php b/templates/show_edit_album_row.inc.php index e1a1a694..0bf77a85 100644 --- a/templates/show_edit_album_row.inc.php +++ b/templates/show_edit_album_row.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -40,6 +40,9 @@ <input type="text" name="year" value="<?php echo scrub_out($album->year); ?>" /> </td> <td> + <input type="text" name="disk" value="<?php echo scrub_out($album->disk); ?>" /> +</td> +<td> <input type="hidden" name="id" value="<?php echo $album->id; ?>" /> <input type="hidden" name="type" value="album" /> <?php echo Ajax::button('?action=edit_object&id=' . $album->id . '&type=album','download',_('Save Changes'),'save_album_' . $album->id,'edit_album_' . $album->id); ?> diff --git a/templates/show_manage_catalogs.inc.php b/templates/show_manage_catalogs.inc.php index 1fcf7194..0b42bd69 100644 --- a/templates/show_manage_catalogs.inc.php +++ b/templates/show_manage_catalogs.inc.php @@ -21,6 +21,9 @@ ?> <?php show_box_top(_('Show Catalogs')) ?> <div id="information_actions"> +<table> +<tr> +<td> <ul> <li><a href="<?php echo Config::get('web_path'); ?>/admin/catalog.php?action=gather_album_art"><?php echo _('Gather All Art'); ?></a></li> <li><a href="<?php echo Config::get('web_path'); ?>/admin/catalog.php?action=add_to_all_catalogs"><?php echo _('Add to All'); ?></a> </li> @@ -29,6 +32,18 @@ <li><a href="<?php echo Config::get('web_path'); ?>/admin/catalog.php?action=full_service"><?php echo _('Update All'); ?></a></li> <li><a href="<?php echo Config::get('web_path'); ?>/admin/catalog.php?action=clear_stats"><?php echo _('Clear Stats'); ?></a></li> </ul> +</td> +<td> + <form method="post" action="<?php echo Config::get('web_path'); ?>/admin/catalog.php?action=update_from"> + <?php echo _('Add From'); ?> <span class="information">/data/myNewMusic</span><br /> + <input type="text" name="add_path" value="/" /><br /> + <?php echo _('Update From'); ?> <span class="information">/data/myUpdatedMusic</span><br /> + <input type="text" name="update_path" value="/" /><br /> +<input type="submit" value="<?php echo _('Update'); ?>" /> +</form> +</td> +</tr> +</table> </div> <?php show_box_bottom(); ?> <?php @@ -38,3 +53,4 @@ Browse::save_objects($catalog_ids); Browse::show_objects($catalog_ids); ?> + diff --git a/templates/show_random.inc.php b/templates/show_random.inc.php index 57f92ed4..72094209 100644 --- a/templates/show_random.inc.php +++ b/templates/show_random.inc.php @@ -38,9 +38,8 @@ <option value="-1"><?php echo _('All'); ?></option> </select> </td> - <td rowspan="5" valign="top"><?php echo _('From genre'); ?></td> + <td rowspan="5" valign="top"><?php echo _('Tags'); ?></td> <td rowspan="5"> - <?php show_genre_select('genre[]','','6'); ?> </td> </tr> <tr> diff --git a/templates/show_stats.inc.php b/templates/show_stats.inc.php new file mode 100644 index 00000000..f4f6da6f --- /dev/null +++ b/templates/show_stats.inc.php @@ -0,0 +1,27 @@ +<?php +/* + + Copyright (c) Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +?> +<?php show_box_top(_('Statistics')); ?> +<?php require_once Config::get('prefix') . '/templates/show_local_catalog_info.inc.php'; ?> +<?php require_once Config::get('prefix') . '/templates/show_stats_newest.inc.php'; ?> + + +<?php show_box_bottom(); ?> diff --git a/templates/show_tagcloud.inc.php b/templates/show_tagcloud.inc.php index bde48898..aee8b960 100644 --- a/templates/show_tagcloud.inc.php +++ b/templates/show_tagcloud.inc.php @@ -21,3 +21,10 @@ */ $web_path = Config::get('web_path'); ?> +<?php foreach ($object_ids as $data) { + $tag = new Tag($data['id']); + $tag->format(); +?> +<span class="<?php echo $tag->f_class; ?>"><?php echo $tag->name; ?></span> + +<?php } ?> diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php index ec37677b..8a23c23c 100644 --- a/templates/sidebar_home.inc.php +++ b/templates/sidebar_home.inc.php @@ -68,6 +68,17 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path'); <label id="show_allplLabel" for="showallplCB"><?php echo _('All Playlists'); ?></label><br /> <?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&type=' . Browse::get_type() . '&key=playlist_type&value=1','')); ?> <?php } // if playlist_type ?> + <?php if (in_array('object_type',$allowed_filters)) { ?> + <input id="typeSongRadio" type="radio" name="object_type" value="1" /> + <label id="typeSongLabel" for="typeSongRadio"><?php echo _('Song Title'); ?></label><br /> + <?php echo Ajax::observe('typeSongRadio','click',Ajax::action('?page=tag&action=browse&type=song','')); ?> + <input id="typeAlbumRadio" type="radio" name="object_type" value="1" /> + <label id="typeAlbumLabel" for="typeAlbumRadio"><?php echo _('Albums'); ?></label><br /> + <?php echo Ajax::observe('typeAlbumRadio','click',Ajax::action('?page=tag&action=browse&type=album','')); ?> + <input id="typeArtistRadio" type="radio" name="object_type" value="1" /> + <label id="typeArtistLabel" for="typeArtistRadio"><?php echo _('Artist'); ?></label><br /> + <?php echo Ajax::observe('typeArtistRadio','click',Ajax::action('?page=tag&action=browse&type=artist','')); ?> + <?php } ?> </div> </li> <?php } ?> diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css index ff09bab0..8824826f 100644 --- a/themes/classic/templates/default.css +++ b/themes/classic/templates/default.css @@ -216,6 +216,9 @@ a.button{padding:1px 3px;} font-weight:normal;
color:#5b5b5b;
}
+#sidebar-page div.sb3 input[type=radio] {
+ margin-left:2px;
+}
#sidebar-page ul.sb3 li{
margin:0;
|