コード例 #1
0
    /**
     * Generate system level payload.
     *
     * @return array
     */
    protected function generateCoreData()
    {
        $core = array();

        if ($this->options) {
            foreach ($this->options as $key => $value) {
                $core[$key] = $value;
            }
        }

        if ($this->csrfToken) {
            $core['authid'] = $this->authid;
            $core['token'] = $this->csrfToken;
        }
        $logUtilMessages = (array)LogUtil::getStatusMessages();
        $core['statusmsg'] = array_merge($this->messages,$logUtilMessages);

        return $core;
    }
コード例 #2
0
ファイル: ajax.php プロジェクト: projectesIF/Sirius
    $response = new Zikula_Response_Ajax_Forbidden($e->getMessage());
} catch (Zikula_Exception_Fatal $e) {
    $response = new Zikula_Response_Ajax_Fatal($e->getMessage());
} catch (PDOException $e) {
    $response = new Zikula_Response_Ajax_Fatal($e->getMessage());
} catch (Exception $e) {
    $response = new Zikula_Response_Ajax_Fatal($e->getMessage());
}
// Handle database transactions
if (System::getVar('Z_CONFIG_USE_TRANSACTIONS')) {
    if (isset($e) && $e instanceof Exception) {
        $dbConn->rollback();
    } else {
        $dbConn->commit();
    }
}
// Process final response.
// If response is not instanceof Zikula_Response_Ajax_AbstractBase provide compat solution
if (!$response instanceof Zikula_Response_Ajax_AbstractBase) {
    $response = !is_array($response) ? array('data' => $response) : $response;
    $response['statusmsg'] = LogUtil::getStatusMessages();
    if (System::isLegacyMode()) {
        $response['authid'] = SecurityUtil::generateAuthKey(ModUtil::getName());
    }
    $response = json_encode($response);
    header("HTTP/1.1 200 OK");
    header('Content-type: application/json');
}
// Issue response.
echo $response;
System::shutdown();