예제 #1
0
		.Get note 		.Get matiere 	nil 		nil
		.Get date
		.Get matiere
*/
include 'co_Bdd.php';
try {
    if (checkArgument() && checkUser($_GET['name'], $_GET['id'], $bdd)) {
        switch ($_GET['action']) {
            case 'set':
                $disp = setNote($bdd);
                break;
            case 'get':
                $disp = getNote($bdd);
                break;
            case 'getLast':
                $disp = getLast($bdd);
                break;
            case 'getAll':
                $disp = getAll($bdd);
                break;
            default:
                throw new Exception('ActionNotFound', 04);
                break;
        }
        echo json_encode($disp, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
    }
} catch (Exception $e) {
    $disp = array("Status" => "Error", "Message" => $e->getMessage(), "Code" => $e->getCode());
    echo json_encode($disp, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
}
function checkUser($name, $id, $bdd)
예제 #2
0
function addSongToQueue($id)
{
    global $dbconn;
    $add;
    if (songRequestIsTooSoon($id)) {
        $add = R_SONG_REQUEST_TOO_SOON;
    } else {
        $start = microtime(true);
        pg_execute($dbconn, "addToQueue", array($id, CACHE_IN_PROGRESS)) or die('Insertion of song with ID: ' . $id . ' has failed!');
        updateSongRequestTime($id, time());
        $add = R_SUCCESS;
        $last_queue = getLast();
        $song = $last_queue[1];
        $cmd = "python /var/www/SonicFlow/assets/includes/pygs/download.py \"" . addslashes($song->title) . "\" " . $song->id . " \" " . addslashes($song->artist) . "\" " . $song->artistId . " \"" . addslashes($song->album) . "\" " . $song->albumId . " \"" . $song->arturl . "\" " . $song->track . " " . $song->popularity . " " . $song->duration . " " . $last_queue[0];
        exec($cmd . " > /dev/null 2>&1 &");
    }
    return $add;
}
예제 #3
0
파일: index.php 프로젝트: GM-Team/web
 } else {
     if (isset($_GET['log'])) {
         $interaction_id = trim($_GET['log']);
         $request = getLogs($interaction_id);
         if ($request !== null) {
             header('Content-Type: application/json');
             echo json_encode($request);
             exit;
         } else {
             header('Content-Type: application/json');
             echo json_encode(['error' => 'Error: Specified logs do not exist!']);
             exit;
         }
     } else {
         if (isset($_GET['last'])) {
             $last = getLast();
             if ($last !== null) {
                 echo json_encode($last);
                 exit;
             } else {
                 echo json_encode(['error' => 'Error: Last ticket not found!']);
                 exit;
             }
         } else {
             if (isset($_GET['user'])) {
                 $gm_id = trim($_GET['user']);
                 $user = getUser($gm_id);
                 if ($user !== null) {
                     header('Content-Type: application/json');
                     echo json_encode($user);
                     exit;
예제 #4
0
function grabAnchors($hrefLinks, $main_site)
{
    // grab the last id for this main site
    $query = 'SELECT max(link_id),link_id FROM scrapper WHERE main_site_id = ' . $hrefLinks['main_site_id'];
    $result = fetch_record($query);
    $id = intval($result['link_id']);
    // cURL the link and dump into the array the result
    $array = curlHREF($hrefLinks['ref_link']);
    sort($array);
    // $array is returned as sorted array. get the fist and last
    // index of the a-html-tag and start the loop from there
    // anything else can be ignored
    // get begin index
    $startpos = getStart($array);
    // get last index
    $endpos = getLast($array, $startpos);
    // if startpos = endpos, it would mean that the a-html-tag is not found properly
    // update the document and exit
    if ($startpos == $endpos) {
        updateDocument($hrefLinks);
        return;
    }
    // start parsing the a-html-tag
    for ($i = $startpos; $i <= $endpos; $i++) {
        // extract the href from the a-html-tag
        $href_a = getHREF($array[$i]);
        // check if link if to be excluded
        if (excludLink($href_a, $main_site) === false) {
            if (checkduplicate($href_a) === true) {
                $id = $id + 1;
                $query = "INSERT INTO scrapper (main_site_id, ref_link, link_id) VALUES ('" . $hrefLinks['main_site_id'] . "','" . $href_a . "','" . $id . "')";
                // add the links
                run_mysql_query($query);
            }
        }
    }
    // update the document after the parsing of the a-html-tag
    updateDocument($hrefLinks);
    return;
}
예제 #5
0
<?php

require_once "config.php";
require_once "assets/includes/sonicflow.php";
/*
 * This will check whether there is a new song yet.
 * Returns true if there is a new song; otherwise, false.
 * If this is being called from the now playing page, then it
 *   will return the new song id if there is a new song; otherwise, 0.
 */
$id_front = $_POST['id_front'];
$id_back = $_POST['id_back'];
$from = $_POST['from'];
if ($from == "queue") {
    $song_front = getNext();
    $song_back = getLast();
    $song_front = $song_front[1];
    $song_back = $song_back[1];
    echo $id_front != $song_front->id || $id_back != $song_back->id;
} else {
    $song_front = getNext();
    $song_front = $song_front[1];
    if ($id_front != $song_front->id) {
        $json = getSongJson($song_front);
        echo $json;
    } else {
        echo 0;
    }
}
function getSongJson($song)
{
예제 #6
0
파일: weeb.php 프로젝트: johnymarek/manta
    $url_parsed = parse_url('http://www.weeb.tv/?' . $strumien);
    parse_str($url_parsed['query'], $dane);
    //print_r($dane);
    $link = 'exec ' . dirpath . 'bin/rtmpdump -o - -r "' . $dane["10"] . '/' . $dane["11"] . $hd_link . '" -W "http://static2.weeb.tv/player.swf" -p "http://weeb.tv" -y "' . $dane["11"] . $hd_link . '" --weeb "' . $dane["73"] . ';' . WEEB_LOGIN . ';' . WEEB_HASLO . '" -v';
    //echo $link;
    $weeb_play = fopen(dirpath . "weeb.cgi", 'w');
    fwrite($weeb_play, "#!/bin/sh\ncat <<EOF\nContent-type: \"video/mp4\"\n\nEOF\n" . $link);
    fclose($weeb_play);
    chmod(dirpath . "weeb.cgi", 0755);
    echo webpath . 'weeb.cgi';
}
function getLast()
{
    $wlast = file_get_contents(dirpath . "weeb.last");
    echo webpath . 'weeb.php?' . $wlast;
}
function generateFooter()
{
    echo <<<FOO
</channel>
</rss>
FOO;
}
if (isset($_GET['stream'])) {
    getLink($_GET['stream'], $_GET['hd']);
} elseif (isset($_GET['last'])) {
    getLast();
} else {
    getChannels();
    generateFooter();
}
    $dataDecoded['userID'] = $userID['user_id'];
    unset($dataDecoded['userHash']);
}
//This switch statement controls the request's program flow, depending on the defined action property.
switch ($action) {
    case 'get':
        get($db, $table, $where);
        break;
    case 'getUserProfile':
        getUserProfile($db, $table, $where);
        break;
    case 'getVisualisationData':
        getUserData($db, $dataDecoded);
        break;
    case 'getLast':
        getLast($db, $table, $where);
        break;
    case 'getMostFrequent':
        getMostFrequent($db, $table, $where, $colForCount, $groupBy, $orderBy, $ascOrDesc, $limit);
        break;
    case 'save':
        save($db, $table, $dataDecoded);
        break;
    case 'confirmIDPassword':
        confirmIDPassword($db, $dataDecoded);
        break;
    case 'usernameUnique':
        usernameUnique($db, $dataDecoded);
        break;
    case 'getUserId':
        getUserId($db, $dataDecoded);