Initial Commit of AgileBill Open Source
This commit is contained in:
152
modules/setup/setup.inc.php
Normal file
152
modules/setup/setup.inc.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?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
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Agileco community forums at http://forum.agileco.com/
|
||||
*
|
||||
* @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
|
||||
* @version 1.4.93
|
||||
*/
|
||||
|
||||
class setup
|
||||
{
|
||||
|
||||
# Open the constructor for this mod
|
||||
function setup()
|
||||
{
|
||||
# name of this module:
|
||||
$this->module = "setup";
|
||||
|
||||
# location of the construct XML file:
|
||||
$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
|
||||
|
||||
# open the construct file for parsing
|
||||
$C_xml = new CORE_xml;
|
||||
$construct = $C_xml->xml_to_array($this->xml_construct);
|
||||
|
||||
$this->method = $construct["construct"]["method"];
|
||||
$this->trigger = $construct["construct"]["trigger"];
|
||||
$this->field = $construct["construct"]["field"];
|
||||
$this->table = $construct["construct"]["table"];
|
||||
$this->module = $construct["construct"]["module"];
|
||||
$this->cache = $construct["construct"]["cache"];
|
||||
$this->order_by = $construct["construct"]["order_by"];
|
||||
$this->limit = $construct["construct"]["limit"];
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH ##
|
||||
##############################
|
||||
|
||||
function search($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH SHOW ##
|
||||
##############################
|
||||
|
||||
function search_show($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_show($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## VIEW ##
|
||||
##############################
|
||||
|
||||
function view($VAR)
|
||||
{
|
||||
$type = "view";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->view($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## UPDATE ##
|
||||
##############################
|
||||
|
||||
function update($VAR)
|
||||
{
|
||||
if ($VAR['setup_currency_id'] != DEFAULT_CURRENCY)
|
||||
$curr = true;
|
||||
else
|
||||
$curr = false;
|
||||
|
||||
# make sure the index.php file is not included at the end:
|
||||
if(!empty($VAR['setup_ssl_url']))
|
||||
$VAR['setup_ssl_url'] = eregi_replace('index.php', '', $VAR['setup_ssl_url']);
|
||||
if(!empty($VAR['setup_nonssl_url']))
|
||||
$VAR['setup_nonssl_url'] = eregi_replace('index.php', '', $VAR['setup_nonssl_url']);
|
||||
|
||||
# Validate trailing slash is on the end of the URL:
|
||||
if(!empty($VAR['setup_ssl_url']) && !ereg('/$', $VAR['setup_ssl_url']))
|
||||
$VAR['setup_ssl_url'] .= '/';
|
||||
# Validate trailing slash is on the end of the URL:
|
||||
if(!empty($VAR['setup_nonssl_url']) && !ereg('/$', $VAR['setup_nonssl_url']))
|
||||
$VAR['setup_nonssl_url'] .= '/';
|
||||
|
||||
$type = "update";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$rs = $db->update($VAR, $this, $type);
|
||||
|
||||
if($rs && $curr)
|
||||
{
|
||||
/* Start: Update all sessions & accounts */
|
||||
$db = &DB();
|
||||
$sql = "UPDATE ".AGILE_DB_PREFIX."session
|
||||
SET
|
||||
currency_id = ".$db->qstr($VAR['setup_currency_id'])."
|
||||
WHERE
|
||||
site_id = ".$db->qstr(DEFAULT_SITE)." AND
|
||||
currency_id != ".$db->qstr($VAR['setup_currency_id']);
|
||||
$rs = $db->Execute($sql);
|
||||
|
||||
$sql = "UPDATE ".AGILE_DB_PREFIX."account
|
||||
SET
|
||||
currency_id = ".$db->qstr($VAR['setup_currency_id'])."
|
||||
WHERE
|
||||
site_id = ".$db->qstr(DEFAULT_SITE)." AND
|
||||
currency_id != ".$db->qstr($VAR['setup_currency_id']);
|
||||
$rs = $db->Execute($sql);
|
||||
/* End: SQL Insert Statement */
|
||||
}
|
||||
|
||||
# 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## PHP_INFO ##
|
||||
##############################
|
||||
|
||||
function _php_info() {
|
||||
phpinfo();
|
||||
}
|
||||
}
|
||||
?>
|
266
modules/setup/setup_construct.xml
Normal file
266
modules/setup/setup_construct.xml
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<construct>
|
||||
<!-- define the module name -->
|
||||
<module>setup</module>
|
||||
<!-- define the module table name -->
|
||||
<table>setup</table>
|
||||
<!-- define the module dependancy(s) -->
|
||||
<dependancy/>
|
||||
<!-- define the DB cache in seconds -->
|
||||
<cache>0</cache>
|
||||
<!-- define the default order_by field for SQL queries -->
|
||||
<order_by>site_id</order_by>
|
||||
<!-- define the methods -->
|
||||
<limit>10</limit>
|
||||
<!-- define the fields -->
|
||||
<field>
|
||||
<id>
|
||||
<type>I4</type>
|
||||
<unique>1</unique>
|
||||
<index>1</index>
|
||||
</id>
|
||||
<site_id>
|
||||
<type>I4</type>
|
||||
<unique>1</unique>
|
||||
<index>1</index>
|
||||
</site_id>
|
||||
<country_id>
|
||||
<type>I4</type>
|
||||
</country_id>
|
||||
<language_id>
|
||||
<type>C(16)</type>
|
||||
</language_id>
|
||||
<currency_id>
|
||||
<type>I4</type>
|
||||
</currency_id>
|
||||
<weight_id>
|
||||
<type>I4</type>
|
||||
</weight_id>
|
||||
<theme_id>
|
||||
<type>C(16)</type>
|
||||
<default>default</default>
|
||||
</theme_id>
|
||||
<admin_theme_id>
|
||||
<type>C(16)</type>
|
||||
<default>default_admin</default>
|
||||
</admin_theme_id>
|
||||
<group_id>
|
||||
<type>I4</type>
|
||||
<default>1</default>
|
||||
</group_id>
|
||||
<affiliate_template_id>
|
||||
<type>I4</type>
|
||||
</affiliate_template_id>
|
||||
<affiliate_id>
|
||||
<type>I4</type>
|
||||
</affiliate_id>
|
||||
<reseller_id>
|
||||
<type>I4</type>
|
||||
</reseller_id>
|
||||
<setup_email_id>
|
||||
<type>I4</type>
|
||||
</setup_email_id>
|
||||
<ssl_url>
|
||||
<type>X</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>255</max_len>
|
||||
<validate>any</validate>
|
||||
</ssl_url>
|
||||
<nonssl_url>
|
||||
<type>X</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>255</max_len>
|
||||
<validate>any</validate>
|
||||
</nonssl_url>
|
||||
<login_expire>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>999999</max_len>
|
||||
<validate>numeric</validate>
|
||||
</login_expire>
|
||||
<cookie_name>
|
||||
<type>C(32)</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>32</max_len>
|
||||
</cookie_name>
|
||||
<cookie_expire>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>999999</max_len>
|
||||
<validate>numeric</validate>
|
||||
</cookie_expire>
|
||||
<session_ip_match>
|
||||
<type>L</type>
|
||||
<default>0</default>
|
||||
</session_ip_match>
|
||||
<error_reporting>
|
||||
<type>C(16)</type>
|
||||
<default>0</default>
|
||||
</error_reporting>
|
||||
<site_name>
|
||||
<type>X</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>255</max_len>
|
||||
<validate>any</validate>
|
||||
</site_name>
|
||||
<site_email>
|
||||
<type>X</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>255</max_len>
|
||||
<validate>email</validate>
|
||||
</site_email>
|
||||
<time_format>
|
||||
<type>X</type>
|
||||
</time_format>
|
||||
<date_format>
|
||||
<type>X</type>
|
||||
<validate>any</validate>
|
||||
<convert>array</convert>
|
||||
</date_format>
|
||||
<date_time_format>
|
||||
<type>C(128)</type>
|
||||
<convert>array</convert>
|
||||
</date_time_format>
|
||||
<decimal_place>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>100</max_len>
|
||||
<validate>numeric</validate>
|
||||
</decimal_place>
|
||||
<debug>
|
||||
<type>L</type>
|
||||
</debug>
|
||||
<login_attempt_try>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>100000</max_len>
|
||||
<validate>numeric</validate>
|
||||
</login_attempt_try>
|
||||
<login_attempt_time>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>100000</max_len>
|
||||
<validate>numeric</validate>
|
||||
</login_attempt_time>
|
||||
<login_attempt_lock>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>100000000</max_len>
|
||||
<validate>numeric</validate>
|
||||
</login_attempt_lock>
|
||||
<search_expire>
|
||||
<type>I4</type>
|
||||
<min_len>1</min_len>
|
||||
<max_len>1000000000</max_len>
|
||||
<validate>numeric</validate>
|
||||
</search_expire>
|
||||
<db_cache>
|
||||
<type>L</type>
|
||||
</db_cache>
|
||||
<newsletter_registration>
|
||||
<type>L</type>
|
||||
</newsletter_registration>
|
||||
<default_account_status>
|
||||
<type>L</type>
|
||||
</default_account_status>
|
||||
<cache_sessions>
|
||||
<type>L</type>
|
||||
</cache_sessions>
|
||||
<weblog>
|
||||
<type>L</type>
|
||||
</weblog>
|
||||
<site_address>
|
||||
<type>C(128)</type>
|
||||
</site_address>
|
||||
<site_city>
|
||||
<type>C(32)</type>
|
||||
</site_city>
|
||||
<site_state>
|
||||
<type>C(16)</type>
|
||||
</site_state>
|
||||
<site_zip>
|
||||
<type>C(16)</type>
|
||||
</site_zip>
|
||||
<site_phone>
|
||||
<type>C(32)</type>
|
||||
</site_phone>
|
||||
<site_fax>
|
||||
<type>C(32)</type>
|
||||
</site_fax>
|
||||
<os>
|
||||
<type>L</type>
|
||||
</os>
|
||||
<auto_affiliate>
|
||||
<type>L</type>
|
||||
</auto_affiliate>
|
||||
<path_curl>
|
||||
<type>C(64)</type>
|
||||
</path_curl>
|
||||
<show_ticket_link>
|
||||
<type>L</type>
|
||||
</show_ticket_link>
|
||||
<show_affiliate_link>
|
||||
<type>L</type>
|
||||
</show_affiliate_link>
|
||||
<show_newsletter_link>
|
||||
<type>L</type>
|
||||
</show_newsletter_link>
|
||||
<show_domain_link>
|
||||
<type>L</type>
|
||||
</show_domain_link>
|
||||
<show_contact_link>
|
||||
<type>L</type>
|
||||
</show_contact_link>
|
||||
<show_cart_link>
|
||||
<type>L</type>
|
||||
</show_cart_link>
|
||||
<show_checkout_link>
|
||||
<type>L</type>
|
||||
</show_checkout_link>
|
||||
<show_product_link>
|
||||
<type>L</type>
|
||||
</show_product_link>
|
||||
<show_cat_block>
|
||||
<type>L</type>
|
||||
</show_cat_block>
|
||||
<show_file_block>
|
||||
<type>L</type>
|
||||
</show_file_block>
|
||||
<show_static_block>
|
||||
<type>L</type>
|
||||
</show_static_block>
|
||||
<show_affiliate_code>
|
||||
<type>L</type>
|
||||
</show_affiliate_code>
|
||||
<show_discount_code>
|
||||
<type>L</type>
|
||||
</show_discount_code>
|
||||
<billing_weekday>
|
||||
<type>C(2)</type>
|
||||
</billing_weekday>
|
||||
<grace_period>
|
||||
<type>C(2)</type>
|
||||
</grace_period>
|
||||
<max_billing_notice>
|
||||
<type>C(2)</type>
|
||||
</max_billing_notice>
|
||||
<max_inv_gen_period>
|
||||
<type>C(2)</type>
|
||||
</max_inv_gen_period>
|
||||
<license_key>
|
||||
<type>C(128)</type>
|
||||
</license_key>
|
||||
<license_code>
|
||||
<type>X2</type>
|
||||
</license_code>
|
||||
</field>
|
||||
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
|
||||
<method>
|
||||
<update>id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_ticket_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_product_link,show_file_block,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate</update>
|
||||
<view>id,db_cache,newsletter_registration,default_account_status,cache_sessions,site_id,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,affiliate_template_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,site_address,site_city,site_state,site_zip,site_phone,site_fax,os,path_curl,show_affiliate_link,show_ticket_link,show_newsletter_link,show_contact_link,show_domain_link,show_cart_link,show_checkout_link,show_cat_block,show_file_block,show_product_link,show_static_block,show_affiliate_code,show_discount_code,billing_weekday,grace_period,max_billing_notice,max_inv_gen_period,auto_affiliate</view>
|
||||
<search>id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,cookie_expire,affiliate_template_id,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,max_inv_gen_period</search>
|
||||
<search_show>id,site_id,newsletter_registration,setup_email_id,country_id,language_id,currency_id,weight_id,theme_id,group_id,affiliate_id,reseller_id,ssl_url,nonssl_url,login_expire,cookie_name,affiliate_template_id,cookie_expire,session_ip_match,error_reporting,site_name,site_email,time_format,date_format,date_time_format,decimal_place,debug,login_attempt_try,login_attempt_time,login_attempt_lock,search_expire,weblog,admin_theme_id,license_key,license_code,max_inv_gen_period</search_show>
|
||||
</method>
|
||||
<!-- define the method triggers -->
|
||||
<trigger>0</trigger>
|
||||
</construct>
|
31
modules/setup/setup_install.xml
Normal file
31
modules/setup/setup_install.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<install>
|
||||
<module_properties>
|
||||
<name>setup</name>
|
||||
<parent>setup</parent>
|
||||
<notes><![CDATA[Control the site setup]]></notes>
|
||||
<menu_display>1</menu_display>
|
||||
</module_properties>
|
||||
<sql_inserts>
|
||||
<module_method>
|
||||
<search>
|
||||
<name>search</name>
|
||||
</search>
|
||||
<view>
|
||||
<name>view</name>
|
||||
</view>
|
||||
<update>
|
||||
<name>update</name>
|
||||
<page><![CDATA[core:search&module=%%&_escape=1&_next_page_one=view]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</update>
|
||||
<search_show>
|
||||
<name>search_show</name>
|
||||
</search_show>
|
||||
<_php_info>
|
||||
<name>_php_info</name>
|
||||
<page><![CDATA[%%:_php_info&_escape=true]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</_php_info>
|
||||
</module_method>
|
||||
</sql_inserts>
|
||||
</install>
|
64
modules/setup/setup_install_data.xml
Normal file
64
modules/setup/setup_install_data.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<install>
|
||||
<setup>
|
||||
<id>1</id>
|
||||
<site_id>1</site_id>
|
||||
<country_id>840</country_id>
|
||||
<language_id>english</language_id>
|
||||
<currency_id>1</currency_id>
|
||||
<weight_id>1</weight_id>
|
||||
<theme_id>default</theme_id>
|
||||
<admin_theme_id>default_admin</admin_theme_id>
|
||||
<group_id>2</group_id>
|
||||
<affiliate_template_id>1</affiliate_template_id>
|
||||
<affiliate_id>0</affiliate_id>
|
||||
<reseller_id>0</reseller_id>
|
||||
<setup_email_id>1</setup_email_id>
|
||||
<ssl_url></ssl_url>
|
||||
<nonssl_url></nonssl_url>
|
||||
<login_expire>86400</login_expire>
|
||||
<cookie_name>CookieName</cookie_name>
|
||||
<cookie_expire>0</cookie_expire>
|
||||
<session_ip_match>0</session_ip_match>
|
||||
<error_reporting>E_ALL</error_reporting>
|
||||
<site_name>Company.com</site_name>
|
||||
<site_email>sales@company.com</site_email>
|
||||
<time_format>g:i A</time_format>
|
||||
<date_format><![CDATA[a:4:{i:0;s:1:"m";i:1;s:1:"d";i:2;s:1:"Y";i:3;s:1:"-";}]]></date_format>
|
||||
<date_time_format><![CDATA[a:1:{i:0;s:0:"";}]]></date_time_format>
|
||||
<decimal_place>2</decimal_place>
|
||||
<debug>0</debug>
|
||||
<login_attempt_try>10</login_attempt_try>
|
||||
<login_attempt_time>60</login_attempt_time>
|
||||
<login_attempt_lock>60</login_attempt_lock>
|
||||
<search_expire>600</search_expire>
|
||||
<db_cache>0</db_cache>
|
||||
<newsletter_registration>1</newsletter_registration>
|
||||
<default_account_status>0</default_account_status>
|
||||
<cache_sessions>1</cache_sessions>
|
||||
<weblog>0</weblog>
|
||||
<os>0</os>
|
||||
<show_ticket_link>0</show_ticket_link>
|
||||
<show_affiliate_link>0</show_affiliate_link>
|
||||
<show_newsletter_link>1</show_newsletter_link>
|
||||
<show_domain_link>0</show_domain_link>
|
||||
<show_contact_link>1</show_contact_link>
|
||||
<show_cart_link>1</show_cart_link>
|
||||
<show_checkout_link>1</show_checkout_link>
|
||||
<show_product_link>1</show_product_link>
|
||||
<show_cat_block>1</show_cat_block>
|
||||
<show_file_block>0</show_file_block>
|
||||
<show_static_block>0</show_static_block>
|
||||
<show_affiliate_code>0</show_affiliate_code>
|
||||
<show_discount_code>1</show_discount_code>
|
||||
<billing_weekday>1</billing_weekday>
|
||||
<grace_period>3</grace_period>
|
||||
<max_billing_notice>3</max_billing_notice>
|
||||
<max_inv_gen_period>7</max_inv_gen_period>
|
||||
<license_key>63689401-9161-10043421</license_key>
|
||||
<auto_affiliate>0</auto_affiliate>
|
||||
</setup>
|
||||
<setup_id>
|
||||
<id>2</id>
|
||||
</setup_id>
|
||||
</install>
|
Reference in New Issue
Block a user