librefm-commits
[Top][All Lists]
Advanced

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

[Librefm-commits] [1493] Revert r1489 and r1492


From: Jørgen Bøhnsdalen
Subject: [Librefm-commits] [1493] Revert r1489 and r1492
Date: Mon, 11 May 2009 21:30:01 +0000

Revision: 1493
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1493
Author:   jurgbohn
Date:     2009-05-11 21:30:00 +0000 (Mon, 11 May 2009)
Log Message:
-----------
Revert r1489 and r1492

Modified Paths:
--------------
    branches/stable/gnukebox/submissions/1.2/index.php
    trunk/gnukebox/submissions/1.2/index.php

Modified: branches/stable/gnukebox/submissions/1.2/index.php
===================================================================
--- branches/stable/gnukebox/submissions/1.2/index.php  2009-05-11 21:15:09 UTC 
(rev 1492)
+++ branches/stable/gnukebox/submissions/1.2/index.php  2009-05-11 21:30:00 UTC 
(rev 1493)
@@ -22,20 +22,19 @@
 require_once('../../scrobble-utils.php');
 
 if(!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t']) || 
!isset($_POST['i'])) {
-       reportError($_POST['u'] . ' POST FAILED', var_dump($_POST));
-       die("Failed Required POST parameters are not set\r\n");
+       die("Failed Required POST parameters are not set\n");
 }
 if(empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t']) || 
empty($_POST['i'])) {
-       die("Failed Required POST parameters are empty\r\n");
+       die("Failed Required POST parameters are empty\n");
 }
 
 if(!is_array($_POST['a']) || !is_array($_POST['t']) || !is_array($_POST['i'])) 
{
-       die("FAILED Track parameters must be arrays\r\n");
+       die("FAILED Track parameters must be arrays\n");
 }
 
 $session_id = $_POST['s'];
 
-$username = $mdb2->quote(usernameFromSID($session_id), "text");
+$username = $adodb->qstr(usernameFromSID($session_id));
 $rowvalues = array();
 $actualcount = 0;
 
@@ -43,19 +42,19 @@
                switch (mb_detect_encoding($_POST['a'][$i])) {
                case "ASCII":
                case "UTF-8":
-                       $artist = $mdb2->quote($_POST['a'][$i], "text");
+                       $artist = $adodb->qstr($_POST['a'][$i]);
                        break;
                default:
-                       die("FAILED Bad encoding in artist submission $i\r\n");
+                       die("FAILED Bad encoding in artist submission $i\n");
                }
        if(isset($_POST['b'][$i]) && !empty($_POST['b'])) {
                switch (mb_detect_encoding($_POST['b'][$i])) {
                case "ASCII":
                case "UTF-8":
-                       $album = $mdb2->quote($_POST['b'][$i], "text");
+                       $album = $adodb->qstr($_POST['b'][$i]);
                        break;
                default:
-                       die("FAILED Bad encoding in album submission $i\r\n");
+                       die("FAILED Bad encoding in album submission $i\n");
                }
        } else {
                $album = 'NULL';
@@ -66,16 +65,16 @@
            $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}\r\n");
+           die("FAILED Track $i was submitted with empty mandatory field(s): 
{$f}\n");
        }
 
        switch (mb_detect_encoding($_POST['t'][$i])) {
                case "ASCII":
                case "UTF-8":
-                   $track = $mdb2->quote($_POST['t'][$i], "text");
+                   $track = $adodb->qstr($_POST['t'][$i]);
                    break;
                default:
-                       die("FAILED Bad encoding in title submission $i\r\n");
+                       die("FAILED Bad encoding in title submission $i\n");
        }
        if(is_numeric($_POST['i'][$i])) {
                $time = (int) $_POST['i'][$i];
@@ -88,29 +87,29 @@
        $mb = validateMBID($_POST['m'][$i]);
 
        if($mb) {
-               $mbid = $mdb2->quote($mb, "text");
+               $mbid = $adodb->qstr($mb);
        } else {
                $mbid = 'NULL';
        }
 
        if(isset($_POST['o'][$i])) {
-               $source = $mdb2->quote($_POST['o'][$i], "text");
+               $source = $adodb->qstr($_POST['o'][$i]);
        } else {
                $source = 'NULL';
        }
        if(!empty($_POST['r'][$i])) {
-               $rating = $mdb2->quote($_POST['r'][$i], "text");
+               $rating = $adodb->qstr($_POST['r'][$i]);
        } else {
-               $rating = $mdb2->quote("0", "text"); // use the fake rating 
code 0 for now
+               $rating = $adodb->qstr("0"); // use the fake rating code 0 for 
now
        }
        if(isset($_POST['l'][$i])) {
-               $length = $mdb2->quote($_POST['l'][$i], "integer");
+               $length = (int)($_POST['l'][$i]);
        } else {
                $length = 'NULL';
        }
 
        if(($time - time()) > 300) {
-            die("FAILED Submitted track has timestamp in the future\r\n"); // 
let's try a 5-minute tolerance
+            die("FAILED Submitted track has timestamp in the future\n"); // 
let's try a 5-minute tolerance
        }
 
        createArtistIfNew($artist);
@@ -141,36 +140,38 @@
 
        if(($i+1) == count($_POST['a']) && $actualcount>0) {
 
-               $mdb2->exec("BEGIN");
+               $adodb->StartTrans();
 
                for($j = 0; $j < $actualcount; $j++) {
 
        // Scrobble!
                $sql = "INSERT INTO Scrobbles (username, artist, album, track, 
time, mbid, source, rating, length, stid) VALUES " . $rowvalues[$j];
-               $res =& $mdb2->exec($sql);
+               $res =& $adodb->Execute($sql);
                if(PEAR::isError($res)) {
                    $msg = $res->getMessage() . " - " . $res->getUserInfo();
-                   $mdb2->exec("ROLLBACK");
+                   $adodb->FailTrans();
+                   $adodb->CompleteTrans();
                    reportError($msg, $sql);
-                    die("FAILED " . $msg . "\nError has been reported to site 
administrators.\r\n");
+                    die("FAILED " . $msg . "\nError has been reported to site 
administrators.\n");
                }
 
                }
 
-               $mdb2->exec("COMMIT");
+               $adodb->CompleteTrans();
 
                if(PEAR::isError($res)) {
                    $msg = $res->getMessage() . " - " . $res->getUserInfo();
-                   $mdb2->exec("ROLLBACK");
+                   $adodb->FailTrans();
+                   $adodb->CompleteTrans();
                    reportError($msg, $sql);
-                    die("FAILED " . $msg . "\nError has been reported to site 
administrators.\r\n");
+                    die("FAILED " . $msg . "\nError has been reported to site 
administrators.\n");
                }
 
                // Destroy now_playing since it is almost certainly obsolescent
-               $mdb2->exec("DELETE FROM Now_Playing WHERE sessionid = " . 
$mdb2->quote($session_id, "text"));
+               $adodb->Execute("DELETE FROM Now_Playing WHERE sessionid = " . 
$adodb->qstr($session_id));
        }
 }
 
-die("OK\r\n");
+die("OK\n");
 
 ?>

Modified: trunk/gnukebox/submissions/1.2/index.php
===================================================================
--- trunk/gnukebox/submissions/1.2/index.php    2009-05-11 21:15:09 UTC (rev 
1492)
+++ trunk/gnukebox/submissions/1.2/index.php    2009-05-11 21:30:00 UTC (rev 
1493)
@@ -22,7 +22,6 @@
 require_once('../../scrobble-utils.php');
 
 if(!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t']) || 
!isset($_POST['i'])) {
-       reportError($_POST['u'] . ' POST FAILED', var_dump($_POST));
        die("Failed Required POST parameters are not set\n");
 }
 if(empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t']) || 
empty($_POST['i'])) {





reply via email to

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