Exemplo n.º 1
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.º 2
0
function admExportPagesAnswer(&$session)
{
    global $export_pattern, $export_exists, $export_type, $export_export, $export_preview;
    $session->trace(TC_Gui1, 'admExportPagesAnswer');
    $message = null;
    if (isset($export_export)) {
        if (empty($export_pattern)) {
            $message = '+++ kein Suchmuster angegeben';
        } else {
            $page_list = dbIdList($session, T_Page, admBuildCondition($session, $export_pattern));
            if (!($file = fopen(FN_PageExport, 'w'))) {
                $message = 'kann Datei nicht öffnen: ' . FN_PageExport;
            } else {
                $prefix = $session->fDbTablePrefix;
                fputs($file, '/* Export ' . "\n" . 'am: ' . strftime("%Y.%m.%d %H:%M:%S") . "\n" . 'von: ' . $session->fUserName . "\n" . 'Modus: ' . $export_type . "\n" . 'Prefix: ' . $prefix . "\n" . 'Seiten: ' . implode(', ', $page_list) . "\n" . "*/\n");
                foreach ($page_list as $ii => $page_id) {
                    $page = dbGetRecordById($session, T_Page, $page_id, 'name,type,readgroup,writegroup');
                    $text_id = dbSingleValue($session, 'select max(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $page_id));
                    $text = dbGetRecordById($session, T_Text, $text_id, 'type,createdby,createdat,text');
                    if ($export_type == 'insert') {
                        fputs($file, 'insert into ' . $prefix . 'page(id,name,type,readgroup,writegroup) values (' . (0 + $page_id) . ',' . dbSqlString($session, $page[0]) . ',' . dbSqlString($session, $page[1]) . ',' . (0 + $page[2]) . ',' . (0 + $page[3]) . ');' . "\n");
                        fputs($file, 'insert into ' . $prefix . 'text(page,type,createdby,createdat,text) values (' . (0 + $page_id) . ',' . dbSqlString($session, $text[0]) . ',' . dbSqlString($session, $text[1]) . ',' . dbSqlString($session, $text[2]) . ',' . dbSqlString($session, $text[3]) . ');' . "\n");
                    } else {
                        fputs($file, '/* Seite ' . $page[0] . "*/\n");
                        fputs($file, '/* delete from ' . $prefix . dbTable($session, T_Text) . ' where page=' . $page_id . ';' . "\n*/\n");
                        fputs($file, 'update ' . $prefix . 'page set type=' . dbSqlString($session, $page[1]) . ' where name=' . dbSqlString($session, $page[0]) . ';' . "\n");
                        fputs($file, 'insert into ' . $prefix . 'text(page,createdby,createdat,text) values (' . (0 + $page_id) . ',' . dbSqlString($session, $text[0]) . ',' . dbSqlString($session, $text[1]) . ',' . dbSqlString($session, $text[2]) . ',' . dbSqlString($session, $text[3]) . ');' . "\n");
                    }
                }
                fclose($file);
                $export_exists = FN_PageExport;
                $message = 'Datei ' . FN_PageExport . ' wurde exportiert';
            }
        }
    }
    admExportPages($session, $message);
}
Exemplo n.º 3
0
function admExportPagesAnswer(&$session)
{
    $session->trace(TC_Gui1, 'admExportPagesAnswer');
    $message = null;
    if (isset($_POST['export_export'])) {
        if (empty($_POST['export_pattern'])) {
            $message = '+++ kein Suchmuster angegeben';
        } else {
            $page_list = dbIdList($session, T_Page, admBuildCondition($session, $_POST['export_pattern']));
            $fn = $session->fullPath("import", true) . FN_PageExport;
            if (!($file = fopen($fn, 'w'))) {
                $message = 'kann Datei nicht öffnen: ' . $fn;
            } else {
                $prefix = $session->fDbTablePrefix;
                fputs($file, '# Export ' . "\n" . '# am: ' . strftime("%Y.%m.%d %H:%M:%S") . "\n" . '# von: ' . $session->fUserName . "\n" . '# Modus: ' . $_POST['export_type'] . "\n" . '# Prefix: ' . $prefix . "\n" . '# Muster: ' . $_POST['export_pattern'] . "\n" . '# Seiten: ' . implode(', ', $page_list) . "\n" . "\n");
                $count = 0;
                foreach ($page_list as $ii => $page_id) {
                    $count++;
                    $page = dbGetRecordById($session, T_Page, $page_id, 'name,type');
                    $text_id = dbSingleValue($session, 'select max(id) from ' . dbTable($session, T_Text) . ' where page=' . (0 + $page_id));
                    $text = dbGetRecordById($session, T_Text, $text_id, 'type,createdby,createdat,text');
                    if ($_POST['export_type'] == 'wiki') {
                        fputs($file, "\n#name=" . $page[0] . "\tlines=" . (1 + substr_count($text[3], "\n")) . "\ttype=" . $text[0] . "\tpage=" . $page_id . "\ttext=" . $text_id . "\tby=" . $text[1] . "\tat=" . $text[2] . "\n");
                        fputs($file, $text[3]);
                    }
                }
                fclose($file);
                $_POST['export_exists'] = $fn;
                $message = 'Datei ' . $fn . ' wurde exportiert: ' . ($count + 0) . " Seite(n)";
            }
        }
    }
    admExportPages($session, $message);
}