Initial Commit of AgileBill Open Source
This commit is contained in:
239
modules/host_registrar_plugin/host_registrar_plugin.inc.php
Normal file
239
modules/host_registrar_plugin/host_registrar_plugin.inc.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?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 host_registrar_plugin
|
||||
{
|
||||
|
||||
# Open the constructor for this mod
|
||||
function host_registrar_plugin()
|
||||
{
|
||||
# name of this module:
|
||||
$this->module = "host_registrar_plugin";
|
||||
|
||||
# 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"];
|
||||
}
|
||||
|
||||
##############################
|
||||
## ADD ##
|
||||
##############################
|
||||
function add($VAR)
|
||||
{
|
||||
$type = "add";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->add($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)
|
||||
{
|
||||
$type = "update";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->update($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## DELETE ##
|
||||
##############################
|
||||
function delete($VAR)
|
||||
{
|
||||
$db = new CORE_database;
|
||||
$db->mass_delete($VAR, $this, "");
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH FORM ##
|
||||
##############################
|
||||
function search_form($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_form($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH ##
|
||||
##############################
|
||||
function search($VAR)
|
||||
{
|
||||
|
||||
### Read the contents of the /plugins/affiliate directory:
|
||||
$count = 0;
|
||||
chdir(PATH_PLUGINS . 'registrar');
|
||||
$dir = opendir(PATH_PLUGINS . 'registrar');
|
||||
while ($file_name = readdir($dir))
|
||||
{
|
||||
if($file_name != '..' && $file_name != '.' && !eregi("^_", $file_name))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
# define the DB vars as a Smarty accessible block
|
||||
global $smarty;
|
||||
|
||||
# create the search record:
|
||||
if($count > 0)
|
||||
{
|
||||
# create the search record
|
||||
include_once(PATH_CORE . 'search.inc.php');
|
||||
$search = new CORE_search;
|
||||
$arr['module'] = $this->module;
|
||||
$arr['sql'] = '';
|
||||
$arr['limit'] = '999';
|
||||
$arr['order_by']= 'name';
|
||||
$arr['results'] = $count;
|
||||
$search->add($arr);
|
||||
|
||||
# define the search id and other parameters for Smarty
|
||||
$smarty->assign('search_id', $search->id);
|
||||
|
||||
# page:
|
||||
$smarty->assign('page', '1');
|
||||
|
||||
# limit:
|
||||
$smarty->assign('limit', '999');
|
||||
|
||||
# order_by:
|
||||
$smarty->assign('order_by', 'name');
|
||||
|
||||
# define the result count
|
||||
$smarty->assign('results', $count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## SEARCH SHOW ##
|
||||
##############################
|
||||
|
||||
function search_show($VAR)
|
||||
{
|
||||
|
||||
### Read the contents of the /plugins/db_mapping directory:
|
||||
$count = 0;
|
||||
chdir(PATH_PLUGINS . 'registrar');
|
||||
$dir = opendir(PATH_PLUGINS . 'registrar');
|
||||
while ($file_name = readdir($dir))
|
||||
{
|
||||
if($file_name != '..' && $file_name != '.' && !eregi("^_", $file_name) )
|
||||
{
|
||||
$result[$count]['name'] = eregi_replace('.php', '', $file_name);
|
||||
$result[$count]['id'] = $count;
|
||||
|
||||
### Get the status of this plugin:
|
||||
$db = &DB();
|
||||
$q = 'SELECT status,id FROM '.AGILE_DB_PREFIX.'host_registrar_plugin WHERE
|
||||
file = '. $db->qstr($result[$count]['name']) . ' AND
|
||||
site_id = '. $db->qstr(DEFAULT_SITE);
|
||||
$dbmap = $db->Execute($q);
|
||||
|
||||
### error reporting:
|
||||
if ($dbmap === false)
|
||||
{
|
||||
global $C_debug;
|
||||
$C_debug->error('affiliate_plugin.inc.php','search_show', $db->ErrorMsg()); return;
|
||||
}
|
||||
|
||||
if($dbmap->RecordCount() > 0)
|
||||
{
|
||||
$result[$count]['id'] = $dbmap->fields['id'];
|
||||
$result[$count]['status'] = 1;
|
||||
$result[$count]['active'] = $dbmap->fields['status'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result[$count]['status'] = 0;
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$class_name = TRUE;
|
||||
for ($i=0; $i<count($result); $i++)
|
||||
{
|
||||
$smart[$i] = $result[$i];
|
||||
if($class_name)
|
||||
{
|
||||
$smart[$i]['_C'] = 'row1';
|
||||
$class_name = FALSE;
|
||||
} else {
|
||||
$smart[$i]['_C'] = 'row2';
|
||||
$class_name = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# define the DB vars as a Smarty accessible block
|
||||
global $smarty;
|
||||
|
||||
# define the results
|
||||
$smarty->assign($this->table, $smart);
|
||||
$smarty->assign('page', $VAR['page']);
|
||||
$smarty->assign('order', $smarty_order);
|
||||
$smarty->assign('sort', $smarty_sort);
|
||||
$smarty->assign('limit', $search->limit);
|
||||
$smarty->assign('search_id',$search->id);
|
||||
$smarty->assign('results', $count);
|
||||
|
||||
# total pages
|
||||
$smarty->assign('pages', 1);
|
||||
|
||||
# current page
|
||||
$smarty->assign('page', 1);
|
||||
$page_arr = '';
|
||||
|
||||
# page array for menu
|
||||
$smarty->assign('page_arr', $page_arr);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<construct>
|
||||
<!-- define the module name -->
|
||||
<module>host_registrar_plugin</module>
|
||||
<!-- define the module table name -->
|
||||
<table>host_registrar_plugin</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>name</order_by>
|
||||
<!-- define the methods -->
|
||||
<limit>25</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>
|
||||
<status>
|
||||
<type>L</type>
|
||||
</status>
|
||||
<name>
|
||||
<type>C(32)</type>
|
||||
<unique>1</unique>
|
||||
<min_len>2</min_len>
|
||||
<max_len>32</max_len>
|
||||
<validate>any</validate>
|
||||
</name>
|
||||
<file>
|
||||
<type>C(32)</type>
|
||||
<unique>1</unique>
|
||||
<min_len>2</min_len>
|
||||
<max_len>32</max_len>
|
||||
<validate>any</validate>
|
||||
</file>
|
||||
<plugin_data>
|
||||
<type>X2</type>
|
||||
<convert>array</convert>
|
||||
</plugin_data>
|
||||
</field>
|
||||
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
|
||||
<method>
|
||||
<add>id,site_id,status,name,file,plugin_data</add>
|
||||
<update>id,site_id,status,name,file,plugin_data</update>
|
||||
<delete>id,site_id,status,name,file,plugin_data</delete>
|
||||
<view>id,site_id,status,name,file,plugin_data</view>
|
||||
<search>id,site_id,status,name,file,plugin_data</search>
|
||||
</method>
|
||||
<!-- define the method triggers -->
|
||||
<trigger>0</trigger>>
|
||||
</construct>
|
@@ -0,0 +1,35 @@
|
||||
<install>
|
||||
<module_properties>
|
||||
<name>host_registrar_plugin</name>
|
||||
<parent>host_server</parent>
|
||||
<notes><![CDATA[This module controls the settings for the registrar plugins]]></notes>
|
||||
<menu_display>1</menu_display>
|
||||
</module_properties>
|
||||
<sql_inserts>
|
||||
<module_method>
|
||||
<add>
|
||||
<name>add</name>
|
||||
</add>
|
||||
<update>
|
||||
<name>update</name>
|
||||
</update>
|
||||
<delete>
|
||||
<name>delete</name>
|
||||
</delete>
|
||||
<view>
|
||||
<name>view</name>
|
||||
<page><![CDATA[core:search&module=%%&_escape=1]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</view>
|
||||
<search>
|
||||
<name>search</name>
|
||||
</search>
|
||||
<search_form>
|
||||
<name>search_form</name>
|
||||
</search_form>
|
||||
<search_show>
|
||||
<name>search_show</name>
|
||||
</search_show>
|
||||
</module_method>
|
||||
</sql_inserts>
|
||||
</install>
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<install>
|
||||
<host_registrar_plugin>
|
||||
<id>1</id>
|
||||
<site_id>1</site_id>
|
||||
<status>1</status>
|
||||
<name>manual</name>
|
||||
<file>MANUAL</file>
|
||||
<plugin_data><![CDATA[a:1:{i:0;s:0:"";}]]></plugin_data>
|
||||
</host_registrar_plugin>
|
||||
<host_registrar_plugin_id>
|
||||
<id>2</id>
|
||||
</host_registrar_plugin_id>
|
||||
</install>
|
Reference in New Issue
Block a user