Esempio n. 1
0
<?php

if (empty($_REQUEST['id']) && empty($_REQUEST['eids'])) {
    ajaxError("No event id(s) supplied");
}
if (canView('Events')) {
    switch ($_REQUEST['action']) {
        case "video":
            if (empty($_REQUEST['videoFormat'])) {
                ajaxError("Video Generation Failure, no format given");
            } elseif (empty($_REQUEST['rate'])) {
                ajaxError("Video Generation Failure, no rate given");
            } elseif (empty($_REQUEST['scale'])) {
                ajaxError("Video Generation Failure, no scale given");
            } else {
                $sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?' . monitorLimitSql();
                if (!($event = dbFetchOne($sql, NULL, array($_REQUEST['id'])))) {
                    ajaxError("Video Generation Failure, can't load event");
                } else {
                    if ($videoFile = createVideo($event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite']))) {
                        ajaxResponse(array('response' => $videoFile));
                    } else {
                        ajaxError("Video Generation Failed");
                    }
                }
            }
            $ok = true;
            break;
        case 'deleteVideo':
            unlink($videoFiles[$_REQUEST['id']]);
            unset($videoFiles[$_REQUEST['id']]);
Esempio n. 2
0
<?php

if (empty($_REQUEST['id']) && empty($_REQUEST['eids'])) {
    ajaxError("No event id(s) supplied");
}
if (canView('Events')) {
    switch ($_REQUEST['action']) {
        case "video":
            if (empty($_REQUEST['videoFormat'])) {
                ajaxError("Video Generation Failure, no format given");
            } elseif (empty($_REQUEST['rate'])) {
                ajaxError("Video Generation Failure, no rate given");
            } elseif (empty($_REQUEST['scale'])) {
                ajaxError("Video Generation Failure, no scale given");
            } else {
                $sql = "select E.*,M.Name as MonitorName,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = " . dbEscape($_REQUEST['id']) . monitorLimitSql();
                if (!($event = dbFetchOne($sql))) {
                    ajaxError("Video Generation Failure, can't load event");
                } else {
                    if ($videoFile = createVideo($event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite']))) {
                        ajaxResponse(array('response' => $videoFile));
                    } else {
                        ajaxError("Video Generation Failed");
                    }
                }
            }
            $ok = true;
            break;
        case 'deleteVideo':
            unlink($videoFiles[$_REQUEST['id']]);
            unset($videoFiles[$_REQUEST['id']]);