本文整理汇总了PHP中rcube_charset类的典型用法代码示例。如果您正苦于以下问题:PHP rcube_charset类的具体用法?PHP rcube_charset怎么用?PHP rcube_charset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rcube_charset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: import
/**
*
*/
public function import($csv)
{
// convert to UTF-8
$head = substr($csv, 0, 4096);
$charset = rcube_charset::detect($head, RCUBE_CHARSET);
$csv = rcube_charset::convert($csv, $charset);
$head = '';
$this->map = array();
// Parse file
foreach (preg_split("/[\r\n]+/", $csv) as $line) {
$elements = $this->parse_line($line);
if (empty($elements)) {
continue;
}
// Parse header
if (empty($this->map)) {
$this->parse_header($elements);
if (empty($this->map)) {
break;
}
} else {
$this->csv_to_vcard($elements);
}
}
}
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:28,代码来源:rcube_csv2vcard.php
示例2: import
/**
*
*/
public function import($csv)
{
// convert to UTF-8
$head = substr($csv, 0, 4096);
$fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1');
// fallback to Latin-1?
$charset = rcube_charset::detect($head, RCUBE_CHARSET);
$csv = rcube_charset::convert($csv, $charset);
$head = '';
$this->map = array();
// Parse file
foreach (preg_split("/[\r\n]+/", $csv) as $i => $line) {
$elements = $this->parse_line($line);
if (empty($elements)) {
continue;
}
// Parse header
if (empty($this->map)) {
$this->parse_header($elements);
if (empty($this->map)) {
break;
}
} else {
$this->csv_to_vcard($elements);
}
}
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:30,代码来源:rcube_csv2vcard.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'])) {
if (!empty($this->prop['skin_path'])) {
$this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
} else {
$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_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:npk,项目名称:roundcubemail,代码行数:61,代码来源:rcube_config.php
示例4: _read_lists
/**
* Read available calendars for the current user and store them internally
*/
private function _read_lists($force = false)
{
// already read sources
if (isset($this->lists) && !$force) {
return $this->lists;
}
// get all folders that have type "task"
$this->folders = kolab_storage::get_folders('task');
$this->lists = array();
// convert to UTF8 and sort
$names = array();
$default_folder = null;
foreach ($this->folders as $folder) {
$names[$folder->name] = rcube_charset::convert($folder->name, 'UTF7-IMAP');
$this->folders[$folder->name] = $folder;
if ($folder->default) {
$default_folder = $folder->name;
}
}
asort($names, SORT_LOCALE_STRING);
// put default folder (aka INBOX) on top of the list
if ($default_folder) {
$default_name = $names[$default_folder];
unset($names[$default_folder]);
$names = array_merge(array($default_folder => $default_name), $names);
}
$delim = $this->rc->get_storage()->get_hierarchy_delimiter();
$listnames = array();
$prefs = $this->rc->config->get('kolab_tasklists', array());
foreach ($names as $utf7name => $name) {
$folder = $this->folders[$utf7name];
$path_imap = explode($delim, $name);
$editname = array_pop($path_imap);
// pop off raw name part
$path_imap = join($delim, $path_imap);
$name = kolab_storage::folder_displayname(kolab_storage::object_name($utf7name), $listnames);
if ($folder->get_namespace() == 'personal') {
$readonly = false;
$alarms = true;
} else {
$alarms = false;
$readonly = true;
if (($rights = $folder->get_myrights()) && !PEAR::isError($rights)) {
if (strpos($rights, 'i') !== false) {
$readonly = false;
}
}
}
$list_id = kolab_storage::folder_id($utf7name);
$tasklist = array('id' => $list_id, 'name' => $name, 'editname' => $editname, 'color' => $folder->get_color('0000CC'), 'showalarms' => isset($prefs[$list_id]['showalarms']) ? $prefs[$list_id]['showalarms'] : $alarms, 'editable' => !$readonly, 'active' => $folder->is_active(), 'parentfolder' => $path_imap, 'default' => $folder->default, 'children' => true, 'class_name' => trim($folder->get_namespace() . ($folder->default ? ' default' : '')));
$this->lists[$tasklist['id']] = $tasklist;
$this->folders[$tasklist['id']] = $folder;
}
}
开发者ID:svenjantzen,项目名称:plugins,代码行数:57,代码来源:tasklist_kolab_driver.php
示例5: import
/**
*
*/
public function import($csv)
{
// convert to UTF-8
$head = substr($csv, 0, 4096);
$charset = rcube_charset::detect($head, RCUBE_CHARSET);
$csv = rcube_charset::convert($csv, $charset);
$csv = preg_replace(array('/^[\\xFE\\xFF]{2}/', '/^\\xEF\\xBB\\xBF/', '/^\\x00+/'), '', $csv);
// also remove BOM
$head = '';
$prev_line = false;
$this->map = array();
$this->gmail_map = array();
// Parse file
foreach (preg_split("/[\r\n]+/", $csv) as $line) {
if (!empty($prev_line)) {
$line = '"' . $line;
}
$elements = $this->parse_line($line);
if (empty($elements)) {
continue;
}
// Parse header
if (empty($this->map)) {
$this->parse_header($elements);
if (empty($this->map)) {
break;
}
} else {
// handle multiline elements (e.g. Gmail)
if (!empty($prev_line)) {
$first = array_shift($elements);
if ($first[0] == '"') {
$prev_line[count($prev_line) - 1] = '"' . $prev_line[count($prev_line) - 1] . "\n" . substr($first, 1);
} else {
$prev_line[count($prev_line) - 1] .= "\n" . $first;
}
$elements = array_merge($prev_line, $elements);
}
$last_element = $elements[count($elements) - 1];
if ($last_element[0] == '"') {
$elements[count($elements) - 1] = substr($last_element, 1);
$prev_line = $elements;
continue;
}
$this->csv_to_vcard($elements);
$prev_line = false;
}
}
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:52,代码来源:rcube_csv2vcard.php
示例6: 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:normalnorge,项目名称:roundcubemail,代码行数:13,代码来源:rcube_storage.php
示例7: 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
*/
protected 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:zamentur,项目名称:roundcube_ynh,代码行数:27,代码来源:rcube_sieve_engine.php
示例8: json_serialize
/**
* Convert a variable into a javascript object notation
*
* @param mixed Input value
*
* @return string Serialized JSON string
*/
public static function json_serialize($input)
{
$input = rcube_charset::clean($input);
// sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
// that's why we have @ here
return @json_encode($input);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:14,代码来源:rcube_output.php
示例9: detect_encoding
/**
* Returns UNICODE type based on BOM (Byte Order Mark)
*
* @param string Input string to test
* @return string Detected encoding
*/
private static function detect_encoding($string)
{
$fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1');
// fallback to Latin-1
return rcube_charset::detect($string, $fallback);
}
开发者ID:rootsdigital,项目名称:roundcubemail,代码行数:12,代码来源:rcube_vcard.php
示例10: _write
/**
* Process template and write to stdOut
*
* @param string HTML template
* @param string Base for absolute paths
*/
public function _write($templ = '', $base_path = '')
{
$output = trim($templ);
if (empty($output)) {
$output = $this->default_template;
$is_empty = true;
}
// set default page title
if (empty($this->pagetitle)) {
$this->pagetitle = 'Roundcube Mail';
}
// replace specialchars in content
$page_title = html::quote($this->pagetitle);
$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 .= html::script($file);
}
}
$head_script = $this->scripts['head_top'] . $this->scripts['head'];
if (!empty($head_script)) {
$page_header .= html::script(array(), $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 .= html::script($file);
}
}
if (!empty($this->footer)) {
$page_footer .= $this->footer . "\n";
}
if (!empty($this->scripts['foot'])) {
$page_footer .= html::script(array(), $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) && !$is_empty && (($pos = stripos($output, '<script ')) || ($pos = stripos($output, '</head>')))) {
$css = '';
foreach ($this->css_files as $file) {
$css .= html::tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $file, 'nl' => true));
}
$output = substr_replace($output, $css, $pos, 0);
}
$output = $this->parse_with_globals($this->fix_paths($output));
// trigger hook with final HTML content to be sent
$hook = $this->app->plugins->exec_hook("send_page", array('content' => $output));
if (!$hook['abort']) {
if ($this->charset != RCUBE_CHARSET) {
echo rcube_charset::convert($hook['content'], RCUBE_CHARSET, $this->charset);
} else {
//.........这里部分代码省略.........
开发者ID:Kuurusch,项目名称:enigmabox-openwrt,代码行数:101,代码来源:rcmail_output_html.php
示例11: localize_folderpath
public function localize_folderpath($path)
{
$protect_folders = $this->config->get('protect_default_folders');
$delimiter = $this->storage->get_hierarchy_delimiter();
$path = explode($delimiter, $path);
$result = array();
foreach ($path as $idx => $dir) {
$directory = implode($delimiter, array_slice($path, 0, $idx + 1));
if ($protect_folders && $this->storage->is_special_folder($directory)) {
unset($result);
$result[] = $this->localize_foldername($directory);
} else {
$result[] = rcube_charset::convert($dir, 'UTF7-IMAP');
}
}
return implode($delimiter, $result);
}
开发者ID:peknur,项目名称:roundcubemail,代码行数:17,代码来源:rcmail.php
示例12: _rcmail_get_identity
protected function _rcmail_get_identity($id)
{
$rcmail = rcube::get_instance();
if ($sql_arr = $rcmail->user->get_identity($id)) {
$out = $sql_arr;
$out['mailto'] = $sql_arr['email'];
$out['string'] = format_email_recipient($sql_arr['email'], rcube_charset::convert($sql_arr['name'], RCUBE_CHARSET, $this->api->output->get_charset()));
if ($rcmail->config->get('sieverules_from_format', 0) == 1) {
$out['disp_string'] = $out['string'];
$out['val_string'] = $out['string'];
} else {
$out['disp_string'] = $out['mailto'];
$out['val_string'] = $out['mailto'];
}
return $out;
}
return false;
}
开发者ID:Kofl,项目名称:Roundcube-Plugin-SieveRules-Managesieve,代码行数:18,代码来源:sieverules.php
示例13: normalize_string
/**
* Normalize the given string for fulltext search.
* Currently only optimized for ISO-8859-1 and ISO-8859-2 characters; to be extended
*
* @param string Input string (UTF-8)
* @param boolean True to return list of words as array
*
* @return mixed Normalized string or a list of normalized tokens
*/
public static function normalize_string($str, $as_array = false)
{
// replace 4-byte unicode characters with '?' character,
// these are not supported in default utf-8 charset on mysql,
// the chance we'd need them in searching is very low
$str = preg_replace('/(' . '\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2}' . '|[\\xF1-\\xF3][\\x80-\\xBF]{3}' . '|\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2}' . ')/', '?', $str);
// split by words
$arr = self::tokenize_string($str);
// detect character set
if (utf8_encode(utf8_decode($str)) == $str) {
// ISO-8859-1 (or ASCII)
preg_match_all('/./u', 'äâàåáãæçéêëèïîìíñöôòøõóüûùúýÿ', $keys);
preg_match_all('/./', 'aaaaaaaceeeeiiiinoooooouuuuyy', $values);
$mapping = array_combine($keys[0], $values[0]);
$mapping = array_merge($mapping, array('ß' => 'ss', 'ae' => 'a', 'oe' => 'o', 'ue' => 'u'));
} else {
if (rcube_charset::convert(rcube_charset::convert($str, 'UTF-8', 'ISO-8859-2'), 'ISO-8859-2', 'UTF-8') == $str) {
// ISO-8859-2
preg_match_all('/./u', 'ąáâäćçčéęëěíîłľĺńňóôöŕřśšşťţůúűüźžżý', $keys);
preg_match_all('/./', 'aaaaccceeeeiilllnnooorrsssttuuuuzzzy', $values);
$mapping = array_combine($keys[0], $values[0]);
$mapping = array_merge($mapping, array('ß' => 'ss', 'ae' => 'a', 'oe' => 'o', 'ue' => 'u'));
}
}
foreach ($arr as $i => $part) {
$part = mb_strtolower($part);
if (!empty($mapping)) {
$part = strtr($part, $mapping);
}
$arr[$i] = $part;
}
return $as_array ? $arr : join(" ", $arr);
}
开发者ID:Jo0oe2Ho,项目名称:roundcubemail,代码行数:42,代码来源:rcube_utils.php
示例14: _convert_filename
/**
* Helper function to convert filenames to the configured charset
*/
private function _convert_filename($str)
{
$str = rcube_charset::convert($str, RCUBE_CHARSET, $this->charset);
return strtr($str, array(':' => '', '/' => '-'));
}
开发者ID:rasky,项目名称:roundcubemail,代码行数:8,代码来源:zipdownload.php
示例15: read_squirrel_prefs
private function read_squirrel_prefs($uname)
{
$rcmail = rcmail::get_instance();
/**** File based backend ****/
if ($rcmail->config->get('squirrelmail_driver') == 'file' && ($srcdir = $rcmail->config->get('squirrelmail_data_dir'))) {
if (($hash_level = $rcmail->config->get('squirrelmail_data_dir_hash_level')) > 0) {
$srcdir = slashify($srcdir) . chunk_split(substr(base_convert(crc32($uname), 10, 16), 0, $hash_level), 1, '/');
}
$prefsfile = slashify($srcdir) . $uname . '.pref';
$abookfile = slashify($srcdir) . $uname . '.abook';
$sigfile = slashify($srcdir) . $uname . '.sig';
$sigbase = slashify($srcdir) . $uname . '.si';
if (is_readable($prefsfile)) {
$this->prefs = array();
foreach (file($prefsfile) as $line) {
list($key, $value) = explode('=', $line);
$this->prefs[$key] = utf8_encode(rtrim($value));
}
// also read signature file if exists
if (is_readable($sigfile)) {
$this->prefs['___signature___'] = utf8_encode(file_get_contents($sigfile));
}
if (isset($this->prefs['identities']) && $this->prefs['identities'] > 1) {
for ($i = 1; $i < $this->prefs['identities']; $i++) {
// read signature file if exists
if (is_readable($sigbase . $i)) {
$this->prefs['___sig' . $i . '___'] = utf8_encode(file_get_contents($sigbase . $i));
}
}
}
// parse addres book file
if (filesize($abookfile)) {
foreach (file($abookfile) as $line) {
list($rec['name'], $rec['firstname'], $rec['surname'], $rec['email']) = explode('|', utf8_encode(rtrim($line)));
if ($rec['name'] && $rec['email']) {
$this->abook[] = $rec;
}
}
}
}
} else {
if ($rcmail->config->get('squirrelmail_driver') == 'sql') {
$this->prefs = array();
/* connect to squirrelmail database */
$db = rcube_db::factory($rcmail->config->get('squirrelmail_dsn'));
$db->set_debug($rcmail->config->get('sql_debug'));
$db->db_connect('r');
// connect in read mode
/* retrieve prefs */
$userprefs_table = $rcmail->config->get('squirrelmail_userprefs_table');
$address_table = $rcmail->config->get('squirrelmail_address_table');
$db_charset = $rcmail->config->get('squirrelmail_db_charset');
if ($db_charset) {
$db->query('SET NAMES ' . $db_charset);
}
$sql_result = $db->query('SELECT * FROM ' . $userprefs_table . ' WHERE user=?', $uname);
// ? is replaced with emailaddress
while ($sql_array = $db->fetch_assoc($sql_result)) {
// fetch one row from result
$this->prefs[$sql_array['prefkey']] = rcube_charset::convert(rtrim($sql_array['prefval']), $db_charset);
}
/* retrieve address table data */
$sql_result = $db->query('SELECT * FROM ' . $address_table . ' WHERE owner=?', $uname);
// ? is replaced with emailaddress
// parse addres book
while ($sql_array = $db->fetch_assoc($sql_result)) {
// fetch one row from result
$rec['name'] = rcube_charset::convert(rtrim($sql_array['nickname']), $db_charset);
$rec['firstname'] = rcube_charset::convert(rtrim($sql_array['firstname']), $db_charset);
$rec['surname'] = rcube_charset::convert(rtrim($sql_array['lastname']), $db_charset);
$rec['email'] = rcube_charset::convert(rtrim($sql_array['email']), $db_charset);
$rec['notes'] = rcube_charset::convert(rtrim($sql_array['label']), $db_charset);
if ($rec['name'] && $rec['email']) {
$this->abook[] = $rec;
}
}
}
}
// end if 'sql'-driver
}
开发者ID:bbspike,项目名称:sentora-core,代码行数:80,代码来源:squirrelmail_usercopy.php
示例16: hash_password
//.........这里部分代码省略.........
$salt = substr(pack("H*", sha1($salt . $password)), 0, 4);
$crypted = sha1($password . $salt, true);
} else {
if (function_exists('hash')) {
$salt = substr(pack("H*", hash('sha1', $salt . $password)), 0, 4);
$crypted = hash('sha1', $password . $salt, true);
} else {
rcube::raise_error(array('code' => 600, 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: Your PHP install does not have the mhash()/hash() nor sha1() function"), true, true);
}
}
}
$crypted = base64_encode($crypted . $salt);
$prefix = '{SSHA}';
break;
case 'smd5':
$salt = substr(pack('h*', md5(mt_rand())), 0, 8);
if (function_exists('mhash') && function_exists('mhash_keygen_s2k')) {
$salt = mhash_keygen_s2k(MHASH_MD5, $password, $salt, 4);
$crypted = mhash(MHASH_MD5, $password . $salt);
} else {
if (function_exists('hash')) {
$salt = substr(pack("H*", hash('md5', $salt . $password)), 0, 4);
$crypted = hash('md5', $password . $salt, true);
} else {
$salt = substr(pack("H*", md5($salt . $password)), 0, 4);
$crypted = md5($password . $salt, true);
}
}
$crypted = base64_encode($crypted . $salt);
$prefix = '{SMD5}';
break;
case 'samba':
if (function_exists('hash')) {
$crypted = hash('md4', rcube_charset::convert($password, RCUBE_CHARSET, 'UTF-16LE'));
$crypted = strtoupper($crypted_password);
} else {
rcube::raise_error(array('code' => 600, 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: Your PHP install does not have hash() function"), true, true);
}
break;
case 'ad':
$crypted = rcube_charset::convert('"' . $password . '"', RCUBE_CHARSET, 'UTF-16LE');
break;
case 'cram-md5':
// deprecated
require_once __DIR__ . '/../helpers/dovecot_hmacmd5.php';
$crypted = dovecot_hmacmd5($password);
$prefix = '{CRAM-MD5}';
break;
case 'dovecot':
if (!($dovecotpw = $rcmail->config->get('password_dovecotpw'))) {
$dovecotpw = 'dovecotpw';
}
if (!($method = $rcmail->config->get('password_dovecotpw_method'))) {
$method = 'CRAM-MD5';
}
// use common temp dir
$tmp_dir = $rcmail->config->get('temp_dir');
$tmpfile = tempnam($tmp_dir, 'roundcube-');
$pipe = popen("{$dovecotpw} -s '{$method}' > '{$tmpfile}'", "w");
if (!$pipe) {
unlink($tmpfile);
return false;
} else {
fwrite($pipe, $passwd . "\n", 1 + strlen($passwd));
usleep(1000);
fwrite($pipe, $passwd . "\n", 1 + strlen($passwd));
开发者ID:NathanAUS,项目名称:roundcubemail,代码行数:67,代码来源:password.php
示例17: rc_utf8_clean
function rc_utf8_clean($input)
{
return rcube_charset::clean($input);
}
开发者ID:noikiy,项目名称:roundcubemail,代码行数:4,代码来源:bc.php
示例18: json_serialize
/**
* Convert a variable into a javascript object notation
*
* @param mixed $input Input value
* @param boolean $pretty Enable JSON formatting
*
* @return string Serialized JSON string
*/
public static function json_serialize($input, $pretty = false)
{
$input = rcube_charset::clean($input);
$options = 0;
if ($pretty) {
$options |= JSON_PRETTY_PRINT;
}
// sometimes even using rcube_charset::clean() the input contains invalid UTF-8 sequences
// that's why we have @ here
return @json_encode($input, $options);
}
开发者ID:jimjag,项目名称:roundcubemail,代码行数:19,代码来源:rcube_output.php
示例19: fix_attachment_name
/**
* Fix attachment name encoding if needed/possible
*/
protected function fix_attachment_name($name, $part)
{
if ($name == rcube_charset::clean($name)) {
return $name;
}
// find charset from part or its parent(s)
if ($part->charset) {
$charsets[] = $part->charset;
} else {
// check first part (common case)
$n = strpos($part->mime_id, '.') ? preg_replace('/\\.[0-9]+$/', '', $part->mime_id) . '.1' : 1;
if (($_part = $this->mime_parts[$n]) && $_part->charset) {
$charsets[] = $_part->charset;
}
// check parents' charset
$items = explode('.', $part->mime_id);
for ($i = count($items) - 1; $i > 0; $i--) {
$last = array_pop($items);
$parent = $this->mime_parts[join('.', $items)];
if ($parent && $parent->charset) {
$charsets[] = $parent->charset;
}
}
}
if ($this->headers->charset) {
$charsets[] = $this->headers->charset;
}
if (empty($charsets)) {
$rcube = rcube::get_instance();
$charsets[] = rcube_charset::detect($name, $rcube->config->get('default_charset', RCUBE_CHARSET));
}
foreach (array_unique($charsets) as $charset) {
$_name = rcube_charset::convert($name, $charset);
if ($_name == rcube_charset::clean($_name)) {
if (!$part->charset) {
$part->charset = $charset;
}
return $_name;
}
}
return $name;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:45,代码来源:rcube_message.php
示例20: get
/**
* Returns header value
*/
public function get($name, $decode = true)
{
$name = strtolower($name);
if (isset($this->obj_headers[$name])) {
$value = $this->{$this->obj_headers[$name]};
} else {
$value = $this->others[$name];
}
if ($decode) {
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = rcube_mime::decode_header($val, $this->charset);
$value[$key] = rcube_charset::clean($val);
}
} else {
$value = rcube_mime::decode_header($value, $this->charset);
$value = rcube_charset::clean($value);
}
}
return $value;
}
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:24,代码来源:rcube_message_header.php
注:本文中的rcube_charset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论