Changeset 419 in subversion for trunk/roundcubemail/program/include/main.inc
- Timestamp:
- Dec 20, 2006 9:06:33 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/include/main.inc (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r403 r419 735 735 $framed = $GLOBALS['_framed']; 736 736 $command = sprintf("display_message('%s', '%s');", 737 rep_specialchars_output(rcube_label(array('name' => $message, 'vars' => $vars)), 'js'),737 JQ(rcube_label(array('name' => $message, 'vars' => $vars))), 738 738 $type); 739 739 … … 855 855 $JS_OBJECT_NAME, 856 856 $name, 857 rep_specialchars_output(rcube_label($name), 'js')));857 JQ(rcube_label($name)))); 858 858 } 859 859 … … 898 898 899 899 900 // convert a string from one charset to another 901 // this function is not complete and not tested well 900 /** 901 * Convert a string from one charset to another. 902 * Uses mbstring and iconv functions if possible 903 * 904 * @param string Input string 905 * @param string Suspected charset of the input string 906 * @param string Target charset to convert to; defaults to $GLOBALS['CHARSET'] 907 * @return Converted string 908 */ 902 909 function rcube_charset_convert($str, $from, $to=NULL) 903 910 { … … 954 961 955 962 956 957 // replace specials characters to a specific encoding type 963 /** 964 * Replacing specials characters to a specific encoding type 965 * 966 * @param string Input string 967 * @param string Encoding type: text|html|xml|js|url 968 * @param string Replace mode for tags: show|replace|remove 969 * @param boolean Convert newlines 970 * @return The quoted string 971 */ 958 972 function rep_specialchars_output($str, $enctype='', $mode='', $newlines=TRUE) 959 973 { 960 974 global $OUTPUT_TYPE, $OUTPUT; 961 static $html_encode_arr, $js_rep_table, $ rtf_rep_table, $xml_rep_table;975 static $html_encode_arr, $js_rep_table, $xml_rep_table; 962 976 963 977 if (!$enctype) … … 1001 1015 } 1002 1016 1003 1004 1017 if ($enctype=='url') 1005 1018 return rawurlencode($str); 1006 1019 1007 1008 // if the replace tables for RTF, XML and JS are not yet defined 1020 // if the replace tables for XML and JS are not yet defined 1009 1021 if (!$js_rep_table) 1010 1022 { 1011 $js_rep_tabl e = $rtf_rep_table= $xml_rep_table = array();1023 $js_rep_tabl = $xml_rep_table = array(); 1012 1024 $xml_rep_table['&'] = '&'; 1013 1025 … … 1015 1027 { 1016 1028 $hex = dechex($c); 1017 $rtf_rep_table[Chr($c)] = "\\'$hex";1018 1029 $xml_rep_table[Chr($c)] = "&#$c;"; 1019 1030 … … 1026 1037 } 1027 1038 1028 // encode for RTF1039 // encode for XML 1029 1040 if ($enctype=='xml') 1030 1041 return strtr($str, $xml_rep_table); … … 1039 1050 } 1040 1051 1041 // encode for RTF1042 if ($enctype=='rtf')1043 return preg_replace("/\r\n/", "\par ", strtr($str, $rtf_rep_table));1044 1045 1052 // no encoding given -> return original string 1046 1053 return $str; 1054 } 1055 1056 /** 1057 * Quote a given string. Alias function for rep_specialchars_output 1058 * @see rep_specialchars_output 1059 */ 1060 function Q($str, $mode='strict', $newlines=TRUE) 1061 { 1062 return rep_specialchars_output($str, 'html', $mode, $newlines); 1063 } 1064 1065 /** 1066 * Quote a given string. Alias function for rep_specialchars_output 1067 * @see rep_specialchars_output 1068 */ 1069 function JQ($str, $mode='strict', $newlines=TRUE) 1070 { 1071 return rep_specialchars_output($str, 'js', $mode, $newlines); 1047 1072 } 1048 1073 … … 1249 1274 case 'label': 1250 1275 if ($attrib['name'] || $attrib['command']) 1251 return rep_specialchars_output(rcube_label($attrib));1276 return Q(rcube_label($attrib)); 1252 1277 break; 1253 1278 … … 1332 1357 { 1333 1358 $name = !empty($CONFIG['product_name']) ? $CONFIG['product_name'] : 'RoundCube Webmail'; 1334 return rep_specialchars_output($name, 'html', 'all');1359 return Q($name); 1335 1360 } 1336 1361 else if ($object=='version') … … 1354 1379 $title .= ucfirst($task); 1355 1380 1356 return rep_specialchars_output($title, 'html', 'all');1381 return Q($title); 1357 1382 } 1358 1383 … … 1420 1445 // get localized text for labels and titles 1421 1446 if ($attrib['title']) 1422 $attrib['title'] = rep_specialchars_output(rcube_label($attrib['title']));1447 $attrib['title'] = Q(rcube_label($attrib['title'])); 1423 1448 if ($attrib['label']) 1424 $attrib['label'] = rep_specialchars_output(rcube_label($attrib['label']));1449 $attrib['label'] = Q(rcube_label($attrib['label'])); 1425 1450 1426 1451 if ($attrib['alt']) 1427 $attrib['alt'] = rep_specialchars_output(rcube_label($attrib['alt']));1452 $attrib['alt'] = Q(rcube_label($attrib['alt'])); 1428 1453 1429 1454 // set title to alt attribute for IE browsers … … 1538 1563 1539 1564 foreach ($a_show_cols as $col) 1540 $table .= '<td class="'.$col.'">' . rep_specialchars_output(rcube_label($col)) . "</td>\n";1565 $table .= '<td class="'.$col.'">' . Q(rcube_label($col)) . "</td>\n"; 1541 1566 1542 1567 $table .= "</tr></thead>\n<tbody>\n"; 1543 1568 1544 1569 $c = 0; 1545 1546 1570 if (!is_array($table_data)) 1547 1571 { … … 1555 1579 foreach ($a_show_cols as $col) 1556 1580 { 1557 $cont = rep_specialchars_output($sql_arr[$col]);1558 $table .= '<td class="'.$col.'">' . $cont . "</td>\n";1581 $cont = Q($sql_arr[$col]); 1582 $table .= '<td class="'.$col.'">' . $cont . "</td>\n"; 1559 1583 } 1560 1584 … … 1574 1598 foreach ($a_show_cols as $col) 1575 1599 { 1576 $cont = rep_specialchars_output($row_data[$col]);1577 $table .= '<td class="'.$col.'">' . $cont . "</td>\n";1600 $cont = Q($row_data[$col]); 1601 $table .= '<td class="'.$col.'">' . $cont . "</td>\n"; 1578 1602 } 1579 1603
Note: See TracChangeset
for help on using the changeset viewer.
