Ejemplo n.º 1
0
 function sotf_Page()
 {
     global $lang, $user, $outputLanguages, $smarty, $defaultLanguage;
     global $nodeId, $basedir, $lang, $rootdir, $imagedir, $smartyDebug, $debug;
     // start session
     session_start();
     // load user data
     if ($_SESSION['username']) {
         $this->user = new sotf_User($_SESSION['username']);
     } else {
         $this->user = new sotf_User();
     }
     $user = $this->user;
     // determine language
     if ($this->user) {
         $lang = $this->user->language;
     }
     if (!$lang && in_array($_SERVER['HTTP_ACCEPT_LANGUAGE'], $outputLanguages)) {
         $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     }
     if (!$lang) {
         $lang = $defaultLanguage;
     }
     // load localization constants for language
     $this->loadLoc();
     debug("lang", $lang);
     debug("username", $_SESSION['username']);
     preg_match('/(\\w+)\\.php$/', $_SERVER['SCRIPT_NAME'], $m);
     $this->action = $m[1];
     debug("action:", $this->action);
     $smarty->assign("ACTION", $this->action);
     $smarty->assign("LANG", $lang);
     $smarty->assign("loggedIn", $this->loggedIn());
     if ($user->isEditor()) {
         $smarty->assign("IS_EDITOR", '1');
     }
     $smarty->assign("STATION_MANAGER", sotf_Permission::get("station_manager"));
     if ($debug) {
         $smarty->assign("VIEWLOG", $this->logURL());
     }
 }
Ejemplo n.º 2
0
    $url = $_GET['okURL'];
    if (!$url) {
        $url = $config['localPrefix'];
    }
    $page->redirect($url);
    exit;
}
// we need trick for making pages indexed by Google
// therefore we pass some parameters in pathinfo
// after this call getParameter can be used to get these parameters as well
$pathinfoParamExceptions = array('getIcon', 'getJingle', 'getUserFile');
if (!in_array($page->action, $pathinfoParamExceptions)) {
    sotf_Utils::collectPathinfoParams();
}
// permissions object is for managing and asking for permissions
$permissions = new sotf_Permission();
//$permissions->debug = true;
// the repository of radio stations
$repository = new sotf_Repository($config['repositoryDir'], $db);
// all controlled vocabularies
$vocabularies = new sotf_Vocabularies($db);
// now you have the following global objects: $config, $db, $userdb, $smarty, $page, $repository, $user, $permission
// is that too many?
// forwarding all $config to smarty is a security risk
// $smarty->assign("CONFIG", $config);
// add basic variables to Smarty
$smarty->assign("NODEID", $config['nodeId']);
$smarty->assign("NODE_NAME", $config['nodeName']);
$smarty->assign("ROOT_URL", $config['rootUrl']);
$smarty->assign("ROOT_PREFIX", $config['localPrefix']);
$smarty->assign("IMAGE_URL", $config['imageUrl']);
Ejemplo n.º 3
0
if ($filter == NULL) {
    $filter = "all";
}
//$max = $db->getAll("SELECT count(*) FROM (".$query.") as count");	//get the number of results
//$max = $max[0]["count"];
$max = $myProgs = sotf_Programme::myProgrammes($series, $filter, $sort1 . ", " . $sort2, true);
//counts it
$limit = $page->splitList($max, "?series={$series}&filter={$filter}&sort1={$sort1}&sort2={$sort2}");
//$result = $db->getAll($query.$limit["limit"]);
$myProgs = sotf_Programme::myProgrammes($series, $filter, $sort1 . ", " . $sort2 . $limit["limit"]);
//$plist = new sotf_PrgList($myProgs);
//// todo sort/filter using sotf_PrgList
//$l = $plist->getList();
$mySeriesData = array();
$mySeriesData[allseries] = $page->getlocalized("allseries");
foreach (sotf_Permission::mySeriesData($stationId) as $s) {
    $mySeriesData[$s["id"]] = $s["title"];
}
$sortby[title] = $page->getlocalized("title");
$sortby[series] = $page->getlocalized("series");
$sortby[station] = $page->getlocalized("station");
$sortby[entry_date] = $page->getlocalized("entry_date");
$sortby[expiry_date] = $page->getlocalized("expiry_date");
$sortby[published] = $page->getlocalized("published");
$filters[all] = $page->getlocalized("all");
$filters[published] = $page->getlocalized("published");
$filters[unpublished] = $page->getlocalized("unpublished");
$filters[urgent] = $page->getlocalized("urgent");
$filters[todo] = $page->getlocalized("todo");
$filters[cat1] = $page->getlocalized("cat1");
$filters[cat2] = $page->getlocalized("cat2");
Ejemplo n.º 4
0
if ($series_id) {
    $ser->set('series_id', $series_id);
}
if ($title) {
    $ser->set('title', $title);
}
if ($description) {
    $ser->set('description', $description);
}
if ($editor) {
    $ser->set('editor', $editor);
}
if ($contact_email) {
    $ser->set('contact_email', $contact_email);
}
if (sotf_Permission::get("write", $station)) {
    $smarty->assign('EDIT_PERMISSION', true);
    if ($save) {
        $error = "";
        if (!$station) {
            $error .= "&errorstation=1";
        }
        if (!$series_id) {
            $error .= "&errorseriesid=1";
        }
        if (!$title) {
            $error .= "&errortitle=1";
        }
        if (!$description) {
            $error .= "&errordescription=1";
        }
Ejemplo n.º 5
0
if (sotf_Utils::getParameter('addprog')) {
    $fname = sotf_Utils::getFileSafeParameter('fname');
    $station = sotf_Utils::getFileSafeParameter('station');
    if (!sotf_Permission::get('upload', $station)) {
        raiseError("no permission to upload to {$station}");
        exit;
    }
    $newPrg = sotf_Programme::create($station);
    $newPrg->setAudio($fname);
    //$page->redirect("editFiles.php");
    $page->redirect($_SERVER['SCRIPT_NAME']);
    exit;
}
$userFtpUrl = str_replace('ftp://', "ftp://{$userid}@", "{$userFTP}{$userid}");
$smarty->assign("USERFTPURL", $userFtpUrl);
$stations = sotf_Permission::listStationsWithPermission('upload');
if (!empty($stations)) {
    $smarty->assign_by_ref("STATIONS", $stations);
}
$userAudioFiles = new sotf_FileList();
$userAudioFiles->getAudioFromDir($user->getUserDir());
$list = $userAudioFiles->getFileNames();
if (!empty($list)) {
    $smarty->assign_by_ref("USER_AUDIO_FILES", $list);
}
$myProgs = sotf_Programme::myProgrammes($user->name);
$plist = new sotf_PrgList($myProgs);
// todo sort/filter using sotf_PrgList
$l = $plist->getList();
$smarty->assign_by_ref("MYPROGS", $l);
$page->send();
Ejemplo n.º 6
0
    $seriesdata = array(id => $s->get('id'), track => $s->get('track'), title => $s->get('title'), author => $s->get('author'), production_date => $s->get('production_date'));
    $smarty->assign('SERIESDATA', $seriesdata);
    $numProgs = $s->numProgrammes();
    $progs = $s->listProgrammes($start, HITS);
} else {
    $serlist = $st->listSeries();
    $series_list = array();
    for ($i = 0; $i < count($serlist); $i++) {
        $series_list[] = array(id => $serlist[$i]->get('id'), series_id => $serlist[$i]->get('series_id'), title => $serlist[$i]->get('title'));
    }
    $smarty->assign('SERIES_LIST', $series_list);
    $numProgs = $st->numProgrammes();
    $progs = $st->listProgrammes($start, HITS);
}
$smarty->assign('EDIT_PERMISSION', sotf_Permission::get('write', $station));
if (sotf_Permission::get('station_manager') || sotf_Permission::get('station_manager', $station)) {
    $smarty->assign('STATION_MANAGER', true);
}
if ($progs) {
    for ($i = 0; $i < count($progs); $i++) {
        $ITEM_LIST[] = array(id => $progs[$i]->get('id'), track => $progs[$i]->get('track'), title => $progs[$i]->get('title'), author => $progs[$i]->get('author'), production_date => $progs[$i]->get('production_date'));
    }
}
$prev = $start - HITS;
if ($prev < 0) {
    $prev = 0;
}
$next = $start + HITS;
if ($next >= $numids) {
    $next = false;
}
Ejemplo n.º 7
0
     if ($st->setLogo($file)) {
         $status = "&oklogo=1";
     } else {
         $status = "&errorlogo=1";
     }
     $page->redirect("editStation.php?station=" . rawurlencode($station) . $status . "#manage_files");
 }
 $usergroups = sotf_Permission::getUsersAndGroups($station);
 for ($i = 0; $i < count($usergroups); $i++) {
     $USERS[$usergroups[$i]['username']]['username'] = $usergroups[$i]['username'];
     $USERS[$usergroups[$i]['username']]['groups'][] = $usergroups[$i]['group_id'];
 }
 if ($USERS) {
     $smarty->assign('USERS', $USERS);
 }
 $GROUPS = sotf_Permission::getGroups();
 if ($GROUPS) {
     $smarty->assign('GROUPS', $GROUPS);
 }
 $smarty->assign('USERFILES', $user->getUserFiles());
 if ($st->getLogo()) {
     $smarty->assign('LOGO', 'getStationLogo.php/icon.png?station=' . rawurlencode($station));
 }
 $jinglelist =& new sotf_FileList();
 $jinglelist->getAudioFromDir($st->getStationDir());
 $dellist = array();
 // stores files to remove from $jinglelist
 for ($i = 0; $i < count($jinglelist->list); $i++) {
     if (substr($jinglelist->list[$i]->name, 0, 6) != "jingle") {
         $dellist[] = $jinglelist->list[$i]->getPath();
     }
 /** list stations for which the current user has the given right right */
 function listStationsWithPermission($perm = 'upload')
 {
     global $user;
     while (list($stationname, $station) = each($user->permissions)) {
         if (sotf_Permission::get($perm, $stationname)) {
             $stations[] = $stationname;
         }
     }
     return $stations;
 }
 function isEditable()
 {
     global $user;
     return $this->get('owner') == $user->name || sotf_Permission::get('write', $this->getStation());
 }
Ejemplo n.º 10
0
    	}
    }
    else
    {
    	$url = parse_url($repository->getRepositoryURL($stations[$i]['station']));
    	$scheme = $url['scheme'];
    	$host = $url['host'];
    	$path = $url['path'];
    	$logo = '<img border="0" src="'.$scheme.'://'.$host.$path.'/getLogo.php?station='.rawurlencode($stations[$i]['station']).'">';
    	if($url['host'] == "node.streamonthefly.com") {
    	  // This is because Thomas Hassan had not refreshed the CVS when I asked for it cca. 5 times.
    	  debug("replaced AT2 logo");
    	  $logo = '';
    	}
    }
    */
    if ($stations[$i]->getLogo()) {
        $logo = true;
    } else {
        $logo = true;
    }
    $STATION_LIST[] = array(stationId => $stations[$i]->get('station'), desc => $stations[$i]->get('description'), numItems => $stations[$i]->numProgrammes(), logo => $logo, local => $stations[$i]->isLocal(), station_manager => sotf_Permission::get('station_manager', $stations[$i]->get('station')));
    if (sotf_Permission::get('station_manager', $stations[$i]->get('station'))) {
        $LOCAL_STATION_MANAGER = true;
    }
}
if ($LOCAL_STATION_MANAGER) {
    $smarty->assign('LOCAL_STATION_MANAGER', $LOCAL_STATION_MANAGER);
}
$smarty->assign('STATION_LIST', $STATION_LIST);
$page->send();