Ejemplo n.º 1
0
 public static function retrieveItem($id)
 {
     $db = DBConnection::db();
     $platforms = API::getPlatforms();
     $query = "SELECT `type`, `name`, `artist`, `album`, `image`";
     while (list($pId, $pObject) = each($platforms)) {
         if (!$pObject->isActiveForSearch()) {
             continue;
         }
         $query .= ", `" . _TABLE_LINK_PREFIX . $pObject->getSafeName() . "`";
         // column name = link_DEEZER, etc ...
     }
     reset($platforms);
     $query .= " FROM `items` WHERE id=:id LIMIT 1;";
     $statement = $db->prepare($query);
     $statement->bindParam(':id', $id, PDO::PARAM_INT);
     // Executes the query
     $exe = $statement->execute();
     if (!$exe || $exe == false || $statement->rowCount() != 1) {
         // Looks like it's expired ?
         return false;
     } else {
         // Fetch the info
         $row = $statement->fetch(PDO::FETCH_ASSOC);
         if (!$row) {
             return false;
         }
         while (list($pId, $pObject) = each($platforms)) {
             if (!$pObject->isActiveForSearch()) {
                 continue;
             }
             $linkProperty = _TABLE_LINK_PREFIX . $pObject->getSafeName();
             $links[$pObject->getId()] = web(trim(stripslashes($row[$linkProperty])));
         }
         return array("name" => $row["name"], "album" => $row["album"], "artist" => $row["artist"], "image" => $row["image"], "type" => $row["type"], "links" => $links);
     }
 }
Ejemplo n.º 2
0
    };
    var placement_id = window.CHITIKA.units.length;
    window.CHITIKA.units.push(unit);
    document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>');
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://scripts.chitika.net/getads.js';
    try {
      document.getElementsByTagName('head')[0].appendChild(s);
    } catch(e) {
      document.write(s.outerHTML);
    }
}());
</script>
<?
web_str(array_merge(web($qs,$start), web($qs,$start+4),web($qs,$start+8)));
			if (count($results) < $pageslimit) {
				echo '<li class="results">Oops!, You\'ve reached the end of the results.</li>';
			}

			echo '</ol>';
			video($qs,$page,6);
		pagination('?q='.$qe.'&search='.$search);
			echo'</div>';
		}

	}

	require_once("footer.php");
	?>
</body>
Ejemplo n.º 3
0
}
if (!is_writeable($outdir)) {
    echo "<h3>Output directory exists but it not writeable by '{$owner}'</h3>";
    echo "<h4>Please make writeable by '{$owner}'</h4>";
    echo "<p>{$outdir}</p>";
    echo "<p>Attempting to execute vi perl CGI...</p>";
    require "{$LD}/web.php";
    $data = array();
    $path = "/phplib/autogen.pl";
    if ($_ENV["SubFolder"]) {
        $path = "/" . $_ENV["SubFolder"] . $path;
    }
    if ($password = $_SERVER["PHP_AUTH_USER"]) {
        $password .= ":" . $_SERVER["PHP_AUTH_PW"];
    }
    echo web($_SERVER["HTTP_HOST"], $path, "POST", $data, $password);
    exit;
}
echo "Files will be output to {$outdir}\n";
echo "{$sitedomainname}<br /><br />\n";
echo "<p>Use this command to move the generated files into production...<br />\n";
echo "cd " . $_ENV["SiteRoot"] . "/phplib/autogen && cp -i *.inc *form.ihtml ..";
echo "<br /></p>\n";
ini_set("display_errors", "on");
function valid_name($str)
{
    $str = str_replace(" ", "_", $str);
    $str = str_replace("(", "_", $str);
    $str = str_replace(")", "_", $str);
    $str = str_replace("/", "_", $str);
    $str = str_replace(",", "_", $str);
Ejemplo n.º 4
0
 public function lookupPermalink($permalink)
 {
     // http://on.beatsmusic.com/albums/al8992411/tracks/tr8992441
     // http://on.beatsmusic.com/artists/ar27304
     // http://on.beatsmusic.com/albums/al6960443
     $REGEX_BEATS_TRACK = "/albums\\/al([0-9]*)\\/tracks\\/tr([0-9]*)\$/";
     $REGEX_BEATS_ALBUM = "/albums\\/al([0-9]*)\$/";
     $REGEX_BEATS_ARTIST = "/artists\\/ar([0-9]*)\$/";
     $track = null;
     $valid = false;
     if (preg_match($REGEX_BEATS_TRACK, $permalink, $match)) {
         $this->lookup_endpoint = 'api/tracks/tr%s';
         $result = $this->callPlatform("lookup", $match[2]);
         if ($result == null || !isset($result->data)) {
             return null;
         }
         // We encode the track to pass it on as the return track
         $track = array('name' => $result->data->title, 'artist' => $result->data->artist_display_name, 'album' => $result->data->refs->album->display, 'picture' => null, 'link' => web(sprintf($this->track_permalink, $match[1], $match[2])));
         // We modify the query
         $valid = true;
         $query = $track['album'] . "+" . $track['name'];
     } else {
         if (preg_match($REGEX_BEATS_ALBUM, $permalink, $match)) {
             $this->lookup_endpoint = 'api/albums/al%s';
             $result = $this->callPlatform("lookup", $match[1]);
             if ($result == null || !isset($result->data)) {
                 return null;
             }
             // We encode the track to pass it on as the return track
             $track = array('name' => null, 'artist' => $result->data->refs->artists[0]->display, 'album' => $result->data->title, 'picture' => null, 'link' => web(sprintf($this->album_permalink, $result->data->id)));
             // We modify the query
             $valid = true;
             $query = $track['artist'] . "+" . $track['album'];
         } else {
             if (preg_match($REGEX_BEATS_ARTIST, $permalink, $match)) {
                 $this->lookup_endpoint = 'api/artists/ar%s';
                 $result = $this->callPlatform("lookup", $match[1]);
                 if ($result == null || !isset($result->data)) {
                     return null;
                 }
                 // No tracks to encode
                 // We modify the query
                 $valid = true;
                 $query = $result->data->name;
             }
         }
     }
     if ($valid) {
         return array('query' => $query, 'track' => $track);
     } else {
         return null;
     }
 }