Esempio n. 1
0
function starmadeLogin($params)
{
    $url = 'http://star-made.org/api/user/login.xml';
    $response = processRequest($url, $params);
    $xml = new SimpleXMLElement($response);
    $_SESSION = parseXml($xml);
}
Esempio n. 2
0
    public function testReturnException()
    {
        $post = <<<'EOD'
7|0|4|http://www.example.com|06947190A0EEE28C80FC4D690B2E92F0|com.example.rpcproject.client.GreetingService|doError|1|2|3|4|0|
EOD;
        $expected = <<<'EOD'
//EX[2,1,["java.lang.IllegalArgumentException\/1755012560","Java system exception"],0,7]
EOD;
        $this->assertEquals($expected, processRequest($post));
    }
Esempio n. 3
0
 function processLine($buffer)
 {
     if (!$this->inParams) {
         $markerPos = strpos($buffer, APIV3_START_MARKER);
         if ($markerPos !== false) {
             $explodedBuffer = explode(' ', $buffer);
             $this->ipAddress = substr($explodedBuffer[3], 1, -1);
             $this->params = substr($buffer, $markerPos + strlen(APIV3_START_MARKER));
             $this->inParams = true;
             $this->isFeed = false;
             return false;
         }
         $markerPos = strpos($buffer, APIV3_GETFEED_MARKER);
         if ($markerPos !== false) {
             $explodedBuffer = explode(' ', $buffer);
             $this->ipAddress = substr($explodedBuffer[3], 1, -1);
             $this->params = substr($buffer, $markerPos + strlen(APIV3_GETFEED_MARKER));
             $this->inParams = true;
             $this->isFeed = true;
             return false;
         }
     } else {
         if ($buffer[0] == ']') {
             $this->inParams = false;
             $parsedParams = print_r_reverse($this->params);
             if (print_r($parsedParams, true) != $this->params) {
                 print "print_r_reverse failed\n";
                 return false;
             }
             if ($this->isFeed) {
                 $shouldQuit = processFeedRequest($this->ipAddress, $parsedParams);
             } else {
                 $shouldQuit = processRequest($this->ipAddress, $parsedParams);
             }
             if ($shouldQuit) {
                 return true;
             }
         } else {
             $this->params .= $buffer;
         }
     }
     return false;
 }
Esempio n. 4
0
    trigger_error('Required class [TemplatesManager] not found', PM_FATAL);
}
initStructure();
//$structureMgr will be created
initModules();
//$modulesMgr will be created
initTemplates();
//$templatesMgr will be created
//    initNotifications(); //$ntfMgr will be created
initCache();
//$cacheMgr will be created
initAuthentication();
//$authenticationMgr will be created
initPermissions();
//$permissionsMgr will be created
processRequest();
if (isset($_errors) && !GetCfg('SuppressErrors') && !empty($_errors)) {
    echoErrorBlock($_errors);
}
$stime = round(get_microtime() - $stime, 3);
$userID = $authenticationMgr->getUserID();
if ($userID == 1) {
    $userName = '******';
} else {
    $ud = $authenticationMgr->getUserData($userID);
    $userName = $ud['Login'];
}
print "\n<!-- Generated in {$stime} seconds for user [ {$userName} ] -->\n";
/******************************************************************************
                                 MAIN FLOW END
******************************************************************************/
Esempio n. 5
0
function execute_request(&$db)
{
    // do not append or prepend anything to output if we have to download
    $output = v($_REQUEST["type"]) == 'download' ? false : true;
    if ($output) {
        startForm($db);
    }
    if (isset($_REQUEST["type"])) {
        $module_requested = $_REQUEST["type"];
        $_REQUEST["query"] = trim(v($_REQUEST["query"], ""), " \t\r\n;");
        $module = BASE_PATH . "/modules/" . $module_requested . ".php";
        if (ctype_alpha($module_requested) && file_exists($module)) {
            require BASE_PATH . '/config/modules.php';
            // check for module access type and allow/disallow as needed
            if (MODULE_ACCESS_MODE == 'deny' && in_array($module_requested, $DENY_MODULES)) {
                createErrorPage();
            } else {
                if (MODULE_ACCESS_MODE == 'allow' && !in_array($module_requested, $ALLOW_MODULES)) {
                    createErrorPage();
                } else {
                    include $module;
                    function_exists('processRequest') ? processRequest($db) : createErrorGrid($db, "");
                }
            }
        } else {
            createErrorPage();
        }
        // unidentified type requested
    }
    if ($output) {
        print "</form>\n";
        print "</body></html>";
    }
}
Esempio n. 6
0
<?php

/**
 * PicoFramework is a very lightweight modular MVC-framerwork with filesystem-based routing
 *
 * For more information @see readme.md
 *
 * @link https://github.com/peter23/PicoFramework
 * @author i@peter23.com
 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
 */
require 'system/core.php';
processRequest(getConfig('paths', 'ROUTE'));
Esempio n. 7
0
// type for returned data
class ReturnObject
{
    public $available;
    public $searchTerm;
    public function __construct()
    {
    }
}
// get query string as associative array
parse_str($_SERVER['QUERY_STRING'], $query);
$values = array("username" => array("jmcpeak", "pwilton"), "email" => array("*****@*****.**", "*****@*****.**"));
function processRequest()
{
    global $query, $values;
    $obj = new ReturnObject();
    $obj->available = TRUE;
    foreach ($query as $key => $value) {
        $arrValues = $values[$key];
        $obj->searchTerm = $value;
        for ($ii = 0; $ii < count($arrValues); $ii++) {
            if (strtolower($arrValues[$ii]) == strtolower($value)) {
                $obj->available = FALSE;
                break;
            }
        }
    }
    return $obj;
}
echo json_encode(processRequest());
<?php

const EMAIL_DESTINATOR = '*****@*****.**';
const CONTROLLER_FREE_CONSULTATION = 'free-consultation';
const CONTROLLER_CREDIT_CONSULTATION = 'credit-consultation';
const CONTROLLER_DEBT_CONSULTATION = 'debt-consultation';
const CONTROLLER_BANKRUPCY_CONSULTATION = 'bankruptcy-consultation';
$postRequest = $_POST;
$errors = processRequest($postRequest);
$phone;
$option;
function processRequest($request)
{
    $errors = array();
    $controller = isset($request['controller']) ? $request['controller'] : false;
    if (!$controller) {
        $errors[] = array("cause" => "Bad request!");
    }
    $name = isset($request['name']) ? $request['name'] : false;
    $phone = isset($request['phone']) ? $request['phone'] : false;
    if (!$name or !$phone) {
        $errors[] = array("cause" => "Make sure you write your full name and your phone!");
    }
    $option = isset($request['option']) ? $request['option'] : false;
    if (!$option) {
        $errors[] = array("cause" => "Make sure you select a valid option for your consultation!");
    }
    if ($errors) {
        header($_SERVER["SERVER_PROTOCOL"] . " 400 Bad Request");
        die(json_encode($errors));
    }
Esempio n. 9
0
<?php

require_once 'settings/DBSettings.php';
$requestResult;
$requestMethod = $_SERVER['REQUEST_METHOD'];
$requestData = json_decode(file_get_contents('php://input'), true);
processRequest($requestMethod, $requestData);
echo json_encode($requestResult);
function processRequest($reqMethod, $reqData)
{
    switch ($reqMethod) {
        case 'GET':
            processGETRequest();
            break;
        case 'POST':
            processPOSTRequest($reqData);
            break;
        case 'DELETE':
            processDELRequest($reqData);
            break;
    }
}
function processDELRequest($reqData)
{
    if (!deletePoint($reqData[id])) {
        return;
    }
    retrievePointsList();
}
function processPOSTRequest($reqData)
{
Esempio n. 10
0
<?php

require_once 'config.php';
require_once 'functions.php';
session_start();
$requestParsed = parseRequest();
processRequest($requestParsed);
} else {
    echo orderStatusText($order);
}
echo "<HR>";
// before we do anything useful, make sure that user is logged
// in.  Anyone that is logged in can SEE orders...
// check to see if th euesr is logged in - if not, this routine DOES NOT return
checkUserLoggedIn();
// here's where it gets interesting...
//  - if a previous button has been pressed, then we process a bit differently
//  - otherwise, the order is presented
if ($request) {
    if ($confirmed) {
        processRequestConfirmed($order, $page_id, $oid, $request, get_page_link($orderListLink), get_page_link($packingListLink), get_page_link($shipOrderLink));
    } else {
        processRequest($order, $page_id, $oid, $request, get_page_link($orderListLink), get_page_link($packingListLink), get_page_link($shipOrderLink));
    }
} else {
    showOrder($order, $customer, $page_id, $oid, get_page_link($editOrderLink), get_page_link($editCustomerLink), get_page_link($shipOrderLink) . "&edit");
    echo "<HR><H3>Payment</H3>\n";
    showPayment($order, $page_id, $oid);
    echo "<HR><H3> Shipping</H3>\n";
    showShipping($order, $page_id, $oid, get_page_link($shipOrderLink));
    echo "<HR><H3>Overrides</h3>\n";
    echo prettyButton($page_id, $oid, "DELETE", "delete");
    if ($order["WasCanceled"]) {
        echo prettyButton($page_id, $oid, "UN-CANCEL", "uncancel");
    } else {
        echo prettyButton($page_id, $oid, "CANCEL", "cancel");
    }
    echo prettyButton($page_id, $oid, "DUPLICATE", "dup", false, current_user_can("can_duplicate_orders"));
//
// HERE'S WHERE THE ACTUAL GOOD STUFF IS!  Up to this point we have
// be doing a lot of setup.
//
// The plan is to paint a screen describing the customer, in a non
// editable format.  Buttons will be available for working with
// the customers.
// first, retrieve the customer, which has the side effect of validating it
$customer = dbGetCustomer($cid);
echo "<H1>Customer: {$cid}</h1>\n";
echo "<HR>";
// here's where it gets interesting...
//  - if a previous button has been pressed, then we process a bit differently
//  - otherwise, the customer is presented
if ($request) {
    if ($confirmed) {
        processRequestConfirmed($page_id, $cid, $request);
    } else {
        processRequest($page_id, $cid, $request);
    }
} else {
    echo prettyButton($page_id, $cid, "DELETE", "delete");
    echo prettyButton($page_id, $cid, "EDIT", "edit");
}
echo "<HR>\n";
?>

</div><!-- end of #content-full -->

<?php 
get_footer();
Esempio n. 13
0
/**
 * 
 */
$scope = empty($_REQUEST['scope']) ? '' : $_REQUEST['scope'];
$qihooOauth2 = new Qihoo_OAuth2(QIHOO_APP_KEY, QIHOO_APP_SECRET, $scope);
if (QIHOO_MSDK_DEBUG) {
    //打开调试日志
    $logger = Qihoo_Logger_File::getInstance();
    //设置日志路径
    $logger->setLogPath(QIHOO_MSDK_LOG);
    $qihooOauth2->setLogger($logger);
}
header('Content-Type: application/json; charset=utf-8');
try {
    $act = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'get_user';
    $data = processRequest($qihooOauth2, $act);
    echo json_encode($data);
} catch (Qihoo_Exception $e) {
    echo json_encode(array('error_code' => $e->getCode(), 'error' => $e->getMessage()));
}
/**
 * 
 * @param Qihoo_OAuth2 $qihooOauth2
 * @return array
 */
function processRequest($qihooOauth2, $act)
{
    switch ($act) {
        //用token获取用户信息
        case 'get_user':
            $token = isset($_GET['token']) ? $_GET['token'] : '';
Esempio n. 14
0
<?php

include '../functions.php';
$parameters = explode("/", $_GET["request"]);
$http_verb = $_SERVER['REQUEST_METHOD'];
header('Content-type: application/json');
processRequest($http_verb, $parameters);
/**
 * Stops script execution and returns a 500 http error
 * with a custom message
 * 
 * @param string $str Description of the error
 */
function terminate($str)
{
    http_response_code(500);
    echo 'error ' . $str;
    exit;
}
/**
 * Includes the appropriate php script
 * to process the request
 *
 * @param string $http_verb the HTTP verb
 * @param array $parameters the list of parameters passed with the request
 */
function processRequest($http_verb, $parameters)
{
    if ($http_verb == "GET" && $parameters[0] == "parking" && $parameters[1] == "zone") {
        include "parking/zone.php";
    } else {
Esempio n. 15
0
header("Content-Type: text/html;charset=UTF-8");
@($http_proxy = "srv01gr.unx.sas.com:80");
@($demoConfigFile = "config.json");
@($demoConfig = array());
@($enable_logging = true);
@($logging_db = array("host" => "localhost:3306", "user" => "omnichanneldemo", "pass" => "CXfmZqwVzDpfzTKJ"));
$mysql_link = new mysqli($logging_db['host'], $logging_db['user'], $logging_db['pass'], $logging_db['user']);
if ($mysql_link->connect_errno) {
    // Let's try this:
    echo "Sorry, this website is experiencing problems.";
    echo "Error: Failed to make a MySQL connection, here is why: \n";
    echo "Errno: " . $mysql_link->connect_errno . "\n";
    echo "Error: " . $mysql_link->connect_error . "\n";
    exit;
}
return processRequest();
// Continue reading in processRequest();
function getRequestParameter($parameter)
{
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        return @$_POST[$parameter] ? @$_POST[$parameter] : @$_GET[$parameter];
    } else {
        return @$_GET[$parameter];
    }
}
function processRequest()
{
    // if POST
    // -> handle Upload
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        header('Content-type: application/json');
Esempio n. 16
0
date_default_timezone_set(HOMER_TIMEZONE);
ini_set('date.timezone', HOMER_TIMEZONE);
/* MAIN CLASS modules */
require_once "../class/index.php";
require_once "api/class/restutils.php";
require_once "api/class/process.php";
require_once "api/class/search.php";
//if((!defined("SKIPAUTH") || $component != "login") && $auth->logincheck() == false){
if ((!defined('NOAUTH') || NOAUTH == 0) && $auth->logincheck() == false) {
    $answer['sid'] = session_id();
    $answer['auth'] = 'false';
    $answer['status'] = 'wrong-session';
    sendResponse($reply, json_encode($answer), 'application/json');
    exit;
}
$obj = processRequest();
/* Call Search */
$search = new Search();
$search->setDB($db);
/* ANSWER */
$answer = array();
$answer['server'] = "apiserver";
$answer['language'] = "en";
$reply = 200;
$method = $obj->getMethod();
$request = $obj->getRURI();
$data = $obj->getData();
if ($method == "get" || $method == "post") {
    $ret = basicFeautures($request, $data);
    $answer = array_merge($answer, $ret);
} else {
Esempio n. 17
0
    // define XML-RPC server
    $server = xmlrpc_server_create();
    // log for debuggin
    $fp = fopen("/var/tmp/ws_request.log", "a");
    fwrite($fp, date("H:i") . "\n");
    fwrite($fp, $request_xml);
    fwrite($fp, "\n\n");
    fclose($fp);
    // register methods
    xmlrpc_server_register_method($server, "getQueueValues", "rpc_get_queue_values");
    xmlrpc_server_register_method($server, "pushValue", "rpc_push_value");
    xmlrpc_server_register_method($server, "getStateData", "rpc_get_state_data");
    xmlrpc_server_register_method($server, "setStateData", "rpc_set_state_data");
    xmlrpc_server_register_method($server, "helloWorld", "rpc_hello_world");
    xmlrpc_server_register_method($server, "noop", "rpc_hello_world");
    // call the method
    $response =& xmlrpc_server_call_method($server, $request_xml, '');
    // send back the respond
    print $response;
    // release resources
    xmlrpc_server_destroy($server);
}
if (isset($HTTP_RAW_POST_DATA)) {
    $input =& $HTTP_RAW_POST_DATA;
} else {
    $input =& implode("\r\n", file('php://input'));
}
// only attempt to process the request if there is a real request
if (!empty($input)) {
    processRequest($input);
}