コード例 #1
0
ファイル: jobs.php プロジェクト: neutrons/MWS-Front-End
 // Check request method (GET or PUT)
 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
     // Various "get job" functions here...
     // Check the request URI.  Requests for individual jobs
     // will have a path of ".../jobs/<job-id>
     $dirs = explode("/", $_SERVER['REQUEST_URI']);
     if ($dirs[count($dirs) - 1] == "jobs") {
         // Request for all jobs....
         list($http_code, $query_response) = get_jobs($_SERVER['PHP_AUTH_USER']);
         // Success code is and 200.  Errors are 4xx...
         header(sprintf("HTTP/1.1 %d", $http_code));
         echo $query_response;
     }
     if ($dirs[count($dirs) - 2] == "jobs") {
         // Request for a specific jobID...
         list($http_code, $query_response) = get_job($dirs[count($dirs) - 1], $_SERVER['PHP_AUTH_USER']);
         // Success code is and 200.  Errors are 4xx...
         header(sprintf("HTTP/1.1 %d", $http_code));
         echo $query_response;
     }
 } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
     // Verify the username in the attached JSON actually matches
     // the user in the auth header
     $body = file_get_contents('php://input');
     $json_vars = json_decode($body, true);
     if (isset($json_vars['user'])) {
         if ($json_vars['user'] != $_SERVER['PHP_AUTH_USER']) {
             $msg = "User name in request body doesn't match user name in authorization header";
             throw new MwsAuthorizationException($msg);
         }
     } else {
コード例 #2
0
ファイル: control.php プロジェクト: nickyudha/spalosophy
$sort_by = $pgdata['sort_by'];
$first_record = $pgdata['first_record'];
$search_parameter = $pgdata['search_parameter'];
$search_value = $pgdata['search_value'];
$search_query = $pgdata['search_query'];
$search = $pgdata['search'];
if (empty($_REQUEST['cat']) || $_REQUEST['cat'] == 'all') {
    $cat = '';
} else {
    $cat = "AND category_name = '" . $_REQUEST['cat'] . "' ";
}
$full_order = count_job($search_query, $sort_by, $query_per_page, $cat);
$total_query = $full_order['total_query'];
$total_page = ceil($full_order['total_query'] / $query_per_page);
// CALL FUNCTION
$listing_order = get_job($search_query, $sort_by, $first_record, $query_per_page, $cat);
// OPTION CATEGORY
$category = get_category();
// HANDLING ARROW SORTING
if ($_REQUEST['srt'] == "category_name DESC") {
    $arr_order_number = "<span class=\"sort-arrow-up\"></span>";
} else {
    if ($_REQUEST['srt'] == "category_name") {
        $arr_order_number = "<span class=\"sort-arrow-down\"></span>";
    } else {
        $arr_order_number = "<span class=\"sort-arrow-down\"></span>";
    }
}
// STORED VALUE
echo "<input type=\"hidden\" name=\"url\" id=\"url\" class=\"hidden\" value=\"http://" . $_SERVER['HTTP_HOST'] . get_dirname($_SERVER['PHP_SELF']) . "/store-view\">\n";
echo "<input type=\"hidden\" name=\"page\" id=\"page\" class=\"hidden\" value=\"" . $page . "\" /> \n";
コード例 #3
0
ファイル: main.php プロジェクト: kden/pipeline-framework
if (count($argv) < 2) {
    echo "Command required.\n";
    show_usage();
    return;
}
$cmd = $argv[1];
if ($cmd == "scripts") {
    if (count($argv) > 2) {
        get_script($argv[2]);
    } else {
        get_scripts();
    }
} else {
    if ($cmd == "jobs") {
        if (count($argv) > 2) {
            get_job($argv[2]);
        } else {
            get_jobs();
        }
    } else {
        if ($cmd == "new-job") {
            if (count($argv) == 2) {
                echo "Error: more arguments required.";
                return;
            }
            if (count($argv) == 3) {
                post_job($argv[2], null);
            } else {
                if (count($argv) == 4) {
                    post_job($argv[2], $argv[3]);
                }