error_reporting(E_ALL);
include_once dirname(__FILE__) . "/../../../config.inc";
include_once "web/Widgets/Comment/ChannelComment.php";
require_once "web/includes/classes/Pagination.php";
global $paging;
//spliting the path_info to get the id and the channel id.
$param = preg_split("|/|", $path_info);
for ($i = 2; $i < count($param); $i++) {
    list($k, $v) = explode('=', $param[$i]);
    $url_param[$k] = $v;
}
$channel_id = ChannelComment::convert_slug_to_channel_id($url_param['slug']);
$paging_new['count'] = ChannelComment::get_channel_comments($channel_id, NULL, TRUE);
$paging_new['show'] = 5;
$paging_new['page'] = $paging['page'];
$comments = ChannelComment::get_channel_comments($channel_id, NULL, FALSE, $paging_new['show'], $paging_new['page']);
$paging_new['extra'] = "onclick='javascript:ajax_pagination(this,{$channel_id});return false;'";
//setting pagination
$Pagination = new Pagination();
$Pagination->setPaging($paging_new);
$page_links = $Pagination->getPageLinks();
$template_file = 'web/Widgets/' . $widget_name . '/widget.tpl';
$template = new Template($template_file);
$template->set('url_param', $url_param);
$template->set('login_uid', PA::$login_uid);
$template->set('comments', $comments);
$template->set('channel_id', $channel_id);
$template->set('comments_count', $paging_new['count']);
$template->set('page_links', $page_links);
$html .= $template->fetch();
header("Content-Type: application/x-javascript");
error_reporting(E_ALL);
$login_required = FALSE;
//error_reporting(E_ALL);
$use_theme = 'Beta';
include_once "web/includes/page.php";
include_once "web/includes/image_resize.php";
include_once "api/User/User.php";
include_once "web/Widgets/Comment/ChannelComment.php";
if (!empty($_POST)) {
    if (!empty($_POST['uid'])) {
        $msg = NULL;
        if (empty($_POST['comment'])) {
            $msg = __('Comment can not be empty');
        }
        if (empty($msg)) {
            $obj = new ChannelComment();
            $obj->user_id = $_POST['uid'];
            $obj->comment = $_POST['comment'];
            $obj->slug = $_POST['slug'];
            $obj->channel_id = $_POST['c_id'];
            $obj->is_active = 1;
            $obj->save();
            //if the comment is posted then need to print the new set of comments.
            $channel_id = ChannelComment::convert_slug_to_channel_id($_POST['slug']);
            $new_comments = ChannelComment::get_channel_comments($channel_id, NULL, FALSE, 5, 1);
            $cnt = count($new_comments);
            $result = NULL;
            if ($cnt > 0) {
                $i = 1;
                $result .= '<div class="mheader_t"><span class="mh1 blue">' . $cnt . '</span></div><br><br><ul>';
                foreach ($new_comments as $comment) {
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author [creator, or "Original Author"]
* @license http://bit.ly/aVWqRV PayAsYouGo License
* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
error_reporting(E_ALL);
$login_required = FALSE;
include_once "web/includes/page.php";
include_once "web/Widgets/Comment/ChannelComment.php";
require_once "web/includes/classes/Pagination.php";
global $paging;
$paging_new['count'] = ChannelComment::get_channel_comments($_POST['cid'], NULL, TRUE);
$paging_new['show'] = 5;
$paging_new['page'] = $_POST['page'];
$comments = ChannelComment::get_channel_comments($_POST['cid'], NULL, FALSE, $paging_new['show'], $paging_new['page']);
$cid = $_POST['cid'];
$paging_new['extra'] = "onclick='javascript:ajax_pagination(this,{$cid});return false;'";
//setting pagination
$Pagination = new Pagination();
$Pagination->setPaging($paging_new);
$page_links = $Pagination->getPageLinks();
?>

<div  id="posted_comment">
  <div class="mheader_t">
    <span class="mh1 blue"><?php 
echo $paging_new['count'];
?>
</span>
  </div>