Exemple #1
0
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_once "libs/xajax/xajax.inc.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoDeleteModule.class.php";
    global $arrConf;
    //include lang local module
    global $arrLangModule;
    $lang = get_language();
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once $lang_file;
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    require_once 'libs/paloSantoDB.class.php';
    $pDB_acl = new paloDB($arrConf['elastix_dsn']['acl']);
    if (!empty($pDB_acl->errMsg)) {
        echo "ERROR DE DB: {$pDB_acl->errMsg} <br>";
    }
    $pDB_menu = new paloDB($arrConf['elastix_dsn']['menu']);
    if (!empty($pDB_menu->errMsg)) {
        echo "ERROR DE DB: {$pDB_menu->errMsg} <br>";
    }
    $xajax = new xajax();
    $xajax->registerFunction("mostrar_menu");
    $xajax->processRequests();
    $content = $xajax->printJavascript("libs/xajax/");
    $delete = isset($_POST['delete']) ? $_POST['delete'] : '';
    if ($delete != '') {
        $accion = 'delete_module';
    } else {
        $accion = "report_delete_module";
    }
    switch ($accion) {
        case 'delete_module':
            $content .= delete_module($smarty, $module_name, $local_templates_dir, $arrLangModule, $pDB_acl, $pDB_menu);
            break;
        default:
            $content .= report_delete_module($smarty, $module_name, $local_templates_dir, $arrLangModule, $pDB_acl);
            break;
    }
    return $content;
}
            }
        }
        //Delete ACP Management Modules
        $acp_management_modules = array('ACP_GARAGE_BUSINESS', 'ACP_GARAGE_CATEGORIES', 'ACP_GARAGE_MODELS', 'ACP_GARAGE_PRODUCTS', 'ACP_GARAGE_QUOTAS', 'ACP_GARAGE_TOOLS', 'ACP_GARAGE_TRACK', 'ACP_GARAGE_MANAGEMENT');
        for ($i = 0, $count = sizeof($acp_management_modules); $i < $count; $i++) {
            $module = get_module('acp', $acp_management_modules[$i]);
            if (!empty($module)) {
                delete_module('acp', $module);
            }
        }
        //Delete ACP Settings Modules
        $acp_settings_modules = array('ACP_GARAGE_GENERAL_SETTINGS', 'ACP_GARAGE_MENU_SETTINGS', 'ACP_GARAGE_INDEX_SETTINGS', 'ACP_GARAGE_IMAGES_SETTINGS', 'ACP_GARAGE_QUARTERMILE_SETTINGS', 'ACP_GARAGE_DYNORUN_SETTINGS', 'ACP_GARAGE_TRACK_SETTINGS', 'ACP_GARAGE_INSURANCE_SETTINGS', 'ACP_GARAGE_BUSINESS_SETTINGS', 'ACP_GARAGE_RATING_SETTINGS', 'ACP_GARAGE_GUESTBOOK_SETTINGS', 'ACP_GARAGE_PRODUCT_SETTINGS', 'ACP_GARAGE_SERVICE_SETTINGS', 'ACP_GARAGE_BLOG_SETTINGS', 'ACP_GARAGE_SETTINGS');
        for ($i = 0, $count = sizeof($acp_settings_modules); $i < $count; $i++) {
            $module = get_module('acp', $acp_settings_modules[$i]);
            if (!empty($module)) {
                delete_module('acp', $module);
            }
        }
        $modules->remove_cache_file();
        $template->assign_vars(array('MESSAGE_TITLE' => 'MODULES DELETED', 'MESSAGE_TEXT' => 'UCP, MCP & ACP Modules Deleted'));
        break;
}
page_footer();
function create_modules($module_data)
{
    global $modules;
    for ($i = 0, $count = sizeof($module_data); $i < $count; $i++) {
        if ($module_data[$i]['module_class'] == 'acp') {
            $modules->module_class = 'acp';
        }
        if ($module_data[$i]['module_class'] == 'mcp') {
Exemple #3
0
}));
add_action(array('code' => 'ajax_install_module', 'rule' => 'admin_ajax', 'category' => 'admin', 'function' => function ($params = null) {
    if (isset($params['button']['pre']['value'])) {
        $params = $params['button']['pre']['value'];
    }
    if ($params && activate_module($params)) {
        echo ajax_make_res('reload', "Модуль {$params} успешно установлен", 'Успех!');
    } else {
        echo ajax_make_res('error', 'Произошла неизвестная ошибка', 'Ошибка!');
    }
}));
add_action(array('code' => 'ajax_delete_module', 'rule' => 'admin_ajax', 'category' => 'admin', 'function' => function ($params = null) {
    if (isset($params['button']['pre']['value'])) {
        $params = $params['button']['pre']['value'];
    }
    if ($params && delete_module($params, false)) {
        echo ajax_make_res('reload', "Модуль {$params} удалён с сохранением данных", 'Успех!');
    } else {
        echo ajax_make_res('error', 'Произошла неизвестная ошибка', 'Ошибка!');
    }
}));
add_action(array('code' => 'ajax_delete_full_module', 'rule' => 'admin_ajax', 'category' => 'admin', 'function' => function ($params = null) {
    if (isset($params['button']['pre']['value'])) {
        $params = $params['button']['pre']['value'];
    }
    if ($params && delete_module($params, true)) {
        echo ajax_make_res('reload', "Модуль {$params} полностью удалён", 'Успех!');
    } else {
        echo ajax_make_res('error', 'Произошла неизвестная ошибка', 'Ошибка!');
    }
}));