Exemple #1
0
/**
 * Displays the screen to edit and delete trackbacks.
 *
 * @param string $msg
 * @see submit_trackback()
 */
function edit_trackbacks($msg = "")
{
    global $Cfg, $Pivot_Vars, $Users;
    PageHeader(lang('userbar', 'trackbacks'), 1);
    PageAnkeiler(lang('userbar', 'trackbacks') . ' » ' . lang('userbar', 'trackbacks_title'));
    $id = $Pivot_Vars['id'];
    $db = new db();
    // read entry if it's not in memory yet.
    $db->read_entry($id, true);
    printf("<p><strong>%s</strong>: %s<br />", lang('entries', 'title'), $db->entry['title']);
    printf("<strong>%s</strong>: %s<br />", lang('entries', 'author'), $db->entry['user']);
    printf("<strong>%s</strong>: %s</p><br />", lang('entries', 'date'), $db->entry['date']);
    if ($Pivot_Vars['user'] == $db->entry['user']) {
        // allowed to edit own trackbacks
        MinLevel(2);
    } else {
        // allowed to edit trackbacks on other people's entries
        MinLevel(3);
    }
    if (!$db->entry['trackbacks'] || count($db->entry['trackbacks']) < 1) {
        // print if there are no trackbacks
        echo "<p><B>" . lang('notice', 'trackback_none') . "</b><br /><br /></p>";
    } else {
        // print the trackbacks..
        // perhaps delete a trackback.
        if (isset($Pivot_Vars['del'])) {
            $del_track = $db->entry['trackbacks'][$Pivot_Vars['del']];
            //remove the trackback from last_trackbacks if it's in there..
            if (file_exists("db/ser_lasttrack.php")) {
                $last_tracks = load_serialize("db/ser_lasttrack.php", true, true);
            } else {
                $last_tracks = array();
            }
            if ($last_tracks !== false && count($last_tracks) > 0) {
                foreach ($last_tracks as $key => $last_track) {
                    if ($last_track['code'] == $db->entry['code'] && $last_track['name'] == $del_track['name'] && $last_track['date'] == $del_track['date']) {
                        unset($last_tracks[$key]);
                        save_serialize("db/ser_lasttrack.php", $last_tracks);
                    }
                }
            }
            // *argh* evil hack to directly delete trackbacks.. I should write a
            // proper wrapper
            unset($db->entry['trackbacks'][$Pivot_Vars['del']]);
            unset($db->db_lowlevel->entry['trackbacks'][$Pivot_Vars['del']]);
            $db->save_entry();
            $msg = lang('notice', 'trackback_deleted');
        }
        // perhaps add an ip-block for single ip.
        if (isset($Pivot_Vars['blocksingle'])) {
            $msg = "Added block for IP " . $Pivot_Vars['blocksingle'];
            add_block($Pivot_Vars['blocksingle']);
        }
        // perhaps add an ip-block for single ip.
        if (isset($Pivot_Vars['blockrange'])) {
            $iprange = make_mask($Pivot_Vars['blockrange']);
            $msg = "Added block for IP-range " . $iprange;
            add_block($iprange);
        }
        // perhaps remove an ip-block for single ip.
        if (isset($Pivot_Vars['unblocksingle'])) {
            $msg = "Removed block for IP " . $Pivot_Vars['unblocksingle'];
            rem_block($Pivot_Vars['unblocksingle']);
        }
        // perhaps remove an ip-block for single ip.
        if (isset($Pivot_Vars['unblockrange'])) {
            $iprange = make_mask($Pivot_Vars['unblockrange']);
            $msg = "Removed block for IP-range " . $iprange;
            rem_block($iprange);
        }
        // print a message, if there is one.
        if ($msg != "") {
            echo "<p><B>{$msg}</b><br /><br /></p>";
        }
        // show the edit form, to edit a trackback..
        if (isset($Pivot_Vars['edit'])) {
            StartForm('submittrackback', 0);
            StartTable();
            $mytrack = $db->entry['trackbacks'][$Pivot_Vars['edit']];
            $settings = array();
            $settings[] = array('heading', lang('weblog_config', 'shortentry_template'), '', 8, '', 2, '');
            $settings[] = array('id', '', '', 7, $id, '', '');
            $settings[] = array('count', '', '', 7, $Pivot_Vars['edit'], '', '');
            $settings[] = array('name', lang('weblog_text', 'blog_name'), '', 0, unentify($mytrack['name']), 60, '');
            $settings[] = array('title', lang('weblog_text', 'title'), '', 0, unentify($mytrack['title']), 60, '');
            $settings[] = array('excerpt', lang('weblog_text', 'excerpt'), '', 5, unentify($mytrack['excerpt']), '60', 'rows=5');
            $settings[] = array('url', lang('weblog_text', 'url'), '', 0, $mytrack['url'], 60, '');
            $settings[] = array('ip', lang('weblog_text', 'ip'), '', 0, $mytrack['ip'], 30, '');
            $settings[] = array('date', lang('weblog_text', 'date'), '', 0, $mytrack['date'], 30, '');
            DisplaySettings($settings, 'blog_settings');
            EndForm(lang('weblog_config', 'save_trackback'), 1);
        }
        // print out all the trackbacks..
        foreach ($db->entry['trackbacks'] as $key => $trackback) {
            $myblock = block_type($trackback['ip']);
            if ($myblock == "single" || $myblock == "range") {
                $strike = "style='text-decoration: line-through;'";
            } else {
                $strike = "";
            }
            // strip stuff from lamers' trackbacks..
            $trackback['url'] = strip_tags($trackback['url']);
            printf("<table border=0 cellpadding=2 cellspacing=2 width='95%%' style='border-bottom:" . " 2px solid #999;'><tr><td width='40%%' valign='top'>" . lang('weblog_text', 'title') . ":&nbsp;<b %s>%s</b><br />", $strike, stripslashes($trackback['title']));
            printf(lang('weblog_text', 'blog_name') . ":&nbsp;%s<br />", $trackback['name']);
            printf(lang('weblog_text', 'url') . ":&nbsp;%s<br />", $trackback['url']);
            printf(lang('weblog_text', 'ip') . ":&nbsp;%s<br />", $trackback['ip']);
            printf(lang('weblog_text', 'date') . ":&nbsp;%s<br />", $trackback['date']);
            printf("<td valign='top'><span %s>%s</span></td>", $strike, nl2br(htmlspecialchars($trackback['excerpt'])));
            // only show the option to edit and delete links if the user is an advanced user.
            if ($Users[$Pivot_Vars['user']]['userlevel'] >= 2) {
                $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=edittrackbacks&amp;", $Pivot_Vars['session']);
                $editlink = sprintf("%sid=%s&amp;edit=%s", $link, $db->entry['code'], $key);
                $dellink = sprintf("%sid=%s&amp;del=%s", $link, $db->entry['code'], $key);
                $reportpopup = sprintf("openReportTrackback('%s', '%s','%s','%s');", $Pivot_Vars['session'], $db->entry['code'], $key, $dellink);
                printf("</tr><tr class='tabular_line_odd'><td><a href='%s'>%s</a> /", $editlink, lang('entries', 'edit_trackback'));
                printf(" <a href='%s'>%s</a> / ", $dellink, lang('entries', 'delete_trackback'));
                // only ping.
                // printf(" <a href='#' onclick=\"%s\">%s</a>&nbsp;&nbsp;", $reportpopup, lang('entries', 'report_trackback') );
                // ping and delete
                printf(" <a href='#' onclick=\"%s\">%s</a>&nbsp;&nbsp;", $reportpopup, lang('entries', 'report_trackback'));
            } else {
                printf("<td>&nbsp;</td>");
            }
            // only show the option to add or remove ip-blocks if the user is an administrator.
            if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) {
                if ($myblock == "none") {
                    $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'block_single'));
                    $blocklink1 = sprintf("%sid=%s&blocksingle=%s", $link, $db->entry['code'], $trackback['ip']);
                    $blocktext2 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'block_range'));
                    $blocklink2 = sprintf("%sid=%s&blockrange=%s", $link, $db->entry['code'], $trackback['ip']);
                    printf("<td><a href='%s'>%s</a> / ", $blocklink1, $blocktext1);
                    printf("<a href='%s'>%s</a></td>", $blocklink2, $blocktext2);
                } else {
                    if ($myblock == "single") {
                        $blocktext1 = str_replace("%s", $trackback['ip'], lang('entries', 'unblock_single'));
                        $blocklink1 = sprintf("%sid=%s&unblocksingle=%s", $link, $db->entry['code'], $trackback['ip']);
                        printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1);
                    } else {
                        $blocktext1 = str_replace("%s", make_mask($trackback['ip']), lang('entries', 'unblock_range'));
                        $blocklink1 = sprintf("%sid=%s&unblockrange=%s", $link, $db->entry['code'], $trackback['ip']);
                        printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1);
                    }
                }
            } else {
                printf("<td>&nbsp;</td>");
            }
            printf("</td></tr></table><br />");
        }
        // end of printing trackbacks
    }
    // Table for editing the entry / trackbacks (this will be replaced after 1.30,
    // When we put the form-builder in place.
    echo '<table  width="95%"  border="0" cellpadding="5" cellspacing="0">';
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=modify&amp;id=%s", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- edit entry --><tr><td width="32" valign="top">');
    print_icon('overview', 'new_entry', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_entry'), lang('entries', 'edit_entry_desc'));
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=editcomments&amp;id=%s", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- edit comments --><tr><td width="32" valign="top">');
    print_icon('entry', 'edit_comments', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_comments'), lang('entries', 'edit_comments_desc'));
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;doaction=1&amp;action=delete&amp;check[%s]=1", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- delete entry --><tr><td width="32" valign="top">');
    print_icon('entry', 'del_entry', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'delete_entry'), lang('entries', 'delete_entry_desc'));
    echo "</table>";
    // End of table for editing the entry / trackbacks
    PageFooter();
    echo "<br /><br /><br /><br />";
}
Exemple #2
0
"><?php 
echo lang('entries', 'edit_trackback');
?>
</a></h3>
        <p class="dim"><?php 
echo lang('entries', 'edit_trackback_desc');
?>
</p></td>
    </tr>


	<!-- delete entry -->
    <tr>
      <td width="32" valign="top"><?php 
$link = sprintf("index.php?session=%s&amp;menu=entries&amp;doaction=1&amp;action=delete&amp;check[%s]=1", $Pivot_Vars['session'], $entry['code']);
print_icon('entry', 'del_entry', "<a href=\"" . $link . "\">");
?>
</td>
      <td><h3><a href="<?php 
echo $link;
?>
"><?php 
echo lang('entries', 'delete_entry');
?>
</a></h3>
        <p class="dim"><?php 
echo lang('entries', 'delete_entry_desc');
?>
</p></td>
    </tr>
  </table>
Exemple #3
0
function DispPage($toshow = '', $screenname = '')
{
    global $Pivot_Vars, $theme_icon;
    if (is_array($toshow)) {
        echo "<table  width='95%'  border='0' cellpadding='5' cellspacing='0'>\n";
        $cnt = count($toshow);
        for ($i = 0; $i < $cnt; $i++) {
            // Make the link..
            if (isset($Pivot_Vars['func']) && $Pivot_Vars['func'] == 'admin' || isset($Pivot_Vars['menu']) && $Pivot_Vars['menu'] == 'admin') {
                $links = array('func' => 'admin', 'do' => $toshow[$i][1]);
            } else {
                $links = array('func' => $toshow[$i][1]);
            }
            if (isset($toshow[$i][3])) {
                $links = array('menu' => $toshow[$i][3]);
            }
            $link = MakeLink($links);
            // Print the icon..
            echo "<tr><td width='48' valign='top' align='center'>\n";
            print_icon($screenname, $toshow[$i][1], $link);
            echo "</td><td><h3>";
            echo $link;
            echo $toshow[$i][0];
            echo "</a></h3>\n<p class='dim'>";
            // Edit the comments that were posted to this entry.
            echo $toshow[$i][2];
            echo "</p></td>\n";
            echo "</tr>\n\n";
        }
        echo "</table>\n\n";
    }
}