Changeset 0a1dd5b in github


Ignore:
Timestamp:
May 22, 2012 5:07:20 AM (12 months ago)
Author:
Aleksander Machniak <alec@…>
Branches:
master, HEAD, dev-browser-capabilities, pdo
Children:
041c93c
Parents:
5a575b7
Message:

Add is_escaped attribute for html_select and html_textarea (#1488485)

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r5c7e54b r0a1dd5b  
    22=========================== 
    33 
     4- Add is_escaped attribute for html_select and html_textarea (#1488485) 
    45- Fix HTML entities handling in HTML editor (#1488483) 
    56- Fix listing shared folders on Courier IMAP (#1488466) 
  • program/include/html.php

    r0c25968 r0a1dd5b  
    299299            } 
    300300            else { 
    301                 $attrib_arr[] = $key . '="' . self::quote($value) . '"'; 
     301                $attrib_arr[] = $key . '="' . self::quote($value, true) . '"'; 
    302302            } 
    303303        } 
     
    332332     * Replacing specials characters in html attribute value 
    333333     * 
    334      * @param  string  $str  Input string 
     334     * @param  string  $str       Input string 
     335     * @param  bool    $validate  Enables double quotation prevention 
    335336     * 
    336337     * @return string  The quoted string 
    337338     */ 
    338     public static function quote($str) 
     339    public static function quote($str, $validate = false) 
    339340    { 
    340341        $str = htmlspecialchars($str, ENT_COMPAT, RCMAIL_CHARSET); 
    341342 
    342343        // avoid douple quotation of & 
    343         // @TODO: get rid of it? 
    344         $str = preg_replace('/&amp;([A-Za-z]{2,6}|#[0-9]{2,4});/', '&\\1;', $str); 
     344        // @TODO: get rid of it 
     345        if ($validate) { 
     346            $str = preg_replace('/&amp;([A-Za-z]{2,6}|#[0-9]{2,4});/', '&\\1;', $str); 
     347        } 
    345348 
    346349        return $str; 
     
    559562        } 
    560563 
    561         if (!empty($value) && !preg_match('/mce_editor/', $this->attrib['class'])) { 
    562             $value = self::quote($value); 
     564        if (!empty($value) && empty($this->attrib['is_escaped'])) { 
     565            $value = self::quote($value, true); 
    563566        } 
    564567 
     
    634637                  in_array($option['text'], $select, true)) ? 1 : null); 
    635638 
    636             $this->content .= self::tag('option', $attr, self::quote($option['text'])); 
     639            $option_content = $option['text']; 
     640            if (empty($this->attrib['is_escaped'])) { 
     641                $option_content = self::quote($option_content, true); 
     642            } 
     643 
     644            $this->content .= self::tag('option', $attr, $option_content); 
    637645        } 
    638646 
  • program/include/rcmail.php

    r5a575b7 r0a1dd5b  
    13301330 
    13311331        if ($type == 'select') { 
     1332            $attrib['is_escaped'] = true; 
    13321333            $select = new html_select($attrib); 
    13331334 
    13341335            // add no-selection option 
    13351336            if ($attrib['noselection']) { 
    1336                 $select->add($rcmail->gettext($attrib['noselection']), ''); 
     1337                $select->add(html::quote($rcmail->gettext($attrib['noselection'])), ''); 
    13371338            } 
    13381339 
     
    13631364    public function folder_selector($p = array()) 
    13641365    { 
    1365         $p += array('maxlength' => 100, 'realnames' => false); 
     1366        $p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true); 
    13661367        $a_mailboxes = array(); 
    13671368        $storage = $this->get_storage(); 
     
    13891390 
    13901391        if ($p['noselection']) { 
    1391             $select->add($p['noselection'], ''); 
     1392            $select->add(html::quote($p['noselection']), ''); 
    13921393        } 
    13931394 
     
    15801581            } 
    15811582 
    1582             $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']); 
     1583            $select->add(str_repeat('&nbsp;', $nestLevel*4) . html::quote($foldername), $folder['id']); 
    15831584 
    15841585            if (!empty($folder['folders'])) { 
  • program/steps/mail/compose.inc

    r5c7e54b r0a1dd5b  
    773773    $MESSAGE_BODY = htmlentities($MESSAGE_BODY, ENT_NOQUOTES, RCMAIL_CHARSET); 
    774774    $attrib['class'] = 'mce_editor'; 
     775    $attrib['is_escaped'] = true; 
    775776    $textarea = new html_textarea($attrib); 
    776777    $out .= $textarea->show($MESSAGE_BODY); 
  • program/steps/settings/edit_identity.inc

    r5c7e54b r0a1dd5b  
    8989  // Enable TinyMCE editor 
    9090  if ($IDENTITY_RECORD['html_signature']) { 
    91     $form['signature']['content']['signature']['class'] = 'mce_editor'; 
     91    $form['signature']['content']['signature']['class']      = 'mce_editor'; 
     92    $form['signature']['content']['signature']['is_escaped'] = true; 
    9293  } 
    9394 
Note: See TracChangeset for help on using the changeset viewer.