Ejemplo n.º 1
0
	static function DelNotification($id) {
		if (is_numeric($id)) {
			$DBHandle = DbConnect();
			$table = new Table("cc_notification", "*");
			$CLAUSE = " id = " . $id ;
			$table->Delete_table($DBHandle, $CLAUSE);
			$table = new Table("cc_notification_admin", "*");
			$CLAUSE = " id_notification = " . $id ;
			$table->Delete_table($DBHandle, $CLAUSE);
			return true;
		} else
			return false;
  	 }
Ejemplo n.º 2
0
	/**
     * Function did_use_delete
     * @public
     */
	static public function did_use_delete()
	{
		$FormHandler = FormHandler::GetInstance();
		$processed = $FormHandler->getProcessed();
		$did_id=$processed['id'];
		$FG_TABLE_DID_USE_NAME = "cc_did_use";
		$FG_TABLE_DID_USE_CLAUSE= "id_did = '".$did_id."' and releasedate IS NULL";
		$FG_TABLE_DID_USE_PARAM= "releasedate = now()";
		$instance_did_use_table = new Table($FG_TABLE_DID_USE_NAME);
		$result_query= $instance_did_use_table -> Update_table ($FormHandler->DBHandle, $FG_TABLE_DID_USE_PARAM, $FG_TABLE_DID_USE_CLAUSE, null);
		$FG_TABLE_DID_USE_NAME = "cc_did_destination";
		$instance_did_use_table = new Table($FG_TABLE_DID_USE_NAME);
		$FG_TABLE_DID_USE_CLAUSE= "id_cc_did = '".$did_id."'";
		$result_query= $instance_did_use_table -> Delete_table ($FormHandler->DBHandle, $FG_TABLE_DID_USE_CLAUSE, null);
	}
Ejemplo n.º 3
0
}
$HD_Form->setDBHandler(DbConnect());
$HD_Form->init();
if ($id != "" || !is_null($id)) {
    $HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "{$id}", $HD_Form->FG_EDITION_CLAUSE);
}
if (!isset($form_action)) {
    $form_action = "list";
}
//ask-add
if (!isset($action)) {
    $action = $form_action;
}
if ($form_action == "delete") {
    $instance_table = new Table($HD_Form->FG_TABLE_NAME, null);
    $res_delete = $instance_table->Delete_table($HD_Form->DBHandle, $HD_Form->FG_EDITION_CLAUSE, null);
    if (!$res_delete) {
        echo "error deletion";
    } else {
        unlink($path);
    }
}
if ($form_action == "restore") {
    $instance_table_backup = new Table($HD_Form->FG_TABLE_NAME, $HD_Form->FG_QUERY_EDITION);
    $list = $instance_table_backup->Get_list($HD_Form->DBHandle, $HD_Form->FG_EDITION_CLAUSE, null, null, null, null, 1, 0);
    $path = $list[0][1];
    if (substr($path, -3) == '.gz') {
        // WE NEED TO GZIP
        $run_gzip = GUNZIP_EXE . " -c " . $path . " | ";
    }
    if (DB_TYPE != 'postgres') {
 /**
  * Function to del_content
  * @public     	 
  */
 function perform_del_content($sub_action, $id)
 {
     $processed = $this->getProcessed();
     $table_split = preg_split("/:/", $this->FG_TABLE_EDITION[$sub_action][14]);
     if (array_key_exists($table_split[1] . '_hidden', $processed)) {
         $value = trim($processed[$table_split[1] . '_hidden']);
     } else {
         $value = trim($processed[$table_split[1]]);
     }
     $instance_sub_table = new Table($table_split[0], $table_split[1] . ", " . $table_split[5]);
     $SPLIT_FG_DELETE_CLAUSE = $table_split[1] . "='" . $value . "' AND " . $table_split[5] . "='" . trim($id) . "'";
     $instance_sub_table->Delete_table($this->DBHandle, $SPLIT_FG_DELETE_CLAUSE, $func_table = null);
 }
            }
            $param_update .= $sp . "{$fields_name}" . $sp . " = '" . addslashes(trim(${$fields_name})) . "'";
        }
    }
    if ($FG_DEBUG == 1) {
        echo "<br><hr> {$param_update}";
    }
    if ($VALID_SQL_REG_EXP) {
        $instance_table->Update_table($DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null);
    }
    if ($VALID_SQL_REG_EXP && isset($FG_GO_LINK_AFTER_ACTION)) {
        Header("Location: {$FG_GO_LINK_AFTER_ACTION}" . $id);
    }
}
if ($form_action == "delete") {
    $res_delete = $instance_table->Delete_table($DBHandle, $FG_EDITION_CLAUSE, $func_table = null);
    if (!$res_delete) {
        echo gettext("error deletion");
    } else {
    }
    $FG_INTRO_TEXT_DELETION = str_replace("%id", "{$id}", $FG_INTRO_TEXT_DELETION);
    $FG_INTRO_TEXT_DELETION = str_replace("%table", "{$FG_TABLE_NAME}", $FG_INTRO_TEXT_DELETION);
    if (isset($FG_GO_LINK_AFTER_ACTION)) {
        Header("Location: {$FG_GO_LINK_AFTER_ACTION_DELETE}" . $id);
    }
}
if ($form_action == "edit" || $form_action == "ask-delete" || $form_action == "ask-edit" || $form_action == "add-content" || $form_action == "del-content") {
    if ($FG_DEBUG >= 2) {
        echo "FG_EDITION_CLAUSE:{$FG_EDITION_CLAUSE}";
    }
    $list = $instance_table->Get_list($DBHandle, $FG_EDITION_CLAUSE, null, null, null, null, 1, 0);
Ejemplo n.º 6
0
    $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}");
}
$smarty->display('main.tpl');
//load rates
$DBHandle = DbConnect();
$table_rates = new Table("cc_package_rate JOIN cc_ratecard ON cc_ratecard.id = cc_package_rate.rate_id LEFT JOIN cc_prefix ON cc_prefix.prefix = cc_ratecard.destination ", "DISTINCT cc_ratecard.id,cc_prefix.destination, cc_ratecard.dialprefix");
$rates_clauses = " cc_package_rate.package_id = {$id}";
$result_rates = $table_rates->Get_list(DbConnect(), $rates_clauses);
echo $CC_help_offer_package;
?>
<br/>

<SCRIPT LANGUAGE="javascript">
var win= null;
function addrate(selvalue)
	
****************************************************************************/
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 ####]");
Ejemplo n.º 8
0
function archive_data($condition, $entity = "")
{
    $handle = DbConnect();
    $instance_table = new Table();
    if (!empty($entity)) {
        if ($entity == "card") {
            $func_fields = "id, creationdate, firstusedate, expirationdate, enableexpire, expiredays, username, useralias, uipass, credit, tariff, id_didgroup, activated, status, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, inuse, simultaccess, currency, lastuse, nbused, typepaid, creditlimit, voipcall, sip_buddy, iax_buddy, language, redial, runservice, nbservice, id_campaign, num_trials_done, vat, servicelastrun, initialbalance, invoiceday, autorefill, loginkey, mac_addr, id_timezone, tag, voicemail_permitted, voicemail_activated, last_notification, email_notification, notify_email, credit_notification, id_group, company_name, company_website, VAT_RN, traffic, traffic_target, discount, restriction";
            $value = "SELECT {$func_fields} FROM cc_card {$condition}";
            $func_table = 'cc_card_archive';
            $id_name = "";
            $subquery = true;
            $result = $instance_table->Add_table($handle, $value, $func_fields, $func_table, $id_name, $subquery);
            $fun_table = "cc_card";
            if (strpos($condition, 'WHERE') > 0) {
                $condition = str_replace("WHERE", "", $condition);
            }
            $result = $instance_table->Delete_table($handle, $condition, $fun_table);
        } else {
            if ($entity == "call") {
                $value = "SELECT id, sessionid,uniqueid,card_id,nasipaddress,starttime,stoptime,sessiontime,calledstation,sessionbill,id_tariffgroup,id_tariffplan,id_ratecard,id_trunk,sipiax,src,id_did,buyrate,id_card_package_offer,real_sessiontime FROM cc_call {$condition}";
                $func_fields = "id, sessionid,uniqueid,card_id,nasipaddress,starttime,stoptime,sessiontime,calledstation,sessionbill,id_tariffgroup,id_tariffplan,id_ratecard,id_trunk,sipiax,src,id_did,buyrate,id_card_package_offer,real_sessiontime";
                $func_table = 'cc_call_archive';
                $id_name = "";
                $subquery = true;
                $result = $instance_table->Add_table($handle, $value, $func_fields, $func_table, $id_name, $subquery);
                if (strpos($condition, 'WHERE') > 0) {
                    $condition = str_replace("WHERE", "", $condition);
                }
                $fun_table = "cc_call";
                $result = $instance_table->Delete_table($handle, $condition, $fun_table);
            }
        }
    }
    return 1;
}
Ejemplo n.º 9
0
function archive_data($condition, $entity = "")
{
    if (empty($condition)) {
        return 0;
        exit;
    }
    $handle = DbConnect();
    $instance_table = new Table();
    if (!empty($entity)) {
        if ($entity == "card") {
            $value = "SELECT id, creationdate, firstusedate, expirationdate, enableexpire, expiredays, username, useralias, uipass, credit, tariff, id_didgroup, activated, status, lastname, firstname, address, city, state, country, zipcode, phone, email,fax, inuse, simultaccess, currency, lastuse,nbused, typepaid, creditlimit, voipcall, sip_buddy, iax_buddy, language, redial, runservice, nbservice, id_campaign, num_trials_done, callback, vat, servicelastrun, initialbalance, invoiceday,autorefill, loginkey, activatedbyuser, mac_addr, id_timezone, tag, template_invoice, template_outstanding FROM cc_card {$condition}";
            $func_fields = "id, creationdate, firstusedate, expirationdate, enableexpire, expiredays, username, useralias, uipass, credit, tariff, id_didgroup, activated, status, lastname, firstname, address, city, state, country, zipcode, phone, email,fax, inuse, simultaccess, currency, lastuse,nbused, typepaid, creditlimit, voipcall, sip_buddy, iax_buddy, language, redial, runservice, nbservice, id_campaign, num_trials_done, callback, vat, servicelastrun, initialbalance, invoiceday,autorefill, loginkey, activatedbyuser, mac_addr, id_timezone, tag, template_invoice, template_outstanding";
            $func_table = 'cc_card_archive';
            $id_name = "";
            $subquery = true;
            $result = $instance_table->Add_table($handle, $value, $func_fields, $func_table, $id_name, $subquery);
            $fun_table = "cc_card";
            if (strpos($condition, 'WHERE') > 0) {
                $condition = str_replace("WHERE", "", $condition);
            }
            $result = $instance_table->Delete_table($handle, $condition, $fun_table);
        } else {
            if ($entity == "call") {
                $value = "SELECT id, 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 {$condition}";
                $func_fields = "id, 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($handle, $value, $func_fields, $func_table, $id_name, $subquery);
                if (strpos($condition, 'WHERE') > 0) {
                    $condition = str_replace("WHERE", "", $condition);
                }
                $fun_table = "cc_call";
                $result = $instance_table->Delete_table($handle, $condition, $fun_table);
            }
        }
    }
    return 1;
}
Ejemplo n.º 10
0
 function Remove_Card($security_key, $transaction_code, $account_number, $cardnumber)
 {
     // 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: Remove_Card [{$transaction_code}, {$account_number}, {$cardnumber}]";
     // 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_TABLE = "cc_card";
     $DBHandle = DbConnect();
     $instance_sub_table = new Table($FG_TABLE);
     $FG_EDITION_CLAUSE = " username = '******' ";
     $res_delete = $instance_sub_table->Delete_table($DBHandle, $FG_EDITION_CLAUSE);
     if (!$res_delete) {
         return array($transaction_code, $account_number, $cardnumber, 'result=ERROR', 'Cannot remove this cardnumber');
     } else {
         return array($transaction_code, $account_number, $cardnumber, 'result=OK', '');
     }
 }
Ejemplo n.º 11
0
function delete_agi_confx($agi_conf)
{
    if (empty($handle)) {
        $handle = DbConnect();
    }
    $instance_table = new Table();
    $clause = "group_title = '{$agi_conf}'";
    $fun_table = "cc_config_group";
    $result = $instance_table->Delete_table($handle, $clause, $fun_table);
    $clause = "config_group_title = '{$agi_conf}'";
    $fun_table = "cc_config";
    $result = $instance_table->Delete_table($handle, $clause, $fun_table);
    return $result;
}
Ejemplo n.º 12
0
			    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 'delete' :
			if(is_numeric($id_msg)){
			    $DBHandle = DbConnect();
			    $instance_table = new Table("cc_message_agent","*");
			    $clause = "id = $id_msg";
			    $result=$instance_table -> Get_list($DBHandle, $clause);
			    if(is_array($result) && sizeof($result)>0){
				$order = $result[0]['order_display'];
				$instance_table -> Delete_table($DBHandle, $clause);
				$instance_table->Update_table($DBHandle, "order_display = order_display - 1", "id_agent = '".$id."' AND order_display >".$order);
				echo "true";
				die();
			    }
			    echo "false";
			    die();
			}
			echo "false";
			die();
			break;
		case 'up' :
			if(is_numeric($id_msg)){
			    $DBHandle = DbConnect();
			    $clause = "id = $id_msg";
			    $instance_table = new Table("cc_message_agent","*");
Ejemplo n.º 13
0
 public function delPayment($idpayment)
 {
     if (!is_null($this->id)) {
         $DBHandle = DbConnect();
         $instance_sub_table = new Table("cc_invoice_payment", "*");
         $CLAUSE = " id_invoice = " . $this->id . " AND id_payment = {$idpayment}";
         $result = null;
         $instance_sub_table->Delete_table($DBHandle, $CLAUSE);
     } else {
         return null;
     }
 }