This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/setup/setup.inc.php
2011-05-03 09:49:01 +10:00

78 lines
2.1 KiB
PHP

<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* Originally authored by Tony Landis, AgileBill LLC
*
* Recent modifications by Deon George
*
* @author Deon George <deonATleenooksDOTnet>
* @copyright 2009 Deon George
* @link http://osb.leenooks.net
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @subpackage Modules:Setup
*/
/**
* The main AgileBill Setup Class
*
* @package AgileBill
* @subpackage Modules:Setup
*/
class setup extends OSB_module {
/**
* Update the Database with setup configuration
*/
public function update($VAR) {
if ($VAR['setup_currency_id'] != DEFAULT_CURRENCY)
$curr = true;
else
$curr = false;
foreach (array('setup_ssl_url','setup_nonssl_url') as $index) {
# Make sure the index.php file is not included at the end:
if (! empty($VAR[$index]))
$VAR[$index] = preg_replace('/index.php$/','',$VAR[$index]);
# Validate trailing slash is on the end of the URL:
if (! empty($VAR[$index]) && ! preg_match('#/$#',$VAR[$index]))
$VAR[$index] .= '/';
}
$result = parent::update($VAR);
# Start: Update all sessions & accounts
if ($result && $curr) {
$db = &DB();
$rs = $db->Execute(sqlUpdate($db,'session',array('currency_id'=>$VAR['setup_currency_id']),sprintf('currency_id !=',$VAR['setup_currency_id'])));
$rs = $db->Execute(sqlUpdate($db,'account',array('currency_id'=>$VAR['setup_currency_id']),sprintf('currency_id !=',$VAR['setup_currency_id'])));
}
# Clear out the cache entry
if (defined('AGILE_CORE_CACHE_DIR') && AGILE_CORE_CACHE_DIR != '') {
$tfile = AGILE_CORE_CACHE_DIR."core-setup";
if (file_exists($tfile))
unlink(AGILE_CORE_CACHE_DIR.'core-setup');
}
}
/**
* Call PHP Info
*/
public function _php_info() {
phpinfo();
}
}
?>