Example #1
0
        }
        $remove_remarks = "remove_remarks";
        $delimiter = ";";
        $sql_query = @file_get_contents($dbms_schema);
        $remove_remarks($sql_query);
        $sql_query = split_sql_file($sql_query, $delimiter);
        foreach ($sql_query as $sql) {
            $db->execute($sql);
        }
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "db_initial_values.php";
        foreach ($sql_ary as $sql) {
            $db->execute($sql);
        }
        write_config_file();
        $rename = write_functions_file();
        update_config_file();
        $success = true;
    }
    if (!$success) {
        $next = array('0' => 'Install', '1' => 'onClick="document.forms[\'final_form\'].submit();"');
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout" . DIRECTORY_SEPARATOR . "pages_final_confirm.php";
    }
    if ($success) {
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "includes/functions_php.php";
        $header = htmlspecialchars('<link type="text/css" rel="stylesheet" id="arrowchat_css" media="all" href="' . $_SESSION['config_path'] . 'external.php?type=css" charset="utf-8" />
<script type="text/javascript" src="' . $_SESSION['config_path'] . 'includes/js/jquery.js"></script>
<script type="text/javascript" src="' . $_SESSION['config_path'] . 'includes/js/jquery-ui.js"></script>');
        $footer = htmlspecialchars('<script type="text/javascript" src="' . $_SESSION['config_path'] . 'external.php?type=djs" charset="utf-8"></script>
<script type="text/javascript" src="' . $_SESSION['config_path'] . 'external.php?type=js" charset="utf-8"></script>');
        $next = array('0' => 'Go to Admin Panel', '1' => 'onClick="window.location.href=\'../admin/\';"');
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout" . DIRECTORY_SEPARATOR . "pages_final.php";
Example #2
0
function create_profil($new_profil, $lbl_profil, $ref_profil)
{
    $new_value = read_profil_file($ref_profil);
    $new_value['INFO']['NAME'] = $lbl_profil;
    update_config_file($new_profil, $new_value, 'NO');
    //getcopy_config_file($protectedPost['ref_profil'],'YES',$protectedPost['new_profil']);
}
Example #3
0
/**
 * update 1.0.x to 1.1.0 (DB v14 to DB v15)
 *
 * - clasmap.ser
 * - config.ini
 * - remove from mantis menu
 * - mantis-plugins if mantis v1.3
 * - DB
 */
function update_v14_to_v15()
{
    echo "- Update classmap.ser<br>";
    try {
        Tools::createClassMap();
    } catch (Exception $e) {
        echo "<span class='error_font'>Could not create classmap: " . $e->getMessage() . "</span><br/>";
        exit;
    }
    echo "- Add [mantis] 'status_enum_workflow' to config.ini<br>";
    // reload mantis config files
    $path_config_defaults_inc = Constants::$mantisPath . DIRECTORY_SEPARATOR . "config_defaults_inc.php";
    $path_core_constant_inc = Constants::$mantisPath . DIRECTORY_SEPARATOR . "core" . DIRECTORY_SEPARATOR . "constant_inc.php";
    $path_mantis_config = Constants::$mantisPath;
    if (is_dir(Constants::$mantisPath . DIRECTORY_SEPARATOR . 'config')) {
        $path_mantis_config .= DIRECTORY_SEPARATOR . 'config';
        // mantis v1.3 or higher
    }
    $path_mantis_config_inc = $path_mantis_config . DIRECTORY_SEPARATOR . 'config_inc.php';
    $path_custom_constants = $path_mantis_config . DIRECTORY_SEPARATOR . 'custom_constants_inc.php';
    global $g_status_enum_workflow;
    include_once $path_core_constant_inc;
    include_once $path_custom_constants;
    include_once $path_config_defaults_inc;
    include_once $path_mantis_config_inc;
    // set status_enum_workflow
    Constants::$status_enum_workflow = $g_status_enum_workflow;
    if (!is_array(Constants::$status_enum_workflow)) {
        echo "<span class='error_font'>Could not retrieve status_enum_workflow from Mantis config files</span><br/>";
        exit;
    }
    // write new config file
    if (!update_config_file()) {
        // ask for manual update
        echo "<span class='error_font'>Could not update config.ini</span><br/>";
        exit;
    }
    // if Mantis 1.3, plugins must be updated
    if (Tools::isMantisV1_3()) {
        echo "- Remove 'CodevTT' from Mantis main menu (CodevTT v1.0.x is incompatible with Mantis v1.3.x)<br>";
        $query = "DELETE FROM `mantis_config_table` WHERE config_id = 'main_menu_custom_options'";
        $result = execQuery($query);
        echo "- Install Mantis plugin: CodevTT (for mantis v1.3.x)<br>";
        if (checkMantisPluginDir()) {
            $errStr = installMantisPlugin('CodevTT', true);
            if (NULL !== $errStr) {
                echo "<span class='error_font'>Please update 'CodevTT' mantis-plugin manualy</span><br/>";
                echo "<script type=\"text/javascript\">console.error(\"{$errStr}\");</script>";
            }
            echo "- Install Mantis plugin: FilterBugList (for mantis v1.3.x)<br>";
            $errStr = installMantisPlugin('FilterBugList', true);
            if (NULL !== $errStr) {
                echo "<span class='error_font'>Please update 'FilterBugList' mantis-plugin manualy</span><br/>";
                echo "<script type=\"text/javascript\">console.error(\"{$errStr}\");</script>";
            }
        }
    }
    // execute the SQL script
    $sqlScriptFilename = Constants::$codevRootDir . '/install/codevtt_update_v14_v15.sql';
    if (!file_exists($sqlScriptFilename)) {
        echo "<span class='error_font'>SQL script not found:{$sqlScriptFilename}</span><br/>";
        exit;
    }
    echo "- Execute SQL script: {$sqlScriptFilename}<br>";
    $retCode = Tools::execSQLscript2($sqlScriptFilename);
    if (0 != $retCode) {
        echo "<span class='error_font'>Could not execSQLscript: {$sqlScriptFilename}</span><br/>";
        exit;
    }
}
Example #4
0
function edit_config()
{
    global $input;
    if (isset($input['confirm']) && !empty($input['confirm'])) {
        $allow_recorder = $input['recording_enabled'] == 'on';
        $add_users = $input['add_users_enabled'] == 'on';
        $pwd_storage = $input['password_storage_enabled'] == 'on';
        $use_course_name = $input['courses_by_name'] == 'on';
        $use_user_name = $input['users_by_name'] == 'on';
        update_config_file($allow_recorder, $add_users, $pwd_storage, $use_course_name, $use_user_name);
        $alert = '<div class="alert alert-success">' . template_get_message('save_successful', get_lang()) . '</div>';
    }
    $params = parse_config_file();
    //update_config_file(false, true, true);
    include template_getpath('div_main_header.php');
    include template_getpath('div_edit_config.php');
    include template_getpath('div_main_footer.php');
}
function admin_profil($form)
{
    global $protectedPost, $l, $pages_refs;
    $yes_no = array('YES' => $l->g(455), 'NO' => $l->g(454));
    $info_field = array('NAME' => array('INFO' => array('LBL' => $l->g(1153) . ": ", 'VALUE' => '')), 'GUI' => array('RESTRICTION' => array('LBL' => $l->g(1154) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF_ACTIVATE' => array('RESTRICTION' => array('LBL' => $l->g(1158) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF_VISIBLE' => array('RESTRICTION' => array('LBL' => $l->g(1301) . ": ", 'VALUE' => $yes_no)), 'EXPORT_XML' => array('RESTRICTION' => array('LBL' => $l->g(1305), 'VALUE' => $yes_no)), 'WOL' => array('RESTRICTION' => array('LBL' => $l->g(1281) . ": ", 'VALUE' => $yes_no)), 'MACADD' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1159) . ": ", 'VALUE' => $yes_no)), 'SERIAL' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1160) . ": ", 'VALUE' => $yes_no)), 'IPDISCOVER' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1161) . ": ", 'VALUE' => $yes_no), 'CONFIGURATION' => array('LBL' => $l->g(1172) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF' => array('CONFIGURATION' => array('LBL' => $l->g(1162) . ": ", 'VALUE' => $yes_no)), 'CONFIG' => array('CONFIGURATION' => array('LBL' => $l->g(1163) . ": ", 'VALUE' => $yes_no)), 'GROUPS' => array('CONFIGURATION' => array('LBL' => $l->g(1164) . ": ", 'VALUE' => $yes_no)), 'CONSOLE' => array('CONFIGURATION' => array('LBL' => $l->g(1165) . ": ", 'VALUE' => $yes_no)), 'ALERTE_MSG' => array('CONFIGURATION' => array('LBL' => $l->g(1166) . ": ", 'VALUE' => $yes_no)), 'ACCOUNTINFO' => array('CONFIGURATION' => array('LBL' => $l->g(1167) . ": ", 'VALUE' => $yes_no)), 'CHANGE_ACCOUNTINFO' => array('CONFIGURATION' => array('LBL' => $l->g(1168) . ": ", 'VALUE' => $yes_no)), 'CHANGE_USER_GROUP' => array('CONFIGURATION' => array('LBL' => $l->g(1169) . ": ", 'VALUE' => $yes_no)), 'MANAGE_PROFIL' => array('CONFIGURATION' => array('LBL' => $l->g(1170) . ": ", 'VALUE' => $yes_no)), 'MANAGE_USER_GROUP' => array('CONFIGURATION' => array('LBL' => $l->g(1171) . ": ", 'VALUE' => $yes_no)), 'MANAGE_SMTP_COMMUNITIES' => array('CONFIGURATION' => array('LBL' => $l->g(1205) . ": ", 'VALUE' => $yes_no)), 'DELETE_COMPUTERS' => array('CONFIGURATION' => array('LBL' => $l->g(1272) . ": ", 'VALUE' => $yes_no)));
    $lbl_cat = array('INFO' => $l->g(1173), 'PAGE_PROFIL' => $l->g(1174), 'RESTRICTION' => $l->g(1175), 'ADMIN_BLACKLIST' => $l->g(1176), 'CONFIGURATION' => $l->g(1177));
    if ($protectedPost['Valid_modif_profil']) {
        //read profil file
        $forprofil = read_profil_file($protectedPost['PROFILS']);
        //read all profil value
        $forall = read_config_file();
        //build new tab with new values
        foreach ($info_field as $if_name => $if_value) {
            foreach ($if_value as $if_cat => $if_val) {
                if (isset($protectedPost[$if_name]) and $protectedPost['cat'] == $if_cat) {
                    $new_value[$if_cat][$if_name] = $protectedPost[$if_name];
                } else {
                    $new_value[$if_cat][$if_name] = $forprofil[$if_cat][$if_name];
                }
            }
        }
        foreach ($forall['URL'] as $name => $value) {
            if (isset($protectedPost[$name]) and $protectedPost['cat'] == "PAGE_PROFIL") {
                $new_value["PAGE_PROFIL"][$name] = '';
            }
        }
        if (!isset($new_value['PAGE_PROFIL'])) {
            $new_value['PAGE_PROFIL'] = $forprofil['PAGE_PROFIL'];
        }
        update_config_file($protectedPost['PROFILS'], $new_value);
        msg_success($l->g(1274));
    }
    $array_profil = get_profile_labels();
    echo $l->g(1196) . ": " . show_modif($array_profil, "PROFILS", 2, $form);
    echo "<a href=\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_new_profil'] . "&head=1&form=" . $form . "\"><img src=image/plus.png></a>";
    if (isset($protectedPost['PROFILS']) and $protectedPost['PROFILS'] != '') {
        $forall = read_config_file();
        $forprofil = read_profil_file($protectedPost['PROFILS'], 'WRITE');
        if (is_array($forprofil) and is_array($forall)) {
            foreach ($forprofil as $key => $value) {
                if (isset($lbl_cat[$key])) {
                    $data_on[$key] = $lbl_cat[$key];
                }
            }
            onglet($data_on, $form, "cat", 10);
            if (isset($forprofil[$protectedPost['cat']]) and $protectedPost['cat'] != 'PAGE_PROFIL') {
                $name_field = array();
                $type_field = array();
                $tab_name = array();
                $value_field = array();
                foreach ($info_field as $if_name => $if_value) {
                    foreach ($if_value as $if_cat => $if_val) {
                        if ($protectedPost['cat'] == $if_cat) {
                            if (isset($forprofil[$if_cat][$if_name])) {
                                $protectedPost[$if_name] = $forprofil[$if_cat][$if_name];
                            }
                            array_push($name_field, $if_name);
                            array_push($tab_name, $if_val['LBL']);
                            if (is_array($if_val['VALUE'])) {
                                array_push($type_field, 2);
                                if (!isset($protectedPost[$if_name])) {
                                    array_push($if_val['VALUE'], '');
                                }
                                array_push($value_field, $if_val['VALUE']);
                            } else {
                                array_push($type_field, 0);
                                array_push($value_field, replace_language($forprofil[$if_cat][$if_name]));
                            }
                        }
                    }
                }
                $tab_typ_champ = show_field($name_field, $type_field, $value_field);
                tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, array('button_name' => 'modif_profil'));
            } elseif ($protectedPost['cat'] == 'PAGE_PROFIL') {
                $champs = "<table align=center><tr><td align=center>";
                $i = 0;
                ksort($forall['URL']);
                foreach ($forall['URL'] as $key => $value) {
                    $champs .= "<input type='checkbox' name='" . $key . "' id='" . $key . "' ";
                    if (isset($forprofil[$protectedPost['cat']][$key])) {
                        $champs .= " checked ";
                    }
                    $champs .= " ></td><td>" . $key . "</td><td align=center>";
                    $i++;
                    if ($i == 4) {
                        $champs .= "</td></tr><tr><td align=center>";
                        $i = 0;
                    }
                }
                $champs .= "</td></tr></table>";
                tab_modif_values($champs, array(), array(), array('button_name' => 'modif_profil'));
            }
        }
    }
}
                            $move_string = substr($file_content, $pos_start, $pos_end - $pos_start);
                            $searching[] = $move_to_start[$name_file][$i] . $move_start . $move_string . $move_end . $move_to_end[$name_file][$i];
                            $replacement[] = $move_to_start[$name_file][$i] . $move_to_end[$name_file][$i];
                            $searching[] = $move_get_start[$name_file][$i] . $move_get_end[$name_file][$i];
                            $replacement[] = $move_get_start[$name_file][$i] . $move_string . $move_get_end[$name_file][$i];
                        }
                    }
                    write_file($file_value, str_replace($searching, $replacement, $file_content));
                    unset($file_content, $searching, $replacement);
                }
            }
            //Execute uninstall script if exist
            if (file_exists('plugins/' . $mod_datadir . '/update_uninstall.php')) {
                require 'plugins/' . $mod_datadir . '/update_uninstall.php';
            }
            update_config_file(0);
            // New status message
            unset($mod_plugin_status);
            $already_installed = false;
            $mod_plugin_status[] = '<span style="color: red; font-weight: bold;">' . sprintf($lang_installer_admin['Plugin removed'], $mod_config['mod_abbr']) . '</span>';
        }
    }
    // Display the admin navigation menu
    generate_admin_menu($plugin);
    ?>
		<div id="plugin_mod" class="plugin blockform">
			<h2><span><?php 
    echo $mod_config['mod_name'] . ' (' . $mod_config['mod_abbr'] . ')';
    ?>
</span></h2>
			<div class="box">