From 66dd1ff782816a301d10ae3d2eaabcd37cbf9dc5 Mon Sep 17 00:00:00 2001 From: Afterster Date: Mon, 15 Sep 2014 07:37:17 +0200 Subject: [PATCH] Image art on artists edition and index display preferences --- arts.php | 2 +- lib/class/art.class.php | 6 +-- lib/class/artist.class.php | 6 +-- lib/class/recommendation.class.php | 2 + lib/class/ui.class.php | 9 ++++ lib/class/update.class.php | 52 ++++++++++++++++++++- lib/preferences.php | 4 ++ templates/header.inc.php | 2 +- templates/show_artist_info.inc.php | 14 ++++-- templates/show_artist_row.inc.php | 10 ++++ templates/show_artists.inc.php | 6 +++ templates/show_html5_player_headers.inc.php | 9 ++++ templates/show_index.inc.php | 12 +++-- 13 files changed, 115 insertions(+), 19 deletions(-) diff --git a/arts.php b/arts.php index 258e9c2d..9ec388ad 100644 --- a/arts.php +++ b/arts.php @@ -28,7 +28,7 @@ $object_type = $_GET['object_type']; $object_id = $_GET['object_id']; $burl = ''; if (isset($_GET['burl'])) { - $burl = rawurldecode($_GET['burl']); + $burl = base64_decode($_GET['burl']); } /* Switch on Action */ diff --git a/lib/class/art.class.php b/lib/class/art.class.php index 71cf53ec..8b59bd90 100644 --- a/lib/class/art.class.php +++ b/lib/class/art.class.php @@ -1482,15 +1482,13 @@ class Art extends database_object echo ""; } echo "
"; - $burl = substr($_SERVER['REQUEST_URI'], strlen(AmpConfig::get('raw_web_path'))); - $burl = rawurlencode(ltrim($burl, '/')); if ($GLOBALS['user']->has_access('25')) { - echo ""; + echo ""; } if ($GLOBALS['user']->has_access('75')) { - echo ""; + echo ""; echo UI::get_icon('delete', T_('Reset Art')); echo ""; } diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index d65e28fa..1971a19d 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -691,7 +691,7 @@ class Artist extends database_object implements library_item $sql = 'UPDATE `artist` SET `name` = ? WHERE `id` = ?'; Dba::write($sql, array($name, $current_id)); } - + $this->update_artist_info($summary, $placeformed, $yearformed); $this->name = $name; @@ -745,11 +745,11 @@ class Artist extends database_object implements library_item { $sql = "UPDATE `artist` SET `summary` = ?, `placeformed` = ?, `yearformed` = ?, `last_update` = ? WHERE `id` = ?"; $sqlret = Dba::write($sql, array($summary, $placeformed, $yearformed, time(), $this->id)); - + $this->summary = $summary; $this->placeformed = $placeformed; $this->yearformed = $yearformed; - + return $sqlret; } diff --git a/lib/class/recommendation.class.php b/lib/class/recommendation.class.php index 72831954..4d534215 100644 --- a/lib/class/recommendation.class.php +++ b/lib/class/recommendation.class.php @@ -325,6 +325,7 @@ class Recommendation // Data newer than 6 months, use it if (($artist->last_update + 15768000) > time()) { $results = array(); + $results['id'] = $artist_id; $results['summary'] = $artist->summary; $results['placeformed'] = $artist->placeformed; $results['yearformed'] = $artist->yearformed; @@ -346,6 +347,7 @@ class Recommendation $results['megaphoto'] = $xml->artist->image[4]; if ($artist) { + $results['id'] = $artist->id; if (!empty($results['summary']) || !empty($results['megaphoto'])) { $artist->update_artist_info($results['summary'], $results['placeformed'], $results['yearformed']); diff --git a/lib/class/ui.class.php b/lib/class/ui.class.php index 19e0622a..1c5835c8 100644 --- a/lib/class/ui.class.php +++ b/lib/class/ui.class.php @@ -329,4 +329,13 @@ END; ob_flush(); flush(); } + + public static function get_logo_url() + { + if (AmpConfig::get('custom_logo')) { + return AmpConfig::get('custom_logo'); + } else { + return AmpConfig::get('web_path') . AmpConfig::get('theme_path') . '/images/ampache.png'; + } + } } diff --git a/lib/class/update.class.php b/lib/class/update.class.php index e5f52215..c98c965f 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -449,6 +449,9 @@ class Update $update_string = '- Add limit of media count for direct play preference.
'; $version[] = array('version' => '370016','description' => $update_string); + $update_string = '- Add home display settings.
'; + $version[] = array('version' => '370017','description' => $update_string); + return $version; } @@ -2965,7 +2968,7 @@ class Update { $retval = true; - $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . "VALUES ('direct_play_limit','0','Limit direct play to maximum media count',25,'integer','interface')"; $retval = Dba::write($sql) ? $retval : false; $id = Dba::insert_id(); @@ -2974,4 +2977,51 @@ class Update return $retval; } + + /** + * update 370017 + * + * Add home display settings + */ + public static function update_370017() + { + $retval = true; + + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('home_moment_albums','1','Show Albums of the moment at home page',25,'integer','interface')"; + $retval = Dba::write($sql) ? $retval : false; + $id = Dba::insert_id(); + $sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')"; + $retval = Dba::write($sql, array($id)) ? $retval : false; + + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('home_moment_videos','1','Show Videos of the moment at home page',25,'integer','interface')"; + $retval = Dba::write($sql) ? $retval : false; + $id = Dba::insert_id(); + $sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')"; + $retval = Dba::write($sql, array($id)) ? $retval : false; + + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('home_recently_played','1','Show Recently Played at home page',25,'integer','interface')"; + $retval = Dba::write($sql) ? $retval : false; + $id = Dba::insert_id(); + $sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')"; + $retval = Dba::write($sql, array($id)) ? $retval : false; + + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('home_now_playing','1','Show Now Playing at home page',25,'integer','interface')"; + $retval = Dba::write($sql) ? $retval : false; + $id = Dba::insert_id(); + $sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')"; + $retval = Dba::write($sql, array($id)) ? $retval : false; + + $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('custom_logo','','Custom logo url',25,'string','interface')"; + $retval = Dba::write($sql) ? $retval : false; + $id = Dba::insert_id(); + $sql = "INSERT INTO `user_preference` VALUES (-1,?,'')"; + $retval = Dba::write($sql, array($id)) ? $retval : false; + + return $retval; + } } diff --git a/lib/preferences.php b/lib/preferences.php index 3243492f..1763f437 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -185,6 +185,10 @@ function create_preference_input($name,$value) case 'daap_backend': case 'upnp_backend': case 'album_release_type': + case 'home_moment_albums': + case 'home_moment_videos': + case 'home_recently_played': + case 'home_now_playing': $is_true = ''; $is_false = ''; if ($value == '1') { diff --git a/templates/header.inc.php b/templates/header.inc.php index cefe3a98..e9399679 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -264,7 +264,7 @@ $_SESSION['login'] = false;