From ae97010e42c47115700b70d7e2d0789dda5deb94 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 6 Nov 2006 03:02:54 +0000 Subject: slight improvement to the democratic stuff and a stats fix --- lib/class/stats.class.php | 1 + lib/class/tmp_playlist.class.php | 16 ++++++++++++++++ templates/show_tv_adminctl.inc.php | 14 ++++++++++++-- tv.php | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/lib/class/stats.class.php b/lib/class/stats.class.php index 004e7b46..ee4fb3aa 100644 --- a/lib/class/stats.class.php +++ b/lib/class/stats.class.php @@ -56,6 +56,7 @@ class Stats { $type = $this->validate_type($type); $oid = sql_escape($oid); $user = sql_escape($user); + $date = time(); $sql = "INSERT INTO object_count (`object_type`,`object_id`,`date`,`user`) " . " VALUES ('$type','$oid','$date','$user')"; diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php index 127ea2d0..52bcf4c5 100644 --- a/lib/class/tmp_playlist.class.php +++ b/lib/class/tmp_playlist.class.php @@ -186,6 +186,22 @@ class tmpPlaylist { } // create + /** + * update_playlist + * This updates the base_playlist on this tmp_playlist + */ + function update_playlist($playlist_id) { + + $playlist_id = sql_escape($playlist_id); + $tmp_id = sql_escape($this->id); + + $sql = "UPDATE tmp_playlist SET tmp_playlist.base_playlist='$playlist_id' WHERE id='$tmp_id'"; + $db_results = mysql_query($sql,dbh()); + + return true; + + } // update_playlist + /** * delete * This deletes any other tmp_playlists assoicated with this diff --git a/templates/show_tv_adminctl.inc.php b/templates/show_tv_adminctl.inc.php index 77becb35..10dd004a 100644 --- a/templates/show_tv_adminctl.inc.php +++ b/templates/show_tv_adminctl.inc.php @@ -28,7 +28,17 @@ - +   - +
+: +
+ base_playlist); ?> + + +
diff --git a/tv.php b/tv.php index 9176b1fc..1cee4d00 100644 --- a/tv.php +++ b/tv.php @@ -34,6 +34,11 @@ $action = scrub_in($_REQUEST['action']); switch ($action) { case 'create_playlist': + /* Only Admins Here */ + if (!$GLOBALS['user']->has_access(100)) { + access_denied(); + break; + } /* We need to make ourselfs a new tmp playlist */ $tmp_playlist = new tmpPlaylist(); $id = $tmp_playlist->create('-1','vote','song',$_REQUEST['playlist_id']); @@ -43,6 +48,15 @@ switch ($action) { $songs = $tmp_playlist->get_items(); require_once(conf('prefix') . '/templates/show_tv.inc.php'); break; + case 'update_playlist': + /* Only Admins Here */ + if (!$GLOBALS['user']->has_access(100)) { + access_denied(); + break; + } + $tmp_playlist = new tmpPlaylist($_REQUEST['tmp_playlist_id']); + $tmp_playlist->update_playlist($_REQUEST['playlist_id']); + /* Display the default tv page */ default: $tmp_playlist = get_democratic_playlist('-1'); $songs = $tmp_playlist->get_items(); -- cgit