| 1 |
<?php |
| 2 |
|
| 3 |
namespace LAM\HELP; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
use ScopeAndModuleValidation; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
include_once(__DIR__ . "/../lib/ldap.inc"); |
| 40 |
|
| 41 |
|
| 42 |
include_once(__DIR__ . "/../lib/config.inc"); |
| 43 |
|
| 44 |
|
| 45 |
include_once(__DIR__ . "/../lib/selfService.inc"); |
| 46 |
if (!empty($_GET['selfService']) && ($_GET['selfService'] === '1')) { |
| 47 |
session_name('SELFSERVICE'); |
| 48 |
} |
| 49 |
|
| 50 |
if (isFileBasedSession()) { |
| 51 |
session_save_path("../sess"); |
| 52 |
} |
| 53 |
lam_start_session(); |
| 54 |
|
| 55 |
|
| 56 |
include_once(__DIR__ . "/../lib/status.inc"); |
| 57 |
|
| 58 |
setlanguage(); |
| 59 |
|
| 60 |
|
| 61 |
include_once(__DIR__ . "/../help/help.inc"); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
function echoHTMLHead(): void { |
| 68 |
echo $_SESSION['header']; |
| 69 |
$title = "LDAP Account Manager Help"; |
| 70 |
printHeaderContents($title, '..'); |
| 71 |
?> |
| 72 |
</head> |
| 73 |
<body> |
| 74 |
<?php |
| 75 |
|
| 76 |
printJsIncludes('..'); |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
function echoHTMLFoot(): void { |
| 83 |
?> |
| 84 |
</body> |
| 85 |
</html> |
| 86 |
<?php |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
function displayHelp(array $helpEntry): void { |
| 95 |
echoHTMLHead(); |
| 96 |
echo "<h1 class=\"help\">" . $helpEntry['Headline'] . "</h1>\n"; |
| 97 |
$format = "<p class=\"help\">" . $helpEntry['Text'] . "</p>\n"; |
| 98 |
if (isset($helpEntry['attr'])) { |
| 99 |
$format .= '<br><hr>' . _('Technical name') . ': <i>' . $helpEntry['attr'] . '</i>'; |
| 100 |
} |
| 101 |
echo $format; |
| 102 |
if (isset($helpEntry['SeeAlso']) && is_array($helpEntry['SeeAlso'])) { |
| 103 |
echo '<p class="help">' . _('See also') . ': <a class="helpSeeAlso" href="' . $helpEntry['SeeAlso']['link'] . '">' . $helpEntry['SeeAlso']['text'] . '</a></p>'; |
| 104 |
} |
| 105 |
echoHTMLFoot(); |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
if (!isset($_GET['HelpNumber'])) { |
| 110 |
$errorMessage = "Sorry no help number submitted."; |
| 111 |
echoHTMLHead(); |
| 112 |
statusMessage("ERROR", "", $errorMessage); |
| 113 |
echoHTMLFoot(); |
| 114 |
exit; |
| 115 |
} |
| 116 |
|
| 117 |
$helpEntry = []; |
| 118 |
|
| 119 |
|
| 120 |
if (isset($_GET['module']) && ($_GET['module'] != 'main') && ($_GET['module'] != '')) { |
| 121 |
include_once(__DIR__ . "/../lib/modules.inc"); |
| 122 |
$moduleName = $_GET['module']; |
| 123 |
if (!ScopeAndModuleValidation::isValidModuleName($moduleName)) { |
| 124 |
logNewMessage(LOG_ERR, 'Invalid module name: ' . $moduleName); |
| 125 |
die(); |
| 126 |
} |
| 127 |
$helpEntry = getHelp($moduleName, $_GET['HelpNumber']); |
| 128 |
if (!$helpEntry) { |
| 129 |
$variables = [htmlspecialchars((string) $_GET['HelpNumber']), htmlspecialchars((string) $moduleName)]; |
| 130 |
$errorMessage = _("Sorry, the help id '%s' is not available for the module '%s'."); |
| 131 |
echoHTMLHead(); |
| 132 |
statusMessage("ERROR", "", $errorMessage, $variables); |
| 133 |
echoHTMLFoot(); |
| 134 |
exit; |
| 135 |
} |
| 136 |
} |
| 137 |
elseif (!array_key_exists($_GET['HelpNumber'], $helpArray)) { |
| 138 |
|
| 139 |
$variables = [htmlspecialchars((string) $_GET['HelpNumber'])]; |
| 140 |
$errorMessage = _("Sorry, the help number %s is not available."); |
| 141 |
echoHTMLHead(); |
| 142 |
statusMessage("ERROR", "", $errorMessage, $variables); |
| 143 |
echoHTMLFoot(); |
| 144 |
exit; |
| 145 |
} |
| 146 |
else { |
| 147 |
$helpEntry = $helpArray[$_GET['HelpNumber']]; |
| 148 |
} |
| 149 |
|
| 150 |
displayHelp($helpEntry); |