Initial Commit of AgileBill Open Source
This commit is contained in:
144
modules/session/session.inc.php
Normal file
144
modules/session/session.inc.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?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 session
|
||||
{
|
||||
|
||||
# Open the constructor for this mod
|
||||
function session()
|
||||
{
|
||||
# name of this module:
|
||||
$this->module = "session";
|
||||
|
||||
# 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"];
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## GRAPH STATISTICS ##
|
||||
##############################
|
||||
function graph($start, $end, $constraint, $default)
|
||||
{
|
||||
global $C_translate;
|
||||
|
||||
|
||||
$db = &DB();
|
||||
$sql = 'SELECT date_orig FROM ' . AGILE_DB_PREFIX . 'session WHERE
|
||||
site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND
|
||||
date_orig >= ' . $db->qstr($start) . ' AND
|
||||
date_orig <= ' . $db->qstr($end);
|
||||
|
||||
$result = $db->Execute($sql);
|
||||
if($result->RecordCount() == 0)
|
||||
{
|
||||
$arr['title'] = $C_translate->translate('search_no_results','','');
|
||||
$arr['results'] = $default;
|
||||
return $arr;
|
||||
}
|
||||
$ii=0;
|
||||
while(!$result->EOF)
|
||||
{
|
||||
$d = $result->fields['date_orig'];
|
||||
for($i=0; $i<count($constraint); $i++)
|
||||
{
|
||||
if($d >= $constraint[$i]["start"] && $d < $constraint[$i]["end"])
|
||||
$default[$i]++;
|
||||
$ii++;
|
||||
}
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
$C_translate->value['session']['count'] = $result->RecordCount();
|
||||
$title = $C_translate->translate('statistics','session','');
|
||||
$arr['title'] = $title;
|
||||
$arr['results'] = $default;
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## VIEW ##
|
||||
##############################
|
||||
function view($VAR)
|
||||
{
|
||||
$type = "view";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->view($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)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
?>
|
95
modules/session/session_construct.xml
Normal file
95
modules/session/session_construct.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<construct>
|
||||
<!-- define the module name -->
|
||||
<module>session</module>
|
||||
<!-- define the module table name -->
|
||||
<table>session</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>date_last</order_by>
|
||||
<!-- define the methods -->
|
||||
<limit>25</limit>
|
||||
<!-- define database indexes -->
|
||||
<index>
|
||||
<expire>date_expire</expire>
|
||||
<logged>logged</logged>
|
||||
<account>account_id</account>
|
||||
<campaign>campaign_id</campaign>
|
||||
</index>
|
||||
<!-- define the fields -->
|
||||
<field>
|
||||
<id>
|
||||
<type>C(32)</type>
|
||||
<unique>1</unique>
|
||||
<index>1</index>
|
||||
</id>
|
||||
<site_id>
|
||||
<type>I4</type>
|
||||
<index>1</index>
|
||||
</site_id>
|
||||
<date_orig>
|
||||
<type>I8</type>
|
||||
<convert>date</convert>
|
||||
</date_orig>
|
||||
<date_last>
|
||||
<type>I8</type>
|
||||
<convert>date</convert>
|
||||
</date_last>
|
||||
<date_expire>
|
||||
<type>I8</type>
|
||||
<convert>date</convert>
|
||||
</date_expire>
|
||||
<logged>
|
||||
<type>L</type>
|
||||
</logged>
|
||||
<ip>
|
||||
<type>C(128)</type>
|
||||
</ip>
|
||||
<theme_id>
|
||||
<type>C(32)</type>
|
||||
</theme_id>
|
||||
<country_id>
|
||||
<type>I4</type>
|
||||
</country_id>
|
||||
<language_id>
|
||||
<type>C(32)</type>
|
||||
</language_id>
|
||||
<currency_id>
|
||||
<type>I4</type>
|
||||
</currency_id>
|
||||
<weight_id>
|
||||
<type>I4</type>
|
||||
</weight_id>
|
||||
<account_id>
|
||||
<type>I8</type>
|
||||
<asso_table>account</asso_table>
|
||||
<asso_field>username</asso_field>
|
||||
</account_id>
|
||||
<reseller_id>
|
||||
<type>I4</type>
|
||||
</reseller_id>
|
||||
<affiliate_id>
|
||||
<type>C(32)</type>
|
||||
</affiliate_id>
|
||||
<campaign_id>
|
||||
<type>I4</type>
|
||||
</campaign_id>
|
||||
<discounts>
|
||||
<type>C(255)</type>
|
||||
</discounts>
|
||||
<groups>
|
||||
<type>C(255)</type>
|
||||
</groups>
|
||||
</field>
|
||||
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
|
||||
<method>
|
||||
<delete>id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts</delete>
|
||||
<view>id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts</view>
|
||||
<search>id,site_id,date_orig,date_last,date_expire,logged,ip,theme_id,country_id,language_id,currency_id,weight_id,account_id,reseller_id,affiliate_id,discounts</search>
|
||||
</method>
|
||||
<!-- define the method triggers -->
|
||||
<trigger>0</trigger>
|
||||
</construct>
|
35
modules/session/session_install.xml
Normal file
35
modules/session/session_install.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<install>
|
||||
<module_properties>
|
||||
<name>session</name>
|
||||
<parent>account_admin</parent>
|
||||
<notes><![CDATA[Control the sessions]]></notes>
|
||||
<menu_display>1</menu_display>
|
||||
</module_properties>
|
||||
<sql_inserts>
|
||||
<module_method>
|
||||
<search>
|
||||
<name>search</name>
|
||||
<page><![CDATA[%%:search_form]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</search>
|
||||
<view>
|
||||
<name>view</name>
|
||||
<page><![CDATA[core:search&module=%%]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</view>
|
||||
<delete>
|
||||
<name>delete</name>
|
||||
</delete>
|
||||
<update>
|
||||
<name>update</name>
|
||||
</update>
|
||||
<search_form>
|
||||
<name>search_form</name>
|
||||
</search_form>
|
||||
<search_show>
|
||||
<name>search_show</name>
|
||||
<notes><![CDATA[Allow users to view the search results]]></notes>
|
||||
</search_show>
|
||||
</module_method>
|
||||
</sql_inserts>
|
||||
</install>
|
Reference in New Issue
Block a user