function array2html($dirlist, $path = "/") { $html = "<ul>"; if ($path == "/") { $html .= "<li class='isFolder {$path}'><a href='{$path}' target=''>.</a></li>"; } foreach ($dirlist as $key => $item) { if (is_string($item)) { $html .= "<li class='isFile {$path}'><a href='{$path}{$key}' target='{$path}'>{$key}</a></li>"; } if (is_array($item)) { $cpath = "{$path}{$key}/"; $html .= "<li class='isFolder {$path}'><a href='{$cpath}' target='{$path}'>{$key}</a>" . array2html($item, $cpath) . "</li>"; } } $html .= "</ul>"; return $html; }
if ($test_username !== '' and $test_password !== '') { $test_username = canonicalize_whitespace($test_username); if (isset($cas_valid) and $cas_valid) { $is_valid = true; } else { $is_valid = auth_user_login($auth, $test_username, $test_password, $settings); } if ($is_valid) { $auth_allow = 1; $tool_content .= "<div class='alert alert-success'>$langConnYes</div>"; // Debugging CAS if ($debugCAS) { if (!empty($cas_ret['message'])) $tool_content .= "<p>{$cas_ret['message']}</p>"; if (!empty($cas_ret['attrs']) && is_array($cas_ret['attrs'])) { $tmp_attrs = "<p>$langCASRetAttr:<br />" . array2html($cas_ret['attrs']); $tool_content .= "$tmp_attrs</p>"; } } } else { $tool_content .= "<div class='alert alert-danger'>$langConnNo"; if (isset($GLOBALS['auth_errors'])) { $tool_content .= "<p>$GLOBALS[auth_errors]</p>"; } $tool_content .= "</div>"; $auth_allow = 0; } } elseif ($auth < 8) { //display the wrong username/password message only if the auth method is NOT a hybridauth method $tool_content .= "<div class='alert alert-danger'>$langWrongAuth</div>"; $auth_allow = 0; } elseif ($auth >= 8) {
function array2html($array, $start = true) { $result = ''; foreach ($array as $key => $value) { $key = (string) $key; switch ($key) { case 'subjectPublicKey': $open = '<pre>'; $close = '</pre>'; break; case 'signature': $open = '<div style="overflow: auto; word-wrap: break-word">'; $close = '</div>'; break; default: $open = $close = ''; } $result .= '<li><span class="name">' . $key . '</span>' . (is_array($value) ? array2html($value, false) : '<ul><li>' . $open . htmlspecialchars($value) . $close . '</li></ul>') . '</li>'; } $start = $start ? ' class="printr"' : ''; return '<ul' . $start . '>' . $result . '</ul>'; }