3 commits - lib/kolab_api_controller.php lib/kolab_client_task.php lib/locale public_html/js

Aleksander Machniak machniak at kolabsys.com
Sat Jun 16 19:28:34 CEST 2012


 lib/kolab_api_controller.php  |    6 +++---
 lib/kolab_client_task.php     |   37 ++++++++++++++++++++++++++++++-------
 lib/locale/en_US.php          |    3 +++
 public_html/js/kolab_admin.js |    4 ++--
 4 files changed, 38 insertions(+), 12 deletions(-)

New commits:
commit d985ff4f32cf0ea469b719f0dbc84b7de2ecf91e
Merge: 8a403ad 33a7c6a
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Sat Jun 16 19:28:23 2012 +0200

    Merge branch 'master' of ssh://git.kolab.org/git/kolab-wap
    
    Conflicts:
    	lib/locale/en_US.php

diff --cc lib/locale/en_US.php
index 07e35bb,db04bef..564803b
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@@ -35,15 -95,28 +95,31 @@@ $LANG['search.uid'] = 'UID'
  $LANG['search.loading'] = 'Searching...';
  $LANG['search.acchars'] = 'At least $min characters required for autocompletion';
  
- $LANG['menu.users'] = 'Users';
- $LANG['menu.groups'] = 'Groups';
- $LANG['menu.about'] = 'About';
- $LANG['menu.kolab'] = 'Kolab';
- $LANG['menu.kolabsys'] = 'Kolab Systems';
- $LANG['menu.technology'] = 'Technology';
+ $LANG['servererror'] = 'Server Error!';
++
++$LANG['session.expired'] = 'Session has expired. Login again, please';
++
+ $LANG['submit.button'] = 'Submit';
  
  $LANG['user.add'] = 'Add User';
+ $LANG['user.add.success'] = 'User created successfully.';
+ $LANG['user.alias'] = 'Secondary Email Address(es)';
+ $LANG['user.astaccountallowedcodec'] = 'Allowed codec(s)';
+ $LANG['user.astaccountcallerid'] = 'Caller ID';
+ $LANG['user.astaccountcontext'] = 'Account Context';
+ $LANG['user.astaccountdeny'] = 'Account deny';
+ $LANG['user.astaccounthost'] = 'Asterisk Host';
+ $LANG['user.astaccountnat'] = 'Account uses NAT';
+ $LANG['user.astaccountname'] = 'Asterisk Account Name';
+ $LANG['user.astaccountqualify'] = 'Account Qualify';
+ $LANG['user.astaccountrealmedpassword'] = 'Realmed Account Password';
+ $LANG['user.astaccountsecret'] = 'Plaintext Password';
+ $LANG['user.astaccounttype'] = 'Account Type';
+ $LANG['user.astcontext'] = 'Asterisk Context';
+ $LANG['user.asterisk'] = 'Asterisk SIP';
+ $LANG['user.astextension'] = 'Asterisk Extension';
  $LANG['user.c'] = 'Country';
+ $LANG['user.city'] = 'City';
  $LANG['user.cn'] = 'Common name';
  $LANG['user.config'] = 'Configuration';
  $LANG['user.contact'] = 'Contact';


commit 8a403ad59ea258b38bddf128cc6c32576849d9a2
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Sat Jun 16 19:25:02 2012 +0200

    Implemented session timeout (client side) #695

diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 380e590..ab5b191 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -234,8 +234,17 @@ class kolab_client_task
             }
         }
         else if (!empty($_SESSION['user']) && !empty($_SESSION['user']['token'])) {
+            // Validate session
+            $timeout = $this->config_get('session_timeout', 3600);
+            if ($timeout && $_SESSION['time'] && $_SESSION['time'] < time() - $timeout) {
+                $this->action_logout(true);
+            }
+
+            // update session time
+            $_SESSION['time'] = time();
+
+            // Set API session key
             $this->api->set_session_token($_SESSION['user']['token']);
-            return;
         }
     }
 
@@ -295,7 +304,7 @@ class kolab_client_task
     /**
      * Logout action.
      */
-    private function action_logout()
+    private function action_logout($sess_expired = false)
     {
         if (!empty($_SESSION['user']) && !empty($_SESSION['user']['token'])) {
             $this->api->logout();
@@ -303,10 +312,24 @@ class kolab_client_task
         $_SESSION = array();
 
         if ($this->output->is_ajax()) {
-            $this->output->command('main_logout');
+            if ($sess_expired) {
+                $args = array('error' => 'session.expired');
+            }
+            $this->output->command('main_logout', $args);
+        }
+        else {
+            $this->output->add_translation('loginerror', 'internalerror', 'session.expired');
+        }
+
+        if ($sess_expired) {
+            $error = 'session.expired';
         }
         else {
-            $this->output->add_translation('loginerror', 'internalerror');
+            $error = $this->get_input('error', 'GET');
+        }
+
+        if ($error) {
+            $this->output->command('display_message', $error, 'error');
         }
 
         $this->output->send('login');
@@ -407,10 +430,10 @@ class kolab_client_task
         $label = $args[0];
 
         if (isset(self::$translation[$label])) {
-	        $content = trim(self::$translation[$label]);
+            $content = trim(self::$translation[$label]);
         }
-	    else {
-	        $content = $label;
+        else {
+            $content = $label;
         }
 
         for ($i = 1, $len = count($args); $i < $len; $i++) {
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 2e01478..07e35bb 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -13,6 +13,7 @@ $LANG['debug'] = 'Debug info';
 $LANG['info'] = 'Information';
 $LANG['creatorsname'] = 'Created by';
 $LANG['modifiersname'] = 'Modified by';
+$LANG['session.expired'] = 'Session has expired. Login again, please';
 
 $LANG['login.username'] = 'Username:';
 $LANG['login.password'] = 'Password:';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index f798a87..bc83cac 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1032,9 +1032,9 @@ function kolab_admin()
   /*********          Client commands              *********/
   /*********************************************************/
 
-  this.main_logout = function()
+  this.main_logout = function(params)
   {
-    location.href = '?task=main&action=logout';
+    location.href = '?task=main&action=logout' + (params ? '&' + $.param(params) : '');
     return false;
   };
 


commit 5041a6726f46bd430974b73d34ef5b76024ea6a0
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue May 8 18:26:17 2012 +0200

    Convert tabs to spaces

diff --git a/lib/kolab_api_controller.php b/lib/kolab_api_controller.php
index cfd984a..7831971 100644
--- a/lib/kolab_api_controller.php
+++ b/lib/kolab_api_controller.php
@@ -426,10 +426,10 @@ class kolab_api_controller
         $label = $args[0];
 
         if (isset(self::$translation[$label])) {
-	        $content = trim(self::$translation[$label]);
+            $content = trim(self::$translation[$label]);
         }
-	    else {
-	        $content = $label;
+        else {
+            $content = $label;
         }
 
         for ($i = 1, $len = count($args); $i < $len; $i++) {





More information about the commits mailing list