コード例 #1
0
function instUnlink(&$session, $dir, $pattern)
{
    $negate = false;
    if (ord($pattern) == ord('^')) {
        $pattern = substr($pattern, 1);
        $negate = true;
    }
    $path = ($dir == '.' ? $session->fFileSystemBase : getParentDir($session, $session->fFileSystemBase) . $dir) . PATH_DELIM;
    $dir = opendir($path);
    while ($file = readdir($dir)) {
        if ($file != '.' && $file != '..' && ($pattern == null || $negate ^ preg_match($pattern, $file))) {
            $name = $path . $file;
            echo $name;
            echo ' wurde ';
            if (!unlink($name)) {
                echo '<b>nicht</b> ';
            }
            echo 'gelöscht';
            outNewline();
        }
    }
    closedir($dir);
}
コード例 #2
0
ファイル: gui.php プロジェクト: BackupTheBerlios/infobasar
function guiLogin(&$session, $message)
{
    guiStandardHeader($session, "Anmeldung f&uuml;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;
}
コード例 #3
0
function baseSearch(&$session, $message)
{
    $session->trace(TC_Gui1, 'baseSearch');
    if (!isset($_POST['search_bodytext']) && isset($_POST['search_titletext'])) {
        $_POST['search_bodytext'] = $_POST['search_titletext'];
    }
    getUserParam($session, U_MaxHits, $_POST['search_maxhits']);
    guiStandardHeader($session, 'Suchen auf den Wiki-Seiten', Th_SearchHeader, Th_SearchBodyStart);
    if (isset($_POST['search_title']) || isset($_POST['search_body'])) {
        baseSearchResults($session);
    }
    guiStartForm($session);
    outTableAndRecord();
    outTableCell('Titel:');
    outTableDelim();
    outTextField($session, 'search_titletext', null, 32, 64);
    echo " ";
    outButton($session, 'search_title', "Suchen");
    outTableDelimAndRecordEnd();
    outTableRecord();
    outTableCell('Beitrag:');
    outTableDelim();
    outTextField($session, 'search_bodytext', null, 32, 64);
    echo " ";
    outButton($session, 'search_body', 'Suchen');
    outTableDelimAndRecordEnd();
    outTableTextField($session, 'Maximale Trefferzahl:', 'search_maxhits', null, 10, 10);
    outTableAndRecordEnd();
    guiFinishForm($session, $session);
    outParagraph($session);
    outStrong('Hinweis:');
    outNewline();
    echo 'Vorl&auml;ufig nur ein Suchbegriff m&ouml;glich.';
    outNewline();
    echo 'Joker (Wildcards) sind % (beliebig) und _ (1 Zeichen).';
    outNewline();
    outStrong('Bsp:');
    outNewline();
    outQuotation('a_t ');
    echo ' findet "Kin';
    outStrong('ast');
    echo '" und "';
    outStrong('Amt');
    echo 'sperson", aber nicht "h';
    outStrong('a');
    echo 's';
    outStrong('st');
    echo '"';
    outNewline();
    outQuotation('Hilfe%format');
    echo ' findet ';
    outStrong('Hilfe');
    echo 'Bei';
    outStrong('Format');
    echo 'ierung und "';
    outStrong('Hilfe');
    echo ' f&uuml;r ein Datei';
    outStrong('format');
    echo '".', outParagraphEnd($session);
    guiStandardBodyEnd($session, Th_SearchBodyEnd);
}
コード例 #4
0
function baseForum(&$session)
{
    $session->trace(TC_Gui1, 'baseForum');
    if (!isset($_POST['forum_id']) || !isInt($_POST['forum_id'])) {
        $_POST['forum_id'] = 1;
    }
    $forum_id = $_POST['forum_id'];
    if (empty($_POST['page_no'])) {
        $_POST['page_no'] = 1;
    }
    $page_no = $_POST['page_no'];
    $forum = dbGetRecordById($session, T_Forum, $forum_id, 'name,description');
    dbForumInfo($session, $forum_id, $threads, $pages);
    $headline = 'Forum ' . $forum[0];
    guiStandardHeader($session, $headline, Th_StandardHeader, Th_StandardBodyStart);
    guiParagraph($session, $forum[1], true);
    guiParagraph($session, 'Seite ' . $page_no . ' von ' . $pages . ' (' . (0 + $threads) . ($threads == 1 ? ' Thema)' : ' Themen)'), false);
    outTableAndRecord();
    outTableInternLink($session, null, P_Forum . '?forum_id=' . $forum_id . '&action=' . A_NewThread, 'Neues Thema');
    outTableDelim(AL_Right);
    guiPageLinks($session, P_Forum . '?action=' . A_ShowForum . '&forum_id=' . $forum_id, $page_no, $pages);
    outTableDelimAndRecordEnd();
    outTableEnd();
    $id_list = dbIdListOfPage($session, T_Posting, "forum={$forum_id} and top is null order by id desc", $session->fUserThreadsPerPage, $page_no);
    outTableAndRecord(1);
    outTableCellStrong('Thema');
    outTableCellStrong('Autor');
    outTableCellStrong('Antworten');
    outTableCellStrong('Aufrufe');
    outTableCellStrong('Letzter Beitrag');
    outTableCellStrong('Thema');
    outTableRecordEnd();
    foreach ($id_list as $ii => $id) {
        $thread = dbGetRecordById($session, T_Posting, $id, 'author,changedat,subject,changedby,calls');
        $last_id = null;
        dbThreadInfo($session, $id, $answers, $thread_pages, $last_id);
        if (empty($last_id)) {
            $last = $thread;
            $last_id = $id;
        } else {
            $last = dbGetRecordById($session, T_Posting, $last_id, 'author,changedat,subject');
        }
        outTableRecordAndDelim();
        guiThreadPageLink($session, $id, 1, $thread[2]);
        outTableDelimEnd();
        outTableCell(htmlentities($thread[0]));
        outTableCell($answers + 0);
        outTableCell($thread[4] + 0);
        outTableDelim();
        echo $last[0];
        echo ' ';
        echo dbSqlDateToText($session, $last[1]);
        outNewline();
        guiInternLink($session, P_Thread . '?action=' . A_ShowThread . '&posting_id=' . $last_id, $last[2]);
        outTableDelimAndRecordEnd();
    }
    outTableEnd();
    outTableAndRecord();
    outTableInternLink($session, null, P_Forum . '?forum_id=' . $forum_id . '&action=' . A_NewThread, 'Neues Thema');
    outTableDelim(AL_Right);
    guiPageLinks($session, P_Forum . '?action=' . A_ShowForum . '&forum_id=' . $forum_id, $page_no, $pages);
    outTableDelimAndRecordEnd();
    outTableEnd();
    guiStandardBodyEnd($session, Th_StandardBodyEnd);
}
コード例 #5
0
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);
    }
}
コード例 #6
0
ファイル: admin.php プロジェクト: BackupTheBerlios/infobasar
function admRename(&$session, $message)
{
    $session->trace(TC_Gui1, 'admRename');
    admStandardHeader($session, 'Umbenennen einer Seite');
    if (!empty($message)) {
        guiParagraph($session, $message, false);
    }
    guiStartForm($session);
    outTableAndRecord();
    outTableTextField($session, 'Bisheriger Name:', 'rename_oldname', null, 64, 64);
    outTableRecordDelim();
    outTableTextField($session, 'Neuer Name:', 'rename_newname', null, 64, 64);
    outTableRecordDelim();
    outTableCell(' ');
    outTableDelim();
    outButton($session, 'rename_info', 'Info');
    if (!empty($_POST['rename_oldname']) && !empty($_POST['rename_newname'])) {
        echo ' | ';
        outButton($session, 'rename_rename', 'Umbenennen');
        outNewline();
        outCheckBox($session, 'rename_backlinks', 'Alle Verweise umbenennen', null);
    }
    outTableDelimAndRecordEnd();
    outTableEnd();
    guiFinishForm($session);
    if (!empty($_POST['rename_oldname']) && dbPageId($session, $_POST['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, '%' . $_POST['rename_oldname'] . '%'));
        if (!$row) {
            guiParagraph($session, '+++ keine Verweise gefunden', false);
        } else {
            outTableAndRecord(1);
            outTableCellStrong('Seite');
            outTableCellStrong('Typ');
            outTableCellStrong('von');
            outTableCellStrong('Letzte &Auml;nderung');
            outTableCellStrong('Fundstelle');
            outTableCellStrong('Seite');
            outTableRecordEnd();
            while ($row) {
                $pagerecord = dbGetRecordById($session, T_Page, $row[0], 'name,type');
                $text = findTextInLine($row[1], $_POST['rename_oldname'], 10, true);
                if (!empty($text)) {
                    outTableRecord();
                    outTableInternLink($session, null, encodeWikiName($session, $pagerecord[0]), $pagerecord[0], M_Base);
                    outTableCell($pagerecord[1]);
                    outTableCell($row[2]);
                    outTableCell(htmlentities($row[3]));
                    outTableCell($text);
                    outTableRecordEnd();
                }
                $row = dbNextRecord($session);
            }
            outTableEnd();
        }
    }
    admFinishBody($session);
}
コード例 #7
0
ファイル: util.php プロジェクト: BackupTheBerlios/infobasar
function writeText($body, &$status)
{
    $status->trace(TC_Util2, "writeText: {$body}");
    $count = 0;
    while (strlen($body) > 0 && preg_match(IB_REG_EXPR, $body, $match)) {
        $args = count($match);
        $count++;
        if ($match[1] != '') {
            echo htmlentities($match[1]);
        }
        #$status->trace (TC_X, "writeText-2:" . dumpArray ($match, 'match', 2));
        // Alle Ausdrücke ohne Klammern:
        if ($args == 3) {
            switch ($match[2]) {
                case '__':
                    $status->handleEmphasis('u');
                    break;
                case '\'\'':
                    $status->handleEmphasis('i');
                    break;
                case '\'\'\'':
                    $status->handleEmphasis('b');
                    break;
                case '\'\'\'\'':
                    $status->handleEmphasis('x');
                    break;
                case '%%%':
                    outNewline();
                    break;
                default:
                    if (strpos($match[2], "hex(") == 1) {
                        for ($ii = 5; $ii < strlen($match[2]) - 1; $ii++) {
                            printf("%02x ", ord(substr($match[2], $ii, 1)));
                        }
                    } elseif (getPos($match[2], '[[') == 0) {
                        if (strlen($match[2]) == 5) {
                            echo substr($match[2], 2, 1);
                        } else {
                            writeExternLink(substr($match[2], 2, strlen($match[2]) - 4), null, true, $status);
                        }
                    } else {
                        echo htmlentities($match[2]);
                    }
            }
        } else {
            if ($args == 9) {
                writeWikiName($match[7], substr($match[8], 1), $status);
            } elseif ($args == 8) {
                writeWikiName($match[7], null, $status);
            } elseif ($args == 5) {
                // Direkter Verweis (ohne [[]]:
                writeExternLink($match[2], null, false, $status);
            } elseif ($args == 4) {
                // [[Verweis]]:
                $len = strpos($match[2], '|') - 2;
                writeExternLink(substr($match[2], 2, $len > 0 ? $len : strlen($match[2])), substr($match[3], 1), true, $status);
            } elseif ($args == 6) {
                // (Nicht-)Wikiname
                writeWikiName($match[2], null, $status);
            } elseif ($args == 7) {
                switch ($match[6]) {
                    case 'newline':
                        echo '<br />';
                        break;
                    case 'big':
                    case '/big':
                    case 'small':
                    case '/small':
                    case 'sub':
                    case '/sub':
                    case 'sup':
                    case '/sup':
                    case 'tt':
                    case '/tt':
                        echo TAG_PREFIX;
                        echo $match[6];
                        echo TAG_SUFFIX;
                        break;
                    case 'subscript':
                        echo TAG_SUB;
                        break;
                    case 'superscript':
                        echo TAG_SUP;
                        break;
                    case '/subscript':
                        echo TAG_SUP_END;
                        break;
                    case '/superscript':
                        echo TAG_SUP_END;
                        break;
                    case '/teletype':
                        echo TAG_TT;
                        break;
                    case 'teletype':
                        echo TAG_TT_END;
                        break;
                    default:
                        echo $match[2];
                        break;
                }
            } elseif ($args == 11) {
                writePlugin($match[9], $match[10], $status);
            } else {
                echo $match[2];
            }
        }
        // args != 3
        $body = substr($body, strlen($match[1]) + strlen($match[2]));
    }
    if ($body != '') {
        echo $status->fSession->replaceMacrosHTML(htmlentities($status->fSession->replaceMacrosNoHTML($body)));
    }
}