function guiHeader(&$session, $title) { $session->trace(TC_Gui1, 'guiHeader'); if (empty($title)) { $title = "Installation Infobasar"; } echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; echo "\n<html>\n"; echo '<head>' . "\r\n"; echo '<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">' . "\n"; echo "<title>{$title}</title>\n</head>\n<body>\n"; guiHeadline($session, 1, 'Installation des InfoBasar'); }
function admRename(&$session, $message) { global $rename_oldname, $rename_newname, $rename_backlinks; $session->trace(TC_Gui1, 'admRename'); guiHeader($session, 'Umbenennen einer Seite'); guiHeadline($session, 1, 'Umbenennen einer Seite'); if (!empty($message)) { guiParagraph($session, $message, false); } guiStartForm($session, 'Form', P_Rename); echo '<table border="0">'; echo '<tr><td>Bisheriger Name:</td><td>'; guiTextField('rename_oldname', $rename_oldname, 64, 64); echo '<tr><td>Neuer Name:</td><td>'; guiTextField('rename_newname', $rename_newname, 64, 64); echo '</td></tr>' . "\n"; echo '<tr><td></td><td>'; guiButton('rename_info', 'Info'); if (!empty($rename_oldname) && !empty($rename_newname)) { echo ' | '; } guiButton('rename_rename', 'Umbenennen'); echo '<br>'; guiCheckBox('rename_backlinks', 'Alle Verweise umbenennen', !isset($rename_backlinks) || $rename_backlinks == C_CHECKBOX_TRUE); echo '</td></tr></table>' . "\n"; guiFinishForm($session); if (!empty($rename_oldname) && dbPageId($session, $rename_oldname) > 0) { $row = dbFirstRecord($session, 'select page,text,createdby,createdat from ' . dbTable($session, T_Text) . ' where replacedby is null and text like ' . dbSqlString($session, "%{$rename_oldname}%")); if (!$row) { guiParagraph($session, '+++ keine Verweise gefunden', false); } else { echo '<table border="1"><tr><td>Seite:</td><td>Typ:</td>' . '<td>von</td><td>Letzte Änderung</td><td>Fundstelle</td></tr>'; while ($row) { $pagerecord = dbGetRecordById($session, T_Page, $row[0], 'name,type'); $text = findTextInLine($row[1], $rename_oldname, 10, true); if (!empty($text)) { echo "\n<tr><td>"; guiInternLink($session, encodeWikiName($session, $pagerecord[0]), $pagerecord[0], M_Base); echo '</td><td>'; echo $pagerecord[1]; echo '</td><td>'; echo $row[2]; echo '</td><td>'; echo htmlentities($row[3]); echo '</td><td>'; echo $text; echo "</td><tr>\n"; } $row = dbNextRecord($session); } echo "\n</table>\n"; } } guiFinishBody($session, null); }
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 basePageInfo(&$session) { $pagename = $session->fPageURL; $pagelink = encodeWikiName($session, $pagename); $headline = 'Info über ' . $pagename; guiStandardHeader($session, $headline, Th_InfoHeader, 0); $page = dbGetRecordByClause($session, T_Page, 'id,createdat,type,readgroup,writegroup', 'name=' . dbSqlString($session, $pagename)); $pageid = $page[0]; guiParagraph($session, 'Erzeugt: ' . dbSqlDateToText($session, $page[1]), false); $count = dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $pageid)); if ($count <= 1) { guiParagraph($session, 'Die Seite wurde nie geändert', false); guiParagraph($session, guiInternLinkString($session, encodeWikiName($session, $pagename), "Aktuelle Version"), false); } else { guiHeadline($session, 2, "Versionen ({$count})"); outTableAndRecord(1); outTableCellStrong('Id'); outTableCellStrong('Autor'); outTableCellStrong('erzeugt'); outTableCellStrong('Unterschied zum Nachfolger'); outTableCellStrong('Unterschied zu jetzt'); outTableRecordEnd(); $row = dbFirstRecord($session, 'select id,createdby,createdat,changedat,replacedby from ' . dbTable($session, T_Text) . ' where page=' . (0 + $pageid) . ' order by id desc'); $act_text_id = $row[0]; while ($row) { outTableRecord(); $text_id = $row[0]; $replacedby = $row[4]; outTableInternLink($session, null, $pagelink . '?action=' . A_ShowText . '&page_id=' . $pageid . '&text_id=' . ($text_id + 0), $text_id); outTableAuthorLink($session, $row[1]); outTableCell(dbSqlDateToText($session, $row[2])); if ($replacedby > 0) { outTableInternLink($session, null, $pagelink . '?action=' . A_Diff . '&text_id=' . $replacedby . '&text_id2=' . $text_id, ' Unterschied zu ' . $replacedby); if ($replacedby == $act_text_id) { outTableCell(' '); } else { outTableInternLink($session, null, $pagelink . '?action=' . A_Diff . '&text_id=' . $text_id . '&text_id2=' . $act_text_id, ' Unterschied zu jetzt'); } } else { outTableCell(' '); outTableCell(' '); } outTableRecordEnd(); $row = dbNextRecord($session); } outTableEnd(); } guiStandardBodyEnd($session, Th_InfoBodyEnd); }
function addressPrintTable(&$session, $query, $max_lines) { $result = mysql_query($query, $session->fDbInfo); if (!$result) { protoc(mysql_error()); } else { guiHeadline($session, 2, 'Suchergebnis:'); $first = true; $no = 0; if ($max_lines <= 0) { $max_lines = 1000; } outTable(1); while ($row = mysql_fetch_row($result)) { if ($first) { addressPrintTableHeader($session); $first = false; } if (++$no > $max_lines) { break; } outTableRecord(); addressPrintRow($session, $row); outTableRecordEnd(); } if ($first) { echo "Die Anfrage ergab keine Ergebnisse"; outNewline(); } else { outTableEnd(); if ($no > $max_lines) { guiParagraph($session, "Es gibt noch weitere Ergebnisse!", false); } } mysql_free_result($result); } }
function guiHeader(&$session, $title) { $session->trace(TC_Gui1, 'guiHeader'); if (empty($title)) { $title = "Installation Infobasar"; } echo '<head>' . "\r\n"; echo '<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">' . "\n"; echo "<title>{$title}</title>\n</head>\n<body>\n"; guiHeadline($session, 1, 'Installation des InfoBasar'); }
function admShowDir(&$session, $path, $headline = null, $pattern = null, $button_text = null, $button_prefix = null, $file_prefix = null, $with_form = true) { $session->trace(TC_Init, 'admShowDir'); $dir = opendir($path); if ($headline != '') { guiHeadline($session, 2, $headline == null ? "Verzeichnis {$path} auf dem Server" : $headline); } if ($button_text != null && $with_form) { guiStartForm($session); } outTableAndRecord(1); outTableCellStrong('Name'); outTableCellStrong('Größe'); outTableCellStrong('Geändert am'); if ($button_text != null) { outTableCellStrong('Aktion'); } outTableRecordEnd(); $no = 0; while ($file = readdir($dir)) { if ($file != '.' && $file != '..' && ($pattern == null || preg_match($pattern, $file))) { $name = $path . $file; outTableRecord(); outTableCell(htmlentities($file)); outTableCell(is_dir($name) ? 'Verzeichnis' : filesize($name), AL_Right); outTableCell(date("Y.m.d H:i:s", filemtime($name))); if ($button_text != null) { $no++; outTableDelim(); outHiddenField($session, $file_prefix . $no, $path . $file); outButton($session, $button_prefix . $no, $button_text); outTableDelimEnd(); } outTableRecordEnd(); } } outTableEnd(); closedir($dir); if ($button_text != null && $with_form) { guiFinishForm($session); } }
function admBackupAnswer(&$session) { global $backup_table, $backup_compressed, $backup_save; $session->trace(TC_Gui1, 'admBackupAnswer'); $message = null; guiHeader($session, 'Datenbank-Backup'); if (isset($backup_save)) { if (empty($backup_table)) { guiParagraph($session, '+++ keine Tabelle angegeben!', false); } else { guiHeadline($session, 1, 'Backup der Tabelle ' . $backup_table); $filename = $backup_table == '*' ? 'db_infobasar' : 'table_' . $backup_table; $filename = 'backup/' . $filename; if ($backup_compressed) { $filename .= '.gz'; } $open_name = $backup_compressed ? 'compress.zlib://' . $session->fFileSystemBase . '/' . $filename : $session->fFileSystemBase . '/' . $filename; $file = fopen($open_name, $backup_compressed ? 'wb9' : 'wb'); fwrite($file, '# InfoBasar: SQL Dump / Version: ' . PHP_Version . " \n# gesichert am " . strftime('%Y.%m.%d %H:%M:%S', time()) . "\n"); echo '<table border="0">'; if ($backup_table != '*') { $bytes = admSaveTable($session, $backup_table, false, $file); } else { $bytes = admWriteOneTable($session, dbTable($session, T_Param), $file); $bytes += admWriteOneTable($session, dbTable($session, T_Macro), $file); $bytes += admWriteOneTable($session, dbTable($session, T_User), $file); $bytes += admWriteOneTable($session, dbTable($session, T_Group), $file); $bytes += admWriteOneTable($session, dbTable($session, T_Forum), $file); $bytes += admWriteOneTable($session, dbTable($session, T_Posting), $file); $bytes += admWriteOneTable($session, dbTable($session, T_Text), $file); } fclose($file); $size = !$backup_compressed ? $bytes : filesize($session->fFileSystemBase . '/' . $filename); echo '<tr><td>Summe:</td><td>' . (0 + $bytes) . ' (' . (0 + $size) . ')</td></tr></table>' . "\n"; echo '<br/>'; guiStaticDataLink($session, '', $filename, 'Datei ' . $filename); } } admBackup($session, false, $message); }
function basePageInfo(&$session) { $pagename = $session->fPageName; $headline = 'Info über ' . $pagename; guiStandardHeader($session, $headline, Th_InfoHeader, 0); $page = dbGetRecordByClause($session, T_Page, 'id,createdat,type,readgroup,writegroup', 'name=' . dbSqlString($session, $pagename)); $pageid = $page[0]; guiParagraph($session, 'Erzeugt: ' . dbSqlDateToText($session, $page[1]), false); $count = dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $pageid)); if ($count <= 1) { guiParagraph($session, 'Die Seite wurde nie geändert', false); } else { guiHeadline($session, 2, "Versionen ({$count})"); echo '<table border="1"><tr><td><b>Id</b></td>' . '<td><b>Autor</b></td><td><b>erzeugt</b></td>' . '<td><b><b>Unterschied zum Nachfolger</b></td>' . '<td><b>Unterschied zu jetzt</b></td></tr>' . "\n"; $row = dbFirstRecord($session, 'select id,createdby,createdat,changedat,replacedby from ' . dbTable($session, T_Text) . ' where page=' . (0 + $pageid) . ' order by id desc'); $act_text_id = $row[0]; while ($row) { $text_id = $row[0]; $replacedby = $row[4]; echo '<tr><td>'; guiInternLink($session, $pagename . '?action=' . A_ShowText . '&page_id=' . $pageid . '&text_id=' . ($text_id + 0), $text_id); echo '</td><td>'; guiAuthorLink($session, $row[1]); echo '</td><td>' . dbSqlDateToText($session, $row[2]); echo '</td><td>'; if ($replacedby > 0) { guiInternLink($session, $pagename . '?action=' . A_Diff . '&text_id=' . $replacedby . '&text_id2=' . $text_id, ' Unterschied zu ' . $replacedby); if ($replacedby != $act_text_id) { echo '</td><td>'; guiInternLink($session, $pagename . '?action=' . A_Diff . '&text_id=' . $text_id . '&text_id2=' . $act_text_id, ' Unterschied zu jetzt'); } } echo '</td></tr>' . "\n"; $row = dbNextRecord($session); } echo '</table>' . "\n"; } guiStandardBodyEnd($session, Th_InfoBodyEnd); }