コード例 #1
0
ファイル: SqlProvider.class.php プロジェクト: prezeskk/lms
 public static function getInstance()
 {
     if ($instance === NULL) {
         self::$instance = new SqlProvider();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: lms-billing.php プロジェクト: prezeskk/lms
    trigger_error($ex->getMessage(), E_USER_WARNING);
    // can't working without database
    die("Fatal error: cannot connect to database!" . PHP_EOL);
}
/* ****************************************
   Good place for config value analysis
   ****************************************/
// Include required files (including sequence is important)
require_once LIB_DIR . DIRECTORY_SEPARATOR . 'common.php';
require_once LIB_DIR . DIRECTORY_SEPARATOR . 'language.php';
include_once LIB_DIR . DIRECTORY_SEPARATOR . 'definitions.php';
setlocale(LC_NUMERIC, 'en_US');
$options['action'] = isset($options['action']) ? $options['action'] : '';
define('VOIP_CACHE_DIR', isset($options['cache-dir']) ? $options['cache-dir'] : SYS_DIR . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'voip' . DIRECTORY_SEPARATOR . 'cache');
$estimate = new Estimate(SqlProvider::getInstance());
$db_buffor = new VoipDbBuffor(SqlProvider::getInstance());
switch (strtolower($options['action'])) {
    case 'estimate':
        if (!isset($options['caller'])) {
            die("Caller phone number isn't set.");
        }
        if (!isset($options['callee'])) {
            die("Callee phone number isn't set.");
        }
        try {
            $call_time = $estimate->getMaxCallTime($options['caller'], $options['callee']);
            // if debug mode is set print value else change to miliseconds before print
            echo array_key_exists('debug', $options) ? $call_time . PHP_EOL : $call_time * 1000;
        } catch (Exception $e) {
            echo $e->getMessage();
        }