当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::read方法代码示例

本文整理汇总了PHP中Comment::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::read方法的具体用法?PHP Comment::read怎么用?PHP Comment::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDeleteOtherUserComment

 /**
  * testDeleteOtherUserComment
  *
  */
 public function testDeleteOtherUserComment()
 {
     $this->goIntoLoginStatus('Comments');
     $result = $this->testAction('/comments/delete/4?return_url=/sashimi', array('method' => 'POST', 'return' => 'contents'));
     $this->assertContains('/sashimi', $this->headers['Location']);
     App::uses('Comment', 'Model');
     $comment = new Comment();
     $comment->useDbConfig = 'test';
     $comment->recursive = -1;
     $rec = $comment->read(null, 4);
     $this->assertTrue(is_array($rec) && $rec["Comment"]["content"] === "てすと4");
 }
开发者ID:attakei,项目名称:open-slideshare,代码行数:16,代码来源:CommentsControllerTest.php

示例2: insert_comment

function insert_comment()
{
    global $commentownerid, $link, $db, $current_user;
    // Check if is a POST of a comment
    if ($_POST['link_id'] == $link->id && $current_user->authenticated && $_POST['user_id'] == $current_user->user_id && $_POST['randkey'] > 0 && strlen($_POST['comment_content']) > 0) {
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        $comment->id = $link->commentid;
        $comment->read();
        $comment->link = $link->id;
        $comment->randkey = $_POST['randkey'];
        $comment->author = $commentownerid;
        //$_POST['user_id'];
        $comment->content = $_POST['comment_content'];
        $comment->store();
        header('Location: ' . getmyurl('story', $_GET['id']));
        die;
    }
}
开发者ID:holsinger,项目名称:openfloor,代码行数:19,代码来源:edit.php

示例3: Comment

// 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".
if (!defined('mnmpath')) {
    include '../config.php';
    include mnminclude . 'html1.php';
    include mnminclude . 'link.php';
    require_once mnminclude . 'comment.php';
}
if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
    $comment = new Comment();
    $comment->id = intval($_REQUEST['id']);
    if (!$comment->read()) {
        die;
    }
} else {
    header('Location: http://' . get_server_name() . $globals['base_url']);
    die;
}
$link = new Link();
$link->id = $comment->link;
if (!$link->read()) {
    header('Location: http://' . get_server_name() . $globals['base_url']);
    die;
}
//$globals['link']=$link;
//$globals['link_id']=$link->id;
if ($_POST['process'] == 'editcomment') {
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment_edit.php

示例4: insert_comment

function insert_comment()
{
    global $commentownerid, $link, $db, $current_user;
    // Check if is a POST of a comment
    if (sanitize($_POST['link_id'], 3) == $link->id && $current_user->authenticated && sanitize($_POST['user_id'], 3) == $current_user->user_id && is_numeric(sanitize($_POST['randkey'], 3)) && sanitize($_POST['randkey'], 3) > 0 && sanitize($_POST['comment_content'], 4) != '') {
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        $comment->id = $link->commentid;
        $comment->read();
        $comment->link = $link->id;
        $comment->randkey = sanitize($_POST['randkey'], 3);
        $comment->author = $commentownerid;
        $comment->content = sanitize($_POST['comment_content'], 4);
        $comment->store();
        header('Location: ' . getmyurl('story', sanitize($_POST['link_id'], 3)));
        die;
    }
}
开发者ID:pantofla,项目名称:waterfan,代码行数:18,代码来源:edit.php

示例5: intval

// 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".

if (! defined('mnmpath')) {
	include('../config.php');
	include(mnminclude.'html1.php');
	include(mnminclude.'link.php');
	require_once(mnminclude.'comment.php');
} 


if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
	$comment = new Comment;
	$comment->id = intval($_REQUEST['id']);
	if (! $comment->read()) die;
} else {
	header('Location: http://'.get_server_name().$globals['base_url']);
	die;
}

$link = new Link;
$link->id = $comment->link;
if (! $link->read() ) {
	header('Location: http://'.get_server_name().$globals['base_url']);
	die;
}

//$globals['link']=$link;
//$globals['link_id']=$link->id;
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:30,代码来源:comment_edit.php

示例6: do_shaken_comments

function do_shaken_comments()
{
    global $db, $rows, $user, $offset, $page_size, $globals;
    do_user_subheader(array($user->username => get_user_uri($user->username, 'commented'), _('conversación') . $globals['extra_comment_conversation'] => get_user_uri($user->username, 'conversation'), _('votados') => get_user_uri($user->username, 'shaken_comments'), _('favoritos') => get_user_uri($user->username, 'favorite_comments')), 2);
    $comment = new Comment();
    $rows = -1;
    $db->get_var("SELECT count(*) FROM votes, comments WHERE vote_type='comments' and vote_user_id={$user->id} and comment_id = vote_link_id and comment_user_id != vote_user_id");
    $comments = $db->get_results("SELECT vote_link_id as id, vote_value as value FROM votes, comments WHERE vote_type='comments' and vote_user_id={$user->id}  and comment_id = vote_link_id and comment_user_id != vote_user_id ORDER BY vote_date DESC LIMIT {$offset},{$page_size}");
    if ($comments) {
        echo '<ol class="comments-list">';
        foreach ($comments as $c) {
            $comment->id = $c->id;
            if ($c->value > 0) {
                $color = '#00d';
            } else {
                $color = '#f00';
            }
            $comment->read();
            if ($comment->author != $user->id && !$comment->admin) {
                echo '<li>';
                $comment->print_summary(false, 1000, false);
                echo '<div class="box" style="margin:0 0 -16px 0;background:' . $color . ';position:relative;top:-34px;left:30px;width:30px;height:16px;border-color:' . $color . ';opacity: 0.5"></div>';
                echo '</li>';
            }
        }
        echo "</ol>\n";
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:28,代码来源:user.php

示例7: print_comment_list

function print_comment_list($comments, $user) {
	global $globals, $current_user;

	$link = new Link;
	$comment = new Comment;

	foreach ($comments as $dbcomment) {
		if ($dbcomment->comment_type == 'admin' && ! $current_user->admin) continue;
		$link->id=$dbcomment->link_id;
		$comment->id = $dbcomment->comment_id;
		if ($last_link != $link->id) {
			$link->read();
			echo '<h4>';
			echo '<a href="'.$link->get_permalink().'">'. $link->title. '</a>';
			echo ' ['.$link->comments.']';
			echo '</h4>';
			$last_link = $link->id;
		}
		$comment->read();
		echo '<ol class="comments-list">';
		echo '<li>';
		$comment->print_summary($link, 2000, false);
		echo '</li>';
		echo "</ol>\n";
	}
}
开发者ID:rasomu,项目名称:chuza,代码行数:26,代码来源:user.php

示例8: insert_comment

function insert_comment()
{
    global $commentownerid, $link, $db, $current_user, $main_smarty, $the_template;
    check_actions('story_edit_comment', $vars);
    // Check if is a POST of a comment
    if (sanitize($_POST['link_id'], 3) == $link->id && $current_user->authenticated && sanitize($_POST['user_id'], 3) == $current_user->user_id && is_numeric(sanitize($_POST['randkey'], 3)) && sanitize($_POST['randkey'], 3) > 0 && sanitize($_POST['comment_content'], 4) != '') {
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        $comment->id = $link->commentid;
        $comment->read();
        $comment->link = $link->id;
        $comment->randkey = sanitize($_POST['randkey'], 3);
        $comment->author = $commentownerid;
        $comment->content = sanitize($_POST['comment_content'], 4);
        if (strlen($comment->content) > maxCommentLength) {
            $main_smarty->assign('url', $_SERVER['REQUEST_URI']);
            $main_smarty->assign('tpl_center', $the_template . '/comment_errors');
            $main_smarty->display($the_template . '/pligg.tpl');
            exit;
        }
        $vars['comment'] = $comment->id;
        $vars = array('comment' => &$comment);
        check_actions('after_comment_edit', $vars);
        if ($vars['comment']->status) {
            $comment->status = $vars['comment']->status;
        }
        $comment->store();
        header('Location: ' . getmyurl('story', sanitize($_POST['link_id'], 3)));
        die;
    }
}
开发者ID:bendroid,项目名称:pligg-cms,代码行数:31,代码来源:edit.php

示例9: do_commented

function do_commented()
{
    global $db, $rows, $user, $offset, $page_size;
    $link = new Link();
    $comment = new Comment();
    echo '<h2>' . _('comentarios') . '</h2><br />';
    $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}");
    $comments = $db->get_results("SELECT comment_id, link_id FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}");
    if ($comments) {
        foreach ($comments as $dbcomment) {
            $link->id = $dbcomment->link_id;
            $comment->id = $dbcomment->comment_id;
            if ($last_link != $link->id) {
                $link->read();
                echo '<h4>';
                echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>';
                echo ' [' . $link->comments . ']';
                echo '</h4>';
                $last_link = $link->id;
            }
            $comment->read();
            echo '<ol class="comments-list">';
            $comment->print_summary($link, 2000, false);
            echo "</ol>\n";
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:27,代码来源:user.php

示例10: get_comments

function get_comments()
{
    global $db, $main_smarty, $current_user, $CommentOrder, $link;
    //Set comment order to 1 if it's not set in the config.php
    if (!isset($CommentOrder)) {
        $CommentOrder = 1;
    }
    if ($CommentOrder == 1) {
        $CommentOrderBy = "comment_votes DESC, comment_date DESC";
    }
    if ($CommentOrder == 2) {
        $CommentOrderBy = "comment_date DESC";
    }
    if ($CommentOrder == 3) {
        $CommentOrderBy = "comment_votes DESC, comment_date ASC";
    }
    if ($CommentOrder == 4) {
        $CommentOrderBy = "comment_date ASC";
    }
    $comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy);
    if ($comments) {
        echo '<ul id="comments-list">';
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        foreach ($comments as $comment_id) {
            $comment->id = $comment_id;
            $comment->read();
            $comment->print_summary($link);
            $comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent={$comment_id} ORDER BY " . $CommentOrderBy);
            if ($comments2) {
                echo '<ul id="comments-list">';
                require_once mnminclude . 'comment.php';
                $comment2 = new Comment();
                foreach ($comments2 as $comment_id) {
                    $comment2->id = $comment_id;
                    $comment2->read();
                    $comment2->print_summary($link);
                }
                echo "</ul>\n";
            }
        }
        echo "</ul>\n";
    }
}
开发者ID:holsinger,项目名称:openfloor,代码行数:44,代码来源:story.php

示例11: get_comments

function get_comments($fetch = false)
{
    global $db, $main_smarty, $current_user, $CommentOrder, $link, $cached_comments;
    //Set comment order to 1 if it's not set in the admin panel
    if (!isset($CommentOrder)) {
        $CommentOrder = 1;
    }
    if ($CommentOrder == 1) {
        $CommentOrderBy = "comment_votes DESC, comment_date DESC";
    }
    if ($CommentOrder == 2) {
        $CommentOrderBy = "comment_date DESC";
    }
    if ($CommentOrder == 3) {
        $CommentOrderBy = "comment_votes DESC, comment_date ASC";
    }
    if ($CommentOrder == 4) {
        $CommentOrderBy = "comment_date ASC";
    }
    $output = '';
    if (checklevel('god') || checklevel('admin')) {
        $status_sql = " OR comment_status='moderated'";
    }
    // get all parent comments
    $comments = $db->get_results("SELECT * FROM " . table_comments . " WHERE (comment_status='published' {$status_sql}) AND comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy);
    if ($comments) {
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        foreach ($comments as $dbcomment) {
            $comment->id = $dbcomment->comment_id;
            $cached_comments[$dbcomment->comment_id] = $dbcomment;
            $comment->read();
            $output .= $comment->print_summary($link, true);
            // get all child comments
            $comments2 = $db->get_results("SELECT * FROM " . table_comments . " WHERE (comment_status='published' {$status_sql}) AND comment_parent={$dbcomment->comment_id} ORDER BY " . $CommentOrderBy);
            if ($comments2) {
                $output .= '<div class="child-comment">';
                require_once mnminclude . 'comment.php';
                $comment2 = new Comment();
                foreach ($comments2 as $dbcomment2) {
                    $comment2->id = $dbcomment2->comment_id;
                    $cached_comments[$dbcomment2->comment_id] = $dbcomment2;
                    $comment2->read();
                    $output .= $comment2->print_summary($link, true);
                }
                $output .= "</div>\n";
            }
        }
        if ($fetch == false) {
            echo $output;
        } else {
            return $output;
        }
    }
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:55,代码来源:story.php

示例12: Comment

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, 10000, true);
echo "</li>\n";
echo "</ol>\n";
// Print answers to the comment
$sql = "SELECT conversation_from as comment_id FROM conversations, comments WHERE conversation_type='comment' and conversation_to = {$comment->id} and comment_id = conversation_from ORDER BY conversation_from asc LIMIT {$page_size}";
$answers = $db->get_results($sql);
if ($answers) {
    $answer = new Comment();
    echo '<div style="padding-left: 40px; padding-top: 10px">' . "\n";
    echo '<ol class="comments-list">';
    foreach ($answers as $dbanswer) {
        $answer->id = $dbanswer->comment_id;
        $answer->read();
        echo '<li>';
        $answer->print_summary($link);
        echo '</li>';
    }
    echo "</ol>\n";
    echo '</div>' . "\n";
}
Comment::print_form($link, 8);
echo '</div>';
// Show the error if the comment couldn't be inserted
if (!empty($new_comment_error)) {
    echo '<script type="text/javascript">';
    echo '$(function(){alert(\'' . _('Aviso') . ": {$new_comment_error}" . '\')});';
    echo '</script>';
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment.php

示例13: do_commented

function do_commented()
{
    global $db, $rows, $user, $offset, $page_size, $globals, $current_user;
    if ($globals['bot']) {
        return;
    }
    $link = new Link();
    $comment = new Comment();
    $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}");
    $comments = $db->get_results("SELECT comment_id, link_id, comment_type FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}");
    if ($comments) {
        echo '<div class="bookmarks-export-user-stories">';
        echo '<a href="' . $globals['base_url'] . 'link_bookmark.php?user_id=' . $user->id . '&amp;option=commented" title="' . _('exportar bookmarks en formato Mozilla') . '" class="bookmarks-export-user-commented"><img src="' . $globals['base_url'] . 'img/common/bookmarks-export-01.png" alt="Mozilla bookmark"/></a>';
        echo '&nbsp;&nbsp;<a href="' . $globals['base_url'] . 'comments_rss2.php?user_id=' . $user->id . '" title="' . _('obtener comentarios en rss2') . '"><img src="' . $globals['base_url'] . 'img/common/rss-button01.png" alt="rss2"/></a>';
        echo '</div>';
        foreach ($comments as $dbcomment) {
            if ($dbcomment->comment_type == 'admin' && $current_user->user_level != 'god' && $current_user->user_level != 'admin') {
                continue;
            }
            $link->id = $dbcomment->link_id;
            $comment->id = $dbcomment->comment_id;
            if ($last_link != $link->id) {
                $link->read();
                echo '<h4>';
                echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>';
                echo ' [' . $link->comments . ']';
                echo '</h4>';
                $last_link = $link->id;
            }
            $comment->read();
            echo '<ol class="comments-list">';
            $comment->print_summary($link, 2000, false);
            echo "</ol>\n";
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:36,代码来源:user.php

示例14: Comment

             $trackback->id = $trackback_id;
             $trackback->read();
             echo '<li class="tab-trackback-entry"><a href="' . $trackback->url . '" rel="nofollow">' . $trackback->title . '</a> [' . preg_replace('/https*:\\/\\/([^\\/]+).*/', "\$1", $trackback->url) . ']</li>' . "\n";
         }
         echo '</ul>';
         echo '</fieldset>';
     }
 }
 $comments = $db->get_col("SELECT comment_id FROM comments WHERE comment_link_id={$link->id} ORDER BY {$order_field} {$limit}");
 if ($comments) {
     echo '<ol class="comments-list">';
     require_once mnminclude . 'comment.php';
     $comment = new Comment();
     foreach ($comments as $comment_id) {
         $comment->id = $comment_id;
         $comment->read();
         $comment->print_summary($link, 700, true);
         echo "\n";
     }
     echo "</ol>\n";
 }
 if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
     // Comments already closed
     if ($tab_option == 1) {
         do_comment_pages($link->comments, $current_page);
     }
     echo '<div class="commentform warn">' . "\n";
     echo _('comentarios cerrados') . "\n";
     echo '</div>' . "\n";
 } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] || $current_user->user_id == $link->author)) {
     // User can comment
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:story.php

示例15: get_comments

function get_comments($fetch = false)
{
    global $db, $main_smarty, $current_user, $CommentOrder, $link;
    //Set comment order to 1 if it's not set in the admin panel
    if (!isset($CommentOrder)) {
        $CommentOrder = 1;
    }
    if ($CommentOrder == 1) {
        $CommentOrderBy = "comment_votes DESC, comment_date DESC";
    }
    if ($CommentOrder == 2) {
        $CommentOrderBy = "comment_date DESC";
    }
    if ($CommentOrder == 3) {
        $CommentOrderBy = "comment_votes ASC, comment_date DESC";
    }
    if ($CommentOrder == 4) {
        $CommentOrderBy = "comment_date ASC";
    }
    $output = '';
    // get all parent comments
    $comments = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_link_id={$link->id} and comment_parent = 0 ORDER BY " . $CommentOrderBy);
    if ($comments) {
        require_once mnminclude . 'comment.php';
        $comment = new Comment();
        foreach ($comments as $comment_id) {
            $comment->id = $comment_id;
            $comment->read();
            $output .= $comment->print_summary($link, true);
            // get all child comments
            $comments2 = $db->get_col("SELECT comment_id FROM " . table_comments . " WHERE comment_parent={$comment_id} ORDER BY " . $CommentOrderBy);
            if ($comments2) {
                $output .= '<div style="margin-left:40px">';
                require_once mnminclude . 'comment.php';
                $comment2 = new Comment();
                foreach ($comments2 as $comment_id) {
                    $comment2->id = $comment_id;
                    $comment2->read();
                    $output .= $comment2->print_summary($link, true);
                }
                $output .= "</div>\n";
            }
        }
        if ($fetch == false) {
            echo $output;
        } else {
            return $output;
        }
    }
}
开发者ID:bendroid,项目名称:pligg-cms,代码行数:50,代码来源:story.php


注:本文中的Comment::read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。