Exemple #1
0
            $video_info['video_rating_full'] = floor($new_rating);
            $video_info['video_rating_part'] = $new_rating - $video_info['video_rating_full'] == 0 ? 0 : 1;
            $video_info['video_rating_none'] = 5 - $video_info['video_rating_full'] - $video_info['video_rating_part'];
            $video_info['video_rating_total'] = $new_total;
        }
    }
    $response_array = array('allowed_to_rate' => (bool) $allowed_to_rate, 'rating_full' => (int) $video_info['video_rating_full'], 'rating_part' => (int) $video_info['video_rating_part'], 'rating_none' => (int) $video_info['video_rating_none'], 'rating_total' => (int) $video_info['video_rating_total']);
    // OUTPUT JSON
    echo json_encode($response_array);
    exit;
}
// GET USER'S VIDEOS FOR CAROUSEL
$total_videos = $video->video_total("(video_is_converted='1')");
$video_array = $video->video_list(0, $video->video_total(), "video_id DESC", "(video_is_converted='1')", 1);
// GET VIDEO COMMENTS
$comment = new se_comment('video', 'video_id', $video_info['video_id']);
$total_comments = $comment->comment_total();
// UPDATE VIDEO VIEWS
if ($user->user_info['user_id'] != $owner->user_info['user_id']) {
    $video_views_new = $video_info['video_views'] + 1;
    $database->database_query("UPDATE se_videos SET video_views='{$video_views_new}' WHERE video_id='{$video_info['video_id']}' LIMIT 1");
}
// UPDATE NOTIFICATIONS
if ($user->user_info['user_id'] == $owner->user_info['user_id']) {
    $database->database_query("DELETE FROM se_notifys USING se_notifys LEFT JOIN se_notifytypes ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id WHERE se_notifys.notify_user_id='{$owner->user_info['user_id']}' AND se_notifytypes.notifytype_name='videocomment' AND notify_object_id='{$video_info['video_id']}'");
}
// SET GLOBAL PAGE TITLE
$global_page_title[0] = 5500151;
$global_page_title[1] = $owner->user_displayname;
$global_page_title[2] = $video_info['video_title'];
$global_page_description[0] = 5500102;
include "header.php";
if($user->level_info[level_article_allow] == 0) { header("Location: user_home.php"); exit(); }
if(isset($_POST['article_id'])) { $article_id = $_POST['article_id']; } elseif(isset($_GET['article_id'])) { $article_id = $_GET['article_id']; } else { $article_id = 0; }
if(isset($_POST['p'])) { $p = $_POST['p']; } elseif(isset($_GET['p'])) { $p = $_GET['p']; } else { $p = 1; }
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }

// INITIALIZE ARTICLE OBJECT
$article = new rc_article($user->user_info[user_id], $article_id);

if($article->article_exists == 0) { header("Location: user_article.php"); exit(); }
if($article->article_info[article_user_id] != $user->user_info[user_id]) { header("Location: user_article.php"); exit(); }


// CREATE PROFILE COMMENT OBJECT
$comments_per_page = 10;
$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);
Exemple #3
0
// GET ARTICLE CATEGORY
$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]));
        <img src=' . $user->user_photo("./images/nophoto.gif") . ' width="60"/></a></div>
        <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 = "июня";
    $articleowner_info = $database->database_fetch_assoc($database->database_query("SELECT se_users.user_id, se_users.user_username, se_users.user_email, se_usersettings.usersetting_notify_articlecomment FROM se_users LEFT JOIN se_usersettings ON se_users.user_id=se_usersettings.usersetting_user_id WHERE se_users.user_id='".$article->article_info[article_user_id]."'"));
    if($articleowner_info[usersetting_notify_articlecomment] == 1 & $articleowner_info[user_id] != $user->user_info[user_id]) { 
      send_generic($articleowner_info[user_email], "$setting[setting_email_fromname] <$setting[setting_email_fromemail]>", $setting[setting_email_articlecomment_subject], $setting[setting_email_articlecomment_message], Array('[username]', '[commenter]', '[articlename]', '[link]'), Array($articleowner_info[user_username], $commenter, $article->article_info[article_title], "<a href=\"".$url->url_base."article.php?article_id=".$article->article_info[article_id]."\">".$url->url_base."article.php?article_id=".$article->article_info[article_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();
}



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

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

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

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


// GET CUSTOM ARTICLE STYLE IF ALLOWED
if($article->articleowner_level_info[level_article_style] != 0) { 
  $articlestyle_info = $database->database_fetch_assoc($database->database_query("SELECT articlestyle_css FROM se_articlestyles WHERE articlestyle_article_id='".$article->article_info[article_id]."' LIMIT 1")); 
Exemple #6
0
        $ownercol = $object_owner == $col ? $col . "_id" : $col . "_" . $object_owner . "_id";
        if ($object_info[$ownercol] != $object_owner_id) {
            exit;
        }
        $object_info['object_owner_id'] = $object_info[$owner_col];
    }
    // RETRIEVE COMMENT
    $comment_info = $database->database_fetch_assoc($database->database_query("SELECT `{$type}comment_authoruser_id` AS comment_authoruser_id FROM `se_{$type}comments` WHERE `{$type}comment_{$iden}`='{$value}' AND `{$type}comment_id`='{$comment_id}'"));
    // CHECK IF USER IS ALLOWED TO DELETE COMMENT
    $functionname = $object_owner . "_privacy_max";
    $privacy_max = $object_owner_class->{$functionname}($user);
    if (!($privacy_max & $object_owner_class->{"moderation_privacy"}) && $user->user_info['user_id'] != $comment_info['comment_authoruser_id']) {
        exit;
    }
    // START COMMENT OBJECT
    $comment = new se_comment($type, $iden, $value, $tab, $col);
    // DELETE COMMENT
    $comment->comment_delete($comment_id);
    // RUN JAVASCRIPT FUNCTION (JSON)
    echo json_encode(array('is_error' => FALSE));
    exit;
} elseif ($task == "tag_do") {
    // GET COMMENT TYPE, ETC
    $type = isset($_POST['type']) ? $_POST['type'] : NULL;
    $media_id = isset($_POST['media_id']) ? $_POST['media_id'] : NULL;
    $media_dir = isset($_POST['media_dir']) ? $_POST['media_dir'] : NULL;
    $object_owner = isset($_POST['object_owner']) ? $_POST['object_owner'] : NULL;
    $object_owner_id = isset($_POST['object_owner_id']) ? $_POST['object_owner_id'] : NULL;
    if (!$media_id || !$media_dir) {
        exit;
    }