Exemplo n.º 1
0
function dbThreadInfo(&$session, $thread_id, &$answers, &$pages, &$last)
{
    $session->trace(TC_Db3 + TC_Query, "dbThreadInfo: {$thread_id}");
    list($answers, $last) = dbGetRecordByClause($session, T_Posting, 'count(id),max(id)', "top={$thread_id}");
    if (empty($last)) {
        $last = $thread_id;
    }
    $pages = empty($answers) ? 1 : 1 + floor($answers / $session->fUserPostingsPerPage);
}
Exemplo n.º 2
0
function guiShowPageById(&$session, $page, $text_id)
{
    $session->trace(TC_Gui1, 'guiShowPageById: ' . $page . '/' . $text_id);
    list($name, $type, $readgroup) = dbGetRecordById($session, T_Page, $page, 'name,type,readgroup');
    if (!empty($text_id) && $text_id > 0) {
        $count_newer = dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $page) . ' and id>' . $text_id);
    } else {
        $count_newer = 0;
        list($text_id) = dbGetRecordByClause($session, T_Text, 'max(id)', 'page=' . (0 + $page));
    }
    $session->trace(TC_Gui1, 'guiShowPageById-2: ' . $count_newer);
    list($content, $created_at, $created_by) = dbGetRecordById($session, T_Text, $text_id, 'text,createdat,createdby');
    $has_changed = $name != $session->fPageURL;
    $session->SetPageData($name, $created_at, $created_by);
    if ($has_changed) {
        $session->SetLocation($name);
    }
    $header = $count_newer == 0 ? $session->fPageURL : $session->fPageURL . ' (Version ' . $text_id . ')';
    if ($type == TT_Wiki) {
        guiStandardHeader($session, $header, Th_HeaderWiki, Th_BodyStartWiki);
    } else {
        guiStandardHeader($session, $header, Th_HeaderHTML, Th_BodyStartHTML);
    }
    if ($count_newer > 0) {
        guiParagraph($session, 'Achtung: es existier' . ($count_newer == 1 ? 't eine neuere Version' : 'en ' . $count_newer . ' neuere Versionen'), false);
    }
    guiFormatPage($session, $type, $content);
    guiStandardBodyEnd($session, $type == TT_Wiki ? Th_BodyEndWiki : Th_BodyEndHTML);
}
Exemplo n.º 3
0
function admParamAnswerLoad(&$session)
{
    global $param_id, $param_theme, $param_pos, $param_name, $param_text;
    $session->trace(TC_Gui1, 'admParamAnswerLoad');
    $param_text = textAreaToWiki($session, $param_text);
    if (!isInt($param_theme)) {
        $error = 'Theme nicht gültig: ' . $param_theme;
    } elseif (!isInt($param_pos)) {
        $error = 'Pos nicht gültig: ' . $param_pos;
    } else {
        $record = dbGetRecordByClause($session, T_Param, 'id,name,text', "theme={$param_theme} and pos={$param_pos}");
        $param_id = $record[0];
        $param_name = $record[1];
        $param_text = $record[2];
        $error = '';
    }
    admParam($session, $error);
}
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
function baseForumHome($session)
{
    $session->trace(TC_Gui1, 'baseForumHome');
    guiStandardHeader($session, 'Forenübersicht', Th_StandardHeader, Th_StandardBodyStart);
    $id_list = dbIdList($session, T_Forum, '1');
    echo '<table width="100%" border="1">' . "\n" . '<tr><td><b>Forum</b></td><td><b>Beschreibung</b></td>' . '<td><b>Themen</b></td><td><b>Beitr&auml;ge</b></td>' . '<td><b>Letzter Beitrag</b></td>' . "</tr>\n";
    foreach ($id_list as $ii => $id) {
        list($name, $description) = dbGetRecordById($session, T_Forum, $id, 'name,description');
        $threads = dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Posting) . " where top is null and forum={$id}");
        $posting_data1 = dbGetRecordByClause($session, T_Posting, 'count(id),max(id)', "forum={$id}");
        $posting_data2 = dbGetRecordById($session, T_Posting, 0 + $posting_data1[1], 'changedat,author,createdat,subject');
        echo '<tr><td>';
        guiInternLink($session, P_Forum . '?forum_id=' . $id, $name);
        echo '</td><td>' . htmlentities($description) . '</td>';
        echo "<td>{$threads}</td><td>{$posting_data1['0']}</td><td>";
        if ($posting_data2) {
            echo htmlentities($posting_data2[1]);
            echo ' am ';
            echo dbSqlDateToText($session, $posting_data2[empty($posting_data2[0]) ? 0 : 2]);
            echo '<br/>';
            guiInternLink($session, P_Thread . '?action=' . A_ShowThread . '&posting_id=' . $posting_data1[1], $posting_data2[3]);
        }
        echo "</td><tr>\n";
    }
    echo "</table>\n";
    guiStandardBodyEnd($session, Th_StandardBodyEnd);
}
Exemplo n.º 6
0
function addressEditCardAnswer(&$session)
{
    $session->trace(TC_Gui1, 'addressEditCardAnswer');
    $session->trace(TC_X, 'addressEditCardAnswer');
    $message = null;
    if (isset($_POST['card_change'])) {
        $session->trace(TC_Gui1, 'addressEditcard-change entdeckt');
        $name = $_POST['card_lastname'];
        $email = $_POST['card_emailprivate'];
        $id = $_POST['card_id'];
        $books = $_POST['card_books'];
        if (empty($name)) {
            $message = 'Bitte Nachnamen angeben';
        } else {
            if (empty($books)) {
                $message = 'Bitte mindestens ein Adressbuch angeben';
            } else {
                if (($msg2 = addressCheckBooks($session, $books, $id_list)) != null) {
                    $message = $msg2;
                } else {
                    if (!empty($email) && dbSingleValue($session, 'select count(id) from ' . dbTable($session, Tab_Card) . ' where emailprivate=' . dbSqlString($session, $email) . ' and id<>' . (0 + $id)) > 0) {
                        $rec = dbGetRecordByClause($session, Tab_Card, 'id,firstname,lastname,city', ' emailprivate=' . dbSqlString($session, $email) . ' and id<>' . (0 + $id));
                        $message = "Adresskarte mit EMai-Adresse {$email} existiert schon: '" . $rec[1] . ' ' . $rec[2] . ' ' . $rec[3] . ' (' . $rec[0] . ')';
                    } else {
                        dbUpdate($session, Tab_Card, $id, 'firstname=' . dbSqlString($session, $_POST['card_firstname']) . ',lastname=' . dbSqlString($session, $_POST['card_lastname']) . ',nickname=' . dbSqlString($session, $_POST['card_nickname']) . ',emailprivate=' . dbSqlString($session, $_POST['card_emailprivate']) . ',emailprivate2=' . dbSqlString($session, $_POST['card_emailprivate2']) . ',phoneprivate=' . dbSqlString($session, $_POST['card_phoneprivate']) . ',phoneprivate2=' . dbSqlString($session, $_POST['card_phoneprivate2']) . ',faxprivate=' . dbSqlString($session, $_POST['card_faxprivate']) . ',mobileprivate=' . dbSqlString($session, $_POST['card_mobileprivate']) . ',emailoffice=' . dbSqlString($session, $_POST['card_emailoffice']) . ',emailoffice2=' . dbSqlString($session, $_POST['card_emailoffice2']) . ',phoneoffice=' . dbSqlString($session, $_POST['card_phoneoffice']) . ',phoneoffice2=' . dbSqlString($session, $_POST['card_phoneoffice2']) . ',faxoffice=' . dbSqlString($session, $_POST['card_faxoffice']) . ',mobileoffice=' . dbSqlString($session, $_POST['card_mobileoffice']) . ',street=' . dbSqlString($session, $_POST['card_street']) . ',country=' . dbSqlString($session, $_POST['card_country']) . ',zip=' . dbSqlString($session, $_POST['card_zip']) . ',city=' . dbSqlString($session, $_POST['card_city']) . ',functions=' . dbSqlString($session, $_POST['card_functions']) . ',notes=' . dbSqlString($session, $_POST['card_notes']) . ',');
                        $message = "Adresskarte {$name} wurde geändert.";
                    }
                }
            }
        }
    } elseif (isset($_POST['card_new'])) {
        $session->trace(TC_Gui1, 'addressEditCard-new entdeckt');
        $name = $_POST['card_lastname'];
        dbInsert($session, Tab_Card, 'firstname,lastname,nickname,' . 'emailprivate,emailprivate2,phoneprivate,phoneprivate2,faxprivate,mobileprivate,' . 'emailoffice,emailoffice2,phoneoffice,phoneoffice2,faxoffice,mobileoffice,' . 'street,country,zip,city,functions,notes', dbSqlString($session, $_POST['card_firstname']) . ',' . dbSqlString($session, $_POST['card_lastname']) . ',' . dbSqlString($session, $_POST['card_nickname']) . ',' . dbSqlString($session, $_POST['card_emailprivate']) . ',' . dbSqlString($session, $_POST['card_emailprivate2']) . ',' . dbSqlString($session, $_POST['card_phoneprivate']) . ',' . dbSqlString($session, $_POST['card_phoneprivate2']) . ',' . dbSqlString($session, $_POST['card_faxprivate']) . ',' . dbSqlString($session, $_POST['card_mobileprivate']) . ',' . dbSqlString($session, $_POST['card_emailoffice']) . ',' . dbSqlString($session, $_POST['card_emailoffice2']) . ',' . dbSqlString($session, $_POST['card_phoneoffice']) . ',' . dbSqlString($session, $_POST['card_phoneoffice2']) . ',' . dbSqlString($session, $_POST['card_faxoffice']) . ',' . dbSqlString($session, $_POST['card_mobileoffice']) . ',' . dbSqlString($session, $_POST['card_street']) . ',' . dbSqlString($session, $_POST['card_country']) . ',' . dbSqlString($session, $_POST['card_zip']) . ',' . dbSqlString($session, $_POST['card_city']) . ',' . dbSqlString($session, $_POST['card_functions']) . ',' . dbSqlString($session, $_POST['card_notes']));
        $message = "Adresskarte {$name} wurde erstellt.";
    }
    addressEditcard($session, $message);
}
Exemplo n.º 7
0
function admMacroAnswerLoad(&$session)
{
    $session->trace(TC_Gui1, 'admMacroAnswerLoad');
    $_POST['macro_text'] = textAreaToWiki($session, $_POST['macro_text']);
    if (!isInt($_POST['macro_theme'])) {
        $error = 'Theme nicht gültig: ' . $_POST['macro_theme'];
    } elseif (empty($_POST['macro_name'])) {
        $error = 'Kein Name angegeben: ' . $_POST['macro_name'];
    } else {
        list($_POST['macro_name'], $_POST['macro_description'], $_POST['macro_text']) = dbGetRecordByClause($session, T_Macro, 'name,description,value', 'theme=' . $_POST['macro_theme'] . ' and name=' . dbSqlString($session, $_POST['macro_name']));
        $error = '';
    }
    admMacro($session, $error);
}
Exemplo n.º 8
0
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);
}