librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1198] merge gnukebox from trunk


From: Clint Adams
Subject: [Librefm-commits] [1198] merge gnukebox from trunk
Date: Tue, 05 May 2009 01:52:11 +0000

Revision: 1198
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1198
Author:   clint
Date:     2009-05-05 01:52:10 +0000 (Tue, 05 May 2009)
Log Message:
-----------
merge gnukebox from trunk

Modified Paths:
--------------
    branches/stable/gnukebox/fix-album-art.php
    branches/stable/gnukebox/install.php
    branches/stable/gnukebox/nowplaying/1.2/index.php
    branches/stable/gnukebox/scrobble-utils.php
    branches/stable/gnukebox/submissions/1.2/index.php

Modified: branches/stable/gnukebox/fix-album-art.php
===================================================================
--- branches/stable/gnukebox/fix-album-art.php  2009-05-05 01:42:33 UTC (rev 
1197)
+++ branches/stable/gnukebox/fix-album-art.php  2009-05-05 01:52:10 UTC (rev 
1198)
@@ -101,4 +101,4 @@
        return $image;
        }
 }
-?>
\ No newline at end of file
+?>

Modified: branches/stable/gnukebox/install.php
===================================================================
--- branches/stable/gnukebox/install.php        2009-05-05 01:42:33 UTC (rev 
1197)
+++ branches/stable/gnukebox/install.php        2009-05-05 01:52:10 UTC (rev 
1198)
@@ -226,6 +226,13 @@
                        url VARCHAR(255),
                        expires INTEGER NOT NULL DEFAULT 0,
                        PRIMARY KEY(username,session))");
+       
+       //Table for delete profile requests             
+       $res = $mdb2->query("CREATE TABLE Delete_Request (
+                       code VARCHAR(300), 
+                       expires INTEGER, 
+                       username VARCHAR(64) REFERENCES Users(username),
+                       PRIMARY KEY(code)");
 
        $res = $mdb2->exec("CREATE TABLE Scrobble_Track(
                        id SERIAL PRIMARY KEY,
@@ -249,7 +256,7 @@
 //      $res = $mdb2->exec("CREATE INDEX scrobbles_track_idx on 
Scrobbles(lower(track))");
 
 // uncomment these if you're using postgresql and want to run the software as 
www-data
-//     $res = $mdb2->exec("GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE 
Album, Artist, Auth, Clientcodes, Error, Invitation_Request, Invitations, 
Now_Playing, Places, Radio_Sessions, Scrobble_Sessions, Scrobbles, 
Scrobble_Track, Similar_Artist, Tags, Track, Users to \"www-data\"");
+//     $res = $mdb2->exec("GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE 
Album, Artist, Auth, Clientcodes, Delete_Request Error, Invitation_Request, 
Invitations, Now_Playing, Places, Radio_Sessions, Scrobble_Sessions, Scrobbles, 
Scrobble_Track, Similar_Artist, Tags, Track, Users to \"www-data\"");
 //     $res = $mdb2->exec("GRANT SELECT ON Free_Scrobbles to \"www-data\"");
 //     $res = $mdb2->exec("GRANT SELECT, UPDATE ON users_uniqueid_seq, 
scrobble_track_id_seq to \"www-data\"");
 

Modified: branches/stable/gnukebox/nowplaying/1.2/index.php
===================================================================
--- branches/stable/gnukebox/nowplaying/1.2/index.php   2009-05-05 01:42:33 UTC 
(rev 1197)
+++ branches/stable/gnukebox/nowplaying/1.2/index.php   2009-05-05 01:52:10 UTC 
(rev 1198)
@@ -46,8 +46,10 @@
        $expires = time() + 250; //Expire in 5 minutes if we don't know the 
track length
 }
 
-if(isset($_POST['m'])) {
-       $mbid = $mdb2->quote($_POST['m'], "text");
+$mb = validateMBID($_POST['m']);
+
+if($mb) {
+       $mbid = $mdb2->quote($mb, "text");
 } else {
        $mbid = 'NULL';
 }

Modified: branches/stable/gnukebox/scrobble-utils.php
===================================================================
--- branches/stable/gnukebox/scrobble-utils.php 2009-05-05 01:42:33 UTC (rev 
1197)
+++ branches/stable/gnukebox/scrobble-utils.php 2009-05-05 01:52:10 UTC (rev 
1198)
@@ -210,4 +210,17 @@
         return $image;
 }
 
+function validateMBID ($input) {
+if(isset($input)) {
+       $input = strtolower(rtrim($input));
+       
if(preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',
 $input)) {
+               return $input;
+       } else {
+               return null;
+       }
+} else {
+       return null;
+}
+
+}
 ?>

Modified: branches/stable/gnukebox/submissions/1.2/index.php
===================================================================
--- branches/stable/gnukebox/submissions/1.2/index.php  2009-05-05 01:42:33 UTC 
(rev 1197)
+++ branches/stable/gnukebox/submissions/1.2/index.php  2009-05-05 01:52:10 UTC 
(rev 1198)
@@ -61,7 +61,11 @@
        }
 
        if (!isset($_POST['t'][$i]) || !isset($_POST['a'][$i]) || 
!isset($_POST['i'][$i])) {
-           die("FAILED Track $i was submitted with empty mandatory 
field(s).\n");
+           $f = isset($_POST['t'][$i]) ? "T({$_POST['t'][$i]})" : 't';
+           $f .= isset($_POST['a'][$i]) ? "A({$_POST['a'][$i]})" : 'a';
+           $f .= isset($_POST['i'][$i]) ? "I({$_POST['i'][$i]})" : 'i';
+
+           die("FAILED Track $i was submitted with empty mandatory field(s): 
{$f}\n");
        }
 
        switch (mb_detect_encoding($_POST['t'][$i])) {
@@ -79,11 +83,15 @@
                date_default_timezone_set("UTC");
                $time = strtotime($_POST['i'][$i]);
        }
-       if(isset($_POST['m'][$i])) {
-               $mbid = $mdb2->quote(rtrim($_POST['m'][$i]), "text");
+
+       $mb = validateMBID($_POST['m'][$i]);
+
+       if($mb) {
+               $mbid = $mdb2->quote($mb, "text");
        } else {
                $mbid = 'NULL';
        }
+
        if(isset($_POST['o'][$i])) {
                $source = $mdb2->quote($_POST['o'][$i], "text");
        } else {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]