示例#1
0
<?php

/*******************************************************
 * Copyright (C) 2015 Muhammad Juan Akbar - All Rights Reserved
 * Written by Muhammad Juan Akbar <*****@*****.**>, 07 2015
 *
 * index.php can not be copied and/or distributed without the express
 * permission of author.
 *******************************************************/
namespace resapi;

require 'vendor/autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) && ($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'GET' || $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'POST' || $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'DELETE' || $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'PUT')) {
        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Credentials: true");
        header('Access-Control-Allow-Headers: X-Requested-With');
        header('Access-Control-Allow-Headers: Content-Type, api-token, www-authorization');
        header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT');
        // http://stackoverflow.com/a/7605119/578667
        header('Access-Control-Max-Age: 86400');
    }
    exit;
}
$app = new Setup();
$app->run();
示例#2
0
        }
    }
    private function copy_folder($src, $dest)
    {
        if (is_win()) {
            $this->execute("xcopy {$src} {$dest} /S/I/Y/Q >log.txt");
        } else {
            $this->execute("cp -fR {$src} {$dest}");
        }
    }
    private function copy_file($src, $dest)
    {
        if (is_win()) {
            $this->execute("copy {$src} {$dest} /Y >log.txt");
        } else {
            $this->execute("cp -fR {$src} {$dest}");
        }
    }
    private function execute($command)
    {
        if (!is_array($command)) {
            $command = array($command);
        }
        foreach ($command as $cmd) {
            passthru($cmd);
        }
    }
}
$setup = new Setup();
$setup->run();
示例#3
0
 public function testRun()
 {
     $q = 'SELECT something';
     $this->connection->expects($this->once())->method('multiQuery')->with($q);
     $this->object->run($q);
 }