Example #1
0
 }
 $oP = new PortalWebPage(Dict::S('Portal:Title'), $sAlternateStylesheet);
 $oP->EnableDisconnectButton(utils::CanLogOff());
 $oP->SetWelcomeMessage(Dict::Format('Portal:WelcomeUserOrg', UserRights::GetUserFriendlyName(), $oUserOrg->GetName()));
 if (is_object($oUserOrg)) {
     switch ($sOperation) {
         case 'show_closed':
             $oP->set_title(Dict::S('Portal:ShowClosed'));
             DisplayMainMenu($oP);
             ShowClosedTickets($oP);
             break;
         case 'create_request':
             $oP->set_title(Dict::S('Portal:CreateNewRequest'));
             DisplayMainMenu($oP);
             if (!MetaModel::DBIsReadOnly()) {
                 CreateRequest($oP, $oUserOrg);
             }
             break;
         case 'details':
             $oP->set_title(Dict::S('Portal:TitleDetailsFor_Request'));
             DisplayMainMenu($oP);
             $oObj = $oP->FindObjectFromArgs(GetTicketClasses());
             ValidateObject($oObj);
             DisplayObject($oP, $oObj, $oUserOrg);
             break;
         case 'update_request':
             $oP->set_title(Dict::S('Portal:TitleDetailsFor_Request'));
             DisplayMainMenu($oP);
             if (!MetaModel::DBIsReadOnly()) {
                 $oObj = $oP->FindObjectFromArgs(GetTicketClasses());
                 ValidateObject($oObj);
Example #2
0
/*需要填写你的密钥,可从  https://console.qcloud.com/capi 获取 SecretId 及 $secretKey*/
$secretKey = 'YOUR_SECRET_KEY';
$secretId = 'YOUR_SECRET_ID';
$action = 'AddCdnHost';
/*参数*/
$PRIVATE_PARAMS = array("host" => "c.u-ndefined.com", "projectId" => 0, "hostType" => "cname", "origin" => "e.u-ndefinded.com:12023");
$HttpUrl = "cdn.api.qcloud.com";
/*除非有特殊说明,如MultipartUploadVodFile,其它接口都支持GET及POST*/
$HttpMethod = "POST";
/*是否https协议,大部分接口都必须为https,只有少部分接口除外(如MultipartUploadVodFile)*/
$isHttps = true;
/*下面这五个参数为所有接口的 公共参数;对于某些接口没有地域概念,则不用传递Region(如DescribeDeals)*/
$COMMON_PARAMS = array('Nonce' => rand(), 'Timestamp' => time(NULL), 'Action' => $action, 'SecretId' => $secretId);
/***********************************************************************************/
CreateRequest($HttpUrl, $HttpMethod, $COMMON_PARAMS, $secretKey, $PRIVATE_PARAMS, $isHttps);
function CreateRequest($HttpUrl, $HttpMethod, $COMMON_PARAMS, $secretKey, $PRIVATE_PARAMS, $isHttps)
{
    $FullHttpUrl = $HttpUrl . "/v2/index.php";
    /***************对请求参数 按参数名 做字典序升序排列,注意此排序区分大小写*************/
    $ReqParaArray = array_merge($COMMON_PARAMS, $PRIVATE_PARAMS);
    ksort($ReqParaArray);
    /**********************************生成签名原文**********************************
     * 将 请求方法, URI地址,及排序好的请求参数  按照下面格式  拼接在一起, 生成签名原文,此请求中的原文为 
     * GETcvm.api.qcloud.com/v2/index.php?Action=DescribeInstances&Nonce=345122&Region=gz
     * &SecretId=AKIDz8krbsJ5yKBZQ    ·1pn74WFkmLPx3gnPhESA&Timestamp=1408704141
     * &instanceIds.0=qcvm12345&instanceIds.1=qcvm56789
     * ****************************************************************************/
    $SigTxt = $HttpMethod . $FullHttpUrl . "?";
    $isFirst = true;
    foreach ($ReqParaArray as $key => $value) {
Example #3
0
/**
* User submitted the form. Validate the request and email a validation link.
* 
*/
function SumbitRequest()
{
    $error = null;
    $recaptcha_key = GetSetting('recaptcha_key');
    $recaptcha_secret = GetSetting('recaptcha_secret');
    if ($recaptcha_key && $recaptcha_secret) {
        if (isset($_REQUEST['g-recaptcha-response'])) {
            $response = urlencode($_REQUEST['g-recaptcha-response']);
            $url = "https://www.google.com/recaptcha/api/siteverify?secret={$recaptcha_secret}&response={$response}";
            $data = http_fetch($url);
            $check = json_decode($data, true);
            if (isset($check) && $check !== false && is_array($check) && isset($check['success'])) {
                if (!$check['success']) {
                    $error = "Captcha challenge failed";
                }
            } else {
                $error = "Error validating the captcha (could not communicate with server)";
            }
        } else {
            $error = "Please answer the captcha challenge";
        }
    }
    if (isset($error)) {
        echo $error;
    } else {
        if (isset($_REQUEST['agree']) && $_REQUEST['agree']) {
            $email = trim($_REQUEST['email']);
            if (!preg_match('/[^@]+@[^\\.]+\\..+/', $email)) {
                echo 'Please provide a valid email address';
            } elseif (BlockEmail($email)) {
                echo 'Sorry, registration is not permitted.  Please contact us for more information.';
            } elseif ($keyinfo = GetKeyInfo($email)) {
                EmailKeyInfo($keyinfo);
            } elseif ($requestinfo = CreateRequest($email)) {
                EmailValidation($requestinfo);
            } else {
                echo 'Internal generating the API key request';
            }
        } else {
            echo 'Please agree to the terms and conditions';
        }
    }
}