Code cleanup
This commit is contained in:
parent
fc22acf0b4
commit
9b55c39abb
@ -38,7 +38,7 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
|
|||||||
$modulerawlist = explode("&", trim($_POST['modulelist'], "&"));
|
$modulerawlist = explode("&", trim($_POST['modulelist'], "&"));
|
||||||
|
|
||||||
//Make sure that gallery and user modules are first in the list
|
//Make sure that gallery and user modules are first in the list
|
||||||
$currentindex = 2;
|
$current_weight = 2;
|
||||||
$identity_provider = module::get_var("gallery", "identity_provider");
|
$identity_provider = module::get_var("gallery", "identity_provider");
|
||||||
foreach ($modulerawlist as $row) {
|
foreach ($modulerawlist as $row) {
|
||||||
$currentry = explode("=", $row);
|
$currentry = explode("=", $row);
|
||||||
@ -48,13 +48,13 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
|
|||||||
} elseif ($currentry[0] == $identity_provider) {
|
} elseif ($currentry[0] == $identity_provider) {
|
||||||
$modulelist[1] = $row;
|
$modulelist[1] = $row;
|
||||||
} else {
|
} else {
|
||||||
$modulelist[$currentindex] = $row;
|
$modulelist[$current_weight] = $row;
|
||||||
$currentindex++;
|
$current_weight++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($modulelist);
|
ksort($modulelist);
|
||||||
|
|
||||||
//Now we are ready to write the correct id values
|
//Write the correct weight values
|
||||||
$current_weight = 0;
|
$current_weight = 0;
|
||||||
foreach ($modulelist as $row) {
|
foreach ($modulelist as $row) {
|
||||||
$current_weight++;
|
$current_weight++;
|
||||||
@ -63,7 +63,7 @@ class Admin_Moduleorder_Controller extends Admin_Controller {
|
|||||||
db::build()
|
db::build()
|
||||||
->update("modules")
|
->update("modules")
|
||||||
->set("weight", $current_weight)
|
->set("weight", $current_weight)
|
||||||
->where("name", "=", $currentry[0])
|
->where("id", "=", $currentry[1])
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user