Ejemplo n.º 1
0
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
require "init.inc.php";
$page->forceLogin();
//sotf_Utils::getParameter("");
$playlist = new sotf_UserPlaylist();
if (sotf_Utils::getParameter("delete_selected") != "") {
    $checkbox = sotf_Utils::getParameter("checkbox");
    $max = count($checkbox);
    for ($i = 0; $i < $max; $i++) {
        $playlist->delete($checkbox[$i]);
    }
    $page->redirect("playlist.php");
}
if (sotf_Utils::getParameter("play_selected") != "") {
    $pl = new sotf_Playlist();
    $checkbox = sotf_Utils::getParameter("checkbox");
    for ($i = 0; $i < count($checkbox); $i++) {
        $prg = new sotf_Programme($checkbox[$i]);
        $pl->addProg($prg);
    }
    $pl->startStreaming();
    $pl->sendRemotePlaylist();
    $page->logRequest();
    exit;
}
$result = $playlist->load();
$programmes = array();
for ($i = 0; $i < count($result); $i++) {
    $result[$i]['icon'] = sotf_Blob::cacheIcon($result[$i]['id']);
    $programmes["0:" . $i] = $result[$i]["title"];
Ejemplo n.º 2
0
<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id$
 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Authors: András Micsik, Máté Pataki, Tamás Déri 
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
require "init.inc.php";
$id = sotf_Utils::getParameter('id');
$fileid = sotf_Utils::getParameter('fileid');
if (empty($id)) {
    raiseError("Missing parameters!");
}
$prg = new sotf_Programme($id);
$playlist = new sotf_Playlist();
$playlist->addProg($prg, $fileid);
$playlist->startStreaming();
$playlist->sendRemotePlaylist();
$page->logRequest();
Ejemplo n.º 3
0
<?php

require "init.inc.php";
$page->forceLogin();
$playlist = new sotf_Playlist();
if (sotf_Utils::getParameter("close") == "true") {
    $lista = sotf_Utils::getParameter("lista");
    $list = split("\\|", $lista);
    $max = count($list);
    for ($i = 1; $i < $max; $i++) {
        $l = split(":", $list[$i]);
        if ($l[1] != $i) {
            //print($l[0].":".$l[1]." -> ".$i."<br>");
            $playlist->setOrder($l[0], $i);
        }
    }
    $page->redirect("closeAndRefresh.php");
    //die("<HTML><HEAD></HEAD><BODY onload='javascript:window.opener.location.reload();window.close();'></BODY></HTML>");
}
$result = $playlist->load();
$programmes = array();
foreach ($result as $value) {
    $programmes[$value["id"] . ":" . $value["order_id"]] = $value["title"];
}
$smarty->assign("result", $result);
$smarty->assign("count", count($result));
$smarty->assign("programmes", $programmes);
$page->sendPopup("playlistPopup.htm");
Ejemplo n.º 4
0
 function send($template = 'main.htm')
 {
     global $smarty, $totalTime;
     if ($this->popup) {
         if ($template == 'main.htm') {
             $template = 'main_popup.htm';
         }
         $smarty->assign('POPUP', 1);
     }
     if (!$this->popup && !$this->halted) {
         if ($_SESSION['stream']) {
             $smarty->assign('STREAM_DATA', $_SESSION['stream']);
             // collect streaming info
             $playlist = new sotf_Playlist();
             $smarty->assign("STREAM_INFO", $playlist->getStreamInfo($_SESSION['stream']));
         }
     }
     unset($_SESSION['halted']);
     session_unregister('halted');
     // handle status messages
     $smarty->assign('STATUS_MESSAGES', $_SESSION['statusMsgs']);
     unset($_SESSION['statusMsgs']);
     session_unregister('statusMsgs');
     $smarty->assign('ERROR_MESSAGES', $_SESSION['errorMsgs']);
     unset($_SESSION['errorMsgs']);
     session_unregister('errorMsgs');
     stopTiming();
     $smarty->assign("totalTime", $totalTime);
     $smarty->display($template);
     $this->logRequest();
     //exit; //??
 }
Ejemplo n.º 5
0
$dir->close();
line("CLEANED TMP DIR");
debug("cleaning", "cacheDir");
$clearTime = time() - 60 * 60;
$dir = dir($config['cacheDir']);
while ($entry = $dir->read()) {
    if ($entry == "." || $entry == "..") {
        continue;
    }
    $file = $config['cacheDir'] . "/{$entry}";
    if (is_dir($file)) {
        continue;
    }
    if (filemtime($file) < $clearTime) {
        if (!unlink($file)) {
            logError("could not delete: {$file}");
        }
    }
}
$dir->close();
line("CLEANED CACHE DIR");
// TODO update subject tree language availability
// TODO remove old sotf_delete objects
// ******** Stop old streams
$playlist = new sotf_Playlist();
$playlist->stopOldStreams();
line("CRON FINISHED");
stopTiming();
$page->logRequest();
debug("--------------- CRON FINISHED -----------------------------------");
//echo "<h4>Cron.php completed</h4>";
Ejemplo n.º 6
0
        $audioFiles[$i] = array_merge($audioFiles[$i], sotf_AudioFile::decodeFormatFilename($audioFiles[$i]['format']));
    }
    $smarty->assign('AUDIO_FILES', $audioFiles);
    // other files
    $otherFiles = $prg->getAssociatedObjects('sotf_other_files', 'filename');
    $smarty->assign('OTHER_FILES', $otherFiles);
    // links
    $smarty->assign('LINKS', $prg->getAssociatedObjects('sotf_links', 'caption'));
    // referencing portals
    $smarty->assign('REFS', $prg->getRefs());
    // statistics
    $smarty->assign('STATS', $prg->getStats());
    // add this visit to statistics
    $prg->addStat('', "visits");
    // rating
    $rating = new sotf_Rating();
    $smarty->assign('RATING', $rating->getInstantRating($id));
    // my rating?
    debug("r", $rating->getMyRating($id));
    $smarty->assign('MY_RATING', $rating->getMyRating($id));
    if ($page->loggedIn()) {
        // is in my playlist?
        $smarty->assign('inplaylist', sotf_Playlist::contains($id));
    }
}
if (sotf_Utils::getParameter('popup')) {
    $smarty->assign('POPUP', 1);
    $page->sendPopup();
} else {
    $page->send();
}
Ejemplo n.º 7
0
<?php

require "init.inc.php";
$page->forceLogin();
//sotf_Utils::getParameter("");
$playlist = new sotf_Playlist();
if (sotf_Utils::getParameter("delete_selected") != "") {
    $checkbox = sotf_Utils::getParameter("checkbox");
    $max = count($checkbox);
    for ($i = 0; $i < $max; $i++) {
        $playlist->delete($checkbox[$i]);
    }
    $page->redirect("playlist.php");
}
if (sotf_Utils::getParameter("play_selected") != "") {
    $playlistFiles = array();
    $checkbox = sotf_Utils::getParameter("checkbox");
    $max = count($checkbox);
    for ($i = 0; $i < $max; $i++) {
        $playlistFiles[$checkbox[$i]] = $playlist->getFilename($checkbox[$i]);
    }
    print "<pre>";
    var_dump($playlistFiles);
    print "</pre>";
    //	$page->redirect("playlist.php");
    /*
    	$filename = '';
    	if (is_writable($filename))	// Let's make sure the file exists and is writable first.
    	{
    	    if (!$fp = fopen($filename, 'w'))
    	    {
Ejemplo n.º 8
0
$data['numUsers'] = sotf_User::countUsers();
$smarty->assign($data);
$smarty->assign('STATIONS', sotf_Station::listStationNames());
$searchLangs = $languages;
array_unshift($searchLangs, "any_language");
for ($i = 0; $i < count($searchLangs); $i++) {
    $langNames[$i] = $page->getlocalized($searchLangs[$i]);
}
$smarty->assign('searchLangs', $searchLangs);
$smarty->assign('langNames', $langNames);
$now = getDate();
$dayInThePast = mktime(0, 0, 0, $now['mon'], $now['mday'] - 10, $now['year']);
$fromDay = date('Y-m-d', $dayInThePast);
if ($page->loggedIn()) {
    // get playlist
    $playlist = new sotf_Playlist();
    $smarty->assign('PLAYLIST', $playlist->load());
    // check if user has default query
    $advsearch = new sotf_AdvSearch();
    $prefs = $user->getPreferences();
    $defQuery = $prefs->getDefaultQuery();
}
// show default query instead of new programmes
if ($defQuery) {
    $smarty->assign("DEF_QUERY", 1);
    debug("default query", $defQuery);
    $advsearch->Deserialize($defQuery);
    $query = $advsearch->GetSQLCommand();
    debug("query", $query);
    //get the number of results
    $max = $db->getOne("SELECT count(*) FROM ( {$query} ) as foo ");
Ejemplo n.º 9
0
    }
    print "kesz";
} elseif ($name == "editorflag") {
    $x = new sotf_Object("sotf_user_progs");
    $x->set('user_id', $user->id);
    $x->set('prog_id', $id);
    $x->find();
    $x->set('flags', $value);
    if ($x->id) {
        if ($value == "none") {
            $x->delete();
        } else {
            $x->update();
        }
    } else {
        $x->create();
    }
    //	else print("<script type=\"text/javascript\" language=\"javascript1.1\">error();</script>");
    print "kesz";
} elseif ($name == "addplaylist") {
    $playlist = new sotf_Playlist();
    $playlist->add($id);
    print "kesz";
} else {
    print "<script type=\"text/javascript\" language=\"javascript1.1\">error();</script>";
}
$page->alertWithErrors();
?>
</body>
</html>