当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarApplication::setCookie方法代码示例

本文整理汇总了PHP中SugarApplication::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarApplication::setCookie方法的具体用法?PHP SugarApplication::setCookie怎么用?PHP SugarApplication::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SugarApplication的用法示例。


在下文中一共展示了SugarApplication::setCookie方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initSharedSession

 /**
  * Initiates Shared Session
  */
 protected function initSharedSession()
 {
     $cookie_name = $this->getSharedSessionCookieName();
     if (isset($_COOKIE[$cookie_name])) {
         $data = $this->parseSignedRequest($_COOKIE[$cookie_name]);
         if ($data && !empty($data['domain']) && self::isAllowedDomain($this->getHttpHost(), $data['domain'])) {
             // good case
             $this->sharedSessionID = $data['id'];
             return;
         }
         // ignoring potentially unreachable data
     }
     // evil/corrupt/missing case
     $base_domain = $this->getBaseDomain();
     $this->sharedSessionID = md5(uniqid(mt_rand(), true));
     $cookie_value = $this->makeSignedRequest(array('domain' => $base_domain, 'id' => $this->sharedSessionID));
     $_COOKIE[$cookie_name] = $cookie_value;
     if (!headers_sent()) {
         $expire = time() + self::FBSS_COOKIE_EXPIRE;
         SugarApplication::setCookie($cookie_name, $cookie_value, $expire, '/', '.' . $base_domain, false, true);
     } else {
         // @codeCoverageIgnoreStart
         self::errorLog('Shared session ID cookie could not be set! You must ensure you ' . 'create the Facebook instance before headers have been sent. This ' . 'will cause authentication issues after the first request.');
         // @codeCoverageIgnoreEnd
     }
 }
开发者ID:anmoldeep,项目名称:erp,代码行数:29,代码来源:facebook.php

示例2: time

global $app_language, $sugar_config;
//we don't want the parent module's string file, but rather the string file specifc to this subpanel
global $current_language;
// Get the login page image
if (sugar_is_file('custom/include/images/sugar_md.png')) {
    $login_image = '<IMG src="custom/include/images/sugar_md.png" alt="Sugar" width="340" height="25">';
} else {
    $login_image = '<IMG src="include/images/sugar_md_open.png" alt="Sugar" width="340" height="25" style="margin: 5px 0;">';
}
$sugar_smarty->assign('LOGIN_IMAGE', $login_image);
// See if any messages were passed along to display to the user.
if (isset($_COOKIE['loginErrorMessage'])) {
    if (!isset($_REQUEST['loginErrorMessage'])) {
        $_REQUEST['loginErrorMessage'] = $_COOKIE['loginErrorMessage'];
    }
    SugarApplication::setCookie('loginErrorMessage', '', time() - 42000, '/');
}
if (isset($_REQUEST['loginErrorMessage'])) {
    if (isset($mod_strings[$_REQUEST['loginErrorMessage']])) {
        echo "<p align='center' class='error' > " . $mod_strings[$_REQUEST['loginErrorMessage']] . "</p>";
    } else {
        if (isset($app_strings[$_REQUEST['loginErrorMessage']])) {
            echo "<p align='center' class='error' > " . $app_strings[$_REQUEST['loginErrorMessage']] . "</p>";
        }
    }
}
$lvars = $GLOBALS['app']->getLoginVars();
$sugar_smarty->assign("LOGIN_VARS", $lvars);
foreach ($lvars as $k => $v) {
    $sugar_smarty->assign(strtoupper($k), $v);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Login.php

示例3: testsetCookie

 public function testsetCookie()
 {
     //execute the method and check that the method adds the key value pair to cookies array.
     SugarApplication::setCookie('key', 'value');
     $this->assertEquals('value', $_COOKIE['key']);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:6,代码来源:SugarApplicationTest.php


注:本文中的SugarApplication::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。