Esempio n. 1
0
function discuss_list($message = '')
{
    pagetop(gTxt('list_discussions'), $message);
    extract(doSlash(gpsa(array('page', 'crit'))));
    extract(get_prefs());
    $total = safe_count('txp_discuss', "1=1");
    $limit = max(@$comment_list_pageby, 25);
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("discuss", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("discuss", $page + 1, gTxt('next'), 'next') : '';
    $criteria = $crit ? "message like '%{$crit}%'" : '1=1';
    $rs = safe_rows_start("*, unix_timestamp(posted) as uPosted", "txp_discuss", "{$criteria} order by posted desc limit {$offset}, {$limit}");
    echo pageby_form('discuss', $comment_list_pageby);
    if ($rs) {
        echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), assHead('date', 'name', 'message', 'parent', '');
        while ($a = nextRow($rs)) {
            extract($a);
            $dmessage = $visible == SPAM ? short_preview($message) : $message;
            $date = "" . date("M d, g:ia", $uPosted + tz_offset()) . "";
            $editlink = eLink('discuss', 'discuss_edit', 'discussid', $discussid, $date);
            $cbox = fInput('checkbox', 'selected[]', $discussid);
            $tq = fetch('Title', 'textpattern', 'ID', $parentid);
            $parent = !$tq ? gTxt('article_deleted') : $tq;
            echo assRow(array($editlink => 100, $name => 100, $dmessage => 250, $parent => 100, $cbox => 20), ' class="' . ($visible == VISIBLE ? 'visible' : ($visible == SPAM ? 'spam' : 'moderate')) . '"');
        }
        echo tr(tda(select_buttons() . discuss_multiedit_form(), ' colspan="5" style="text-align:right;border:0px"'));
        echo endTable() . '</form>';
        echo startTable('edit'), tr(td(form(fInput('text', 'crit', '', 'edit') . fInput('submit', 'search', gTxt('search'), 'smallbox') . eInput("discuss") . sInput("list"))) . td(graf(join('', $nav)))) . tr(tda(graf('<a href="index.php?event=discuss' . a . 'step=ipban_list">' . gTxt('list_banned_ips') . '</a>'), ' colspan="2" align="center" valign="middle"')), endTable();
    } else {
        echo graf(gTxt('no_comments_recorded'), ' align="center"');
    }
}
Esempio n. 2
0
function list_plugins($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    echo startTable('list') . tr(tda(plugin_form() . plugin_form_old(), ' colspan="5" style="border:0;height:50px"')) . assHead('plugin', 'author', 'version', 'description', 'active', '');
    $rs = safe_rows("*", "txp_plugin", "1 order by name");
    foreach ($rs as $a) {
        extract($a);
        // nice to have eval() do a syntax check on the plugin here
        echo tr(td(eLink('plugin', 'edit', 'name', $name, $name), 150) . td('<a href="' . $author_uri . '">' . $author . '</a>', 100) . td($version, 10) . td($description, 260) . td(status_link($status, $name, yes_no($status)), 30) . td(dLink('plugin', 'delete', 'name', $name), 30));
        unset($name, $page, $deletelink);
    }
    echo endTable();
}
Esempio n. 3
0
function plugin_list($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    echo startTable('list') . tr(tda(plugin_form() . plugin_form_old(), ' colspan="8" style="border:0;height:50px"')) . assHead('plugin', 'author', 'version', 'description', 'active', '', '', '');
    $rs = safe_rows_start("*", "txp_plugin", "1 order by name");
    while ($a = nextRow($rs)) {
        extract($a);
        $elink = eLink('plugin', 'plugin_edit', 'name', $name, gTxt('edit'));
        $hlink = '<a href="?event=plugin&#38;step=plugin_help&#38;name=' . $name . '">' . gTxt('help') . '</a>';
        echo tr(td($name) . td('<a href="' . $author_uri . '">' . $author . '</a>') . td($version, 10) . td($description, 260) . td(status_link($status, $name, yes_no($status)), 30) . td($elink) . td($hlink) . td(dLink('plugin', 'plugin_delete', 'name', $name), 30));
        unset($name, $page, $deletelink);
    }
    echo endTable();
}
Esempio n. 4
0
function element_list($event, $step)
{
    $message = '';
    pagetop(gTxt('element'), $message);
    echo startTable('list') . assHead('element', 'version', 'date', 'active', 'checksum');
    $rs = safe_rows('*', 'txp_element', '1=1');
    foreach ($rs as $row) {
        extract($row);
        if ($hash) {
            $checksum = md5_file(txpath . '/elements/' . $name . '.php') == $hash ? gTxt('ok') : gTxt('modified');
        } else {
            $checksum = gTxt('unknown');
        }
        echo tr(td($name) . td($version) . td($modified) . td($status ? gTxt('yes') : gTxt('no')) . td($checksum));
    }
    echo endTable();
}
Esempio n. 5
0
function log_list()
{
    pagetop(gTxt('visitor_logs'));
    extract(get_prefs());
    safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)");
    safe_optimize("txp_log");
    safe_repair("txp_log");
    $page = gps('page');
    $total = getCount('txp_log', "1");
    $limit = 50;
    $numPages = ceil($total / $limit);
    $page = !$page ? 1 : $page;
    $offset = ($page - 1) * $limit;
    $nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : '';
    $nav[] = sp . small($page . '/' . $numPages) . sp;
    $nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : '';
    $rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}");
    if ($rs) {
        echo startTable('list'), assHead('time', 'host', 'page', 'referrer');
        $stamp = '';
        while ($a = nextRow($rs)) {
            extract($a);
            if ($refer) {
                $referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50));
                $referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>';
            } else {
                $referprint = '&#160;';
            }
            $pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1)));
            $pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>';
            if ($method == 'POST') {
                $pageprint = '<b>' . $pageprint . '</b>';
            }
            $fstamp = date("n/j g:i a", $stamp + tz_offset());
            $hostprint = chunk($host, 40);
            echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint));
            unset($refer, $referprint, $page, $pageprint);
        }
        echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable();
    } else {
        echo graf(gTxt('no_refers_recorded'), ' align="center"');
    }
}
Esempio n. 6
0
function form_list($curname)
{
    global $step, $essential_forms;
    $out[] = startTable('list');
    $out[] = tr(tda(sLink('form', 'form_create', gTxt('create_new_form')), ' colspan="3" style="height:30px"'));
    $out[] = assHead('form', 'type', '');
    $methods = array('delete' => gTxt('delete'));
    $rs = safe_rows_start("*", "txp_form", "1 order by type asc, name asc");
    if ($rs) {
        while ($a = nextRow($rs)) {
            extract($a);
            $editlink = $curname != $name ? eLink('form', 'form_edit', 'name', $name, $name) : htmlspecialchars($name);
            $modbox = !in_array($name, $essential_forms) ? '<input type="checkbox" name="selected_forms[]" value="' . $name . '" />' : sp;
            $out[] = tr(td($editlink) . td(small($type)) . td($modbox));
        }
        $out[] = endTable();
        $out[] = eInput('form') . sInput('form_multi_edit');
        $out[] = graf(selectInput('edit_method', $methods, '', 1) . sp . gTxt('selected') . sp . fInput('submit', 'form_multi_edit', gTxt('go'), 'smallerbox'), ' align="right"');
        return form(join('', $out), '', "verify('" . gTxt('are_you_sure') . "')");
    }
}
Esempio n. 7
0
function form_list($curname)
{
    global $step;
    $out[] = startTable('list');
    $out[] = tr(tda(sLink('form', 'form_create', gTxt('create_new_form')), ' colspan="3" style="height:30px"'));
    $out[] = assHead('form', 'type', '');
    $methods = array('delete' => 'delete');
    $rs = safe_rows("*", "txp_form", "1 order by name");
    if ($rs) {
        foreach ($rs as $a) {
            extract($a);
            $editlink = $curname != $name ? eLink('form', 'form_edit', 'name', $name, $name) : $name;
            $modbox = $name != 'comments' && $name != 'comment_form' && $name != 'default' && $name != 'Links' ? '<input type="checkbox" name="selected_forms[]" value="' . $name . '" />' : sp;
            $out[] = tr(td($editlink) . td(small($type)) . td($modbox));
        }
        $out[] = endTable();
        $out[] = eInput('form') . sInput('form_multi_edit');
        $out[] = graf(selectInput('method', $methods, '', 1) . sp . gTxt('selected') . sp . fInput('submit', 'form_multi_edit', gTxt('go'), 'smallerbox'), ' align="right"');
        return form(join('', $out), '', "verify('" . gTxt('are_you_sure') . "')");
    }
}
Esempio n. 8
0
function plugin_list($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    echo n . n . startTable('list') . tr(tda(plugin_form(), ' colspan="8" style="height: 30px; border: none;"'));
    $rs = safe_rows_start('name, status, author, author_uri, version, description, code_md5, length(help) as help, md5(code) as md5', 'txp_plugin', '1 order by name');
    if ($rs and numRows($rs) > 0) {
        echo assHead('plugin', 'author', 'version', 'plugin_modified', 'description', 'active', 'help', '', '');
        while ($a = nextRow($rs)) {
            foreach ($a as $key => $value) {
                ${$key} = htmlspecialchars($value);
            }
            // Fix up the description for clean cases
            $description = preg_replace(array('#&lt;br /&gt;#', '#&lt;(/?(a|b|i|em|strong))&gt;#', '#&lt;a href=&quot;(https?|\\.|\\/|ftp)([A-Za-z0-9:/?.=_]+?)&quot;&gt;#'), array('<br />', '<$1>', '<a href="$1$2">'), $description);
            $help = !empty($help) ? '<a href="?event=plugin' . a . 'step=plugin_help' . a . 'name=' . $name . '">' . gTxt('view') . '</a>' : gTxt('none');
            // modified?
            $modified = strtolower($md5) != strtolower($code_md5);
            echo tr(n . td($name) . td(href($author, $author_uri)) . td($version, 10) . td($modified ? gTxt('yes') : '') . td($description, 260) . td(status_link($status, $name, yes_no($status)), 30) . td($help) . td(eLink('plugin', 'plugin_edit', 'name', $name, gTxt('edit'))) . td(dLink('plugin', 'plugin_delete', 'name', $name), 30));
            unset($name, $page, $deletelink);
        }
    }
    echo endTable();
}
function _sed_list_plugins_from_cache($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    echo startTable('list');
    $filenames = array();
    if (!empty($GLOBALS['prefs']['plugin_cache_dir'])) {
        $dir = dir($GLOBALS['prefs']['plugin_cache_dir']);
        while ($file = $dir->read()) {
            if ($file != '.' && $file != '..') {
                $fileaddr = $GLOBALS['prefs']['plugin_cache_dir'] . DS . $file;
                if (!is_dir($fileaddr)) {
                    $filenames[] = $fileaddr;
                }
            }
        }
        $dir->close();
        ($filenames and count($filenames) > 0) ? natcasesort($filenames) : '';
    }
    echo tr(tda(tag('Plugins found in the plugin cache directory: ' . $GLOBALS['prefs']['plugin_cache_dir'], 'h1'), ' colspan="1" style="border:0;height:50px;text-align:left"'));
    echo assHead('plugin');
    if (count($filenames) > 0) {
        foreach ($filenames as $filename) {
            $fileext = array_pop(explode('.', $filename));
            if ($fileext === 'php') {
                $elink = '<a href="?event=sed_plugin_help_viewer&#38;step=view_help&#38;filename=' . $filename . '">' . (isset($plugin['name']) ? $plugin['name'] : $filename) . '</a>';
                echo tr(td(strong($elink)));
            }
        }
    }
    echo endTable();
}