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


PHP Safe::ini_set方法代码示例

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


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

示例1: mktime

        // sanity check
        if (!isset($stamp) || $stamp <= NULL_DATE) {
            return $stamp;
        }
        // time in surfer time zone
        $stamp = mktime(intval(substr($stamp, 11, 2)), intval(substr($stamp, 14, 2)), intval(substr($stamp, 17, 2)), intval(substr($stamp, 5, 2)), intval(substr($stamp, 8, 2)), intval(substr($stamp, 0, 4)));
        // shift to UTC time zone
        return strftime('%Y-%m-%d %H:%M:%S', $stamp - Surfer::get_gmt_offset() * 3600);
    }
}
// we don't want to use url rewriting, but only cookies (exclusive with 'use.cookies' and 'use_trans_sid')
if (isset($_SERVER['REMOTE_ADDR'])) {
    Safe::ini_set('session.use_cookies', '1');
    Safe::ini_set('session.use_only_cookies', '1');
    //Safe::ini_set('session.use_trans_sid', '0'); -- don't uncomment !!!
    Safe::ini_set('url_rewriter.tags', '');
}
// set the permanent cookie on the transaction that follows the login, in case a redirection would have happened
if (isset($_SESSION['surfer_token'])) {
    // set it
    Surfer::set_cookie('screening', $_SESSION['surfer_token']);
    // don't do that again
    unset($_SESSION['surfer_token']);
}
// retrieve session data, but not if run from the command line, and not from robot nor spider
if (isset($_SERVER['REMOTE_ADDR']) && !Surfer::is_crawler() && !headers_sent()) {
    // permanent identification has been selected
    if (isset($context['users_with_permanent_authentication']) && $context['users_with_permanent_authentication'] != 'N') {
        // use cookie to identify user -- user id, time of login, gmt offset, salt
        if (!Surfer::is_logged() && isset($_COOKIE['screening']) && ($nouns = explode('|', $_COOKIE['screening'], 4)) && count($nouns) == 4) {
            // get user by id
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:surfer.php

示例2: connect


//.........这里部分代码省略.........
             Logger::remember('shared/mailer.php: Command EHLO has been rejected at ' . $server);
             fclose($handle);
             return FALSE;
         }
         // authenticate as per SMTP protocol extension
         if (isset($context['mail_account']) && isset($context['mail_password']) && preg_match('/^AUTH (.+)$/m', $response, $matches)) {
             // CRAM-MD5 -- the preferred method
             if (strpos($matches[1], 'CRAM-MD5') !== FALSE) {
                 // get the challenge
                 $request = 'AUTH CRAM-MD5';
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
                 if (($response = Mailer::parse_response($handle, 334)) === FALSE) {
                     Logger::remember('shared/mailer.php: Command AUTH has been rejected at ' . $server);
                     fclose($handle);
                     return FALSE;
                 }
                 $challenge = base64_decode($response);
                 // from password to a 64 bytes block
                 if (strlen($context['mail_password']) < 64) {
                     $key = str_pad($context['mail_password'], 64, chr(0));
                 } elseif (strlen($context['mail_password']) > 64) {
                     $key = str_pad(pack('H32', md5($context['mail_password'])), 64, chr(0));
                 } else {
                     $key = $context['mail_password'];
                 }
                 // compute HMAC-MD5
                 $inner = $key ^ str_repeat(chr(0x36), 64);
                 $outer = $key ^ str_repeat(chr(0x5c), 64);
                 $digest = md5($outer . pack('H32', md5($inner . $challenge)));
                 // answer the challenge
                 $request = base64_encode($context['mail_account'] . ' ' . $digest);
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
                 // LOGIN
             } elseif (strpos($matches[1], 'LOGIN') !== FALSE) {
                 $request = 'AUTH LOGIN';
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
                 if (Mailer::parse_response($handle, 334) === FALSE) {
                     Logger::remember('shared/mailer.php: Command AUTH has been rejected at ' . $server);
                     fclose($handle);
                     return FALSE;
                 }
                 $request = base64_encode($context['mail_account']);
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
                 if (Mailer::parse_response($handle, 334) === FALSE) {
                     Logger::remember('shared/mailer.php: Command AUTH has been rejected at ' . $server);
                     fclose($handle);
                     return FALSE;
                 }
                 $request = base64_encode($context['mail_password']);
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
                 // PLAIN
             } elseif (strpos($matches[1], 'PLAIN') !== FALSE) {
                 $request = 'AUTH PLAIN ' . base64_encode("" . $context['mail_account'] . "" . $context['mail_password']);
                 fputs($handle, $request . CRLF);
                 if ($context['debug_mail'] == 'Y') {
                     Logger::remember('shared/mailer.php: SMTP ->', $request, 'debug');
                 }
             }
             // expecting an OK
             if (Mailer::parse_response($handle, 235) === FALSE) {
                 Logger::remember('shared/mailer.php: Command AUTH has been rejected at ' . $server);
                 fclose($handle);
                 return FALSE;
             }
         }
         // ready to submit messages
         $context['mail_handle'] = $handle;
         return $handle;
         // rely on system settings and PHP
     } elseif (is_callable('mail')) {
         // set the SMTP server
         if ($server) {
             Safe::ini_set('SMTP', $server);
         }
         // set the SMTP sender
         if (isset($context['mail_from']) && $context['mail_from']) {
             Safe::ini_set('sendmail_from', $context['mail_from']);
         }
         // ready to submit messages
         $context['mail_handle'] = TRUE;
         return TRUE;
     }
     // no SMTP configuration
     return FALSE;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:mailer.php


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