<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: createContact.php 225 2003-06-12 16:46:59Z andras $
 * 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";
$page->popup = true;
$page->forceLogin();
$stationId = sotf_Utils::getParameter('stationid');
$contactName = sotf_Utils::getParameter('name');
if ($contactName) {
    if (sotf_Contact::findByNameLocal($contactName)) {
        //$page->addStatusMsg('contact_name_exists');
        //$page->redirect("createCOntact.php);
        raiseError("contact_name_exists");
        exit;
    }
    // create a new contact
    $contact = new sotf_Contact();
    $status = $contact->create($contactName, $stationId);
    if (!$status) {
        $page->addStatusMsg('contact_create_failed');
    } else {
        $permissions->addPermission($contact->id, $user->id, 'admin');
        $page->redirect("editContact.php?id=" . $contact->id);
        exit;
    }
示例#2
0
    if ($entry != "." && $entry != "..") {
        $currentFile = $dirPath . "/" . $entry;
        //debug("examining", $currentFile);
        if (!is_dir($currentFile)) {
            $XBMF[] = basename($currentFile);
        }
    }
}
$dir->close();
$smarty->assign("XBMF", $XBMF);
// UPDATE Topic Tree ADDED BY Martin Schmidt, FH St. Poelten
if (sotf_Utils::getParameter('updatetopictree')) {
    $query = "SELECT * FROM sotf_vars WHERE name='topic_update_done' AND value=1";
    $result = $db->getRow($query);
    if (count($result) == 0) {
        if (is_file($config['basedir'] . '/code/share/update_topics.txt') && sotf_Utils::getParameter('confirmed')) {
            $db->query("BEGIN;");
            // UPDATE sotf_topic_tree_defs, sotf_topics
            $update_statements = "";
            $upd_file = fopen($config['basedir'] . '/code/share/update_topics.txt', "r");
            while (!feof($upd_file)) {
                $update_statements .= fgets($upd_file, 4096);
            }
            fclose($upd_file);
            $db->query($update_statements);
            // UPDATE sotf_prog_topics (OLD TOPIC ID => NEW TOPIC ID)
            $new_topics = array('001td8' => '001td2', '001td9' => '001td6', '001td10' => '001td8', '001td11' => '001td9', '001td12' => '001td10', '001td13' => '001td11', '001td14' => '001td12', '001td15' => '001td12', '001td16' => '001td13', '001td17' => '001td10', '001td18' => '001td14', '001td19' => '001td15', '001td20' => '001td16', '001td21' => '001td18', '001td22' => '001td19', '001td23' => '001td20', '001td24' => '001td21', '001td25' => '001td22', '001td26' => '001td23', '001td27' => '001td24', '001td28' => '001td18', '001td29' => '001td25', '001td30' => '001td26', '001td31' => '001td27', '001td32' => '001td28', '001td33' => '001td29', '001td34' => '001td18', '001td35' => '001td25', '001td36' => '001td30', '001td37' => '001td18', '001td38' => '001td31', '001td39' => '001td32', '001td40' => '001td18', '001td41' => '001td34', '001td42' => '001td35', '001td43' => '001td35', '001td44' => '001td36', '001td45' => '001td35', '001td46' => '001td34', '001td47' => '001td34', '001td48' => '001td36', '001td49' => '001td26', '001td50' => '001td37', '001td51' => '001td38', '001td52' => '001td39', '001td53' => '001td40', '001td54' => '001td35', '001td55' => '001td38', '001td56' => '001td38', '001td57' => '001td41', '001td58' => '001td42', '001td59' => '001td43', '001td60' => '001td44', '001td61' => '001td41', '001td62' => '001td41', '001td63' => '001td41', '001td64' => '001td45', '001td65' => '001td46', '001td66' => '001td47', '001td67' => '001td48', '001td68' => '001td45', '001td69' => '001td41', '001td70' => '001td49', '001td71' => '001td41', '001td72' => '001td42', '001td73' => '001td50', '001td74' => '001td51', '001td75' => '001td52', '001td76' => '001td51', '001td77' => '001td53', '001td78' => '001td54', '001td79' => '001td55', '001td80' => '001td56', '001td81' => '001td57', '001td82' => '001td58', '001td83' => '001td51', '001td84' => '001td59', '001td85' => '001td60', '001td86' => '001td61', '001td87' => '001td62', '001td88' => '001td63', '001td89' => '001td62', '001td90' => '001td64', '001td91' => '001td65', '001td92' => '001td66', '001td93' => '001td67', '001td94' => '001td68', '001td95' => '001td66', '001td96' => '001td61', '001td97' => '001td69', '001td98' => '001td27', '001td99' => '001td65', '001td100' => '001td70', '001td101' => '001td69', '001td102' => '001td71', '001td103' => '001td72', '001td104' => '001td73', '001td105' => '001td74', '001td106' => '001td75', '001td107' => '001td76', '001td108' => '001td33', '001td109' => '001td111', '001td110' => '001td77', '001td111' => '001td33', '001td112' => '001td106', '001td113' => '001td78', '001td114' => '001td79', '001td115' => '001td80', '001td116' => '001td81', '001td117' => '001td82', '001td118' => '001td83', '001td119' => '001td84', '001td120' => '001td85', '001td121' => '001td86', '001td122' => '001td87', '001td123' => '001td88', '001td124' => '001td89', '001td125' => '001td90', '001td126' => '001td91', '001td127' => '001td92', '001td128' => '001td90', '001td129' => '001td90', '001td130' => '001td93', '001td131' => '001td90', '001td132' => '001td94', '001td133' => '001td91', '001td134' => '001td95', '001td135' => '001td96', '001td136' => '001td97', '001td137' => '001td98', '001td138' => '001td99', '001td139' => '001td98', '001td140' => '001td100', '001td141' => '001td17', '001td142' => '001td17', '001td143' => '001td17', '001td144' => '001td17', '001td145' => '001td17', '001td146' => '001td17', '001td147' => '001td17', '001td148' => '001td17', '001td149' => '001td17', '001td150' => '001td17', '001td151' => '001td17', '001td152' => '001td17', '001td153' => '001td17', '001td154' => '001td17', '001td155' => '001td17', '001td156' => '001td17', '001td157' => '001td17', '001td158' => '001td17', '001td159' => '001td17', '001td160' => '001td17', '001td161' => '001td17', '001td162' => '001td17', '001td163' => '001td17', '001td164' => '001td17', '001td165' => '001td17', '001td166' => '001td17', '001td167' => '001td17', '001td168' => '001td17', '001td169' => '001td17', '001td170' => '001td17', '001td171' => '001td17', '001td172' => '001td17', '001td173' => '001td17', '001td174' => '001td17', '001td175' => '001td17', '001td176' => '001td17', '001td177' => '001td17', '001td178' => '001td17', '001td179' => '001td17', '001td180' => '001td17', '001td181' => '001td17', '001td182' => '001td17', '001td183' => '001td17', '001td184' => '001td17', '001td185' => '001td17', '001td186' => '001td17', '001td187' => '001td17', '001td188' => '001td17', '001td189' => '001td17', '001td190' => '001td17', '001td191' => '001td17', '001td192' => '001td17', '001td193' => '001td17', '001td194' => '001td17', '001td195' => '001td17', '001td196' => '001td17', '001td197' => '001td17', '001td198' => '001td17', '001td199' => '001td17', '001td200' => '001td17', '001td201' => '001td17', '001td202' => '001td17', '001td203' => '001td17', '001td204' => '001td17', '001td205' => '001td17', '001td206' => '001td17', '001td207' => '001td17', '001td208' => '001td17', '001td209' => '001td17', '001td210' => '001td101', '001td211' => '001td102', '001td212' => '001td103', '001td213' => '001td104', '001td214' => '001td105', '001td215' => '001td44', '001td216' => '001td106', '001td217' => '001td106', '001td218' => '001td101', '001td219' => '001td101', '001td220' => '001td103', '001td221' => '001td107', '001td222' => '001td108', '001td223' => '001td103', '001td224' => '001td109', '001td225' => '001td109', '001td226' => '001td110', '001td227' => '001td112', '001td228' => '001td113', '001td229' => '001td114', '001td230' => '001td115', '001td231' => '001td16', '001td232' => '001td116', '001td233' => '001td117', '001td234' => '001td118', '001td235' => '001td119', '001td236' => '001td22', '001td237' => '001td120', '001td238' => '001td119', '001td239' => '001td121', '001td240' => '001td122', '001td241' => '001td113', '001td242' => '001td119', '001td243' => '001td119', '001td244' => '001td123', '001td245' => '001td15', '001td246' => '001td113', '001td247' => '001td124', '001td248' => '001td9', '001td249' => '001td119', '001td250' => '001td125', '001td251' => '001td10', '001td252' => '001td4', '001td253' => '001td126', '001td254' => '001td119', '001td255' => '001td113', '001td256' => '001td16', '001td257' => '001td15', '001td258' => '001td127', '001td259' => '001td18', '001td260' => '001td110');
            $old_topics = array_keys($new_topics);
            for ($k = 0; $k < count($old_topics); $k++) {
                // get programs with current OLD topic_id
                $q_progs = $db->query("SELECT prog_id FROM sotf_prog_topics WHERE topic_id = '" . $old_topics[$k] . "';");
示例#3
0
    $_SESSION['error'] = $error;
    //needed after reload
    $page->redirect($_SERVER["PHP_SELF"] . "?" . $subpage . "=2");
    //redirect page
}
////SMARTY variables
$smarty->assign("table", $portal->getTable());
//current layout table
//user rights and options
$smarty->assign("is_admin", $portal->isAdmin($user->getId()));
//true if admin
$smarty->assign("is_logged_in", $user->loggedIn());
//true if logged in
$smarty->assign("username", $user->getName());
//username (if logged in)
$smarty->assign("back", sotf_Utils::getParameter('back'));
//true if came from programmes editor page to the view programme page
//directories and names
$smarty->assign("rootdir", $rootdir);
//root directory (portal/www)
$smarty->assign("php_self", $_SERVER['PHP_SELF']);
//php self for the form submit and hrefs
$smarty->assign("portal_name", $portal_name);
//name of the portal
$smarty->assign("sotfSite", $sotfSite);
//location of the StreamontheFly portal
$smarty->assign("portal", $settings["portal"]);
$smarty->assign("home", $settings["home"]);
$smarty->assign("programmes", $settings["programmes"]);
$smarty->assign("css", $settings["css"]);
//CSS enabled
示例#4
0
$smarty->assign("USERFTPURL", $userFtpUrl);
$stations = $permissions->listStationsForEditor();
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);
}
////form sent
$series = sotf_Utils::getParameter("series");
$filter = sotf_Utils::getParameter("filter");
$sort1 = sotf_Utils::getParameter("sort1");
$sort2 = sotf_Utils::getParameter("sort2");
////from user prefs if first time on page
$prefs = $user->getPreferences();
if ($sort1 == NULL) {
    $sort1 = $prefs->editorSettings[sort1];
}
if ($sort2 == NULL) {
    $sort2 = $prefs->editorSettings[sort2];
}
if ($series == NULL) {
    $series = $prefs->editorSettings[series];
}
if ($filter == NULL) {
    $filter = $prefs->editorSettings[filter];
}
////default settings if first time here
示例#5
0
 * $Id: podcast.php 558 2006-05-04 14:34:58Z buddhafly $
 * Authors: András Micsik
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 * nicer filenames, stream link, broadcastdate and
 * role supporte by rama + rjankowski
 */
define('ITEMS_IN_RSS', 10);
require "init.inc.php";
require_once $config['classdir'] . "/sotf_AdvSearch.class.php";
//$prgId = sotf_Utils::getParameter('id');
$stationId = sotf_Utils::getParameter('station');
$seriesId = sotf_Utils::getParameter('series');
//$userName = sotf_Utils::getParameter('user');
//$queryName = sotf_Utils::getParameter('qname');
$query = sotf_Utils::getParameter('query');
$items = intval(sotf_Utils::getParameter('count'));
if (!$items or $items < 1 or $items > 200) {
    $items = ITEMS_IN_RSS;
}
//debug("ITEMS", $items);
function writeTag(&$rss, $tag, $value, $lang = '', $attr = '')
{
    if ($lang) {
        $langAttr = "xml:lang=\"{$lang}\"";
    }
    if (is_array($attr)) {
        foreach ($attr as $k => $v) {
            $attrNew .= $k . '="' . htmlspecialchars($v) . '" ';
        }
        $attr = $attrNew;
    }
if ($save) {
    $userPerms = $permissions->getPermissions($objectid, $userid);
    debug("userPerms", $userPerms);
    if (sotf_Utils::getParameter('perm_admin')) {
        if (!in_array('admin', $userPerms)) {
            $permissions->addPermission($objectid, $userid, 'admin');
        }
    } else {
        if (in_array('admin', $userPerms)) {
            $permissions->delPermission($objectid, $userid, 'admin');
        }
        $perms['create'] = sotf_Utils::getParameter('perm_create');
        $perms['change'] = sotf_Utils::getParameter('perm_change');
        $perms['add_prog'] = sotf_Utils::getParameter('perm_add_prog');
        $perms['delete'] = sotf_Utils::getParameter('perm_delete');
        $perms['authorize'] = sotf_Utils::getParameter('perm_authorize');
        while (list($perm, $hasP) = each($perms)) {
            if ($hasP && !in_array($perm, $userPerms)) {
                $permissions->addPermission($objectid, $userid, $perm);
            } elseif (!$hasP && in_array($perm, $userPerms)) {
                $permissions->delPermission($objectid, $userid, $perm);
            }
        }
    }
    $page->redirect('closeAndRefresh.php?anchor=perms');
}
$smarty->assign('CONTEXT', $context);
$smarty->assign('OBJECT_NAME', $objectname);
$smarty->assign('OBJECT_ID', $objectid);
$smarty->assign('USER_NAME', $username);
$smarty->assign('USER_ID', $userid);
示例#7
0
require "init.inc.php";
if (sotf_Utils::getParameter('reconnect')) {
    $playlist = new sotf_Playlist();
    $playlist->sendMyRemotePlaylist();
    $page->logRequest();
    exit;
}
if (sotf_Utils::getParameter('stop')) {
    $playlist = new sotf_Playlist();
    $playlist->stopMyStream();
    $page->redirect(myGetenv('HTTP_REFERER'));
    exit;
}
$id = sotf_Utils::getParameter('id');
$fileid = sotf_Utils::getParameter('fileid');
$jingle = sotf_Utils::getParameter('jingle');
if (empty($id)) {
    raiseError("Missing parameters!", 'id');
}
$playlist = new sotf_Playlist();
if ($jingle) {
    // play the jingle of station/series
    $obj = $repository->getObject($id);
    if (!$obj) {
        raiseError("no_such_object", $id);
    }
    if (!$obj->isLocal()) {
        // have to send user to home node of this programme
        sotf_Node::redirectToHomeNode($obj, 'listen.php');
        exit;
    }
<?php

require "init.inc.php";
$smarty->assign('PAGETITLE', $page->getlocalized('AdminPage'));
$page->forceLogin();
$page->popup = true;
$page->errorURL = "createNeighbour.php";
if (!hasPerm('node', "change")) {
    raiseError("You have no permission to change node settings!");
}
$url = sotf_Utils::getParameter('url');
$nid = sotf_Utils::getParameter('node_id');
//
$createNew = sotf_Utils::getParameter('create_new_node');
if ($createNew) {
    if (!$url) {
        $page->addStatusMsg('no_url_given');
    } elseif (sotf_Node::getNodeById($nid)) {
        $page->addStatusMsg('node_id_occupied');
    } else {
        $neighbor = new sotf_Neighbour();
        $neighbor->set('node_id', $nid);
        $neighbor->set('use_for_outgoing', 'f');
        $neighbor->set('accept_incoming', 't');
        $neighbor->set('pending_url', $url);
        $neighbor->create();
        $page->redirect("closeAndRefresh.php?anchor=network");
        exit;
    }
    $page->redirect("createNeighbour.php?node_id={$nid}&url=" . urlencode($url) . "#network");
    exit;
示例#9
0
    $page->redirect("admin.php#network");
}
// delete neighbour
$deln = sotf_Utils::getParameter('delneighbour');
debug("deln", $deln);
if ($deln) {
    debug("deln", "!!");
    $nid = sotf_Utils::getParameter('nodeid');
    $neighbour = sotf_Neighbour::getById($nid);
    $neighbour->delete();
    $page->redirect("admin.php#network");
}
// manage permissions
$delperm = sotf_Utils::getParameter('delperm');
if ($delperm) {
    $username = sotf_Utils::getParameter('username');
    $userid = $user->getUserid($username);
    if (empty($userid) || !is_numeric($userid)) {
        raiseError("Invalid username: {$username}");
    }
    $permissions->delPermission('node', $userid);
    $msg = $page->getlocalizedWithParams("deleted_permissions_for", $username);
    $page->addStatusMsg($msg, false);
    $page->redirect("admin.php");
    exit;
}
// generate output
$localNode = sotf_Node::getLocalNode();
if (!$localNode) {
    $localNode = new sotf_Node();
    $localNode->set('node_id', $nodeId);
示例#10
0
<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: login.php,v 1.4 2003/09/25 07:46:12 andras Exp $
 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Author: Martin Schmidt, ptmschmidt@fh-stpoelten.ac.at
 */
require "init.inc.php";
$username = sotf_Utils::getParameter('userid');
$email = sotf_Utils::getParameter('email');
$okURL = sotf_Utils::getParameter('okURL');
if ($username && $email) {
    $temp_user = new sotf_User();
    $storage = $temp_user->getStorageObject();
    $fields['userid'] = $temp_user->getUserid($username);
    if ($fields['userid'] != NULL) {
        $data = $storage->userDbSelect($fields);
    }
    if ($email == $data['email'] && $username == $data['username']) {
        $new_password = sotf_Utils::randString(6);
        global $page;
        $login_href = "http://" . $_SERVER['HTTP_HOST'] . $config['localPrefix'] . "/login.php";
        $subject = $page->getlocalized("pass_mail_subject");
        $message = $page->getlocalizedWithParams("pass_mail_message", $username, $new_password, $login_href);
        mail($email, $subject, $message, "From: no-reply@streamonthefly.org\r\nX-Mailer: PHP/" . phpversion() . "\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\n");
        $fields['password'] = $new_password;
        $fields['email'] = $email;
        $storage->userDbUpdate($fields);
    } else {
        $errorMsg = $page->getlocalized("new_pass_error");
示例#11
0
    exit;
}
// upload jingle
$uploadjingle = sotf_Utils::getParameter('uploadjingle');
if ($uploadjingle) {
    checkPerm($series, "change");
    $file = $user->getUserDir() . '/' . $_FILES['userfile']['name'];
    moveUploadedFile('userfile', $file);
    $series->setJingle($file);
    $page->redirect("editSeries.php?seriesid={$seriesid}#icon");
    exit;
}
// select icon/jingle from user files
$filename = sotf_Utils::getParameter('filename');
$setjingle = sotf_Utils::getParameter('setjingle');
$seticon = sotf_Utils::getParameter('seticon');
if ($setjingle) {
    checkPerm($series, "change");
    $file = sotf_Utils::getFileInDir($user->getUserDir(), $filename);
    $series->setJingle($file);
    $page->redirect("editSeries.php?seriesid={$seriesid}#icon");
} elseif ($seticon) {
    checkPerm($series, "change");
    $file = sotf_Utils::getFileInDir($user->getUserDir(), $filename);
    //debug("FILE", $file);
    if ($series->setIcon($file)) {
        //$page->addStatusMsg("ok_icon");
    } else {
        //$page->addStatusMsg("error_icon");
    }
    $page->redirect("editSeries.php?seriesid={$seriesid}#icon");
示例#12
0
} elseif ($deluser) {
    for ($i = 0; $i < count($selectedUserFiles); $i++) {
        $retval = $user->deleteFile($selectedUserFiles[$i]);
    }
} elseif ($send) {
    $success = move_uploaded_file($_FILES['userfile']['tmp_name'], $user->getUserDir() . '/' . $_FILES['userfile']['name']);
    if (!$success) {
        $status = "&uploaderror=1";
    }
    $page->redirect($_SERVER['PHP_SELF'] . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL) . $status);
} elseif ($ok) {
    $page->redirect($okURL);
} elseif ($itemtoftp) {
    foreach ($_POST as $name => $value) {
        if (substr($name, 0, 6) == 'tosel-') {
            $postvar = sotf_Utils::getParameter($name);
            for ($i = 0; $i < count($postvar); $i++) {
                $retval = $prg->getAudio($postvar[$i], $copy);
            }
        }
    }
    for ($i = 0; $i < count($selectedOtherFiles); $i++) {
        $retval = $prg->getOtherFile($selectedOtherFiles[$i], $copy);
    }
    $page->redirect($PHP_SELF . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL));
} elseif ($ftptoaudio) {
    for ($i = 0; $i < count($selectedUserFiles); $i++) {
        $retval = $prg->setAudio($selectedUserFiles[$i], $copy);
    }
    $page->redirect($PHP_SELF . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL));
} elseif ($ftptoother) {
示例#13
0
<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id: export.php,v 1.5 2004/03/05 15:35:11 micsik Exp $
 * 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');
$type = sotf_Utils::getParameter('type');
$prg =& new sotf_Programme($id);
if (!$prg) {
    raiseError("no_such_object", $id);
}
if (!$prg->isLocal()) {
    raiseError("works only for local objects!", $id);
    exit;
}
checkPerm($prg, 'change');
if ($type == 1) {
    // send XBMF metadata
    $meta = new sotf_Metadata($prg);
    $md = $meta->getXBMFMetadata();
    header("Content-type: application/xml\n");
    //header("Content-type: text/plain\n");
    //header("Content-transfer-encoding: binary\n");
    header("Content-length: " . strlen($md) . "\n");
    echo $md;
} elseif ($type == 2) {
示例#14
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();
 function splitList($rp_count, $rp_url, $anchor = "")
 {
     global $smarty, $sotfVars;
     $rp_maxresults = $sotfVars->get("hitsPerPage", 10);
     //display maximal so many results
     //$rp_maxresults = 2;
     $rp_from = sotf_Utils::getParameter('from');
     if (!isset($rp_from)) {
         $rp_from = 1;
     }
     //if first time on page
     // refresh link
     $refresh_url = $this->splitListURL($rp_url, $rp_from);
     if (strpos($refresh_url, "?") === false) {
         $refresh_url .= "?t=" . time();
     } else {
         $refresh_url .= "&t=" . time();
     }
     if ($anchor) {
         $refresh_url .= '#' . $anchor;
     }
     $smarty->assign("rp_refresh_url", $refresh_url);
     // last item displayed
     $rp_to = $rp_from + $rp_maxresults - 1;
     //set 'to' field
     if ($rp_to > $rp_count) {
         $rp_to = $rp_count;
     }
     //if less then $maxresults
     if ($rp_from > 1) {
         // url to first page
         $smarty->assign("rp_first_url", $this->splitListURL($rp_url, 1, $anchor));
         // url to prev page
         $rp_prev = $rp_from - $rp_maxresults;
         if ($rp_prev >= 1) {
             $smarty->assign("rp_prev_url", $this->splitListURL($rp_url, $rp_prev, $anchor));
         }
     }
     $reminder = $rp_count % $rp_maxresults;
     if ($reminder == 0) {
         $reminder = $rp_maxresults;
     }
     $rp_last = $rp_count - $reminder + 1;
     if ($rp_from < $rp_last) {
         // url to next page
         $rp_next = $rp_from + $rp_maxresults;
         if ($rp_next <= $rp_count) {
             $smarty->assign("rp_next_url", $this->splitListURL($rp_url, $rp_next, $anchor));
         }
         // url to last page
         $smarty->assign("rp_last_url", $this->splitListURL($rp_url, $rp_last, $anchor));
     }
     $smarty->assign("rp_count", $rp_count);
     $smarty->assign("rp_to", $rp_to);
     $smarty->assign("rp_from", $rp_from);
     $smarty->assign("rp_url", $rp_url);
     $smarty->assign("anchor", $anchor);
     if ($rp_to == $rp_count) {
         $smarty->assign("rp_theend", true);
     }
     if ($rp_from == 1) {
         $smarty->assign("rp_thebeginning", true);
     }
     $limit["from"] = $rp_from - 1;
     $limit["to"] = $rp_to - 1;
     $limit["maxresults"] = $rp_maxresults;
     $limit["limit"] = " LIMIT " . $rp_maxresults . " OFFSET " . ($rp_from - 1);
     return $limit;
     //print($query." LIMIT ".$maxresults." OFFSET ".($from - 1))
 }
示例#16
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";
$page->forceLogin();
$playlist = new sotf_UserPlaylist();
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");
    //var_dump($lista);
    //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"];
示例#17
0
    $portal->insertCell($row, $col, "before");
    //insert cell before current
    $_SESSION["settings"]["table"] = $portal->getTable();
    //save result
} elseif (sotf_Utils::getParameter('delete')) {
    $portal->deleteCell($row, $col);
    //delete current cell
    $_SESSION["settings"]["table"] = $portal->getTable();
    //save result
    $page->redirect($rootdir . "/closeAndRefresh.php");
    //close window and go back to edit mode
} elseif ($cell["resource"] != NULL) {
    $portal->setCell($row, $col, $cell);
    ////save cuttent portal table to the session
    $_SESSION["settings"]["table"] = $portal->getTable();
    if ($cell["resource"] == sotf_Utils::getParameter('oldresource')) {
        $page->redirect($rootdir . "/closeAndRefresh.php");
    }
    //if resource type not chnged
}
////SMARTY
$settings = $_SESSION["settings"];
$smarty->assign("portal", $settings["portal"]);
$smarty->assign("css", $settings["css"]);
$smarty->assign("table", $portal->getTable());
$smarty->assign("resources", $portal->getResources());
$smarty->assign("files", $portal->getUploadedFiles());
$smarty->assign("queries", $portal->getQueries());
$smarty->assign("playlists", $portal->getPlaylists());
$smarty->assign("styles", $portal->getStyles());
$smarty->assign("aligns", $portal->getAligns());
示例#18
0
    if (!in_array(sotf_File::getExtension($file), $config['skipGetID3FileTypes'])) {
        $getID3 = new getID3();
        $fileinfo = $getID3->analyze($file);
        getid3_lib::CopyTagsToComments($fileinfo);
    } else {
        $fileinfo['video'] = true;
    }
    if (!is_readable($file) || filesize($file) == 0 || !isset($fileinfo['audio'])) {
        return false;
    }
    return true;
}
$id = sotf_Utils::getParameter('id');
$index = sotf_Utils::getParameter('index');
$jingle = sotf_Utils::getParameter('jingle');
$all = sotf_Utils::getParameter('all');
$obj = $repository->getObject($id);
if (!$obj) {
    raiseError("object does not exist!");
}
checkPerm($obj->id, 'change');
// CHANGED BY BUDDHAFLY
$audioVideoFiles =& new sotf_FileList();
if ($jingle) {
    $audioVideoFiles->getAudioVideoFromDir($obj->getMetaDir());
} else {
    $audioVideoFiles->getAudioVideoFromDir($obj->getAudioDir());
}
$checker =& new sotf_ContentCheck($audioVideoFiles);
$checker = $checker->selectType();
if ($videoconv) {
示例#19
0
 */
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"];
}
示例#20
0
    $file = $userDir . $newname . "." . $extension;
    moveUploadedFile('userfile', $file);
    $page->redirect("manageFiles.php");
    exit;
}
//---------
// delete files
$del = sotf_Utils::getParameter('del');
if ($del) {
    reset($_POST);
    while (list($k, $fname) = each($_POST)) {
        debug("P", $k);
        if (substr($k, 0, 4) == 'sel_') {
            if (!unlink($user->getUserDir() . '/' . $fname)) {
                addError("Could not delete: {$fname}");
            }
        }
    }
    $page->redirect("manageFiles.php");
    exit;
}
// close
$close = sotf_Utils::getParameter('close');
if ($close) {
    $page->redirect("closeAndRefresh.php");
    exit;
}
// generate output
$smarty->assign('USERFILES', $user->getUserFiles());
$smarty->assign("USERFTPURL", $user->getUrlForUserFTP());
$page->sendPopup();
示例#21
0
    $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?
    $myRating = $rating->getMyRating($id);
    debug("r", $myRating);
    $smarty->assign('MY_RATING', $myRating);
    if ($page->loggedIn()) {
        // is in my playlist?
        $smarty->assign('inplaylist', sotf_UserPlaylist::contains($id));
    }
}
$db->commit();
if (sotf_Utils::getParameter('popup')) {
    $smarty->assign('POPUP', 1);
    $page->sendPopup();
} else {
    $page->send();
}
示例#22
0
if (!$treeId) {
    if ($open) {
        $info = $vocabularies->getTopicInfo($open, $lang);
        $treeId = $info['tree_id'];
    } else {
        $treeId = $vocabularies->getDefaultTreeId();
    }
}
debug("treeid", $treeId);
$rootId = $vocabularies->getTopicTreeRoot($treeId);
if ($prgid) {
    $addMode = 1;
    $smarty->assign("OPENER_URL", "editMeta.php?id={$prgid}");
}
$smarty->assign('ADD_MODE', $addMode);
// list all topic trees
$smarty->assign('TREES', $vocabularies->listTopicTrees($lang));
// TODO; use user's language
$info = $vocabularies->getTopicTreeInfo($treeId, $lang);
debug("INFO", $info);
$treeLang = $lang;
if (strpos($info['languages'], $lang) === FALSE) {
    $treeLang = 'eng';
}
// fall back to English
$result = $vocabularies->getTree($treeId, $treeLang, true);
$smarty->assign('TREE_ID', $treeId);
$smarty->assign("TREE", $result);
$smarty->assign("prgid", sotf_Utils::getParameter('prgid'));
//$page->sendPopup();
$page->send("topicTree.htm");
 * $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";
require $config['classdir'] . "/sotf_AdvSearch.class.php";
$SQLquerySerial = sotf_Utils::getParameter('SQLquerySerial');
//the serialized query in the hidden field
$advsearch = new sotf_AdvSearch();
//create new search object object with this array
//if ($SQLquerySerial == "")							//get old search query from session if none in url
//	$SQLquerySerial = $_SESSION["SQLquerySerial"];				//get array from session
$SQLquery = $advsearch->Deserialize($SQLquerySerial);
//deserialize the content of the hidden field
if (sotf_Utils::getParameter('back') != NULL) {
    $_SESSION["SQLquerySerial"] = $SQLquerySerial;
    //save the new quey to the session
    $page->redirect("advsearch.php");
}
$query = $advsearch->GetSQLCommand();
$max = $db->getAll("SELECT count(*) FROM (" . $query . ") as count");
//get the number of results
$max = $max[0]["count"];
$limit = $page->splitList($max, "?SQLquerySerial={$SQLquerySerial}");
$result = $db->getAll($query . $limit["limit"]);
$allfields = $advsearch->GetSQLfields();
//get all possible fileld names with translation
$max = count($SQLquery);
//$fields will contain all the USED field names
for ($i = 0; $i < $max; $i++) {
示例#24
0
        if ($text) {
            $prgprop['text'] = $value;
        } elseif ($teaser) {
            $prgprop['teaser'] = $value;
        }
        $portal->setPrgProperties($id, $prgprop['text'], $prgprop['teaser']);
        $page->redirect($rootdir . "/closeAndRefresh.php");
        //close window and go back to edit mode
    } else {
        if ($text) {
            $value = $prgprop['text'];
        } elseif ($teaser) {
            $value = $prgprop['teaser'];
        }
    }
    $settings = $portal->loadSettings();
    ////Smarty
    $smarty->assign("portal", $settings["portal"]);
    $smarty->assign("rootdir", $rootdir);
    //root directory (portal/www)
    $smarty->assign("php_self", $_SERVER['PHP_SELF']);
    //php self for the form submit and hrefs
    $smarty->assign("portal_name", $portal_name);
    //name of the portal
    $smarty->assign("id", $id);
    $smarty->assign("value", $value);
    $smarty->assign("text", $text);
    $smarty->assign("teaser", $teaser);
    $smarty->assign("title", sotf_Utils::getParameter('title'));
    $page->send("edit_text.htm");
}
示例#25
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";
$filename = sotf_Utils::getParameter('filename');
$filename = sotf_Utils::getFileInDir($user->getUserDir(), $filename);
$file =& new sotf_File($filename);
if ($file->type != "none") {
    header("Content-type: " . $file->mimetype . "\n");
    header("Content-transfer-encoding: binary\n");
    header("Content-length: " . filesize($filename) . "\n");
    // send file
    readfile($filename);
} else {
    raiseError("download_problem");
}
$page->logRequest();
示例#26
0
    $video = false;
}
$converting = false;
// admins or owners can change files
checkPerm($id, 'change');
// delete link
$delLink = sotf_Utils::getParameter('dellink');
$linkid = sotf_Utils::getParameter('linkid');
if ($delLink) {
    $link = new sotf_NodeObject("sotf_links", $linkid);
    $link->delete();
    $page->redirect("editFiles.php?id={$id}#links");
    exit;
}
// delete file
$delFile = sotf_Utils::getParameter('delfile');
if ($delFile) {
    $prg->deleteFile($delFile);
    $page->redirect("editFiles.php?id={$id}#mfiles");
    exit;
}
// generate output
//$smarty->assign("OKURL",$okURL);
if ($new) {
    $smarty->assign("NEW", 1);
}
$smarty->assign('PRG_DATA', $prg->getAll());
$smarty->assign('LINKS', $prg->getAssociatedObjects('sotf_links', 'caption'));
// TODO: compare directory and SQL data for correctness
// other files
$otherFiles = $prg->listOtherFiles();
示例#27
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();
示例#28
0
 * Authors: András Micsik, Máté Pataki, Tamás Kézdi 
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
define('ITEMS_IN_RSS', 10);
require "init.inc.php";
require_once $config['classdir'] . "/xmlwriterclass.php";
require_once $config['classdir'] . "/rss_writer_class.php";
require_once $config['classdir'] . "/sotf_AdvSearch.class.php";
$prgId = sotf_Utils::getParameter('id');
$stationId = sotf_Utils::getParameter('station');
$seriesId = sotf_Utils::getParameter('series');
$userName = sotf_Utils::getParameter('user');
$queryName = sotf_Utils::getParameter('qname');
$query = sotf_Utils::getParameter('query');
$from = sotf_Utils::getParameter('from');
$count = sotf_Utils::getParameter('count');
if (!$count) {
    $count = ITEMS_IN_RSS;
}
function createImageTag($url, $title, $link)
{
    return "<url>{$url}</url><title>{$title}</title><link>{$link}</link>";
}
function getW3CDate()
{
    $retval = date("Y-m-d\\TH:i:sO");
    // 1997-07-16T19:20:30+01:00  "2002-05-06T00:00:00Z";
    $retval = substr($retval, 0, -2) . ':' . substr($retval, -2);
    return $retval;
}
/** this is a hack to convert pgsql date format to W3C date format required by RSS */
示例#29
0
    $fname = $_FILES['userfile']['name'];
    $file = sotf_Utils::getFileInDir($user->getUserDir(), $fname);
    move_uploaded_file($_FILES['userfile']['tmp_name'], $file);
    $prg = new sotf_Programme($prgId);
    if ($main) {
        $prg->setAudio($file);
        $page->redirect("closeAndRefresh.php");
    } else {
        $prg->setOtherFile($fname);
        $page->redirect("closeAndRefresh.php#anchor=mfiles");
    }
    exit;
}
// add files
if ($add) {
    $copy = sotf_Utils::getParameter('copy');
    $prg = new sotf_Programme($prgId);
    reset($_POST);
    while (list($k, $fname) = each($_POST)) {
        debug("P", $k);
        if (substr($k, 0, 4) == 'sel_') {
            if ($main) {
                debug("setAudio", "'{$fname}', '{$copy}'");
                $prg->setAudio($user->getUserDir() . '/' . $fname, $copy);
            } else {
                debug("setOtherFile", "'{$fname}', '{$copy}'");
                $prg->setOtherFile($fname, $copy);
            }
        }
    }
    if ($main) {
示例#30
0
// -*- 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";
$filename = sotf_Utils::getParameter('filename');
if (!$filename) {
    $filename = sotf_Utils::getParameter('f');
}
$id = sotf_Utils::getParameter('id');
$fid = sotf_Utils::getParameter('fid');
$mainAudio = sotf_Utils::getParameter('audio');
if (empty($fid)) {
    if (empty($id)) {
        raiseError("Missing parameters!", 'id');
    }
    if (empty($filename)) {
        raiseError("Missing parameters!", 'filename');
    }
}
if ($fid) {
    $pos = strpos($fid, ".mp3");
    if ($pos !== false) {
        $fid = rtrim($fid, ".mp3");
    }
    debug("fid", $fid);
    $fobj =& $repository->getObject($fid);