Only members with a valid membership can migrate through the modal dialog. Note: Newly registered users are still migrated.
This commit is contained in:
1 parent
057082578a
commit
d105c55469
3 files changed
+50
-20
No files matched your search
+3
-2
@@ -831,8 +831,9 @@ possibly include it instead? --Thomas Misund, 26. Oct 2009
|
||||
$form = new Form($title, $enctype, $method, $action, $fields, $id);
|
||||
$form->display("horizontal");
|
||||
}
|
||||
// Migration LDAP (nikolark)
|
||||
if( !is_migrated(getCurrentUser()) ) {
|
||||
// Migration LDAP (nikolark)
|
||||
$uid = getCurrentUser();
|
||||
if( !is_migrated($uid) && !membership_expired($uid) ) {
|
||||
?>
|
||||
<div id="infomodal">
|
||||
<div class="ui-widget">
|
||||
|
||||
@@ -1602,6 +1602,19 @@ function set_migrated($uid) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/* User has valid membership? */
|
||||
function membership_expired($uid) {
|
||||
$conn = db_connect();
|
||||
|
||||
$sql = sprintf("SELECT expires FROM din_user WHERE id=%s AND expires <= NOW()", $uid);
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if (DB :: isError($result) == true) {
|
||||
error("membership_expired: " . $result->toString());
|
||||
return false;
|
||||
}
|
||||
return $result->numRows() > 0;
|
||||
}
|
||||
/* Find a users groups */
|
||||
function find_groups($uid) {
|
||||
$conn = db_connect();
|
||||
|
||||
@@ -64,26 +64,42 @@ if( !function_exists('is_migrated') ) {
|
||||
return $result->numRows() > 0;
|
||||
}
|
||||
}
|
||||
/* Note: copied from functions.php */
|
||||
if( !function_exists('membership_expired') ) {
|
||||
function membership_expired($uid) {
|
||||
$conn = db_connect();
|
||||
|
||||
$sql = sprintf("SELECT expires FROM din_user WHERE id=%s AND expires <= NOW()", $uid);
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if (DB :: isError($result) == true) {
|
||||
error("membership_expired: " . $result->toString());
|
||||
return false;
|
||||
}
|
||||
return $result->numRows() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: copied from functions.php */
|
||||
if( !function_exists('find_groups') ) {
|
||||
function find_groups($uid) {
|
||||
$conn = db_connect();
|
||||
$sql = "SELECT g.posix_group
|
||||
FROM din_usergrouprelationship ugr, din_user u, din_group g
|
||||
WHERE ugr.user_id = $uid
|
||||
AND ugr.user_id = u.id
|
||||
AND ugr.group_id = g.id";
|
||||
$conn->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$result = $conn->getAll($sql);
|
||||
function find_groups($uid) {
|
||||
$conn = db_connect();
|
||||
$sql = "SELECT g.posix_group
|
||||
FROM din_usergrouprelationship ugr, din_user u, din_group g
|
||||
WHERE ugr.user_id = $uid
|
||||
AND ugr.user_id = u.id
|
||||
AND ugr.group_id = g.id";
|
||||
$conn->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$result = $conn->getAll($sql);
|
||||
|
||||
if(DB :: isError($result)) {
|
||||
return false;
|
||||
}
|
||||
$arr = array();
|
||||
foreach($result as $column => $group) {
|
||||
$arr[] = $group['posix_group'];
|
||||
}
|
||||
if(DB :: isError($result)) {
|
||||
return false;
|
||||
}
|
||||
$arr = array();
|
||||
foreach($result as $column => $group) {
|
||||
$arr[] = $group['posix_group'];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user