Пример #1
0
$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;
    }
}
// Parameter to enable/disable the update of list of value in Config Edition
define("LIST_OF_VALUES", false);
// Define a demo mode
define("DEMO_MODE", false);
// Parameter to show link to Asterisk GUI
define("ASTERISK_GUI_LINK", false);
define("LEN_ALIASNUMBER", isset($A2B->config['global']['len_aliasnumber']) ? $A2B->config['global']['len_aliasnumber'] : null);
define("LEN_VOUCHER", isset($A2B->config['global']['len_voucher']) ? $A2B->config['global']['len_voucher'] : null);
define("BASE_CURRENCY", isset($A2B->config['global']['base_currency']) ? $A2B->config['global']['base_currency'] : null);
define("MANAGER_HOST", isset($A2B->config['global']['manager_host']) ? $A2B->config['global']['manager_host'] : null);
define("MANAGER_USERNAME", isset($A2B->config['global']['manager_username']) ? $A2B->config['global']['manager_username'] : null);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include dirname(__FILE__) . "/lib/admin.defines.php";
include dirname(__FILE__) . "/lib/ProcessHandler.php";
if (!defined('PID')) {
    define("PID", "/var/run/a2billing/currencies_update_yahoo_pid.php");
}
// CHECK IF THE CRONT PROCESS IS ALREADY RUNNING
$prcHandler = new ProcessHandler();
if ($prcHandler->isActive()) {
    die;
    // Already running!
} else {
    $prcHandler->activate();
}
$FG_DEBUG = 0;
$A2B = new A2Billing();
$A2B->load_conf($agi, DEFAULT_A2BILLING_CONFIG, 1);
// DEFINE FOR THE DATABASE CONNECTION
define("BASE_CURRENCY", strtoupper($A2B->config["global"]['base_currency']));
$A2B->load_conf($agi, NULL, 0, $idconfig);
write_log(LOGFILE_CRONT_CURRENCY_UPDATE, basename(__FILE__) . ' line:' . __LINE__ . "[#### START CURRENCY UPDATE ####]");
if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";
    write_log(LOGFILE_CRONT_CURRENCY_UPDATE, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");
    exit;
}
$instance_table = new Table();
$A2B->set_instance_table($instance_table);
$return = currencies_update_yahoo($A2B->DBHandle, $A2B->instance_table);
write_log(LOGFILE_CRONT_CURRENCY_UPDATE, basename(__FILE__) . ' line:' . __LINE__ . $return, 0);
die;
include dirname(__FILE__) . "/lib/ProcessHandler.php";
if (!defined('PID')) {
    define("PID", "/var/run/a2billing/a2billing_subscription_fee_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;
$groupcard = 5000;
$A2B = new A2Billing();
$A2B->load_conf($agi, NULL, 0, $idconfig);
write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[#### BATCH BEGIN ####]");
if (!$A2B->DbConnect()) {
    echo "[Cannot connect to the database]\n";
    write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");
    exit;
}
$instance_table = new Table();
/*
    Pay_Status :
        0 : First USE
        1 : Billed
        2 : Paid
        3 : UnPaid
*/
$QUERY = 'SELECT count(*) FROM cc_card INNER JOIN cc_card_subscription ON cc_card.id = cc_card_subscription.id_cc_card INNER JOIN cc_subscription_service ON cc_card_subscription.id_subscription_fee=cc_subscription_service.id' . ' WHERE cc_subscription_service.status=1 AND cc_card_subscription.startdate < NOW() AND (cc_card_subscription.stopdate = "0000-00-00 00:00:00" OR cc_card_subscription.stopdate > NOW())' . ' AND cc_subscription_service.startdate < NOW() AND (cc_subscription_service.stopdate = "0000-00-00 00:00:00" OR cc_subscription_service.stopdate > NOW()) AND cc_card_subscription.paid_status !=3';
Пример #4
0
		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";
    write_log(LOGFILE_API_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[Cannot connect to the database]");