本文整理汇总了PHP中osCommerce\OM\Core\OSCOM::getRequestType方法的典型用法代码示例。如果您正苦于以下问题:PHP OSCOM::getRequestType方法的具体用法?PHP OSCOM::getRequestType怎么用?PHP OSCOM::getRequestType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osCommerce\OM\Core\OSCOM
的用法示例。
在下文中一共展示了OSCOM::getRequestType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCurrentPage
/**
* @since v3.0.0
*/
public function addCurrentPage()
{
$action_counter = 0;
$application_key = null;
$action = array();
foreach ($_GET as $key => $value) {
if (!isset($application_key) && $key == OSCOM::getSiteApplication()) {
$application_key = $action_counter;
$action_counter++;
continue;
}
$action[] = array($key => $value);
if ($this->siteApplicationActionExists(implode('\\', array_keys($action))) === false) {
array_pop($action);
break;
}
$action_counter++;
}
$action_get = http_build_query($action);
for ($i = 0, $n = sizeof($this->_data); $i < $n; $i++) {
if ($this->_data[$i]['application'] == OSCOM::getSiteApplication() && $this->_data[$i]['action'] == $action_get) {
array_splice($this->_data, $i);
break;
}
}
$this->_data[] = array('application' => OSCOM::getSiteApplication(), 'action' => $action_get, 'mode' => OSCOM::getRequestType(), 'get' => array_slice($_GET, $action_counter), 'post' => $_POST);
if (!isset($_SESSION[OSCOM::getSite()]['NavigationHistory']['data'])) {
$_SESSION[OSCOM::getSite()]['NavigationHistory']['data'] = $this->_data;
}
}
示例2: start
/**
* Verify an existing session ID and create or resume the session if the existing session ID is valid
*
* @return boolean
* @since v3.0.0
*/
public function start()
{
if ($this->_life_time > 0) {
ini_set('session.gc_maxlifetime', $this->_life_time);
} else {
$this->_life_time = ini_get('session.gc_maxlifetime');
}
session_set_cookie_params(0, OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('http_cookie_path') : OSCOM::getConfig('https_cookie_path'), OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('http_cookie_domain') : OSCOM::getConfig('https_cookie_domain'));
if (isset($_GET[$this->_name]) && (empty($_GET[$this->_name]) || !ctype_alnum($_GET[$this->_name]) || !$this->exists($_GET[$this->_name]))) {
unset($_GET[$this->_name]);
}
if (isset($_POST[$this->_name]) && (empty($_POST[$this->_name]) || !ctype_alnum($_POST[$this->_name]) || !$this->exists($_POST[$this->_name]))) {
unset($_POST[$this->_name]);
}
if (isset($_COOKIE[$this->_name]) && (empty($_COOKIE[$this->_name]) || !ctype_alnum($_COOKIE[$this->_name]) || !$this->exists($_COOKIE[$this->_name]))) {
setcookie($this->_name, '', time() - 42000, $this->getCookieParameters('path'), $this->getCookieParameters('domain'));
}
if (session_start()) {
register_shutdown_function(array($this, 'close'));
$this->_is_started = true;
$this->_id = session_id();
return true;
}
return false;
}
示例3: getAddress
public function getAddress($image, $group = 'default')
{
$group_id = $this->getID($group);
$url = OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('product_images_http_server') . OSCOM::getConfig('product_images_dir_ws_http_server') : OSCOM::getConfig('product_images_http_server') . OSCOM::getConfig('product_images_dir_ws_http_server');
return $url . $this->_groups[$group_id]['code'] . '/' . $image;
}
示例4: start
public static function start()
{
Registry::set('Session', SessionClass::load());
$OSCOM_Session = Registry::get('Session');
$OSCOM_Session->setLifeTime(SERVICE_SESSION_EXPIRATION_TIME * 60);
if (SERVICE_SESSION_FORCE_COOKIE_USAGE == '1' || (bool) ini_get('session.use_only_cookies') === true) {
OSCOM::setCookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 90);
if (isset($_COOKIE['cookie_test'])) {
$OSCOM_Session->start();
}
} elseif (SERVICE_SESSION_BLOCK_SPIDERS == '1') {
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$spider_flag = false;
if (!empty($user_agent)) {
$spiders = file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/spiders.txt');
foreach ($spiders as $spider) {
if (!empty($spider)) {
if (strpos($user_agent, trim($spider)) !== false) {
$spider_flag = true;
break;
}
}
}
}
if ($spider_flag === false) {
$OSCOM_Session->start();
}
} else {
$OSCOM_Session->start();
}
// verify the ssl_session_id
if (OSCOM::getRequestType() == 'SSL' && SERVICE_SESSION_CHECK_SSL_SESSION_ID == '1' && OSCOM::getConfig('enable_ssl') == 'true') {
if (isset($_SERVER['SSL_SESSION_ID']) && ctype_xdigit($_SERVER['SSL_SESSION_ID'])) {
if (!isset($_SESSION['SESSION_SSL_ID'])) {
$_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
}
if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Info', 'SSLcheck', 'AUTO'));
}
}
}
// verify the browser user agent
if (SERVICE_SESSION_CHECK_USER_AGENT == '1') {
$http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (!isset($_SESSION['SESSION_USER_AGENT'])) {
$_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
}
if ($_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
}
}
// verify the IP address
if (SERVICE_SESSION_CHECK_IP_ADDRESS == '1') {
if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
$_SESSION['SESSION_IP_ADDRESS'] = OSCOM::getIPAddress();
}
if ($_SESSION['SESSION_IP_ADDRESS'] != OSCOM::getIPAddress()) {
$OSCOM_Session->destroy();
OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
}
}
Registry::get('MessageStack')->loadFromSession();
return true;
}