Source for file index.inc.php
Documentation is available at index.inc.php
* state machine for main file
* 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.
* 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.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author m2mtech <tech@m2m.at>
* @copyright 2007 m2m server software gmbh
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
* @version $Id: index.inc.php 150 2007-09-09 10:22:44Z m2mtech $
* @link http://www.ea-geier.at/
require_once('code/base/db.class.php');
require_once('code/base/input.class.php');
* @param array configuration data
* @return array output data
if (isset ($conf['notInstalled']) && $conf['notInstalled']) {
require_once('code/base/install.inc.php');
if ($db->error()) die('database problem');
$vars = array('g:abc:state', 'p:txt:pass', 'p:mail:mail');
if ($dummy = $in->get('state')) $state = $dummy;
if ($dummy = $in->post('state')) $state = $dummy;
$user = $db->checkLogin($in);
$lang = $in->getGet('lang-', 'abc');
if (!$lang && isset ($_SESSION['language'])) $lang = $_SESSION['language'];
if ($lang) $_SESSION['language'] = $lang;
if (!$lang && $user && isset ($conf['abcLanguage']))
$lang = $conf['abcLanguage'];
if (isset ($user['mail']) && ($user['mail'] == eaSYSADMIN))
if (!isset ($conf['txtVersion']) || ($conf['txtVersion'] != eaVERSION)) {
require_once('code/base/install.inc.php');
if ($user) $db->getClients($in);
if (!$user) { $state = 'login'; break; }
require_once('code/cashbook.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/cashbook.inc.php');
case 'cashbookprint': case 'cashbookcsv':
require_once('code/cashbook.inc.php');
case 'cashbookitemprint': case 'cashbookitemcsv':
require_once('code/cashbook.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/assets.inc.php');
case 'assetsprint': case 'assetscsv':
require_once('code/assets.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/assets.inc.php');
case 'assetsitemprint': case 'assetsitemcsv':
require_once('code/assets.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/purchasebook.inc.php');
$state = 'purchasebookitem';
case 'purchasebookprint': case 'purchasebookcsv':
require_once('code/purchasebook.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/purchasebook.inc.php');
case 'purchasebookitemprint': case 'purchasebookitemcsv':
require_once('code/purchasebook.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/travel.inc.php');
case 'travelprint': case 'travelcsv':
require_once('code/travel.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/travel.inc.php');
case 'travelitemprint': case 'travelitemcsv':
require_once('code/travel.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/balance.inc.php');
if (saveBalance($db, $in)) $in->options['itemsaved'] = true;
case 'balanceprint': case 'balancecsv':
require_once('code/balance.inc.php');
if (!$user) { // not logged in;
if (!isset ($_POST['buttonLogin'])) break;
$in->error['mailLogin'] = true;
$in->error['passLogin'] = true;
require_once('code/main.inc.php');
require_once('code/base/newuser.inc.php');
require_once('code/base/sendpw.inc.php');
if (sendPW($db, $in)) $state = 'pwsent';
case 'configuration': case 'userconfig':
if (!$user) { $state = 'login'; break; }
require_once('code/base/config.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/base/config.inc.php');
if (!$user) { $state = 'login'; break; }
require_once('code/base/config.inc.php');
if (saveNewClient($db, $in)) $in->options['newclientsaved'] = true;
if (!$user) $state = 'login';
require_once('code/main.inc.php');
$in->get['state'] = $state;
|