function parseWebVTT($captionUrl = NULL, $descUrl = NULL)
{
    if ($captionUrl) {
        $captionFile = @file_get_contents($captionUrl);
        if ($captionFile) {
            $captionArray = toArray('captions', $captionFile);
        } else {
            echo '1';
            // unable to read caption file;
        }
        if ($descUrl) {
            $descFile = @file_get_contents($descUrl);
            if ($descFile) {
                $descArray = toArray('desc', $descFile);
            } else {
                // do nothing
                // description file is not required
            }
        }
        if (sizeof($captionArray) > 0) {
            writeOutput($captionArray, $descArray);
        } else {
            // do nothing
            // an error has occurred (and hopefully an error code was displayed)
        }
    } else {
        echo '0';
        // insuficcient parameters were passed by URL
    }
}
예제 #2
0
    }
    $sid = $sessionManager->startSession($sessionId, $adoptSession);
    if (!$sessionId && !$operationManager->isPreLoginOperation()) {
        writeErrorOutput($operationManager, new WebServiceException(WebServiceErrorCode::$AUTHREQUIRED, "Authentication required"));
        return;
    }
    if (!$sid) {
        writeErrorOutput($operationManager, $sessionManager->getError());
        return;
    }
    $userid = $sessionManager->get("authenticatedUserId");
    if ($userid) {
        $seed_user = new Users();
        $current_user = $seed_user->retrieveCurrentUserInfoFromFile($userid);
    } else {
        $current_user = null;
    }
    $operationInput = $operationManager->sanitizeOperation($input);
    $includes = $operationManager->getOperationIncludes();
    foreach ($includes as $ind => $path) {
        checkFileAccessForInclusion($path);
        require_once $path;
    }
    cbEventHandler::do_action('corebos.audit.action', array(isset($current_user) ? $current_user->id : 0, 'Webservice', $operation, 0, date('Y-m-d H:i:s')));
    $rawOutput = $operationManager->runOperation($operationInput, $current_user);
    writeOutput($operationManager, $rawOutput);
} catch (WebServiceException $e) {
    writeErrorOutput($operationManager, $e);
} catch (Exception $e) {
    writeErrorOutput($operationManager, new WebServiceException(WebServiceErrorCode::$INTERNALERROR, "Unknown Error while processing request"));
}
예제 #3
0
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        // count only file syncs that should be synced
        $count = 0;
        $size = 0;
        foreach ($rows as $row) {
            $objectType = $row['OBJECT_TYPE'];
            $objectSubType = $row['OBJECT_SUB_TYPE'];
            if (isset($excludeFileSyncMap[$objectType]) && (!count($excludeFileSyncMap[$objectType]) || in_array($objectSubType, $excludeFileSyncMap[$objectType]))) {
                continue;
            }
            $count += $row['COUNT(file_sync.ID)'];
            $size += $row['SUM(file_sync.FILE_SIZE)'];
        }
        if ($count) {
            $breakdownBySize[$sizeName] = array($count, $size);
        }
    }
    // get next file sync to process
    $c = clone $baseCriteria;
    $c->addAscendingOrderByColumn(FileSyncPeer::ID);
    $fileSync = FileSyncPeer::doSelectOne($c);
    // print the status
    writeOutput("Worker id [{$workerId}] name [{$workerName}] lastId [{$lastId}] maxId - lastId [" . ($maxId - $lastId) . "]\n");
    foreach ($breakdownBySize as $sizeName => $curStat) {
        list($count, $size) = $curStat;
        writeOutput("\t{$sizeName} - count {$count}, size " . formatFileSize($size) . "\n");
    }
    if ($fileSync) {
        writeOutput("\tnext file sync id [" . $fileSync->getId() . "] created at [" . $fileSync->getCreatedAt() . "]\n");
    }
}
예제 #4
0
                $json = $DataGraph->to_simple_json($pageUri) ;
                $array = json_decode($json, true);
                writeOutput(getDataForList($array['result']['items']));
                break;*/
    /*case API.'ExternalHTTPService' :
    	$pageUri = $this->Request->getUriWithPageParam();
            $json = $DataGraph->to_simple_json($pageUri) ;
            $array = json_decode($json, true);
            writeOutput(getDataForList($array['result']['items']));
            break;*/
    case API . 'ItemEndpoint':
    default:
        $pageUri = $this->Request->getUri();
        $json = $DataGraph->to_simple_json($pageUri);
        $array = json_decode($json, true);
        writeOutput(getDataForItem($array['result']['primaryTopic']));
        break;
}
function getDataForList($input)
{
    global $headers, $curr_line, $lines;
    getLines($input, array());
    $output = array();
    $output['headers'] = $headers;
    $output['lines'] = $lines;
    return $output;
}
function getDataForItem($input)
{
    global $headers, $curr_line, $lines;
    getLine($input, array());