$comment = new se_comment('article', 'article_id', $article->article_info[article_id]);


// DELETE NECESSARY COMMENTS
$start = ($p - 1) * $comments_per_page;
if($task == "delete") { $comment->comment_delete_selected($start, $comments_per_page); }


// GET TOTAL COMMENTS
$total_comments = $comment->comment_total();

// MAKE COMMENT PAGES
$page_vars = make_page($total_comments, $comments_per_page, $p);

// GET COMMENT ARRAY
$comments = $comment->comment_list($page_vars[0], $comments_per_page);







// ASSIGN VARIABLES AND DISPLAY MODERATE COMMENTS PAGE
$smarty->assign('article', $article);
$smarty->assign('comments', $comments);
$smarty->assign('total_comments', $total_comments);
$smarty->assign('p', $page_vars[1]);
$smarty->assign('maxpage', $page_vars[2]);
$smarty->assign('p_start', $page_vars[0]+1);
$smarty->assign('p_end', $page_vars[0]+count($comments));
Esempio n. 2
0
$article_category = "";
$parent_category = "";
$article_category_query = $database->database_query("SELECT articlecat_id, articlecat_title, articlecat_dependency FROM se_articlecats WHERE articlecat_id='".$rc_article->article_info[article_articlecat_id]."' LIMIT 1");
if($database->database_num_rows($article_category_query) == 1) {
  $article_category_info = $database->database_fetch_assoc($article_category_query);
  $article_category = $article_category_info[articlecat_title];
  if($article_category_info[articlecat_dependency] != 0) {
    $parent_category = $database->database_fetch_assoc($database->database_query("SELECT articlecat_id, articlecat_title FROM se_articlecats WHERE articlecat_id='".$article_category_info[articlecat_dependency]."' LIMIT 1"));
  }
}


// GET ARTICLE COMMENTS
$comment = new se_comment('article', 'article_id', $rc_article->article_info[article_id]);
$total_comments = $comment->comment_total();
$comments = $comment->comment_list(0, 10);



// CHECK IF USER IS ALLOWED TO COMMENT
$allowed_to_comment = 1;
if(!($privacy_max & $rc_article->article_info[article_comments])) { $allowed_to_comment = 0; }

// SHOW FILES IN THIS ALBUM
$articlealbum_info = $database->database_fetch_assoc($database->database_query("SELECT articlealbum_id FROM se_articlealbums WHERE articlealbum_article_id='".$rc_article->article_info[article_id]."' LIMIT 1"));
$total_files = $rc_article->article_media_total($articlealbum_info[articlealbum_id]);
$file_array = $rc_article->article_media_list(0, 5, "RAND()", "(articlemedia_articlealbum_id='$articlealbum_info[articlealbum_id]')");

$rc_article->article_info[article_body] = str_replace("\r\n", "", html_entity_decode($rc_article->article_info[article_body]));

$rc_tag = new rc_articletag();
Esempio n. 3
0
}
// CREATE ALBUM OBJECT
$album = new se_album($owner->user_info['user_id']);
$fotos = $album->album_media_list(0, 4, "media_id DESC", "media_ext = 'jpg' or media_ext = 'jpeg' or media_ext = 'gif' or media_ext = 'png' or media_ext = 'bmp'");
/*echo "<pre>";
print_r($fotos);
echo "</pre>";
die();
*/
// DELETE COMMENT NOTIFICATIONS IF VIEWING COMMENT PAGE
if ($v == "comments" && $user->user_info['user_id'] == $owner->user_info['user_id']) {
    $database->database_query("DELETE FROM se_notifys WHERE notify_user_id='{$owner->user_info['user_id']}' AND notify_notifytype_id='3' AND notify_object_id='{$owner->user_info['user_id']}'");
}
// GET PROFILE COMMENTS
$comment = new se_comment('profile', 'user_id', $owner->user_info['user_id']);
$comments = $comment->comment_list(0, 30);
$total_comments = $comment->comment_total();
foreach ($comments as &$comment) {
    $num_month = date("n", $comment['comment_date']);
    if ($num_month == 1) {
        $month = "января";
    } elseif ($num_month == 2) {
        $month = "февраля";
    } elseif ($num_month == 3) {
        $month = "марта";
    } elseif ($num_month == 4) {
        $month = "апреля";
    } elseif ($num_month == 5) {
        $month = "мая";
    } elseif ($num_month == 6) {
        $month = "июня";
Esempio n. 4
0
        <div class = "comment-level-1">
        <div class="comment-text">
            <a class="link-user" href="/id' . $user->user_info['user_id'] . '">' . $user->user_info['user_displayname'] . '</a><small>' . $comArray['comment_date'] . '</small><br />
            ' . $comArray['comment_body'] . '
        </div>
            <a href="#" class="small-link">Ответить</a>
        </div>
        </div>';
    }
    die;
} elseif ($action == 'get_messages') {
    $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : NULL;
    $start = isset($_POST['start']) ? $_POST['start'] : NULL;
    $limit = isset($_POST['limit']) ? $_POST['limit'] : NULL;
    $comment_model = new se_comment('profile', 'user_id', $user_id);
    $comments = $comment_model->comment_list($start, $limit);
    foreach ($comments as $comment) {
        $num_month = date("n", $comment['comment_date']);
        if ($num_month == 1) {
            $month = "января";
        } elseif ($num_month == 2) {
            $month = "февраля";
        } elseif ($num_month == 3) {
            $month = "марта";
        } elseif ($num_month == 4) {
            $month = "апреля";
        } elseif ($num_month == 5) {
            $month = "мая";
        } elseif ($num_month == 6) {
            $month = "июня";
        } elseif ($num_month == 7) {
Esempio n. 5
0
        $classname = "se_" . $object_owner;
        if (class_exists($classname)) {
            $object_owner_class = new $classname($user->user_info['user_id'], $object_owner_id);
            $object_exists = $object_owner_class->{$object_owner . "_exists"};
        }
    }
    if (!$owner->user_exists && !$object_exists) {
        exit;
    }
    // START COMMENT OBJECT
    $comment = new se_comment($type, $iden, $value, $tab, $col);
    // GET TOTAL COMMENTS
    $total_comments = $comment->comment_total();
    // MAKE COMMENT PAGES AND GET COMMENT ARRAY
    $page_vars = make_page($total_comments, $cpp, $p);
    $comments = $comment->comment_list($page_vars[0], $cpp);
    // CONSTRUCT JSON RESPONSE
    $response_array = array('total_comments' => (int) $total_comments, 'maxpage' => (int) $page_vars[2], 'p_start' => (int) ($page_vars[0] + 1), 'p_end' => (int) ($page_vars[0] + count($comments)), 'p' => (int) $page_vars[1], 'comments' => array());
    foreach ($comments as $comment_index => $comment_data) {
        // Escape trailing backslash
        if (substr($comment_data['comment_body'], -1, 1) == "\\" && substr($comment_data['comment_body'], -2, 2) != "\\\\") {
            $comment_data['comment_body'] .= "\\";
        }
        $response_array['comments'][(int) $comment_data['comment_id']] = array('comment_authoruser_id' => (int) $comment_data['comment_authoruser_id'], 'comment_authoruser_exists' => (bool) $comment_data['comment_author']->user_exists, 'comment_authoruser_private' => (bool) $comment_data['comment_author_private'], 'comment_authoruser_url' => (string) $url->url_create('profile', $comment_data['comment_author']->user_info['user_username']), 'comment_authoruser_photo' => (string) $comment_data['comment_author']->user_photo('./images/nophoto.gif'), 'comment_authoruser_photo_width' => (int) $misc->photo_size($comment_data['comment_author']->user_photo('./images/nophoto.gif'), '75', '75', 'w'), 'comment_authoruser_username' => (string) $comment_data['comment_author']->user_info['user_username'], 'comment_authoruser_displayname' => (string) $comment_data['comment_author']->user_displayname, 'comment_date' => (string) $datetime->cdate("{$setting['setting_dateformat']} {$setting['setting_timeformat']}", $datetime->timezone($comment_data['comment_date'], $global_timezone)), 'comment_body' => (string) $comment_data['comment_body']);
    }
    // OUTPUT JSON
    echo json_encode($response_array);
    exit;
} elseif ($task == "comment_post") {
    // GET COMMENT TYPE, ETC
    $type = isset($_POST['type']) ? $_POST['type'] : NULL;
      send_generic($articleowner_info[user_email], "$setting[setting_email_fromname] <$setting[setting_email_fromemail]>", $setting[setting_email_articlemediacomment_subject], $setting[setting_email_articlemediacomment_message], Array('[username]', '[commenter]', '[articlename]', '[link]'), Array($articleowner_info[user_username], $commenter, $article->article_info[article_title], "<a href=\"".$url->url_base."article_album_file.php?article_id=".$article->article_info[article_id]."&articlemedia_id=$articlemedia_info[articlemedia_id]\">".$url->url_base."article_album_file.php?article_id=".$article->article_info[article_id]."&articlemedia_id=$articlemedia_info[articlemedia_id]</a>")); 
    }
  }

  echo "<html><head><script type=\"text/javascript\">";
  echo "window.parent.addComment('$is_error', '$comment_body', '$comment_date');";
  echo "</script></head><body></body></html>";
  exit();
}



// GET ARTICLE MEDIA COMMENTS
$comment = new se_comment('articlemedia', 'articlemedia_id', $articlemedia_info[articlemedia_id]);
$total_comments = $comment->comment_total();
$comments = $comment->comment_list(0, $total_comments);




// CREATE BACK MENU LINK
$back = $database->database_query("SELECT articlemedia_id FROM se_articlemedia WHERE articlemedia_articlealbum_id='$articlemedia_info[articlemedia_articlealbum_id]' AND articlemedia_id<'$articlemedia_info[articlemedia_id]' ORDER BY articlemedia_id DESC LIMIT 1");
if($database->database_num_rows($back) == 1) {
  $back_info = $database->database_fetch_assoc($back);
  $link_back = $url->base."article_album_file.php?article_id=".$article->article_info[article_id]."&articlemedia_id=$back_info[articlemedia_id]";
} else {
  $link_back = "#";
}

// CREATE FIRST MENU LINK
$first = $database->database_query("SELECT articlemedia_id FROM se_articlemedia WHERE articlemedia_articlealbum_id='$articlemedia_info[articlemedia_articlealbum_id]' ORDER BY articlemedia_id ASC LIMIT 1");