Author: dgoette
Date: Sat Nov 22 13:37:14 2008
New Revision: 37565
URL:
http://svn.reactos.org/svn/reactos?rev=37565&view=rev
Log:
implement account disabling / enabling(if already activated)
Modified:
branches/danny-web/reactos.org/htdocs/roscms/js/cms_user.js
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_User.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Login.class.php
Modified:
branches/danny-web/reactos.org/htdocs/roscms/js/cms_user.js
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/js/cms_user.js [iso-8859-1] (original)
+++
branches/danny-web/reactos.org/htdocs/roscms/js/cms_user.js [iso-8859-1] Sat Nov 22
13:37:14 2008
@@ -91,4 +91,12 @@
// to prevent memory leak
http_request = null;
}
-
+
+// enables or disables useraccounts
+function setaccount(userid, enable) {
+ var uf_check = confirm("Do you want to "+enable+" this
membership?");
+
+ if (uf_check == true) {
+
makeRequest('?page=data_out&d_f=user&d_u=usrtbl&d_fl=account'+enable+'&d_val='+encodeURIComponent(userid),
'usrtbl', 'userarea');
+ }
+}
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_User.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_User.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Export_User.class.php [iso-8859-1]
Sat Nov 22 13:37:14 2008
@@ -117,6 +117,29 @@
$flag = 'detail';
break;
+ case 'accountdisable':
+ // only with admin rights
+ if ($roscms_security_level == 3) {
+ $stmt=DBConnection::getInstance()->prepare("UPDATE users SET
user_account_enabled = 'no' WHERE user_id = :user_id");
+ $stmt->bindParam('user_id',$user_id,PDO::PARAM_INT);
+ $stmt->execute();
+ }
+ // preselect displayed content
+ $flag = 'detail';
+ break;
+
+ case 'accountenable':
+ // enable account only with admin rights
+ if ($roscms_security_level == 3) {
+ // enable account only, if he has already activated his account
+ $stmt=DBConnection::getInstance()->prepare("UPDATE users SET
user_account_enabled = 'yes' WHERE user_register_activation = '' AND
user_id = :user_id");
+ $stmt->bindParam('user_id',$user_id,PDO::PARAM_INT);
+ $stmt->execute();
+ }
+ // preselect displayed content
+ $flag = 'detail';
+ break;
+
case 'upateusrlang':
$stmt=DBConnection::getInstance()->prepare("UPDATE users SET
user_timestamp_touch2 = NOW(), user_language = :lang WHERE user_id = :user_id LIMIT
1");
$stmt->bindParam('lang',$group_id);
@@ -184,7 +207,7 @@
break;
case 'detail':
- $stmt=DBConnection::getInstance()->prepare("SELECT user_id,
user_name, user_timestamp_touch2 AS visit, user_login_counter AS visitcount,
user_register, user_fullname, user_email, user_language FROM users WHERE user_id =
:user_id LIMIT 1");
+ $stmt=DBConnection::getInstance()->prepare("SELECT user_id,
user_name, user_timestamp_touch2 AS visit, user_login_counter AS visitcount,
user_register, user_fullname, user_email, user_language, user_account_enabled FROM users
WHERE user_id = :user_id LIMIT 1");
$stmt->bindParam('user_id',$user_id,PDO::PARAM_INT);
$stmt->execute();
$user = $stmt->fetchOnce();
@@ -198,7 +221,12 @@
echo_strip('
<p><strong>E-Mail:</strong>
'.$user['user_email'].'</p>
<p><strong>Latest Login:</strong>
'.$user['visit'].'; '.$user['visitcount'].'
logins</p>
- <p><strong>Registered:</strong>
'.$user['user_register'].'</p>');
+ <p><strong>Registered:</strong>
'.$user['user_register'].'</p>
+ <p>Account is
'.($user['user_account_enabled']=='yes'?'enabled':'disabled').'
+ (
+ <span class="frmeditbutton"
onclick="'."setaccount(".$user_id.",
'".($user['user_account_enabled']=='yes'?'disable':'enable')."')".'"> '.($user['user_account_enabled']=='yes'?'disable':'enable').'</span>
+ it)
+ </p>');
}
echo_strip('
<fieldset>
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Login.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
==============================================================================
---
branches/danny-web/reactos.org/htdocs/roscms/lib/Login.class.php [iso-8859-1]
(original)
+++
branches/danny-web/reactos.org/htdocs/roscms/lib/Login.class.php [iso-8859-1] Sat Nov
22 13:37:14 2008
@@ -71,10 +71,10 @@
// Now, see if we have a valid login session
if ($subsys == '') {
- $stmt=DBConnection::getInstance()->prepare("SELECT u.user_id,
s.usersession_expires AS session_expires FROM user_sessions s JOIN users u ON u.user_id =
s.usersession_user_id WHERE s.usersession_id = :session_id AND (u.user_setting_ipaddress =
'false' OR s.usersession_ipaddress=:ip ) AND (u.user_setting_browseragent =
'false' OR s.usersession_browseragent = :agent)");
+ $stmt=DBConnection::getInstance()->prepare("SELECT u.user_id,
s.usersession_expires AS session_expires FROM user_sessions s JOIN users u ON u.user_id =
s.usersession_user_id WHERE s.usersession_id = :session_id AND (u.user_setting_ipaddress =
'false' OR s.usersession_ipaddress=:ip ) AND (u.user_setting_browseragent =
'false' OR s.usersession_browseragent = :agent) AND u.user_account_enabled =
'yes' LIMIT 1");
}
else{
- $stmt=DBConnection::getInstance()->prepare("SELECT m.map_subsys_userid AS
user_id, s.usersession_expires AS session_expires FROM user_sessions s JOIN users u ON
u.user_id = s.usersession_user_id JOIN subsys_mappings m ON m.map_roscms_userid =
s.usersession_user_id WHERE s.usersession_id = :session_id AND (u.user_setting_ipaddress =
'false' OR s.usersession_ipaddress = :ip) AND (u.user_setting_browseragent =
'false' OR s.usersession_browseragent = :agent) AND m.map_subsys_name =
:subsys");
+ $stmt=DBConnection::getInstance()->prepare("SELECT m.map_subsys_userid AS
user_id, s.usersession_expires AS session_expires FROM user_sessions s JOIN users u ON
u.user_id = s.usersession_user_id JOIN subsys_mappings m ON m.map_roscms_userid =
s.usersession_user_id WHERE s.usersession_id = :session_id AND (u.user_setting_ipaddress =
'false' OR s.usersession_ipaddress = :ip) AND (u.user_setting_browseragent =
'false' OR s.usersession_browseragent = :agent) AND m.map_subsys_name = :subsys
AND u.user_account_enabled = 'yes' LIMIT 1");
$stmt->bindParam('subsys',$subsys,PDO::PARAM_STR);
}
$stmt->bindParam('session_id',$session_id_clean,PDO::PARAM_INT);