示例#1
0
            echo 'once that this package has rolled a release.</p>';
        }
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        // }}}
    } elseif ($action == 'trackbacks') {
        if ($pkg['blocktrackbacks']) {
            echo '<p>Trackbacks are disabled for this package. If you like to enable them, click below:</p>';
            echo '<p><a href="/package/' . $pkg['name'] . '/trackbacks/?allowtrackbacks=1">Allow trackbacks</a></p>';
            response_footer();
            exit;
        }
        include_once 'Damblan/Trackback.php';
        // Generate trackback list
        $trackbacks = Damblan_Trackback::listTrackbacks($dbh, $name, !$trackbackIsAdmin);
        echo '<p>This page provides a list of trackbacks, which have been received to this package. A trackback is usually generated,
when a weblog entry is created, which is related to the package. If you want to learn more about trackbacks, please take a look at
what <a href="http://en.wikipedia.org/wiki/Trackback">Wikipedia writes about trackbacks</a>.</p>
<p>If you like to disable the trackbacks for this package, click here:
<p><a href="/package/' . $pkg['name'] . '/trackbacks/?allowtrackbacks=2">Disable trackbacks</a></p>';
        echo '<p>The trackback URL for this package is: <a href="' . $trackback_uri . '">' . $trackback_uri . '</a>';
        if ($trackbackIsAdmin) {
            echo '<div class="explain">You may manipulate the trackbacks of this package. In contrast to normal users, you see approved and pending trackbacks, while normal users only see the approved ones.</div>';
        }
        if (count($trackbacks) == 0) {
            echo '<p>Sorry, there are no trackbacks for this package, yet.</p>';
        }
        echo '<table border="0" cellspacing="0" cellpadding="2" style="width: 100%">';
        foreach ($trackbacks as $trackback) {
            echo '<tr>';
示例#2
0
   +----------------------------------------------------------------------+
   $Id$
*/
auth_require('pear.dev');
$action = isset($_GET['action']) && !empty($_GET['action']) ? $_GET['action'] : false;
$track_id = isset($_GET['id']) && !empty($_GET['id']) ? $_GET['id'] : false;
$timestamp = isset($_GET['timestamp']) && !empty($_GET['timestamp']) ? $_GET['timestamp'] : false;
if (!$action || !$track_id || !$timestamp) {
    response_header('Trackback admin', null, null);
    report_error('Missing arguments. Exiting.');
    response_footer();
    exit;
}
include_once 'Damblan/Trackback.php';
include_once 'Damblan/Mailer.php';
$trackback = new Damblan_Trackback(array('id' => $track_id, 'timestamp' => $timestamp));
$res = $trackback->load($dbh);
$error = false;
if (!$res) {
    $msg = 'No trackback.';
    $error = true;
} elseif (PEAR::isError($res)) {
    $msg = $res->getMessage();
    $error = true;
}
if ($error) {
    response_header('Trackback admin', null, null);
    report_error('Error: ' . $msg);
    response_footer();
    exit;
}
示例#3
0
    // Determine administrative user
    $karma =& new Damblan_Karma($dbh);
    $trackbackIsAdmin = $karma->has($auth_user->handle, 'pear.dev');
} else {
    $trackbackIsAdmin = false;
}
// Prepare pager
$max = Damblan_Trackback::getCount($dbh, !$trackbackIsAdmin, $unapprovedOnly);
if ($max < 1) {
    PEAR::raiseError('Sorry, no trackbacks were found.');
}
$pager_options = array('mode' => 'Sliding', 'perPage' => $number, 'delta' => 5, 'totalItems' => $max, 'urlVar' => 'page', 'curPageSpanPre' => '[ <strong>', 'curPageSpanPost' => '</strong> ]', 'lastPagePre' => '[ <strong>', 'lastPagePost' => '</strong> ]', 'firstPagePre' => '[ <strong>', 'firstPagePost' => '</strong> ]', 'spacesBeforeSeparator' => 2, 'spacesAfterSeparator ' => 2);
$pager = Pager::factory($pager_options);
list($offset, $to) = $pager->getOffsetByPageId();
// Fetch trackbacks
$trackbacks = Damblan_Trackback::recentTrackbacks($dbh, $offset, $number, !$trackbackIsAdmin, $unapprovedOnly);
response_header('Trackback overview');
echo '<p style="text-align: center;">' . $pager->links . '</p>';
if ($trackbackIsAdmin) {
    if (!$unapprovedOnly) {
        echo '<p><a href="/trackback/trackback-overview.php?unapprovedOnly=1">View only not appoved trackbacks.</a></p>';
    } else {
        echo '<p><a href="/trackback/trackback-overview.php">View all trackbacks.</a></p>';
    }
}
// Printing pager.
echo '<table border="0" cellspacing="0" cellpadding="2" style="width: 100%">';
foreach ($trackbacks as $trackback) {
    echo '<tr>';
    echo '<th class="others">';
    echo 'Package:';
示例#4
0
if (!$testid || PEAR::isError($testid)) {
    echo Services_Trackback::getResponseError('No package with ID ' . $id . ' found. Trackback not possible.', 1);
    exit;
}
// Now grab package information
$pkgInfo = package::info($testid);
if (!isset($pkgInfo) || PEAR::isError($pkgInfo)) {
    echo Services_Trackback::getResponseError('No package with ID ' . $id . ' found. Trackback not possible.', 1);
    exit;
}
if ($pkgInfo['blocktrackbacks']) {
    echo Services_Trackback::getResponseError('Package ' . $id . ' does not allow trackbacks.', 1);
    exit;
}
// Creating new trackback
$trackback = new Damblan_Trackback(array('id' => $id, 'timestamp' => time()));
$res = $trackback->receive();
if (PEAR::isError($res)) {
    echo $res->getMessage();
    echo Services_Trackback::getResponseError('The data you submited was invalid, please recheck.', 1);
    exit;
}
if ($trackback->checkRepost($dbh, TRACKBACK_REPOST_COUNT, TRACKBACK_REPOST_TIMESPAN) !== false) {
    echo Services_Trackback::getResponseError('Only ' . TRACKBACK_REPOST_COUNT . ' trackbacks from 1 IP address within ' . TRACKBACK_REPOST_TIMESPAN . ' secs are allowed on this site. Please try again later.', 1);
    exit;
}
$trackback->createSpamCheck('Akismet', $trackback->akismetOptions);
if ($trackback->checkSpam() === true) {
    echo Services_Trackback::getResponseError('Your trackback seems to be spam. If it is not, please contact the webmaster of this site.', 1);
    exit;
}