Ejemplo n.º 1
0
function show_import_form()
{
    lcm_page_start(_T('title_archives'), '', '', 'archives_import');
    global $tabs;
    show_tabs_links($tabs, 1);
    lcm_bubble('archive_restore');
    // Show the errors (if any)
    echo show_all_errors($_SESSION['errors']);
    // Upload backup form
    echo '<form enctype="multipart/form-data" action="import_db.php" method="post">' . "\n";
    echo '<input type="hidden" name="action" value="upload_file" />' . "\n";
    echo '<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />' . "\n";
    echo "<fieldset class='info_box'>\n";
    show_page_subtitle(_T('archives_subtitle_upload'), 'archives_import', 'newrestore');
    echo '<p class="normal_text">' . _T('archives_info_how_to_upload') . "</p>\n";
    echo '<p class="normal_text">' . _Ti('file_input_name');
    echo '<input type="file" name="filename" size="40" value="" /> ';
    echo '<input type="submit" name="submit" id="btn_upload" value="' . _T('button_validate') . '" class="search_form_btn" />';
    echo "</p>\n";
    echo "</fieldset>\n";
    echo "</form>\n";
    // Restore backup form
    echo '<form action="import_db.php" method="post">' . "\n";
    echo '<input type="hidden" name="action" value="import" />' . "\n";
    echo "<fieldset class='info_box'>\n";
    show_page_subtitle(_T('archives_subtitle_restore'), 'archives_import', 'delrestore');
    echo "<strong>" . _Ti('archives_input_select_backup') . "</strong><br />";
    echo "<select name='file' class='sel_frm'>\n";
    lcm_debug("opendir: " . DIR_BACKUPS);
    $storage = opendir(DIR_BACKUPS);
    while ($file = readdir($storage)) {
        lcm_debug("file in opendir: {$file}");
        if (is_dir(DIR_BACKUPS . '/' . $file) && strpos($file, 'db-') === 0) {
            echo "\t\t<option value='" . substr($file, 3) . "'>" . substr($file, 3) . "</option>\n";
        }
    }
    echo "</select>\n";
    // Select restore type
    echo "<p class='normal_text'>\n";
    echo "<input type='radio' name='restore_type' value='clean' id='r1' /><label for='r1'>&nbsp;<strong>" . _T('archives_input_option_restore') . "</strong></label><br />" . _T('archives_info_option_restore') . "<br /><br />\n";
    // [ML] This is confusing as hell. I understand the aim from DB point of view
    // but I don't understand the aim from the admin's point of view.
    // echo "<input type='radio' name='restore_type' value='replace' id='r2' /><label for='r2'>&nbsp;<strong>Replace (experimental!)</strong></label><br /> Imported backup data will replace the existing. This is usefull to undo the changes made in the database since last backup, without losing the new information. Warning: This operation could break database integrity, especially if importing data between different LCM installations.<br /><br />\n";
    echo "<input type='radio' name='restore_type' value='ignore' id='r3' /><label for='r3'>&nbsp;<strong>" . _T('archives_input_option_sync') . " (experimental!)</strong></label><br /> Only backup data NOT existing in the database will be imported. This is usefull to import data lost since last backup, without changing the existing information. Warning: This operation could break database integrity, especially if importing data between different LCM installations.<br /><br />\n";
    // TRAD
    echo "<button type='submit' class='simple_form_btn'>" . _T('button_validate') . "</button>\n";
    echo "</p>\n";
    echo "</fieldset\n>";
    echo "</form>\n";
    lcm_page_end();
    $_SESSION['errors'] = array();
}
Ejemplo n.º 2
0
    $stage_info = get_kw_from_name('stage', $old_stage);
    $id_stage = $stage_info['id_keyword'];
    show_context_stage($case, $id_stage);
} else {
    // Normal follow-up
    $result = lcm_query("SELECT stage FROM lcm_case WHERE id_case = " . $case);
    $row = lcm_fetch_array($result);
    if ($row['stage']) {
        $stage_info = get_kw_from_name('stage', $row['stage']);
        $id_stage = $stage_info['id_keyword'];
        show_context_stage($case, $id_stage);
    }
}
show_context_end();
// Show the errors (if any)
echo show_all_errors($_SESSION['errors']);
// Disable inputs when edit is not allowed for the field
$dis = $admin || $edit ? '' : 'disabled="disabled"';
echo '<form action="upd_fu.php" method="post">' . "\n";
$obj_fu = new LcmFollowupInfoUI($_SESSION['follow']);
$obj_fu->printEdit();
echo '<button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n";
echo '<input type="hidden" name="id_followup" value="' . _session('id_followup') . '" />';
echo '<input type="hidden" name="id_case" value="' . _session('id_case') . '">';
echo '<input type="hidden" name="id_app" value="' . _session('id_app', 0) . '">';
echo '<input type="hidden" name="ref_edit_fu" value="' . _session('ref_edit_fu') . '">';
echo "</form>\n";
lcm_page_end();
// Clear the errors, in case user jumps to other 'edit' page
$_SESSION['errors'] = array();
$_SESSION['form_data'] = array();
Ejemplo n.º 3
0
    if (_request('submit') == 'set_exp_status') {
        lcm_page_start(_T('title_expense_comment'), '', '', 'expenses');
    } else {
        lcm_page_start(_T('title_expense_comment'), '', '', 'expenses');
    }
} else {
    lcm_page_start(_T('title_expense_new'), '', '', 'expenses');
}
/* TODO
show_context_start();
show_context_case_title($case, 'followups');
show_context_case_involving($case);
*/
show_context_end();
// Show the errors (if any)
echo show_all_errors();
echo '<form action="upd_exp.php" method="post">' . "\n";
$id_expense = _request('expense', 0);
$id_comment = _request('c', 0);
$status = _request('new_exp_status');
if ($status || $id_comment || _request('edit_comment')) {
    $obj_exp = new LcmExpenseInfoUI($id_expense);
    $obj_exp->printGeneral(false);
    // with minimal UI (no edit button)
    show_page_subtitle(_T('expenses_subtitle_comment'), 'expenses_comment');
    $obj_comment = new LcmExpenseCommentInfoUI($id_expense, $id_comment);
    $obj_comment->printEdit();
} else {
    $obj_exp = new LcmExpenseInfoUI(_request('expense', 0));
    $obj_exp->printEdit();
}
Ejemplo n.º 4
0
function install_step_1()
{
    install_html_start('AUTO', '', 1);
    echo "<h3><small>" . _T('install_step_one') . "</small> " . _T('install_title_sql_connection') . "</h3>\n";
    echo show_all_errors($_SESSION['errors']);
    echo "<p class='simple_text'>" . _T('install_info_sql_connection') . " " . lcm_help("install_database") . "</p>\n";
    $db_address = _session('db_address', 'localhost');
    $db_login = _session('db_login');
    $db_password = _session('db_password');
    $db_choice = _session('db_choice');
    // Fetch the previous configuration data to make things easier (if possible)
    $lcm_config_prefix = isset($_SERVER['LcmConfigDir']) ? $_SERVER['LcmConfigDir'] : 'inc/config';
    if (@file_exists($lcm_config_prefix . '/inc_connect_install.php')) {
        $s = @join('', @file($lcm_config_prefix . '/inc_connect_install.php'));
        if (ereg("mysql_connect\\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\\)", $s, $regs)) {
            $db_address = $regs[1];
            $db_login = $regs[2];
        } else {
            if (ereg("lcm_connect_db\\('(.*)','(.*)','(.*)','(.*)','(.*)'\\)", $s, $regs)) {
                $db_address = $regs[1];
                if ($port_db = $regs[2]) {
                    $db_address .= ':' . $port_db;
                }
                $db_login = $regs[3];
            }
        }
    }
    echo "<form action='install.php' method='post'>\n";
    echo "<input type='hidden' name='step' value='2' />\n";
    echo "<fieldset class='fs_box'>\n";
    echo "<div><label for='db_address'><strong>" . f_err_star('address') . _T('install_database_address') . "</strong></label></div>\n";
    echo "<input type='text' id='db_address' name='db_address' value=\"{$db_address}\" size='40' class='txt_lmnt' />\n";
    echo "<br />\n";
    echo "<br />\n";
    echo "<div><label for='db_login'><strong>" . f_err_star('login') . _T('install_connection_login') . "</strong></label></div>\n";
    echo "<input type='text' id='db_login' name='db_login' value=\"{$db_login}\" size='40' class='txt_lmnt' />\n";
    echo "<br />\n";
    echo "<br />\n";
    echo "<div><label for='db_password'><strong>" . f_err_star('password') . _T('install_connection_password') . "</strong></label></div>\n";
    echo "<input type='password' id='db_password' name='db_password' value=\"{$db_password}\" size='40' class='txt_lmnt' />\n";
    // Afaik, there is no way to get a list of databases in PgSQL
    // without logging in first, and to login, you must provide DBname
    if (preg_match("/^PostgreSQL/", lcm_sql_server_info())) {
        echo "<br />\n";
        echo "<br />\n";
        echo "<div><label for='db_choice'><strong>" . f_err_star('dbname') . "Database name" . "</strong></label></div>\n";
        // TRAD
        echo "<input type='text' id='db_choice' name='db_choice' value=\"{$db_choice}\" size='40' class='txt_lmnt' />\n";
    }
    echo "</fieldset>\n";
    echo "<div align='" . $GLOBALS['lcm_lang_right'] . "'>" . "<button type='submit' name='Next'>" . _T('button_next') . " >></button>&nbsp;" . "</div>\n";
    echo "</form>\n";
    install_html_end();
}
Ejemplo n.º 5
0
function print_registration_form()
{
    install_html_start(_T('pass_title_register'), 'login');
    $link = new Link();
    $url = $link->getUrl();
    echo '<p align="left" class="normal_text">' . _T('pass_info_why_register') . "</p>\n";
    echo show_all_errors();
    echo "<form method='post' action='{$url}' style='border: 0px; margin: 0px;'>\n";
    echo '<input type="hidden" name="register" value="data" />' . "\n";
    echo "<fieldset><label><b>" . _T('info_your_contact_information') . "</b><br></label>\n";
    // [ML] Altough not most problematic, could be better. But if someone
    // fixes here, please fix install.php also (step 4)
    echo "<table border='0'>\n";
    echo "<tr>\n";
    echo "<td>\n\t\t\t<label for='name_first'>" . f_err_star('name_first') . _Ti('person_input_name_first') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_first' name='name_first' class='formo' value='" . _session('name_first') . "' size='20'>\n\t\t</td>\n";
    echo "<td>\n\t\t\t<label for='name_last'>" . f_err_star('name_last') . _Ti('person_input_name_last') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_last' name='name_last' class='formo' value='" . _session('name_last') . "' size='20'>\n\t\t</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td colspan='2'>";
    echo "<p><label for='email'>" . f_err_star('email') . _Ti('input_email') . "</label><br />";
    echo "<input type='text' id='email' name='email' class='formo' value='" . _session('email') . "' size='40'></p>\n";
    echo "<p><label for='username'>" . f_err_star('username') . _Ti('authoredit_input_username') . "</label> ";
    echo "<small>" . _T('info_more_than_three') . "</small><br />";
    echo "<input type='text' id='username' name='username' class='formo' value='" . _session('username') . "' size='40'></p>\n";
    echo "<small>" . _T('pass_info_password_by_mail') . "</small>\n";
    echo "</fieldset>\n";
    echo "<p align=\"right\">";
    echo '<button type="submit" name="Validate">' . _T('button_validate') . "</button>";
    echo "</p>";
    echo "</form>\n";
    $_SESSION['form_data'] = array();
    $_SESSION['errors'] = array();
}
Ejemplo n.º 6
0
function show_keyword_id($id_keyword = 0)
{
    if (!$id_keyword) {
        if (!intval($_REQUEST['id_group']) > 0) {
            lcm_panic("missing valid id_group for new keyword");
        }
        $kwg = get_kwg_from_id($_REQUEST['id_group']);
        // Suggest a keyword name: kwgnameNN, where NN = numeric sequence
        $all_kws = get_keywords_in_group_name($kwg['name'], false);
        $cpt = sprintf("%02d", count($all_kws) + 1);
        while (get_kw_from_name($kwg['name'], $kwg['name'] . $cpt)) {
            $cpt = sprintf("%02d", ++$cpt);
        }
        $kw['name'] = $kwg['name'] . $cpt;
        $kw['title'] = '';
        $kw['description'] = '';
        $kw['id_group'] = $kwg['id_group'];
        $kw['ac_author'] = 'Y';
        $kw['hasvalue'] = 'N';
        $kw['type'] = $kwg['type'];
        lcm_page_start(_T('title_keyword_new'));
    } else {
        $kw = get_kw_from_id($id_keyword);
        $kwg = get_kwg_from_id($kw['id_group']);
        lcm_page_start(_T('title_keyword_edit'));
    }
    echo show_all_errors($_SESSION['errors']);
    if (!$id_keyword) {
        echo "<ul style=\"padding-left: 0.5em; padding-top: 0.2; padding-bottom: 0.2; font-size: 12px;\">\n";
        echo '<li style="list-style-type: none;">' . _T('keywords_input_for_group') . " " . '<a class="content_link" href="keywords.php?action=edit_group&id_group=' . $kwg['id_group'] . '">' . _T($kwg['title']) . "</a></li>\n";
        echo "</ul>\n";
    }
    echo '<fieldset class="info_box">';
    echo '<form action="keywords.php" method="post">' . "\n";
    echo '<input type="hidden" name="action" value="update_keyword" />' . "\n";
    echo '<input type="hidden" name="id_keyword" value="' . $id_keyword . '" />' . "\n";
    echo '<input type="hidden" name="id_group" value="' . $kw['id_group'] . '" />' . "\n";
    // for new keyword only
    // Name (only for new keywords, must be unique and cannot be changed)
    echo "<strong>" . f_err_star('name') . _T('keywords_input_name') . "</strong> " . "(short identifier, unique to this keyword group)" . "<br />\n";
    // TRAD
    $disabled = isDisabled($id_keyword);
    echo '<input ' . $disabled . ' type="text" id="kw_name" name="kw_name" size="45" value="' . $kw['name'] . '" class="search_form_txt" />' . "\n";
    echo "<br /><br />\n";
    // Title
    echo "<strong>" . f_err_star('title') . _T('keywords_input_title') . "</strong><br />\n";
    echo "<input type='text' id='kw_title' name='kw_title' size='45' value='" . $kw['title'] . "' class='search_form_txt' />\n";
    echo "<br /><br />\n";
    // Description
    echo "<strong>" . _T('keywords_input_description') . "</strong><br />\n";
    echo "<textarea id='kw_desc' name='kw_desc' rows='2' cols='45' wrap='soft' class='frm_tarea'>";
    echo $kw['description'];
    echo "</textarea>\n";
    // Ac_author
    echo '<ul class="info">';
    echo '<li>' . _T('keywords_info_kw_ac_author') . ' ' . get_yes_no('kw_ac_author', $kw['ac_author']) . "</li>\n";
    if (!$id_keyword || $id_keyword && $kwg['type'] != 'system') {
        echo '<li>' . "Does the keyword have a specific value?" . ' ' . get_yes_no('kw_hasvalue', $kw['hasvalue']) . "</li>\n";
    }
    echo '<button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n";
    echo "</form>\n";
    echo '</fieldset>';
    // destroy error messages
    $_SESSION['errors'] = array();
    lcm_page_end();
    exit;
}