From a544971fe81e47bcf79bae66ef5ef5592bce12e8 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 24 Apr 2013 07:27:29 -0400
Subject: [PATCH] Fix error when using check_referer=true

---
 index.php |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/index.php b/index.php
index 0ad371a..5d52571 100644
--- a/index.php
+++ b/index.php
@@ -2,9 +2,9 @@
 /*
  +-------------------------------------------------------------------------+
  | Roundcube Webmail IMAP Client                                           |
- | Version 0.9-git                                                         |
+ | Version 1.0-git                                                         |
  |                                                                         |
- | Copyright (C) 2005-2012, The Roundcube Dev Team                         |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team                         |
  |                                                                         |
  | This program is free software: you can redistribute it and/or modify    |
  | it under the terms of the GNU General Public License (with exceptions   |
@@ -161,7 +161,7 @@
 }
 
 // end session (after optional referer check)
-else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcmail::check_referer())) {
+else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcube_utils::check_referer())) {
   $userdata = array(
     'user' => $_SESSION['username'],
     'host' => $_SESSION['storage_host'],
@@ -236,7 +236,7 @@
     }
 
     // check referer if configured
-    if ($RCMAIL->config->get('referer_check') && !rcmail::check_referer()) {
+    if ($RCMAIL->config->get('referer_check') && !rcube_utils::check_referer()) {
       raise_error(array(
         'code' => 403, 'type' => 'php',
         'message' => "Referer check failed"), true, true);
@@ -248,7 +248,6 @@
 $plugin = $RCMAIL->plugins->exec_hook('ready', array('task' => $RCMAIL->task, 'action' => $RCMAIL->action));
 $RCMAIL->set_task($plugin['task']);
 $RCMAIL->action = $plugin['action'];
-
 
 // handle special actions
 if ($RCMAIL->action == 'keep-alive') {
@@ -282,7 +281,8 @@
   else if (($stepfile = $RCMAIL->get_action_file())
     && is_file($incfile = INSTALL_PATH . 'program/steps/'.$RCMAIL->task.'/'.$stepfile)
   ) {
-    include $incfile;
+    // include action file only once (in case it don't exit)
+    include_once $incfile;
     $redirects++;
   }
   else {
@@ -290,6 +290,9 @@
   }
 }
 
+if ($RCMAIL->action == 'refresh') {
+  $RCMAIL->plugins->exec_hook('refresh', array());
+}
 
 // parse main template (default)
 $OUTPUT->send($RCMAIL->task);

--
Gitblit v1.9.1