Esempio n. 1
0
include '../config.php';
// Free connections fast
ini_set('default_socket_timeout', 2);
$db->connect_timeout = 2;
if (!empty($_REQUEST['rows'])) {
    $rows = min(2000, intval($_REQUEST['rows']));
} else {
    $rows = 100;
}
// Compatibility with the old "search" query string
if ($_REQUEST['search']) {
    $_REQUEST['q'] = $_REQUEST['search'];
}
// Sub
if ($_REQUEST['sub']) {
    $sub_id = SitesMgr::get_id(mb_substr($_REQUEST['sub'], 20));
    if ($sub_id) {
        SitesMgr::__init($sub_id);
    } else {
        die;
    }
} else {
    $site_id = SitesMgr::my_id();
}
$site_info = SitesMgr::get_info();
if ($site_info->sub && $site_info->owner > 0) {
    $site_info->name = $site_info->name;
}
if (!empty($_REQUEST['id']) && intval($_REQUEST['id']) > 0) {
    //
    // Comments
Esempio n. 2
0
#! /usr/bin/env php
<?php 
// Check which hostname server we run for, for example: mnm, emnm, etc.
$site_name = $argv[2];
include dirname(__FILE__) . '/../www/config.php';
include mnminclude . 'external_post.php';
$my_id = SitesMgr::get_id($site_name);
if (!$my_id > 0) {
    syslog(LOG_INFO, "Meneame, " . basename(__FILE__) . " site not found {$site_name}");
    echo "No site id found\n";
    die;
}
SitesMgr::__init($my_id);
syslog(LOG_INFO, "Meneame, running " . basename(__FILE__) . " for {$site_name}");
$info = SitesMgr::get_info();
$properties = SitesMgr::get_extended_properties();
if (intval($argv[1]) > 0) {
    $hours = intval($argv[1]);
} else {
    $hours = 1;
}
$key = "post_best_comment_{$my_id}";
$previous = Annotation::get_text($key);
if ($previous) {
    $extra = "AND comment_id not in ({$previous})";
}
$now = intval(time() / 60) * 60;
$coef = 0.8;
$min_karma = $globals['comment_highlight_karma'] * 2;
$min_value = $globals['comment_highlight_karma'];
$min_length = 400;