2008-11-26 22:50:40 +00:00
|
|
|
<?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
|
2008-11-26 22:50:40 +00:00
|
|
|
*
|
|
|
|
* @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>
|
2008-11-26 22:50:40 +00:00
|
|
|
* @package AgileBill
|
2009-08-03 04:10:16 +00:00
|
|
|
* @subpackage Modules:Setup
|
2008-11-26 22:50:40 +00:00
|
|
|
*/
|
|
|
|
|
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) {
|
2008-11-26 22:50:40 +00:00
|
|
|
if ($VAR['setup_currency_id'] != DEFAULT_CURRENCY)
|
|
|
|
$curr = true;
|
|
|
|
else
|
2009-08-03 04:10:16 +00:00
|
|
|
$curr = false;
|
2008-11-26 22:50:40 +00:00
|
|
|
|
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]);
|
2008-11-26 22:50:40 +00:00
|
|
|
|
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] .= '/';
|
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
$result = parent::update($VAR);
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Start: Update all sessions & accounts
|
|
|
|
if ($result && $curr) {
|
2008-11-26 22:50:40 +00:00
|
|
|
$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'])));
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Clear out the cache entry
|
2009-08-03 04:10:16 +00:00
|
|
|
if (defined('AGILE_CORE_CACHE_DIR') && AGILE_CORE_CACHE_DIR != '') {
|
2008-11-26 22:50:40 +00:00
|
|
|
$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');
|
2008-11-26 22:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
/**
|
|
|
|
* Call PHP Info
|
|
|
|
*/
|
|
|
|
public function _php_info() {
|
2008-11-26 22:50:40 +00:00
|
|
|
phpinfo();
|
|
|
|
}
|
|
|
|
}
|
2009-08-03 04:10:16 +00:00
|
|
|
?>
|