function guiLogin(&$session, $message) { guiStandardHeader($session, "Anmeldung für den InfoBasar", Th_LoginHeader, Th_LoginBodyStart); guiStartForm($session); if (!empty($message)) { $message = preg_replace('/^\\+/', '+++ Fehler: ', $message); guiParagraph($session, $message, false); } outDivision($session); if (!isset($_POST['login_user'])) { $_POST['login_user'] = $session->fUserName; $_POST['login_email'] = ''; } outTableAndRecord(); outTableTextField($session, 'Benutzername:', 'login_user', null, 32, 32); outTableRecordDelim(); outTablePasswordField($session, 'Passwort:', 'login_code', '', 32, 32); outTableRecordDelim(); outTableButton($session, ' ', 'but_login', 'Anmelden'); outTableAndRecordEnd(); guiLine($session, 2); guiParagraph($session, 'Passwort vergessen?', false); outTableAndRecord(); outTableTextField($session, 'EMail-Adresse:', 'login_email', null, 32, 0); outTableRecordDelim(); outTableButton($session, ' ', 'but_forget', 'Passwort ändern'); outTableAndRecordEnd(); echo '(Das neue Passwort wird dann zugeschickt.)'; outNewline(); outStrong('Achtung:'); echo 'Benutzername muss ausgefüllt sein!'; outDivisionEnd($session); guiFinishForm($session, $session); guiStandardBodyEnd($session, Th_LoginBodyEnd); return 1; }
function guiStandardBodyEnd(&$session, $pos) { $session->trace(TC_Gui1, 'guiStandardBodyEnd'); $html = guiParam($session, $pos, null); if (!empty($html)) { echo $session->replaceMacrosNoHTML($html); } else { if (!defined('Th_LoginBodyEnd')) { define('Th_LoginBodyEnd', 0); } if ($pos != Th_LoginBodyEnd) { guiLine(1); modStandardLinks($session); echo '</body>'; } } echo "\n" . '</body></html>' . "\n"; }
function guiFinishBody(&$session) { $session->trace(TC_Gui2, 'guiFinishBody'); guiLine($session, 1); // ($session, ') echo "\n</body>\n</html>\n"; }
function baseAccount(&$session, $message) { $session->trace(TC_Gui1, 'baseAccount'); $reload = false; if (isset($_POST['account_user']) && !empty($_POST['account_user'])) { $account_user = $_POST['account_user']; } else { $account_user = $session->fUserName; $reload = true; } if (!empty($_POST['account_user2']) && $account_user != $_POST['account_user2']) { $account_user = $_POST['account_user2']; $reload = true; } if (!$reload) { $id = dbUserId($session, $account_user); } else { list($id, $_POST['account_locked'], $_POST['account_width'], $_POST['account_height'], $_POST['account_maxhits'], $_POST['account_theme'], $_POST['account_startpage'], $_POST['account_email']) = dbGetRecordByClause($session, T_User, 'id,locked,width,height,maxhits,theme,startpage,email', 'name=' . dbSqlString($session, $account_user)); } guiStandardHeader($session, 'Einstellungen für ' . $account_user, Th_StandardHeader, Th_StandardBodyStart); if (!empty($message)) { guiParagraph($session, $message, false); } guiStartForm($session); outDivision($session); outHiddenField($session, 'account_user', $account_user); outTable(); outTableRecordCells('Benutzername', $account_user); outTableRecord(); outTablePasswordField($session, 'Passwort:', 'account_code', '', 64, 32); outTableRecordDelim(); outTablePasswordField($session, 'Wiederholung:', 'account_code2', '', 64, 32); outTableRecordDelim(); outTableTextField($session, 'EMail:', 'account_email', null, 64, 64); outTableRecordDelim(); outTableCheckBox($session, 'Gesperrt', 'account_locked', 'Gesperrt'); outTableRecordDelim(); dbGetThemes($session, $theme_names, $theme_numbers); outTableComboBox($session, 'Oberfläche (Skin):', 'account_theme', $theme_names, $theme_numbers, array_search($_POST['account_theme'], $theme_numbers)); outTableRecordDelim(); outTableTextField($session, 'Eingabefeldbreite:', 'account_width', null, 64, 3); outTableRecordDelim(); outTableTextField($session, 'Eingabefeldhöhe:', 'account_height', null, 64, 3); outTableRecordDelim(); outTableTextField($session, 'Zahl Suchergebnisse:', 'account_maxhits', null, 64, 3); outTableRecordDelim(); $names = array('WikiSeite:', 'Übersicht', 'Einstellungen', 'Wikisuche', 'Letze Änderungen', 'StartSeite', 'Hilfe'); $values = array('', P_Home, P_Account, P_Search, P_LastChanges, 'StartSeite', 'Hilfe'); if (($pos = strpos($_POST['account_startpage'], '!')) == 0 && is_int($pos)) { $ix = array_search($_POST['account_startpage'], $values); } else { $ix = 0; } outTableCell('Startseite:'); outTableDelim(); outComboBox($session, 'account_startpageoffer', $names, $values, $ix); echo ' '; outTextField($session, 'account_startpage', null, 45, 128); outTableDelimAndRecordEnd(); modUserTableData($session, $id); outTableEnd(); modUserOwnData($session, $id); outNewline(); outButton($session, "account_change", "Ändern"); outNewline(); outNewline(); $change = $session->hasRight(R_User, R_Put); $new = $session->hasRight(R_User, R_New); $new = $session->fUserId <= 2 || $session->fUserName == 'wk' || $session->fUserName == 'admin' || $session->testFeature(FEATURE_SIMPLE_USER_MANAGEMENT) || strpos($session->fUserName, $session->fAdmins) > 0; $change = $new; if ($change || $new) { guiLine($session, 2); outTableAndRecord(); outTableTextField($session, 'Name:', "account_user2", null, 32, 32); outTableRecordDelim(); outTableCell(''); outTableDelim(); if ($change) { outButton($session, "account_other", "Benutzer wechseln"); } if ($new) { echo " "; outButton($session, "account_new", "Neu"); } } outTableDelimEnd(); outTableAndRecordEnd(); outDivisionEnd($session); guiFinishForm($session, $session); guiStandardBodyEnd($session, Th_StandardBodyEnd); }
function baseThread(&$session) { global $thread_id, $posting_id, $page_no; $session->trace(TC_Gui1, 'baseThread'); if (empty($thread_id)) { if (empty($posting_id)) { $thread_id = 1; } else { $thread_id = dbSingleValue($session, 'select top from ' . dbTable($session, T_Posting) . " where id={$posting_id}"); if (empty($thread_id)) { $thread_id = $posting_id; } } } if (!isset($page_no)) { $page_no = isset($posting_id) ? dbPageOfPosting($session, $thread_id, $posting_id) : 1; } $id_list = dbIdListOfThreadPage($session, $thread_id, $page_no); $thread = dbGetRecordById($session, T_Posting, $thread_id, 'author,subject,text,createdat,changedby,changedat,calls,forum'); dbThreadInfo($session, $thread_id, $answers, $pages, $last); $thread_date = dbSqlDateToText($session, $thread[3]); $forum = dbGetRecordById($session, T_Forum, $thread[7], 'name'); guiStandardHeader($session, 'Thema: ' . $thread[1], Th_ThreadHeader, Th_ThreadBodyStart); guiParagraph($session, $thread[0] . ', ' . $thread_date . ', ' . (0 + $answers) . ' Antwort' . ($answers == 1 ? ', ' : 'en, ') . $pages . ' Seite' . ($pages == 1 ? '' : 'n'), true); echo '<table width="100%" border="0"><tr><td>'; echo 'Forum: '; guiInternLink($session, P_Forum . '?forum_id=' . $thread[7], $forum[0]); if ($pages > 1) { echo '</td><td style="text-align: right">'; guiPageLinks($session, P_Thread . '?action=' . A_ShowThread . '&thread_id=' . $thread_id, $page_no, $pages); } echo "</td></tr></table>\n"; dbUpdateRaw($session, T_Posting, $thread_id, 'calls=calls+1'); echo '<table width="100%" border="0">' . "\n"; // Autor Thema-Text foreach ($id_list as $ii => $id) { # echo "alle Postings: $ii / $id<br>"; if ($id == $thread_id) { $posting = $thread; } else { $posting = dbGetRecordById($session, T_Posting, $id, 'author,subject,text,createdat,changedby,changedat'); } dbGetAuthorInfo($session, $posting[0], $author_link, $postings, $avatar, $ranking); echo '<tr><td style="vertical-align:top">'; guiLine(1); echo $thread[0] . '<br/>' . ($postings + 0) . ' Beiträge<br/>' . $ranking; if (!empty($avatar)) { echo '<br/>' . $avatar; } echo '</td><td>'; guiLine(1); if ($id == $thread_id) { guiHeadline($session, 3, 'Thema: ' . $posting[1]); } else { guiHeadline($session, 3, 'Antwort ' . ($ii + $session->fUserPostingsPerPage * ($page_no - 1)) . ': ' . $posting[1]); } echo 'Geschrieben am ' . dbSqlDateToText($session, $posting[3]); if (strcmp($posting[5], $posting[3]) != 0) { echo ' Letzte Änderung: ' . dbSqlDateToText($session, $posting[5]); if (!empty($posting[4]) && strcmp($posting[4], $posting[0]) != 0) { echo ' von ' . $posting[5]; } } echo '<br/>'; wikiToHTML($session, $posting[2]); echo '<p>'; guiInternLink($session, P_Thread . '?action=' . A_Answer . "&thread_id={$thread_id}&reference_id={$id}", 'Antworten'); if (strcmp($posting[0], $session->fUserName) == 0) { echo ' '; guiInternLink($session, P_Thread . '?action=' . A_ChangeThread . "&thread_id={$thread_id}&posting_id={$id}", 'Ändern'); echo "</p>\n"; } echo "</td><tr>\n"; } echo "</table>\n"; guiStandardBodyEnd($session, Th_ThreadBodyEnd); }
function writeHoricontalLine($line, &$status) { $status->trace(TC_Util2, 'writeHoricontalLine'); $count = countRepeats($line, '-'); if ($count < 4) { writeLine($line, $status); } else { guiLine($count - 3); } }
function wikiToHtml(&$session, $wiki_text) { $lines = explode("\n", $wiki_text); $session->trace(TC_Util1, 'wikiToHtml: ' . (0 + count($lines)) . ' Zeilen' . "({$lines['0']})"); $status = new LayoutStatus($session); $last_linetype = ''; foreach ($lines as $ii => $line) { $start_code = false; if (!$status->fPreformatted && ($line_trimmed = trim($line)) == '') { $last_linetype = ''; $status->changeOfLineType($last_linetype, ''); } else { $linetype = $status->fPreformatted ? '[' : substr($line, 0, 1); switch ($linetype) { case '-': $count = countRepeats($line, '-'); if ($count < 4) { $linetype = 'x'; } break; case '[': if (strpos($line, 'code]') == 1) { $start_code = true; } elseif (strpos($line, '/code]') == 1) { $status->finishCode(); $last_linetype = 'x'; $line = $line_trimmed = substr($line, 7); $session->trace(TC_Util2, 'wikiToHtml: /code-Restzeile: ' . $line); } else { $linetype = 'x'; } break; case '!': case ';': case '*': case '#': case '|': break; default: $linetype = 'x'; break; } $last_linetype = $status->testChangeOfLineType($last_linetype, $linetype); switch ($linetype) { case '!': if (strpos($line, '|') != 1) { writeHeader($line, $status); } else { writeTableHeader($line, $status); $last_linetype = '|'; } break; case '[': if ($start_code) { $status->startCode(); } $line = substr($line_trimmed, 6); if (!empty($line)) { writeLine($line, $status); } break; case ';': writeIndent($line, $status); break; case '*': writeUList($line, $status); break; case '#': writeOrderedList($line, $status); break; case '|': writeTable($line, $status); break; case '-': guiLine($status->fSession, $count - 3); break; default: writeLine($line, $status); break; } } } // foreach if ($status->fPreformatted) { $session->trace(TC_Warning, PREFIX_Warning . '[/code] fehlt'); } $session->trace(TC_Util1, 'wikiToHtml-Ende'); }
function baseAlterPage(&$session, $mode, $message, $message2, $type = M_Undef) { global $alterpage_name, $alterpage_content, $textarea_width, $textarea_height, $alterpage_content, $alterpage_mime, $alterpage_lastmode, $alterpage_preview; $session->trace(TC_Gui1, 'baseAlterPage'); if ($type != M_Undef) { $alterpage_mime = $type; } if ($alterpage_mime == M_Wiki) { guiStandardHeader($session, $mode != C_Change ? 'Neue Seite eintragen' : 'Seite ändern', Th_EditHeaderWiki, Th_EditStartWiki); } else { guiStandardHeader($session, $mode != C_Change ? 'Neue Seite eintragen' : 'Seite ändern', Th_EditHeaderHTML, Th_EditStartHTML); } getUserParam($session, U_TextAreaWidth, $textarea_width); getUserParam($session, U_TextAreaHeight, $textarea_height); if (!empty($message)) { guiParagraph($session, $message, true); } if (!empty($message2)) { guiParagraph($session, $message2, true); } if (isset($alterpage_preview)) { guiHeadline($session, 1, 'Vorschau'); guiFormatPage($session, $alterpage_mime, $alterpage_content); guiLine(1); } guiStartForm($session, 'alterpage'); guiHiddenField('alterpage_lastmode', $mode); echo "<table border=\"0\">\n<tr><td>Name:</td><td>"; guiTextField('alterpage_name', $alterpage_name, 64, 64); if ($mode == C_Change) { guiButton('alterpage_changepage', 'Seite laden'); } if ($type == M_Wiki) { } echo "</td></tr>\n<tr><td>Typ:</td><td>"; if ($mode == C_New && $type == M_Undef) { guiComboBox('alterpage_mime', array(M_Wiki, M_HTML), null); } else { echo $alterpage_mime; guiHiddenField($session, 'alterpage_mime', $alterpage_mime); } echo "</td></tr>\n<tr><td>Inhalt:</td><td>"; guiTextArea("alterpage_content", $alterpage_content, $textarea_width, $textarea_height); echo "</td></tr>\n<tr><td></td><td>"; if ($mode != C_Change) { guiButton('alterpage_insert', 'Eintragen'); } else { guiButton('alterpage_changecontent', 'Ändern'); } echo " "; guiButton('alterpage_preview', 'Vorschau'); echo " "; guiButton('alterpage_cancel', 'Abbrechen'); echo "<br /><br />Eingabefeld: Breite: "; guiTextField("alterpage_width", $textarea_width, 3, 3); echo " Höhe: "; guiTextField("alterpage_height", $textarea_height, 3, 3); echo "</td></tr>\n</table>\n"; guiFinishForm($session, $session); guiStandardBodyEnd($session, Th_StandardBodyEnd); }