本文整理汇总了PHP中Table::Add_table方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::Add_table方法的具体用法?PHP Table::Add_table怎么用?PHP Table::Add_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Add_table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddNotification
static function AddNotification($key,$priority,$from_type,$from_id=0,$link_type=null,$link_id=null) {
$DBHandle = DbConnect();
$table = new Table("cc_notification", "*");
$fields = " key_value , priority, from_type, from_id, link_type,link_id";
$values = " '$key' , $priority,$from_type ,$from_id ,'$link_type',$link_id";
$return = $table->Add_table($DBHandle, $values, $fields);
return $return;
}
示例2:
$useralias = $arr_card_alias[1];
if (!is_numeric($addcredit)) {
$addcredit = 0;
}
$passui_secret = MDP_NUMERIC(10);
$FG_ADITION_SECOND_ADD_VALUE = "'{$cardnum}', '{$useralias}', '{$addcredit}', '{$choose_tariff}', 't', '{$gen_id}', '', '', '', '', '', '', '', '', {$choose_simultaccess}, '{$choose_currency}', {$choose_typepaid}, {$creditlimit}, {$enableexpire}, '{$expirationdate}', {$expiredays}, '{$passui_secret}', '{$runservice}','{$tag}'";
if (DB_TYPE != "postgres") {
$FG_ADITION_SECOND_ADD_VALUE .= ",now() ";
}
if (isset($sip)) {
$FG_ADITION_SECOND_ADD_VALUE .= ", 1";
}
if (isset($iax)) {
$FG_ADITION_SECOND_ADD_VALUE .= ", 1";
}
$id_cc_card = $instance_sub_table->Add_table($HD_Form->DBHandle, $FG_ADITION_SECOND_ADD_VALUE, null, null, $HD_Form->FG_TABLE_ID);
// Insert data for sip_buddy
if (isset($sip)) {
$FG_QUERY_ADITION_SIP_IAX_VALUE = "'{$cardnum}', '{$cardnum}', '{$cardnum}', '{$amaflags}', '{$cardnum}', '{$context}', '{$dtmfmode}','{$host}', '{$type}', '{$cardnum}', '{$allow}', '" . $passui_secret . "', '{$id_cc_card}', '{$nat}', '{$qualify}'";
$result_query1 = $instance_sip_table->Add_table($HD_Form->DBHandle, $FG_QUERY_ADITION_SIP_IAX_VALUE, null, null, null);
$_SESSION["is_sip_iax_change"] = 1;
$_SESSION["is_sip_changed"] = 1;
}
// Insert data for iax_buddy
if (isset($iax)) {
//$FG_QUERY_ADITION_SIP_IAX_VALUE = "'$cardnum', '$cardnum', '$cardnum', '$amaflag', '$cardnum', '$context', 'RFC2833','dynamic', 'friend', '$cardnum', 'g729,ulaw,alaw,gsm','".$passui_secret."'";
$FG_QUERY_ADITION_SIP_IAX_VALUE = "'{$cardnum}', '{$cardnum}', '{$cardnum}', '{$amaflags}', '{$cardnum}', '{$context}', '{$dtmfmode}','{$host}', '{$type}', '{$cardnum}', '{$allow}', '" . $passui_secret . "', '{$id_cc_card}', '{$nat}', '{$qualify}'";
$result_query2 = $instance_iax_table->Add_table($HD_Form->DBHandle, $FG_QUERY_ADITION_SIP_IAX_VALUE, null, null, null);
$_SESSION["is_sip_iax_change"] = 1;
$_SESSION["is_iax_changed"] = 1;
}
示例3: Table
$instance_table = new Table("cc_invoice", $field_insert);
if ($verbose_level >= 1) {
echo "INSERT INVOICE : {$field_insert} =>\t{$value_insert} \n";
}
$id_invoice = $instance_table->Add_table($A2B->DBHandle, $value_insert, null, null, "id");
if (!empty($id_invoice) && is_numeric($id_invoice)) {
$description = "Subscription (" . $subscription['product_name'] . ")";
$amount = $subscription['fee'];
$vat = 0;
$field_insert = "date, id_invoice, price, vat, description, id_ext, type_ext";
$instance_table = new Table("cc_invoice_item", $field_insert);
$value_insert = " '{$date}' , '{$id_invoice}', '{$amount}','{$vat}','{$description}','" . $subscription['card_subscription_id'] . "','SUBSCR'";
if ($verbose_level >= 1) {
echo "INSERT INVOICE ITEM : {$field_insert} =>\t{$value_insert} \n";
}
$instance_table->Add_table($A2B->DBHandle, $value_insert, null, null, "id");
}
$mail = new Mail(Mail::$TYPE_SUBSCRIPTION_UNPAID, $card['id']);
$mail->replaceInEmail(Mail::$DAY_REMAINING_KEY, $billdaybefor_anniversary);
$mail->replaceInEmail(Mail::$INVOICE_REF_KEY, $reference);
$mail->replaceInEmail(Mail::$SUBSCRIPTION_FEE, $subscription['fee']);
$mail->replaceInEmail(Mail::$SUBSCRIPTION_ID, $subscription['id']);
$mail->replaceInEmail(Mail::$SUBSCRIPTION_LABEL, $subscription['product_name']);
//insert charge
$QUERY = "INSERT INTO cc_charge (id_cc_card, amount, chargetype, id_cc_card_subscription, invoiced_status, description) VALUES ('" . $card['id'] . "', '" . $subscription['fee'] . "', '3','" . $subscription['card_subscription_id'] . "',1, '" . $subscription['product_name'] . "')";
if ($verbose_level >= 1) {
echo "==> INSERT CHARGE QUERY: \t{$QUERY}\n";
}
$instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
$QUERY = "UPDATE cc_card_subscription SET paid_status = 1 WHERE id=" . $subscription['card_subscription_id'];
if ($verbose_level >= 1) {
开发者ID:ekamhara,项目名称:BootStrap-A2Billing-custom-templates,代码行数:31,代码来源:a2billing_subscription_fee.php
示例4: strpos
}
$param_add_fields .= $FG_QUERY_ADITION_HIDDEN_FIELDS;
if ($i > 0) {
$param_add_value .= ", ";
}
$param_add_value .= $FG_QUERY_ADITION_HIDDEN_VALUE;
}
if ($FG_DEBUG == 1) {
echo "<br><hr> {$param_add_fields}";
}
if ($FG_DEBUG == 1) {
echo "<br><hr> {$param_add_value}";
}
$FG_TABLE_ID = "id";
if ($VALID_SQL_REG_EXP) {
$result_query = $instance_table->Add_table($DBHandle, $param_add_value, $param_add_fields, null, $FG_TABLE_ID);
}
if (!$result_query) {
//--echo "<br><b>".$instance_table -> errstr."</b><br>";
$findme = 'duplicate';
$pos_find = strpos($instance_sub_table->errstr, $findme);
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos_find === false) {
//-- echo $instance_sub_table -> errstr;
} else {
//echo $FG_TEXT_ERROR_DUPLICATION;
$alarm_db_error_duplication = true;
}
} else {
if ($FG_ADITION_GO_EDITION == "yes") {
示例5: SQLExec
function Update_Rates($security_key, $instance, $arr_rates)
{
$arr_check = $this->Check_KeyInstance($security_key, $instance);
if ($arr_check[0] == 'ERROR') {
return $arr_check;
}
$id_group = $arr_check;
$QUERY = "SELECT id_trunk FROM cc_trunk WHERE trunkcode = '$instance'";
$result = $this->instance_table -> SQLExec ($this->DBHandle, $QUERY);
if (!is_array($result))
{
return array(false, "CANNOT LOAD THE TRUNK FOR THIS INSTANCE");
}
$id_trunk = $result[0][0];
$QUERY = "SELECT id FROM cc_tariffplan WHERE tariffname = '$instance'";
$result = $this->instance_table -> SQLExec ($this->DBHandle, $QUERY);
if (!is_array($result))
{
return array(false, "CANNOT LOAD THE RATECARD FOR THIS INSTANCE");
}
$id_ratecard = $result[0][0];
// CHECK RATES VALIDITY
if (!$this->check_rates_validity ($arr_rates)) {
return array(false, "ERROR RATES VALIDITY, LINE $nb_rates. ENSURE THAT ALL RATES HAVE A CORRECT FORMAT!");
}
// DELETE EXISTING RATES
$DEL_QUERY = "DELETE FROM cc_ratecard WHERE idtariffplan=$id_ratecard";
$result_query = $this->DBHandle->Execute($DEL_QUERY);
// REIMPORT RATES
foreach ($arr_rates as $arr_rates_val) {
$dialprefix = trim($arr_rates_val[0]);
$destination = trim($arr_rates_val[1]);
$buyrate = trim($arr_rates_val[2]);
$sellrate = trim($arr_rates_val[3]);
// ADD PREFIX
$instance_table_prefix = new Table("cc_prefix");
$FG_ADITION_SECOND_ADD_FIELDS_PREFIX = 'prefix, destination';
$FG_ADITION_SECOND_ADD_VALUE_PREFIX = "'" . intval($dialprefix) . "', '$destination'";
$TT_QUERY_PREFIX = "INSERT INTO " . $FG_ADITION_SECOND_ADD_TABLE_PREFIX . " (" . $FG_ADITION_SECOND_ADD_FIELDS_PREFIX . ") values (" . $FG_ADITION_SECOND_ADD_VALUE_PREFIX . ") ";
$instance_table_prefix -> Add_table ($this->DBHandle, $FG_ADITION_SECOND_ADD_VALUE_PREFIX, $FG_ADITION_SECOND_ADD_FIELDS_PREFIX);
// ADD RATES
$FG_ADITION_SECOND_ADD_TABLE = 'cc_ratecard';
$FG_ADITION_SECOND_ADD_FIELDS = 'idtariffplan, id_trunk, dialprefix, destination, buyrate, rateinitial, startdate, stopdate';
$startdate = date("Y-m-d H:i:s");
$stopdate_prefix = date("Y") + 30;
$stopdate_suffix = date("-m-d H:i:s");
$FG_ADITION_SECOND_ADD_VALUE = "'$id_ratecard', '$id_trunk', '$dialprefix', '".intval($dialprefix)."', '$buyrate', '$sellrate', '$startdate', '$stopdate_prefix$stopdate_suffix'";
$TT_QUERY = "INSERT INTO " . $FG_ADITION_SECOND_ADD_TABLE . " (" . $FG_ADITION_SECOND_ADD_FIELDS . ") values (" . $FG_ADITION_SECOND_ADD_VALUE . ") ";
$result_query = $this->DBHandle->Execute($TT_QUERY);
if (!$result_query) {
return array(false, "ERROR RATES CREATION ($nb_to_import Rates imported)");
}
$nb_to_import++;
}
return array(true, "RATES UPDATED ($nb_to_import Rates imported) - SUCCESS");
}
示例6: Header
break;
default:
$rates_clauses .= " destination = '{$prefix}'";
break;
}
}
$QUERY = "SELECT {$id},id FROM cc_ratecard rc WHERE {$rates_clauses} GROUP BY destination";
$table_rates->SQLExec($DBHandle, "INSERT IGNORE INTO cc_package_rate(package_id , rate_id) ({$QUERY})");
Header("Location: A2B_package_manage_rates.php?id={$id}");
}
if (isset($addrate) && is_numeric($addrate)) {
$DBHandle = DbConnect();
$add_rate_table = new Table("cc_package_rate", "*");
$fields = " package_id , rate_id";
$values = " {$id} , {$addrate}";
$add_rate_table->Add_table($DBHandle, $values, $fields);
Header("Location: A2B_package_manage_rates.php?id={$id}");
}
if (isset($delrate) && is_numeric($delrate)) {
$DBHandle = DbConnect();
$del_rate_table = new Table("cc_package_rate", "*");
$CLAUSE = " package_id = " . $id . " AND rate_id = {$delrate}";
$del_rate_table->Delete_table($DBHandle, $CLAUSE);
Header("Location: A2B_package_manage_rates.php?id={$id}");
}
if (isset($delallrate) && $delallrate) {
$DBHandle = DbConnect();
$del_rate_table = new Table("cc_package_rate", "*");
$CLAUSE = " package_id = " . $id;
$del_rate_table->Delete_table($DBHandle, $CLAUSE);
Header("Location: A2B_package_manage_rates.php?id={$id}");
示例7: dirname
****************************************************************************/
set_time_limit(0);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include_once dirname(__FILE__) . "/../Class.Table.php";
include dirname(__FILE__) . "/../Class.A2Billing.php";
write_log(LOGFILE_CRONT_ARCHIVE_DATA, basename(__FILE__) . ' line:' . __LINE__ . "[#### ARCHIVING DATA BEGIN ####]");
if (!$A2B->DbConnect()) {
echo "[Cannot connect to the database]\n";
write_log(LOGFILE_CRONT_ARCHIVE_DATA, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");
exit;
}
$A2B = new A2Billing();
$A2B->load_conf($agi, NULL, 0, $idconfig);
$instance_table = new Table();
$from_month = $A2B->config["backup"]['archive_data_x_month'];
if ($A2B->config["database"]['dbtype'] == "postgres") {
$condition = "CURRENT_TIMESTAMP - interval '{$from_month} months' > starttime";
} else {
$condition = "DATE_SUB(NOW(),INTERVAL {$from_month} MONTH) > starttime";
}
$value = "SELECT sessionid,uniqueid,username,nasipaddress,starttime,stoptime,sessiontime,calledstation,startdelay,stopdelay,terminatecause,usertariff,calledprovider,calledcountry,calledsub,calledrate,sessionbill,destination,id_tariffgroup,id_tariffplan,id_ratecard,id_trunk,sipiax,src,id_did,buyrate,buycost,id_card_package_offer,real_sessiontime FROM cc_call where {$condition}";
$func_fields = "sessionid,uniqueid,username,nasipaddress,starttime,stoptime,sessiontime,calledstation,startdelay,stopdelay,terminatecause,usertariff,calledprovider,calledcountry,calledsub,calledrate,sessionbill,destination,id_tariffgroup,id_tariffplan,id_ratecard,id_trunk,sipiax,src,id_did,buyrate,buycost,id_card_package_offer,real_sessiontime";
$func_table = 'cc_call_archive';
$id_name = "";
$subquery = true;
$result = $instance_table->Add_table($A2B->DBHandle, $value, $func_fields, $func_table, $id_name, $subquery);
$fun_table = "cc_call";
$result = $instance_table->Delete_table($A2B->DBHandle, $condition, $fun_table);
write_log(LOGFILE_CRONT_ARCHIVE_DATA, basename(__FILE__) . ' line:' . __LINE__ . "[#### ARCHIVING DATA END ####]");
示例8: if
}
}
$paycur = $currencies_list[$getcur][2];
if (strtoupper($payment)=='PLUGNPAY') {
$QUERY_FIELDS = "cardid, amount, vat, paymentmethod, cc_owner, cc_number, cc_expires, creationdate, cvv, credit_card_type, currency , item_id , item_type";
$QUERY_VALUES = "'".$_SESSION["card_id"]."','$amount_string', '".$_SESSION["vat"]."', '$payment','$plugnpay_cc_owner','".substr($plugnpay_cc_number,0,4)."XXXXXXXXXXXX','".$plugnpay_cc_expires_month."-".$plugnpay_cc_expires_year."','$time_stamp', '$cvv', '$credit_card_type', '".BASE_CURRENCY."' , '$item_id', '$item_type'";
} else if(strtoupper($payment)=='IRIDIUM'){
$QUERY_FIELDS = "cardid, amount, vat, paymentmethod, cc_owner, cc_number, cc_expires, creationdate, currency, item_id, item_type";
$QUERY_VALUES = "'".$_SESSION["card_id"]."','$amount_string', '".$_SESSION["vat"]."', '$payment','$CardName','".substr($CardNumber,0,4)."XXXXXXXXXXXX','".$ExpiryDateMonth."-".$ExpiryDateYear."','$time_stamp', '".BASE_CURRENCY."' , '$item_id','$item_type'";
} else {
$QUERY_FIELDS = "cardid, amount, vat, paymentmethod, cc_owner, cc_number, cc_expires, creationdate, currency, item_id, item_type";
$QUERY_VALUES = "'".$_SESSION["card_id"]."','$amount_string', '".$_SESSION["vat"]."', '$payment','$authorizenet_cc_owner','".substr($authorizenet_cc_number,0,4)."XXXXXXXXXXXX','".$authorizenet_cc_expires_month."-".$authorizenet_cc_expires_year."','$time_stamp', '".$getcur."' , '$item_id','$item_type'";
}
$transaction_no = $paymentTable->Add_table ($HD_Form -> DBHandle, $QUERY_VALUES, $QUERY_FIELDS, 'cc_epayment_log', 'id');
$key = securitykey(EPAYMENT_TRANSACTION_KEY, $time_stamp."^".$transaction_no."^".$amount_string."^".$_SESSION["card_id"]."^".$item_id."^".$item_type);
if (empty($transaction_no)) {
exit(gettext("No Transaction ID found"));
}
$HD_Form -> create_toppage ($form_action);
if (!isset($currencies_list[strtoupper($_SESSION['currency'])][2]) || !is_numeric($currencies_list[strtoupper($_SESSION['currency'])][2])) {
$mycur = 1;
} else {
$mycur = $currencies_list[strtoupper($_SESSION['currency'])][2]/$paycur;
if ($payment == 'webmoney') {
$getcur = $wm_purse_type;
$two_currency=true;
示例9: date
function Create_Card($security_key, $transaction_code, $account_number, $tariff, $uipass, $credit, $language, $activated, $status, $simultaccess, $currency, $runservice, $typepaid, $creditlimit, $enableexpire, $expirationdate, $expiredays, $lastname, $firstname, $address, $city, $state, $country, $zipcode, $phone, $fax, $callerid_list, $iax_friend, $sip_friend)
{
// The wrapper variables for security
// $security_key = API_SECURITY_KEY;
$logfile = SOAP_LOGFILE;
$mysecurity_key = API_SECURITY_KEY;
$mail_content = "[" . date("Y/m/d G:i:s", mktime()) . "] " . "SOAP API - Request asked: Create_Card [{$transaction_code}, {$account_number}, {$tariff}, {$uipass}, {$credit}, {$language}, {$activated}, {$simultaccess}, {$currency}, {$runservice}, {$typepaid}, {$creditlimit}, {$enableexpire}, {$expirationdate}, {$expiredays}, {$lastname}, {$firstname}, {$address}, {$city}, {$state}, {$country}, {$zipcode}, {$phone}, {$fax}, {$callerid_list}, {$iax_friend}, {$sip_friend}]";
// CHECK SECURITY KEY
if (md5($mysecurity_key) !== $security_key || strlen($security_key) == 0) {
a2b_mail(EMAIL_ADMIN, "ALARM : API - CODE_ERROR SECURITY_KEY ", $mail_content);
error_log("[" . date("Y/m/d G:i:s", mktime()) . "] " . " CODE_ERROR SECURITY_KEY" . "\n", 3, $logfile);
sleep(2);
return array($transaction_code, '', '', '', '', 'Error', 'KEY - BAD PARAMETER' . "{$security_key} - {$mysecurity_key}");
}
// Create new account
$FG_ADITION_SECOND_ADD_TABLE = "cc_card";
$FG_ADITION_SECOND_ADD_FIELDS = "username, useralias, credit, tariff, id_didgroup, activated, status, lastname, firstname, email, address, city, state, country, zipcode, phone, fax, userpass, simultaccess, currency, typepaid, creditlimit, language, runservice, enableexpire, expirationdate, expiredays, uipass, sip_buddy, iax_buddy";
$arr_card_alias = gen_card_with_alias('cc_card', 1);
$cardnum = $arr_card_alias[0];
$useralias = $arr_card_alias[1];
if ($uipass == '' || strlen($uipass) == 0) {
$uipass = MDP_STRING();
}
// CHECK PARAMETERS LASTNAME ; FIRSTNAME ; ADDRESS ; ....
if (!is_numeric($credit) || !is_numeric($creditlimit) || !is_numeric($expiredays) || $activated != 0 && $activated != 1 || $simultaccess != 0 && $simultaccess != 1 || $runservice != 0 && $runservice != 1 || strlen($lastname) > 40 || strlen($firstname) > 40 || strlen($address) > 100 || strlen($city) > 40 || strlen($state) > 40 || strlen($country) > 40 || strlen($zipcode) > 40 || strlen($phone) > 40 || strlen($email) > 60 || strlen($fax) > 40) {
a2b_mail(EMAIL_ADMIN, "ALARM : API - BAD PARAMETER ", $mail_content);
error_log("[" . date("Y/m/d G:i:s", mktime()) . "] " . " - BAD PARAMETER " . "\n", 3, $logfile);
return array($transaction_code, '', '', '', '', 'Error', 'BAD PARAMETER');
} else {
if ($expirationdate == '') {
$expirationdate = "now()";
} else {
$expirationdate = "'{$expirationdate}'";
}
$DBHandle = DbConnect();
$instance_sub_table = new Table($FG_ADITION_SECOND_ADD_TABLE, $FG_ADITION_SECOND_ADD_FIELDS);
$FG_ADITION_SECOND_ADD_VALUE = "'{$cardnum}', '{$useralias}', '" . $credit . "', '" . $tariff . "', '0', '{$activated}', '{$status}', '{$lastname}', '{$firstname}', '{$email}', '{$address}', '{$city}', " . "'{$state}', '{$country}', '{$zipcode}', '{$phone}', '{$fax}', '{$cardnum}', " . $simultaccess . ", '" . $currency . "', '" . $typepaid . "','" . $creditlimit . "', '" . $language . "', '" . $runservice . "', '" . $enableexpire . "', {$expirationdate}, '{$expiredays}', '{$uipass}', '{$iax_friend}', '{$sip_friend}'";
$result_query = $instance_sub_table->Add_table($DBHandle, $FG_ADITION_SECOND_ADD_VALUE, null, null, 'id');
if ($result_query) {
$id_cc_card = $result_query;
if (strlen($callerid_list) > 1) {
$callerid_list = split(',', $callerid_list);
if (count($callerid_list) > 0) {
$k = 0;
foreach ($callerid_list as $mycallerid) {
$k++;
if (strlen($mycallerid) > 1) {
$QUERY = "SELECT * FROM cc_callerid WHERE cid='{$mycallerid}'";
$result = $instance_sub_table->SQLExec($DBHandle, $QUERY);
if (!is_array($result)) {
$QUERY = "INSERT INTO cc_callerid (cid, id_cc_card) VALUES ('{$mycallerid}', '{$id_cc_card}')";
$result = $instance_sub_table->SQLExec($DBHandle, $QUERY, 0);
if ($result == false) {
$callerid_result .= "|callerid{$k}-{$mycallerid}=NOK";
} else {
$callerid_result .= "|callerid{$k}-{$mycallerid}=OK";
}
} else {
$callerid_result .= "|callerid{$k}-{$mycallerid}=NOK";
}
}
}
}
}
//return array('transaction_code', 'account_number', 'card_number', $useralias, 'uipass', 'result', "IDCARD_CREATED=$id_cc_card"."$callerid_result");
//|LASTQUERY=$QUERY
// CHECK IF THERE IS A FRIEND TO CREATE
if ($iax_friend || $sip_friend) {
// NEW ACCOUNT CREATED
$type = FRIEND_TYPE;
$allow = FRIEND_ALLOW;
$context = FRIEND_CONTEXT;
$nat = FRIEND_NAT;
$amaflags = FRIEND_AMAFLAGS;
$qualify = FRIEND_QUALIFY;
$host = FRIEND_HOST;
$dtmfmode = FRIEND_DTMFMODE;
$uipass = MDP_STRING();
$FG_QUERY_ADITION_SIP_IAX = 'name, type, username, accountcode, regexten, callerid, amaflags, secret, md5secret, nat, dtmfmode, qualify, canreinvite,disallow, allow, host, callgroup, context, defaultip, fromuser, fromdomain, insecure, language, mailbox, permit, deny, mask, pickupgroup, port,restrictcid, rtptimeout, rtpholdtimeout, musiconhold, regseconds, ipaddr, cancallforward';
// For IAX and SIP
$param_add_fields = "name, accountcode, regexten, amaflags, callerid, context, dtmfmode, host, type, username, allow, secret";
$param_add_value = "'{$cardnum}', '{$cardnum}', '{$cardnum}', '{$amaflags}', '{$cardnum}', '{$context}', '{$dtmfmode}','{$host}', '{$type}', '{$cardnum}', '{$allow}', '" . $uipass . "', '{$id_cc_card}', '{$nat}', '{$qualify}'";
$list_names = explode(",", $FG_QUERY_ADITION_SIP_IAX);
$FG_TABLE_SIP_NAME = "cc_sip_buddies";
$FG_TABLE_IAX_NAME = "cc_iax_buddies";
for ($ki = 0; $ki < 2; $ki++) {
if ($ki == 0) {
if (!$sip_friend) {
continue;
}
$cfriend = 'sip';
$FG_TABLE_NAME = "cc_sip_buddies";
$buddyfile = BUDDY_SIP_FILE;
} else {
if (!$iax_friend) {
continue;
}
$cfriend = 'iax';
$FG_TABLE_NAME = "cc_iax_buddies";
$buddyfile = BUDDY_IAX_FILE;
//.........这里部分代码省略.........
示例10: add_agi_confx
function add_agi_confx($handle = null)
{
if (empty($handle)) {
$handle = DbConnect();
}
$instance_table = new Table();
$config_group = array();
$config_group = agi_confx_title();
// calling function to generate agi-conf(title_number)
$group_title = $config_group[0];
$config_group_id = $config_group[1];
$description = $config_group[2];
$base_group_title = 'agi-conf' . $config_group[3];
$value = "'{$group_title}', '{$description}'";
$func_fields = "group_title, group_description";
$func_table = 'cc_config_group';
$id_name = "id";
$inserted_id = $instance_table->Add_table($handle, $value, $func_fields, $func_table, $id_name);
$value = "SELECT config_title, config_key, config_value, config_description, config_valuetype, '{$group_title}', config_listvalues FROM cc_config WHERE config_group_title = '{$base_group_title}'";
$func_fields = "config_title, config_key, config_value, config_description, config_valuetype, config_group_title, config_listvalues";
$func_table = 'cc_config';
$id_name = "";
$subquery = true;
$result = $instance_table->Add_table($handle, $value, $func_fields, $func_table, $id_name, $subquery);
return $group_title;
}
示例11: elseif
function insert_voip_config ($sip, $iax, $id_card, $accountnumber, $passui_secret, $useralias, $language)
{
$who_id = '';
if (!isset ($sip))
$sip = 0;
if (!isset ($iax))
$iax = 0;
// SIP / IAX FRIENDS TABLE
$FG_TABLE_SIP_NAME = "cc_sip_buddies";
$FG_TABLE_IAX_NAME = "cc_iax_buddies";
if ((isset ($sip)) || (isset ($iax))) {
$type = FRIEND_TYPE;
$allow = str_replace(' ', '', FRIEND_ALLOW);
$context = FRIEND_CONTEXT;
$nat = FRIEND_NAT;
$amaflags = FRIEND_AMAFLAGS;
$qualify = FRIEND_QUALIFY;
$host = FRIEND_HOST;
$dtmfmode = FRIEND_DTMFMODE;
if (!USE_REALTIME) {
if(($sip == 1) && ($iax == 1))
$key = "sip_iax_changed";
elseif ($sip == 1)
$key = "sip_changed";
elseif ($iax == 1)
$key = "iax_changed";
//check who
if (isset($_SESSION["user_type"]) && $_SESSION["user_type"]=="ADMIN") {
$who = Notification::$ADMIN;
$who_id = $_SESSION['admin_id'];
} elseif (isset($_SESSION["user_type"]) && $_SESSION["user_type"]=="AGENT") {
$who = Notification::$AGENT;
$who_id = $_SESSION['agent_id'];
} else {
$who=Notification::$UNKNOWN;
$id=-1;
}
NotificationsDAO::AddNotification($key, Notification::$HIGH, $who, $who_id);
}
}
// Insert data for sip_buddy
if ($sip) {
$FG_QUERY_ADITION_SIP_FIELDS = "name, accountcode, regexten, amaflags, callerid, context, dtmfmode, host, type, defaultuser, allow, secret, id_cc_card, nat, qualify, language, rtptimeout, rtpholdtimeout, rtpkeepalive, allowtransfer";
$instance_sip_table = new Table($FG_TABLE_SIP_NAME, $FG_QUERY_ADITION_SIP_FIELDS);
$FG_QUERY_ADITION_SIP_IAX_VALUE = "'$useralias', '$accountnumber', '', '$amaflags', '', '$context', '$dtmfmode','$host', '$type', ".
"'$useralias', '$allow', '$passui_secret', '$id_card', '$nat', '$qualify', '$language', '60', '300', '30', 'yes'";
$result_query1 = $instance_sip_table->Add_table($this->DBHandler, $FG_QUERY_ADITION_SIP_IAX_VALUE, null, null, null);
if (USE_REALTIME) {
$_SESSION["is_sip_iax_change"] = 1;
$_SESSION["is_sip_changed"] = 1;
}
}
// Insert data for iax_buddy
if ($iax) {
$FG_QUERY_ADITION_IAX_FIELDS = "name, accountcode, regexten, amaflags, callerid, context, host, type, username, allow, secret, id_cc_card, qualify";
$instance_iax_table = new Table($FG_TABLE_IAX_NAME, $FG_QUERY_ADITION_IAX_FIELDS);
$FG_QUERY_ADITION_SIP_IAX_VALUE = "'$accountnumber', '$accountnumber', '$accountnumber', '$amaflags', '', '$context', '$host', '$type', ".
"'$accountnumber', '$allow', '$passui_secret', '$id_card', '$qualify'";
$result_query2 = $instance_iax_table->Add_table($this->DBHandler, $FG_QUERY_ADITION_SIP_IAX_VALUE, null, null, null);
if (USE_REALTIME) {
$_SESSION["is_sip_iax_change"] = 1;
$_SESSION["is_iax_changed"] = 1;
}
}
}
示例12: insertReceiptItem
public function insertReceiptItem($desc, $price)
{
$DBHandle = DbConnect();
$instance_sub_table = new Table("cc_receipt_item", "*");
$QUERY_FIELDS = 'id_receipt, description,price';
$QUERY_VALUES = "'{$this->id}', '{$desc}','{$price}'";
$return = $instance_sub_table->Add_table($DBHandle, $QUERY_VALUES, $QUERY_FIELDS, 'cc_receipt_item', 'id');
}
示例13: insertComment
public function insertComment($desc, $creator, $creator_type)
{
$DBHandle = DbConnect();
$instance_sub_table = new Table("cc_ticket_comment", "*");
$QUERY_FIELDS = 'id_ticket, description,creator, creator_type';
$QUERY_VALUES = "'{$this->id}', '{$desc}','{$creator}', '{$creator_type}'";
switch ($creator_type) {
case 0:
$QUERY_FIELDS .= " ,viewed_cust ";
$QUERY_VALUES .= " ,'0'";
break;
case 1:
$QUERY_FIELDS .= " ,viewed_admin ";
$QUERY_VALUES .= " ,'0'";
break;
case 2:
$QUERY_FIELDS .= " ,viewed_agent ";
$QUERY_VALUES .= " ,'0'";
break;
}
$return = $instance_sub_table->Add_table($DBHandle, $QUERY_VALUES, $QUERY_FIELDS, 'cc_ticket_comment', 'id');
switch ($creator_type) {
case 0:
$instance_sub_table = new Table("cc_card", "lastname, firstname");
$QUERY = " id = " . $creator;
$subreturn = null;
$subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$subvalue = $subreturn[0];
if (!is_null($subvalue)) {
$owner_comment = $subvalue["lastname"] . " " . $subvalue["firstname"];
}
break;
case 1:
$instance_sub_table = new Table("cc_ui_authen", "*");
$QUERY = " userid = " . $creator;
$subreturn = null;
$subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$subvalue = $subreturn[0];
if (!is_null($subvalue)) {
$owner_comment = "(ADMINISTRATOR) " . $subvalue["login"];
}
break;
case 2:
$instance_sub_table = new Table("cc_agent", "lastname, firstname,login");
$QUERY = " id = " . $creator;
$subreturn = null;
$subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$subvalue = $subreturn[0];
if (!is_null($subvalue)) {
$owner_comment = "(AGENT) " . $subvalue["login"] . " - " . $subvalue["firstname"] . " " . $subvalue["lastname"];
}
break;
}
$owner = $this->creator_login . " (" . $this->creator_firstname . " " . $this->creator_lastname . ")";
try {
$mail = new Mail(Mail::$TYPE_TICKET_MODIFY, null, $this->creator_language);
$mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
$mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $this->id);
$mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $this->description);
$mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($this->priority));
$mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, Ticket::getStatusDisplay($this->status));
$mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $this->title);
$mail->replaceInEmail(Mail::$TICKET_COMMENT_DESCRIPTION_KEY, $desc);
$mail->replaceInEmail(Mail::$TICKET_COMMENT_CREATOR_KEY, $owner_comment);
$mail->send($this->creator_email);
} catch (A2bMailException $e) {
$error_msg = $e->getMessage();
}
try {
$mail = new Mail(Mail::$TYPE_TICKET_MODIFY, null, $this->supportbox_language);
$mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
$mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $this->id);
$mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $this->description);
$mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($this->priority));
$mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, Ticket::getStatusDisplay($this->status));
$mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $this->title);
$mail->replaceInEmail(Mail::$TICKET_COMMENT_DESCRIPTION_KEY, $desc);
$mail->replaceInEmail(Mail::$TICKET_COMMENT_CREATOR_KEY, $owner_comment);
$mail->send($this->supportbox_email);
} catch (A2bMailException $e) {
$error_msg = $e->getMessage();
}
}
示例14: DbConnect
}
$DBHandle = DbConnect();
if (!empty($action)) {
switch ($action) {
case 'add' :
$DBHandle = DbConnect();
$instance_table = new Table("cc_message_agent","COUNT(*)");
$clause="id_agent = $id";
$result=$instance_table -> Get_list($DBHandle, $clause);
if(is_array($result) && sizeof($result)>0){
$count = $result[0][0];
$fields="id_agent,type,message,order_display,logo";
if(empty($logo))$logo=0;
$values="$id,$type,'".addslashes($_POST['message'])."',$count,$logo";
$return=$instance_table->Add_table($DBHandle, $values, $fields);
if($return)$result_param ="success";
else $result_param ="faild";
header("Location: A2B_agent_home.php?" . "id=" . $id . "&result=$result_param");
die();
}
header("Location: A2B_agent_home.php?" . "id=" . $id . "&result=faild");
die();
break;
case 'askedit' :
if(is_numeric($id_msg)){
$DBHandle = DbConnect();
$clause = "id = $id_msg";
$instance_table = new Table("cc_message_agent","*");
$result=$instance_table -> Get_list($DBHandle, $clause);
if(is_array($result) && sizeof($result)>0){
示例15: Table
if (!empty($id) && is_numeric($id)) {
$instance_table_remittance = new Table("cc_remittance_request", "*");
$param_update_remittance = "status = '1'";
$clause_update_remittance = " id ='{$id}'";
$instance_table_remittance->Update_table($DBHandle, $param_update_remittance, $clause_update_remittance, $func_table = null);
// load
$result = $instance_table_remittance->Get_list($DBHandle, $clause_update_remittance);
$type = $result[0]['type'];
$agent_id = $result[0]['id_agent'];
$credit = $result[0]['amount'];
if ($type == 0) {
// insert refill
$field_insert = " credit, agent_id, description";
$value_insert = "'" . $credit . "', '{$agent_id}', '" . gettext('REFILL BY REMITTANCE REQUEST') . "'";
$instance_sub_table = new Table("cc_logrefill_agent", $field_insert);
$instance_sub_table->Add_table($DBHandle, $value_insert, null, null, 'id');
//REFILL... UPDATE AGENT
$instance_table_agent = new Table("cc_agent");
$param_update_agent = "credit = credit + '" . $credit . "' , com_balance = com_balance - {$credit} ";
$clause_update_agent = " id='{$agent_id}'";
$instance_table_agent->Update_table($DBHandle, $param_update_agent, $clause_update_agent, $func_table = null);
} else {
//UPDATE AGENT
$instance_table_agent = new Table("cc_agent");
$param_update_agent = " com_balance = com_balance - {$credit} ";
$clause_update_agent = " id='{$agent_id}'";
$instance_table_agent->Update_table($DBHandle, $param_update_agent, $clause_update_agent, $func_table = null);
}
}
die;
}