refactoring

This commit is contained in:
Roland Gruber 2018-12-23 11:01:29 +01:00
parent e289cabe3f
commit 2a10013f36
10 changed files with 45 additions and 28 deletions

View File

@ -192,24 +192,24 @@ class lamList {
// show form
echo "<div class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">";
echo "<div id=\"listTabContentArea\">\n";
echo ("<form action=\"list.php?type=" . $this->type->getId() . "&amp;norefresh=true\" method=\"post\">\n");
echo "<form action=\"list.php?type=" . $this->type->getId() . "&amp;norefresh=true\" method=\"post\">\n";
// draw account list if accounts were found
if (sizeof($this->entries) > 0) {
// buttons
$this->listPrintButtons(false);
echo ("<br>\n");
echo "<br>\n";
// navigation bar
$this->listDrawNavigationBar(sizeof($this->entries));
echo ("<br>\n");
echo "<br>\n";
$this->printAccountTable($this->entries);
}
else {
// buttons
$this->listPrintButtons(true);
echo ("<br>\n");
echo "<br>\n";
// navigation bar
$this->listDrawNavigationBar(sizeof($this->entries));
echo ("<br>\n");
echo "<br>\n";
$accounts = array();
$this->printAccountTable($accounts);
echo "</table><br>\n";
@ -267,8 +267,9 @@ class lamList {
* @param array $info the account list
*/
protected function listCreateSortMapping(&$info) {
if (!is_array($this->attrArray)) return;
if (!is_string($this->sortColumn)) return;
if (!is_array($this->attrArray) || !is_string($this->sortColumn)) {
return;
}
$toSort = array();
$col = $this->sortColumn;
$size = sizeof($info);
@ -498,8 +499,12 @@ class lamList {
private function addDataElements(&$data, &$info, &$onClickEvents, &$onDoubleClickEvents) {
// calculate which rows to show
$table_begin = ($this->page - 1) * $this->maxPageEntries;
if (($this->page * $this->maxPageEntries) > sizeof($info)) $table_end = sizeof($info);
else $table_end = ($this->page * $this->maxPageEntries);
if (($this->page * $this->maxPageEntries) > sizeof($info)) {
$table_end = sizeof($info);
}
else {
$table_end = ($this->page * $this->maxPageEntries);
}
// get sort mapping
$sortMapping = &$this->sortMapping;
if (empty($sortMapping)) {
@ -964,8 +969,12 @@ class lamList {
exit();
}
// get current page
if (!empty($_GET["page"])) $this->page = $_GET["page"];
else $this->page = 1;
if (!empty($_GET["page"])) {
$this->page = $_GET["page"];
}
else {
$this->page = 1;
}
// generate attribute-description table
$temp_array = $this->listGetAttributeDescriptionList();
$this->attrArray = array_keys($temp_array); // list of LDAP attributes to show

View File

@ -152,7 +152,7 @@ $tabindex = 1;
echo $_SESSION['header'];
printHeaderContents(_("LDAP Account Manager Configuration"), '../..');
echo ("<body class=\"admin\">\n");
echo "<body class=\"admin\">\n";
// include all JavaScript files
printJsIncludes('../..');
printConfigurationPageHeaderBar($conf);
@ -171,7 +171,7 @@ if (sizeof($errorsToDisplay) > 0) {
}
// display formular
echo ("<form enctype=\"multipart/form-data\" action=\"confmain.php\" method=\"post\" autocomplete=\"off\">\n");
echo "<form enctype=\"multipart/form-data\" action=\"confmain.php\" method=\"post\" autocomplete=\"off\">\n";
printConfigurationPageTabs(ConfigurationPageTab::GENERAL);

View File

@ -117,9 +117,11 @@ printJsIncludes('../..');
printConfigurationPageHeaderBar($conf);
// print error messages
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) {
call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
}
echo ("<form id=\"inputForm\" action=\"confmodules.php\" method=\"post\" onSubmit=\"saveScrollPosition('inputForm')\">\n");
echo "<form id=\"inputForm\" action=\"confmodules.php\" method=\"post\" onSubmit=\"saveScrollPosition('inputForm')\">\n";
printConfigurationPageTabs(ConfigurationPageTab::MODULES);

View File

@ -143,9 +143,11 @@ printJsIncludes('../..');
printConfigurationPageHeaderBar($conf);
// print error messages
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) {
call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
}
echo ("<form action=\"conftypes.php\" method=\"post\">\n");
echo "<form action=\"conftypes.php\" method=\"post\">\n";
printConfigurationPageTabs(ConfigurationPageTab::TYPES);

View File

@ -111,9 +111,11 @@ printJsIncludes('../..');
printConfigurationPageHeaderBar($conf);
// print error messages
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) {
call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
}
echo ("<form id=\"inputForm\" action=\"moduleSettings.php\" method=\"post\" autocomplete=\"off\" onSubmit=\"saveScrollPosition('inputForm')\">\n");
echo "<form id=\"inputForm\" action=\"moduleSettings.php\" method=\"post\" autocomplete=\"off\" onSubmit=\"saveScrollPosition('inputForm')\">\n";
printConfigurationPageTabs(ConfigurationPageTab::MODULE_SETTINGS);

View File

@ -229,7 +229,7 @@ function display_LoginPage($licenseValidator, $error_message) {
</td>
<td align="center" height=30 width="34%">
<span class="hide-for-small">
<a href="http://www.ldap-account-manager.org/lamcms/lamPro"> <?php if (!isLAMProVersion()) { echo (_("Want more features? Get LAM Pro!"));} ?> </a>
<a href="http://www.ldap-account-manager.org/lamcms/lamPro"> <?php if (!isLAMProVersion()) { echo _("Want more features? Get LAM Pro!");} ?> </a>
</span>
</td>
<td align="right" height=30 width="34%">

View File

@ -62,7 +62,9 @@ startSecureSession();
enforceUserIsLoggedIn();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
if (!checkIfWriteAccessIsAllowed()) {
die();
}
checkIfToolIsActive('ImportExport');
@ -175,7 +177,7 @@ function printImportTabContent(&$tabindex) {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
}
/**
@ -220,7 +222,7 @@ function printImportTabProcessing(&$tabindex) {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
}
/**
@ -303,7 +305,7 @@ function printExportTabContent(&$tabindex) {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
}
/**
@ -380,7 +382,7 @@ function printExportTabProcessing(&$tabindex) {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
}
/**

View File

@ -201,7 +201,7 @@ function displayStartPage() {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
echo '</div>';
include '../../lib/adminFooter.inc';
}

View File

@ -228,7 +228,7 @@ function display_main($message, $error) {
addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n");
echo "</form>\n";
echo '</div>';
include '../../lib/adminFooter.inc';
}

View File

@ -15,4 +15,4 @@ sonar.links.issue=https://github.com/LDAPAccountManager/lam
sonar.sources=lam
sonar.tests=lam/tests
sonar.exclusions=**/3rdParty/**,**/lib/extra/**,**/lib/*jquery*.js,**/tests/**,**/style/*jquery*.css,,**/style/*cropper*.css,**/style/*magnific*.css
sonar.exclusions=**/3rdParty/**,**/lib/extra/**,**/lib/*jquery*.js,**/tests/**,**/style/*jquery*.css,,**/style/*cropper*.css,**/style/*magnific*.css,**/schema.inc