2 // +----------------------------------------------------------------------+
3 // | Anuko Time Tracker
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
6 // +----------------------------------------------------------------------+
7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
8 // | by anyone for any purpose, and freely redistributed alone or in
9 // | combination with other software, provided that the license is obeyed.
11 // | There are only two ways to violate the license:
13 // | 1. To redistribute this code in source form, with the copyright
14 // | notice or license removed or altered. (Distributing in compiled
15 // | forms without embedded copyright notices is permitted).
17 // | 2. To redistribute modified versions of this code in *any* form
18 // | that bears insufficient indications that the modifications are
19 // | not the work of the original author(s).
21 // | This license applies to this document only, not any other software
22 // | that it may be combined with.
24 // +----------------------------------------------------------------------+
26 // | https://www.anuko.com/time_tracker/credits.htm
27 // +----------------------------------------------------------------------+
29 require_once('initialize.php');
31 import('ttUserHelper');
34 if (!ttAccessAllowed('administer_site')) {
35 header('Location: access_denied.php');
39 if ($request->isPost()) {
40 $cl_name = trim($request->getParameter('name'));
41 $cl_login = trim($request->getParameter('login'));
42 if (!$auth->isPasswordExternal()) {
43 $cl_password1 = $request->getParameter('password1');
44 $cl_password2 = $request->getParameter('password2');
46 $cl_email = trim($request->getParameter('email'));
48 $cl_name = $user->name;
49 $cl_login = $user->login;
50 $cl_email = $user->email;
53 $form = new Form('optionsForm');
54 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name));
55 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'login','value'=>$cl_login));
56 if (!$auth->isPasswordExternal()) {
57 $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password1','value'=>$cl_password1));
58 $form->addInput(array('type'=>'password','maxlength'=>'30','name'=>'password2','value'=>$cl_password2));
60 $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=>$cl_email));
61 $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.submit')));
63 if ($request->isPost()) {
64 // Create fields array for ttAdmin instance.
68 'password1' => $cl_password1,
69 'password2' => $cl_password2,
70 'email' => $cl_email);
73 $admin = new ttAdmin($err);
74 $result = $admin->updateSelf($fields);
76 header('Location: admin_groups.php');
81 $smarty->assign('auth_external', $auth->isPasswordExternal());
82 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
83 $smarty->assign('title', $i18n->get('title.options'));
84 $smarty->assign('content_page_name', 'admin_options.tpl');
85 $smarty->display('index.tpl');