function stats_split_ip_range($start, $end)
{
    $slen = strlen($start);
    $elen = strlen($end);
    $len = $slen < $elen ? $elen : $slen;
    $up = stats_increment($start, $len);
    $ips = array();
    if ($up < $end) {
        $ips += stats_split_ip_range($up, $end);
    } else {
        $up = $end;
    }
    array_push($ips, array($start, $up - 1));
    return $ips;
}
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// The code below was made by Beldar <beldar at gmail dot com>
if (!defined('mnmpath')) {
    include_once '../config.php';
    header('Content-Type: text/html; charset=utf-8');
    stats_increment('ajax');
}
include_once 'pager.php';
global $db, $globals;
if (!isset($globals['link_id']) && !empty($_GET['id'])) {
    $globals['link_id'] = intval($_GET['id']);
}
if (!$globals['link_id'] > 0) {
    die;
}
if (!isset($_GET['p'])) {
    $favorites_page = 1;
} else {
    $favorites_page = intval($_GET['p']);
}
$favorites_page_size = 20;
$favorites_offset = ($favorites_page - 1) * $favorites_page_size;
$favorites_users = $db->get_var("SELECT count(*) FROM favorites WHERE favorite_link_id=" . $globals['link_id']);
示例#3
0
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
$globals['max_load'] = 2;
include '../config.php';
$mnm_over = $globals['base_static'] . "img/mnm/api/mnm-over-01.png";
$mnm_vote = $globals['base_static'] . "img/mnm/api/mnm-vote-01.png";
$mnm_add = $globals['base_static'] . "img/mnm/api/mnm-add-01.png";
if (empty($_GET['url'])) {
    die;
}
header('Content-Type: text/html; charset=UTF-8');
stats_increment('ajax', true);
echo '<html>' . "\n";
echo '<script type="text/javascript" language="Javascript">' . "\n";
echo '   mnm_yesover = new Image;' . "\n";
echo '   mnm_vote_notover = new Image;' . "\n";
echo '   mnm_add_notover = new Image;' . "\n";
echo '   mnm_yesover.src = "' . $mnm_over . '";' . "\n";
echo '   mnm_vote_notover.src = "' . $mnm_vote . '";' . "\n";
echo '   mnm_add_notover.src = "' . $mnm_add . '";' . "\n";
echo '   function changebutton(where,what) {' . "\n";
echo '      if (document.images) document.images[where].src = eval(what + ".src");' . "\n";
echo '   }' . "\n";
echo '</script>' . "\n";
echo '<body>' . "\n";
$url = $db->escape($_GET['url']);
$res = $db->get_row("select link_id, link_votes, link_anonymous from links where link_url='{$url}'");
示例#4
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
stats_increment('api', true);
if (!empty($_REQUEST['rows'])) {
    $rows = intval($_REQUEST['rows']);
    if ($rows > 3000) {
        $rows = 3000;
    }
    //avoid abuses
} else {
    $rows = 200;
}
if (!empty($_REQUEST['days']) && intval($_REQUEST['days'] <= 90)) {
    $days = intval($_REQUEST['days']);
} else {
    $days = 7;
}
//$sql = "SELECT link_id, count(*) as votes FROM votes, links WHERE  ";
//$sql .= "vote_type='links' AND vote_date > DATE_SUB(now(), INTERVAL $days DAY) AND ";
//$sql .= "vote_link_id=link_id  AND link_status != 'discard' GROUP BY vote_link_id  ORDER BY votes DESC LIMIT $rows";
$sql = "SELECT link_id, link_url, link_votes, link_anonymous, link_negatives, link_karma from links WHERE link_date > DATE_SUB(now(), INTERVAL {$days} DAY) AND link_status != 'discard' ORDER BY link_karma DESC, link_votes DESC LIMIT {$rows}";
$link = new Link();
$links = $db->get_results($sql);
if ($links) {
示例#5
0
<?php

include_once '../config.php';
include_once mnmpath . '/libs/avatars.php';
stats_increment('image');
if (!$_GET['id'] && !empty($_GET['user'])) {
    $id = (int) $db->get_var("select user_id from users where user_login = '******'user']) . "'");
} else {
    $id = intval($_GET['id']);
}
if (!$id > 0) {
    die;
}
$size = intval($_GET['size']);
if (!$size > 0) {
    $size = 80;
}
if (!($img = avatar_get_from_file($id, $size))) {
    $img = avatar_get_from_db($id, $size);
    if (!$img) {
        if (is_writable($globals['avatars_dir'])) {
            $user = $db->get_row("select user_avatar, user_email from users where user_id={$id}");
            if ($user) {
                header('Location: ' . get_avatar_url($id, $user->user_avatar, $size));
            }
        } else {
            header('Location: ' . get_no_avatar_url($size));
        }
        die;
    }
}
示例#6
0
function do_footer($credits = true)
{
    global $globals;
    if ($credits) {
        @do_credits();
    }
    do_js_from_array($globals['post_js']);
    // warn warn warn
    // dont do stats of password recovering pages
    @(include 'ads/stats.inc');
    // Store as html page load
    stats_increment('html');
    printf("\n<!--Generated in %4.3f seconds-->\n", microtime(true) - $globals['start_time']);
    echo "</body></html>\n";
}
示例#7
0
<?php

include '../config.php';
include mnminclude . 'link.php';
include mnminclude . 'trackback.php';
stats_increment('other');
$remote = $_SERVER["REMOTE_ADDR"];
$local_ips = gethostbynamel($_SERVER["SERVER_NAME"]);
if (!in_array($remote, $local_ips)) {
    syslog(LOG_NOTICE, "Meneame: send_pingback remote address {$_SERVER['REMOTE_ADDR']} is no local address ({$_SERVER['SERVER_ADDR']}).");
    echo "ein? {$_SERVER['REMOTE_ADDR']}\n";
    die;
}
$linkid = (int) $_REQUEST['id'];
if ($linkid <= 0) {
    echo "no id";
    die;
}
$link = new Link();
$link->id = $linkid;
if (!$link->read()) {
    echo "error reading link\n";
    die;
}
preg_match_all('/([\\(\\[:\\.\\s]|^)(https*:\\/\\/[^ \\t\\n\\r\\]\\(\\)\\&]{5,70}[^ \\t\\n\\r\\]\\(\\)]*[^ .\\t,\\n\\r\\(\\)\\"\'\\]\\?])/i', $link->content, $matches);
foreach ($matches[2] as $match) {
    $tb = new Trackback();
    $tb->link = clean_input_url($match);
    $tb->link_id = $link->id;
    $tb->author = $link->author;
    if (!$tb->read()) {
示例#8
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'comment.php';
include mnminclude . 'link.php';
stats_increment('rss', true);
if (!empty($_REQUEST['rows'])) {
    $rows = intval($_REQUEST['rows']);
    if ($rows > 300) {
        $rows = 100;
    }
    //avoid abuses
} else {
    $rows = 100;
}
// Bug in FeedBurner, it needs all items
if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])) {
    $if_modified = 0;
} else {
    $if_modified = get_if_modified();
}
$individual_user = false;
if (!empty($_GET['id'])) {
    //
    // Link comments
示例#9
0
foreach ($events as $key => $val) {
    if ($counter > 0) {
        echo ",";
    }
    echo $val;
    $counter++;
    if ($counter >= $max_items) {
        echo "]);";
        exit;
    }
}
echo "]);";
if (intval($_REQUEST['r']) % 10 == 0) {
    update_sneakers();
}
stats_increment('sneaker');
function check_chat()
{
    global $db, $current_user, $now, $globals, $events;
    if (empty($_POST['chat'])) {
        return;
    }
    $comment = trim(preg_replace("/[\r\n\t]/", ' ', $_REQUEST['chat']));
    if ($current_user->user_id > 0 && strlen($comment) > 2) {
        // Sends a message back if the user has a very low karma
        if ($globals['min_karma_for_sneaker'] > 0 && $current_user->user_karma < $globals['min_karma_for_sneaker']) {
            $comment = _('no tienes suficiente karma para comentar en la fisgona') . ' (' . $current_user->user_karma . ' < ' . $globals['min_karma_for_sneaker'] . ')';
            send_chat_warn($comment);
            return;
        }
        $period = $now - 5;