Initial Commit of AgileBill Open Source

This commit is contained in:
unknown
2008-11-26 14:50:40 -08:00
parent ae5a0fc25e
commit 02306ccc47
2954 changed files with 410976 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<?php
### public methods for this module:
$auth_methods = Array
(
Array ('module' => 'voip_fax', 'method' => 'user_search_show'),
Array ('module' => 'voip_fax', 'method' => 'user_search'),
Array ('module' => 'voip_fax', 'method' => 'user_view'),
Array ('module' => 'voip_fax', 'method' => 'user_delete')
);
?>

View File

@@ -0,0 +1,192 @@
<?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> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
* @package AgileBill
* @version 1.4.93
*/
class voip_fax
{
var $did;
# Open the constructor for this mod
function voip_fax()
{
# name of this module:
$this->module = "voip_fax";
# 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"];
}
function user_view($VAR) {
if(SESS_LOGGED) {
$this->did = @$VAR['id'];
$db = &DB();
$rs = & $db->Execute(sqlSelect($db,"voip_fax","account_id","id = ::$this->did::"));
if($rs->fields['account_id'] == SESS_ACCOUNT) {
$this->view($VAR,$this);
}
}
echo "Not logged in or authenticated!";
}
function user_delete($VAR) {
if(SESS_LOGGED) {
$this->did = @$VAR['id'];
$db = &DB();
$rs = & $db->Execute(sqlSelect($db,"voip_fax","account_id","id = ::$this->did::"));
if($rs->fields['account_id'] == SESS_ACCOUNT) {
$this->delete($VAR,$this);
}
}
}
function user_search_show($VAR) {
$this->search_show($VAR,$this);
}
function user_search($VAR) {
if(SESS_LOGGED) {
include_once(PATH_MODULES."voip/voip.inc.php");
$db =& DB();
$v = new voip;
$fdids = $v->get_fax_dids(SESS_ACCOUNT);
#echo "<pre>".print_r($fdids,true)."</pre>";
if (is_array($fdids)) {
foreach ($fdids as $did) {
$flds['account_id'] = SESS_ACCOUNT;
$flds['site_id'] = DEFAULT_SITE;
$sql = sqlUpdate($db, "voip_fax", $flds, "dst = ::".$did."::");
$db->Execute($sql);
#echo $sql."<br>";
}
}
unset($db);
$VAR['voip_fax_account_id'] = SESS_ACCOUNT;
$type = "search";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->search($VAR, $this, $type);
} else {
define("FORCE_REDIRECT", "?_page=account:account");
}
}
function view($VAR) {
global $_SERVER;
ob_clean();
ob_start();
$this->did = @$VAR['id'];
$db = &DB();
$rs = & $db->Execute(sqlSelect($db,"voip_fax","mime_type","id = ::$this->did::"));
if ($rs && $rs->RecordCount()==1)
{
$this->mime_type = $rs->fields['mime_type'];
$fax = & $db->Execute(sqlSelect($db,"voip_fax_data","faxdata","fax_id = ::$this->did::"));
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
ini_set('zlib.output_compression','Off');
}
header("Content-Type: ". $this->mime_type );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Disposition: attachment; filename=\"fax.pdf\"");
while(!$fax->EOF) {
echo $fax->fields['faxdata'];
$fax->MoveNext();
}
}
ob_end_flush();
exit();
}
function add($VAR) {
$type = "add";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->add($VAR, $this, $type);
}
function update($VAR) {
// delete assoc faxdata records
$this->associated_DELETE[] = Array( 'table' => 'voip_fax_data', 'field' => 'fax_id');
$type = "update";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->update($VAR, $this, $type);
}
function delete($VAR) {
$db = new CORE_database;
$db->mass_delete($VAR, $this, "");
}
function search_form($VAR) {
$type = "search";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_form($VAR, $this, $type);
}
function search($VAR) {
$type = "search";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->search($VAR, $this, $type);
}
function search_show($VAR) {
if(SESS_LOGGED) {
include_once(PATH_MODULES."voip/voip.inc.php");
$db =& DB();
$v = new voip;
$fdids = $v->get_fax_dids(SESS_ACCOUNT);
#echo "<pre>".print_r($fdids,true)."</pre>";
if (is_array($fdids)) {
foreach ($fdids as $did) {
$sql = "UPDATE ".AGILE_DB_PREFIX."voip_fax SET
account_id = ".$db->qstr(SESS_ACCOUNT).",
site_id = ".$db->qstr(DEFAULT_SITE)."
WHERE dst = ".$db->qstr($did);
$db->Execute($sql);
#echo "did=$did ".$sql."<br>";
}
}
unset($db);
}
$type = "search";
$this->method["$type"] = split(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_show($VAR, $this, $type);
}
}
?>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<module>voip_fax</module>
<table>voip_fax</table>
<dependancy>voip</dependancy>
<cache>0</cache>
<order_by>date_orig</order_by>
<limit>50</limit>
<index>
<dst_idx>dst</dst_idx>
</index>
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<account_id>
<type>I4</type>
<asso_table>account</asso_table>
<asso_field>username</asso_field>
</account_id>
<date_orig>
<type>C(16)</type>
<validate>date-time</validate>
</date_orig>
<clid>
<type>C(64)</type>
</clid>
<src>
<type>C(64)</type>
</src>
<dst>
<type>C(64)</type>
</dst>
<pages>
<type>I4</type>
</pages>
<image_size>
<type>C(16)</type>
</image_size>
<image_resolution>
<type>C(16)</type>
</image_resolution>
<transfer_rate>
<type>I4</type>
</transfer_rate>
<image_bytes>
<type>I4</type>
</image_bytes>
<bad_rows>
<type>I4</type>
</bad_rows>
<mime_type>
<type>C(32)</type>
</mime_type>
</field>
<method>
<add>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</add>
<update>id,site_id,account_id,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</update>
<delete>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</delete>
<view>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</view>
<search>id,site_id,account_id,date_orig,clid,src,dst,pages,image_size,image_resolution,transfer_rate,image_bytes,bad_rows,mime_type</search>
</method>
<trigger>0</trigger>
</construct>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<module_properties>
<name>voip_fax</name>
<parent>voip</parent>
<notes>This module stores the VoIP fax records</notes>
<menu_display>1</menu_display>
<dependancy>voip</dependancy>
<sub_modules></sub_modules>
</module_properties>
<sql_inserts>
<module_method>
<update>
<name>update</name>
</update>
<delete>
<name>delete</name>
</delete>
<view>
<name>view</name>
<page>core:search&amp;module=%%&amp;_escape=1</page>
<menu_display>1</menu_display>
</view>
<search>
<name>search</name>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
</module_method>
</sql_inserts>
</install>