Esempio n. 1
0
 public function testCliHeaders()
 {
     $_SERVER['HTTP_SOME_HEADER'] = TRUE;
     $obj_controller = new Headers();
     $obj_controller->dispatch();
     $this->assertEquals($obj_controller->getResponse(), ['Some-Header' => TRUE]);
 }
 protected function _run($request)
 {
     if ($this->requestMethod == 'POST' && count($request) == 0) {
         // User tries to login
         Authentication::login($_POST['username'], $_POST['password']);
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         } else {
             Headers::sendStatusOk();
             echo "login succeeded<br>";
             return;
         }
     } else {
         Authentication::authenticate();
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         }
         if ($this->requestMethod == 'GET' && count($request) > 0) {
             // User info requested
             echo "requesting userinfo of user " . $request[0];
         } else {
             // Bad request
             Headers::sendStatusMethodNotAllowed();
             echo "Method not allowed<br>";
             print_r($request);
         }
     }
 }
Esempio n. 3
0
 /**
  * Constructs a new Request object based on the given environment data.
  *
  * @param array $get Data similar to that which is typically provided by $_GET
  * @param array $post Data similar to that which is typically provided by $_POST
  * @param array $files Data similar to that which is typically provided by $_FILES
  * @param array $server Data similar to that which is typically provided by $_SERVER
  * @see create()
  * @see createFromEnvironment()
  * @api
  */
 public function __construct(array $get, array $post, array $files, array $server)
 {
     $this->headers = Headers::createFromServer($server);
     $method = isset($server['REQUEST_METHOD']) ? $server['REQUEST_METHOD'] : 'GET';
     if ($method === 'POST') {
         if (isset($post['__method'])) {
             $method = $post['__method'];
         } elseif (isset($server['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
             $method = $server['HTTP_X_HTTP_METHOD_OVERRIDE'];
         } elseif (isset($server['HTTP_X_HTTP_METHOD'])) {
             $method = $server['HTTP_X_HTTP_METHOD'];
         }
     }
     $this->setMethod($method);
     if ($this->headers->has('X-Forwarded-Proto')) {
         $protocol = $this->headers->get('X-Forwarded-Proto');
     } else {
         $protocol = isset($server['SSL_SESSION_ID']) || isset($server['HTTPS']) && ($server['HTTPS'] === 'on' || strcmp($server['HTTPS'], '1') === 0) ? 'https' : 'http';
     }
     $host = isset($server['HTTP_HOST']) ? $server['HTTP_HOST'] : 'localhost';
     $requestUri = isset($server['REQUEST_URI']) ? $server['REQUEST_URI'] : '/';
     if (substr($requestUri, 0, 10) === '/index.php') {
         $requestUri = '/' . ltrim(substr($requestUri, 10), '/');
     }
     $this->uri = new \TYPO3\Flow\Http\Uri($protocol . '://' . $host . $requestUri);
     if ($this->headers->has('X-Forwarded-Port')) {
         $this->uri->setPort($this->headers->get('X-Forwarded-Port'));
     } elseif (isset($server['SERVER_PORT'])) {
         $this->uri->setPort($server['SERVER_PORT']);
     }
     $this->server = $server;
     $this->arguments = $this->buildUnifiedArguments($get, $post, $files);
 }
/**
 * DeserializationFilter has the job of taking the raw input stream and converting in into valid php objects.
 *
 * The DeserializationFilter is just part of a set of Filter chains used to manipulate the raw data.  Here we
 * get the input stream and convert it to php objects using the helper class AMFInputStream.
 */
function deserializationFilter(AMFObject &$amf)
{
    if ($GLOBALS['amfphp']['native'] === true && function_exists('amf_decode')) {
        include_once AMFPHP_BASE . "amf/io/AMFBaseDeserializer.php";
        include_once AMFPHP_BASE . "amf/io/AMFBaseSerializer.php";
        $deserializer = new AMFBaseDeserializer($amf->rawData);
        // deserialize the data
    } else {
        include_once AMFPHP_BASE . "amf/io/AMFDeserializer.php";
        include_once AMFPHP_BASE . "amf/io/AMFSerializer.php";
        $deserializer = new AMFDeserializer($amf->rawData);
        // deserialize the data
    }
    $deserializer->deserialize($amf);
    // run the deserializer
    //Add some headers
    $headers = $amf->_headerTable;
    if (isset($headers) && is_array($headers)) {
        foreach ($headers as $value) {
            Headers::setHeader($value->name, $value->value);
        }
    }
    //Set as a describe service
    $describeHeader = $amf->getHeader(AMFPHP_SERVICE_BROWSER_HEADER);
    if ($describeHeader !== false) {
        if ($GLOBALS['amfphp']['disableDescribeService']) {
            //Exit
            trigger_error("Service description not allowed", E_USER_ERROR);
            die;
        }
        $bodyCopy =& $amf->getBodyAt(0);
        $bodyCopy->setSpecialHandling('describeService');
        $bodyCopy->noExec = true;
    }
}
Esempio n. 5
0
/**
 * DeserializationFilter has the job of taking the raw input stream and converting in into valid php objects.
 * 
 * The DeserializationFilter is just part of a set of Filter chains used to manipulate the raw data.  Here we
 * get the input stream and convert it to php objects using the helper class AMFInputStream.
 */
function deserializationFilter(&$amf)
{
    $deserializer = new AMFDeserializer($amf->rawData);
    // deserialize the data
    $deserializer->deserialize($amf);
    // run the deserializer
    //Add some headers
    $headers = $amf->_headerTable;
    if (isset($headers) && is_array($headers)) {
        foreach ($headers as $key => $value) {
            Headers::setHeader($value->name, $value->value);
        }
    }
    //Set as a describe service
    $describeHeader = $amf->getHeader(AMFPHP_SERVICE_BROWSER_HEADER);
    if ($describeHeader !== false) {
        if ($GLOBALS['amfphp']['disableDescribeService']) {
            //Exit
            trigger_error("Service description not allowed", E_USER_ERROR);
            die;
        }
        $bodyCopy =& $amf->getBodyAt(0);
        $bodyCopy->setSpecialHandling('describeService');
        $bodyCopy->noExec = true;
    }
}
Esempio n. 6
0
 private function __construct()
 {
     //获取环境参数
     $this->env = Environment::getInstance()->get();
     //HTTP request headers (retains HTTP_ prefix to match $_SERVER)
     $this->headers = Headers::extract($_SERVER);
 }
Esempio n. 7
0
 /**
  * @throws \Exception
  */
 function __construct()
 {
     $this->domain = Headers::get('Host');
     if (!class_exists('Memcached') && Globals::get('MongularCache')) {
         $error = 'Mongular cache turned on but memcached does not exist.';
         throw new \Exception($error);
     }
 }
Esempio n. 8
0
 public function __construct($path, $method, $error)
 {
     $this->_path = $path;
     $this->_method = $method;
     $this->_error = $error;
     $this->_err_message = Headers::set_response($error);
     $this->_resp_message = Headers::get_response($error);
     parent::__construct($error);
     Headers::save($this->_err_message);
 }
Esempio n. 9
0
 /**
  * Construct the class & set its variables
  *
  * @param mixed $config Configuration data, possibly an .ini or .json
  */
 public function __construct($config = null)
 {
     $this->headers = Headers::load();
     if (isset($this->headers->{'x-github-event'})) {
         $this->event = $this->headers->{'x-github-event'};
     }
     if (isset($config)) {
         $this->config = Resources\Parser::parseFile($config);
     }
     $this->parsePayload();
 }
 public function __construct($request)
 {
     $this->_setRequestMethod();
     Authentication::authenticate();
     if (!Authentication::authenticated()) {
         // Return unauthorised response
         Headers::sendStatusUnauthorised();
         echo "Unauthorised<br>";
         return;
     }
     $this->_run($request);
 }
Esempio n. 11
0
 /**
  * @throws \Exception
  */
 public function __construct()
 {
     if (isset($_GET['q'])) {
         $parameters = explode('/', $_GET['q']);
         $this->request = Classes::getControllerRoute(array_shift($parameters));
         if (!$this->request) {
             throw new \Exception('Mongular: Request not valid.');
         }
         $this->values = $parameters;
         $this->query_parameters = Headers::get('QueryParameters');
     } else {
         throw new \Exception('Mongular: No valid parameters passed.');
     }
 }
Esempio n. 12
0
 protected function sendHeaders()
 {
     if ($this->status != 200 && isset(self::$httpCodes[$this->status])) {
         header(sprintf("%s %s", $this->protocol, self::$httpCodes[$this->status]));
     }
     if (!$this->headers) {
         return;
     }
     if (!$this->headers->has('content-type')) {
         $this->headers->set('content-type', 'text/html; charset=' . $this->charset);
     }
     foreach ($this->headers as $key => $value) {
         header("{$key}: {$value}", true);
     }
 }
Esempio n. 13
0
 public function __construct($code, $body)
 {
     $this->code = $code;
     $body = explode("\r\n\r\n", $body, 2);
     if (empty($body)) {
         throw new Exception\Response('Response seems to be empty.');
     }
     if ($body[0] == 'HTTP/1.1 100 Continue') {
         $body = explode("\r\n\r\n", $body[1], 2);
     }
     $this->headers = Headers::parse($body[0]);
     if (isset($body[1])) {
         $this->body = $body[1];
     }
 }
Esempio n. 14
0
 public function add_routes()
 {
     $routes = func_get_args();
     \_u::each($routes, function ($route, $index) {
         $method = key($route);
         $items = $route[$method];
         if (!Method::has_method(strtolower($method))) {
             continue;
         }
         $route = new Route($items);
         $route->method = new Method($method);
         if (isset($items['headers']) && is_array($items['headers'])) {
             $route->headers = Headers::set_for_route($items['headers']);
         }
         $this->routes[] = $route;
     });
 }
Esempio n. 15
0
 private function __construct($entrance)
 {
     //创建config
     $this->AppDefaultConfig = $this->AppDefaultConfig();
     //入口配置
     $this->ent = $entrance;
     //获取环境参数
     $this->env = Environment::getInstance()->get();
     //HTTP request headers (retains HTTP_ prefix to match $_SERVER)
     $this->headers = Headers::extract($_SERVER);
     //获取app 配置
     $file = $this->ent['CONF_FILE'] = $this->ent['CONF_FILE'] ?: 'Conf.php';
     $this->app = G($this->ent['APP_PATH'] . $file);
     //所有配置的模块列表
     $modulelist = $this->ent['modulelist'] ?: $this->app['modulelist'];
     $modulelist = is_array($modulelist) ? $modulelist : [];
     $this->modulelist = array_keys($modulelist);
 }
Esempio n. 16
0
 public function getResponse(ServiceLocatorInterface $serviceLocator, $path)
 {
     $serviceLocator->get('log')->info('Build Response');
     $urlDispatcher = new UrlDispatcher();
     $urlDispatcher->setServiceLocator($serviceLocator);
     $baseXMSResponse = $urlDispatcher->dispatch($path);
     $response = new ZendResponse();
     switch ((string) $baseXMSResponse->code) {
         case 200:
             $requestHandler = RequestHandler::factory((string) $baseXMSResponse->id, (string) $baseXMSResponse->contentclass, $this);
             // override response
             $response = $requestHandler->getResponse();
             break;
         case 301:
             if (true) {
                 $response->setContent('Redirect to <a href="' . (string) $baseXMSResponse->path . '">' . (string) $baseXMSResponse->path . '</a>');
                 $response->setStatusCode(200);
             } else {
                 $response->setContent('Redirect');
                 $response->setStatusCode(301);
                 $headers = Headers::fromString('Location: ' . (string) $baseXMSResponse->path);
                 $response->setHeaders($headers);
             }
             break;
         case 500:
             $response->setContent('500 - Server Error.');
             $response->setStatusCode((string) $baseXMSResponse->code);
             break;
         case 400:
             $response->setContent('404 - Not found.');
             $response->setStatusCode((string) $baseXMSResponse->code);
             break;
         default:
             $response->setContent('Unhandled return code.');
             $response->setStatusCode(500);
     }
     $response->setReasonPhrase($response->getReasonPhrase());
     // set default phrase
     $serviceLocator->get('accumulator')->start('BaseXMS', BASEXMS_START);
     $serviceLocator->get('accumulator')->stop('BaseXMS');
     return $response;
 }
Esempio n. 17
0
 public function getResponse()
 {
     $this->serviceManager->get('log')->info('Build Response');
     $response = new ZendResponse();
     switch ($this->baseXMSResponse->queryToValue('//code')) {
         case 200:
             $requestHandler = \BaseXMS\RequestHandler\Factory::factory($this->baseXMSResponse, $this);
             // override response
             $response = $requestHandler->getResponse();
             break;
         case 301:
             if (true) {
                 $response->setContent('Redirect to <a href="' . (string) $this->baseXMSResponse->path . '">' . (string) $this->baseXMSResponse->path . '</a>');
                 $response->setStatusCode(200);
             } else {
                 $response->setContent('Redirect');
                 $response->setStatusCode(301);
                 $headers = Headers::fromString('Location: ' . (string) $this->baseXMSResponse->path);
                 $response->setHeaders($headers);
             }
             break;
         case 500:
             $response->setContent('500 - Server Error.');
             $response->setStatusCode((string) $this->baseXMSResponse->code);
             break;
         case 400:
             $response->setContent('404 - Not found.');
             $response->setStatusCode((string) $this->baseXMSResponse->code);
             break;
         default:
             $response->setContent('Unhandled return code.');
             $response->setStatusCode(500);
     }
     $response->setReasonPhrase($response->getReasonPhrase());
     // set default phrase
     $this->serviceManager->get('accumulator')->start('BaseXMS', BASEXMS_START);
     $this->serviceManager->get('accumulator')->stop('BaseXMS');
     return $response;
 }
Esempio n. 18
0
     *
     * @return none, but populates $this->JSON
     */
    public function handleGET()
    {
        $TE = $this->getHeader('acquisition:echo_time');
        $TR = $this->getHeader('acquisition:repetition_time');
        $TI = $this->getHeader('acquisition:inversion_time');
        $ST = $this->getHeader('acquisition:slice_thickness');
        $SeriesName = $this->getHeader("acquisition:protocol");
        $SeriesDescription = $this->getHeader("acquisition:series_description");
        $XSpace = ["Length" => $this->getHeader("xspace:length"), "StepSize" => $this->getHeader("xspace:step")];
        $YSpace = ["Length" => $this->getHeader("yspace:length"), "StepSize" => $this->getHeader("yspace:step")];
        $ZSpace = ["Length" => $this->getHeader("zspace:length"), "StepSize" => $this->getHeader("zspace:step")];
        $TimeD = ["Length" => $this->getHeader("time:length"), "StepSize" => $this->getHeader("time:step")];
        $this->JSON = ['Meta' => ['CandID' => $this->CandID, 'Visit' => $this->VisitLabel, 'Filename' => $this->Filename], 'Physical' => ["TE" => $TE, "TR" => $TR, "TI" => $TI, "SliceThickness" => $ST], 'Description' => ["SeriesName" => $SeriesName, "SeriesDescription" => $SeriesDescription], 'Dimensions' => ["XSpace" => $XSpace, "YSpace" => $YSpace, "ZSpace" => $ZSpace, "TimeDimension" => $TimeD]];
    }
    /**
     * Calculate the entity tag for this URL
     *
     * @return string
     */
    public function calculateETag()
    {
        return null;
    }
}
if (isset($_REQUEST['PrintHeadersSummary'])) {
    $obj = new Headers($_SERVER['REQUEST_METHOD'], $_REQUEST['CandID'], $_REQUEST['VisitLabel'], $_REQUEST['Filename']);
    print $obj->toJSONString();
}
Esempio n. 19
0
 public function __construct(Headers $header = null, Cookies $cookie = null)
 {
     $this->headers = is_null($header) ? Headers::createFromEnv() : $header;
     $this->cookies = is_null($cookie) ? new Cookies() : $cookie;
 }
Esempio n. 20
0
 function getHeader($key)
 {
     return Headers::setHeader($key);
 }
Esempio n. 21
0
 /**
  * The service method runs the gateway application.  It turns the gateway 'on'.  You
  * have to call the service method as the last line of the gateway script after all of the
  * gateway configuration properties have been set.
  * 
  * Right now the service method also includes a very primitive debugging mode that
  * just dumps the raw amf input and output to files.  This may change in later versions.
  * The debugging implementation is NOT thread safe so be aware of file corruptions that
  * may occur in concurrent environments.
  */
 function service()
 {
     //Set the parameters for the charset handler
     CharsetHandler::setMethod($this->_charsetMethod);
     CharsetHandler::setPhpCharset($this->_charsetPhp);
     CharsetHandler::setSqlCharset($this->_charsetSql);
     //Attempt to call charset handler to catch any uninstalled extensions
     $ch = new CharsetHandler('flashtophp');
     $ch->transliterate('?');
     $ch2 = new CharsetHandler('sqltophp');
     $ch2->transliterate('?');
     $GLOBALS['amfphp']['actions'] = $this->actions;
     if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
     }
     if (isset($GLOBALS["HTTP_RAW_POST_DATA"]) && $GLOBALS["HTTP_RAW_POST_DATA"] != "") {
         //Start NetDebug
         NetDebug::initialize();
         error_reporting($GLOBALS['amfphp']['errorLevel']);
         //Enable loose mode if requested
         if ($this->_looseMode) {
             ob_start();
         }
         $amf = new AMFObject($GLOBALS["HTTP_RAW_POST_DATA"]);
         // create the amf object
         if ($this->incomingMessagesFolder != NULL) {
             $mt = microtime();
             $pieces = explode(' ', $mt);
             file_put_contents($this->incomingMessagesFolder . 'in.' . $pieces[1] . '.' . substr($pieces[0], 2) . ".amf", $GLOBALS["HTTP_RAW_POST_DATA"]);
         }
         foreach ($this->filters as $key => $filter) {
             $filter($amf);
             //   invoke the first filter in the chain
         }
         $output = $amf->outputStream;
         // grab the output stream
         //Clear the current output buffer if requested
         if ($this->_looseMode) {
             ob_end_clean();
         }
         //Send content length header
         //Thanks to Alec Horley for pointing out the necessity
         //of this for FlashComm support
         header(AMFPHP_CONTENT_TYPE);
         // define the proper header
         if (Headers::getHeader('serviceBrowser') == true) {
             //Add the total time header
             $toAddPos = strpos($output, "СА");
             $time = (int) ((microtime_float() - $GLOBALS['amfphp']['startTime']) * 1000);
             $b = pack("d", $time);
             // pack the bytes
             if (AMFPHP_BIG_ENDIAN) {
                 // if we are a big-endian processor
                 $r = strrev($b);
             } else {
                 // add the bytes to the output
                 $r = $b;
             }
             $output = substr($output, 0, $toAddPos) . $r . substr($output, $toAddPos + 8);
         }
         //Send expire header, apparently helps for SSL
         //Thanks to Gary Rogers for that
         //And also to Lucas Filippi from openAMF list
         //And to Robert Reinhardt who appears to be the first who
         //documented the bug
         //Finally to Gary who appears to have find a solution which works even more reliably
         $dateStr = date("D, j M Y ") . date("H:i:s", strtotime("-2 days"));
         header("Expires: {$dateStr} GMT");
         header("Pragma: no-store");
         header("Cache-Control: no-store");
         //else don't send any special headers at all
         if ($this->outgoingMessagesFolder != NULL) {
             $mt = microtime();
             $pieces = explode(' ', $mt);
             file_put_contents($this->outgoingMessagesFolder . 'out.' . $pieces[1] . '.' . substr($pieces[0], 2) . ".amf", $output);
         }
         $doCompress = false;
         $outputCompression = @ini_get("zlib.output_compression");
         if (!$outputCompression) {
             if (strlen($output) > $this->_gzipCompressionThreshold && extension_loaded("zlib") && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && $this->_enableGzipCompression) {
                 $doCompress = true;
                 ob_start();
                 ob_start('ob_gzhandler');
             } else {
                 header("Content-length: " . strlen($output));
             }
         }
         print $output;
         // flush the binary data
         if ($doCompress) {
             ob_end_flush();
             header("Content-length: " . ob_get_length());
             ob_end_flush();
         }
     } else {
         $versionData = explode("\n", file_get_contents(APP . DS . "plugins" . DS . "cpamf" . DS . "version.txt"));
         $cpamfVersion = $versionData[count($versionData) - 1];
         echo "<p> CpAmf plugin v" . $cpamfVersion . " (CakePHP 1.2)</p>";
         echo "<p>amfphp and this gateway are installed correctly. You may now connect " . "to this gateway from Flash.</p>";
         if (function_exists("amf_decode")) {
             echo "<p>AMF C Extension is loaded " . ($GLOBALS['amfphp']['native'] ? "and enabled." : "but disabled") . "</p>";
         }
         echo "<p>Note: If you're reading an " . "old tutorial, it will tell you that you should see a download " . "window instead of this message. This confused people so this is " . "the new behaviour starting from amfphp 1.2.</p><p>" . "<a href='http://www.amfphp.org/docs'>View the amfphp documentation</p>" . "<p><a href='browser'>Load the service browser</a></p>";
         echo "<pre>";
     }
 }
Esempio n. 22
0
 public function __construct()
 {
     parent::__construct("Headers Type incorrect");
     Headers::save(Headers::set_response('500'));
 }
Esempio n. 23
0
 public function __construct($name, $class)
 {
     parent::__construct("{$name} is not a Database ({$class})");
     Headers::save(Headers::set_response('500'));
     $this->display_error_page();
 }
Esempio n. 24
0
 public function __construct($type)
 {
     parent::__construct("{$type} is not a valid type of route");
     Headers::save(Headers::set_response('500'));
 }
Esempio n. 25
0
 /**
  * Handle a a set of routes: if a match is found, execute the relating handling function
  * @param array $routes Collection of route patterns and their handling functions
  * @param boolean $quitAfterRun Does the handle function need to quit after one route was matched?
  * @return int The number of routes handled
  */
 private function handle($routes, $quitAfterRun = false)
 {
     // Counter to keep track of the number of routes we've handled
     $numHandled = 0;
     // The current page URL
     $uri = Headers::GetRequestUri();
     // Variables in the URL
     $urlvars = array();
     // Loop all routes
     foreach ($routes as $route) {
         // we have a match!
         if (preg_match_all('#^' . $route['pattern'] . '$#', $uri, $matches, PREG_OFFSET_CAPTURE)) {
             // Extract the matched URL parameters (and only the parameters)
             $params = Headers::GetRegExParams(array_slice($matches, 1));
             // call the handling function with the URL parameters
             call_user_func_array($route['fn'], $params);
             // yay!
             $numHandled++;
             // If we need to quit, then quit
             if ($quitAfterRun) {
                 break;
             }
         }
     }
     // Return the number of routes handled
     return $numHandled;
 }
Esempio n. 26
0
/**
 * Adds debugging information to outgoing packet
 */
function debugFilter(&$amf)
{
    //Add trace headers before outputting
    if (!$GLOBALS['amfphp']['isFlashComm'] && !$GLOBALS['amfphp']['disableTrace']) {
        $headerresults = array();
        // create a result array
        $headerresults[0] = array();
        // create a sub array in results (CF seems to do this, don't know why)
        if (count(NetDebug::getTraceStack()) != 0) {
            $ts = NetDebug::getTraceStack();
            $headerresults[0][] = new TraceHeader($ts);
        }
        if (Headers::getHeader("serviceBrowser") == true) {
            global $amfphp;
            $amfphp['totalTime'] = microtime_float() - $amfphp['startTime'];
            $headerresults[0][] = new ProfilingHeader();
        }
        //Get the last body in the stack
        if (count($headerresults[0]) > 0) {
            $body =& $amf->getBodyAt($amf->numBody() - 1);
            $headers = new MessageBody(NULL, $body->responseIndex, NULL);
            // create a new amf body
            $headers->responseURI = $body->responseIndex . "/onDebugEvents";
            // set the response uri of this body
            $headers->setResults($headerresults);
            // set the results.
            $amf->addBodyAt(0, $headers);
        }
    }
}
Esempio n. 27
0
<?php

/* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80 : */
// Returns all builders belonging to a branch with the following format:
// [ { "name": "...", "buildername": "...", "hidden": 0/1 }, ... ]
// hidden:0 may be ommitted.
require_once 'config.php';
require_once 'inc/Communication.php';
Headers::send(Headers::ALLOW_CROSS_ORIGIN | Headers::NO_CACHE, "application/json");
$branch = requireStringParameter('branch', $_GET);
$stmt = $db->prepare("\n  SELECT name, buildername, hidden\n  FROM builders\n  WHERE branch = :branch\n  ORDER BY buildername ASC;");
$stmt->execute(array(":branch" => $branch));
// mysql returns everything as string, so we need to manually cast to bool :-(
$result = array();
while ($builder = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $builder['hidden'] = $builder['hidden'] != "0";
    $result[] = $builder;
}
echo json_encode($result) . "\n";
Esempio n. 28
0
<?php

/* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80 : */
require_once 'inc/LogParser.php';
require_once 'inc/GeneralErrorFilter.php';
require_once 'inc/ShortLogGenerator.php';
require_once 'inc/FullLogGenerator.php';
require_once 'inc/GzipUtils.php';
require_once 'inc/RunForLog.php';
require_once 'inc/Communication.php';
Headers::send(Headers::ALLOW_CROSS_ORIGIN);
$run = getRequestedRun();
$logParser = new LogParser($run, new GeneralErrorFilter());
try {
    // Create the plain text summary too, since we need to parse the
    // log for errors anyway.
    $logParser->ensureExcerptExists();
    $viewFullLog = isset($_GET['full']) && $_GET['full'] == 1;
    $logGenerator = $viewFullLog ? new FullLogGenerator($logParser, $run) : new ShortLogGenerator($logParser, $run);
    $parsedLog = $logGenerator->ensureLogExists();
    GzipUtils::passThru($parsedLog, "text/html");
} catch (Exception $e) {
    die($e->getMessage());
}
/**
 * @copyright	@copyright	Copyright (c) 2016 knvbapi. All rights reserved.
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
// no direct access
defined('_JEXEC') or die;
// include the syndicate functions only once
if (!class_exists('modiCcalendarHelper')) {
    require_once dirname(__FILE__) . '/helper.php';
}
$class_sfx = htmlspecialchars($params->get('class_sfx'));
$json = modKNVBAPI2Helper::SetUrl($params);
$selectie = Selectie::getSelectie();
$getteams = Teams::getTeams();
$getcompetities = Competities::getCompetitie();
$getheader = Headers::getHeaders();
$getsize = Image::getLogoSize($params);
echo $getsize;
// Show Columns of program view
$matchid = $params->get('MatchID');
$wedstijdnummer = $params->get('WedstrijdNummer');
$datum = $params->get('Datum');
$tijd = $params->get('Tijd');
$verzameltijd = $params->get('Verzameltijd');
$thuisclub = $params->get('ThuisClub');
$thuislogo = $params->get('ThuisLogo');
$thuisteamid = $params->get('ThuisTeamID');
$uitclub = $params->get('UitClub');
$uitlogo = $params->get('UitLogo');
$uitteamid = $params->get('UitTeamID');
$bijzonderheden = $params->get('Bijzonderheden');
Esempio n. 30
0
<?php

/* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80 : */
require_once 'config.php';
require_once 'inc/Communication.php';
Headers::send(Headers::ALLOW_CROSS_ORIGIN, "application/json");
$id = requireStringParameter('id', $_POST);
if (is_numeric($id)) {
    // $id is a Buildbot ID.
    $stmt = $db->prepare("\n    SELECT id\n    FROM runs\n    WHERE buildbot_id = :id;");
    $stmt->execute(array(":id" => $id));
    $run = $stmt->fetchColumn();
    if (!$run) {
        die("No build with that id in database.");
    }
} else {
    // $id is not a Buildbot ID; it could be a Tinderbox result ID.
    // TBPL with Tinderbox backend doesn't know the Buildbot ID of a run,
    // so it lets us figure it out from the slave name and the start time
    // of the run.
    $slave = requireStringParameter('machinename', $_POST);
    $starttime = +requireStringParameter('starttime', $_POST);
    $stmt = $db->prepare("\n    SELECT id\n    FROM runs\n    WHERE slave = :slave AND starttime = FROM_UNIXTIME(:starttime);");
    $stmt->execute(array(":slave" => $slave, ":starttime" => $starttime));
    $run = $stmt->fetchColumn();
    if (!$run) {
        die("No build with that slave/starttime combination in database.");
    }
}
$who = requireStringParameter('who', $_POST);