Esempio n. 1
0
 function setVersion($version)
 {
     $this->version = $version;
 }
 function getContentFormDiscuz($module, $opt = '', $moth = 'GET')
 {
     $qry_str = 'module=' . $module . '&version=' . $this->version . $opt;
     $tuCurl = curl_init();
     if ($moth = 'GET') {
         curl_setopt($tuCurl, CURLOPT_URL, $this->discuzURl . '/api/mobile/index.php?' . $qry_str);
     } else {
         curl_setopt($tuCurl, CURLOPT_URL, $this->discuzURl);
         curl_setopt($tuCurl, CURLOPT_POST, 1);
         curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $qry_str);
     }
     foreach ($_COOKIE as $k => $v) {
         $cookieStr .= $k . '=' . URLencode($v) . '; ';
     }
     $cookieStr = rtrim($cookieStr, '; ');
     //dump('**********************');
     //dump($cookieStr);exit;
     curl_setopt($tuCurl, CURLOPT_HEADER, 0);
     curl_setopt($tuCurl, CURLOPT_COOKIE, $cookieStr);
     curl_setopt($tuCurl, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
     $tuData = curl_exec($tuCurl);
     if (curl_errno($tuCurl)) {
         return 'Curl error: ' . curl_error($tuCurl);
     }
function redirectHandler()
{
    $id = $_GET['id'];
    $result = ChargeBee_HostedPage::retrieve($id);
    $hostedPage = $result->hostedPage();
    if ($hostedPage->state != "succeeded") {
        header("HTTP/1.0 400 Error");
        include $_SERVER["DOCUMENT_ROOT"] . "/error_pages/400.html";
    } else {
        header("Location: thankyou.php?subscription_id=" . URLencode($hostedPage->content()->subscription()->id));
    }
}
function redirectHandler()
{
    $hostedPageId = $_GET['id'];
    /* Requesting ChargeBee server about the Hosted page state and 
     * getting the details of the created subscription.
     */
    $result = ChargeBee_HostedPage::retrieve($hostedPageId);
    $hostedPage = $result->hostedPage();
    /*
     * Checking the state of the hosted page. If the state is not "succeeded",
     * then cusotmer checkout is considered as failed.
     */
    if ($hostedPage->state != "succeeded") {
        header("HTTP/1.0 400 Error");
        include $_SERVER["DOCUMENT_ROOT"] . "/error_pages/400.html";
        return;
    }
    $subscriptionId = $hostedPage->content()->subscription()->id;
    addShippingAddress($subscriptionId, $result);
    header("Location: thankyou?subscription_id=" . URLencode($subscriptionId));
}
Esempio n. 4
0
 function genPackage($packageParams)
 {
     $sign = $this->createMd5Sign($packageParams);
     $reqPars = '';
     foreach ($packageParams as $k => $v) {
         $reqPars .= $k . '=' . URLencode($v) . '&';
     }
     $reqPars = $reqPars . 'sign=' . $sign;
     //debug信息
     $this->_setDebugInfo('gen package:' . $reqPars);
     return $reqPars;
 }
 public function update()
 {
     $result = array();
     $content = $_REQUEST['treasure_content'];
     $treasure_img = empty($_REQUEST['treasure_img']) ? '' : $_REQUEST['treasure_img'];
     $product_link = 'http://' . $_SERVER['HTTP_HOST'] . '/products/view/' . $_REQUEST['product_id'];
     if (isset($_REQUEST['link_status']) && $_REQUEST['link_status'] == 1) {
         $link_status = 1;
         $content = $content . $product_link;
         $content_status = $content . URLencode($product_link);
     } else {
         $link_status = 0;
         $content_status = $content;
     }
     if (isset($_REQUEST['vendor_status']) && $_REQUEST['vendor_status'] == 1) {
         $timing = $_REQUEST['release_date'] . ' ' . $_REQUEST['release_hours'] . ':' . $_REQUEST['release_min'] . ':00';
         $now = time();
         if ($now >= strtotime($timing)) {
             $result['flag'] = 0;
             $result['msg'] = '定时发布时间设置错误,请设置为当前时间 5 分钟后的某个时间。';
         } else {
             $web_treasure = array('id' => '', 'user_id' => $this->admin['id'], 'upload_type' => 0, 'product_id' => $_REQUEST['product_id'], 'release_time' => $timing, 'interval_time' => $_REQUEST['interval_time'], 'content' => $content, 'img' => $treasure_img, 'product_link' => $product_link, 'link_status' => $link_status, 'status' => 0);
             $this->WbmktTreasure->save($web_treasure);
             $result['flag'] = 1;
             $result['msg'] = '已成功加入发布队列';
         }
     } else {
         $SaeTOAuthV2 = $this->saetoauthv2();
         $url = 'statuses/update';
         $parameters = array();
         $parameters['status'] = $content_status;
         //要发布的微博文本内容,必须做URLencode,内容不超过140个汉字。
         $wb_result = $SaeTOAuthV2->post($url, $parameters);
         if (isset($wb_result['id']) && isset($wb_result['user'])) {
             $result['flag'] = 1;
             $result['msg'] = '发布成功';
             $web_treasure = array('id' => '', 'user_id' => $this->admin['id'], 'upload_type' => 1, 'product_id' => $_REQUEST['product_id'], 'release_time' => '', 'interval_time' => $_REQUEST['interval_time'], 'content' => $content, 'img' => $treasure_img, 'product_link' => $product_link, 'link_status' => $link_status, 'status' => 1);
         } else {
             $result['flag'] = 0;
             $msg = isset($wb_result['error']) ? $wb_result['error'] : '';
             $result['msg'] = '发布失败:' . $msg;
             $web_treasure = array('id' => '', 'user_id' => $this->admin['id'], 'upload_type' => 1, 'product_id' => $_REQUEST['product_id'], 'release_time' => '', 'interval_time' => $_REQUEST['interval_time'], 'content' => $content, 'img' => $treasure_img, 'product_link' => $product_link, 'link_status' => $link_status, 'status' => 2);
         }
         $this->WbmktTreasure->save($web_treasure);
     }
     Configure::write('debug', 0);
     $this->layout = 'ajax';
     die(json_encode($result));
     //		$this->redirect("/wbmkt_treasures/");
 }
Esempio n. 6
0
 /**
  * IDのURLを取得する
  */
 function getIDURL()
 {
     return "http://stick.newsplus.jp/id.cgi?bbs={$this->bbs}&word=" . URLencode($this->id);
 }
function display_item_nav($hookname, $return = false)
{
    global $session;
    if ($hookname_override = httpget("hookname")) {
        $hookname = $hookname_override;
    }
    $constant = constant("HOOK_" . strtoupper($hookname));
    $item = db_prefix("item");
    $inventory = db_prefix("inventory");
    $acctid = $session['user']['acctid'];
    $sql = "SELECT {$item}.*,\r\n\t\t\t\t\t\tSUM(if ({$inventory}.charges > 1, {$inventory}.charges, 1)) AS quantity,\r\n\t\t\t\t\t\t{$inventory}.invid AS invid\r\n\t\t\t\t\tFROM {$item}\r\n\t\t\t\t\tINNER JOIN {$inventory} ON {$item}.itemid = {$inventory}.itemid\r\n\t\t\t\t\tWHERE ({$item}.activationhook & {$constant})\r\n\t\t\t\t\t\tAND {$inventory}.userid = {$acctid}\r\n\t\t\t\t\tGROUP BY {$item}.itemid";
    $result = db_query($sql);
    if (db_num_rows($result) > 0) {
        addnav("Items");
        if ($return === false) {
            $return = URLencode($_SERVER['REQUEST_URI']);
        } else {
            $return = URLencode($return);
            $return .= "&returnhandle=1&hookname={$hookname}";
        }
        while ($item = db_fetch_assoc($result)) {
            if ((int) $item['itemid'] == 0 || $item['quantity'] == 0) {
                continue;
            }
            if ($item['link'] != "") {
                $linkentry = $item['link'];
            } else {
                $linkentry = "|";
            }
            list($lname, $llink) = explode("|", $linkentry, 2);
            if ($lname == "") {
                $lname = $item['name'];
            }
            if ($llink == "") {
                $llink = "runmodule.php?module=inventory&op=activate&id=" . $item['itemid'] . "&invid=" . $item['invid'];
            }
            $args = modulehook("inventory-changereturn", array("item" => $item, "return" => $return, "hookname" => $hookname));
            $newreturn = $args['return'];
            $llink .= "&return=" . $newreturn . "&hookname={$hookname}";
            addnav(array("%s `7(%s)`0", " ?{$lname}", $item['quantity']), $llink);
        }
    }
}