[Openupload-svn-update] SF.net SVN: openupload:[26] trunk
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-10-16 17:46:23
|
Revision: 26
http://openupload.svn.sourceforge.net/openupload/?rev=26&view=rev
Author: tsdogs
Date: 2008-10-16 17:46:16 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add user preferences management.
Modified Paths:
--------------
trunk/lib/classes.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/default/auth.inc.php
Added Paths:
-----------
trunk/templates/default/modules/auth/profile.tpl
trunk/templates/default/modules/auth/profileedit.tpl
Modified: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/classes.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -129,7 +129,7 @@
$_SESSION['user']['login']=$username;
/* retrieve user info */
$info = $this->auth->userinfo($username);
- unset($info['password']);
+ //unset($info['password']);
$_SESSION['user'] = $info;
/* make the post not be resent on refresh */
redirect();
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/main.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -66,8 +66,8 @@
$this->tr->init();
$this->config['modules'][]='files';
+ $this->config['modules'][]='admin';
$this->config['modules'][]='auth';
- $this->config['modules'][]='admin';
$this->loadACL();
$this->initModules();
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -6,6 +6,10 @@
1 => "loginForm",
2 => "authenticate",
),
+ "profile" => array (
+ 1 => "profile",
+ 2 => "profileedit",
+ ),
"logout" => array (
1 => "logout",
),
@@ -24,6 +28,9 @@
"register" => array (
"title" => tr("User registration"),
),
+ "profile" => array (
+ "title" => tr("User options"),
+ ),
);
}
@@ -31,6 +38,7 @@
if (!app()->user->loggedin()) {
$this->menu['login']=tr('Login');
} else {
+ $this->menu['profile']=tr('Preferences');
$this->menu['logout']=tr('Logout');
}
$this->tpl->assign('register',app()->checkACL(app()->user->userGroup(),'auth','register')=='allow');
@@ -145,5 +153,49 @@
}
+ function profile() {
+ $user = app()->user->userInfo();
+ $this->tpl->assign('puser',$user);
+ }
+
+ function profileedit() {
+ global $_POST;
+ $user = app()->user->userInfo();
+echo 'pwd:'.$user['password'];
+ if (isset($_POST['username'])) {
+ /* check for valid values*/
+ if ($_POST['username']=='') {
+ app()->error(tr('Full Name cannot be empty!'));
+ $error = true;
+ } else
+ $user['name']=$_POST['username'];
+ if (!validEmail($_POST['useremail'])) {
+ app()->error(tr('Please enter a valid e-mail address!'));
+ $error=true;
+ }
+ $user['email']=$_POST['useremail'];
+ if ($_POST['newpassword']!='') {
+ $error = false;
+ if (strlen($_POST['newpassword'])<5) {
+ app()->error(tr('Password must be at least 5 charaters long!'));
+ $error = true;
+ } else if (crypt($_POST['oldpassword'],$user['password'])!=$user['password']) {
+ app()->error(tr('Old password is wrong!'));
+ $error = true;
+ } else if ($_POST['newpassword']!=$_POST['confirmpassword']) {
+ app()->error(tr('New passwords do not match!'));
+ $error = true;
+ } else {
+ app()->message(tr('Password has been changed!'));
+ $user['password']=crypt($_POST['newpassword']);
+ }
+ }
+ if (!$error) {
+ app()->db->updateUser($user);
+ $this->nextStep(1);
+ }
+ }
+ $this->tpl->assign('puser',$user);
+ }
}
?>
\ No newline at end of file
Added: trunk/templates/default/modules/auth/profile.tpl
===================================================================
--- trunk/templates/default/modules/auth/profile.tpl (rev 0)
+++ trunk/templates/default/modules/auth/profile.tpl 2008-10-16 17:46:16 UTC (rev 26)
@@ -0,0 +1,7 @@
+<table border="0" width="300">
+<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td>{$puser.name}</td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td>{$puser.email}</td></tr>
+<tr><td colspan="2"><hr></td></tr>
+<tr><td colspan="2"><a href="{$script}?action={$action}&step={$nextstep}">{tr}Change{/tr}</td></tr>
+</table>
\ No newline at end of file
Added: trunk/templates/default/modules/auth/profileedit.tpl
===================================================================
--- trunk/templates/default/modules/auth/profileedit.tpl (rev 0)
+++ trunk/templates/default/modules/auth/profileedit.tpl 2008-10-16 17:46:16 UTC (rev 26)
@@ -0,0 +1,14 @@
+<form action="{$script}" method="POST">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<table border="0" width="300">
+<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="username" value="{$puser.name}"></td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="useremail" value="{$puser.email}"></td></tr>
+<tr><td colspan="2"><hr></td></tr>
+<tr><td>{tr}Old password{/tr}:</td><td><input type="password" name="oldpassword" value=""></td></tr>
+<tr><td>{tr}New password{/tr}:</td><td><input type="password" name="newpassword" value=""></td></tr>
+<tr><td>{tr}Retype password{/tr}:</td><td><input type="password" name="confirmpassword" value=""></td></tr>
+<tr><td><a href="{$script}?action={$action}&step=1"><< {tr}Cancel{/tr}</td>
+ <td align="right"><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
+</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|