diff --git a/.gitignore b/.gitignore index 7028482f2..f9053c671 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ *devserver* *sublime* *~ + +# PhpStorm +.idea/ +*.iml +/vendor/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..dcc342063 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: php + +php: + - 5.3 + +env: + - DB=mysql + +before_script: + - composer self-update --no-interaction + - composer install --dev --prefer-source --no-interaction + +# omitting "script:" will default to phpunit +# use the $DB env variable to determine the phpunit.xml to use +script: vendor/bin/phpunit + diff --git a/AGI/a2billing.php b/AGI/a2billing.php index 4b9f30a48..9ef0407c9 100755 --- a/AGI/a2billing.php +++ b/AGI/a2billing.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -39,7 +39,10 @@ error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); +require_once __DIR__ . '/../vendor/autoload.php'; + include(dirname(__FILE__) . "/lib/Class.Table.php"); +include(dirname(__FILE__) . "/lib/Class.Connection.php"); include(dirname(__FILE__) . "/lib/Class.A2Billing.php"); include(dirname(__FILE__) . "/lib/Class.RateEngine.php"); include(dirname(__FILE__) . "/lib/phpagi/phpagi.php"); @@ -49,7 +52,7 @@ $charge_callback = 0; $G_startime = time(); -$agi_version = "A2Billing - v2.0.3"; +$agi_version = "A2Billing - v2.2.0"; if ($argc > 1 && ($argv[1] == '--version' || $argv[1] == '-v')) { echo "$agi_version\n"; @@ -120,11 +123,7 @@ $A2B->CC_TESTING = isset($A2B->agiconfig['debugshell']) && $A2B->agiconfig['debugshell']; //$A2B->CC_TESTING = true; -define("DB_TYPE", isset($A2B->config["database"]['dbtype']) ? $A2B->config["database"]['dbtype'] : null); -define("SMTP_SERVER", isset($A2B->config['global']['smtp_server']) ? $A2B->config['global']['smtp_server'] : null); -define("SMTP_HOST", isset($A2B->config['global']['smtp_host']) ? $A2B->config['global']['smtp_host'] : null); -define("SMTP_USERNAME", isset($A2B->config['global']['smtp_username']) ? $A2B->config['global']['smtp_username'] : null); -define("SMTP_PASSWORD", isset($A2B->config['global']['smtp_password']) ? $A2B->config['global']['smtp_password'] : null); +include(dirname(__FILE__) . "/lib/common.defines.php"); // Print header $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "AGI Request:\n" . print_r($agi->request, true)); @@ -198,6 +197,7 @@ if (($A2B->agiconfig['answer_call'] == 1) && ($stat_channel["result"] != $status_channel) && ($A2B->CC_TESTING != 1)) { if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); $A2B->write_log("[STOP - EXIT]", 0); + $RateEngine->hangup($agi, $A2B); exit(); } @@ -227,7 +227,7 @@ if ($try > 3) { if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); exit(); } } while ($return); @@ -316,7 +316,7 @@ $agi->stream_file('prepaid-final', '#'); if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); exit(); } $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[TRY : $try]"); @@ -371,7 +371,7 @@ $agi->stream_file('prepaid-final', '#'); if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); exit(); } } @@ -415,14 +415,14 @@ } } - $A2B->dnid = $agi->request['agi_dnid']; - $A2B->extension = $agi->request['agi_extension']; + $A2B->dnid = $A2B->orig_dnid; + $A2B->extension = $A2B->orig_ext; if ($A2B->agiconfig['ivr_voucher'] == 1) { $res_dtmf = $agi->get_data('prepaid-refill_card_with_voucher', 5000, 1); $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "RES REFILL CARD VOUCHER DTMF : " . $res_dtmf["result"]); $A2B->ivr_voucher = $res_dtmf["result"]; - if ((isset($A2B->ivr_voucher)) && ($A2B->ivr_voucher == $A2B->agiconfig['ivr_voucher_prefixe'])) { + if ((isset($A2B->ivr_voucher)) && ($A2B->ivr_voucher == $A2B->agiconfig['ivr_voucher_prefix'])) { $vou_res = $A2B->refill_card_with_voucher($agi, $i); } } @@ -579,16 +579,18 @@ $A2B->debug(INFO, $agi, __FILE__, __LINE__, "[ CALL OF THE SYSTEM - [DID=" . $A2B->destination . "]"); - $QUERY = "SELECT cc_did.id, cc_did_destination.id, billingtype, tariff, destination, voip_call, username, useralias, connection_charge, selling_rate, did, ". - " aleg_carrier_connect_charge, aleg_carrier_cost_min, aleg_retail_connect_charge, aleg_retail_cost_min, ". + $QUERY = "SELECT cc_did.id, cc_did_destination.id, billingtype, tariff, destination, voip_call, username, useralias, connection_charge, ". + " selling_rate, did, aleg_carrier_connect_charge, aleg_carrier_cost_min, aleg_retail_connect_charge, aleg_retail_cost_min, ". " aleg_carrier_initblock, aleg_carrier_increment, aleg_retail_initblock, aleg_retail_increment, ". " aleg_timeinterval, ". " aleg_carrier_connect_charge_offp, aleg_carrier_cost_min_offp, aleg_retail_connect_charge_offp, aleg_retail_cost_min_offp, ". " aleg_carrier_initblock_offp, aleg_carrier_increment_offp, aleg_retail_initblock_offp, aleg_retail_increment_offp, ". " cc_card.id ". " FROM cc_did, cc_did_destination, cc_card ". - " WHERE id_cc_did=cc_did.id AND cc_card.status=1 AND cc_card.id=id_cc_card and cc_did_destination.activated=1 AND cc_did.activated=1 AND did='" . $A2B->destination . "' ". - " AND cc_did.startingdate <= CURRENT_TIMESTAMP AND (cc_did.expirationdate > CURRENT_TIMESTAMP OR cc_did.expirationdate IS NULL ". + " WHERE id_cc_did=cc_did.id AND cc_card.status=1 AND cc_card.id=id_cc_card and cc_did_destination.activated=1 ". + " AND cc_did.activated=1 AND did='" . $A2B->destination . "' ". + " AND cc_did.startingdate <= CURRENT_TIMESTAMP ". + " AND (cc_did.expirationdate > CURRENT_TIMESTAMP OR cc_did.expirationdate IS NULL ". " AND cc_did_destination.validated = 1 "; if ($A2B->config["database"]['dbtype'] == "mysql") { $QUERY .= " OR cc_did.expirationdate = '0000-00-00 00:00:00'"; @@ -628,22 +630,22 @@ $RateEngine->Reinit(); $A2B->Reinit(); - $mydnid = $agi->request['agi_extension']; - if ($A2B->CC_TESTING) $mydnid = '11111111'; + $mydnid = $A2B->orig_ext; if (strlen($mydnid) > 0) { $A2B->debug(INFO, $agi, __FILE__, __LINE__, "[DID CALL - [CallerID=" . $A2B->CallerID . "]:[DID=" . $mydnid . "]"); - $QUERY = "SELECT cc_did.id, cc_did_destination.id, billingtype, tariff, destination, voip_call, username, useralias, connection_charge, selling_rate, did, ". - " aleg_carrier_connect_charge, aleg_carrier_cost_min, aleg_retail_connect_charge, aleg_retail_cost_min, ". - " aleg_carrier_initblock, aleg_carrier_increment, aleg_retail_initblock, aleg_retail_increment, ". - " aleg_timeinterval, ". - " aleg_carrier_connect_charge_offp, aleg_carrier_cost_min_offp, aleg_retail_connect_charge_offp, aleg_retail_cost_min_offp, ". - " aleg_carrier_initblock_offp, aleg_carrier_increment_offp, aleg_retail_initblock_offp, aleg_retail_increment_offp ". - " FROM cc_did, cc_did_destination, cc_card ". - " WHERE id_cc_did=cc_did.id and cc_card.status=1 and cc_card.id=id_cc_card and cc_did_destination.activated=1 and cc_did.activated=1 and did='$mydnid' ". - " AND cc_did.startingdate<= CURRENT_TIMESTAMP AND (cc_did.expirationdate > CURRENT_TIMESTAMP OR cc_did.expirationdate IS NULL ". - " AND cc_did_destination.validated=1"; + $QUERY = "SELECT cc_did.id, cc_did_destination.id, billingtype, tariff, destination, voip_call, username, useralias, connection_charge, ". + " selling_rate, did, aleg_carrier_connect_charge, aleg_carrier_cost_min, aleg_retail_connect_charge, aleg_retail_cost_min, ". + " aleg_carrier_initblock, aleg_carrier_increment, aleg_retail_initblock, aleg_retail_increment, ". + " aleg_timeinterval, ". + " aleg_carrier_connect_charge_offp, aleg_carrier_cost_min_offp, aleg_retail_connect_charge_offp, aleg_retail_cost_min_offp, ". + " aleg_carrier_initblock_offp, aleg_carrier_increment_offp, aleg_retail_initblock_offp, aleg_retail_increment_offp ". + " FROM cc_did, cc_did_destination, cc_card ". + " WHERE id_cc_did=cc_did.id AND cc_card.status=1 AND cc_card.id=id_cc_card AND cc_did_destination.activated=1 ". + " AND cc_did.activated=1 AND did='$mydnid' ". + " AND cc_did.startingdate<= CURRENT_TIMESTAMP AND (cc_did.expirationdate > CURRENT_TIMESTAMP OR cc_did.expirationdate IS NULL ". + " AND cc_did_destination.validated=1"; if ($A2B->config["database"]['dbtype'] != "postgres") { // MYSQL $QUERY .= " OR cc_did.expirationdate = '0000-00-00 00:00:00'"; @@ -699,7 +701,7 @@ // SAY GOODBYE if ($A2B->agiconfig['say_goodbye'] == 1) $agi->stream_file('prepaid-final', '#'); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); $A2B->write_log("[STOP - EXIT]", 0); exit(); @@ -715,7 +717,7 @@ if ($A2B->agiconfig['answer_call'] == 1 && $mode == 'cid-callback') { $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, '[HANGUP CLI CALLBACK TRIGGER]'); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); } elseif ($mode == 'cid-prompt-callback') { $agi->answer(); } else { @@ -792,7 +794,7 @@ if ($subtry >= 3) { if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); exit(); } } while ($res_dtmf["result"] != '1' && $res_dtmf["result"] != '2'); @@ -813,7 +815,7 @@ if (strlen($outbound_destination) <= 0) { if ($A2B->set_inuse == 1) $A2B->callingcard_acct_start_inuse($agi, 0); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); exit(); } @@ -841,7 +843,10 @@ $addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover]; $destination = $A2B->destination; - if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) $destination= substr($destination, strlen($removeprefix)); + + // applying prefix rule(s) + $destination = $A2B->removePrefix($removeprefix, $destination); + $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[UPDATED DESTINATION: $destination]"); $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%'); @@ -935,7 +940,7 @@ // END if ($A2B->agiconfig['answer_call'] == 1) { $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, '[HANGUP ALL CALLBACK TRIGGER]'); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); } else { $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, '[ALL CALLBACK TRIGGER RINGING]'); } @@ -985,7 +990,10 @@ $addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover]; $destination = $A2B->destination; - if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) $destination= substr($destination, strlen($removeprefix)); + + // applying prefix rule(s) + $destination = $A2B->removePrefix($removeprefix, $destination); + $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[UPDATED DESTINATION: $destination]"); $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%'); @@ -1248,7 +1256,7 @@ if ($error_settings) { $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[CALLBACK : Error settings accountcode and phonenumber_member]"); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); $A2B->write_log("[STOP - EXIT]", 0); exit(); } @@ -1329,7 +1337,10 @@ $addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover]; $destination = $A2B->destination; - if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) $destination= substr($destination, strlen($removeprefix)); + + // applying prefix rule(s) + $destination = $A2B->removePrefix($removeprefix, $destination); + $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[UPDATED DESTINATION: $destination]"); $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%'); @@ -1458,7 +1469,7 @@ if ($error_settings) { $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[CALLBACK : Error settings accountcode]"); - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); $A2B->write_log("[STOP - EXIT]", 0); exit(); } @@ -1585,9 +1596,9 @@ }// END if ($charge_callback) if ($mode != 'cid-callback' && $mode != 'all-callback') { - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); } elseif ($A2B->agiconfig['answer_call'] == 1) { - $agi->hangup(); + $RateEngine->hangup($agi, $A2B); } // SEND MAIL REMINDER WHEN CREDIT IS TOO LOW diff --git a/AGI/a2billing_monitoring.php b/AGI/a2billing_monitoring.php index 90a868b93..3f87a2fe8 100755 --- a/AGI/a2billing_monitoring.php +++ b/AGI/a2billing_monitoring.php @@ -39,6 +39,8 @@ error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); +require_once __DIR__ . '/../vendor/autoload.php'; + include_once(dirname(__FILE__) . "/lib/Class.Table.php"); include(dirname(__FILE__) . "/lib/Class.A2Billing.php"); include(dirname(__FILE__) . "/lib/Class.RateEngine.php"); diff --git a/AUTHORS b/AUTHORS index 8ef5c7870..77c90e102 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,11 @@ -A2Billing (c) AGPL 2003-2012 +A2Billing (c) AGPL 2003-2015 A2Billing is free software written by Areski Belaid with contributions from : - Rachid Belaid + Rachid Belaid Panos Christeas Steve Dommett Alberto Escudero-Pascual @@ -23,7 +23,7 @@ The following third party software is included with the distribution: * phpagi 2.14 Copyright 2003, 2004, 2005 Matthew Asham and David Eder * smarty 2.6.26 Copyright 2001-2005 New Digital Group, Inc - * jgraph 1.27 Copyright 2001, 2002, 2003, 2004 Johan Persson Aditus Consulting + * jgraph 3.5.0 Copyright 2001, 2002, 2003, 2004 Johan Persson Aditus Consulting * adodb 4.991 Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim * famfamfam.com Icons from Mark James * phpconfig (C) 2003 Dave Packham and Rob Birkinshaw diff --git a/CallBack/callback-daemon-py/INSTALL b/CallBack/callback-daemon-py/INSTALL deleted file mode 100644 index 6de18f1a5..000000000 --- a/CallBack/callback-daemon-py/INSTALL +++ /dev/null @@ -1,76 +0,0 @@ --------------------------------------------------------------------------------- - INSTALL A2B CALLBACK DAEMON --------------------------------------------------------------------------------- - - -- REQUIREMENTS -============================= -python -python-mysqldb -python-psycopg2 -python-sqlalchemy - - - -1) INSTALL DAEMON : CENTOS / REDHAT -===================================== - - Install from egg : - easy_install dist/a2b_callback_daemon-versionXXX.egg - - Install Init Script : - cp a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon - chmod +x /etc/init.d/a2b-callback-daemon - - Add a service to start at boot : - chkconfig --add a2b-callback-daemon - chkconfig a2b-callback-daemon on - - Start Daemon : - service a2b-callback-daemon start - - - -2) INSTALL DAEMON : Debian -============================= - - Install from egg : - easy_install dist/a2b_callback_daemon-versionXXX.egg - - Install Init Script : - cp a2b-callback-daemon.debian /etc/init.d/a2b-callback-daemon - chmod +x /etc/init.d/a2b-callback-daemon - - update-rc.d a2b-callback-daemon defaults 40 60 - * to remove update-rc.d -f a2b-callback-daemon remove - - Start Daemon : - /etc/init.d/a2b-callback-daemon start - - -3) RUN DEBUG MODE -============================= - - cd CallBack/callback-daemon-py/callback_daemon - ./a2b_callback_daemon.py --nodaemon - - - -# ADDITIONAL INFO -============================= - - a) rebuild the source : - - python setup.py build - - b) create a new egg : - - python setup.py bdist_egg - - c) Build RPMs : - - python setup.py bdist_rpm - - - - diff --git a/CallBack/callback-daemon-py/INSTALL.rst b/CallBack/callback-daemon-py/INSTALL.rst new file mode 100644 index 000000000..216f46bd1 --- /dev/null +++ b/CallBack/callback-daemon-py/INSTALL.rst @@ -0,0 +1,83 @@ + +=========================== +INSTALL A2B CALLBACK DAEMON +=========================== + +To install A2B Callback Daemon, make sure you have Python 2.7 or greater installed. +Then follow the instructions bellow. + +Dependencies:: + + * python + * python-mysqldb + * python-psycopg2 + * python-sqlalchemy + + +1) INSTALL DAEMON : CENTOS / REDHAT +----------------------------------- + +Install:: + + cd CallBack/callback-daemon-py + python setup.py install + +Install Init Script:: + + cp callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon + chmod +x /etc/init.d/a2b-callback-daemon + +Add a service to start at boot:: + + chkconfig --add a2b-callback-daemon + chkconfig a2b-callback-daemon on + +Start Daemon:: + + service a2b-callback-daemon start + + +2) INSTALL DAEMON : DEBIAN +-------------------------- + +Install:: + + cd CallBack/callback-daemon-py + python setup.py install + +Install Init script:: + + cp callback_daemon/a2b-callback-daemon.debian /etc/init.d/a2b-callback-daemon + chmod +x /etc/init.d/a2b-callback-daemon + + update-rc.d a2b-callback-daemon defaults 40 60 + * to remove update-rc.d -f a2b-callback-daemon remove + +Start daemon:: + + /etc/init.d/a2b-callback-daemon start + + +3) RUN DEBUG MODE +----------------- + +Run Daemon on debug mode:: + + cd CallBack/callback-daemon-py/callback_daemon + ./a2b_callback_daemon.py --nodaemon + + +4) ADDITIONAL INFO +------------------ + +a) Rebuild the source:: + + python setup.py build + +b) Create a new egg:: + + python setup.py bdist_egg + +c) Kill Daemon:: + + kill -9 `cat /var/run/a2b-callback-daemon.pid` diff --git a/CallBack/callback-daemon-py/callback_daemon/__init__.py b/CallBack/callback-daemon-py/callback_daemon/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/CallBack/callback-daemon-py/callback_daemon/a2b_callback_daemon.py b/CallBack/callback-daemon-py/callback_daemon/a2b_callback_daemon.py index 439fb7b8e..510e8d74a 100755 --- a/CallBack/callback-daemon-py/callback_daemon/a2b_callback_daemon.py +++ b/CallBack/callback-daemon-py/callback_daemon/a2b_callback_daemon.py @@ -7,7 +7,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -32,13 +32,6 @@ kill -9 `cat /var/run/a2b-callback-daemon.pid` ''' -__author__ = "Belaid Arezqui (areski@gmail.com)" -__copyright__ = "Copyright (C) Belaid Arezqui" - -__revision__ = "$Id$" -__version__ = "1.00" - -# Load Python modules import threading import signal import daemon @@ -50,10 +43,6 @@ #import asterisk.manager import manager -INTP_VER = sys.version_info[:2] -if INTP_VER < (2, 2): - raise RuntimeError("Python v.2.2 or later needed") - # Daemon Config File CONFIG_FILE = '/etc/a2billing.conf' @@ -72,7 +61,8 @@ def handler(signum, frame): logging.debug('Signal handler called with signal %d', signum) - logging.debug("At " + str(frame.f_code.co_name) + " in " + str(frame.f_code.co_filename) + " line " + str(frame.f_lineno)) + logging.debug("At " + str(frame.f_code.co_name) + " in " + + str(frame.f_code.co_filename) + " line " + str(frame.f_lineno)) shutdown_all.set() sys.exit() @@ -149,62 +139,64 @@ def perform(self): if (len(request_list) > 0): logging.info(request_list) - prev_id_server_group = -1 - id_server_group = None for current_request in request_list: - - #print current_request.id,' : ',current_request.channel,' : ',current_request.context,' : ',current_request.exten,' : ',current_request.priority,' : ' try: get_Server_Manager = self.inst_cb_db.find_server_manager_roundrobin(current_request.id_server_group) - #print get_Server_Manager.id,' : ',get_Server_Manager.id_group, ' : ',get_Server_Manager.server_ip, ' : ',get_Server_Manager.manager_username + # print "%s;%s;%s;%s" % (get_Server_Manager.id, get_Server_Manager.id_group, + # get_Server_Manager.server_ip, get_Server_Manager.manager_username) except: - logging.error("ERROR to find the Server Manager for the Id group : " + str(current_request.id_server_group)) + logging.error("ERROR to find the Server Manager for the Id group : %s" % + str(current_request.id_server_group)) self.inst_cb_db.update_callback_request(current_request.id, 'ERROR') continue # Connect to Manager + logging.debug("We will try to connect to the manager : host=%s, username=%s" % + (get_Server_Manager.manager_host, get_Server_Manager.manager_username)) try: - self.inst_callback_manager.connect(get_Server_Manager.manager_host, get_Server_Manager.manager_username, get_Server_Manager.manager_secret) + self.inst_callback_manager.connect( + get_Server_Manager.manager_host, + get_Server_Manager.manager_username, + get_Server_Manager.manager_secret) except: # cannot connect to the manager - self.inst_cb_db.update_callback_request( - current_request.id, - 'ERROR') + logging.error("ERROR cannot connect to the manager") + self.inst_cb_db.update_callback_request(current_request.id, 'ERROR') continue current_channel = current_request.channel # UPDATE Callback Request to "Perform Status" - self.inst_cb_db.update_callback_request( - current_request.id, - 'PROCESSING') + self.inst_cb_db.update_callback_request(current_request.id, 'PROCESSING') """ - id ; uniqueid ; entry_time ; status; server_ip ; num_attempt ; last_attempt_time ; manager_result ; agi_result ; callback_time ; channel ; exten - context ; priority ; application ; data ; timeout ; callerid ; variable ; account ; async ; actionid ; id_server ; id_server_group + id ; uniqueid ; entry_time ; status; server_ip ; num_attempt ; last_attempt_time ; + manager_result ; agi_result ; callback_time ; channel ; exten + context ; priority ; application ; data ; timeout ; callerid ; variable ; account ; + async ; actionid ; id_server ; id_server_group """ self.num_placed = self.num_placed + 1 # Initiate call - logging.info("try_originate : " + current_request.channel + " : " + current_request.exten + " : " + current_request.context) + logging.info("try_originate : " + current_request.channel + " : " + + current_request.exten + " : " + current_request.context) try: res_orig = self.inst_callback_manager.try_originate( - current_channel, - current_request.exten, - current_request.context, - current_request.priority, - current_request.timeout, - current_request.callerid, - False, - current_request.account, - current_request.application, - current_request.data, - current_request.variable) + current_channel, + current_request.exten, + current_request.context, + current_request.priority, + current_request.timeout, + current_request.callerid, + False, + current_request.account, + current_request.application, + current_request.data, + current_request.variable) except: # cannot connect to the manager - self.inst_cb_db.update_callback_request( - current_request.id, - 'ERROR') + logging.error("Error connecting to the manager 2: %s" % reason) + self.inst_cb_db.update_callback_request(current_request.id, 'ERROR') continue str_manager_res = str(res_orig) @@ -213,19 +205,20 @@ def perform(self): if (str_manager_res.find('Success') == -1): # Callback Failed self.inst_cb_db.update_callback_request_server( - current_request.id, - 'ERROR', - get_Server_Manager.id, - str_manager_res) + current_request.id, + 'ERROR', + get_Server_Manager.id, + str_manager_res) else: # Callback Successful self.inst_cb_db.update_callback_request_server( - current_request.id, - 'SENT', - get_Server_Manager.id, - str_manager_res) + current_request.id, + 'SENT', + get_Server_Manager.id, + str_manager_res) - logging.info("[" + time.strftime("%Y/%m/%d %H:%M:%S", time.localtime()) + "] Placed " + str(self.num_placed) + " calls") + logging.info("[" + time.strftime("%Y/%m/%d %H:%M:%S", time.localtime()) + "] Placed " + + str(self.num_placed) + " calls") """ self.inst_cb_db.update_callback_request( @@ -243,11 +236,11 @@ class callback_manager(object): def connect(self, host, login, password): if (self._manager_host != host or - self._manager_login != login or - self._manager_passw != password or - self._manager == None): + self._manager_login != login or + self._manager_passw != password or + self._manager is None): # we have different manager parameter so let s connect - if self._manager != None: + if self._manager is not None: self.disconnect() self._manager_host = host self._manager_login = login @@ -276,20 +269,22 @@ def try_connect(self): return True - def try_originate(self, channel = None, exten = None, context = None, priority = None, timeout = None, caller_id = None, async = True, account = None, application = None, data = None, variables = None, actionid = None): + def try_originate(self, channel=None, exten=None, context=None, priority=None, timeout=None, + caller_id=None, async=True, account=None, application=None, data=None, + variables=None, actionid=None): response = self._manager.originate( - channel, - exten, - context, - priority, - timeout, - caller_id, - async, - account, - application, - data, - variables, - actionid) + channel, + exten, + context, + priority, + timeout, + caller_id, + async, + account, + application, + data, + variables, + actionid) return response def disconnect(self): @@ -297,38 +292,10 @@ def disconnect(self): self._manager = None -# ------------------------------ FUNCTION MAIN ------------------------------ - def main(): CallBackDaemon().main() -# ------------------------------ COMMON FUNCTION ------------------------------ - -def IsInt(str): - """ Is the given string an integer? """ - ok = 1 - try: - int(str) - except ValueError: - ok = 0 - except TypeError: - ok = 0 - return ok - - -def readToEnd(manager, message, END_SIGNAL='--END COMMAND--'): - """Read until the end of the current command""" - result = [] - while manager._running.isSet(): - current = message.data - if current.strip() == END_SIGNAL: - return result - else: - result.append(current.rstrip('\n')) - message = manager._response_queue.get() - - # ------------------------------ MAIN ------------------------------ if __name__ == '__main__': CallBackDaemon().main() diff --git a/CallBack/callback-daemon-py/callback_daemon/database.py b/CallBack/callback-daemon-py/callback_daemon/database.py index 7cde2d872..806090d2b 100755 --- a/CallBack/callback-daemon-py/callback_daemon/database.py +++ b/CallBack/callback-daemon-py/callback_daemon/database.py @@ -32,29 +32,13 @@ module to connect to Postgresql & Mysql Database and manipulate database information . ''' - -__author__ = "Belaid Arezqui (areski@gmail.com)" -__copyright__ = "Copyright (C) Belaid Arezqui" - -__revision__ = "$Id$" -__version__ = "1.00" - - - -# ------------------------------ IMPORT ------------------------------ -import sys -INTP_VER = sys.version_info[:2] -if INTP_VER < (2, 2): - raise RuntimeError("Python v.2.2 or later needed") - import ConfigParser from sqlalchemy import * from sqlalchemy import orm from sqlalchemy.orm import sessionmaker -import datetime, time +import datetime -# ------------------------------ CLASS ------------------------------ class SQLError(Exception): ''' Error exception class ''' @@ -65,9 +49,13 @@ def __init__(self, value): def __str__(self): return repr(self.value) -class ConnectionError(Exception): pass -class SQlRow_Empty(Exception): pass +class ConnectionError(Exception): + pass + + +class SQlRow_Empty(Exception): + pass # Class for the ORM @@ -121,18 +109,16 @@ def read_basic_config(self): self.dbpasswd = cp.get(self.section, 'password') self.dbtype = cp.get(self.section, 'dbtype') - - def status_on (self, status): - if (status.lower()=='on') : + def status_on(self, status): + if (status.lower() == 'on'): return 'ACTIVE' else: return 'INACTIVE' - - def db_connect (self): - - if (len(self.dbpasswd) > 0) : - connection_string = self.dbtype + "://" + self.dbuser + ":" + self.dbpasswd + "@" + self.dbhost + "/" + self.dbname + def db_connect(self): + if (len(self.dbpasswd) > 0): + connection_string = self.dbtype + "://" + self.dbuser + ":" + \ + self.dbpasswd + "@" + self.dbhost + "/" + self.dbname else: connection_string = self.dbtype + "://" + self.dbuser + "@" + self.dbhost + "/" + self.dbname @@ -163,52 +149,51 @@ def db_connect (self): #print "connection error to " + connection_string raise ConnectionError(error_message) - - def db_close (self): + def db_close(self): try: self.session.flush() except Exception, error_message: raise SQLError(error_message) - def count_callback_spool(self): - return self.CallBack_Spool_q.filter((self.cc_callback_spool.c.status=='PENDING')).count() - + return self.CallBack_Spool_q.filter((self.cc_callback_spool.c.status == 'PENDING')).count() def find_server_manager(self, c_id_group): get_Server_Manager = self.Server_Manager_q.filter( - (self.cc_server_manager.c.id_group==c_id_group) - ).all() + (self.cc_server_manager.c.id_group == c_id_group) + ).all() return get_Server_Manager - def find_server_manager_roundrobin(self, c_id_group): - - nball_Server_Manager = self.Server_Manager_q.filter( - (self.cc_server_manager.c.id_group==c_id_group) - ).count() - if (nball_Server_Manager == 0): - raise SQlRow_Empty("No Server_Manager has been found for this idgroup : "+ str(c_id_group)) - - nb_sel_Server_Manager = (self.count_server_manager % nball_Server_Manager) + 1 - selected_Server_Manager = self.Server_Manager_q.get(nb_sel_Server_Manager) + cnt_servermanager = self.Server_Manager_q.filter( + (self.cc_server_manager.c.id_group == c_id_group) + ).count() + if not cnt_servermanager: + raise SQlRow_Empty("No Server_Manager has been found for this idgroup : " + str(c_id_group)) + + list_servermanager = self.Server_Manager_q.filter( + (self.cc_server_manager.c.id_group == c_id_group) + ).all() + select_servermanager = (self.count_server_manager % cnt_servermanager) + 1 + #selected_Server_Manager = self.Server_Manager_q.get(select_servermanager) + selected_Server_Manager = list_servermanager[select_servermanager - 1] + # print (selected_Server_Manager) + # print (dir(selected_Server_Manager)) + # print (selected_Server_Manager.server_ip) self.count_server_manager = self.count_server_manager + 1 return selected_Server_Manager - - def find_callback_request(self, c_status = 'PENDING', c_hours = 24): - + def find_callback_request(self, c_status='PENDING', c_hours=24): get_CallBack_Spool = self.CallBack_Spool_q.filter( - (self.cc_callback_spool.c.status==c_status) & - (self.cc_callback_spool.c.entry_time > datetime.datetime.now() - datetime.timedelta(hours=c_hours)) & - ((self.cc_callback_spool.c.callback_time==None) | (self.cc_callback_spool.c.callback_time < datetime.datetime.now())) - ).all() + (self.cc_callback_spool.c.status == c_status) & + (self.cc_callback_spool.c.entry_time > datetime.datetime.now() - datetime.timedelta(hours=c_hours)) & + ((self.cc_callback_spool.c.callback_time == None) | (self.cc_callback_spool.c. callback_time < datetime.datetime.now())) + ).all() return get_CallBack_Spool - - def update_callback_request (self, c_id, c_status): + def update_callback_request(self, c_id, c_status): try: get_CallBack_Spool = self.CallBack_Spool_q.filter((self.cc_callback_spool.c.id == c_id)).one() get_CallBack_Spool.status = c_status @@ -217,8 +202,7 @@ def update_callback_request (self, c_id, c_status): #print "--- nothing to update ---" pass - - def update_callback_request_server (self, c_id, c_status, c_id_server, c_manager_result): + def update_callback_request_server(self, c_id, c_status, c_id_server, c_manager_result): try: get_CallBack_Spool = self.CallBack_Spool_q.filter((self.cc_callback_spool.c.id == c_id)).one() get_CallBack_Spool.status = c_status @@ -236,7 +220,6 @@ def update_callback_request_server (self, c_id, c_status, c_id_server, c_manager if __name__ == "__main__": - """ print "\n\n" inst_cb_db = callback_database() print inst_cb_db.count_callback_spool() @@ -244,25 +227,20 @@ def update_callback_request_server (self, c_id, c_status, c_id_server, c_manager print get_CallBack_Spool = inst_cb_db.find_callback_request('SENT', 121212) for p in get_CallBack_Spool[0:5]: - print p.id,' ===========>>> >>> ',p.uniqueid, '>> ',p.status, '>> ',p.num_attempt, ' ::>> ',p.id_server, ' ::>> ',p.manager_result - - + print "%d ==> %s, %s, %d, %d, %s" % (p.id, p.uniqueid, p.status, p.num_attempt, p.id_server, p.manager_result) - inst_cb_db.update_callback_request (5, 'SENT') - inst_cb_db.update_callback_request (5, 'SENT') + inst_cb_db.update_callback_request(5, 'SENT') + inst_cb_db.update_callback_request_server(5, 'SENT', 77, 'this is a test') - inst_cb_db.update_callback_request_server (5, 'SENT', 77, 'rhaaaaaaaa') - - print + print "" get_Server_Manager = inst_cb_db.find_server_manager(1) for p in get_Server_Manager[0:5]: - print p.id,' ===========>>> >>> ',p.id_group, '>> ',p.server_ip, '>> ',p.manager_username - + print "%d ==> %d, %d, %s" % (p.id, p.id_group, p.server_ip, p.manager_username) try: - get_Server_Manager = inst_cb_db.find_server_manager_roundrobin(11) - print get_Server_Manager.id,' ===========>>> >>> ',get_Server_Manager.id_group, '>> ',get_Server_Manager.server_ip, '>> ',get_Server_Manager.manager_username + server_manager = inst_cb_db.find_server_manager_roundrobin(11) + print ("%d ==> %d, %d, %s" % + (server_manager.id, server_manager.id_group, server_manager.server_ip, server_manager.manager_username)) except: print "--- no manager ---" pass - """ diff --git a/CallBack/callback-daemon-py/callback_daemon/manager.py b/CallBack/callback-daemon-py/callback_daemon/manager.py index 21f2c86bc..491136980 100644 --- a/CallBack/callback-daemon-py/callback_daemon/manager.py +++ b/CallBack/callback-daemon-py/callback_daemon/manager.py @@ -52,7 +52,8 @@ def handle_event(event, manager): and submit patches. """ -import sys,os +import sys +import os import socket import threading import Queue @@ -94,7 +95,7 @@ def parse(self, response): # locate the ':' in our message, if there is one if line.find(':') > -1: - item = [x.strip() for x in line.split(':',1)] + item = [x.strip() for x in line.split(':', 1)] # if this is a header if len(item) == 2: @@ -239,12 +240,12 @@ def send_action(self, cdict={}, **kwargs): # generate the command for key, value in cdict.items(): if isinstance(value, list): - for item in value: - item = tuple([key, item]) - clist.append('%s: %s' % item) + for item in value: + item = tuple([key, item]) + clist.append('%s: %s' % item) else: - item = tuple([key, value]) - clist.append('%s: %s' % item) + item = tuple([key, value]) + clist.append('%s: %s' % item) clist.append(EOL) command = EOL.join(clist) @@ -254,7 +255,7 @@ def send_action(self, cdict={}, **kwargs): except socket.error, (errno, reason): raise ManagerSocketException(errno, reason) - self._reswaiting.insert(0,1) + self._reswaiting.insert(0, 1) response = self._response_queue.get() self._reswaiting.pop(0) @@ -297,12 +298,14 @@ def _receive_data(self): # if we are no longer connected we probably did not # recieve a full message, don't try to handle it - if not self._connected.isSet(): break + if not self._connected.isSet(): + break # make sure our line is a string assert type(line) in StringTypes - lines.append(line) # add the line to our message + # add the line to our message + lines.append(line) # if the line is our EOL marker we have a complete message if line == EOL: @@ -310,8 +313,10 @@ def _receive_data(self): # check to see if this is the greeting line if line.find('/') >= 0 and line.find(':') < 0: - self.title = line.split('/')[0].strip() # store the title of the manager we are connecting to - self.version = line.split('/')[1].strip() # store the version of the manager we are connecting to + # store the title of the manager we are connecting to + self.title = line.split('/')[0].strip() + # store the version of the manager we are connecting to + self.version = line.split('/')[1].strip() break #sleep(.001) # waste some time before reading another line @@ -391,7 +396,6 @@ def message_loop(self): # wait for our data receiving thread to exit t.join() - def event_dispatch(self): """This thread is responsible fore dispatching events""" @@ -412,8 +416,8 @@ def event_dispatch(self): # now execute the functions for callback in callbacks: - if callback(ev, self): - break + if callback(ev, self): + break def connect(self, host, port=5038): """Connect to the manager interface""" @@ -429,7 +433,7 @@ def connect(self, host, port=5038): # create our socket and connect try: self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self._sock.connect((host,port)) + self._sock.connect((host, port)) except socket.error, (errno, reason): raise ManagerSocketException(errno, reason) @@ -467,30 +471,29 @@ def close(self): self._running.clear() - def login(self, username, secret): """Login to the manager, throws ManagerAuthException when login fails""" - cdict = {'Action':'Login'} + cdict = {'Action': 'Login'} cdict['Username'] = username cdict['Secret'] = secret response = self.send_action(cdict) if response.get_header('Response') == 'Error': - raise ManagerAuthException(response.get_header('Message')) + raise ManagerAuthException(response.get_header('Message')) return response def ping(self): """Send a ping action to the manager""" - cdict = {'Action':'Ping'} + cdict = {'Action': 'Ping'} response = self.send_action(cdict) return response def logoff(self): """Logoff from the manager""" - cdict = {'Action':'Logoff'} + cdict = {'Action': 'Logoff'} response = self.send_action(cdict) # Clear connection @@ -502,16 +505,16 @@ def logoff(self): def hangup(self, channel): """Hanup the specfied channel""" - cdict = {'Action':'Hangup'} + cdict = {'Action': 'Hangup'} cdict['Channel'] = channel response = self.send_action(cdict) return response - def status(self, channel = ''): + def status(self, channel=''): """Get a status message from asterisk""" - cdict = {'Action':'Status'} + cdict = {'Action': 'Status'} cdict['Channel'] = channel response = self.send_action(cdict) @@ -520,12 +523,14 @@ def status(self, channel = ''): def redirect(self, channel, exten, priority='1', extra_channel='', context=''): """Redirect a channel""" - cdict = {'Action':'Redirect'} + cdict = {'Action': 'Redirect'} cdict['Channel'] = channel cdict['Exten'] = exten cdict['Priority'] = priority - if context: cdict['Context'] = context - if extra_channel: cdict['ExtraChannel'] = extra_channel + if context: + cdict['Context'] = context + if extra_channel: + cdict['ExtraChannel'] = extra_channel response = self.send_action(cdict) return response @@ -533,23 +538,33 @@ def redirect(self, channel, exten, priority='1', extra_channel='', context=''): def originate(self, channel, exten, context='', priority='', timeout='', caller_id='', async=False, account='', application='', data='', variables={}, ActionID=''): """Originate a call""" - cdict = {'Action':'Originate'} + cdict = {'Action': 'Originate'} cdict['Channel'] = channel cdict['Exten'] = exten - if context: cdict['Context'] = context - if priority: cdict['Priority'] = priority - if timeout: cdict['Timeout'] = timeout - if caller_id: cdict['CallerID'] = caller_id - if async: cdict['Async'] = 'yes' - if account: cdict['Account'] = account - if application: cdict['Application'] = application - if data: cdict['Data'] = data - if ActionID: cdict['ActionID'] = ActionID + if context: + cdict['Context'] = context + if priority: + cdict['Priority'] = priority + if timeout: + cdict['Timeout'] = timeout + if caller_id: + cdict['CallerID'] = caller_id + if async: + cdict['Async'] = 'yes' + if account: + cdict['Account'] = account + if application: + cdict['Application'] = application + if data: + cdict['Data'] = data + if ActionID: + cdict['ActionID'] = ActionID # join dict of vairables together in a string in the form of 'key=val|key=val' # with the latest CVS HEAD this is no longer necessary # if variables: cdict['Variable'] = '|'.join(['='.join((str(key), str(value))) for key, value in variables.items()]) #if variables: cdict['Variable'] = ['='.join((str(key), str(value))) for key, value in variables.items()] - if variables: cdict['Variable'] = variables + if variables: + cdict['Variable'] = variables response = self.send_action(cdict) @@ -558,7 +573,7 @@ def originate(self, channel, exten, context='', priority='', timeout='', caller_ def mailbox_status(self, mailbox): """Get the status of the specfied mailbox""" - cdict = {'Action':'MailboxStatus'} + cdict = {'Action': 'MailboxStatus'} cdict['Mailbox'] = mailbox response = self.send_action(cdict) @@ -567,7 +582,7 @@ def mailbox_status(self, mailbox): def command(self, command): """Execute a command""" - cdict = {'Action':'Command'} + cdict = {'Action': 'Command'} cdict['Command'] = command response = self.send_action(cdict) @@ -576,7 +591,7 @@ def command(self, command): def extension_state(self, exten, context): """Get the state of an extension""" - cdict = {'Action':'ExtensionState'} + cdict = {'Action': 'ExtensionState'} cdict['Exten'] = exten cdict['Context'] = context response = self.send_action(cdict) @@ -586,7 +601,7 @@ def extension_state(self, exten, context): def absolute_timeout(self, channel, timeout): """Set an absolute timeout on a channel""" - cdict = {'Action':'AbsoluteTimeout'} + cdict = {'Action': 'AbsoluteTimeout'} cdict['Channel'] = channel cdict['Timeout'] = timeout response = self.send_action(cdict) @@ -594,13 +609,20 @@ def absolute_timeout(self, channel, timeout): return response def mailbox_count(self, mailbox): - cdict = {'Action':'MailboxCount'} + cdict = {'Action': 'MailboxCount'} cdict['Mailbox'] = mailbox response = self.send_action(cdict) return response -class ManagerException(Exception): pass -class ManagerSocketException(ManagerException): pass -class ManagerAuthException(ManagerException): pass +class ManagerException(Exception): + pass + + +class ManagerSocketException(ManagerException): + pass + + +class ManagerAuthException(ManagerException): + pass diff --git a/CallBack/callback-daemon-py/setup.py b/CallBack/callback-daemon-py/setup.py index c97bd53d8..8e1e50aaf 100644 --- a/CallBack/callback-daemon-py/setup.py +++ b/CallBack/callback-daemon-py/setup.py @@ -1,25 +1,59 @@ +# This file is part of A2Billing (http://www.a2billing.net/) +# +# A2Billing, Commercial Open Source Telecom Billing platform, +# powered by Star2billing S.L. +# +# @copyright Copyright (C) 2004-2015 - Star2billing S.L. +# @author Belaid Arezqui +# @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +# @package A2Billing +# +# Software License Agreement (GNU Affero General Public License) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# +# Daemon to proceed Call-Back request from the a2billing plaftorm +# + from setuptools import setup, find_packages setup( - name = "callback_daemon", - version = "1.0", - packages = ['callback_daemon'], - - package_data = { + name="callback_daemon", + version="1.1", + packages=['callback_daemon'], + package_data={ '': ['*.txt', '*.conf', '*.debian', '*.rc'] }, - - entry_points = { + entry_points={ 'console_scripts': [ - 'a2b_callback_daemon = callback_daemon.a2b_callback_daemon:main' + 'a2b_callback_daemon=callback_daemon.a2b_callback_daemon:main' ] }, - - # metadata - author = "Belaid Arezqui", - author_email = "areski@gmail.com", - description = "This Package provide a callback daemon for a2billing", - license = "GPL", - keywords = "callback a2billing daemon", - url = "http://www.asterisk2billing.org/" + author="Belaid Arezqui", + author_email="areski@gmail.com", + description="This Package provide a callback daemon for a2billing", + license="AGPLv3+", + keywords="callback a2billing daemon", + url="http://www.asterisk2billing.org/", + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers, Users', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Topic :: Software Development' + ], ) diff --git a/Checker/checker.init.d.sh b/Checker/checker.init.d.sh new file mode 100644 index 000000000..3d9b3816b --- /dev/null +++ b/Checker/checker.init.d.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Startup script for A2Billing checker +# +# author: Roman Davydov +# +# chkconfig: 345 150 20 +# description: A2Billing checker. + +# Source function library. +. /etc/rc.d/init.d/functions + +DAEMON=/path/to/checker.php +PIDFILE=/var/run/checker.php +PROG=checker +RETVAL=0 + +start() { + echo -n $"Starting $PROG: " + daemon --pidfile $PIDFILE php $DAEMON -p $PIDFILE + RETVAL=$? + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping $PROG: " + killproc -p $PIDFILE + RETVAL=$? + echo + return $RETVAL +} + + +# See how we were called. +case "$1" in + start|debug) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo $"Usage: $PROG {start|stop|restart}" + exit 1 +esac + +exit $RETVAL diff --git a/Checker/checker.php b/Checker/checker.php new file mode 100644 index 000000000..c78971aab --- /dev/null +++ b/Checker/checker.php @@ -0,0 +1,555 @@ + + * @license http://openvoip.co Free (just keep reference to my name and my site) + * + */ + +require_once('phpagi-asmanager.php'); +declare(ticks = 1); + +function _asm_event_handler($ecode, $data, $server, $port) { + if (is_object($checker = Checker::getInstance())) + $checker->asmHandleEvent($ecode, $data, $server, $port); +} + +class Checker { + + private static + $instance = null, + $daemon = false, + $pidfile = '', + $master_pid = 0, + $logfile = 'checker.log', + $action_prefix = 'checker_'; + + private + $childs = array(), + $worker = null, + $stop = false, + $params = array(), + $mysqli = null, + $asm = null; + + public static function getInstance($argv = null) { + if (!self::$instance) { + self::$instance = new self($argv); + + // check args + if (!is_array($argv) || count($argv) == 0) + $argv = array(__FILE__); + $script = basename($argv[0]); + + // show help + if (in_array('-h', $argv)) { + + echo "Usage: $script [OPTIONS] +------------------------------------------------ +OPTIONS: +-p Enable PID file (only one running process) +-nf No fork +-h Show this help + +"; + exit(0); + } + + if (in_array('-nf', $argv)) { + + ini_set('error_reporting', E_ALL); + + self::$master_pid = getmypid(); + self::log('No fork mode', LOG_INFO); + + } else { + + $pid = pcntl_fork(); + if ($pid == -1) { + self::log('Could not fork!', LOG_ERR); + exit(1); + } else if ($pid) { + // we are the parent + exit(0); + } else { + // we are daemon + ini_set('error_log', '/var/log/' . self::$logfile); + ini_set('error_reporting', E_ERROR); + + self::$daemon = true; + self::$master_pid = getmypid(); + + // check pid + if (in_array('-p', $argv)) { + self::log("Checking PID"); + self::$pidfile = "/var/run/$script"; + if (is_file(self::$pidfile)) { + $pid = file_get_contents(self::$pidfile); + $prog = trim(shell_exec("ps --pid $pid -o comm=")); + if (strlen($prog) > 0) { + self::log("Old instance is still running!", LOG_ERR); + self::$pidfile = null; + exit(10); + } + } + + // update pid file + $pid = self::$master_pid; + file_put_contents(self::$pidfile, $pid); + } + } + } + } + + return self::$instance; + } + + private function __construct() { + + // load settings + $config = '/etc/a2billing.conf'; + if (file_exists($config)) + $this->params = parse_ini_file($config, true); + + } + + public function __destruct() { + + if (!$this->worker) { // master ending + + if (count($this->childs) > 0) { + + self::log("Destroying master..."); + foreach ($this->childs as $pid => $id) { + if (posix_kill($pid, SIGTERM)) { + $res = pcntl_waitpid($pid, $status, WNOHANG | WUNTRACED); + if ($res == -1) { + self::log("Something happened with worker, pid = $pid", LOG_ERR); + } else if (!pcntl_wifstopped($status)) { + self::log("Child is agile, killing with 9", LOG_INFO); + posix_kill($pid, 9); + } + } else { + self::log("Cannot kill worker, pid = $pid", LOG_ERR); + } + } + + } // else - it is just daemon parent + + if (self::$daemon) { + # removes PID if exists + if (is_file(self::$pidfile)) { + self::log("Removing PID file"); + unlink(self::$pidfile); + } + } + + } else { + + $pid = self::$master_pid; + self::log("$pid Destroying worker '$this->worker' ..."); + + // signalling to parent + $res = posix_kill($pid, SIGCHLD); + + } + + } + + // signal handler function + public function sig_handler($signo) { + switch ($signo) { + case SIGTERM: + case SIGHUP: + self::log("Term signal recieved, ending..."); + $this->stop = true; + break; + case SIGUSR1: + break; + case SIGCHLD: + self::log("Child term signal recieved, ending..."); + $this->stop = true; + break; + default: + // handle all other signals + } + } + + private function createWorker($id = '') { + // run another child for schedule managing + $pid = pcntl_fork(); + if ($pid == -1) { + self::log("Cannot create worker!", LOG_ERR); + return false; + } else if ($pid) { + // we are the parent + $this->childs[$pid] = $id; + } else { + // we are worker + $this->worker = $id; + $func = array($this, 'initWorker'.$id); + if (is_callable($func)) { + $result = call_user_func($func); + if ($result) { + $func = array($this, 'runWorker'.$id); + if (is_callable($func)) { + // run worker task + self::log("Running worker '$id'"); + exit(call_user_func($func)); + } + self::log("Cannot run worker '$id' !", LOG_ERR); + exit(50); + } + } + self::log("Cannot initiate worker '$id' !", LOG_ERR); + exit(50); + } + return true; + } + + private function initDb() { + // connecting to DB + if (strcasecmp($this->getParam('database.dbtype', ''), 'mysql') != 0) { + self::log('Supports only mysql database', LOG_ERR); + return false; + } + $host = $this->getParam('database.hostname', '127.0.0.1'); + $user = $this->getParam('database.user', 'root'); + $pass = $this->getParam('database.password', ''); + $db = $this->getParam('database.dbname', 'a2billing'); + $mysqli = new mysqli($host, $user, $pass, $db); + if ($mysqli->connect_error) { + self::log('Mysql connection error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error, LOG_ERR); + return false; + } + $this->mysqli = $mysqli; + $this->mysqli->set_charset("utf8"); + return true; + } + + private function initAsm() { + // connecting to Asterisk + $this->asm = new AGI_AsteriskManager(); + $this->asm->pagi = &$this; + if ($this->asm->connect( + $this->getConfig('manager_host', '127.0.0.1'), + $this->getConfig('manager_username', 'manager'), + $this->getConfig('manager_secret', ''))) { + + $this->asm->Events('on'); + $this->asm->add_event_handler('*', '_asm_event_handler'); + } else { + self::log('Asterisk connection error!', LOG_ERR); + return false; + } + return true; + } + + function conlog($str, $vbl = 1) { + if (!self::$daemon) + $this->log($str); + } + + private function initWorkerEventHandler() { + return $this->initDb() && $this->initAsm(); + } + + protected $channels = array(); + private function runWorkerEventHandler() { + + // life cycle + while (!$this->stop) { + if (!$this->pingResources()) + break; + + // send initial request + $this->sendStatusRequest(); + + // handle responses + $this->asm->wait_response(true); + } + + } + + private function asmEventEventHandler($ecode, $data, $server, $port) { + + if ($ecode == 'status') { + + $this->channels[] = $data; + + } else if ($ecode == 'statuscomplete') { + + // do check + $this->doCheck(); + + // sleep to prevent event flooding + sleep(1); + + // send next request + $this->sendStatusRequest(); + + } + + } + + private function sendStatusRequest() { + $data = $this->asm->send_request('Status', array('ActionID' => $this->generateId(time()))); + } + + private function doCheck() { + if (count($this->channels) == 0) + return; + + //print_r($this->channels); + + // list of channels to hangup + $hangup = array(); + + // prepare channels + $channels = array(); + foreach ($this->channels as $channel) { + // check bridged channel + if (isset($channel['BridgedChannel']) && preg_match("/^(.+\/.+)\-.*$/", $channel['BridgedChannel'], $matches)) { + $channel_id = strtolower($matches[1]); + if (!isset($channels[$channel_id])) { + $channels[$channel_id] = array( + 'seconds' => 0, + 'channels' => array() + ); + } + $billsec = $this->asm->GetVar($channel['BridgedChannel'], "CDR(billsec)"); + $channels[$channel_id]['seconds'] += is_array($billsec) && isset($billsec['Value']) ? intval($billsec['Value']) : 0; + $channels[$channel_id]['channels'][$channel['BridgedChannel']] = isset($channel['Accountcode']) ? $channel['Accountcode'] : ''; + } + } + + //print_r($channels); + + // check trunks (minutes_per_day, inuse) + $sql = "select * from cc_trunk"; + $trunks = $this->query($sql); + foreach ($trunks as $t) { + $id = $t['id_trunk']; + $minutes_per_day = intval($t['minutes_per_day']); + $inuse = intval($t['inuse']); + $channel_id = strtolower($t['providertech'] . '/' . $t['providerip']); + + // check if trunk minutes limit exceeded + if ($minutes_per_day > 0 && isset($channels[$channel_id])) { + // getting realtime seconds + $realtime_seconds = $channels[$channel_id]['seconds']; + $sql = "select * from cc_trunk_counter where (id_trunk = '$id') and (calldate = getCurDateByTrunkTZ($id)) and (((seconds + $realtime_seconds) / 60) >= $minutes_per_day) limit 1"; + $data = $this->query($sql); + if (count($data) > 0) + $hangup = array_merge($hangup, array_keys($channels[$channel_id]['channels'])); + } + + // check inuse except for "Local" trunks + $inuse_real = isset($channels[$channel_id]) ? count($channels[$channel_id]['channels']) : 0; + if (strcasecmp(trim($t['providertech']), 'local') != 0 && $inuse_real != $inuse) { + self::log("Fixing 'inuse' for trunk with ID = $id", LOG_INFO); + $sql = "update cc_trunk set inuse = $inuse_real where id_trunk = $id"; + $this->query($sql); + } + } + + // check account balances limit (works only for devices registered on A2B) + $sql = "select * from cc_card where typepaid = 0 and credit <= 0"; + $data = $this->query($sql); + foreach ($data as $card) { + foreach ($channels as $channel_id => $info) { + foreach ($info['channels'] as $channel => $accountcode) { + if (strcasecmp($accountcode, $card['username']) == 0) + $hangup[] = $channel; + } + } + } + + // hangup channels + $hangup = array_unique($hangup); + foreach ($hangup as $channel) { + // sending Hangup for the channel + self::log("Hanging up channel '$channel'", LOG_INFO); + $this->asm->Hangup($channel); + } + + // reset channels list + $this->channels = array(); + } + + public function run() { + $result = 0; + self::log('Starting...', LOG_INFO); + + // set signal handlers for ALL ! + pcntl_signal(SIGTERM, array($this, "sig_handler")); + pcntl_signal(SIGHUP, array($this, "sig_handler")); + pcntl_signal(SIGUSR1, array($this, "sig_handler")); + pcntl_signal(SIGCHLD, array($this, "sig_handler")); + + // create workers + if ($this->createWorker('EventHandler')) { + + // waiting for stop + while (!$this->stop) + sleep(1); + + } else { + $result = 15; + } + + self::log('Exiting...', LOG_INFO); + return $result; + } + + private static function getEventData($event, $key, $default = '') { + if (!is_array($event)) + return $default; + + $event = array_change_key_case($event); + $key = strtolower($key); + return isset($event[$key]) ? $event[$key] : $default; + } + + private static function isId($actid) { + $result = null; + $prefix = self::$action_prefix; + if (preg_match("/^$prefix(.+)$/i", $actid, $matches)) { + $result = $matches[1]; + } + return $result; + } + + private static function generateId($actid) { + return self::$action_prefix . $actid; + } + + private function pingResources() { + + static $stamp_mysqli = 0; + static $stamp_asm = 0; + + // step # 1 - ping mysql + $stamp = time(); + $ping_interval = 3; + if ($this->mysqli !== null && ($stamp - $stamp_mysqli) > $ping_interval) { + $stamp_mysqli = $stamp; + if (!$this->mysqli->ping()) { + self::log("Mysql connection has been lost in '" . $this->worker . "', trying to reconnect...", LOG_ERR); + // reconnect + $connected = false; + while (!$this->stop) { + $connected = $this->initDb(); + if ($connected) + break; + sleep(1); + } + if (!$connected) { + self::log("Cannot establish Mysql connection in '" . $this->worker . "' !", LOG_ERR); + return false; + } else { + self::log("Mysql connection reestablished in '" . $this->worker . "' !", LOG_INFO); + } + } + } + + // step # 2 - ping Asterisk + $stamp = time(); + $ping_interval = 7; + if ($this->asm !== null && ($stamp - $stamp_asm) > $ping_interval) { + $stamp_asm = $stamp; + $result = $this->asm->Ping(); + if (is_array($result) && isset($result['Ping']) && $result['Ping'] == 'Pong') { + // connection OK + } else { + self::log("AMI connection has been lost in '" . $this->worker . "', trying to reconnect...", LOG_ERR); + // reconnect + $connected = false; + while (!$this->stop) { + $connected = $this->initAsm(); + if ($connected) + break; + sleep(1); + } + if (!$connected) { + self::log("Cannot establish AMI connection in '" . $this->worker . "' !", LOG_ERR); + return false; + } else { + self::log("AMI connection reestablished in '" . $this->worker . "' !", LOG_INFO); + } + } + } + + return true; + } + + public function asmHandleEvent($ecode, $data, $server, $port) { + if (!$this->worker) + return; + + $func = array($this, 'asmEvent'.$this->worker); + if (is_callable($func)) + call_user_func_array($func, array($ecode, $data, $server, $port)); + } + + private function getParam($key, $default = null) { + $keys = explode('.', $key); + if (!is_array($keys)) + $keys = array($key); + + // get param + $value = $this->params; + foreach ($keys as $key) { + $value = isset($value[$key]) ? $value[$key] : $default; + } + + return $value; + } + + private function getConfig($key, $default = null, $group = 'global') { + if (!$this->mysqli) + return $default; + + $sql = "select * from cc_config where config_group_title = '$group' and config_key = '$key' limit 1"; + $data = $this->query($sql); + + return count($data) > 0 ? $data[0]['config_value'] : $default; + } + + public static function log($msg, $level = LOG_INFO) { + if (self::$daemon) + syslog($level, $msg); + else + error_log(date('r') . ' - ' . $msg); + } + + public function query($sql) { + $data = array(); + if (is_object($result = $this->mysqli->query($sql))) { + while ($row = $result->fetch_assoc()) + $data[] = $row; + $result->free(); + } + return $data; + } + +} + +// run Process +$checker = Checker::getInstance($argv); +exit($checker->run()); diff --git a/Checker/cid_randomizer.php b/Checker/cid_randomizer.php new file mode 100755 index 000000000..ed41f5558 --- /dev/null +++ b/Checker/cid_randomizer.php @@ -0,0 +1,106 @@ +#!/usr/bin/php -q + s,n,AGI(cid_randomizer.php,PATH/TO/FILE/WITH/CIDS[,DISABLE_CACHE]); one CID per line + * For example: exten => s,n,AGI(cid_randomizer.php,/tmp/list.txt,1) OR exten => s,n,AGI(cid_randomizer.php,/tmp/list.txt); + * + * @author Roman Davydov + * @license http://openvoip.co Free (just keep reference to my name and my site) + * + */ + +error_reporting(E_ALL ^ E_NOTICE); +require_once('phpagi.php'); + +$agi = new AGI(); +$filename = ($argc > 1 ? $argv[1] : ''); +$disable_cache = intval($argc > 2 ? $argv[2] : 0); + +if (!file_exists($filename)) { + $agi->verbose("CID filename not found"); + exit; +} + +if ($cid = getNextNumber($filename, $disable_cache)) { + if (preg_match("/[xzn]/i", $cid)) { + for ($i = 0; $i < strlen($cid); $i++) { + switch (strtolower($cid[$i])) { + case 'x': + $cid[$i] = rand(0, 9); + break; + case 'z': + $cid[$i] = rand(1, 9); + break; + case 'n': + $cid[$i] = rand(2, 9); + break; + } + } + } + $agi->verbose("New CID: " . $cid); + $agi->set_variable('CALLERID(num)', $cid); +} else { + $agi->verbose("New CID is not obtained!"); +} + +// go back to the dialplan +exit; + + +// functions + +function getNextNumber($filename, $disable_cache) { + // check the cache + $cache = array(); + $modified = filemtime($filename); + $cache_filename = '/tmp/' . basename($filename) . '_' . ($modified === false ? '' : date('U', $modified)); + if (!$disable_cache && file_exists($cache_filename) && is_readable($cache_filename)) { + $cache = unserialize(file_get_contents($cache_filename)); + if (!is_array($cache)) { + $cache = array(); + } + } + + // getting data + $data = file_get_contents($filename); + $number = null; + if (is_string($data) && strlen($data) > 0) { + $cids = preg_split("/(\n)|(\r\n)|(\n\r)/m", $data); + if (is_array($cids) && count($cids) > 0) { + $cids = array_map('trim', $cids); + $cids = array_filter($cids); + $cids = array_merge(array_unique($cids), array()); // to reassign indexes + $cidsn = count($cids); + $protection = 0; + while ($protection < ($cidsn * 100)) { // protect from infinite loops + $tmp_number = $cids[rand(0, $cidsn - 1)]; + if ($disable_cache) { + $number = $tmp_number; + break; + } else { + if (!in_array($tmp_number, $cache)) { // try to search in cache for unique value + $cache[] = $tmp_number; + $number = $tmp_number; + break; + } else if (!count(array_diff($cids, $cache))) { // no more variants, reset cache + $cache = array($tmp_number); + $number = $tmp_number; + break; + } + } + $protection++; + } + } + } + + // update cache + if (!$disable_cache && $number != null) { + file_put_contents($cache_filename, serialize($cache)); + } + + return $number; +} diff --git a/Checker/phpagi-asmanager.php b/Checker/phpagi-asmanager.php new file mode 100644 index 000000000..111b02a44 --- /dev/null +++ b/Checker/phpagi-asmanager.php @@ -0,0 +1,834 @@ +, David Eder and others + * All Rights Reserved. + * + * This software is released under the terms of the GNU Lesser General Public License v2.1 + * A copy of which is available from http://www.gnu.org/copyleft/lesser.html + * + * We would be happy to list your phpagi based application on the phpagi + * website. Drop me an Email if you'd like us to list your program. + * + * @package phpAGI + * @version 2.0 + */ + + + /** + * Written for PHP 4.3.4, should work with older PHP 4.x versions. + * Please submit bug reports, patches, etc to http://sourceforge.net/projects/phpagi/ + * Gracias. :) + * + */ + + if(!class_exists('AGI')) + { + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi.php'); + } + + /** + * Asterisk Manager class + * + * @link http://www.voip-info.org/wiki-Asterisk+config+manager.conf + * @link http://www.voip-info.org/wiki-Asterisk+manager+API + * @example examples/sip_show_peer.php Get information about a sip peer + * @package phpAGI + */ + class AGI_AsteriskManager + { + /** + * Config variables + * + * @var array + * @access public + */ + public $config; + + /** + * Socket + * + * @access public + */ + public $socket = NULL; + + /** + * Server we are connected to + * + * @access public + * @var string + */ + public $server; + + /** + * Port on the server we are connected to + * + * @access public + * @var integer + */ + public $port; + + /** + * Parent AGI + * + * @access private + * @var AGI + */ + public $pagi; + + /** + * Event Handlers + * + * @access private + * @var array + */ + private $event_handlers; + + /** + * Whether we're successfully logged in + * + * @access private + * @var boolean + */ + private $_logged_in = FALSE; + + /** + * Constructor + * + * @param string $config is the name of the config file to parse or a parent agi from which to read the config + * @param array $optconfig is an array of configuration vars and vals, stuffed into $this->config['asmanager'] + */ + function AGI_AsteriskManager($config=NULL, $optconfig=array()) + { + // load config + if(!is_null($config) && file_exists($config)) + $this->config = parse_ini_file($config, true); + elseif(file_exists(DEFAULT_PHPAGI_CONFIG)) + $this->config = parse_ini_file(DEFAULT_PHPAGI_CONFIG, true); + + // If optconfig is specified, stuff vals and vars into 'asmanager' config array. + foreach($optconfig as $var=>$val) + $this->config['asmanager'][$var] = $val; + + // add default values to config for uninitialized values + if(!isset($this->config['asmanager']['server'])) $this->config['asmanager']['server'] = 'localhost'; + if(!isset($this->config['asmanager']['port'])) $this->config['asmanager']['port'] = 5038; + if(!isset($this->config['asmanager']['username'])) $this->config['asmanager']['username'] = 'phpagi'; + if(!isset($this->config['asmanager']['secret'])) $this->config['asmanager']['secret'] = 'phpagi'; + } + + /** + * Send a request + * + * @param string $action + * @param array $parameters + * @return array of parameters + */ + function send_request($action, $parameters=array()) + { + $req = "Action: $action\r\n"; + foreach($parameters as $var=>$val) + $req .= "$var: $val\r\n"; + $req .= "\r\n"; + $result = fwrite($this->socket, $req); + if ($result === false) + return null; + return $this->wait_response(); + } + + /** + * Wait for a response + * + * If a request was just sent, this will return the response. + * Otherwise, it will loop forever, handling events. + * + * @param boolean $allow_timeout if the socket times out, return an empty array + * @return array of parameters, empty on timeout + */ + function wait_response($allow_timeout=false) + { + $timeout = false; + do + { + $type = NULL; + $parameters = array(); + + $buffer = fgets($this->socket, 4096); + if ($buffer === false) + return null; + + $buffer = trim($buffer); + while($buffer != '') + { + $a = strpos($buffer, ':'); + if($a) + { + if(!count($parameters)) // first line in a response? + { + $type = strtolower(substr($buffer, 0, $a)); + if(substr($buffer, $a + 2) == 'Follows') + { + // A follows response means there is a miltiline field that follows. + $parameters['data'] = ''; + $buff = fgets($this->socket, 4096); + while(substr($buff, 0, 6) != '--END ') + { + $parameters['data'] .= $buff; + $buff = fgets($this->socket, 4096); + } + } + } + + // store parameter in $parameters + $parameters[substr($buffer, 0, $a)] = substr($buffer, $a + 2); + } + + $buffer = fgets($this->socket, 4096); + if ($buffer === false) + return null; + $buffer = trim($buffer); + } + + // process response + switch($type) + { + case '': // timeout occured + $timeout = $allow_timeout; + break; + case 'event': + $this->process_event($parameters); + break; + case 'response': + break; + default: + $this->log('Unhandled response packet from Manager: ' . print_r($parameters, true)); + break; + } + } while($type != 'response' && !$timeout); + return $parameters; + } + + /** + * Connect to Asterisk + * + * @example examples/sip_show_peer.php Get information about a sip peer + * + * @param string $server + * @param string $username + * @param string $secret + * @return boolean true on success + */ + function connect($server=NULL, $username=NULL, $secret=NULL) + { + // use config if not specified + if(is_null($server)) $server = $this->config['asmanager']['server']; + if(is_null($username)) $username = $this->config['asmanager']['username']; + if(is_null($secret)) $secret = $this->config['asmanager']['secret']; + + // get port from server if specified + if(strpos($server, ':') !== false) + { + $c = explode(':', $server); + $this->server = $c[0]; + $this->port = $c[1]; + } + else + { + $this->server = $server; + $this->port = $this->config['asmanager']['port']; + } + + // connect the socket + $errno = $errstr = NULL; + $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr); + if($this->socket == false) + { + $this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr"); + return false; + } + + // read the header + $str = fgets($this->socket); + if($str == false) + { + // a problem. + $this->log("Asterisk Manager header not received."); + return false; + } + else + { + // note: don't $this->log($str) until someone looks to see why it mangles the logging + } + + // login + $res = $this->send_request('login', array('Username'=>$username, 'Secret'=>$secret)); + if($res['Response'] != 'Success') + { + $this->_logged_in = FALSE; + $this->log("Failed to login."); + $this->disconnect(); + return false; + } + $this->_logged_in = TRUE; + return true; + } + + /** + * Disconnect + * + * @example examples/sip_show_peer.php Get information about a sip peer + */ + function disconnect() + { + if($this->_logged_in==TRUE) + $this->logoff(); + fclose($this->socket); + } + + // ********************************************************************************************************* + // ** COMMANDS ** + // ********************************************************************************************************* + + /** + * Set Absolute Timeout + * + * Hangup a channel after a certain time. + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+AbsoluteTimeout + * @param string $channel Channel name to hangup + * @param integer $timeout Maximum duration of the call (sec) + */ + function AbsoluteTimeout($channel, $timeout) + { + return $this->send_request('AbsoluteTimeout', array('Channel'=>$channel, 'Timeout'=>$timeout)); + } + + /** + * Change monitoring filename of a channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ChangeMonitor + * @param string $channel the channel to record. + * @param string $file the new name of the file created in the monitor spool directory. + */ + function ChangeMonitor($channel, $file) + { + return $this->send_request('ChangeMontior', array('Channel'=>$channel, 'File'=>$file)); + } + + /** + * Execute Command + * + * @example examples/sip_show_peer.php Get information about a sip peer + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Command + * @link http://www.voip-info.org/wiki-Asterisk+CLI + * @param string $command + * @param string $actionid message matching variable + */ + function Command($command, $actionid=NULL) + { + $parameters = array('Command'=>$command); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('Command', $parameters); + } + + /** + * Enable/Disable sending of events to this manager + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Events + * @param string $eventmask is either 'on', 'off', or 'system,call,log' + */ + function Events($eventmask) + { + return $this->send_request('Events', array('EventMask'=>$eventmask)); + } + + /** + * Check Extension Status + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ExtensionState + * @param string $exten Extension to check state on + * @param string $context Context for extension + * @param string $actionid message matching variable + */ + function ExtensionState($exten, $context, $actionid=NULL) + { + $parameters = array('Exten'=>$exten, 'Context'=>$context); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('ExtensionState', $parameters); + } + + /** + * Gets a Channel Variable + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+GetVar + * @link http://www.voip-info.org/wiki-Asterisk+variables + * @param string $channel Channel to read variable from + * @param string $variable + * @param string $actionid message matching variable + */ + function GetVar($channel, $variable, $actionid=NULL) + { + $parameters = array('Channel'=>$channel, 'Variable'=>$variable); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('GetVar', $parameters); + } + + /** + * Hangup Channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Hangup + * @param string $channel The channel name to be hungup + */ + function Hangup($channel) + { + return $this->send_request('Hangup', array('Channel'=>$channel)); + } + + /** + * List IAX Peers + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+IAXpeers + */ + function IAXPeers() + { + return $this->send_request('IAXPeers'); + } + + /** + * List available manager commands + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ListCommands + * @param string $actionid message matching variable + */ + function ListCommands($actionid=NULL) + { + if($actionid) + return $this->send_request('ListCommands', array('ActionID'=>$actionid)); + else + return $this->send_request('ListCommands'); + } + + /** + * Logoff Manager + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Logoff + */ + function Logoff() + { + return $this->send_request('Logoff'); + } + + /** + * Check Mailbox Message Count + * + * Returns number of new and old messages. + * Message: Mailbox Message Count + * Mailbox: + * NewMessages: + * OldMessages: + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxCount + * @param string $mailbox Full mailbox ID @ + * @param string $actionid message matching variable + */ + function MailboxCount($mailbox, $actionid=NULL) + { + $parameters = array('Mailbox'=>$mailbox); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('MailboxCount', $parameters); + } + + /** + * Check Mailbox + * + * Returns number of messages. + * Message: Mailbox Status + * Mailbox: + * Waiting: + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxStatus + * @param string $mailbox Full mailbox ID @ + * @param string $actionid message matching variable + */ + function MailboxStatus($mailbox, $actionid=NULL) + { + $parameters = array('Mailbox'=>$mailbox); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('MailboxStatus', $parameters); + } + + /** + * Monitor a channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Monitor + * @param string $channel + * @param string $file + * @param string $format + * @param boolean $mix + */ + function Monitor($channel, $file=NULL, $format=NULL, $mix=NULL) + { + $parameters = array('Channel'=>$channel); + if($file) $parameters['File'] = $file; + if($format) $parameters['Format'] = $format; + if(!is_null($file)) $parameters['Mix'] = ($mix) ? 'true' : 'false'; + return $this->send_request('Monitor', $parameters); + } + + /** + * Originate Call + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Originate + * @param string $channel Channel name to call + * @param string $exten Extension to use (requires 'Context' and 'Priority') + * @param string $context Context to use (requires 'Exten' and 'Priority') + * @param string $priority Priority to use (requires 'Exten' and 'Context') + * @param string $application Application to use + * @param string $data Data to use (requires 'Application') + * @param integer $timeout How long to wait for call to be answered (in ms) + * @param string $callerid Caller ID to be set on the outgoing channel + * @param string $variable Channel variable to set (VAR1=value1|VAR2=value2) + * @param string $account Account code + * @param boolean $async true fast origination + * @param string $actionid message matching variable + */ + function Originate($channel, + $exten=NULL, $context=NULL, $priority=NULL, + $application=NULL, $data=NULL, + $timeout=NULL, $callerid=NULL, $variable=NULL, $account=NULL, $async=NULL, $actionid=NULL) + { + $parameters = array('Channel'=>$channel); + + if($exten) $parameters['Exten'] = $exten; + if($context) $parameters['Context'] = $context; + if($priority) $parameters['Priority'] = $priority; + + if($application) $parameters['Application'] = $application; + if($data) $parameters['Data'] = $data; + + if($timeout) $parameters['Timeout'] = $timeout; + if($callerid) $parameters['CallerID'] = $callerid; + if($variable) $parameters['Variable'] = $variable; + if($account) $parameters['Account'] = $account; + if(!is_null($async)) $parameters['Async'] = ($async) ? 'true' : 'false'; + if($actionid) $parameters['ActionID'] = $actionid; + + return $this->send_request('Originate', $parameters); + } + + /** + * List parked calls + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ParkedCalls + * @param string $actionid message matching variable + */ + function ParkedCalls($actionid=NULL) + { + if($actionid) + return $this->send_request('ParkedCalls', array('ActionID'=>$actionid)); + else + return $this->send_request('ParkedCalls'); + } + + /** + * Ping + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Ping + */ + function Ping() + { + return $this->send_request('Ping'); + } + + /** + * Queue Add + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueAdd + * @param string $queue + * @param string $interface + * @param integer $penalty + */ + function QueueAdd($queue, $interface, $penalty=0) + { + $parameters = array('Queue'=>$queue, 'Interface'=>$interface); + if($penalty) $parameters['Penalty'] = $penalty; + return $this->send_request('QueueAdd', $parameters); + } + + /** + * Queue Remove + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueRemove + * @param string $queue + * @param string $interface + */ + function QueueRemove($queue, $interface) + { + return $this->send_request('QueueRemove', array('Queue'=>$queue, 'Interface'=>$interface)); + } + + /** + * Queues + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Queues + */ + function Queues() + { + return $this->send_request('Queues'); + } + + /** + * Queue Status + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueStatus + * @param string $actionid message matching variable + */ + function QueueStatus($actionid=NULL) + { + if($actionid) + return $this->send_request('QueueStatus', array('ActionID'=>$actionid)); + else + return $this->send_request('QueueStatus'); + } + + /** + * Redirect + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Redirect + * @param string $channel + * @param string $extrachannel + * @param string $exten + * @param string $context + * @param string $priority + */ + function Redirect($channel, $extrachannel, $exten, $context, $priority) + { + return $this->send_request('Redirect', array('Channel'=>$channel, 'ExtraChannel'=>$extrachannel, 'Exten'=>$exten, + 'Context'=>$context, 'Priority'=>$priority)); + } + + /** + * Set the CDR UserField + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetCDRUserField + * @param string $userfield + * @param string $channel + * @param string $append + */ + function SetCDRUserField($userfield, $channel, $append=NULL) + { + $parameters = array('UserField'=>$userfield, 'Channel'=>$channel); + if($append) $parameters['Append'] = $append; + return $this->send_request('SetCDRUserField', $parameters); + } + + /** + * Set Channel Variable + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetVar + * @param string $channel Channel to set variable for + * @param string $variable name + * @param string $value + */ + function SetVar($channel, $variable, $value) + { + return $this->send_request('SetVar', array('Channel'=>$channel, 'Variable'=>$variable, 'Value'=>$value)); + } + + /** + * Channel Status + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Status + * @param string $channel + * @param string $actionid message matching variable + */ + function Status($channel, $actionid=NULL) + { + $parameters = array('Channel'=>$channel); + if($actionid) $parameters['ActionID'] = $actionid; + return $this->send_request('Status', $parameters); + } + + /** + * Stop monitoring a channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+StopMonitor + * @param string $channel + */ + function StopMonitor($channel) + { + return $this->send_request('StopMonitor', array('Channel'=>$channel)); + } + + /** + * Dial over Zap channel while offhook + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDialOffhook + * @param string $zapchannel + * @param string $number + */ + function ZapDialOffhook($zapchannel, $number) + { + return $this->send_request('ZapDialOffhook', array('ZapChannel'=>$zapchannel, 'Number'=>$number)); + } + + /** + * Toggle Zap channel Do Not Disturb status OFF + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDoff + * @param string $zapchannel + */ + function ZapDNDoff($zapchannel) + { + return $this->send_request('ZapDNDoff', array('ZapChannel'=>$zapchannel)); + } + + /** + * Toggle Zap channel Do Not Disturb status ON + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDon + * @param string $zapchannel + */ + function ZapDNDon($zapchannel) + { + return $this->send_request('ZapDNDon', array('ZapChannel'=>$zapchannel)); + } + + /** + * Hangup Zap Channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapHangup + * @param string $zapchannel + */ + function ZapHangup($zapchannel) + { + return $this->send_request('ZapHangup', array('ZapChannel'=>$zapchannel)); + } + + /** + * Transfer Zap Channel + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapTransfer + * @param string $zapchannel + */ + function ZapTransfer($zapchannel) + { + return $this->send_request('ZapTransfer', array('ZapChannel'=>$zapchannel)); + } + + /** + * Zap Show Channels + * + * @link http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapShowChannels + * @param string $actionid message matching variable + */ + function ZapShowChannels($actionid=NULL) + { + if($actionid) + return $this->send_request('ZapShowChannels', array('ActionID'=>$actionid)); + else + return $this->send_request('ZapShowChannels'); + } + + // ********************************************************************************************************* + // ** MISC ** + // ********************************************************************************************************* + + /* + * Log a message + * + * @param string $message + * @param integer $level from 1 to 4 + */ + function log($message, $level=1) + { + if($this->pagi != false) + $this->pagi->conlog($message, $level); + else + error_log(date('r') . ' - ' . $message); + } + + /** + * Add event handler + * + * Known Events include ( http://www.voip-info.org/wiki-asterisk+manager+events ) + * Link - Fired when two voice channels are linked together and voice data exchange commences. + * Unlink - Fired when a link between two voice channels is discontinued, for example, just before call completion. + * Newexten - + * Hangup - + * Newchannel - + * Newstate - + * Reload - Fired when the "RELOAD" console command is executed. + * Shutdown - + * ExtensionStatus - + * Rename - + * Newcallerid - + * Alarm - + * AlarmClear - + * Agentcallbacklogoff - + * Agentcallbacklogin - + * Agentlogoff - + * MeetmeJoin - + * MessageWaiting - + * join - + * leave - + * AgentCalled - + * ParkedCall - Fired after ParkedCalls + * Cdr - + * ParkedCallsComplete - + * QueueParams - + * QueueMember - + * QueueStatusEnd - + * Status - + * StatusComplete - + * ZapShowChannels - Fired after ZapShowChannels + * ZapShowChannelsComplete - + * + * @param string $event type or * for default handler + * @param string $callback function + * @return boolean sucess + */ + function add_event_handler($event, $callback) + { + $event = strtolower($event); + if(isset($this->event_handlers[$event])) + { + $this->log("$event handler is already defined, not over-writing."); + return false; + } + $this->event_handlers[$event] = $callback; + return true; + } + + /** + * Process event + * + * @access private + * @param array $parameters + * @return mixed result of event handler or false if no handler was found + */ + function process_event($parameters) + { + $ret = false; + $e = strtolower($parameters['Event']); + $this->log("Got event.. $e"); + + $handler = ''; + if(isset($this->event_handlers[$e])) $handler = $this->event_handlers[$e]; + elseif(isset($this->event_handlers['*'])) $handler = $this->event_handlers['*']; + + if(function_exists($handler)) + { + $this->log("Execute handler $handler"); + $ret = $handler($e, $parameters, $this->server, $this->port); + } + else + $this->log("No event handler for event '$e'"); + return $ret; + } + } +?> diff --git a/Checker/phpagi.php b/Checker/phpagi.php new file mode 100644 index 000000000..d84b8c731 --- /dev/null +++ b/Checker/phpagi.php @@ -0,0 +1,1826 @@ +, David Eder and others +* All Rights Reserved. +* +* This software is released under the terms of the GNU Lesser General Public License v2.1 +* A copy of which is available from http://www.gnu.org/copyleft/lesser.html +* +* We would be happy to list your phpagi based application on the phpagi +* website. Drop me an Email if you'd like us to list your program. +* +* +* Written for PHP 4.3.4, should work with older PHP 4.x versions. +* +* Please submit bug reports, patches, etc to http://sourceforge.net/projects/phpagi/ +* Gracias. :) +* +* +* @package phpAGI +* @version 2.20 +*/ + +if (!class_exists('AGI_AsteriskManager')) +{ + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpagi-asmanager.php'); +} + +define('AST_CONFIG_DIR', '/etc/asterisk/'); +define('AST_SPOOL_DIR', '/var/spool/asterisk/'); +define('AST_TMP_DIR', AST_SPOOL_DIR . '/tmp/'); +define('DEFAULT_PHPAGI_CONFIG', AST_CONFIG_DIR . '/phpagi.conf'); + +define('AST_DIGIT_ANY', '0123456789#*'); + +define('AGIRES_OK', 200); + +define('AST_STATE_DOWN', 0); +define('AST_STATE_RESERVED', 1); +define('AST_STATE_OFFHOOK', 2); +define('AST_STATE_DIALING', 3); +define('AST_STATE_RING', 4); +define('AST_STATE_RINGING', 5); +define('AST_STATE_UP', 6); +define('AST_STATE_BUSY', 7); +define('AST_STATE_DIALING_OFFHOOK', 8); +define('AST_STATE_PRERING', 9); + +define('AUDIO_FILENO', 3); // STDERR_FILENO + 1 + +/** +* AGI class +* +* @package phpAGI +* @link http://www.voip-info.org/wiki-Asterisk+agi +* @example examples/dtmf.php Get DTMF tones from the user and say the digits +* @example examples/input.php Get text input from the user and say it back +* @example examples/ping.php Ping an IP address +*/ +class AGI +{ + /** + * Request variables read in on initialization. + * + * Often contains any/all of the following: + * agi_request - name of agi script + * agi_channel - current channel + * agi_language - current language + * agi_type - channel type (SIP, ZAP, IAX, ...) + * agi_uniqueid - unique id based on unix time + * agi_callerid - callerID string + * agi_dnid - dialed number id + * agi_rdnis - referring DNIS number + * agi_context - current context + * agi_extension - extension dialed + * agi_priority - current priority + * agi_enhanced - value is 1.0 if started as an EAGI script + * agi_accountcode - set by SetAccount in the dialplan + * agi_network - value is yes if this is a fastagi + * agi_network_script - name of the script to execute + * + * NOTE: program arguments are still in $_SERVER['argv']. + * + * @var array + * @access public + */ + var $request; + + /** + * Config variables + * + * @var array + * @access public + */ + var $config; + + /** + * Asterisk Manager + * + * @var AGI_AsteriskManager + * @access public + */ + var $asmanager; + + /** + * Input Stream + * + * @access private + */ + var $in = NULL; + + /** + * Output Stream + * + * @access private + */ + var $out = NULL; + + /** + * Audio Stream + * + * @access public + */ + var $audio = NULL; + + + /** + * Application option delimiter + * + * @access public + */ + public $option_delim = ","; + + /** + * Constructor + * + * @param string $config is the name of the config file to parse + * @param array $optconfig is an array of configuration vars and vals, stuffed into $this->config['phpagi'] + */ + function __construct($config=NULL, $optconfig=array()) + { + // load config + if(!is_null($config) && file_exists($config)) + $this->config = parse_ini_file($config, true); + elseif(file_exists(DEFAULT_PHPAGI_CONFIG)) + $this->config = parse_ini_file(DEFAULT_PHPAGI_CONFIG, true); + + // If optconfig is specified, stuff vals and vars into 'phpagi' config array. + foreach($optconfig as $var=>$val) + $this->config['phpagi'][$var] = $val; + + // add default values to config for uninitialized values + if(!isset($this->config['phpagi']['error_handler'])) $this->config['phpagi']['error_handler'] = true; + if(!isset($this->config['phpagi']['debug'])) $this->config['phpagi']['debug'] = false; + if(!isset($this->config['phpagi']['admin'])) $this->config['phpagi']['admin'] = NULL; + if(!isset($this->config['phpagi']['tempdir'])) $this->config['phpagi']['tempdir'] = AST_TMP_DIR; + + // festival TTS config + if(!isset($this->config['festival']['text2wave'])) $this->config['festival']['text2wave'] = $this->which('text2wave'); + + // swift TTS config + if(!isset($this->config['cepstral']['swift'])) $this->config['cepstral']['swift'] = $this->which('swift'); + + ob_implicit_flush(true); + + // open stdin & stdout + $this->in = defined('STDIN') ? STDIN : fopen('php://stdin', 'r'); + $this->out = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w'); + + // initialize error handler + if($this->config['phpagi']['error_handler'] == true) + { + set_error_handler('phpagi_error_handler'); + global $phpagi_error_handler_email; + $phpagi_error_handler_email = $this->config['phpagi']['admin']; + error_reporting(E_ALL); + } + + // make sure temp folder exists + $this->make_folder($this->config['phpagi']['tempdir']); + + // read the request + $str = fgets($this->in); + while($str != "\n") + { + $this->request[substr($str, 0, strpos($str, ':'))] = trim(substr($str, strpos($str, ':') + 1)); + $str = fgets($this->in); + } + + // open audio if eagi detected + if($this->request['agi_enhanced'] == '1.0') + { + if(file_exists('/proc/' . getmypid() . '/fd/3')) + $this->audio = fopen('/proc/' . getmypid() . '/fd/3', 'r'); + elseif(file_exists('/dev/fd/3')) + { + // may need to mount fdescfs + $this->audio = fopen('/dev/fd/3', 'r'); + } + else + $this->conlog('Unable to open audio stream'); + + if($this->audio) stream_set_blocking($this->audio, 0); + } + + $this->conlog('AGI Request:'); + $this->conlog(print_r($this->request, true)); + $this->conlog('PHPAGI internal configuration:'); + $this->conlog(print_r($this->config, true)); + } + + // ********************************************************************************************************* + // ** COMMANDS ** + // ********************************************************************************************************* + + /** + * Answer channel if not already in answer state. + * + * @link http://www.voip-info.org/wiki-answer + * @example examples/dtmf.php Get DTMF tones from the user and say the digits + * @example examples/input.php Get text input from the user and say it back + * @example examples/ping.php Ping an IP address + * + * @return array, see evaluate for return information. ['result'] is 0 on success, -1 on failure. + */ + function answer() + { + return $this->evaluate('ANSWER'); + } + + /** + * Get the status of the specified channel. If no channel name is specified, return the status of the current channel. + * + * @link http://www.voip-info.org/wiki-channel+status + * @param string $channel + * @return array, see evaluate for return information. ['data'] contains description. + */ + function channel_status($channel='') + { + $ret = $this->evaluate("CHANNEL STATUS $channel"); + switch($ret['result']) + { + case -1: $ret['data'] = trim("There is no channel that matches $channel"); break; + case AST_STATE_DOWN: $ret['data'] = 'Channel is down and available'; break; + case AST_STATE_RESERVED: $ret['data'] = 'Channel is down, but reserved'; break; + case AST_STATE_OFFHOOK: $ret['data'] = 'Channel is off hook'; break; + case AST_STATE_DIALING: $ret['data'] = 'Digits (or equivalent) have been dialed'; break; + case AST_STATE_RING: $ret['data'] = 'Line is ringing'; break; + case AST_STATE_RINGING: $ret['data'] = 'Remote end is ringing'; break; + case AST_STATE_UP: $ret['data'] = 'Line is up'; break; + case AST_STATE_BUSY: $ret['data'] = 'Line is busy'; break; + case AST_STATE_DIALING_OFFHOOK: $ret['data'] = 'Digits (or equivalent) have been dialed while offhook'; break; + case AST_STATE_PRERING: $ret['data'] = 'Channel has detected an incoming call and is waiting for ring'; break; + default: $ret['data'] = "Unknown ({$ret['result']})"; break; + } + return $ret; + } + + /** + * Deletes an entry in the Asterisk database for a given family and key. + * + * @link http://www.voip-info.org/wiki-database+del + * @param string $family + * @param string $key + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise. + */ + function database_del($family, $key) + { + return $this->evaluate("DATABASE DEL \"$family\" \"$key\""); + } + + /** + * Deletes a family or specific keytree within a family in the Asterisk database. + * + * @link http://www.voip-info.org/wiki-database+deltree + * @param string $family + * @param string $keytree + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise. + */ + function database_deltree($family, $keytree='') + { + $cmd = "DATABASE DELTREE \"$family\""; + if($keytree != '') $cmd .= " \"$keytree\""; + return $this->evaluate($cmd); + } + + /** + * Retrieves an entry in the Asterisk database for a given family and key. + * + * @link http://www.voip-info.org/wiki-database+get + * @param string $family + * @param string $key + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 failure. ['data'] holds the value + */ + function database_get($family, $key) + { + return $this->evaluate("DATABASE GET \"$family\" \"$key\""); + } + + /** + * Adds or updates an entry in the Asterisk database for a given family, key, and value. + * + * @param string $family + * @param string $key + * @param string $value + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise + */ + function database_put($family, $key, $value) + { + $value = str_replace("\n", '\n', addslashes($value)); + return $this->evaluate("DATABASE PUT \"$family\" \"$key\" \"$value\""); + } + + + /** + * Sets a global variable, using Asterisk 1.6 syntax. + * + * @link http://www.voip-info.org/wiki/view/Asterisk+cmd+Set + * + * @param string $pVariable + * @param string|int|float $pValue + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise + */ + function set_global_var($pVariable, $pValue) + { + if (is_numeric($pValue)) + return $this->evaluate("Set({$pVariable}={$pValue},g);"); + else + return $this->evaluate("Set({$pVariable}=\"{$pValue}\",g);"); + } + + + /** + * Sets a variable, using Asterisk 1.6 syntax. + * + * @link http://www.voip-info.org/wiki/view/Asterisk+cmd+Set + * + * @param string $pVariable + * @param string|int|float $pValue + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise + */ + function set_var($pVariable, $pValue) + { + if (is_numeric($pValue)) + return $this->evaluate("Set({$pVariable}={$pValue});"); + else + return $this->evaluate("Set({$pVariable}=\"{$pValue}\");"); + } + + + /** + * Executes the specified Asterisk application with given options. + * + * @link http://www.voip-info.org/wiki-exec + * @link http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands + * @param string $application + * @param mixed $options + * @return array, see evaluate for return information. ['result'] is whatever the application returns, or -2 on failure to find application + */ + function exec($application, $options) + { + if(is_array($options)) $options = join('|', $options); + return $this->evaluate("EXEC $application $options"); + } + + /** + * Plays the given file and receives DTMF data. + * + * This is similar to STREAM FILE, but this command can accept and return many DTMF digits, + * while STREAM FILE returns immediately after the first DTMF digit is detected. + * + * Asterisk looks for the file to play in /var/lib/asterisk/sounds by default. + * + * If the user doesn't press any keys when the message plays, there is $timeout milliseconds + * of silence then the command ends. + * + * The user has the opportunity to press a key at any time during the message or the + * post-message silence. If the user presses a key while the message is playing, the + * message stops playing. When the first key is pressed a timer starts counting for + * $timeout milliseconds. Every time the user presses another key the timer is restarted. + * The command ends when the counter goes to zero or the maximum number of digits is entered, + * whichever happens first. + * + * If you don't specify a time out then a default timeout of 2000 is used following a pressed + * digit. If no digits are pressed then 6 seconds of silence follow the message. + * + * If you don't specify $max_digits then the user can enter as many digits as they want. + * + * Pressing the # key has the same effect as the timer running out: the command ends and + * any previously keyed digits are returned. A side effect of this is that there is no + * way to read a # key using this command. + * + * @example examples/ping.php Ping an IP address + * + * @link http://www.voip-info.org/wiki-get+data + * @param string $filename file to play. Do not include file extension. + * @param integer $timeout milliseconds + * @param integer $max_digits + * @return array, see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present. + * + * This differs from other commands with return DTMF as numbers representing ASCII characters. + */ + function get_data($filename, $timeout=NULL, $max_digits=NULL) + { + return $this->evaluate(rtrim("GET DATA $filename $timeout $max_digits")); + } + + /** + * Fetch the value of a variable. + * + * Does not work with global variables. Does not work with some variables that are generated by modules. + * + * @link http://www.voip-info.org/wiki-get+variable + * @link http://www.voip-info.org/wiki-Asterisk+variables + * @param string $variable name + * @param boolean $getvalue return the value only + * @return array, see evaluate for return information. ['result'] is 0 if variable hasn't been set, 1 if it has. ['data'] holds the value. returns value if $getvalue is TRUE + */ + function get_variable($variable,$getvalue=FALSE) + { + $res=$this->evaluate("GET VARIABLE $variable"); + + if($getvalue==FALSE) + return($res); + + return($res['data']); + } + + + /** + * Fetch the value of a full variable. + * + * + * @link http://www.voip-info.org/wiki/view/get+full+variable + * @link http://www.voip-info.org/wiki-Asterisk+variables + * @param string $variable name + * @param string $channel channel + * @param boolean $getvalue return the value only + * @return array, see evaluate for return information. ['result'] is 0 if variable hasn't been set, 1 if it has. ['data'] holds the value. returns value if $getvalue is TRUE + */ + function get_fullvariable($variable,$channel=FALSE,$getvalue=FALSE) + { + if($channel==FALSE){ + $req = $variable; + } else { + $req = $variable.' '.$channel; + } + + $res=$this->evaluate('GET VARIABLE FULL '.$req); + + if($getvalue==FALSE) + return($res); + + return($res['data']); + + } + + /** + * Hangup the specified channel. If no channel name is given, hang up the current channel. + * + * With power comes responsibility. Hanging up channels other than your own isn't something + * that is done routinely. If you are not sure why you are doing so, then don't. + * + * @link http://www.voip-info.org/wiki-hangup + * @example examples/dtmf.php Get DTMF tones from the user and say the digits + * @example examples/input.php Get text input from the user and say it back + * @example examples/ping.php Ping an IP address + * + * @param string $channel + * @return array, see evaluate for return information. ['result'] is 1 on success, -1 on failure. + */ + function hangup($channel='') + { + return $this->evaluate("HANGUP $channel"); + } + + /** + * Does nothing. + * + * @link http://www.voip-info.org/wiki-noop + * @return array, see evaluate for return information. + */ + function noop($string="") + { + return $this->evaluate("NOOP \"$string\""); + } + + /** + * Receive a character of text from a connected channel. Waits up to $timeout milliseconds for + * a character to arrive, or infinitely if $timeout is zero. + * + * @link http://www.voip-info.org/wiki-receive+char + * @param integer $timeout milliseconds + * @return array, see evaluate for return information. ['result'] is 0 on timeout or not supported, -1 on failure. Otherwise + * it is the decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function receive_char($timeout=-1) + { + return $this->evaluate("RECEIVE CHAR $timeout"); + } + + /** + * Record sound to a file until an acceptable DTMF digit is received or a specified amount of + * time has passed. Optionally the file BEEP is played before recording begins. + * + * @link http://www.voip-info.org/wiki-record+file + * @param string $file to record, without extension, often created in /var/lib/asterisk/sounds + * @param string $format of the file. GSM and WAV are commonly used formats. MP3 is read-only and thus cannot be used. + * @param string $escape_digits + * @param integer $timeout is the maximum record time in milliseconds, or -1 for no timeout. + * @param integer $offset to seek to without exceeding the end of the file. + * @param boolean $beep + * @param integer $silence number of seconds of silence allowed before the function returns despite the + * lack of dtmf digits or reaching timeout. + * @return array, see evaluate for return information. ['result'] is -1 on error, 0 on hangup, otherwise a decimal value of the + * DTMF tone. Use chr() to convert to ASCII. + */ + function record_file($file, $format, $escape_digits='', $timeout=-1, $offset=NULL, $beep=false, $silence=NULL) + { + $cmd = trim("RECORD FILE $file $format \"$escape_digits\" $timeout $offset"); + if($beep) $cmd .= ' BEEP'; + if(!is_null($silence)) $cmd .= " s=$silence"; + return $this->evaluate($cmd); + } + + /** + * Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel. + * + * @link http://www.voip-info.org/wiki-say+digits + * @param integer $digits + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function say_digits($digits, $escape_digits='') + { + return $this->evaluate("SAY DIGITS $digits \"$escape_digits\""); + } + + /** + * Say the given number, returning early if any of the given DTMF escape digits are received on the channel. + * + * @link http://www.voip-info.org/wiki-say+number + * @param integer $number + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function say_number($number, $escape_digits='') + { + return $this->evaluate("SAY NUMBER $number \"$escape_digits\""); + } + + /** + * Say the given character string, returning early if any of the given DTMF escape digits are received on the channel. + * + * @link http://www.voip-info.org/wiki-say+phonetic + * @param string $text + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function say_phonetic($text, $escape_digits='') + { + return $this->evaluate("SAY PHONETIC $text \"$escape_digits\""); + } + + /** + * Say a given time, returning early if any of the given DTMF escape digits are received on the channel. + * + * @link http://www.voip-info.org/wiki-say+time + * @param integer $time number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function say_time($time=NULL, $escape_digits='') + { + if(is_null($time)) $time = time(); + return $this->evaluate("SAY TIME $time \"$escape_digits\""); + } + + /** + * Send the specified image on a channel. + * + * Most channels do not support the transmission of images. + * + * @link http://www.voip-info.org/wiki-send+image + * @param string $image without extension, often in /var/lib/asterisk/images + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the image is sent or + * channel does not support image transmission. + */ + function send_image($image) + { + return $this->evaluate("SEND IMAGE $image"); + } + + /** + * Send the given text to the connected channel. + * + * Most channels do not support transmission of text. + * + * @link http://www.voip-info.org/wiki-send+text + * @param $text + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the text is sent or + * channel does not support text transmission. + */ + function send_text($text) + { + return $this->evaluate("SEND TEXT \"$text\""); + } + + /** + * Cause the channel to automatically hangup at $time seconds in the future. + * If $time is 0 then the autohangup feature is disabled on this channel. + * + * If the channel is hungup prior to $time seconds, this setting has no effect. + * + * @link http://www.voip-info.org/wiki-set+autohangup + * @param integer $time until automatic hangup + * @return array, see evaluate for return information. + */ + function set_autohangup($time=0) + { + return $this->evaluate("SET AUTOHANGUP $time"); + } + + /** + * Changes the caller ID of the current channel. + * + * @link http://www.voip-info.org/wiki-set+callerid + * @param string $cid example: "John Smith"<1234567> + * This command will let you take liberties with the but the format shown in the example above works + * well: the name enclosed in double quotes followed immediately by the number inside angle brackets. If there is no name then + * you can omit it. If the name contains no spaces you can omit the double quotes around it. The number must follow the name + * immediately; don't put a space between them. The angle brackets around the number are necessary; if you omit them the + * number will be considered to be part of the name. + * @return array, see evaluate for return information. + */ + function set_callerid($cid) + { + return $this->evaluate("SET CALLERID $cid"); + } + + /** + * Sets the context for continuation upon exiting the application. + * + * Setting the context does NOT automatically reset the extension and the priority; if you want to start at the top of the new + * context you should set extension and priority yourself. + * + * If you specify a non-existent context you receive no error indication (['result'] is still 0) but you do get a + * warning message on the Asterisk console. + * + * @link http://www.voip-info.org/wiki-set+context + * @param string $context + * @return array, see evaluate for return information. + */ + function set_context($context) + { + return $this->evaluate("SET CONTEXT $context"); + } + + /** + * Set the extension to be used for continuation upon exiting the application. + * + * Setting the extension does NOT automatically reset the priority. If you want to start with the first priority of the + * extension you should set the priority yourself. + * + * If you specify a non-existent extension you receive no error indication (['result'] is still 0) but you do + * get a warning message on the Asterisk console. + * + * @link http://www.voip-info.org/wiki-set+extension + * @param string $extension + * @return array, see evaluate for return information. + */ + function set_extension($extension) + { + return $this->evaluate("SET EXTENSION $extension"); + } + + /** + * Enable/Disable Music on hold generator. + * + * @link http://www.voip-info.org/wiki-set+music + * @param boolean $enabled + * @param string $class + * @return array, see evaluate for return information. + */ + function set_music($enabled=true, $class='') + { + $enabled = ($enabled) ? 'ON' : 'OFF'; + return $this->evaluate("SET MUSIC $enabled $class"); + } + + /** + * Set the priority to be used for continuation upon exiting the application. + * + * If you specify a non-existent priority you receive no error indication (['result'] is still 0) + * and no warning is issued on the Asterisk console. + * + * @link http://www.voip-info.org/wiki-set+priority + * @param integer $priority + * @return array, see evaluate for return information. + */ + function set_priority($priority) + { + return $this->evaluate("SET PRIORITY $priority"); + } + + /** + * Sets a variable to the specified value. The variables so created can later be used by later using ${} + * in the dialplan. + * + * These variables live in the channel Asterisk creates when you pickup a phone and as such they are both local and temporary. + * Variables created in one channel can not be accessed by another channel. When you hang up the phone, the channel is deleted + * and any variables in that channel are deleted as well. + * + * @link http://www.voip-info.org/wiki-set+variable + * @param string $variable is case sensitive + * @param string $value + * @return array, see evaluate for return information. + */ + function set_variable($variable, $value) + { + $value = str_replace("\n", '\n', addslashes($value)); + return $this->evaluate("SET VARIABLE $variable \"$value\""); + } + + /** + * Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA + * command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of + * digits before returning. + * + * @example examples/ping.php Ping an IP address + * + * @link http://www.voip-info.org/wiki-stream+file + * @param string $filename without extension, often in /var/lib/asterisk/sounds + * @param string $escape_digits + * @param integer $offset + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function stream_file($filename, $escape_digits='', $offset=0) + { + return $this->evaluate("STREAM FILE $filename \"$escape_digits\" $offset"); + } + + /** + * Enable or disable TDD transmission/reception on the current channel. + * + * @link http://www.voip-info.org/wiki-tdd+mode + * @param string $setting can be on, off or mate + * @return array, see evaluate for return information. ['result'] is 1 on sucess, 0 if the channel is not TDD capable. + */ + function tdd_mode($setting) + { + return $this->evaluate("TDD MODE $setting"); + } + + /** + * Sends $message to the Asterisk console via the 'verbose' message system. + * + * If the Asterisk verbosity level is $level or greater, send $message to the console. + * + * The Asterisk verbosity system works as follows. The Asterisk user gets to set the desired verbosity at startup time or later + * using the console 'set verbose' command. Messages are displayed on the console if their verbose level is less than or equal + * to desired verbosity set by the user. More important messages should have a low verbose level; less important messages + * should have a high verbose level. + * + * @link http://www.voip-info.org/wiki-verbose + * @param string $message + * @param integer $level from 1 to 4 + * @return array, see evaluate for return information. + */ + function verbose($message, $level=1) + { + foreach(explode("\n", str_replace("\r\n", "\n", print_r($message, true))) as $msg) + { + @syslog(LOG_WARNING, $msg); + $ret = $this->evaluate("VERBOSE \"$msg\" $level"); + } + return $ret; + } + + /** + * Waits up to $timeout milliseconds for channel to receive a DTMF digit. + * + * @link http://www.voip-info.org/wiki-wait+for+digit + * @param integer $timeout in millisecons. Use -1 for the timeout value if you want the call to wait indefinitely. + * @return array, see evaluate for return information. ['result'] is 0 if wait completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function wait_for_digit($timeout=-1) + { + return $this->evaluate("WAIT FOR DIGIT $timeout"); + } + + + // ********************************************************************************************************* + // ** APPLICATIONS ** + // ********************************************************************************************************* + + /** + * Set absolute maximum time of call. + * + * Note that the timeout is set from the current time forward, not counting the number of seconds the call has already been up. + * Each time you call AbsoluteTimeout(), all previous absolute timeouts are cancelled. + * Will return the call to the T extension so that you can playback an explanatory note to the calling party (the called party + * will not hear that) + * + * @link http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands + * @link http://www.dynx.net/ASTERISK/AGI/ccard/agi-ccard.agi + * @param $seconds allowed, 0 disables timeout + * @return array, see evaluate for return information. + */ + function exec_absolutetimeout($seconds=0) + { + return $this->exec('AbsoluteTimeout', $seconds); + } + + /** + * Executes an AGI compliant application. + * + * @param string $command + * @return array, see evaluate for return information. ['result'] is -1 on hangup or if application requested hangup, or 0 on non-hangup exit. + * @param string $args + */ + function exec_agi($command, $args) + { + return $this->exec("AGI $command", $args); + } + + /** + * Set Language. + * + * @param string $language code + * @return array, see evaluate for return information. + */ + function exec_setlanguage($language='en') + { + return $this->exec('Set', 'CHANNEL(language)='. $language); + } + + /** + * Do ENUM Lookup. + * + * Note: to retrieve the result, use + * get_variable('ENUM'); + * + * @param $exten + * @return array, see evaluate for return information. + */ + function exec_enumlookup($exten) + { + return $this->exec('EnumLookup', $exten); + } + + /** + * Dial. + * + * Dial takes input from ${VXML_URL} to send XML Url to Cisco 7960 + * Dial takes input from ${ALERT_INFO} to set ring cadence for Cisco phones + * Dial returns ${CAUSECODE}: If the dial failed, this is the errormessage. + * Dial returns ${DIALSTATUS}: Text code returning status of last dial attempt. + * + * @link http://www.voip-info.org/wiki-Asterisk+cmd+Dial + * @param string $type + * @param string $identifier + * @param integer $timeout + * @param string $options + * @param string $url + * @return array, see evaluate for return information. + */ + function exec_dial($type, $identifier, $timeout=NULL, $options=NULL, $url=NULL) + { + return $this->exec('Dial', trim("$type/$identifier".$this->option_delim.$timeout.$this->option_delim.$options.$this->option_delim.$url, $this->option_delim)); + } + + /** + * Goto. + * + * This function takes three arguments: context,extension, and priority, but the leading arguments + * are optional, not the trailing arguments. Thuse goto($z) sets the priority to $z. + * + * @param string $a + * @param string $b; + * @param string $c; + * @return array, see evaluate for return information. + */ + function exec_goto($a, $b=NULL, $c=NULL) + { + return $this->exec('Goto', trim($a.$this->option_delim.$b.$this->option_delim.$c, $this->option_delim)); + } + + + // ********************************************************************************************************* + // ** FAST PASSING ** + // ********************************************************************************************************* + + /** + * Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel. + * Return early if $buffer is adequate for request. + * + * @link http://www.voip-info.org/wiki-say+digits + * @param string $buffer + * @param integer $digits + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function fastpass_say_digits(&$buffer, $digits, $escape_digits='') + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->say_digits($digits, $escape_digits); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); + } + + /** + * Say the given number, returning early if any of the given DTMF escape digits are received on the channel. + * Return early if $buffer is adequate for request. + * + * @link http://www.voip-info.org/wiki-say+number + * @param string $buffer + * @param integer $number + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function fastpass_say_number(&$buffer, $number, $escape_digits='') + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->say_number($number, $escape_digits); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); + } + + /** + * Say the given character string, returning early if any of the given DTMF escape digits are received on the channel. + * Return early if $buffer is adequate for request. + * + * @link http://www.voip-info.org/wiki-say+phonetic + * @param string $buffer + * @param string $text + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function fastpass_say_phonetic(&$buffer, $text, $escape_digits='') + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->say_phonetic($text, $escape_digits); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); + } + + /** + * Say a given time, returning early if any of the given DTMF escape digits are received on the channel. + * Return early if $buffer is adequate for request. + * + * @link http://www.voip-info.org/wiki-say+time + * @param string $buffer + * @param integer $time number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). + * @param string $escape_digits + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function fastpass_say_time(&$buffer, $time=NULL, $escape_digits='') + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->say_time($time, $escape_digits); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); + } + + /** + * Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA + * command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of + * digits before returning. + * Return early if $buffer is adequate for request. + * + * @link http://www.voip-info.org/wiki-stream+file + * @param string $buffer + * @param string $filename without extension, often in /var/lib/asterisk/sounds + * @param string $escape_digits + * @param integer $offset + * @return array, see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no + * digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII. + */ + function fastpass_stream_file(&$buffer, $filename, $escape_digits='', $offset=0) + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->stream_file($filename, $escape_digits, $offset); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); + } + + /** + * Use festival to read text. + * Return early if $buffer is adequate for request. + * + * @link http://www.cstr.ed.ac.uk/projects/festival/ + * @param string $buffer + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function fastpass_text2wav(&$buffer, $text, $escape_digits='', $frequency=8000) + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->text2wav($text, $escape_digits, $frequency); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); + } + + /** + * Use Cepstral Swift to read text. + * Return early if $buffer is adequate for request. + * + * @link http://www.cepstral.com/ + * @param string $buffer + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function fastpass_swift(&$buffer, $text, $escape_digits='', $frequency=8000, $voice=NULL) + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->swift($text, $escape_digits, $frequency, $voice); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); + } + + /** + * Say Puncutation in a string. + * Return early if $buffer is adequate for request. + * + * @param string $buffer + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function fastpass_say_punctuation(&$buffer, $text, $escape_digits='', $frequency=8000) + { + $proceed = false; + if($escape_digits != '' && $buffer != '') + { + if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) + $proceed = true; + } + if($buffer == '' || $proceed) + { + $res = $this->say_punctuation($text, $escape_digits, $frequency); + if($res['code'] == AGIRES_OK && $res['result'] > 0) + $buffer .= chr($res['result']); + return $res; + } + return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); + } + + /** + * Plays the given file and receives DTMF data. + * Return early if $buffer is adequate for request. + * + * This is similar to STREAM FILE, but this command can accept and return many DTMF digits, + * while STREAM FILE returns immediately after the first DTMF digit is detected. + * + * Asterisk looks for the file to play in /var/lib/asterisk/sounds by default. + * + * If the user doesn't press any keys when the message plays, there is $timeout milliseconds + * of silence then the command ends. + * + * The user has the opportunity to press a key at any time during the message or the + * post-message silence. If the user presses a key while the message is playing, the + * message stops playing. When the first key is pressed a timer starts counting for + * $timeout milliseconds. Every time the user presses another key the timer is restarted. + * The command ends when the counter goes to zero or the maximum number of digits is entered, + * whichever happens first. + * + * If you don't specify a time out then a default timeout of 2000 is used following a pressed + * digit. If no digits are pressed then 6 seconds of silence follow the message. + * + * If you don't specify $max_digits then the user can enter as many digits as they want. + * + * Pressing the # key has the same effect as the timer running out: the command ends and + * any previously keyed digits are returned. A side effect of this is that there is no + * way to read a # key using this command. + * + * @link http://www.voip-info.org/wiki-get+data + * @param string $buffer + * @param string $filename file to play. Do not include file extension. + * @param integer $timeout milliseconds + * @param integer $max_digits + * @return array, see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present. + * + * This differs from other commands with return DTMF as numbers representing ASCII characters. + */ + function fastpass_get_data(&$buffer, $filename, $timeout=NULL, $max_digits=NULL) + { + if(is_null($max_digits) || strlen($buffer) < $max_digits) + { + if($buffer == '') + { + $res = $this->get_data($filename, $timeout, $max_digits); + if($res['code'] == AGIRES_OK) + $buffer .= $res['result']; + return $res; + } + else + { + while(is_null($max_digits) || strlen($buffer) < $max_digits) + { + $res = $this->wait_for_digit(); + if($res['code'] != AGIRES_OK) return $res; + if($res['result'] == ord('#')) break; + $buffer .= chr($res['result']); + } + } + } + return array('code'=>AGIRES_OK, 'result'=>$buffer); + } + + // ********************************************************************************************************* + // ** DERIVED ** + // ********************************************************************************************************* + + /** + * Menu. + * + * This function presents the user with a menu and reads the response + * + * @param array $choices has the following structure: + * array('1'=>'*Press 1 for this', // festival reads if prompt starts with * + * '2'=>'some-gsm-without-extension', + * '*'=>'*Press star for help'); + * @return mixed key pressed on sucess, -1 on failure + */ + function menu($choices, $timeout=2000) + { + $keys = join('', array_keys($choices)); + $choice = NULL; + while(is_null($choice)) + { + foreach($choices as $prompt) + { + if($prompt{0} == '*') + $ret = $this->text2wav(substr($prompt, 1), $keys); + else + $ret = $this->stream_file($prompt, $keys); + + if($ret['code'] != AGIRES_OK || $ret['result'] == -1) + { + $choice = -1; + break; + } + + if($ret['result'] != 0) + { + $choice = chr($ret['result']); + break; + } + } + + if(is_null($choice)) + { + $ret = $this->get_data('beep', $timeout, 1); + if($ret['code'] != AGIRES_OK || $ret['result'] == -1) + $choice = -1; + elseif($ret['result'] != '' && strpos(' '.$keys, $ret['result'])) + $choice = $ret['result']; + } + } + return $choice; + } + + /** + * setContext - Set context, extension and priority. + * + * @param string $context + * @param string $extension + * @param string $priority + */ + function setContext($context, $extension='s', $priority=1) + { + $this->set_context($context); + $this->set_extension($extension); + $this->set_priority($priority); + } + + /** + * Parse caller id. + * + * @example examples/dtmf.php Get DTMF tones from the user and say the digits + * @example examples/input.php Get text input from the user and say it back + * + * "name" + * + * @param string $callerid + * @return array('Name'=>$name, 'Number'=>$number) + */ + function parse_callerid($callerid=NULL) + { + if(is_null($callerid)) + $callerid = $this->request['agi_callerid']; + + $ret = array('name'=>'', 'protocol'=>'', 'username'=>'', 'host'=>'', 'port'=>''); + $callerid = trim($callerid); + + if($callerid{0} == '"' || $callerid{0} == "'") + { + $d = $callerid{0}; + $callerid = explode($d, substr($callerid, 1)); + $ret['name'] = array_shift($callerid); + $callerid = join($d, $callerid); + } + + $callerid = explode('@', trim($callerid, '<> ')); + $username = explode(':', array_shift($callerid)); + if(count($username) == 1) + $ret['username'] = $username[0]; + else + { + $ret['protocol'] = array_shift($username); + $ret['username'] = join(':', $username); + } + + $callerid = join('@', $callerid); + $host = explode(':', $callerid); + if(count($host) == 1) + $ret['host'] = $host[0]; + else + { + $ret['host'] = array_shift($host); + $ret['port'] = join(':', $host); + } + + return $ret; + } + + /** + * Use festival to read text. + * + * @example examples/dtmf.php Get DTMF tones from the user and say the digits + * @example examples/input.php Get text input from the user and say it back + * @example examples/ping.php Ping an IP address + * + * @link http://www.cstr.ed.ac.uk/projects/festival/ + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function text2wav($text, $escape_digits='', $frequency=8000) + { + $text = trim($text); + if($text == '') return true; + + $hash = md5($text); + $fname = $this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR; + $fname .= 'text2wav_' . $hash; + + // create wave file + if(!file_exists("$fname.wav")) + { + // write text file + if(!file_exists("$fname.txt")) + { + $fp = fopen("$fname.txt", 'w'); + fputs($fp, $text); + fclose($fp); + } + + shell_exec("{$this->config['festival']['text2wave']} -F $frequency -o $fname.wav $fname.txt"); + } + else + { + touch("$fname.txt"); + touch("$fname.wav"); + } + + // stream it + $ret = $this->stream_file($fname, $escape_digits); + + // clean up old files + $delete = time() - 2592000; // 1 month + foreach(glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'text2wav_*') as $file) + if(filemtime($file) < $delete) + unlink($file); + + return $ret; + } + + /** + * Use Cepstral Swift to read text. + * + * @link http://www.cepstral.com/ + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function swift($text, $escape_digits='', $frequency=8000, $voice=NULL) + { + if(!is_null($voice)) + $voice = "-n $voice"; + elseif(isset($this->config['cepstral']['voice'])) + $voice = "-n {$this->config['cepstral']['voice']}"; + + $text = trim($text); + if($text == '') return true; + + $hash = md5($text); + $fname = $this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR; + $fname .= 'swift_' . $hash; + + // create wave file + if(!file_exists("$fname.wav")) + { + // write text file + if(!file_exists("$fname.txt")) + { + $fp = fopen("$fname.txt", 'w'); + fputs($fp, $text); + fclose($fp); + } + + shell_exec("{$this->config['cepstral']['swift']} -p audio/channels=1,audio/sampling-rate=$frequency $voice -o $fname.wav -f $fname.txt"); + } + + // stream it + $ret = $this->stream_file($fname, $escape_digits); + + // clean up old files + $delete = time() - 2592000; // 1 month + foreach(glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'swift_*') as $file) + if(filemtime($file) < $delete) + unlink($file); + + return $ret; + } + + /** + * Text Input. + * + * Based on ideas found at http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText + * + * Example: + * UC H LC i , SP h o w SP a r e SP y o u ? + * $string = '*8'.'44*'.'*5'.'444*'.'00*'.'0*'.'44*'.'666*'.'9*'.'0*'.'2*'.'777*'.'33*'.'0*'.'999*'.'666*'.'88*'.'0000*'; + * + * @link http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText + * @example examples/input.php Get text input from the user and say it back + * + * @return string + */ + function text_input($mode='NUMERIC') + { + $alpha = array( 'k0'=>' ', 'k00'=>',', 'k000'=>'.', 'k0000'=>'?', 'k00000'=>'0', + 'k1'=>'!', 'k11'=>':', 'k111'=>';', 'k1111'=>'#', 'k11111'=>'1', + 'k2'=>'A', 'k22'=>'B', 'k222'=>'C', 'k2222'=>'2', + 'k3'=>'D', 'k33'=>'E', 'k333'=>'F', 'k3333'=>'3', + 'k4'=>'G', 'k44'=>'H', 'k444'=>'I', 'k4444'=>'4', + 'k5'=>'J', 'k55'=>'K', 'k555'=>'L', 'k5555'=>'5', + 'k6'=>'M', 'k66'=>'N', 'k666'=>'O', 'k6666'=>'6', + 'k7'=>'P', 'k77'=>'Q', 'k777'=>'R', 'k7777'=>'S', 'k77777'=>'7', + 'k8'=>'T', 'k88'=>'U', 'k888'=>'V', 'k8888'=>'8', + 'k9'=>'W', 'k99'=>'X', 'k999'=>'Y', 'k9999'=>'Z', 'k99999'=>'9'); + $symbol = array('k0'=>'=', + 'k1'=>'<', 'k11'=>'(', 'k111'=>'[', 'k1111'=>'{', 'k11111'=>'1', + 'k2'=>'@', 'k22'=>'$', 'k222'=>'&', 'k2222'=>'%', 'k22222'=>'2', + 'k3'=>'>', 'k33'=>')', 'k333'=>']', 'k3333'=>'}', 'k33333'=>'3', + 'k4'=>'+', 'k44'=>'-', 'k444'=>'*', 'k4444'=>'/', 'k44444'=>'4', + 'k5'=>"'", 'k55'=>'`', 'k555'=>'5', + 'k6'=>'"', 'k66'=>'6', + 'k7'=>'^', 'k77'=>'7', + 'k8'=>"\\",'k88'=>'|', 'k888'=>'8', + 'k9'=>'_', 'k99'=>'~', 'k999'=>'9'); + $text = ''; + do + { + $command = false; + $result = $this->get_data('beep'); + foreach(explode('*', $result['result']) as $code) + { + if($command) + { + switch($code{0}) + { + case '2': $text = substr($text, 0, strlen($text) - 1); break; // backspace + case '5': $mode = 'LOWERCASE'; break; + case '6': $mode = 'NUMERIC'; break; + case '7': $mode = 'SYMBOL'; break; + case '8': $mode = 'UPPERCASE'; break; + case '9': $text = explode(' ', $text); unset($text[count($text)-1]); $text = join(' ', $text); break; // backspace a word + } + $code = substr($code, 1); + $command = false; + } + if($code == '') + $command = true; + elseif($mode == 'NUMERIC') + $text .= $code; + elseif($mode == 'UPPERCASE' && isset($alpha['k'.$code])) + $text .= $alpha['k'.$code]; + elseif($mode == 'LOWERCASE' && isset($alpha['k'.$code])) + $text .= strtolower($alpha['k'.$code]); + elseif($mode == 'SYMBOL' && isset($symbol['k'.$code])) + $text .= $symbol['k'.$code]; + } + $this->say_punctuation($text); + } while(substr($result['result'], -2) == '**'); + return $text; + } + + /** + * Say Puncutation in a string. + * + * @param string $text + * @param string $escape_digits + * @param integer $frequency + * @return array, see evaluate for return information. + */ + function say_punctuation($text, $escape_digits='', $frequency=8000) + { + $ret=""; + for($i = 0; $i < strlen($text); $i++) + { + switch($text{$i}) + { + case ' ': $ret .= 'SPACE '; + case ',': $ret .= 'COMMA '; break; + case '.': $ret .= 'PERIOD '; break; + case '?': $ret .= 'QUESTION MARK '; break; + case '!': $ret .= 'EXPLANATION POINT '; break; + case ':': $ret .= 'COLON '; break; + case ';': $ret .= 'SEMICOLON '; break; + case '#': $ret .= 'POUND '; break; + case '=': $ret .= 'EQUALS '; break; + case '<': $ret .= 'LESS THAN '; break; + case '(': $ret .= 'LEFT PARENTHESIS '; break; + case '[': $ret .= 'LEFT BRACKET '; break; + case '{': $ret .= 'LEFT BRACE '; break; + case '@': $ret .= 'AT '; break; + case '$': $ret .= 'DOLLAR SIGN '; break; + case '&': $ret .= 'AMPERSAND '; break; + case '%': $ret .= 'PERCENT '; break; + case '>': $ret .= 'GREATER THAN '; break; + case ')': $ret .= 'RIGHT PARENTHESIS '; break; + case ']': $ret .= 'RIGHT BRACKET '; break; + case '}': $ret .= 'RIGHT BRACE '; break; + case '+': $ret .= 'PLUS '; break; + case '-': $ret .= 'MINUS '; break; + case '*': $ret .= 'ASTERISK '; break; + case '/': $ret .= 'SLASH '; break; + case "'": $ret .= 'SINGLE QUOTE '; break; + case '`': $ret .= 'BACK TICK '; break; + case '"': $ret .= 'QUOTE '; break; + case '^': $ret .= 'CAROT '; break; + case "\\": $ret .= 'BACK SLASH '; break; + case '|': $ret .= 'BAR '; break; + case '_': $ret .= 'UNDERSCORE '; break; + case '~': $ret .= 'TILDE '; break; + default: $ret .= $text{$i} . ' '; break; + } + } + return $this->text2wav($ret, $escape_digits, $frequency); + } + + /** + * Create a new AGI_AsteriskManager. + */ + function &new_AsteriskManager() + { + $this->asm = new AGI_AsteriskManager(NULL, $this->config); + $this->asm->pagi =& $this; + $this->config =& $this->asm->config; + return $this->asm; + } + + + // ********************************************************************************************************* + // ** PRIVATE ** + // ********************************************************************************************************* + + + /** + * Evaluate an AGI command. + * + * @access private + * @param string $command + * @return array ('code'=>$code, 'result'=>$result, 'data'=>$data) + */ + function evaluate($command) + { + $broken = array('code'=>500, 'result'=>-1, 'data'=>''); + + // write command + if(!@fwrite($this->out, trim($command) . "\n")) return $broken; + fflush($this->out); + + // Read result. Occasionally, a command return a string followed by an extra new line. + // When this happens, our script will ignore the new line, but it will still be in the + // buffer. So, if we get a blank line, it is probably the result of a previous + // command. We read until we get a valid result or asterisk hangs up. One offending + // command is SEND TEXT. + $count = 0; + do + { + $str = trim(fgets($this->in, 4096)); + } while($str == '' && $count++ < 5); + + if($count >= 5) + { + // $this->conlog("evaluate error on read for $command"); + return $broken; + } + + // parse result + $ret['code'] = substr($str, 0, 3); + $str = trim(substr($str, 3)); + + if($str{0} == '-') // we have a multiline response! + { + $count = 0; + $str = substr($str, 1) . "\n"; + $line = fgets($this->in, 4096); + while(substr($line, 0, 3) != $ret['code'] && $count < 5) + { + $str .= $line; + $line = fgets($this->in, 4096); + $count = (trim($line) == '') ? $count + 1 : 0; + } + if($count >= 5) + { + // $this->conlog("evaluate error on multiline read for $command"); + return $broken; + } + } + + $ret['result'] = NULL; + $ret['data'] = ''; + if($ret['code'] != AGIRES_OK) // some sort of error + { + $ret['data'] = $str; + $this->conlog(print_r($ret, true)); + } + else // normal AGIRES_OK response + { + $parse = explode(' ', trim($str)); + $in_token = false; + foreach($parse as $token) + { + if($in_token) // we previously hit a token starting with ')' but not ending in ')' + { + $ret['data'] .= ' ' . trim($token, '() '); + if($token{strlen($token)-1} == ')') $in_token = false; + } + elseif($token{0} == '(') + { + if($token{strlen($token)-1} != ')') $in_token = true; + $ret['data'] .= ' ' . trim($token, '() '); + } + elseif(strpos($token, '=')) + { + $token = explode('=', $token); + $ret[$token[0]] = $token[1]; + } + elseif($token != '') + $ret['data'] .= ' ' . $token; + } + $ret['data'] = trim($ret['data']); + } + + // log some errors + if($ret['result'] < 0) + $this->conlog("$command returned {$ret['result']}"); + + return $ret; + } + + /** + * Log to console if debug mode. + * + * @example examples/ping.php Ping an IP address + * + * @param string $str + * @param integer $vbl verbose level + */ + function conlog($str, $vbl=1) + { + static $busy = false; + + if($this->config['phpagi']['debug'] != false) + { + if(!$busy) // no conlogs inside conlog!!! + { + $busy = true; + $this->verbose($str, $vbl); + $busy = false; + } + } + } + + /** + * Find an execuable in the path. + * + * @access private + * @param string $cmd command to find + * @param string $checkpath path to check + * @return string the path to the command + */ + function which($cmd, $checkpath=NULL) + { + global $_ENV; + $chpath = is_null($checkpath) ? $_ENV['PATH'] : $checkpath; + + foreach(explode(':', $chpath) as $path) + if(is_executable("$path/$cmd")) + return "$path/$cmd"; + + if(is_null($checkpath)) + return $this->which($cmd, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:'. + '/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/mysql/bin'); + return false; + } + + /** + * Make a folder recursively. + * + * @access private + * @param string $folder + * @param integer $perms + * @return boolean + */ + function make_folder($folder, $perms=0755) + { + $f = explode(DIRECTORY_SEPARATOR, $folder); + $base = ''; + for($i = 0; $i < count($f); $i++) + { + $base .= $f[$i]; + if($f[$i] != '' && !file_exists($base)) { + if(mkdir($base, $perms)==FALSE){ + return(FALSE); + } + } + $base .= DIRECTORY_SEPARATOR; + } + return(TRUE); + } + +} + + +/** + * error handler for phpagi. + * + * @param integer $level PHP error level + * @param string $message error message + * @param string $file path to file + * @param integer $line line number of error + * @param array $context variables in the current scope + */ + function phpagi_error_handler($level, $message, $file, $line, $context) + { + if(ini_get('error_reporting') == 0) return; // this happens with an @ + + @syslog(LOG_WARNING, $file . '[' . $line . ']: ' . $message); + + global $phpagi_error_handler_email; + if(function_exists('mail') && !is_null($phpagi_error_handler_email)) // generate email debugging information + { + // decode error level + switch($level) + { + case E_WARNING: + case E_USER_WARNING: + $level = "Warning"; + break; + case E_NOTICE: + case E_USER_NOTICE: + $level = "Notice"; + break; + case E_USER_ERROR: + $level = "Error"; + break; + } + + // build message + $basefile = basename($file); + $subject = "$basefile/$line/$level: $message"; + $message = "$level: $message in $file on line $line\n\n"; + + if(function_exists('mysql_errno') && strpos(' '.strtolower($message), 'mysql')) + $message .= 'MySQL error ' . mysql_errno() . ": " . mysql_error() . "\n\n"; + + // figure out who we are + if(function_exists('socket_create')) + { + $addr = NULL; + $port = 80; + $socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + @socket_connect($socket, '64.0.0.0', $port); + @socket_getsockname($socket, $addr, $port); + @socket_close($socket); + $message .= "\n\nIP Address: $addr\n"; + } + + // include variables + $message .= "\n\nContext:\n" . print_r($context, true); + $message .= "\n\nGLOBALS:\n" . print_r($GLOBALS, true); + $message .= "\n\nBacktrace:\n" . print_r(debug_backtrace(), true); + + // include code fragment + if(file_exists($file)) + { + $message .= "\n\n$file:\n"; + $code = @file($file); + for($i = max(0, $line - 10); $i < min($line + 10, count($code)); $i++) + $message .= ($i + 1)."\t$code[$i]"; + } + + // make sure message is fully readable (convert unprintable chars to hex representation) + $ret = ''; + for($i = 0; $i < strlen($message); $i++) + { + $c = ord($message{$i}); + if($c == 10 || $c == 13 || $c == 9) + $ret .= $message{$i}; + elseif($c < 16) + $ret .= '\x0' . dechex($c); + elseif($c < 32 || $c > 127) + $ret .= '\x' . dechex($c); + else + $ret .= $message{$i}; + } + $message = $ret; + + // send the mail if less than 5 errors + static $mailcount = 0; + if($mailcount < 5) + @mail($phpagi_error_handler_email, $subject, $message); + $mailcount++; + } + } + + $phpagi_error_handler_email = NULL; + diff --git a/Cronjobs/a2billing_alarm.php b/Cronjobs/a2billing_alarm.php index 04689e828..22d1ca8d6 100755 --- a/Cronjobs/a2billing_alarm.php +++ b/Cronjobs/a2billing_alarm.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/Cronjobs/a2billing_archive_data_cront.php b/Cronjobs/a2billing_archive_data_cront.php old mode 100644 new mode 100755 index ff9ac67bb..12a3c3d8a --- a/Cronjobs/a2billing_archive_data_cront.php +++ b/Cronjobs/a2billing_archive_data_cront.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -66,10 +66,10 @@ $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $A2B = new A2Billing(); $A2B->load_conf($agi, NULL, 0, $idconfig); diff --git a/Cronjobs/a2billing_autorefill.php b/Cronjobs/a2billing_autorefill.php index c8625a709..64273170a 100755 --- a/Cronjobs/a2billing_autorefill.php +++ b/Cronjobs/a2billing_autorefill.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -67,10 +67,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 0; $groupcard = 5000; diff --git a/Cronjobs/a2billing_batch_autodialer.php b/Cronjobs/a2billing_batch_autodialer.php index af4d5f368..fa356a484 100755 --- a/Cronjobs/a2billing_batch_autodialer.php +++ b/Cronjobs/a2billing_batch_autodialer.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -71,10 +71,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 1; @@ -259,8 +259,10 @@ $addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover]; $destination = $phone["number"]; - if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) - $destination = substr($destination, strlen($removeprefix)); + + // applying prefix rule(s) + $destination = $A2B->removePrefix($removeprefix, $destination); + $A2B->debug(DEBUG, $agi, __FILE__, __LINE__, "[UPDATED DESTINATION: $destination]"); $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%'); $ipaddress = str_replace("%cardnumber%", $A2B->cardnumber, $ipaddress); diff --git a/Cronjobs/a2billing_batch_billing.php b/Cronjobs/a2billing_batch_billing.php index cb89d86bd..04c45f91f 100755 --- a/Cronjobs/a2billing_batch_billing.php +++ b/Cronjobs/a2billing_batch_billing.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -66,10 +66,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} //Flag to show the debuging information $verbose_level = 0; @@ -179,7 +179,7 @@ $clause_call_billing .= "stoptime >= '" . $result[0][1] . "' AND "; $clause_charge .= "creationdate >= '" . $result[0][1] . "' AND "; $desc_billing = "Calls cost between the " . $result[0][1] . " and " . $date_now; - $desc_billing_postpaid = "Amount for period between the " .date("Y-m-d", strtotime($result[0][1]) + $oneday). " and " . $date_now; + $desc_billing_postpaid = "Amount for period between the " .date("Y-m-d", strtotime($result[0][1])). " and " . $date_now; $start_date = $result[0][1]; $lastbilling_invoice = $result[0][2]; } else { diff --git a/Cronjobs/a2billing_batch_cache.php b/Cronjobs/a2billing_batch_cache.php index 8a08351d4..1ff34f428 100755 --- a/Cronjobs/a2billing_batch_cache.php +++ b/Cronjobs/a2billing_batch_cache.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -73,10 +73,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 1; $nb_record = 100; diff --git a/Cronjobs/a2billing_batch_process.php b/Cronjobs/a2billing_batch_process.php index 692ea26d7..fe4518ce8 100755 --- a/Cronjobs/a2billing_batch_process.php +++ b/Cronjobs/a2billing_batch_process.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -68,10 +68,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 0; $groupcard = 1000; @@ -98,7 +98,7 @@ // CHECK THE SERVICES $QUERY = "SELECT DISTINCT id, name, amount, period, rule, daynumber, stopmode, maxnumbercycle, status, numberofrun, datecreate, " . - "UNIX_TIMESTAMP(datelastrun), emailreport, totalcredit, totalcardperform, dialplan, operate_mode, use_group " . + "UNIX_TIMESTAMP(datelastrun), emailreport, totalcredit, totalcardperform, dialplan, operate_mode, use_group, condition5x " . "FROM cc_service " . "WHERE status=1 $service_lastrun ORDER BY id DESC"; if ($verbose_level >= 1) @@ -139,6 +139,7 @@ $dialplan = $myservice[15]; $operate_mode = $myservice[16]; $use_group = $myservice[17]; + $condition5x = $myservice[18]; $amount = $myservice[2]; $filter = ''; if ($verbose_level >= 1) @@ -161,11 +162,17 @@ if ($stopmode == 2) { $filter .= " -- NBSERVICE <= MAXNUMBERCYCLE STOPMODE Max number of cycle reach AND nbservice <= " . $myservice[7] ."\n"; - } - if ($stopmode == 1) { + } else if ($stopmode == 1) { $filter .= " -- CREDIT <= 0 STOPMODE Account balance below zero AND credit>0 \n"; + } else if ($stopmode == 50) { + $filter .= " -- CREDIT > PARAM STOPMODE Account balance greater than parameter + AND credit<$condition5x \n"; + } else if ($stopmode == 51) { + $filter .= " -- CREDIT < PARAM STOPMODE Account balance less than parameter + AND credit>$condition5x \n"; } + // dialplan if ($dialplan > 0) { $filter .= " -- dialplan check diff --git a/Cronjobs/a2billing_bill_diduse.php b/Cronjobs/a2billing_bill_diduse.php index 2da6a91ae..1e447f663 100755 --- a/Cronjobs/a2billing_bill_diduse.php +++ b/Cronjobs/a2billing_bill_diduse.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -66,10 +66,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 0; diff --git a/Cronjobs/a2billing_notify_account.php b/Cronjobs/a2billing_notify_account.php index 08f7697ee..d3dc32b77 100755 --- a/Cronjobs/a2billing_notify_account.php +++ b/Cronjobs/a2billing_notify_account.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -69,10 +69,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 0; $groupcard = 5000; diff --git a/Cronjobs/a2billing_subscription_fee.php b/Cronjobs/a2billing_subscription_fee.php index 17e80009a..a5d524a67 100755 --- a/Cronjobs/a2billing_subscription_fee.php +++ b/Cronjobs/a2billing_subscription_fee.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -68,10 +68,10 @@ // CHECK IF THE CRONT PROCESS IS ALREADY RUNNING $pH= new ProcessHandler(); if ($pH->isActive()) { - die(); // Already running! - } else { - $pH->activate(); - } + die(); // Already running! +} else { + $pH->activate(); +} $verbose_level = 1; diff --git a/Cronjobs/currencies_update_yahoo.php b/Cronjobs/currencies_update_yahoo.php index 0be2c581a..fc07d6fd5 100755 --- a/Cronjobs/currencies_update_yahoo.php +++ b/Cronjobs/currencies_update_yahoo.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/DataBase/mysql-5.x/INFO b/DataBase/mysql-5.x/INFO old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.0-to-v1.2.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.0-to-v1.2.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.2-to-v1.2.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.2-to-v1.2.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.3-to-v1.3.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.2.3-to-v1.3.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.0-to-v1.3.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.0-to-v1.3.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.3-to-v1.3.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.3-to-v1.3.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.4-to-v1.4.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.3.4-to-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.0-to-v1.6.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.0-to-v1.6.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.1-to-v1.6.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.1-to-v1.6.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.2-to-v1.7.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.6.2-to-v1.7.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.0-to-v1.7.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.0-to-v1.7.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.1-to-v1.7.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.1-to-v1.7.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.2-to-v1.8.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.7.2-to-v1.8.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.0-to-v1.8.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.0-to-v1.8.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.1-to-v1.8.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.1-to-v1.8.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.2-to-v1.8.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.2-to-v1.8.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.3-to-v1.8.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.3-to-v1.8.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.4-to-v1.8.5.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.4-to-v1.8.5.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.5-to-v1.8.6.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.5-to-v1.8.6.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.6-to-v1.9.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.8.6-to-v1.9.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.0-to-v1.9.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.0-to-v1.9.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.1-to-v1.9.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.1-to-v1.9.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.2-to-v1.9.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.2-to-v1.9.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.3-to-v1.9.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.3-to-v1.9.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.4-to-v1.9.5.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.4-to-v1.9.5.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.5-to-v2.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.5-to-v2.0.sql index 0640d4eb7..ba6ce1612 100644 --- a/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.5-to-v2.0.sql +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v1.9.5-to-v2.0.sql @@ -27,8 +27,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - * Contributed by Milan Benicek, SIPhone s.r.o., milan.benicek@siphone.cz - * **/ diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0-to-v2.0.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0-to-v2.0.3.sql index bb7f21c4b..1b11dcb0d 100644 --- a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0-to-v2.0.3.sql +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0-to-v2.0.3.sql @@ -27,8 +27,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - * Contributed by Milan Benicek, SIPhone s.r.o., milan.benicek@siphone.cz - * **/ diff --git a/admin/Public/A2B_entity_campaign_config.php b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.10-to-v2.0.11.sql old mode 100755 new mode 100644 similarity index 52% rename from admin/Public/A2B_entity_campaign_config.php rename to DataBase/mysql-5.x/UPDATE-a2billing-v2.0.10-to-v2.0.11.sql index c1c28843f..d116c4240 --- a/admin/Public/A2B_entity_campaign_config.php +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.10-to-v2.0.11.sql @@ -1,4 +1,3 @@ -. * - * **/ -include '../lib/admin.defines.php'; -include '../lib/admin.module.access.php'; -include '../lib/Form/Class.FormHandler.inc.php'; -include './form_data/FG_var_campaign_config.inc'; -include '../lib/admin.smarty.php'; - -if (! has_rights (ACX_PREDICTIVE_DIALER)) { - Header ("HTTP/1.0 401 Unauthorized"); - Header ("Location: PP_error.php?c=accessdenied"); - die(); -} - -getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname')); - -$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; - -$list = $HD_Form -> perform_action($form_action); - -// #### HEADER SECTION -$smarty->display('main.tpl'); - -// #### HELP SECTION -echo $CC_help_campaign_config; - -// #### TOP SECTION PAGE -$HD_Form -> create_toppage ($form_action); - -$HD_Form -> create_form ($form_action, $list, $id=null) ; - -// #### FOOTER SECTION -if (!$popup_select) $smarty->display('footer.tpl'); +-- Update Version +UPDATE cc_version SET version = '2.0.11'; diff --git a/admin/Public/A2B_entity_phonebook.php b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.11-to-v2.0.12.sql old mode 100755 new mode 100644 similarity index 54% rename from admin/Public/A2B_entity_phonebook.php rename to DataBase/mysql-5.x/UPDATE-a2billing-v2.0.11-to-v2.0.12.sql index e12621783..6ac57769b --- a/admin/Public/A2B_entity_phonebook.php +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.11-to-v2.0.12.sql @@ -1,4 +1,3 @@ -. * - * **/ -include '../lib/admin.defines.php'; -include '../lib/admin.module.access.php'; -include '../lib/Form/Class.FormHandler.inc.php'; -include './form_data/FG_var_phonebook.inc'; -include '../lib/admin.smarty.php'; - -if (!has_rights(ACX_PREDICTIVE_DIALER)) { - Header("HTTP/1.0 401 Unauthorized"); - Header("Location: PP_error.php?c=accessdenied"); - die(); -} - -$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; - -$list = $HD_Form->perform_action($form_action); - -// #### HEADER SECTION -$smarty->display('main.tpl'); - -// #### HELP SECTION -echo $CC_help_phonebook; - -// #### TOP SECTION PAGE -$HD_Form->create_toppage($form_action); - -$HD_Form->create_form($form_action, $list, $id = null); +-- Update Version +UPDATE cc_version SET version = '2.0.12'; -// #### FOOTER SECTION -if (!$popup_select) - $smarty->display('footer.tpl'); +CREATE OR REPLACE VIEW cc_sip_buddies_empty AS + SELECT id, id_cc_card, name, accountcode, regexten, amaflags, callgroup, callerid, canreinvite, context, DEFAULTip, dtmfmode, fromuser, fromdomain, host, insecure, language, mailbox, '' as md5secret, nat, deny, permit, mask, pickupgroup, port, qualify, restrictcid, rtptimeout, rtpholdtimeout, '' as secret, type, username, disallow, allow, musiconhold, regseconds, ipaddr, cancallforward, fullcontact, setvar, regserver, lastms, defaultuser, auth, subscribemwi, vmexten, cid_number, callingpres, usereqphone, incominglimit, subscribecontext, musicclass, mohsuggest, allowtransfer, autoframing, maxcallbitrate, outboundproxy, rtpkeepalive, useragent, callbackextension + FROM cc_sip_buddies; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.12-to-v2.0.13.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.12-to-v2.0.13.sql new file mode 100644 index 000000000..bde135817 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.12-to-v2.0.13.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.13'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.13-to-v2.0.14.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.13-to-v2.0.14.sql new file mode 100644 index 000000000..ba37043cb --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.13-to-v2.0.14.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.14'; diff --git a/customer/A2B_entity_campaign.php b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.14-to-v2.0.15.sql similarity index 55% rename from customer/A2B_entity_campaign.php rename to DataBase/mysql-5.x/UPDATE-a2billing-v2.0.14-to-v2.0.15.sql index 65bd0c538..bf9152eb6 100644 --- a/customer/A2B_entity_campaign.php +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.14-to-v2.0.15.sql @@ -1,4 +1,3 @@ -. * - * **/ -include './lib/customer.defines.php'; -include './lib/customer.module.access.php'; -include './lib/Form/Class.FormHandler.inc.php'; -include './form_data/FG_var_campaign.inc'; -include 'lib/customer.smarty.php'; - -if (!has_rights(ACX_AUTODIALER)) { - Header("HTTP/1.0 401 Unauthorized"); - Header("Location: PP_error.php?c=accessdenied"); - die(); -} - -$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; - -$list = $HD_Form->perform_action($form_action); - -// #### HEADER SECTION -$smarty->display('main.tpl'); - -// #### HELP SECTION -echo $CC_help_campaign; - -// #### TOP SECTION PAGE -$HD_Form->create_toppage($form_action); -$HD_Form->create_form($form_action, $list, $id = null); +ALTER TABLE cc_call ADD a2b_custom1 VARCHAR( 20 ); +ALTER TABLE cc_call ADD a2b_custom2 VARCHAR( 20 ); -// #### FOOTER SECTION -$smarty->display('footer.tpl'); +-- Update Version +UPDATE cc_version SET version = '2.0.15'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.15-to-v2.0.16.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.15-to-v2.0.16.sql new file mode 100644 index 000000000..b1d2a1a51 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.15-to-v2.0.16.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.16'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.16-to-v2.0.17.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.16-to-v2.0.17.sql new file mode 100644 index 000000000..eb463e566 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.16-to-v2.0.17.sql @@ -0,0 +1,53 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Add default account code setting +DELETE FROM cc_config + WHERE config_key IN ('default_accountcode', 'default_accountcode_all'); + +INSERT INTO cc_config SET + config_title = 'Default Accountcode', + config_key = 'default_accountcode', + config_value = '', + config_description = 'The accountcode to apply to all calls using this AGI config. See default_accountcode_all for more control', + config_valuetype = 0, + config_listvalues = NULL, + config_group_title = 'agi-conf1'; + +INSERT INTO cc_config SET + config_title = 'Default Accountcode Behaviour', + config_key = 'default_accountcode_all', + config_value = '0', + config_description = 'Use the default accountcode for all calls, even if they have an accountcode already?', + config_valuetype = '1', + config_listvalues = 'yes,no', + config_group_title = 'agi-conf1'; + +-- Update Version +UPDATE cc_version SET version = '2.0.17'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.17-to-v2.1.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.17-to-v2.1.0.sql new file mode 100644 index 000000000..fb32dec56 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.17-to-v2.1.0.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.1.0'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.3-to-v2.0.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.3-to-v2.0.4.sql new file mode 100755 index 000000000..fe5442da8 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.3-to-v2.0.4.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.4'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.4-to-v2.0.5.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.4-to-v2.0.5.sql new file mode 100755 index 000000000..fd2263c2f --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.4-to-v2.0.5.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.5'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.5-to-v2.0.6.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.5-to-v2.0.6.sql new file mode 100755 index 000000000..81afdefae --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.5-to-v2.0.6.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.6'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.6-to-v2.0.7.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.6-to-v2.0.7.sql new file mode 100755 index 000000000..bb63d0fe4 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.6-to-v2.0.7.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.7'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.7-to-v2.0.8.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.7-to-v2.0.8.sql new file mode 100644 index 000000000..b165fbcba --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.7-to-v2.0.8.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.8'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.8-to-v2.0.9.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.8-to-v2.0.9.sql new file mode 100644 index 000000000..d66aa1a45 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.8-to-v2.0.9.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.9'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.9-to-v2.0.10.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.9-to-v2.0.10.sql new file mode 100644 index 000000000..8bb09c18f --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.0.9-to-v2.0.10.sql @@ -0,0 +1,33 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * This file is part of A2Billing (http://www.a2billing.net/) + * + * A2Billing, Commercial Open Source Telecom Billing platform, + * powered by Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @author Belaid Arezqui + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @package A2Billing + * + * Software License Agreement (GNU Affero General Public License) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * +**/ + +-- Update Version +UPDATE cc_version SET version = '2.0.10'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.0-to-v2.1.1.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.0-to-v2.1.1.sql new file mode 100644 index 000000000..4ba637038 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.0-to-v2.1.1.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.1.1'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.1-to-v2.1.2.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.1-to-v2.1.2.sql new file mode 100644 index 000000000..643a28a15 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.1-to-v2.1.2.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.1.2'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.2-to-v2.1.3.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.2-to-v2.1.3.sql new file mode 100644 index 000000000..d9965f50e --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.2-to-v2.1.3.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.1.3'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.3-to-v2.1.4.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.3-to-v2.1.4.sql new file mode 100644 index 000000000..ecac540d8 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.3-to-v2.1.4.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.1.4'; diff --git a/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.4-to-v2.2.0.sql b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.4-to-v2.2.0.sql new file mode 100644 index 000000000..5c3314edc --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-a2billing-v2.1.4-to-v2.2.0.sql @@ -0,0 +1,31 @@ +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ +/** +* This file is part of A2Billing (http://www.a2billing.net/) +* +* A2Billing, Commercial Open Source Telecom Billing platform, +* powered by Star2billing S.L. +* +* @copyright Copyright (C) 2004-2012 - Star2billing S.L. +* @author Belaid Arezqui +* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html +* @package A2Billing +* +* Software License Agreement (GNU Affero General Public License) +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**/ + +-- Update Version +UPDATE cc_version SET version = '2.2.0'; diff --git a/DataBase/mysql-5.x/UPDATE-to-develop.sql b/DataBase/mysql-5.x/UPDATE-to-develop.sql new file mode 100755 index 000000000..c7b0c20a1 --- /dev/null +++ b/DataBase/mysql-5.x/UPDATE-to-develop.sql @@ -0,0 +1,130 @@ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * 2016 copyright Roman Davydov +**/ + +-- ICustomer bundle specific SQL changes + +alter table `cc_version` + add primary key(`version`); + +-- Openvoip.co customization SQL changes + +alter table `cc_trunk` + add column `minutes_per_day` int(11) NULL DEFAULT '0' after `if_max_use`, + add column `attempt_statuses` varchar(255) COLLATE utf8_bin NULL DEFAULT 'CHANUNAVAIL,CONGESTION' after `minutes_per_day`, + add column `attempt_condition` int(11) unsigned NULL DEFAULT '0' after `attempt_statuses`, + add column `attempt_count` int(11) unsigned NULL DEFAULT '0' after `attempt_condition`, + add column `priority` int(11) NULL DEFAULT '0' after `attempt_count`, + add column `attempt_delay` int(11) DEFAULT '0' after `priority`, + add column `calls_per_day` int(11) DEFAULT '0' after `attempt_delay`, + add column `trunk_GMT` int(11) DEFAULT '0' after `calls_per_day`, + add column `tollfree` int(11) NOT NULL DEFAULT '0' after `trunk_GMT`, + change `removeprefix` `removeprefix` varchar (2048) NULL; + +CREATE TABLE `cc_trunk_counter` ( + `id_trunk` int(10) unsigned NOT NULL, + `calldate` date NOT NULL, + `seconds` int(11) DEFAULT '0', + `last_call_time` int(11) NOT NULL DEFAULT '0', + `success_calls` int(11) DEFAULT '0', + `minutes` int(11) DEFAULT '0', + PRIMARY KEY (`id_trunk`,`calldate`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +alter table `cc_provider` + add column `id_cc_card` int(11) NOT NULL DEFAULT '0' after `description`; + +alter table `cc_ratecard` + add column `is_disabled` int(1) unsigned NOT NULL DEFAULT '0' after `destination`; + +alter table `cc_tariffplan` + add column `trunk_algo` int(10) unsigned NULL DEFAULT '0' after `calleridprefix`, + add column `algo_break_hc` varchar (1024) NULL after `trunk_algo`; + +create table `cc_tariffplan_trunk`( + `idtariffplan` int(11) NOT NULL, + `idtrunk` int(11) NOT NULL, + PRIMARY KEY (`idtariffplan`,`idtrunk`) +)Engine=MyISAM DEFAULT CHARSET='utf8'; + + +DELIMITER $$ +DROP FUNCTION IF EXISTS `a2billing`.`getCurDateByTrunkTZ`$$ +CREATE FUNCTION `a2billing`.`getCurDateByTrunkTZ`(id_trunk INT) +RETURNS DATE DETERMINISTIC +BEGIN + declare server_GMT varchar(10); + declare trunk_GMT varchar(10); + + -- getting server GMT + select config_value into server_GMT from cc_config where config_key = 'server_GMT' and config_group_title = 'global' and (config_value REGEXP "^(GMT)?(\\-|\\+)[[:digit:]]{1,2}\\:[[:digit:]]{1,2}$") limit 1; + IF (ISNULL(server_GMT)) THEN + set server_GMT = '+00:00'; + ELSE + IF SUBSTRING(server_GMT, 1, 3) LIKE 'gmt' THEN + set server_GMT = SUBSTRING(server_GMT, 4); + END IF; + END IF; + + -- getting trunk GMT + select tz.gmttime into trunk_GMT from cc_timezone tz where tz.id = (select t.trunk_GMT from cc_trunk t where t.id_trunk = id_trunk limit 1) limit 1; + IF (ISNULL(trunk_GMT)) THEN + set trunk_GMT = '+00:00'; + ELSE + IF SUBSTRING(trunk_GMT, 1, 3) LIKE 'gmt' THEN + set trunk_GMT = SUBSTRING(trunk_GMT, 4); + END IF; + END IF; + + -- adjusting current date + return DATE(CONVERT_TZ(NOW(), server_GMT, trunk_GMT)); + +END$$ +DELIMITER ; + +-- Reccuring service improvement, added new condition +alter table cc_service add `condition5x` float NOT NULL DEFAULT '0'; + +-- Create cc_auth_failures_log for Auth fails report +CREATE TABLE `cc_auth_failures_log` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `cid` varchar(100) DEFAULT NULL, + `reason` varchar(100) NOT NULL, + `dump` text NOT NULL, + `id_card` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `cid` (`cid`), + KEY `created_at` (`created_at`), + KEY `reason` (`reason`), + FULLTEXT KEY `dump` (`dump`) +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +-- Insert new config parameter allowed_groups +insert into cc_config +(config_title, config_key, config_description, config_valuetype, config_group_title) +values +('Allowed card groups', 'allowed_groups', 'The list of allowed card groups to be authenticated. Just list groups IDs with commas, like "1,2,3,4". Allows all if empty', '0', 'agi-conf1'); + +-- Insert new config parameter lock_useralias +insert into cc_config +(config_title, config_key, config_description, config_valuetype, config_value, config_listvalues, config_group_title) +values +('Lock useralias', 'lock_useralias', 'Disable WEBUI LOGIN field editing', '1', '0', 'yes,no', 'webui'); + +-- Insert new config parameter customer_balance_precision +insert into cc_config +(config_title, config_key, config_value, config_description, config_valuetype, config_group_title) +values +('Customer balance precision', 'customer_balance_precision', '2', 'Only for displaying / saying', 0, 'global'); + +-- Insert new config parameter force_rerouting +insert into cc_config +(config_title, config_key, config_description, config_valuetype, config_value, config_listvalues, config_group_title) +values + ('Force rerouting', 'force_rerouting', 'If enabled the billing will stop rerouting only on ANSWER', '1', '0', 'yes,no', 'agi-conf1'); + +-- END Openvoip.co customization SQL changes diff --git a/DataBase/mysql-5.x/a2billing-createdb-user.sql b/DataBase/mysql-5.x/a2billing-createdb-user.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/a2billing-prefix-table-josko-v1.4.0.sql b/DataBase/mysql-5.x/a2billing-prefix-table-josko-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/a2billing-prefix-table-v1.4.0.sql b/DataBase/mysql-5.x/a2billing-prefix-table-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql b/DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql old mode 100644 new mode 100755 index cd15aee33..c30f379f3 --- a/DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql +++ b/DataBase/mysql-5.x/a2billing-schema-v1.4.0.sql @@ -1478,6 +1478,7 @@ INSERT INTO `cc_country` (`id`, `countrycode`, `countryprefix`, `countryname`) V INSERT INTO `cc_country` (`id`, `countrycode`, `countryprefix`, `countryname`) VALUES(253, 'SRB', '381', 'Serbia, Republic of'); INSERT INTO `cc_country` (`id`, `countrycode`, `countryprefix`, `countryname`) VALUES(254, 'CPT', '0', 'Clipperton Island'); INSERT INTO `cc_country` (`id`, `countrycode`, `countryprefix`, `countryname`) VALUES(255, 'TAA', '0', 'Tristan da Cunha'); +INSERT INTO `cc_country` (`id`, `countrycode`, `countryprefix`, `countryname`) VALUES(256, 'UNK', '381', 'Kosovo'); -- -------------------------------------------------------- diff --git a/DataBase/mysql-5.x/install-db.sh b/DataBase/mysql-5.x/install-db.sh index e2c3df7e7..786cbe677 100755 --- a/DataBase/mysql-5.x/install-db.sh +++ b/DataBase/mysql-5.x/install-db.sh @@ -1,8 +1,36 @@ #!/bin/bash +SCRIPT_DIR=$(dirname $0) +sqllist=( + a2billing-schema-v1.4.0.sql UPDATE-a2billing-v1.4.0-to-v1.4.1.sql + UPDATE-a2billing-v1.4.1-to-v1.4.2.sql UPDATE-a2billing-v1.4.2-to-v1.4.3.sql + UPDATE-a2billing-v1.4.3-to-v1.4.4.sql UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql + UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql UPDATE-a2billing-v1.4.5-to-v1.5.0.sql + UPDATE-a2billing-v1.5.0-to-v1.5.1.sql UPDATE-a2billing-v1.5.1-to-v1.6.0.sql + UPDATE-a2billing-v1.6.0-to-v1.6.1.sql UPDATE-a2billing-v1.6.1-to-v1.6.2.sql + UPDATE-a2billing-v1.6.2-to-v1.7.0.sql UPDATE-a2billing-v1.7.0-to-v1.7.1.sql + UPDATE-a2billing-v1.7.1-to-v1.7.2.sql UPDATE-a2billing-v1.7.2-to-v1.8.0.sql + UPDATE-a2billing-v1.8.0-to-v1.8.1.sql UPDATE-a2billing-v1.8.1-to-v1.8.2.sql + UPDATE-a2billing-v1.8.2-to-v1.8.3.sql UPDATE-a2billing-v1.8.3-to-v1.8.4.sql + UPDATE-a2billing-v1.8.4-to-v1.8.5.sql UPDATE-a2billing-v1.8.5-to-v1.8.6.sql + UPDATE-a2billing-v1.8.6-to-v1.9.0.sql UPDATE-a2billing-v1.9.0-to-v1.9.1.sql + UPDATE-a2billing-v1.9.1-to-v1.9.2.sql UPDATE-a2billing-v1.9.2-to-v1.9.3.sql + UPDATE-a2billing-v1.9.3-to-v1.9.4.sql UPDATE-a2billing-v1.9.4-to-v1.9.5.sql + UPDATE-a2billing-v1.9.5-to-v2.0.sql UPDATE-a2billing-v2.0-to-v2.0.3.sql + UPDATE-a2billing-v2.0.3-to-v2.0.4.sql UPDATE-a2billing-v2.0.4-to-v2.0.5.sql + UPDATE-a2billing-v2.0.5-to-v2.0.6.sql UPDATE-a2billing-v2.0.6-to-v2.0.7.sql + UPDATE-a2billing-v2.0.7-to-v2.0.8.sql UPDATE-a2billing-v2.0.9-to-v2.0.10.sql + UPDATE-a2billing-v2.0.10-to-v2.0.11.sql UPDATE-a2billing-v2.0.11-to-v2.0.12.sql + UPDATE-a2billing-v2.0.12-to-v2.0.13.sql UPDATE-a2billing-v2.0.13-to-v2.0.14.sql + UPDATE-a2billing-v2.0.14-to-v2.0.15.sql UPDATE-a2billing-v2.0.15-to-v2.0.16.sql + UPDATE-a2billing-v2.0.16-to-v2.0.17.sql UPDATE-a2billing-v2.0.17-to-v2.1.0.sql + UPDATE-a2billing-v2.1.0-to-v2.1.1.sql UPDATE-a2billing-v2.1.1-to-v2.1.2.sql + UPDATE-a2billing-v2.1.2-to-v2.1.3.sql UPDATE-a2billing-v2.1.3-to-v2.1.4.sql + UPDATE-a2billing-v2.1.4-to-v2.2.0.sql +) echo "" -echo "Install A2Billing DataBase" -echo "-----------------------------" +echo "Install A2Billing Database" +echo "--------------------------" echo "" echo "Enter Database Name : " @@ -19,7 +47,12 @@ read password echo mysql --user=$username --password=$password --host=$hostname $dbname -cat a2billing-schema-v1.4.0.sql UPDATE-a2billing-v1.4.0-to-v1.4.1.sql UPDATE-a2billing-v1.4.1-to-v1.4.2.sql UPDATE-a2billing-v1.4.2-to-v1.4.3.sql UPDATE-a2billing-v1.4.3-to-v1.4.4.sql UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql UPDATE-a2billing-v1.4.5-to-v1.5.0.sql UPDATE-a2billing-v1.5.0-to-v1.5.1.sql UPDATE-a2billing-v1.5.1-to-v1.6.0.sql UPDATE-a2billing-v1.6.0-to-v1.6.1.sql UPDATE-a2billing-v1.6.1-to-v1.6.2.sql UPDATE-a2billing-v1.6.2-to-v1.7.0.sql UPDATE-a2billing-v1.7.0-to-v1.7.1.sql UPDATE-a2billing-v1.7.1-to-v1.7.2.sql UPDATE-a2billing-v1.7.2-to-v1.8.0.sql UPDATE-a2billing-v1.8.0-to-v1.8.1.sql UPDATE-a2billing-v1.8.1-to-v1.8.2.sql UPDATE-a2billing-v1.8.2-to-v1.8.3.sql UPDATE-a2billing-v1.8.3-to-v1.8.4.sql UPDATE-a2billing-v1.8.4-to-v1.8.5.sql UPDATE-a2billing-v1.8.5-to-v1.8.6.sql UPDATE-a2billing-v1.8.6-to-v1.9.0.sql UPDATE-a2billing-v1.9.0-to-v1.9.1.sql UPDATE-a2billing-v1.9.1-to-v1.9.2.sql UPDATE-a2billing-v1.9.2-to-v1.9.3.sql UPDATE-a2billing-v1.9.3-to-v1.9.4.sql UPDATE-a2billing-v1.9.4-to-v1.9.5.sql UPDATE-a2billing-v1.9.5-to-v2.0.sql UPDATE-a2billing-v2.0-to-v2.0.3.sql| mysql --user=$username --password=$password --host=$hostname $dbname +for script in "${sqllist[@]}" +do + cat $SCRIPT_DIR/$script|mysql --user=$username --password=$password --host=$hostname $dbname +done + +[ ! -z "$1" ] && cat $SCRIPT_DIR/UPDATE-to-develop.sql | mysql --user=$username --password=$password --host=$hostname $dbname # All done, exit ok exit 0 diff --git a/DataBase/mysql-5.x/my-maintenance.sh b/DataBase/mysql-5.x/my-maintenance.sh new file mode 100755 index 000000000..b5e165886 --- /dev/null +++ b/DataBase/mysql-5.x/my-maintenance.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +echo "" +echo "Maintenance A2Billing DataBase" +echo "------------------------------" +echo "" + +echo "Enter Database Name : " +read dbname + +echo "Enter Hostname : " +read hostname + +echo "Enter UserName : " +read username + +echo "Enter Password : " +read password + +NOW=$(date +"%m-%d-%Y") + +echo "Dump a2billing.$NOW.dmp in process..." +mysqldump --user=$username --password=$password --host=$hostname --create-options --routines --triggers $dbname > a2billing.$NOW.dmp + +echo "Tar.gz a2billing.$NOW.dmp in process..." +tar -pczf a2billing.$NOW.tar.gz a2billing.$NOW.dmp +rm a2billing.$NOW.dmp + +echo "Database backup available at a2billing.$NOW.tar.gz" + +echo "mysqlcheck --user=$username --password=$password --host=$hostname --check --databases $dbname" +mysqlcheck --user=$username --password=$password --host=$hostname --check --databases $dbname + + +echo "mysqlcheck --user=$username --password=$password --host=$hostname --optimize --databases $dbname" +mysqlcheck --user=$username --password=$password --host=$hostname --optimize --databases $dbname + + +echo "mysqlcheck --user=$username --password=$password --host=$hostname --analyze --databases $dbname" +mysqlcheck --user=$username --password=$password --host=$hostname --analyze --databases $dbname diff --git a/DataBase/psql/INSTALL b/DataBase/psql/INSTALL old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.2.0-to-v1.2.3.sql b/DataBase/psql/UPDATE-a2billing-v1.2.0-to-v1.2.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.2.3-to-v1.3.0.sql b/DataBase/psql/UPDATE-a2billing-v1.2.3-to-v1.3.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.3.0-to-v1.3.1.sql b/DataBase/psql/UPDATE-a2billing-v1.3.0-to-v1.3.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.3.3-to-v1.3.4.sql b/DataBase/psql/UPDATE-a2billing-v1.3.3-to-v1.3.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.3.4-to-v1.4.0.sql b/DataBase/psql/UPDATE-a2billing-v1.3.4-to-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql b/DataBase/psql/UPDATE-a2billing-v1.4.0-to-v1.4.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql b/DataBase/psql/UPDATE-a2billing-v1.4.1-to-v1.4.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql b/DataBase/psql/UPDATE-a2billing-v1.4.2-to-v1.4.3.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql b/DataBase/psql/UPDATE-a2billing-v1.4.3-to-v1.4.4.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql b/DataBase/psql/UPDATE-a2billing-v1.4.4-to-v1.4.4.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql b/DataBase/psql/UPDATE-a2billing-v1.4.4.1-to-v1.4.5.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql b/DataBase/psql/UPDATE-a2billing-v1.4.5-to-v1.5.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql b/DataBase/psql/UPDATE-a2billing-v1.5.0-to-v1.5.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql b/DataBase/psql/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.6.0-to-v1.6.1.sql b/DataBase/psql/UPDATE-a2billing-v1.6.0-to-v1.6.1.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.6.1-to-v1.6.2.sql b/DataBase/psql/UPDATE-a2billing-v1.6.1-to-v1.6.2.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/UPDATE-a2billing-v1.6.2-to-v1.7.0.sql b/DataBase/psql/UPDATE-a2billing-v1.6.2-to-v1.7.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/a2billing-createdb-user-v1.0.0.sql b/DataBase/psql/a2billing-createdb-user-v1.0.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/a2billing-createlang-v1.0.0.sql b/DataBase/psql/a2billing-createlang-v1.0.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/a2billing-prefix-table-josko-v1.4.0.sql b/DataBase/psql/a2billing-prefix-table-josko-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/a2billing-prefix-table-v1.4.0.sql b/DataBase/psql/a2billing-prefix-table-v1.4.0.sql old mode 100644 new mode 100755 diff --git a/DataBase/psql/a2billing-schema-v1.4.0.sql b/DataBase/psql/a2billing-schema-v1.4.0.sql old mode 100644 new mode 100755 index 6e640ccd3..30a6b24c6 --- a/DataBase/psql/a2billing-schema-v1.4.0.sql +++ b/DataBase/psql/a2billing-schema-v1.4.0.sql @@ -766,7 +766,7 @@ CREATE TABLE cc_sip_buddies ( ); --- Empty password view for OpenSips +-- Empty password view for OpenSips / Kamailio CREATE OR REPLACE VIEW cc_sip_buddies_empty AS SELECT id, id_cc_card, name, accountcode, regexten, amaflags, callgroup, callerid, canreinvite, context, DEFAULTip, dtmfmode, fromuser, fromdomain, host, insecure, language, mailbox, md5secret, nat, permit, diff --git a/INSTALL.rst b/INSTALL.rst index b18eb46f3..b7f211813 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -7,15 +7,18 @@ A2BILLING INSTALLATION GUIDE 0. Sypnosis ----------- - A2Billing is a voip billing software licensed under the AGPL 3. - Copyright (C) 2004-2012 - Star2billing S.L. http://www.star2billing.com/ +A2Billing is a voip billing software licensed under the AGPL 3. +Copyright (C) 2004-2015 - Star2billing S.L. http://www.star2billing.com/ - This document focuses on the installation of A2Billing system for the Asterisk open source PBX. The document covers the installation and basic configuration of - A2Billing. A2billing is an open source implementation of a telecommunication billing and added value services platform. +This document focuses on the installation of A2Billing system for the Asterisk +open source PBX. The document covers the installation and basic configuration +of A2Billing. A2billing is an open source implementation of a telecommunication +billing and added value services platform. - A2billing is a LAMP (Linux Apache Mysql(Postgresql) PHP) application that interfaces with Asterisk using both the AMI and AGI interfaces. +A2billing is a LAMP (Linux/Apache/Mysql/PHP) application that interfaces with +Asterisk using both the AMI and AGI interfaces. - This documentation has been tested using Debian etch, Debian etch and half, Ubuntu 8.04 and Ubuntu 8.10 and A2Billing. +This documentation has been tested using Ubuntu 12.04. 1. A2Billing installation guide @@ -24,60 +27,83 @@ A2BILLING INSTALLATION GUIDE 1.1 Important note about distributions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - This documentation assumes that you are using a .deb based distro that has used the folder /usr/share/asterisk during packaging. Other distributions use the alternate - folder /var/lib/asterisk. If you compile from source the path by default is /var/lib/asterisk. +This documentation assumes that you are using a .deb based distro that has used the folder /usr/share/asterisk during packaging. Other distributions use the alternate +folder /var/lib/asterisk. If you compile from source the path by default is /var/lib/asterisk. - The basic assumptions of this documentation is that used pre-packaged software and: - * your apache2 default root folder is /var/www - * your asterisk sounds are under /usr/share/asterisk - * your asterisk AGI folder is expected under /usr/share/asterisk - * your apache2 runs as www-data (uid) - * you asterisk runs as asterisk (uid) - * those using subversion to check out the code, can use symbolic links instead of copying the files to the right directories +The basic assumptions of this documentation is that used pre-packaged software and: + * your apache2 default root folder is /var/www + * your asterisk sounds are under /usr/share/asterisk + * your asterisk AGI folder is expected under /usr/share/asterisk + * your apache2 runs as www-data (uid) + * you asterisk runs as asterisk (uid) + * those using subversion to check out the code, can use symbolic links instead of copying the files to the right directories 1.2 Default passwords and access info ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - This are the default passwords that you should know about - * mysql root password (in default system normally is ) - * A2Billing default database is mya2billing, user is a2billinguser and password is a2billing - * asterisk manager default information is: [myasterisk] and secret=mycode - * A2Billing admin default password is: user: root password: changepassword +This are the default passwords that you should know about: + +* mysql root password (in default system normally is ) +* A2Billing default database is mya2billing, user is a2billinguser and password is a2billing +* asterisk manager default information is: [myasterisk] and secret=mycode +* A2Billing admin default password is: user: root password: changepassword 1.3 Pre-required software packages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - A2billing requires the packages of a LAMP (PHP5) installation. To install the necessary packages, run the following commands: - - apt-get install libapache2-mod-php5 php5 php5-common - - apt-get install php5-cli php5-mysql mysql-server apache2 php5-gd - - apt-get install openssh-server subversion - A2Billing also requires MCrypt module for PHP5 - - apt-get install php5-mcrypt +A2billing requires the packages of a LAMP (PHP5) installation. To install +the necessary packages, run the following commands:: + + apt-get install libapache2-mod-php5 php5 php5-common + apt-get install php5-cli php5-mysql mysql-server apache2 php5-gd + apt-get install openssh-server subversion + +A2Billing also requires MCrypt module for PHP5:: + + apt-get install php5-mcrypt + +Asterisk is of course also needed:: + + apt-get install asterisk + +1.3.1 Extra software to support text-to-speech IVR monitoring +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Since version 1.7 we include an AGI mode that allows the monitoring of +the a2billing system via an IVR. - Asterisk is of course also needed. - - apt-get install asterisk +The monitoring feature requires text-to-speech TTS support, the +default TTS engine is Cepstral (http://www.cepstral.com/) although +A2Billing can support Festival too. - 1.3.1 Extra software to support text-to-speech IVR monitoring +Install Cepstral (default path: /opt/swift) and make a symbolic link:: - Version 1.7.1 includes a new AGI mode that allows the monitoring of the a2billing system via an IVR. + ln -s /opt/swift/bin/swift /usr/bin/swift - The new monitoring feature requires text-to-speech TTS support, the default TTS engine is Cepstral - http://www.cepstral.com/ although a2billing can support Festival too. +Make sure that the dynamic libraries are linked, create a file called +cepstral.conf under /etc/ld.so.conf.d/ including the path : /opt/swift/lib - Install Cepstral (default path: /opt/swift) and make a symbolic link: - - ln -s /opt/swift/bin/swift /usr/bin/swift - Make sure that the dynamic libraries are linked, create a file called cepstral.conf under /etc/ld.so.conf.d/ including the path : /opt/swift/lib +1.3 PHP Composer +~~~~~~~~~~~~~~~~ - Do not forget to register your voice! +A PHP dependency manager called Composer (https://getcomposer.org/) is used to +install PHP packages needed for A2Billing. +You can follow those steps to install PHP composer:: + + cd /usr/local/a2billing + curl -sS https://getcomposer.org/installer | php + php composer.phar update + php composer.phar install + 2. Installation -~~~~~~~~~~~~~~~ +--------------- - In a nutshell installing A2Billing requires a minimum of seven steps (1-7) +In a nutshell installing A2Billing requires a minimum of seven steps (1-7) 1. Download and unpack source code 2. Setup the database @@ -91,311 +117,384 @@ A2BILLING INSTALLATION GUIDE 10. Enable monitoring (only for IVR monitoring) 11. Enable card locking (only for card PIN locking) - 2.1. Step 1: Download and unpack source code - Create a a2billing folder under /usr/local/src +2.1. Step 1: Download and unpack source code +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Create a a2billing folder under /usr/local/src:: + + mkdir /usr/local/src/a2billing + +Unpack the code + +Download the code from the GIT repository run: :: + + git clone https://github.com/Star2Billing/a2billing.git /usr/local/src/a2billing/ && rm -rf /usr/local/src/a2billing/.git + +At the end of this step you should have a a2billing tree structure that should look like:: + + /usr/local/src/a2billing/ + +Files:: + + AGI + CHANGELOG + COPYING + CallBack + Cronjobs : Recurrent services run via crontab + DataBase : Database Schema / DB Installation + FEATURES_LIST + a2billing.conf : Main Configuration file + addons : Sounds and other addons + admin : Admin UI + agent : Agent UI + customer : Customer UI + webservice + + +2.2. Step 2: Prepare the Database +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +We will now create a MySQL database (mya2billing) for the billing software. The file a2billing-createdb-user.sql includes a script that creates the database with the correct access control users and permissions. :: + + cd /usr/local/src/a2billing + mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql + +The script with create a database, username and password with the following default values + - Database name is: mya2billing + - Database user is: a2billinguser + - User password is: a2billing + +After creating the database structure, we will create a set of tables and insert some initial basic configuration data:: + + cd DataBase/mysql-5.x/ + ./install-db.sh + +**Checkpoint 1 :** Check that the database (my2billing) and that (97) tables have been created. :: + + mysql -u root -p mya2billing + mysql>show tables + mysql>exit + + +2.3. Step 3: Edit the a2billing.conf configuration file +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The A2Billing configuration file (a2billing.conf) contains the basic +information to connect to the a2billing database. Copy or make a symbolic +link from /usr/local/src/a2billing/a2billing.conf to /etc/a2billing.conf + +a2billing.conf -> /usr/local/src/a2billing/a2billing.conf + +Option 1:: + + cp /usr/local/src/a2billing/a2billing.conf /etc/ + +Option 2:: + + ln -s /usr/local/src/a2billing/a2billing.conf /etc/a2billing.conf + +Open the file with your favorite text editor (vi is used in this example). +If you are new to Linux, we recommend you to use the text editor Gedit:: + + vi /etc/a2billing.conf + +The only parameters that you need to change here is the database connection +information, an example follows:: + + [database] + hostname = localhost + port = 3306 + user = a2billinguser + password = a2billing + dbname = mya2billing + dbtype = mysql + + +2.4. Step 4: Fix permissions, files and folders +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In this step, we will tweak the file permissions of Asterisk to fit the A2Billing software. We will also create a number of additional files and folders that A2Billing +needs, which does not come with the default installation. + +2.4.1. SIP and IAX +^^^^^^^^^^^^^^^^^^ + +First we will set a few file permissions (chmod, chown) and create (touch) the SIP and IAX configuration files for Asterisk.:: + + chmod 777 /etc/asterisk + touch /etc/asterisk/additional_a2billing_iax.conf + touch /etc/asterisk/additional_a2billing_sip.conf + echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip.conf + echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf + chown -Rf www-data /etc/asterisk/additional_a2billing_iax.conf + chown -Rf www-data /etc/asterisk/additional_a2billing_sip.conf + +2.4.2. Sound files +^^^^^^^^^^^^^^^^^^ + +Run the sounds installation script available in the addons folder (IMPORTANT: the script assumes that asterisk sounds are under /usr/share/asterisk/sounds/):: + + /usr/local/src/a2billing/addons/install_a2b_sounds_deb.sh + chown -R asterisk:asterisk /usr/share/asterisk/sounds/ + + +2.4.3. Configure Asterisk Manager +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Configure the Asterisk Manager by editing the manager.conf file:: + + vi /etc/asterisk/manager.conf + +Notice that we are using the default values (myasterisk, mycode) in this section. The configuration should look like this:: + + [general] + enabled = yes + port = 5038 + bindaddr = 0.0.0.0 + + [myasterisk] + secret=mycode + read=system,call,log,verbose,command,agent,user + write=system,call,log,verbose,command,agent,user + + +2.5. Step 6: Install The AGI components +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Copy or create a symbolic link of the entire content of the AGI directory into asterisk agi-bin directory:: - - mkdir /usr/local/src/a2billing + mkdir /usr/share/asterisk/agi-bin + chown asterisk:asterisk /usr/share/asterisk/agi-bin - Unpack the code +Option 1:: - Download the code from the SVN repository run: - - svn co --username guest --password guest http://svn.a2billing.net/svn/asterisk2billing/tags/1-current /usr/local/src/a2billing/ + cd /usr/local/src/a2billing/AGI + cp a2billing.php /usr/share/asterisk/agi-bin/ + cp a2billing-monitoring.php /usr/share/asterisk/agi-bin/ + cp -Rf ../common/lib /usr/share/asterisk/agi-bin/ - At the end of this step you should have a a2billing tree structure that should look like: - - /usr/local/src/a2billing/ +Option 2:: - Files : - - AGI - - CHANGELOG - - COPYING - - CallBack - - Cronjobs : Recurrent services run via crontab - - DataBase : Database Schema / DB Installation - - FEATURES_LIST - - a2billing.conf : Main Configuration file - - addons : Sounds and other addons - - admin : Admin UI - - agent : Agent UI - - customer : Customer UI - - webservice + ln -s /usr/local/src/a2billing/AGI/a2billing.php /usr/share/asterisk/agi-bin/a2billing.php + ln -s /usr/local/src/a2billing/AGI/lib /usr/share/asterisk/agi-bin/lib +Make sure the scripts are executable:: - 2.2. Step 2: Prepare the Database + chmod +x /usr/share/asterisk/agi-bin/a2billing.php - We will now create a MySQL database (mya2billing) for the billing software. The file a2billing-createdb-user.sql includes a script that creates the database with the correct access control users and permissions. +(if you are going to run the monitoring AGI script):: - - cd /usr/local/src/a2billing + chmod +x /usr/share/asterisk/agi-bin/a2billing_monitoring.php - - mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql - The script with create a database, username and password with the following default values - - Database name is: mya2billing - - Database user is: a2billinguser - - User password is: a2billing +2.6. Step 5: Install web-based Graphical interfaces +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - After creating the database structure, we will create a set of tables and insert some initial basic configuration data - - cd DataBase/mysql-5.x/ - - ./install-db.sh +In this step, we will install the three graphical interfaces of A2Billing: +the Administration (admin), Agent (agent) and Customer (customer) interface. +As in previous steps you can copy the folders of make symbolic links. - **Checkpoint 1 :** Check that the database (my2billing) and that (97) tables have been created. - - mysql -u root -p mya2billing - - mysql>show tables - - mysql>exit +Place the directories "admin" and "customer" into your webserver document root. +Create a2billing folder in your web root folder:: - 2.3. Step 3: Edit the a2billing.conf configuration file + mkdir /var/www/a2billing + chown www-data:www-data /var/www/a2billing - The A2Billing configuration file (a2billing.conf) contains the basic information to connect to the a2billing database. Copy or make a symbolic link from - /usr/local/src/a2billing/a2billing.conf to /etc/a2billing.conf +Create folder directory for monitoring Scripts:: - a2billing.conf -> /usr/local/src/a2billing/a2billing.conf + mkdir -p /var/lib/a2billing/script - Option 1 - - cp /usr/local/src/a2billing/a2billing.conf /etc/ +Create folder directory for Cronts PID:: - Option 2 - - ln -s /usr/local/src/a2billing/a2billing.conf /etc/a2billing.conf + mkdir -p /var/run/a2billing - Open the file with your favorite text editor (vi is used in this example). If you are new to Linux, we recommend you to use the text editor Gedit. - - vi /etc/a2billing.conf +Option 1:: - The only parameters that you need to change here is the database connection information, an example follows: - [database] - hostname = localhost - port = 3306 - user = a2billinguser - password = a2billing - dbname = mya2billing - dbtype = mysql + cp -rf /usr/local/src/a2billing/admin /var/www/a2billing + cp -rf /usr/local/src/a2billing/agent /var/www/a2billing + cp -rf /usr/local/src/a2billing/customer /var/www/a2billing + cp -rf /usr/local/src/a2billing/common /var/www/a2billing +Option 2:: - 2.4. Step 4: Fix permissions, files and folders + ln -s /usr/local/src/a2billing/admin /var/www/a2billing/admin + ln -s /usr/local/src/a2billing/agent /var/www/a2billing/agent + ln -s /usr/local/src/a2billing/customer /var/www/a2billing/customer + ln -s /usr/local/src/a2billing/common /var/www/a2billing/common - In this step, we will tweak the file permissions of Asterisk to fit the A2Billing software. We will also create a number of additional files and folders that A2Billing - needs, which does not come with the default installation. +Fix the permissions of the templates_c folder in each of the UI:: - 2.4.1. SIP and IAX + chmod 755 /usr/local/src/a2billing/admin/templates_c + chmod 755 /usr/local/src/a2billing/customer/templates_c + chmod 755 /usr/local/src/a2billing/agent/templates_c + chown -Rf www-data:www-data /usr/local/src/a2billing/admin/templates_c + chown -Rf www-data:www-data /usr/local/src/a2billing/customer/templates_c + chown -Rf www-data:www-data /usr/local/src/a2billing/agent/templates_c - First we will set a few file permissions (chmod, chown) and create (touch) the SIP and IAX configuration files for Asterisk. - chmod 777 /etc/asterisk - touch /etc/asterisk/additional_a2billing_iax.conf - touch /etc/asterisk/additional_a2billing_sip.conf - echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip.conf - echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf - chown -Rf www-data /etc/asterisk/additional_a2billing_iax.conf - chown -Rf www-data /etc/asterisk/additional_a2billing_sip.conf - 2.4.2. Sound files +Checkpoint 2: Direct a browser to the administrative web interface (http:///a2billing/admin) and login as administrator. Default passwords are: + - user: root + - pass: changepassword - Run the sounds installation script available in the addons folder (IMPORTANT: the script assumes that asterisk sounds are under /usr/share/asterisk/sounds/) - - /usr/local/src/a2billing/addons/install_a2b_sounds_deb.sh - - chown -R asterisk:asterisk /usr/share/asterisk/sounds/ - 2.4.3. Configure Asterisk Manager +2.7. Step 7: Create a dialplan for A2Billing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Configure the Asterisk Manager by editing the manager.conf file. - - vi /etc/asterisk/manager.conf +The extensions.conf is the Asterisk dialplan. Calls that interact with the billing software need to be handled inside of one or many A2Billing related contexts. - Notice that we are using the default values (myasterisk, mycode) in this section. The configuration should look like this - [general] - enabled = yes - port = 5038 - bindaddr = 0.0.0.0 +The calls that reach the context are processed using the a2billing.php AGI script. The a2billing.php script can be invoked in many different modes (standard, did,voucher, callback, etc). In the example, we create two different contexts, the first context [a2billing] handles all the calls from our VoIP clients. When a call arrives, any extension number _X. (2 digits or more) reaches the script a2billing.php - [myasterisk] - secret=mycode - read=system,call,log,verbose,command,agent,user - write=system,call,log,verbose,command,agent,user +The second context [did], will be used to route inward calls back to the users. Calls to the clients (DID) are handled inside of the [did] context. The script a2billing.php in did mode is responsible of routing the call back to one of our users. +Edit extension.conf:: - 2.5. Step 6: Install The AGI components + vi /etc/asterisk/extensions.conf - Copy or create a symbolic link of the entire content of the AGI directory into asterisk agi-bin directory. - - mkdir /usr/share/asterisk/agi-bin - - chown asterisk:asterisk /usr/share/asterisk/agi-bin +and the following contexts:: - Option 1 - - cd /usr/local/src/a2billing/AGI - - cp a2billing.php /usr/share/asterisk/agi-bin/ - - cp a2billing-monitoring.php /usr/share/asterisk/agi-bin/ - - cp -Rf lib /usr/share/asterisk/agi-bin/ + [a2billing] + include => a2billing_callingcard + include => a2billing_monitoring + include => a2billing_voucher - Option 2 - - ln -s /usr/local/src/a2billing/AGI/a2billing.php /usr/share/asterisk/agi-bin/a2billing.php - - ln -s /usr/local/src/a2billing/AGI/lib /usr/share/asterisk/agi-bin/lib + [a2billing_callingcard] + ; CallingCard application + exten => _X.,1,NoOp(A2Billing Start) + exten => _X.,n,DeadAgi(a2billing.php|1) + exten => _X.,n,Hangup - Make sure the scripts are executable - - chmod +x /usr/share/asterisk/agi-bin/a2billing.php - (if you are going to run the monitoring AGI script) - - chmod +x /usr/share/asterisk/agi-bin/a2billing_monitoring.php + [a2billing_voucher] + exten => _X.,1,Answer(1) + exten => _X.,n,DeadAgi(a2billing.php|1|voucher) + ;exten => _X.,n,AGI(a2billing.php|1|voucher44) ; will add 44 in front of the callerID for the CID authentication + exten => _X.,n,Hangup + [a2billing_did] + exten => _X.,1,DeadAgi(a2billing.php|1|did) + exten => _X.,2,Hangup - 2.6. Step 5: Install web-based Graphical interfaces +Note that newer versions of Asterisk use a comma (,) instead of a pipe (|) to separate the AGI arguments. - In this step, we will install the three graphical interfaces of A2Billing: the Administration (admin), Agent (agent) and Customer (customer) interface. As in previous - steps you can copy the folders of make symbolic links. - Place the directories "admin" and "customer" into your webserver document root. +2.8. Step 8: Configure recurring services +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Create a2billing folder in your web root folder - - mkdir /var/www/a2billing - - chown www-data:www-data /var/www/a2billing +Recurring services are handled via the /etc/crontab - Create folder directory for monitoring Scripts - - mkdir -p /var/lib/a2billing/script +You can add the following cron jobs to your /etc/crontab or create a file with +the jobs in /var/spool/cron/a2billing - Create folder directory for Cronts PID - - mkdir -p /var/run/a2billing +- update the currency table:: - Option 1 - - cp -rf /usr/local/src/a2billing/admin /var/www/a2billing - - cp -rf /usr/local/src/a2billing/agent /var/www/a2billing - - cp -rf /usr/local/src/a2billing/customer /var/www/a2billing - - cp -rf /usr/local/src/a2billing/common /var/www/a2billing + 0 6 * * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php - Option 2 - - ln -s /usr/local/src/a2billing/admin /var/www/a2billing/admin - - ln -s /usr/local/src/a2billing/agent /var/www/a2billing/agent - - ln -s /usr/local/src/a2billing/customer /var/www/a2billing/customer - - ln -s /usr/local/src/a2billing/common /var/www/a2billing/common +- manage the monthly services subscription:: - Fix the permissions of the templates_c folder in each of the UI - - chmod 755 /usr/local/src/a2billing/admin/templates_c - - chmod 755 /usr/local/src/a2billing/customer/templates_c - - chmod 755 /usr/local/src/a2billing/agent/templates_c - - chown -Rf www-data:www-data /usr/local/src/a2billing/admin/templates_c - - chown -Rf www-data:www-data /usr/local/src/a2billing/customer/templates_c - - chown -Rf www-data:www-data /usr/local/src/a2billing/agent/templates_c + 0 6 1 * * php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php +- To check account of each Users and send an email if the balance is less than the user have choice:: - Checkpoint 2: Direct a browser to the administrative web interface (http:///a2billing/admin) and login as administrator. Default passwords are: - user: root - pass: changepassword + 0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php - 2.7. Step 7: Create a dialplan for A2Billing +- This script will browse all the DID that are reserve and check if the customer + need to pay for it bill them or warn them per email to know if they want to pay + in order to keep their DIDs:: - The extensions.conf is the Asterisk dialplan. Calls that interact with the billing software need to be handled inside of one or many A2Billing related contexts. + 0 2 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php - The calls that reach the context are processed using the a2billing.php AGI script. The a2billing.php script can be invoked in many different modes (standard, did,voucher, callback, etc). In the example, we create two different contexts, the first context [a2billing] handles all the calls from our VoIP clients. When a call arrives, any extension number _X. (2 digits or more) reaches the script a2billing.php +- This script will take care of the recurring service. :: - The second context [did], will be used to route inward calls back to the users. Calls to the clients (DID) are handled inside of the [did] context. The script a2billing.php in did mode is responsible of routing the call back to one of our users. + 0 12 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php - Edit extension.conf - - vi /etc/asterisk/extensions.conf +- Generate Invoices at 6am everyday:: - and the following contexts + 0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php - | [a2billing] - | include => a2billing_callingcard - | include => a2billing_monitoring - | include => a2billing_voucher +- to proceed the autodialer:: - | [a2billing_callingcard] - | ; CallingCard application - | exten => _X.,1,NoOp(A2Billing Start) - | exten => _X.,n,DeadAgi(a2billing.php|1) - | exten => _X.,n,Hangup + * / 5 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_autodialer.php - | [a2billing_voucher] - | exten => _X.,1,Answer(1) - | exten => _X.,n,DeadAgi(a2billing.php|1|voucher) - | ;exten => _X.,n,AGI(a2billing.php|1|voucher|44) ; will add 44 in front of the callerID for the CID authentication - | exten => _X.,n,Hangup +- manage alarms:: - | [a2billing_did] - | exten => _X.,1,DeadAgi(a2billing.php|1|did) - | exten => _X.,2,Hangup + 0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php - 2.8. Step 8: Configure recurring services +2.9. Step 9: Call back daemon (only for Call backs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Recurring services are handled via the /etc/crontab +The call back daemon is responsible of reading from the database the pool of +calls stored for call back and trigger those calls periodically. - You can add the following cron jobs to your /etc/crontab or create a file with the jobs in /var/spool/cron/a2billing +The daemon is written in Python. Install the python-setuptools and use +easy_install to install the callback_daemon:: - - update the currency table - 0 6 * * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php + apt-get install python-setuptools python-mysqldb python-psycopg2 python-sqlalchemy + cd /usr/local/src/a2billing/CallBack + easy_install callback-daemon-py/dist/callback_daemon-1.0.prod_r1527-py2.5.egg - - manage the monthly services subscription - 0 6 1 * * php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php +Install the init.d startup script:: - - To check account of each Users and send an email if the balance is less than the user have choice. - 0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php + cd /usr/local/src/a2billing/CallBack/callback-daemon-py/callback_daemon/ - - this script will browse all the DID that are reserve and check if the customer need to pay for it bill them or warn them per email to know if they want to pay in order to keep their DIDs - 0 2 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php +For Debian:: - - This script will take care of the recurring service. - 0 12 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php + cp a2b-callback-daemon.debian /etc/init.d/a2b-callback-daemon - - Generate Invoices at 6am everyday - 0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php +For RedHat:: - - to proceed the autodialer - * / 5 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_autodialer.php + cp a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon + chmod +x /etc/init.d/a2b-callback-daemon - - manage alarms - 0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php +Make sure the daemon starts, +For Debian:: - 2.9. Step 9: Call back daemon (only for Call backs) + update-rc.d a2b-callback-daemon defaults 40 60 - The call back daemon is responsible of reading from the database the pool of calls stored for call back and trigger those calls periodically. +If you need to remove the daemon in the future run:: - The daemon is written in Python. Install the python-setuptools and use easy_install to install the callback_daemon - - apt-get install python-setuptools python-mysqldb python-psycopg2 python-sqlalchemy - - cd /usr/local/src/a2billing/CallBack - - easy_install callback-daemon-py/dist/callback_daemon-1.0.prod_r1527-py2.5.egg + update-rc.d -f a2b-callback-daemon remove - Install the init.d startup script - - cd /usr/local/src/a2billing/CallBack/callback-daemon-py/callback_daemon/ +For RedHat:: - For Debian : - - cp a2b-callback-daemon.debian /etc/init.d/a2b-callback-daemon + chkconfig --add a2b-callback-daemon + service a2b-callback-daemon start + chkconfig a2b-callback-daemon on - For RedHat : - - cp a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon - - chmod +x /etc/init.d/a2b-callback-daemon - Make sure the daemon starts - For Debian : - - update-rc.d a2b-callback-daemon defaults 40 60 +2.10. Step 10: Enable IVR monitoring +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - If you need to remove the daemon in the future run - - update-rc.d -f a2b-callback-daemon remove - For RedHat : - - chkconfig --add a2b-callback-daemon - - service a2b-callback-daemon start - - chkconfig a2b-callback-daemon on +General system monitoring via IVR is available from version 1.7, the new AGI +a2billing_monitoring.php provides access to an IVR where monitoring tasks can be +configured via the new Monitoring Menu under Maintenance. +SQL queries can be performed and shell scripts can be invoked. +Place your scripts under /var/lib/a2billing/script/ - 2.10. Step 10: Enable Monitoring - General system monitoring via IVR is available from version 1.7, the new AGI - a2billing_monitoring.php provides access to an IVR where monitoring tasks can be - configured via the new Monitoring Menu under Maintenance. +2.11. Step 11: Security features via IVR (Monitor account and locking calling card) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SQL queries can be performed and shell scripts can be invoked. - Place your scripts under /var/lib/a2billing/script/ +Two new IVR menus are now available via the main a2billing.php AGI. The menus +needs to be enabled setting the variables in the agi-conf menu (GUI system settings) - 2.11. Step 11: Security features via IVR (Monitor account and locking calling card) +Locking Options IVR menu:: - Two new IVR menus are now available via the main a2billing.php AGI. The menus - needs to be enabled setting the variables in the agi-conf menu (GUI system settings) + ivr_enable_locking_option = true (default: false) - Locking Options IVR menu - ivr_enable_locking_option = true (default: false) +Monitoring your Calling Card IVR menu:: - Monitoring your Calling Card IVR menu - ivr_enable_account_information = true (default: false) + ivr_enable_account_information = true (default: false) 3. Support ---------- - Star2Billing S.L. offers consultancy including installation, training and customisation +Star2Billing S.L. offers consultancy including installation, training and customisation - Please email us at sales@star2billing.com for more information +Please email us at sales@star2billing.com for more information. diff --git a/README.rst b/README.rst index 8bc3bdb7e..c90dfe1d6 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,9 @@ services, consultancy and support is available. see http://www.star2billing.com/ for more details +.. image:: https://github.com/Star2Billing/a2billing/raw/master/a2billing_dashboard.png + + Info ---- @@ -20,7 +23,7 @@ Info http://forum.asterisk2billing.org/ * Wiki version of installation - - http://www.asterisk2billing.org/documentation/ + http://www.asterisk2billing.org/documentation/ * Latest development version https://github.com/Star2Billing/a2billing @@ -29,10 +32,17 @@ Info https://github.com/Star2Billing/a2billing/issues +License +------- + +Copyright (c) 2004-2015 Star2Billing S.L. + +A2Billing is licensed under AGPL: http://www.gnu.org/licenses/agpl.html + + Support ------- Star2Billing S.L. offers consultancy including installation, training and customisation Please email us at sales@star2billing.com for more information - diff --git a/REQUIREMENTS.rst b/REQUIREMENTS.rst index 7d4d9a38c..9c73ea01c 100644 --- a/REQUIREMENTS.rst +++ b/REQUIREMENTS.rst @@ -2,29 +2,30 @@ REQUIREMENTS ------------ - - Apache 2 +- Apache2 - - Asterisk 1.2 >= +- Asterisk >= version 1.2 - - MySQL 5.x or PostgreSQL 8.x +- MySQL 5.x - - PHP 5 >= 5.2.0 +- PHP >= version 5.3.0 - - PHP MODULES : - * PHP-PGSQL or PHP-MYSQLi - * PHP-MCRYPT - * PHP_POSIX - * PHP-GD - * PHP-PCNTL - * PHP-GETTEXT - * PHP-SQLITE (only if you use the module to pool CDR) - * PHP PEAR SOAP +- PHP MODULES : + * PHP-PGSQL or PHP-MYSQLi + * PHP-MCRYPT + * PHP-XML + * PHP_POSIX + * PHP-GD + * PHP-PCNTL + * PHP-GETTEXT + * PHP-SQLITE (only if you use the module to pool CDR) + * PHP PEAR SOAP - - CallBack Module, Python requirements : - * python >= 2.4 - * python-mysqldb - * python-psycopg2 - * python-sqlalchemy +- CallBack Module, Python requirements : + * python >= version 2.6 + * python-mysqldb + * python-psycopg2 + * python-sqlalchemy - - Monitoring IVR Module - * Cepstral Text to speech (http://www.cepstral.com) +- Monitoring IVR Module + * Cepstral Text to speech (http://www.cepstral.com) diff --git a/a2billing.conf b/a2billing.conf index 7f77b21ab..02fe25ca1 100755 --- a/a2billing.conf +++ b/a2billing.conf @@ -37,18 +37,18 @@ keys=consoleHandler,FileHandler,RotatingFileHandler keys=callbackFormatter [logger_root] -level=INFO +level=DEBUG handlers=consoleHandler,RotatingFileHandler [logger_callbackLogger] -level=INFO +level=DEBUG handlers=consoleHandler,RotatingFileHandler qualname=callbackLogger propagate=0 [handler_consoleHandler] class=StreamHandler -level=INFO +level=DEBUG formatter=callbackFormatter args=(sys.stdout,) diff --git a/a2billing_dashboard.png b/a2billing_dashboard.png new file mode 100755 index 000000000..457d59376 Binary files /dev/null and b/a2billing_dashboard.png differ diff --git a/addons/Doc/Database/a2b_database_description.txt b/addons/Doc/Database/a2b_database_description.txt index 6a5aceea3..349a0a859 100644 --- a/addons/Doc/Database/a2b_database_description.txt +++ b/addons/Doc/Database/a2b_database_description.txt @@ -1,38 +1,38 @@ - >> A2Billing Database Description + >> A2Billing Database Description ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`` -1) cc_agent This table contains detail information of agent who have access to the agent interface. +1) cc_agent This table contains detail information of agent who have access to the agent interface. Info like personal detail,account detail, bank detail,active status etc. 2) cc_agent_commission This table contains the information about commission of agent like commission percentage, type, amount etc. -3) cc_agent_signup This table contains the information about agent sign-up key which can be used to relate customer and +3) cc_agent_signup This table contains the information about agent sign-up key which can be used to relate customer and also their group id,tariff group id available. 4) cc_agent_tariffgroup This table contains the information about tariff group (call-plan) in which agent is belong to. -5) cc_alarm This table contains the information about alarms which can monitor the calls rates,trunks,durations, status etc. +5) cc_alarm This table contains the information about alarms which can monitor the calls rates,trunks,durations, status etc. and able to create these alarms on daily, weekly, and monthly basis. 6) cc_alarm_report This table contains reporting information of created alarm. -7) cc_autorefill_report This table keeps information about the auto refill cront performed, used for reporting. +7) cc_autorefill_report This table keeps information about the auto refill cront performed, used for reporting. -8) cc_backup This table contains backup detail to backup an existing database context. Path define where backup files are stored. +8) cc_backup This table contains backup detail to backup an existing database context. Path define where backup files are stored. 9) cc_billing_customer This table contains detail of created bill against customer with invoice id,start date. It allows you to see all billing generated by the batch for the customers, or also to run a billing manually for a specific customer. -10) cc_call This table contains records of the made calls. This is a CDR (Call Detail Record) which contains +10) cc_call This table contains records of the made calls. This is a CDR (Call Detail Record) which contains trunk id,customer id,rate card,cost,start-stop time,session id,call destination,tariff detail etc. 11) cc_callback_spool This table contains functionality to handle the callback service. Different parameters like server ip,server group, channel,call-back time,number of attempt,agi result,caller id etc we need to set. -12) cc_callerid This table contains caller id number and its status of customer through which the customer calling in is authenticated on the basis of the callerID rather than with the account number. +12) cc_callerid This table contains caller id number and its status of customer through which the customer calling in is authenticated on the basis of the callerID rather than with the account number. 13) cc_callplan_lcr This table contains list of Call Plans & Call plan will regroup a collection of ratecards and define a routing rules on them (LCR/LCD). @@ -48,7 +48,7 @@ 19) cc_campaign_phonestatus This table contains list of all the phone numbers attached to a campaign which includes phone number,status, callback id. -20) cc_card This table contains detail information of customers/accounts. +20) cc_card This table contains detail information of customers/accounts. Table stores the info personal detail, account detail, company detail,call plan, credit remaining etc. 21) cc_cardgroup_service This table define the link between Service and Customer Group @@ -67,10 +67,10 @@ 28) cc_charge This table contains charges for setup,services etc. Charges will appear to the customer with & each charge that you create for a customer will decrement from his account. -29) cc_config This table contains different A2Billing settings which includes config key, value,group etc. +29) cc_config This table contains different A2Billing settings which includes config key, value,group etc. -30) cc_configuration This table contains epayment method configuration. - It used to enable or disable the payment method, define the currency settings etc. +30) cc_configuration This table contains epayment method configuration. + It used to enable or disable the payment method, define the currency settings etc. 31) cc_config_group This table contains list of all configuration groups. @@ -132,7 +132,7 @@ 60) cc_payments Keep trace of the customer's payment -61) cc_payments_agent Keep trace of the agent's payment +61) cc_payments_agent Keep trace of the agent's payment 62) cc_payments_status This table contains list of different payment status (failed,paid,in-progress,completed). @@ -155,12 +155,12 @@ 71) cc_receipt_item This table contains list of receipt history against a customers with date,price,description. 72) cc_remittance_request This is used from the Agent UI to require for a payment of their commission - + 73) cc_restricted_phonenumber This table contains list of restricted phonenumber through which customer can't make call. -74) cc_server_group This table contains list of server groups which define the set of servers that are going to be used by the callback system. A callback is bound to a server group which will be used to dispatch the callback requests. +74) cc_server_group This table contains list of server groups which define the set of servers that are going to be used by the callback system. A callback is bound to a server group which will be used to dispatch the callback requests. -75) cc_server_manager This table contains list of servers are used by the callback system through the asterisk manager in order to initiate the callback and outbound calls for your customers.AGI and callback modes need to be installed on those machines. +75) cc_server_manager This table contains list of servers are used by the callback system through the asterisk manager in order to initiate the callback and outbound calls for your customers.AGI and callback modes need to be installed on those machines. 76) cc_service This table contains list of services which can be a scheduled action on the account.For example if we want to remove 10 cents everyday on each single customer account @@ -168,7 +168,7 @@ 78) cc_sip_buddies This table contains configuration info of each SIP client which is identified by a number of parameters. -79) cc_sip_buddies_empty This table is used when Asterisk is used with OpenSIPs. +79) cc_sip_buddies_empty This table is used when Asterisk is used with OpenSIPs/Kamailio. 80) cc_speeddial This table contains list of speed dials numbers for the customer. @@ -198,7 +198,7 @@ 93) cc_timezone This table contains detail for all the Timezone which includes zone,gmt-time,gmt-offset. -94) cc_trunk This table contains list of trunks which are used to terminate the call.Trunk and ratecard is selected by the rating engine on the basis of the dialed digits. The trunk is used to dial out from asterisk box which can be a zaptel interface or a voip provider. +94) cc_trunk This table contains list of trunks which are used to terminate the call.Trunk and ratecard is selected by the rating engine on the basis of the dialed digits. The trunk is used to dial out from asterisk box which can be a zaptel interface or a voip provider. 95) cc_ui_authen This table contains list of all the Administrators who have access to the Administrator interface. diff --git a/addons/Doc/Resources/a2billing-customer-list.png b/addons/Doc/Resources/a2billing-customer-list.png new file mode 100644 index 000000000..249732f2f Binary files /dev/null and b/addons/Doc/Resources/a2billing-customer-list.png differ diff --git a/addons/apache2/a2billing_admin.conf b/addons/apache2/a2billing_admin.conf new file mode 100644 index 000000000..83e866da0 --- /dev/null +++ b/addons/apache2/a2billing_admin.conf @@ -0,0 +1,21 @@ +Alias /a2b_admin /usr/share/a2billing/latest/admin/ + + + + DirectoryIndex index.php + + Options +FollowSymLinks + AllowOverride None + + #order deny,allow + #deny from all + #allow from 127.0.0.0/255.0.0.0 ::1/128 + allow from all + + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + diff --git a/addons/apache2/a2billing_agent.conf b/addons/apache2/a2billing_agent.conf new file mode 100644 index 000000000..762be5f4a --- /dev/null +++ b/addons/apache2/a2billing_agent.conf @@ -0,0 +1,21 @@ +Alias /a2b_agent /usr/share/a2billing/latest/agent/ + + + + DirectoryIndex index.php + + Options +FollowSymLinks + AllowOverride None + + #order deny,allow + #deny from all + #allow from 127.0.0.0/255.0.0.0 ::1/128 + allow from all + + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + diff --git a/addons/apache2/a2billing_customer.conf b/addons/apache2/a2billing_customer.conf new file mode 100644 index 000000000..e43e097f4 --- /dev/null +++ b/addons/apache2/a2billing_customer.conf @@ -0,0 +1,21 @@ +Alias /customer /usr/share/a2billing/latest/customer/ + + + + DirectoryIndex index.php + + Options +FollowSymLinks + AllowOverride None + + #order deny,allow + #deny from all + #allow from 127.0.0.0/255.0.0.0 ::1/128 + allow from all + + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + diff --git a/addons/apache2/a2billing_index.conf b/addons/apache2/a2billing_index.conf new file mode 100644 index 000000000..9255da734 --- /dev/null +++ b/addons/apache2/a2billing_index.conf @@ -0,0 +1,21 @@ +Alias /a2b /usr/share/a2billing/index/ + + + + DirectoryIndex index.php index.html + + Options +FollowSymLinks + AllowOverride None + + #order deny,allow + #deny from all + #allow from 127.0.0.0/255.0.0.0 ::1/128 + allow from all + + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + diff --git a/addons/apache2/a2billing_webservice.conf b/addons/apache2/a2billing_webservice.conf new file mode 100644 index 000000000..98aee8af6 --- /dev/null +++ b/addons/apache2/a2billing_webservice.conf @@ -0,0 +1,16 @@ +Alias /a2b_webservice /usr/share/a2billing/latest/webservice/ + + + + AllowOverride all + Options Indexes FollowSymLinks + order allow,deny + allow from all + + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + diff --git a/addons/asterisk-conf/extensions_a2billing.conf b/addons/asterisk-conf/extensions_a2billing.conf index b61bf9de8..3b8e2ad6e 100755 --- a/addons/asterisk-conf/extensions_a2billing.conf +++ b/addons/asterisk-conf/extensions_a2billing.conf @@ -29,17 +29,17 @@ exten => _X.,1,DeadAgi(a2billing.php|1|cid-prompt-callback|34) ;last parameter i exten => _X.,n,Hangup ; Inbound callback scenario -; it will just callback the person after this callback context rang +; it will just callback the person after this callback context rang [a2billing-all-callback] exten => _X.,1,DeadAgi(a2billing.php|1|all-callback|34) ;last parameter is the callback area code -exten => _X.,n,Hangup +exten => _X.,n,Hangup ; !!! note : the 34 number is used for international callback, let s say that my server is in UK but that my DID is in Spain -; The system will need to know that it have to add up 34 to callback this person +; The system will need to know that it have to add up 34 to callback this person [a2billing-predictivedialer] -exten => _X.,1,DeadAgi(a2billing.php|1|predictivedialer) +exten => _X.,1,DeadAgi(a2billing.php|1|predictivedialer) exten => _X.,n,Hangup @@ -62,7 +62,7 @@ exten => h,1,Hangup exten => _X.,1,Answer() exten => _X.,n,NoOp(Start Conference) ;exten => _X.,n(record),Set(MEETME_RECORDINGFILE=/var/spool/asterisk/meetme/conference_recording-${EPOCH}-${USER}); -;exten => _X.,n,MeetMe(${EXTEN}|rdTMc) ;Make new Room and record call. +;exten => _X.,n,MeetMe(${EXTEN}|rdTMc) ;Make new Room and record call. exten => _X.,n,MeetMe(${EXTEN}|dTMc) ;Make new Room exten => _X.,n,Hangup() @@ -71,7 +71,7 @@ exten => _X.,n,Hangup() exten => _X.,1,Answer(1) exten => _X.,n,DeadAgi(a2billing.php|1|voucher) ;exten => _X.,n,AGI(a2billing.php|1|voucher|44) ; will add 44 in front of the callerID for the CID authentication -exten => _X.,n,Hangup +exten => _X.,n,Hangup [a2billing_dispatch] @@ -91,7 +91,7 @@ exten => _X.,1,Dial(SIP/${EXTEN}@IP_SECOND_SERVER) ; Use canreinvite to not pass the media through the first box -; As fourth parameter we pass the reference ID of the Agent +; As fourth parameter we pass the reference ID of the Agent [a2billing_autocreate_example] exten => _X.,1,DeadAgi(a2billing.php|1|standard|0|%REF_AGENT%) exten => _X.,n,Hangup @@ -113,4 +113,15 @@ exten => _X.,h,Hangup exten => _X.,1,NoOp(A2Billing Echo Test Start) exten => _X.,1,Playback(demo-echotest) ; Let them know what's going on exten => _X.,2,Echo ; Do the echo test -exten => _X.,3,Playback(demo-echodone) ; Let them know it's over \ No newline at end of file +exten => _X.,3,Playback(demo-echodone) ; Let them know it's over + + +; A2Billing Set Custom Vars into CDRs cc_call Table +[a2billing-custom-var-cdr] +exten => _X.,1,NoOp(A2Billing Set Custom Var into CDRs table cc_call) +exten => _X.,n,Set(A2B_CUSTOM1=${SIP_HEADER(X-a2b-custom1)}) +exten => _X.,n,Set(A2B_CUSTOM2=${SIP_HEADER(X-a2b-custom2)}) +exten => _X.,n,Set(CDR(A2B_CUSTOM1)=${A2B_CUSTOM1}) +exten => _X.,n,Set(CDR(A2B_CUSTOM2)=${A2B_CUSTOM2}) +exten => _X.,n,DeadAgi(a2billing.php|1) +exten => _X.,h,Hangup diff --git a/addons/contrib/archives/enhancements/A2B_entity_package_group.php b/addons/contrib/archives/enhancements/A2B_entity_package_group.php index 60e4901bc..5ea8fba12 100755 --- a/addons/contrib/archives/enhancements/A2B_entity_package_group.php +++ b/addons/contrib/archives/enhancements/A2B_entity_package_group.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/openvoip.co/cdr_format.php b/addons/contrib/openvoip.co/cdr_format.php new file mode 100755 index 000000000..c951c7b08 --- /dev/null +++ b/addons/contrib/openvoip.co/cdr_format.php @@ -0,0 +1,134 @@ += 2 ? $argv[1] : ""; +if (empty($cdr_file) && isset($_REQUEST['file'])) + $cdr_file = $_REQUEST['file']; + +if (!file_exists($cdr_file)) + exit(1); + +$cdr_position_file = __DIR__ . '/.cdr_position'; +$cdr_position = intval(file_exists($cdr_position_file) ? file_get_contents($cdr_position_file) : 0); + +$file = new SplFileObject($cdr_file); +if (!$file->isReadable()) + exit(1); + +try { + $csv2 = null; + $file->seek($cdr_position); + while (!$file->eof()) { + if (empty($csv2)) { + $csv1 = get_csv(); + } else { + $csv1 = $csv2; + } + $csv2 = get_csv(); + if ($csv1 === false) + break; + + process_cdr($csv1, $csv2); + }; + + // save position for next run + $cdr_position = $file->key() - 1; + file_put_contents($cdr_position_file, ($cdr_position < 0 ? 0 : $cdr_position)); +} catch (\Exception $e) { + echo $e->getMessage(); + exit(1); +} + +function get_csv() { + global $file; + $result = false; + while (!$file->eof()) { + $line = $file->fgets(); + $csv = str_getcsv($line); + if (!is_array($csv) || count($csv) < 17) + continue; + if ($csv[7] != 'Dial') // need only Dial app cdrs + continue; + $result = $csv; + break; + } + return $result; +} + +function process_cdr($csv, $next_csv) { + if (!$csv) + return; + + // detect from + $from = ''; + if ($csv[0] == '4528339244') { + $from = '091-00'; + } elseif ($csv[0] == '0744553513') { + $from = '092-00'; + } + + // detect to, cdr format + $carrier = ''; + $to = ''; + if (preg_match('/[A-Z0-9]+\/carrier\_(\d+)\_(\d+)/', $csv[6], $matches) || preg_match('/[A-Z0-9]+\/\d+\@carrier\_(\d+)\_(\d+)/', $csv[6], $matches)) { + $carrier = $matches[1]; + $to = sprintf('%03d-%02d', $carrier, $matches[2]); + } + + // detect date + $datetime = DateTime::createFromFormat('Y-m-d H:i:s', $csv[9]); + + // detect duration + $duration = gmdate("H:i:s", $csv[13]); + + // detect answer flag + $flag = ''; + if ($csv[14] == 'ANSWERED') { + $flag = 'A'; // answer + } elseif ($next_csv && $csv[16] == $next_csv[16]) { + $flag = 'R'; // retry, next one is the result + } + + // detect dialed number + $number = sprintf('%03d', $carrier) . preg_replace('/^011/', '', $csv[2]); + + // output data + printf("%-6s %-6s %-10s %-8s %-8s %1s %-23s %-23s %-23s %s\r\n", $from, $to, $datetime->format('m-d-Y'), $datetime->format('H:i:s'), $duration, $flag, $csv[2], $number, $csv[1], $csv[16]); +} diff --git a/addons/contrib/openvoip.co/cdr_format_mysql.php b/addons/contrib/openvoip.co/cdr_format_mysql.php new file mode 100755 index 000000000..de49104ae --- /dev/null +++ b/addons/contrib/openvoip.co/cdr_format_mysql.php @@ -0,0 +1,448 @@ +args = self::parse_args(); + $this->params_ini = self::parse_ini_config(); + $this->init_db(); + $this->params_a2b = $this->parse_a2b_config(); + + $this->cdr_db = $this->get_arg('cdr_db', 'asteriskcdrdb'); + $this->cdr_table = $this->get_arg('cdr_table', 'cdr'); + $this->cdr_batch = intval($this->get_arg('cdr_batch', 10000)); + $this->active_channels = $this->get_active_channels(); + $this->cdr_id_column = $this->get_arg('cdr_id_column', 'id'); + $this->cdr_processed_column = $this->get_arg('cdr_processed_column', 'processed'); + + // add dynamic columns + $this->columns[] = $this->cdr_id_column; + $this->columns[] = $this->cdr_processed_column; + } + + public function run() { + if ($this->has_arg('h') || $this->has_arg('help')) { // help + self::print_ln( + 'Usage: php cdr_format_mysql.php [options]', + 'Options are:', + '-h or --help - show this help', + '--test - test only, no real actions, just output to console', + '--cdr_db - CDR database name, default "asteriskcdrdb"', + '--cdr_table - CDR table name, default "cdr"', + '--cdr_batch - CDR parsing batch limit, default 10000', + '--cdr_id_column - CDR db table ID column, must be "bigint UNSIGNED NOT NULL Auto_increment"', + '--cdr_processed_column - CDR db table column that is used to mark processed cdrs, must "int(1) UNSIGNED DEFAULT 0 NULL"', + '--asterisk_hosts - comma separated list of all asterisk hosts in cluster, like "host1,192.168.0.2"' + ); + return; + } + + if ($this->is_test()) { + self::print_ln('>>> TEST RUN <<<'); + self::print_ln(self::DEL); + self::print_ln('Passed arguments:'); + self::print_ln($this->args); + self::print_ln(self::DEL); + self::print_ln('INI params:'); + self::print_ln($this->params_ini); + } + + // process cdrs + $cdrs = $this->get_cdrs(); + $cdr_ids = array(); + for ($i = 0; $i < count($cdrs); ++$i) { + $cdr = $cdrs[$i]; + $cdr_ids[] = $cdr[$this->cdr_id_column]; + + // we need to parse only following + if (!in_array($cdr['lastapp'], array('Dial', 'ResetCDR'))) + continue; + + if ($this->is_test()) + self::print_ln(self::DEL, 'Processing cdr #' . $i . ':', $cdr); + + // detect from + $from = ''; + if ($cdr['accountcode'] == '4528339244') { + $from = '091-00'; + } elseif ($cdr['accountcode'] == '0744553513') { + $from = '092-00'; + } + + // detect to, cdr format + $carrier = ''; + $to = ''; + if (preg_match('/[A-Z0-9]+\/carrier\_(\d+)\_(\d+)/', $cdr['dstchannel'], $matches) || preg_match('/[A-Z0-9]+\/\d+\@carrier\_(\d+)\_(\d+)/', $cdr['dstchannel'], $matches)) { + $carrier = $matches[1]; + $to = sprintf('%03d-%02d', $carrier, $matches[2]); + } + + // detect date + $datetime = \DateTime::createFromFormat('Y-m-d H:i:s', $cdr['calldate']); + + // detect duration + $duration = gmdate("H:i:s", $cdr['billsec']); + + // detect answer flag + $flag = ''; + if ($cdr['disposition'] == 'ANSWERED') { // answer + $flag = 'A'; + } elseif ($this->is_retry($cdrs, $i)) { // retry + $flag = 'R'; + } + + // detect dialed number + $number = sprintf('%03d', $carrier) . preg_replace('/^011/', '', $cdr['dst']); + + // output data + if ($this->is_test()) + self::print_ln(self::DEL, 'OUTPUT cdr #' . $i . ':'); + + printf("%-6s %-6s %-10s %-8s %-8s %1s %-23s %-23s %-23s %s\r\n", $from, $to, $datetime->format('m-d-Y'), $datetime->format('H:i:s'), $duration, $flag, $cdr['dst'], $number, $cdr['src'], $cdr['uniqueid']); + } + + // set marker + $this->mark_cdrs_processed($cdr_ids); + } + + protected function is_retry($cdrs, $i) { + $result = false; + $current_cdr = $cdrs[$i]; + + // all cdrs is cdrs + active calls + static $all_cdrs = null; + if (!$all_cdrs) + $all_cdrs = array_merge($cdrs, $this->active_channels); + + // prepare time limit + $until_time = \DateTime::createFromFormat('Y-m-d H:i:s', $current_cdr['calldate']); + $until_time->add(new DateInterval('PT' . self::MAX_CALL_DURATION . 'S')); + + // check if we have a retry in the following CDRs and active calls + // we go forward on self::MAX_CALL_DURATION seconds only! + $j = $i + 1; + for ($j; $j < count($all_cdrs); $j++) { + $cdr = $all_cdrs[$j]; + if ($current_cdr['channel'] === $cdr['channel'] && $current_cdr['dst'] === $cdr['dst']) { + $result = true; + break; + } + $cdr_time = \DateTime::createFromFormat('Y-m-d H:i:s', $cdr['calldate']); + if ($cdr_time > $until_time) + break; + } + + if ($this->is_test()) + self::print_ln( + self::DEL, + 'RETRY RESULT: ' . ($result ? 'TRUE' : 'FALSE'), + 'Checked cdr(s): ' . ($j - $i) + ); + + return $result; + } + + protected function get_cdrs() { + $columns = implode(', ', $this->columns); + $sql = "select $columns from {$this->cdr_db}.{$this->cdr_table} + where {$this->cdr_processed_column} = 0 order by calldate asc limit {$this->cdr_batch}"; + + if ($this->is_test()) + self::print_ln(self::DEL, 'CDRs SQL:', $sql); + + $cdrs = $this->query($sql); + + if ($this->is_test()) + self::print_ln(self::DEL, 'CDRs count: ' . count($cdrs)); + + return $cdrs; + } + + protected function mark_cdrs_processed($cdr_ids) { + if (!is_array($cdr_ids) || !count($cdr_ids)) + return; + + $cdrs_chunks = array_chunk($cdr_ids, 500); + foreach ($cdrs_chunks as $cdr_ids) { + $cdr_ids_sql = join(', ', $cdr_ids); + $sql = "update {$this->cdr_db}.{$this->cdr_table} + set {$this->cdr_processed_column} = 1 + where {$this->cdr_id_column} in ($cdr_ids_sql)"; + + if ($this->is_test()) { + self::print_ln(self::DEL, 'CDRs mark SQL: ' . $sql); + } else { + $this->query($sql); + } + } + } + + protected function get_a2b_param($key, $default_value = null) { + return self::_get_param($this->params_a2b, $key, $default_value); + } + + protected function get_ini_param($key, $default_value = null) { + return self::_get_param($this->params_ini, $key, $default_value); + } + + protected static function _get_param($data, $key, $default_value = null) { + $keys = explode('.', $key); + if (!is_array($keys)) + $keys = array($key); + + // get param + $value = $data; + foreach ($keys as $key) { + $value = isset($value[$key]) ? $value[$key] : $default_value; + } + + return $value; + } + + protected function escape($value) { + return $this->mysqli ? $this->mysqli->real_escape_string($value) : $value; + } + + protected function init_db() { + // connecting to DB + if (strcasecmp($this->get_ini_param('database.dbtype', ''), 'mysql') != 0) + throw new \RuntimeException('Supports only mysql database'); + + $host = $this->get_ini_param('database.hostname', '127.0.0.1'); + $user = $this->get_ini_param('database.user', 'root'); + $pass = $this->get_ini_param('database.password', ''); + $db = $this->get_ini_param('database.dbname', 'a2billing'); + $mysqli = new mysqli($host, $user, $pass, $db); + + if ($mysqli->connect_error) + throw new \RuntimeException('Mysql connection error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); + + $this->mysqli = $mysqli; + $this->mysqli->set_charset("utf8"); + } + + public function query($sql) { + $data = array(); + if (is_object($result = $this->mysqli->query($sql))) { + while ($row = $result->fetch_assoc()) + $data[] = $row; + $result->free(); + } + return $data; + } + + protected function is_test() { + return $this->has_arg('test'); + } + + protected function has_arg($name) { + return array_key_exists($name, $this->args); + } + + protected function get_arg($name, $default_value = null) { + return $this->has_arg($name) ? $this->args[$name] : $default_value; + } + + protected static function parse_args() { + $shortargs = 'h'; + $longargs = array( + 'help', + 'test', + 'cdr_db:', + 'cdr_table:', + 'cdr_processed_column:', + 'cdr_id_column:', + 'cdr_batch:', + 'asterisk_hosts:' + ); + return getopt($shortargs, $longargs); + } + + protected function parse_a2b_config() { + $result = []; + $sql = "select * from cc_config"; + $data = $this->query($sql); + foreach ($data as $row) { + $group = $row['config_group_title']; + if (!isset($result[$group])) + $result[$group] = array(); + $result[$group][$row['config_key']] = $row['config_value']; + } + return $result; + } + + protected static function parse_ini_config() { + return file_exists(self::A2B_CONFIG) ? parse_ini_file(self::A2B_CONFIG, true) : array(); + } + + protected static function _print_ln($value, $block_name = null) { + if (!empty($block_name) && !is_numeric($block_name)) + echo '[' . $block_name . ']' . PHP_EOL; + foreach ($value as $name => $arg) { + if (is_array($arg)) { + self::_print_ln($arg, $name); + } else { + echo (!is_numeric($name) ? $name . ': ' : '') . $arg . PHP_EOL; + } + } + } + + protected static function print_ln() { + self::_print_ln(func_get_args()); + } + + protected function get_active_channels() { + $result = array(); + $asm = new AGI_AsteriskManager(); + $hosts = $this->get_arg('asterisk_hosts', $this->get_a2b_param('global.manager_host', '127.0.0.1')); + $hosts = explode(',', $hosts); + $username = $this->get_a2b_param('global.manager_username', ''); + $secret = $this->get_a2b_param('global.manager_secret', ''); + + if (!is_array($hosts) || !count($hosts)) { + if ($this->is_test()) + self::print_ln('No asterisk hosts found!'); + + return $result; + } + + // search calls on all hosts + foreach ($hosts as $host) { + if (!$asm->connect($host, $username, $secret)) { + if ($this->is_test()) + self::print_ln('Cannot connect to asterisk host "' . $host . '"!'); + continue; + } + + $response = $asm->send_request('COMMAND', array( + 'command' => 'core show channels concise', + 'actionid' => md5(rand()) + )); + + if (empty($response['data'])) { + if ($this->is_test()) + self::print_ln('Got no response from asterisk: ' . $host); + + continue; + } + + if ($this->is_test()) + self::print_ln('Got asterisk response:', $response['data']); + + $lines = preg_split('/\r\n|\n/', $response['data']); + if (!is_array($lines)) { + if ($this->is_test()) + self::print_ln('Cannot parse lines: ', $lines); + + continue; + } + + foreach ($lines as $line) { + if (strpos($line, '!')) { + $parts = explode('!', $line); + if (!is_array($parts) || count($parts) < 3) + continue; + + // we need channel and number + $result[] = array( + 'calldate' => date('Y-m-d H:i:s'), + 'channel' => $parts[0], + 'dst' => $parts[2] + ); + } + } + + $asm->disconnect(); + } + + if ($this->is_test()) + self::print_ln(self::DEL, 'ACTIVE CHANNELS COUNT: ' . count($result)); + + return $result; + } +} + +// run app +try { + $parser = new CdrParser(); + $parser->run(); + exit(0); +} catch (\Exception $err) { + error_log($err->getMessage()); + exit(1); +} diff --git a/addons/contrib/openvoip.co/cdr_upload.sh b/addons/contrib/openvoip.co/cdr_upload.sh new file mode 100755 index 000000000..6e5910d81 --- /dev/null +++ b/addons/contrib/openvoip.co/cdr_upload.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +SCRIPT_NAME=$(basename "$0") +SCRIPT_DIR=$(cd $(dirname $0) ; pwd -P); + +lock() { + exec 200>/var/lock/$SCRIPT_NAME + flock -n 200 +} + +if ! lock; then + exit 1; +fi + +# run parser and redirect output to NMS server +php $SCRIPT_DIR/cdr_format_mysql.php $@ | ssh cdranalyst@nms "cat >> /home/cdranalyst/cdrs/A$(date +%m%d%Y).txt" diff --git a/addons/contrib/openvoip.co/test.csv b/addons/contrib/openvoip.co/test.csv new file mode 100644 index 000000000..43afff656 --- /dev/null +++ b/addons/contrib/openvoip.co/test.csv @@ -0,0 +1,7 @@ +"4528339244","17186173500","01113474604646","a2billing","17186173500","SIP/4528339244-00000018","SIP/carrier_34_2-0000001a","Dial","1","2016-09-07 20:01:50",,"2016-09-07 20:01:55",5,0,"CHANUNAVAIL","BILLING","A2B03-1473278510.32","13474604646" +"4528339244","17186173500","01113474604646","a2billing","17186173500","SIP/4528339244-00000018","SIP/carrier_35_1-0000001a","Dial","1","2016-09-07 20:01:56",,"2016-09-07 20:06:56",500,300,"ANSWERED","BILLING","A2B03-1473278510.32","13474604646" +"4528339244","17186173500","5082159142","a2billing","17186173500","SIP/4528339244-00000036","OOH323/carrier_14_1-8","Hangup","42","2016-10-04 01:09:17",,"2016-10-04 01:09:21",4,0,"FAILED","BILLING","A2B03-1475543357.62","5082159142" +"4528339244","17186173500","150821591423","a2billing","17186173500","SIP/4528339244-00000037","OOH323/carrier_14_1-9","Dial","OOH323/25830#150821591423@carrier_14_1,30,L(5400000:61000:30000)","2016-10-04 01:09:46","2016-10-04 01:10:00","2016-10-04 01:10:07",21,7,"ANSWERED","BILLING","A2B03-1475543386.64","150821591423" +"4528339244","17186173500","15082159142","a2billing","17186173500","SIP/4528339244-00000039","SIP/carrier_30_1-0000003a","Dial","SIP/78816#15082159142@carrier_30_1,30,L(5400000:61000:30000)","2016-10-04 01:19:08","2016-10-04 01:19:17","2016-10-04 01:19:25",17,8,"ANSWERED","BILLING","A2B03-1475543948.67","15082159142" +"4528339244","17186173500","13474604646","a2billing","17186173500","SIP/4528339244-0000003b","SIP/carrier_30_1-0000003e","Dial","SIP/78816#13474604646@carrier_30_1,30,L(5400000:61000:30000)","2016-10-04 01:21:48",,"2016-10-04 01:21:59",11,0,"NO ANSWER","BILLING","A2B03-1475544108.69","13474604646" +"4528339244","17186173500","15082159142","a2billing","17186173500","SIP/4528339244-0000003f","SIP/carrier_30_1-00000040","Dial","SIP/78816#15082159142@carrier_30_1,30,L(5400000:61000:30000)","2016-10-04 01:28:12","2016-10-04 01:28:28","2016-10-04 01:28:38",26,10,"ANSWERED","BILLING","A2B03-1475544492.73","15082159142" diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_card_info__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_card_info__vt.php index fd3a127ba..bcdf4fee4 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_card_info__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_card_info__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_card__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_card__vt.php index 0d64007ab..f364114c0 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_card__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_card__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -150,17 +150,15 @@ if ($popup_select) { ?> * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_did__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_did__vt.php index 521c80b74..b8c03fd9f 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_did__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_did__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_monitor__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_monitor__vt.php index b15a039a4..65b576fb3 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_monitor__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_monitor__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_password__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_password__vt.php index fb2b8ebae..67097de14 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_password__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_password__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_voucher__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_voucher__vt.php index ffb43e26a..5be4bb00f 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_voucher__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_entity_voucher__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/A2B_notification__vt.php b/addons/contrib/villagetelco/gui/admin/Public/A2B_notification__vt.php index 6076286e1..e78b79ab5 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/A2B_notification__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/A2B_notification__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/PP_error__vt.php b/addons/contrib/villagetelco/gui/admin/Public/PP_error__vt.php index 4537eba0b..943a2f67f 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/PP_error__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/PP_error__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/PP_intro__vt.php b/addons/contrib/villagetelco/gui/admin/Public/PP_intro__vt.php index a8c9e80ab..675053386 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/PP_intro__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/PP_intro__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/call-last-month__vt.php b/addons/contrib/villagetelco/gui/admin/Public/call-last-month__vt.php index a4b644f74..80fc95449 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/call-last-month__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/call-last-month__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/call-log-customers__vt.php b/addons/contrib/villagetelco/gui/admin/Public/call-log-customers__vt.php index 6a605bb79..4320a5883 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/call-log-customers__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/call-log-customers__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/dashboard__vt.php b/addons/contrib/villagetelco/gui/admin/Public/dashboard__vt.php index daab64160..bf384f9f0 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/dashboard__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/dashboard__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_card__vt.inc b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_card__vt.inc index e01a3f4c6..c299c5623 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_card__vt.inc +++ b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_card__vt.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -38,7 +38,7 @@ getpost_ifset(array('id', 'username', 'useralias', 'uipass', 'credit', 'language 'lastname', 'firstname', 'email', 'address','city', 'state', 'country', 'zipcode', 'phone', 'fax', 'inuse', 'cid', 'runservice', 'firstusedate','expirationdate', 'enableexpire', 'expiredays', 'sip_buddy', 'iax_buddy','popup_select', 'vat', 'autorefill', 'initialbalance', 'mac_addr', 'cardnumberlenght_list', -'status', 'block', 'lock_pin', 'template_invoice', 'template_outstanding', 'description', 'voicemail_activated', +'status', 'block', 'lock_pin', 'template_invoice', 'template_outstanding', 'description', 'voicemail_activated', 'voicemail_permitted','email_notification','credit_notification','notify_email', 'id_seria', 'company_name' , 'company_website' , 'vat_rn' , 'traffic' , 'traffic_target','discount','restriction' )); @@ -64,15 +64,15 @@ if (DELETE_FK_CARD) { } if (!($popup_select>=1)) { - if (VT_MODE) { + if (VT_MODE) { $HD_Form ->FG_LIST_ADDING_BUTTON1 = false; -} else { +} else { $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; } $HD_Form ->FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_card_multi__vt.php?stitle=Card§ion=".$_SESSION["menu_section"]; $HD_Form ->FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Generate Customers"); $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/user_multi_add.png" ; - if (VT_MODE) { + if (VT_MODE) { $HD_Form ->FG_LIST_ADDING_BUTTON2 = false; } else { $HD_Form ->FG_LIST_ADDING_BUTTON2 = true; @@ -123,7 +123,7 @@ foreach ($show_list_temp as $i => $value) { if (!($pos===false)) { $temp_ar=preg_split('/:/',$a); $b=$temp_ar[1]; - $a=strtolower(trim($temp_ar[0])); + $a=strtolower(trim($temp_ar[0])); if (strlen($a)>1) { $show_list_sizes[$a]=$b; } @@ -136,7 +136,7 @@ $show_fields=array(); $show_fields['id']=array(gettext("ID"), "id", "3%", "center", "sort","", "", "", "", "", "", ""); $show_fields['username']=array(gettext("Account Number"), "username", "14%", "center", "sort", "", "30", "", "", "", "", "linktocustomer"); -if (!($popup_select>=1)) +if (!($popup_select>=1)) $show_fields['useralias']=array("".gettext("LOGIN")."", "useralias", "12%", "center", "sort","", "", "", "", "", "", ""); $show_fields['lastname']=array(gettext("LASTNAME"), "lastname", "7%", "center", "sort", "20","", "", "", "", "", ""); @@ -166,7 +166,7 @@ if (!($popup_select>=1)) { foreach ($show_list_temp as $i => $value) { $show_list[$value]=$value; } - + $FG_COL_QUERY='DISTINCT '; } $FG_COL_QUERY_FIELD=''; @@ -218,7 +218,7 @@ if (!($popup_select>=1)) $HD_Form -> FG_EXPORT_CSV = true; if (!($popup_select>=1)) { - if (VT_MODE) { + if (VT_MODE) { $HD_Form -> FG_EXPORT_XML = false; } else { $HD_Form -> FG_EXPORT_XML = true; @@ -270,7 +270,7 @@ if (($popup_select>=1)) { //This disables the select botton in the CDR if (VT_MODE){ $HD_Form -> FG_OTHER_BUTTON1 = true; - } else { + } else { $HD_Form -> FG_OTHER_BUTTON1 = true; } $HD_Form -> FG_OTHER_BUTTON1_ALT = '<select>'; @@ -284,7 +284,7 @@ if (($popup_select>=1)) { } else { $HD_Form -> FG_INFO = true; - if (VT_MODE){ + if (VT_MODE){ $HD_Form -> FG_OTHER_BUTTON1 = false; $HD_Form -> FG_OTHER_BUTTON2 = false; $HD_Form -> FG_OTHER_BUTTON3 = false; @@ -334,7 +334,7 @@ $HD_Form -> FG_ADDITION = true; if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { - if (VT_MODE) { + if (VT_MODE) { $HD_Form -> FG_EDITION = true; } else { $HD_Form -> FG_EDITION = false; @@ -347,11 +347,11 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { } - + $maxi = ''; $maxi2 = ''; $maxi3 = ''; - + if (isset($form_action) && $form_action=="ask-add") { if (!is_numeric($cardnumberlenght_list)) $cardnumberlenght_list = LEN_CARDNUMBER; $array_card_generated = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list); @@ -361,7 +361,7 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { $maxi3 = "value='".$pass."'"; $default_initbalance = "value='0'"; } - + $HD_Form -> AddEditElement (gettext("ACCOUNT NUMBER"), "username", "", @@ -370,8 +370,8 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { "4", gettext("Insert the account number"), "" , "", "", "", "" , "", "", '', null, null, gettext("Customer Information")); - - + + $HD_Form -> AddEditElement (gettext("VOIP LOGIN"), "useralias", "", @@ -380,8 +380,8 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { "4", gettext("Insert the webui login"), "" , "", "", "", "" , "", "", ""); - - + + $HD_Form -> AddEditElement (gettext("VOIP PASSWORD"), "uipass", '', @@ -390,16 +390,16 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { "", gettext("Insert the password"), "" , "", "", "", "", "", "", gettext("Password for customer to register with the VoIP gateway") ); - + if ($form_action =="ask-add" || $form_action=="add") { $balance_access = "value = '0'"; $payment_status = ""; - + } else { $balance_access = 'readonly'; $payment_status= 'disabled="true" style="color: gray;" '; } - + $HD_Form -> AddEditElement (gettext("BALANCE"), "credit", "", @@ -408,7 +408,7 @@ if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { "12", gettext("Insert the number of credit"), "" , "", "", "", "", "", "", gettext("currency : ").strtoupper(BASE_CURRENCY) ); - + if (!VT_MODE) { $HD_Form -> AddEditElement (gettext("CUSTOMER GROUP"), "id_group", @@ -429,7 +429,7 @@ if (!VT_MODE) { "cc_card_seria", "name, id", "", "", "%1", "", "", "", '' ); -} +} $HD_Form -> AddEditElement (gettext("LAST NAME"), "lastname", '$value', @@ -438,7 +438,7 @@ if (!VT_MODE) { "11", gettext("Insert the lastname of the customers"), "" , "", "", "", "", "" , "NO", "", null, null, gettext("Personal Information")); - + $HD_Form -> AddEditElement (gettext("FIRST NAME"), "firstname", '$value', @@ -447,8 +447,8 @@ if (!VT_MODE) { "11", gettext("Insert the firstname of the customers"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("EMAIL"), "email", '$value', @@ -457,8 +457,8 @@ if (!VT_MODE) { "1", gettext("Insert the email"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("ADDRESS"), "address", '$value', @@ -467,8 +467,8 @@ if (!VT_MODE) { "0", gettext("Insert the address of the customers"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("CITY"), "city", '$value', @@ -477,8 +477,8 @@ if (!VT_MODE) { "0", gettext("Insert the city"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("STATE/PROVINCE"), "state", '$value', @@ -487,11 +487,11 @@ if (!VT_MODE) { "11", gettext("Insert the state"), "" , "", "", "", "", "" , "NO", ""); - + if ($form_action == 'ask-add') { $country_default_val = 'USA'; } - + $HD_Form -> AddEditElement (gettext("COUNTRY"), "country", "$country_default_val", @@ -501,7 +501,7 @@ if (!VT_MODE) { "cc_country", "countryname, countrycode", "", "", "%1", "", "", "", '' ); - + $HD_Form -> AddEditElement (gettext("ZIP/POSTAL CODE"), "zipcode", '$value', @@ -510,8 +510,8 @@ if (!VT_MODE) { "0", gettext("Insert the zipcode"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("PHONE NUMBER"), "phone", '$value', @@ -520,8 +520,8 @@ if (!VT_MODE) { "7", gettext("Insert the phone number of the customers"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("FAX NUMBER"), "fax", '$value', @@ -530,7 +530,7 @@ if (!VT_MODE) { "", gettext("Insert the fax number of the customers"), "" , "", "", "", "", "" , "NO", ""); - + $HD_Form -> AddEditElement (gettext("COMPANY NAME"), "company_name", '$value', @@ -539,8 +539,8 @@ if (!VT_MODE) { "", gettext("Insert Company name of this customer"), "" , "", "", "", "", "" , "NO", ""); - - + + $HD_Form -> AddEditElement (gettext("COMPANY WEBSITE"), "company_website", '$value', @@ -549,11 +549,11 @@ if (!VT_MODE) { "", gettext("Insert the company website of this customer"), "" , "", "", "", "", "" , "NO", ""); - + if ($form_action != "edit") { - + $update_field_typepaid = 'typepaid ,'; - + $HD_Form -> AddEditElement (gettext("PAYMENT TYPE"), "typepaid", "", @@ -563,7 +563,7 @@ if (!VT_MODE) { "", "list" , "", "", "", $typepaid_list, "%1", "", '', null, null, gettext("Customer Status") ); } -if (!VT_MODE) { +if (!VT_MODE) { $HD_Form -> AddEditElement (gettext("CALL PLAN"), "tariff", "", @@ -573,7 +573,7 @@ if (!VT_MODE) { "cc_tariffgroup", "tariffgroupname, id", "", "", "%1", "", gettext("Changing the call plan will result in the free minutes or free calls package being reset.") ); - + $HD_Form -> AddEditElement (gettext("DIDGROUP"), "id_didgroup", "", @@ -583,7 +583,7 @@ if (!VT_MODE) { "cc_didgroup", "didgroupname, id", "", "", "%1", "", "", "", '' ); - + $timezone_list = get_timezones(); $one_select = false; foreach ($timezone_list as $key => $cur_value) { @@ -595,16 +595,16 @@ if (!VT_MODE) { } } } - + $HD_Form -> AddEditElement (gettext("TIMEZONE"), "id_timezone", "$timezone_default_val", "SELECT", "","","", "list" , "", "", "", $timezone_list, "%1", "", "" ); - + } - + $HD_Form -> AddEditElement (gettext("LANGUAGE"), "language", "", @@ -613,7 +613,7 @@ if (!VT_MODE) { "", "", "list" , "", "", "", $language_list, "%1", "", "" ); - + $HD_Form -> AddEditElement (gettext("CURRENCY"), "currency", @@ -621,9 +621,9 @@ if (!VT_MODE) { "SELECT", "", "", "", "list" , "", "", "", $currency_list, "%1", "", gettext("Currency used at the customer end.") ); - - - + + + $HD_Form -> AddEditElement (gettext("STATUS"), "status", "", @@ -664,8 +664,8 @@ if (!VT_MODE) { "", "", "list" , "", "", "", $simultaccess_list, "%1", "", "" ); - -if (!VT_MODE) { + +if (!VT_MODE) { $HD_Form -> AddEditElement (gettext("RUN SERVICE"), "runservice", '0', @@ -674,7 +674,7 @@ if (!VT_MODE) { "", gettext("Choose if you want to enable the service recurring on this account"), "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Apply recurring service to this account.")); - + $HD_Form -> AddEditElement (gettext("CREDIT LIMIT"), "creditlimit", "", @@ -683,9 +683,9 @@ if (!VT_MODE) { "4", gettext("Insert the credit limit"), "" , "", "", "", "", "", "NO-NULL", gettext("Credit limit is only used for the postpaid account.")); - - - + + + $HD_Form -> AddEditElement (gettext("CREDIT LIMIT NOTIFICATION"), "credit_notification", '', @@ -693,11 +693,11 @@ if (!VT_MODE) { "", "", "", - "list" , "", "", "", $limits_notify_list , "%1", "", - gettext("currency : ").strtoupper(BASE_CURRENCY).'
'.gettext("Low credit limit to alert the customer"), + "list" , "", "", "", $limits_notify_list , "%1", "", + gettext("currency : ").strtoupper(BASE_CURRENCY).'
'.gettext("Low credit limit to alert the customer"), "", ''); - - + + $HD_Form -> AddEditElement (gettext("PERMITTED NOTIFICATIONS BY MAIL"), "notify_email", '0', @@ -706,8 +706,8 @@ if (!VT_MODE) { "", gettext("Choose if you want to enable the notification by email for this account"), "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the notification by mail for this account.")); - - + + $HD_Form -> AddEditElement (gettext("EMAIL NOTIFICATION"), "email_notification", '$value', @@ -716,8 +716,8 @@ if (!VT_MODE) { "1", gettext("Insert the email to notify this customer"), "" , "", "", "", "", "" , "NO", ""); - - if (ACT_VOICEMAIL) { + + if (ACT_VOICEMAIL) { $HD_Form -> AddEditElement (gettext("PERMITTED VOICEMAIL"), "voicemail_permitted", '1', @@ -726,7 +726,7 @@ if (!VT_MODE) { "", gettext("Choose if you want to enable the voicemail functionality for this account"), "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the voicemail functionality for this account.")); - + $HD_Form -> AddEditElement (gettext("ACTIVE VOICEMAIL SERVICE"), "voicemail_activated", '0', @@ -736,7 +736,7 @@ if (!VT_MODE) { gettext("Customer can choose to enable the voicemail for this account"), "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Customer can enable the voicemail for this account.")); } - + $HD_Form -> AddEditElement (gettext("CAMPAIGN"), "id_campaign", "", @@ -746,9 +746,9 @@ if (!VT_MODE) { "cc_campaign", "name, id", "", "", "%1", "", "", "", '' ); -//END OF VT_MODE IF CLAUSE -} - +//END OF VT_MODE IF CLAUSE +} + $HD_Form -> AddEditElement (gettext("FIRST USE DATE"), "firstusedate", "", @@ -757,8 +757,8 @@ if (!VT_MODE) { "", "the first use date", "" , "" , "", "", "", "", "NO-NULL", "", "", "res_display_dateformat"); - - + + $HD_Form -> AddEditElement (gettext("ENABLE EXPIRY"), "enableexpire", "", @@ -767,18 +767,18 @@ if (!VT_MODE) { "", "", "list" , "", "", "", $expire_list, "%1", "", gettext("Select method of expiry for the account.") ); - - + + $comp_zero = $comp_date_plus=''; if (isset($form_action) && $form_action=="ask-add"){ $begin_date = date("Y"); - $begin_date_plus = date("Y")+10; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; $comp_zero = "value='0'"; } - + $HD_Form -> AddEditElement (gettext("EXPIRY DATE"), "expirationdate", '$value', @@ -787,9 +787,9 @@ if (!VT_MODE) { "10", gettext("Insert the expiration date"), "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); - - - + + + $HD_Form -> AddEditElement (gettext("EXPIRY DAYS"), "expiredays", "", @@ -798,8 +798,8 @@ if (!VT_MODE) { "4", gettext("Insert the number of days after which the account will expire"), "" , "", "", "", "", "", "", gettext("The number of days after which the account will expire.")); -if (!VT_MODE) { - +if (!VT_MODE) { + $HD_Form -> AddEditElement (gettext("CREATE SIP CONFIG"), "sip_buddy", '1', @@ -808,8 +808,8 @@ if (!VT_MODE) { "", gettext("Choose if you want to enable the sip account"), "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Create the SIP config automatically")); - - + + $HD_Form -> AddEditElement (gettext("CREATE IAX CONFIG"), "iax_buddy", '1', @@ -828,8 +828,8 @@ if (!VT_MODE) { "", gettext("Insert the MAC address customers' device"), "" , "", "", "", "", "" , "NO", gettext("FORMAT: 00-08-74-4C-7F-1D")); - - + + $HD_Form -> AddEditElement (gettext("IN USE"), "inuse", '$value', @@ -838,7 +838,7 @@ if (!VT_MODE) { "", "", "" , "", "", "", "", "", "NO", gettext("Updated to show the number of concurrent calls in use by this customer. If there are no currently no calls, and the system shows that there are, manually reset this field back to zero.") ); -if (!VT_DEMO) { +if (!VT_DEMO) { $HD_Form -> AddEditElement (gettext("AUTOREFILL"), "autorefill", '0', @@ -848,7 +848,7 @@ if (!VT_DEMO) { gettext("Choose if you want to enable the autorefill on this account"), "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Define if you want to authorize the autorefill to apply on this accout"), '', '', gettext("AUTOREFILL")); - + $HD_Form -> AddEditElement (gettext("INITIAL BALANCE"), "initialbalance", "", @@ -857,9 +857,9 @@ if (!VT_DEMO) { "12", gettext("Insert the amount of the initial balance"), "" , "", "", "", "", "", "", gettext("The initial balance is used by autorefill to reset the current balance to this amount")); - - - + + + $HD_Form -> AddEditElement (gettext("INVOICE DAY"), "invoiceday", '$value', @@ -867,15 +867,15 @@ if (!VT_DEMO) { "", "", "", - "list" , "", "", "", $invoiceday_list, "%1", "", gettext("Define the day of the month when the system will generate the customer invoice."), + "list" , "", "", "", $invoiceday_list, "%1", "", gettext("Define the day of the month when the system will generate the customer invoice."), '', '', gettext("Invoice Status")); -} - +} + if ($form_action =="ask-add" || $form_action=="add") { $vat_init = "value = '0'"; - + } -if (!VT_DEMO) { +if (!VT_DEMO) { $HD_Form -> AddEditElement (gettext("VAT"), "vat", "", @@ -884,8 +884,8 @@ if (!VT_DEMO) { "12", gettext("Insert the VAT"), "" , "", "", "", "", "", "" , gettext("VAT to add on the invoice of this customer. it should be a decimal value '21' this will be for 21% of VAT!")); - - + + $HD_Form -> AddEditElement (gettext("VAT REGISTRATION NUMBER "), "vat_rn", '$value', @@ -893,9 +893,9 @@ if (!VT_DEMO) { "size=40 maxlength=40", "", gettext("Insert the VAT registration number of this customer"), - "" , "", "", "", "", "" , "NO", ""); - - + "" , "", "", "", "", "" , "NO", ""); + + $HD_Form -> AddEditElement (gettext("DISCOUNT"), "discount", "", @@ -903,9 +903,9 @@ if (!VT_DEMO) { "", "", "", - "list" , "", "", "", $discount_list, "%1", "", ""); - - + "list" , "", "", "", $discount_list, "%1", "", ""); + + $HD_Form -> AddEditElement (gettext("TRAFFIC PER MONTH"), "traffic", '$value', @@ -914,8 +914,8 @@ if (!VT_DEMO) { "4", gettext("Insert the traffic per month for this customer"), "" , "", "", "", "", "" , "NO", "", - '', '', gettext("TARGET TRAFFIC")); - + '', '', gettext("TARGET TRAFFIC")); + $HD_Form -> AddEditElement (gettext("TARGET TRAFFIC"), "traffic_target", '', @@ -924,8 +924,8 @@ if (!VT_DEMO) { "", gettext("Insert the target traffic description"), "" , "", "", "", "" , "", "", ""); - - + + $HD_Form -> AddEditElement (gettext("RESTRICTION"), "restriction", "0", @@ -934,8 +934,8 @@ if (!VT_DEMO) { "", "", "list" , "", "", "", $restriction_list, "%1", "", "", - '', '', gettext("RESTRICTED NUMBERS")); - + '', '', gettext("RESTRICTED NUMBERS")); + $HD_Form -> AddEditElement (gettext("RESTRICTED NUMBERS"), "restrictednumber", '$value', @@ -947,8 +947,8 @@ if (!VT_DEMO) { "", "", "", "", "", "", "", "cc_restricted_phonenumber:number:number, id_card:id_card = %id::id_card:::::::0"); - - + + $HD_Form -> AddEditElement (gettext("CALLERID"), "callerid", '$value', @@ -961,12 +961,12 @@ if (!VT_DEMO) { "", "", "", "", "", "", "cc_callerid:cid:cid, cid, id_cc_card:id_cc_card = %id::id_cc_card:::::::0", '', gettext("CALLERID / CUSTOMER HISTORY")); - - - - -} - + + + + +} + $HD_Form -> AddEditElement (gettext("CUSTOMER HISTORY"), "description", '$value', @@ -978,7 +978,7 @@ if (!VT_DEMO) { "", "", "", "", "", "", "", "cc_card_history:description:description,id_cc_card,datecreated:id_cc_card = %id::id_cc_card::2:::::0"); - + // cc_card_history:description:description,id_cc_card:id_cc_card = %id::id_cc_card // Above function will provid Has Many functionality // Each parameter is seperated by (:) notation @@ -988,12 +988,12 @@ if (!VT_DEMO) { // 3. Third will get all the columns (but first should be joining column) // 4. Fourth param generates the where cluase // 5. Last, Sixth param is the FK column - + $add_fields_voicemail = ''; if (ACT_VOICEMAIL) $add_fields_voicemail = 'voicemail_permitted, voicemail_activated, '; - -/* THIS FORM IS EVIL! + +/* THIS FORM IS EVIL! $HD_Form -> FieldEditElement ('username, useralias, uipass, credit, id_group, id_seria, lastname, firstname, email, '. @@ -1008,59 +1008,59 @@ if (!VT_DEMO) { ' address, city, state, country, zipcode, phone, fax, company_name, company_website, '. $update_field_typepaid.' language, currency, status, block, lock_pin, simultaccess, ' . ' firstusedate, enableexpire, expirationdate, expiredays, mac_addr, inuse' ); - - - if(!isset($myusername)) + + + if(!isset($myusername)) $myusername=''; - + if ($form_action == "ask-edit") { $table_card = new Table("cc_card","status"); $result_card = $table_card ->Get_list(DbConnect(),"id=$id"); $HD_Form -> FG_EDITION_HIDDEN_PARAM = "oldstatus"; $HD_Form -> FG_EDITION_HIDDEN_PARAM_VALUE = "".$result_card[0][0]; } - - + + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your")." ".$HD_Form->FG_INSTANCE_NAME; $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
".gettext("Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."
"; - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on Confirm Data"); - + $HD_Form -> FG_ADDITIONAL_FUNCTION_BEFORE_EDITION = 'change_card_lock'; - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'processing_card_add'; $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_EDITION = 'create_status_log'; - + if (isset($form_action) && $form_action=='delete' && USE_REALTIME) { $card_table = new Table('cc_card','sip_buddy,iax_buddy'); $card_clause = "id = ".$id; $card_result = $card_table -> Get_list(DbConnect(), $card_clause, 0); $sip_buddy = $card_result[0]['sip_buddy']; $iax_buddy = $card_result[0]['iax_buddy']; - if(($sip_buddy == 1) && ($iax_buddy == 1)) + if(($sip_buddy == 1) && ($iax_buddy == 1)) $key = "sip_iax_changed"; - elseif (($sip_buddy == 1) ) + elseif (($sip_buddy == 1) ) $key = "sip_changed"; - elseif ($iax_buddy == 1) + elseif ($iax_buddy == 1) $key = "iax_changed"; - + if ($_SESSION["user_type"]=="ADMIN") { $who= Notification::$ADMIN;$who_id=$_SESSION['admin_id']; } elseif ($_SESSION["user_type"]=="AGENT") { $who= Notification::$AGENT;$who_id=$_SESSION['agent_id']; - } else { + } else { $who=Notification::$UNKNOWN;$who_id=-1; } NotificationsDAO::AddNotification($key,Notification::$HIGH,$who,$who_id); } - + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; diff --git a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_def_ratecard__vt.inc b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_def_ratecard__vt.inc index 706564c05..d79829164 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_def_ratecard__vt.inc +++ b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_def_ratecard__vt.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -37,7 +37,7 @@ getpost_ifset(array('id', 'idtariffplan', 'dialprefix', 'destination', 'buyrate' 'buyrateincrement', 'rateinitial', 'initblock', 'billingblock', 'connectcharge', 'disconnectcharge','disconnectcharge_after', 'stepchargea', 'chargea', 'timechargea', 'billingblocka', 'stepchargeb', 'chargeb', 'timechargeb', 'billingblockb', 'stepchargec', 'chargec', 'timechargec', 'billingblockc', 'startdate', 'stopdate', -'starttime', 'endtime', 'id_trunk', 'musiconhold','tariffplan', 'tariffgroup','posted','id_outbound_cidgroup','rounding_calltime', +'starttime', 'endtime', 'id_trunk', 'musiconhold','tariffplan', 'tariffgroup','posted','id_outbound_cidgroup','rounding_calltime', 'rounding_threshold', 'additional_block_charge', 'additional_block_charge_time', 'additional_grace','minimal_cost','announce_time_correction', 'cancelsearch_callplanlcr', 'deleteselected')); @@ -50,7 +50,7 @@ if ( (empty($form_action) || $form_action=="list") && $deleteselected != 'true') $HD_Form = new FormHandler("cc_ratecard", "Rates"); } -$HD_Form -> FG_TABLE_ID = 'cc_ratecard.id'; +$HD_Form -> FG_TABLE_ID = 'cc_ratecard.id'; if ($cancelsearch_callplanlcr) { $_SESSION['def_ratecard_tariffgroup'] = ''; @@ -60,38 +60,38 @@ $rateinitial_field = "rateinitial"; $use_lcr_callplan = false; if (isset($posted) && !$popup_select) { - + if (is_string ($tariffgroup) && strlen(trim($tariffgroup))>0) { - + $HD_Form = new FormHandler("cc_callplan_lcr", "Rates"); $HD_Form -> FG_TABLE_ID = 'id'; $use_lcr_callplan = true; $HD_Form -> SQL_GROUP = " GROUP BY dialprefix "; - + $tariffgroup = explode('-:-',$tariffgroup); $HD_Form->FG_TOP_FILTER_NAME = gettext("EXPORTED LCR CALL PLAN").' : '.str_replace ("-:-","",$tariffgroup[1]).''; $HD_Form->FG_TOP_FILTER_VALUE2 = $tariffgroup[0]; - + $HD_Form -> FG_TABLE_CLAUSE = "tariffgroup_id= '$HD_Form->FG_TOP_FILTER_VALUE2'"; - + $rateinitial_field = "MIN(rateinitial) as rateinitial"; - + $_SESSION['def_ratecard_tariffgroup'] = $HD_Form -> FG_TABLE_CLAUSE; - + } else { - $_SESSION['def_ratecard_tariffgroup'] = ''; + $_SESSION['def_ratecard_tariffgroup'] = ''; } } else { if (!empty($_SESSION['def_ratecard_tariffgroup']) && (empty($form_action) || $form_action=="list")) { - + $HD_Form = new FormHandler("cc_callplan_lcr", "Rates"); $HD_Form -> FG_TABLE_ID = 'id'; $use_lcr_callplan = true; $HD_Form -> SQL_GROUP = " GROUP BY dialprefix "; - + $HD_Form -> FG_TABLE_CLAUSE = $_SESSION['def_ratecard_tariffgroup']; $rateinitial_field = "MIN(rateinitial) as rateinitial"; - + } } @@ -102,11 +102,11 @@ $HD_Form -> FG_TABLE_DEFAULT_SENS = "ASC"; $HD_Form->FG_FILTER_SEARCH_SESSION_NAME = 'entity_ratecard_selection'; if (!$popup_select) { - if (VT_MODE) - { - $HD_Form ->FG_LIST_ADDING_BUTTON1 = false; + if (VT_MODE) + { + $HD_Form ->FG_LIST_ADDING_BUTTON1 = false; } else { - $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; + $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; } $HD_Form ->FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_def_ratecard.php?form_action=ask-add&atmenu=ratecard§ion=".$_SESSION["menu_section"]; $HD_Form ->FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Add Rate"); @@ -117,7 +117,7 @@ if (!$popup_select) { $musiconhold_list = Constants::getMusicOnHold_List(); $yesno = Constants::getYesNoList(); -// +// if ($popup_select) $HD_Form -> AddViewElement(gettext("ID"), "id", "5%", "center", "sort"); $HD_Form -> AddViewElement(gettext("DESTINATION"), "destination", "17%", "center", "", "15"); $HD_Form -> AddViewElement("".gettext("PREFIX")."", "dialprefix", "10%", "center", "sort", ""); @@ -150,7 +150,7 @@ if ($popup_select) { $HD_Form -> FG_OTHER_BUTTON1 = true; $HD_Form -> FG_OTHER_BUTTON1_ALT = '<select>'; $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; - + if ($popup_select == 1) $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|param|');"; elseif ($popup_select == 2) @@ -163,7 +163,7 @@ if ($popup_select) { $HD_Form -> FG_EXPORT_XML = true; } $HD_Form -> FG_EXPORT_SESSION_VAR = "pr_export_entity_rates"; - if (VT_MODE) { + if (VT_MODE) { $HD_Form -> FG_EDITION = false; $HD_Form -> FG_DELETION = false; $HD_Form -> FG_ADDITION = false; @@ -171,13 +171,13 @@ if ($popup_select) { $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; - } + } } if (VT_MODE) { $HD_Form -> CV_NO_FIELDS = ''; -} else { -$HD_Form -> CV_NO_FIELDS = gettext("NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("HAVE BEEN CREATED."); +} else { +$HD_Form -> CV_NO_FIELDS = gettext("NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("HAVE BEEN CREATED."); } $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; @@ -204,48 +204,48 @@ $HD_Form -> AddSearchElement_Select('SELECT RATECARD', "cc_tariffplan", "id, tar } $HD_Form -> AddEditElement(gettext("RATECARD"), - "idtariffplan", - '$value', - "SELECT", - "", "", "", - "sql", - "cc_tariffplan", - "tariffname, id", + "idtariffplan", + '$value', + "SELECT", + "", "", "", + "sql", + "cc_tariffplan", + "tariffname, id", "", "", "%1", "", ""); $HD_Form -> AddEditElement(gettext("DIALPREFIX"), "dialprefix", - '$value', - "INPUT", - "size=50 maxlength=80", + '$value', + "INPUT", + "size=50 maxlength=80", "13", gettext("Insert the dialing prefix, such as for UK '44' or for US '1' "), - "" , "", "", "", "" , "", "", + "" , "", "", "", "" , "", "", gettext("A) Add destination prefixes, ie '441' for UK Landlines.
B) Use 'defaultprefix' to setup a rate for all destinations where a specific rate is not provided.
C) if you ADD a rate, NOT an EDIT, you can define a range of prefixes. '32484-32487' adds all prefixes between 32484 and 32487. '32484,32386,32488' would add only the individual prefixes listed.
D) Asterisk extensions style + POSIX regex syntaxes are supported. '_447[7-9]XXXXXXXX' matches 12-digit UK mobiles. '_X{0,3}(112|999|911)' matches any 0-3 digits followed an emergency number. '_' can be used to add length, and raise the priority.")); $HD_Form -> AddEditElement(gettext("Destination Prefix"), "destination", - '$value', - "POPUPVALUE", - "size=50 maxlength=80", + '$value', + "POPUPVALUE", + "size=50 maxlength=80", "13", "", - "" , "", "", "", "" , "A2B_entity_prefix.php?popup_select=2&", ", 'prefix','width=550,height=340,top=20,left=100,scrollbars=1'", + "" , "", "", "", "" , "A2B_entity_prefix.php?popup_select=2&", ", 'prefix','width=550,height=340,top=20,left=100,scrollbars=1'", gettext("Select the prefix destination corresponding to your prefix rate.").'
'.gettext("This is the label that appears against the Call Detail Record.")); /* $HD_Form -> AddEditElement(gettext("Destination Prefix"), "destination", - '$value', - "SELECT", - "", "", "", - "sql", - "cc_prefix", - "destination, prefix", + '$value', + "SELECT", + "", "", "", + "sql", + "cc_prefix", + "destination, prefix", "prefix >= 0 ORDER BY prefix ASC", "", "%2 (%1)", "", gettext("Select the prefix destination corresponding to your prefix rate.")); -*/ +*/ $HD_Form -> AddEditElement("BUYING RATE", "buyrate", @@ -254,7 +254,7 @@ $HD_Form -> AddEditElement("BUYING RATE", "size=30 maxlength=20", "12", gettext("Insert the buy rate"), - "" , "", "", "", "" , "", "", gettext("Set the carrier cost, the price you pay for minutes."), null, null, + "" , "", "", "", "" , "", "", gettext("Set the carrier cost, the price you pay for minutes."), null, null, gettext("Set the carrier cost for this destination.")); @@ -289,11 +289,11 @@ $HD_Form -> AddEditElement(gettext("SELLING RATE"), $HD_Form -> AddEditElement(gettext("SELLRATE MIN DURATION"), - "initblock", - '$value', - "INPUT", - "size=30 maxlength=20", - "4", + "initblock", + '$value', + "INPUT", + "size=30 maxlength=20", + "4", gettext("Insert the init block"), "" , "", "", "", "", "", "NO", gettext("Set the minimum duration to charge the customer (ie 60 seconds)")); @@ -349,7 +349,7 @@ $HD_Form -> AddEditElement(gettext("MINIMUM CALL COST"), if (ADVANCED_MODE) { - + $HD_Form -> AddEditElement(gettext("STEPCHARGE A"), "stepchargea", '$value', @@ -358,8 +358,8 @@ if (ADVANCED_MODE) { "12", gettext("Insert the stepcharge A"), "" , "", "", "", "", "", "NO", gettext("When entering in the cycle 'A', define the amount to charge for the entrance."), '', '', gettext("Below we have the section to create progressive rates. Progressive rate aims to bill the customer at various rates according the duration of the call. For instance you can define that you can to bill the customer 0.33dollars for the first 2 minutes and then you want to bill him 0.45dollars for the rest of the call." )); - - + + $HD_Form -> AddEditElement(gettext("CHARGE A"), "chargea", '$value', @@ -368,8 +368,8 @@ if (ADVANCED_MODE) { "12", gettext("Insert the charge A"), "" , "", "", "", "", "", "NO", gettext("When entering in the cycle 'A', define the rate to apply." )); - - + + $HD_Form -> AddEditElement(gettext("TIMECHARGE A"), "timechargea", '$value', @@ -378,8 +378,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the time charge A"), "" , "", "", "", "", "", "NO", gettext("Define the duration of the cycle 'A'." )); - - + + $HD_Form -> AddEditElement(gettext("BILLING BLOCK A"), "billingblocka", '$value', @@ -388,8 +388,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the billing block A"), "" , "", "", "", "", "" , "NO", gettext("Define the duration of each billing block to apply the rate 'CHARGE A'.")); - - + + $HD_Form -> AddEditElement(gettext("STEPCHARGE B"), "stepchargeb", '$value', @@ -398,8 +398,8 @@ if (ADVANCED_MODE) { "12", gettext("Insert the stepcharge B"), "" , "", "", "", "", "" , "NO", gettext("When entering in the cycle 'B', define the amount to charge for the entrance.")); - - + + $HD_Form -> AddEditElement(gettext("CHARGE B"), "chargeb", '$value', @@ -408,8 +408,8 @@ if (ADVANCED_MODE) { "12", gettext("Insert the charge B"), "" , "", "", "", "", "", "NO", gettext("When entering in the cycle 'B', define the rate to apply." )); - - + + $HD_Form -> AddEditElement(gettext("TIMECHARGE B"), "timechargeb", '$value', @@ -418,8 +418,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the time charge B"), "" , "", "", "", "", "", "NO", gettext("Define the duration of the cycle 'B'." )); - - + + $HD_Form -> AddEditElement(gettext("BILLING BLOCK B"), "billingblockb", '$value', @@ -428,8 +428,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the billing block B"), "" , "", "", "", "", "", "NO", gettext("Define the duration of each billing block to apply the rate 'CHARGE B'." )); - - + + $HD_Form -> AddEditElement(gettext("STEPCHARGE C"), "stepchargec", '$value', @@ -438,8 +438,8 @@ if (ADVANCED_MODE) { "12", "Insert the stepcharge C", "" , "", "", "", "", "", "NO", gettext("When entering in the cycle 'C', define the amount to charge for the entrance." )); - - + + $HD_Form -> AddEditElement(gettext("CHARGE C"), "chargec", '$value', @@ -448,8 +448,8 @@ if (ADVANCED_MODE) { "12", gettext("Insert the charge C"), "" , "", "", "", "", "", "NO", gettext("When entering in the cycle 'C', define the rate to apply.")); - - + + $HD_Form -> AddEditElement(gettext("TIMECHARGE C"), "timechargec", '$value', @@ -458,8 +458,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the time charge C"), "" , "", "", "", "", "", "NO", gettext("Define the duration of the cycle 'C'.")); - - + + $HD_Form -> AddEditElement(gettext("BILLING BLOCK C"), "billingblockc", '$value', @@ -468,8 +468,8 @@ if (ADVANCED_MODE) { "4", gettext("Insert the billing block C"), "" , "", "", "", "", "", "NO", gettext("Define the duration of each billing block to apply the rate 'CHARGE C'.")); - - + + $HD_Form -> AddEditElement(gettext("ANNOUNCE TIME CORRECTION"), "announce_time_correction", '$value', @@ -484,7 +484,7 @@ if (ADVANCED_MODE) { if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+10; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; diff --git a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_did__vt.inc b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_did__vt.inc index f890d753f..d9c2d62cc 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_did__vt.inc +++ b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_did__vt.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -98,11 +98,10 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_SPLITABLE_FIELD = 'did'; - // TODO integrate in Framework if ($form_action=="ask-add" || $form_action=="purchase") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; diff --git a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_voucher__vt.inc b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_voucher__vt.inc index 1c5e2617f..9c716f9c0 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_voucher__vt.inc +++ b/addons/contrib/villagetelco/gui/admin/Public/form_data/FG_var_voucher__vt.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -65,7 +65,7 @@ foreach($currencies_list as $key => $cur_value) { if (VT_MODE) { $HD_Form ->FG_LIST_ADDING_BUTTON1 = false; -} else { +} else { $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; } $HD_Form ->FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_voucher_multi.php?section=".$_SESSION["menu_section"]; @@ -146,31 +146,31 @@ if ($form_action=="ask-add") { } $HD_Form -> AddEditElement (gettext("VOUCHER"), - "voucher", - "$value", + "voucher", + "$value", "INPUT", - "size=20 $maxi readonly maxlength=40", - "4", + "size=20 $maxi readonly maxlength=40", + "4", gettext("Insert the voucher"), "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("AMOUNT"), "credit", - '$value', - "INPUT", - "size=30 maxlength=30", + '$value', + "INPUT", + "size=30 maxlength=30", "12", gettext("Insert the number of credit"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("TAG"), - "tag", - '$value', + "tag", + '$value', "INPUT", - "size=30 maxlength=30", - "11", + "size=30 maxlength=30", + "11", gettext("Insert the tag"), "" , "", "", "", "", "", "NO-NULL", "" ); @@ -178,8 +178,8 @@ $HD_Form -> AddEditElement (gettext("TAG"), $HD_Form -> AddEditElement (gettext("ACTIVATED"), "activated", 't', - "RADIOBUTTON", - "", + "RADIOBUTTON", + "", "", gettext("Choose if you want to activate this card"), "" , "", "" ,"Yes :t, - No:f", "", "" , "" , ""); @@ -196,7 +196,7 @@ $HD_Form -> AddEditElement (gettext("CURRENCY"), if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+10; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; @@ -207,7 +207,7 @@ $HD_Form -> AddEditElement (gettext("EXPIRY DATE"), "expirationdate", '$value', "INPUT", - "size=40 maxlength=40 $comp_date_plus", + "size=40 maxlength=40 $comp_date_plus", "10", gettext("Insert the expiration date"), "" , "", "", "", "", "", "", gettext("Format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), null, "res_display_dateformat" ); diff --git a/addons/contrib/villagetelco/gui/admin/Public/index__vt.php b/addons/contrib/villagetelco/gui/admin/Public/index__vt.php index 39919cae4..f55ec30eb 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/index__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/index__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/admin/Public/logout__vt.php b/addons/contrib/villagetelco/gui/admin/Public/logout__vt.php index af609648c..1143b0bbc 100644 --- a/addons/contrib/villagetelco/gui/admin/Public/logout__vt.php +++ b/addons/contrib/villagetelco/gui/admin/Public/logout__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/common/lib/Form/Class.FormHandler.inc__vt.php b/addons/contrib/villagetelco/gui/common/lib/Form/Class.FormHandler.inc__vt.php index c251c0dd2..3a5e8ac8d 100644 --- a/addons/contrib/villagetelco/gui/common/lib/Form/Class.FormHandler.inc__vt.php +++ b/addons/contrib/villagetelco/gui/common/lib/Form/Class.FormHandler.inc__vt.php @@ -18,7 +18,7 @@ include (dirname(__FILE__) . "/Class.FormBO.php"); class FormHandler -{ +{ private static $Instance; var $_action = ''; var $_vars = null; @@ -26,22 +26,22 @@ class FormHandler var $DBHandle; var $VALID_SQL_REG_EXP = true; var $RESULT_QUERY = false; - + var $pqp; - - + + /* CONFIG THE VIEWER : CV */ var $CV_TOPVIEWER = ''; var $CV_NO_FIELDS = "THERE IS NO RECORD !"; var $CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = true; - var $CV_TITLE_TEXT = ''; + var $CV_TITLE_TEXT = ''; var $CV_TEXT_TITLE_ABOVE_TABLE = "DIRECTORY"; var $CV_DISPLAY_FILTER_ABOVE_TABLE = true; var $CV_FILTER_ABOVE_TABLE_PARAM = "?id="; var $CV_FOLLOWPARAMETERS = ''; var $CV_DO_ARCHIVE_ALL = false; - - + + var $CV_DISPLAY_RECORD_LIMIT = true; var $CV_DISPLAY_BROWSE_PAGE = true; @@ -54,20 +54,20 @@ class FormHandler * @public - @type integer */ var $FG_DEBUG = 0; - + /** * Sets the table name. * @public - @type string - */ + */ var $FG_TABLE_NAME=""; - + /** * Sets the table name used for count. * @public - @type string - */ + */ var $FG_TABLE_NAME_COUNT=""; - - + + /** * Sets the instance_name, used to descripbe the name of the element your are managing * @public - @type string @@ -77,15 +77,15 @@ class FormHandler /** * Sets the main clause - Clause to execute on the table * @public - @type string - */ + */ var $FG_TABLE_CLAUSE = ""; /** * Sets the table list you will need to feed the SELECT from element * @public - @type array - ( String to display, value to save) - */ + */ var $tablelist = array(); - + /** * ARRAY with the list of element to display in the ViewData page * @public - @type array @@ -104,8 +104,8 @@ class FormHandler */ var $FG_NB_TABLE_COL=0; var $FG_TOTAL_TABLE_COL=0; - - + + /** * Keep the ID of the table * @public - @type string @@ -120,7 +120,7 @@ class FormHandler var $FG_LIST_ADDING_BUTTON_IMG = ''; var $FG_LIST_ADDING_BUTTON_MSG = ''; var $FG_LIST_ADDING_BUTTON_ALT = ''; - + /** * Sets if we want a colum "ACTION" to EDIT or to DELETE * @public - @type boolean @@ -134,7 +134,7 @@ class FormHandler var $FG_OTHER_BUTTON3=false; var $FG_OTHER_BUTTON4=false; var $FG_OTHER_BUTTON5=false; - + /** * Keep the link for the action (EDIT & DELETE) @@ -143,17 +143,17 @@ class FormHandler var $FG_EDITION_LINK = ''; var $FG_DELETION_LINK = ''; var $FG_DELETION_FORBIDDEN_ID = array(); - var $FG_INFO_LINK=''; - var $FG_OTHER_BUTTON1_LINK = ''; + var $FG_INFO_LINK=''; + var $FG_OTHER_BUTTON1_LINK = ''; var $FG_OTHER_BUTTON2_LINK = ''; var $FG_OTHER_BUTTON3_LINK = ''; var $FG_OTHER_BUTTON4_LINK = ''; var $FG_OTHER_BUTTON5_LINK = ''; - + var $FG_EDITION_IMG = 'edit.png'; var $FG_DELETION_IMG= 'delete.png'; - var $FG_INFO_IMG='info.png'; - + var $FG_INFO_IMG='info.png'; + var $FG_OTHER_BUTTON1_IMG = ''; var $FG_OTHER_BUTTON2_IMG = ''; var $FG_OTHER_BUTTON3_IMG = ''; @@ -164,19 +164,19 @@ class FormHandler var $FG_OTHER_BUTTON2_FORBIDDEN_KEY = array(); var $FG_OTHER_BUTTON3_FORBIDDEN_KEY = array(); var $FG_OTHER_BUTTON4_FORBIDDEN_KEY = array(); - var $FG_OTHER_BUTTON5_FORBIDDEN_KEY = array(); + var $FG_OTHER_BUTTON5_FORBIDDEN_KEY = array(); var $FG_EDIT_PAGE_CONFIRM_BUTTON = ''; var $FG_DELETE_PAGE_CONFIRM_BUTTON = ''; var $FG_ADD_PAGE_CONFIRM_BUTTON = ''; - + /** * Sets the number of record to show by page * @public - @type integer */ var $FG_LIMITE_DISPLAY=10; var $SQL_GROUP = null; - + /** * Sets the variable to control the View Module * @public - @type integer @@ -188,17 +188,17 @@ class FormHandler var $FG_NB_RECORD_MAX = 0; var $FG_NB_RECORD = 0; - + /** * Sets the variables to control the Apply filter * @public - @type string */ var $FG_FILTER_FORM_ACTION = 'list'; - + var $FG_FILTER_APPLY = false; var $FG_FILTERTYPE = 'INPUT'; // INPUT :: SELECT :: POPUPVALUE var $FG_FILTERFIELD = ''; - var $FG_FILTERFIELDNAME = ''; + var $FG_FILTERFIELDNAME = ''; var $FG_FILTERPOPUP = array('CC_entity_card.php?popup_select=1&', ", 'CardNumberSelection','width=550,height=350,top=20,left=100'"); // SECOND FILTER @@ -208,21 +208,21 @@ class FormHandler var $FG_FILTERFIELDNAME2 = ''; var $FG_FILTERPOPUP2 = array(); - + /** * Sets the variables to control the search filter * @public - @type boolean , array , string */ var $FG_FILTER_SEARCH_FORM = false; - + var $FG_FILTER_SEARCH_1_TIME = false; var $FG_FILTER_SEARCH_1_TIME_TEXT = ''; var $FG_FILTER_SEARCH_1_TIME_FIELD = 'creationdate'; - + var $FG_FILTER_SEARCH_1_TIME_BIS = false; var $FG_FILTER_SEARCH_1_TIME_TEXT_BIS = ''; var $FG_FILTER_SEARCH_1_TIME_FIELD_BIS = ''; - + var $FG_FILTER_SEARCH_3_TIME = false; var $FG_FILTER_SEARCH_3_TIME_TEXT = ''; var $FG_FILTER_SEARCH_3_TIME_FIELD = 'creationdate'; @@ -231,11 +231,11 @@ class FormHandler var $FG_FILTER_SEARCH_FORM_2C = array(); var $FG_FILTER_SEARCH_FORM_SELECT = array(); var $FG_FILTER_SEARCH_FORM_SELECT_TEXT = ''; - var $FG_FILTER_SEARCH_TOP_TEXT = ""; + var $FG_FILTER_SEARCH_TOP_TEXT = ""; var $FG_FILTER_SEARCH_SESSION_NAME = ''; var $FG_FILTER_SEARCH_DELETE_ALL = true; - - + + /** * Sets the variable to define if we want a splitable field into the form * @public - @type void , string (fieldname) @@ -243,14 +243,14 @@ class FormHandler * according to the values/ranges defined. */ var $FG_SPLITABLE_FIELD = ''; - + /** * Sets the variables to control the top search filter * @public - @type void , string */ var $FG_TOP_FILTER_VALUE = 0; var $FG_TOP_FILTER_NAME = ''; - + /** * Sets the variables to control the CSV export * @public - @type boolean @@ -258,7 +258,7 @@ class FormHandler var $FG_EXPORT_CSV = false; var $FG_EXPORT_XML = false; var $FG_EXPORT_SESSION_VAR = ''; - + /** * Sets the fieldname of the SQL query for Export e.g:name, mail" * @public - @type string @@ -266,17 +266,17 @@ class FormHandler var $FG_EXPORT_FIELD_LIST = ""; /** - * Sets the TEXT to display above the records displayed + * Sets the TEXT to display above the records displayed * @public - @string */ var $FG_INTRO_TEXT="You can browse through our #FG_INSTANCE_NAME# and modify their different properties
"; /** - * Sets the ALT TEXT after mouse over the bouton + * Sets the ALT TEXT after mouse over the bouton * @public - @string - */ - + */ + var $FG_DELETE_ALT = "Delete this record"; var $FG_EDIT_ALT = "Edit this record"; var $FG_INFO_ALT = "Info on this record"; @@ -285,19 +285,19 @@ class FormHandler var $FG_OTHER_BUTTON3_ALT = ''; var $FG_OTHER_BUTTON4_ALT = ''; var $FG_OTHER_BUTTON5_ALT = ''; - + var $FG_OTHER_BUTTON1_HTML_CLASS = ''; var $FG_OTHER_BUTTON2_HTML_CLASS = ''; var $FG_OTHER_BUTTON3_HTML_CLASS = ''; var $FG_OTHER_BUTTON4_HTML_CLASS = ''; var $FG_OTHER_BUTTON5_HTML_CLASS = ''; - + var $FG_OTHER_BUTTON1_HTML_ID = ''; var $FG_OTHER_BUTTON2_HTML_ID = ''; var $FG_OTHER_BUTTON3_HTML_ID = ''; - var $FG_OTHER_BUTTON4_HTML_ID = ''; + var $FG_OTHER_BUTTON4_HTML_ID = ''; var $FG_OTHER_BUTTON5_HTML_ID = ''; - + var $FG_OTHER_BUTTON1_CONDITION = ''; var $FG_OTHER_BUTTON2_CONDITION = ''; var $FG_OTHER_BUTTON3_CONDITION = ''; @@ -306,34 +306,34 @@ class FormHandler var $FG_EDITION_CONDITION = ''; var $FG_DELETION_CONDITION = ''; - + // -------------------- DATA FOR THE EDITION -------------------- - + /** * ARRAY with the list of element to EDIT/REMOVE/ADD in the edit page - * @public - @type array - */ + * @public - @type array + */ var $FG_TABLE_EDITION = array (); var $FG_TABLE_ADITION = array (); - + /** * ARRAY with the comment below each fields - * @public - @type array - */ + * @public - @type array + */ var $FG_TABLE_COMMENT = array (); - + /** * ARRAY with the regular expression to check the form - * @public - @type array - */ + * @public - @type array + */ var $FG_regular = array(); /** * Array that will contain the field where the regularexpression check have found errors - * @public - @type array - */ + * @public - @type array + */ var $FG_fit_expression = array(); - + /** * Set the fields for the EDIT/ADD query * @public - @type string @@ -341,7 +341,7 @@ class FormHandler var $FG_QUERY_EDITION=''; var $FG_QUERY_ADITION=''; - + /** * Set the width of the column to the EDIT FORM * @public - @type string @@ -377,12 +377,12 @@ class FormHandler var $FG_QUERY_ADITION_HIDDEN_FIELDS = ''; var $FG_QUERY_ADITION_HIDDEN_VALUE = ''; var $FG_QUERY_SQL_HIDDEN = ''; - + var $FG_EDITION_HIDDEN_PARAM = ''; var $FG_EDITION_HIDDEN_PARAM_VALUE = ''; var $FG_ADITION_HIDDEN_PARAM = ''; var $FG_ADITION_HIDDEN_PARAM_VALUE = ''; - + /** * Set the EXTRA HIDDED VALUES for the edition/addition * @public - @type array @@ -406,10 +406,10 @@ class FormHandler */ var $FG_GO_LINK_AFTER_ACTION; var $FG_GO_LINK_AFTER_ACTION_ADD; - var $FG_GO_LINK_AFTER_ACTION_DELETE; + var $FG_GO_LINK_AFTER_ACTION_DELETE; var $FG_GO_LINK_AFTER_ACTION_EDIT; - - + + /** #################################################### * if yes that allow your form to edit the form after added succesfully a instance * in the case if you don't have the same option in the edition and the adding option @@ -417,7 +417,7 @@ class FormHandler */ var $FG_ADITION_GO_EDITION = "no"; - + var $FG_ADITION_GO_EDITION_MESSAGE = "The document has been created correctly. Now, you can define the different tariff that you want to associate."; @@ -426,7 +426,7 @@ class FormHandler var $FG_INTRO_TEXT_EDITION="You can modify, through the following form, the different properties of your #FG_INSTANCE_NAME#
"; var $FG_INTRO_TEXT_ASK_DELETION = "If you really want remove this #FG_INSTANCE_NAME#, click on the delete button."; - + var $FG_INTRO_TEXT_DELETION = "A #FG_INSTANCE_NAME# has been deleted!"; var $FG_INTRO_TEXT_ADD = "you can add easily a new #FG_INSTANCE_NAME#.
Fill the following fields and confirm by clicking on the button add."; @@ -434,7 +434,7 @@ class FormHandler var $FG_INTRO_TEXT_ADITION = "Add a \"#FG_INSTANCE_NAME#\" now."; var $FG_TEXT_ADITION_CONFIRMATION = "Your new #FG_INSTANCE_NAME# has been inserted.
"; - + var $FG_TEXT_ADITION_ERROR = ' Your new #FG_INSTANCE_NAME# has not been inserted.
'; var $FG_TEXT_ERROR_DUPLICATION = "You cannot choose more than one !"; @@ -454,9 +454,9 @@ class FormHandler var $FG_ADDITIONAL_FUNCTION_AFTER_DELETE = ''; var $FG_ADDITIONAL_FUNCTION_BEFORE_EDITION = ''; var $FG_ADDITIONAL_FUNCTION_AFTER_EDITION = ''; - + var $FG_TABLE_ALTERNATE_ROW_COLOR = array(); - + var $FG_TABLE_DEFAULT_ORDER = "id"; var $FG_TABLE_DEFAULT_SENS = "ASC"; @@ -466,7 +466,7 @@ class FormHandler // if it is set to true and Allowed flag is true all dependent records will be deleted. var $FG_FK_DELETE = false; - + // Foreign Key Tables var $FG_FK_TABLENAMES = array(); @@ -488,16 +488,16 @@ class FormHandler // Delete Message for FK var $FG_FK_DELETE_MESSAGE = "Are you sure to delete all records connected to this instance."; - - //To enable Disable Selection List - var $FG_DISPLAY_SELECT = false; + + //To enable Disable Selection List + var $FG_DISPLAY_SELECT = false; //Selection List Field Name to get from Database var $FG_SELECT_FIELDNAME = ""; // Configuration Key value Field Name var $FG_CONF_VALUE_FIELDNAME = ""; - + // For Pre Selected Delete // Pre Selected Records Count var $FG_PRE_COUNT = 0; @@ -510,10 +510,10 @@ class FormHandler var $lang = array('strfirst' => '<< First', 'strprev' => '< Prev', 'strnext' => 'Next >', 'strlast' => 'Last >>' ); var $logger = null; - + var $FG_ENABLE_LOG = ENABLE_LOG; - - + + // ---------------------------------------------- // CLASS CONSTRUCTOR : FormHandler // @public @@ -530,17 +530,17 @@ function FormHandler ($tablename=null, $instance_name=null, $action=null, $table $this -> FG_TABLE_NAME = $tablename; $this -> FG_INSTANCE_NAME = $instance_name; $this -> FG_TABLE_NAME_COUNT = $tablename_count; - + if ($this->FG_DEBUG) echo "".$this -> Host.""; - + $this -> set_regular_expression(); - + $this->_action = $action ? $action : $_SERVER['PHP_SELF']; - + $this->_vars = array_merge((array)$_GET, (array)$_POST); - + $this -> def_list(); - + //initializing variables with gettext $this -> CV_NO_FIELDS = gettext("No data found!"); $this -> CV_TEXT_TITLE_ABOVE_TABLE = gettext("DIRECTORY"); @@ -553,7 +553,7 @@ function FormHandler ($tablename=null, $instance_name=null, $action=null, $table $this -> FG_INTRO_TEXT_EDITION = gettext("You can modify, through the following form, the different properties of your")." #FG_INSTANCE_NAME#".'
'; $this -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." #FG_INSTANCE_NAME#, ".gettext("Click on the delete button."); $this -> FG_INTRO_TEXT_DELETION = gettext("One")." #FG_INSTANCE_NAME# ".gettext("has been deleted!"); - + $this -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." #FG_INSTANCE_NAME#.
".gettext("Fill the following fields and confirm by clicking on the button add."); $this -> FG_INTRO_TEXT_ADITION = gettext("Add a")." \"#FG_INSTANCE_NAME#\" ".gettext("now."); $this -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." #FG_INSTANCE_NAME# ".gettext("has been inserted.".'
'); @@ -561,18 +561,18 @@ function FormHandler ($tablename=null, $instance_name=null, $action=null, $table $this -> FG_TEXT_ERROR_DUPLICATION = gettext("You cannot choose more than one !"); $this -> FG_FK_DELETE_MESSAGE = gettext("Are you sure to delete all records connected to this instance."); - + $this -> FG_EDIT_PAGE_CONFIRM_BUTTON = gettext("CONFIRM DATA"); $this -> FG_DELETE_PAGE_CONFIRM_BUTTON = gettext('DELETE'); $this -> FG_ADD_PAGE_CONFIRM_BUTTON = gettext('CONFIRM DATA'); - + if($this -> FG_ENABLE_LOG == 1) { $this -> logger = new Logger(); } - + } - + static function GetInstance() { if (empty (self :: $Instance)) { $Instance = null; @@ -585,25 +585,25 @@ function setDBHandler ($DBHandle=null) Console::log('FormHandler -> setDBHandler'); Console::logMemory($this, 'FormHandler -> setDBHandler : Line '.__LINE__); Console::logSpeed('FormHandler -> setDBHandler : Line '.__LINE__); - + $this->DBHandle = $DBHandle; } /** * Perform the execution of some actions to prepare the form generation - * @public - */ + * @public + */ function init () { $processed = $this->getProcessed(); - + Console::log('FormHandler -> init'); Console::logMemory($this, 'FormHandler -> init : Line '.__LINE__); Console::logSpeed('FormHandler -> init : Line '.__LINE__); - - global $_SERVER; - - + + global $_SERVER; + + if ($processed['section']!="") { $section = $processed['section']; $_SESSION["menu_section"] = $section; @@ -615,10 +615,10 @@ function init () if (!empty($processed['order']) && !empty($processed['sens']))$ext_link.="&order=".$processed['order']."&sens=".$processed['sens']; $this -> FG_EDITION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-edit".$ext_link."&id="; $this -> FG_DELETION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-delete".$ext_link."&id="; - + $this -> FG_DELETE_ALT = gettext("Delete this ").$this -> FG_INSTANCE_NAME; $this -> FG_EDIT_ALT = gettext("Edit this ").$this -> FG_INSTANCE_NAME; - + $this -> FG_INTRO_TEXT = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT); $this -> FG_INTRO_TEXT_EDITION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_EDITION); $this -> FG_INTRO_TEXT_ASK_DELETION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_ASK_DELETION); @@ -628,36 +628,36 @@ function init () $this -> FG_TEXT_ADITION_CONFIRMATION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_TEXT_ADITION_CONFIRMATION); $this -> FG_TEXT_ADITION_ERROR = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_TEXT_ADITION_ERROR); $this -> FG_FILTER_SEARCH_TOP_TEXT = gettext("Define criteria to make a precise search"); - + $this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F2EE"; $this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FCFBFB"; - + $this -> FG_TOTAL_TABLE_COL = $this -> FG_NB_TABLE_COL; if ($this -> FG_DELETION || $this -> FG_INFO || $this -> FG_EDITION || $this -> FG_OTHER_BUTTON1 || $this -> FG_OTHER_BUTTON2 || $this -> FG_OTHER_BUTTON3 || $this -> FG_OTHER_BUTTON4 || $this -> FG_OTHER_BUTTON5) { $this -> FG_TOTAL_TABLE_COL++; } } - + /** * Define the list * @public - */ + */ function def_list () { Console::log('FormHandler -> def_list'); Console::logMemory($this, 'FormHandler -> def_list : Line '.__LINE__); Console::logSpeed('FormHandler -> def_list : Line '.__LINE__); - + $this -> tablelist['status_list']["1"] = array( gettext("INSERTED"), "1"); $this -> tablelist['status_list']["2"] = array( gettext("ENABLE"), "2"); $this -> tablelist['status_list']["3"] = array( gettext("DISABLE"), "3"); $this -> tablelist['status_list']["4"] = array( gettext("FREE"), "4"); - + } function &getProcessed() - { + { foreach ($this->_vars as $key => $value) { if (!$this->_processed[$key] or empty($this->_processed[$key])) { $this->_processed[$key] = $this -> sanitize($value); @@ -671,9 +671,9 @@ function &getProcessed() } return $this->_processed; } - - - function cleanInput($input) + + + function sanitize_tag($input) { $search = array( '@]*?>.*?@si', // Strip out javascript @@ -681,42 +681,42 @@ function cleanInput($input) '@]*?>.*?@siU', // Strip style tags properly '@@' // Strip multi-line comments ); - + $output = preg_replace($search, '', $input); return $output; } - - - function sanitize($input) - { - + + + function sanitize($input) + { + if (is_array($input)) { foreach($input as $var=>$val) { $output[$var] = $this -> sanitize($val); } } else { - - // remove whitespaces (not a must though) + + // remove whitespaces (not a must though) $input = trim($input); - + $input = str_replace('--', '', $input); $data = str_replace(';', '', $data); - + if (!(stripos($input, ' or 1')===FALSE)) { return false;} if (!(stripos($input, ' or true')===FALSE)) { return false;} - + if (get_magic_quotes_gpc()) { $input = stripslashes($input); } - $input = $this -> cleanInput($input); - + $input = $this -> sanitize_tag($input); + $output = addslashes( $input ); } - + return $output; } - + // ---------------------------------------------- // RECIPIENT METHODS @@ -758,7 +758,7 @@ function AddViewElement($displayname, $fieldname, $colpercentage, $textalign='ce *fieldname is the Field Name which will be included in the export file */ - + function FieldExportElement($fieldname) { if(strlen($fieldname)>0) @@ -903,11 +903,11 @@ function AddEditElement($displayname, $fieldname, $defaultvalue, $fieldtype, $fi return; } if($field_enabled==true) - { + { $cur = count($this->FG_TABLE_EDITION); $this->FG_TABLE_EDITION[$cur] = array ( $displayname, $fieldname, $defaultvalue, $fieldtype, $fieldproperty, $regexpr_nb, $error_message, $type_selectfield, $lie_tablename, $lie_tablefield, $lie_clause, $listname, $displayformat_selectfield, $check_emptyvalue, - $custom_query, $displayinput_defaultselect, $comment_above); + $custom_query, $displayinput_defaultselect, $comment_above); $this->FG_TABLE_COMMENT[$cur] = $comment; $this->FG_TABLE_ADITION[$cur] = $this->FG_TABLE_EDITION[$cur]; $this->FG_NB_TABLE_ADITION = $this->FG_NB_TABLE_EDITION = count($this->FG_TABLE_EDITION); @@ -916,15 +916,15 @@ function AddEditElement($displayname, $fieldname, $defaultvalue, $fieldtype, $fi /** * Sets Search form fieldnames for the view module - * @public - * @ $displayname , $fieldname, $fieldvar + * @public + * @ $displayname , $fieldname, $fieldvar */ function AddSearchElement_C1($displayname, $fieldname, $fieldvar) { $cur = count($this->FG_FILTER_SEARCH_FORM_1C); $this->FG_FILTER_SEARCH_FORM_1C[$cur] = array($displayname, $fieldname, $fieldvar); } - + function AddSearchElement_C2($displayname, $fieldname1 , $fielvar1 , $fieldname2 , $fielvar2, $sqlfield) { $cur = count($this->FG_FILTER_SEARCH_FORM_2C); @@ -938,25 +938,25 @@ function AddSearchElement_C2($displayname, $fieldname1 , $fielvar1 , $fieldname2 */ function AddSearchElement_Select($displayname, $table = null, $fields = null, $clause = null, $order = null ,$sens = null , $select_name, $sql_type = 1, $array_content = null,$search_table=null){ - + $cur = count($this->FG_FILTER_SEARCH_FORM_SELECT); - + if ($sql_type) { $sql = array($table, $fields, $clause, $order ,$sens); $this->FG_FILTER_SEARCH_FORM_SELECT[$cur] = array($displayname, $sql, $select_name,null,$search_table); } else { $this->FG_FILTER_SEARCH_FORM_SELECT[$cur] = array($displayname, 0, $select_name, $array_content,null); - } + } } - - + + /** * Sets Query fieldnames for the Edit/ADD module - * @public - * @ $col_query + * @public + * @ $col_query */ function FieldEditElement ($fieldname) - { + { if($this->FG_DISPLAY_SELECT == true) { if(strlen($this->FG_SELECT_FIELDNAME)>0) @@ -967,50 +967,50 @@ function FieldEditElement ($fieldname) $this->FG_QUERY_EDITION = $fieldname; $this->FG_QUERY_ADITION = $fieldname; } - - + + function set_regular_expression() { - // 0. A STRING WITH EXACTLY 3 CHARACTERS. - $this -> FG_regular[] = array( "^.{3}", + // 0. A STRING WITH EXACTLY 3 CHARACTERS. + $this -> FG_regular[] = array( "^.{3}", gettext("(at least 3 characters)")); - + // 1. EMAIL ADRESSE - $this -> FG_regular[] = array( "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", + $this -> FG_regular[] = array( "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", gettext("(must match email structure. Example : name@domain.com)")); - + // 2 . IF AT LEAST FIVE SUCCESSIVE CHARACTERS APPEAR AT THE END OF THE STRING. - $this -> FG_regular[] = array( ".{5}$", + $this -> FG_regular[] = array( ".{5}$", gettext("(at least 5 successive characters appear at the end of this string)")); // 3. IF AT LEAST 4 CHARACTERS - $this -> FG_regular[] = array( ".{4}", + $this -> FG_regular[] = array( ".{4}", gettext("(at least 4 characters)")); // 4 - $this -> FG_regular[] = array( "^[0-9]+$" , + $this -> FG_regular[] = array( "^[0-9]+$" , gettext("(number format)")); - + // 5 - $this -> FG_regular[] = array( "^([0-9]{4})-([0-9]{2})-([0-9]{2})$" , + $this -> FG_regular[] = array( "^([0-9]{4})-([0-9]{2})-([0-9]{2})$" , "(YYYY-MM-DD)"); - + // 6 - $this -> FG_regular[] = array( "^[0-9]{8,}$" , + $this -> FG_regular[] = array( "^[0-9]{8,}$" , gettext("(only number with more that 8 digits)")); - + // 7 - $this -> FG_regular[] = array( "^[0-9][ .0-9\/\-]{6,}[0-9]$" , + $this -> FG_regular[] = array( "^[0-9][ .0-9\/\-]{6,}[0-9]$" , gettext("(at least 8 digits using . or - or the space key)")); - + // 8 - $this -> FG_regular[] = array( ".{5}", + $this -> FG_regular[] = array( ".{5}", gettext("network adress format")); // 9 $this -> FG_regular[] = array( "^.{1}", gettext("at least 1 character")); - + // 10 $this -> FG_regular[] = array( "^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$" , "(YYYY-MM-DD HH:MM:SS)"); @@ -1022,27 +1022,27 @@ function set_regular_expression() // 12 $this -> FG_regular[] = array( "^(-){0,1}[0-9]+(\.){0,1}[0-9]*$" , gettext("(NUMBER FORMAT WITH/WITHOUT DECIMAL, use '.' for decimal)")); - + // 13 - RATECARD $this -> FG_regular[] = array( "^(defaultprefix|[-,0-9]+|_[-[.[.][.].]0-9XZN(){}|.,_]+)$", "(NUMBER FORMAT OR 'defaultprefix' OR ASTERISK/POSIX REGEX FORMAT)"); - + // 14 - DNID PREFIX FOR RATECARD $this -> FG_regular[] = array( "^(all|[0-9]+)$", "(NUMBER FORMAT OR 'all')"); - + // 15 - RATECARD TIME $this -> FG_regular[] = array( "^([0-9]{2}):([0-9]{2})$" , "(HH:MM)"); - + // 16 TEXT > 15 caract - $this -> FG_regular[] = array( ".{15}", + $this -> FG_regular[] = array( ".{15}", gettext("You must write something.")); - + // 17 TEXT > 15 caract - $this -> FG_regular[] = array( ".{8}", + $this -> FG_regular[] = array( ".{8}", gettext("8 characters alphanumeric")); - + // 18 - CALLERID - PhoneNumber $this -> FG_regular[] = array( "^(\+|[0-9]{1})[0-9]+$" , "Phone Number format"); @@ -1051,26 +1051,26 @@ function set_regular_expression() gettext("(at least 6 Alphanumeric characters)")); //20 TIME $this -> FG_regular[] = array( "^([0-9]{2}):([0-9]{2}):([0-9]{2})$" , - "(HH:MM:SS)"); + "(HH:MM:SS)"); // check_select // TO check if a select have a value different -1 // 21 -> Check percent more of 0 and under 100 $this -> FG_regular[] = array( "^100$|^(([0-9]){0,2})((\.)([0-9]*))?$" , gettext("(PERCENT FORMAT WITH/WITHOUT DECIMAL, use '.' for decimal and don't use '%' character. e.g.: 12.4 )")); - + } - - + + // ---------------------------------------------- // FUNCTION FOR THE FORM // ---------------------------------------------- - + function do_field_duration($sql,$fld, $fldsql) - { + { $processed = $this->getProcessed(); - + $fldtype = $fld.'type'; - + if (isset($processed[$fld]) && ($processed[$fld]!='')){ if (strpos($sql,'WHERE') > 0){ $sql = "$sql AND "; @@ -1078,11 +1078,11 @@ function do_field_duration($sql,$fld, $fldsql) $sql = "$sql WHERE "; } $sql = "$sql $fldsql"; - if (isset ($processed[$fldtype])){ + if (isset ($processed[$fldtype])){ switch ($processed[$fldtype]) { case 1: $sql = "$sql ='".$processed[$fld]."'"; break; case 2: $sql = "$sql <= '".$processed[$fld]."'"; break; - case 3: $sql = "$sql < '".$processed[$fld]."'"; break; + case 3: $sql = "$sql < '".$processed[$fld]."'"; break; case 4: $sql = "$sql > '".$processed[$fld]."'"; break; case 5: $sql = "$sql >= '".$processed[$fld]."'"; break; } @@ -1093,13 +1093,13 @@ function do_field_duration($sql,$fld, $fldsql) function do_field($sql,$fld, $simple=0,$processed=null,$search_table=null) { - - + + $fldtype = $fld.'type'; - if(empty($processed)) { + if(empty($processed)) { $processed = $this->getProcessed(); } - + if (isset($processed[$fld]) && ($processed[$fld]!='')){ if (strpos($sql,'WHERE') > 0){ $sql = "$sql AND "; @@ -1111,24 +1111,24 @@ function do_field($sql,$fld, $simple=0,$processed=null,$search_table=null) }else{ $sql = "$sql $search_table.$fld"; } - if (DB_TYPE == "postgres"){ + if (DB_TYPE == "postgres"){ $LIKE = "ILIKE"; $CONVERT =""; }else{ $LIKE = "LIKE"; $CONVERT =" COLLATE utf8_unicode_ci"; } - + if ($simple==0){ - if (isset ($processed[$fldtype])){ + if (isset ($processed[$fldtype])){ switch ($processed[$fldtype]) { case 1: $sql = "$sql='".$processed[$fld]."'"; break; case 2: $sql = "$sql $LIKE '".$processed[$fld]."%'".$CONVERT; break; case 3: $sql = "$sql $LIKE '%".$processed[$fld]."%'".$CONVERT; break; case 4: $sql = "$sql $LIKE '%".$processed[$fld]."'".$CONVERT; } - }else{ - $sql = "$sql $LIKE '%".$processed[$fld]."%'".$CONVERT; + }else{ + $sql = "$sql $LIKE '%".$processed[$fld]."%'".$CONVERT; } }else{ $sql = "$sql ='".$processed[$fld]."'"; @@ -1136,10 +1136,10 @@ function do_field($sql,$fld, $simple=0,$processed=null,$search_table=null) } return $sql; } - + /** * Function to execture the appropriate action - * @public + * @public */ function perform_action (&$form_action){ //security check @@ -1178,7 +1178,7 @@ function perform_action (&$form_action){ $this -> perform_delete($form_action); break; } - + $processed = $this->getProcessed(); //$processed['firstname'] if ($form_action == "ask-delete" && in_array($processed['id'],$this->FG_DELETION_FORBIDDEN_ID) ){ @@ -1189,7 +1189,7 @@ function perform_action (&$form_action){ } die(); } - + if ( $form_action == "list" || $form_action == "edit" || $form_action == "ask-delete" || $form_action == "ask-edit" || $form_action == "add-content" || $form_action == "del-content" || $form_action == "ask-del-confirm") { include_once (FSROOT."lib/Class.Table.php"); @@ -1202,7 +1202,7 @@ function perform_action (&$form_action){ if (isset($_SESSION[$session_limit]) && is_numeric($_SESSION[$session_limit])){ $this -> FG_LIMITE_DISPLAY = $_SESSION[$session_limit]; } - + if (isset($processed['mydisplaylimit']) && (is_numeric($processed['mydisplaylimit']) || ($processed['mydisplaylimit']=='ALL'))){ if ($processed['mydisplaylimit']=='ALL'){ $this -> FG_LIMITE_DISPLAY = 5000; @@ -1216,29 +1216,29 @@ function perform_action (&$form_action){ $this->FG_ORDER = $this -> FG_TABLE_DEFAULT_ORDER; $this->FG_SENS = $this -> FG_TABLE_DEFAULT_SENS; } - + if ( $form_action == "list" ) { $sql_calc_found_rows = ''; if (DB_TYPE != "postgres") { $sql_calc_found_rows = 'SQL_CALC_FOUND_ROWS'; } $instance_table = new Table($this -> FG_TABLE_NAME, "$sql_calc_found_rows ".$this -> FG_COL_QUERY, null, null, null, true, $this -> FG_TABLE_NAME_COUNT); - + $this->prepare_list_subselection($form_action); - + // Code here to call the Delete Selected items Fucntion if (isset($processed['deleteselected'])) { $this -> Delete_Selected(); } - - if ($this->FG_DEBUG >= 2) { + + if ($this->FG_DEBUG >= 2) { echo "FG_CLAUSE:$this->FG_CLAUSE"; echo "FG_ORDER = ".$this->FG_ORDER."
"; echo "FG_SENS = ".$this->FG_SENS."
"; echo "FG_LIMITE_DISPLAY = ".$this -> FG_LIMITE_DISPLAY."
"; echo "CV_CURRENT_PAGE = ".$this -> CV_CURRENT_PAGE."
"; } - + $list = $instance_table -> Get_list ($this -> DBHandle, $this -> FG_TABLE_CLAUSE, $this->FG_ORDER, $this->FG_SENS, null, null, $this -> FG_LIMITE_DISPLAY, $this -> CV_CURRENT_PAGE * $this -> FG_LIMITE_DISPLAY, $this -> SQL_GROUP); if ($this->FG_DEBUG == 3) echo "
Clause : ".$this -> FG_TABLE_CLAUSE; @@ -1248,9 +1248,9 @@ function perform_action (&$form_action){ $res_count = $instance_table -> SQLExec($this->DBHandle, "SELECT FOUND_ROWS() as count", 1); $this -> FG_NB_RECORD = $res_count[0][0]; } - + if ($this->FG_DEBUG >= 1) var_dump ($list); - + if ($this -> FG_NB_RECORD <=$this -> FG_LIMITE_DISPLAY){ $this -> FG_NB_RECORD_MAX = 1; }else{ @@ -1259,12 +1259,12 @@ function perform_action (&$form_action){ if ($this->FG_DEBUG == 3) echo "
Nb_record : ".$this -> FG_NB_RECORD ; if ($this->FG_DEBUG == 3) echo "
Nb_record_max : ".$this -> FG_NB_RECORD_MAX ; - + } else { - + $instance_table = new Table($this->FG_TABLE_NAME, $this->FG_QUERY_EDITION); $list = $instance_table -> Get_list ($this->DBHandle, $this->FG_EDITION_CLAUSE, null, null, null, null, 1, 0); - + //PATCH TO CLEAN THE IMPORT OF PASSWORD FROM THE DATABASE if ( substr_count($this->FG_QUERY_EDITION,"pwd_encoded")>0 ) { $tab_field = explode(',', $this->FG_QUERY_EDITION ) ; @@ -1274,19 +1274,19 @@ function perform_action (&$form_action){ } } } - + if (isset($list[0]["pwd_encoded"])) { - $list[0]["pwd_encoded"] = ""; + $list[0]["pwd_encoded"] = ""; } } - - if ($this->FG_DEBUG >= 2) print_r ($list); + + if ($this->FG_DEBUG >= 2) print_r ($list); } return $list; - + } - + /** * Function to prepare the clause from the session filter * @public @@ -1295,9 +1295,9 @@ function prepare_list_subselection($form_action) { $processed = $this->getProcessed(); - + if ( $form_action == "list" && $this->FG_FILTER_SEARCH_FORM) { - + if (isset($processed['cancelsearch']) && ($processed['cancelsearch'] == true)){ $_SESSION[$this->FG_FILTER_SEARCH_SESSION_NAME] = ''; } @@ -1314,7 +1314,7 @@ function prepare_list_subselection($form_action) } } } - + if (($processed['posted_search'] != 1 && isset($_SESSION[$this->FG_FILTER_SEARCH_SESSION_NAME]) && strlen($_SESSION[$this->FG_FILTER_SEARCH_SESSION_NAME])>10 )){ $arr_session_var = preg_split("/\|/", $_SESSION[$this->FG_FILTER_SEARCH_SESSION_NAME]); foreach ($arr_session_var as $arr_val){ @@ -1328,14 +1328,14 @@ function prepare_list_subselection($form_action) // Search Form On if (($processed['posted_search'] == 1 )) { - + $this->_processed[fromstatsday_sday] = normalize_day_of_month($processed[fromstatsday_sday], $processed[fromstatsmonth_sday],1); $this->_processed[tostatsday_sday] = normalize_day_of_month($processed[tostatsday_sday], $processed[tostatsmonth_sday],1); $this->_processed[fromstatsday_sday_bis] = normalize_day_of_month($processed[fromstatsday_sday_bis], $processed[fromstatsmonth_sday_bis],1); $this->_processed[tostatsday_sday_bis] = normalize_day_of_month($processed[tostatsday_sday_bis], $processed[tostatsmonth_sday_bis],1); - + $SQLcmd = ''; - + $search_parameters = "Period=$processed[Period]|frommonth=$processed[frommonth]|fromstatsmonth=$processed[fromstatsmonth]|tomonth=$processed[tomonth]"; $search_parameters .= "|tostatsmonth=$processed[tostatsmonth]|fromday=$processed[fromday]|fromstatsday_sday=$processed[fromstatsday_sday]"; $search_parameters .= "|fromstatsmonth_sday=$processed[fromstatsmonth_sday]|today=$processed[today]|tostatsday_sday=$processed[tostatsday_sday]"; @@ -1344,52 +1344,52 @@ function prepare_list_subselection($form_action) $search_parameters .= "|tostatsmonth_bis=$processed[tostatsmonth_bis]|fromday_bis=$processed[fromday_bis]|fromstatsday_sday_bis=$processed[fromstatsday_sday_bis]"; $search_parameters .= "|fromstatsmonth_sday_bis=$processed[fromstatsmonth_sday_bis]|today_bis=$processed[today_bis]|tostatsday_sday_bis=$processed[tostatsday_sday_bis]"; $search_parameters .= "|tostatsmonth_sday_bis=$processed[tostatsmonth_sday_bis]"; - - foreach ($this->FG_FILTER_SEARCH_FORM_1C as $r){ + + foreach ($this->FG_FILTER_SEARCH_FORM_1C as $r){ $search_parameters .= "|$r[1]=".$processed[$r[1]]."|$r[2]=".$processed[$r[2]]; $SQLcmd = $this->do_field($SQLcmd, $r[1],0,$processed); } - + foreach ($this->FG_FILTER_SEARCH_FORM_2C as $r){ $search_parameters .= "|$r[1]=".$processed[$r[1]]."|$r[2]=".$processed[$r[2]]; $search_parameters .= "|$r[3]=".$processed[$r[3]]."|$r[4]=".$processed[$r[4]]; $SQLcmd = $this->do_field_duration($SQLcmd,$r[1],$r[5]); $SQLcmd = $this->do_field_duration($SQLcmd,$r[3],$r[5]); } - + foreach ($this->FG_FILTER_SEARCH_FORM_SELECT as $r){ $search_parameters .= "|$r[2]=".$processed[$r[2]]; $SQLcmd = $this->do_field($SQLcmd, $r[2], 1,null,$r[4]); } - + $_SESSION[$this->FG_FILTER_SEARCH_SESSION_NAME] = $search_parameters; $date_clause = ''; - + if ($processed[fromday] && isset($processed[fromstatsday_sday]) && isset($processed[fromstatsmonth_sday])) $date_clause.=" AND ".$this->FG_FILTER_SEARCH_1_TIME_FIELD." >= TIMESTAMP('$processed[fromstatsmonth_sday]-$processed[fromstatsday_sday]')"; if ($processed[today] && isset($processed[tostatsday_sday]) && isset($processed[tostatsmonth_sday])) $date_clause.=" AND ".$this->FG_FILTER_SEARCH_1_TIME_FIELD." <= TIMESTAMP('$processed[tostatsmonth_sday]-".sprintf("%02d",intval($processed[tostatsday_sday])/*+1*/)." 23:59:59')"; - - + + if ($processed[Period]=="month_older_rad"){ $from_month = $processed[month_earlier]; $date_clause .= " AND DATE_SUB(NOW(),INTERVAL $from_month MONTH) > ".$this->FG_FILTER_SEARCH_3_TIME_FIELD.""; } - + //BIS FIELD if ($processed[fromday_bis] && isset($processed[fromstatsday_sday_bis]) && isset($processed[fromstatsmonth_sday_bis])) $date_clause.=" AND ".$this->FG_FILTER_SEARCH_1_TIME_FIELD_BIS." >= TIMESTAMP('$processed[fromstatsmonth_sday_bis]-$processed[fromstatsday_sday_bis]')"; if ($processed[today_bis] && isset($processed[tostatsday_sday_bis]) && isset($processed[tostatsmonth_sday_bis])) $date_clause.=" AND ".$this->FG_FILTER_SEARCH_1_TIME_FIELD_BIS." <= TIMESTAMP('$processed[tostatsmonth_sday_bis]-".sprintf("%02d",intval($processed[tostatsday_sday_bis])/*+1*/)." 23:59:59')"; - - + + if ($processed[Period_bis]=="month_older_rad") { $from_month = $processed[month_earlier_bis]; $date_clause .= " AND DATE_SUB(NOW(),INTERVAL $from_month MONTH) > ".$this->FG_FILTER_SEARCH_3_TIME_FIELD_BIS.""; } - - + + if (strpos($SQLcmd, 'WHERE') > 0) { if (strlen($this->FG_TABLE_CLAUSE)>0) $this->FG_TABLE_CLAUSE .=" AND "; $this -> FG_TABLE_CLAUSE .= substr($SQLcmd,6).$date_clause; @@ -1400,7 +1400,7 @@ function prepare_list_subselection($form_action) } } } - + /**************************************** Function to delete all pre selected records, This Function Gets the selected records and delete them from DB @@ -1417,45 +1417,45 @@ function Delete_Selected() /** * Function to perform the add action after inserting all data in required fields - * @public + * @public */ function perform_add (&$form_action) { include_once (FSROOT."lib/Class.Table.php"); - + $processed = $this->getProcessed(); //$processed['firstname'] - $this->VALID_SQL_REG_EXP = true; - + $this->VALID_SQL_REG_EXP = true; + for($i=0; $i < $this->FG_NB_TABLE_ADITION; $i++) { - + $pos = strpos($this->FG_TABLE_ADITION[$i][14], ":"); // SQL CUSTOM QUERY $pos_mul = strpos($this->FG_TABLE_ADITION[$i][4], "multiple"); - + if (!$pos) { - + $fields_name = $this->FG_TABLE_ADITION[$i][1]; $regexp = $this->FG_TABLE_ADITION[$i][5]; - + // FIND THE MULTIPLE SELECT if ($pos_mul && is_array($processed[$fields_name])) { - $total_mult_select=0; + $total_mult_select=0; foreach ($processed[$fields_name] as $value) { $total_mult_select += $value; } - - if ($this->FG_DEBUG == 1) echo "
$fields_name : ".$total_mult_select; - + + if ($this->FG_DEBUG == 1) echo "
$fields_name : ".$total_mult_select; + if ($i>0) $param_add_fields .= ", "; $param_add_fields .= $fields_name; if ($i>0) $param_add_value .= ", "; $param_add_value .= "'".addslashes(trim($total_mult_select))."'"; - + } else { // NO MULTIPLE SELECT - - // CHECK ACCORDING TO THE REGULAR EXPRESSION DEFINED - if (is_numeric($regexp) && !(strtoupper(substr($this->FG_TABLE_ADITION[$i][13],0,2))=="NO" && $processed[$fields_name]=="")) { - $this-> FG_fit_expression[$i] = preg_match("/".$this->FG_regular[$regexp][0]."/", $processed[$fields_name]); + + // CHECK ACCORDING TO THE REGULAR EXPRESSION DEFINED + if (is_numeric($regexp) && !(strtoupper(substr($this->FG_TABLE_ADITION[$i][13],0,2))=="NO" && $processed[$fields_name]=="")) { + $this-> FG_fit_expression[$i] = preg_match("/".$this->FG_regular[$regexp][0]."/", $processed[$fields_name]); if ($this->FG_DEBUG == 1) echo "
-> $fields_name => ".$this->FG_regular[$regexp][0]." , ".$processed[$fields_name]; if (!$this-> FG_fit_expression[$i]){ $this->VALID_SQL_REG_EXP = false; @@ -1492,31 +1492,31 @@ function perform_add (&$form_action) $arr_value_to_import[] = $arr_value_explode[0]; } } - + if (!is_null($processed[$fields_name]) && ($processed[$fields_name]!="") && ($this->FG_TABLE_ADITION[$i][4]!="disabled") ){ - if ($i>0) $param_add_fields .= ", "; + if ($i>0) $param_add_fields .= ", "; $param_add_fields .= str_replace('myfrom_', '', $fields_name); if ($i>0) $param_add_value .= ", "; - $param_add_value .= "'%TAGPREFIX%'"; + $param_add_value .= "'%TAGPREFIX%'"; } } else { if ($this->FG_DEBUG == 1) echo "
$fields_name : ".$processed[$fields_name]; if (!is_null($processed[$fields_name]) && ($processed[$fields_name]!="") && ($this->FG_TABLE_ADITION[$i][4]!="disabled") ){ if (strtoupper ($this->FG_TABLE_ADITION[$i][3]) != strtoupper("CAPTCHAIMAGE")) { - if ($i>0) $param_add_fields .= ", "; + if ($i>0) $param_add_fields .= ", "; $param_add_fields .= str_replace('myfrom_', '', $fields_name); if ($i>0) $param_add_value .= ", "; $param_add_value .= "'".addslashes(trim($processed[$fields_name]))."'"; } } } - } + } } } - + if (!is_null($this->FG_QUERY_ADITION_HIDDEN_FIELDS) && $this->FG_QUERY_ADITION_HIDDEN_FIELDS!=""){ - if ($i>0) $param_add_fields .= ", "; + if ($i>0) $param_add_fields .= ", "; $param_add_fields .= $this->FG_QUERY_ADITION_HIDDEN_FIELDS; if ($i>0) $param_add_value .= ", "; $split_hidden_fields_value = preg_split("/,/",trim($this->FG_QUERY_ADITION_HIDDEN_VALUE)); @@ -1525,24 +1525,24 @@ function perform_add (&$form_action) if($cur_hiddenFG_DEBUG == 1) echo "

$param_add_fields"; - if ($this->FG_DEBUG == 1) echo "

$param_add_value"; - + if ($this->FG_DEBUG == 1) echo "

$param_add_value"; + $res_funct = true; - + // CALL DEFINED FUNCTION BEFORE THE ADDITION - + if (strlen($this->FG_ADDITIONAL_FUNCTION_BEFORE_ADD)>0 && ($this->VALID_SQL_REG_EXP)) - $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_ADD)); - + $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_ADD)); + if ($res_funct) { - + $instance_table = new Table($this->FG_TABLE_NAME, $param_add_fields); // CHECK IF WE HAD FOUND A SPLITABLE FIELD THEN WE MIGHT HAVE %TAGPREFIX% if (strpos($param_add_value, '%TAGPREFIX%')) { foreach ($arr_value_to_import as $current_value) { - $param_add_value_replaced = str_replace("%TAGPREFIX%", $current_value, $param_add_value); + $param_add_value_replaced = str_replace("%TAGPREFIX%", $current_value, $param_add_value); if ($this->VALID_SQL_REG_EXP) $this -> RESULT_QUERY = $instance_table -> Add_table ($this->DBHandle, $param_add_value_replaced, null, null, $this->FG_TABLE_ID); } } else { @@ -1559,7 +1559,7 @@ function perform_add (&$form_action) $this->FG_ADITION_GO_EDITION = "yes-done"; } $id = $this -> RESULT_QUERY; - if ( !empty($id) && ($this->VALID_SQL_REG_EXP) && (isset($this->FG_GO_LINK_AFTER_ACTION_ADD))){ + if ( !empty($id) && ($this->VALID_SQL_REG_EXP) && (isset($this->FG_GO_LINK_AFTER_ACTION_ADD))){ if ($this->FG_DEBUG == 1) echo "
GOTO ; ".$this->FG_GO_LINK_AFTER_ACTION_ADD.$id; //echo "
GOTO ; ".$this->FG_GO_LINK_AFTER_ACTION_ADD.$id; Header ("Location: ".$this->FG_GO_LINK_AFTER_ACTION_ADD.$id); @@ -1567,8 +1567,8 @@ function perform_add (&$form_action) } } - - + + /** * Function to edit the fields * @public @@ -1576,35 +1576,35 @@ function perform_add (&$form_action) function perform_edit (&$form_action) { include_once (FSROOT."lib/Class.Table.php"); - + $processed = $this->getProcessed(); //$processed['firstname'] - + $this->VALID_SQL_REG_EXP = true; - + $instance_table = new Table($this->FG_TABLE_NAME, $this->FG_QUERY_EDITION); - + if ($processed['id']!="" || !is_null($processed['id'])){ $this->FG_EDITION_CLAUSE = str_replace("%id", $processed['id'], $this->FG_EDITION_CLAUSE); } - + for($i=0;$i<$this->FG_NB_TABLE_EDITION;$i++) { - - $pos = strpos($this->FG_TABLE_EDITION[$i][14], ":"); // SQL CUSTOM QUERY + + $pos = strpos($this->FG_TABLE_EDITION[$i][14], ":"); // SQL CUSTOM QUERY $pos_mul = strpos($this->FG_TABLE_EDITION[$i][4], "multiple"); if (!$pos){ - $fields_name = $this->FG_TABLE_EDITION[$i][1]; + $fields_name = $this->FG_TABLE_EDITION[$i][1]; $regexp = $this->FG_TABLE_EDITION[$i][5]; - + if ($pos_mul && is_array($processed[$fields_name])){ $total_mult_select=0; foreach ($processed[$fields_name] as $value){ $total_mult_select += $value; } if ($this->FG_DEBUG == 1) echo "
$fields_name : ".$total_mult_select; - if ($i>0) $param_update .= ", "; + if ($i>0) $param_update .= ", "; $param_update .= "$fields_name = '".addslashes(trim($total_mult_select))."'"; } else { - + if (is_numeric($regexp) && !(strtoupper(substr($this->FG_TABLE_ADITION[$i][13],0,2))=="NO" && $processed[$fields_name]=="") ) { $this-> FG_fit_expression[$i] = preg_match("/".$this->FG_regular[$regexp][0]."/", $processed[$fields_name]); if ($this->FG_DEBUG == 1) echo "
-> ".$this->FG_regular[$regexp][0]." , ".$processed[$fields_name]; @@ -1613,7 +1613,7 @@ function perform_edit (&$form_action) $form_action="ask-edit"; } } - + if ($this->FG_DEBUG == 1) echo "
$fields_name : ".$processed[$fields_name]; if ($i>0 && $this->FG_TABLE_EDITION[$i][3]!= "SPAN") $param_update .= ", "; if (empty($processed[$fields_name]) && strtoupper(substr($this->FG_TABLE_ADITION[$i][13],3,4))=="NULL"){ @@ -1624,73 +1624,73 @@ function perform_edit (&$form_action) } } } - + } else { if (strtoupper ($this->FG_TABLE_EDITION[$i][3])==strtoupper ("CHECKBOX")) { $table_split = preg_split("/:/",$this->FG_TABLE_EDITION[$i][1]); - $checkbox_data = $table_split[0]; //doc_tariff + $checkbox_data = $table_split[0]; //doc_tariff $instance_sub_table = new Table($table_split[0], $table_split[1].", ".$table_split[5]); - $SPLIT_FG_DELETE_CLAUSE = $table_split[5]."='".trim($processed['id'])."'"; + $SPLIT_FG_DELETE_CLAUSE = $table_split[5]."='".trim($processed['id'])."'"; $instance_sub_table -> Delete_table ($this -> DBHandle, $SPLIT_FG_DELETE_CLAUSE, $func_table = null); - + if (!is_array($processed[$checkbox_data])) { $snum=0; $this -> VALID_SQL_REG_EXP = false; $this-> FG_fit_expression[$i] = false; - } else { + } else { $snum = count($processed[$checkbox_data]); } - + $checkbox_data_tab = $processed[$checkbox_data]; for($j=0;$j<$snum;$j++){ $this -> RESULT_QUERY = $instance_sub_table -> Add_table ($this-> DBHandle, "'".addslashes(trim($checkbox_data_tab[$j]))."', '".addslashes(trim($processed['id']))."'", null, null); if (!$this -> RESULT_QUERY) { $findme = 'duplicate'; - $pos_find = strpos($instance_sub_table -> errstr, $findme); - + $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; + echo $instance_sub_table -> errstr; } else { //echo $FG_TEXT_ERROR_DUPLICATION; $alarm_db_error_duplication = true; - } - } + } + } } } - } + } } - + if (!is_null($this->FG_QUERY_EDITION_HIDDEN_FIELDS) && $this->FG_QUERY_EDITION_HIDDEN_FIELDS!=""){ - + $table_split_field = preg_split("/,/",$this->FG_QUERY_EDITION_HIDDEN_FIELDS); $table_split_value = preg_split("/,/",$this->FG_QUERY_EDITION_HIDDEN_VALUE); - + for($k=0;$kFG_ADDITIONAL_FUNCTION_BEFORE_EDITION)>0 && ($this->VALID_SQL_REG_EXP)) - $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_EDITION)); + $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_EDITION)); if ($this->FG_DEBUG == 1) echo "

PARAM_UPDATE: $param_update
".$this->FG_EDITION_CLAUSE; - + if ($this->VALID_SQL_REG_EXP) $this -> RESULT_QUERY = $instance_table -> Update_table ($this->DBHandle, $param_update, $this->FG_EDITION_CLAUSE, $func_table = null); - + if($this -> FG_ENABLE_LOG == 1) $this -> logger -> insertLog_Update($_SESSION["admin_id"], 3, "A ".strtoupper($this->FG_INSTANCE_NAME)." UPDATED" , "A RECORD IS UPDATED, EDITION CALUSE USED IS ".$this->FG_EDITION_CLAUSE, $this->FG_TABLE_NAME, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], $param_update); - + if ($this->FG_DEBUG == 1) echo $this -> RESULT_QUERY; // CALL DEFINED FUNCTION AFTER THE ACTION ADDITION if (strlen($this->FG_ADDITIONAL_FUNCTION_AFTER_EDITION)>0 && ($this->VALID_SQL_REG_EXP)) - $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_AFTER_EDITION)); - - if (($this->VALID_SQL_REG_EXP) && (isset($this->FG_GO_LINK_AFTER_ACTION_EDIT))) { + $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_AFTER_EDITION)); + + if (($this->VALID_SQL_REG_EXP) && (isset($this->FG_GO_LINK_AFTER_ACTION_EDIT))) { if ($this->FG_DEBUG == 1) echo "
GOTO ; ".$this->FG_GO_LINK_AFTER_ACTION_EDIT.$processed['id']; $ext_link =''; if(is_numeric($processed['current_page']))$ext_link.="¤t_page=".$processed['current_page']; @@ -1698,8 +1698,8 @@ function perform_edit (&$form_action) Header ("Location: ".$this->FG_GO_LINK_AFTER_ACTION_EDIT.$processed['id'].$ext_link); } } - - + + /** * Function to delete a record * @public @@ -1707,12 +1707,12 @@ function perform_edit (&$form_action) function perform_delete (&$form_action) { include_once (FSROOT."lib/Class.Table.php"); - + if (strlen($this -> FG_ADDITIONAL_FUNCTION_AFTER_DELETE) > 0) $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_AFTER_DELETE)); $processed = $this->getProcessed(); //$processed['firstname'] $this->VALID_SQL_REG_EXP = true; - + $instance_table = null; $tableCount = count($this -> FG_FK_TABLENAMES); $clauseCount = count($this -> FG_FK_EDITION_CLAUSE); @@ -1725,17 +1725,17 @@ function perform_delete (&$form_action) $instance_table = new Table($this->FG_TABLE_NAME, $this->FG_QUERY_EDITION); } $instance_table->FK_DELETE = ($this->FG_FK_WARNONLY ? false : true); - + if ($processed['id']!="" || !is_null($processed['id'])){ $this->FG_EDITION_CLAUSE = str_replace("%id", $processed['id'], $this->FG_EDITION_CLAUSE); } - + $this -> RESULT_QUERY = $instance_table -> Delete_table ($this->DBHandle, $this->FG_EDITION_CLAUSE, $func_table = null); if($this -> FG_ENABLE_LOG == 1) { $this -> logger -> insertLog($_SESSION["admin_id"], 3, "A ".strtoupper($this->FG_INSTANCE_NAME)." DELETED" , "A RECORD IS DELETED, EDITION CLAUSE USED IS ".$this->FG_EDITION_CLAUSE, $this->FG_TABLE_NAME, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], $param_update); - } + } if (!$this -> RESULT_QUERY) echo gettext("error deletion"); - + $this->FG_INTRO_TEXT_DELETION = str_replace("%id", $processed['id'], $this->FG_INTRO_TEXT_DELETION); $this->FG_INTRO_TEXT_DELETION = str_replace("%table", $this->FG_TABLE_NAME, $this->FG_INTRO_TEXT_DELETION); if (isset($this->FG_GO_LINK_AFTER_ACTION_DELETE)) { @@ -1751,7 +1751,7 @@ function perform_delete (&$form_action) } } } - + } /* @@ -1784,18 +1784,18 @@ function perform_add_content($sub_action,$id) { $processed = $this->getProcessed(); $table_split = preg_split("/:/",$this->FG_TABLE_EDITION[$sub_action][14]); - $instance_sub_table = new Table($table_split[0], $table_split[1].", ".$table_split[5]); - + $instance_sub_table = new Table($table_split[0], $table_split[1].", ".$table_split[5]); + if (is_array($processed[$table_split[1]])) { foreach($processed[$table_split[1]] as $value) { if (empty($table_split[12]) || preg_match("/".$this->FG_regular[$table_split[12]][0]."/", $value)){ // RESPECT REGULAR EXPRESSION $result_query = $instance_sub_table -> Add_table ($this->DBHandle, "'".addslashes(trim($value))."', '".addslashes(trim($id))."'", null, null); - + if (!$result_query) { $findme = 'duplicate'; $pos_find = strpos($instance_sub_table -> errstr, $findme); - + if ($pos_find === false) { echo $instance_sub_table -> errstr; } else { @@ -1809,12 +1809,12 @@ function perform_add_content($sub_action,$id) if (empty($table_split[12]) || preg_match("/".$this->FG_regular[$table_split[12]][0]."/", $value)) { // RESPECT REGULAR EXPRESSION $result_query = $instance_sub_table -> Add_table ($this->DBHandle, "'".addslashes(trim($value))."', '".addslashes(trim($id))."'", null, null); - + if (!$result_query) { - + $findme = 'duplicate'; $pos_find = strpos($instance_sub_table -> errstr, $findme); - + if ($pos_find === false) { echo $instance_sub_table -> errstr; } else { @@ -1829,7 +1829,7 @@ function perform_add_content($sub_action,$id) /** * Function to del_content - * @public + * @public */ function perform_del_content($sub_action,$id) { @@ -1840,15 +1840,15 @@ function perform_del_content($sub_action,$id) } else { $value = trim($processed[$table_split[1]]); } - $instance_sub_table = new Table($table_split[0], $table_split[1].", ".$table_split[5]); + $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); - } - - + } + + /** * Function to create the top page section - * @public + * @public */ function create_toppage ($form_action) { @@ -1856,43 +1856,43 @@ function create_toppage ($form_action) if ($form_action=="ask-edit" || $form_action=="edit" || $form_action == "add-content" || $form_action == "del-content"){ ?> - -
- - FG_ADITION_GO_EDITION == "yes-done") echo ''.$this->FG_ADITION_GO_EDITION_MESSAGE.'

'; - if ($alarm_db_error_duplication){ +
+ + FG_ADITION_GO_EDITION == "yes-done") echo ''.$this->FG_ADITION_GO_EDITION_MESSAGE.'

'; + if ($alarm_db_error_duplication){ echo ''.gettext("ERROR_DUPLICATION").' ::'.$this->FG_TEXT_ERROR_DUPLICATION.''; - }else{ + }else{ echo $this->FG_INTRO_TEXT_EDITION; } ?>
- + FG_INTRO_TEXT_ADITION)>1){ ?> -
+

FG_INTRO_TEXT_ADITION?>

- '; } } - } - - + } + + /** * CREATE_ACTIONFINISH : Function to display result - * @public + * @public */ function create_actionfinish ($form_action) { @@ -1900,25 +1900,25 @@ function create_actionfinish ($form_action) ?> - +
+ - FG_INSTANCE_NAME?> Deletion + FG_INSTANCE_NAME?> Deletion INSERT NEW FG_INSTANCE_NAME?> -

-
- + FG_INTRO_TEXT_DELETION; - } elseif ($form_action == "add") { + } elseif ($form_action == "add") { if(!empty($this -> RESULT_QUERY)) { echo $this->FG_TEXT_ADITION_CONFIRMATION; } else { echo $this->FG_TEXT_ADITION_ERROR; - } + } } ?>
@@ -1926,8 +1926,8 @@ function create_actionfinish ($form_action)
-




-



+ -




+




Get_list ($this->DBHandle, $FG_TABLE_CLAUSE, "tariffgroupname", "ASC", null, null, null, null); - + ?>
FG_TOP_FILTER_NAME)) echo "$this->FG_TOP_FILTER_NAME
"; ?> - +
- +
   @@ -2001,7 +2001,7 @@ function create_select_form() - + @@ -2014,7 +2014,7 @@ function create_select_form()
- +
@@ -2023,8 +2023,8 @@ function create_select_form() FG_TOP_FILTER_NAME)) echo "".gettext("THE CURRENT RATECARD")." : $this->FG_TOP_FILTER_NAME"; ?>

  - + - +
   @@ -2075,11 +2075,11 @@ function create_select_form_client($table_cluase = "")
- +
getProcessed(); - + $cur = 0; foreach ($this->FG_FILTER_SEARCH_FORM_SELECT as $select) { // If is a sql_type @@ -2104,7 +2104,7 @@ function create_search_form() } include ("Class.SearchHandler.inc__vt.php"); } - + /** * Function to create the form * @public @@ -2114,49 +2114,49 @@ function create_form ($form_action, $list, $id=null) Console::logSpeed('Time taken to get to line '.__LINE__); include_once (FSROOT."lib/Class.Table.php"); $processed = $this->getProcessed(); - + $id = $processed['id']; $atmenu = $processed['atmenu']; $stitle = $processed['stitle']; $ratesort = $processed['ratesort']; $sub_action = $processed['sub_action']; - + switch ($form_action) { case "add-content": $this->perform_add_content($sub_action,$id); include('Class.FormHandler.EditForm.inc.php'); break; - + case "del-content": $this->perform_del_content($sub_action,$id); include('Class.FormHandler.EditForm.inc.php'); break; - + case "ask-edit": case "edit": include('Class.FormHandler.EditForm.inc.php'); break; - - case "ask-add": + + case "ask-add": include('Class.FormHandler.AddForm.inc.php'); break; - + case "ask-delete": case "ask-del-confirm": if (strlen($this -> FG_ADDITIONAL_FUNCTION_BEFORE_DELETE) > 0) $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_DELETE)); include('Class.FormHandler.DelForm.inc.php'); break; - + case "list": include('Class.ViewHandler.inc.php'); break; - + case "delete": case "add": $this -> create_actionfinish($form_action); break; - + default: $this -> create_custom($form_action); } @@ -2189,25 +2189,25 @@ function printPages($page, $pages, $url, $max_width = 20) $temp = str_replace('%s', $page - 1-1, $url); echo "{$this->lang['strprev']}\n"; } - - if ($page <= $window) { - $min_page = 1; - $max_page = min(2 * $window, $pages); + + if ($page <= $window) { + $min_page = 1; + $max_page = min(2 * $window, $pages); } - elseif ($page > $window && $pages >= $page + $window) { - $min_page = ($page - $window) + 1; - $max_page = $page + $window; + elseif ($page > $window && $pages >= $page + $window) { + $min_page = ($page - $window) + 1; + $max_page = $page + $window; } - else { - $min_page = ($page - (2 * $window - ($pages - $page))) + 1; - $max_page = $pages; + else { + $min_page = ($page - (2 * $window - ($pages - $page))) + 1; + $max_page = $pages; } - + // Make sure min_page is always at least 1 // and max_page is never greater than $pages $min_page = max($min_page, 1); $max_page = min($max_page, $pages); - + for ($i = $min_page; $i <= $max_page; $i++) { $temp = str_replace('%s', $i-1, $url); if ($i != $page) echo "$i\n"; diff --git a/addons/contrib/villagetelco/gui/common/lib/Misc__vt.php b/addons/contrib/villagetelco/gui/common/lib/Misc__vt.php index 9f84ce44a..81a0fe4d3 100644 --- a/addons/contrib/villagetelco/gui/common/lib/Misc__vt.php +++ b/addons/contrib/villagetelco/gui/common/lib/Misc__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -218,9 +218,9 @@ function write_log($logfile, $output) } /* - * function cleanInput + * function sanitize_tag */ -function cleanInput($input) +function sanitize_tag($input) { $search = array ( '@]*?>.*?@si', // Strip out javascript @@ -261,7 +261,7 @@ function sanitize_data($input) if (get_magic_quotes_gpc()) { $input = stripslashes($input); } - $input = cleanInput($input); + $input = sanitize_tag($input); $output = addslashes($input); } diff --git a/addons/contrib/villagetelco/gui/common/lib/admin.defines__vt.php b/addons/contrib/villagetelco/gui/common/lib/admin.defines__vt.php index 5e671f54b..628bc2124 100644 --- a/addons/contrib/villagetelco/gui/common/lib/admin.defines__vt.php +++ b/addons/contrib/villagetelco/gui/common/lib/admin.defines__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -42,7 +42,6 @@ include_once (FSROOT."lib/interface/constants.php"); include_once (dirname(__FILE__)."/Class.A2Billing.php"); -require_once 'adodb/adodb.inc.php'; // AdoDB include_once (dirname(__FILE__)."/Class.Table.php"); include_once (dirname(__FILE__)."/Class.Connection.php"); include_once (dirname(__FILE__)."/Class.Realtime.php"); diff --git a/addons/contrib/villagetelco/gui/common/lib/admin.module.access__vt.php b/addons/contrib/villagetelco/gui/common/lib/admin.module.access__vt.php index 7f018a744..be774afc1 100644 --- a/addons/contrib/villagetelco/gui/common/lib/admin.module.access__vt.php +++ b/addons/contrib/villagetelco/gui/common/lib/admin.module.access__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/gui/common/lib/admin.smarty__vt.php b/addons/contrib/villagetelco/gui/common/lib/admin.smarty__vt.php index 827ecb828..7d03dbc0e 100644 --- a/addons/contrib/villagetelco/gui/common/lib/admin.smarty__vt.php +++ b/addons/contrib/villagetelco/gui/common/lib/admin.smarty__vt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -31,6 +31,8 @@ * **/ +use Factory\SmartyFactory; + error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); define( 'FULL_PATH', dirname(__FILE__) . '/' ); @@ -38,8 +40,7 @@ define( 'TEMPLATE_DIR', '../Public/templates/' ); define( 'TEMPLATE_C_DIR', '../templates_c/' ); -require_once SMARTY_DIR . 'Smarty.class.php'; -$smarty = new Smarty; +$smarty = SmartyFactory::getInstance(); $skin_name = $_SESSION["stylefile"]; diff --git a/addons/contrib/villagetelco/provisioning/a2billing_provisioning.php b/addons/contrib/villagetelco/provisioning/a2billing_provisioning.php index 99090f81e..038d6d76e 100644 --- a/addons/contrib/villagetelco/provisioning/a2billing_provisioning.php +++ b/addons/contrib/villagetelco/provisioning/a2billing_provisioning.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/villagetelco/provisioning/originate_echo.php b/addons/contrib/villagetelco/provisioning/originate_echo.php index e0f2ef19c..8ad06e5b8 100644 --- a/addons/contrib/villagetelco/provisioning/originate_echo.php +++ b/addons/contrib/villagetelco/provisioning/originate_echo.php @@ -9,7 +9,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/addons/contrib/wordpress/a2billing.zip b/addons/contrib/wordpress/a2billing.zip new file mode 100644 index 000000000..2cf80cb23 Binary files /dev/null and b/addons/contrib/wordpress/a2billing.zip differ diff --git a/addons/debian/install_debian.sh b/addons/debian/install_debian.sh new file mode 100644 index 000000000..21eeea8cc --- /dev/null +++ b/addons/debian/install_debian.sh @@ -0,0 +1,74 @@ +# +# Minimalist Install on Debian 7.4 +# +# +# This scripts only install the A2Billing Web UI and Asterisk +# It doesn't include realtime, callback, security +# +# WARNING: Don't use this script for production deployment, this is intended for development purpose +# + +apt-get update +apt-get -y upgrade + +apt-get -y install asterisk +apt-get -y install mysql-client mysql-server apache2 libapache2-mod-php5 php5-mysql vim-tiny +apt-get -y install php-pear php-db php5-gd php5-curl php-soap + +mkdir -p /usr/share/a2billing/latest/ +cd /usr/share/a2billing/ +wget -O master.tar.gz --no-check-certificate https://codeload.github.com/Star2Billing/a2billing/tar.gz/master +tar zxf master.tar.gz +mv a2billing-master/* /usr/share/a2billing/latest/ +rm -rf a2billing-master master.tar.gz + +chmod u+xwr /usr/share/a2billing/latest/admin/templates_c +chmod a+w /usr/share/a2billing/latest/admin/templates_c +chmod u+xwr /usr/share/a2billing/latest/agent/templates_c +chmod a+w /usr/share/a2billing/latest/agent/templates_c +chmod u+xwr /usr/share/a2billing/latest/customer/templates_c +chmod a+w /usr/share/a2billing/latest/customer/templates_c + +rm -rf /usr/share/a2billing/latest/admin/templates_c/* +rm -rf /usr/share/a2billing/latest/agent/templates_c/* +rm -rf /usr/share/a2billing/latest/customer/templates_c/* + +# copy conf files +cp /usr/share/a2billing/latest//a2billing.conf /etc/a2billing.conf + +cd /etc/apache2/sites-enabled/ +wget https://raw.github.com/Star2Billing/a2billing/develop/addons/apache2/a2billing_admin.conf +wget https://raw.github.com/Star2Billing/a2billing/develop/addons/apache2/a2billing_customer.conf + +ln -s /usr/share/a2billing/latest/AGI/a2billing.php /usr/share/asterisk/agi-bin/a2billing.php +chown asterisk:asterisk /usr/share/asterisk/agi-bin/a2billing.php +chmod +x /usr/share/asterisk/agi-bin/a2billing.php + +# Install Audio files +cd /usr/share/a2billing/latest/addons/sounds +./install_a2b_sounds.sh +#set ownership on sounds +chown -R asterisk:asterisk /usr/share/asterisk/ + +cd /etc/asterisk +wget -O extensions_a2billing.conf https://raw.github.com/Star2Billing/a2billing/develop/addons/asterisk-conf/extensions_a2billing_1_8.conf + +#include "extensions_a2billing.conf" +echo "Adding A2Billing extensions to /etc/asterisk/extensions.conf" +echo ' +; include a2billing extension +#include extensions_a2billing.conf +' >> /etc/asterisk/extensions.conf + +#Install A2billing DB +/etc/init.d/mysql start +mysql -uroot -ppassword -e "CREATE DATABASE a2billing_db;" +cd /usr/share/a2billing/latest/DataBase/mysql-5.x +bash install-db.sh + +sed -i "s/a2billing_dbuser/root/g" /etc/a2billing.conf +sed -i "s/a2billing_dbpassword/password/g" /etc/a2billing.conf +sed -i "s/a2billing_dbname/a2billing_db/g" /etc/a2billing.conf + +/etc/init.d/mysql restart +/etc/init.d/apache2 restart diff --git a/admin/Public/A2B_admin_info.php b/admin/Public/A2B_admin_info.php old mode 100644 new mode 100755 index f6d728c38..982bf7e00 --- a/admin/Public/A2B_admin_info.php +++ b/admin/Public/A2B_admin_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_agent_home.php b/admin/Public/A2B_agent_home.php old mode 100644 new mode 100755 index a1219979e..1ed1852b8 --- a/admin/Public/A2B_agent_home.php +++ b/admin/Public/A2B_agent_home.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -62,7 +62,7 @@ $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"; + $values="$id,$type,$message,$count,$logo"; $return=$instance_table->Add_table($DBHandle, $values, $fields); if($return)$result_param ="success"; else $result_param ="faild"; @@ -93,7 +93,7 @@ $clause = "id = $id_msg"; $instance_table = new Table("cc_message_agent","*"); if(empty($logo))$logo=0; - $values="type = $type, message ='".addslashes($_POST['message'])."',logo = $logo"; + $values="type = $type, message = '$message',logo = $logo"; $return=$instance_table -> Update_table($DBHandle, $values, $clause); if($return)$result_param ="success"; else $result_param ="faild"; @@ -174,7 +174,7 @@ ?>
- + @@ -223,7 +223,6 @@ -
0) { ?> @@ -249,7 +248,6 @@ }); $(document).ready(function () { - $('.msg_info , .msg_success , .msg_warning , .msg_error').mouseover(function () { $(this).children(".up,.down,.delete,.edit").show(); }); diff --git a/admin/Public/A2B_agent_info.php b/admin/Public/A2B_agent_info.php old mode 100644 new mode 100755 index 473bf99a6..57bf3b414 --- a/admin/Public/A2B_agent_info.php +++ b/admin/Public/A2B_agent_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_asteriskinfo.php b/admin/Public/A2B_asteriskinfo.php old mode 100644 new mode 100755 index e878ed210..21427789c --- a/admin/Public/A2B_asteriskinfo.php +++ b/admin/Public/A2B_asteriskinfo.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -158,8 +158,8 @@ foreach ($modes as $mode => $value) { $i++; if ($i > 1) echo " | "; - //echo "
  • "._($value)."
  • "; - echo ""._($value).""; + //echo "
  • "._($value)."
  • "; + echo ""._($value).""; } ?>
    @@ -167,7 +167,7 @@

    - +
    diff --git a/admin/Public/A2B_call_archiving.php b/admin/Public/A2B_call_archiving.php old mode 100644 new mode 100755 index d27019f2a..847851586 --- a/admin/Public/A2B_call_archiving.php +++ b/admin/Public/A2B_call_archiving.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -183,8 +183,16 @@
    - - + + FG_CSRF_STATUS == true) { + ?> + + +
    diff --git a/admin/Public/A2B_card_info.php b/admin/Public/A2B_card_info.php index 2401fe4c6..31fe64483 100644 --- a/admin/Public/A2B_card_info.php +++ b/admin/Public/A2B_card_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -841,7 +841,7 @@ } $call_table = new Table('cc_call,cc_prefix','*'); -$call_clause = "card_id = ".$id." AND cc_call.destination = cc_prefix.prefix"; +$call_clause = "card_id = ".$id." AND CAST(cc_call.destination AS CHAR) = cc_prefix.prefix"; $call_result = $call_table -> Get_list($DBHandle, $call_clause, 'starttime', 'DESC', NULL, NULL, 10, 0); if (sizeof($call_result)>0 && $call_result[0]!=null) { ?> diff --git a/admin/Public/A2B_currencies.php b/admin/Public/A2B_currencies.php old mode 100644 new mode 100755 index 57f99bac9..e07ac43bf --- a/admin/Public/A2B_currencies.php +++ b/admin/Public/A2B_currencies.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -50,10 +50,11 @@ /********************************* BATCH UPDATE CURRENCY TABLE ***********************************/ $A2B -> DBHandle = $HD_Form -> DBHandle; -if ($updatecurrency == 1) { +if ($updatecurrency == 1) { + // Check demo mode check_demo_mode(); - + // Update Currencies $instance_table = new Table(); $A2B -> set_instance_table ($instance_table); $return = currencies_update_yahoo($A2B -> DBHandle, $A2B -> instance_table); @@ -78,8 +79,16 @@ ?>
    - + + FG_CSRF_STATUS == true) { + ?> + + +
      : diff --git a/admin/Public/A2B_data_archiving.php b/admin/Public/A2B_data_archiving.php old mode 100644 new mode 100755 index 53f904701..a845bcf5d --- a/admin/Public/A2B_data_archiving.php +++ b/admin/Public/A2B_data_archiving.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -227,23 +227,32 @@ ?>
    - - - - + + +
    -    + FG_CSRF_STATUS == true) { + ?> + + + + + + + +
    +    + + + - - -
    + - - -
    - -
    +
    diff --git a/admin/Public/A2B_detail_package.php b/admin/Public/A2B_detail_package.php old mode 100644 new mode 100755 index b16b501fe..29290e185 --- a/admin/Public/A2B_detail_package.php +++ b/admin/Public/A2B_detail_package.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -190,7 +190,7 @@
    -
    + diff --git a/admin/Public/A2B_entity_agent.php b/admin/Public/A2B_entity_agent.php old mode 100644 new mode 100755 index 73a38d3ef..bae9b51a0 --- a/admin/Public/A2B_entity_agent.php +++ b/admin/Public/A2B_entity_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -68,14 +68,11 @@ if ($popup_select) { ?> * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_alarm.php b/admin/Public/A2B_entity_alarm.php old mode 100644 new mode 100755 index 87d5a4dfa..2a2ccd068 --- a/admin/Public/A2B_entity_alarm.php +++ b/admin/Public/A2B_entity_alarm.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_autorefill.php b/admin/Public/A2B_entity_autorefill.php old mode 100644 new mode 100755 index 22412edaf..4228de749 --- a/admin/Public/A2B_entity_autorefill.php +++ b/admin/Public/A2B_entity_autorefill.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_backup.php b/admin/Public/A2B_entity_backup.php old mode 100644 new mode 100755 index bd5bf6d25..aad0b1e4c --- a/admin/Public/A2B_entity_backup.php +++ b/admin/Public/A2B_entity_backup.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_billing_customer.php b/admin/Public/A2B_entity_billing_customer.php index 3d111664d..5a00db5ae 100755 --- a/admin/Public/A2B_entity_billing_customer.php +++ b/admin/Public/A2B_entity_billing_customer.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_call.php b/admin/Public/A2B_entity_call.php old mode 100644 new mode 100755 index 1bceca74b..9bd4e18b9 --- a/admin/Public/A2B_entity_call.php +++ b/admin/Public/A2B_entity_call.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_callback.php b/admin/Public/A2B_entity_callback.php old mode 100644 new mode 100755 index 68c82ddca..40cd953ec --- a/admin/Public/A2B_entity_callback.php +++ b/admin/Public/A2B_entity_callback.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_callerid.php b/admin/Public/A2B_entity_callerid.php old mode 100644 new mode 100755 index 6a558fb2b..80925ec92 --- a/admin/Public/A2B_entity_callerid.php +++ b/admin/Public/A2B_entity_callerid.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_campaign.php b/admin/Public/A2B_entity_campaign.php old mode 100644 new mode 100755 index c7ebe28f0..a5957bb48 --- a/admin/Public/A2B_entity_campaign.php +++ b/admin/Public/A2B_entity_campaign.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -33,8 +33,6 @@ include '../lib/admin.defines.php'; include '../lib/admin.module.access.php'; -include '../lib/Form/Class.FormHandler.inc.php'; -include './form_data/FG_var_campaign.inc'; include '../lib/admin.smarty.php'; if (! has_rights (ACX_PREDICTIVE_DIALER)) { @@ -43,28 +41,15 @@ die(); } -$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; - -$list = $HD_Form -> perform_action($form_action); // #### HEADER SECTION $smarty->display('main.tpl'); -// #### HELP SECTION -echo $CC_help_campaign; - -// #### TOP SECTION PAGE -$HD_Form -> create_toppage ($form_action); -$HD_Form -> create_form ($form_action, $list, $id=null) ; +echo "

    "; +echo "
    Campaigns and Voice Broadcasting is obsolete in A2Billing, and has been replaced by Newfies-Dialer.
    "; +echo '
    More information at http://www.newfies-dialer.org/


    '; // #### FOOTER SECTION $smarty->display('footer.tpl'); diff --git a/admin/Public/A2B_entity_card.php b/admin/Public/A2B_entity_card.php index 2bb7f6bcc..8d2769e0d 100644 --- a/admin/Public/A2B_entity_card.php +++ b/admin/Public/A2B_entity_card.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -47,26 +47,29 @@ $HD_Form -> init(); /********************************* BATCH UPDATE ***********************************/ -getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname', 'upd_inuse', 'upd_status', 'upd_language', 'upd_tariff', 'upd_credit', - 'upd_credittype', 'upd_simultaccess', 'upd_currency', 'upd_typepaid', 'upd_creditlimit', 'upd_enableexpire', 'upd_expirationdate', - 'upd_expiredays', 'upd_runservice', 'upd_runservice', 'batchupdate', 'check', 'type', 'mode', 'addcredit', 'cardnumber','description', - 'upd_id_group','upd_discount','upd_refill_type','upd_description','upd_id_seria', 'upd_vat', 'upd_country')); +getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname', 'upd_inuse', 'upd_status', 'upd_language', + 'upd_tariff', 'upd_credit', 'upd_credittype', 'upd_simultaccess', 'upd_currency', 'upd_typepaid', + 'upd_creditlimit', 'upd_enableexpire', 'upd_expirationdate', 'upd_expiredays', 'upd_runservice', + 'upd_runservice', 'batchupdate', 'check', 'type', 'mode', 'addcredit', 'cardnumber','description', + 'upd_id_group','upd_discount','upd_refill_type','upd_description','upd_id_seria', 'upd_vat', + 'upd_country')); // CHECK IF REQUEST OF BATCH UPDATE if ($batchupdate == 1 && is_array($check)) { $SQL_REFILL=""; $HD_Form->prepare_list_subselection('list'); - if (isset($check['upd_credit'])||(strlen(trim($upd_credit))>0)) {//set to refil + if (isset($check['upd_credit']) || (strlen(trim($upd_credit)) > 0)) { + //set to refill $SQL_REFILL_CREDIT=""; $SQL_REFILL_WHERE=""; if ($type["upd_credit"] == 1) {//equal $SQL_REFILL_CREDIT="($upd_credit -credit) "; $SQL_REFILL_WHERE=" AND $upd_credit<>credit ";//never write 0 refill } elseif ($type["upd_credit"] == 2) {//+- - $SQL_REFILL_CREDIT="($upd_credit) "; + $SQL_REFILL_CREDIT="($upd_credit) "; } else { - $SQL_REFILL_CREDIT="(-$upd_credit) "; + $SQL_REFILL_CREDIT="(-$upd_credit) "; } $SQL_REFILL="INSERT INTO cc_logrefill (credit,card_id,description,refill_type) SELECT $SQL_REFILL_CREDIT,a.id,'$upd_description','$upd_refill_type' from ".$HD_Form->FG_TABLE_NAME." as a "; @@ -150,17 +153,13 @@ if ($popup_select) { ?> create_search_form(); @@ -218,256 +218,264 @@ function sendValue(selvalue, othervalue)
      FG_NB_RECORD ?>   -
    - - - - - - - - - - + + + + + + + +
    - > - - 1)  : - -
    -
    - > - - 2)  : - + + + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - -
    + > + + 1)  : + +
    +
    + > + + 2)  : +
    +
    + > + + 3)  : + +
    + > + + 4)  : +
    -
    - > - - 3)  : -
    +
    + > + + + 5)  : + + + checked> + checked> + checked> +
       Refill: + Description
    + +
    + > + + 6)  : + +
    + > + + 7)  : + +
    + > + + + 8)  : + + + checked> + checked> + checked> + +
    + > + + 9)  : + -
    - > - - 4)  : -
    + > + + + 10)  : + > +
    + > + + 11)  : + +
    +
    + > + + 12)  : + + checked> + checked> + +
    + > + + 13)  : +
    -
    - > - - - 5)  : - - - checked> - checked> - checked> -
       Refill: -
    +
    + > + + 14)  : +
    +
    + > + + 15)  : + Description
    - -
    - > - - 6)  : - -
    - > - - 7)  : - -
    - > - - - 8)  : - - - checked> - checked> - checked> - -
    - > - - 9)  : - -
    - > - - - 10)  : - > -
    - > - - 11)  : - -
    +
    - > - - 12)  : - - checked> - checked> - -
    - > - - 13)  : -
    -
    - > - - 14)  : -
    + > + + 16)  : + +
    +
    + > + + 17)  : +
    -
    - > - - 15)  : -
    -
    - > - - 16)  : - -
    -
    - > - - 17)  : -
    -
    - " type="submit"> -
    +
    +
    + " type="submit"> +
    @@ -476,10 +484,18 @@ function sendValue(selvalue, othervalue) } // END if ($form_action == "list") ?> - + + FG_CSRF_STATUS == true) { + ?> + + +
    diff --git a/admin/Public/A2B_entity_card_group.php b/admin/Public/A2B_entity_card_group.php index 0ebaaa46e..4bf8f63d0 100755 --- a/admin/Public/A2B_entity_card_group.php +++ b/admin/Public/A2B_entity_card_group.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_card_multi.php b/admin/Public/A2B_entity_card_multi.php index 6bbc82cff..62c5b4e6f 100644 --- a/admin/Public/A2B_entity_card_multi.php +++ b/admin/Public/A2B_entity_card_multi.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -45,7 +45,7 @@ getpost_ifset(array('nb_to_create', 'creditlimit', 'cardnum', 'addcredit', 'choose_tariff', 'gen_id', 'cardnum', 'choose_simultaccess', 'choose_currency', 'choose_typepaid', 'creditlimit', 'enableexpire', 'expirationdate', 'expiredays', 'runservice', 'sip', 'iax', - 'cardnumberlenght_list', 'tag', 'id_group', 'discount', 'id_seria', 'id_didgroup', 'vat', 'id_country')); + 'cardnumberlenght_list', 'tag', 'id_group', 'discount', 'id_seria', 'id_didgroup', 'vat', 'id_country', 'useralias_next')); $HD_Form->FG_FILTER_SEARCH_FORM = false; $HD_Form->FG_EDITION = false; @@ -108,6 +108,13 @@ $msg_error .= "
    "; $msg_error .= gettext("- Choose the number of customers that you want generate!"); } + if (!empty($useralias_next) && !is_numeric($useralias_next)) { + $nb_error++; + $number_error = true; + if (!empty ($msg_error)) + $msg_error .= "
    "; + $msg_error .= gettext("- User alias should be a number!"); + } } $nbcard = $nb_to_create; if ($nbcard > 0 && $action == "generate" && $nb_error == 0) { @@ -144,7 +151,7 @@ $instance_refill_table = new Table("cc_logrefill", $field_insert_refill); for ($k = 0; $k < $nbcard; $k++) { - $arr_card_alias = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list); + $arr_card_alias = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list, null, $useralias_next); $accountnumber = $arr_card_alias[0]; $useralias = $arr_card_alias[1]; if (!is_numeric($addcredit)) @@ -233,7 +240,15 @@ - + +FG_CSRF_STATUS == true) { +?> + + + diff --git a/admin/Public/A2B_entity_card_seria.php b/admin/Public/A2B_entity_card_seria.php old mode 100644 new mode 100755 index 48702e570..78898284b --- a/admin/Public/A2B_entity_card_seria.php +++ b/admin/Public/A2B_entity_card_seria.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_charge.php b/admin/Public/A2B_entity_charge.php old mode 100644 new mode 100755 index b7b3ae96f..5244f3867 --- a/admin/Public/A2B_entity_charge.php +++ b/admin/Public/A2B_entity_charge.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_commission_agent.php b/admin/Public/A2B_entity_commission_agent.php index 9a62c5651..cbdc05873 100755 --- a/admin/Public/A2B_entity_commission_agent.php +++ b/admin/Public/A2B_entity_commission_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_config.php b/admin/Public/A2B_entity_config.php old mode 100644 new mode 100755 index 1f879407e..fc6d2479d --- a/admin/Public/A2B_entity_config.php +++ b/admin/Public/A2B_entity_config.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -44,7 +44,7 @@ die(); } -$HD_Form -> setDBHandler (DbConnect()); +$HD_Form -> setDBHandler(DbConnect()); $HD_Form -> init(); if ($id!="" || !is_null($id)) { @@ -72,17 +72,15 @@ ?>
    + + FG_CSRF_STATUS == true) { + ?> + + +
    1) @@ -315,7 +330,7 @@
    /exclamation.png" /> +
    + 21) + : > +
    diff --git a/admin/Public/A2B_entity_config_generate_confirm.php b/admin/Public/A2B_entity_config_generate_confirm.php old mode 100644 new mode 100755 index 76ca4ccf0..98440bdfd --- a/admin/Public/A2B_entity_config_generate_confirm.php +++ b/admin/Public/A2B_entity_config_generate_confirm.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_config_group.php b/admin/Public/A2B_entity_config_group.php old mode 100644 new mode 100755 index bbedee707..9b4a3fe05 --- a/admin/Public/A2B_entity_config_group.php +++ b/admin/Public/A2B_entity_config_group.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_def_ratecard.php b/admin/Public/A2B_entity_def_ratecard.php old mode 100644 new mode 100755 index ad6834425..e9a2d51d8 --- a/admin/Public/A2B_entity_def_ratecard.php +++ b/admin/Public/A2B_entity_def_ratecard.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -48,7 +48,7 @@ /********************************* BATCH UPDATE ***********************************/ getpost_ifset(array ( 'batchupdate', 'upd_id_trunk', 'upd_idtariffplan', 'upd_id_outbound_cidgroup', 'upd_tag', 'upd_inuse', 'upd_activated', 'upd_language', 'upd_tariff', 'upd_credit', 'upd_credittype', 'upd_simultaccess', 'upd_currency', 'upd_typepaid', 'upd_creditlimit', 'upd_enableexpire', 'upd_expirationdate', - 'upd_expiredays', 'upd_runservice', 'filterprefix', 'filterfield' + 'upd_expiredays', 'upd_runservice', 'filterprefix', 'filterfield', 'upd_is_disabled' )); $update_fields = array ( @@ -236,13 +236,10 @@ if ($popup_select && empty($package) && !is_numeric($package) ) { ?> CV_FOLLOWPARAMETERS .= "&package=".$package; ?>
    - +
    + @@ -310,7 +305,27 @@ function sendValue(selvalue) + FG_CSRF_STATUS == true) { + ?> + + + + + + + @@ -370,20 +385,19 @@ function sendValue(selvalue) foreach ($update_fields as $value) { ?> - - + > + + + + @@ -399,27 +413,26 @@ function sendValue(selvalue) - + - - - + > + + + + + @@ -427,8 +440,8 @@ function sendValue(selvalue) " type="submit"> - -
    + > + + *) : + +
    > - > - - - - : - - - checked> - checked> - checked> - -
    + : + + + checked> + checked> + checked> + +
    - > - - - - : - - - checked> - checked> - checked> - -
    + : + + + checked> + checked> + checked> + +
    + +
    @@ -467,13 +480,16 @@ function sendValue(selvalue)
    -
    +
    + + +
    - -
    - .

    - - - - - - - - - - - - - - - -
    - : - -
    -
    - : - -

    - -
    +.

    + + + + + @@ -302,46 +278,47 @@ function moveSourceDown() move down -
    + : + +
    +
    + : + +

    + +
    - -
    -
    - -
    - -
    - - - -
    - -
    - -
    - -
    -

    - - - KB
    - - - - - -

    -
    + + + + + + + +
    + +
    + +
    + - + +
    + +
    + +
    + + + + + +

    + + + KB
    + + + + + +

    + + + + +
    * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -190,7 +190,7 @@ } $begin_date = date("Y"); - $begin_date_plus = date("Y") + 25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "'".$begin_date.$end_date."'"; $comp_date_plus = "'".$begin_date_plus.$end_date."'"; diff --git a/admin/Public/A2B_entity_did_use.php b/admin/Public/A2B_entity_did_use.php old mode 100644 new mode 100755 index f4cd5f386..4de37d529 --- a/admin/Public/A2B_entity_did_use.php +++ b/admin/Public/A2B_entity_did_use.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -65,10 +65,19 @@ case "release_did": echo $CC_help_release_did; ?> -
    id=form1 method=post name=form1> + id=form1 method=post name=form1> -

    + + FG_CSRF_STATUS == true) { + ?> + + + +



    @@ -105,12 +114,22 @@ if (!isset($actionbtn) || $actionbtn=="ask_release") { echo $CC_help_list_did_use; + if (!isset($inuse) || $inuse=="")$inuse=1; /**/?>
    - - + + + FG_CSRF_STATUS == true) { + ?> + + + +
    diff --git a/admin/Public/A2B_entity_didgroup.php b/admin/Public/A2B_entity_didgroup.php old mode 100644 new mode 100755 index cbc927153..d60ae57b9 --- a/admin/Public/A2B_entity_didgroup.php +++ b/admin/Public/A2B_entity_didgroup.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_didx.php b/admin/Public/A2B_entity_didx.php old mode 100644 new mode 100755 index 09ed3b337..f92f672f1 --- a/admin/Public/A2B_entity_didx.php +++ b/admin/Public/A2B_entity_didx.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -46,15 +46,12 @@ getpost_ifset(array('country', 'area', 'nxx', 'number', 'ID', 'rating')); -function unavailable() -{ +function unavailable() { return "Sorry, the DID selection service is currently unavailable because of uplink error, please come back and try again later or contact us about available DIDs (include country and area codes to your request)."; } -function getcountry($arr, $selected=0, $id=0) -{ - if($arr === false) - +function getcountry($arr, $selected=0, $id=0) { + if ($arr === false) return unavailable(); $res = "\n"; $res .= "\n"; @@ -98,10 +93,8 @@ function getarea($arr, $selected=0) return $res; } -function getnxx($arr, $selected=0) -{ +function getnxx($arr, $selected=0) { if($arr === false) - return unavailable(); $res = "\n"; $res .= "\n"; @@ -150,16 +141,17 @@ function getnumber($arr, $country, $selected=0) $didx = new didx(); if ($form_action == "purchase" || $form_action == "add") { - if($form_action == "purchase") + if($form_action == "purchase") { $form_action = "ask-add"; + } $HD_Form -> init(); $list = $HD_Form -> perform_action($form_action); $smarty->display('main.tpl'); - $res = $didx->BuyDIDByNumber($did,"$did@".DIDX_RING_TO); - if($res < 0) - echo "Error $res while setting up the DID $did."; - else { + $res = $didx->BuyDIDByNumber($did,"$did@".DIDX_RING_TO); + if ($res < 0) { + echo "Error $res while setting up the DID $did."; + } else { echo "The DID $did successfully purchased on DIDX"; // #### TOP SECTION PAGE $HD_Form -> create_toppage ($form_action); @@ -167,9 +159,7 @@ function getnumber($arr, $country, $selected=0) $HD_Form -> create_form ($form_action, $list, $id=null) ; } } else { - $smarty->display('main.tpl'); - echo $CC_help_list_did; if (!empty($country)) @@ -205,7 +195,7 @@ function getnumber($arr, $country, $selected=0)
    - +
    - + \n"; for ($i=0; $i<=9;$i++) { diff --git a/admin/Public/A2B_entity_friend.php b/admin/Public/A2B_entity_friend.php old mode 100644 new mode 100755 index 6e8525357..d679403a3 --- a/admin/Public/A2B_entity_friend.php +++ b/admin/Public/A2B_entity_friend.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -47,21 +47,23 @@ $HD_Form -> init(); /********************************* BATCH UPDATE ***********************************/ -getpost_ifset(array('upd_callerid', 'upd_context', 'batchupdate', 'check', 'type', 'mode')); +getpost_ifset(array('upd_callerid', 'upd_context', 'batchupdate', 'check', 'type', 'mode', 'atmenu')); + // CHECK IF REQUEST OF BATCH UPDATE if ($batchupdate == 1 && is_array($check)) { - $SQL_REFILL=""; - $HD_Form->prepare_list_subselection('list'); + $SQL_REFILL = ""; + $HD_Form -> prepare_list_subselection('list'); // Array ( [upd_simultaccess] => on [upd_currency] => on ) - $loop_pass=0; + $loop_pass = 0; $SQL_UPDATE = ''; - foreach ($check as $ind_field => $ind_val) { + foreach($check as $ind_field => $ind_val) { //echo "
    ::> $ind_field -"; $myfield = substr($ind_field,4); - if ($loop_pass!=0) $SQL_UPDATE.=','; - + if ($loop_pass != 0) { + $SQL_UPDATE.=','; + } // Standard update mode if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1) { if (!isset($type["$ind_field"])) { @@ -96,14 +98,12 @@ if (!$HD_Form -> DBHandle -> Execute("begin")) { $update_msg = $update_msg_error; } else { - if (!$HD_Form -> DBHandle -> Execute($SQL_UPDATE)) { $update_msg = $update_msg_error; } if (! $res = $HD_Form -> DBHandle -> Execute("commit")) { $update_msg = '
    '.gettext('The batch update has been successfully perform!').'
    '; } - }; } @@ -134,8 +134,11 @@ $instance_table_friend = new Table('cc_card'); $instance_table_friend -> Update_table ($HD_Form -> DBHandle, $friend_param_update, "id='$id_cc_card'", $func_table = null); - if ( $form_action == "add_sip" ) $TABLE_BUDDY = 'cc_sip_buddies'; - else $TABLE_BUDDY = 'cc_iax_buddies'; + if ($form_action == "add_sip") { + $TABLE_BUDDY = 'cc_sip_buddies'; + } else { + $TABLE_BUDDY = 'cc_iax_buddies'; + } $instance_table_friend = new Table($TABLE_BUDDY,'*'); $list_friend = $instance_table_friend -> Get_list ($HD_Form -> DBHandle, "id_cc_card='$id_cc_card'", null, null, null, null); @@ -161,10 +164,10 @@ $HD_Form->_vars = array_merge((array) $_GET, (array) $_POST); } -$HD_Form -> FG_EDITION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-edit&atmenu=$atmenu&id="; -$HD_Form -> FG_DELETION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-delete&atmenu=$atmenu&id="; +$HD_Form -> FG_EDITION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=ask-edit&atmenu=$atmenu&id="; +$HD_Form -> FG_DELETION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=ask-delete&atmenu=$atmenu&id="; -if ($id!="" || !is_null($id)) { +if ($id != "" || !is_null($id)) { $HD_Form -> FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form -> FG_EDITION_CLAUSE); } @@ -176,9 +179,9 @@ if ($form_action == "add" || $form_action == "edit" || $form_action == "delete") { if ($atmenu=='sip') { $key = "sip_changed"; - } else { - $key = "iax_changed"; - } + } else { + $key = "iax_changed"; + } if ($_SESSION["user_type"]=="ADMIN") {$who= Notification::$ADMIN;$id=$_SESSION['admin_id'];} elseif ($_SESSION["user_type"]=="AGENT") {$who= Notification::$AGENT;$id=$_SESSION['agent_id'];} else {$who=Notification::$UNKNOWN;$id=-1;} NotificationsDAO::AddNotification($key,Notification::$HIGH,$who,$id); } @@ -197,12 +200,24 @@ if (!USE_REALTIME) { ?> - - - + + + + + + + + + FG_CSRF_STATUS == true) { + ?> + + +
     :  -
    - -
     : 
    + +
    SIP : " @@ -229,22 +244,29 @@
    - +
    - - - - - - - -
      - - - -
    + + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + +
      + + +
    @@ -257,42 +279,49 @@
      FG_NB_RECORD ?>   - - - +
    + + + FG_CSRF_STATUS == true) { + ?> + + + - - + + - - + + - - - -
    - > - + + > + 1)  :
    -
    - > - + + > + 2)  :
    -
    + " type="submit">
    -
    - + +
    + + diff --git a/admin/Public/A2B_entity_invoice.php b/admin/Public/A2B_entity_invoice.php old mode 100644 new mode 100755 index 288c3608a..e1916f579 --- a/admin/Public/A2B_entity_invoice.php +++ b/admin/Public/A2B_entity_invoice.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -108,10 +108,10 @@ diff --git a/admin/Public/A2B_entity_invoice_conf.php b/admin/Public/A2B_entity_invoice_conf.php old mode 100644 new mode 100755 index 5ef5ff6a0..b1c0d0194 --- a/admin/Public/A2B_entity_invoice_conf.php +++ b/admin/Public/A2B_entity_invoice_conf.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_log_viewer.php b/admin/Public/A2B_entity_log_viewer.php old mode 100644 new mode 100755 index 10c712c2f..46ec3ba59 --- a/admin/Public/A2B_entity_log_viewer.php +++ b/admin/Public/A2B_entity_log_viewer.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -70,163 +70,171 @@
    - - - - - - + + + + + + + + + + +
    -    + FG_CSRF_STATUS == true) { + ?> + + + + + + + + + +
    +    + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - -
    + : + - - -
    - : - -
    - - checked="checked" > - - - -
    - checked> - :
    + + checked="checked" > + + + +
    + checked> + : +    + checked> + : +
    +
    + checked="checked" > + + + +
    + checked> : + + -    - checked> - : +    + checked> + : + + -
    -
    - checked="checked" > - - - -
    - checked> : - - -    - checked> - : - - -
    -
    -    - - -
    - - -
    +
    +
    +    + + +
    + + +
    * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_logrefill_agent.php b/admin/Public/A2B_entity_logrefill_agent.php index cfdebd63c..739da089d 100755 --- a/admin/Public/A2B_entity_logrefill_agent.php +++ b/admin/Public/A2B_entity_logrefill_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_mailtemplate.php b/admin/Public/A2B_entity_mailtemplate.php old mode 100644 new mode 100755 index 95b698469..4423f6e0a --- a/admin/Public/A2B_entity_mailtemplate.php +++ b/admin/Public/A2B_entity_mailtemplate.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -43,7 +43,7 @@ die(); } -getpost_ifset(array('languages','id','action')); +getpost_ifset(array('languages', 'id', 'action')); if ($action=="load") { $DBHandle=DbConnect(); @@ -59,9 +59,7 @@ if ($popup_select) { ?> - +
    - SQLExec ($handle, $QUERY); - if (is_array($result)) { - $num_cur = count($result); - for ($i=0;$i<$num_cur;$i++) { - $languages_list[$result[$i][0]] = array (0 => $result[$i][0], 1 => $result[$i][1]); - } + SQLExec ($handle, $QUERY); + if (is_array($result)) { + $num_cur = count($result); + for ($i=0;$i<$num_cur;$i++) { + $languages_list[$result[$i][0]] = array (0 => $result[$i][0], 1 => $result[$i][1]); } - ?> + } + ?> - - - - - - + + + + + + + + + + +
    - - checked="checked" > - - - -
    - checked> - : + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + + + + + + - - - - - - - - - - - - - - - -
    + checked="checked" > + + + +
    + checked> + : +    + checked> + : +
    +
    + checked="checked" > + + + +
    + checked> : + + -    - checked> - : +    + checked> + : + + -
    -
    - checked="checked" > - - - -
    - checked> : - - -    - checked> - : - - -
    -
    -    - - -
    - - -
    +
    +
    +    + + +
    + + +
    - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. - * @author Belaid Arezqui - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html - * @package A2Billing - * - * Software License Agreement (GNU Affero General Public License) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * -**/ - -include '../lib/admin.defines.php'; -include '../lib/admin.module.access.php'; -include '../lib/Form/Class.FormHandler.inc.php'; -include './form_data/FG_var_phonenumber.inc'; -include '../lib/admin.smarty.php'; - -if (!has_rights(ACX_PREDICTIVE_DIALER)) { - Header("HTTP/1.0 401 Unauthorized"); - Header("Location: PP_error.php?c=accessdenied"); - die(); -} - -getpost_ifset(array ( - 'action', - 'campaign', - 'check', 'type', 'mode', 'batchupdate', - 'upd_id_phonebook', 'upd_number', 'upd_name', 'upd_amount', 'upd_status' -)); - -if (!empty ($action) && !empty ($campaign) && is_numeric($campaign) && ($action == "run" || $action == "hold" || $action == "stop")) { - $DBHandle = DbConnect(); - $status = 0; - if ($action == "stop") - $status = 2; - elseif ($action == "hold") - $status = 1; - - $table = new Table(); - $table->SQLExec($DBHandle, "UPDATE cc_campaign_phonestatus SET status = $status WHERE id_phonenumber =$id AND id_campaign = $campaign "); - - Header("Location: A2B_entity_phonenumber.php?form_action=ask-edit&id=$id"); -} - -$HD_Form->setDBHandler(DbConnect()); - -$HD_Form->init(); - -/********************************* BATCH UPDATE ***********************************/ - -// CHECK IF REQUEST OF BATCH UPDATE -if ($batchupdate == 1 && is_array($check)) { - $SQL_REFILL=""; - $HD_Form->prepare_list_subselection('list'); - - // Array ( [upd_simultaccess] => on [upd_currency] => on ) - $loop_pass=0; - $SQL_UPDATE = ''; - foreach ($check as $ind_field => $ind_val) { - //echo "
    ::> $ind_field -"; - $myfield = substr($ind_field,4); - if ($loop_pass!=0) $SQL_UPDATE.=','; - - // Standard update mode - if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1) { - if (!isset($type["$ind_field"])) { - $SQL_UPDATE .= " $myfield='".$$ind_field."'"; - } else { - $SQL_UPDATE .= " $myfield='".$type["$ind_field"]."'"; - } - // Mode 2 - Equal - Add - Subtract - } elseif ($mode["$ind_field"]==2) { - if (!isset($type["$ind_field"])) { - $SQL_UPDATE .= " $myfield='".$$ind_field."'"; - } else { - if ($type["$ind_field"] == 1) { - $SQL_UPDATE .= " $myfield='".$$ind_field."'"; - } elseif ($type["$ind_field"] == 2) { - $SQL_UPDATE .= " $myfield = $myfield +'".$$ind_field."'"; - } else { - $SQL_UPDATE .= " $myfield = $myfield -'".$$ind_field."'"; - } - } - } - $loop_pass++; - } - - $SQL_UPDATE = "UPDATE $HD_Form->FG_TABLE_NAME SET $SQL_UPDATE"; - if (strlen($HD_Form->FG_TABLE_CLAUSE)>1) { - $SQL_UPDATE .= ' WHERE '; - $SQL_UPDATE .= $HD_Form->FG_TABLE_CLAUSE; - } - $update_msg_error = '
    '.gettext('Could not perform the batch update!').'
    '; - - if (!$HD_Form -> DBHandle -> Execute("begin")) { - $update_msg = $update_msg_error; - } else { - if (!$HD_Form -> DBHandle -> Execute($SQL_UPDATE)) { - $update_msg = $update_msg_error; - } - if (! $res = $HD_Form -> DBHandle -> Execute("commit")) { - $update_msg = '
    '.gettext('The batch update has been successfully perform!').'
    '; - } - - }; -} - -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; - -$list = $HD_Form->perform_action($form_action); - -// #### HEADER SECTION -$smarty->display('main.tpl'); - -// #### HELP SECTION -echo $CC_help_phonelist; - -?> - -
    -
     ( )
    - -
    - -=1)) ) { - - $instance_table_tariff = new Table("cc_phonebook", "id, name"); - $FG_TABLE_CLAUSE = ""; - $list_phonebook = $instance_table_tariff -> Get_list ($HD_Form -> DBHandle, $FG_TABLE_CLAUSE, "name", "ASC", null, null, null, null); - $nb_phonebook = count($list_phonebook); - $cnts = new Constants(); - $actived_list = $cnts->getActivationList(); - -?> - -
    -
    - -
    - -=1)) echo $CC_help_create_customer; - -if (isset($update_msg) && strlen($update_msg)>0) echo $update_msg; - -// #### TOP SECTION PAGE -$HD_Form->create_toppage($form_action); - -$HD_Form->create_form($form_action, $list); - -if ($form_action = "ask_edit") { - $DBHandle = DbConnect(); - $instance_table = new Table(); - - $QUERY_PHONENUMBERS = 'SELECT cc_campaign.id, cc_campaign.name,cc_campaign.status, cc_campaign.startingdate <= CURRENT_TIMESTAMP AS started ,cc_campaign.expirationdate <= CURRENT_TIMESTAMP AS expired FROM cc_phonenumber , cc_phonebook , cc_campaign_phonebook, cc_campaign WHERE '; - //JOIN CLAUSE - $QUERY_PHONENUMBERS .= 'cc_phonenumber.id_phonebook = cc_phonebook.id AND cc_campaign_phonebook.id_phonebook = cc_phonebook.id AND cc_campaign_phonebook.id_campaign = cc_campaign.id '; - //CAMPAIGN CLAUSE - if ($id != null) // Exclude if null otherwise kills the list query - $QUERY_PHONENUMBERS .= 'AND cc_phonenumber.id= ' . $id; // I've no idea under what conditions this should be included. Please review! - $result = $instance_table->SQLExec($DBHandle, $QUERY_PHONENUMBERS); - if ($result) { - ?> -
    -
    - - - - - - - - - SQLExec ($DBHandle, $query); - ?> - - - - - - - - -
    - - - - - - - -
    - - - - - - -   - - "> " border="0" title="" alt=""> - "> " border="0" title="" alt=""> - "> " border="0" title="" alt=""> - - -
    - display('footer.tpl'); diff --git a/admin/Public/A2B_entity_prefix.php b/admin/Public/A2B_entity_prefix.php old mode 100644 new mode 100755 index 508e3355f..013a1207c --- a/admin/Public/A2B_entity_prefix.php +++ b/admin/Public/A2B_entity_prefix.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_provider.php b/admin/Public/A2B_entity_provider.php index d0d7370c8..90c0bd6c6 100644 --- a/admin/Public/A2B_entity_provider.php +++ b/admin/Public/A2B_entity_provider.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -50,10 +50,12 @@ $HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form->FG_EDITION_CLAUSE); } -if (!isset ($form_action)) +if (!isset ($form_action)) { $form_action = "list"; //ask-add -if (!isset ($action)) +} +if (!isset ($action)) { $action = $form_action; +} $list = $HD_Form->perform_action($form_action); @@ -61,22 +63,20 @@ $smarty->display('main.tpl'); if ($popup_select) { ?> - + create_form($form_action, $list, $id = null); // #### FOOTER SECTION -if (!$popup_select) +if (!$popup_select) { $smarty->display('footer.tpl'); +} diff --git a/admin/Public/A2B_entity_receipt.php b/admin/Public/A2B_entity_receipt.php old mode 100644 new mode 100755 index ba685e325..e7d09194a --- a/admin/Public/A2B_entity_receipt.php +++ b/admin/Public/A2B_entity_receipt.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -68,10 +68,12 @@ $HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form->FG_EDITION_CLAUSE); } -if (!isset ($form_action)) +if (!isset ($form_action)) { $form_action = "list"; //ask-add -if (!isset ($action)) +} +if (!isset ($action)) { $action = $form_action; +} $list = $HD_Form->perform_action($form_action); @@ -93,10 +95,10 @@ diff --git a/admin/Public/A2B_entity_remittance_request.php b/admin/Public/A2B_entity_remittance_request.php old mode 100644 new mode 100755 index ec6973ec9..340e4b868 --- a/admin/Public/A2B_entity_remittance_request.php +++ b/admin/Public/A2B_entity_remittance_request.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_restore.php b/admin/Public/A2B_entity_restore.php old mode 100644 new mode 100755 index 490e33b9e..462b9a5a9 --- a/admin/Public/A2B_entity_restore.php +++ b/admin/Public/A2B_entity_restore.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -146,7 +146,15 @@ function CheckForm() //--> - + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + + + + + + + +
      diff --git a/admin/Public/A2B_entity_server.php b/admin/Public/A2B_entity_server.php old mode 100644 new mode 100755 index 78c536412..33bb78b6f --- a/admin/Public/A2B_entity_server.php +++ b/admin/Public/A2B_entity_server.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_server_group.php b/admin/Public/A2B_entity_server_group.php old mode 100644 new mode 100755 index 6cf2c374c..e96a5f997 --- a/admin/Public/A2B_entity_server_group.php +++ b/admin/Public/A2B_entity_server_group.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_service.php b/admin/Public/A2B_entity_service.php old mode 100644 new mode 100755 index 1a2b812d9..c3ee8c84e --- a/admin/Public/A2B_entity_service.php +++ b/admin/Public/A2B_entity_service.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_signup_agent.php b/admin/Public/A2B_entity_signup_agent.php index 973c478c7..7cf325e52 100755 --- a/admin/Public/A2B_entity_signup_agent.php +++ b/admin/Public/A2B_entity_signup_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -45,9 +45,9 @@ ?> setDBHandler (DbConnect()); @@ -72,8 +72,8 @@ function sexyBOX(v,b) { setTimeout("sexyTOG()",100); style('sexyBG').height=XYwi // #### HEADER SECTION $smarty->display('main.tpl'); ?> -
    -
    +
    +
    * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_statuslog.php b/admin/Public/A2B_entity_statuslog.php old mode 100644 new mode 100755 index a9305d8cb..d9f95c4a0 --- a/admin/Public/A2B_entity_statuslog.php +++ b/admin/Public/A2B_entity_statuslog.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -70,171 +70,178 @@ ?> - - - - - - - - + + + + + + + + + +
    -    + + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + + + +
    +    + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - -
    + + - - -
    - - -
    - - checked="checked" > - - - -
    - checked> - :
    + + checked="checked" > + + + +
    + checked> + : +    + checked> + : +
    +
    + checked="checked" > + + + +
    + checked> : + + -    - checked> - : +    + checked> + : + + -
    -
    - checked="checked" > - - - -
    - checked> : - - -    - checked> - : - - -
    -
    - - -
    - - -
    -
    - - -
    + } + ?> + +
    +
    + + +
    + + +
    +
    + + +
    * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_subscriber_signup.php b/admin/Public/A2B_entity_subscriber_signup.php index d263fedd2..a04d91f5e 100755 --- a/admin/Public/A2B_entity_subscriber_signup.php +++ b/admin/Public/A2B_entity_subscriber_signup.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_subscription.php b/admin/Public/A2B_entity_subscription.php old mode 100644 new mode 100755 index b20c1e456..e25ecdc47 --- a/admin/Public/A2B_entity_subscription.php +++ b/admin/Public/A2B_entity_subscription.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_tariffgroup.php b/admin/Public/A2B_entity_tariffgroup.php index e9efc82e4..02f62ccb4 100644 --- a/admin/Public/A2B_entity_tariffgroup.php +++ b/admin/Public/A2B_entity_tariffgroup.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -50,31 +50,33 @@ $HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form->FG_EDITION_CLAUSE); } -if (!isset ($form_action)) +if (!isset ($form_action)) { $form_action = "list"; //ask-add -if (!isset ($action)) +} +if (!isset ($action)) { $action = $form_action; +} $list = $HD_Form->perform_action($form_action); // #### HEADER SECTION $smarty->display('main.tpl'); ?> - + create_form($form_action, $list, $id = null); // #### FOOTER SECTION -if (!$popup_select) +if (!$popup_select) { $smarty->display('footer.tpl'); +} diff --git a/admin/Public/A2B_entity_tariffplan.php b/admin/Public/A2B_entity_tariffplan.php old mode 100644 new mode 100755 index 1fcb6de6b..4010a1f6e --- a/admin/Public/A2B_entity_tariffplan.php +++ b/admin/Public/A2B_entity_tariffplan.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_transactions.php b/admin/Public/A2B_entity_transactions.php old mode 100644 new mode 100755 index c839bec45..62876466b --- a/admin/Public/A2B_entity_transactions.php +++ b/admin/Public/A2B_entity_transactions.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_transactions_agent.php b/admin/Public/A2B_entity_transactions_agent.php index b2b4f87c0..b03a4f2b3 100755 --- a/admin/Public/A2B_entity_transactions_agent.php +++ b/admin/Public/A2B_entity_transactions_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_entity_translate.php b/admin/Public/A2B_entity_translate.php old mode 100644 new mode 100755 index 2d2449ace..e0eafa9c8 --- a/admin/Public/A2B_entity_translate.php +++ b/admin/Public/A2B_entity_translate.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -90,65 +90,74 @@ } ?> -
    - + + + +FG_CSRF_STATUS == true) { +?> + + + - - - - + + + - - - - - - - - - - - -
    -
    + - - -
    - - - -
    - + if ($mail[0][4] != '') { + if ($lang_value[0]==$mail[0][4]) {print "selected";} + } else { + if ($lang_value[0]==$languages) {print "selected";} + }?>> + + - -
    - - - - - - - - - - -
     
    - -
    - -
    + +
    + + + +
    + + + +
    + + + + + + + + + + +
     
    + +
    + + * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -46,9 +46,20 @@ getpost_ifset(array ( 'popup_select', 'popup_formname', - 'popup_fieldname' + 'popup_fieldname', + 'counters_clear' )); +if ($counters_clear && !empty($id)) { + eraseTrunkCounters($id); + $_SESSION['trunk_counters_erased'] = true; + Header("Location: A2B_entity_trunk.php?form_action=ask-edit&id=" . $id); + die; +} else if (isset($_SESSION['trunk_counters_erased'])) { + unset($_SESSION['trunk_counters_erased']); + echo ''; +} + $HD_Form->setDBHandler(DbConnect()); $HD_Form->init(); @@ -71,9 +82,9 @@ ?> diff --git a/admin/Public/A2B_invoice_view.php b/admin/Public/A2B_invoice_view.php index 71ec5f547..11650455d 100755 --- a/admin/Public/A2B_invoice_view.php +++ b/admin/Public/A2B_invoice_view.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -132,7 +132,7 @@ function amount_convert($amount)    - ')"> diff --git a/admin/Public/A2B_log_activity_info.php b/admin/Public/A2B_log_activity_info.php old mode 100644 new mode 100755 index d0a665a63..405395ff7 --- a/admin/Public/A2B_log_activity_info.php +++ b/admin/Public/A2B_log_activity_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_logfile.php b/admin/Public/A2B_logfile.php old mode 100644 new mode 100755 index 5b70f1663..bd09fa40b --- a/admin/Public/A2B_logfile.php +++ b/admin/Public/A2B_logfile.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_mass_mail.php b/admin/Public/A2B_mass_mail.php old mode 100644 new mode 100755 index bedf79da9..5fcb71f04 --- a/admin/Public/A2B_mass_mail.php +++ b/admin/Public/A2B_mass_mail.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -186,17 +186,14 @@ ?> +
    -
    -
    - - - - - 0) { ?> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    - -
    -
    -
    -
    -
    + + + FG_CSRF_STATUS == true) { + ?> + + + + + + + + 0) { ?> + + - + + - - - + + - + } + }?> 
    + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    + +
    +
    +          
    +        
    +
    -
    - "; - } - if (is_array($list_customer)) { - for ($key=0; $key < $nb_customer && $key <= 100; $key++) { - echo "".$list_customer[$key][1].""; - if ($key + 1 != $nb_customer) echo ", "; - echo ""; - if ($key == 100) { - echo "
    ".gettext("Click on list customer to see them all").""; - } +
    + "; + } + if (is_array($list_customer)) { + for ($key=0; $key < $nb_customer && $key <= 100; $key++) { + echo "".$list_customer[$key][1].""; + if ($key + 1 != $nb_customer) echo ", "; + echo ""; + if ($key == 100) { + echo "
    ".gettext("Click on list customer to see them all").""; } - }?> 
    -
      - LOAD TEMPLATE<");?>" /> -
    -   -
    -   -
    -   -
    - - -  
      - ">
    - - +
      + " /> +
    +   +
    +   +
    +   +
    + +  
      + ">
    + + * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_notifications.php b/admin/Public/A2B_notifications.php old mode 100644 new mode 100755 index 966ca3152..d3c24095f --- a/admin/Public/A2B_notifications.php +++ b/admin/Public/A2B_notifications.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_package_manage_rates.php b/admin/Public/A2B_package_manage_rates.php old mode 100644 new mode 100755 index fe284ea97..7759c17b2 --- a/admin/Public/A2B_package_manage_rates.php +++ b/admin/Public/A2B_package_manage_rates.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_payment_info.php b/admin/Public/A2B_payment_info.php old mode 100644 new mode 100755 index 5f0cc7eaa..b146536bf --- a/admin/Public/A2B_payment_info.php +++ b/admin/Public/A2B_payment_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_payment_info_agent.php b/admin/Public/A2B_payment_info_agent.php old mode 100644 new mode 100755 index a70ed44e2..95cb6fcc6 --- a/admin/Public/A2B_payment_info_agent.php +++ b/admin/Public/A2B_payment_info_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_phonelist_import.php b/admin/Public/A2B_phonelist_import.php deleted file mode 100755 index 8e4a558f8..000000000 --- a/admin/Public/A2B_phonelist_import.php +++ /dev/null @@ -1,327 +0,0 @@ - - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. - * @author Belaid Arezqui - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html - * @package A2Billing - * - * Software License Agreement (GNU Affero General Public License) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * -**/ - -include '../lib/admin.defines.php'; -include '../lib/admin.module.access.php'; -include '../lib/admin.smarty.php'; - -set_time_limit(0); - -if (! has_rights (ACX_PREDICTIVE_DIALER)) { - Header ("HTTP/1.0 401 Unauthorized"); - Header ("Location: PP_error.php?c=accessdenied"); - die(); -} - -$FG_DEBUG = 0; - -$DBHandle = DbConnect(); -$my_max_file_size = (int) MY_MAX_FILE_SIZE_IMPORT; - -$instance_table_phonebook = new Table("cc_phonebook", "id, name"); -$FG_TABLE_CLAUSE = ""; -$list_phonebook = $instance_table_phonebook -> Get_list ($DBHandle, $FG_TABLE_CLAUSE, "name", "ASC", null, null, null, null); -$nb_phonebook = count($list_phonebook); - -$smarty->display('main.tpl'); - -?> - - - - - -
    -

    - - - - - - - - - - - - - - - - - - -
    - : - -

    - -
    - - -

    - -.
    - - - - - - - - - - - -
    - - - add source -
    - remove source -
    - - - move up -
    - move down -
    - -
      - -
    -
    - -
    - - -
    - - - -
    - -
    - - -
    - -
    -

    - - - KB
    - - - - -

    -
    -
    - -display('footer.tpl'); diff --git a/admin/Public/A2B_phonelist_import_analyse.php b/admin/Public/A2B_phonelist_import_analyse.php deleted file mode 100755 index 35b14e15a..000000000 --- a/admin/Public/A2B_phonelist_import_analyse.php +++ /dev/null @@ -1,342 +0,0 @@ - - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. - * @author Belaid Arezqui - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html - * @package A2Billing - * - * Software License Agreement (GNU Affero General Public License) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * -**/ - -include '../lib/admin.defines.php'; -include '../lib/admin.module.access.php'; -include '../lib/admin.smarty.php'; - -set_time_limit(0); - -if (! has_rights (ACX_PREDICTIVE_DIALER)) { - Header ("HTTP/1.0 401 Unauthorized"); - Header ("Location: PP_error.php?c=accessdenied"); - die(); -} - -check_demo_mode(); - -getpost_ifset(array('phonebook', 'search_sources', 'task','status_import','uploadedfile_name','uploadedfile_name')); - -$phonebookval= preg_split('/-:-/', $phonebook); -if (!is_numeric($phonebookval[0])) { - echo gettext("No Phonebook defined !"); - exit(); -} - -if ($search_sources!='nochange') { - $fieldtoimport= preg_split("/\t/", $search_sources); - $fieldtoimport_sql = str_replace("\t", ", ", $search_sources); - $fieldtoimport_sql = trim ($fieldtoimport_sql); - if (strlen($fieldtoimport_sql)>0) $fieldtoimport_sql = ', '.$fieldtoimport_sql; -} - -$fixfield[0]="Id Phonebook (KEY)"; -$field[0]="Number"; - -$FG_DEBUG = 0; - -// THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE -$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFFFFF"; -$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F8FF"; -$Temps1 = time(); -if ($FG_DEBUG == 1) echo "::::>> ".$the_file; -//INUTILE -$my_max_file_size = (int) MY_MAX_FILE_SIZE_IMPORT; - -if ($FG_DEBUG == 1) echo "
    Task :: $task"; - -if ($task=='upload') { - - $the_file_name = $_FILES['the_file']['name']; - $the_file_type = $_FILES['the_file']['type']; - $the_file = $_FILES['the_file']['tmp_name']; - - if (count($_FILES) > 0) { - $errortext = validate_upload($the_file, $the_file_type); - if ($errortext != "" || $errortext != false) { - echo $errortext; - exit; - } - $new_filename = "/tmp/".MDP(6).".csv"; - if (file_exists($new_filename)) { - echo $_FILES["file"]["name"] . " already exists. "; - } else { - if (!move_uploaded_file($_FILES["the_file"]["tmp_name"], $new_filename)) { - echo gettext("File Save Failed, FILE=".$new_filename); - } - } - $the_file = $new_filename; - } else { - $the_file_type = $uploadedfile_type; - $the_file = $uploadedfile_name; - } - - if ($FG_DEBUG == 1) echo "
    FILE ::> ".$the_file_name; - if ($FG_DEBUG == 1) echo "
    THE_FILE:$the_file
    THE_FILE_TYPE:$the_file_type"; - - $fp = fopen($the_file, "r"); - if (!$fp) { /* THE FILE DOESN'T EXIST */ - echo gettext('Error: Failed to open the file.'); - exit(); - } - - $nb_imported=0; - $nb_to_import=0; - $DBHandle = DbConnect(); - - while (!feof($fp)) { - - //if ($nb_imported==1000) break; - $ligneoriginal = fgets($fp,4096); /* On se dplace d'une ligne */ - $ligneoriginal = trim ($ligneoriginal); - - // strip out ' and " and, with the exception of dialprefix field, - // substitute , for . to allow European style floats, eg: 0,1 == 0.1 - $ligne = str_replace(array('"',"'"), '', $ligneoriginal); - $val=preg_split('/[;:]/', $ligne); - for ($i = 1; $i < count($val); $i++) - $val[$i]=str_replace(',', '.', $val[$i]); - if ($status_import!="ok") break; - - if (substr($ligne,0,1)!='#' && $val[0]!='' && strlen($val[0])>0) { - - $FG_ADITION_SECOND_ADD_TABLE = 'cc_phonenumber'; - $FG_ADITION_SECOND_ADD_FIELDS = 'id_phonebook, number'; //$fieldtoimport_sql - - - $FG_ADITION_SECOND_ADD_VALUE = "'".$phonebookval[0]."', '".$val[0]."'"; - - for ($k=0;$k0 && ($nb_to_import==1) ) { - - $nb_to_import=0; - $result_query = $DBHandle -> Execute($TT_QUERY); - - if ($result_query) { - $nb_imported = $nb_imported + 1; - } else {$buffer_error.= $ligneoriginal.'
    ';} - $TT_QUERY=''; - } - - } // END WHILE EOF - - echo "QUERY : ".$TT_QUERY; - if ($TT_QUERY!='' && strlen($TT_QUERY)>0 && ($nb_to_import>0) ) { - $result_query = @ $DBHandle -> Execute($TT_QUERY); - if ($result_query) $nb_imported = $nb_imported + $nb_to_import; - } -} - -$Temps2 = time(); -$Temps = $Temps2 - $Temps1; - - -$smarty->display('main.tpl'); - -?> - - - - - - - - - - - -
    -. -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    ()
    - - -

    - - - - - - - - - - - - - - - - - - - -
    -
    -
    , -
    -
    -

    - - - - - - -
    -  

    -
    - -
    - - - -
    - - - - - - - - -
     
    -
    -
    - insertLog($_SESSION["admin_id"], 2, "PHONE NUMBER IMPORTED", $nb_imported." Phone Number Imported Successfully", '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'],''); - $log = null; - ?> - ,   .
    -
    -

    - - -
    - ! -
    - - - -
    -
    -
    - - -
    - - -
    - -display('footer.tpl'); diff --git a/admin/Public/A2B_phpinfo.php b/admin/Public/A2B_phpinfo.php old mode 100644 new mode 100755 index f87e6e512..32e11f137 --- a/admin/Public/A2B_phpinfo.php +++ b/admin/Public/A2B_phpinfo.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_phpsysinfo.php b/admin/Public/A2B_phpsysinfo.php old mode 100644 new mode 100755 index 4bc58e03d..0b32854f8 --- a/admin/Public/A2B_phpsysinfo.php +++ b/admin/Public/A2B_phpsysinfo.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_receipt_edit.php b/admin/Public/A2B_receipt_edit.php index 08d30fac8..f67f77721 100755 --- a/admin/Public/A2B_receipt_edit.php +++ b/admin/Public/A2B_receipt_edit.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_receipt_view.php b/admin/Public/A2B_receipt_view.php index bfa33a0ae..1a15f6a60 100755 --- a/admin/Public/A2B_receipt_view.php +++ b/admin/Public/A2B_receipt_view.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -127,7 +127,7 @@ function amount_convert($amount)    - ')"> diff --git a/admin/Public/A2B_refill_info.php b/admin/Public/A2B_refill_info.php old mode 100644 new mode 100755 index 72de12bd8..953b36cfd --- a/admin/Public/A2B_refill_info.php +++ b/admin/Public/A2B_refill_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_refill_info_agent.php b/admin/Public/A2B_refill_info_agent.php old mode 100644 new mode 100755 index 32e7b8937..fb8ac894a --- a/admin/Public/A2B_refill_info_agent.php +++ b/admin/Public/A2B_refill_info_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_remittance_info.php b/admin/Public/A2B_remittance_info.php old mode 100644 new mode 100755 index 01fffaee6..d396ff6ec --- a/admin/Public/A2B_remittance_info.php +++ b/admin/Public/A2B_remittance_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_signup_agent.php b/admin/Public/A2B_signup_agent.php old mode 100644 new mode 100755 index e9dc36741..67734ddc9 --- a/admin/Public/A2B_signup_agent.php +++ b/admin/Public/A2B_signup_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_ticket_agent.php b/admin/Public/A2B_ticket_agent.php index b57a709a4..ee35bffbc 100755 --- a/admin/Public/A2B_ticket_agent.php +++ b/admin/Public/A2B_ticket_agent.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/A2B_trunk_report.php b/admin/Public/A2B_trunk_report.php old mode 100644 new mode 100755 index 61d3ae04c..78ac18ef7 --- a/admin/Public/A2B_trunk_report.php +++ b/admin/Public/A2B_trunk_report.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_card_import.php b/admin/Public/CC_card_import.php old mode 100644 new mode 100755 index f15e6b978..0b4efe9fb --- a/admin/Public/CC_card_import.php +++ b/admin/Public/CC_card_import.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_card_import_analyse.php b/admin/Public/CC_card_import_analyse.php index 37562d4d1..cc1e8cd81 100644 --- a/admin/Public/CC_card_import_analyse.php +++ b/admin/Public/CC_card_import_analyse.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -165,7 +165,7 @@ } $begin_date = date("Y"); - $begin_date_plus = date("Y") + 25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "'".$begin_date.$end_date."'"; $comp_date_plus = "'".$begin_date_plus.$end_date."'"; diff --git a/admin/Public/CC_entity_alarm_details.php b/admin/Public/CC_entity_alarm_details.php old mode 100644 new mode 100755 index 94c576bf5..e813a4154 --- a/admin/Public/CC_entity_alarm_details.php +++ b/admin/Public/CC_entity_alarm_details.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_entity_service_details.php b/admin/Public/CC_entity_service_details.php old mode 100644 new mode 100755 index 82b86ba7c..ca1e5e847 --- a/admin/Public/CC_entity_service_details.php +++ b/admin/Public/CC_entity_service_details.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_entity_sim_ratecard.php b/admin/Public/CC_entity_sim_ratecard.php old mode 100644 new mode 100755 index 2b6fbb4a3..c988ac5c4 --- a/admin/Public/CC_entity_sim_ratecard.php +++ b/admin/Public/CC_entity_sim_ratecard.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_generate_friend_file.php b/admin/Public/CC_generate_friend_file.php old mode 100644 new mode 100755 index c326c4ca7..6e853cbd1 --- a/admin/Public/CC_generate_friend_file.php +++ b/admin/Public/CC_generate_friend_file.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_musiconhold.php b/admin/Public/CC_musiconhold.php old mode 100644 new mode 100755 index 4378d741f..057f0af76 --- a/admin/Public/CC_musiconhold.php +++ b/admin/Public/CC_musiconhold.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_ratecard_import.php b/admin/Public/CC_ratecard_import.php index 8c4a565fb..5d7f43687 100644 --- a/admin/Public/CC_ratecard_import.php +++ b/admin/Public/CC_ratecard_import.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -51,7 +51,7 @@ // GET CALLPLAN LIST $instance_table_tariffname = new Table("cc_tariffplan", "id, tariffname"); $FG_TABLE_CLAUSE = ""; -$list_tariffname = $instance_table_tariffname->Get_list($DBHandle, $FG_TABLE_CLAUSE, "tariffname", "ASC", null, null, null, null); +$list_tariffname = $instance_table_tariffname->Get_list($DBHandle, $FG_TABLE_CLAUSE, "id", "DESC", null, null, null, null); $nb_tariffname = count($list_tariffname); // GET TRUNK LIST diff --git a/admin/Public/CC_ratecard_import_analyse.php b/admin/Public/CC_ratecard_import_analyse.php old mode 100644 new mode 100755 index 8e8bec6ed..66c7c09d3 --- a/admin/Public/CC_ratecard_import_analyse.php +++ b/admin/Public/CC_ratecard_import_analyse.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_ratecard_merging.php b/admin/Public/CC_ratecard_merging.php old mode 100644 new mode 100755 index 4e29090f9..acbd5510e --- a/admin/Public/CC_ratecard_merging.php +++ b/admin/Public/CC_ratecard_merging.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -219,7 +219,16 @@ function removeSource()
    - + + FG_CSRF_STATUS == true) { + ?> + + + +
    diff --git a/admin/Public/CC_support.php b/admin/Public/CC_support.php old mode 100644 new mode 100755 index 80bd7f66d..242fd52d3 --- a/admin/Public/CC_support.php +++ b/admin/Public/CC_support.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_support_component.php b/admin/Public/CC_support_component.php old mode 100644 new mode 100755 index 0007ea919..d70954a3d --- a/admin/Public/CC_support_component.php +++ b/admin/Public/CC_support_component.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_ticket.php b/admin/Public/CC_ticket.php old mode 100644 new mode 100755 index ad860087f..4c64125c2 --- a/admin/Public/CC_ticket.php +++ b/admin/Public/CC_ticket.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_ticket_view.php b/admin/Public/CC_ticket_view.php old mode 100644 new mode 100755 index 793ba52dc..8ddf5c555 --- a/admin/Public/CC_ticket_view.php +++ b/admin/Public/CC_ticket_view.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/CC_upload.php b/admin/Public/CC_upload.php old mode 100644 new mode 100755 index a03104a75..3df9c19f4 --- a/admin/Public/CC_upload.php +++ b/admin/Public/CC_upload.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -199,7 +199,7 @@ function arr_rid_blank($my_arr)
    - ?method=upload'> + ?method=upload'> @@ -276,13 +276,13 @@ function arr_rid_blank($my_arr) ?> - + * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/PP_intro.php b/admin/Public/PP_intro.php old mode 100644 new mode 100755 index 92c3b7eee..2c872ee0e --- a/admin/Public/PP_intro.php +++ b/admin/Public/PP_intro.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/call-auth-failures-report.php b/admin/Public/call-auth-failures-report.php new file mode 100755 index 000000000..5d2ce52c4 --- /dev/null +++ b/admin/Public/call-auth-failures-report.php @@ -0,0 +1,434 @@ + nothing, 1 => sql result, 2 => boucle checking, 3 other value checking) +$FG_DEBUG = 0; + +// The variable FG_TABLE_NAME define the table name to use +$FG_TABLE_NAME = "cc_auth_failures_log t1 LEFT JOIN cc_card t2 ON t1.id_card = t2.id"; + +// THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE +$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFFFFF"; +$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F8FF"; + +$yesno = array(); +$yesno["1"] = array("Yes", "1"); +$yesno["0"] = array("No", "0"); + +$DBHandle = DbConnect(); + +$FG_TABLE_COL = array(); +$FG_TABLE_COL[] = array(gettext("DATE"), "created_at", "15%", "center", "SORT", "100"); +$FG_TABLE_COL[] = array(gettext("CALLER ID"), "cid", "10%", "center", "SORT", "100"); +$FG_TABLE_COL[] = array(gettext("REASON"), "reason", "15%", "center", "SORT", "100"); +$FG_TABLE_COL[] = array(gettext("LOG"), "dump", "50%", "left", "SORT", "", "", "", "", "", "", "display_pre"); +$FG_TABLE_COL[] = array(gettext("CUSTOMER"), "username", "10%", "center", "SORT", "30", "", "", "", "", "", "linktocustomer"); + +$FG_TABLE_DEFAULT_ORDER = "created_at"; +$FG_TABLE_DEFAULT_SENS = "DESC"; + +// This Variable store the argument for the SQL query +$FG_COL_QUERY = 't1.created_at as created_at, t1.cid as cid, t1.reason as reason, t1.dump as dump, t2.username as username'; + +$FG_LIMITE_DISPLAY = 1000; +$FG_NB_TABLE_COL = count($FG_TABLE_COL); +$FG_EDITION = false; +$FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL; + +$FG_HTML_TABLE_TITLE = gettext(" - AUTH FAIL REPORT - "); +$FG_HTML_TABLE_WIDTH = '80%'; + +if ($FG_DEBUG == 3) + echo "
    Table : $FG_TABLE_NAME - Col_query : $FG_COL_QUERY"; +$instance_table = new Table($FG_TABLE_NAME, $FG_COL_QUERY); +$instance_table_graph = new Table($FG_TABLE_NAME); + +if (is_null($order) || is_null($sens)) { + $order = $FG_TABLE_DEFAULT_ORDER; + $sens = $FG_TABLE_DEFAULT_SENS; +} + +if ($posted == 1) { + $SQLcmd = ''; + $SQLcmd = do_field($SQLcmd, 'cid', 'cid'); +} + +$date_clause = ''; +normalize_day_of_month($fromstatsday_sday, $fromstatsmonth_sday, 1); +normalize_day_of_month($tostatsday_sday, $tostatsmonth_sday, 1); +if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) { + if ($fromtime) { + $date_clause.=" AND t1.created_at >= '$fromstatsmonth_sday-$fromstatsday_sday $fromstatsday_hour:$fromstatsday_min'"; + } else { + $date_clause.=" AND t1.created_at >= '$fromstatsmonth_sday-$fromstatsday_sday'"; + } +} +if ($today && isset($tostatsday_sday) && isset($tostatsmonth_sday)) { + if ($totime) { + $date_clause.=" AND t1.created_at <= '$tostatsmonth_sday-" . sprintf("%02d", intval($tostatsday_sday)/* +1 */) . " $tostatsday_hour:$tostatsday_min:59'"; + } else { + $date_clause.=" AND t1.created_at <= '$tostatsmonth_sday-" . sprintf("%02d", intval($tostatsday_sday)/* +1 */) . " 23:59:59'"; + } +} + +if (strpos($SQLcmd, 'WHERE') > 0) { + $FG_TABLE_CLAUSE = substr($SQLcmd, 6) . $date_clause; +} elseif (strpos($date_clause, 'AND') > 0) { + $FG_TABLE_CLAUSE = substr($date_clause, 5); +} + +if (!isset($FG_TABLE_CLAUSE) || strlen($FG_TABLE_CLAUSE) == 0) { + $cc_yearmonth = sprintf("%04d-%02d-%02d", date("Y"), date("n"), date("d")); + $FG_TABLE_CLAUSE = " t1.created_at >= '$cc_yearmonth'"; +} + +$list = $instance_table->Get_list($DBHandle, $FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page * $FG_LIMITE_DISPLAY); + +$smarty->display('main.tpl'); + +?> + + +
    + + + +
    ?method=download&file=&'>?method=download&file=&'> - ?')) location.href='?method=delete&file=&';">Delete <?php echo $entry;?> - ?method=download&file=&'>Download <?php echo $entry;?> - Rename <?php echo $entry;?> + ?')) location.href='?method=delete&file=&';">Delete <?php echo $entry;?> + ?method=download&file=&'>Download <?php echo $entry;?> + Rename <?php echo $entry;?>
    + + + + + + + + + + + + +
    +    + + +
    + checked> : + + +
    + checked> + + + : + +
    + checked> + : + + +
    + checked> + + + : + +
    +
    +    + + + + + + + + +
      checked>checked>checked>checked>
    + +
    + + + + +
    +
    + +
    +
    + + + + + + + + + + + +
    + + + + + + +
    +
    + + + + + 0) { + + for ($i = 0; $i < $FG_NB_TABLE_COL; $i++) { + ?> + + + + + + + + + + + + Get_list($DBHandle, $sub_clause, null, null, null, null, null, null); + + $field_list_sun = preg_split('/,/', $FG_TABLE_COL[$i][8]); + $record_display = $FG_TABLE_COL[$i][10]; + + for ($l = 1; $l <= count($field_list_sun); $l++) { + $record_display = str_replace("%$l", $select_list[0][$l - 1], $record_display); + } + } elseif ($FG_TABLE_COL[$i][6] == "list") { + $select_list = $FG_TABLE_COL[$i][7]; + $record_display = $select_list[$recordset[$i]][0]; + } else { + $record_display = $recordset[$i]; + } + + if (is_numeric($FG_TABLE_COL[$i][5]) && (strlen($record_display) > $FG_TABLE_COL[$i][5])) { + $record_display = substr($record_display, 0, $FG_TABLE_COL[$i][5] - 3) . ""; + } + ?> + + + + + + + + + + + + + +
    +
    + + "> + + + +   + +   + + + + +
    1) { + call_user_func($FG_TABLE_COL[$i][11], $record_display); + } else { + echo stripslashes($record_display); + } + ?>
      
    + + + + + +
    + +
    + +
    + +display('footer.tpl'); diff --git a/admin/Public/call-comp.php b/admin/Public/call-comp.php old mode 100644 new mode 100755 index 22c1bdbc2..201fc24b2 --- a/admin/Public/call-comp.php +++ b/admin/Public/call-comp.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -174,7 +174,7 @@ $FG_TABLE_CLAUSE = substr($date_clause,5); } -if ($_POST['posted']==1) { +if ($posted==1) { $list = $instance_table -> Get_list ($DBHandle, $FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page*$FG_LIMITE_DISPLAY); $instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH); diff --git a/admin/Public/call-count-reporting.php b/admin/Public/call-count-reporting.php old mode 100644 new mode 100755 index 365a42363..1ed4f54a2 --- a/admin/Public/call-count-reporting.php +++ b/admin/Public/call-count-reporting.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/call-daily-load.php b/admin/Public/call-daily-load.php old mode 100644 new mode 100755 index b3185b6c3..9a1afde8e --- a/admin/Public/call-daily-load.php +++ b/admin/Public/call-daily-load.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -166,7 +166,7 @@ $FG_TABLE_CLAUSE = substr($date_clause,5); } -if ($_POST['posted']==1) { +if ($posted==1) { $list = $instance_table -> Get_list ($DBHandle, $FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page*$FG_LIMITE_DISPLAY); $instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH); diff --git a/admin/Public/call-dnid.php b/admin/Public/call-dnid.php old mode 100644 new mode 100755 index b57adb4f7..363ab197e --- a/admin/Public/call-dnid.php +++ b/admin/Public/call-dnid.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/call-last-month.php b/admin/Public/call-last-month.php old mode 100644 new mode 100755 index 176d0abb7..7064a7602 --- a/admin/Public/call-last-month.php +++ b/admin/Public/call-last-month.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/call-log-customers.php b/admin/Public/call-log-customers.php old mode 100644 new mode 100755 index 9f1588f33..39dfb1c78 --- a/admin/Public/call-log-customers.php +++ b/admin/Public/call-log-customers.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -53,8 +53,8 @@ $dl_full = MONITOR_PATH . "/" . $value_de; $dl_name = $value_de; - if (! file_exists ( $dl_full )) { - echo gettext ( "ERROR: Cannot download file " . $dl_full . ", it does not exist.
    " ); + if (!file_exists ($dl_full)) { + echo gettext ("ERROR: Cannot download file " . $dl_full . ", it does not exist.
    "); exit (); } diff --git a/admin/Public/call-pnl-report.php b/admin/Public/call-pnl-report.php old mode 100644 new mode 100755 index 21562d95a..98e83269b --- a/admin/Public/call-pnl-report.php +++ b/admin/Public/call-pnl-report.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -42,24 +42,9 @@ die(); } -getpost_ifset(array ( - 'posted', - 'Period', - 'frommonth', - 'fromstatsmonth', - 'tomonth', - 'tostatsmonth', - 'fromday', - 'fromstatsday_sday', - 'fromstatsmonth_sday', - 'today', - 'tostatsday_sday', - 'tostatsmonth_sday', - 'current_page', - 'lst_time', - 'group_id', - 'report_type' -)); +getpost_ifset(array ( 'posted', 'Period', 'frommonth', 'fromstatsmonth', 'tomonth', 'tostatsmonth', 'fromday', + 'fromstatsday_sday', 'fromstatsmonth_sday', 'today', 'tostatsday_sday', 'tostatsmonth_sday', 'current_page', + 'lst_time', 'group_id', 'report_type')); // Initialization of variables /////////////////////////////// @@ -68,13 +53,19 @@ $from_to = ''; $bool = false; +$HD_Form = new FormHandler("pnl_report","PNL Report"); + +$HD_Form -> setDBHandler (DbConnect()); +$HD_Form -> init(); + // Generating WHERE CLAUSE /////////////////////////////// normalize_day_of_month($fromstatsday_sday, $fromstatsmonth_sday, 1); normalize_day_of_month($tostatsday_sday, $tostatsmonth_sday, 1); if ($Period == "Time" && $lst_time != "") { - if (strlen($condition) > 0) + if (strlen($condition) > 0) { $condition .= " AND "; + } if (DB_TYPE == "postgres") { switch ($lst_time) { case 1 : @@ -92,7 +83,6 @@ case 5 : $condition .= "CURRENT_TIMESTAMP - interval '1 month' <= cdr.starttime"; break; - } } else { switch ($lst_time) { @@ -164,6 +154,14 @@
    + FG_CSRF_STATUS == true) { + ?> + + + fetchRow(); + $roa = array(); + $row = $res -> fetchRow(); echo ""; - for ($k=0;$k<18;$k++) { + for ($k=0; $k<18; $k++) { echo "'); -} +} document.write(''); if (obj_caller && obj_caller.time_comp) @@ -71,5 +63,4 @@
    @@ -272,24 +270,19 @@ setDBHandler (DbConnect()); -$HD_Form -> init(); - -$condition1=str_replace('cdr.starttime','date',$condition); -$condition2=str_replace('cdr.starttime','firstusedate',$condition); -$payphones=$A2B->config["webui"]["report_pnl_pay_phones"]; -$tallfree=$A2B->config["webui"]["report_pnl_tall_free"]; -$payphones=str_replace(' ','',$payphones); -$tallfree=str_replace(' ','',$tallfree); -$payphones=str_replace('),(',' ,1 as dnid_type union select ',$payphones); -$payphones=str_replace(')',' ,1 ',$payphones); -$tallfree=str_replace('),(',' ,2 union select ',$tallfree); -$tallfree=str_replace(')',' ,2 ',$tallfree); -$tallfree=str_replace('(',' select ',$tallfree); -$payphones=str_replace('(',' select ',$payphones); -$dnids="select 'dnid' as dnid, 0.1 as sell_cost,0.1 as cost,0 as dnid_type"; +$condition1 = str_replace('cdr.starttime','date',$condition); +$condition2 = str_replace('cdr.starttime','firstusedate',$condition); +$payphones = $A2B->config["webui"]["report_pnl_pay_phones"]; +$tallfree = $A2B->config["webui"]["report_pnl_tall_free"]; +$payphones = str_replace(' ','',$payphones); +$tallfree = str_replace(' ','',$tallfree); +$payphones = str_replace('),(',' ,1 as dnid_type union select ',$payphones); +$payphones = str_replace(')',' ,1 ',$payphones); +$tallfree = str_replace('),(',' ,2 union select ',$tallfree); +$tallfree = str_replace(')',' ,2 ',$tallfree); +$tallfree = str_replace('(',' select ',$tallfree); +$payphones = str_replace('(',' select ',$payphones); +$dnids = "select 'dnid' as dnid, 0.1 as sell_cost,0.1 as cost,0 as dnid_type"; if (strlen($tallfree)>0)$dnids.=" union ".$tallfree; if (strlen($payphones)>0)$dnids.=" union ".$payphones; @@ -363,47 +356,46 @@ if (!isset($group_id)) { if ($report_type==1) { $HD_Form -> DBHandle -> Execute("create temporary table pnl_report_sub1 as - select cc.id_group,sum(cr.credit) as credits from cc_logrefill cr - left join cc_card cc on cc.id=cr.card_id - where refill_type=1 and $condition1 - group by id_group"); + select cc.id_group,sum(cr.credit) as credits from cc_logrefill cr + left join cc_card cc on cc.id=cr.card_id + where refill_type=1 and $condition1 + group by id_group"); $HD_Form -> DBHandle -> Execute("create index pnl_report_sub1_get on pnl_report_sub1(id_group)"); $HD_Form -> DBHandle -> Execute("create temporary table pnl_report_sub2 as - select cc.id_group,-sum(cr.credit) as charges from cc_logrefill cr - left join cc_card cc on cc.id=cr.card_id - where refill_type=2 and $condition1 - group by id_group "); + select cc.id_group,-sum(cr.credit) as charges from cc_logrefill cr + left join cc_card cc on cc.id=cr.card_id + where refill_type=2 and $condition1 + group by id_group "); $HD_Form -> DBHandle -> Execute("create index pnl_report_sub2_get on pnl_report_sub2(id_group)"); $HD_Form -> DBHandle -> Execute("create temporary table pnl_report_sub3 as - select id_group,count(*) as first_use from cc_card - where $condition2 group by id_group"); + select id_group,count(*) as first_use from cc_card + where $condition2 group by id_group"); $HD_Form -> DBHandle -> Execute("create index pnl_report_sub3_get on pnl_report_sub3(id_group)"); $QUERY.=" left join cc_card_group as cg on cg.id=id_group left join pnl_report_sub1 as t2 on t1.id_group=t2.id_group left join pnl_report_sub2 as t3 on t1.id_group=t3.id_group left join pnl_report_sub3 as t4 on t1.id_group=t4.id_group - )as result - )as final + ) as result + ) as final "; } elseif ($report_type==2) { $HD_Form -> DBHandle -> Execute("create temporary table pnl_report_sub1 as - select cc.tariff as id_tariffgroup, - sum(case when refill_type=1 then cr.credit else 0 end ) as credits, - - sum(case when refill_type=2 then cr.credit else 0 end ) as charges + select cc.tariff as id_tariffgroup, sum(case when refill_type=1 then cr.credit else 0 end ) as credits, + - sum(case when refill_type=2 then cr.credit else 0 end ) as charges from cc_logrefill cr left join cc_card as cc on cc.id=cr.card_id where $condition1 group by cc.tariff"); $HD_Form -> DBHandle -> Execute("create temporary table pnl_report_sub2 as - select tariff as id_tariffgroup,count(*) as first_use - from cc_card where $condition2 - group by tariff"); + select tariff as id_tariffgroup,count(*) as first_use + from cc_card where $condition2 + group by tariff"); $HD_Form -> DBHandle -> Execute("create index pnl_report_sub1_get on pnl_report_sub1(id_tariffgroup)"); $HD_Form -> DBHandle -> Execute("create index pnl_report_sub2_get on pnl_report_sub2(id_tariffgroup)"); $QUERY.=" left join cc_tariffgroup as cg on cg.id=id_tariffgroup - left join pnl_report_sub1 as t2 on t1.id_tariffgroup=t2.id_tariffgroup - left join pnl_report_sub2 as t4 on t1.id_tariffgroup=t4.id_tariffgroup - )as result - )as final + left join pnl_report_sub1 as t2 on t1.id_tariffgroup=t2.id_tariffgroup + left join pnl_report_sub2 as t4 on t1.id_tariffgroup=t4.id_tariffgroup + ) as result + )as final "; } } else { @@ -424,8 +416,7 @@ $FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFFFFF"; $FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F8FF"; -function linktonext_1($value) -{ +function linktonext_1($value) { $handle = DbConnect(); $inst_table = new Table("cc_card_group", "id"); $FG_TABLE_CLAUSE = "name = '$value'"; @@ -437,8 +428,8 @@ function linktonext_1($value) echo $value; } } -function linktonext_2($value) -{ + +function linktonext_2($value) { $handle = DbConnect(); $inst_table = new Table("cc_tariffgroup", "id"); $FG_TABLE_CLAUSE = "tariffgroupname = '$value'"; @@ -497,7 +488,7 @@ function linktonext_2($value) $HD_Form -> FG_FILTER_SEARCH_SESSION_NAME = 'pnl_selection'; $HD_Form -> FG_FK_DELETE_CONFIRM = true; $HD_Form -> FG_FK_DELETE_ALLOWED = true; -$HD_Form -> FieldViewElement ($FG_COL_QUERY); +$HD_Form -> FieldViewElement($FG_COL_QUERY); $HD_Form -> CV_NO_FIELDS = gettext("NO INFO!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; @@ -543,10 +534,10 @@ function linktonext_2($value)
    "; if ($k<3) { echo $row[$k]; diff --git a/admin/Public/calonlydays.html b/admin/Public/calonlydays.html old mode 100644 new mode 100755 index 8cd3d1ae9..69e87625f --- a/admin/Public/calonlydays.html +++ b/admin/Public/calonlydays.html @@ -31,19 +31,11 @@ // function passing selected date to calling window function set_datetime(day, b_close) { if (!obj_caller) return; - -// alert('day '+day+' time '+document.cal.time.value); - - var dt_datetime = obj_caller.prs_time((document.cal ? document.cal.time.value : ''),day); - -// alert('result '+dt_datetime); - if (dt_datetime == -1) return; window.close(); obj_caller.target.value = dt_datetime; } - @@ -62,7 +54,7 @@ document.write('') document.write(''); document.write(ARR_WEEKDAYS[(NUM_WEEKSTART+n)%7]+'
    - - + \ No newline at end of file diff --git a/admin/Public/card-history.php b/admin/Public/card-history.php old mode 100644 new mode 100755 index d356372b8..7bbbb668b --- a/admin/Public/card-history.php +++ b/admin/Public/card-history.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -246,7 +246,7 @@
    - "> diff --git a/admin/Public/cls_phpconfig.php b/admin/Public/cls_phpconfig.php old mode 100644 new mode 100755 index 20269aca9..51e930cf2 --- a/admin/Public/cls_phpconfig.php +++ b/admin/Public/cls_phpconfig.php @@ -97,7 +97,7 @@ function OC_setConfDirectories($newvalue) // build directory name => link menu list foreach ($newvalue as $item) { - $this->_OC_conf_dirs[$item] = $_SERVER['PHP_SELF'] . '?dir=' . $item; + $this->_OC_conf_dirs[$item] = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . '?dir=' . $item; } } @@ -120,7 +120,7 @@ function OC_readConfFile($confFile) { exit(); } - + $this->OC_setConfFile($this->_OC_conf_dir . '/' . basename($confFile)); $this->_OC_the_file = array(); @@ -435,7 +435,7 @@ function OC_checkAccess($user) echo 'Access file: ' .$this->_OC_access_file . 'not found!
    '; return(false); } - + $file = fopen($this->_OC_access_file, "r"); while (!feof($file)) @@ -443,7 +443,7 @@ function OC_checkAccess($user) $accessFile[] = fgets($file); } - fclose($file); + fclose($file); foreach ($accessFile as $line) { diff --git a/admin/Public/cls_phpconfig_html.php b/admin/Public/cls_phpconfig_html.php old mode 100644 new mode 100755 index d5c3e46d0..53e2ec789 --- a/admin/Public/cls_phpconfig_html.php +++ b/admin/Public/cls_phpconfig_html.php @@ -577,7 +577,7 @@ public function OC_HTML_showTimestat($start) ////////////////////////////////////////////////////////// public function OC_HTML_doConfigurationForm($file,$section,$theItems,$md5) { - $action = $_SERVER['PHP_SELF']."?file=$file"; + $action = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?file=$file"; ?> diff --git a/admin/Public/dashboard.php b/admin/Public/dashboard.php old mode 100644 new mode 100755 index 826f4495f..8e1aaa12d --- a/admin/Public/dashboard.php +++ b/admin/Public/dashboard.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/export_csv.php b/admin/Public/export_csv.php old mode 100644 new mode 100755 index 447247d57..ac627db2c --- a/admin/Public/export_csv.php +++ b/admin/Public/export_csv.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/form_data/FG_var_agent.inc b/admin/Public/form_data/FG_var_agent.inc old mode 100644 new mode 100755 index 7dd4f6d28..8f50e47f8 --- a/admin/Public/form_data/FG_var_agent.inc +++ b/admin/Public/form_data/FG_var_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,14 +27,14 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ -getpost_ifset(array('id', 'login', 'passwd', 'active', 'location', 'id_tariffgroup', 'options', 'credit', -'currency', 'locale', 'commission', 'vat', 'banner', 'language', 'perms', 'lastname', 'firstname', 'address', 'city', 'state', +getpost_ifset(array('id', 'login', 'passwd', 'active', 'location', 'id_tariffgroup', 'options', 'credit', +'currency', 'locale', 'commission', 'vat', 'banner', 'language', 'perms', 'lastname', 'firstname', 'address', 'city', 'state', 'country', 'zipcode', 'phone', 'email', 'fax')); @@ -100,7 +100,7 @@ if ($popup_select) { $HD_Form -> AddViewElement(gettext("LASTNAME"), "lastname", "14%", "center", "sort"); $HD_Form -> AddViewElement("".gettext("CUR")."", "currency", "5%", "center", "sort", "", "list", $currency_list_key); $HD_Form -> AddViewElement(gettext("ACTIVE"), "active", "3%", "center", "sort", "", "list", $yesno); - + $HD_Form -> FieldViewElement ('id, login, passwd, lastname, currency, active'); } else { $HD_Form -> AddViewElement(gettext("ID"), "id", "3%", "center", "sort"); @@ -113,7 +113,7 @@ if ($popup_select) { $HD_Form -> AddViewElement(gettext("COMMISSION"), "com_balance", "7%", "center", "sort"); $HD_Form -> AddViewElement("".gettext("CUR")."", "currency", "5%", "center", "sort", "", "list", $currency_list_key); $HD_Form -> AddViewElement(gettext("ACTIVE"), "active", "5%", "center", "sort", "", "list", $yesno); - + $HD_Form -> FieldViewElement ('id, datecreation, login, passwd, firstname, lastname, credit, com_balance, currency, active'); } @@ -136,19 +136,19 @@ if ($popup_select) { $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|param|');"; elseif ($popup_select == 2) $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|col0|');"; - + } else { $HD_Form -> FG_INFO = true; $HD_Form -> FG_INFO_LINK = "A2B_agent_info.php?id="; } if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { - + $HD_Form -> FG_EDITION = true; $HD_Form -> FG_ADDITION = true; $HD_Form -> FG_DELETION = true; - - + + $HD_Form -> AddEditElement (gettext("LOGIN"), "login", '$value', @@ -157,7 +157,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "3", gettext("Insert the login"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("PASSWORD"), "passwd", '$value', @@ -166,7 +166,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "3", gettext("Insert the password"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("PERMISSION"), "perms", '$value', @@ -175,7 +175,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", "", "list", "", "description, id", "", $right_list, "%1" , "", gettext("To select several rights in the above ListBox, hold the CTRL key down while clicking the items") ); - + $HD_Form -> AddEditElement (gettext("ACTIVE"), "active", '1', @@ -184,14 +184,14 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Choose if you want to active the agent"), "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Enable agent")); - + if ($form_action =="ask-add" || $form_action=="add") { $balance_access = "value = '0'"; $default_label_value = "0"; } else { $balance_access = 'readonly'; } - + $HD_Form -> AddEditElement (gettext("BALANCE"), "credit", "", @@ -209,14 +209,14 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("amount of commission"), "" , "", "", "", "", "", "", gettext("currency : ").strtoupper(BASE_CURRENCY) ); - + $HD_Form -> AddEditElement (gettext("CURRENCY"), "currency", "", "SELECT", "", "", "", "list" , "", "", "", $currency_list, "%1", "", gettext("Currency used at the customer end.") ); - + $HD_Form -> AddEditElement (gettext("COMMISSION PERCENTAGE"), "commission", "", @@ -234,7 +234,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "12", gettext("treshold remittance"), "" , "", "", "", "", "", "", gettext("currency : ").strtoupper(BASE_CURRENCY) ); - + $HD_Form -> AddEditElement (gettext("VAT"), "vat", "", @@ -243,7 +243,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "12", gettext("Insert the VAT"), "" , "", "", "", "", "", "NO-NULL", gettext("VAT")); - + $HD_Form -> AddEditElement (gettext("LANGUAGE"), "language", "", @@ -252,7 +252,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", "", "list" , "", "", "", $language_list, "%1", "", "" ); - + $HD_Form -> AddEditElement (gettext("COMPANY"), "company", '$value', @@ -261,7 +261,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the company"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("LAST NAME"), "lastname", '$value', @@ -270,7 +270,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the lastname"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("FIRST NAME"), "firstname", '$value', @@ -279,7 +279,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the firstname"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("ADDRESS"), "address", '$value', @@ -288,7 +288,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the address"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("CITY"), "city", '$value', @@ -297,7 +297,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the city"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("STATE"), "state", '$value', @@ -306,7 +306,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the state"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("COUNTRY"), "country", '$value', @@ -315,7 +315,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the country"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("ZIPCODE"), "zipcode", '$value', @@ -324,7 +324,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the zip code"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("EMAIL"), "email", '$value', @@ -333,7 +333,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "1", gettext("Insert the email"), "" , "", "", "", "" , "", "NO", ""); - + $HD_Form -> AddEditElement (gettext("PHONE"), "phone", '$value', @@ -342,7 +342,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the telephone number"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("FAX"), "fax", '$value', @@ -351,7 +351,7 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "", gettext("Insert the fax number"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("BANK INFO"), "bank_info", '', @@ -359,53 +359,53 @@ if (has_rights (ACX_MODIFY_AGENTS) && !($popup_select)) { "cols=50 rows=4", "", gettext("Insert the bank info of this agent"), - "" , "", "", "", "" , "", "", ""); - - + "" , "", "", "", "" , "", "", ""); + + $DBHandle_max = DbConnect(); $numrow = 0; $resmax = $DBHandle_max -> Execute("SELECT * FROM cc_tariffgroup"); if ( $resmax ) $numrow = $resmax -> RecordCount(); - if ($numrow > 0) { + if ($numrow > 0) { $HD_Form -> AddEditElement (gettext("CALL PLAN USABLE"), - "tariffgroup", - '$value', - "SELECT", + "tariffgroup", + '$value', + "SELECT", 'size="10" multiple="multiple"', - "", - "", - "sql", - "cc_agent_tariffgroup", - "label, id", + "", + "", + "sql", + "cc_agent_tariffgroup", + "label, id", "", "", "%1 : (%2)", "", "", "cc_agent_tariffgroup:id_tariffgroup:cc_tariffgroup LEFT JOIN cc_agent_tariffgroup ON cc_tariffgroup.id=cc_agent_tariffgroup.id_tariffgroup:DISTINCT cc_tariffgroup.tariffgroupname, cc_tariffgroup.id: cc_agent_tariffgroup.id_agent = %id:id_agent:%2 - (%1)::::%1:id='%1'"); } - - + + $FG_QUERY_EDITION = 'login, passwd, perms, active, credit,com_balance, currency, commission,threshold_remittance, vat, language, company, lastname, firstname, address, city, state, country, zipcode, email, phone, fax,bank_info'; $HD_Form -> FieldEditElement ($FG_QUERY_EDITION); - + $HD_Form -> FG_EDITION_CLAUSE = " id='%id'"; - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'creation_agent_refill'; - + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("Modify the properties of the")." ".$HD_Form->FG_INSTANCE_NAME; $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
    ".gettext("Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."
    "; - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); - - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - - -} + + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + + +} diff --git a/admin/Public/form_data/FG_var_agentsituation.inc b/admin/Public/form_data/FG_var_agentsituation.inc old mode 100644 new mode 100755 index 05d56bd82..f47142d80 --- a/admin/Public/form_data/FG_var_agentsituation.inc +++ b/admin/Public/form_data/FG_var_agentsituation.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -60,7 +60,7 @@ $HD_Form -> AddSearchElement_C1(gettext("FIRSTNAME"),'firstname','firstnametype' $HD_Form -> FG_ACTION_SIZE_COLUMN = '15%'; -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO").strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO").strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -87,7 +87,7 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_alarm.inc b/admin/Public/form_data/FG_var_alarm.inc old mode 100644 new mode 100755 index 76b231bc8..0faac057e --- a/admin/Public/form_data/FG_var_alarm.inc +++ b/admin/Public/form_data/FG_var_alarm.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -148,9 +148,9 @@ $HD_Form -> AddEditElement (gettext("MIN VALUE"), "" , "", "", "", "", "", "", gettext("Input the minimum value (between 0 and 1 for ASR ; >= 0 for ALOC in sec ; not used by CIC) or leave it empty")); $HD_Form -> AddEditElement(gettext("TRUNK"), "id_trunk", - '$value', - "POPUPVALUE", - "", + '$value', + "POPUPVALUE", + "", "", "", "" , "", "", "", "" , "A2B_entity_trunk.php?popup_select=1&", ", 'id_trunk','width=550,height=340,top=20,left=100,scrollbars=1'", gettext("Set if you want to apply the alarm on a specific trunk or leave empty for all trunk.")); @@ -192,8 +192,8 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_autorefill.inc b/admin/Public/form_data/FG_var_autorefill.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_backup.inc b/admin/Public/form_data/FG_var_backup.inc old mode 100644 new mode 100755 index c890ffaba..2a805dd14 --- a/admin/Public/form_data/FG_var_backup.inc +++ b/admin/Public/form_data/FG_var_backup.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -53,7 +53,7 @@ if ($form_action == 'add'){ // Make the backup stuff here and redirect to success page //mysqldump -all --databases mya2billing -ua2billinguser -pa2billing > /tmp/test.sql //pg_dump -c -d -U a2billinguser -h localhost -f /tmp/test.sql mya2billing - + if (DB_TYPE != 'postgres'){ $run_backup=MYSQLDUMP." -all --databases ".DBNAME." -u'".USER."' -p'".PASS."' > '{$backup_file}'"; }else{ @@ -122,7 +122,7 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on the CONTINUE button."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_billing_customer.inc b/admin/Public/form_data/FG_var_billing_customer.inc index b0c2d9900..ed9ee5d71 100644 --- a/admin/Public/form_data/FG_var_billing_customer.inc +++ b/admin/Public/form_data/FG_var_billing_customer.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,15 +27,12 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ - - getpost_ifset(array('id', 'id_card', 'date')); - if (!isset($form_action) || $form_action=="list") { $HD_Form = new FormHandler("cc_billing_customer LEFT JOIN cc_card ON cc_card.id=id_card ","Billing"); } else { @@ -57,8 +54,7 @@ $HD_Form -> AddViewElement(gettext("ACCOUNT"), "username", "15%", "center", "sor $HD_Form -> AddViewElement(gettext("BILLING DATE"), "cc_billing_customer.date", "20%", "center", "sort", "30", "", "", "", "", "", "display_dateformat"); $HD_Form -> FieldViewElement ('cc_billing_customer.id, username, cc_billing_customer.date'); - -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -66,34 +62,30 @@ $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; $HD_Form -> FG_ADDITION = true; $HD_Form -> FG_DELETION = true; - $HD_Form -> AddEditElement (gettext("ID CUSTOMER"), - "id_card", - "$value", "POPUPVALUE", "size=30 maxlength=50", - "4", gettext("Insert the Customer ID"), - "" , "", "", "", "", - "A2B_entity_card.php?popup_select=1&", ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , - gettext("Select the Customer ID")); - -if ($form_action=="ask-add"){ + "id_card", + "$value", "POPUPVALUE", "size=30 maxlength=50", + "4", gettext("Insert the Customer ID"), + "" , "", "", "", "", + "A2B_entity_card.php?popup_select=1&", ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , + gettext("Select the Customer ID")); + +if ($form_action=="ask-add"){ $comp_date = date("Y-m-d"); $comp_date="value='$comp_date'"; } $HD_Form -> AddEditElement (gettext("BILLING DATE"), - "date", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date", - "5", - gettext("Insert the current date (YYYY-MM-DD)"), - "" , "", "", "", "", "", "", "" ); - + "date", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date", + "8", + gettext("Insert the current date (YYYY-MM-DD)"), + "" , "", "", "", "", "", "", "" ); $HD_Form -> FieldEditElement ('id_card, date'); - - $HD_Form -> FG_FILTER_APPLY = true; $HD_Form -> FG_FILTERFIELD = 'cardnumber'; $HD_Form -> FG_FILTERFIELDNAME = 'Account number'; @@ -104,19 +96,13 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)){ $HD_Form -> FG_TABLE_CLAUSE.="username like '$filterprefix%'"; } - - $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this ".$HD_Form->FG_INSTANCE_NAME.", click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new ".$HD_Form->FG_INSTANCE_NAME.".
    Fill the following fields and confirm by clicking on the button add."); - $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new ".$HD_Form->FG_INSTANCE_NAME." has been inserted.
    "); $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'proccessing_billing_customer'; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - - - +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_call.inc b/admin/Public/form_data/FG_var_call.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_callback.inc b/admin/Public/form_data/FG_var_callback.inc index 3b0037717..f530ed97d 100755 --- a/admin/Public/form_data/FG_var_callback.inc +++ b/admin/Public/form_data/FG_var_callback.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -75,7 +75,7 @@ $HD_Form -> AddViewElement(gettext("SERVER"), "id_server", "5%", "center", "sort $HD_Form -> FieldViewElement ('id, uniqueid, entry_time, status, server_ip, num_attempt, manager_result, callback_time, last_attempt_time, channel, context, id_server'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO CALLBACK CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO CALLBACK CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -97,34 +97,34 @@ $HD_Form -> AddEditElement (gettext("SERVER GROUP"), "", "", "%1","", ""); -$HD_Form -> AddEditElement (gettext("UNIQUEID"), - "uniqueid", - '$value', - "INPUT", - "size=20 maxlength=30", - "3", - gettext("Insert the uniqueid"), +$HD_Form -> AddEditElement (gettext("UNIQUEID"), + "uniqueid", + '$value', + "INPUT", + "size=20 maxlength=30", + "3", + gettext("Insert the uniqueid"), "" , "", "", "", "" , "", "", gettext("This is an identifier to cross check the callback's request.").gettext("(useful if you have requests coming from an other platform through the API))") ); if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; - - $def_ipserver = " value='localhost' "; + + $def_ipserver = " value='localhost' "; $def_nbattempt = " value='0' "; } -$HD_Form -> AddEditElement (gettext("STATUS"), - "status", - '$value', - "SELECT", - "", - "", - "", +$HD_Form -> AddEditElement (gettext("STATUS"), + "status", + '$value', + "SELECT", + "", + "", + "", "list" , "", "", "", $status_list, "%1", "", "" ); @@ -138,13 +138,13 @@ $HD_Form -> AddEditElement (gettext("IP SERVER"), "" , "", "", "", "", "" , "", ""); -$HD_Form -> AddEditElement (gettext("NUMBER ATTEMPTS"), - "num_attempt", - '$value', - "INPUT", - "size=5 maxlength=10 $def_nbattempt", +$HD_Form -> AddEditElement (gettext("NUMBER ATTEMPTS"), + "num_attempt", + '$value', + "INPUT", + "size=5 maxlength=10 $def_nbattempt", "4", - gettext("Insert the number of attempts"), + gettext("Insert the number of attempts"), "" , "", "", "", "", "", "", ""); @@ -176,7 +176,7 @@ $HD_Form -> AddEditElement (gettext("CALLBACK DATE"), "10", "Insert the callback time", "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); - + $HD_Form -> AddEditElement (gettext("CHANNEL"), "channel", @@ -186,7 +186,7 @@ $HD_Form -> AddEditElement (gettext("CHANNEL"), "11", gettext("Insert the channel"), "" , "", "", "", "", "", "", gettext("Channel on which to originate the call (SIP/123@1.1.1.4)"), null, null, gettext("Define all the information requested by asterisk to generate the callback")); - + $HD_Form -> AddEditElement (gettext("EXTENSION"), "exten", @@ -325,8 +325,8 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create the new")." ".$HD_Form->FG_INSTANCE_NAME; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; diff --git a/admin/Public/form_data/FG_var_callerid.inc b/admin/Public/form_data/FG_var_callerid.inc old mode 100644 new mode 100755 index 72ec72e7c..de6cf629e --- a/admin/Public/form_data/FG_var_callerid.inc +++ b/admin/Public/form_data/FG_var_callerid.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -91,13 +91,13 @@ $HD_Form -> AddEditElement (gettext("ACTIVATED"), "" , "", "", "Yes :t, - No:f", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("ID CARD"), - "id_cc_card", - "$value", - "POPUPVALUE", - "size=30 maxlength=50", - "4", + "id_cc_card", + "$value", + "POPUPVALUE", + "size=30 maxlength=50", + "4", gettext("Insert the Id CardNumber"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Define the card number ID to use.")); @@ -138,9 +138,9 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_campaign.inc b/admin/Public/form_data/FG_var_campaign.inc index 5a30a4801..935c4b122 100644 --- a/admin/Public/form_data/FG_var_campaign.inc +++ b/admin/Public/form_data/FG_var_campaign.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -77,7 +77,7 @@ $HD_Form -> AddViewElement(gettext("STATUS"), "status", "5%", "center", "sort", $HD_Form -> FieldViewElement ('cc_campaign.name, cc_campaign.startingdate, cc_campaign.expirationdate, username,cc_campaign.status'); -$HD_Form -> CV_NO_FIELDS = gettext("No campaigns have been created."); +$HD_Form -> CV_NO_FIELDS = gettext("No campaigns have been created."); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -107,20 +107,20 @@ $HD_Form -> AddEditElement ("STATUS", if ($form_action=="ask-add") { - + $HD_Form -> AddEditElement (gettext("CUSTOMER ID"), - "id_card", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ", - "4", + "id_card", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ", + "4", gettext("Insert the customer ID"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the owner of this campaing, but you may not modify it in the future")); } else { - + $HD_Form -> AddEditElement (gettext("CUSTOMER ID"), "id_card", '$value', @@ -149,7 +149,7 @@ if ($form_action!="ask-add") { // TODO integrate in new framework if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $time = "value= '10:00:00'"; $time_plus = "value= '18:00:00'"; @@ -195,7 +195,7 @@ $HD_Form -> AddEditElement (gettext("FREQUENCY"), "size=20 maxlength=10", "4", gettext("Insert the frequency of callback in min "), - "" , "", "", "", "" , "", "", gettext("Please insert the frequency in minutes")); + "" , "", "", "", "" , "", "", gettext("Please insert the frequency in minutes")); $HD_Form -> AddEditElement (gettext("DAILY START TIME"), "daily_start_time", @@ -214,7 +214,7 @@ $HD_Form -> AddEditElement (gettext("DAILY STOP TIME"), "20", gettext("Insert the daily stop time"), "" , "", "", "", "", "", "res_display_dateformat", gettext("Please respect the format HH:MM:SS. For instance, '00:00:00'")); - + $HD_Form -> AddEditElement (gettext("MONDAY"), "monday", @@ -224,7 +224,7 @@ $HD_Form -> AddEditElement (gettext("MONDAY"), "", gettext("Choose if you want to enable the campaign callback for the monday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("TUESDAY"), "tuesday", '1', @@ -233,7 +233,7 @@ $HD_Form -> AddEditElement (gettext("TUESDAY"), "", gettext("Choose if you want to enable the campaign callback for the monday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("WEDNESDAY"), "wednesday", '1', @@ -242,7 +242,7 @@ $HD_Form -> AddEditElement (gettext("WEDNESDAY"), "", gettext("Choose if you want to enable the campaign callback for the monday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("THURSDAY"), "thursday", '1', @@ -251,7 +251,7 @@ $HD_Form -> AddEditElement (gettext("THURSDAY"), "", gettext("Choose if you want to enable the campaign callback for the thursday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("FRIDAY"), "friday", '1', @@ -260,7 +260,7 @@ $HD_Form -> AddEditElement (gettext("FRIDAY"), "", gettext("Choose if you want to enable the campaign callback for the friday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("SATURDAY"), "saturday", '0', @@ -269,7 +269,7 @@ $HD_Form -> AddEditElement (gettext("SATURDAY"), "", gettext("Choose if you want to enable the campaign callback for the saturday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("SUNDAY"), "sunday", '0', @@ -278,7 +278,7 @@ $HD_Form -> AddEditElement (gettext("SUNDAY"), "", gettext("Choose if you want to enable the campaign callback for the sunday"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); - + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -292,26 +292,26 @@ $HD_Form -> AddEditElement (gettext("DESCRIPTION"), $HD_Form -> FieldEditElement ("name, status, id_card $edit_col, id_cid_group, startingdate, expirationdate, frequency, daily_start_time, daily_stop_time, monday, tuesday, wednesday, thursday, friday, saturday, sunday, description" ); $HD_Form -> FG_EDITION_CLAUSE = " id='%id'"; -if ($form_action!="ask-delete") { +if ($form_action!="ask-delete") { $DBHandle_max = DbConnect(); $numrow = 0; $resmax = $DBHandle_max -> Execute("SELECT * FROM cc_phonebook"); if ( $resmax ) $numrow = $resmax -> RecordCount( ); - + if ($numrow>0) { $HD_Form -> AddEditElement (gettext("PHONE BOOK"), - "phonebook", - '$value', - "SELECT", + "phonebook", + '$value', + "SELECT", 'size="10" multiple="multiple"', - "", - "", - "sql", - "campaigns_phonebooks", - "name, id", - "", "", "%1 : (%2)", "", "", "cc_campaign_phonebook:id_phonebook:cc_phonebook LEFT JOIN cc_campaign_phonebook ON cc_phonebook.id=cc_campaign_phonebook.id_phonebook:DISTINCT cc_phonebook.name, cc_phonebook.id: cc_campaign_phonebook.id_campaign = %id:id_campaign:%2 - (%1)::::%1:id='%1'"); - + "", + "", + "sql", + "campaigns_phonebooks", + "name, id", + "", "", "%1 : (%2)", "", "", "cc_campaign_phonebook:id_phonebook:cc_phonebook LEFT JOIN cc_campaign_phonebook ON cc_phonebook.id=cc_campaign_phonebook.id_phonebook:DISTINCT cc_phonebook.name, cc_phonebook.id: cc_campaign_phonebook.id_campaign = %id:id_campaign:%2 - (%1)::::%1:id='%1'"); + } } diff --git a/admin/Public/form_data/FG_var_card.inc b/admin/Public/form_data/FG_var_card.inc old mode 100644 new mode 100755 index d9ef4c9ff..b53340cc9 --- a/admin/Public/form_data/FG_var_card.inc +++ b/admin/Public/form_data/FG_var_card.inc @@ -32,15 +32,14 @@ **/ - getpost_ifset(array('id', 'username', 'useralias', 'uipass', 'credit', 'language', 'tariff', -'id_didgroup','id_campaign', 'callback', 'simultaccess', 'currency','typepaid', 'creditlimit', -'lastname', 'firstname', 'email', 'address','city', 'state', 'country', 'zipcode', 'phone', 'fax', 'inuse', -'max_concurrent', 'cid', 'runservice', 'firstusedate','expirationdate', 'enableexpire', 'expiredays', 'sip_buddy', -'iax_buddy','popup_select', 'vat', 'autorefill', 'initialbalance', 'mac_addr', 'cardnumberlenght_list', -'status', 'block', 'lock_pin', 'template_invoice', 'template_outstanding', 'description', 'voicemail_activated', -'voicemail_permitted','email_notification','credit_notification','notify_email', 'id_seria', -'company_name' , 'company_website' , 'vat_rn' , 'traffic' , 'traffic_target','discount','restriction' )); + 'id_didgroup','id_campaign', 'callback', 'simultaccess', 'currency','typepaid', 'creditlimit', + 'lastname', 'firstname', 'email', 'address','city', 'state', 'country', 'zipcode', 'phone', 'fax', 'inuse', + 'max_concurrent', 'cid', 'runservice', 'firstusedate','expirationdate', 'enableexpire', 'expiredays', 'sip_buddy', + 'iax_buddy','popup_select', 'vat', 'autorefill', 'initialbalance', 'mac_addr', 'cardnumberlenght_list', + 'status', 'block', 'lock_pin', 'template_invoice', 'template_outstanding', 'description', 'voicemail_activated', + 'voicemail_permitted','email_notification','credit_notification','notify_email', 'id_seria', + 'company_name' , 'company_website' , 'vat_rn' , 'traffic' , 'traffic_target','discount','restriction' )); $HD_Form = new FormHandler("cc_card", gettext("Card")); @@ -56,23 +55,23 @@ $HD_Form -> FG_FK_EDITION_CLAUSE = array("id_cc_card", "id_cc_card", "id_cc_card $HD_Form -> FG_FK_WARNONLY = (DELETE_FK_CARD == true) ? false: true; if (DELETE_FK_CARD) { - // WE WILL DELETE THE FK - $HD_Form -> FG_FK_DELETE_MESSAGE = gettext("You are going as well to remove all the SIP/IAX accounts & CallerIDs attached to this card! Please confirm that you really want to remove this card ? "); + // WE WILL DELETE THE FK + $HD_Form -> FG_FK_DELETE_MESSAGE = gettext("You are going as well to remove all the SIP/IAX accounts & CallerIDs attached to this card! Please confirm that you really want to remove this card ? "); } else { - // WE JUST NOTIFY - $HD_Form -> FG_FK_DELETE_MESSAGE = gettext("You are going to remove a card that have SIP/IAX accounts and/or CallerIDs attached to it ! Please confirm that you really want to remove this card ? "); + // WE JUST NOTIFY + $HD_Form -> FG_FK_DELETE_MESSAGE = gettext("You are going to remove a card that have SIP/IAX accounts and/or CallerIDs attached to it ! Please confirm that you really want to remove this card ? "); } if (!($popup_select>=1)) { - $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; - $HD_Form ->FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_card_multi.php?stitle=Card§ion=".$_SESSION["menu_section"]; - $HD_Form ->FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Generate Customers"); - $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/user_multi_add.png" ; - - $HD_Form ->FG_LIST_ADDING_BUTTON2 = true; - $HD_Form ->FG_LIST_ADDING_BUTTON_LINK2 = "A2B_entity_card.php?form_action=ask-add&atmenu=card&stitle=Card§ion=".$_SESSION["menu_section"]; - $HD_Form ->FG_LIST_ADDING_BUTTON_ALT2 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG2 = gettext("Add Customer"); - $HD_Form ->FG_LIST_ADDING_BUTTON_IMG2 = Images_Path ."/user_add.png" ; + $HD_Form ->FG_LIST_ADDING_BUTTON1 = true; + $HD_Form ->FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_card_multi.php?stitle=Card§ion=".$_SESSION["menu_section"]; + $HD_Form ->FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Generate Customers"); + $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/user_multi_add.png" ; + + $HD_Form ->FG_LIST_ADDING_BUTTON2 = true; + $HD_Form ->FG_LIST_ADDING_BUTTON_LINK2 = "A2B_entity_card.php?form_action=ask-add&atmenu=card&stitle=Card§ion=".$_SESSION["menu_section"]; + $HD_Form ->FG_LIST_ADDING_BUTTON_ALT2 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG2 = gettext("Add Customer"); + $HD_Form ->FG_LIST_ADDING_BUTTON_IMG2 = Images_Path ."/user_add.png" ; } $cnts= new Constants(); @@ -90,9 +89,9 @@ $indcur=0; $currencies_list = get_currencies(); foreach($currencies_list as $key => $cur_value) { - $currency_list[$key] = array( $cur_value[1].' ('.$cur_value[2].')', $key); - $currency_list_r[$key] = array( $key, $cur_value[1]); - $currency_list_key[$key][0] = $key; + $currency_list[$key] = array( $cur_value[1].' ('.$cur_value[2].')', $key); + $currency_list_r[$key] = array( $key, $cur_value[1]); + $currency_list_key[$key][0] = $key; } $restriction_list = $cnts->getRestrictionList(); @@ -113,19 +112,19 @@ $show_list_temp = array(); $show_list_temp = preg_split('/,/', $A2B->config["webui"]['card_show_field_list']); foreach ($show_list_temp as $i => $value) { - $a = strtolower(trim($value)); - $pos = strpos($a, ':'); - if (!($pos === false)) { - $temp_ar = preg_split('/:/', $a); - $b = $temp_ar[1]; - $a = strtolower(trim($temp_ar[0])); - if (strlen($a)>1) { - $show_list_sizes[$a] = $b; - } - } - if (strlen($a)>1) { - $show_list[$a] = $a; - } + $a = strtolower(trim($value)); + $pos = strpos($a, ':'); + if (!($pos === false)) { + $temp_ar = preg_split('/:/', $a); + $b = $temp_ar[1]; + $a = strtolower(trim($temp_ar[0])); + if (strlen($a)>1) { + $show_list_sizes[$a] = $b; + } + } + if (strlen($a)>1) { + $show_list[$a] = $a; + } } $show_fields = array(); $show_fields['id'] = array(gettext("ID"), "id", "3%", "center", "sort","", "", "", "", "", "", ""); @@ -139,61 +138,61 @@ $show_fields['id_group'] = array(gettext("GROUP"), "id_group", "6%", "center", " $show_fields['credit'] = array("".gettext("BA")."", "credit", "5%", "center", "sort", "", "", "", "", "", "", "display_2bill"); if (!($popup_select>=1)) { - $serial_pad_length = $A2B->config["webui"]['card_serial_length']; - $show_fields['id_seria'] = array(gettext("SERIE"), "id_seria", "*", "center", "sort", "15", "lie", "cc_card_seria", "name","id='%id'", "%1",""); - $show_fields['serial'] = array("SERIAL#", "serial", "*","center", "sort","","eval",'str_pad("%C",'.$serial_pad_length.' , "0", STR_PAD_LEFT)'); - $show_fields['tariff'] = array("".gettext('PLAN')."", - "tariff", "8%", "center", "sort", "20", "lie", "cc_tariffgroup", "tariffgroupname", "id='%id'", "%1"); - $show_fields['status'] = array(gettext("STATUS"), "status", "4%", "center", "sort", "", "list", $cardstatus_list_acronym); - $show_fields['language']=array(gettext("LG"), "language", "3%", "center", "sort"); - $show_fields['inuse'] = array(gettext("USE"), "inuse", "3%", "center", "sort"); - $show_fields['currency'] = array("".gettext("CUR")."", "currency", "4%", "center", "sort", "", "list", $currency_list_key); - $show_fields['sip_buddy'] = array(gettext("SIP"), "sip_buddy", "2%", "center", "sort", "", "list", $yesno); - $show_fields['iax_buddy'] = array(gettext("IAX"), "iax_buddy", "2%", "center", "sort", "", "list", $yesno); - $show_fields['nbused'] = array("".gettext("ACD")."", "nbused", "3%", "center", "sort"); - $show_fields['firstname'] = array(gettext("FIRSTNAME"), "firstname", "7%", "center", "sort", "15"); - $show_fields['email'] = array(gettext("EMAIL"), "email","","center", "sort", "40"); - $show_fields['discount'] = array("".gettext("DISC")."", "discount","","center", "sort", "15","30", "", "", "", "", "display_percentage"); - $show_fields['callerid'] = array("".gettext("CID")."", "callerid","","center", "sort", "15"); - $FG_COL_QUERY = 'DISTINCT '; + $serial_pad_length = $A2B->config["webui"]['card_serial_length']; + $show_fields['id_seria'] = array(gettext("SERIE"), "id_seria", "*", "center", "sort", "15", "lie", "cc_card_seria", "name","id='%id'", "%1",""); + $show_fields['serial'] = array("SERIAL#", "serial", "*","center", "sort","","eval",'str_pad("%C",'.$serial_pad_length.' , "0", STR_PAD_LEFT)'); + $show_fields['tariff'] = array("".gettext('PLAN')."", + "tariff", "8%", "center", "sort", "20", "lie", "cc_tariffgroup", "tariffgroupname", "id='%id'", "%1"); + $show_fields['status'] = array(gettext("STATUS"), "status", "4%", "center", "sort", "", "list", $cardstatus_list_acronym); + $show_fields['language']=array(gettext("LG"), "language", "3%", "center", "sort"); + $show_fields['inuse'] = array(gettext("USE"), "inuse", "3%", "center", "sort"); + $show_fields['currency'] = array("".gettext("CUR")."", "currency", "4%", "center", "sort", "", "list", $currency_list_key); + $show_fields['sip_buddy'] = array(gettext("SIP"), "sip_buddy", "2%", "center", "sort", "", "list", $yesno); + $show_fields['iax_buddy'] = array(gettext("IAX"), "iax_buddy", "2%", "center", "sort", "", "list", $yesno); + $show_fields['nbused'] = array("".gettext("ACD")."", "nbused", "3%", "center", "sort"); + $show_fields['firstname'] = array(gettext("FIRSTNAME"), "firstname", "7%", "center", "sort", "15"); + $show_fields['email'] = array(gettext("EMAIL"), "email","","center", "sort", "40"); + $show_fields['discount'] = array("".gettext("DISC")."", "discount","","center", "sort", "15","30", "", "", "", "", "display_percentage"); + $show_fields['callerid'] = array("".gettext("CID")."", "callerid","","center", "sort", "15"); + $FG_COL_QUERY = 'DISTINCT '; }else{ - $show_list_temp = array('id', 'username', 'lastname', 'id_group', 'credit'); - foreach ($show_list_temp as $i => $value) { + $show_list_temp = array('id', 'username', 'lastname', 'id_group', 'credit'); + foreach ($show_list_temp as $i => $value) { $show_list[$value] = $value; - } + } - $FG_COL_QUERY = 'DISTINCT '; + $FG_COL_QUERY = 'DISTINCT '; } $FG_COL_QUERY_FIELD = ''; $index = 0; foreach ($show_list as $i => $value) { - if (array_key_exists($i,$show_fields)) { - $param = $show_fields[$i]; - $param = $param + array("","","","","","");#expand array to max length - $size = "*"; - $param7 = $param[7]; - if ($param[6]=="eval"){ - $param7 = str_replace('%C', '%'.$index, $param7);//because of dynamic nature need set current field for eval - }; - if (array_key_exists($i,$show_list_sizes)) { - if ((strlen(trim($show_list_sizes[$i])==0))&&(strlen(trim($param[2])>0))){ - $size = $param[2]; - }else{ - $size = $show_list_sizes[$i]; - } - } - $HD_Form -> AddViewElement($param[0],$param[1],$size,$param[3],$param[4],$param[5],$param[6],$param7,$param[8], - $param[9],$param[10],$param[11],$param[12]); - if ($value=='callerid') { - $FG_COL_QUERY_FIELD = $FG_COL_QUERY_FIELD .', (select GROUP_CONCAT(cid SEPARATOR \'
    \') from cc_callerid where id_cc_card=cc_card.id) as callerid'; - } else { - $FG_COL_QUERY_FIELD = $FG_COL_QUERY_FIELD .', '.$value; - } - $index = $index + 1; - } + if (array_key_exists($i,$show_fields)) { + $param = $show_fields[$i]; + $param = $param + array("","","","","","");#expand array to max length + $size = "*"; + $param7 = $param[7]; + if ($param[6]=="eval"){ + $param7 = str_replace('%C', '%'.$index, $param7);//because of dynamic nature need set current field for eval + }; + if (array_key_exists($i,$show_list_sizes)) { + if ((strlen(trim($show_list_sizes[$i])==0))&&(strlen(trim($param[2])>0))){ + $size = $param[2]; + }else{ + $size = $show_list_sizes[$i]; + } + } + $HD_Form -> AddViewElement($param[0],$param[1],$size,$param[3],$param[4],$param[5],$param[6],$param7,$param[8], + $param[9],$param[10],$param[11],$param[12]); + if ($value=='callerid') { + $FG_COL_QUERY_FIELD = $FG_COL_QUERY_FIELD .', (select GROUP_CONCAT(cid SEPARATOR \'
    \') from cc_callerid where id_cc_card=cc_card.id) as callerid'; + } else { + $FG_COL_QUERY_FIELD = $FG_COL_QUERY_FIELD .', '.$value; + } + $index = $index + 1; + } } if (strlen($FG_COL_QUERY_FIELD)>2) { - $FG_COL_QUERY_FIELD = substr( $FG_COL_QUERY_FIELD,2); + $FG_COL_QUERY_FIELD = substr( $FG_COL_QUERY_FIELD,2); } $FG_COL_QUERY_COUNT = count(preg_split('/,/',$FG_COL_QUERY_FIELD)); $FG_COL_QUERY_FIELD = $FG_COL_QUERY_FIELD.', id as id_,username as username_,useralias as alias_ '; @@ -214,13 +213,13 @@ if (!($popup_select>=1)) $HD_Form -> FG_EXPORT_XML = true; $HD_Form -> FG_EXPORT_SESSION_VAR = "pr_export_entity_card"; -if (($popup_select>=1)) $HD_Form ->FG_LIMITE_DISPLAY = 7; +if (($popup_select>=1)) $HD_Form ->FG_LIMITE_DISPLAY = 7; $HD_Form -> CV_FOLLOWPARAMETERS= "&popup_select=".$popup_select."&popup_formname=".$popup_formname."&popup_fieldname=".$popup_fieldname; // Search form -if (!($popup_select>=1)) $HD_Form -> FG_FILTER_SEARCH_FORM = true; +if (!($popup_select>=1)) $HD_Form -> FG_FILTER_SEARCH_FORM = true; $HD_Form -> FG_FILTER_SEARCH_TOP_TEXT = gettext('Define specific criteria to search for cards created.'); $HD_Form -> FG_FILTER_SEARCH_1_TIME = true; @@ -234,8 +233,11 @@ $HD_Form -> FG_FILTER_SEARCH_1_TIME_FIELD_BIS = 'firstusedate'; $HD_Form -> AddSearchElement_C1(gettext("ACCOUNT NUMBER"), 'username','usernametype'); $HD_Form -> AddSearchElement_C1(gettext("EMAIL"), 'email','emailtype'); $HD_Form -> AddSearchElement_C1(gettext("LASTNAME"),'lastname','lastnametype'); +$HD_Form -> AddSearchElement_C1(gettext("FIRSTNAME"),'firstname','firstnametype'); $HD_Form -> AddSearchElement_C1(gettext("LOGIN"),'useralias','useraliastype'); +$HD_Form -> AddSearchElement_C2(gettext("LOGIN NUMERIC"),'useralias1','useralias1type','useralias2','useralias2type','useralias'); $HD_Form -> AddSearchElement_C1(gettext("MACADDRESS"),'mac_addr','macaddresstype'); +$HD_Form -> AddSearchElement_C1(gettext("COMPANY NAME"),'company_name','companynametype'); $HD_Form -> AddSearchElement_C2(gettext("CUSTOMER ID"),'id1','id1type','id2','id2type','id'); $HD_Form -> AddSearchElement_C2(gettext("SERIAL"),'serial1','serial1type','serial2','serial2type','serial'); $HD_Form -> AddSearchElement_C2(gettext("CREDIT"),'credit1','credit1type','credit2','credit2type','credit'); @@ -253,43 +255,43 @@ $HD_Form -> AddSearchElement_Select(gettext("SELECT LANGUAGE"), null, null, null $HD_Form -> AddSearchElement_Select(gettext("SELECT PAYMENT TYPE"), null, null, null, null, null, "typepaid", 0, $typepaid_list_r); if (($popup_select>=1)) { - $HD_Form -> FG_OTHER_BUTTON1 = true; - $HD_Form -> FG_OTHER_BUTTON1_ALT = '<select>'; - $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; + $HD_Form -> FG_OTHER_BUTTON1 = true; + $HD_Form -> FG_OTHER_BUTTON1_ALT = '<select>'; + $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; - if ($popup_select==1) { - $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|param|', '|col1|');"; - } elseif ($popup_select==2) { - $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|col1|');"; - } + if ($popup_select==1) { + $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|param|', '|col1|');"; + } elseif ($popup_select==2) { + $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|col1|');"; + } } else { - $HD_Form -> FG_INFO = true; - $HD_Form -> FG_OTHER_BUTTON1 = true; - $HD_Form -> FG_OTHER_BUTTON2 = true; - $HD_Form -> FG_OTHER_BUTTON3 = true; - $HD_Form -> FG_OTHER_BUTTON4 = true; - $HD_Form -> FG_OTHER_BUTTON5 = true; - $FN_COLUMN_ID="col".($FG_COL_QUERY_COUNT);//get numbers of rows for needed fields - $FN_COLUMN_USERNAME="col".($FG_COL_QUERY_COUNT+1); - $FN_COLUMN_ALIAS="col".($FG_COL_QUERY_COUNT+2); - $HD_Form -> FG_OTHER_BUTTON1_LINK="A2B_entity_friend.php?atmenu=sip&form_action=add_sip&id_cc_card=|$FN_COLUMN_ID|&cardnumber=|$FN_COLUMN_USERNAME|&useralias=|$FN_COLUMN_ALIAS|"; - $HD_Form -> FG_OTHER_BUTTON2_LINK="A2B_entity_friend.php?atmenu=iax&form_action=add_iax&id_cc_card=|$FN_COLUMN_ID|&cardnumber=|$FN_COLUMN_USERNAME|&useralias=|$FN_COLUMN_ALIAS|"; - $HD_Form -> FG_OTHER_BUTTON3_LINK="A2B_entity_payment.php?form_action=ask-add&card_id=|$FN_COLUMN_ID|"; - $HD_Form -> FG_OTHER_BUTTON4_LINK="A2B_entity_subscriber.php?form_action=ask-add&id=|$FN_COLUMN_ID|"; - $HD_Form -> FG_OTHER_BUTTON5_LINK="A2B_mass_mail.php?form_action=ask-add&id=|$FN_COLUMN_ID|"; - $HD_Form -> FG_INFO_LINK = "A2B_card_info.php?id="; - //FOR INFO , DEL, EDIT the image is already in Image_Path - $HD_Form -> FG_OTHER_BUTTON1_IMG = Images_Path . "/icon-sip.gif"; - $HD_Form -> FG_OTHER_BUTTON2_IMG = Images_Path . "/icon-iax.gif"; - $HD_Form -> FG_OTHER_BUTTON3_IMG = Images_Path . "/money.png"; - $HD_Form -> FG_OTHER_BUTTON4_IMG = Images_Path . "/book_add.png"; - $HD_Form -> FG_OTHER_BUTTON5_IMG = Images_Path . "/email.png"; - $HD_Form -> FG_OTHER_BUTTON1_ALT=gettext("Auto Create SIP Config"); - $HD_Form -> FG_OTHER_BUTTON2_ALT=gettext("Auto Create IAX Config"); - $HD_Form -> FG_OTHER_BUTTON3_ALT = gettext('Add Payment to this Card'); - $HD_Form -> FG_OTHER_BUTTON4_ALT = gettext('Add New Subscription to this Card'); - $HD_Form -> FG_OTHER_BUTTON5_ALT = gettext('Email to this Customer'); + $HD_Form -> FG_INFO = true; + $HD_Form -> FG_OTHER_BUTTON1 = true; + $HD_Form -> FG_OTHER_BUTTON2 = true; + $HD_Form -> FG_OTHER_BUTTON3 = true; + $HD_Form -> FG_OTHER_BUTTON4 = true; + $HD_Form -> FG_OTHER_BUTTON5 = true; + $FN_COLUMN_ID="col".($FG_COL_QUERY_COUNT);//get numbers of rows for needed fields + $FN_COLUMN_USERNAME="col".($FG_COL_QUERY_COUNT+1); + $FN_COLUMN_ALIAS="col".($FG_COL_QUERY_COUNT+2); + $HD_Form -> FG_OTHER_BUTTON1_LINK="A2B_entity_friend.php?atmenu=sip&form_action=add_sip&id_cc_card=|$FN_COLUMN_ID|&cardnumber=|$FN_COLUMN_USERNAME|&useralias=|$FN_COLUMN_ALIAS|"; + $HD_Form -> FG_OTHER_BUTTON2_LINK="A2B_entity_friend.php?atmenu=iax&form_action=add_iax&id_cc_card=|$FN_COLUMN_ID|&cardnumber=|$FN_COLUMN_USERNAME|&useralias=|$FN_COLUMN_ALIAS|"; + $HD_Form -> FG_OTHER_BUTTON3_LINK="A2B_entity_payment.php?form_action=ask-add&card_id=|$FN_COLUMN_ID|"; + $HD_Form -> FG_OTHER_BUTTON4_LINK="A2B_entity_subscriber.php?form_action=ask-add&id=|$FN_COLUMN_ID|"; + $HD_Form -> FG_OTHER_BUTTON5_LINK="A2B_mass_mail.php?form_action=ask-add&id=|$FN_COLUMN_ID|"; + $HD_Form -> FG_INFO_LINK = "A2B_card_info.php?id="; + //FOR INFO , DEL, EDIT the image is already in Image_Path + $HD_Form -> FG_OTHER_BUTTON1_IMG = Images_Path . "/icon-sip.gif"; + $HD_Form -> FG_OTHER_BUTTON2_IMG = Images_Path . "/icon-iax.gif"; + $HD_Form -> FG_OTHER_BUTTON3_IMG = Images_Path . "/money.png"; + $HD_Form -> FG_OTHER_BUTTON4_IMG = Images_Path . "/book_add.png"; + $HD_Form -> FG_OTHER_BUTTON5_IMG = Images_Path . "/email.png"; + $HD_Form -> FG_OTHER_BUTTON1_ALT=gettext("Auto Create SIP Config"); + $HD_Form -> FG_OTHER_BUTTON2_ALT=gettext("Auto Create IAX Config"); + $HD_Form -> FG_OTHER_BUTTON3_ALT = gettext('Add Payment to this Card'); + $HD_Form -> FG_OTHER_BUTTON4_ALT = gettext('Add New Subscription to this Card'); + $HD_Form -> FG_OTHER_BUTTON5_ALT = gettext('Email to this Customer'); } $HD_Form -> FG_FILTER_APPLY = true; @@ -299,735 +301,738 @@ $HD_Form -> FG_FILTER_FORM_ACTION = 'list'; if (isset($filterprefix) && (strlen($filterprefix)>0)){ - if (strlen($HD_Form -> FG_TABLE_CLAUSE)>0) $HD_Form -> FG_TABLE_CLAUSE.=" AND "; - $HD_Form -> FG_TABLE_CLAUSE.="username like '$filterprefix%'"; + if (strlen($HD_Form -> FG_TABLE_CLAUSE)>0) $HD_Form -> FG_TABLE_CLAUSE.=" AND "; + $HD_Form -> FG_TABLE_CLAUSE.="username like '$filterprefix%'"; } $HD_Form -> FG_ADDITION = true; if (has_rights (ACX_MODIFY_CUSTOMERS) && !($popup_select>=1)) { - $HD_Form -> FG_EDITION = true; - $HD_Form -> FG_DELETION = true; - - $maxi = ''; - $maxi2 = ''; - $maxi3 = ''; - - if (isset($form_action) && $form_action=="ask-add") { - if (!is_numeric($cardnumberlenght_list)) $cardnumberlenght_list = LEN_CARDNUMBER; - $array_card_generated = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list); - $maxi = "value='".$array_card_generated[0]."'"; - $maxi2 = "value='".$array_card_generated[1]."'"; - $pass = MDP_NUMERIC(5).MDP_STRING(15); - $maxi3 = "value='".$pass."'"; - $default_initbalance = "value='0'"; - } - - $HD_Form -> AddEditElement (gettext("ACCOUNT NUMBER"), - "username", - "", - "INPUT", - "size=30 $maxi readonly maxlength=40", - "4", - gettext("Insert the account number"), - "" , "", "", "", "" , "", "", '', null, null, gettext("Customer Information")); - - - $HD_Form -> AddEditElement (gettext("WEBUI LOGIN"), - "useralias", - "", - "INPUT", - "size=20 $maxi2 maxlength=40", - "4", - gettext("Insert the webui login"), - "" , "", "", "", "" , "", "", ""); - - - $HD_Form -> AddEditElement (gettext("WEBUI PASSWORD"), - "uipass", - '', - "INPUT", - "size=20 $maxi3 maxlength=20", - "", - gettext("Insert the password"), - "" , "", "", "", "", "", "", gettext("Password for customer to access to the web interface and view the balance.") ); - - if ($form_action =="ask-add" || $form_action=="add") { - $balance_access = "value = '0'"; - $payment_status = ""; - - } else { - $balance_access = 'readonly'; - $payment_status= 'disabled="true" style="color: gray;" '; - } - - $HD_Form -> AddEditElement (gettext("BALANCE"), - "credit", - "", - "INPUT", - "size=30 maxlength=30 ".$balance_access, - "12", - gettext("Insert the number of credit"), - "" , "", "", "", "", "", "", gettext("currency : ").strtoupper(BASE_CURRENCY) ); - - - $HD_Form -> AddEditElement (gettext("CUSTOMER GROUP"), - "id_group", - "", - "SELECT", - "", "", "", - "sql", - "cc_card_group", - "name, id", - "", "", "%1", "", "", "", "", ""); - - $HD_Form -> AddEditElement (gettext("SERIAL"), - "id_seria", - "", - "SELECT", - "", "", "", - "sql", - "cc_card_seria", - "name, id", - "", "", "%1", "", "", "", '' ); - - - $HD_Form -> AddEditElement (gettext("LAST NAME"), - "lastname", - '$value', - "INPUT", - "size=30 maxlength=50", - "11", - gettext("Insert the lastname of the customers"), - "" , "", "", "", "", "" , "NO", "", null, null, gettext("Personal Information")); - - $HD_Form -> AddEditElement (gettext("FIRST NAME"), - "firstname", - '$value', - "INPUT", - "size=30 maxlength=50", - "11", - gettext("Insert the firstname of the customers"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("EMAIL"), - "email", - '$value', - "INPUT", - "size=30 maxlength=70", - "1", - gettext("Insert the email"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("ADDRESS"), - "address", - '$value', - "INPUT", - "size=30 maxlength=100", - "0", - gettext("Insert the address of the customers"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("CITY"), - "city", - '$value', - "INPUT", - "size=30 maxlength=40", - "0", - gettext("Insert the city"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("STATE/PROVINCE"), - "state", - '$value', - "INPUT", - "size=30 maxlength=40", - "11", - gettext("Insert the state"), - "" , "", "", "", "", "" , "NO", ""); - - if ($form_action == 'ask-add') { - $country_default_val = 'USA'; - } - - $HD_Form -> AddEditElement (gettext("COUNTRY"), - "country", - "$country_default_val", - "SELECT", - "", "", "", - "sql", - "cc_country", - "countryname, countrycode", - "", "", "%1", "", "", "", '' ); - - $HD_Form -> AddEditElement (gettext("ZIP/POSTAL CODE"), - "zipcode", - '$value', - "INPUT", - "size=30 maxlength=20", - "0", - gettext("Insert the zipcode"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("PHONE NUMBER"), - "phone", - '$value', - "INPUT", - "size=30 maxlength=20", - "7", - gettext("Insert the phone number of the customers"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("FAX NUMBER"), - "fax", - '$value', - "INPUT", - "size=30 maxlength=20", - "", - gettext("Insert the fax number of the customers"), - "" , "", "", "", "", "" , "NO", ""); - - $HD_Form -> AddEditElement (gettext("COMPANY NAME"), - "company_name", - '$value', - "INPUT", - "size=40 maxlength=50", - "", - gettext("Insert Company name of this customer"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("COMPANY WEBSITE"), - "company_website", - '$value', - "INPUT", - "size=40 maxlength=60", - "", - gettext("Insert the company website of this customer"), - "" , "", "", "", "", "" , "NO", ""); - - if ($form_action != "edit") { - - $update_field_typepaid = 'typepaid ,'; - - $HD_Form -> AddEditElement (gettext("PAYMENT TYPE"), - "typepaid", - "", - "SELECT", - "$payment_status", - "", - "", - "list" , "", "", "", $typepaid_list, "%1", "", '', null, null, gettext("Customer Status") ); - } - - $HD_Form -> AddEditElement (gettext("CALL PLAN"), - "tariff", - "", - "SELECT", - "", "", "", - "sql", - "cc_tariffgroup", - "tariffgroupname, id", - "", "", "%1", "", gettext("Changing the call plan will result in the free minutes or free calls package being reset.") ); - - - $HD_Form -> AddEditElement (gettext("DIDGROUP"), - "id_didgroup", - "", - "SELECT", - "", "", "", - "sql", - "cc_didgroup", - "didgroupname, id", - "", "", "%1", "", "", "", '' ); - - $timezone_list = get_timezones(); - $one_select = false; - foreach ($timezone_list as $key => $cur_value) { - $timezone_list[$key] = array($cur_value[2], $key); - if ($form_action == 'ask-add') { - if (in_array(SERVER_GMT,$cur_value) && !$one_select) { - $timezone_default_val = $key; - $one_select = true; - } - } - } - - $HD_Form -> AddEditElement (gettext("TIMEZONE"), - "id_timezone", - "$timezone_default_val", - "SELECT", - "","","", - "list" , "", "", "", $timezone_list, "%1", "", "" ); - - - $HD_Form -> AddEditElement (gettext("LANGUAGE"), - "language", - "", - "SELECT", - "", - "", - "", - "list" , "", "", "", $language_list, "%1", "", "" ); - - - $HD_Form -> AddEditElement (gettext("CURRENCY"), - "currency", - "", - "SELECT", - "", - "", "", "list" , "", "", "", $currency_list, "%1", "", gettext("Currency used at the customer end.") ); - - - - $HD_Form -> AddEditElement (gettext("STATUS"), - "status", - "", - "SELECT", - "", - "", - "", - "list" , "", "", "", $cardstatus_list, "%1", "", "" ); - - $HD_Form -> AddEditElement (gettext("LOCK"), - "block", - '0', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the lock on this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable lock for this account.")); - - if ($form_action =="ask-add" || $form_action=="add") { - $lockpin_default = "value = '0'"; - } - - $HD_Form -> AddEditElement (gettext("LOCK PIN"), - "lock_pin", - '$value', - "INPUT", - "size=20 maxlength=10 $lockpin_default", - "4", - "", - "" , "", "", "", "", "", "NO", gettext("Code required to make the call if the lock is active.")); - - - $HD_Form -> AddEditElement (gettext("SIMULTANEOUS ACCESS"), - "simultaccess", - "1", - "SELECT", - "", - "", - "", - "list" , "", "", "", $simultaccess_list, "%1", "", "" ); - - - $HD_Form -> AddEditElement (gettext("RUN SERVICE"), - "runservice", - '0', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the service recurring on this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Apply recurring service to this account.")); - - - $HD_Form -> AddEditElement (gettext("CREDIT LIMIT"), - "creditlimit", - "", - "INPUT", - "size=20 maxlength=20", - "4", - gettext("Insert the credit limit"), - "" , "", "", "", "", "", "NO-NULL", gettext("Credit limit is only used for the postpaid account.")); - - - - $HD_Form -> AddEditElement (gettext("CREDIT LIMIT NOTIFICATION"), - "credit_notification", - '', - "SELECT", - "", - "", - "", - "list" , "", "", "", $limits_notify_list , "%1", "", - gettext("currency : ").strtoupper(BASE_CURRENCY).'
    '.gettext("Low credit limit to alert the customer"), - "", ''); - - - $HD_Form -> AddEditElement (gettext("PERMITTED NOTIFICATIONS BY MAIL"), - "notify_email", - '0', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the notification by email for this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the notification by mail for this account.")); - - - $HD_Form -> AddEditElement (gettext("EMAIL NOTIFICATION"), - "email_notification", - '$value', - "INPUT", - "size=30 maxlength=70", - "1", - gettext("Insert the email to notify this customer"), - "" , "", "", "", "", "" , "NO", ""); - - if (ACT_VOICEMAIL) { - $HD_Form -> AddEditElement (gettext("PERMITTED VOICEMAIL"), - "voicemail_permitted", - '1', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the voicemail functionality for this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the voicemail functionality for this account.")); - - $HD_Form -> AddEditElement (gettext("ACTIVE VOICEMAIL SERVICE"), - "voicemail_activated", - '0', - "RADIOBUTTON", - "", - "", - gettext("Customer can choose to enable the voicemail for this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Customer can enable the voicemail for this account.")); - } - - $HD_Form -> AddEditElement (gettext("CAMPAIGN"), - "id_campaign", - "", - "SELECT", - "", "", "", - "sql", - "cc_campaign", - "name, id", - "", "", "%1", "", "", "", '' ); - - - $HD_Form -> AddEditElement (gettext("FIRST USE DATE"), - "firstusedate", - "", - "INPUT", - "size=40 maxlength=40 readonly", - "", - "the first use date", - "" , "" , "", "", "", "", "NO-NULL", "", "", "res_display_dateformat"); - - - $HD_Form -> AddEditElement (gettext("ENABLE EXPIRY"), - "enableexpire", - "", - "SELECT", - "", - "", - "", - "list" , "", "", "", $expire_list, "%1", "", gettext("Select method of expiry for the account.") ); - - - $comp_zero = $comp_date_plus=''; - if (isset($form_action) && $form_action=="ask-add"){ - $begin_date = date("Y"); - $begin_date_plus = date("Y")+10; - $end_date = date("-m-d H:i:s"); - $comp_date = "value='".$begin_date.$end_date."'"; - $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; - $comp_zero = "value='0'"; - } - - $HD_Form -> AddEditElement (gettext("EXPIRY DATE"), - "expirationdate", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date_plus", - "10", - gettext("Insert the expiration date"), - "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); - - - - $HD_Form -> AddEditElement (gettext("EXPIRY DAYS"), - "expiredays", - "", - "INPUT", - "size=10 maxlength=6 $comp_zero", - "4", - gettext("Insert the number of days after which the account will expire"), - "" , "", "", "", "", "", "", gettext("The number of days after which the account will expire.")); - - - $HD_Form -> AddEditElement (gettext("CREATE SIP CONFIG"), - "sip_buddy", - '1', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the sip account"), - "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Create the SIP config automatically")); - - - $HD_Form -> AddEditElement (gettext("CREATE IAX CONFIG"), - "iax_buddy", - '1', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the iax account"), - "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Create the IAX config automatically")); - - $HD_Form -> AddEditElement (gettext("MAC ADDRESS"), - "mac_addr", - '$value', - "INPUT", - "size=20 maxlength=17", - "", - gettext("Insert the MAC address customers' device"), - "" , "", "", "", "", "" , "NO", gettext("FORMAT: 00-08-74-4C-7F-1D")); - - - $HD_Form -> AddEditElement (gettext("IN USE"), - "inuse", - '$value', - "INPUT", - "size=5 maxlength=5", - "", - "", - "" , "", "", "", "", "", "NO", gettext("Updated to show the number of concurrent calls in use by this customer. If there are no currently no calls, and the system shows that there are, manually reset this field back to zero.") ); - - - $HD_Form -> AddEditElement (gettext("MAX CONCURRENT CALLS"), - "max_concurrent", - '$value', - "INPUT", - "size=5 maxlength=5", - "", - "", - "" , "", "", "", "", "", "NO", gettext("Max concurrent calls (Feature not implemented)") ); - - - $HD_Form -> AddEditElement (gettext("AUTOREFILL"), - "autorefill", - '0', - "RADIOBUTTON", - "", - "", - gettext("Choose if you want to enable the autorefill on this account"), - "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Define if you want to authorize the autorefill to apply on this accout"), - '', '', gettext("AUTOREFILL")); - - $HD_Form -> AddEditElement (gettext("INITIAL BALANCE"), - "initialbalance", - "", - "INPUT", - "size=30 $default_initbalance maxlength=30", - "12", - gettext("Insert the amount of the initial balance"), - "" , "", "", "", "", "", "", gettext("The initial balance is used by autorefill to reset the current balance to this amount")); - - - - $HD_Form -> AddEditElement (gettext("INVOICE DAY"), - "invoiceday", - '$value', - "SELECT", - "", - "", - "", - "list" , "", "", "", $invoiceday_list, "%1", "", gettext("Define the day of the month when the system will generate the customer invoice."), - '', '', gettext("Invoice Status")); - - - if ($form_action =="ask-add" || $form_action=="add") { - $vat_init = "value = '0'"; - - } - - $HD_Form -> AddEditElement (gettext("VAT"), - "vat", - "", - "INPUT", - "size=10 maxlength=6 $vat_init", - "12", - gettext("Insert the VAT"), - "" , "", "", "", "", "", "" , gettext("VAT to add on the invoice of this customer. it should be a decimal value '21' this will be for 21% of VAT!")); - - - $HD_Form -> AddEditElement (gettext("VAT REGISTRATION NUMBER "), - "vat_rn", - '$value', - "INPUT", - "size=40 maxlength=40", - "", - gettext("Insert the VAT registration number of this customer"), - "" , "", "", "", "", "" , "NO", ""); - - - $HD_Form -> AddEditElement (gettext("DISCOUNT"), - "discount", - "", - "SELECT", - "", - "", - "", - "list" , "", "", "", $discount_list, "%1", "", ""); - - - $HD_Form -> AddEditElement (gettext("TRAFFIC PER MONTH"), - "traffic", - '$value', - "INPUT", - "size=30 maxlength=20", - "4", - gettext("Insert the traffic per month for this customer"), - "" , "", "", "", "", "" , "NO", "", - '', '', gettext("TARGET TRAFFIC")); - - $HD_Form -> AddEditElement (gettext("TARGET TRAFFIC"), - "traffic_target", - '', - "TEXTAREA", - "cols=50 rows=4", - "", - gettext("Insert the target traffic description"), - "" , "", "", "", "" , "", "", ""); - - - $HD_Form -> AddEditElement (gettext("RESTRICTION"), - "restriction", - "0", - "SELECT", - "", - "", - "", - "list" , "", "", "", $restriction_list, "%1", "", "", - '', '', gettext("RESTRICTED NUMBERS")); - - $HD_Form -> AddEditElement (gettext("RESTRICTED NUMBERS"), - "restrictednumber", - '$value', - "HAS_MANY", - "", - "", - gettext("Insert numbers that restrict the customer"), - "", - "", - "", - "", "", "", "", "", "cc_restricted_phonenumber:number:number, id_card:id_card = %id::id_card:::::::0"); - - - - $HD_Form -> AddEditElement (gettext("CALLERID"), - "callerid", - '$value', - "HAS_MANY", - "", - "", - "", - "", - "", - "", - "", "", "", "", "", "cc_callerid:cid:cid, cid, id_cc_card:id_cc_card = %id::id_cc_card:::::::0", - '', gettext("CALLERID / CUSTOMER HISTORY")); - - - - - - $HD_Form -> AddEditElement (gettext("CUSTOMER HISTORY"), - "description", - '$value', - "HAS_MANY", - "multiline", - "", - "", - "", - "", - "", - "", "", "", "", "", "cc_card_history:description:description,id_cc_card,datecreated:id_cc_card = %id::id_cc_card::2:::::0"); - - // cc_card_history:description:description,id_cc_card:id_cc_card = %id::id_cc_card - // Above function will provid Has Many functionality - // Each parameter is seperated by (:) notation - // 0. HAS_MANY will allow to get one to many functionality - // 1. First param is the table name - // 2. Second param is the join condition coloumn - // 3. Third will get all the columns (but first should be joining column) - // 4. Fourth param generates the where cluase - // 5. Last, Sixth param is the FK column - - $add_fields_voicemail = ''; - if (ACT_VOICEMAIL) - $add_fields_voicemail = 'voicemail_permitted, voicemail_activated, '; - - $HD_Form -> FieldEditElement ('username, useralias, uipass, credit, id_group, id_seria, lastname, firstname, email, '. - ' address, city, state, country, zipcode, phone, fax,company_name, company_website, '. - $update_field_typepaid.' tariff, id_didgroup, id_timezone, language, currency, status, block, lock_pin, simultaccess, runservice, creditlimit, ' . - ' credit_notification, notify_email, email_notification, ' .$add_fields_voicemail. - ' id_campaign, ' . - ' firstusedate, enableexpire, expirationdate, expiredays, sip_buddy, iax_buddy, mac_addr, inuse, max_concurrent, ' . - ' autorefill, initialbalance, invoiceday, vat, vat_rn, discount, traffic, traffic_target, restriction' ); - - - if(!isset($myusername)) - $myusername=''; - - if ($form_action == "ask-edit") { - $table_card = new Table("cc_card","status"); - $result_card = $table_card ->Get_list(DbConnect(),"id=$id"); - $HD_Form -> FG_EDITION_HIDDEN_PARAM = "oldstatus"; - $HD_Form -> FG_EDITION_HIDDEN_PARAM_VALUE = "".$result_card[0][0]; - } - - - $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your")." ".$HD_Form->FG_INSTANCE_NAME; - $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); - $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
    ".gettext("Fill the following fields and confirm by clicking on the button add."); - - - $HD_Form -> FG_INTRO_TEXT_ADITION = ''; - $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."
    "; - - - $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; - $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on Confirm Data"); - - $HD_Form -> FG_ADDITIONAL_FUNCTION_BEFORE_EDITION = 'change_card_lock'; - - $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'processing_card_add'; - $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_EDITION = 'create_status_log'; - - if (isset($form_action) && $form_action=='delete' && USE_REALTIME) { - $card_table = new Table('cc_card','sip_buddy,iax_buddy'); - $card_clause = "id = ".$id; - $card_result = $card_table -> Get_list(DbConnect(), $card_clause, 0); - $sip_buddy = $card_result[0]['sip_buddy']; - $iax_buddy = $card_result[0]['iax_buddy']; - if(($sip_buddy == 1) && ($iax_buddy == 1)) - $key = "sip_iax_changed"; - elseif (($sip_buddy == 1) ) - $key = "sip_changed"; - elseif ($iax_buddy == 1) - $key = "iax_changed"; - - if ($_SESSION["user_type"]=="ADMIN") { - $who= Notification::$ADMIN;$who_id=$_SESSION['admin_id']; - } elseif ($_SESSION["user_type"]=="AGENT") { - $who= Notification::$AGENT;$who_id=$_SESSION['agent_id']; - } else { - $who=Notification::$UNKNOWN;$who_id=-1; - } - NotificationsDAO::AddNotification($key,Notification::$HIGH,$who,$who_id); - } - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?section=".$_SESSION["menu_section"]."&id="; + $HD_Form -> FG_EDITION = true; + $HD_Form -> FG_DELETION = true; + + $maxi = ''; + $maxi2 = ''; + $maxi3 = ''; + $useralias_locked = ''; + + if (isset($form_action) && $form_action=="ask-add") { + if (!is_numeric($cardnumberlenght_list)) $cardnumberlenght_list = LEN_CARDNUMBER; + $array_card_generated = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list); + $maxi = "value='".$array_card_generated[0]."'"; + $maxi2 = "value='".$array_card_generated[1]."'"; + $pass = MDP_NUMERIC(5).MDP_STRING(15); + $maxi3 = "value='".$pass."'"; + $default_initbalance = "value='0'"; + } + + if (!empty($A2B->config["webui"]['lock_useralias'])) { + $useralias_locked = 'readonly="readonly"'; + } + + $HD_Form -> AddEditElement (gettext("ACCOUNT NUMBER"), + "username", + "", + "INPUT", + "size=30 $maxi readonly maxlength=40", + "4", + gettext("Insert the account number"), + "" , "", "", "", "" , "", "", '', null, null, gettext("Customer Information")); + + + $HD_Form -> AddEditElement (gettext("WEBUI LOGIN"), + "useralias", + "", + "INPUT", + "size=20 $maxi2 maxlength=40 $useralias_locked", + "4", + gettext("Insert the webui login"), + "" , "", "", "", "" , "", "", ""); + + + $HD_Form -> AddEditElement (gettext("WEBUI PASSWORD"), + "uipass", + '', + "INPUT", + "size=20 $maxi3 maxlength=20", + "", + gettext("Insert the password"), + "" , "", "", "", "", "", "", gettext("Password for customer to access to the web interface and view the balance.") ); + + if ($form_action =="ask-add" || $form_action=="add") { + $balance_access = "value = '0'"; + $payment_status = ""; + + } else { + $balance_access = 'readonly'; + $payment_status= 'disabled="true" style="color: gray;" '; + } + + $HD_Form -> AddEditElement (gettext("BALANCE"), + "credit", + "", + "INPUT", + "size=30 maxlength=30 ".$balance_access, + "12", + gettext("Insert the number of credit"), + "" , "", "", "", "", "", "", gettext("currency : ").strtoupper(BASE_CURRENCY) ); + + + $HD_Form -> AddEditElement (gettext("CUSTOMER GROUP"), + "id_group", + "", + "SELECT", + "", "", "", + "sql", + "cc_card_group", + "name, id", + "", "", "%1", "", "", "", "", ""); + + $HD_Form -> AddEditElement (gettext("SERIAL"), + "id_seria", + "", + "SELECT", + "", "", "", + "sql", + "cc_card_seria", + "name, id", + "", "", "%1", "", "", "", '' ); + + + $HD_Form -> AddEditElement (gettext("LAST NAME"), + "lastname", + '$value', + "INPUT", + "size=30 maxlength=50", + "11", + gettext("Insert the lastname of the customers"), + "" , "", "", "", "", "" , "NO", "", null, null, gettext("Personal Information")); + + $HD_Form -> AddEditElement (gettext("FIRST NAME"), + "firstname", + '$value', + "INPUT", + "size=30 maxlength=50", + "11", + gettext("Insert the firstname of the customers"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("EMAIL"), + "email", + '$value', + "INPUT", + "size=30 maxlength=70", + "1", + gettext("Insert the email"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("ADDRESS"), + "address", + '$value', + "INPUT", + "size=30 maxlength=100", + "0", + gettext("Insert the address of the customers"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("CITY"), + "city", + '$value', + "INPUT", + "size=30 maxlength=40", + "0", + gettext("Insert the city"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("STATE/PROVINCE"), + "state", + '$value', + "INPUT", + "size=30 maxlength=40", + "11", + gettext("Insert the state"), + "" , "", "", "", "", "" , "NO", ""); + + if ($form_action == 'ask-add') { + $country_default_val = 'USA'; + } + + $HD_Form -> AddEditElement (gettext("COUNTRY"), + "country", + "$country_default_val", + "SELECT", + "", "", "", + "sql", + "cc_country", + "countryname, countrycode", + "", "", "%1", "", "", "", '' ); + + $HD_Form -> AddEditElement (gettext("ZIP/POSTAL CODE"), + "zipcode", + '$value', + "INPUT", + "size=30 maxlength=20", + "0", + gettext("Insert the zipcode"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("PHONE NUMBER"), + "phone", + '$value', + "INPUT", + "size=30 maxlength=20", + "7", + gettext("Insert the phone number of the customers"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("FAX NUMBER"), + "fax", + '$value', + "INPUT", + "size=30 maxlength=20", + "", + gettext("Insert the fax number of the customers"), + "" , "", "", "", "", "" , "NO", ""); + + $HD_Form -> AddEditElement (gettext("COMPANY NAME"), + "company_name", + '$value', + "INPUT", + "size=40 maxlength=50", + "", + gettext("Insert Company name of this customer"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("COMPANY WEBSITE"), + "company_website", + '$value', + "INPUT", + "size=40 maxlength=60", + "", + gettext("Insert the company website of this customer"), + "" , "", "", "", "", "" , "NO", ""); + + if ($form_action != "edit") { + + $update_field_typepaid = 'typepaid ,'; + + $HD_Form -> AddEditElement (gettext("PAYMENT TYPE"), + "typepaid", + "", + "SELECT", + "$payment_status", + "", + "", + "list" , "", "", "", $typepaid_list, "%1", "", '', null, null, gettext("Customer Status") ); + } + + $HD_Form -> AddEditElement (gettext("CALL PLAN"), + "tariff", + "", + "SELECT", + "", "", "", + "sql", + "cc_tariffgroup", + "tariffgroupname, id", + "", "", "%1", "", gettext("Changing the call plan will result in the free minutes or free calls package being reset.") ); + + + $HD_Form -> AddEditElement (gettext("DIDGROUP"), + "id_didgroup", + "", + "SELECT", + "", "", "", + "sql", + "cc_didgroup", + "didgroupname, id", + "", "", "%1", "", "", "", '' ); + + $timezone_list = get_timezones(); + $one_select = false; + foreach ($timezone_list as $key => $cur_value) { + $timezone_list[$key] = array($cur_value[2], $key); + if ($form_action == 'ask-add') { + if (in_array(SERVER_GMT,$cur_value) && !$one_select) { + $timezone_default_val = $key; + $one_select = true; + } + } + } + + $HD_Form -> AddEditElement (gettext("TIMEZONE"), + "id_timezone", + "$timezone_default_val", + "SELECT", + "","","", + "list" , "", "", "", $timezone_list, "%1", "", "" ); + + + $HD_Form -> AddEditElement (gettext("LANGUAGE"), + "language", + "", + "SELECT", + "", + "", + "", + "list" , "", "", "", $language_list, "%1", "", "" ); + + + $HD_Form -> AddEditElement (gettext("CURRENCY"), + "currency", + "", + "SELECT", + "", + "", "", "list" , "", "", "", $currency_list, "%1", "", gettext("Currency used at the customer end.") ); + + + + $HD_Form -> AddEditElement (gettext("STATUS"), + "status", + "", + "SELECT", + "", + "", + "", + "list" , "", "", "", $cardstatus_list, "%1", "", "" ); + + $HD_Form -> AddEditElement (gettext("LOCK"), + "block", + '0', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the lock on this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable lock for this account.")); + + if ($form_action =="ask-add" || $form_action=="add") { + $lockpin_default = "value = '0'"; + } + + $HD_Form -> AddEditElement (gettext("LOCK PIN"), + "lock_pin", + '$value', + "INPUT", + "size=20 maxlength=10 $lockpin_default", + "4", + "", + "" , "", "", "", "", "", "NO", gettext("Code required to make the call if the lock is active.")); + + + $HD_Form -> AddEditElement (gettext("SIMULTANEOUS ACCESS"), + "simultaccess", + "1", + "SELECT", + "", + "", + "", + "list" , "", "", "", $simultaccess_list, "%1", "", "" ); + + + $HD_Form -> AddEditElement (gettext("RUN SERVICE"), + "runservice", + '0', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the service recurring on this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Apply recurring service to this account.")); + + + $HD_Form -> AddEditElement (gettext("CREDIT LIMIT"), + "creditlimit", + "", + "INPUT", + "size=20 maxlength=20", + "4", + gettext("Insert the credit limit"), + "" , "", "", "", "", "", "NO-NULL", gettext("Credit limit is only used for the postpaid account.")); + + + + $HD_Form -> AddEditElement (gettext("CREDIT LIMIT NOTIFICATION"), + "credit_notification", + '', + "SELECT", + "", + "", + "", + "list" , "", "", "", $limits_notify_list , "%1", "", + gettext("currency : ").strtoupper(BASE_CURRENCY).'
    '.gettext("Low credit limit to alert the customer"), + "", ''); + + + $HD_Form -> AddEditElement (gettext("PERMITTED NOTIFICATIONS BY MAIL"), + "notify_email", + '0', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the notification by email for this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the notification by mail for this account.")); + + + $HD_Form -> AddEditElement (gettext("EMAIL NOTIFICATION"), + "email_notification", + '$value', + "INPUT", + "size=30 maxlength=70", + "1", + gettext("Insert the email to notify this customer"), + "" , "", "", "", "", "" , "NO", ""); + + if (ACT_VOICEMAIL) { + $HD_Form -> AddEditElement (gettext("PERMITTED VOICEMAIL"), + "voicemail_permitted", + '1', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the voicemail functionality for this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Enable the voicemail functionality for this account.")); + + $HD_Form -> AddEditElement (gettext("ACTIVE VOICEMAIL SERVICE"), + "voicemail_activated", + '0', + "RADIOBUTTON", + "", + "", + gettext("Customer can choose to enable the voicemail for this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Customer can enable the voicemail for this account.")); + } + + $HD_Form -> AddEditElement (gettext("CAMPAIGN"), + "id_campaign", + "", + "SELECT", + "", "", "", + "sql", + "cc_campaign", + "name, id", + "", "", "%1", "", "", "", '' ); + + + $HD_Form -> AddEditElement (gettext("FIRST USE DATE"), + "firstusedate", + "", + "INPUT", + "size=40 maxlength=40 readonly", + "", + "the first use date", + "" , "" , "", "", "", "", "NO-NULL", "", "", "res_display_dateformat"); + + + $HD_Form -> AddEditElement (gettext("ENABLE EXPIRY"), + "enableexpire", + "", + "SELECT", + "", + "", + "", + "list" , "", "", "", $expire_list, "%1", "", gettext("Select method of expiry for the account.") ); + + + $comp_zero = $comp_date_plus=''; + if (isset($form_action) && $form_action=="ask-add"){ + $begin_date = date("Y"); + $begin_date_plus = date("Y")+10; + $end_date = date("-m-d H:i:s"); + $comp_date = "value='".$begin_date.$end_date."'"; + $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; + $comp_zero = "value='0'"; + } + + $HD_Form -> AddEditElement (gettext("EXPIRY DATE"), + "expirationdate", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date_plus", + "10", + gettext("Insert the expiration date"), + "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); + + + + $HD_Form -> AddEditElement (gettext("EXPIRY DAYS"), + "expiredays", + "", + "INPUT", + "size=10 maxlength=6 $comp_zero", + "4", + gettext("Insert the number of days after which the account will expire"), + "" , "", "", "", "", "", "", gettext("The number of days after which the account will expire.")); + + + $HD_Form -> AddEditElement (gettext("CREATE SIP CONFIG"), + "sip_buddy", + '1', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the sip account"), + "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Create the SIP config automatically")); + + + $HD_Form -> AddEditElement (gettext("CREATE IAX CONFIG"), + "iax_buddy", + '1', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the iax account"), + "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Create the IAX config automatically")); + + $HD_Form -> AddEditElement (gettext("MAC ADDRESS"), + "mac_addr", + '$value', + "INPUT", + "size=20 maxlength=17", + "", + gettext("Insert the MAC address customers' device"), + "" , "", "", "", "", "" , "NO", gettext("FORMAT: 00-08-74-4C-7F-1D")); + + + $HD_Form -> AddEditElement (gettext("IN USE"), + "inuse", + '$value', + "INPUT", + "size=5 maxlength=5", + "", + "", + "" , "", "", "", "", "", "NO", gettext("Updated to show the number of concurrent calls in use by this customer. If there are no currently no calls, and the system shows that there are, manually reset this field back to zero.") ); + + + $HD_Form -> AddEditElement (gettext("MAX CONCURRENT CALLS"), + "max_concurrent", + '$value', + "INPUT", + "size=5 maxlength=5", + "", + "", + "" , "", "", "", "", "", "NO", gettext("Max concurrent calls (Feature not implemented)") ); + + + $HD_Form -> AddEditElement (gettext("AUTOREFILL"), + "autorefill", + '0', + "RADIOBUTTON", + "", + "", + gettext("Choose if you want to enable the autorefill on this account"), + "" , "", "", "Yes :1, - No:0", "", "" , "", gettext("Define if you want to authorize the autorefill to apply on this accout"), + '', '', gettext("AUTOREFILL")); + + $HD_Form -> AddEditElement (gettext("INITIAL BALANCE"), + "initialbalance", + "", + "INPUT", + "size=30 $default_initbalance maxlength=30", + "12", + gettext("Insert the amount of the initial balance"), + "" , "", "", "", "", "", "", gettext("The initial balance is used by autorefill to reset the current balance to this amount")); + + + + $HD_Form -> AddEditElement (gettext("INVOICE DAY"), + "invoiceday", + '$value', + "SELECT", + "", + "", + "", + "list" , "", "", "", $invoiceday_list, "%1", "", gettext("Define the day of the month when the system will generate the customer invoice."), + '', '', gettext("Invoice Status")); + + + if ($form_action =="ask-add" || $form_action=="add") { + $vat_init = "value = '0'"; + + } + + $HD_Form -> AddEditElement (gettext("VAT"), + "vat", + "", + "INPUT", + "size=10 maxlength=6 $vat_init", + "12", + gettext("Insert the VAT"), + "" , "", "", "", "", "", "" , gettext("VAT to add on the invoice of this customer. it should be a decimal value '21' this will be for 21% of VAT!")); + + + $HD_Form -> AddEditElement (gettext("VAT REGISTRATION NUMBER "), + "vat_rn", + '$value', + "INPUT", + "size=40 maxlength=40", + "", + gettext("Insert the VAT registration number of this customer"), + "" , "", "", "", "", "" , "NO", ""); + + + $HD_Form -> AddEditElement (gettext("DISCOUNT"), + "discount", + "", + "SELECT", + "", + "", + "", + "list" , "", "", "", $discount_list, "%1", "", ""); + + + $HD_Form -> AddEditElement (gettext("TRAFFIC PER MONTH"), + "traffic", + '$value', + "INPUT", + "size=30 maxlength=20", + "4", + gettext("Insert the traffic per month for this customer"), + "" , "", "", "", "", "" , "NO", "", + '', '', gettext("TARGET TRAFFIC")); + + $HD_Form -> AddEditElement (gettext("TARGET TRAFFIC"), + "traffic_target", + '', + "TEXTAREA", + "cols=50 rows=4", + "", + gettext("Insert the target traffic description"), + "" , "", "", "", "" , "", "", ""); + + + $HD_Form -> AddEditElement (gettext("RESTRICTION"), + "restriction", + "0", + "SELECT", + "", + "", + "", + "list" , "", "", "", $restriction_list, "%1", "", "", + '', '', gettext("RESTRICTED NUMBERS")); + + $HD_Form -> AddEditElement (gettext("RESTRICTED NUMBERS"), + "restrictednumber", + '$value', + "HAS_MANY", + "", + "", + gettext("Insert numbers that restrict the customer"), + "", + "", + "", + "", "", "", "", "", "cc_restricted_phonenumber:number:number, id_card:id_card = %id::id_card:::::::0"); + + + + $HD_Form -> AddEditElement (gettext("CALLERID"), + "callerid", + '$value', + "HAS_MANY", + "", + "", + "", + "", + "", + "", + "", "", "", "", "", "cc_callerid:cid:cid, cid, id_cc_card:id_cc_card = %id::id_cc_card:::::::0", + '', gettext("CALLERID / CUSTOMER HISTORY")); + + + + + + $HD_Form -> AddEditElement (gettext("CUSTOMER HISTORY"), + "description", + '$value', + "HAS_MANY", + "multiline", + "", + "", + "", + "", + "", + "", "", "", "", "", "cc_card_history:description:description,id_cc_card,datecreated:id_cc_card = %id::id_cc_card::2:::::0"); + + // cc_card_history:description:description,id_cc_card:id_cc_card = %id::id_cc_card + // Above function will provid Has Many functionality + // Each parameter is seperated by (:) notation + // 0. HAS_MANY will allow to get one to many functionality + // 1. First param is the table name + // 2. Second param is the join condition coloumn + // 3. Third will get all the columns (but first should be joining column) + // 4. Fourth param generates the where cluase + // 5. Last, Sixth param is the FK column + + $add_fields_voicemail = ''; + if (ACT_VOICEMAIL) + $add_fields_voicemail = 'voicemail_permitted, voicemail_activated, '; + + $HD_Form -> FieldEditElement ('username, useralias, uipass, credit, id_group, id_seria, lastname, firstname, email, '. + ' address, city, state, country, zipcode, phone, fax,company_name, company_website, '. + $update_field_typepaid.' tariff, id_didgroup, id_timezone, language, currency, status, block, lock_pin, simultaccess, runservice, creditlimit, ' . + ' credit_notification, notify_email, email_notification, ' .$add_fields_voicemail. + ' id_campaign, ' . + ' firstusedate, enableexpire, expirationdate, expiredays, sip_buddy, iax_buddy, mac_addr, inuse, max_concurrent, ' . + ' autorefill, initialbalance, invoiceday, vat, vat_rn, discount, traffic, traffic_target, restriction' ); + + + if(!isset($myusername)) + $myusername=''; + + if ($form_action == "ask-edit") { + $table_card = new Table("cc_card","status"); + $result_card = $table_card ->Get_list(DbConnect(),"id=$id"); + $HD_Form -> FG_EDITION_HIDDEN_PARAM = "oldstatus"; + $HD_Form -> FG_EDITION_HIDDEN_PARAM_VALUE = "".$result_card[0][0]; + } + + + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your")." ".$HD_Form->FG_INSTANCE_NAME; + $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); + $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
    ".gettext("Fill the following fields and confirm by clicking on the button add."); + + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; + $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."
    "; + + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; + $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on Confirm Data"); + + $HD_Form -> FG_ADDITIONAL_FUNCTION_BEFORE_EDITION = 'change_card_lock'; + + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'processing_card_add'; + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_EDITION = 'create_status_log'; + + if (isset($form_action) && $form_action=='delete' && USE_REALTIME) { + $card_table = new Table('cc_card','sip_buddy,iax_buddy'); + $card_clause = "id = ".$id; + $card_result = $card_table -> Get_list(DbConnect(), $card_clause, 0); + $sip_buddy = $card_result[0]['sip_buddy']; + $iax_buddy = $card_result[0]['iax_buddy']; + if(($sip_buddy == 1) && ($iax_buddy == 1)) + $key = "sip_iax_changed"; + elseif (($sip_buddy == 1) ) + $key = "sip_changed"; + elseif ($iax_buddy == 1) + $key = "iax_changed"; + + if ($_SESSION["user_type"]=="ADMIN") { + $who= Notification::$ADMIN;$who_id=$_SESSION['admin_id']; + } elseif ($_SESSION["user_type"]=="AGENT") { + $who= Notification::$AGENT;$who_id=$_SESSION['agent_id']; + } else { + $who=Notification::$UNKNOWN;$who_id=-1; + } + NotificationsDAO::AddNotification($key,Notification::$HIGH,$who,$who_id); + } + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?section=".$_SESSION["menu_section"]."&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?section=".$_SESSION["menu_section"]."&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?section=".$_SESSION["menu_section"]."&id="; } - - diff --git a/admin/Public/form_data/FG_var_card_group.inc b/admin/Public/form_data/FG_var_card_group.inc index 567d8ad81..321b81679 100755 --- a/admin/Public/form_data/FG_var_card_group.inc +++ b/admin/Public/form_data/FG_var_card_group.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -61,13 +61,13 @@ $HD_Form ->FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/group_add.png" ; - +$HD_Form -> AddViewElement(gettext("ID"), "id", "10%", "center", "sort"); $HD_Form -> AddViewElement(gettext("NAME"), "name", "25%", "center", "sort"); -$HD_Form -> AddViewElement(gettext("DESCRIPTION"), "description", "65%", "center", "SORT", "150"); -$HD_Form -> FieldViewElement ( 'name, description'); +$HD_Form -> AddViewElement(gettext("DESCRIPTION"), "description", "55%", "center", "SORT", "150"); +$HD_Form -> FieldViewElement ( 'id, name, description'); -$HD_Form -> CV_NO_FIELDS = gettext("NO CUSTOMER GROUP CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("NO CUSTOMER GROUP CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -101,12 +101,12 @@ $right_list["19"] = array( gettext("SEE RECORDING"), "262144"); $len_right_list = count($right_list); -$HD_Form -> AddEditElement ( gettext("NAME"), - "name", '$value', +$HD_Form -> AddEditElement ( gettext("NAME"), + "name", '$value', "INPUT", "size=30 maxlength=40", "0", - gettext("Insert the provider name"), + gettext("Insert the provider name"), "" , "", "", "", "", "", "", "" ); @@ -118,7 +118,7 @@ $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("AGENT"), "id_agent", "", @@ -137,7 +137,7 @@ $HD_Form -> AddEditElement (gettext("PERMISSION USER INTERFACE"), "", "", "list", "", "description, id", "", $right_list, "%1" , "", gettext("To select several rights in the above ListBox, hold the CTRL key down while clicking the items") ); - + $HD_Form -> FieldEditElement ('name, description, id_agent, users_perms'); @@ -158,7 +158,7 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_card_seria.inc b/admin/Public/form_data/FG_var_card_seria.inc old mode 100644 new mode 100755 index 500f35147..80f36af8d --- a/admin/Public/form_data/FG_var_card_seria.inc +++ b/admin/Public/form_data/FG_var_card_seria.inc @@ -106,6 +106,6 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_charge.inc b/admin/Public/form_data/FG_var_charge.inc old mode 100644 new mode 100755 index 43298a8af..ffd1eeb6a --- a/admin/Public/form_data/FG_var_charge.inc +++ b/admin/Public/form_data/FG_var_charge.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -188,7 +188,7 @@ $HD_Form_c -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form_c -> FG_BUTTON_ADITION_BO -$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form_c -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_commission.inc b/admin/Public/form_data/FG_var_commission.inc old mode 100644 new mode 100755 index a4035aa5f..efccf36f7 --- a/admin/Public/form_data/FG_var_commission.inc +++ b/admin/Public/form_data/FG_var_commission.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -58,7 +58,7 @@ $HD_Form -> AddViewElement(gettext("LINK TO PAYMENT"), "id_payment", "10%", "cen $HD_Form -> FieldViewElement ('cc_agent_commission.id, id_card, id_agent, date, amount, commission_type , description, id_payment'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE ARE NO COMMISSION AGENTS CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE ARE NO COMMISSION AGENTS CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -72,30 +72,30 @@ if ($form_action=="ask-add" && !empty($id_card)) { } $HD_Form -> AddEditElement (gettext("CUSTOMER ID"), - "id_card", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ".$id_val, - "4", + "id_card", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ".$id_val, + "4", gettext("Insert the Customer ID "), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Customer ID")); $HD_Form -> AddEditElement (gettext("AGENT ID"), - "id_agent", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ".$id_val, - "4", + "id_agent", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ".$id_val, + "4", gettext("Insert the AGENT ID "), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_agent.php?popup_select=1&" , ", 'AgentSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Agent ID")); - -if ($form_action=="ask-add") { + +if ($form_action=="ask-add") { $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; @@ -103,20 +103,20 @@ if ($form_action=="ask-add") { } $HD_Form -> AddEditElement (gettext("PAYMENT DATE"), - "date", - '$value', - "INPUT", - "size=40 READONLY maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 READONLY maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("COMMISSION AMOUNT"), - "amount", - '$value', - "INPUT", - "size=60 maxlength=10", - "12", + "amount", + '$value', + "INPUT", + "size=60 maxlength=10", + "12", gettext("Insert the commission amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount in the currency base : ").BASE_CURRENCY ); @@ -131,13 +131,13 @@ $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("PAYMENT ID"), - "id_payment", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ".$id_val, - "4", + "id_payment", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ".$id_val, + "4", gettext("Insert the Payment ID "), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_payment.php?popup_select=1&" , ", 'PaymentSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Payment ID")); @@ -167,8 +167,8 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_config.inc b/admin/Public/form_data/FG_var_config.inc index e62b27b05..a96dbb86c 100755 --- a/admin/Public/form_data/FG_var_config.inc +++ b/admin/Public/form_data/FG_var_config.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,16 +27,15 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ - getpost_ifset(array('id', 'config_title', 'config_key', 'config_value', 'config_description', 'config_group_title', 'groupselect', 'filterKey', 'rbKey', 'filterDescription', 'rbDesc', 'filterValue', 'rbValue', 'posted','agi_conf')); -// This will generate agi-confx -// agi-confx is duplication of Global configuration and list of configurations of : agi-conf1 +// This will generate agi-confx +// agi-confx is duplication of Global configuration and list of configurations of : agi-conf1 if ($agi_conf) { check_demo_mode(); $groupselect = add_agi_confx(); @@ -84,7 +83,6 @@ $HD_Form -> FG_TABLE_DEFAULT_ORDER = "config_group_title"; $HD_Form -> FG_TABLE_DEFAULT_SENS = "ASC"; if ($groupselect != "-1" && $groupselect != "") { - $HD_Form = new FormHandler("cc_config", gettext("Configuration")); $HD_Form -> FG_TABLE_ID = "id"; $HD_Form -> FG_TABLE_CLAUSE = " config_group_title = '$groupselect'"; $_SESSION['ss_groupselect'] = $HD_Form -> FG_TABLE_CLAUSE; @@ -145,7 +143,7 @@ if($form_action == "list") { $_SESSION['ss_groupselect'] = ''; $_SESSION['groupselect'] = ''; } else { - $HD_Form -> FG_TABLE_CLAUSE = $_SESSION['ss_groupselect']; + $HD_Form -> FG_TABLE_CLAUSE = $_SESSION['ss_groupselect']; } $HD_Form -> FG_EDITION_CLAUSE = "id = %id"; @@ -180,7 +178,7 @@ $HD_Form -> AddEditElement (gettext("GROUP"), "", gettext("This is the group of the configuration. Not editable!"), "" , "", "", "", "", "", "", gettext("Group Name of the configuration variable")); - + $HD_Form -> AddEditElement (gettext("TITLE"), "config_title", @@ -199,7 +197,7 @@ $HD_Form -> AddEditElement (gettext("KEY"), "", gettext("Insert the TITLE"), "" , "", "", "", "" , "", "" ,gettext("Key name of the configuration variable")); - + if ($setbool) { $HD_Form -> AddEditElement (gettext("VALUE"), "config_value", @@ -207,7 +205,7 @@ if ($setbool) { "SELECT", "","","", "list" , "", "", "", $value_list, "%1", "", "" ); - + } else { $HD_Form -> AddEditElement (gettext("VALUE"), "config_value", @@ -250,8 +248,4 @@ $HD_Form -> FG_INTRO_TEXT_EDITION= ''; $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - - - - +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_config_group.inc b/admin/Public/form_data/FG_var_config_group.inc index 583a4252f..8f2f1e526 100755 --- a/admin/Public/form_data/FG_var_config_group.inc +++ b/admin/Public/form_data/FG_var_config_group.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -44,7 +44,7 @@ if ( !empty($groupdelete) && substr($groupdelete,0,8) == "agi-conf" && $groupdel $result = $instance_table -> SQLExec ($handle, $QUERY); $QUERY = "DELETE FROM cc_config WHERE config_group_title='$groupdelete'"; $result = $instance_table -> SQLExec ($handle, $QUERY); - + $msg = $groupdelete.' : '."Group deleted !"; $error_msg = ''.$msg.'
    '; } @@ -98,9 +98,9 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_currencies.inc b/admin/Public/form_data/FG_var_currencies.inc old mode 100644 new mode 100755 index 717be8143..c9fc69fa7 --- a/admin/Public/form_data/FG_var_currencies.inc +++ b/admin/Public/form_data/FG_var_currencies.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -70,7 +70,7 @@ $HD_Form -> AddEditElement (gettext("Name"), "3", gettext("Insert the currency name"), "" , "", "", "", "" , "" , "" , ""); - + $HD_Form -> AddEditElement (gettext("LABEL"), "currency", "$value", @@ -79,7 +79,7 @@ $HD_Form -> AddEditElement (gettext("LABEL"), "0", gettext("Insert the currency label"), "" , "", "", "", "" , "" , "" , ""); - + $HD_Form -> AddEditElement (gettext("VALUE"), "value", @@ -126,9 +126,9 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'processing_refill_add'; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_def_ratecard.inc b/admin/Public/form_data/FG_var_def_ratecard.inc old mode 100644 new mode 100755 index ccc620149..c87ff00b0 --- a/admin/Public/form_data/FG_var_def_ratecard.inc +++ b/admin/Public/form_data/FG_var_def_ratecard.inc @@ -38,7 +38,7 @@ getpost_ifset(array('id', 'idtariffplan', 'dialprefix', 'destination', 'buyrate' 'billingblockb', 'stepchargec', 'chargec', 'timechargec', 'billingblockc', 'startdate', 'stopdate', 'starttime', 'endtime', 'id_trunk', 'musiconhold','tariffplan', 'tariffgroup','posted','id_outbound_cidgroup','rounding_calltime', 'rounding_threshold', 'additional_block_charge', 'additional_block_charge_time', 'additional_grace','minimal_cost','announce_time_correction', -'cancelsearch_callplanlcr', 'deleteselected')); +'cancelsearch_callplanlcr', 'deleteselected', 'is_disabled')); // put all the destination name to lowercase $destination = strtolower ($destination); @@ -62,7 +62,9 @@ if (isset($posted) && !$popup_select) { if (is_string ($tariffgroup) && strlen(trim($tariffgroup))>0) { - $HD_Form = new FormHandler("cc_callplan_lcr", "Rates"); + // $HD_Form = new FormHandler("cc_callplan_lcr", "Rates"); + $HD_Form -> FG_TABLE_NAME = "cc_callplan_lcr"; + $HD_Form -> FG_INSTANCE_NAME = "Rates"; $HD_Form -> FG_TABLE_ID = 'id'; $use_lcr_callplan = true; $HD_Form -> SQL_GROUP = " GROUP BY dialprefix "; @@ -115,6 +117,7 @@ $yesno = Constants::getYesNoList(); if ($popup_select) $HD_Form -> AddViewElement(gettext("ID"), "id", "5%", "center", "sort"); $HD_Form -> AddViewElement(gettext("DESTINATION"), "destination", "17%", "center", "", "15"); $HD_Form -> AddViewElement("".gettext("PREFIX")."", "dialprefix", "10%", "center", "sort", ""); +$HD_Form -> AddViewElement(gettext("Disabled"), "is_disabled", "", "center", "", "", "list", $yesno); $HD_Form -> AddViewElement("".gettext("BR")."", "buyrate", "4%", "center", "sort"); $HD_Form -> AddViewElement("".gettext("SR")."", "rateinitial", "4%", "center", "sort"); if (!$popup_select) $HD_Form -> AddViewElement(gettext("START-DATE"), "startdate", "13%", "center", "sort", "19", "", "", "", "", "", "display_dateformat"); @@ -127,14 +130,14 @@ if (!$popup_select) $HD_Form -> AddViewElement(gettext("RATE CARD"), "idtariffpl if (!$popup_select) { if ($use_lcr_callplan) - $HD_Form -> FieldViewElement ('destination, dialprefix, buyrate, '.$rateinitial_field.', startdate, stopdate, initblock, connectcharge, id_trunk , idtariffplan '); + $HD_Form -> FieldViewElement ('destination, dialprefix, is_disabled, buyrate, '.$rateinitial_field.', startdate, stopdate, initblock, connectcharge, id_trunk , idtariffplan '); else - $HD_Form -> FieldViewElement ('cc_prefix.destination, cc_ratecard.dialprefix, cc_ratecard.buyrate, cc_ratecard.rateinitial, cc_ratecard.startdate, cc_ratecard.stopdate, cc_ratecard.initblock, cc_ratecard.connectcharge, cc_ratecard.id_trunk , cc_ratecard.idtariffplan '); + $HD_Form -> FieldViewElement ('cc_prefix.destination, cc_ratecard.dialprefix, cc_ratecard.is_disabled, cc_ratecard.buyrate, cc_ratecard.rateinitial, cc_ratecard.startdate, cc_ratecard.stopdate, cc_ratecard.initblock, cc_ratecard.connectcharge, cc_ratecard.id_trunk , cc_ratecard.idtariffplan '); } else { if ($use_lcr_callplan) - $HD_Form -> FieldViewElement ('id, destination, dialprefix, buyrate, '.$rateinitial_field); + $HD_Form -> FieldViewElement ('id, destination, dialprefix, is_disabled, buyrate, '.$rateinitial_field); else - $HD_Form -> FieldViewElement ('id, cc_prefix.destination, cc_ratecard.dialprefix, cc_ratecard.buyrate, '.$rateinitial_field); + $HD_Form -> FieldViewElement ('id, cc_prefix.destination, cc_ratecard.dialprefix, cc_ratecard.is_disabled, cc_ratecard.buyrate, '.$rateinitial_field); } if ($popup_select) { @@ -214,6 +217,17 @@ $HD_Form -> AddEditElement(gettext("Destination Prefix"), "" , "", "", "", "" , "A2B_entity_prefix.php?popup_select=2&", ", 'prefix','width=650,height=400,top=20,left=100,scrollbars=1'", gettext("Select the prefix destination corresponding to your prefix rate.").'
    '.gettext("This is the label that appears against the Call Detail Record.")); +$value_list = array(); +$value_list["1"] = array(gettext("yes"), 1); +$value_list["2"] = array(gettext("no"), 0); + +$HD_Form -> AddEditElement (gettext("Disabled"), + "is_disabled", + "", + "SELECT", + "","","", + "list" , "", "", "", $value_list, "%1", "", "" ); + /* $HD_Form -> AddEditElement(gettext("Destination Prefix"), "destination", @@ -612,10 +626,10 @@ if (ADVANCED_MODE) { if (ADVANCED_MODE) { // This Variable store the argument for the SQL query - $HD_Form -> FieldEditElement ('cc_ratecard.idtariffplan, dialprefix, cc_ratecard.destination, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge,disconnectcharge_after, minimal_cost, stepchargea, chargea, timechargea, billingblocka, stepchargeb, chargeb, timechargeb, billingblockb, stepchargec, chargec, timechargec, billingblockc,announce_time_correction, startdate, stopdate, starttime, endtime, rounding_calltime, rounding_threshold, additional_block_charge, additional_block_charge_time,additional_grace, id_trunk, id_outbound_cidgroup, tag, musiconhold'); + $HD_Form -> FieldEditElement ('cc_ratecard.idtariffplan, dialprefix, cc_ratecard.destination, cc_ratecard.is_disabled, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge,disconnectcharge_after, minimal_cost, stepchargea, chargea, timechargea, billingblocka, stepchargeb, chargeb, timechargeb, billingblockb, stepchargec, chargec, timechargec, billingblockc,announce_time_correction, startdate, stopdate, starttime, endtime, rounding_calltime, rounding_threshold, additional_block_charge, additional_block_charge_time,additional_grace, id_trunk, id_outbound_cidgroup, tag, musiconhold'); } else { // This Variable store the argument for the SQL query - $HD_Form -> FieldEditElement ('cc_ratecard.idtariffplan, dialprefix, cc_ratecard.destination, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge,disconnectcharge_after, minimal_cost, startdate, stopdate, starttime, endtime, rounding_calltime, rounding_threshold, additional_block_charge, additional_block_charge_time,additional_grace, id_trunk, id_outbound_cidgroup, tag'); + $HD_Form -> FieldEditElement ('cc_ratecard.idtariffplan, dialprefix, cc_ratecard.destination, cc_ratecard.is_disabled, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge,disconnectcharge_after, minimal_cost, startdate, stopdate, starttime, endtime, rounding_calltime, rounding_threshold, additional_block_charge, additional_block_charge_time,additional_grace, id_trunk, id_outbound_cidgroup, tag'); } @@ -644,8 +658,8 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)) { $HD_Form -> FG_TABLE_CLAUSE.="dialprefix like '$filterprefix%'"; } -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_did.inc b/admin/Public/form_data/FG_var_did.inc index a1ebbdd47..21ed92e93 100644 --- a/admin/Public/form_data/FG_var_did.inc +++ b/admin/Public/form_data/FG_var_did.inc @@ -87,7 +87,7 @@ $HD_Form -> FG_SPLITABLE_FIELD = 'did'; // TODO integrate in Framework if ($form_action=="ask-add" || $form_action=="purchase") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; @@ -413,7 +413,7 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_did_billing.inc b/admin/Public/form_data/FG_var_did_billing.inc old mode 100644 new mode 100755 index 8e28222f0..814832318 --- a/admin/Public/form_data/FG_var_did_billing.inc +++ b/admin/Public/form_data/FG_var_did_billing.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -62,7 +62,7 @@ $HD_Form -> FieldViewElement ("DATE(starttime) as date, cc_did.did, count(*) as $HD_Form -> SQL_GROUP = " GROUP BY cc_card.username, cc_did.did, date "; -$HD_Form -> CV_NO_FIELDS = gettext("NO DID BILLING HAS BEEN CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("NO DID BILLING HAS BEEN CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -112,7 +112,7 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_did_destination.inc b/admin/Public/form_data/FG_var_did_destination.inc index 4a01c02b6..31a98c532 100644 --- a/admin/Public/form_data/FG_var_did_destination.inc +++ b/admin/Public/form_data/FG_var_did_destination.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -84,7 +84,7 @@ $HD_Form -> AddViewElement(gettext("VALIDATED"), "validated", "10%", "center", " $HD_Form -> FieldViewElement ('destination, cc_did_destination.creationdate, cc_did.did, id_cc_card, cc_did_destination.activated, voip_call, priority, cc_did_destination.secondusedreal, validated'); $HD_Form -> FG_ACTION_SIZE_COLUMN = '15%'; - + $HD_Form -> CV_NO_FIELDS = gettext("NO DID DESTINATIONS HAVE BEEN CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; @@ -100,7 +100,7 @@ $HD_Form -> FG_ADDITION = true; // TODO integrate in Framework if ($form_action=="ask-add"){ $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; @@ -118,7 +118,7 @@ $HD_Form -> AddEditElement (gettext("DESTINATION"), "" , "", "", "", "" , "", "", gettext("Enter the phone number you wish to call, or the VoIP client to reach. (ie: 347894999 or SIP/jeremy@182.212.1.45). If the call is VoIP, the VoIP_Call must be set to yes.")); if ($form_action!='ask-edit' && $form_action!='edit') { - + $HD_Form -> AddEditElement (gettext("CUSTOMER ID"), "id_cc_card", '', @@ -211,9 +211,9 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'did_destination_add'; $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_DELETE = 'did_destination_del'; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?id="; diff --git a/admin/Public/form_data/FG_var_didgroup.inc b/admin/Public/form_data/FG_var_didgroup.inc old mode 100644 new mode 100755 index 7f5692ae7..6969916c7 --- a/admin/Public/form_data/FG_var_didgroup.inc +++ b/admin/Public/form_data/FG_var_didgroup.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -100,8 +100,8 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_diduse.inc b/admin/Public/form_data/FG_var_diduse.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_friend.inc b/admin/Public/form_data/FG_var_friend.inc old mode 100644 new mode 100755 index 55d0d3899..65a3de4b0 --- a/admin/Public/form_data/FG_var_friend.inc +++ b/admin/Public/form_data/FG_var_friend.inc @@ -952,7 +952,7 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=$atmenu&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=$atmenu&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=$atmenu&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=$atmenu&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=$atmenu&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=$atmenu&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_invoice.inc b/admin/Public/form_data/FG_var_invoice.inc old mode 100644 new mode 100755 index ad64ec20a..5fa9308b7 --- a/admin/Public/form_data/FG_var_invoice.inc +++ b/admin/Public/form_data/FG_var_invoice.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,15 +27,15 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ getpost_ifset(array('id', 'id_card', 'date','title','description')); - - + + if (!isset($form_action) || $form_action=="list") { $list_query = "cc_invoice LEFT JOIN cc_card ON cc_card.id=id_card "; $list_query .= "LEFT JOIN (SELECT st1.id_invoice, TRUNCATE(SUM(st1.price*(1+(st1.vat/100))),2) as total_price " . @@ -54,7 +54,7 @@ $HD_Form -> FG_FK_DELETE_CONFIRM = true; $HD_Form -> FG_FK_WARNONLY = true; $HD_Form -> FG_FK_TABLENAMES = array("cc_invoice_item"); $HD_Form -> FG_FK_EDITION_CLAUSE = array(" id_invoice "); - + $HD_Form -> FG_INFO = true; $HD_Form -> FG_INFO_LINK = "A2B_invoice_view.php?id="; $HD_Form -> FG_INFO_ALT = "VIEW"; @@ -107,7 +107,7 @@ $HD_Form -> AddViewElement(gettext("AMOUNT INCL VAT"), "total_price", "10%", "ce $HD_Form -> FieldViewElement ("cc_invoice.id, cc_invoice.reference, username, cc_invoice.date,title, cc_invoice.paid_status, cc_invoice.status as cc_invoice_status,$filter_amount_with_vat"); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -137,14 +137,14 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; $HD_Form -> AddEditElement (gettext("ID CUSTOMER"), - "id_card", - "$value", "POPUPVALUE", "size=30 maxlength=50", + "id_card", + "$value", "POPUPVALUE", "size=30 maxlength=50", "4", gettext("Insert the Customer ID"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&", ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Customer ID")); -if ($form_action=="ask-add"){ +if ($form_action=="ask-add"){ $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; @@ -152,24 +152,24 @@ if ($form_action=="ask-add"){ } $HD_Form -> AddEditElement (gettext("INVOICE DATE"), - "date", - '$value', - "INPUT", - "size=40 READONLY maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 READONLY maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); -$HD_Form -> AddEditElement ( gettext("TITLE"), - "title", '$value', +$HD_Form -> AddEditElement ( gettext("TITLE"), + "title", '$value', "INPUT", "size=30 maxlength=50", "0", - gettext("Insert the title of invoice, if you need one"), + gettext("Insert the title of invoice, if you need one"), "" , "", "", "", "", "", "", "" ); - - + + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -178,7 +178,7 @@ $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> FieldEditElement ('id_card, date,title, description'); @@ -211,8 +211,8 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'create_invoice_reference'; $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = "A2B_invoice_edit.php?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_logrefill.inc b/admin/Public/form_data/FG_var_logrefill.inc old mode 100644 new mode 100755 index f72d87762..8ce7f498b --- a/admin/Public/form_data/FG_var_logrefill.inc +++ b/admin/Public/form_data/FG_var_logrefill.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -76,7 +76,7 @@ $HD_Form -> AddSearchElement_C1(gettext("LASTNAME"),'lastname','lastnametype'); $HD_Form -> AddSearchElement_C1(gettext("FIRSTNAME"),'firstname','firstnametype'); $HD_Form -> FG_FILTER_SEARCH_DELETE_ALL =false; -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -94,47 +94,47 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)) { $HD_Form -> FG_ADDITION = true; if (has_rights (ACX_MODIFY_REFILLS)) { - + $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; - + if ($form_action=="ask-add" && !empty($card_id)) { $id_val = "value='$card_id'"; } - + $HD_Form -> AddEditElement (gettext("ID CUSTOMER"), - "card_id", - "$value", "POPUPVALUE", "size=30 maxlength=50 ".$id_val, + "card_id", + "$value", "POPUPVALUE", "size=30 maxlength=50 ".$id_val, "4", gettext("Insert the Customer ID"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&", ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Customer ID")); - - if ($form_action=="ask-add") { + + if ($form_action=="ask-add") { $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; $comp_date="value='$comp_date'"; } - + $HD_Form -> AddEditElement (gettext("REFILL DATE"), - "date", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("REFILL AMOUNT"), - "credit", - '$value', - "INPUT", - "size=60 maxlength=10", - "12", + "credit", + '$value', + "INPUT", + "size=60 maxlength=10", + "12", gettext("Insert the credit amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount in the currency base : ").BASE_CURRENCY ); - + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -143,7 +143,7 @@ if (has_rights (ACX_MODIFY_REFILLS)) { "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("REFILL TYPE"), "refill_type", '$value', @@ -152,8 +152,8 @@ if (has_rights (ACX_MODIFY_REFILLS)) { "", "", "list" , "", "", "", $list_refill_type, "%1", "", gettext("Define type for payment and refill,if created.") ); - - if ($form_action!="ask-edit" && $form_action!="edit") { + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> AddEditElement (gettext("CREATE ASSOCIATE INVOICE"), "added_invoice", '1', @@ -163,29 +163,29 @@ if (has_rights (ACX_MODIFY_REFILLS)) { gettext("Choose if you want to create an invoice with this refill account"), "" , "", "" , "Yes :1, - No:0", "", "" , "", ""); } - - + + $HD_Form -> FieldEditElement ('card_id, date, credit, description, refill_type, added_invoice'); - - - + + + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your ".$HD_Form->FG_INSTANCE_NAME); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this ".$HD_Form->FG_INSTANCE_NAME.", click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new ".$HD_Form->FG_INSTANCE_NAME.".
    Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new ".$HD_Form->FG_INSTANCE_NAME." has been inserted.
    "); - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'processing_refill_add'; - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; } diff --git a/admin/Public/form_data/FG_var_logrefill_agent.inc b/admin/Public/form_data/FG_var_logrefill_agent.inc old mode 100644 new mode 100755 index e563bf60d..956525bf8 --- a/admin/Public/form_data/FG_var_logrefill_agent.inc +++ b/admin/Public/form_data/FG_var_logrefill_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -56,7 +56,7 @@ $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/time_add.png" ; $list_refill_type=Constants::getRefillType_List(); $HD_Form -> AddViewElement(gettext("ID"), "cc_logrefill_agent.id", "10%", "center", "sort"); -if (has_rights (ACX_ADMINISTRATOR)) { +if (has_rights (ACX_ADMINISTRATOR)) { $HD_Form -> AddViewElement(gettext("AGENT"), "agent_id", "20%", "center", "sort", "", "30", "", "", "", "", "linktoagent"); }else{ $HD_Form -> AddViewElement(gettext("AGENT"), "agent_id", "20%", "center", "sort", "", "30", "", "", "", "", "nameofagent"); @@ -68,7 +68,7 @@ $HD_Form -> AddViewElement(gettext("REFILL AMOUNT"), "credit", "15%", "center", $HD_Form -> FieldViewElement ('cc_logrefill_agent.id, agent_id, date, cc_logrefill_agent.refill_type as refill_type, cc_logrefill_agent.credit'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO AGENT REFILL CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO AGENT REFILL CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -91,41 +91,41 @@ $HD_Form -> AddSearchElement_C1(gettext("FIRSTNAME"),'firstname','firstnametype' if (has_rights (ACX_MODIFY_REFILLS)) { $HD_Form -> FG_EDITION = true; - $HD_Form -> FG_DELETION = true; - + $HD_Form -> FG_DELETION = true; + $HD_Form -> AddEditElement (gettext("ID AGENT"), - "agent_id", - "$value", "POPUPVALUE", "size=30 maxlength=50", + "agent_id", + "$value", "POPUPVALUE", "size=30 maxlength=50", "4", gettext("Insert the Customer ID"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_agent.php?popup_select=1&", ", 'AgentSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Agent ID")); - + if ($form_action=="ask-add") { $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; $comp_date="value='$comp_date'"; } - + $HD_Form -> AddEditElement (gettext("REFILL DATE"), - "date", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("REFILL AMOUNT"), - "credit", - '$value', - "INPUT", - "size=60 maxlength=10", - "12", + "credit", + '$value', + "INPUT", + "size=60 maxlength=10", + "12", gettext("Insert the credit amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount in the currency base : ").BASE_CURRENCY ); - + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -134,7 +134,7 @@ if (has_rights (ACX_MODIFY_REFILLS)) { "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("REFILL TYPE"), "refill_type", '$value', @@ -143,26 +143,26 @@ if (has_rights (ACX_MODIFY_REFILLS)) { "", "", "list" , "", "", "", $list_refill_type, "%1", "", gettext("Define type for payment and refill,if created.") ); - + $HD_Form -> FieldEditElement ('agent_id, date, credit, description, refill_type'); - + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your ".$HD_Form->FG_INSTANCE_NAME); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this ".$HD_Form->FG_INSTANCE_NAME.", click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new ".$HD_Form->FG_INSTANCE_NAME.".
    Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new ".$HD_Form->FG_INSTANCE_NAME." has been inserted.
    "); - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'add_agent_refill'; - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + } diff --git a/admin/Public/form_data/FG_var_mailtemplate.inc b/admin/Public/form_data/FG_var_mailtemplate.inc old mode 100644 new mode 100755 index 060387a55..573a4e5b1 --- a/admin/Public/form_data/FG_var_mailtemplate.inc +++ b/admin/Public/form_data/FG_var_mailtemplate.inc @@ -31,7 +31,7 @@ * **/ -getpost_ifset(array('id', 'IDCust', 'mailtype', 'fromemail', 'fromname', 'subject', 'messagetext','languages','id_language')); +getpost_ifset(array('id', 'IDCust', 'mailtype', 'fromemail', 'fromname', 'subject', 'messagetext', 'languages','id_language')); // Get Latest id from the table @@ -45,62 +45,56 @@ $HD_Form -> FG_TABLE_DEFAULT_ORDER = "id"; if ($languages != '') { - if ($languages != '') { - $_SESSION["Langfilter"]=$languages; - } - if (isset($_SESSION["Langfilter"])) { - $HD_Form -> FG_TABLE_CLAUSE = "id_language='".$_SESSION["Langfilter"]."'"; - } + if ($languages != '') { + $_SESSION["Langfilter"]=$languages; + } + if (isset($_SESSION["Langfilter"])) { + $HD_Form -> FG_TABLE_CLAUSE = "id_language='".$_SESSION["Langfilter"]."'"; + } } else { - if (isset($_SESSION["Langfilter"])) { - $languages = $_SESSION["Langfilter"]; - } + if (isset($_SESSION["Langfilter"])) { + $languages = $_SESSION["Langfilter"]; + } } $id_language = $languages; -$HD_Form -> FG_EDITION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-edit&id_language=$languages&id="; -$HD_Form -> FG_DELETION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-delete&id_language=$languages&id="; +$HD_Form -> FG_EDITION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=ask-edit&id_language=$languages&id="; +$HD_Form -> FG_DELETION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=ask-delete&id_language=$languages&id="; $typemail_list = array(); -$typemail_list["reminder"] = array( gettext("Reminder"), Mail::$TYPE_REMINDER); -$typemail_list["signup"] = array( gettext("Signup"), Mail::$TYPE_SIGNUP); -$typemail_list["forgetpassword"] = array( gettext("Forget password"), Mail::$TYPE_FORGETPASSWORD); -$typemail_list["signupconfirmed"] = array( gettext("Signup confirmed"), Mail::$TYPE_SIGNUPCONFIRM); -$typemail_list["payment"] = array( gettext("Payment Confirmation"), Mail::$TYPE_PAYMENT); -$typemail_list["invoice_to_pay"] = array( gettext("Invoice"), Mail::$TYPE_INVOICE_TO_PAY); -$typemail_list["epaymentverify"] = array( gettext("EPayment Warning"), Mail::$TYPE_EPAYMENTVERIFY); -$typemail_list["did_paid"] = array( gettext("Did Payment confirmation"), Mail::$TYPE_DID_PAID); -$typemail_list["did_unpaid"] = array( gettext("Did not payment warning"), Mail::$TYPE_DID_UNPAID); -$typemail_list["did_released"] = array( gettext("Did released warning"), Mail::$TYPE_DID_RELEASED); -$typemail_list["template1"] = array( gettext("template1"), "template1"); -$typemail_list["template2"] = array( gettext("template2"), "template2"); -$typemail_list["template3"] = array( gettext("template3"), "template3"); -$typemail_list["template4"] = array( gettext("template4"), "template4"); -$typemail_list["template5"] = array( gettext("template5"), "template5"); -$typemail_list["template6"] = array( gettext("template6"), "template6"); -$typemail_list["template7"] = array( gettext("template7"), "template7"); -$typemail_list["template8"] = array( gettext("template8"), "template8"); -$typemail_list["template9"] = array( gettext("template9"), "template9"); -$typemail_list["new_ticket"] = array( gettext("New Ticket"), Mail::$TYPE_TICKET_NEW); -$typemail_list["modify_ticket"] = array( gettext("Modify Ticket"), Mail::$TYPE_TICKET_MODIFY); -$typemail_list["invoice_to_pay"] = array( gettext("Invoice to Pay"), Mail::$TYPE_INVOICE_TO_PAY); -$typemail_list["subscription_paid"] = array( gettext("Subscription Paid"), Mail::$TYPE_SUBSCRIPTION_PAID); -$typemail_list["subscription_unpaid"] = array( gettext("Subscription Unpaid"), Mail::$TYPE_SUBSCRIPTION_UNPAID); -$typemail_list["subscription_disable_card"] = array( gettext("Subscription Disable Card"), Mail::$TYPE_SUBSCRIPTION_DISABLE_CARD); - -if (($popup_select>=1)) { - $HD_Form -> AddViewElement(gettext("ID MAIL"), "id", "10%", "center", "sort"); -} +$typemail_list["reminder"] = array( gettext("Reminder"), Mail::$TYPE_REMINDER); +$typemail_list["signup"] = array( gettext("Signup"), Mail::$TYPE_SIGNUP); +$typemail_list["forgetpassword"] = array( gettext("Forget password"), Mail::$TYPE_FORGETPASSWORD); +$typemail_list["signupconfirmed"] = array( gettext("Signup confirmed"), Mail::$TYPE_SIGNUPCONFIRM); +$typemail_list["payment"] = array( gettext("Payment Confirmation"), Mail::$TYPE_PAYMENT); +$typemail_list["invoice_to_pay"] = array( gettext("Invoice"), Mail::$TYPE_INVOICE_TO_PAY); +$typemail_list["epaymentverify"] = array( gettext("EPayment Warning"), Mail::$TYPE_EPAYMENTVERIFY); +$typemail_list["did_paid"] = array( gettext("Did Payment confirmation"), Mail::$TYPE_DID_PAID); +$typemail_list["did_unpaid"] = array( gettext("Did not payment warning"), Mail::$TYPE_DID_UNPAID); +$typemail_list["did_released"] = array( gettext("Did released warning"), Mail::$TYPE_DID_RELEASED); +$typemail_list["template1"] = array( gettext("template1"), "template1"); +$typemail_list["template2"] = array( gettext("template2"), "template2"); +$typemail_list["template3"] = array( gettext("template3"), "template3"); +$typemail_list["template4"] = array( gettext("template4"), "template4"); +$typemail_list["template5"] = array( gettext("template5"), "template5"); +$typemail_list["template6"] = array( gettext("template6"), "template6"); +$typemail_list["template7"] = array( gettext("template7"), "template7"); +$typemail_list["template8"] = array( gettext("template8"), "template8"); +$typemail_list["template9"] = array( gettext("template9"), "template9"); +$typemail_list["new_ticket"] = array( gettext("New Ticket"), Mail::$TYPE_TICKET_NEW); +$typemail_list["modify_ticket"] = array( gettext("Modify Ticket"), Mail::$TYPE_TICKET_MODIFY); +$typemail_list["invoice_to_pay"] = array( gettext("Invoice to Pay"), Mail::$TYPE_INVOICE_TO_PAY); +$typemail_list["subscription_paid"] = array( gettext("Subscription Paid"), Mail::$TYPE_SUBSCRIPTION_PAID); +$typemail_list["subscription_unpaid"] = array( gettext("Subscription Unpaid"), Mail::$TYPE_SUBSCRIPTION_UNPAID); +$typemail_list["subscription_disable_card"] = array( gettext("Subscription Disable Card"), Mail::$TYPE_SUBSCRIPTION_DISABLE_CARD); + +$HD_Form -> AddViewElement(gettext("ID MAIL"), "id", "10%", "center", "sort"); $HD_Form -> AddViewElement(gettext("MAILTYPE"), "mailtype", "14%", "center", "sort"); $HD_Form -> AddViewElement(gettext("FROMEMAIL"), "fromemail", "25%", "center", "sort"); $HD_Form -> AddViewElement(gettext("SUBJECT"), "subject", "30%", "center", "sort"); -if (($popup_select>=1)) { - $HD_Form -> FieldViewElement ('id, mailtype, fromemail, subject'); -} else { - $HD_Form -> FieldViewElement ('mailtype, fromemail, subject'); -} +$HD_Form -> FieldViewElement ('id, mailtype, fromemail, subject'); $HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); @@ -108,89 +102,99 @@ $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; -if (($popup_select>=1)) { - $HD_Form -> FG_OTHER_BUTTON1 = true; - $HD_Form -> FG_OTHER_BUTTON1_ALT = '<'.gettext("SELECT TEXT").'>'; - $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; +if ($popup_select >= 1) { + $HD_Form -> FG_OTHER_BUTTON1 = true; + $HD_Form -> FG_OTHER_BUTTON1_ALT = '<'.gettext("SELECT TEXT").'>'; + $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; - if ($popup_select==1) { - $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|col0|');"; - } + if ($popup_select == 1) { + $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|col0|');"; + } } else { - $HD_Form -> FG_LIST_ADDING_BUTTON1 = true; - $HD_Form -> FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_mailtemplate.php?form_action=ask-add&id_language=$languages§ion=".$_SESSION["menu_section"]; - $HD_Form -> FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Add MAIL TEMPLATE"); - $HD_Form -> FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/email_add.png" ; - - $HD_Form -> FG_ADDITION = true; - $HD_Form -> FG_EDITION = true; - $HD_Form -> FG_DELETION = true; - - // Translation - $HD_Form -> FG_OTHER_BUTTON2 = true; - $HD_Form -> FG_OTHER_BUTTON2_LINK= "A2B_entity_translate.php?form_action=ask-add&id=|param|&mailtype=|col0|&languages=$languages"; - $HD_Form -> FG_OTHER_BUTTON2_ALT = gettext('Translate'); + $HD_Form -> FG_LIST_ADDING_BUTTON1 = true; + $HD_Form -> FG_LIST_ADDING_BUTTON_LINK1 = "A2B_entity_mailtemplate.php?form_action=ask-add&id_language=$languages§ion=".$_SESSION["menu_section"]; + $HD_Form -> FG_LIST_ADDING_BUTTON_ALT1 = $HD_Form ->FG_LIST_ADDING_BUTTON_MSG1 = gettext("Add MAIL TEMPLATE"); + $HD_Form -> FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/email_add.png" ; + + $HD_Form -> FG_ADDITION = true; + $HD_Form -> FG_EDITION = true; + $HD_Form -> FG_DELETION = true; + + // Translation + $HD_Form -> FG_OTHER_BUTTON2 = true; + $HD_Form -> FG_OTHER_BUTTON2_LINK= "A2B_entity_translate.php?form_action=ask-add&id=|param|&mailtype=|col0|&languages=$languages"; + $HD_Form -> FG_OTHER_BUTTON2_ALT = gettext('Translate'); } $HD_Form -> AddEditElement (gettext("MAIL TYPE"), - "mailtype", - '$value', - "SELECT", - "", - "", - "", - "list" , "", "", "", $typemail_list, "%1", "", ""); + "mailtype", + '$value', + "SELECT", + "", + "", + "", + "list" , "", "", "", $typemail_list, "%1", "", ""); + +$HD_Form -> AddEditElement (gettext("LANGUAGE"), + "id_language", + '', + "INPUT", + "size=30 maxlength=60", + "", + gettext("Insert the mail id language"), + "" , "", "", "", "" , "", "", ""); + $HD_Form -> AddEditElement (gettext("FROM EMAIL"), - "fromemail", - '', - "INPUT", - "size=30 maxlength=60", - "1", - gettext("Insert the user fromemail"), - "" , "", "", "", "" , "", "", ""); + "fromemail", + '', + "INPUT", + "size=30 maxlength=60", + "1", + gettext("Insert the user fromemail"), + "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("FROM NAME"), - "fromname", - '', - "INPUT", - "size=30 maxlength=60", - "", - gettext("Insert the user fromname"), - "" , "", "", "", "" , "", "", ""); + "fromname", + '', + "INPUT", + "size=30 maxlength=60", + "", + gettext("Insert the user fromname"), + "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("SUBJECT"), - "subject", - '', - "INPUT", - "size=30 maxlength=80", - "", - gettext("Insert the user subject"), - "" , "", "", "", "" , "", "", ""); + "subject", + '', + "INPUT", + "size=30 maxlength=80", + "", + gettext("Insert the user subject"), + "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("MESSAGE TEXT"), - "messagetext", - '', - "TEXTAREA", - "cols=70 rows=10", - "", - gettext("Insert the user subject"), - "" , "", "", "", "" , "", "", ""); + "messagetext", + '', + "TEXTAREA", + "cols=70 rows=10", + "", + gettext("Insert the user subject"), + "" , "", "", "", "" , "", "", ""); -$HD_Form -> FieldEditElement ('mailtype, fromemail, fromname, subject, messagetext'); +$HD_Form -> FieldEditElement ('mailtype, id_language, fromemail, fromname, subject, messagetext'); -$HD_Form ->FG_QUERY_ADITION_HIDDEN_FIELDS = "id, id_language"; -$HD_Form ->FG_QUERY_ADITION_HIDDEN_VALUE = "$latest_id, $id_language"; +$HD_Form -> FG_QUERY_ADITION_HIDDEN_FIELDS = "id, id_language"; +$HD_Form -> FG_QUERY_ADITION_HIDDEN_VALUE = "$latest_id, $id_language"; -$HD_Form ->FG_QUERY_EDITION_HIDDEN_FIELDS = "id_language"; -$HD_Form ->FG_QUERY_EDITION_HIDDEN_VALUE = "$id_language"; +$HD_Form -> FG_QUERY_EDITION_HIDDEN_FIELDS = "id_language"; +$HD_Form -> FG_QUERY_EDITION_HIDDEN_VALUE = "$id_language"; $HD_Form -> FG_EDITION_CLAUSE = "id ='%id' "; -if($id_language != '' || !is_null($id_language)) { - $HD_Form -> FG_EDITION_CLAUSE .= "AND id_language = '$id_language'"; -} +// if ($id_language != '' || !is_null($id_language)) { +// $HD_Form -> FG_EDITION_CLAUSE .= "AND id_language = '$id_language'"; +// } $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("Modify the contents of the email template below."); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this").$HD_Form->FG_INSTANCE_NAME." ".gettext("click on the delete button."); @@ -203,51 +207,50 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("The followings tags will be replaced in the message by the value in the database.").'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tags used for EPayment Warning email').':
    ' . - '$time$ : time of payment
    ' . - '$paymentgateway$: '.gettext('display payment gateway').'
    ' . - '$itemAmount$: '.gettext('amount of payment').'
    '; + '$time$ : time of payment
    ' . + '$paymentgateway$: '.gettext('display payment gateway').'
    ' . + '$itemAmount$: '.gettext('amount of payment').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tags used for Payment email').':
    ' . - '$itemName$: '.gettext('name of item paid').'
    ' . - '$itemID$ : '.gettext('id of customer').'
    ' . - '$paymentMethod$ : '.gettext('methode of payment').'
    ' . - '$paymentStatus$ : '.gettext('status of payment').'
    ' . - '$itemAmount$: '.gettext('amount of payment').'
    '; + '$itemName$: '.gettext('name of item paid').'
    ' . + '$itemID$ : '.gettext('id of customer').'
    ' . + '$paymentMethod$ : '.gettext('methode of payment').'
    ' . + '$paymentStatus$ : '.gettext('status of payment').'
    ' . + '$itemAmount$: '.gettext('amount of payment').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tags used for Signup').':
    ' . - '$loginkey$: '.gettext('key created to validate the signup').'
    '; + '$loginkey$: '.gettext('key created to validate the signup').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tag used for Did Payment confirmation email').':
    ' . - '$balance_remaining$: '.gettext('balance after payment').'
    '; + '$balance_remaining$: '.gettext('balance after payment').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tag used for Did not payment warning email').':
    ' . - '$days_remaining$: '.gettext('number of day before release of the did').'
    '. - '$invoice_ref$: '.gettext('invoice reference to pay for the did').'
    '; + '$days_remaining$: '.gettext('number of day before release of the did').'
    '. + '$invoice_ref$: '.gettext('invoice reference to pay for the did').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tag used for DID').':
    ' . - '$did$: '.gettext('did number').'
    '. - '$did_cost$: '.gettext('cost of the did').'
    '; + '$did$: '.gettext('did number').'
    '. + '$did_cost$: '.gettext('cost of the did').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tag used for Support Ticket').':
    ' . - '$ticket_id$: '.gettext('Ticket Id').'
    '. - '$ticket_owner$: '.gettext('Ticket Owner').'
    '. - '$ticket_priority$: '.gettext('Ticket Priority').'
    '. - '$ticket_status$: '.gettext('Ticket Status').'
    '. - '$ticket_title$: '.gettext('Ticket Title').'
    '. - '$ticket_description$: '.gettext('Ticket Description').'
    '. - '$comment_creator$: '.gettext('Comment Creator').'
    '. - '$comment_description$: '.gettext('Comment Description').'
    '; + '$ticket_id$: '.gettext('Ticket Id').'
    '. + '$ticket_owner$: '.gettext('Ticket Owner').'
    '. + '$ticket_priority$: '.gettext('Ticket Priority').'
    '. + '$ticket_status$: '.gettext('Ticket Status').'
    '. + '$ticket_title$: '.gettext('Ticket Title').'
    '. + '$ticket_description$: '.gettext('Ticket Description').'
    '. + '$comment_creator$: '.gettext('Comment Creator').'
    '. + '$comment_description$: '.gettext('Comment Description').'
    '; $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT .= ''.gettext('Tags used in all emails').':
    ' . - '$email$: '.gettext('email of the customer').'
    ' . - '$firstname$: '.gettext('firstname of the customer').'
    ' . - '$lastname$: '.gettext('lastname of the customer').'
    ' . - '$credit$: '.gettext('credit of the customer in the system currency').'
    ' . - '$creditcurrency$: '.gettext('credit of the customer in the own currency').'
    ' . - '$currency$: '.gettext('currency of the customer').'
    ' . - '$cardnumber$: '.gettext('card number of the customer').'
    ' . - '$password$: '.gettext('password of the customer').'
    ' . - '$login$: '.gettext('login of the customer').'
    ' . - '$credit_notification$: '.gettext('credit notification of the customer').'
    ' . - '$base_currency$: '.gettext('base currency of system').'
    '; + '$email$: '.gettext('email of the customer').'
    ' . + '$firstname$: '.gettext('firstname of the customer').'
    ' . + '$lastname$: '.gettext('lastname of the customer').'
    ' . + '$credit$: '.gettext('credit of the customer in the system currency').'
    ' . + '$creditcurrency$: '.gettext('credit of the customer in the own currency').'
    ' . + '$currency$: '.gettext('currency of the customer').'
    ' . + '$cardnumber$: '.gettext('card number of the customer').'
    ' . + '$password$: '.gettext('password of the customer').'
    ' . + '$login$: '.gettext('login of the customer').'
    ' . + '$credit_notification$: '.gettext('credit notification of the customer').'
    ' . + '$base_currency$: '.gettext('base currency of system').'
    '; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT ; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; - +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&languages=en&id="; diff --git a/admin/Public/form_data/FG_var_moneysituation.inc b/admin/Public/form_data/FG_var_moneysituation.inc old mode 100644 new mode 100755 index 522c26526..2d05aaecc --- a/admin/Public/form_data/FG_var_moneysituation.inc +++ b/admin/Public/form_data/FG_var_moneysituation.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -52,7 +52,7 @@ $HD_Form -> AddViewElement(gettext("TO PAY"), "to pay", "7%", "center", "sort", $HD_Form -> FieldViewElement ('id, username, useralias, firstname, lastname, credit, id, id, id'); $HD_Form -> FG_ACTION_SIZE_COLUMN = '15%'; -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO").strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO").strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -99,7 +99,7 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_moneysituation_details.inc b/admin/Public/form_data/FG_var_moneysituation_details.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_monitor.inc b/admin/Public/form_data/FG_var_monitor.inc old mode 100644 new mode 100755 index 6d22a6c1b..d663f50f2 --- a/admin/Public/form_data/FG_var_monitor.inc +++ b/admin/Public/form_data/FG_var_monitor.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -172,8 +172,8 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_outbound_cid.php b/admin/Public/form_data/FG_var_outbound_cid.php index 50dcd57ef..38ddf0300 100644 --- a/admin/Public/form_data/FG_var_outbound_cid.php +++ b/admin/Public/form_data/FG_var_outbound_cid.php @@ -34,7 +34,7 @@ // TODO integrate in Framework if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+25; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; @@ -81,6 +81,6 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_outbound_cidgroup.php b/admin/Public/form_data/FG_var_outbound_cidgroup.php old mode 100644 new mode 100755 index b546e8043..21b754226 --- a/admin/Public/form_data/FG_var_outbound_cidgroup.php +++ b/admin/Public/form_data/FG_var_outbound_cidgroup.php @@ -63,6 +63,6 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_package.inc b/admin/Public/form_data/FG_var_package.inc old mode 100644 new mode 100755 index 5b087c339..d1d3017a8 --- a/admin/Public/form_data/FG_var_package.inc +++ b/admin/Public/form_data/FG_var_package.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -70,7 +70,7 @@ $HD_Form -> AddViewElement(gettext("FREE"), "freetimetocall", "17%", "center", " $HD_Form -> FieldViewElement ('label, creationdate, packagetype, billingtype, startday, '.$filter_unit); $HD_Form -> FG_ACTION_SIZE_COLUMN='15%'; -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -83,29 +83,29 @@ $HD_Form -> FG_OTHER_BUTTON1_ALT = gettext("Add rates"); $HD_Form -> FG_OTHER_BUTTON1_IMG = ""; $HD_Form -> FG_OTHER_BUTTON1_LINK = "A2B_package_manage_rates.php?id=|param|"; $HD_Form -> AddEditElement (gettext("LABEL"), - "label", - '$value', - "INPUT", - "size=30 maxlength=30", - "0", + "label", + '$value', + "INPUT", + "size=30 maxlength=30", + "0", gettext("Insert the package label"), "" , "", "", "", "", "", "", ""); $HD_Form -> AddEditElement (gettext("PACKAGE TYPE"), - "packagetype", - '$value', - "SELECT", - "", - "", + "packagetype", + '$value', + "SELECT", + "", + "", "", "list" , "", "", "", $packagetype_list, "%1", "", ""); $HD_Form -> AddEditElement (gettext("BILLING TYPE"), "billingtype", - '$value', - "SELECT", - "", - "", + '$value', + "SELECT", + "", + "", "", "list" , "", "", "", $billingtype_list, "%1", "", ""); @@ -115,25 +115,25 @@ if (isset($form_action) && $form_action=="ask-add") { $HD_Form -> AddEditElement (gettext("STARTING DAY"), "startday", - '$value', - "INPUT", - "size=10 $default_init maxlength=5", - "4", - gettext("Insert the start day"), + '$value', + "INPUT", + "size=10 $default_init maxlength=5", + "4", + gettext("Insert the start day"), "" , "", "", "", "", "", "", gettext("The value will be related to billing type ; if monthly accepted value are 1-31 ; if Weekly accepted value 1-7 (Monday to Sunday) ")); $HD_Form -> AddEditElement (gettext("FREE UNITS"), - "freetimetocall", - '$value', - "INPUT", - "size=10 maxlength=10", - "4", + "freetimetocall", + '$value', + "INPUT", + "size=10 maxlength=10", + "4", gettext("Insert the amount of free time to call (seconds)"), "" , "", "", "", "", "", "", gettext("Insert the amount of free units, in seconds,for the FREE SECONDS mode. For NUMBER OF FREE CALLS insert the number of free calls")); - - + + $HD_Form -> FieldEditElement ('label, packagetype, billingtype, startday, freetimetocall'); @@ -148,9 +148,9 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create the new")." ".$HD_Form->FG_INSTANCE_NAME; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_payment.inc b/admin/Public/form_data/FG_var_payment.inc old mode 100644 new mode 100755 index ef7bde87a..f8b89d877 --- a/admin/Public/form_data/FG_var_payment.inc +++ b/admin/Public/form_data/FG_var_payment.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -65,7 +65,7 @@ $HD_Form -> AddViewElement(gettext("REFILL"), "id_logrefill", "17%", "center", " $HD_Form -> FieldViewElement ('cc_logpayment.id, card_id, date, payment ,payment_type,id_logrefill'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -106,53 +106,53 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)) { if (has_rights (ACX_MODIFY_PAYMENTS)) { - + $HD_Form -> FG_ADDITION = true; $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; - + if ($form_action=="ask-add" && !empty($card_id)) { $id_val = "value='$card_id'"; } - + $HD_Form -> AddEditElement (gettext("CUSTOMER ID"), - "card_id", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ".$id_val, - "4", + "card_id", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ".$id_val, + "4", gettext("Insert the Customer ID "), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Customer ID")); - - if ($form_action=="ask-add"){ + + if ($form_action=="ask-add"){ $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; $comp_date="value='$comp_date'"; } - + $HD_Form -> AddEditElement (gettext("PAYMENT DATE"), - "date", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("PAYMENT AMOUNT"), - "payment", - '$value', - "INPUT", - "size=60 maxlength=10", - "12", + "payment", + '$value', + "INPUT", + "size=60 maxlength=10", + "12", gettext("Insert the payment amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount in the currency base : ").BASE_CURRENCY ); - - + + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -161,8 +161,8 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - - if ($form_action!="ask-edit" && $form_action!="edit") { + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> AddEditElement (gettext("CREATE ASSOCIATE REFILL"), "added_refill", '0', @@ -172,8 +172,8 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { gettext("Choose if you want to create a refill with this payment account"), "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Refill card account")); } - - if ($form_action!="ask-edit" && $form_action!="edit") { + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> AddEditElement (gettext("CREATE AGENT COMMISSION "), "added_commission", '0', @@ -183,7 +183,7 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { gettext("Choose if you want to create a commission to an agent, if this customer is managed by one"), "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Commission for agent")); } - + $HD_Form -> AddEditElement (gettext("PAYMENT TYPE"), "payment_type", '$value', @@ -192,32 +192,32 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { "", "", "list" , "", "", "", $list_refill_type, "%1", "", gettext("Define type for payment and refill,if created.") ); - - - - if ($form_action!="ask-edit" && $form_action!="edit") { + + + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> FieldEditElement ('card_id, date, payment, description,payment_type'); } else { $HD_Form -> FieldEditElement ('card_id, date, payment, description, added_refill,added_commission, payment_type'); } - - + + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your ".$HD_Form->FG_INSTANCE_NAME); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this ".$HD_Form->FG_INSTANCE_NAME.", click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new ".$HD_Form->FG_INSTANCE_NAME.".
    Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new ".$HD_Form->FG_INSTANCE_NAME." has been inserted.
    "); - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'create_refill_after_payment'; - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; } diff --git a/admin/Public/form_data/FG_var_payment_agent.inc b/admin/Public/form_data/FG_var_payment_agent.inc old mode 100644 new mode 100755 index d04f13b61..32b9d2ecd --- a/admin/Public/form_data/FG_var_payment_agent.inc +++ b/admin/Public/form_data/FG_var_payment_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -54,7 +54,7 @@ $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = Images_Path ."/money_add.png" ; $list_refill_type=Constants::getRefillType_List(); $HD_Form -> AddViewElement(gettext("ID"), "cc_logpayment.id", "10%", "center", "sort"); -if (has_rights (ACX_ADMINISTRATOR)) { +if (has_rights (ACX_ADMINISTRATOR)) { $HD_Form -> AddViewElement(gettext("AGENT"), "agent_id", "20%", "center", "sort", "", "30", "", "", "", "", "linktoagent"); } else { $HD_Form -> AddViewElement(gettext("AGENT"), "agent_id", "20%", "center", "sort", "", "30", "", "", "", "", "nameofagent"); @@ -67,7 +67,7 @@ $HD_Form -> AddViewElement(gettext("REFILL"), "id_logrefill", "17%", "center", " $HD_Form -> FieldViewElement ('cc_logpayment_agent.id, agent_id, date, payment ,payment_type,id_logrefill'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO AGENT PAYMENT CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO AGENT PAYMENT CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -90,49 +90,49 @@ $HD_Form -> AddSearchElement_C1(gettext("FIRSTNAME"),'firstname','firstnametype' if (has_rights (ACX_MODIFY_PAYMENTS)) { $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; - - if ($form_action=="ask-add" && !empty($agent_id)) { + + if ($form_action=="ask-add" && !empty($agent_id)) { $id_val = "value='$agent_id'"; } - + $HD_Form -> AddEditElement (gettext("AGENT ID"), - "agent_id", - "$value", - "POPUPVALUE", - "size=30 maxlength=50 ".$id_val, - "4", + "agent_id", + "$value", + "POPUPVALUE", + "size=30 maxlength=50 ".$id_val, + "4", gettext("Insert the Agent ID "), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_agent.php?popup_select=1&" , ", 'AgentSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Agent ID")); - + if ($form_action=="ask-add") { $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; $comp_date="value='$comp_date'"; } - + $HD_Form -> AddEditElement (gettext("PAYMENT DATE"), - "date", - '$value', - "INPUT", - "size=40 maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("PAYMENT AMOUNT"), - "payment", - '$value', - "INPUT", - "size=60 maxlength=10", - "12", + "payment", + '$value', + "INPUT", + "size=60 maxlength=10", + "12", gettext("Insert the payment amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount in the currency base : ").BASE_CURRENCY ); - - + + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -141,8 +141,8 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - - if ($form_action!="ask-edit" && $form_action!="edit") { + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> AddEditElement (gettext("CREATE ASSOCIATE REFILL"), "added_refill", '0', @@ -152,7 +152,7 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { gettext("Choose if you want to create a refill with this payment account"), "" , "", "" , "Yes :1, - No:0", "", "" , "", gettext("Refill card account")); } - + $HD_Form -> AddEditElement (gettext("REFILL TYPE"), "payment_type", '$value', @@ -161,31 +161,31 @@ if (has_rights (ACX_MODIFY_PAYMENTS)) { "", "", "list" , "", "", "", $list_refill_type, "%1", "", gettext("Define type for payment and refill,if created.") ); - - - if ($form_action!="ask-edit" && $form_action!="edit") { + + + if ($form_action!="ask-edit" && $form_action!="edit") { $HD_Form -> FieldEditElement ('agent_id, date, payment, description,payment_type'); } else { $HD_Form -> FieldEditElement ('agent_id, date, payment, description, added_refill, payment_type'); } - - + + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("You can modify, through the following form, the different properties of your ".$HD_Form->FG_INSTANCE_NAME); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this ".$HD_Form->FG_INSTANCE_NAME.", click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new ".$HD_Form->FG_INSTANCE_NAME.".
    Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new ".$HD_Form->FG_INSTANCE_NAME." has been inserted.
    "); - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); - + $HD_Form -> FG_ADDITIONAL_FUNCTION_AFTER_ADD = 'create_agent_refill'; - - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; + + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; } diff --git a/admin/Public/form_data/FG_var_payment_configuration.inc b/admin/Public/form_data/FG_var_payment_configuration.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_payment_invoice.inc b/admin/Public/form_data/FG_var_payment_invoice.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_paymentlog.inc b/admin/Public/form_data/FG_var_paymentlog.inc old mode 100644 new mode 100755 index 068d83888..4bec325d8 --- a/admin/Public/form_data/FG_var_paymentlog.inc +++ b/admin/Public/form_data/FG_var_paymentlog.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -44,7 +44,7 @@ $HD_Form -> FG_TABLE_DEFAULT_SENS = "DESC"; $date_clause = ""; -if (DB_TYPE == "postgres") { +if (DB_TYPE == "postgres") { $UNIX_TIMESTAMP = ""; }else{ $UNIX_TIMESTAMP = "UNIX_TIMESTAMP"; @@ -57,10 +57,10 @@ if ($Period=="Month"){ if ($tomonth && isset($tostatsmonth)) { if (strlen($date_clause)>0) $date_clause.=" AND "; - $date_clause.=" $UNIX_TIMESTAMP(creationdate) <= $UNIX_TIMESTAMP('".$tostatsmonth."-$lastdayofmonth 23:59:59')"; + $date_clause.=" $UNIX_TIMESTAMP(creationdate) <= $UNIX_TIMESTAMP('".$tostatsmonth."-$lastdayofmonth 23:59:59')"; } }else{ - if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) + if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) { if (strlen($date_clause)>0) $date_clause.=" AND "; $date_clause.=" $UNIX_TIMESTAMP(creationdate) >= $UNIX_TIMESTAMP('$fromstatsmonth_sday-$fromstatsday_sday')"; @@ -76,7 +76,7 @@ if (strlen($HD_Form -> FG_TABLE_CLAUSE)>0 && strlen($enteradmin)>0) $HD_Form -> if($enteradmin != "") { $HD_Form -> FG_TABLE_CLAUSE.=" iduser = '$enteradmin'"; -} +} if (strlen($enteradmin)>0 && strlen($loglevel)>0 && $loglevel > 0) $HD_Form -> FG_TABLE_CLAUSE.=" AND "; if($status >= 0 && $status != '') { @@ -116,74 +116,74 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; $HD_Form -> AddEditElement (gettext("ID"), - "id", - "$value", - "INPUT", - "size=10 READONLY maxlength=10", - "4", + "id", + "$value", + "INPUT", + "size=10 READONLY maxlength=10", + "4", gettext("Insert the Id "), - "" , "", "", "", "", "", "", + "" , "", "", "", "", "", "", gettext("Select the ID")); $HD_Form -> AddEditElement (gettext("DATE"), - "creationdate", - '$value', - "INPUT", - "size=40 READONLY maxlength=40 ", - "10", + "creationdate", + '$value', + "INPUT", + "size=40 READONLY maxlength=40 ", + "10", gettext("Insert the creation date"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("PAYMENT METHOD"), - "paymentmethod", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "paymentmethod", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the payment method"), "" , "", "", "", "" , "", "", gettext("Enter the payment method ") ); -$HD_Form -> AddEditElement (gettext("STATUS"), - "status", - '$value', - "SELECT", - "", - "", - "", +$HD_Form -> AddEditElement (gettext("STATUS"), + "status", + '$value', + "SELECT", + "", + "", + "", "list" , "", "", "", $status_list, "%1", "", "" ); $HD_Form -> AddEditElement (gettext("OWNER"), - "cc_owner", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "cc_owner", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the owner"), "" , "", "", "", "" , "", "", gettext("Enter the owner") ); $HD_Form -> AddEditElement (gettext("AMOUNT"), - "amount", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "amount", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount ") ); $HD_Form -> AddEditElement (gettext("ID CARD"), - "card_id", - "$value", - "POPUPVALUE", - "size=30 maxlength=50", - "4", + "card_id", + "$value", + "POPUPVALUE", + "size=30 maxlength=50", + "4", gettext("Insert the Id CardNumber"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Card Number ID")); @@ -208,6 +208,6 @@ $HD_Form -> FG_INTRO_TEXT_EDITION= ''; $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_paymentlog_agent.inc b/admin/Public/form_data/FG_var_paymentlog_agent.inc old mode 100644 new mode 100755 index f76efe2bc..c0647d4af --- a/admin/Public/form_data/FG_var_paymentlog_agent.inc +++ b/admin/Public/form_data/FG_var_paymentlog_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -44,7 +44,7 @@ $HD_Form -> FG_TABLE_DEFAULT_SENS = "DESC"; $date_clause = ""; -if (DB_TYPE == "postgres") { +if (DB_TYPE == "postgres") { $UNIX_TIMESTAMP = ""; }else{ $UNIX_TIMESTAMP = "UNIX_TIMESTAMP"; @@ -57,10 +57,10 @@ if ($Period=="Month"){ if ($tomonth && isset($tostatsmonth)) { if (strlen($date_clause)>0) $date_clause.=" AND "; - $date_clause.=" $UNIX_TIMESTAMP(creationdate) <= $UNIX_TIMESTAMP('".$tostatsmonth."-$lastdayofmonth 23:59:59')"; + $date_clause.=" $UNIX_TIMESTAMP(creationdate) <= $UNIX_TIMESTAMP('".$tostatsmonth."-$lastdayofmonth 23:59:59')"; } }else{ - if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) + if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) { if (strlen($date_clause)>0) $date_clause.=" AND "; $date_clause.=" $UNIX_TIMESTAMP(creationdate) >= $UNIX_TIMESTAMP('$fromstatsmonth_sday-$fromstatsday_sday')"; @@ -76,7 +76,7 @@ if (strlen($HD_Form -> FG_TABLE_CLAUSE)>0 && strlen($enteradmin)>0) $HD_Form -> if($enteradmin != "") { $HD_Form -> FG_TABLE_CLAUSE.=" iduser = '$enteradmin'"; -} +} if (strlen($enteradmin)>0 && strlen($loglevel)>0 && $loglevel > 0) $HD_Form -> FG_TABLE_CLAUSE.=" AND "; if($status >= 0 && $status != '') { @@ -116,74 +116,74 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; $HD_Form -> AddEditElement (gettext("ID"), - "id", - "$value", - "INPUT", - "size=10 READONLY maxlength=10", - "4", + "id", + "$value", + "INPUT", + "size=10 READONLY maxlength=10", + "4", gettext("Insert the Id "), - "" , "", "", "", "", "", "", + "" , "", "", "", "", "", "", gettext("Select the ID")); $HD_Form -> AddEditElement (gettext("DATE"), - "creationdate", - '$value', - "INPUT", - "size=40 READONLY maxlength=40 ", - "10", + "creationdate", + '$value', + "INPUT", + "size=40 READONLY maxlength=40 ", + "10", gettext("Insert the creation date"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("PAYMENT METHOD"), - "paymentmethod", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "paymentmethod", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the payment method"), "" , "", "", "", "" , "", "", gettext("Enter the payment method ") ); -$HD_Form -> AddEditElement (gettext("STATUS"), - "status", - '$value', - "SELECT", - "", - "", - "", +$HD_Form -> AddEditElement (gettext("STATUS"), + "status", + '$value', + "SELECT", + "", + "", + "", "list" , "", "", "", $status_list, "%1", "", "" ); $HD_Form -> AddEditElement (gettext("OWNER"), - "cc_owner", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "cc_owner", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the owner"), "" , "", "", "", "" , "", "", gettext("Enter the owner") ); $HD_Form -> AddEditElement (gettext("AMOUNT"), - "amount", - '$value', - "INPUT", - "size=30 maxlength=30", - "12", + "amount", + '$value', + "INPUT", + "size=30 maxlength=30", + "12", gettext("Insert the amount"), "" , "", "", "", "" , "", "", gettext("Enter the amount ") ); $HD_Form -> AddEditElement (gettext("ID AGENT"), - "agent_id", - "$value", - "POPUPVALUE", - "size=30 maxlength=50", - "4", + "agent_id", + "$value", + "POPUPVALUE", + "size=30 maxlength=50", + "4", gettext("Insert the Id CardNumber"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_agent.php?popup_select=1&" , ", 'AgentIdSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Agent ID")); @@ -208,6 +208,6 @@ $HD_Form -> FG_INTRO_TEXT_EDITION= ''; $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_phonenumber.inc b/admin/Public/form_data/FG_var_phonenumber.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_prefix.inc b/admin/Public/form_data/FG_var_prefix.inc old mode 100644 new mode 100755 index e9f583c28..f651fd7f0 --- a/admin/Public/form_data/FG_var_prefix.inc +++ b/admin/Public/form_data/FG_var_prefix.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -92,7 +92,7 @@ $HD_Form -> AddEditElement (gettext("PREFIX"), "$dialprefix", gettext("Insert the Prefixe"), "" , "", "", "", "" , "", "" ,""); - + $HD_Form -> AddEditElement (gettext("DESTINATION"), "destination", '$value', @@ -134,9 +134,9 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_provider.inc b/admin/Public/form_data/FG_var_provider.inc old mode 100644 new mode 100755 index 810225573..c44cefe45 --- a/admin/Public/form_data/FG_var_provider.inc +++ b/admin/Public/form_data/FG_var_provider.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,13 +27,13 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ -getpost_ifset(array('id', 'provider_name', 'creationdate', 'description', 'popup_select')); +getpost_ifset(array('id', 'provider_name', 'creationdate', 'description', 'popup_select', 'id_cc_card')); $HD_Form = new FormHandler("cc_provider","Provider"); @@ -50,11 +50,12 @@ if ($popup_select) $HD_Form -> AddViewElement(gettext("ID"), "id", "15%", "center", "sort"); $HD_Form -> AddViewElement(gettext("PROVIDER NAME"), "provider_name", "25%", "center", "sort"); $HD_Form -> AddViewElement(gettext("CREATIONDATE"), "creationdate", "20%", "center", "sort", "19", "", "", "", "", "", "display_dateformat"); -$HD_Form -> AddViewElement(gettext("DESCRIPTION"), "description", "30%", "center", "sort", "30"); -$HD_Form -> FieldViewElement (($popup_select ? 'id,' : '') . 'provider_name, creationdate, description'); +$HD_Form -> AddViewElement(gettext("DESCRIPTION"), "description", "20%", "center", "sort", "30"); +$HD_Form -> AddViewElement(gettext("CARDHOLDER"), "id_cc_card", "17%", "center", "sort", "25", "lie", "cc_card", "lastname, firstname", "id='%id'", "%1 %2"); +$HD_Form -> FieldViewElement (($popup_select ? 'id,' : '') . 'provider_name, creationdate, description, id_cc_card'); -$HD_Form -> CV_NO_FIELDS = gettext("NO PROVIDERS CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("NO PROVIDERS CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -80,25 +81,37 @@ if ($popup_select) { $HD_Form -> FG_ADDITION = true; } -$HD_Form -> AddEditElement ( gettext("PROVIDER NAME"), - "provider_name", '$value', +$HD_Form -> AddEditElement ( gettext("PROVIDER NAME"), + "provider_name", '$value', "INPUT", "size=40 maxlength=40", "0", - gettext("Insert the provider name"), + gettext("Insert the provider name"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement ( gettext("DESCRIPTION"), "description", - '$value', + '$value', "TEXTAREA", "cols=50 rows=5", "", - gettext("Insert the description"), + gettext("Insert the description"), "" , "", "", "", "", "", "", ""); -$HD_Form -> FieldEditElement ('provider_name, description'); +$HD_Form -> AddEditElement (gettext("ID CARD"), + "id_cc_card", + '', + "POPUPVALUE", + "size=30 maxlength=50 $def_value_idcard", + "4", + gettext("Insert the Id CardNumber"), + "", "", "", "", "", + "A2B_entity_card.php?popup_select=1&" + , ", 'CardNumberSelection','width=590,height=350,top=20,left=100,scrollbars=1'", + gettext("Insert the card ID.")); + +$HD_Form -> FieldEditElement ('provider_name, description, id_cc_card'); @@ -112,9 +125,9 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_receipt.inc b/admin/Public/form_data/FG_var_receipt.inc old mode 100644 new mode 100755 index d67a2645a..f83fd734c --- a/admin/Public/form_data/FG_var_receipt.inc +++ b/admin/Public/form_data/FG_var_receipt.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,15 +27,15 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ getpost_ifset(array('id', 'id_card', 'date','title','description')); - - + + if (!isset($form_action) || $form_action=="list") { $list_query = "cc_receipt LEFT JOIN cc_card ON cc_card.id=id_card"; $list_query .= " LEFT JOIN ( SELECT st1.id_receipt, SUM(st1.price) as total_price FROM cc_receipt_item AS st1 GROUP BY st1.id_receipt) as items ON items.id_receipt = cc_receipt.id "; @@ -53,7 +53,7 @@ $HD_Form -> FG_FK_DELETE_CONFIRM = true; $HD_Form -> FG_FK_WARNONLY = true; $HD_Form -> FG_FK_TABLENAMES = array("cc_receipt_item"); $HD_Form -> FG_FK_EDITION_CLAUSE = array(" id_receipt "); - + $HD_Form -> FG_INFO = true; $HD_Form -> FG_INFO_LINK = "A2B_receipt_view.php?id="; $HD_Form -> FG_INFO_ALT = "VIEW"; @@ -92,7 +92,7 @@ $HD_Form -> AddViewElement(gettext("AMOUNT INCL VAT"), "total_price", "10%", "ce $HD_Form -> FieldViewElement ("cc_receipt.id, username, cc_receipt.date,title,cc_receipt.status,$filter_amount_with_vat"); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -103,14 +103,14 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> AddEditElement (gettext("ID CUSTOMER"), - "id_card", - "$value", "POPUPVALUE", "size=30 maxlength=50", + "id_card", + "$value", "POPUPVALUE", "size=30 maxlength=50", "4", gettext("Insert the Customer ID"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&", ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Select the Customer ID")); -if ($form_action=="ask-add"){ +if ($form_action=="ask-add"){ $begin_date = date("Y"); $end_date = date("-m-d H:i:s"); $comp_date=$begin_date.$end_date; @@ -118,24 +118,24 @@ if ($form_action=="ask-add"){ } $HD_Form -> AddEditElement (gettext("INVOICE DATE"), - "date", - '$value', - "INPUT", - "size=40 READONLY maxlength=40 $comp_date", - "10", + "date", + '$value', + "INPUT", + "size=40 READONLY maxlength=40 $comp_date", + "10", gettext("Insert the current date"), "" , "", "", "", "", "", "", "" ); -$HD_Form -> AddEditElement ( gettext("TITLE"), - "title", '$value', +$HD_Form -> AddEditElement ( gettext("TITLE"), + "title", '$value', "INPUT", "size=30 maxlength=50", "0", - gettext("Insert the title of invoice, if you need one"), + gettext("Insert the title of invoice, if you need one"), "" , "", "", "", "", "", "", "" ); - - + + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "description", '', @@ -144,7 +144,7 @@ $HD_Form -> AddEditElement (gettext("DESCRIPTION"), "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> FieldEditElement ('id_card, date,title, description'); @@ -176,8 +176,8 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = "A2B_receipt_edit.php?id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_remittance_request.inc b/admin/Public/form_data/FG_var_remittance_request.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_restore.inc b/admin/Public/form_data/FG_var_restore.inc old mode 100644 new mode 100755 index 3893b3295..e2e8924e2 --- a/admin/Public/form_data/FG_var_restore.inc +++ b/admin/Public/form_data/FG_var_restore.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -52,7 +52,7 @@ $HD_Form -> AddViewElement(gettext("CREATIONDATE"), "creationdate", "20%", "cent $HD_Form -> FieldViewElement ('id, name, path, creationdate'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -72,7 +72,7 @@ $HD_Form -> AddEditElement (gettext("Name "), "", gettext("Insert the name of backup"), "" , "", "", "", "", "", "", gettext("Name of the backup")); - + $HD_Form -> AddEditElement ("PATH", "path", '', @@ -81,7 +81,7 @@ $HD_Form -> AddEditElement ("PATH", "", "the backup file", "" , "", "", "", "", "", "", gettext("The backup file name")); - + $HD_Form -> FieldEditElement ('name, path, creationdate'); @@ -101,11 +101,11 @@ $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
    ".gettext("Fill the following fields and confirm by clicking on the button add."); -$HD_Form -> FG_OTHER_BUTTON1_LINK = $_SERVER['PHP_SELF']."?form_action=restore&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; +$HD_Form -> FG_OTHER_BUTTON1_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=restore&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; $HD_Form -> FG_OTHER_BUTTON1_IMG = Images_Path . "/icon-restore.gif"; $HD_Form -> FG_OTHER_BUTTON1_ALT = gettext("Restore"); -$HD_Form -> FG_OTHER_BUTTON2_LINK = $_SERVER['PHP_SELF']."?form_action=download&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; +$HD_Form -> FG_OTHER_BUTTON2_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=download&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; $HD_Form -> FG_OTHER_BUTTON2_IMG = Images_Path . "/dl.gif"; $HD_Form -> FG_OTHER_BUTTON2_ALT = gettext("Download"); @@ -117,10 +117,10 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on the CONTINUE button."); -$FG_GO_LINK_AFTER_UPLOAD = $_SERVER['PHP_SELF']."?form_action=list&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; +$FG_GO_LINK_AFTER_UPLOAD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?form_action=list&atmenu=$HD_Form->FG_INSTANCE_NAME&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; unset($FG_GO_LINK_AFTER_UPLOAD); unset($HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE); diff --git a/admin/Public/form_data/FG_var_server.inc b/admin/Public/form_data/FG_var_server.inc index a387edccf..e6ef31ede 100755 --- a/admin/Public/form_data/FG_var_server.inc +++ b/admin/Public/form_data/FG_var_server.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -56,7 +56,7 @@ $HD_Form -> AddViewElement(gettext("LASTTIME USED"), "lasttime_used", "15%", "ce $HD_Form -> FieldViewElement ('id_group, id_group, server_ip, manager_host, manager_username, lasttime_used'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -76,39 +76,39 @@ $HD_Form -> AddEditElement (gettext("SERVER GROUP"), "name, id", "", "", "%1","", ""); -$HD_Form -> AddEditElement (gettext("SERVER HOSTNAME"), - "server_ip", - '$value', - "INPUT", - "size=30 maxlength=40", +$HD_Form -> AddEditElement (gettext("SERVER HOSTNAME"), + "server_ip", + '$value', + "INPUT", + "size=30 maxlength=40", "3", gettext("Insert the server hostname"), "" , "", "", "", "" , "", "", ""); -$HD_Form -> AddEditElement (gettext("MANAGER HOST"), - "manager_host", - '$value', - "INPUT", - "size=30 maxlength=40", +$HD_Form -> AddEditElement (gettext("MANAGER HOST"), + "manager_host", + '$value', + "INPUT", + "size=30 maxlength=40", "9", gettext("Insert the manager host"), "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("MANAGER USERNAME"), - "manager_username", - '$value', - "INPUT", - "size=30 maxlength=40", - "9", + "manager_username", + '$value', + "INPUT", + "size=30 maxlength=40", + "9", gettext("Insert the manager username"), "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("MANAGER SECRET"), - "manager_secret", - '$value', - "INPUT", - "size=30 maxlength=40", - "", + "manager_secret", + '$value', + "INPUT", + "size=30 maxlength=40", + "", gettext("Insert the manager secret"), "" , "", "", "", "" , "", "", ""); @@ -140,9 +140,9 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create the new")." ".$HD_Form->FG_INSTANCE_NAME; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_server_group.inc b/admin/Public/form_data/FG_var_server_group.inc index 3c2345aa9..9cf6e3d00 100755 --- a/admin/Public/form_data/FG_var_server_group.inc +++ b/admin/Public/form_data/FG_var_server_group.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -54,7 +54,7 @@ $HD_Form -> AddViewElement("DESCRIPTION", "description", "40%", "center", "sort" $HD_Form -> FieldViewElement ('id, name, description'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -66,21 +66,21 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; -$HD_Form -> AddEditElement ("NAME", - "name", - '$value', - "INPUT", - "size=20 maxlength=30", - "3", - gettext("Insert the name"), +$HD_Form -> AddEditElement ("NAME", + "name", + '$value', + "INPUT", + "size=20 maxlength=30", + "3", + gettext("Insert the name"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("DESCRIPTION"), - "description", - '', - "TEXTAREA", - "cols=50 rows=4", - "", + "description", + '', + "TEXTAREA", + "cols=50 rows=4", + "", gettext("Insert the description"), "" , "", "", "", "" , "", "", ""); @@ -116,9 +116,9 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create the new")." ".$HD_Form->FG_INSTANCE_NAME; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_service.inc b/admin/Public/form_data/FG_var_service.inc old mode 100644 new mode 100755 index 05f029cf6..14c680c60 --- a/admin/Public/form_data/FG_var_service.inc +++ b/admin/Public/form_data/FG_var_service.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,13 +27,13 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ -getpost_ifset(array('id', 'name', 'amount', 'period', 'rule', 'daynumber', 'stopmode', 'maxnumbercycle', 'status', 'emailreport')); +getpost_ifset(array('id', 'name', 'amount', 'period', 'rule', 'daynumber', 'stopmode', 'maxnumbercycle', 'status', 'emailreport', 'condition5x')); $HD_Form = new FormHandler("cc_service","Service"); @@ -73,13 +73,15 @@ $stopmode_list = array(); $stopmode_list["0"] = array( gettext("Never"), "0"); $stopmode_list["1"] = array( gettext("Account balance below zero"), "1"); $stopmode_list["2"] = array( gettext("Max number of cycle reach"), "2"); +$stopmode_list["50"] = array( gettext("Account balance is greater than"), "50"); +$stopmode_list["51"] = array( gettext("Account balance is less than"), "51"); $operatemode_list = array(); $operatemode_list["0"] = array(gettext("Allow be charged into negative balance"),"0"); $operatemode_list["1"] = array(gettext("Do partial charge but never go into negative balance"),"1"); $usegroup_list = array(); -$usegroup_list["0"] = array(gettext("List of groups below"),"0"); +$usegroup_list["0"] = array(gettext("List of groups below"),"0"); $usegroup_list["1"] = array(gettext("Any group"),"1"); $HD_Form -> AddViewElement(gettext("NAME"), "name", "15%", "center", "sort"); @@ -96,7 +98,7 @@ $HD_Form -> AddViewElement(gettext("TOTALCREDIT"), "totalcredit", "10%", "center $HD_Form -> FieldViewElement ('name, amount, period, status, numberofrun, datelastrun, totalcardperform, totalcredit'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -140,7 +142,7 @@ $HD_Form -> AddEditElement (gettext("RULE"), "", "", "list" , "", "", "", $rule_list, "%1", "", gettext("where X - day number (X) in days
    and Y = number set in period field")); - + $HD_Form -> AddEditElement ("DAY NUMBER (X)", "daynumber", "$value", @@ -167,7 +169,7 @@ $HD_Form -> AddEditElement ("STOP MODE", "", "", "list" , "", "", "", $stopmode_list, "%1" , "", ""); - + $HD_Form -> AddEditElement ("MAX NUMBER OF CYCLES BY CARD", "maxnumbercycle", "$value", @@ -176,7 +178,16 @@ $HD_Form -> AddEditElement ("MAX NUMBER OF CYCLES BY CARD", "4", gettext("Insert the max number of cycle"), "" , "", "", "", "", "" , "NO-NULL", gettext("Set the maximum number of times that the service should be applied.")); - + +$HD_Form -> AddEditElement ("ACCOUNT BALANCE PARAMETER", + "condition5x", + '$value', + "INPUT", + "size=20 maxlength=20", + "12", + gettext("Insert the condition for stop mode"), + "" , "", "", "", "", "" , "NO-NULL", gettext("Set the stop mode condition for checking by account balance.")); + $HD_Form -> AddEditElement ("STATUS", "status", '$value', @@ -190,10 +201,10 @@ $HD_Form -> AddEditElement (gettext("EMAIL TO SEND REPORT"), "emailreport", '$value', "INPUT", - "size=30 maxlength=30", + "size=30 maxlength=70", "1", gettext("Insert the email to send the report"), - "" , "", "", "", "", "" , "NO-NULL", ""); + "" , "", "", "", "", "" , "NO", ""); $HD_Form -> AddEditElement (gettext("CALL PLAN"), "dialplan", @@ -204,7 +215,7 @@ $HD_Form -> AddEditElement (gettext("CALL PLAN"), "cc_tariffgroup union select '--ANY--',0", "tariffgroupname, id", "", "", "%1", "", ""); - + $HD_Form -> AddEditElement (gettext("OPERATE MODE"), "operate_mode", '$value', @@ -213,7 +224,7 @@ $HD_Form -> AddEditElement (gettext("OPERATE MODE"), "", "", "list" , "", "", "", $operatemode_list, "%1", "", gettext("If you want to charge only part of sum in case if current balance less then amount, select second option. Will be charged only part of amount, cause balance to be 0.0")); - + $HD_Form -> AddEditElement (gettext("SKIP GROUP"), "use_group", '$value', @@ -229,21 +240,21 @@ $resmax = $DBHandle_max -> Execute("SELECT * FROM cc_card_group"); if ( $resmax ) $numrow = $resmax -> RecordCount( ); -if ($numrow > 0) { +if ($numrow > 0) { $HD_Form -> AddEditElement (gettext("CARD GROUP"), - "service", - '$value', - "SELECT", + "service", + '$value', + "SELECT", 'size="10" multiple="multiple"', - "", - "", - "sql", - "cards_services", - "name, id", + "", + "", + "sql", + "cards_services", + "name, id", "", "", "%1 : (%2)", "", "", "cc_cardgroup_service:id_card_group:cc_card_group LEFT JOIN cc_cardgroup_service ON cc_card_group.id=cc_cardgroup_service.id_card_group:DISTINCT cc_card_group.name, cc_card_group.id: cc_cardgroup_service.id_service = %id:id_service:%2 - (%1)::::%1:id='%1'"); } -$HD_Form->FieldEditElement('name, amount, rule, daynumber, period, stopmode, maxnumbercycle, status, emailreport, dialplan, operate_mode, use_group'); +$HD_Form->FieldEditElement('name, amount, rule, daynumber, period, stopmode, maxnumbercycle, condition5x, status, emailreport, dialplan, operate_mode, use_group'); if (DB_TYPE == "mysql") { $HD_Form->FG_QUERY_ADITION_HIDDEN_FIELDS = "datecreate "; @@ -260,7 +271,7 @@ $HD_Form->FG_TEXT_ADITION_CONFIRMATION = gettext("Your new") . " " . $HD_Form->F $HD_Form->FG_BUTTON_EDITION_SRC = $HD_Form->FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form->FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form->FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form->FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF'] . "?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form->FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF'] . "?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form->FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF'] . "?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form->FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form->FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form->FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_service_details.inc b/admin/Public/form_data/FG_var_service_details.inc old mode 100644 new mode 100755 index 21a08479a..d35c8fe51 --- a/admin/Public/form_data/FG_var_service_details.inc +++ b/admin/Public/form_data/FG_var_service_details.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -57,7 +57,7 @@ $HD_Form -> AddViewElement(gettext("TOTALCARDPERFORM"), "totalcardperform", "20% $HD_Form -> FieldViewElement ('name, numberofrun, datelastrun, totalcredit, totalcardperform',0); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -81,6 +81,6 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_signup_agent.inc b/admin/Public/form_data/FG_var_signup_agent.inc index 86fd2002a..015660cb9 100644 --- a/admin/Public/form_data/FG_var_signup_agent.inc +++ b/admin/Public/form_data/FG_var_signup_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -59,13 +59,13 @@ $HD_Form -> FieldViewElement ('code, id_agent, id_tariffgroup ,id_group'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; $HD_Form -> FG_OTHER_BUTTON1 = true; $HD_Form -> FG_OTHER_BUTTON1_ALT = 'URL'; $HD_Form -> FG_OTHER_BUTTON1_IMG = Images_Path ."/link.png"; -$HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sexyBOX('".$A2B->config['signup']['urlcustomerinterface']."signup.php?key=|col0|',400);"; +$HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:elegantBOX('".$A2B->config['signup']['urlcustomerinterface']."signup.php?key=|col0|',400);"; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']; \ No newline at end of file +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL); \ No newline at end of file diff --git a/admin/Public/form_data/FG_var_speeddial.inc b/admin/Public/form_data/FG_var_speeddial.inc old mode 100644 new mode 100755 index 433d2508a..40c96b320 --- a/admin/Public/form_data/FG_var_speeddial.inc +++ b/admin/Public/form_data/FG_var_speeddial.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -66,7 +66,7 @@ $HD_Form -> AddViewElement(gettext("DATE"), "cc_speeddial.creationdate", "20%", $HD_Form -> FieldViewElement ('cc_speeddial.speeddial, cc_speeddial.phone, cc_speeddial.name, cc_speeddial.id_cc_card, cc_speeddial.creationdate'); -$HD_Form -> CV_NO_FIELDS = gettext("NO SPEED DIALS HAVE BEEN CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("NO SPEED DIALS HAVE BEEN CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -77,43 +77,43 @@ $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; $HD_Form -> AddEditElement (gettext("SPEED DIAL"), - "speeddial", - "", - "SELECT", - "", - "", - "", + "speeddial", + "", + "SELECT", + "", + "", + "", "list" , "", "", "", $speeddial_list, "%1", "", "" ); $HD_Form -> AddEditElement (gettext("NAME"), - "name", - '$value', - "INPUT", - "size=40 maxlength=50", - "0", + "name", + '$value', + "INPUT", + "size=40 maxlength=50", + "0", gettext("Insert the name"), "" , "", "", "", "", "", "", gettext("Enter the name or label that will identify this speed dial") ); $HD_Form -> AddEditElement (gettext("PHONE"), - "phone", - '$value', - "INPUT", - "size=30 maxlength=50", - "4", + "phone", + '$value', + "INPUT", + "size=30 maxlength=50", + "4", gettext("Insert the phone"), "" , "", "", "", "", "", "", gettext("Enter the phone number for the speed dial.") ); $HD_Form -> AddEditElement (gettext("ID CARD"), - "id_cc_card", - "$value", - "POPUPVALUE", - "size=30 maxlength=50", - "4", + "id_cc_card", + "$value", + "POPUPVALUE", + "size=30 maxlength=50", + "4", gettext("Insert the Id CardNumber"), - "" , "", "", "", "", + "" , "", "", "", "", "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=330,top=20,left=100,scrollbars=1'" , gettext("Define the card number ID to use.")); @@ -144,7 +144,7 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click Confirm Data."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_statuslog.inc b/admin/Public/form_data/FG_var_statuslog.inc old mode 100644 new mode 100755 diff --git a/admin/Public/form_data/FG_var_subscriber.inc b/admin/Public/form_data/FG_var_subscriber.inc old mode 100644 new mode 100755 index 40b35df7f..b600bac83 --- a/admin/Public/form_data/FG_var_subscriber.inc +++ b/admin/Public/form_data/FG_var_subscriber.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -58,7 +58,7 @@ $HD_Form -> FG_ACTION_SIZE_COLUMN = '15%'; // added a parameter to append FG_TABLE_ID ( by default ) or disable 0. $HD_Form -> FieldViewElement ('id_cc_card, id_subscription_fee, startdate, stopdate, product_name'); -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." MADE!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO ".strtoupper($HD_Form->FG_INSTANCE_NAME)." MADE!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -90,7 +90,7 @@ $HD_Form -> AddEditElement (gettext("ACCOUNT ID"), "A2B_entity_card.php?popup_select=1&" , ", 'CardNumberSelection','width=550,height=350,top=20,left=100,scrollbars=1'" , gettext("Set the Customer ID.")); - + $HD_Form -> AddEditElement (gettext("ID SUBSCRIPTION SERVICE"), "id_subscription_fee", "", @@ -109,7 +109,7 @@ $HD_Form -> AddEditElement (gettext("START DATE"), "10", gettext("Insert the start date"), "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); - + $HD_Form -> AddEditElement (gettext("STOP DATE"), "stopdate", '$value', @@ -118,13 +118,13 @@ $HD_Form -> AddEditElement (gettext("STOP DATE"), "10", gettext("Insert the stop date"), "" , "", "", "", "", "", "NO-NULL", gettext("please use the format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), "", "res_display_dateformat"); - + $HD_Form -> AddEditElement (gettext("PRODUCT LABEL"), - "product_name", - '', - "TEXTAREA", - "cols=50 rows=4", - "", + "product_name", + '', + "TEXTAREA", + "cols=50 rows=4", + "", gettext("Enter the name of the product wich is subscribed"), "" , "", "", "", "" , "", "", ""); @@ -143,8 +143,8 @@ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Once you have completed the form above, click on Confirm Data"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_subscription.inc b/admin/Public/form_data/FG_var_subscription.inc old mode 100644 new mode 100755 index 80c5df113..a43a1db44 --- a/admin/Public/form_data/FG_var_subscription.inc +++ b/admin/Public/form_data/FG_var_subscription.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -74,7 +74,7 @@ $HD_Form -> AddViewElement(gettext("TOTAL CREDIT"), "totalcredit", "10%", "cente $HD_Form -> FieldViewElement ('label, fee, status,startdate,stopdate, numberofrun, datelastrun, totalcardperform, totalcredit'); -$HD_Form -> CV_NO_FIELDS = gettext("There are no subscriptions created!"); +$HD_Form -> CV_NO_FIELDS = gettext("There are no subscriptions created!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -178,8 +178,8 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_subscription_signup.inc b/admin/Public/form_data/FG_var_subscription_signup.inc index c04ff3e8f..9815ad76b 100755 --- a/admin/Public/form_data/FG_var_subscription_signup.inc +++ b/admin/Public/form_data/FG_var_subscription_signup.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -73,14 +73,14 @@ $HD_Form -> FG_ADDITION = true; $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; -$HD_Form -> AddEditElement ( gettext("LABEL"), - "label", '$value', +$HD_Form -> AddEditElement ( gettext("LABEL"), + "label", '$value', "INPUT", "size=30 maxlength=40", "0", - gettext("Insert the provider name"), + gettext("Insert the provider name"), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("ACTIVATED"), "enable", '1', @@ -90,7 +90,7 @@ $HD_Form -> AddEditElement (gettext("ACTIVATED"), gettext("Choose if you want to activate this subscriber in the signup"), "" , "", "", "Yes :1, - No:0", "", "", "" , "" ); -$CURRENCY = strtoupper(BASE_CURRENCY); +$CURRENCY = strtoupper(BASE_CURRENCY); $HD_Form -> AddEditElement (gettext("SUBSCRIPTION OPTIONS"), "id_subscription", "", @@ -142,7 +142,7 @@ $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_support.inc b/admin/Public/form_data/FG_var_support.inc index ce8d2af36..82961b387 100755 --- a/admin/Public/form_data/FG_var_support.inc +++ b/admin/Public/form_data/FG_var_support.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -124,9 +124,9 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_support_component.inc b/admin/Public/form_data/FG_var_support_component.inc index 0bafed20c..30c2bc8b9 100755 --- a/admin/Public/form_data/FG_var_support_component.inc +++ b/admin/Public/form_data/FG_var_support_component.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -135,8 +135,8 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_tariffgroup.inc b/admin/Public/form_data/FG_var_tariffgroup.inc old mode 100644 new mode 100755 index ce5af452f..1af321f47 --- a/admin/Public/form_data/FG_var_tariffgroup.inc +++ b/admin/Public/form_data/FG_var_tariffgroup.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -81,7 +81,7 @@ if (!$popup_select) { } -$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); +$HD_Form -> CV_NO_FIELDS = gettext("THERE IS NO")." ".strtoupper($HD_Form->FG_INSTANCE_NAME)." ".gettext("CREATED!"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; @@ -108,21 +108,21 @@ if ($popup_select) { $HD_Form -> AddEditElement (gettext("NAME"), - "tariffgroupname", - '$value', - "INPUT", - "size=30 maxlength=20", - "9", + "tariffgroupname", + '$value', + "INPUT", + "size=30 maxlength=20", + "9", gettext("Insert the Call Plan name "), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("LC TYPE"), - "lcrtype", - '$value', - "SELECT", - "", - "", + "lcrtype", + '$value', + "SELECT", + "", + "", "", "list" , "", "", "", $lcrtype_list, "%1", "", ""); @@ -139,35 +139,35 @@ $HD_Form -> AddEditElement(gettext("PACKAGE"), $HD_Form -> AddEditElement (gettext("REMOVE INTER PREFIX"), - "removeinterprefix", + "removeinterprefix", '0', "RADIOBUTTON", - "", - "", + "", + "", gettext("Define if the international prefix will be removed to check the rate."), "" , "", "" , "Yes :1, - No:0", "", "", "", gettext("Remove the international access prefix (00 or 011) before matching the dialled digits with the rate card. E.G. If the dialled digits were 0044 for a call to the UK, only 44 would be delivered.")); - + $DBHandle_max = DbConnect(); $numrow = 0; $resmax = $DBHandle_max -> Execute("SELECT * FROM cc_tariffplan"); if ( $resmax ) $numrow = $resmax -> RecordCount( ); -if ($numrow>0){ +if ($numrow>0){ $HD_Form -> AddEditElement (gettext("RATECARD"), - "tariffplan", - '$value', - "SELECT", + "tariffplan", + '$value', + "SELECT", 'size="10" multiple="multiple"', - "", - "", - "sql", - "cc_tariffgroup_plan", - "label, id", - "", "", "%1 : (%2)", "", "", "cc_tariffgroup_plan:idtariffplan:cc_tariffplan LEFT JOIN cc_tariffgroup_plan ON cc_tariffplan.id=cc_tariffgroup_plan.idtariffplan:DISTINCT cc_tariffplan.tariffname, cc_tariffplan.id: cc_tariffgroup_plan.idtariffgroup = %id:idtariffgroup:%2 - (%1)::::%1:id='%1'"); - + "", + "", + "sql", + "cc_tariffgroup_plan", + "label, id", + "", "", "%1 : (%2)", "", "", "cc_tariffgroup_plan:idtariffplan:cc_tariffplan LEFT JOIN cc_tariffgroup_plan ON cc_tariffplan.id=cc_tariffgroup_plan.idtariffplan:DISTINCT cc_tariffplan.tariffname, cc_tariffplan.id: cc_tariffgroup_plan.idtariffgroup = %id:idtariffgroup:%2 - (%1)::::%1:id='%1'"); + } @@ -186,9 +186,9 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_tariffplan.inc b/admin/Public/form_data/FG_var_tariffplan.inc index 3315fd809..b5b940260 100644 --- a/admin/Public/form_data/FG_var_tariffplan.inc +++ b/admin/Public/form_data/FG_var_tariffplan.inc @@ -56,6 +56,7 @@ $HD_Form -> FG_FK_TABLENAMES = array("cc_ratecard"); $HD_Form -> FG_FK_EDITION_CLAUSE = array(" idtariffplan "); $HD_Form -> FG_FK_DELETE_MESSAGE = gettext("You are going as well to remove all the rates attached to this ratecard! Please comfirm that you really want to remove this ratecard and those rates ? "); +$trunk_algo_list = Constants::getTrunkAlgo_List(); $HD_Form -> AddViewElement(gettext("ID"), "id", "4%", "center", "sort"); $HD_Form -> AddViewElement(gettext("TARIFFNAME"), "tariffname", "18%", "center", "sort"); @@ -95,6 +96,7 @@ if ($form_action=="ask-add"){ $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; + $def_value_trunkalgo = "value='0'"; } $HD_Form -> AddEditElement (gettext("START DATE"), @@ -160,6 +162,45 @@ $HD_Form -> AddEditElement (gettext("CALLERID PREFIX"), $HD_Form -> FieldEditElement ('tariffname, startingdate, expirationdate, id_trunk, description, dnidprefix, calleridprefix'); +$HD_Form -> AddEditElement (gettext("TRUNK SELECT ALGO"), + "trunk_algo", + '$value', + "SELECT", + "$def_value_trunkalgo", + "", + "", + "list" , "", "", "", $trunk_algo_list, "%1", "", gettext("Trunk selection algorithm. Use default for the standard functionality.")); + +$HD_Form -> AddEditElement (gettext("ALGO BREAK CODE(S)"), + "algo_break_hc", + "$value", + "INPUT", + "size=100 maxlength=1024", + "", + "", + "", "", "", "", "", "", "", gettext("Use this setting to recognize a hangup cause and break algo if code matches. This field should contain a comma separated list of HANGUPCAUSE codes or be empty to do nothing")); + +$DBHandle_max = DbConnect(); +$numrow = 0; +$resmax = $DBHandle_max -> Execute("SELECT * FROM cc_trunk"); +if ( $resmax ) + $numrow = $resmax -> RecordCount( ); + +if ($numrow>0){ + $HD_Form -> AddEditElement (gettext("TRUNKS"), + "trunk", + '$value', + "SELECT", + 'size="10" multiple="multiple"', + "", + "", + "sql", + "cc_tariffplan_trunk", + "label, id", + "", "", "%1 : (%2)", "", "", "cc_tariffplan_trunk:idtrunk:cc_trunk LEFT JOIN cc_tariffplan_trunk ON cc_trunk.id_trunk=cc_tariffplan_trunk.idtrunk:DISTINCT cc_trunk.trunkcode, cc_trunk.id_trunk: cc_tariffplan_trunk.idtariffplan = %id:idtariffplan:%2 - (%1)::::%1:id='%1'"); +} + +$HD_Form -> FieldEditElement ('tariffname, startingdate, expirationdate, id_trunk, description, dnidprefix, calleridprefix, trunk_algo, algo_break_hc'); $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("Modify the properties of the rate card."); @@ -172,8 +213,8 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ". $HD_Form->FG $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create the new")." ".$HD_Form->FG_INSTANCE_NAME; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_ticket.inc b/admin/Public/form_data/FG_var_ticket.inc index 90d0bb3b8..8fec5b1c2 100755 --- a/admin/Public/form_data/FG_var_ticket.inc +++ b/admin/Public/form_data/FG_var_ticket.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -144,7 +144,7 @@ $HD_Form -> AddEditElement (gettext("TITLE"), "9", gettext("Insert the Title of ticket "), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("COMPONENT"), "id_component", "", @@ -200,8 +200,8 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_ticket_agent.inc b/admin/Public/form_data/FG_var_ticket_agent.inc index f9dd9e0ea..29e58209b 100755 --- a/admin/Public/form_data/FG_var_ticket_agent.inc +++ b/admin/Public/form_data/FG_var_ticket_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -121,7 +121,7 @@ $HD_Form -> AddEditElement (gettext("TITLE"), "9", gettext("Insert the Title of ticket "), "" , "", "", "", "", "", "", "" ); - + $HD_Form -> AddEditElement (gettext("COMPONENT"), "id_component", "", @@ -177,8 +177,8 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_transactions.inc b/admin/Public/form_data/FG_var_transactions.inc old mode 100644 new mode 100755 index d4aa712ec..23fd4fe32 --- a/admin/Public/form_data/FG_var_transactions.inc +++ b/admin/Public/form_data/FG_var_transactions.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -84,7 +84,7 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)){ $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_transactions_agent.inc b/admin/Public/form_data/FG_var_transactions_agent.inc old mode 100644 new mode 100755 index 91c050a67..f6b302625 --- a/admin/Public/form_data/FG_var_transactions_agent.inc +++ b/admin/Public/form_data/FG_var_transactions_agent.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -80,7 +80,7 @@ if (isset($filterprefix) && (strlen($filterprefix)>0)){ $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_trunk.inc b/admin/Public/form_data/FG_var_trunk.inc index 42c59b5b6..769f11094 100644 --- a/admin/Public/form_data/FG_var_trunk.inc +++ b/admin/Public/form_data/FG_var_trunk.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,13 +27,11 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ - - -getpost_ifset(array('id', 'trunkcode', 'trunkprefix', 'removeprefix', 'providertech', 'providerip', 'addparameter','failover_trunk', 'id_provider', 'popup_select', 'inuse', 'maxuse', 'status', 'if_max_use')); +getpost_ifset(array('id', 'trunkcode', 'trunkprefix', 'removeprefix', 'providertech', 'providerip', 'addparameter','failover_trunk', 'id_provider', 'popup_select', 'inuse', 'maxuse', 'status', 'if_max_use', 'minutes_per_day', 'attempt_condition', 'attempt_statuses', 'attempt_count, attempt_statuses, priority, attempt_delay, calls_per_day', 'trunk_GMT')); $DBHandle = DbConnect(); $instance_table = new Table(); @@ -77,6 +75,13 @@ $maxuse_behaviour_list = array(); $maxuse_behaviour_list["0"] = array( gettext("Use failover trunk"), "0"); $maxuse_behaviour_list["1"] = array( gettext("Use next trunk"), "1"); +$attempt_cond_list = array(); +$attempt_cond_list["0"] = array( gettext("Dialstatus in the list"), "0"); +$attempt_cond_list["1"] = array( gettext("Dialstatus not in the list"), "1"); + +$timezone_list = constants::getTimezones_List(); +$timezone_list['0'] = array(gettext("Not set"), '0'); + // Dependent Tables $HD_Form -> FG_FK_DELETE_ALLOWED = true; $HD_Form -> FG_FK_DELETE_CONFIRM = true; @@ -91,20 +96,29 @@ if ($popup_select) { $HD_Form -> AddViewElement(gettext("ID"), "id_trunk", "7%", "center", "sort"); $HD_Form -> AddViewElement(gettext("LABEL"), "trunkcode", "15%", "center", "sort"); $HD_Form -> AddViewElement(gettext("PROVIDER"), "id_provider" ,"10%", "center", "sort", "15", "lie", "cc_provider", "provider_name", "id='%id'", "%1"); + $HD_Form -> AddViewElement(gettext("TOLL FREE"), "tollfree", "5%", "center", "sort", "", "list", Constants::getYesNoList()); - $HD_Form -> FieldViewElement ('id_trunk, trunkcode, id_provider'); + $HD_Form -> FieldViewElement ('id_trunk, trunkcode, id_provider, tollfree'); } else { $HD_Form -> AddViewElement(gettext("LABEL"), "trunkcode", "14%", "center", "sort"); $HD_Form -> AddViewElement(gettext("ADD_PREFIX"), "trunkprefix", "6%", "center", "sort"); - $HD_Form -> AddViewElement(gettext("REMOVE_PREFIX"), "removeprefix", "6%", "center", "sort"); + $HD_Form -> AddViewElement(gettext("REMOVE_PREFIX"), "removeprefix", "2%", "center", "sort"); $HD_Form -> AddViewElement(gettext("TECH"), "providertech", "6%", "center", "sort"); $HD_Form -> AddViewElement(gettext("IP/HOST"), "providerip" , "14%", "center", "sort"); $HD_Form -> AddViewElement(gettext("PROVIDER"), "id_provider" ,"9%", "center", "sort", "15", "lie", "cc_provider", "provider_name", "id='%id'", "%1"); $HD_Form -> AddViewElement(gettext("MINUTES USED"), "secondusedreal", "%9", "center", "SORT", "30", "", "", "", "", "", "display_minute"); $HD_Form -> AddViewElement(gettext("STATUS"), "status", "7%", "center", "sort", "", "list", $actived_list); $HD_Form -> AddViewElement(gettext("MAXUSE"), "maxuse" , "5%", "center", "sort"); - - $HD_Form -> FieldViewElement ('trunkcode, trunkprefix, removeprefix, providertech, providerip, id_provider, secondusedreal, status, maxuse'); + $HD_Form -> AddViewElement(gettext("Minutes/day"), "minutes_per_day" , "5%", "center", "sort"); + $HD_Form -> AddViewElement(gettext("Minutes/day used"), "id_trunk" , "5%", "center", "", "", "", "", "", "", "", "display_minute_used"); + $HD_Form -> AddViewElement(gettext("Whole Minutes/day used"), "id_trunk" , "5%", "center", "", "", "", "", "", "", "", "display_wholeminute_used"); + $HD_Form -> AddViewElement(gettext("Priority"), "priority" , "5%", "center", "sort"); + $HD_Form -> AddViewElement(gettext("Calls/day"), "calls_per_day" , "5%", "center", "sort"); + $HD_Form -> AddViewElement(gettext("Calls/day used"), "id_trunk" , "5%", "center", "", "", "", "", "", "", "", "display_calls_used"); + $HD_Form -> AddViewElement(gettext("TIMEZONE"), "trunk_GMT", "1%", "center", "SORT", "30", "", "", "", "", "", "display_timezone"); + $HD_Form -> AddViewElement(gettext("TOLL FREE"), "tollfree", "1%", "center", "sort", "", "list", Constants::getYesNoList()); + + $HD_Form -> FieldViewElement ('trunkcode, trunkprefix, removeprefix, providertech, providerip, id_provider, secondusedreal, status, maxuse, minutes_per_day, id_trunk, id_trunk, priority, calls_per_day, id_trunk, trunk_GMT, tollfree'); } $HD_Form -> FG_FILTER_SEARCH_FORM = true; @@ -140,11 +154,25 @@ if ($popup_select) { $HD_Form -> FG_ADDITION = true; } +$counters = getTrunkCounters($id); $def_value_inuse = ''; $def_value_maxuse = ''; -if (isset($form_action) && $form_action=="ask-add"){ - $def_value_inuse = "value='0'"; - $def_value_maxuse = "value='-1'"; +$def_value_minutes = ''; +$def_value_attempts = ''; +$def_value_statuses = ''; +$def_value_priority = ''; +$def_value_attempt_delay = ''; +$def_value_calls = ''; +if (isset($form_action) && $form_action=="ask-add") { + $counters = null; + $def_value_inuse = "value='0'"; + $def_value_maxuse = "value='-1'"; + $def_value_minutes = "value='0'"; + $def_value_attempts = "value='0'"; + $def_value_statuses = "value=''"; + $def_value_priority = "value='0'"; + $def_value_attempt_delay = "value='0'"; + $def_value_calls = "value='0'"; } $HD_Form -> AddEditElement (gettext("VOIP-PROVIDER"), @@ -156,7 +184,7 @@ $HD_Form -> AddEditElement (gettext("VOIP-PROVIDER"), "cc_provider", "provider_name, id", "", "", "%1","", "", '', ''); - + $HD_Form -> AddEditElement (gettext("LABEL"), "trunkcode", "$value", @@ -174,16 +202,16 @@ $HD_Form -> AddEditElement (gettext("ADD PREFIX"), "", gettext("Insert the trunkprefix"), "" , "", "", "", "" , "" , "", gettext("Add a prefix to the dialled digits.")); - + $HD_Form -> AddEditElement (gettext("REMOVE PREFIX"), "removeprefix", "$value", "INPUT", - "size=30 maxlength=20", + "size=120", "", gettext("Insert the removeprefix"), - "" , "", "", "", "" , "" , "", gettext("Remove prefix from the dialed digits.")); - + "" , "", "", "", "" , "" , "", gettext("Remove prefix from the dialed digits.") . " " . gettext("Supported format: SEARCH_PLAIN[{,}/SEARCH_REGEX/[{-}REPLACEMENT][{-}STOP_FLAG]{,}/SEARCH_REGEX/{,}SEARCH_PLAIN{-}REPLACEMENT{,}etc...] Separators are: {,} - between rules , {-} - between SEARCH and REPLACEMENT rules and STOP sign (if 3rd parameter greater than 0 - than rule process will be stoped if current rule was applied; if / found in the rule - it is being recognized as REGEX; default for REPLACEMENT is empty string; default for STOP_FLAG is zero).")); + $HD_Form -> AddEditElement (gettext("PROVIDER TECH"), "providertech", "$value", @@ -192,7 +220,7 @@ $HD_Form -> AddEditElement (gettext("PROVIDER TECH"), "0", gettext("Insert the providertech"), "" , "", "", "", "" , "" , "", gettext("Technology used on the trunk (SIP,IAX2,ZAP,H323)")); - + $HD_Form -> AddEditElement (gettext("PROVIDER IP"), "providerip", "$value", @@ -210,7 +238,7 @@ $HD_Form -> AddEditElement (gettext("ADDITIONAL PARAMETER"), "", gettext("Insert Additional parameters"), "" , "", "", "", "" , "" , "", gettext("Define any additional parameters that will be used when running the Dial Command in Asterisk. Use the following tags as variables %dialingnumber%, %cardnumber%. ie 'D(ww%cardnumber%wwwwwwwwww%dialingnumber%)'")); - + $HD_Form -> AddEditElement (gettext("FAILOVER TRUNK"), "failover_trunk", '$value', @@ -239,7 +267,7 @@ $HD_Form -> AddEditElement (gettext("MAXIMUM CONNECTIONS"), gettext("Number of maximum simultaneous connections"), "" , "", "", "", "", "", "", gettext("The maximum number of channels available to this trunk. Set to -1 to have an unlimited number of channels") ); -$HD_Form -> AddEditElement ("IFMAXUSED", +$HD_Form -> AddEditElement (gettext("IFMAXUSED"), "if_max_use", '$value', "SELECT", @@ -247,8 +275,8 @@ $HD_Form -> AddEditElement ("IFMAXUSED", "", "", "list" , "", "", "", $maxuse_behaviour_list, "%1" , "", gettext("Specifies which trunk to use when the maximum number of connections is reached")); - -$HD_Form -> AddEditElement ("STATUS", + +$HD_Form -> AddEditElement (gettext("STATUS"), "status", '$value', "SELECT", @@ -257,9 +285,88 @@ $HD_Form -> AddEditElement ("STATUS", "", "list" , "", "", "", $actived_list, "%1" , "", gettext("Define if this trunk is active or not")); +$HD_Form -> AddEditElement (gettext("Minutes/day"), + "minutes_per_day", + "", + "INPUT", + "size=9 $def_value_minutes maxlength=30", + "12", + "", + "" , "", "", "", "", "", "", gettext("Number of maximum minutes to the gateway per day, to disable - set to 0 (zero)") . (is_array($counters) ? ". " . sprintf(gettext("Minutes today: %s"), sprintf("%02d", intval($counters['seconds'] / 60)) . ":" . sprintf("%02d", intval($counters['seconds'] % 60))) . sprintf(", Whole minutes today: %ld", $counters['minutes']) . '' : '')); + +$HD_Form -> AddEditElement (gettext("Attempts"), + "attempt_count", + "", + "INPUT", + "size=9 $def_value_attempts maxlength=30", + "12", + "", + "" , "", "", "", "", "", "", gettext("Additional attempts according attempt condition, to disable - set to 0 (zero)")); + +$HD_Form -> AddEditElement (gettext("Attempt condition"), + "attempt_condition", + '$value', + "SELECT", + "", + "", + "", + "list" , "", "", "", $attempt_cond_list, "%1" , "", gettext("Condition for checking the dialstatus in list")); + +$HD_Form -> AddEditElement (gettext("Attempt dial status(es) list"), + "attempt_statuses", + "$value", + "INPUT", + "size=100 $def_value_statuses maxlength=255", + "", + "", + "" , "", "", "", "", "", "", gettext("The list of dialstatuses (comma (,) as separator). Use any of: ANSWER,BUSY,NOANSWER,CONGESTION,CHANUNAVAIL,DONTCALL,TORTURE,INVALIDARGS,CANCEL. If empty - does nothing...")); -$HD_Form -> FieldEditElement ('id_provider, trunkcode, trunkprefix, removeprefix, providertech, providerip, addparameter, failover_trunk, inuse, maxuse, if_max_use, status'); +$HD_Form -> AddEditElement (gettext("Priority"), + "priority", + "", + "INPUT", + "size=9 $def_value_priority maxlength=30", + "12", + "", + "" , "", "", "", "", "", "", gettext("Trunk select priority for tariffplan algorithm")); + +$HD_Form -> AddEditElement (gettext("Attempt delay"), + "attempt_delay", + "", + "INPUT", + "size=9 $def_value_attempt_delay maxlength=30", + "12", + "", + "" , "", "", "", "", "", "", gettext("Delay between calls to the trunk in seconds, to disable - set to 0 (zero)")); + +$HD_Form -> AddEditElement (gettext("Calls/day"), + "calls_per_day", + "", + "INPUT", + "size=9 $def_value_calls maxlength=30", + "12", + "", + "" , "", "", "", "", "", "", gettext("Number of maximum success calls to the gateway per day, to disable - set to 0 (zero)") . (is_array($counters) ? ". " . sprintf(gettext("Calls today: %s"), $counters['success_calls']) . '' : '')); + +$HD_Form -> AddEditElement (gettext("Timezone"), + "trunk_GMT", + '$value', + "SELECT", + "", + "", + "", + "list" , "", "", "", $timezone_list, "%1" , "", gettext("Trunk timezone")); + +$HD_Form -> AddEditElement (gettext("TOLL FREE"), + "tollfree", + '0', + "RADIOBUTTON", + "", + "", + gettext("Choose if this provider is toll free"), + "" , "", "", "Yes:1, - No:0", "", "" , "", gettext("Define if you want to apply toll free logic")); +$HD_Form -> FieldEditElement ('id_provider, trunkcode, trunkprefix, removeprefix, providertech, providerip, addparameter, failover_trunk, inuse, maxuse, if_max_use, status, minutes_per_day, attempt_count, attempt_condition, attempt_statuses, priority, attempt_delay, calls_per_day, trunk_GMT, tollfree'); $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("Modify the properties of the trunk below."); $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); @@ -271,8 +378,8 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_ $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = 'Fill correctly the fields to add a new '.$HD_Form->FG_INSTANCE_NAME; -//$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +//$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/form_data/FG_var_user.inc b/admin/Public/form_data/FG_var_user.inc old mode 100644 new mode 100755 index a14d6f940..99855627b --- a/admin/Public/form_data/FG_var_user.inc +++ b/admin/Public/form_data/FG_var_user.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -66,7 +66,7 @@ $HD_Form ->FG_LIST_ADDING_BUTTON_IMG1 = $ADDING_BUTTON_IMG1; if (is_numeric($groupID)) { $FG_TABLE_CLAUSE = "groupid='$groupID'"; -} +} //else select all $HD_Form -> FG_TABLE_CLAUSE = $FG_TABLE_CLAUSE; @@ -114,7 +114,7 @@ $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; if (!$popup_select) { - $HD_Form -> FG_ADDITION = true; + $HD_Form -> FG_ADDITION = true; $HD_Form -> FG_INFO = true; $HD_Form -> FG_INFO_LINK = "A2B_admin_info.php?groupID=$groupID&id="; } @@ -122,7 +122,7 @@ if (!$popup_select) { if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { $HD_Form -> FG_DELETION = true; $HD_Form -> FG_EDITION = true; - + if ($form_action!="ask-add" && $form_action!="add") { $HD_Form -> AddEditElement (gettext("USERID"), "userid", @@ -133,7 +133,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { gettext("Insert the userid"), "" , "", "", "", "", "", "", "" ); } - + $HD_Form -> AddEditElement (gettext("LOGIN"), "login", '$value', @@ -142,16 +142,16 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "3", gettext("Insert the username"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("PASSWORD"), "pwd_encoded", '$value', "INPUT", - "type=password size=30 maxlength=15", + "type=password size=30 maxlength=30", "3", gettext("Insert the Reseller password"), "" , "", "", "", "", "", "", ""); - + if ($groupID!="0") { $HD_Form -> AddEditElement (gettext("PERMISSION"), "perms", @@ -162,8 +162,8 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "list", "", "description, id", "", $right_list, "%1" , "", gettext("To select several rights in the above ListBox, hold the CTRL key down while clicking the items") ); } - - + + $HD_Form -> AddEditElement (gettext("NAME"), "name", '$value', @@ -172,7 +172,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the name"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("ADDRESS"), "direction", '$value', @@ -189,7 +189,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the country"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("ZIPCODE"), "zipcode", '$value', @@ -198,7 +198,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the zip code"), "" , "", "", "", "", "", "", ""); - + $HD_Form -> AddEditElement (gettext("STATE"), "state", '$value', @@ -215,7 +215,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the country"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("PHONE"), "phone", '$value', @@ -224,7 +224,7 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the telephone number"), "" , "", "", "", "" , "", "", ""); - + $HD_Form -> AddEditElement (gettext("FAX"), "fax", '$value', @@ -241,8 +241,8 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "", gettext("Insert the email"), "" , "", "", "", "" , "", "", ""); - - + + if (($groupID=="2") || ($groupID=="3")) { if ($groupID=="2") { $HD_Form -> AddEditElement ("UserID", @@ -266,36 +266,36 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { "groupID='1'", "", "%2 (%1)", "", "" ); } } - + if ($form_action!="ask-add" && $form_action!="add") { $FG_QUERY_EDITION='userid, '; } - + $FG_QUERY_EDITION .= 'login, '; - + $FG_QUERY_EDITION .='pwd_encoded, '; - + if ($groupID!="0") { $FG_QUERY_EDITION .= 'perms, '; } - + $FG_QUERY_EDITION .= 'name, direction,city, zipcode, state,country, phone, fax,email'; - + $HD_Form -> FieldEditElement ($FG_QUERY_EDITION); - + $HD_Form -> FG_EDITION_CLAUSE = " userid='%id'"; - + if (is_numeric($groupID)) { $HD_Form -> FG_QUERY_ADITION_HIDDEN_FIELDS .= "groupID"; $HD_Form -> FG_QUERY_ADITION_HIDDEN_VALUE .= "$groupID"; - + $HD_Form -> FG_QUERY_EDITION_HIDDEN_FIELDS = "groupID"; $HD_Form -> FG_QUERY_EDITION_HIDDEN_VALUE = "$groupID"; - + if ($groupID=="0") { $HD_Form -> FG_QUERY_ADITION_HIDDEN_FIELDS .= ", perms"; $HD_Form -> FG_QUERY_ADITION_HIDDEN_VALUE .= ", 5242879"; - + $HD_Form -> FG_QUERY_EDITION_HIDDEN_FIELDS .= ", perms"; $HD_Form -> FG_QUERY_EDITION_HIDDEN_VALUE .= ", 5242879"; } @@ -303,33 +303,33 @@ if (has_rights (ACX_MODIFY_ADMINS) && !($popup_select)) { $HD_Form -> FG_QUERY_ADITION_HIDDEN_FIELDS .= "groupID"; $HD_Form -> FG_QUERY_ADITION_HIDDEN_VALUE .= "1"; } - + if (($popup_select>=1)){ $HD_Form -> FG_OTHER_BUTTON1 = true; $HD_Form -> FG_OTHER_BUTTON1_ALT = '<select>'; $HD_Form -> FG_OTHER_BUTTON1_IMG = ''; - + if ($popup_select==1) { $HD_Form -> FG_OTHER_BUTTON1_LINK = "javascript:sendValue('|param|');"; } } - + $HD_Form -> FG_INTRO_TEXT_EDITION= gettext("Modify the properties of the")." ".$HD_Form->FG_INSTANCE_NAME; $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".
    ".gettext("Fill the following fields and confirm by clicking on the button add."); - - + + $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."
    "; - - + + $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue"); - - - $HD_Form -> FG_GO_LINK_AFTER_ACTION = $_SERVER['PHP_SELF']."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; - $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; + + + $HD_Form -> FG_GO_LINK_AFTER_ACTION = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; + $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=user&groupID=$groupID&stitle=Administrator+management&id="; } diff --git a/admin/Public/form_data/FG_var_voucher.inc b/admin/Public/form_data/FG_var_voucher.inc index 1a22b08fb..8e98e8bab 100644 --- a/admin/Public/form_data/FG_var_voucher.inc +++ b/admin/Public/form_data/FG_var_voucher.inc @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -126,31 +126,31 @@ if ($form_action=="ask-add") { } $HD_Form -> AddEditElement (gettext("VOUCHER"), - "voucher", - "$value", + "voucher", + "$value", "INPUT", - "size=20 $maxi readonly maxlength=40", - "4", + "size=20 $maxi readonly maxlength=40", + "4", gettext("Insert the voucher"), "" , "", "", "", "" , "", "", ""); $HD_Form -> AddEditElement (gettext("AMOUNT"), "credit", - '$value', - "INPUT", - "size=30 maxlength=30", + '$value', + "INPUT", + "size=30 maxlength=30", "12", gettext("Insert the number of credit"), "" , "", "", "", "", "", "", "" ); $HD_Form -> AddEditElement (gettext("TAG"), - "tag", - '$value', + "tag", + '$value', "INPUT", - "size=30 maxlength=30", - "11", + "size=30 maxlength=30", + "11", gettext("Insert the tag"), "" , "", "", "", "", "", "NO-NULL", "" ); @@ -158,8 +158,8 @@ $HD_Form -> AddEditElement (gettext("TAG"), $HD_Form -> AddEditElement (gettext("ACTIVATED"), "activated", 't', - "RADIOBUTTON", - "", + "RADIOBUTTON", + "", "", gettext("Choose if you want to activate this card"), "" , "", "" ,"Yes :t, - No:f", "", "" , "" , ""); @@ -176,7 +176,7 @@ $HD_Form -> AddEditElement (gettext("CURRENCY"), if ($form_action=="ask-add") { $begin_date = date("Y"); - $begin_date_plus = date("Y")+10; + $begin_date_plus = date("Y") + 10; $end_date = date("-m-d H:i:s"); $comp_date = "value='".$begin_date.$end_date."'"; $comp_date_plus = "value='".$begin_date_plus.$end_date."'"; @@ -187,7 +187,7 @@ $HD_Form -> AddEditElement (gettext("EXPIRY DATE"), "expirationdate", '$value', "INPUT", - "size=40 maxlength=40 $comp_date_plus", + "size=40 maxlength=40 $comp_date_plus", "10", gettext("Insert the expiration date"), "" , "", "", "", "", "", "", gettext("Format YYYY-MM-DD HH:MM:SS. For instance, '2004-12-31 00:00:00'"), null, "res_display_dateformat" ); @@ -216,7 +216,7 @@ $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$Form->FG_INS $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path . "/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Click 'Confirm Data' to continue."); -$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; -$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = $_SERVER['PHP_SELF']."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; +$HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; diff --git a/admin/Public/graph_hourdetail.php b/admin/Public/graph_hourdetail.php old mode 100644 new mode 100755 index cbeea0de6..2c20594e0 --- a/admin/Public/graph_hourdetail.php +++ b/admin/Public/graph_hourdetail.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/graph_pie.php b/admin/Public/graph_pie.php old mode 100644 new mode 100755 index f5f9811d7..e21ee7426 --- a/admin/Public/graph_pie.php +++ b/admin/Public/graph_pie.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -88,11 +88,7 @@ $SQLcmd = ''; -if (isset ($dst) && ($dst > 0)) { - if (strlen($SQLcmd) > 0) - $SQLcmd .= " AND "; - $SQLcmd .= " calledstation='$dst' "; -} +$SQLcmd = do_field ( $SQLcmd, 'dst', 'calledstation' ); if (isset ($customer) && ($customer > 0)) { if (strlen($SQLcmd) > 0) @@ -207,14 +203,16 @@ $at_least_one_data = true; } -if (!$at_least_one_data) + +if (!$at_least_one_data) { $data[0] = 1; +} /**************************************/ $data = array_reverse($data); -$graph = new PieGraph(475, 200, "auto"); +$graph = new PieGraph(800, 300, "auto"); $graph->SetShadow(); $graph->title->Set($title_graph); @@ -222,7 +220,8 @@ $p1 = new PiePlot3D($data); $p1->ExplodeSlice(2); -$p1->SetCenter(0.35); +// $p1->SetCenter(0.35); +$p1->SetCenter(0.4, 0.4); //print_r($gDateLocale->GetShortMonth()); //Array ( [0] => Jan [1] => Feb [2] => Mar [3] => Apr [4] => May [5] => Jun [6] => Jul [7] => Aug [8] => Sep [9] => Oct [10] => Nov [11] => Dec ) //$p1->SetLegends($gDateLocale->GetShortMonth()); diff --git a/admin/Public/graph_stat.php b/admin/Public/graph_stat.php old mode 100644 new mode 100755 index 52cc30399..8f9e113dc --- a/admin/Public/graph_stat.php +++ b/admin/Public/graph_stat.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/graph_statbar.php b/admin/Public/graph_statbar.php old mode 100644 new mode 100755 index 8026b1207..c7cf4c249 --- a/admin/Public/graph_statbar.php +++ b/admin/Public/graph_statbar.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/importsamples.php b/admin/Public/importsamples.php old mode 100644 new mode 100755 index c6d298115..a545aaf55 --- a/admin/Public/importsamples.php +++ b/admin/Public/importsamples.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/index.php b/admin/Public/index.php old mode 100644 new mode 100755 index 3ff1aff27..97281f9e8 --- a/admin/Public/index.php +++ b/admin/Public/index.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/logout.php b/admin/Public/logout.php old mode 100644 new mode 100755 index 806ed073b..39f0bab5b --- a/admin/Public/logout.php +++ b/admin/Public/logout.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/calls_counts.php b/admin/Public/modules/calls_counts.php old mode 100644 new mode 100755 index fbf8d3785..d4e4af95d --- a/admin/Public/modules/calls_counts.php +++ b/admin/Public/modules/calls_counts.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/calls_lastmonth.php b/admin/Public/modules/calls_lastmonth.php old mode 100644 new mode 100755 index 5a5103c92..de65fec6d --- a/admin/Public/modules/calls_lastmonth.php +++ b/admin/Public/modules/calls_lastmonth.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/customers_lastmonth.php b/admin/Public/modules/customers_lastmonth.php old mode 100644 new mode 100755 index f3279c8e5..7d6bd25ea --- a/admin/Public/modules/customers_lastmonth.php +++ b/admin/Public/modules/customers_lastmonth.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/customers_numbers.php b/admin/Public/modules/customers_numbers.php old mode 100644 new mode 100755 index 7258a87c0..ab838f5d7 --- a/admin/Public/modules/customers_numbers.php +++ b/admin/Public/modules/customers_numbers.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/news.php b/admin/Public/modules/news.php old mode 100644 new mode 100755 index c7c8a46ab..68183ef4c --- a/admin/Public/modules/news.php +++ b/admin/Public/modules/news.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/payments_lastmonth.php b/admin/Public/modules/payments_lastmonth.php old mode 100644 new mode 100755 index 660f3d1eb..bec3e7c7e --- a/admin/Public/modules/payments_lastmonth.php +++ b/admin/Public/modules/payments_lastmonth.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/refills_lastmonth.php b/admin/Public/modules/refills_lastmonth.php old mode 100644 new mode 100755 index 59ee98454..89578f716 --- a/admin/Public/modules/refills_lastmonth.php +++ b/admin/Public/modules/refills_lastmonth.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/modules/system_info.php b/admin/Public/modules/system_info.php index 611799b4c..bbea5b43e 100755 --- a/admin/Public/modules/system_info.php +++ b/admin/Public/modules/system_info.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/phpconfig.php b/admin/Public/phpconfig.php old mode 100644 new mode 100755 index 0e7c66180..f8fae39b8 --- a/admin/Public/phpconfig.php +++ b/admin/Public/phpconfig.php @@ -5,10 +5,10 @@ /** * This file is part of A2Billing (http://www.a2billing.net/) * - * A2Billing, Commercial Open Source Telecom Billing platform, + * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. - * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -27,8 +27,8 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * - * + * + * **/ @@ -46,7 +46,7 @@ * Rob Birkinshaw */ -// add for a2billing +// add for a2billing include_once ("../lib/admin.defines.php"); include_once ("../lib/admin.module.access.php"); include_once ("../lib/regular_express.inc"); @@ -59,6 +59,9 @@ die(); } +getpost_ifset(array('tryUpdate', 'themd5', 'updateSection', 'section_text')); + + check_demo_mode_intro(); require_once ("phpconfig_init.php"); @@ -126,7 +129,7 @@ // side menu population of file sections foreach ($conf->_OC_the_sections as $record) { - $menuList[$record[0]] = $_SERVER['PHP_SELF'] . "?file=" . $_GET['file'] . "§ion_conf=$record[0]"; + $menuList[$record[0]] = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?file=" . $_GET['file'] . "§ion_conf=$record[0]"; } if ($_GET['section_conf']) // sidemenu link was clicked (edit section) @@ -159,14 +162,14 @@ } } - elseif ($_POST['tryUpdate']) // update button pushed from edit section page + elseif ($tryUpdate) // update button pushed from edit section page { // create HTML header and left menu $page->OC_HTML_doHtmlHeader_a2billing($smarty); $page->OC_HTML_doSideMenu($menuList); // attempt to write the changes - $result = $conf->OC_writeConfSection($_POST['themd5'], $_POST['updateSection'], $_POST['section_text']); + $result = $conf->OC_writeConfSection($themd5, $updateSection, $section_text); if (!$result) { echo "Write failed!
    "; @@ -233,7 +236,7 @@ if ($files) { foreach ($files as $file) { - $menuList[$file] = $_SERVER['PHP_SELF'] . "?file=$file§ion_conf=$file"; + $menuList[$file] = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?file=$file§ion_conf=$file"; // HTML output $page->OC_HTML_setMenuList($menuList); } diff --git a/admin/Public/phpconfig_init.php b/admin/Public/phpconfig_init.php old mode 100644 new mode 100755 index dc65152fb..a24e4e82b --- a/admin/Public/phpconfig_init.php +++ b/admin/Public/phpconfig_init.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/admin/Public/templates/default/css/index.php b/admin/Public/templates/default/css/index.php old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/css/main.css b/admin/Public/templates/default/css/main.css old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/css/menu.css b/admin/Public/templates/default/css/menu.css old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/css/popup.css b/admin/Public/templates/default/css/popup.css old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/css/style-ie.css b/admin/Public/templates/default/css/style-ie.css old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/footer.tpl b/admin/Public/templates/default/footer.tpl old mode 100644 new mode 100755 index 97177ab50..37f1d92f1 --- a/admin/Public/templates/default/footer.tpl +++ b/admin/Public/templates/default/footer.tpl @@ -1,14 +1,14 @@ - + - + - +
    - + - +

    {include file="profiler.tpl"} diff --git a/admin/Public/templates/default/header.tpl b/admin/Public/templates/default/header.tpl old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/OSicon/Arch.png b/admin/Public/templates/default/images/OSicon/Arch.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/OSicon/Ubuntu.png b/admin/Public/templates/default/images/OSicon/Ubuntu.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/OSicon/xp.png b/admin/Public/templates/default/images/OSicon/xp.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/a2b-logo-450.png b/admin/Public/templates/default/images/a2b-logo-450.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/animated_favicon1.gif b/admin/Public/templates/default/images/animated_favicon1.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/back.png b/admin/Public/templates/default/images/back.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/back_button_over.gif b/admin/Public/templates/default/images/back_button_over.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/background_cells.gif b/admin/Public/templates/default/images/background_cells.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/background_cells_red.gif b/admin/Public/templates/default/images/background_cells_red.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/bg-menu-down.png b/admin/Public/templates/default/images/bg-menu-down.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/bg-menu-middle.png b/admin/Public/templates/default/images/bg-menu-middle.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/bg-menu-up.png b/admin/Public/templates/default/images/bg-menu-up.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/blueshade.png b/admin/Public/templates/default/images/blueshade.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/btn_Delete_94x20.gif b/admin/Public/templates/default/images/btn_Delete_94x20.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/button_buynow.gif b/admin/Public/templates/default/images/button_buynow.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/button_cancel.gif b/admin/Public/templates/default/images/button_cancel.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/button_confirm_order.gif b/admin/Public/templates/default/images/button_confirm_order.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/button_continue.gif b/admin/Public/templates/default/images/button_continue.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/button_update.gif b/admin/Public/templates/default/images/button_update.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cal.gif b/admin/Public/templates/default/images/cal.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/call-labs.com.png b/admin/Public/templates/default/images/call-labs.com.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/call-labs.png b/admin/Public/templates/default/images/call-labs.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/chart_bar.png b/admin/Public/templates/default/images/chart_bar.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/chart_curve.png b/admin/Public/templates/default/images/chart_curve.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/chart_line.png b/admin/Public/templates/default/images/chart_line.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/chart_pie.png b/admin/Public/templates/default/images/chart_pie.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog.png b/admin/Public/templates/default/images/cog.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog_add.png b/admin/Public/templates/default/images/cog_add.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog_delete.png b/admin/Public/templates/default/images/cog_delete.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog_edit.png b/admin/Public/templates/default/images/cog_edit.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog_error.png b/admin/Public/templates/default/images/cog_error.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cog_go.png b/admin/Public/templates/default/images/cog_go.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/connected.gif b/admin/Public/templates/default/images/connected.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/cross.gif b/admin/Public/templates/default/images/cross.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/del.png b/admin/Public/templates/default/images/del.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/details.gif b/admin/Public/templates/default/images/details.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/dl.gif b/admin/Public/templates/default/images/dl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/down.png b/admin/Public/templates/default/images/down.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/down_black.png b/admin/Public/templates/default/images/down_black.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/edit.gif b/admin/Public/templates/default/images/edit.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/email03.gif b/admin/Public/templates/default/images/email03.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/excel.gif b/admin/Public/templates/default/images/excel.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/exclamation.png b/admin/Public/templates/default/images/exclamation.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/favicon.ico b/admin/Public/templates/default/images/favicon.ico old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/ae.gif b/admin/Public/templates/default/images/flags/ae.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/br.gif b/admin/Public/templates/default/images/flags/br.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/cn.gif b/admin/Public/templates/default/images/flags/cn.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/cz.gif b/admin/Public/templates/default/images/flags/cz.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/de.gif b/admin/Public/templates/default/images/flags/de.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/dk.gif b/admin/Public/templates/default/images/flags/dk.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/es.gif b/admin/Public/templates/default/images/flags/es.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/fi.gif b/admin/Public/templates/default/images/flags/fi.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/fr.gif b/admin/Public/templates/default/images/flags/fr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/gb.gif b/admin/Public/templates/default/images/flags/gb.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/gr.gif b/admin/Public/templates/default/images/flags/gr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/it.gif b/admin/Public/templates/default/images/flags/it.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/jp.gif b/admin/Public/templates/default/images/flags/jp.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/nl.gif b/admin/Public/templates/default/images/flags/nl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/pk.gif b/admin/Public/templates/default/images/flags/pk.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/pl.gif b/admin/Public/templates/default/images/flags/pl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/pt.gif b/admin/Public/templates/default/images/flags/pt.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/ro.gif b/admin/Public/templates/default/images/flags/ro.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/ru.gif b/admin/Public/templates/default/images/flags/ru.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/tr.gif b/admin/Public/templates/default/images/flags/tr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/flags/us.gif b/admin/Public/templates/default/images/flags/us.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/forward.png b/admin/Public/templates/default/images/forward.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/gbottom.png b/admin/Public/templates/default/images/gbottom.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/group.png b/admin/Public/templates/default/images/group.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/group_add.png b/admin/Public/templates/default/images/group_add.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/gtop.png b/admin/Public/templates/default/images/gtop.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon-card.png b/admin/Public/templates/default/images/icon-card.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon-info.gif b/admin/Public/templates/default/images/icon-info.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon-release.gif b/admin/Public/templates/default/images/icon-release.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon-restore.gif b/admin/Public/templates/default/images/icon-restore.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon-viewdetails.gif b/admin/Public/templates/default/images/icon-viewdetails.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icon_refresh.gif b/admin/Public/templates/default/images/icon_refresh.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/icons_xml.gif b/admin/Public/templates/default/images/icons_xml.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/index.php b/admin/Public/templates/default/images/index.php old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-menu_back.gif b/admin/Public/templates/default/images/key-menu_back.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-menu_bl.gif b/admin/Public/templates/default/images/key-menu_bl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-menu_br.gif b/admin/Public/templates/default/images/key-menu_br.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-menu_tl.gif b/admin/Public/templates/default/images/key-menu_tl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-menu_tr.gif b/admin/Public/templates/default/images/key-menu_tr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-point_back.gif b/admin/Public/templates/default/images/key-point_back.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-point_bl.gif b/admin/Public/templates/default/images/key-point_bl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-point_br.gif b/admin/Public/templates/default/images/key-point_br.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-point_tl.gif b/admin/Public/templates/default/images/key-point_tl.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/key-point_tr.gif b/admin/Public/templates/default/images/key-point_tr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/3d.gif b/admin/Public/templates/default/images/kicons/3d.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/accessibility-directory.gif b/admin/Public/templates/default/images/kicons/accessibility-directory.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/acroread.gif b/admin/Public/templates/default/images/kicons/acroread.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/apply.gif b/admin/Public/templates/default/images/kicons/apply.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/authorize.gif b/admin/Public/templates/default/images/kicons/authorize.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/back.gif b/admin/Public/templates/default/images/kicons/back.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/backup.gif b/admin/Public/templates/default/images/kicons/backup.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/blockdevice.gif b/admin/Public/templates/default/images/kicons/blockdevice.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/bug.gif b/admin/Public/templates/default/images/kicons/bug.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/button_cancel.gif b/admin/Public/templates/default/images/kicons/button_cancel.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/button_ok.gif b/admin/Public/templates/default/images/kicons/button_ok.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/cache.gif b/admin/Public/templates/default/images/kicons/cache.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/calc.gif b/admin/Public/templates/default/images/kicons/calc.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/clanbomber.gif b/admin/Public/templates/default/images/kicons/clanbomber.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/clear_left.gif b/admin/Public/templates/default/images/kicons/clear_left.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/clock.gif b/admin/Public/templates/default/images/kicons/clock.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/config-date.gif b/admin/Public/templates/default/images/kicons/config-date.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/config-language.gif b/admin/Public/templates/default/images/kicons/config-language.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/connect_to_network.gif b/admin/Public/templates/default/images/kicons/connect_to_network.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/date.gif b/admin/Public/templates/default/images/kicons/date.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/desktop.gif b/admin/Public/templates/default/images/kicons/desktop.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/exec.gif b/admin/Public/templates/default/images/kicons/exec.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/favorites.gif b/admin/Public/templates/default/images/kicons/favorites.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/favorites_16.gif b/admin/Public/templates/default/images/kicons/favorites_16.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/favorites_24.gif b/admin/Public/templates/default/images/kicons/favorites_24.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/file-manager.gif b/admin/Public/templates/default/images/kicons/file-manager.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/folder_open.gif b/admin/Public/templates/default/images/kicons/folder_open.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/folder_red_open.gif b/admin/Public/templates/default/images/kicons/folder_red_open.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gkrellm2.gif b/admin/Public/templates/default/images/kicons/gkrellm2.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-calculator.gif b/admin/Public/templates/default/images/kicons/gnome-calculator.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-finance.gif b/admin/Public/templates/default/images/kicons/gnome-finance.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-globe.gif b/admin/Public/templates/default/images/kicons/gnome-globe.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-other.gif b/admin/Public/templates/default/images/kicons/gnome-other.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-settings.gif b/admin/Public/templates/default/images/kicons/gnome-settings.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/gnome-shutdown.gif b/admin/Public/templates/default/images/kicons/gnome-shutdown.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/help.gif b/admin/Public/templates/default/images/kicons/help.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/help_index.gif b/admin/Public/templates/default/images/kicons/help_index.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/hwbrowser.gif b/admin/Public/templates/default/images/kicons/hwbrowser.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/icon-db-user.gif b/admin/Public/templates/default/images/kicons/icon-db-user.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/icon-media.gif b/admin/Public/templates/default/images/kicons/icon-media.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/icon-speaker.gif b/admin/Public/templates/default/images/kicons/icon-speaker.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/identity.gif b/admin/Public/templates/default/images/kicons/identity.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/im-nov.gif b/admin/Public/templates/default/images/kicons/im-nov.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/index.php b/admin/Public/templates/default/images/kicons/index.php old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kate.gif b/admin/Public/templates/default/images/kicons/kate.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kchart.gif b/admin/Public/templates/default/images/kicons/kchart.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kchart_chrt.gif b/admin/Public/templates/default/images/kicons/kchart_chrt.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kcmdf.gif b/admin/Public/templates/default/images/kicons/kcmdf.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kdmconfig.gif b/admin/Public/templates/default/images/kicons/kdmconfig.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kfind.gif b/admin/Public/templates/default/images/kicons/kfind.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kfm_home.gif b/admin/Public/templates/default/images/kicons/kfm_home.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/khelpcenter.gif b/admin/Public/templates/default/images/kicons/khelpcenter.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/knewstuff.gif b/admin/Public/templates/default/images/kicons/knewstuff.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/ksplash.gif b/admin/Public/templates/default/images/kicons/ksplash.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kspread.gif b/admin/Public/templates/default/images/kicons/kspread.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kspread_ksp.gif b/admin/Public/templates/default/images/kicons/kspread_ksp.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/ksysguard.gif b/admin/Public/templates/default/images/kicons/ksysguard.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kthememgr.gif b/admin/Public/templates/default/images/kicons/kthememgr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/ktip.gif b/admin/Public/templates/default/images/kicons/ktip.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/kwrite.gif b/admin/Public/templates/default/images/kicons/kwrite.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/locale.gif b/admin/Public/templates/default/images/kicons/locale.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/locationbar_erase.gif b/admin/Public/templates/default/images/kicons/locationbar_erase.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/lock_bg.png b/admin/Public/templates/default/images/kicons/lock_bg.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/messagebox_critical.gif b/admin/Public/templates/default/images/kicons/messagebox_critical.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/messagebox_info.gif b/admin/Public/templates/default/images/kicons/messagebox_info.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/moneybookers.gif b/admin/Public/templates/default/images/kicons/moneybookers.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/network.gif b/admin/Public/templates/default/images/kicons/network.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/network_local.gif b/admin/Public/templates/default/images/kicons/network_local.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/next.gif b/admin/Public/templates/default/images/kicons/next.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/package.gif b/admin/Public/templates/default/images/kicons/package.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/package_network.gif b/admin/Public/templates/default/images/kicons/package_network.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/package_settings.gif b/admin/Public/templates/default/images/kicons/package_settings.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/package_utilities.gif b/admin/Public/templates/default/images/kicons/package_utilities.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/password.gif b/admin/Public/templates/default/images/kicons/password.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/password.png b/admin/Public/templates/default/images/kicons/password.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/paypal.gif b/admin/Public/templates/default/images/kicons/paypal.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/paypal_logo.gif b/admin/Public/templates/default/images/kicons/paypal_logo.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/penguin.gif b/admin/Public/templates/default/images/kicons/penguin.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/personal.gif b/admin/Public/templates/default/images/kicons/personal.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/pinguim-root3.gif b/admin/Public/templates/default/images/kicons/pinguim-root3.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/pinguim-user.gif b/admin/Public/templates/default/images/kicons/pinguim-user.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/pinguim-user2.gif b/admin/Public/templates/default/images/kicons/pinguim-user2.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/pipe.gif b/admin/Public/templates/default/images/kicons/pipe.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/plugnpay.png b/admin/Public/templates/default/images/kicons/plugnpay.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/socket.gif b/admin/Public/templates/default/images/kicons/socket.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/spreadsheet.gif b/admin/Public/templates/default/images/kicons/spreadsheet.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock-panel-multimedia.gif b/admin/Public/templates/default/images/kicons/stock-panel-multimedia.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_alarm.gif b/admin/Public/templates/default/images/kicons/stock_alarm.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_cell-phone.gif b/admin/Public/templates/default/images/kicons/stock_cell-phone.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_dialog-info.gif b/admin/Public/templates/default/images/kicons/stock_dialog-info.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_init.gif b/admin/Public/templates/default/images/kicons/stock_init.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_landline-phone.gif b/admin/Public/templates/default/images/kicons/stock_landline-phone.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_new-spreadsheet.gif b/admin/Public/templates/default/images/kicons/stock_new-spreadsheet.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/stock_unknown.gif b/admin/Public/templates/default/images/kicons/stock_unknown.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/system-config-date.gif b/admin/Public/templates/default/images/kicons/system-config-date.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/system-config-rootpassword.gif b/admin/Public/templates/default/images/kicons/system-config-rootpassword.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/system-config-rootpassword.png b/admin/Public/templates/default/images/kicons/system-config-rootpassword.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/toggle_hide2show.png b/admin/Public/templates/default/images/kicons/toggle_hide2show.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/toggle_hide2show_on.png b/admin/Public/templates/default/images/kicons/toggle_hide2show_on.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/vcard.gif b/admin/Public/templates/default/images/kicons/vcard.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/viewmag.gif b/admin/Public/templates/default/images/kicons/viewmag.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/wi0124-48.gif b/admin/Public/templates/default/images/kicons/wi0124-48.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/worldpay.gif b/admin/Public/templates/default/images/kicons/worldpay.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/xclock.gif b/admin/Public/templates/default/images/kicons/xclock.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/xmag.gif b/admin/Public/templates/default/images/kicons/xmag.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_HD.gif b/admin/Public/templates/default/images/kicons/yast_HD.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_PhoneTTOffhook.gif b/admin/Public/templates/default/images/kicons/yast_PhoneTTOffhook.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_multihead.gif b/admin/Public/templates/default/images/kicons/yast_multihead.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_partitioner.gif b/admin/Public/templates/default/images/kicons/yast_partitioner.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_remote.gif b/admin/Public/templates/default/images/kicons/yast_remote.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/yast_sysadmin.gif b/admin/Public/templates/default/images/kicons/yast_sysadmin.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/kicons/zip_mount.gif b/admin/Public/templates/default/images/kicons/zip_mount.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/login-border-center.png b/admin/Public/templates/default/images/login-border-center.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/login-border-down.png b/admin/Public/templates/default/images/login-border-down.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/login-border-up.png b/admin/Public/templates/default/images/login-border-up.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/logout.png b/admin/Public/templates/default/images/logout.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/map.png b/admin/Public/templates/default/images/map.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/menu_back.gif b/admin/Public/templates/default/images/menu_back.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/menu_br.gif b/admin/Public/templates/default/images/menu_br.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/menu_tr.gif b/admin/Public/templates/default/images/menu_tr.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/msg_error.png b/admin/Public/templates/default/images/msg_error.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/msg_info.png b/admin/Public/templates/default/images/msg_info.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/msg_success.png b/admin/Public/templates/default/images/msg_success.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/msg_warning.png b/admin/Public/templates/default/images/msg_warning.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/next.gif b/admin/Public/templates/default/images/next.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/next_icon.gif b/admin/Public/templates/default/images/next_icon.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/next_icon2.gif b/admin/Public/templates/default/images/next_icon2.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/next_year.gif b/admin/Public/templates/default/images/next_year.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/orangeshade.png b/admin/Public/templates/default/images/orangeshade.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/orangeshadet.gif b/admin/Public/templates/default/images/orangeshadet.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/orangeshadet.png b/admin/Public/templates/default/images/orangeshadet.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/page_white.png b/admin/Public/templates/default/images/page_white.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/page_white_add.png b/admin/Public/templates/default/images/page_white_add.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/page_white_edit.png b/admin/Public/templates/default/images/page_white_edit.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/pdf.gif b/admin/Public/templates/default/images/pdf.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/pixel.gif b/admin/Public/templates/default/images/pixel.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/prev.gif b/admin/Public/templates/default/images/prev.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/prev_year.gif b/admin/Public/templates/default/images/prev_year.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/spacer.jpg b/admin/Public/templates/default/images/spacer.jpg old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/stock-mic.png b/admin/Public/templates/default/images/stock-mic.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/telephone.png b/admin/Public/templates/default/images/telephone.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/telephone_add.png b/admin/Public/templates/default/images/telephone_add.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/telephone_delete.png b/admin/Public/templates/default/images/telephone_delete.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/telephone_edit.png b/admin/Public/templates/default/images/telephone_edit.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/terminated.gif b/admin/Public/templates/default/images/terminated.gif old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/top_menu_bg.png b/admin/Public/templates/default/images/top_menu_bg.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/topshade.png b/admin/Public/templates/default/images/topshade.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/tux.png b/admin/Public/templates/default/images/tux.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/up.png b/admin/Public/templates/default/images/up.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/up_black.png b/admin/Public/templates/default/images/up_black.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user.png b/admin/Public/templates/default/images/user.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_comment.png b/admin/Public/templates/default/images/user_comment.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_delete.png b/admin/Public/templates/default/images/user_delete.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_edit.png b/admin/Public/templates/default/images/user_edit.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_female.png b/admin/Public/templates/default/images/user_female.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_go.png b/admin/Public/templates/default/images/user_go.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_gray.png b/admin/Public/templates/default/images/user_gray.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_green.png b/admin/Public/templates/default/images/user_green.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_multi_add.png b/admin/Public/templates/default/images/user_multi_add.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_orange.png b/admin/Public/templates/default/images/user_orange.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_red.png b/admin/Public/templates/default/images/user_red.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/images/user_suit.png b/admin/Public/templates/default/images/user_suit.png old mode 100644 new mode 100755 diff --git a/admin/Public/templates/default/index.tpl b/admin/Public/templates/default/index.tpl index f2c80ad65..957ea9a25 100755 --- a/admin/Public/templates/default/index.tpl +++ b/admin/Public/templates/default/index.tpl @@ -39,7 +39,7 @@ - +
    @@ -85,7 +85,7 @@ - +
    {if ($error == 1)} {php} echo gettext("AUTHENTICATION REFUSED, please check your user/password!");{/php} @@ -95,12 +95,12 @@ {php} echo gettext("BLOCKED ACCOUNT, Please contact the administrator!");{/php} {/if}
    + - + - - + {literal} {/literal} - - diff --git a/admin/Public/templates/default/main.tpl b/admin/Public/templates/default/main.tpl index 207ac44d6..3a5e5e06c 100755 --- a/admin/Public/templates/default/main.tpl +++ b/admin/Public/templates/default/main.tpl @@ -6,27 +6,27 @@ - + {/if} {if ($popupwindow == 0)} @@ -54,7 +54,7 @@ @@ -265,7 +266,7 @@ {/if} - + {if ($ACXOUTBOUNDCID > 0)} {/if} - + {if ($ACXCALLBACK > 0)} {/if} - + {if ($ACXMAINTENANCE > 0)} - + {/if} - + {if ($ACXMAIL > 0)} + - + {/if} - + - +
    diff --git a/customer/userinfo.php b/customer/userinfo.php index 308b89bdd..bd017d389 100644 --- a/customer/userinfo.php +++ b/customer/userinfo.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/customer/webservice/create_trunkconfig.php b/customer/webservice/create_trunkconfig.php index a86b5bbdf..a395f1f60 100755 --- a/customer/webservice/create_trunkconfig.php +++ b/customer/webservice/create_trunkconfig.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/customer/webservice/get_balance.php b/customer/webservice/get_balance.php index d32044fc0..de9448af7 100644 --- a/customer/webservice/get_balance.php +++ b/customer/webservice/get_balance.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/customer/webservice/get_rates.php b/customer/webservice/get_rates.php index 739a4088f..f51b0aa77 100644 --- a/customer/webservice/get_rates.php +++ b/customer/webservice/get_rates.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 000000000..1237189ec --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + + + ./tests/ + + + + + vendor + + + + + + + diff --git a/src/Contracts/Factory/Factory.php b/src/Contracts/Factory/Factory.php new file mode 100644 index 000000000..46cd7a5d4 --- /dev/null +++ b/src/Contracts/Factory/Factory.php @@ -0,0 +1,8 @@ +php_handling = \Smarty::PHP_ALLOW; + $smarty->enableSecurity($securityPolicy); + + return $smarty; + } +} \ No newline at end of file diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/Factory/SmartyFactoryTest.php b/tests/Factory/SmartyFactoryTest.php new file mode 100644 index 000000000..5adb7d7da --- /dev/null +++ b/tests/Factory/SmartyFactoryTest.php @@ -0,0 +1,13 @@ +assertInstanceOf('\Smarty', $smarty); + } +} + diff --git a/webservice/SOAP/soap-a2billing-server.php b/webservice/SOAP/soap-a2billing-server.php index cf2300a22..4dcccd4fe 100755 --- a/webservice/SOAP/soap-a2billing-server.php +++ b/webservice/SOAP/soap-a2billing-server.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/soap-a2billing-test.php b/webservice/SOAP/soap-a2billing-test.php index f84a4dbb9..1ff2c7565 100644 --- a/webservice/SOAP/soap-a2billing-test.php +++ b/webservice/SOAP/soap-a2billing-test.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/soap-callback-server.php b/webservice/SOAP/soap-callback-server.php index f6dad8c33..005e01831 100755 --- a/webservice/SOAP/soap-callback-server.php +++ b/webservice/SOAP/soap-callback-server.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/soap-stress-a2billing.php b/webservice/SOAP/soap-stress-a2billing.php index 224be0244..493f9f6d2 100755 --- a/webservice/SOAP/soap-stress-a2billing.php +++ b/webservice/SOAP/soap-stress-a2billing.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/stress-a2billing-test.php b/webservice/SOAP/stress-a2billing-test.php index 1cdc5bbf0..0fd48181d 100644 --- a/webservice/SOAP/stress-a2billing-test.php +++ b/webservice/SOAP/stress-a2billing-test.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/test-a2billing-server.php b/webservice/SOAP/test-a2billing-server.php index 8ef7cb034..46a08a1f5 100755 --- a/webservice/SOAP/test-a2billing-server.php +++ b/webservice/SOAP/test-a2billing-server.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/SOAP/test-callback-server.php b/webservice/SOAP/test-callback-server.php index aab367e3c..c1cfe9f62 100755 --- a/webservice/SOAP/test-callback-server.php +++ b/webservice/SOAP/test-callback-server.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing diff --git a/webservice/api.php b/webservice/api.php new file mode 100755 index 000000000..d207d2c3c --- /dev/null +++ b/webservice/api.php @@ -0,0 +1,193 @@ +initConfig()) + throw new RuntimeException('Cannot load config'); + + if (!$this->initDb()) + throw new RuntimeException('Cannot connect to db'); + + if (!$this->initApi()) + throw new RuntimeException('Cannot init APIs'); + } + + public function getConfig($key, $default = null) { + $keys = explode('.', $key); + if (!is_array($keys)) + $keys = array($key); + + // get param + $value = $this->config; + foreach ($keys as $key) { + $value = (is_array($value) && isset($value[$key])) ? $value[$key] : $default; + } + + return $value; + } + + private function initConfig() { + $config = '/etc/a2billing.conf'; + if (!file_exists($config)) + return false; + $this->config = parse_ini_file($config, true); + return is_array($this->config); + } + + private function initDb() { + // connecting to DB + if (strcasecmp($this->getConfig('database.dbtype', ''), 'mysql') != 0) { + self::log('Supports only mysql database', LOG_ERR); + return false; + } + $host = $this->getConfig('database.hostname', '127.0.0.1'); + $user = $this->getConfig('database.user', 'root'); + $pass = $this->getConfig('database.password', ''); + $db = $this->getConfig('database.dbname', 'a2billing'); + $mysqli = new mysqli($host, $user, $pass, $db); + if ($mysqli->connect_error) { + self::log('Mysql connection error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error, LOG_ERR); + return false; + } + $this->dbh = $mysqli; + $this->dbh->set_charset("utf8"); + return true; + } + + private function initApi() { + $scripts = glob(dirname(__FILE__).'/api/*.php'); + if (!is_array($scripts)) + return false; + + foreach ($scripts as $script) { + try { + require_once($script); + $class = basename($script, '.php'); + $api = new $class(); + if ($api instanceof IApi) + $api->init($this); + } catch (Exception $e) { + return false; + } + } + + return true; + } + + public function columnExists($table, $column) { + $result = false; + $sql = "show fields from $table"; + $data = $this->query($sql); + foreach ($data as $row) { + if (strtolower($row['Field']) == strtolower($column)) { + $result = true; + break; + } + } + return $result; + } + + public function getParam($key, $default = null, $group = 'global') { + $sql = "select * from cc_config where config_group_title = '$group' and config_key = '$key' limit 1"; + $data = $this->query($sql); + + return (is_array($data) && count($data)) > 0 ? $data[0]['config_value'] : $default; + } + + public function getQueryParam($key, $default = null) { + return array_key_exists($key, $_REQUEST) ? $_REQUEST[$key] : $default; + } + + public function query($sql) { + $data = array(); + if ($this->dbh) { + try { + $result = $this->dbh->query($sql); + if ($result === true) { // data changed + $data['affected_rows'] = $this->dbh->affected_rows; + $data['insert_id'] = $this->dbh->insert_id; + } else if ($result instanceof mysqli_result) { // data extracted + while ($row = $result->fetch_assoc()) + $data[] = $row; + $result->free(); + } else { + $data['error'] = $this->dbh->error; + } + } catch (Exception $e) { + $data['error'] = $e->getMessage(); + } + } else { + $data['error'] = 'No connection'; + } + return $data; + } + + public function escape($value) { + return $this->dbh ? $this->dbh->real_escape_string($value) : $value; + } + + public function registerApi($name, $callback) { + if (!array_key_exists($name, $this->api) && is_callable($callback)) + $this->api[$name] = $callback; + } + + public function registerFormat($name, $callback) { + if (!array_key_exists($name, $this->format) && is_callable($callback)) + $this->format[$name] = $callback; + } + + private function check() { + $ips = $this->getParam('api_ip_auth', null, 'webui'); + if (strlen($ips) > 0 && $ips != '*') { + if (!in_array($_SERVER['REMOTE_ADDR'], explode(';', $ips))) { + return 'Your IP is not allowed'; + } + } + + if (strtolower(md5($this->getParam('api_security_key', null, 'webui'))) != strtolower($this->getQueryParam('api_security_key', 'error'))) { + return 'Wrong API key'; + } + + return $error; + } + + public function process() { + $data = ''; + $ips = $this->getParam('api_ip_auth', null, 'webui'); + if (!strlen($ips) || $ips == '*' || in_array($_SERVER['REMOTE_ADDR'], explode(';', $ips))) { + if (strtolower(md5($this->getParam('api_security_key', null, 'webui'))) == strtolower($this->getQueryParam('api_security_key', 'error'))) { + $method = $this->getQueryParam('api_method'); + if (!is_null($method) && strlen($method) > 0 && array_key_exists($method, $this->api) && is_callable($this->api[$method])) { + $data = call_user_func($this->api[$method]); + } else { + $data = 'Wrong API method'; + } + } else { + $data = 'Wrong API key'; + } + } else { + $data = 'Your IP is not allowed'; + } + + $format = $this->getQueryParam('api_format'); + if (!is_null($format) && strlen($format) > 0 && array_key_exists($format, $this->format) && is_callable($this->format[$format])) { + echo call_user_func($this->format[$format], $data); + } else { + print_r($data); + } + } + +} + +$api = new Api(); +$api->process(); diff --git a/webservice/api/JsonFormat.php b/webservice/api/JsonFormat.php new file mode 100755 index 000000000..ffa4fd228 --- /dev/null +++ b/webservice/api/JsonFormat.php @@ -0,0 +1,20 @@ +registerFormat('json', array($this, 'format')); + + } + + public function format($data) { + + if (!is_array($data)) + $data = array('data' => $data); + + return json_encode($data); + + } + +} diff --git a/webservice/api/OneWorldApi.php b/webservice/api/OneWorldApi.php new file mode 100755 index 000000000..26e10654e --- /dev/null +++ b/webservice/api/OneWorldApi.php @@ -0,0 +1,791 @@ +registerApi('card_create', array($this, 'card_create')); + $api->registerApi('card_delete', array($this, 'card_delete')); + $api->registerApi('card_find', array($this, 'card_find')); + $api->registerApi('card_pin_update', array($this, 'card_pin_update')); + $api->registerApi('tariff_find', array($this, 'tariff_find')); + $api->registerApi('helper_param_get', array($this, 'helper_param_get')); + $api->registerApi('helper_currency_convert', array($this, 'helper_currency_convert')); + $api->registerApi('card_balance', array($this, 'card_balance')); + $api->registerApi('card_balance_add', array($this, 'card_balance_add')); + $api->registerApi('card_tariff', array($this, 'card_tariff')); + $api->registerApi('card_tariff_change', array($this, 'card_tariff_change')); + $api->registerApi('call_rate', array($this, 'call_rate')); + $api->registerApi('did_find', array($this, 'did_find')); + $api->registerApi('did_buy', array($this, 'did_buy')); + $api->registerApi('did_list', array($this, 'did_list')); + $api->registerApi('did_release', array($this, 'did_release')); + $api->registerApi('voucher_activate', array($this, 'voucher_activate')); + $api->registerApi('conference_create', array($this, 'conference_create')); + $api->registerApi('callback_create', array($this, 'callback_create')); + + $this->api = $api; + $this->base_currency = $api->getParam('base_currency'); + $data = $api->query("select lower(currency) currency, value from cc_currencies"); + foreach ($data as $row) + $this->currencies[$row['currency']] = $row['value']; + } + + public function getCurrencyRate($currency) { + $currency = strtolower($currency); + + return array_key_exists($currency, $this->currencies) ? $this->currencies[$currency] : 0; + } + + public function getRate($from, $to) { + $fromRate = $this->getCurrencyRate($from); + $toRate = $this->getCurrencyRate($to); + if ($fromRate == 0 || $toRate == 0) + return 0; + + $rate = 0; + if ($from == $this->base_currency) { + $rate = 1 / $toRate; + } else if ($to == $this->base_currency) { + $rate = $fromRate; + } else { + $rate = $fromRate * (1 / $toRate); + } + + return $rate; + } + + /** + * Converts from one to another + * + * @param float $amount + * @param mixed $from + * @param mixed $to if null - base currency will be used + * @return float + */ + public function convertCurrency($amount, $from, $to = null) { + if ($to === null) + $to = $this->base_currency; + + return $amount * $this->getRate($from, $to); + } + + /** + * Expects: + * query_column + * query_value + * query_condition + * + * @return mixed + */ + private function find_query($table) { + $response = null; + $query_value = $this->api->escape($this->api->getQueryParam('query_value', '%')); + $query_column = $this->api->getQueryParam('query_column', 'id'); + $query_condition = $this->api->getQueryParam('query_condition', 'like'); + if ($this->api->columnExists($table, $query_column)) { + try { + $sql = "select * from $table where `$query_column` $query_condition '$query_value'"; + $response = $this->response(true, array('data' => $this->api->query($sql))); + } catch (Exception $e) { + $response = $this->response(false, array('msg' => $e->getMessage())); + } + } else { + $response = $this->response(false, array('msg' => "Wrong query_column")); + } + return $response; + } + + /** + * Expects: + * query_column + * query_value + * + * @return mixed + */ + public function delete_query($table) { + $response = null; + $query_value = $this->api->escape($this->api->getQueryParam('query_value')); + $query_column = $this->api->getQueryParam('query_column', 'id'); + if ($this->api->columnExists($table, $query_column)) { + try { + $sql = "delete from $table where `$query_column` = '$query_value' limit 1"; + $result = $this->api->query($sql); + $response = (isset($result['affected_rows']) && $result['affected_rows'] > 0) ? $this->response(true) : $this->response(false, array('msg' => "Cannot find card where $query_column = $query_value")); + } catch (Exception $e) { + $response = $this->response(false, array('msg' => $e->getMessage())); + } + } else { + $response = $this->response(false, array('msg' => "Wrong query_column")); + } + return $response; + } + + private function response($success, $params = array()) { + return array_merge(array('success' => $success), $params); + } + + /** + * Creates new card + * + * Expectes: + * parameters like col_REALCOLUMNNAME and a value for it + * + * @return array + */ + public function card_create() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $password = $this->api->escape($this->api->getQueryParam('password', '')); + $tariff = intval($this->api->getQueryParam('tariff', 0)); + $pin = $this->api->escape($this->api->getQueryParam('pin', '')); + + $sql = "select * from cc_tariffgroup where id = '$tariff'"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Bad tariff')); + + $values = array( + 'username' => $username, + 'useralias' => $username, + 'uipass' => $password, + 'tariff' => $tariff, + 'credit' => '0', + 'activated' => 't', + 'status' => '1', + 'lastname' => '', + 'firstname' => '', + 'address' => '', + 'city' => '', + 'state' => '', + 'country' => '', + 'zipcode' => '', + 'phone' => '', + 'email' => '', + 'fax' => '', + 'typepaid' => '0', + 'loginkey' => '', + 'email_notification' => '', + 'company_name' => '', + 'company_website' => '', + 'traffic_target' => '0', + 'simultaccess' => '0', + 'max_concurrent' => '1', + 'redial' => '', + 'tag' => 'oneworld', + 'block' => '1', + 'lock_pin' => $pin + ); + + $fields = array(); + foreach ($values as $col => $value) + $fields[] = "$col = '$value'"; + + $response = null; + try { + $sql = "insert into cc_card set " . join(', ', $fields); + $result = $this->api->query($sql); + if (isset($result['insert_id']) && $result['insert_id'] > 0) { + $sql = "select * from cc_card where id = '{$result['insert_id']}'"; + $data = $this->api->query($sql); + $response = count($data) > 0 ? $this->response(true, array('card' => $data[0])) : $this->response(false, array('msg' => "Cannot find card by id {{$result['insert_id']}}")); + } else { + $response = $this->response(false, array('msg' => "Cannot create card")); + } + } catch (Exception $e) { + $response = $this->response(false, array('msg' => $e->getMessage())); + } + + return $response; + } + + public function card_pin_update() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $pin = $this->api->escape($this->api->getQueryParam('pin', '')); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + $sql = "update cc_card set lock_pin = '$pin' where id = '{$card['id']}' limit 1"; + $data = $this->api->query($sql); + + if (!isset($data['affected_rows']) || !$data['affected_rows']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Pin is not changed.')); + + return $this->response(true); + } + + public function card_delete() { + return $this->delete_query('cc_card'); + } + + public function tariff_find() { + return $this->find_query('cc_tariffgroup'); + } + + public function card_find() { + return $this->find_query('cc_card'); + } + + /** + * Expects: + * key (optional) + * group (optional) + * default (optional) + * + */ + public function helper_param_get() { + $key = $this->api->getQueryParam('key', ''); + $group = $this->api->getQueryParam('group', 'global'); + $default = $this->api->getQueryParam('default', null); + + return $this->response(true, array('data' => $this->api->getParam($key, $default, $group))); + } + + /** + * Expects: + * amount + * from + * to (optional) + * + */ + public function helper_currency_convert() { + $amount = $this->api->getQueryParam('amount', 0); + $from = $this->api->getQueryParam('from'); + $to = $this->api->getQueryParam('to', $this->base_currency); + + return $this->response(true, array('data' => $this->convertCurrency($amount, $from, $to))); + } + + public function card_balance() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + + $sql = "select credit, currency from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + return $this->response(true, array('balance' => $this->convertCurrency($data[0]['credit'], $this->base_currency, $data[0]['currency']), 'currency' => $data[0]['currency'])); + } + + public function card_tariff_change() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $tariff = intval($this->api->getQueryParam('tariff', 0)); + + $sql = "select * from cc_tariffgroup where id = '$tariff' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Tariff record not found.')); + + $new_tariff = $data[0]; + + $sql = "select c.id card_id, t.id tariff_id from cc_card c left join cc_tariffgroup t on t.id = c.tariff where c.username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $ids = $data[0]; + + if ($ids['tariff_id'] == $tariff) + return $this->response(false, array('msg' => 'Tariff is same.')); + + // changing tariff + $sql = "update cc_card set tariff = '$tariff' where id = '{$ids['card_id']}' limit 1"; + $data = $this->api->query($sql); + + if (!isset($data['affected_rows']) || !$data['affected_rows']) { + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot change tariff.')); + } else { + // TODO: additional actions + + + } + + return $this->response(true, array('plan' => $new_tariff['tariffgroupname'], 'id' => $new_tariff['id'])); + } + + public function card_tariff() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + + $sql = "select t.id id, t.tariffgroupname tariff from cc_card c left join cc_tariffgroup t on t.id = c.tariff where c.username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + return $this->response(true, array('plan' => $data[0]['tariff'], 'id' => $data[0]['id'])); + } + + public function call_rate() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $number = $this->api->escape($this->api->getQueryParam('number', '')); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + if (!strlen($number)) + return $this->response(false, array('msg' => 'Number is empty.')); + + require_once dirname(__FILE__) . '/../lib/admin.defines.php'; + require_once dirname(__FILE__) . '/../lib/Class.RateEngine.php'; + + $A2B->DBHandle = DbConnect(); + $A2B->set_instance_table(new Table()); + $A2B->cardnumber = $username; + if (!$A2B->callingcard_ivr_authenticate_light($error_msg, $balance)) + return $this->response(false, array('msg' => $error_msg)); + + $RateEngine = new RateEngine(); + $RateEngine->webui = 0; + + $A2B->agiconfig['accountcode'] = $A2B->cardnumber ; + $A2B->agiconfig['use_dnid'] = 1; + $A2B->agiconfig['say_timetocall'] = 0; + $A2B->dnid = $A2B ->destination = $number; + if ($A2B->removeinterprefix) $A2B->destination = $A2B->apply_rules($A2B->destination); + + $resfindrate = $RateEngine->rate_engine_findrates($A2B, $A2B->destination, $card['tariff']); + if (!$resfindrate) + return $this->response(false, array('msg' => 'No matching rate found.')); + + $res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit); + + if (!is_array($RateEngine->ratecard_obj) || !count($RateEngine->ratecard_obj)) + return $this->response(false, array('msg' => 'No matching rate found.')); + + $rate = $RateEngine->ratecard_obj[0]; + + return $this->response(true, array('rate' => $rate['rateinitial'], 'currency' => $this->base_currency, 'duration' => $rate['timeout'])); + } + + public function voucher_activate() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $voucher_id = $this->api->escape($this->api->getQueryParam('voucher_id', '')); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + $sql = "select * from cc_voucher where expirationdate >= CURRENT_TIMESTAMP AND activated='t' AND voucher='$voucher_id' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Voucher record not found.')); + + $voucher = $data[0]; + + if (!array_key_exists(strtolower($voucher['currency']), $this->currencies)) + return $this->response(false, array('msg' => 'Voucher currency is invalid.')); + + $amount = $this->convertCurrency($voucher['credit'], $voucher['currency']); + if ($amount <= 0) + return $this->response(false, array('msg' => 'Invalid amount.')); + + $sql = "update cc_voucher set activated = 'f', usedcardnumber = '$username', usedate = now() where voucher = '$voucher_id' limit 1"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot activate voucher.')); + + $sql = "update cc_card set credit = credit + '$amount' where username = '$username'"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot add balance.')); + + return $this->card_balance(); + } + + public function card_balance_add() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $amount = floatval($this->api->getQueryParam('amount', 0)); + $currency = $this->api->escape($this->api->getQueryParam('currency', $this->base_currency)); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + if (!array_key_exists(strtolower($currency), $this->currencies)) + return $this->response(false, array('msg' => 'Currency is invalid.')); + + $amount = $this->convertCurrency($amount, $currency); + + if ($amount <= 0) + return $this->response(false, array('msg' => 'Invalid amount.')); + + $sql = "insert into cc_logrefill set credit = '$amount', card_id = '{$card['id']}', description = 'oneworld refill', refill_type = '0', added_invoice = '0'"; + $data = $this->api->query($sql); + if (!isset($data['insert_id']) || !$result['insert_id']) + $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot add refill record.')); + + $sql = "update cc_card set credit = credit + '$amount' where username = '$username'"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot add balance.')); + + return $this->card_balance(); + } + + public function did_find() { + $country = $this->api->escape($this->api->getQueryParam('country', '')); + $prefix = $this->api->escape($this->api->getQueryParam('prefix', '')); + $max_rate = floatval($this->api->getQueryParam('max_rate', 0)); + + $sql = "select d.id, c.countryname, d.did, d.billingtype, d.fixrate, d.selling_rate from cc_did d left join cc_country c on c.id = d.id_cc_country where d.activated = '1' and d.reserved = '0' and d.iduser = '0'"; + if (strlen($country)) { + $sql .= " and lower(c.countryname) like '%" . strtolower($country) . "%'"; + } + if (strlen($prefix)) { + $sql .= " and d.did like '" . $prefix . "%'"; + } + if ($max_rate) { + $sql .= " and d.fixrate <= '" . $max_rate . "'"; + } + $sql .= " order by d.did asc"; + + $data = $this->api->query($sql); + + return $this->response(true, array('data' => $data)); + } + + public function did_list() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + $sql = "select d.id, c.countryname, d.did, d.billingtype, d.fixrate, d.selling_rate from cc_did d left join cc_country c on c.id = d.id_cc_country where d.activated = '1' and d.reserved = '1' and d.iduser = '{$card['id']}'"; + $data = $this->api->query($sql); + + return $this->response(true, array('data' => $data)); + } + + public function did_buy() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $destination = $this->api->escape($this->api->getQueryParam('destination', '')); + $did_id = intval($this->api->getQueryParam('did_id', 0)); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + $sql = "select * from cc_did where id = '$did_id' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'DID record not found.')); + + $did = $data[0]; + + if ($did['activated'] != '1' || $did['iduser'] != '0' || $did['reserved'] != '0') + return $this->response(false, array('msg' => 'Bad DID record.')); + + if ($did['billingtype'] < 2 && $card['credit'] < $did['fixrate']) + return $this->response(false, array('msg' => 'No enough balance.')); + + // update DID + $sql = "update cc_did set iduser = '{$card['id']}', reserved = '1' where id = '$did_id' limit 1"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot assign DID.')); + + // update cc_charge + $sql = "insert into cc_charge set id_cc_card = '{$card['id']}', amount = '{$did['fixrate']}', chargetype = '2', id_cc_did = '$did_id'"; + $data = $this->api->query($sql); + if (!isset($data['insert_id']) || !$data['insert_id']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot create charge record.')); + + // update cc_card + $sql = "update cc_card set credit = credit - '{$did['fixrate']}' where id = '{$card['id']}' limit 1"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot deduct balance.')); + + // update cc_did_use previous record + $sql = "select * from cc_did_use where id_did = '$did_id' and activated = '0' limit 1"; + $data = $this->api->query($sql); + if (count($data)) { + $did_use = $data[0]; + $sql = "update cc_did_use set releasedate = now() where id = '{$did_use['id']}' limit 1"; + $this->api->query($sql); + } + + // update cc_did_use with new data + $sql = "insert into cc_did_use set activated = '1', id_cc_card = '{$card['id']}', id_did = '$did_id', month_payed = '1'"; + $data = $this->api->query($sql); + if (!isset($data['insert_id']) || !$data['insert_id']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot create DID use record.')); + + // adding default voip destination + if (strlen($destination)) { + $sql = "insert into cc_did_destination set activated = '1', id_cc_card = '{$card['id']}', id_cc_did = '$did_id', destination = '$destination', voip_call = '1', validated = '1', priority = '0'"; + $data = $this->api->query($sql); + if (!isset($data['insert_id']) || !$data['insert_id']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot create DID destination record.')); + } + + return $this->response(true); + } + + public function did_release() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $did_id = intval($this->api->getQueryParam('did_id', 0)); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + $sql = "select * from cc_did where id = '$did_id' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'DID record not found.')); + + $did = $data[0]; + + if ($did['iduser'] != $card['id']) + return $this->response(false, array('msg' => 'Bad DID record.')); + + // update DID + $sql = "update cc_did set iduser = '0', reserved = '0' where id = '$did_id' limit 1"; + $data = $this->api->query($sql); + if (!isset($data['affected_rows']) || !$data['affected_rows']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot release DID.')); + + // update cc_did_use previous record + $sql = "select * from cc_did_use where id_did = '$did_id' and activated = '1' limit 1"; + $data = $this->api->query($sql); + if (count($data)) { + $did_use = $data[0]; + $sql = "update cc_did_use set releasedate = now() where id = '{$did_use['id']}' limit 1"; + $this->api->query($sql); + } + + // update cc_did_use with new data + $sql = "insert into cc_did_use set activated = '0', id_did = '$did_id'"; + $data = $this->api->query($sql); + if (!isset($data['insert_id']) || !$data['insert_id']) + return $this->response(false, array('msg' => isset($data['error']) ? $data['error'] : 'Cannot create DID use record.')); + + // remove destinations + $sql = "delete from cc_did_destination where id_cc_did = '$did_id'"; + $this->api->query($sql); + + return $this->response(true); + } + + /** + * Creates new conference with unique N digit number, minimum 5 + * Requires an asterisk DB available with "meetme" table, extconfig should be configured on asterisk! + */ + public function conference_create() { + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $pin = $this->api->escape($this->api->getQueryParam('pin', '')); + $length = max(intval($this->api->getQueryParam('length', 6)), 5); + $response = ""; + + // meetme table location + $database = "asterisk"; + $table = "meetme"; + + // get next incremental ID + $sql = "select AUTO_INCREMENT id from information_schema.tables where table_name = '$table' and table_schema = '$database'"; + $data = $this->api->query($sql); + $next_id = count($data) ? $data[0]['id'] : 1; + + // generate padding + $padding = ""; + for ($i = 0; $i < $length - strlen($next_id); $i++) + $padding .= rand(0, 9); + + // generating confno + $confno = $next_id . $padding; + + $fields = array( + "confno = '$confno'", + "pin = '$pin'", + "opts = 'MA'", + "owner = '$username'", + "starttime = now()" + ); + $sql = "insert into $database.$table set " . join(', ', $fields); + + try { + $result = $this->api->query($sql); + $response = (isset($result['insert_id']) && $result['insert_id'] > 0) ? $this->response(true, array('confno' => $confno)) : $this->response(false, array('msg' => "Cannot create conference")); + } catch (Exception $e) { + $response = $this->response(false, array('msg' => $e->getMessage())); + } + + return $response; + } + + public function callback_create() { + $lib = dirname(__FILE__) . '/../lib'; + + define ("FSROOT", substr($lib,0,-3)); + + require_once "$lib/Misc.php"; + require_once "$lib/interface/constants.php"; + require_once "$lib/Class.A2Billing.php"; + require_once "$lib/adodb/adodb.inc.php"; + require_once "$lib/Class.Table.php"; + require_once "$lib/Class.Connection.php"; + require_once "$lib/Class.Realtime.php"; + require_once "$lib/Class.RateEngine.php"; + + $A2B = new A2Billing(); + + // LOAD THE CONFIGURATION + $res_load_conf = $A2B -> load_conf($agi, A2B_CONFIG_DIR."a2billing.conf", 1); + if (!$res_load_conf) + return $this->response(false, array('msg' => 'Cannot load A2B config')); + + require_once "$lib/common.defines.php"; + + $username = $this->api->escape($this->api->getQueryParam('username', '')); + $number = $this->api->getQueryParam('number', ''); + $destination = $this->api->getQueryParam('destination', ''); + + $sql = "select * from cc_card where username = '$username' limit 1"; + $data = $this->api->query($sql); + if (!count($data)) + return $this->response(false, array('msg' => 'Billing record not found.')); + + $card = $data[0]; + + if (strlen($number) < 6) + return $this->response(false, array('msg' => 'Bad number "' . $number . '"')); + + $A2B -> DBHandle = DbConnect(); + $instance_table = new Table(); + $A2B -> set_instance_table ($instance_table); + $A2B -> cardnumber = $username; + + if ($A2B -> callingcard_ivr_authenticate_light ($error_msg)) { + + $RateEngine = new RateEngine(); + $RateEngine -> webui = 0; + // LOOKUP RATE : FIND A RATE FOR THIS DESTINATION + + $A2B -> agiconfig['accountcode']=$username; + $A2B -> agiconfig['use_dnid']=1; + $A2B -> agiconfig['say_timetocall']=0; + $A2B -> extension = $A2B -> dnid = $A2B -> destination = $username; + + $resfindrate = $RateEngine->rate_engine_findrates($A2B, $username, $card["tariff"]); + + // IF FIND RATE + if ($resfindrate!=0) { + $res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit); + if ($res_all_calcultimeout) { + + // MAKE THE CALL + if ($RateEngine -> ratecard_obj[0][34]!='-1') { + $usetrunk = 34; + $usetrunk_failover = 1; + $RateEngine -> usedtrunk = $RateEngine -> ratecard_obj[0][34]; + } else { + $usetrunk = 29; + $RateEngine -> usedtrunk = $RateEngine -> ratecard_obj[0][29]; + $usetrunk_failover = 0; + } + + $prefix = $RateEngine -> ratecard_obj[0][$usetrunk+1]; + $tech = $RateEngine -> ratecard_obj[0][$usetrunk+2]; + $ipaddress = $RateEngine -> ratecard_obj[0][$usetrunk+3]; + $removeprefix = $RateEngine -> ratecard_obj[0][$usetrunk+4]; + $timeout = $RateEngine -> ratecard_obj[0]['timeout']; + $failover_trunk = $RateEngine -> ratecard_obj[0][40+$usetrunk_failover]; + $addparameter = $RateEngine -> ratecard_obj[0][42+$usetrunk_failover]; + + $destination = $username; + if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) $destination= substr($destination, strlen($removeprefix)); + + $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%' ); + $ipaddress = str_replace("%cardnumber%", $A2B->cardnumber, $ipaddress); + $ipaddress = str_replace("%dialingnumber%", $prefix.$destination, $ipaddress); + + $dialparams = ''; + if ($pos_dialingnumber !== false) { + $dialstr = "$tech/$ipaddress".$dialparams; + } else { + if ($A2B->agiconfig['switchdialcommand'] == 1) { + $dialstr = "$tech/$prefix$destination@$ipaddress".$dialparams; + } else { + $dialstr = "$tech/$ipaddress/$prefix$destination".$dialparams; + } + } + + //ADDITIONAL PARAMETER %dialingnumber%, %cardnumber% + if (strlen($addparameter)>0) { + $addparameter = str_replace("%cardnumber%", $A2B->cardnumber, $addparameter); + $addparameter = str_replace("%dialingnumber%", $prefix.$destination, $addparameter); + $dialstr .= $addparameter; + } + + $channel= $dialstr; + $exten = $number; + $context = $A2B -> config["callback"]['context_callback']; + $id_server_group = $A2B -> config["callback"]['id_server_group']; + $priority=1; + $timeout = $A2B -> config["callback"]['timeout']*1000; + $application=''; + $callerid = $username; // was before: $A2B -> config["callback"]['callerid']; + $account = $username; + + $uniqueid = MDP_NUMERIC(5).'-'.MDP_STRING(7); + $status = 'PENDING'; + $server_ip = 'localhost'; + $num_attempt = 0; + + if ($A2B->config['global']['asterisk_version'] == "1_2" || $A2B->config['global']['asterisk_version'] == "1_4") { + $variable = "CALLED=$username|CALLING=$number|CBID=$uniqueid|LEG=".$A2B->cardnumber; + } else { + $variable = "CALLED=$username,CALLING=$number,CBID=$uniqueid,LEG=".$A2B->cardnumber; + } + + $QUERY = " INSERT INTO cc_callback_spool (uniqueid, status, server_ip, num_attempt, channel, exten, context, priority," . + " variable, id_server_group, callback_time, account, callerid, timeout ) " . + " VALUES ('$uniqueid', '$status', '$server_ip', '$num_attempt', '$channel', '$exten', '$context', '$priority'," . + " '$variable', '$id_server_group', now(), '$account', '$callerid', '30000')"; + $res = $A2B -> DBHandle -> Execute($QUERY); + + if (!$res) { + return $this->response(false, array('msg' => 'Cannot insert the callback request in the spool!')); + } else { + return $this->response(true); + } + } else { + return $this->response(false, array('msg' => 'You don t have enough credit to call you back!')); + } + } else { + return $this->response(false, array('msg' => 'There is no route to call back your phonenumber!')); + } + } else { + return $this->response(false, array('msg' => strip_tags($error_msg))); + } + } + +} diff --git a/webservice/api/Voipru.php b/webservice/api/Voipru.php new file mode 100755 index 000000000..c05108399 --- /dev/null +++ b/webservice/api/Voipru.php @@ -0,0 +1,162 @@ +api = $api; + + $api->registerApi('ping', array($this, 'ping')); + $api->registerApi('voipru_account_create', array($this, 'accountCreate')); + $api->registerApi('voipru_apply_config', array($this, 'applySipConfig')); + $api->registerApi('voipru_card_create', array($this, 'createCard')); + $api->registerApi('voipru_sip_create', array($this, 'createSip')); + } + + private function response($success, $params = array()) { + return array_merge(array('success' => $success), $params); + } + + private function getAllQueryParams($prefix) { + $data = array(); + foreach ($_REQUEST as $key => $value) { + if (preg_match("/^$prefix(.+)/i", $key, $matches)) { + $data[$matches[1]] = $value; + } + } + return $data; + } + + public function ping() { + return $this->response(true, array('msg' => 'pong')); + } + + public function applySipConfig() { + if (!USE_REALTIME) { + ob_start(); + $instance_realtime = new Realtime(); + $instance_realtime->create_trunk_config_file('sip'); + $output = ob_get_clean(); + + if (!file_exists(BUDDY_SIP_FILE)) { + return $this->response(false, array('msg' => 'File is not created, check rights')); + } else if (strlen($output)) { + return $this->response(false, array('msg' => $output)); + } + + $as = new AGI_AsteriskManager(); + if ($as->connect(MANAGER_HOST, MANAGER_USERNAME, MANAGER_SECRET)) { + $res = $as->Command('sip reload'); + $as->disconnect(); + } + } + + return $this->response(true); + } + + public function createCard() { + $data = $this->getAllQueryParams('card_'); + if (!count($data)) + return $this->response(false, array('msg' => "Data array expected, param prefix is 'card_'")); + + $values = array_merge(array( + 'username' => gen_card(), + 'useralias' => null, + 'uipass' => null, + 'tariff' => null, + 'credit' => '0', + 'activated' => 't', + 'status' => '1', + 'lastname' => '', + 'firstname' => '', + 'address' => '', + 'city' => '', + 'state' => '', + 'country' => '', + 'zipcode' => '', + 'phone' => '', + 'email' => '', + 'fax' => '', + 'typepaid' => '0', + 'loginkey' => '', + 'email_notification' => '', + 'company_name' => '', + 'company_website' => '', + 'traffic_target' => '0', + 'simultaccess' => '0', + 'max_concurrent' => '1', + 'redial' => '', + 'tag' => 'voipru' + ), $data); + + $fields = array(); + foreach ($values as $col => $value) + $fields[] = "$col = '$value'"; + + $response = null; + try { + $sql = "insert into cc_card set " . join(', ', $fields); + $result = $this->api->query($sql); + if (isset($result['insert_id']) && $result['insert_id'] > 0) { + $sql = "select * from cc_card where id = '{$result['insert_id']}'"; + $data = $this->api->query($sql); + $response = count($data) > 0 ? $this->response(true, array('card' => $data[0])) : $this->response(false, array('msg' => "Cannot find card by id {{$result['insert_id']}}")); + } else { + $response = $this->response(false, array('msg' => "Cannot create card")); + } + } catch (Exception $e) { + $response = $this->response(false, array('msg' => $e->getMessage())); + } + + return $response; + } + + public function createSip() { + $data = $this->getAllQueryParams('sip_'); + if (!count($data)) + return $this->response(false, array('msg' => "Data array expected, param prefix is 'sip_'")); + + if (!isset($data['card_id'])) + return $this->response(false, array('msg' => "Parameter 'sip_card_id' expected")); + + if (!isset($data['secret'])) + return $this->response(false, array('msg' => "Parameter 'sip_secret' expected")); + + $sql = "select * from cc_card where id = '{$data['card_id']}' limit 1"; + $records = $this->api->query($sql); + if (!count($records)) + return $this->response(false, array('msg' => 'Card record not found')); + + $instance_realtime = new Realtime(); + $instance_realtime->insert_voip_config(1, 0, $data['card_id'], $records[0]['username'], $data['secret']); + + $sql = "select * from cc_sip_buddies where id_cc_card = '{$data['card_id']}' limit 1"; + $records = $this->api->query($sql); + if (!count($records)) + return $this->response(false, array('msg' => 'SIP buddy record not found')); + + return $this->response(true, array('sip' => $records[0])); + } + + public function accountCreate() { + $response = $this->createCard(); + if ($response['success'] && $response['card']) { + $_REQUEST['sip_card_id'] = $response['card']['id']; + if (!isset($_REQUEST['sip_secret'])) + $_REQUEST['sip_secret'] = MDP(10); + $response = $this->createSip(); + if ($response['success']) { + $response = $this->applySipConfig(); + } + } + return $response; + } +} diff --git a/webservice/api/client/ApiClient.php b/webservice/api/client/ApiClient.php new file mode 100755 index 000000000..259b66657 --- /dev/null +++ b/webservice/api/client/ApiClient.php @@ -0,0 +1,61 @@ +url = $url . '?api_security_key=' . md5($api_security_key); + $this->defaultFormat = $defaultFormat; + } + + public function __call($name, $arguments) { + $params = is_array($arguments) && count($arguments) > 0 && is_array($arguments[0]) ? $arguments[0] : array(); + $format = is_array($arguments) && count($arguments) > 1 ? $arguments[1] : null; + + return $this->execute($name, $params, $format); + } + + public function execute($method, $params = array(), $format = null) { + $strParams = array(); + if (is_array($params)) { + foreach ($params as $key => $value) { + $strParams[] = "$key=" . urlencode($value); + } + } + + $format = is_null($format) ? $this->defaultFormat : $format; + $url = $this->url . '&api_format=' . $format . '&api_method=' . $method . '&' . join('&', $strParams); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $result = curl_exec($ch); + curl_close($ch); + + return $this->formatResult($result, $format); + } + + /** + * Decodes result + * + * @param mixed $data + * @param string $format + * @return mixed + */ + private function formatResult($data, $format) { + $result = $data; + switch (strtolower($format)) { + case 'json': + $result = json_decode($data, true); + break; + } + return $result; + } + +} diff --git a/webservice/display_ratecard.php b/webservice/display_ratecard.php index 965d795e8..c39067edb 100644 --- a/webservice/display_ratecard.php +++ b/webservice/display_ratecard.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing @@ -132,7 +132,7 @@ $choose_currency = $currency_select; } if (!isset ($css_url) || strlen($css_url) == 0) - $css_url = substr("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'], 0, strlen("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) - 31) . "webservice/css/api_ratecard.css"; + $css_url = substr("http://" . $_SERVER['HTTP_HOST'] . filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL), 0, strlen("http://" . $_SERVER['HTTP_HOST'] . filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)) - 31) . "webservice/css/api_ratecard.css"; if (!isset ($merge_form) || strlen($merge_form) == 0) $merge_form = 0; diff --git a/webservice/sample_display_ratecard.php b/webservice/sample_display_ratecard.php index 45d24c388..7f960f809 100644 --- a/webservice/sample_display_ratecard.php +++ b/webservice/sample_display_ratecard.php @@ -8,7 +8,7 @@ * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. * - * @copyright Copyright (C) 2004-2012 - Star2billing S.L. + * @copyright Copyright (C) 2004-2015 - Star2billing S.L. * @author Belaid Arezqui * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing