All pastes #715168 Raw Edit

Unnamed

public text v1 · immutable
#715168 ·published 2007-09-26 02:15 UTC
rendered paste body
// Validate license
protected function __mode_rbvalidate() {
    // Insure required params
    $this->ensure_none_empty(array('api_login', 'api_pass', 'license'), true);

    // Generate license simplexml object
    try {
        $license = new SimpleXMLElement(stripslashes($this->request['license']));
    } catch (Exception $e) {
        $this->xmldie('<Response>Bad License Posted</Response>');
    }

    // Set clientid in request params
    $this->request['clientid'] = $this->stripnonascii((string) $license->License->ClientID);

    // Generate service simplexml object
    try {
        $service = new SimpleXMLElement(stripslashes($this->_getScriptResponse('getRbClientPacks.php5', array('api_login', 'api_pass', 'clientid'), array(), true, false)));
    } catch (Exception $e) {
        $this->xmldie('<Response>No License</Response>');
    }

    // Update license
    $license->License->LicenseDate   = (string) $service->response->service->start;
    $license->License->LicenseExpiry = (string) $service->response->service->end;

    // Output updated license
    $this->xmldie($license->asXML());
}