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


PHP rcube_charset_convert函数代码示例

本文整理汇总了PHP中rcube_charset_convert函数的典型用法代码示例。如果您正苦于以下问题:PHP rcube_charset_convert函数的具体用法?PHP rcube_charset_convert怎么用?PHP rcube_charset_convert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: load

 /**
  * Load config from local config file
  *
  * @todo Remove global $CONFIG
  */
 private function load()
 {
     // load main config file
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/main.inc.php')) {
         $this->errors[] = 'main.inc.php was not found.';
     }
     // load database config
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/db.inc.php')) {
         $this->errors[] = 'db.inc.php was not found.';
     }
     // load host-specific configuration
     $this->load_host_config();
     // set skin (with fallback to old 'skin_path' property)
     if (empty($this->prop['skin']) && !empty($this->prop['skin_path'])) {
         $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
     } else {
         if (empty($this->prop['skin'])) {
             $this->prop['skin'] = self::DEFAULT_SKIN;
         }
     }
     // larry is the new default skin :-)
     if ($this->prop['skin'] == 'default') {
         $this->prop['skin'] = self::DEFAULT_SKIN;
     }
     // fix paths
     $this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : INSTALL_PATH . 'logs';
     $this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : INSTALL_PATH . 'temp';
     // fix default imap folders encoding
     foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
         $this->prop[$folder] = rcube_charset_convert($this->prop[$folder], RCMAIL_CHARSET, 'UTF7-IMAP');
     }
     if (!empty($this->prop['default_folders'])) {
         foreach ($this->prop['default_folders'] as $n => $folder) {
             $this->prop['default_folders'][$n] = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
         }
     }
     // set PHP error logging according to config
     if ($this->prop['debug_level'] & 1) {
         ini_set('log_errors', 1);
         if ($this->prop['log_driver'] == 'syslog') {
             ini_set('error_log', 'syslog');
         } else {
             ini_set('error_log', $this->prop['log_dir'] . '/errors');
         }
     }
     // enable display_errors in 'show' level, but not for ajax requests
     ini_set('display_errors', intval(empty($_REQUEST['_remote']) && $this->prop['debug_level'] & 4));
     // set timezone auto settings values
     if ($this->prop['timezone'] == 'auto') {
         $this->prop['_timezone_value'] = $this->client_timezone();
     } else {
         if (is_numeric($this->prop['timezone'])) {
             $this->prop['timezone'] = timezone_name_from_abbr("", $this->prop['timezone'] * 3600, 0);
         }
     }
     // remove deprecated properties
     unset($this->prop['dst_active']);
     // export config data
     $GLOBALS['CONFIG'] =& $this->prop;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:65,代码来源:rcube_config.php

示例2: load

 /**
  * Load config from local config file
  *
  * @todo Remove global $CONFIG
  */
 private function load()
 {
     // start output buffering, we don't need any output yet,
     // it'll be cleared after reading of config files, etc.
     ob_start();
     // load main config file
     if (include RCMAIL_CONFIG_DIR . '/main.inc.php') {
         $this->prop = (array) $rcmail_config;
     } else {
         $this->errors[] = 'main.inc.php was not found.';
     }
     // load database config
     if (include RCMAIL_CONFIG_DIR . '/db.inc.php') {
         $this->prop += (array) $rcmail_config;
     } else {
         $this->errors[] = 'db.inc.php was not found.';
     }
     // load host-specific configuration
     $this->load_host_config();
     // set skin (with fallback to old 'skin_path' property)
     if (empty($this->prop['skin']) && !empty($this->prop['skin_path'])) {
         $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
     } else {
         if (empty($this->prop['skin'])) {
             $this->prop['skin'] = 'default';
         }
     }
     // fix paths
     $this->prop['log_dir'] = $this->prop['log_dir'] ? unslashify($this->prop['log_dir']) : INSTALL_PATH . 'logs';
     $this->prop['temp_dir'] = $this->prop['temp_dir'] ? unslashify($this->prop['temp_dir']) : INSTALL_PATH . 'temp';
     // fix default imap folders encoding
     foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
         $this->prop[$folder] = rcube_charset_convert($this->prop[$folder], RCMAIL_CHARSET, 'UTF-7');
     }
     if (!empty($this->prop['default_imap_folders'])) {
         foreach ($this->prop['default_imap_folders'] as $n => $folder) {
             $this->prop['default_imap_folders'][$n] = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF-7');
         }
     }
     // set PHP error logging according to config
     if ($this->prop['debug_level'] & 1) {
         ini_set('log_errors', 1);
         if ($this->prop['log_driver'] == 'syslog') {
             ini_set('error_log', 'syslog');
         } else {
             ini_set('error_log', $this->prop['log_dir'] . '/errors');
         }
     }
     if ($this->prop['debug_level'] & 4) {
         ini_set('display_errors', 1);
     } else {
         ini_set('display_errors', 0);
     }
     // clear output buffer
     ob_end_clean();
     // export config data
     $GLOBALS['CONFIG'] =& $this->prop;
 }
开发者ID:jin255ff,项目名称:company_website,代码行数:63,代码来源:rcube_config.php

示例3: load

 /**
  * Load config from local config file
  *
  * @todo Remove global $CONFIG
  */
 private function load()
 {
     // load main config file
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/main.inc.php')) {
         $this->errors[] = 'main.inc.php was not found.';
     }
     // load database config
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/db.inc.php')) {
         $this->errors[] = 'db.inc.php was not found.';
     }
     // load host-specific configuration
     $this->load_host_config();
     // set skin (with fallback to old 'skin_path' property)
     if (empty($this->prop['skin']) && !empty($this->prop['skin_path'])) {
         $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
     } else {
         if (empty($this->prop['skin'])) {
             $this->prop['skin'] = 'default';
         }
     }
     // fix paths
     $this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : INSTALL_PATH . 'logs';
     $this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : INSTALL_PATH . 'temp';
     // fix default imap folders encoding
     foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
         $this->prop[$folder] = rcube_charset_convert($this->prop[$folder], RCMAIL_CHARSET, 'UTF7-IMAP');
     }
     if (!empty($this->prop['default_imap_folders'])) {
         foreach ($this->prop['default_imap_folders'] as $n => $folder) {
             $this->prop['default_imap_folders'][$n] = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
         }
     }
     // set PHP error logging according to config
     if ($this->prop['debug_level'] & 1) {
         ini_set('log_errors', 1);
         if ($this->prop['log_driver'] == 'syslog') {
             ini_set('error_log', 'syslog');
         } else {
             ini_set('error_log', $this->prop['log_dir'] . '/errors');
         }
     }
     if ($this->prop['debug_level'] & 4) {
         ini_set('display_errors', 1);
     } else {
         ini_set('display_errors', 0);
     }
     // export config data
     $GLOBALS['CONFIG'] =& $this->prop;
 }
开发者ID:shishenkov,项目名称:zpanel,代码行数:54,代码来源:rcube_config.php

示例4: change_charset

 function change_charset($args)
 {
     if ($msg_uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
         $rcmail = rcmail::get_instance();
         $alter_charset = (array) $rcmail->config->get('alter_charset', array());
         $headers = $rcmail->imap->get_headers($msg_uid);
         if ($alias_charset = get_input_value('_alter_charset', RCUBE_INPUT_GET)) {
             $output_charset = $alter_charset[$alias_charset];
         }
         $input_charset = $rcmail->output->get_charset();
         $charset = $this->charset($msg_uid);
         $msg_body = rcube_charset_convert($args[body], $input_charset, $charset);
         $args['body'] = rcube_charset_convert($msg_body, $output_charset);
         return $args;
     }
 }
开发者ID:umount,项目名称:rcplugin_altercharset,代码行数:16,代码来源:alter_charset.php

示例5: mod_mailbox

 /**
  * Converts mailbox name from/to UTF7-IMAP from/to internal Sieve encoding
  * with delimiter replacement.
  *
  * @param string $mailbox Mailbox name
  * @param string $mode    Conversion direction ('in'|'out')
  *
  * @return string Mailbox name
  */
 private function mod_mailbox($mailbox, $mode = 'out')
 {
     $delimiter = $_SESSION['imap_delimiter'];
     $replace_delimiter = $this->rc->config->get('managesieve_replace_delimiter');
     $mbox_encoding = $this->rc->config->get('managesieve_mbox_encoding', 'UTF7-IMAP');
     if ($mode == 'out') {
         $mailbox = rcube_charset_convert($mailbox, $mbox_encoding, 'UTF7-IMAP');
         if ($replace_delimiter && $replace_delimiter != $delimiter) {
             $mailbox = str_replace($replace_delimiter, $delimiter, $mailbox);
         }
     } else {
         $mailbox = rcube_charset_convert($mailbox, 'UTF7-IMAP', $mbox_encoding);
         if ($replace_delimiter && $replace_delimiter != $delimiter) {
             $mailbox = str_replace($delimiter, $replace_delimiter, $mailbox);
         }
     }
     return $mailbox;
 }
开发者ID:npk,项目名称:roundcubemail,代码行数:27,代码来源:managesieve.php

示例6: write

 /**
  * Process template and write to stdOut
  *
  * @param string HTML template
  * @param string Base for absolute paths
  */
 public function write($templ = '', $base_path = '')
 {
     $output = empty($templ) ? $this->default_template : trim($templ);
     // set default page title
     if (empty($this->title)) {
         $this->title = 'Roundcube Mail';
     }
     // replace specialchars in content
     $page_title = Q($this->title, 'show', FALSE);
     $page_header = '';
     $page_footer = '';
     // include meta tag with charset
     if (!empty($this->charset)) {
         if (!headers_sent()) {
             header('Content-Type: text/html; charset=' . $this->charset);
         }
         $page_header = '<meta http-equiv="content-type"';
         $page_header .= ' content="text/html; charset=';
         $page_header .= $this->charset . '" />' . "\n";
     }
     // definition of the code to be placed in the document header and footer
     if (is_array($this->script_files['head'])) {
         foreach ($this->script_files['head'] as $file) {
             $page_header .= sprintf($this->script_tag_file, $file);
         }
     }
     $head_script = $this->scripts['head_top'] . $this->scripts['head'];
     if (!empty($head_script)) {
         $page_header .= sprintf($this->script_tag, $head_script);
     }
     if (!empty($this->header)) {
         $page_header .= $this->header;
     }
     // put docready commands into page footer
     if (!empty($this->scripts['docready'])) {
         $this->add_script('$(document).ready(function(){ ' . $this->scripts['docready'] . "\n});", 'foot');
     }
     if (is_array($this->script_files['foot'])) {
         foreach ($this->script_files['foot'] as $file) {
             $page_footer .= sprintf($this->script_tag_file, $file);
         }
     }
     if (!empty($this->footer)) {
         $page_footer .= $this->footer . "\n";
     }
     if (!empty($this->scripts['foot'])) {
         $page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
     }
     // find page header
     if ($hpos = stripos($output, '</head>')) {
         $page_header .= "\n";
     } else {
         if (!is_numeric($hpos)) {
             $hpos = stripos($output, '<body');
         }
         if (!is_numeric($hpos) && ($hpos = stripos($output, '<html'))) {
             while ($output[$hpos] != '>') {
                 $hpos++;
             }
             $hpos++;
         }
         $page_header = "<head>\n<title>{$page_title}</title>\n{$page_header}\n</head>\n";
     }
     // add page hader
     if ($hpos) {
         $output = substr_replace($output, $page_header, $hpos, 0);
     } else {
         $output = $page_header . $output;
     }
     // add page footer
     if (($fpos = strripos($output, '</body>')) || ($fpos = strripos($output, '</html>'))) {
         $output = substr_replace($output, $page_footer . "\n", $fpos, 0);
     } else {
         $output .= "\n" . $page_footer;
     }
     // add css files in head, before scripts, for speed up with parallel downloads
     if (!empty($this->css_files) && (($pos = stripos($output, '<script ')) || ($pos = stripos($output, '</head>')))) {
         $css = '';
         foreach ($this->css_files as $file) {
             $css .= sprintf($this->link_css_file, $file);
         }
         $output = substr_replace($output, $css, $pos, 0);
     }
     $this->base_path = $base_path;
     // correct absolute paths in images and other tags
     // add timestamp to .js and .css filename
     $output = preg_replace_callback('!(src|href|background)=(["\']?)([a-z0-9/_.-]+)(["\'\\s>])!i', array($this, 'file_callback'), $output);
     $output = str_replace('$__skin_path', $base_path, $output);
     // trigger hook with final HTML content to be sent
     $hook = rcmail::get_instance()->plugins->exec_hook("send_page", array('content' => $output));
     if (!$hook['abort']) {
         if ($this->charset != RCMAIL_CHARSET) {
             echo rcube_charset_convert($hook['content'], RCMAIL_CHARSET, $this->charset);
         } else {
//.........这里部分代码省略.........
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:101,代码来源:rcube_html_page.php

示例7: _mbox_encode

 private function _mbox_encode($text, $encoding)
 {
     return rcube_charset_convert($text, 'UTF7-IMAP', $encoding);
 }
开发者ID:nansenat16,项目名称:Roundcube-Plugin-SieveRules-Managesieve,代码行数:4,代码来源:sieverules.php

示例8: password_save

/**
 * LDAP Password Driver
 *
 * Driver for passwords stored in LDAP
 * This driver use the PEAR Net_LDAP2 class (http://pear.php.net/package/Net_LDAP2).
 *
 * @version 1.1 (2010-04-07)
 * @author Edouard MOREAU <edouard.moreau@ensma.fr>
 *
 * function hashPassword based on code from the phpLDAPadmin development team (http://phpldapadmin.sourceforge.net/).
 * function randomSalt based on code from the phpLDAPadmin development team (http://phpldapadmin.sourceforge.net/).
 *
 */
function password_save($curpass, $passwd)
{
    $rcmail = rcmail::get_instance();
    require_once 'Net/LDAP2.php';
    // Building user DN
    if ($userDN = $rcmail->config->get('password_ldap_userDN_mask')) {
        $userDN = substitute_vars($userDN);
    } else {
        $userDN = search_userdn($rcmail);
    }
    if (empty($userDN)) {
        return PASSWORD_CONNECT_ERROR;
    }
    // Connection Method
    switch ($rcmail->config->get('password_ldap_method')) {
        case 'admin':
            $binddn = $rcmail->config->get('password_ldap_adminDN');
            $bindpw = $rcmail->config->get('password_ldap_adminPW');
            break;
        case 'user':
        default:
            $binddn = $userDN;
            $bindpw = $curpass;
            break;
    }
    // Configuration array
    $ldapConfig = array('binddn' => $binddn, 'bindpw' => $bindpw, 'basedn' => $rcmail->config->get('password_ldap_basedn'), 'host' => $rcmail->config->get('password_ldap_host'), 'port' => $rcmail->config->get('password_ldap_port'), 'starttls' => $rcmail->config->get('password_ldap_starttls'), 'version' => $rcmail->config->get('password_ldap_version'));
    // Connecting using the configuration array
    $ldap = Net_LDAP2::connect($ldapConfig);
    // Checking for connection error
    if (PEAR::isError($ldap)) {
        return PASSWORD_CONNECT_ERROR;
    }
    // Crypting new password
    $newCryptedPassword = hashPassword($passwd, $rcmail->config->get('password_ldap_encodage'));
    if (!$newCryptedPassword) {
        return PASSWORD_CRYPT_ERROR;
    }
    // Writing new crypted password to LDAP
    $userEntry = $ldap->getEntry($userDN);
    if (Net_LDAP2::isError($userEntry)) {
        return PASSWORD_CONNECT_ERROR;
    }
    $pwattr = $rcmail->config->get('password_ldap_pwattr');
    $force = $rcmail->config->get('password_ldap_force_replace');
    if (!$userEntry->replace(array($pwattr => $newCryptedPassword), $force)) {
        return PASSWORD_CONNECT_ERROR;
    }
    // Updating PasswordLastChange Attribute if desired
    if ($lchattr = $rcmail->config->get('password_ldap_lchattr')) {
        $current_day = (int) (time() / 86400);
        if (!$userEntry->replace(array($lchattr => $current_day), $force)) {
            return PASSWORD_CONNECT_ERROR;
        }
    }
    if (Net_LDAP2::isError($userEntry->update())) {
        return PASSWORD_CONNECT_ERROR;
    }
    // Update Samba password fields, ignore errors if attributes are not found
    if ($rcmail->config->get('password_ldap_samba')) {
        $sambaNTPassword = hash('md4', rcube_charset_convert($passwd, RCMAIL_CHARSET, 'UTF-16LE'));
        $userEntry->replace(array('sambaNTPassword' => $sambaNTPassword), $force);
        $userEntry->replace(array('sambaPwdLastSet' => time()), $force);
        $userEntry->update();
    }
    // All done, no error
    return PASSWORD_SUCCESS;
}
开发者ID:shishenkov,项目名称:zpanel,代码行数:81,代码来源:ldap.php

示例9: password_save

 function password_save()
 {
     $rcmail = rcmail::get_instance();
     $this->load_config();
     $this->add_texts('localization/');
     $this->register_handler('plugin.body', array($this, 'password_form'));
     $rcmail->output->set_pagetitle($this->gettext('changepasswd'));
     $confirm = $rcmail->config->get('password_confirm_current');
     $required_length = intval($rcmail->config->get('password_minimum_length'));
     $check_strength = $rcmail->config->get('password_require_nonalpha');
     if ($confirm && !isset($_POST['_curpasswd']) || !isset($_POST['_newpasswd'])) {
         $rcmail->output->command('display_message', $this->gettext('nopassword'), 'error');
     } else {
         $charset = strtoupper($rcmail->config->get('password_charset', 'ISO-8859-1'));
         $rc_charset = strtoupper($rcmail->output->get_charset());
         $curpwd = get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset);
         $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST, true);
         $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST, true);
         // check allowed characters according to the configured 'password_charset' option
         // by converting the password entered by the user to this charset and back to UTF-8
         $orig_pwd = $newpwd;
         $chk_pwd = rcube_charset_convert($orig_pwd, $rc_charset, $charset);
         $chk_pwd = rcube_charset_convert($chk_pwd, $charset, $rc_charset);
         // WARNING: Default password_charset is ISO-8859-1, so conversion will
         // change national characters. This may disable possibility of using
         // the same password in other MUA's.
         // We're doing this for consistence with Roundcube core
         $newpwd = rcube_charset_convert($newpwd, $rc_charset, $charset);
         $conpwd = rcube_charset_convert($conpwd, $rc_charset, $charset);
         if ($chk_pwd != $orig_pwd) {
             $rcmail->output->command('display_message', $this->gettext('passwordforbidden'), 'error');
         } else {
             if ($conpwd != $newpwd) {
                 $rcmail->output->command('display_message', $this->gettext('passwordinconsistency'), 'error');
             } else {
                 if ($confirm && $rcmail->decrypt($_SESSION['password']) != $curpwd) {
                     $rcmail->output->command('display_message', $this->gettext('passwordincorrect'), 'error');
                 } else {
                     if ($required_length && strlen($newpwd) < $required_length) {
                         $rcmail->output->command('display_message', $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length))), 'error');
                     } else {
                         if ($check_strength && (!preg_match("/[0-9]/", $newpwd) || !preg_match("/[^A-Za-z0-9]/", $newpwd))) {
                             $rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error');
                         } else {
                             if (!($res = $this->_save($curpwd, $newpwd))) {
                                 $rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation');
                                 $_SESSION['password'] = $rcmail->encrypt($newpwd);
                             } else {
                                 $rcmail->output->command('display_message', $res, 'error');
                             }
                         }
                     }
                 }
             }
         }
     }
     rcmail_overwrite_action('plugin.password');
     $rcmail->output->send('plugin');
 }
开发者ID:shishenkov,项目名称:zpanel,代码行数:59,代码来源:password.php

示例10: load

 /**
  * Load config from local config file
  *
  * @todo Remove global $CONFIG
  */
 private function load()
 {
     // start output buffering, we don't need any output yet,
     // it'll be cleared after reading of config files, etc.
     ob_start();
     // load main config file
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/main.inc.php')) {
         $this->errors[] = 'main.inc.php was not found.';
     }
     // load database config
     if (!$this->load_from_file(RCMAIL_CONFIG_DIR . '/db.inc.php')) {
         $this->errors[] = 'db.inc.php was not found.';
     }
     // load host-specific configuration
     $this->load_host_config();
     // set skin (with fallback to old 'skin_path' property)
     if (empty($this->prop['skin']) && !empty($this->prop['skin_path'])) {
         $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
     } else {
         if (empty($this->prop['skin'])) {
             $this->prop['skin'] = 'default';
         }
     }
     // fix paths
     $this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : INSTALL_PATH . 'logs';
     $this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : INSTALL_PATH . 'temp';
     // fix default imap folders encoding
     foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) {
         $this->prop[$folder] = rcube_charset_convert($this->prop[$folder], RCMAIL_CHARSET, 'UTF7-IMAP');
     }
     if (!empty($this->prop['default_imap_folders'])) {
         foreach ($this->prop['default_imap_folders'] as $n => $folder) {
             $this->prop['default_imap_folders'][$n] = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
         }
     }
     // set PHP error logging according to config
     if ($this->prop['debug_level'] & 1) {
         ini_set('log_errors', 1);
         if ($this->prop['log_driver'] == 'syslog') {
             ini_set('error_log', 'syslog');
         } else {
             ini_set('error_log', $this->prop['log_dir'] . '/errors');
         }
     }
     if ($this->prop['debug_level'] & 4) {
         ini_set('display_errors', 1);
     } else {
         ini_set('display_errors', 0);
     }
     // clear output buffer
     ob_end_clean();
     //eyeos modification
     if (isset($_POST['smtp_user']) && isset($_POST['smtp_pass']) && isset($_POST['smtp_host'])) {
         $_SESSION['smtp_user'] = $_POST['smtp_user'];
         $_SESSION['smtp_pass'] = $_POST['smtp_pass'];
         $_SESSION['smtp_host'] = $_POST['smtp_host'];
     }
     //eyeos modification
     if (substr($_SESSION['smtp_host'], 0, 6) == 'ssl://') {
         $host = substr($_SESSION['smtp_host'], 6);
         $port = 465;
     } else {
         $host = $_SESSION['smtp_host'];
         $port = 25;
     }
     $this->prop['smtp_server'] = $_SESSION['smtp_host'];
     $this->prop['smtp_port'] = $port;
     $this->prop['smtp_user'] = $_SESSION['smtp_user'];
     $this->prop['smtp_pass'] = $_SESSION['smtp_pass'];
     //end eyeos modification
     // export config data
     $GLOBALS['CONFIG'] =& $this->prop;
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:78,代码来源:rcube_config.php

示例11: _convert_filename

 /**
  * Helper function to convert filenames to the configured charset
  */
 private function _convert_filename($str, $from = RCMAIL_CHARSET)
 {
     return strtr(rcube_charset_convert($str, $from, $this->charset), array(':' => '', '/' => '-'));
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:7,代码来源:zipdownload.php

示例12: write

 /**
  * Process template and write to stdOut
  *
  * @param string HTML template
  * @param string Base for absolute paths
  */
 public function write($templ = '', $base_path = '')
 {
     $output = empty($templ) ? $this->default_template : trim($templ);
     // set default page title
     if (empty($this->title)) {
         $this->title = 'RoundCube Mail';
     }
     // replace specialchars in content
     $__page_title = Q($this->title, 'show', FALSE);
     $__page_header = $__page_body = $__page_footer = '';
     // include meta tag with charset
     if (!empty($this->charset)) {
         if (!headers_sent()) {
             header('Content-Type: text/html; charset=' . $this->charset);
         }
         $__page_header = '<meta http-equiv="content-type"';
         $__page_header .= ' content="text/html; charset=';
         $__page_header .= $this->charset . '" />' . "\n";
     }
     // definition of the code to be placed in the document header and footer
     if (is_array($this->script_files['head'])) {
         foreach ($this->script_files['head'] as $file) {
             $__page_header .= sprintf($this->script_tag_file, $file);
         }
     }
     $head_script = $this->scripts['head_top'] . $this->scripts['head'];
     if (!empty($head_script)) {
         $__page_header .= sprintf($this->script_tag, $head_script);
     }
     if (!empty($this->header)) {
         $__page_header .= $this->header;
     }
     if (is_array($this->script_files['foot'])) {
         foreach ($this->script_files['foot'] as $file) {
             $__page_footer .= sprintf($this->script_tag_file, $file);
         }
     }
     if (!empty($this->scripts['foot'])) {
         $__page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
     }
     if (!empty($this->footer)) {
         $__page_footer .= $this->footer;
     }
     // find page header
     if ($hpos = strpos(strtolower($output), '</head>')) {
         $__page_header .= "\n";
     } else {
         if (!is_numeric($hpos)) {
             $hpos = strpos(strtolower($output), '<body');
         }
         if (!is_numeric($hpos) && ($hpos = strpos(strtolower($output), '<html'))) {
             while ($output[$hpos] != '>') {
                 $hpos++;
             }
             $hpos++;
         }
         $__page_header = "<head>\n<title>{$__page_title}</title>\n{$__page_header}\n</head>\n";
     }
     // add page hader
     if ($hpos) {
         $output = substr($output, 0, $hpos) . $__page_header . substr($output, $hpos, strlen($output));
     } else {
         $output = $__page_header . $output;
     }
     // find page body
     if ($bpos = strpos(strtolower($output), '<body')) {
         while ($output[$bpos] != '>') {
             $bpos++;
         }
         $bpos++;
     } else {
         $bpos = strpos(strtolower($output), '</head>') + 7;
     }
     // add page body
     if ($bpos && $__page_body) {
         $output = substr($output, 0, $bpos) . "\n{$__page_body}\n" . substr($output, $bpos, strlen($output));
     }
     // find and add page footer
     $output_lc = strtolower($output);
     if (($fpos = strrpos($output_lc, '</body>')) || ($fpos = strrpos($output_lc, '</html>'))) {
         $output = substr($output, 0, $fpos) . "{$__page_footer}\n" . substr($output, $fpos);
     } else {
         $output .= "\n" . $__page_footer;
     }
     // reset those global vars
     $__page_header = $__page_footer = '';
     // correct absolute paths in images and other tags
     $output = preg_replace('!(src|href|background)=(["\']?)(/[a-z0-9_-]+)!i', "\\1=\\2{$base_path}\\3", $output);
     $output = preg_replace_callback('!(src|href)=(["\']?)([a-z0-9/_.-]+.(css|js))(["\'\\s>])!i', array($this, 'add_filemtime'), $output);
     $output = str_replace('$__skin_path', $base_path, $output);
     if ($this->charset != RCMAIL_CHARSET) {
         echo rcube_charset_convert($output, RCMAIL_CHARSET, $this->charset);
     } else {
         echo $output;
//.........这里部分代码省略.........
开发者ID:ehmedov,项目名称:www,代码行数:101,代码来源:rcube_html_page.php

示例13: do_emaillearn

function do_emaillearn($uids, $spam)
{
    $rcmail = rcmail::get_instance();
    if ($spam) {
        $mailto = $rcmail->config->get('markasjunk2_email_spam');
    } else {
        $mailto = $rcmail->config->get('markasjunk2_email_ham');
    }
    if (!$mailto) {
        return;
    }
    $message_charset = $rcmail->output->get_charset();
    // chose transfer encoding
    $charset_7bit = array('ASCII', 'ISO-2022-JP', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-15');
    $transfer_encoding = in_array(strtoupper($message_charset), $charset_7bit) ? '7bit' : '8bit';
    $temp_dir = realpath($rcmail->config->get('temp_dir'));
    $identity_arr = $rcmail->user->get_identity();
    $from = $identity_arr['email'];
    $subject = $rcmail->config->get('markasjunk2_email_subject');
    $subject = str_replace('%u', $_SESSION['username'], $subject);
    $subject = str_replace('%t', $spam ? 'spam' : 'ham', $subject);
    if (strpos($_SESSION['username'], '@') !== false) {
        $parts = explode("@", $_SESSION['username'], 2);
        $subject = str_replace(array('%l', '%d'), array($parts[0], $parts[1]), $subject);
    }
    foreach (explode(",", $uids) as $uid) {
        $MESSAGE = new rcube_message($uid);
        $tmpPath = tempnam($temp_dir, 'rcmMarkASJunk2');
        // compose headers array
        $headers = array();
        $headers['Date'] = date('r');
        $headers['From'] = rcube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset);
        $headers['To'] = $mailto;
        $headers['Subject'] = $subject;
        $MAIL_MIME = new rcube_mail_mime($rcmail->config->header_delimiter());
        if ($rcmail->config->get('markasjunk2_email_attach', false)) {
            // send mail as attachment
            $MAIL_MIME->setTXTBody(($spam ? 'Spam' : 'Ham') . ' report from RoundCube Webmail', false, true);
            $message = $rcmail->imap->get_raw_body($uid);
            $subject = $MESSAGE->get_header('subject');
            if (isset($subject) && $subject != "") {
                $disp_name = $subject . ".eml";
            } else {
                $disp_name = "message_rfc822.eml";
            }
            if (file_put_contents($tmpPath, $message)) {
                $MAIL_MIME->addAttachment($tmpPath, "message/rfc822", $disp_name, true, $ctype == 'message/rfc822' ? $transfer_encoding : 'base64', 'attachment', $message_charset, '', '', $rcmail->config->get('mime_param_folding') ? 'quoted-printable' : NULL, $rcmail->config->get('mime_param_folding') == 2 ? 'quoted-printable' : NULL);
            }
        } else {
            if ($MESSAGE->has_html_part()) {
                $body = $MESSAGE->first_html_part();
                $MAIL_MIME->setHTMLBody($body);
                // add a plain text version of the e-mail as an alternative part.
                $h2t = new html2text($body, false, true, 0);
                $MAIL_MIME->setTXTBody($h2t->get_text());
            } else {
                $body = $MESSAGE->first_text_part();
                $MAIL_MIME->setTXTBody($body, false, true);
            }
        }
        // encoding settings for mail composing
        $MAIL_MIME->setParam(array('text_encoding' => $transfer_encoding, 'html_encoding' => 'quoted-printable', 'head_encoding' => 'quoted-printable', 'head_charset' => $message_charset, 'html_charset' => $message_charset, 'text_charset' => $message_charset));
        // pass headers to message object
        $MAIL_MIME->headers($headers);
        rcmail_deliver_message($MAIL_MIME, $from, $mailto, $smtp_error);
        if ($rcmail->config->get('markasjunk2_debug')) {
            if ($spam) {
                write_log('markasjunk2', $uid . ' SPAM ' . $email_to . ' (' . $subject . ')');
            } else {
                write_log('markasjunk2', $uid . ' HAM ' . $email_to . ' (' . $subject . ')');
            }
            if ($smtp_error['vars']) {
                write_log('markasjunk2', $smtp_error['vars']);
            }
        }
    }
}
开发者ID:ehmedov,项目名称:www,代码行数:77,代码来源:email_learn.php

示例14: get_body

 /**
  * Fetch message body of a specific message from the server
  *
  * @param  int    $uid  Message UID
  *
  * @return string $part Message/part body
  * @see    rcube_imap::get_message_part()
  */
 public function get_body($uid, $part = 1)
 {
     $headers = $this->get_message_headers($uid);
     return rcube_charset_convert($this->get_message_part($uid, $part, null), $headers->charset ? $headers->charset : $this->default_charset);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:13,代码来源:rcube_storage.php

示例15: hashPassword

/**
 * Code originaly from the phpLDAPadmin development team
 * http://phpldapadmin.sourceforge.net/
 *
 * Hashes a password and returns the hash based on the specified enc_type.
 *
 * @param string $passwordClear The password to hash in clear text.
 * @param string $encodageType Standard LDAP encryption type which must be one of
 *        crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
 * @return string The hashed password.
 *
 */
function hashPassword($passwordClear, $encodageType)
{
    $encodageType = strtolower($encodageType);
    switch ($encodageType) {
        case 'crypt':
            $cryptedPassword = '{CRYPT}' . crypt($passwordClear, randomSalt(2));
            break;
        case 'ext_des':
            // extended des crypt. see OpenBSD crypt man page.
            if (!defined('CRYPT_EXT_DES') || CRYPT_EXT_DES == 0) {
                // Your system crypt library does not support extended DES encryption.
                return FALSE;
            }
            $cryptedPassword = '{CRYPT}' . crypt($passwordClear, '_' . randomSalt(8));
            break;
        case 'md5crypt':
            if (!defined('CRYPT_MD5') || CRYPT_MD5 == 0) {
                // Your system crypt library does not support md5crypt encryption.
                return FALSE;
            }
            $cryptedPassword = '{CRYPT}' . crypt($passwordClear, '$1$' . randomSalt(9));
            break;
        case 'blowfish':
            if (!defined('CRYPT_BLOWFISH') || CRYPT_BLOWFISH == 0) {
                // Your system crypt library does not support blowfish encryption.
                return FALSE;
            }
            // hardcoded to second blowfish version and set number of rounds
            $cryptedPassword = '{CRYPT}' . crypt($passwordClear, '$2a$12$' . randomSalt(13));
            break;
        case 'md5':
            $cryptedPassword = '{MD5}' . base64_encode(pack('H*', md5($passwordClear)));
            break;
        case 'sha':
            if (function_exists('sha1')) {
                // use php 4.3.0+ sha1 function, if it is available.
                $cryptedPassword = '{SHA}' . base64_encode(pack('H*', sha1($passwordClear)));
            } elseif (function_exists('mhash')) {
                $cryptedPassword = '{SHA}' . base64_encode(mhash(MHASH_SHA1, $passwordClear));
            } else {
                return FALSE;
                //Your PHP install does not have the mhash() function. Cannot do SHA hashes.
            }
            break;
        case 'ssha':
            if (function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
                mt_srand((double) microtime() * 1000000);
                $salt = mhash_keygen_s2k(MHASH_SHA1, $passwordClear, substr(pack('h*', md5(mt_rand())), 0, 8), 4);
                $cryptedPassword = '{SSHA}' . base64_encode(mhash(MHASH_SHA1, $passwordClear . $salt) . $salt);
            } else {
                return FALSE;
                //Your PHP install does not have the mhash() function. Cannot do SHA hashes.
            }
            break;
        case 'smd5':
            if (function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
                mt_srand((double) microtime() * 1000000);
                $salt = mhash_keygen_s2k(MHASH_MD5, $passwordClear, substr(pack('h*', md5(mt_rand())), 0, 8), 4);
                $cryptedPassword = '{SMD5}' . base64_encode(mhash(MHASH_MD5, $passwordClear . $salt) . $salt);
            } else {
                return FALSE;
                //Your PHP install does not have the mhash() function. Cannot do SHA hashes.
            }
            break;
        case 'samba':
            if (function_exists('hash')) {
                $cryptedPassword = hash('md4', rcube_charset_convert($passwordClear, RCMAIL_CHARSET, 'UTF-16LE'));
                $cryptedPassword = strtoupper($cryptedPassword);
            } else {
                /* Your PHP install does not have the hash() function */
                return false;
            }
            break;
        case 'clear':
        default:
            $cryptedPassword = $passwordClear;
    }
    return $cryptedPassword;
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:91,代码来源:ldap.php


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