Changeset 5eee009 in github


Ignore:
Timestamp:
Sep 19, 2007 2:29:28 AM (6 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
4d0413d
Parents:
104ee38b
Message:

Allow vars and PHP code in templates; improved page title; fixed #1484395

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • .htaccess

    r0d1dd7c r5eee009  
    77  php_value     error_log       logs/errors 
    88  php_value     upload_max_filesize     5M 
     9  php_value     post_max_size   6M 
    910</IfModule> 
    1011 
     
    1415  php_value     error_log       logs/errors 
    1516  php_value     upload_max_filesize     5M 
     17  php_value     post_max_size   6M 
    1618</IfModule> 
    1719 
  • CHANGELOG

    reb68420 r5eee009  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42007/09/18 (thomasb) 
     5---------- 
     6- Eval PHP code in template includes (if configured) 
     7- Show message when folder is empty. Mo more static text in table (#1484395) 
     8- Only display unread count in page title when new messages arrived 
     9- Show mailbox name in page title 
     10 
    311 
    4122007/09/09 (thomasb) 
  • config/main.inc.php.dist

    rd7d6638 r5eee009  
    8787// relative path to the skin folder 
    8888$rcmail_config['skin_path'] = 'skins/default/'; 
     89 
     90// inludes shloud be interpreted as PHP files 
     91$rcmail_config['skin_include_php'] = true; 
    8992 
    9093// use this folder to store temp files (must be writebale for apache user) 
  • program/include/rcmail_template.inc

    rbd4209e r5eee009  
    323323    } 
    324324     
     325    // add command to set page title 
     326    if ($this->ajax_call && !empty($this->pagetitle)) 
     327      $out .= sprintf( 
     328        "this.set_pagetitle('%s');\n", 
     329        JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle) 
     330      ); 
     331     
    325332    return $out; 
    326333  } 
     
    454461      case 'include': 
    455462        $path = realpath($this->config['skin_path'].$attrib['file']); 
    456         if (filesize($path) && ($fp = @fopen($path, 'r'))) 
     463        if (filesize($path)) 
    457464        { 
    458           $incl = fread($fp, filesize($path)); 
    459           fclose($fp);         
     465          if ($this->config['skin_include_php']) 
     466            $incl = $this->include_php($path); 
     467          else if ($fp = @fopen($path, 'r')) 
     468          { 
     469            $incl = fread($fp, filesize($path)); 
     470            fclose($fp); 
     471          } 
    460472          return $this->parse_xml($incl); 
    461473        } 
     
    495507 
    496508        break; 
    497       } 
     509       
     510      // return variable 
     511      case 'var': 
     512        $var = explode(':', $attrib['name']); 
     513        $name = $var[1]; 
     514        $value = ''; 
     515         
     516        switch ($var[0]) 
     517        { 
     518          case 'env': 
     519            $value = $this->env[$name]; 
     520            break; 
     521          case 'config': 
     522            $value = $this->config[$name]; 
     523            if (is_array($value) && $value[$_SESSION['imap_host']]) 
     524              $value = $value[$_SESSION['imap_host']]; 
     525            break; 
     526          case 'request': 
     527            $value = get_input_value($name, RCUBE_INPUT_GPC); 
     528            break; 
     529          case 'session': 
     530            $value = $_SESSION[$name]; 
     531            break; 
     532        } 
     533         
     534        if (is_array($value)) 
     535          $value = join(", ", $value); 
     536         
     537        return Q($value); 
     538    } 
    498539 
    499540    return ''; 
     541  } 
     542 
     543 
     544  /** 
     545   * Include a specific file and return it's contents 
     546   * 
     547   * @param string File path 
     548   * @return string Contents of the processed file 
     549   */ 
     550  function include_php($file) 
     551  { 
     552    ob_start(); 
     553    @include($file); 
     554    $out = ob_get_contents(); 
     555    ob_end_clean(); 
     556     
     557    return $out; 
    500558  } 
    501559 
  • program/js/app.js

    r104ee38b r5eee009  
    29442944 
    29452945 
     2946  // write to the document/window title 
     2947  this.set_pagetitle = function(title) 
     2948  { 
     2949    if (title && document.title) 
     2950      document.title = title; 
     2951  } 
     2952 
     2953 
    29462954  // display a system message 
    29472955  this.display_message = function(msg, type, hold) 
     
    31303138      return false; 
    31313139 
    3132     if (mbox==this.env.mailbox) 
    3133       set_title = true; 
    3134  
    31353140    var reg, text_obj; 
    31363141    var item = this.get_folder_li(mbox); 
     
    31593164      { 
    31603165      var doc_title = String(document.title); 
     3166      var new_title = ""; 
    31613167 
    31623168      if (count && doc_title.match(reg)) 
    3163         document.title = doc_title.replace(reg, '('+count+') '); 
     3169        new_title = doc_title.replace(reg, '('+count+') '); 
    31643170      else if (count) 
    3165         document.title = '('+count+') '+doc_title; 
     3171        new_title = '('+count+') '+doc_title; 
    31663172      else 
    3167         document.title = doc_title.replace(reg, ''); 
     3173        new_title = doc_title.replace(reg, ''); 
     3174         
     3175      this.set_pagetitle(new_title); 
    31683176      } 
    31693177    }; 
     
    33193327    } 
    33203328 
    3321     this.set_busy(false); 
     3329    if (request_obj.__lock) 
     3330        this.set_busy(false); 
    33223331 
    33233332    console.log(request_obj.get_text()); 
     
    33823391 
    33833392    this.set_busy(true, 'checkingmail'); 
    3384     var d = new Date(); 
    3385     this.http_request('check-recent', '_t='+d.getTime()); 
     3393    this.http_request('check-recent', '_t='+(new Date().getTime()), true); 
    33863394    }; 
    33873395 
  • program/steps/mail/check_recent.inc

    rf115416 r5eee009  
    3232 
    3333      $OUTPUT->set_env('messagecount', $count); 
    34       $OUTPUT->command('set_unread_count', $mbox_name, $unread_count); 
     34      $OUTPUT->command('set_unread_count', $mbox_name, $unread_count, true); 
    3535      $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); 
    3636      $OUTPUT->command('set_quota', $IMAP->get_quota()); 
  • program/steps/mail/func.inc

    reb68420 r5eee009  
    7575if (!$OUTPUT->ajax_call) 
    7676  rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash'); 
     77 
     78// set page title 
     79if (empty($_action) || $_action == 'list') 
     80  $OUTPUT->set_pagetitle(rcube_charset_convert($IMAP->get_mailbox_name(), 'UTF-7')); 
    7781 
    7882 
     
    190194  // no messages in this mailbox 
    191195  if (!sizeof($a_headers)) 
    192     { 
    193     $out .= sprintf('<tr><td colspan="%d">%s</td></tr>', 
    194                     sizeof($a_show_cols)+2, 
    195                     Q(rcube_label('nomessagesfound'))); 
    196     } 
     196    $OUTPUT->show_message('nomessagesfound', 'notice'); 
    197197 
    198198 
  • program/steps/mail/list.inc

    r06895c3 r5eee009  
    5959if (isset($a_headers) && count($a_headers)) 
    6060  rcmail_js_message_list($a_headers); 
    61  
     61else 
     62  $OUTPUT->show_message('nomessagesfound', 'notice'); 
    6263   
    6364// send response 
  • program/steps/settings/func.inc

    r2ad77d2 r5eee009  
    2727                                  
    2828if ($USER_DATA = $DB->fetch_assoc($sql_result)) 
    29   $OUTPUT->set_pagetitle(sprintf('%s %s@%s', rcube_label('settingsfor'), $USER_DATA['username'], $USER_DATA['mail_host'])); 
     29{ 
     30  $username = $USER_DATA['username'] . (!strpos($USER_DATA['username'], '@') ? '@'.$USER_DATA['mail_host'] : ''); 
     31  $OUTPUT->set_pagetitle(sprintf('%s %s', rcube_label('settingsfor'), $username)); 
     32} 
    3033 
    3134 
Note: See TracChangeset for help on using the changeset viewer.