| | |
| | | |
| | | // convert charset using iconv module |
| | | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
| | | $_iconv = iconv($from, $to . '//IGNORE', $str); |
| | | $_iconv = @iconv($from, $to . '//IGNORE', $str); |
| | | if ($_iconv !== false) { |
| | | return $_iconv; |
| | | } |
| | |
| | | { |
| | | $charset = strtoupper($charset); |
| | | |
| | | # RFC1642 |
| | | $charset = str_replace('UNICODE-1-1-', '', $charset); |
| | | $charset = preg_replace(array( |
| | | '/^[^0-9A-Z]+/', // e.g. _ISO-8859-JP$SIO |
| | | '/\$.*$/', // e.g. _ISO-8859-JP$SIO |
| | | '/UNICODE-1-1-/', // RFC1642 |
| | | ), '', $charset); |
| | | |
| | | # Aliases: some of them from HTML5 spec. |
| | | $aliases = array( |
| | |
| | | 'TIS620' => 'WINDOWS-874', |
| | | 'ISO88599' => 'WINDOWS-1254', |
| | | 'ISO885911' => 'WINDOWS-874', |
| | | 'MACROMAN' => 'MACINTOSH', |
| | | ); |
| | | |
| | | // allow a-z and 0-9 only and remove X- prefix (e.g. X-ROMAN8 => ROMAN8) |
| | |
| | | $xml_rep_table['&'] = '&'; |
| | | |
| | | for ($c=160; $c<256; $c++) // can be increased to support more charsets |
| | | $xml_rep_table[Chr($c)] = "&#$c;"; |
| | | $xml_rep_table[chr($c)] = "&#$c;"; |
| | | |
| | | $xml_rep_table['"'] = '"'; |
| | | $js_rep_table['"'] = '\\"'; |
| | | $js_rep_table["'"] = "\\'"; |
| | | $js_rep_table["\\"] = "\\\\"; |
| | | // Unicode line and paragraph separators (#1486310) |
| | | $js_rep_table[chr(hexdec(E2)).chr(hexdec(80)).chr(hexdec(A8))] = '
'; |
| | | $js_rep_table[chr(hexdec(E2)).chr(hexdec(80)).chr(hexdec(A9))] = '
'; |
| | | } |
| | | |
| | | // encode for javascript use |
| | |
| | | $today_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday'], $now_date['year']); |
| | | $week_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']); |
| | | |
| | | // define date format depending on current time |
| | | if ($CONFIG['prettydate'] && !$format && $timestamp > $today_limit && $timestamp < $now) |
| | | return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp)); |
| | | else if ($CONFIG['prettydate'] && !$format && $timestamp > $week_limit && $timestamp < $now) |
| | | $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i'; |
| | | else if (!$format) |
| | | $format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i'; |
| | | // define date format depending on current time |
| | | if (!$format) { |
| | | if ($CONFIG['prettydate'] && $timestamp > $today_limit && $timestamp < $now) |
| | | return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp)); |
| | | else if ($CONFIG['prettydate'] && $timestamp > $week_limit && $timestamp < $now) |
| | | $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i'; |
| | | else |
| | | $format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i'; |
| | | } |
| | | |
| | | // strftime() format |
| | | if (preg_match('/%[a-z]+/i', $format)) |
| | |
| | | global $RCMAIL; |
| | | static $a_mailboxes; |
| | | |
| | | $attrib += array('maxlength' => 100, 'relanames' => false); |
| | | $attrib += array('maxlength' => 100, 'realnames' => false); |
| | | |
| | | // add some labels to client |
| | | $RCMAIL->output->add_label('purgefolderconfirm', 'deletemessagesconfirm'); |
| | |
| | | |
| | | |
| | | /** |
| | | * Check if working in SSL mode |
| | | * |
| | | * @param integer HTTPS port number |
| | | * @param boolean Enables 'use_https' option checking |
| | | */ |
| | | function rcube_https_check($port=null, $use_https=true) |
| | | { |
| | | global $RCMAIL; |
| | | |
| | | if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') |
| | | return true; |
| | | if ($port && $_SERVER['SERVER_PORT'] == $port) |
| | | return true; |
| | | if ($use_https && $RCMAIL->config->get('use_https')) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * E-mail address validation |
| | | */ |
| | | function check_email($email) |