예제 #1
0
 * Use of this software implies aceptance of the mdb license agreement
 */
# I am using the comment /* @var $res PDO */ to get code completion on ZendIDE-5:
# "Best programmers are the lazy ones" :-)
# supported PDO:: constants by sqlite (complete this list).
# PDO::ATTR_SERVER_VERSION
# PDO::ATTR_ERRMODE
# PDO::ATTR_CASE
# PDO::ATTR_DRIVER_NAME
define('DB_AUTOINC', 'INTEGER');
define('NULLDATETIME', 0);
/* @todo: add a PDO specific constant for 'no date' */
if (!extension_loaded('pdo') && !load_extension('pdo')) {
    die("PDO extension not loaded");
}
if (!extension_loaded('pdo_sqlite') && !load_extension('pdo_sqlite')) {
    die("SQLite extension not loaded");
}
// Move this to a top library file?
function load_extension($ext_name)
{
    if (is_windows()) {
        $loaded = @dl($ext_name . '.dll');
    } else {
        $loaded = @dl($ext_name . '.so');
    }
    return $loaded;
}
function db_connect($host, $user, $pass, $dbname = '')
{
    global $mdb_res, $pdo_error;
예제 #2
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include elastix framework
    include_once "libs/paloSantoGrid.class.php";
    include_once "libs/paloSantoValidar.class.php";
    include_once "libs/paloSantoConfig.class.php";
    include_once "libs/misc.lib.php";
    include_once "libs/paloSantoForm.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoExtensionsBatch.class.php";
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrAMP = $pConfig->leer_configuracion(false);
    $dsnAsterisk = $arrAMP['AMPDBENGINE']['valor'] . "://" . $arrAMP['AMPDBUSER']['valor'] . ":" . $arrAMP['AMPDBPASS']['valor'] . "@" . $arrAMP['AMPDBHOST']['valor'] . "/asterisk";
    $pDB = new paloDB($dsnAsterisk);
    if (!empty($pDB->errMsg)) {
        $smarty->assign("mb_message", _tr('Error when connecting to database') . "<br/>" . $pDB->errMsg);
    }
    $pConfig = new paloConfig($arrAMP['ASTETCDIR']['valor'], "asterisk.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrAST = $pConfig->leer_configuracion(false);
    $content = "";
    $accion = getAction();
    //Sirve para todos los casos
    $smarty->assign("MODULE_NAME", $module_name);
    $smarty->assign("icon", "modules/{$module_name}/images/pbx_batch_of_extensions.png");
    $smarty->assign("SAVE", _tr('Save'));
    $smarty->assign("DOWNLOAD", _tr("Download Extensions"));
    $smarty->assign("label_file", _tr("File"));
    $smarty->assign("title", _tr("Extensions Batch"));
    $smarty->assign("title_module", _tr("Batch of Extensions"));
    $smarty->assign("HeaderFile", _tr("Header File Extensions Batch"));
    $smarty->assign("AboutUpdate", _tr("About Update Extensions Batch"));
    $html_input = "<input class='button' type='submit' name='delete_all' value='" . _tr('Delete All Extensions') . "' onClick=\" return confirmSubmit('" . _tr("Are you really sure you want to delete all the extensions in this server?") . "');\" />";
    $smarty->assign("DELETE_ALL", $html_input);
    switch ($accion) {
        case 'delete_all':
            delete_all_extention($smarty, $module_name, $local_templates_dir, $arrConf, $pDB, $arrAST, $arrAMP);
            $content = report_extension($smarty, $module_name, $local_templates_dir, $arrConf);
            break;
        case 'load_extension':
            $content = load_extension($smarty, $module_name, $local_templates_dir, $arrConf, $base_dir, $pDB, $arrAST, $arrAMP);
            break;
        case 'download_csv':
            download_extensions($pDB);
            break;
        default:
            $content = report_extension($smarty, $module_name, $local_templates_dir, $arrConf);
            break;
    }
    return $content;
}