예제 #1
0
    $newProgs = $series->listProgrammes(0, $items);
    //debug("progs", $newProgs);
    if (is_array($newProgs)) {
        foreach ($newProgs as $prog) {
            addItem($rss, $prog);
        }
    }
    $rss .= "\n</channel>";
} elseif ($stationId) {
    // *************** STATION *******************
    // send list of new progs in station
    if ($repository->looksLikeId($stationId)) {
        $station = $repository->getObject($stationId);
    }
    if (!$station) {
        $station = sotf_Station::getByName($stationId);
    }
    if (!$station) {
        raiseError("no such station: {$stationName}");
    }
    // define channel
    $rss .= "\n<channel>";
    writeTag($rss, "title", $station->get('name'));
    writeTag($rss, "link", $config['rootUrl'] . "/showStation.php/" . $station->id);
    writeTag($rss, "language", $station->get2LetterLanguageCode());
    writeTag($rss, "description", $station->get('description'));
    // TODO: editor e-mail
    writeTag($rss, "webMaster", $config['adminEmail']);
    //writeTag($rss, "pubDate", getW3CDate());
    // get and cache station icon
    $stationData = $station->getAllWithIcon();
예제 #2
0
if ($data['numNodes'] == 0) {
    $data['numNodes'] = 1;
}
$data['numStations'] = sotf_Station::countAll();
$data['numProgs'] = sotf_Programme::countAll();
$data['numProgs'] = sotf_Programme::countAll();
$allStats = sotf_Statistics::networkStats();
$allStats['l_and_d'] = $allStats['listens'] + $allStats['downloads'];
$data['access'] = $allStats;
$fileStats = sotf_Programme::getFileStats();
$fileStats['size_mb'] = sprintf('%d', $fileStats['filesize'] / 1024 / 1024);
$fileStats['length_hour'] = sprintf('%d', $fileStats['play_length'] / 60 / 60);
$data['files'] = $fileStats;
$data['numUsers'] = sotf_User::countUsers();
$smarty->assign($data);
$smarty->assign('STATIONS', sotf_Station::listStationNames());
$searchLangs = $config['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']);
$dayInThePast = time() - 60 * 60 * 24 * 30;
// 30 days back
$fromDay = date('Y-m-d', $dayInThePast);
if ($page->loggedIn()) {
    // get users's playlist
    $playlist = new sotf_UserPlaylist();
예제 #3
0
<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
// $Id$
require "init.inc.php";
$hitsPerPage = $sotfVars->get("hitsPerPage", 15);
$smarty->assign('PAGETITLE', $page->getlocalized('Stations'));
$start = sotf_Utils::getParameter('start');
$station = sotf_Utils::getParameter('station');
$delete = sotf_Utils::getParameter('delete');
if ($delete and hasPerm('node', 'delete')) {
    $st =& new sotf_Station($station);
    $st->delete();
    $page->addStatusMsg('delete_ok');
    $page->redirect($_SERVER["PHP_SELF"]);
}
$limit = $page->splitList(sotf_Station::countAll(), "{$php_self}");
//$result = $db->limitQuery($query, $limit["from"], $limit["maxresults"]);				//get results with limit
$stations = sotf_Station::listStations($limit["from"], $limit["maxresults"]);
for ($i = 0; $i < count($stations); $i++) {
    $sprops = $stations[$i]->getAllWithIcon();
    $sprops['numProgs'] = $stations[$i]->numProgrammes();
    $sprops['isLocal'] = $stations[$i]->isLocal();
    if (hasPerm('node', 'delete')) {
        $sprops['managers'] = $permissions->listUsersWithPermission($stations[$i]->id, 'admin');
    }
    $STATION_LIST[] = $sprops;
}
$smarty->assign('STATIONS', $STATION_LIST);
$page->send();
예제 #4
0
     if (empty($userid) || !is_numeric($userid)) {
         $page->addStatusMsg('invalid_user');
         $problem = 1;
     }
 } else {
     $userid = $user->id;
 }
 $station_old = $station;
 /*
 $station = sotf_Utils::makeValidName($station, 32);
 if ($station != $station_old) {
 			$page->addStatusMsg('illegal_name');
     $problem = 1;
 }
 */
 if (sotf_Station::isNameInUse($station)) {
     $page->addStatusMsg('name_in_use');
     $problem = 1;
 }
 if (!$problem) {
     $st =& new sotf_Station();
     $st->create($station, $desc);
     if ($manager || !hasPerm('node', 'change')) {
         $permissions->addPermission($st->getID(), $userid, 'admin');
     }
     $page->addStatusMsg('station_created');
     if (hasPerm('node', 'change') || !$manager) {
         $page->redirect("editStation.php?stationid=" . $st->id);
     } else {
         $page->redirect("stations.php");
     }
예제 #5
0
//the query
$smarty->assign("SQLquerySerial", $advsearch->Serialize());
//the serialized query
$smarty->assign("SQLqueryfields", $advsearch->GetSQLqueryfields($SQLquery));
//translated name for all rows of the query
$smarty->assign("EQdate", $advsearch->GetEQdate());
//EQ dropdown for date
$smarty->assign("EQstring", $advsearch->GetEQstring());
//EQ dropdown for string
$smarty->assign("EQlang", $advsearch->GetEQlang());
//EQ dropdown for lang
$smarty->assign("EQlength", $advsearch->GetEQlength());
//EQ dropdown for length
$smarty->assign("Languages", $advsearch->GetLanguages());
//all possible languages
$smarty->assign("Stations", sotf_Station::listStationNames());
//all possible stationnames
$smarty->assign("SQLstring", $SQLstring);
//selected values
//box 1
$smarty->assign("SQLfields", $advsearch->GetSQLfields());
//name of all possibble columns
$smarty->assign("SQLfieldDefault", key($advsearch->GetSQLfields($SQLquery)));
//set default selected to the first element
//box 2
$smarty->assign("sort1", $advsearch->GetSort1());
//current sort1
$smarty->assign("sort2", $advsearch->GetSort2());
//current sort2
//box 3
$smarty->assign("saved", $saved[example] = "Example");
 function GetStations()
 {
     $stationsarray = sotf_Station::listStationNames();
     $max = count($stationsarray);
     for ($i = 0; $i < $max; $i++) {
         $Stations[$stationsarray[$i][name]] = $stationsarray[$i][name];
     }
     return $Stations;
 }
예제 #7
0
if ($delete) {
    $station = sotf_Utils::getParameter('station');
    if (!hasPerm('node', 'delete') && !hasPerm($station, 'admin')) {
        $permTransl = $page->getlocalized('perm_delete');
        $msg = $page->getlocalizedWithParams('no_permission', $permTransl);
        raiseError($msg);
    }
    $st =& $repository->getObject($station);
    $st->delete();
    $page->addStatusMsg('delete_ok');
    $page->redirect($_SERVER["PHP_SELF"]);
}
$count = sotf_Station::countStations($language);
//$limit = $page->splitList($count, $config['localPrefix'] . "/stations.php");
$limit = $page->splitList($count, $scriptUrl);
$stations = sotf_Station::listStations($limit["from"], $limit["maxresults"], $mode, $language);
for ($i = 0; $i < count($stations); $i++) {
    $sprops = $stations[$i]->getAllWithIcon();
    $sprops['numProgs'] = $stations[$i]->numProgrammes();
    $sprops['isLocal'] = $stations[$i]->isLocal();
    $sprops['languages'] = $stations[$i]->getLanguagesLocalized();
    if (hasPerm('node', 'delete', 'change')) {
        $sprops['managers'] = $permissions->listUsersWithPermission($stations[$i]->id, 'admin');
    }
    $STATION_LIST[] = $sprops;
}
$smarty->assign('STATIONS', $STATION_LIST);
$smarty->assign('MODE', $mode);
$smarty->assign('LANGUAGE', $language);
$smarty->assign('STATION_LANGS', sotf_Station::listStationLanguages());
$page->send();
예제 #8
0
$now = getDate();
$dayInThePast = mktime(0, 0, 0, $now['mon'], $now['mday'] - 10, $now['year']);
$fromDay = date('Y-m-d', $dayInThePast);
// prepare RSS writer
$rss_writer_object = new rss_writer_class();
$rss_writer_object->specification = "1.0";
$rss_writer_object->about = $config['rootUrl'] . "/rss.php";
// Specify the URL of an optional XSL stylesheet. This lets the document be rendered automatically in XML capable browsers.
$rss_writer_object->stylesheet = $config['rootUrl'] . "/static/rss2html.xsl";
// When generating RSS version 1.0, you may declare additional namespaces that enable the use of
// more property tags defined by extension modules of the RSS specification.
$rss_writer_object->rssnamespaces["dc"] = "http://purl.org/dc/elements/1.1/";
// do the job, fill in RSS
if ($stationName) {
    // send list of new progs in station
    $station = sotf_Station::getByName($stationName);
    if (!$station) {
        raiseError("no such station: {$stationName}");
    }
    // define channel
    $properties = array();
    $properties["description"] = "New programmes at {$stationName}";
    $properties["link"] = $config['rootUrl'] . "/showStation.php/" . $station->id;
    $properties["title"] = "{$stationName}";
    //$properties["language"]="en";
    $properties["dc:date"] = date("Y-m-d H:i:s");
    // "2002-05-06T00:00:00Z";
    $rss_writer_object->addchannel($properties);
    // get and cache station icon
    $stationData = $station->getAllWithIcon();
    if ($stationData['icon']) {
예제 #9
0
        } else {
            $smarty->assign('STATUS', $page->getlocalized('addstationmanager_failed'));
        }
    } elseif ($delstationmanager) {
        if (sotf_Permission::delStationManager($username)) {
            $smarty->assign('STATUS', $page->getlocalized('delstationmanager_ok'));
        } else {
            $smarty->assign('STATUS', $page->getlocalized('delstationmanager_failed'));
        }
    }
    $users = sotf_Permission::getStationManagers();
    if (count($users) > 0) {
        $smarty->assign('USERS', $users);
    }
}
$stations = sotf_Station::listStations();
for ($i = 0; $i < count($stations); $i++) {
    /*
    $logo = false;
    if (isLocalStation($stations[$i]['station']))
    {
    	if (!is_object($repository->getStationLogo($stations[$i]['station'])))
    	{
    		$logo = '<img border="0" src="getLogo.php?station='.rawurlencode($stations[$i]['station']).'">';
    	}
    }
    else
    {
    	$url = parse_url($repository->getRepositoryURL($stations[$i]['station']));
    	$scheme = $url['scheme'];
    	$host = $url['host'];
예제 #10
0
     else
     print("not");
*/
//$prog = new sotf_Programme('001pr4');
//$prog->setBlob('icon', $prog->get('icon'));
//echo "Icon saved";
$ids = $db->getCol("select id from sotf_programmes");
while (list(, $id) = each($ids)) {
    $obj = new sotf_Programme($id);
    $icon = $obj->getBlob('icon');
    $obj->saveBlob('icon', $icon);
    echo "<br>icon saved for {$id}";
}
$ids = $db->getCol("select id from sotf_stations");
while (list(, $id) = each($ids)) {
    $obj = new sotf_Station($id);
    $icon = $obj->getBlob('icon');
    $obj->saveBlob('icon', $icon);
    echo "<br>icon saved for {$id}";
}
$ids = $db->getCol("select id from sotf_series");
while (list(, $id) = each($ids)) {
    $obj = new sotf_Series($id);
    $icon = $obj->getBlob('icon');
    $obj->saveBlob('icon', $icon);
    echo "<br>icon saved for {$id}";
}
$ids = $db->getCol("select id from sotf_contacts");
while (list(, $id) = each($ids)) {
    $obj = new sotf_Contact($id);
    $icon = $obj->getBlob('icon');