コード例 #1
0
ファイル: post.php プロジェクト: khaledkhalil94/SH.A
					</div>
					<input type="hidden" name="post_id" value="<?php 
echo $id;
?>
" >
					<input type="hidden" name="comment_token" value="<?php 
echo Token::generateToken();
?>
" >
					<button name="comment" id="subcomment" style="display:none;" class="ui blue submit disabled icon button">Submit</button>
				</form>
				<br>
				<div id="comments">
					<?php 
foreach ($comments as $c) {
    $voted = QNA::has_voted($c->id, USER_ID);
    $votes = Comment::get_votes($c->id);
    $votes = $votes > 0 ? '+' . $votes : null;
    $self = $c->uid === USER_ID;
    if ($c->last_modified > $c->created) {
        $edited = "(edited <span id='editedDate' title=\"{$c->created}\">{$c->created}</span>)";
    } else {
        $edited = "";
    }
    $c->path = $c->path ?: DEF_PIC;
    ?>
					<div class="ui minimal comments">
						<div class="ui comment padded segment" id="<?php 
    echo $c->id;
    ?>
" comment-id="<?php 
コード例 #2
0
ファイル: _question.php プロジェクト: khaledkhalil94/SH.A
     if ($insert === true) {
         die(json_encode(['status' => true]));
     } else {
         die(json_encode(['status' => false, 'err' => $database->errors[2]]));
     }
     break;
 case 'downvote':
     $post = new Post();
     $PostID = sanitize_id($data['id']);
     // check if question exists
     $QNA = new QNA($PostID);
     if (!is_object($QNA->get_question()) && !is_array($post->get_post($PostID, true))) {
         die(json_encode(['status' => false, 'err' => 'Question was not found.']));
     }
     // check if user has not upvoted the question
     $voted = QNA::has_voted($PostID, USER_ID);
     if (!$voted) {
         die(json_encode(['status' => false, 'err' => 'You haven\'t upvoted this question.']));
     }
     $remove = QNA::downvote($PostID, USER_ID);
     if ($remove === true) {
         die(json_encode(['status' => true]));
     }
     break;
 case 'publish':
     $PostID = sanitize_id($data['id']);
     $QNA = new QNA($PostID);
     // check if question exists
     $question = $QNA->get_question();
     if (!is_object($question)) {
         die(json_encode(['status' => false, 'err' => 'Question was not found.']));
コード例 #3
0
" >
	<input type="hidden" name="comment_token" value="<?php 
echo Token::generateToken();
?>
" >
	<button name="comment" id="subcomment" style="display:none;" class="ui blue submit disabled icon button">Submit</button>
</form>
<hr>
<div id="comments">
<?php 
if (count($comments) === 0) {
    echo "<span id=\"emptycmt\">There is nothing here yet, be the first to comment!</span>";
} else {
}
foreach ($comments as $comment) {
    $voted = QNA::has_voted($comment->id, USER_ID);
    $votes = Comment::get_votes($comment->id);
    $votes = $votes > 0 ? '+' . $votes : null;
    $self = $comment->uid === USER_ID;
    $rpsc = QNA::get_reports_count($comment->id) ?: false;
    $comment_date = $comment->created;
    $comment_edited_date = $comment->last_modified;
    if ($comment->last_modified > $comment->created) {
        $edited = "(edited <span class='datetime' title=\"{$comment_edited_date}\">{$comment_edited_date}</span>)";
    } else {
        $edited = "";
    }
    ?>
				<?php 
    if ($session->adminCheck()) {
        ?>