function admParamAnswerChange(&$session, $mode) { global $param_id, $param_theme, $param_pos, $param_name, $param_text; $session->trace(TC_Gui1, 'admParamAnswerChange'); $param_text = textAreaToWiki($session, $param_text); if (!isInt($param_theme)) { $message = 'Theme nicht gültig: ' . $param_theme; } elseif (!isInt($param_pos)) { $message = 'Pos nicht gültig: ' . $param_pos; } elseif ($mode == C_New && dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Param) . " where theme={$param_theme} and pos={$param_pos}") > 0) { $message = 'Eintrag nicht möglich, da (Theme,Pos) schon existiert'; } elseif ($mode == C_Change && dbSingleValue($session, 'select id from ' . dbTable($session, T_Param) . " where theme={$param_theme} and pos={$param_pos}") <= 0) { $message = 'Ändern nicht möglich, da (Id, Theme, Pos) nicht korrekt'; } else { if ($mode == C_New) { dbInsert($session, T_Param, 'theme,pos,name,text', $param_theme . ',' . $param_pos . ',' . dbSqlString($session, $param_name) . ',' . dbSqlString($session, $param_text)); $message = 'Parameter wurde eingefügt'; } elseif ($mode == C_Change) { dbUpdateRaw($session, T_Param, $param_id, 'name=' . dbSqlString($session, $param_name) . ',' . 'text=' . dbSqlString($session, $param_text)); $message = 'Parameter wurde geändert'; } else { $message = 'Unbekannter Modus: ' . $mode; } } admParam($session, $message); }
function baseEditPageAnswerSave(&$session) { $session->trace(TC_Gui1, 'baseEditPageAnswerSave'); $message2 = null; $message = null; $content = $_POST['edit_content']; $len = strlen($content); $content = textAreaToWiki($session, $content); $session->trace(TC_Gui1, 'baseEditPageAnswerSave: ' . $content); if (!isset($_POST['edit_pageid']) || $_POST['edit_pageid'] <= 0) { $session->trace(TC_Gui1, 'baseEditPageAnswerSave-2: ' . $_POST['edit_pagename']); $_POST['edit_pagename'] = normalizeWikiName($session, $_POST['edit_pagename']); $content = extractHtmlBody($content); if (empty($_POST['edit_pagename'])) { $message = '+++ kein Seitenname angegeben'; } elseif (dbSingleValue($session, 'select count(*) from ' . dbTable($session, T_Page) . ' where name=' . dbSqlString($session, $_POST['edit_pagename'])) > 0) { $message = '+++ Seite existiert schon: ' . $_POST['edit_pagename']; } else { $read_group = 0; $write_group = 0; if (empty($_POST['edit_mimetype'])) { $_POST['edit_mimetype'] = M_Wiki; } $page = dbInsert($session, T_Page, 'name,type,createdat,changedat,readgroup,writegroup', dbSqlString($session, $_POST['edit_pagename']) . ',' . dbSqlString($session, $_POST['edit_mimetype']) . ',now(),now(),' . $read_group . ',' . $write_group); $_POST['edit_pageid'] = $page; $_POST['edit_textid'] = dbInsert($session, T_Text, 'page,type,text,createdby,createdat,changedat', $page + 0 . "," . dbSqlString($session, mimeToTextType($_POST['edit_mimetype'])) . ',' . dbSqlString($session, $content) . ',' . dbSqlString($session, $session->fUserName) . ',now(),now()'); $session->trace(TC_Gui1, 'baseEditPageAnswerSave-3: ' . $page . '/' . $_POST['edit_textid']); } $message2 = $len == strlen($content) ? '' : 'Es wurde der Rumpf (body) extrahiert.'; } else { $pageid = $_POST['edit_pageid']; $new_textid = dbGetLastText($session, $pageid); if ($new_textid > $_POST['edit_textidpred'] && (!isset($_POST['edit_textid']) || $new_textid > $_POST['edit_textid'])) { $message = "+++ Warnung: Seite wurde inzwischen geändert! " . "Bitte Differenz ermitteln und erneut eintragen! " . $new_textid . " / " . $_POST['edit_textidpred']; } $date = dbSqlDateTime($session, time()); if (empty($_POST['edit_textid'])) { $_POST['edit_textid'] = dbInsert($session, T_Text, 'page,type,createdat,changedat,createdby,text', $_POST['edit_pageid'] . ',' . dbSqlString($session, mimeToTextType($_POST['edit_mimetype'])) . ",{$date},{$date}," . dbSqlString($session, $session->fUserName) . ',' . dbSqlString($session, $content)); dbUpdate($session, T_Text, $new_textid, 'replacedby=' . $_POST['edit_textid'] . ','); } else { dbUpdate($session, T_Text, $_POST['edit_textid'], "text=" . dbSqlString($session, $content) . ","); } } if (isset($_POST['edit_save']) && $message == null) { guiShowPageById($session, $_POST['edit_pageid'], 0); } else { baseEditPage($session, C_Auto, $message, $message2); } }
function basePostingAnswer(&$session) { global $forum_id, $thread_id, $posting_id, $posting_subject, $posting_text, $posting_preview, $posting_insert, $posting_change, $textarea_width, $textarea_height; $session->trace(TC_Gui1, 'basePostingAnswer'); $message = null; $mode = null; $posting_text = textAreaToWiki($session, $posting_text); if (isset($posting_preview)) { $mode = isset($posting_id) && isInt($posting_id) ? C_Change : C_New; } elseif (isset($posting_insert)) { $mode = C_New; if (empty($posting_subject)) { $message = '+++ Thema fehlt'; } elseif (strlen($posting_text) < 5) { $message = '+++ Beitrag zu kurz'; } else { $date = dbSqlDateTime($session, time()); $thread_id = $posting_id = dbInsert($session, T_Posting, 'createdat,changedat,forum,author,top,reference,subject,text', "{$date},{$date},{$forum_id}," . dbSqlString($session, $session->fUserName) . ',' . (empty($thread_id) ? 'null' : $thread_id) . ',' . (empty($reference_id) ? 'null' : $reference_id) . ',' . dbSqlString($session, $posting_subject) . ',' . dbSqlString($session, $posting_text)); dbUpdateRaw($session, T_User, $session->fUserId, 'postings=postings+1'); baseForum($session); $mode = NULL; } } elseif (isset($posting_change)) { $mode = C_Change; if (empty($posting_subject)) { $message = '+++ Thema fehlt'; } elseif (strlen($posting_text) < 5) { $message = '+++ Beitrag zu kurz'; } else { $date = dbSqlString($session, time()); dbUpdate($session, T_Posting, $posting_id, 'changedby=' . dbSqlString($session, $session->fUserName) . ',changedat=' . $date . ',subject=' . dbSqlString($session, $posting_subject) . ',text=' . dbSqlString($session, $posting_text) . ','); baseThread($session); $mode = NULL; } } if ($mode) { basePosting($session, $message, $mode); } }
function basePostingAnswer(&$session) { $session->trace(TC_Gui1, 'basePostingAnswer'); $message = null; $mode = null; $_POST['posting_text'] = textAreaToWiki($session, $_POST['posting_text']); if (isset($_POST['posting_preview'])) { $mode = isset($_POST['posting_id']) && isInt($_POST['posting_id']) ? C_Change : C_New; } elseif (isset($_POST['posting_insert'])) { $mode = C_New; if (empty($_POST['posting_subject'])) { $message = '+++ Thema fehlt'; } elseif (strlen($_POST['posting_text']) < 5) { $message = '+++ Beitrag zu kurz'; } else { $date = dbSqlDateTime($session, time()); $_POST['thread_id'] = $_POST['posting_id'] = dbInsert($session, T_Posting, 'createdat,changedat,forum,author,top,reference,subject,text', "{$date},{$date}," . $_POST['forum_id'] . ',' . dbSqlString($session, $session->fUserName) . ',' . (empty($_POST['thread_id']) ? 'null' : $_POST['thread_id']) . ',' . (empty($_POST['reference_id']) ? 'null' : $_POST['reference_id']) . ',' . dbSqlString($session, $_POST['posting_subject']) . ',' . dbSqlString($session, $_POST['posting_text'])); dbUpdateRaw($session, T_User, $session->fUserId, 'postings=postings+1'); baseForum($session); $mode = NULL; } } elseif (isset($_POST['posting_change'])) { $mode = C_Change; if (empty($_POST['posting_subject'])) { $message = '+++ Thema fehlt'; } elseif (strlen($_POST['posting_text']) < 5) { $message = '+++ Beitrag zu kurz'; } else { $date = dbSqlString($session, time()); dbUpdate($session, T_Posting, $_POST['posting_id'], 'changedby=' . dbSqlString($session, $session->fUserName) . ',changedat=' . $date . ',subject=' . dbSqlString($session, $_POST['posting_subject']) . ',text=' . dbSqlString($session, $_POST['posting_text']) . ','); baseThread($session); $mode = NULL; } } if ($mode) { basePosting($session, $message, $mode); } }
function admMacroAnswerChange(&$session, $mode) { $session->trace(TC_Gui1, 'admMacroAnswerChange'); $id = null; $_POST['macro_text'] = textAreaToWiki($session, $_POST['macro_text']); $count = 0; if (!isInt($_POST['macro_theme'])) { $message = 'Theme nicht gültig: ' . $_POST['macro_theme']; } elseif (empty($_POST['macro_name'])) { $message = 'kein Name angegeben: ' . $_POST['macro_name']; } elseif ($mode == C_New && ($count = dbSingleValue($session, 'select count(id) from ' . dbTable($session, T_Macro) . ' where theme=' . $_POST['macro_theme'] . ' and name=' . dbSqlString($session, $_POST['macro_name']))) > 0) { $message = 'Eintrag nicht möglich, da (Theme,Name) schon existiert'; } elseif ($mode == C_Change && ($id = dbSingleValue($session, 'select id from ' . dbTable($session, T_Macro) . ' where theme=' . $_POST['macro_theme'] . ' and name=' . dbSqlString($session, $_POST['macro_name']))) <= 0) { $message = 'Ändern nicht möglich, da (Theme, Name) nicht existiert'; } else { $session->trace(TC_Gui3, 'admMacroAnswerChange-2: ' . $count . ' / ' . $mode); if ($mode == C_New) { dbInsert($session, T_Macro, 'theme,name,description,value', $_POST['macro_theme'] . ',' . dbSqlString($session, $_POST['macro_name']) . ',' . dbSqlString($session, $_POST['macro_description']) . ',' . dbSqlString($session, $_POST['macro_text'])); $message = 'Makro ' . $_POST['macro_name'] . ' wurde eingefügt'; } elseif ($mode == C_Change) { dbUpdateRaw($session, T_Macro, $id, 'value=' . dbSqlString($session, $_POST['macro_text']) . ',' . 'description=' . dbSqlString($session, $_POST['macro_description']) . ',' . 'value=' . dbSqlString($session, $_POST['macro_text'])); $message = 'Makro ' . $_POST['macro_name'] . ' wurde geändert'; } else { $message = 'Unbekannter Modus: ' . $mode; } } admMacro($session, $message); }
function baseAlterPageAnswer(&$session, $mode) { global $alterpage_name, $alterpage_content, $textarea_width, $textarea_height, $alterpage_content, $alterpage_insert, $alterpage_preview, $alterpage_lastmode, $alterpage_mime; $session->trace(TC_Gui1, 'baseAlterPageAnswer'); $alterpage_name = makePageName($alterpage_name); if ($mode == C_LastMode) { $mode = $alterpage_lastmode; } $len = strlen($alterpage_content); $message = null; $alterpage_content = textAreaToWiki($session, $alterpage_content); $alterpage_content = extractHtmlBody($alterpage_content); if (isset($alterpage_preview)) { } elseif (empty($alterpage_name)) { $message = '+++ kein Seitenname angegeben'; } elseif (dbSingleValue($session, 'select count(*) from ' . dbTable($session, T_Page) . ' where name=' . dbSqlString($session, $alterpage_name)) > 0) { $message = '+++ Seite existiert schon: ' . $alterpage_name; } else { $read_group = 0; $write_group = 0; if (empty($alterpage_mime)) { $alterpage_mime = TT_Wiki; } $page = dbInsert($session, T_Page, 'name,type,createdat,changedat,readgroup,writegroup', dbSqlString($session, $alterpage_name) . ',' . dbSqlString($session, $alterpage_mime) . ',now(),now(),' . $read_group . ',' . $write_group); dbInsert($session, T_Text, 'page,type,text,createdby,createdat,changedat', $page . "," . dbSqlString($session, $alterpage_mime) . ',' . dbSqlString($session, $alterpage_content) . ',' . dbSqlString($session, $session->fUserName) . ',now(),now()'); } $message2 = $len == strlen($alterpage_content) ? '' : 'Es wurde der Rumpf (body) extrahiert.'; $session->SetLocation($alterpage_name); if ($message != null || isset($alterpage_preview)) { baseAlterPage($session, $mode, $message, $message2, $alterpage_mime); } else { guiShowPage($session, $alterpage_mime, $alterpage_name, $alterpage_name); } }