Exemplo n.º 1
0
function admAnswerRename(&$session)
{
    global $rename_oldname, $rename_newname, $rename_rename, $rename_backlinks;
    $session->trace(TC_Gui1, 'admAnswerRename');
    $message = null;
    $origin = isset($rename_newname) ? $rename_newname : null;
    if (!isset($rename_oldname)) {
        $message = '+++ kein bisheriger Name angegeben!';
    } elseif (($page_id = dbPageId($session, $rename_oldname)) <= 0) {
        $message = '+++ Seite ' . $rename_oldname . ' existiert nicht';
    } elseif (isset($rename_rename) && !isset($rename_newname)) {
        $message = '+++ kein neuer Name angegeben!';
    } elseif (isset($rename_rename) && ($rename_newname = normalizeWikiName($session, $rename_newname)) != $origin) {
        $message = '+++ Unzulässiger neuer Name (' . $origin . ') wurde korrigiert';
    } elseif (isset($rename_rename) && dbPageId($session, $rename_newname) > 0) {
        $message = '+++ Seite ' . $rename_newname . ' existiert schon!';
    } elseif (isset($rename_rename)) {
        dbUpdate($session, T_Page, $page_id, 'name=' . dbSQLString($session, $rename_newname) . ',');
        $message = 'Seite ' . $rename_oldname . ' wurde in ' . $rename_newname . ' umbenannt.';
        $pages = 0;
        $hits = 0;
        if ($rename_backlinks == C_CHECKBOX_TRUE) {
            $row = dbFirstRecord($session, 'select id,text from ' . dbTable($session, T_Text) . ' where replacedby is null and text like ' . dbSqlString($session, "%{$rename_oldname}%"));
            $pattern1 = '/([^' . CL_WikiName . '])' . $rename_oldname . '([^' . CL_WikiName . '])/';
            $pattern2 = '/^' . $rename_oldname . '([^' . CL_WikiName . '])/';
            $pattern3 = '/([^' . CL_WikiName . '])' . $rename_oldname . '$/';
            $replacement1 = '\\1' . $rename_newname . '\\2';
            $replacement2 = $rename_newname . '\\1';
            $replacement3 = '\\1' . $rename_newname;
            while ($row) {
                $text = $row[1];
                $count1 = preg_match_all($pattern1, $row[1], $dummy);
                if ($count1 > 0) {
                    $text = preg_replace($pattern1, $replacement1, $text);
                }
                $count2 = preg_match($pattern2, $row[1]);
                if ($count2 > 0) {
                    $text = preg_replace($pattern2, $replacement2, $text);
                }
                $count3 = preg_match($pattern3, $text);
                if ($count3 > 0) {
                    $text = preg_replace($pattern3, $replacement3, $text);
                }
                if ($count1 + $count2 + $count3 > 0) {
                    dbUpdate($session, T_Text, $row[0], 'text=' . dbSQLString($session, $text) . ',');
                    $pages++;
                    $hits += $count1 + $count2 + $count3;
                }
                $row = dbNextRecord($session);
            }
            if ($pages > 0) {
                $message .= '<br>Es wurde' . ($hits == 1 ? ' ' : 'n ') . $hits . ($hits == 1 ? ' Verweis auf ' : ' Verweise auf ') . $pages . ($pages == 1 ? ' Seite umbenannt.' : ' Seiten umbenannt.');
            }
        }
        addSystemMessage($session, $rename_oldname . ' >> ' . $rename_newname . ': ' . (0 + $hits));
        $rename_oldname = '';
        $rename_newname = '';
    }
    admRename($session, $message);
}
Exemplo n.º 2
0
function dbGetAndStoreMacroPattern(&$session)
{
    $session->trace(TC_Db2, 'dbGetAndStoreMacroPattern:');
    $theme = $session->fUserTheme;
    $pattern = dbGetParam($session, $theme, Th_MacroPattern);
    if (empty($pattern)) {
        $row = dbFirstRecord($session, 'select name from ' . dbTable($session, T_Macro) . ' where theme=' . Theme_All . ' or theme=' . ($theme + 0) . ' order by name');
        $last_var = null;
        $open_parenthesis = false;
        while ($row) {
            $pos = strpos($row[0], ':');
            if ($pos <= 0) {
                $val = $row[0];
                $var = null;
            } else {
                $var = substr($row[0], 0, $pos + 1);
                $val = substr($row[0], $pos + 1);
            }
            $session->trace(TC_Db3, 'dbGetAndStoreMacroPattern-2: ' . $pos . ' ' . $var . ' / ' . $val);
            if ($var != $last_var) {
                $session->trace(TC_Db2, 'dbGetAndStoreMacroPattern-3: ');
                if ($open_parenthesis) {
                    $session->trace(TC_Db2, 'dbGetAndStoreMacroPattern-4: ');
                    $pattern .= ')';
                    $open_parenthesis = false;
                }
                $last_var = $var;
                if (!empty($var)) {
                    $session->trace(TC_Db2, 'dbGetAndStoreMacroPattern-5: ' . $pattern);
                    $val = $var . '(' . $val;
                    $open_parenthesis = true;
                }
            }
            $new = '|' . $val;
            if (getPos($pattern, $new . '|') < 0) {
                $pattern .= $new;
            }
            $row = dbNextRecord($session);
        }
        if ($open_parenthesis) {
            $pattern .= ')';
        }
        $id = dbSingleValue($session, 'select id from ' . dbTable($session, T_Param) . ' where theme=' . (0 + $theme) . ' and pos=' . Th_MacroPattern);
        if ($id > 0) {
            dbUpdateRaw($session, T_Param, $id, 'text=' . dbSqlString($session, $pattern));
            $session->trace(TC_Db1, "dbGetAndStoreMacroPattern: Id: {$id} Th: {$theme} P: {$pattern}");
        }
    }
    return $pattern;
}
Exemplo n.º 3
0
function instImportPages(&$session, $import_file, $import_replace)
{
    $message = null;
    if (!file_exists($import_file)) {
        $message = "Datei nicht gefunden: " . $import_file;
    } elseif (checkDB($session, $message) == DB_EXISTS) {
        $file = fopen($import_file, "r");
        $count_inserts = 0;
        $count_updates = 0;
        $count_lines = 0;
        while ($line = fgets($file)) {
            if (preg_match('/^#name=(\\S+)\\tlines=(\\d+)\\ttype=(\\w+)\\t/', $line, $param)) {
                $name = $param[1];
                $lines = $param[2];
                $type = $param[3];
                $session->trace(TC_Gui1, 'instImportPagesAnswer-2: ' . $line);
                if (($page = dbPageId($session, $name)) > 0) {
                    $count_updates++;
                    if ($import_replace) {
                        dbDeleteByClause($session, T_Text, 'page=' . $page);
                    }
                } else {
                    $page = dbInsert($session, T_Page, 'name,type', dbSqlString($session, $name) . ',' . dbSqlString($session, $type));
                    $count_inserts++;
                }
                $text = "";
                $session->trace(TC_Gui1, 'instImportPagesAnswer-3: ' . $lines);
                $count_lines += $lines;
                for ($ii = 0; $ii < $lines; $ii++) {
                    $text .= fgets($file);
                }
                if ($import_replace) {
                    $old_id = dbSingleValue($session, 'select max(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $page));
                }
                $text_id = dbInsert($session, T_Text, 'page,type,text', $page . ',' . dbSqlString($session, $type) . ',' . dbSqlString($session, $text));
                if ($import_replace && $old_id > 0) {
                    dbUpdate($session, T_Text, $old_id, 'replacedby=' . $text_id);
                }
            }
        }
        fclose($file);
        $message = 'Datei ' . $import_file . ' wurde eingelesen. Neu: ' . (0 + $count_inserts) . ' Geändert: ' . (0 + $count_updates) . ' Zeilen: ' . (0 + $count_lines);
    }
    return $message;
}
Exemplo n.º 4
0
function guiLoginAnswer(&$session, &$message)
{
    $session->trace(TC_Gui1, 'guiLoginAnswer; login_user: '******'login_user']);
    $login_again = true;
    $message = null;
    $again = false;
    $user = $_POST['login_user'];
    $email = $_POST['login_email'];
    $code = $_POST['login_code'];
    if (isset($_POST['but_forget'])) {
        if (empty($user)) {
            $message = "+kein Benutzername angegeben";
        } elseif (empty($email)) {
            $message = "+keine EMail-Adresse angegeben";
        } else {
            $row = dbSingleRecord($session, 'select id,email from ' . dbTable($session, T_User) . ' where name=' . dbSqlString($session, $user));
            if (!$row) {
                $message = "+unbekannter Benutzer";
            } elseif (empty($row[1])) {
                $message = "+keine EMail-Adresse eingetragen";
            } elseif (strcasecmp($row[1], $email) != 0) {
                $message = "+EMail-Adresse ist nicht bekannt";
            } else {
                sendPassword($session, $row[0], $user, $email);
                $message = 'Das Passwort wurde an ' . $email . ' verschickt';
            }
        }
        $again = true;
    } else {
        $message = dbCheckUser($session, $user, $code);
        if (!empty($message)) {
            $again = true;
        } else {
            setLoginCookie($session, $user, $code);
            $session->setPageName(P_Home);
            $session->setSessionNo(1);
        }
    }
    return $again;
}
Exemplo n.º 5
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.º 6
0
function guiBacklinks($session, $page_name)
{
    $session->trace(TC_Gui1, 'pluginBacklinks');
    $name = $page_name;
    $condition = '(text like ' . dbSqlString($session, '%' . $name . '%');
    if (normWikiName($session, $name)) {
        $condition .= ' or text like ' . dbSqlString($session, '%' . $name . '%');
    }
    $condition .= ') and replacedby is NULL';
    if (!($ids = dbIdList2($session, T_Text, 'distinct page', $condition))) {
        guiParagraph($session, 'keine Verweise auf ' . $page_name . ' gefunden', false);
    } else {
        echo '<p>Es gibt folgende Verweise auf ';
        guiInternLink($session, $name, $page_name);
        echo '</p>' . "\n" . '<ulist>';
        foreach ($ids as $ii => $id) {
            $page = dbGetRecordById($session, T_Page, $id, 'name');
            echo '<li>';
            guiInternLink($session, $page[0], null);
            echo '</li>';
        }
        echo '</ulist>' . "\n";
    }
}
Exemplo n.º 7
0
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);
    }
}
Exemplo n.º 8
0
 function getMacro($name)
 {
     $this->trace(TC_Session3, 'getMacro');
     if (isset($this->fMacros[$name])) {
         $value = $this->fMacros[$name];
     } else {
         $value = '';
         switch ($name) {
             case TM_CurrentUser:
                 $value = htmlentities($this->fUserName);
                 break;
             case TM_CurrentDate:
                 $value = strftime('%Y.%m.%d');
                 break;
             case TM_CurrentDateTime:
                 $value = strftime('%Y.%m.%d %H:%M');
                 break;
             case TM_PageTitle:
                 $value = getMacro(TM_BasarName);
                 break;
             case TM_Newline:
                 $value = tagNewline;
                 break;
             case TM_RuntimeSecMilli:
             case TM_RuntimeSecMicro:
                 $value = $this->getRuntimeSec($name == TM_RuntimeSecMilli);
                 break;
             default:
                 # $this->trace (TC_X, "getMacro: $name");
                 $value = dbSingleValue($this, 'select value from ' . dbTable($this, T_Macro) . ' where name=' . dbSqlString($this, $name) . ' and ' . '(theme=' . ($this->fUserTheme + 0) . ' or theme=' . Theme_All . ') order by theme desc');
                 # $this->trace (TC_X, "getMacro: $name: $value");
                 break;
         }
         $this->trace(TC_Session2, 'getMacro-2: ' . $name . '=' . $value);
         if ($name != TM_RuntimeSecMicro && $name != TM_RuntimeSecMicro) {
             $this->fMacros[$name] = $value;
         }
     }
     $this->trace(TC_Session3, 'getMacro-3: ' . $name . '=' . $value);
     return $value;
 }
Exemplo n.º 9
0
function sendPassword(&$session, $id, $user, $email)
{
    $session->trace(TC_Util1, "sendPassword");
    $password = createPassword($session, 6);
    dbUpdate($session, T_User, $id, 'code=' . dbSqlString($session, encryptPassword($session, $user, $password)) . ',');
    mail($email, 'Deine Anmeldedaten für den Infobasar', 'Es wurde ein neues Passwort erzeugt:' . "\n{$password}\n" . 'Bitte nach dem Anmelden das Passwort wieder ändern');
}
Exemplo n.º 10
0
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);
    }
}
Exemplo n.º 11
0
function addressShowCards(&$session, $message = null)
{
    $session->trace(TC_Gui1, 'addressShowBook:');
    guiStandardHeader($session, 'Anzeigen von Adressen', Th_AddressHeader, Th_AddressBodyStart);
    if ($message != null) {
        guiParagraph($session, $message, false);
    }
    guiStartForm($session);
    guiHeadline($session, 2, 'Suchkriterien:');
    $books = dbColumnList($session, Tab_Book, 'name', '1');
    if (!isset($_POST['show_book'])) {
        $_POST['show_book'] = $books[0];
    }
    echo 'Adressbuch: ';
    guiComboBox('show_book', $books, null, null);
    $fields = array('Name', 'Vorname', 'Spitzname', 'EMail', 'PLZ', 'Ort', 'Funktion', 'Notiz');
    echo ' Auswahlkriterium: ';
    guiComboBox('show_choice', $fields, null, null);
    echo ' Suchmuster: ';
    outTextField($session, 'show_pattern', null, 16);
    echo ' ';
    outButton($session, 'show_search', 'Suchen');
    guiHeadline($session, 2, 'Ausgabefelder:');
    outCheckBox($session, 'show_withname', 'Name');
    echo ' ';
    outCheckBox($session, 'show_withprivate', 'Privat');
    echo ' ';
    outCheckBox($session, 'show_withoffice', 'Geschäftlich');
    echo ' ';
    outCheckBox($session, 'show_withphone', 'Telefon');
    echo ' ';
    outCheckBox($session, 'show_withemail', 'EMail');
    echo ' ';
    outCheckBox($session, 'show_withaddress', 'Postadresse');
    echo ' ';
    outCheckBox($session, 'show_withfunction', 'Funktion');
    echo ' ';
    outCheckBox($session, 'show_withnote', 'Notiz');
    echo ' ';
    outCheckBox($session, 'show_withdate', 'Datum');
    guiFinishForm($session, $session);
    if (isset($_POST['show_pattern'])) {
        $pattern = $_POST['show_pattern'];
        if (empty($pattern)) {
            $condidtion = '1';
        } else {
            $pattern = '%' . $pattern . '%';
            switch ($_POST['show_choice']) {
                case 'Name':
                    $condition = 'lastname like ' . dbSqlString($session, $pattern);
                    break;
                case 'Vorname':
                    $condition = 'firstname like ' . dbSqlString($session, $pattern);
                    break;
                case 'Spitzname':
                    $condition = 'nickname like ' . dbSqlString($session, $pattern);
                    break;
                case 'EMail':
                    $condition = 'emailprivate like ' . dbSqlString($session, $pattern) . ' or emailprivate2 like ' . dbSqlString($session, $pattern) . ' or emailoffice like ' . dbSqlString($session, $pattern) . ' or emailoffice2 like ' . dbSqlString($session, $pattern);
                    break;
                case 'PLZ':
                    $condition = 'zip like ' . dbSqlString($session, $pattern);
                    break;
                case 'Ort':
                    $condition = 'city like ' . dbSqlString($session, $pattern);
                    break;
                case 'Funktion':
                    $condition = 'function like ' . dbSqlString($session, $pattern);
                    break;
                case 'Notiz':
                    $condition = 'note like ' . dbSqlString($session, $pattern);
                    break;
                default:
                    $condition = '1';
                    break;
            }
            $what = 'lastname,firstname,country,zip,city,street,' . 'emailprivate,emailprivate2,phoneprivate,phoneprivate2,mobileprivate,faxprivate,' . 'emailoffice,emailoffice2,phoneoffice,phoneoffice2,mobileoffice,faxoffice,' . 'functions,notes,nickname,id,changedat,createdat';
            addressPrintTable($session, "select {$what} from " . dbTable($session, Tab_Card) . " where {$condition}", 30);
        }
    }
    guiStandardBodyEnd($session, Th_AddressBodyEnd);
}
Exemplo n.º 12
0
 function getLogPageId()
 {
     $this->trace(TC_Session1, 'getLogPageId');
     if ($this->fLogPageId == null) {
         $this->fLogPageId = dbPageId($this, PN_SystemLog);
         if ($this->fLogPageId <= 0) {
             $this->fLogPageId = dbInsert($this, T_Page, 'name,type,createdat,changedat,readgroup,writegroup', dbSqlString($this, PN_SystemLog) . ',' . dbSqlString($this, TT_Text) . ',now(),now(),0,0');
         }
     }
     return $this->fLogPageId;
 }
Exemplo n.º 13
0
function admSaveTable(&$session, $table, $ignore_id, &$file)
{
    $session->trace(TC_Gui1, 'admSaveTable: ' . $table);
    $bytes = 0;
    if (!dbGetTableInfo($session, $table, $names, $types, $is_string, $max_lengths, $ix_primary)) {
        $session->trace(TC_Error, 'admSaveTable: keine Metainfo');
        $bytes = -1;
    }
    $header = 'insert into ' . $table . ' (' . join(',', $ignore_id ? array_splice($names, $ix_primary, 1) : $names) . ') values (';
    if ($bytes == 0 && ($row = dbFirstRecord($session, 'select * from ' . $table . ' where 1'))) {
        do {
            $line = $header;
            $no = 0;
            for ($ix = 0; $ix < count($row); $ix++) {
                if (!$ignore_id || $ix != $ix_primary) {
                    if ($no++ > 0) {
                        $line .= ',';
                    }
                    if ($row[$ix] == null) {
                        $line .= 'NULL';
                    } else {
                        $line .= $is_string[$ix] ? dbSqlString($session, $row[$ix]) : 0 + $row[$ix];
                    }
                }
            }
            $line .= ');';
            $bytes += fwrite($file, $line);
            $bytes += fwrite($file, "\r\n");
        } while ($row = dbNextRecord($session));
    }
    return $bytes;
}
Exemplo n.º 14
0
function dbGetAuthorInfo(&$session, $author, &$link, &$postings, &$avatar, &$ranking)
{
    $session->trace(TC_Db3 + TC_Query, "dbGetAuthorInfo: {$author}");
    list($postings, $avatar) = dbGetRecordByClause($session, T_User, 'postings,avatar', 'name=' . dbSqlString($session, $author));
    $ranking = 'Stallknecht';
    if (!empty($avatar)) {
        $avatar = guiExternLinkString($session, $avatar, $author);
    }
    $link = null;
}
Exemplo n.º 15
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);
}