summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-22 18:32:09 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-22 18:32:09 +0000
commitff606dbefca94580b56a081c5d3089037a2d033d (patch)
treebdc9cb8ea8d3b5d8e9b1ebe313ce163990a75d0c /lib
parent472072028560aa178211ae248fc0dad4526533c7 (diff)
downloadampache-ff606dbefca94580b56a081c5d3089037a2d033d.tar.gz
ampache-ff606dbefca94580b56a081c5d3089037a2d033d.tar.bz2
ampache-ff606dbefca94580b56a081c5d3089037a2d033d.zip
removed some old/legacy functions fixed download and merged it into the /play
Diffstat (limited to 'lib')
-rw-r--r--lib/class/album.class.php4
-rw-r--r--lib/class/artist.class.php2
-rw-r--r--lib/class/song.class.php6
-rw-r--r--lib/ui.lib.php237
4 files changed, 16 insertions, 233 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index f03a1990..fc54f390 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -184,11 +184,11 @@ class Album {
foreach ($data as $key=>$value) { $this->$key = $value; }
/* Truncate the string if it's to long */
- $this->f_name = scrub_out(truncate_with_ellipse($this->name,Config::get('ellipse_threshold_album')));
+ $this->f_name = scrub_out(truncate_with_ellipsis($this->name,Config::get('ellipsis_threshold_album')));
$this->f_name_link = "<a href=\"$web_path/albums.php?action=show&amp;album=" . scrub_out($this->id) . "\" title=\"" . scrub_out($this->name) . "\">" . $this->f_name . "</a>";
$this->f_title = $name;
if ($this->artist_count == '1') {
- $artist = scrub_out(truncate_with_ellipse(trim($this->artist_prefix . ' ' . $this->artist_name),Config::get('ellipse_threshold_album')));
+ $artist = scrub_out(truncate_with_ellipsis(trim($this->artist_prefix . ' ' . $this->artist_name),Config::get('ellipsis_threshold_album')));
$this->f_artist = "<a href=\"$web_path/artists.php?action=show&amp;artist=" . $this->artist_id . "\">" . $artist . "</a>";
}
else {
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php
index eb18b539..3de53153 100644
--- a/lib/class/artist.class.php
+++ b/lib/class/artist.class.php
@@ -183,7 +183,7 @@ class Artist {
public function format() {
/* Combine prefix and name, trim then add ... if needed */
- $name = truncate_with_ellipse(trim($this->prefix . " " . $this->name));
+ $name = truncate_with_ellipsis(trim($this->prefix . " " . $this->name));
$this->f_name = $name;
//FIXME: This shouldn't be scrubing right here!!!!
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 4200ff2a..1dd7aa20 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -629,14 +629,14 @@ class Song {
// Format the album name
$this->f_album_full = $this->get_album_name();
- $this->f_album = truncate_with_ellipse($this->f_album_full,Config::get('ellipse_threshold_album'));
+ $this->f_album = truncate_with_ellipsis($this->f_album_full,Config::get('ellipse_threshold_album'));
// Format the artist name
$this->f_artist_full = $this->get_artist_name();
- $this->f_artist = truncate_with_ellipse($this->f_artist_full,Config::get('ellipse_threshold_artist'));
+ $this->f_artist = truncate_with_ellipsis($this->f_artist_full,Config::get('ellipse_threshold_artist'));
// Format the title
- $this->f_title = truncate_with_ellipse($this->title,Config::get('ellipse_threshold_title'));
+ $this->f_title = truncate_with_ellipsis($this->title,Config::get('ellipse_threshold_title'));
// Create Links for the different objects
$this->f_link = "<a href=\"" . Config::get('web_path') . "/stream.php?action=single_song&amp;song_id=" . $this->id . "\">$this->f_title</a>";
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index d7aaa0aa..7ae9e4ec 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -70,18 +70,6 @@ function flip_class($array=0) {
} // flip_class
/**
- * clear_now_playing
- * Clears the now playing information incase something has
- * gotten stuck in there
- */
-function clear_now_playing() {
-
- $sql = "TRUNCATE TABLE `now_playing`";
- $db_results = Dba::query($sql);
-
-} // clear_now_playing
-
-/**
* _
* checks to see if the alias _ is defined
* if it isn't it defines it as a simple return
@@ -95,14 +83,6 @@ if (!function_exists('_')) {
} // if _ isn't defined
/**
- * show_admin_menu
- * shows the admin menu
- */
-function show_admin_menu ($admin_highlight) {
- include(conf('prefix') . "/templates/admin_menu.inc");
-} // show_admin_menu
-
-/**
* access_denied
* throws an error if they try to do something
* that they aren't allowed to
@@ -188,21 +168,6 @@ function show_local_control () {
} // show_local_control
/**
- * truncate_with_ellipse
- * truncates a text file to specified length by adding
- * thre dots (ellipse) to the end
- * (Thx Nedko Arnaudov)
- * @todo Fix Spelling!
- * @depreciated
- */
-function truncate_with_ellipse($text, $max=27) {
-
- /* Run the function with the correct spelling */
- return truncate_with_ellipsis($text,$max);
-
-} // truncate_with_ellipse
-
-/**
* truncate_with_ellipsis
* Correct Spelling function that truncates text to a specific lenght
* and appends three dots, or an ellipsis to the end
@@ -327,8 +292,7 @@ function get_now_playing($filter='') {
* if they don't: insert them
*
*/
-
-function set_artist_rating($artist_id, $rate_user, $rating) {
+function set_artist_rating ($artist_id, $rate_user, $rating) {
$artist_id = sql_escape($artist_id);
$sql = "SELECT * FROM ratings WHERE user='$rate_user' AND object_type='artist' AND object_id='$artist_id'";
@@ -646,84 +610,6 @@ function show_genre($genre_id) {
} // show_genre
-function show_random_play_bar() {
-
- require (conf('prefix') . '/templates/show_random_play_bar.inc.php');
-
-} // show_random_play_bar()
-
-
-/*
- * show_artist_pulldown()
- *
- * Helper functions for album and artist functions
- *
- */
-function show_artist_pulldown ($artist_id,$select_name='artist') {
-
- $sq = "SELECT `id`,`name` FROM `artist` ORDER BY `name`";
- $db_results = Dba::query($sq);
-
- echo "\n<select name=\"$select_name\">\n";
-
- while ($data = Dba::fetch_assoc($db_results)) {
-
- if ( $artist_id == $data['id'] ) {
- echo "\t<option value=\"" . $data['id'] . "\" selected=\"selected\">". scrub_out($data['name']) . "</option>\n";
- }
- else {
- echo "\t<option value=\"" . $data['id'] . "\">". scrub_out($data['name']) ."</option>\n";
- }
-
- } // end while fetching artists
-
- echo "</select>\n";
-
-} // show_artist_pulldown
-
-/**
- * show_catalog_pulldown
- * This has been changed, first is the name of the
- * dropdown select, the second is the style to be applied
- *
- */
-function show_catalog_pulldown ($name='catalog',$style) {
-
- $sql = "SELECT `id`,`name` FROM `catalog` ORDER BY `name`";
- $db_result = Dba::query($sql);
-
- echo "\n<select name=\"" . $name . "\" style=\"" . $style . "\">\n";
-
- echo "<option value=\"-1\">" . _('All') . "</option>\n";
-
- while ($r = Dba::fetch_assoc($db_result)) {
- $catalog_name = scrub_out($r['name']);
-
- if ( $catalog == $r['id'] ) {
- echo " <option value=\"" .$r['id'] . "\" selected=\"selected\">$catalog_name</option>\n";
- }
- else {
- echo " <option value=\"" . $r['id'] . "\">$catalog_name</option>\n";
- }
- }
- echo "\n</select>\n";
-
-} // show_catalog_pulldown
-
-
-/**
- * show_submenu
- * This shows the submenu mojo for the sidebar, and I guess honestly anything
- * else you would want it to... takes an array of items which have ['url'] ['title']
- * and ['active']
- */
-function show_submenu($items) {
-
- require Config::get('prefix') . '/templates/subnavbar.inc.php';
-
-} // show_submenu
-
-
/**
* get_location
* This function gets the information about said persons currently location
@@ -840,49 +726,6 @@ function show_preference_box($preferences) {
} // show_preference_box
-
-/**
- * show_genre_pulldown
- * This shows a select of all of the genres, it takes the name of the select
- * the currently selected and then the size
- *
- */
-function show_genre_pulldown ($name,$selected='',$size=1,$width=0,$style='') {
-
- /* Get them genre hippies */
- $sql = "SELECT genre.id,genre.name FROM genre ORDER BY genre.name";
- $db_result = Dba::query($sql);
-
- if ($size > 0) {
- $multiple_txt = "multiple=\"multiple\" size=\"$size\"";
- }
- if ($style) {
- $style_txt = "style=\"$style\"";
- }
-
- echo "<select name=\"" . $name . "[]\" $multiple_txt $style_txt>\n";
- echo "\t<option value=\"-1\">" . _("All") . "</option>\n";
-
- while ($r = Dba::fetch_assoc($db_result)) {
-
- if ($width > 0) {
- $r['name'] = truncate_with_ellipsis($r['name'],$width);
- }
-
- $r['name'] = scrub_out($r['name']);
-
- if ( $selected == $r['id'] ) {
- echo "\t<option value=\"" . $r['id'] . "\" selected=\"selected\">" . $r['name'] . "</option>\n";
- }
- else {
- echo " <option value=\"" . $r['id'] . "\">" . $r['name'] . "</option>\n";
- }
- } // end while
-
- echo "</select>\n";
-
-} // show_genre_pulldown
-
/**
* good_email
* Don't get me started... I'm sure the indenting is still wrong on this
@@ -1024,24 +867,6 @@ function show_playlist_import() {
} // show_playlist_import
/**
- * show_songs
- * Still not happy with this function, but at least it's in the right
- * place now
- */
-function show_songs ($song_ids, $playlist, $album=0) {
-
- $dbh = dbh();
-
- $totaltime = 0;
- $totalsize = 0;
-
- require (conf('prefix') . "/templates/show_songs.inc");
-
- return true;
-
-} // show_songs
-
-/**
* show_album_select
* This displays a select of every album that we've got in Ampache, (it can be hella long) it's used
* by the Edit page, it takes a $name and a $album_id
@@ -1050,10 +875,10 @@ function show_album_select($name='album',$album_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name, prefix FROM album ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name`, `prefix` FROM `album` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$album_name = trim($r['prefix'] . " " . $r['name']);
if ($r['id'] == $album_id) {
@@ -1076,10 +901,10 @@ function show_artist_select($name='artist', $artist_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name, prefix FROM artist ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name`, `prefix` FROM `artist` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$artist_name = trim($r['prefix'] . " " . $r['name']);
if ($r['id'] == $artist_id) {
@@ -1103,10 +928,10 @@ function show_genre_select($name='genre',$genre_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name FROM genre ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name` FROM `genre` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$genre_name = $r['name'];
if ($r['id'] == $genre_id) {
@@ -1146,7 +971,6 @@ function show_catalog_select($name='catalog',$catalog_id=0,$style='') {
} // show_catalog_select
-
/**
* show_user_select
* This one is for users! shows a select/option statement so you can pick a user
@@ -1397,24 +1221,6 @@ function xml_get_footer($type){
} //xml_get_footer
/**
- * get_users
- * This returns an array of user objects and takes an sql statement
- */
-function get_users($sql) {
-
- $db_results = mysql_query($sql,dbh());
-
- $results = array();
-
- while ($u = mysql_fetch_assoc($db_results)) {
- $results[] = new User($u['id']);
- }
-
- return $results;
-
-} // get_users
-
-/**
* ajax_include
* This does an ob_start, getcontents, clean
* on the specified require, only works if you
@@ -1431,27 +1237,4 @@ function ajax_include($include) {
} // ajax_include
-/**
- * ajax_button
- * This is a generic function that generates the on(whateva) URL for ajaxie hotness
- * it takes a action url, icon name, alt tag and form_id (option)
- */
-function ajax_button($action,$icon,$alt,$post_id='') {
-
- $url = Config::get('ajax_url') . $action;
- $icon_url = Config::get('web_path') . '/images/icons/' . $icon . '.png';
-
- if ($post) {
- $ajax_string = "ajaxPost('$url','$post');";
- }
- else {
- $ajax_string = "ajaxPut('$url');";
- }
-
- $string = "<span onclick=\"$ajax_string;return true\">\n\t<img src=\"$icon_url\" border=\"0\" style=\"cursor:pointer;\" alt=\"$alt\" />\n</span>\n";
-
- return $string;
-
-} // ajax_button
-
?>