Esempio n. 1
0
 function error($code, $desc = "")
 {
     global $XML_RPC_erruser;
     // import user errcode value
     //definition of error strings
     $str = array(1 => $desc, 2 => "MUST_LOGIN", 3 => "UNKNOWN_USER", 4 => "USER_NOT_ADMIN", 5 => "WRONG_PASSWORD", 6 => "USER_ALREADY_EXISTS", 7 => "REGISTERING_NOT_ALLOWED", 10 => "TRACK_NOT_FOUND", 11 => "RATING_MISSING", 12 => "BAD_INPUT");
     $error = new XML_RPC_Response(0, $XML_RPC_erruser + $code, $str[$code]);
     //quite dirty todo
     $payload = "<?xml version=\"1.0\"?>\n" . $error->serialize();
     header('Content-Length: ' . strlen($payload));
     header('Content-Type: text/xml');
     print $payload;
     die;
 }
Esempio n. 2
0
 /**
  * Echos back the input packet as a string value
  *
  * @return void
  *
  * Useful for debugging.
  */
 function echoInput()
 {
     global $HTTP_RAW_POST_DATA;
     $r = new XML_RPC_Response(0);
     $r->xv = new XML_RPC_Value("'Aha said I: '" . $HTTP_RAW_POST_DATA, 'string');
     print $r->serialize();
 }
Esempio n. 3
0
 function echoInput()
 {
     global $HTTP_RAW_POST_DATA;
     // a debugging routine: just echos back the input
     // packet as a string value
     $r = new XML_RPC_Response();
     $r->xv = new XML_RPC_Value("'Aha said I: '" . $HTTP_RAW_POST_DATA, "string");
     print $r->serialize();
 }
Esempio n. 4
0
function pearErrorHandler($oError)
{
    $aConf = $GLOBALS['_MAX']['CONF'];
    // Log message
    $message = $oError->getMessage();
    $debugInfo = $oError->getDebugInfo();
    OA::debug('PEAR' . " :: {$message} : {$debugInfo}", PEAR_LOG_ERR);
    // If sesssion debug, send error info to screen
    $msg = '';
    if (empty($aConf['debug']['production'])) {
        $GLOBALS['_MAX']['ERRORS'][] = $oError;
    }
    // Add backtrace info
    if (!empty($aConf['debug']['showBacktrace'])) {
        $msg .= 'PEAR backtrace: <div onClick="if (this.style.height) {this.style.height = null;this.style.width = null;} else {this.style.height = \'8px\'; this.style.width=\'8px\'}"';
        $msg .= 'style="float:left; cursor: pointer; border: 1px dashed #FF0000; background-color: #EFEFEF; height: 8px; width: 8px; overflow: hidden; margin-bottom: 2px;">';
        $msg .= '<pre wrap style="margin: 5px; background-color: #EFEFEF">';
        ob_start();
        print_r($oError->getBacktrace());
        $msg .= ob_get_clean();
        $msg .= '<hr></pre></div>';
        $msg .= '<div style="clear:both"></div>';
    }
    if (defined('TEST_ENVIRONMENT_RUNNING')) {
        // It's a test, stop execution
        echo $message;
        exit(1);
    } elseif (defined('OA_WEBSERVICES_API_XMLRPC')) {
        // It's an XML-RPC response
        $oResponse = new XML_RPC_Response('', 99999, $message);
        echo $oResponse->serialize();
        exit;
    } else {
        // Send the error to the screen
        echo MAX::errorObjToString($oError, $msg);
    }
}
function phpAds_Die($title = "Error", $message = "Unknown error")
{
    if (defined('OA_WEBSERVICES_API_XMLRPC')) {
        // It's an XML-RPC response
        if (class_exists('XmlRpcUtils')) {
            $oResponse = XmlRpcUtils::generateError($message);
        } else {
            $oResponse = new XML_RPC_Response('', 99999, $message);
        }
        echo $oResponse->serialize();
        exit;
    }
    $conf = $GLOBALS['_MAX']['CONF'];
    global $phpAds_GUIDone, $phpAds_TextDirection;
    $header = $title == $GLOBALS['strAccessDenied'] ? phpAds_Login : phpAds_Error;
    // Header
    if ($phpAds_GUIDone == false) {
        if (!isset($phpAds_TextDirection)) {
            $phpAds_TextDirection = 'ltr';
        }
        phpAds_PageHeader(phpAds_Error);
    }
    echo "<br>";
    echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/errormessage.gif' align='absmiddle'> ";
    echo "<span class='tab-r'>" . $title . "</span><br><br>" . $message . "</div><br>";
    // Die
    if ($header == phpAds_Login) {
        $_COOKIE['sessionID'] = phpAds_SessionStart();
        OA_Auth::displayLogin('', $_COOKIE['sessionID'], true);
    }
    phpAds_PageFooter();
    exit;
}