コード例 #1
0
ファイル: author_det.php プロジェクト: nyimbi/legalcase
function get_date_range_fields()
{
    $ret = array();
    $link = new Link();
    $link->delVar('date_start_day');
    $link->delVar('date_start_month');
    $link->delVar('date_start_year');
    $link->delVar('date_end_day');
    $link->delVar('date_end_month');
    $link->delVar('date_end_year');
    $ret['html'] = $link->getForm();
    // By default, show from "now() - 1 month" to NOW().
    // Unlike in case_details, we cannot show all, since it would return
    // too many results.
    $ret['html'] .= "<p class=\"normal_text\">\n";
    $ret['date_end'] = get_datetime_from_array($_REQUEST, 'date_end', 'end', "-1");
    $ret['date_start'] = get_datetime_from_array($_REQUEST, 'date_start', 'start', date('Y-m-d H:i:s', strtotime("-1 month" . ($ret['date_end'] != "-1" ? $ret['date_end'] : date('Y-m-d H:i:s')))));
    $ret['html'] .= _Ti('time_input_date_start');
    $ret['html'] .= get_date_inputs('date_start', $ret['date_start']);
    $ret['html'] .= _Ti('time_input_date_end');
    if ($ret['date_end'] == "-1") {
        $ret['html'] .= get_date_inputs('date_end');
    } else {
        $ret['html'] .= get_date_inputs('date_end', $ret['date_end']);
    }
    $ret['html'] .= ' <button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n";
    $ret['html'] .= "</p>\n";
    $ret['html'] .= "</form>\n";
    return $ret;
}
コード例 #2
0
ファイル: lcm_cookie.php プロジェクト: nyimbi/legalcase
        @header('Content-Type: image/gif');
        @header('Expires: 0');
        @header("Cache-Control: no-store, no-cache, must-revalidate");
        @header('Pragma: no-cache');
        @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        @readfile('ecrire/img_pack/rien.gif');
        // XXX change this
        exit;
    }
}
// If cookie_admin == no, delete the lcm_admin cookie
// This is the "connect with another identifier" on the login page
$cookie_admin = _request('cookie_admin');
if ($cookie_admin == 'no') {
    lcm_setcookie('lcm_admin', $lcm_admin, time() - 3600 * 24);
    $cible->delVar('var_login');
    $cible->addVar('var_login', '-1');
} else {
    if ($cookie_admin and $lcm_admin != $cookie_admin) {
        // Remember the username for the next login
        // This way, the user can login in only one form, not two
        lcm_setcookie('lcm_admin', $cookie_admin, time() + 3600 * 24 * 14);
    }
}
// Attempt to logout
if (_request('logout')) {
    include_lcm('inc_session');
    verifier_visiteur();
    global $author_session;
    if ($author_session['username'] == $_REQUEST['logout']) {
        if ($_COOKIE['lcm_session']) {
コード例 #3
0
ファイル: inc_login.php プロジェクト: nyimbi/legalcase
function show_login($cible, $prive = 'prive', $message_login = '')
{
    $error = '';
    $login = _request('var_login');
    $logout = _request('var_logout');
    // If the cookie fails, inc_auth tried to redirect to lcm_cookie who
    // then tried to put a cookie. If it is not there, it is "cookie failed"
    // who is there, and it's probably a bookmark on privet=yes and not
    // a cookie failure.
    $cookie_failed = "";
    if (_request('var_cookie_failed')) {
        $cookie_failed = $_COOKIE['lcm_session'] != 'cookie_test_failed';
    }
    global $author_session;
    global $lcm_session;
    global $clean_link;
    if (!$cible) {
        // cible = destination
        $cible = new Link(_request('var_url', 'index.php'));
    }
    $cible->delVar('var_erreur');
    $cible->delVar('var_url');
    $cible->delVar('var_cookie_failed');
    $clean_link->delVar('var_erreur');
    $clean_link->delVar('var_login');
    $clean_link->delVar('var_cookie_failed');
    $url = $cible->getUrl();
    // This populates the $author_session variable
    include_lcm('inc_session');
    verifier_visiteur();
    if ($author_session and !$logout and ($author_session['status'] == 'admin' or $author_session['status'] == 'normal')) {
        if ($url != $GLOBALS['clean_link']->getUrl()) {
            lcm_header("Location: " . $cible->getUrlForHeader());
        }
        // [ML] This is making problems for no reason, we use login only
        // for one mecanism (entering the system).
        // echo "<a href='$url'>"._T('login_this_way')."</a>\n";
        echo "<a class='content_link' href='index.php'>" . _T('login_this_way') . "</a>\n";
        return;
    }
    if (_request('var_erreur') == 'pass') {
        $error = _T('login_password_incorrect');
    }
    // The login is memorized in the cookie for a possible future admin login
    if (!$login && isset($_COOKIE['lcm_admin'])) {
        if (preg_match("/^@(.*)\$/", $_COOKIE['lcm_admin'], $regs)) {
            $login = $regs[1];
        }
    } else {
        if ($login == '-1') {
            $login = '';
        }
    }
    // other sources for authentication
    $flag_autres_sources = isset($GLOBALS['ldap_present']) ? $GLOBALS['ldap_present'] : '';
    // What informations to pass?
    if ($login) {
        $status_login = 0;
        // unknown status
        $login = clean_input($login);
        $query = "SELECT id_author, status, password, prefs, alea_actuel, alea_futur \n\t\t\t\t\tFROM lcm_author \n\t\t\t\t\tWHERE username='******'";
        $result = lcm_query($query);
        if ($row = lcm_fetch_array($result)) {
            if ($row['status'] == 'trash' or $row['password'] == '') {
                $status_login = -1;
                // deny
            } else {
                $status_login = 1;
                // known login
                // Which infos to pass for the javascript ?
                $id_author = $row['id_author'];
                $alea_actuel = $row['alea_actuel'];
                // for MD5
                $alea_futur = $row['alea_futur'];
                // Button for lenght of connection
                if ($row['prefs']) {
                    $prefs = unserialize($row['prefs']);
                    $rester_checked = $prefs['cnx'] == 'perma' ? ' checked=\'checked\'' : '';
                }
            }
        }
        // Unknown login (except LDAP) or refused
        if ($status_login == -1 or $status_login == 0 and !$flag_autres_sources) {
            $error = _T('login_identifier_unknown', array('login' => htmlspecialchars(clean_output($login))));
            $login = '';
            // [ML] Not sure why this was here, but headers are already sent
            // therefore it causes an error message (which is not shown, but
            // might make a mess, knowing how PHP runs differently everywhere..)
            // @lcm_setcookie('lcm_admin', '', time() - 3600);
        }
    }
    // Javascript for the focus
    if ($login) {
        $js_focus = 'document.form_login.session_password.focus();';
    } else {
        $js_focus = 'document.form_login.var_login.focus();';
    }
    // [ML] we should probably add a help link here, since tech, but let's see
    // how many users complain first, since this should affect only tech users
    if ($cookie_failed == "yes") {
        $error = _T('login_warning_cookie');
    }
    echo open_login();
    // [ML] Looks like there is no reason why to use $clean_link (defined in inc_version.php)
    // It would cause very strange bugs when the "feed_globals()" were removed from inc_version
    // and in the end, well, it looks rather useless.
    //
    // Strange bugs were caused because $action would be "./" and therefore it
    // would call index.php -> listcases.php -> includes inc_auth.php who then
    // calls auth(), who redirects to the login page.
    $action = $clean_link->getUrl();
    // $action = "lcm_login.php";
    if ($login) {
        // Shows the login form, including the MD5 javascript
        $flag_challenge_md5 = true;
        if ($flag_challenge_md5) {
            echo '<script type="text/javascript" src="inc/md5.js"></script>';
        }
        echo "\n";
        echo '<form name="form_login" action="lcm_cookie.php" method="post"';
        if ($flag_challenge_md5) {
            echo " onsubmit='if (this.session_password.value) {\n\t\t\t\tthis.session_password_md5.value = calcMD5(\"{$alea_actuel}\" + this.session_password.value);\n\t\t\t\tthis.next_session_password_md5.value = calcMD5(\"{$alea_futur}\" + this.session_password.value);\n\t\t\t\tthis.session_password.value = \"\"; }'";
        }
        echo ">\n";
        echo "<div class='main_login_box' style='text-align:" . $GLOBALS["lcm_lang_left"] . ";'>\n";
        if ($error) {
            echo "<div style='color:red;'><b>" . _T('login_access_denied') . " {$error}</b></div><br />\n";
        }
        if ($flag_challenge_md5) {
            // This is printed with javascript so that it is hidden from navigators not
            // using JS, since they will see the username field anyway.
            echo "<script type=\"text/javascript\"><!--\n" . "document.write('" . addslashes(_T('login_login')) . " <b>{$login}</b><br/>" . "<font size=\\'2\\'><a href=\\'lcm_cookie.php?cookie_admin=no&amp;url=" . rawurlencode($action) . "\\' class=\\'link_btn\\'>" . _T('login_other_identifier') . "</a></font>');\n" . "//--></script>\n";
            // If javascript is active, we pass the login in the hidden field
            echo "<input type='hidden' name='session_login_hidden' value='{$login}' />";
            // If javascript is not active, the login is still modifiable
            // (since the challenge is not used)
            echo "<noscript>";
        }
        echo "\t<label for='session_login'><b>" . _T('login_login') . "</b> (" . _T('login_info_login') . ")<br /></label>";
        echo "\t<input type='text' name='session_login' id='session_login' class='forml' value=\"{$login}\" size='40' />\n";
        if ($flag_challenge_md5) {
            echo "</noscript>\n";
        }
        echo "\t<p />\n";
        echo "\t<label for='session_password'><b>" . _T('login_password') . "</b><br /></label>";
        echo "\t<input type='password' name='session_password' id='session_password' class='forml' value=\"\" size='40' />\n";
        echo "\t<input type='hidden' name='essai_login' value='oui' />\n";
        echo "\t<br />&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='session_remember' value='yes' id='session_remember'{$rester_checked} /> ";
        echo "\t<label for='session_remember'>" . _T('login_remain_logged_on') . "</label>";
        echo "\t<input type='hidden' name='url' value='{$url}' />\n";
        echo "\t<input type='hidden' name='session_password_md5' value='' />\n";
        echo "\t<input type='hidden' name='next_session_password_md5' value='' />\n";
        echo "<div align='right'><input class='button_login' type='submit' value='" . _T('button_validate') . "' /></div>\n";
        echo "</div>";
        echo "</form>";
    } else {
        // Ask only for the login/username
        $action = quote_amp($action);
        echo "<form name='form_login' action='{$action}' method='post'>\n";
        echo "<div class='main_login_box' style='text-align:" . $GLOBALS["lcm_lang_left"] . ";'>";
        if ($error) {
            echo "<span style='color:red;'><b>" . _T('login_access_denied') . " {$error}</b></span><p />";
        }
        echo "<label><b>" . _T('login_login') . '</b> (' . _T('login_info_login') . ')' . "<br /></label>";
        echo "<input type='text' name='var_login' class='forml' value=\"\" size='40' />\n";
        echo "<input type='hidden' name='var_url' value='{$url}' />\n";
        echo "<div align='right'><input class='button_login' type='submit' value='" . _T('button_validate') . "' /></div>\n";
        echo "</div>";
        echo "</form>";
    }
    // Focus management
    echo "<script type=\"text/javascript\"><!--\n" . $js_focus . "\n//--></script>\n";
    // Start the login footer
    echo "<div align='left' style='font-size: 12px;' >";
    echo "<div class='lang_combo_box'>" . menu_languages() . "</div>\n";
    // button for "forgotten password"
    include_lcm('inc_mail');
    if (server_can_send_email()) {
        echo '<a href="lcm_pass.php?pass_forgotten=yes" target="lcm_pass" onclick="' . "javascript:window.open(this.href, 'lcm_pass', 'scrollbars=yes, resizable=yes, width=640, height=280'); return false;\" class=\"link_btn\">" . _T('login_password_forgotten') . '</a>';
    }
    $register_popup = 'href="lcm_pass.php?register=yes" target="lcm_pass" ' . ' onclick="' . "javascript:window.open('lcm_pass.php?register=yes', 'lcm_pass', 'scrollbars=yes, resizable=yes, width=640, height=500'); return false;\"";
    $open_subscription = read_meta("site_open_subscription");
    if ($open_subscription == 'yes' || $open_subscription == 'moderated') {
        echo "&nbsp;&nbsp;&nbsp;<a {$register_popup} class=\"link_btn\">" . _T('login_register') . '</a>';
    }
    echo "</div>\n";
    echo close_login();
}
コード例 #4
0
ファイル: inc_obj_case.php プロジェクト: nyimbi/legalcase
 function printFollowups($show_filters = false)
 {
     $cpt = 0;
     $my_list_pos = intval(_request('list_pos', 0));
     show_page_subtitle(_T('case_subtitle_followups'), 'cases_followups');
     // Show filters (if not shown in ajaxed page)
     if ($show_filters) {
         // By default, show from "case creation date" to NOW().
         $link = new Link();
         $link->delVar('date_start_day');
         $link->delVar('date_start_month');
         $link->delVar('date_start_year');
         $link->delVar('date_end_day');
         $link->delVar('date_end_month');
         $link->delVar('date_end_year');
         echo $link->getForm();
         $date_end = get_datetime_from_array($_REQUEST, 'date_end', 'end', '0000-00-00 00:00:00');
         // date('Y-m-d H:i:s'));
         $date_start = get_datetime_from_array($_REQUEST, 'date_start', 'start', '0000-00-00 00:00:00');
         // $row['date_creation']);
         echo _Ti('time_input_date_start');
         echo get_date_inputs('date_start', $date_start);
         echo _Ti('time_input_date_end');
         echo get_date_inputs('date_end', $date_end);
         echo ' <button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n";
         echo "</form>\n";
         echo "<div style='margin-bottom: 4px;'>&nbsp;</div>\n";
         // FIXME patch for now (leave small space between filter and list)
     }
     show_listfu_start('general', false);
     for ($cpt = 0, $this->getFollowupStart(); !$this->getFollowupDone(); $cpt++) {
         $item = $this->getFollowupIterator();
         show_listfu_item($item, $cpt);
     }
     if (!$cpt) {
         echo "No followups";
     }
     // TRAD
     show_list_end($my_list_pos, $this->getFollowupTotal(), true);
 }
コード例 #5
0
ファイル: inc_presentation.php プロジェクト: nyimbi/legalcase
function show_find_box($type, $string, $dest = '', $layout = 'normal')
{
    static $find_box_counter = 0;
    // there may be more than one search box for a given type, in same page
    if ($type == 'client' && read_meta('client_hide_all') == 'yes') {
        return;
    }
    if ($type == 'org' && read_meta('org_hide_all') == 'yes') {
        return;
    }
    switch ($type) {
        case 'case':
        case 'client':
        case 'org':
        case 'author':
        case 'rep':
        case 'exp':
            $action = 'list' . $type . 's.php';
            break;
        default:
            lcm_panic("invalid type: {$type}");
    }
    if ($dest) {
        if ($dest == '__self__') {
            $link_dest = new Link();
            $link_dest->delVar('find_' . $type . '_string');
            $link_dest->delVar('submit');
            echo $link_dest->getForm('get', '', '', 'search_form');
        } else {
            $action = $dest;
        }
    } else {
        echo '<form name="frm_find_' . $type . '" class="search_form" action="' . $action . '" method="get">' . "\n";
    }
    echo '<label for="find_box' . $find_box_counter . '">';
    echo _T('input_search_' . $type) . "&nbsp;";
    echo "</label>\n";
    if ($layout == 'narrow') {
        echo "<br />\n";
    }
    echo '<input type="text" id="find_box' . $find_box_counter . '" name="find_' . $type . '_string" size="10" class="search_form_txt" value="' . clean_output($string) . '" />';
    echo '&nbsp;<input type="submit" name="submit" value="' . _T('button_search') . '" class="search_form_btn" />' . "\n";
    echo "</form>\n";
    $find_box_counter++;
}
コード例 #6
0
ファイル: run_rep.php プロジェクト: nyimbi/legalcase
        } else {
            $tmp_link->addVar('show_nokw', "1");
            echo '<p><a href="' . $tmp_link->getUrl() . '" class="run_lnk">' . _T('rep_button_nokw_show') . "</a></p>\n";
        }
    }
    echo '<p><a href="rep_det.php?rep=' . $report->getId() . '" class="run_lnk">' . _T('rep_button_goback') . "</a></p>\n";
    //
    // Make a link to export the report
    //
    echo '<p>';
    $link_csv = new Link();
    $link_csv->delVar('export');
    $link_csv->addVar('export', 'csv');
    echo '<a href="' . $link_csv->getUrl() . '" class="exp_lnk">' . _T('rep_button_exportcsv') . '</a> ';
    $link_ods = new Link();
    $link_ods->delVar('export');
    $link_ods->addVar('export', 'ods');
    echo '<a href="' . $link_ods->getUrl() . '" class="exp_lnk">' . _T('rep_button_exportcsv') . ' (ODS)' . '</a>';
    // TRAD
    echo "</p>\n";
    //
    // Print debug information, if requested
    //
    if (isset($_REQUEST['debug'])) {
        $dbg = $report->getJournal();
        foreach ($dbg as $line) {
            echo $line;
        }
    }
    lcm_page_end();
}