[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10831] mobilefrontend : New login
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10831] mobilefrontend : New login |
Date: |
Thu, 14 Feb 2013 12:47:54 +0000 |
Revision: 10831
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10831
Author: sigurdne
Date: 2013-02-14 12:47:54 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
mobilefrontend : New login
Modified Paths:
--------------
trunk/mobilefrontend/home.php
trunk/mobilefrontend/index.php
Added Paths:
-----------
trunk/mobilefrontend/login.php
trunk/mobilefrontend/logout.php
Modified: trunk/mobilefrontend/home.php
===================================================================
--- trunk/mobilefrontend/home.php 2013-02-14 12:47:05 UTC (rev 10830)
+++ trunk/mobilefrontend/home.php 2013-02-14 12:47:54 UTC (rev 10831)
@@ -17,12 +17,13 @@
$GLOBALS['phpgw_info']['flags'] = array
(
- 'noheader' => true,
- 'nonavbar' => false,
- 'currentapp' => 'home',
- 'enable_network_class' => true,
- 'enable_contacts_class' => true,
- 'enable_nextmatchs_class' => true
+ 'noheader' => true,
+ 'nonavbar' => false,
+ 'currentapp' => 'home',
+ 'enable_network_class' => true,
+ 'enable_contacts_class' => true,
+ 'enable_nextmatchs_class' => true,
+ 'template_set' => 'mobilefrontend'
);
/**
Modified: trunk/mobilefrontend/index.php
===================================================================
--- trunk/mobilefrontend/index.php 2013-02-14 12:47:05 UTC (rev 10830)
+++ trunk/mobilefrontend/index.php 2013-02-14 12:47:54 UTC (rev 10831)
@@ -1,193 +1,94 @@
<?php
/**
- * phpGroupWare - property: a Facilities Management System.
+ * phpGroupWare
*
- * @author Jonas Borgström address@hidden
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2009 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
+ * @author Dave Hall <address@hidden>
+ * @author Others <unknown>
+ * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @version $Id$
+ * @package phpgroupware
+ * @version $Id$
*/
- /**
- * Start page
- *
- * This script will check if there is defined a startpage in the users
- * preferences - and then forward the user to this page
- */
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- $GLOBALS['phpgw_info']['flags'] = array
- (
- 'noheader' => true,
- 'nonavbar' => true,
- 'currentapp' => 'login', // To stop functions.inc.php from
validating the session
- );
- $GLOBALS['phpgw_info']['flags']['session_name'] =
'mobilefrontendsession';
- $GLOBALS['phpgw_remote_user_fallback'] = 'sql';
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- include_once('../header.inc.php');
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
- $GLOBALS['phpgw_info']['server']['template_set'] = 'mobilefrontend';
-
- // Make sure we're always logged in
- if (!phpgw::get_var(session_name()) ||
!$GLOBALS['phpgw']->session->verify())
+ $phpgw_info = array();
+ if (!file_exists('../header.inc.php'))
{
- $login = "bookingguest";
- $passwd = "bkbooking";
- $_POST['submitit'] = "";
-
- $GLOBALS['sessionid'] =
$GLOBALS['phpgw']->session->create($login, $passwd);
- if(!$GLOBALS['sessionid'])
- {
- $lang_denied = lang('Anonymous access not correctly
configured');
- if($GLOBALS['phpgw']->session->reason)
- {
- $lang_denied =
$GLOBALS['phpgw']->session->reason;
- }
- echo <<<HTML
- <div class="error">$lang_denied</div>
-HTML;
- $GLOBALS['phpgw']->common->phpgw_exit(True);
- }
+ echo 'Not installed correctly';
+ exit;
}
- $GLOBALS['phpgw_info']['flags']['currentapp'] = 'mobilefrontend';
-/////////////////////////////////////////////////////////////////////////////
-// BEGIN Stuff copied from functions.inc.php
-/////////////////////////////////////////////////////////////////////////////
+ /**
+ * @global string $GLOBALS['sessionid']
+ */
+ $GLOBALS['sessionid'] = isset($_REQUEST['sessionid'])?
$_REQUEST['sessionid'] : '';
-
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
+ $invalid_data = false;
+ // This is the preliminary menuaction driver for the new multi-layered
design
+ if (isset($_GET['menuaction']) || isset($_POST['menuaction']))
+ {
+ if(isset($_GET['menuaction']))
{
-
$GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],
true);
+ list($app,$class,$method) =
explode('.',$_GET['menuaction']);
}
-
- /* A few hacker resistant constants that will be used throught
the program */
- define('PHPGW_TEMPLATE_DIR',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
- define('PHPGW_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
- define('PHPGW_IMAGES_FILEDIR',
ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
- define('PHPGW_APP_ROOT',
ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
- define('PHPGW_APP_INC',
ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
- define('PHPGW_APP_TPL',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
- define('PHPGW_IMAGES',
ExecMethod('phpgwapi.phpgw.common.get_image_path'));
- define('PHPGW_APP_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
-
-
/************************************************************************\
- * Load the menuaction
*
-
\************************************************************************/
- $GLOBALS['phpgw_info']['menuaction'] =
phpgw::get_var('menuaction');
- if(!$GLOBALS['phpgw_info']['menuaction'])
+ else
{
- unset($GLOBALS['phpgw_info']['menuaction']);
+ list($app,$class,$method) =
explode('.',$_POST['menuaction']);
}
-
- /********* This sets the user variables *********/
- $GLOBALS['phpgw_info']['user']['private_dir'] =
$GLOBALS['phpgw_info']['server']['files_dir']
- . '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
-
- /* This will make sure that a user has the basic default prefs.
If not it will add them */
- $GLOBALS['phpgw']->preferences->verify_basic_settings();
-
- /********* Optional classes, which can be disabled for
performance increases *********/
- while ($phpgw_class_name =
each($GLOBALS['phpgw_info']['flags']))
+ if (! $app || ! $class || ! $method)
{
- if (ereg('enable_', $phpgw_class_name[0]))
- {
- $enable_class = str_replace('enable_', '',
$phpgw_class_name[0]);
- $enable_class = str_replace('_class', '',
$enable_class);
- $GLOBALS['phpgw']->$enable_class =
createObject("phpgwapi.{$enable_class}");
- }
+ $invalid_data = true;
}
- unset($enable_class);
- reset($GLOBALS['phpgw_info']['flags']);
+ }
+ else
+ {
+ $app = 'home';
+ $invalid_data = true;
+ }
-
/*************************************************************************\
- * These lines load up the templates class
*
-
\*************************************************************************/
- if (
!isset($GLOBALS['phpgw_info']['flags']['disable_Template_class'])
- ||
!$GLOBALS['phpgw_info']['flags']['disable_Template_class'] )
- {
- $GLOBALS['phpgw']->template =
createObject('phpgwapi.Template',PHPGW_APP_TPL);
- $GLOBALS['phpgw']->xslttpl =
createObject('phpgwapi.xslttemplates',PHPGW_APP_TPL);
- }
+ $api_requested = false;
+ if ($app == 'phpgwapi')
+ {
+ $app = 'home';
+ $api_requested = true;
+ }
-
/*************************************************************************\
- * Verify that the users session is still active otherwise kick
them out *
-
\*************************************************************************/
- if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
- {
- if (!$GLOBALS['phpgw']->acl->check('run',
PHPGW_ACL_READ, $GLOBALS['phpgw_info']['flags']['currentapp']))
- {
- $GLOBALS['phpgw']->common->phpgw_header(true);
-
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
+ $GLOBALS['phpgw_info']['flags'] = array
+ (
+ 'noheader' => true,
+ 'currentapp' => $app,
+ 'template_set'=> 'mobilefrontend'
+ );
+
+ /**
+ * Include phpgroupware header
+ */
+ $GLOBALS['phpgw_info']['server']['template_set'] = 'mobilefrontend';
- $lang_denied = lang('Access not permitted');
- echo <<<HTML
- <div class="error">$lang_denied</div>
+ require_once('../header.inc.php');
-HTML;
- $GLOBALS['phpgw']->common->phpgw_exit(True);
- }
- }
-
- // Already called from sessions::verify
- // $GLOBALS['phpgw']->applications->read_installed_apps(); // to
get translated app-titles
-
-
/*************************************************************************\
- * Load the header unless the developer turns it off
*
-
\*************************************************************************/
- if ( !isset($GLOBALS['phpgw_info']['flags']['noheader']) ||
!$GLOBALS['phpgw_info']['flags']['noheader'] )
- {
- $inc_navbar =
!isset($GLOBALS['phpgw_info']['flags']['nonavbar']) ||
!$GLOBALS['phpgw_info']['flags']['nonavbar'];
- $GLOBALS['phpgw']->common->phpgw_header($inc_navbar);
- unset($inc_navbar);
- }
-
-
/*************************************************************************\
- * Load the app include files if the exists
*
-
\*************************************************************************/
- /* Then the include file */
- if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) &&
file_exists(PHPGW_APP_INC . '/functions.inc.php') &&
!isset($GLOBALS['phpgw_info']['menuaction']))
- {
- include_once(PHPGW_APP_INC . '/functions.inc.php');
- }
- if (address@hidden'phpgw_info']['flags']['noheader'] &&
- address@hidden'phpgw_info']['flags']['noappheader'] &&
- file_exists(PHPGW_APP_INC . '/header.inc.php') &&
!isset($GLOBALS['phpgw_info']['menuaction']))
- {
- include_once(PHPGW_APP_INC . '/header.inc.php');
- }
-
-/////////////////////////////////////////////////////////////////////////////
-// END Stuff copied from functions.inc.php
-/////////////////////////////////////////////////////////////////////////////
-
- if (isset($_GET['menuaction']))
+ if ($app == 'home' && ! $api_requested)
{
- list($app,$class,$method) = explode('.',$_GET['menuaction']);
+ $GLOBALS['phpgw']->redirect_link('/mobilefrontend/home.php');
}
- else
+
+ if ($api_requested)
{
- $app = 'mobilefrontend';
- $class = 'uifront';
- $method = 'index';
+ $app = 'phpgwapi';
}
if(is_file(PHPGW_SERVER_ROOT.
"/mobilefrontend/inc/class.{$class}.inc.php"))
@@ -201,7 +102,6 @@
$GLOBALS[$class] = new $_class;
}
- $invalid_data = false; //FIXME consider whether this should be computed
as in the main index.php
if ( !$invalid_data
&& is_object($GLOBALS[$class])
&& isset($GLOBALS[$class]->public_functions)
@@ -219,11 +119,55 @@
$return_data = $GLOBALS[$class]->$method();
echo json_encode($return_data);
$GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+ //If debug info is not triggered elsewhere.
+ if
(isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && DEBUG_TIMER &&
!phpgwapi_cache::session_get($app,'id_debug'))
+ {
+ $debug_timer_stop = perfgetmicrotime();
+ //BTW: wil not destroy the json output - click
on the 'Debug-link' to view message
+ _debug_array(lang('page prepared in %1
seconds.', $debug_timer_stop - $GLOBALS['debug_timer_start'] ));
+ }
+
$GLOBALS['phpgw']->common->phpgw_exit();
}
else
{
- $GLOBALS[$class]->$method();
- $GLOBALS['phpgw']->common->phpgw_footer();
+ $GLOBALS[$class]->$method();
}
+ unset($app);
+ unset($class);
+ unset($method);
+ unset($invalid_data);
+ unset($api_requested);
}
+ else
+ {
+ //FIXME make this handle invalid data better
+ if (! $app || ! $class || ! $method)
+ {
+ $GLOBALS['phpgw']->log->message(array(
+ 'text' => 'W-BadmenuactionVariable, menuaction
missing or corrupt: %1',
+ 'p1' => $menuaction,
+ 'line' => __LINE__,
+ 'file' => __FILE__
+ ));
+ }
+
+ if ( ( !isset($GLOBALS[$class]->public_functions)
+ || !is_array($GLOBALS[$class]->public_functions)
+ || !isset($GLOBALS[$class]->public_functions[$method])
+ || !$GLOBALS[$class]->public_functions[$method] )
+ && $method)
+ {
+ $GLOBALS['phpgw']->log->message(array(
+ 'text' => 'W-BadmenuactionVariable, attempted
to access private method: %1',
+ 'p1' => $method,
+ 'line' => __LINE__,
+ 'file' => __FILE__
+ ));
+ }
+ $GLOBALS['phpgw']->log->commit();
+
+ $GLOBALS['phpgw']->redirect_link('/home.php');
+ }
+ $GLOBALS['phpgw']->common->phpgw_footer();
Added: trunk/mobilefrontend/login.php
===================================================================
--- trunk/mobilefrontend/login.php (rev 0)
+++ trunk/mobilefrontend/login.php 2013-02-14 12:47:54 UTC (rev 10831)
@@ -0,0 +1,18 @@
+<?php
+
+ /**
+ * phpGroupWare
+ *
+ * phpgroupware base
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2013 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package phpgroupware
+ * @version $Id: login.php 9960 2012-09-02 18:56:26Z sigurdne $
+ */
+
+ require_once '../phpgwapi/inc/class.login.inc.php';
+
+ $phpgwlogin = new phpgwapi_login;
+ $phpgwlogin->login('mobilefrontend');
+
Added: trunk/mobilefrontend/logout.php
===================================================================
--- trunk/mobilefrontend/logout.php (rev 0)
+++ trunk/mobilefrontend/logout.php 2013-02-14 12:47:54 UTC (rev 10831)
@@ -0,0 +1,70 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * phpgroupware base
+ * @author Joseph Engo <address@hidden>
+ * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package phpgroupware
+ * @version $Id: logout.php 6669 2010-12-11 22:27:07Z sigurdne $
+ */
+
+ $GLOBALS['phpgw_info'] = array();
+
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'disable_template_class' => True,
+ 'currentapp' => 'logout',
+ 'noheader' => True,
+ 'nofooter' => True,
+ 'nonavbar' => True
+ );
+
+ /**
+ * Include phpgroupware header
+ */
+ include_once('../header.inc.php');
+
+ $sessionid = phpgw::get_var('sessionphpgwsessid');
+
+ $verified = $GLOBALS['phpgw']->session->verify();
+ if ($verified)
+ {
+ if (
is_dir("{$GLOBALS['phpgw_info']['server']['temp_dir']}/{$sessionid}") &&
!empty($session_id) )
+ {
+ $dh =
dir("{$GLOBALS['phpgw_info']['server']['temp_dir']}/{$sessionid}");
+ while ( ($file = $dh->read()) !== false )
+ {
+ if ( $file == '.' || $file == '..' )
+ {
+ continue;
+ }
+
unlink("{$GLOBALS['phpgw_info']['server']['temp_dir']}/{$sessionid}/{$file}");
+ }
+
rmdir("{$GLOBALS['phpgw_info']['server']['temp_dir']}/{$sessionid}");
+ $dh->close();
+ }
+// execMethod('phpgwapi.menu.clear'); // moved to hook for login
+ $GLOBALS['phpgw']->hooks->process('logout');
+ $GLOBALS['phpgw']->session->destroy($sessionid);
+ }
+ else
+ {
+ if(is_object($GLOBALS['phpgw']->log))
+ {
+ $GLOBALS['phpgw']->log->write(array(
+ 'text' => 'W-VerifySession, could not verify
session during logout',
+ 'line' => __LINE__,
+ 'file' => __FILE__
+ ));
+ }
+ }
+
+ if ( isset($GLOBALS['phpgw_info']['server']['usecookies'])
+ && $GLOBALS['phpgw_info']['server']['usecookies'] )
+ {
+
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionphpgwsessid');
+ $GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+ }
+
+ $GLOBALS['phpgw']->redirect_link('mobilefrontend/login.php', array('cd'
=> 1, 'logout' => true));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10831] mobilefrontend : New login,
Sigurd Nes <=