WorkbenchContext::get()->clearCache(); $cacheCleared = true; } // PATH_INFO can include malicious scripts and never used purposely in Workbench. if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != "") { httpError("400 Bad Request", "Path info trailing script name in URI not allowed."); } if (WorkbenchConfig::get()->value("requireSSL") && !usingSslEndToEnd()) { if (WorkbenchContext::isEstablished()) { WorkbenchContext::get()->release(); } httpError("403.4 SSL Required", "Secure connection to Workbench and Salesforce required"); //TODO: what do we want to do here? } //kick user back to login page for any page that requires a session and one isn't established $myPage = getMyPage(); if (!isLoggedIn() && $myPage->requiresSfdcSession) { session_unset(); session_destroy(); header('Location: login.php'); exit; } if (!$myPage->isReadOnly && isReadOnlyMode()) { throw new WorkbenchHandledException("This page is not accessible in read-only mode"); } if (WorkbenchContext::isEstablished() && !$myPage->isReadOnly && $_SERVER['REQUEST_METHOD'] == 'POST') { validateCsrfToken(); } if (WorkbenchContext::isEstablished() && isset($_POST['termsAccepted'])) { WorkbenchContext::get()->agreeToTerms(); }
/** * 获取用户购物券(未使用的优惠券,已使用的优惠券 ,已过期的优惠券) * 1: is_used=0,validate_time>now 2: is_used = 1 3: is_used=0,validate_time<now * @access public * @param int $user_id 用户id * @param int $page_size 列表最大数量 * @param int $start 列表起始页 * @return array */ function get_coupons_list($user_id, $conKey, $couponsCon, $page = 1) { $PER_PAGE_NUM = 10; $nowTime = gmtime(); $count = $GLOBALS['db']->getOne("SELECT COUNT(sent_coupon_id) FROM " . $GLOBALS['ecs']->table('coupons_sent') . " WHERE user_id='{$user_id}' AND {$couponsCon}"); $page_count = ceil($count / $PER_PAGE_NUM); $pager = getMyPage(array('currPage' => $page, 'size' => $PER_PAGE_NUM, 'count' => $count, 'page_count' => $page_count, 'js_func' => 'goToMyPage', 'ext' => array('location' => 'coupons', 'conKey' => $conKey))); $sql = "SELECT sent_coupon_id, coupon_id, is_used, coupon_value, restriction_ext, validate_time, coupon_name, coupon_description FROM " . $GLOBALS['ecs']->table('coupons_sent') . " WHERE user_id='{$user_id}' AND " . $couponsCon . " ORDER BY validate_time ASC LIMIT " . ($page - 1) * $PER_PAGE_NUM . ",{$PER_PAGE_NUM}"; $coupons = $GLOBALS['db']->getAll($sql); foreach ($coupons as $key => $value) { $coupons[$key]['validate_time'] = local_date("Y-m-d H:i:s", $value['validate_time']); } return array('coupons' => $coupons, 'pager' => $pager); }
function getMyTitle() { $myPage = getMyPage(); return $myPage->title; }