Source for file prepare.php
Documentation is available at prepare.php
* 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: prepare.php 141 2007-08-31 20:52:47Z m2mtech $
* @link http://www.ea-geier.at/
if (!isset ($_GET['what'])) exit;
chdir('../../'); // set root directory
* environment configuration
require_once('code/config.php');
require_once('code/base/db.class.php');
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'old test user deleted<br />';
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'test user deleted<br />';
if (!$db->isUser('test@ea-geier.at')) {
$db->createUser('test@ea-geier.at', 'testpass');
echo 'test user created<br />';
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'test user deleted<br />';
if (!$db->isUser('test@ea-geier.at')) {
$db->createUser('test@ea-geier.at', 'testpass');
echo 'test user created<br />';
$db->setPW('test@ea-geier.at', 'testpass');
echo 'password corrected<br />';
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'test user deleted<br />';
if (!$db->isUser('test@ea-geier.at')) {
$db->createUser('test@ea-geier.at', 'testpass');
echo 'test user created<br />';
$db->setPW('test@ea-geier.at', 'testpass');
echo 'password corrected<br />';
if (!$db->isUser('testdouble@ea-geier.at')) {
$db->createUser('testdouble@ea-geier.at', 'testpass');
echo 'double user created<br />';
if ($db->isUser('testnew@ea-geier.at')) {
$db->deleteUser('testnew@ea-geier.at');
echo 'new user deleted<br />';
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'test user deleted<br />';
if ($db->isUser('testdouble@ea-geier.at')) {
$db->deleteUser('testdouble@ea-geier.at');
echo 'double user deleted<br />';
if ($db->isUser('testnew@ea-geier.at')) {
$db->deleteUser('testnew@ea-geier.at');
echo 'new user deleted<br />';
case 'cashBookStart': case 'assetsStart': case 'purchaseBookStart':
case 'travelStart': case 'balanceStart':
if (!$db->isUser('test@ea-geier.at')) {
$db->createUser('test@ea-geier.at', 'testpass');
echo 'test user created<br />';
$db->setPW('test@ea-geier.at', 'testpass');
echo 'password corrected<br />';
case 'cashBookCreateClient': case 'assetsCreateClient':
case 'purchaseBookCreateClient': case 'travelCreateClient':
if (!$id = $db->isUser('test@ea-geier.at', 'id')) {
echo 'no user existis - will not create client';
$data['txtNewClientName'] = 'Test Client';
if (!$db->select('id', $db->table('clients'), array('owner' => $id))) {
$db->createClient($data, $user);
echo 'test client created<br />';
case 'balanceCreateClient':
if (!$id = $db->isUser('test@ea-geier.at', 'id')) {
echo 'no user existis - will not create client';
$data['txtNewClientName'] = 'Test Client';
if (!$db->select('id', $db->table('clients'), array('owner' => $id))) {
$db->createClient($data, $user, true);
echo 'test client created with demo data<br />';
case 'cashBookStop': case 'assetsStop': case 'purchaseBookStop':
case 'travelStop': case 'balanceStop':
if ($db->isUser('test@ea-geier.at')) {
$db->deleteUser('test@ea-geier.at');
echo 'test user deleted<br />';
require_once('code/base/mail.class.php');
if ($_GET['what'] == 'sendPWStart') {
// check if fake mail server is running
echo 'fake-mail server started';
} else echo 'fake-mail server already running<br />';
if ($_GET['what'] == 'sendPWStop') {
if (exec('ps ax | grep fakemail', $output)) {
foreach ($output as $line) {
$command = 'kill ' . $match[0];
echo 'fake-mail server stopped';
|