19 |
19 |
$config_file = realpath('config.php');
|
20 |
20 |
if(file_exists($config_file) && !defined('WB_URL'))
|
21 |
21 |
{
|
22 |
|
require_once($config_file);
|
|
22 |
require($config_file);
|
23 |
23 |
}
|
24 |
24 |
|
25 |
25 |
//require_once(WB_PATH.'/framework/class.admin.php');
|
... | ... | |
74 |
74 |
'[ADMIN]/preferences/email.php',
|
75 |
75 |
'[ADMIN]/preferences/password.php',
|
76 |
76 |
'[ADMIN]/pages/settings2.php',
|
|
77 |
'[ADMIN]/users/users.php',
|
77 |
78 |
|
78 |
79 |
'[FRAMEWORK]/class.msg_queue.php',
|
79 |
80 |
'[FRAMEWORK]/class.logfile.php',
|
... | ... | |
797 |
798 |
echo implode(PHP_EOL,$aDebugMessage);
|
798 |
799 |
}
|
799 |
800 |
$aDebugMessage = array();
|
|
801 |
echo '<h3>Step '.(++$stepID).': Updating group_id in table users</h3>';
|
|
802 |
/**********************************************************
|
|
803 |
* Updating group_id in table users
|
|
804 |
*/
|
800 |
805 |
|
|
806 |
echo '<div style="margin-left:2em;">';
|
|
807 |
$aUsers = array();
|
|
808 |
// Get existing values
|
|
809 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'users` ' ;
|
|
810 |
$sql .= 'WHERE `user_id` != 1 ';
|
|
811 |
if($oUser = $database->query($sql)){
|
|
812 |
$iTotalUsers = $oUser->numRows();
|
|
813 |
while($Users = $oUser->fetchRow(MYSQL_ASSOC)) {
|
|
814 |
|
|
815 |
$aUsers[$Users['user_id']]['groups_id'] = $Users['groups_id'];
|
|
816 |
$aUsers[$Users['user_id']]['display_name'] = $Users['display_name'];
|
|
817 |
}
|
|
818 |
} else {
|
|
819 |
$aDebugMessage[] = $database->is_error()==false ? " $OK<br />" : " $FAIL!<br />";
|
|
820 |
}
|
|
821 |
|
|
822 |
foreach($aUsers AS $user_id => $value){
|
|
823 |
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
|
|
824 |
$groups_id = explode(',', $aUsers[$user_id]['groups_id']);
|
|
825 |
$group_id = 0;
|
|
826 |
//if user is in administrator-group, get this group else just get the first one
|
|
827 |
if($admin->is_group_match($groups_id,'1')) { $group_id = 1; } else { $group_id = intval($groups_id[0]); }
|
|
828 |
unset($groups_id);
|
|
829 |
|
|
830 |
$sMessage = "<span>Updating group_id ".$TEXT['DISPLAY_NAME']." " .$aUsers[$user_id]['display_name']."</span>";
|
|
831 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` ';
|
|
832 |
$sql .= 'SET `group_id` = '.$group_id.' ';
|
|
833 |
$sql .= 'WHERE `user_id` = '.intval($user_id);
|
|
834 |
|
|
835 |
if($oRes = $database->query($sql)){ }
|
|
836 |
$aDebugMessage[] = $database->is_error()==false ? $sMessage." $OK<br />" : $sMessage." $FAIL!<br />";
|
|
837 |
}
|
|
838 |
unset($aUsers);
|
|
839 |
|
|
840 |
$aDebugMessage[] = '</div>';
|
|
841 |
|
|
842 |
if($bDebugModus) {
|
|
843 |
// $aDebugMessage[] =
|
|
844 |
echo implode(PHP_EOL,$aDebugMessage);
|
|
845 |
}else {
|
|
846 |
echo '<span><strong>'.$iTotalUsers.' users updating the group_id</strong></span>'." $OK<br />";
|
|
847 |
echo '</div>';
|
|
848 |
}
|
|
849 |
|
|
850 |
$aDebugMessage = array();
|
801 |
851 |
echo '<h3>Step '.(++$stepID).': Updating acess and protected files in folders</h3>';
|
802 |
852 |
|
803 |
853 |
echo '<div style="margin-left:2em;">';
|
! upgrade-script fixed wrong users group_id, (Bug in users management)