| | |
| | | $opt = rcmail::get_instance()->config->get($config_key); |
| | | |
| | | if (!empty($opt)) |
| | | { |
| | | $db = &rcmail::get_instance()->db; |
| | | |
| | | if ($db->db_provider=='pgsql') |
| | | { |
| | | $db->db_handle->setOption('disable_smart_seqname', true); |
| | | $db->db_handle->setOption('seqname_format', '%s'); |
| | | } |
| | | |
| | | return $opt; |
| | | } |
| | | |
| | | return $sequence; |
| | | } |
| | |
| | | $app = rcmail::get_instance(); |
| | | return $app->url((array)$p + array('_action' => $action, 'task' => $task)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add a localized label to the client environment |
| | | * @deprecated |
| | | */ |
| | | function rcube_add_label() |
| | | { |
| | | global $OUTPUT; |
| | | |
| | | $arg_list = func_get_args(); |
| | | foreach ($arg_list as $i => $name) |
| | | $OUTPUT->add_label($name); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | return $str; |
| | | |
| | | $aliases = array( |
| | | 'UNKNOWN-8BIT' => 'ISO-8859-15', |
| | | 'X-UNKNOWN' => 'ISO-8859-15', |
| | | 'X-USER-DEFINED' => 'ISO-8859-15', |
| | | 'ISO-8859-8-I' => 'ISO-8859-8', |
| | | 'KS_C_5601-1987' => 'EUC-KR', |
| | | 'US-ASCII' => 'ISO-8859-1', |
| | | 'ANSI_X3.110-1983' => 'ISO-8859-1', |
| | | 'ANSI_X3.4-1968' => 'ISO-8859-1', |
| | | 'UNKNOWN-8BIT' => 'ISO-8859-15', |
| | | 'X-UNKNOWN' => 'ISO-8859-15', |
| | | 'X-USER-DEFINED' => 'ISO-8859-15', |
| | | 'ISO-8859-8-I' => 'ISO-8859-8', |
| | | 'KS_C_5601-1987' => 'EUC-KR', |
| | | ); |
| | | |
| | | // convert charset using iconv module |
| | |
| | | } |
| | | } |
| | | |
| | | // settings for mbstring module (by Tadashi Jokagi) |
| | | if (is_null($mbstring_loaded)) { |
| | | if ($mbstring_loaded = extension_loaded("mbstring")) |
| | | mb_internal_encoding(RCMAIL_CHARSET); |
| | | } |
| | | |
| | | if (is_null($mbstring_loaded)) |
| | | $mbstring_loaded = extension_loaded('mbstring'); |
| | | |
| | | // convert charset using mbstring module |
| | | if ($mbstring_loaded) |
| | | { |
| | |
| | | $str = strip_tags($str); |
| | | |
| | | // avoid douple quotation of & |
| | | $out = preg_replace('/&([a-z]{2,5}|#[0-9]{2,4});/', '&\\1;', strtr($str, $encode_arr)); |
| | | $out = preg_replace('/&([A-Za-z]{2,6}|#[0-9]{2,4});/', '&\\1;', strtr($str, $encode_arr)); |
| | | |
| | | return $newlines ? nl2br($out) : $out; |
| | | } |
| | |
| | | |
| | | // use value from post |
| | | if (!empty($_POST[$fname])) |
| | | $value = get_input_value($fname, RCUBE_INPUT_POST); |
| | | $value = get_input_value($fname, RCUBE_INPUT_POST, |
| | | $type == 'textarea' && strpos($attrib['class'], 'mce_editor')!==false ? true : false); |
| | | |
| | | $out = $input->show($value); |
| | | |
| | |
| | | $last_pos = 0; |
| | | |
| | | // ignore the whole block if evil styles are detected |
| | | if (stristr($source, 'expression') || stristr($source, 'behavior')) |
| | | $stripped = preg_replace('/[^a-z\(:]/', '', rcmail_xss_entitiy_decode($source)); |
| | | if (preg_match('/expression|behavior|url\(|import/', $stripped)) |
| | | return ''; |
| | | |
| | | // cut out all contents between { and } |
| | |
| | | |
| | | return $styles; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decode escaped entities used by known XSS exploits. |
| | | * See http://downloads.securityfocus.com/vulnerabilities/exploits/26800.eml for examples |
| | | * |
| | | * @param string CSS content to decode |
| | | * @return string Decoded string |
| | | */ |
| | | function rcmail_xss_entitiy_decode($content) |
| | | { |
| | | $out = html_entity_decode(html_entity_decode($content)); |
| | | $out = preg_replace('/\\\([0-9a-f]{4})/ie', "chr(hexdec('\\1'))", $out); |
| | | $out = preg_replace('#/\*.*\*/#Um', '', $out); |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | $ts = $date; |
| | | else if (!empty($date)) |
| | | { |
| | | while (($ts = @strtotime($date))===false) |
| | | // if date parsing fails, we have a date in non-rfc format. |
| | | // remove token from the end and try again |
| | | while ((($ts = @strtotime($date))===false) || ($ts < 0)) |
| | | { |
| | | // if we have a date in non-rfc format |
| | | // remove token from the end and try again |
| | | $d = explode(' ', $date); |
| | | array_pop($d); |
| | | if (!$d) break; |
| | |
| | | $log_entry = sprintf("[%s]: %s\n", |
| | | date("d-M-Y H:i:s O", mktime()), |
| | | $line); |
| | | |
| | | |
| | | if ($CONFIG['log_driver'] == 'syslog') { |
| | | if ($name == 'errors') |
| | | $prio = LOG_ERR; |
| | |
| | | // log_driver == 'file' is assumed here |
| | | if (empty($CONFIG['log_dir'])) |
| | | $CONFIG['log_dir'] = INSTALL_PATH.'logs'; |
| | | |
| | | |
| | | // try to open specific log file for writing |
| | | if ($fp = @fopen($CONFIG['log_dir'].'/'.$name, 'a')) { |
| | | fwrite($fp, $log_entry); |
| | | fflush($fp); |
| | | fclose($fp); |
| | | } |
| | | } |
| | |
| | | $attrib += array('maxlength' => 100, 'relanames' => false); |
| | | |
| | | // add some labels to client |
| | | rcube_add_label('purgefolderconfirm'); |
| | | rcube_add_label('deletemessagesconfirm'); |
| | | $RCMAIL->output->add_label('purgefolderconfirm', 'deletemessagesconfirm'); |
| | | |
| | | $type = $attrib['type'] ? $attrib['type'] : 'ul'; |
| | | unset($attrib['type']); |
| | |
| | | $classes[] = 'trash'; |
| | | else if ($folder['id']==$CONFIG['junk_mbox']) |
| | | $classes[] = 'junk'; |
| | | else if ($folder['id']=='INBOX') |
| | | $classes[] = 'inbox'; |
| | | else |
| | | $classes[] = asciiwords($folder_class ? $folder_class : strtolower($folder['id']), true); |
| | | $classes[] = '_'.asciiwords($folder_class ? $folder_class : strtolower($folder['id']), true); |
| | | |
| | | $classes[] = $zebra_class; |
| | | |