コード例 #1
0
ファイル: go.php プロジェクト: brainsqueezer/fffff
 case 'comments':
     $url = get_user_uri($current_user->user_login, 'conversation');
     do_redirection($url);
     exit(0);
 case 'friends':
     $url = get_user_uri($current_user->user_login, 'friends_new');
     do_redirection($url);
     exit(0);
 case 'post':
     $url = 'http://' . get_server_name() . post_get_base_url($id);
     do_redirection($url);
     exit(0);
 case 'comment':
     $c = new Comment();
     $c->id = $id;
     $url = 'http://' . get_server_name() . $c->get_relative_individual_permalink();
     do_redirection($url);
     exit(0);
 default:
     $l = Link::from_db($id, null, false);
     if (!$l) {
         exit(0);
     }
     if (!$globals['mobile'] && !$globals['mobile_version'] && $current_user->user_id > 0 && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
         if ($globals['base_bar_url']) {
             $url = $globals['base_url'] . $globals['base_bar_url'] . $id;
         } else {
             $url = $globals['base_url'] . "bar.php?id={$id}";
         }
         do_redirection($url, 307);
     } else {
コード例 #2
0
ファイル: go.php プロジェクト: GallardoAlba/Meneame
 case 'comments':
     $url = get_user_uri($current_user->user_login, 'conversation');
     do_redirection($url);
     exit(0);
 case 'friends':
     $url = get_user_uri($current_user->user_login, 'friends_new');
     do_redirection($url);
     exit(0);
 case 'post':
     $url = $globals['scheme'] . '//' . get_server_name() . post_get_base_url($id);
     do_redirection($url);
     exit(0);
 case 'comment':
     $c = new Comment();
     $c->id = $id;
     $url = $globals['scheme'] . '//' . get_server_name() . $c->get_relative_individual_permalink();
     do_redirection($url);
     exit(0);
 default:
     $l = Link::from_db($id, null, false);
     if (!$l) {
         exit(0);
     }
     if (!$globals['mobile'] && !$globals['mobile_version'] && !empty($l->url) && $current_user->user_id > 0 && (empty($globals['https']) || preg_match('/^https:/', $l->url)) && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
         $url = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'b/' . $id;
         // we use always http to load no https pages
         do_redirection($url, 307);
     } else {
         if (empty($l->url)) {
             $url = $l->get_permalink();
         } else {
コード例 #3
0
ファイル: comment.php プロジェクト: brainsqueezer/fffff
include 'config.php';
include mnminclude . 'html1.php';
$page_size = $globals['page_size'] * 3;
$comment = new Comment();
if (!isset($_REQUEST['id']) && $globals['base_comment_url'] && $_SERVER['PATH_INFO']) {
    $url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
    array_shift($url_args);
    // The first element is always a "/"
    $comment->id = intval($url_args[0]);
} else {
    $url_args = preg_split('/\\/+/', $_REQUEST['id']);
    $comment->id = intval($url_args[0]);
    if ($comment->id > 0 && $globals['base_comment_url']) {
        // Redirect to the right URL if the link has a "semantic" uri
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: ' . $comment->get_relative_individual_permalink());
        die;
    }
}
if (!$comment->read()) {
    do_error(_('comentario no encontrado'), 404);
}
$link = Link::from_db($comment->link, null, false);
if ($link->is_discarded()) {
    $globals['ads'] = false;
    $globals['noindex'] = true;
}
$globals['link'] = $link;
$globals['permalink'] = 'http://' . get_server_name() . $comment->get_relative_individual_permalink();
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
コード例 #4
0
ファイル: html1.php プロジェクト: brainsqueezer/fffff
function do_best_comments()
{
    global $db, $globals, $dblang;
    if ($globals['mobile']) {
        return;
    }
    $foo = new Comment();
    $output = '';
    $key = 'best_comments_' . $globals['css_main'];
    if (memcache_mprint($key)) {
        return;
    }
    $min_date = date("Y-m-d H:i:00", $globals['now'] - 43000);
    // about 12 hours
    $link_min_date = date("Y-m-d H:i:00", $globals['now'] - 86400);
    // 24 hours
    $now = intval($globals['now'] / 60) * 60;
    // The order is not exactly the comment_karma
    // but a time-decreasing function applied to the number of votes
    $res = $db->get_results("select comment_id, comment_order, user_id, user_login, user_avatar, link_id, link_uri, link_title, link_comments, comment_karma*(1-({$now}-unix_timestamp(comment_date))*0.7/43000) as value, link_negatives/link_votes as rel from comments, links, users  where link_date > '{$link_min_date}' and comment_date > '{$min_date}' and link_negatives/link_votes < 0.5  and comment_karma > 50 and comment_link_id = link_id and comment_user_id = user_id order by value desc limit 12");
    if ($res) {
        $output .= '<div class="sidebox"><div class="header"><h4><a href="' . $globals['base_url'] . 'topcomments.php">' . _('mejores comentarios') . '</a></h4></div><div class="comments"><ul>' . "\n";
        foreach ($res as $comment) {
            $foo->id = $comment->comment_id;
            $link = $foo->get_relative_individual_permalink();
            $output .= '<li><img src="' . get_avatar_url($comment->user_id, $comment->user_avatar, 20) . '" alt="" width="20" height="20" class="avatar"/>';
            $output .= '<p><strong>' . $comment->user_login . '</strong> ' . _('en') . ' <a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $comment->comment_id . '\', 10000);" href="' . $link . '">' . $comment->link_title . '</a></p></li>' . "\n";
        }
        $output .= '</ul></div></div>';
        echo $output;
        memcache_madd($key, $output, 300);
    }
}
コード例 #5
0
ファイル: html1.php プロジェクト: manelio/woolr
function do_best_comments()
{
    global $db, $globals, $dblang;
    if ($globals['mobile'] || $globals['bot']) {
        return;
    }
    $foo = new Comment();
    $output = '';
    $key = 'best_comments_' . $globals['site_shortname'] . $globals['v'];
    if (memcache_mprint($key)) {
        return;
    }
    echo '<!-- Calculating ' . __FUNCTION__ . ' -->';
    $min_date = date("Y-m-d H:i:00", $globals['now'] - 50000);
    // about 12 hours
    $link_min_date = date("Y-m-d H:i:00", $globals['now'] - 86400 * 2);
    // 48 hours
    $now = intval($globals['now'] / 60) * 60;
    // The order is not exactly the comment_karma
    // but a time-decreasing function applied to the number of votes
    $res = $db->get_results("select comment_id, comment_order, user_id, user_login, user_avatar, link_id, link_uri, link_title, link_comments, comment_karma*(1-({$now}-unix_timestamp(comment_date))*0.7/43000) as value, link_negatives/link_votes as rel from comments, links, users, sub_statuses where id = " . SitesMgr::my_id() . " AND status in ('published', 'queued') AND link_id = link AND date > '{$link_min_date}' and comment_date > '{$min_date}' and LENGTH(comment_content) > 32 and link_negatives/link_votes < 0.5  and comment_karma > 50 and comment_link_id = link and comment_user_id = user_id and user_level != 'disabled' order by value desc limit 10");
    if ($res) {
        $objects = array();
        $title = _('mejores comentarios');
        $url = $globals['base_url'] . 'top_comments';
        foreach ($res as $comment) {
            $obj = new stdClass();
            $obj->id = $foo->id = $comment->comment_id;
            $obj->link = $foo->get_relative_individual_permalink();
            $obj->user_id = $comment->user_id;
            $obj->avatar = $comment->user_avatar;
            $obj->title = $comment->link_title;
            $obj->username = $comment->user_login;
            $obj->tooltip = 'c';
            $objects[] = $obj;
        }
        $vars = compact('objects', 'title', 'url');
        $output = Haanga::Load('best_comments_posts.html', $vars, true);
        echo $output;
        memcache_madd($key, $output, 300);
    }
}
コード例 #6
0
ファイル: comment.php プロジェクト: manelio/woolr
//do_subheader(_('comentario de') . ' ' . $username);
/*** SIDEBAR ****/
echo '<div id="sidebar">';
do_banner_right();
//do_best_stories();
do_best_comments();
do_banner_promotions();
echo '</div>' . "\n";
/*** END SIDEBAR ***/
echo '<div id="newswrap"><!-- comment.php -->' . "\n";
echo '<h3 style="text-shadow: 0 1px #ccc"><a href="' . $link->get_permalink() . '">' . $link->title . '</a></h3>';
echo '<ol class="comments-list">';
echo '<li>';
$comment->print_summary($link, 0, false);
echo '<div style="text-align:right">';
$vars = array('link' => 'http://' . get_server_name() . $comment->get_relative_individual_permalink(), 'title' => $title);
Haanga::Load('share.html', $vars);
echo '</div>';
echo "</li>\n";
echo "</ol>\n";
print_answers($comment->id, 1);
Comment::print_form($link, 8);
echo '</div>';
// Show the error if the comment couldn't be inserted
if (!empty($new_comment_error)) {
    add_javascript('mDialog.notify("' . _('Aviso') . ": {$new_comment_error}" . '", 5);');
}
do_footer();
exit(0);
function print_answers($id, $level, $visited = false)
{
コード例 #7
0
ファイル: comment.php プロジェクト: brainsqueezer/fffff
include mnminclude . 'html1.php';
$globals['ads'] = true;
$page_size = 50;
$comment = new Comment();
if (!isset($_REQUEST['id']) && $globals['base_comment_url'] && $_SERVER['PATH_INFO']) {
    $url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
    array_shift($url_args);
    // The first element is always a "/"
    $comment->id = intval($url_args[0]);
} else {
    $url_args = preg_split('/\\/+/', $_REQUEST['id']);
    $comment->id = intval($url_args[0]);
    if ($comment->id > 0 && $globals['base_comment_url']) {
        // Redirect to the right URL if the link has a "semantic" uri
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: ' . $comment->get_relative_individual_permalink());
        die;
    }
}
if (!$comment->read()) {
    do_error(_('comentario no encontrado'), 404);
}
$link = new Link();
$link->id = $comment->link;
$link->read();
$globals['link'] = $link;
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
    $globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']);
}
// Check for comment post