clarify use of mysql_fetch_array : we really want mysql_fetch_assoc
[diogenes.git] / htdocs / prefs.php
1 <?php
2 if (isset($_REQUEST['nlang'])) {
3 setcookie('lang',$_REQUEST['nlang'],(time()+25920000));
4 $_COOKIE['lang'] = $_REQUEST['nlang'];
5 }
6
7 // include common definitions
8 require_once 'diogenes.common.inc.php';
9 require_once 'diogenes.toplevel.inc.php';
10 $page = new $globals->toplevel;
11 $_SESSION['session']->doAuth($page);
12
13 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";
14 $myuid = $_SESSION['session']->uid;
15
16 switch ($action) {
17 case "passwd":
18 if ($_SESSION['session']->auth == "native") {
19 $page->info(__("Changing password.."));
20 $newpass = $_REQUEST['newpass'];
21 $globals->db->query("update {$globals->tauth['native']} set password='$newpass' where user_id='$myuid'");
22 }
23 break;
24 }
25
26
27 $page->assign('md5',$page->url('md5.js'));
28 $page->assign('native',$_SESSION['session']->auth == "native");
29 $page->assign('username',$_SESSION['session']->username);
30 $page->assign('fullname',$_SESSION['session']->fullname);
31 $page->assign('langs', $globals->locales);
32
33 $page->assign('page', __("User preferences"));
34 $page->assign('greeting', __("Diogenes preferences"));
35
36 $page->assign('msg_myinfo' ,__("my information"));
37 $page->assign('msg_username' ,__("username"));
38 $page->assign('msg_fullname' ,__("full name"));
39
40 $page->assign('msg_lang', __("language"));
41 $page->assign('msg_lang_blab', __("You can select your preferred language by clicking on the appropriate language below."));
42
43 $page->assign('msg_mypassword' ,__("my password"));
44 $page->assign('msg_password' ,__("new password"));
45 $page->assign('msg_confirmation' ,__("confirmation"));
46
47 $page->assign('submit', __("Change"));
48
49 $page->display("prefs.tpl");
50 ?>