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()); } }
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"; }
$smarty->assign("PAGETITLE", $page->getlocalized("EditorPage")); $page->forceLogin(); $smarty->assign("OKURL", $_SERVER['PHP_SELF']); if (!$user->isEditor()) { raiseError("You have no permission to upload to any station"); exit; } if (sotf_Utils::getParameter('upload')) { move_uploaded_file($_FILES['userfile']['tmp_name'], $user->getUserDir() . '/' . $_FILES['userfile']['name']); $page->redirect($_SERVER['SCRIPT_NAME']); exit; } 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); }
$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; }
if ($erroraddusergroup) { $smarty->assign('ERRORADDUSERGROUP', $erroraddusergroup); } if ($okdelusergroup) { $smarty->assign('OKDELUSERGROUP', $okdelusergroup); } if ($errordelusergroup) { $smarty->assign('ERRORDELUSERGROUP', $errordelusergroup); } if ($okdeluserstation) { $smarty->assign('OKDELUSERSTATION', $okdeluserstation); } if ($errordeluserstation) { $smarty->assign('ERRORDELUSERSTATION', $errordeluserstation); } if ((sotf_Permission::get("station_manager", $station) || sotf_Permission::get("station_manager")) && $st->isLocal($station)) { if ($addusergroup) { if (sotf_Permission::addUserToGroup($username, $group, $station)) { $status = "&okaddusergroup=1"; } else { $status = "&erroraddusergroup=1"; } $page->redirect("editStation.php?station=" . rawurlencode($station) . $status . "#admin_users"); } elseif ($delusergroup) { if (sotf_Permission::delUserFromGroup($username, $group, $station)) { $status = "&okdelusergroup=1"; } else { $status = "&errordelusergroup=1"; } $page->redirect("editStation.php?station=" . rawurlencode($station) . $status . "#admin_users"); } elseif ($deluserstation) {
/** 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()); }
} } 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();