changed getquotas to use account objects as input

This commit is contained in:
katagia 2003-11-08 18:51:48 +00:00
parent ab99775bc8
commit 4337a1c795
4 changed files with 134 additions and 235 deletions

View File

@ -192,13 +192,12 @@ function RndInt($Format){
/* Whis function will return the quotas from the specified user If empty only filesystems with enabled quotas are returned /* Whis function will return the quotas from the specified user If empty only filesystems with enabled quotas are returned
* $type = 'user' or 'group' * $users = array of account objects. If $user is a string (user or group)
* $users = array of users or groupnames. If no user or groupname is defined,
* an array with all quota-enabled partitions will be returned in this case all returned values are 0 exept mointpoint[x][0] * an array with all quota-enabled partitions will be returned in this case all returned values are 0 exept mointpoint[x][0]
*/ */
function getquotas($type,$users=array('+')) { function getquotas($users) {
// define new object // define new object
$return = new account(); $return = $users;
// get username and password of the current lam-admin // get username and password of the current lam-admin
$ldap_q = $_SESSION['ldap']->decrypt(); $ldap_q = $_SESSION['ldap']->decrypt();
/* $towrite has the following syntax: /* $towrite has the following syntax:
@ -210,6 +209,10 @@ function getquotas($type,$users=array('+')) {
/* scriptServer is the IP to remote-host to which lam should connect via ssh /* scriptServer is the IP to remote-host to which lam should connect via ssh
* scriptPath is Path to lamdaemon.pl on remote system * scriptPath is Path to lamdaemon.pl on remote system
*/ */
for($i=0; $i<count($return); $i++)
// put string to trasmit together
if ($return[$i]->general_username!='') $userstring .= $return[$i]->general_username." quota get ".$return[$i]->type."\n";
else $userstring .= "+ quota get ".$return[$i]->type."\n";
if (function_exists(proc_open)) { if (function_exists(proc_open)) {
// New Code, requires PHP 4.3 // New Code, requires PHP 4.3
$descriptorspec = array( $descriptorspec = array(
@ -226,30 +229,24 @@ function getquotas($type,$users=array('+')) {
* $pipes[1] is readable handle to child stdout * $pipes[1] is readable handle to child stdout
* any error is send to /dev/null * any error is send to /dev/null
*/ */
foreach ($users as $user) { // Write one output-line for every user
// put string to trasmit together fwrite($pipes[0], $userstring);
$userstring = "$user quota get $type\n";
// Write one output-line for every user
fwrite($pipes[0], $userstring);
}
fclose($pipes[0]); fclose($pipes[0]);
while (!feof($pipes[1])) { while (!feof($pipes[1])) {
$output = fgets($pipes[1], 1024); $output = fgets($pipes[1], 1024);
if ($output!='') $vals5[] = $output; if ($output!='') $output_array[] = $output;
} }
fclose($pipes[1]); fclose($pipes[1]);
$return_value = proc_close($process); $return_value = proc_close($process);
} }
} }
else { // PHP 4.3> else { // PHP 4.3>
$input = "";
foreach ($users as $user) $input .= "$user quota get $type\n";
$command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite; $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".$towrite;
$pipe = popen("echo \"$input\"|$command" , 'r'); $pipe = popen("echo \"$userstring\"|$command" , 'r');
$output = ''; $output = '';
while(!feof($pipe)) { while(!feof($pipe)) {
$output .= fread($pipe, 1024); $output .= fread($pipe, 1024);
if ($output!='') $vals5[] = $output; if ($output!='') $output_array[] = $output;
} }
pclose($pipe); pclose($pipe);
} }
@ -261,22 +258,29 @@ function getquotas($type,$users=array('+')) {
* mountpoint, used blocks, soft block limit, hard block limit, grace block period, used inodes, * mountpoint, used blocks, soft block limit, hard block limit, grace block period, used inodes,
* soft inode limit, hard inode limit, grace inode period * soft inode limit, hard inode limit, grace inode period
*/ */
if (is_array($vals5)) for ($i=0; $i<count($return); $i++) {
foreach ($vals5 as $vals3) { $all_quota = explode(':', $output_array[$i]);
$vals = explode(':', $vals3); for ($j=0; $j<sizeof($all_quota)-1; $j++) {
for ($i=0; $i<sizeof($vals)-1; $i++) { $single_quota = explode(',', $all_quota[$j]);
$vals2 = explode(',', $vals[$i]); // unset not existing quotas from account-object
for ($j=0; $j<sizeof($vals2); $j++) { // collect all existing mountpoints in array
$return->quota[$i][$j] = $vals2[$j]; $real_quotas[] = $single_quota[0];
} for ($k=0; $k<sizeof($single_quota); $k++)
if ($return->quota[$i][4]<$time) $return->quota[$i][4] = ''; $return[$i]->quota[$j][$k] = $single_quota[$k];
else $return->quota[$i][4] = strval(($return->quota[$i][4]-$time)/3600) .' '. _('hours'); if ($return[$i]->quota[$j][4]<time()) $return[$i]->quota[$j][4] = '';
if ($return->quota[$i][8]<$time) $return->quota[$i][8] = ''; else $return[$i]->quota[$j][4] = strval(($return[$i]->quota[$j][4]-time())/3600) .' '. _('hours');
else $return->quota[$i][8] = strval(($return->quota[$i][8]-$time)/3600) .' '. _('hours'); if ($return[$i]->quota[$j][8]<time()) $return[$i]->quota[$j][8] = '';
} else $return[$i]->quota[$j][8] = strval(($return[$i]->quota[$j][8]-time())/3600) .' '. _('hours');
$return2[] = $return;
} }
return $return2; $j=0;
while (isset($return[$i]->quota[$j][0]))
// remove invalid quotas
if (!in_array($return[$i]->quota[$j][0], $real_quotas)) unset($return[$i]->quota[$j]);
else $j++;
// Beautify array, repair index
$return[$i]->quota = array_values($return[$i]->quota);
}
return $return;
} }

View File

@ -93,37 +93,24 @@ else if (count($_POST)==0) {
$account_new ->type = 'group'; $account_new ->type = 'group';
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('group'); $quotas = getquotas(array($account_new));
if (isset($account_new->quota[0])) { for ($i=0; $i<count($account_new->quota); $i++) $profile_quotas[] = $account_new->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($account_new->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $account_new->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values[0]->quota); $j++)
if ($values->quota[$j][0]==$account_new->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($account_new->quota[$i]);
else {
// Set missing part in quota-array
$account_new->quota[$i][1] = $values[0]->quota[$found][1];
$account_new->quota[$i][5] = $values[0]->quota[$found][5];
$account_new->quota[$i][4] = $values[0]->quota[$found][4];
$account_new->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $account_new->quota[]=$quotas[0]->quota[$i];
$account_new->quota = array_values($account_new->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($account_new->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $account_new->$key = $val; if (!in_array($account_new->quota[$j][0], $real_quotas)) unset($account_new->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$account_new->quota = array_values($account_new->quota);
} }
// Display general-page // Display general-page
$select_local = 'general'; $select_local = 'general';
@ -284,15 +271,8 @@ switch ($_POST['select']) {
if ($_POST['outputpdf']) { if ($_POST['outputpdf']) {
// Load quotas if not yet done because they are needed for the pdf-file // Load quotas if not yet done because they are needed for the pdf-file
if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas
$values = getquotas('group', array($account_old->general_username)); $quotas = getquotas(array($account_old));
if (is_object($values[0])) { $account_new = $quotas[0];
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_new->$key = $val;
}
if (is_object($values[0]) && isset($account_old)) {
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_old->$key = $val;
}
} }
// Create / display PDf-file // Create / display PDf-file
createGroupPDF(array($account_new)); createGroupPDF(array($account_new));
@ -401,37 +381,24 @@ do { // X-Or, only one if() can be true
} }
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('group'); $quotas = getquotas(array($account_new));
if (isset($account_new->quota[0])) { for ($i=0; $i<count($account_new->quota); $i++) $profile_quotas[] = $account_new->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($account_new->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $account_new->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values[0]->quota); $j++)
if ($values[0]->quota[$j][0]==$account_new->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($account_new->quota[$i]);
else {
// Set missing part in quota-array
$account_new->quota[$i][1] = $values[0]->quota[$found][1];
$account_new->quota[$i][5] = $values[0]->quota[$found][5];
$account_new->quota[$i][4] = $values[0]->quota[$found][4];
$account_new->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $account_new->quota[]=$quotas[0]->quota[$i];
$account_new->quota = array_values($account_new->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($account_new->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $account_new->$key = $val; if (!in_array($account_new->quota[$j][0], $real_quotas)) unset($account_new->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$account_new->quota = array_values($account_new->quota);
} }
// select general page after group has been loaded // select general page after group has been loaded
$select_local='general'; $select_local='general';
@ -739,15 +706,8 @@ switch ($select_local) {
// Quota Settings // Quota Settings
// Load quotas if not yet done // Load quotas if not yet done
if ($config_intern->scriptServer && !isset($account_new->quota[0]) ) { // load quotas if ($config_intern->scriptServer && !isset($account_new->quota[0]) ) { // load quotas
$values = getquotas('group', array($account_new->general_username)); $quotas = getquotas(array($account_new));
if (is_object($values[0])) { $account_new = $quotas[0];
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_new->$key = $val;
}
if (is_object($values[0]) && isset($account_old)) {
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_old->$key = $val;
}
} }
echo "<input name=\"select\" type=\"hidden\" value=\"samba\">\n"; echo "<input name=\"select\" type=\"hidden\" value=\"samba\">\n";
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >"; echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";

View File

@ -89,7 +89,7 @@ if (isset($_GET['DN']) && $_GET['DN']!='') {
// Display general-page // Display general-page
$select_local = 'general'; $select_local = 'general';
} }
// Startcondition. useredit.php was called from outside to create a new group // Startcondition. useredit.php was called from outside to create a new user
else if (count($_POST)==0) { else if (count($_POST)==0) {
// Create new account object with settings from default profile // Create new account object with settings from default profile
// Check if there are valid groups. Can not create user with no primary group // Check if there are valid groups. Can not create user with no primary group
@ -114,37 +114,24 @@ if (isset($_GET['DN']) && $_GET['DN']!='') {
$account_new ->type = 'user'; $account_new ->type = 'user';
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('user'); $quotas = getquotas(array($account_new));
if (isset($account_new->quota[0])) { for ($i=0; $i<count($account_new->quota); $i++) $profile_quotas[] = $account_new->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($account_new->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $account_new->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values[0]->quota); $j++)
if ($values[0]->quota[$j][0]==$account_new->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($account_new->quota[$i]);
else {
// Set missing part in quota-array
$account_new->quota[$i][1] = $values[0]->quota[$found][1];
$account_new->quota[$i][5] = $values[0]->quota[$found][5];
$account_new->quota[$i][4] = $values[0]->quota[$found][4];
$account_new->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $account_new->quota[]=$quotas[0]->quota[$i];
$account_new->quota = array_values($account_new->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($account_new->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $account_new->$key = $val; if (!in_array($account_new->quota[$j][0], $real_quotas)) unset($account_new->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$account_new->quota = array_values($account_new->quota);
} }
// Display general-page // Display general-page
$select_local = 'general'; $select_local = 'general';
@ -518,15 +505,9 @@ switch ($_POST['select']) {
if ($_POST['outputpdf']) { if ($_POST['outputpdf']) {
// Load quotas if not yet done because they are needed for the pdf-file // Load quotas if not yet done because they are needed for the pdf-file
if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas
$values = getquotas('user', array($account_old->general_username)); $quotas = getquotas(array($account_old));
if (is_object($values[0])) { $account_new = $quotas[0];
while (list($key, $val) = each($values[0])) // Set only defined values $account_new->quota = $account_old->quota;
if (isset($val)) $account_new->$key = $val;
}
if (is_object($values[0]) && isset($account_old)) {
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_old->$key = $val;
}
} }
// Create / display PDf-file // Create / display PDf-file
createUserPDF(array($account_new)); createUserPDF(array($account_new));
@ -689,37 +670,24 @@ do { // X-Or, only one if() can be true
$account_new->smb_smbhome = str_replace('$user', $account_new->general_username, $account_new->smb_smbhome); $account_new->smb_smbhome = str_replace('$user', $account_new->general_username, $account_new->smb_smbhome);
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('user'); $quotas = getquotas(array($account_new));
if (isset($account_new->quota[0])) { for ($i=0; $i<count($account_new->quota); $i++) $profile_quotas[] = $account_new->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($account_new->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $account_new->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values[0]->quota[$j][0]==$account_new->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($account_new->quota[$i]);
else {
// Set missing part in quota-array
$account_new->quota[$i][1] = $values[0]->quota[$found][1];
$account_new->quota[$i][5] = $values[0]->quota[$found][5];
$account_new->quota[$i][4] = $values[0]->quota[$found][4];
$account_new->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $account_new->quota[]=$quotas[0]->quota[$i];
$account_new->quota = array_values($account_new->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($account_new->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $account_new->$key = $val; if (!in_array($account_new->quota[$j][0], $real_quotas)) unset($account_new->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$account_new->quota = array_values($account_new->quota);
} }
// select general page after group has been loaded // select general page after group has been loaded
$select_local='general'; $select_local='general';
@ -1410,15 +1378,8 @@ switch ($select_local) {
// Quota Settings // Quota Settings
// Load quotas if not yet done // Load quotas if not yet done
if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas if ($config_intern->scriptServer && !isset($account_new->quota[0])) { // load quotas
$values = getquotas('user', array($account_old->general_username)); $quotas = getquotas(array($account_old));
if (is_object($values[0])) { $account_new = $quotas[0];
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_new->$key = $val;
}
if (is_object($values[0]) && isset($account_old)) {
while (list($key, $val) = each($values[0])) // Set only defined values
if (isset($val)) $account_old->$key = $val;
}
} }
echo "<input name=\"select\" type=\"hidden\" value=\"quota\">\n"; echo "<input name=\"select\" type=\"hidden\" value=\"quota\">\n";
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >"; echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";

View File

@ -173,37 +173,24 @@ switch ($select) {
// load quotas from profile and check if they are valid // load quotas from profile and check if they are valid
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('group'); $quotas = getquotas(array($group));
if (isset($group->quota[0])) { for ($i=0; $i<count($group->quota); $i++) $profile_quotas[] = $group->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($group->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $group->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values[0]->quota); $j++)
if ($values[0]->quota[$j][0]==$group->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($group->quota[$i]);
else {
// Set missing part in quota-array
$group->quota[$i][1] = $values[0]->quota[$found][1];
$group->quota[$i][5] = $values[0]->quota[$found][5];
$group->quota[$i][4] = $values[0]->quota[$found][4];
$group->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $group->quota[]=$quotas[0]->quota[$i];
$group->quota = array_values($group->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($group->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $group->$key = $val; if (!in_array($group->quota[$j][0], $real_quotas)) unset($group->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$group->quota = array_values($group->quota);
} }
// Get groupname from current user // Get groupname from current user
$group->general_username=$_SESSION['accounts'][$_SESSION['pointer']]->general_group; $group->general_username=$_SESSION['accounts'][$_SESSION['pointer']]->general_group;
@ -467,37 +454,24 @@ function loadfile() {
$profile->type = 'user'; $profile->type = 'user';
if ($config_intern->scriptServer) { if ($config_intern->scriptServer) {
// load quotas and check if quotas from profile are valid // load quotas and check if quotas from profile are valid
$values = getquotas('user'); $quotas = getquotas(array($profile));
if (isset($profile->quota[0])) { for ($i=0; $i<count($profile->quota); $i++) $profile_quotas[] = $profile->quota[$i][0];
// check quotas from profile for ($i=0; $i<count($quotas[0]->quota); $i++) {
$i=0; $real_quotas[] = $quotas[0]->quota[$i][0];
// check quota settings, loop for every partition with quotas if (is_array($profile_quotas)) {
while (isset($profile->quota[$i])) { if (!in_array($quotas[0]->quota[$i][0], $profile_quotas)) $profile->quota[]=$quotas[0]->quota[$i];
// search if quotas from profile fit to a real quota
$found = (-1);
for ($j=0; $j<count($values[0]->quota); $j++)
if ($values[0]->quota[$j][0]==$profile->quota[$i][0]) $found = $j;
// unset quota from profile if quotas (mointpoint) doesn't exists anymore
if ($found==-1) unset($profile->quota[$i]);
else {
// Set missing part in quota-array
$profile->quota[$i][1] = $values[0]->quota[$found][1];
$profile->quota[$i][5] = $values[0]->quota[$found][5];
$profile->quota[$i][4] = $values[0]->quota[$found][4];
$profile->quota[$i][8] = $values[0]->quota[$found][8];
$i++;
}
} }
// Beautify array, repair index else $profile->quota[]=$quotas[0]->quota[$i];
$profile->quota = array_values($profile->quota);
} }
else { // No quotas saved in profile $j=0;
// Display quotas for new users (Quota set to 0) // delete not existing quotas
if (is_object($values[0])) { while (isset($profile->quota[$j][0])) {
while (list($key, $val) = each($values[0])) // Set only defined values // remove invalid quotas
if (isset($val)) $profile->$key = $val; if (!in_array($profile->quota[$j][0], $real_quotas)) unset($profile->quota[$j]);
} else $j++;
} }
// Beautify array, repair index
$profile->quota = array_values($profile->quota);
} }
// Get keys to en/decrypt passwords // Get keys to en/decrypt passwords
$iv = base64_decode($_COOKIE["IV"]); $iv = base64_decode($_COOKIE["IV"]);