alecpl
2009-06-11 8ca0c7ce6a1c7f8eb60cddc5955db51afd2cd107
- fix folder ID generation (for example two folders 'aaa' and 'aaa "')


2 files modified
11 ■■■■ changed files
program/include/main.inc 8 ●●●● patch | view | raw | blame | history
program/js/app.js 3 ●●●● patch | view | raw | blame | history
program/include/main.inc
@@ -590,12 +590,12 @@
/**
 * Remove all non-ascii and non-word chars
 * except . and -
 * except ., -, _
 */
function asciiwords($str, $css_id = false)
function asciiwords($str, $css_id = false, $replace_with = '')
{
  $allowed = 'a-z0-9\_\-' . (!$css_id ? '\.' : '');
  return preg_replace("/[^$allowed]/i", '', $str);
  return preg_replace("/[^$allowed]/i", $replace_with, $str);
}
/**
@@ -1201,7 +1201,7 @@
    }
    // make folder name safe for ids and class names
    $folder_id = asciiwords($folder['id'], true);
    $folder_id = asciiwords($folder['id'], true, '_');
    $classes = array('mailbox');
    // set special class for Sent, Drafts, Trash and Junk
program/js/app.js
@@ -3496,7 +3496,6 @@
      if ((current_li = this.get_folder_li(old))) {
        $(current_li).removeClass('selected').removeClass('unfocused');
      }
      if ((target_li = this.get_folder_li(name))) {
        $(target_li).removeClass('unfocused').addClass('selected');
      }
@@ -3511,7 +3510,7 @@
  {
    if (this.gui_objects.folderlist)
    {
      name = String(name).replace(this.identifier_expr, '');
      name = String(name).replace(this.identifier_expr, '_');
      return document.getElementById('rcmli'+name);
    }