当前位置: 首页>>代码示例>>PHP>>正文


PHP A2Billing类代码示例

本文整理汇总了PHP中A2Billing的典型用法代码示例。如果您正苦于以下问题:PHP A2Billing类的具体用法?PHP A2Billing怎么用?PHP A2Billing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了A2Billing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 function init($sA2Billing = null)
 {
     if ($sA2Billing) {
         $this->a2billing =& $sA2Billing;
     } else {
         $this->a2billing =& A2Billing::instance();
     }
     if (isset($GLOBALS['FG_DEBUG'])) {
         $this->FG_DEBUG = $GLOBALS['FG_DEBUG'];
     }
     // Fill a local array with dirty versions of data..
     if (!$this->prefix) {
         $this->_dirty_vars = array_merge($_GET, $_POST);
     } else {
         $tmp_arr = array_merge($_GET, $_POST);
         $tlen = strlen($this->prefix);
         $this->_dirty_vars = array();
         // Find vars matching prefix and strip that!
         foreach ($tmp_arr as $key => $data) {
             if (strncmp($this->prefix, $key, $tlen) == 0) {
                 $this->_dirty_vars[substr($key, $tlen)] = $data;
             }
         }
     }
     // set action, for a start:
     $this->action = $this->getpost_single('action');
     if ($this->action == null) {
         $this->action = $this->action_ask;
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:30,代码来源:Class.ActionElem.inc.php

示例2: insertLog

 function insertLog($userID, $logLevel, $actionPerformed, $description, $tableName, $ipAddress, $pageName, $data = '')
 {
     $DB_Handle = A2Billing::DBHandle();
     $pageName = basename($pageName);
     $pageArray = explode('?', $pageName);
     $pageName = array_shift($pageArray);
     $res = $DB_Handle->Execute("INSERT INTO cc_system_log (iduser, loglevel, action, description, tablename, pagename, ipaddress, data) " . " VALUES(?,?,?,?,?,?,?,?);", array($userID, $logLevel, $actionPerformed, $description, $tableName, $pageName, $ipAddress, $data));
     if (!$res) {
         @syslog(LOG_WARNING, "Cannot log: " . $DB_Handle->ErrorMsg());
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:11,代码来源:Class.Logger.inc.php

示例3: login

function login($user, $pass)
{
    global $FG_DEBUG;
    $DBHandle = A2Billing::DBHandle();
    $user = trim($user);
    $pass = trim($pass);
    if (strlen($user) == 0 || strlen($user) >= 50 || strlen($pass) == 0 || strlen($pass) >= 50) {
        return false;
    }
    $nameclause = "";
    if (DynConf::GetCfg(CUSTOMER_CFG, 'username_login', true)) {
        $nameclause = "username = %1";
    }
    if (DynConf::GetCfg(CUSTOMER_CFG, 'useralias_login', false)) {
        if (!empty($nameclause)) {
            $nameclause .= ' OR ';
        }
        $nameclause .= "useralias = %1";
    }
    if (DynConf::GetCfg(CUSTOMER_CFG, 'email_login', false)) {
        if (!empty($nameclause)) {
            $nameclause .= ' OR ';
        }
        $nameclause .= "email = %1";
    }
    if (($cgrp = DynConf::GetCfg(CUSTOMER_CFG, 'cardgroup_only', null)) != null) {
        $group_clause = ' AND grp = %#3';
    }
    $QUERY = str_dbparams($DBHandle, "SELECT id, username, status, currency, grp, language\n\t\t FROM cc_card WHERE ({$nameclause}) AND userpass = %2 {$group_clause} ;", array($user, $pass, $cgrp));
    $res = $DBHandle->Execute($QUERY);
    if (!$res) {
        $errstr = $DBHandle->ErrorMsg();
        if ($FG_DEBUG) {
            echo $errstr . "<br>\n";
        }
        return 4;
    }
    if ($res->EOF) {
        // no such user!
        if ($FG_DEBUG > 1) {
            echo "Query: {$QUERY} <br>";
        }
        return 1;
    }
    $row = $res->fetchRow();
    if ($row['status'] != 1) {
        return 0 - intval($row['status']);
    }
    //     if( ACTIVATEDBYUSER==1 && $row [0][7] != "t" && $row [0][7] != "1" ) {
    // 		return -2;
    // 	}
    return $row;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:53,代码来源:login.php

示例4: init

 function init($sA2Billing = null, $stdActions = true)
 {
     if (!$this->rights_checked) {
         error_log("Attempt to use Callshop w/o rights!");
         die;
     }
     if ($sA2Billing) {
         $this->a2billing =& $sA2Billing;
     } else {
         $this->a2billing =& A2Billing::instance();
     }
     if (isset($GLOBALS['FG_DEBUG'])) {
         $this->FG_DEBUG = $GLOBALS['FG_DEBUG'];
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:15,代码来源:Class.CallShop.inc.php

示例5: sendMail

 public function sendMail($templ, $tomail, $locale, $params)
 {
     global $verbose;
     $dbhandle = A2Billing::DBHandle();
     if ($verbose > 2) {
         echo "Sending {$templ} mail to {$tomail}\n";
     }
     $res = $dbhandle->Execute("SELECT create_mail(?, ?, ?, ?);", array($templ, $tomail, $locale, arr2url($params)));
     if (!$res) {
         echo "Cannot mark mail: ";
         echo $dbhandle->ErrorMsg() . "\n";
     } elseif ($res->EOF) {
         echo "Cannot send mail, no template?\n";
     }
     $this->mail_flag = true;
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:16,代码来源:Class.Alarm.inc.php

示例6: UseLanguage

function UseLanguage()
{
    global $language_list;
    global $FG_DEBUG;
    if (isset($_GET['language'])) {
        if ($FG_DEBUG > 0) {
            echo "<!-- lang explicitly set to " . $_GET['language'] . "-->\n";
        }
        $_SESSION["language"] = $_GET['language'];
    } elseif (!isset($_SESSION["language"])) {
        // we have to find a lang to use..
        if (isset($_SESSION["lang_db"])) {
            foreach ($language_list as $lang) {
                if ($lang['abbrev'] == $_SESSION["lang_db"]) {
                    $_SESSION["language"] = $lang['cname'];
                }
            }
            if ($FG_DEBUG > 0) {
                trigger_error("Lang Selected by db: " . $_SESSION["language"], E_USER_NOTICE);
            }
        } else {
            $_SESSION["language"] = 'english';
        }
    }
    define("LANGUAGE", $_SESSION["language"]);
    //include (FSROOT."lib/languages/".LANGUAGE.".php");
    //define ("LANGUAGE_DIR",FSROOT."lib/languages/".LANGUAGE."/");
    $lang_abbr = SetLocalLanguage($_SESSION["language"]);
    if ($FG_DEBUG > 5) {
        trigger_error("lang abbr: {$lang_abbr}", E_USER_NOTICE);
    }
    if (isset($_SESSION['agent_id']) && $_SESSION['cus_rights'] != 0 && isset($_SESSION["lang_db"]) && $_SESSION["lang_db"] != $lang_abbr) {
        $DBconn_tmp = A2Billing::DBHandle();
        $QUERY = "UPDATE cc_agent SET language = " . $DBconn_tmp->Quote($lang_abbr) . ", locale = " . $DBconn_tmp->Quote(getenv("LANG")) . " WHERE id = " . $DBconn_tmp->Quote($_SESSION['agent_id']) . ';';
        $res = $DBconn_tmp->query($QUERY);
        $_SESSION["lang_db"] = $lang_abbr;
        //echo $QUERY;
        if (!$res) {
            trigger_error("Set language to db failed:" . $DBconn_tmp->ErrorMsg(), E_USER_WARNING);
        }
        //DbDisconnect($DBconn_tmp);
    }
}
开发者ID:sayemk,项目名称:a2billing,代码行数:43,代码来源:module.access.php

示例7: ProcessAlarm

 function ProcessAlarm(AlmInstance $inst)
 {
     $dbhandle = A2Billing::DBHandle();
     global $verbose;
     if ($inst->ar_id) {
         // we cannot handle previous instances
         return;
     }
     $margin = $inst->alm_params['margin'];
     if (!isset($margin)) {
         $margin = 0.0;
     }
     $qry = str_dbparams($dbhandle, "SELECT cc_agent.id, credit, name, locale, email, climit, cc_alarm_run.id AS ar_id,\n\t\t\t\tcc_alarm_run.status AS ar_status\n\t\t\tFROM cc_agent LEFT JOIN cc_alarm_run ON ( cc_alarm_run.dataid = cc_agent.id\n\t\t\t\tAND cc_alarm_run.alid = %#1) \n\t\t\tWHERE (climit + credit ) < %#2 ;", array($inst->id, $margin));
     if ($verbose > 2) {
         echo "Query: " . $qry . "\n";
     }
     $res = $dbhandle->Execute($qry);
     if (!$res) {
         echo $dbhandle->ErrorMsg() . "\n";
     } else {
         if ($res->EOF) {
             if ($verbose > 2) {
                 echo "All agents have credit.\n";
             }
             $inst->Save(1);
             return;
         }
     }
     $neg_agents = array();
     while ($row = $res->fetchRow()) {
         if ($verbose > 2) {
             echo "Agent " . $row['name'] . " is low on credit.\n";
         }
         if (!empty($row['email'])) {
             $this->sendMail('agent-low-credit', $row['email'], $row['locale'], array(credit => $row['credit'], climit => $row['climit']));
         }
         $neg_agents[] = $row['name'] . ": " . $row['credit'] . "/" . $row['climit'];
     }
     $this->sendSysMail('sys-agent-low-credit', $inst, array(low_agents => implode("\n", $neg_agents)));
     $inst->Save();
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:41,代码来源:agent-credit.inc.php

示例8: A2Billing

	    case 'did': 			$mode = 'did'; break;
	    case 'callback':			$mode = 'callback'; break;
	    case 'cid-callback':		$mode = 'cid-callback'; break;
	    case 'cid-prompt-callback': 	$mode = 'cid-prompt-callback'; break;
	    case 'all-callback':		$mode = 'all-callback'; break;
	    case 'voucher':			$mode = 'voucher'; break;
	    case 'campaign-callback':		$mode = 'campaign-callback'; break;
	    case 'conference-moderator':	$mode = 'conference-moderator'; break;
	    case 'conference-member':		$mode = 'conference-member'; break;
	    case 'auto-did-callback-cid':	$mode = 'auto'; break;
	    case 'auto':			$mode = 'auto'; break;
	    default:				$mode = 'standard'; break;
	}
} else $mode = 'standard';

$A2B = new A2Billing();
$A2B -> load_conf($agi, NULL, 0, $idconfig, $optconfig);
$A2B -> mode = $mode;
$A2B -> G_startime = $G_startime;


$A2B -> debug( INFO, $agi, __FILE__, __LINE__, "IDCONFIG : $idconfig");
$A2B -> debug( INFO, $agi, __FILE__, __LINE__, "MODE : $mode");


// get the area code for the cid-callback, all-callback and cid-prompt-callback
if ($argc > 3 && strlen($argv[3]) > 0) {
	$caller_areacode = $argv[3];
} else $caller_areacode = "";

if ($argc > 4 && strlen($argv[4]) > 0) {
开发者ID:nixonch,项目名称:a2billing,代码行数:31,代码来源:a2billing.php

示例9: disconnect

		$ast -> disconnect();
		if ($res !== false) return $res;
		else return -2; // not enough free trunk for make call
	    }
	    else return -3; // not have enough credit to call you back
	}
	else return -1; // no route to call back your phonenumber
    }
    else return -1; // ERROR MESSAGE IS CONFIGURE BY THE callingcard_ivr_authenticate_light
}


$FG_DEBUG = 0;
$verbose_level = 1;

$A2B = new A2Billing();
$A2B->load_conf($agi);

if (!defined('PID'))
    define("PID", $A2B->config["daemon-info"]['pidfile']);

// CHECK IF THE DAEMON IS ALREADY RUNNING
if (ProcessHandler :: isActive())
    die("Already running!");
else
    ProcessHandler :: activate();

write_log(LOGFILE_API_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[#### CALLBACK BEGIN ####]");

if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";
开发者ID:nixonch,项目名称:a2billing,代码行数:31,代码来源:callback_daemon.php

示例10: detailQueryField

 public function detailQueryField(&$dbhandle)
 {
     if ($this->fieldexpr) {
         $fld = $this->fieldexpr;
     } else {
         $fld = $this->fieldname;
     }
     return "format_currency2({$fld}, '" . A2Billing::instance()->currency . "') AS " . $this->fieldname;
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:9,代码来源:Class.NumField.inc.php

示例11: Copyright

<?php

/** Booths xml code:
    Copyright (C) 2006-2008 P. Christeas <p_christeas@yahoo.com>
    */
// We must tell the mod_php to send the correct header..
header('Content-type: text/xml');
require "lib/defines.php";
require "lib/module.access.php";
require "lib/common/BoothsXML.inc.php";
require "lib/common/Misc.inc.php";
if (!has_rights(ACX_AGENTS)) {
    header("HTTP/1.0 401 Unauthorized");
    $dom = messageDom(_("Unauthorized: please log in again."), "msg_errror");
    echo $dom->saveXML();
    exit;
}
$aclause = '';
if (!empty($_GET['aid'])) {
    $aclause = str_dbparams(A2Billing::DBHandle(), 'agentid = %#1', array($_GET['aid']));
}
$dom = BoothsDom($_GET['action'], $_GET['actb'], $aclause);
// Let ONLY this line produce any output!
echo $dom->saveXML();
开发者ID:sayemk,项目名称:a2billing,代码行数:24,代码来源:booths.xml.php

示例12: define

// $res= fopen($files[0],'r');
// if (!$res){
// 	echo "Could not open ".$files[0]." .\n";
// 	exit(2);
// }
define('DEBUG_CONF', 1);
$host = A2Billing::instance()->set_def_conf($manager_section, 'host', 'localhost');
$uname = A2Billing::instance()->set_def_conf($manager_section, 'username', 'a2billing');
$password = A2Billing::instance()->set_def_conf($manager_section, 'secret', '');
if ($verbose > 2) {
    echo "Starting manager-eventd.\n";
}
$num_tries = 0;
while ($num_tries < 10) {
    $num_tries++;
    $dbh = A2Billing::DBHandle();
    if (!$dbh) {
        echo "Cannot connect to database, exiting..";
        break;
    }
    $as = new AGI_AsteriskManager();
    if ($verbose < 2) {
        $as->nolog = true;
    } else {
        if ($verbose > 3) {
            $as->debug = true;
        }
    }
    // && CONNECTING  connect($server=NULL, $username=NULL, $secret=NULL)
    $res = $as->connect($host, $uname, $password);
    if (!$res) {
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:manager-eventd.php

示例13: define

if (!defined('PID')) {
    define("PID", "/var/run/a2billing/a2billing_batch_autodialer_pid.php");
}
// CHECK IF THE CRONT PROCESS IS ALREADY RUNNING
$pH = new ProcessHandler();
if ($pH->isActive()) {
    die;
    // Already running!
} else {
    $pH->activate();
}
$verbose_level = 1;
// time to wait between every send in callback queue
$timing = 6;
$group = 20;
$A2B = new A2Billing();
$A2B->load_conf($agi, NULL, 0, $idconfig);
write_log(LOGFILE_CRONT_BATCH_PROCESS, basename(__FILE__) . ' line:' . __LINE__ . "[#### BATCH BEGIN ####]");
if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";
    write_log(LOGFILE_CRONT_BATCH_PROCESS, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");
    exit;
}
if ($A2B->config["database"]['dbtype'] == "postgres") {
    $UNIX_TIMESTAMP = "date_part('epoch',";
} else {
    $UNIX_TIMESTAMP = "UNIX_TIMESTAMP(";
}
$tab_day = array(1 => 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$num_day = date('N');
$name_day = $tab_day[$num_day];
开发者ID:pearlvoip,项目名称:a2billing,代码行数:31,代码来源:a2billing_batch_autodialer.php

示例14: BoothsDom

function BoothsDom($action, $actb, $agent_clause = 'AND false')
{
    global $FG_DEBUG;
    $dbhandle =& A2Billing::instance()->DBHandle();
    // Prepare the XML DOM structure
    $dom = new DOMDocument("1.0", "utf-8");
    // $_SESSION["pr_login"];
    $dom_root = $dom->createElement("root");
    $dom->appendChild($dom_root);
    $dom_message = $dom->createElement("message");
    $dom_root->appendChild($dom_message);
    if (!empty($agent_clause)) {
        $aclause = ' AND ' . $agent_clause;
    } else {
        $aclause = '';
    }
    $booth_states = array();
    $booth_states[0] = array(_("N/A"), _("Not available, no cards configured."));
    $booth_states[1] = array(_("Empty"), _("No customer attached."));
    $booth_states[2] = array(_("Idle"), _("Customer attached, inactive"));
    $booth_states[3] = array(_("Ready"), _("Waiting for calls"));
    $booth_states[4] = array(_("Active"), _("Calls made, charged"));
    $booth_states[5] = array(_("Disabled"), _("Disabled by the agent"));
    $booth_states[6] = array(_("Stopped"), _("Calls made, charged, stopped"));
    // Perform the SQL query
    $message = '';
    if (!empty($action)) {
        /* Here we handle all actions to the booths!
         */
        $get_booth = -1;
        if (!empty($actb)) {
            $get_booth = (int) $actb;
            switch ($action) {
                case 'disable':
                    $message = _("Booth disabled");
                    break;
                case 'stop':
                    //$DBHandle->debug = true;
                    $res = $dbhandle->Execute("UPDATE cc_booth_v SET state = 2 WHERE id = ? {$aclause};", array($get_booth));
                    if ($res) {
                        $message = _("Booth stopped");
                    } else {
                        $message = _("Action failed:");
                        //if ($FG_DEBUG)
                        $message .= $dbhandle->ErrorMsg();
                    }
                    break;
                case 'start':
                    $res = $dbhandle->Execute("UPDATE cc_booth_v SET state = 3 WHERE id = ? {$aclause};", array($get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message = $message . $dbhandle->ErrorMsg();
                        $message_class = "msg_error";
                    }
                    break;
                case 'load_def':
                    $res = $dbhandle->Execute("UPDATE cc_booth SET cur_card_id = def_card_id WHERE id = ? {$aclause};", array($get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message = $message . $dbhandle->ErrorMsg();
                        $message_class = "msg_error";
                    }
                    break;
                case 'load_reg':
                    $res = $dbhandle->Execute("UPDATE cc_booth SET cur_card_id = ? WHERE id = ? {$aclause};", array($_GET['card'], $get_booth));
                    if ($res && $dbhandle->Affected_Rows()) {
                        $message = _("Booth started");
                    } else {
                        $message = _("Action failed:");
                        $message .= $dbhandle->ErrorMsg();
                        // $message .= "<br>Query: " . $query;
                        $message_class = "msg_error";
                    }
                    break;
                case 'refill':
                    $rf = (double) $_GET['sum'];
                    if ($rf <= 0.0 || $rf > 50.0) {
                        $message = _("Invalid sum for refill");
                        $message_class = "msg_error";
                    } else {
                        $get_booth = (int) $actb;
                        $query = "INSERT INTO cc_agentrefill(agentid, boothid, credit, pay_type) " . "SELECT agentid, cc_booth.id, conv_currency_from(?,  cc_agent.currency), " . "(SELECT id FROM cc_paytypes WHERE preset = 'prepay') " . "FROM cc_booth, cc_agent WHERE cc_booth.id = ? AND cc_agent.id = cc_booth.agentid {$aclause};";
                        $res = $dbhandle->Execute($query, array($rf, $get_booth));
                        if ($res && $dbhandle->Affected_Rows()) {
                            $message = _("Credit added to booth");
                            $message_class = "msg_success";
                        } else {
                            $message = _("Refill failed: do you have enough credit?");
                            if ($FG_DEBUG) {
                                $message .= "<br>" . $dbhandle->ErrorMsg();
                            }
                            if ($FG_DEBUG > 2) {
                                $message .= " <br>QUERY= " . $query;
                            }
                            $message_class = "msg_error";
                        }
//.........这里部分代码省略.........
开发者ID:sayemk,项目名称:a2billing,代码行数:101,代码来源:BoothsXML.inc.php

示例15: time

if (isset($_SESSION['startTime'])) {
    $timeDiff = time() - $_SESSION['startTime'];
    //destroy session
    if ($timeDiff > 3600) {
        // 60 minutes
        //echo "You've been logged in too long. ($timeDiff)";
        $_SESSION = array();
        session_destroy();
        setcookie('PHPSESSID', '', time() - 3600, '/', '', 0, 0);
    }
} else {
    $_SESSION['startTime'] = time();
}
$G_instance_Query_trace = Query_trace::getInstance();
// A2B INSTANCE
$A2B = new A2Billing();
// The system will not log for Public/index.php and signup/index.php
if (isset($_SERVER['REQUEST_URI'])) {
    $URI = $_SERVER['REQUEST_URI'];
} else {
    $URI = '';
}
// Enable UI Logger
define("ENABLE_LOG", 1);
include FSROOT . "lib/Class.Logger.php";
$log = new Logger();
// LOAD THE CONFIGURATION
if (stripos($URI, "Public/index.php") === FALSE) {
    $res_load_conf = $A2B->load_conf($agi, A2B_CONFIG_DIR . "a2billing.conf", 1);
    if (!$res_load_conf) {
        exit;
开发者ID:hellbound,项目名称:a2billing-mod,代码行数:31,代码来源:admin.defines.php


注:本文中的A2Billing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。