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

78 lines
2.1 KiB
PHP
Raw Normal View History

<?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
2009-08-03 04:10:16 +00:00
*
* 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
2009-08-03 04:10:16 +00:00
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
2009-08-03 04:10:16 +00:00
* @subpackage Modules:Setup
*/
2009-08-03 04:10:16 +00:00
/**
* 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
2009-08-03 04:10:16 +00:00
$curr = false;
2009-08-03 04:10:16 +00:00
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]);
2009-08-03 04:10:16 +00:00
# Validate trailing slash is on the end of the URL:
if (! empty($VAR[$index]) && ! preg_match('#/$#',$VAR[$index]))
$VAR[$index] .= '/';
}
2009-08-03 04:10:16 +00:00
$result = parent::update($VAR);
2009-08-03 04:10:16 +00:00
# Start: Update all sessions & accounts
if ($result && $curr) {
$db = &DB();
2009-08-03 04:10:16 +00:00
$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
2009-08-03 04:10:16 +00:00
if (defined('AGILE_CORE_CACHE_DIR') && AGILE_CORE_CACHE_DIR != '') {
$tfile = AGILE_CORE_CACHE_DIR."core-setup";
2009-08-03 04:10:16 +00:00
if (file_exists($tfile))
unlink(AGILE_CORE_CACHE_DIR.'core-setup');
}
}
2009-08-03 04:10:16 +00:00
/**
* Call PHP Info
*/
public function _php_info() {
phpinfo();
}
}
2009-08-03 04:10:16 +00:00
?>