示例#1
0
<img src="<?php 
            echo $fullpath;
            ?>
" class="img-responsive">

<br>
<?php 
        }
        ?>
        <p>
        <?php 
        $l = null;
        if ($from == "logged") {
            $l = HeartData::getByRUT($p->id, $user->id, 2);
        }
        $c = HeartData::countByRT($p->id, 2)->c;
        $b = "btn-default";
        if ($l != null) {
            $b = "btn-primary";
        }
        ?>
        <?php 
        if ($l == null) {
            ?>
        <a href="javascript:void()" onclick="like(2,<?php 
            echo $p->id;
            ?>
)" id="ilk-<?php 
            echo $p->id;
            ?>
" class="btn btn-sm <?php 
示例#2
0
<?php

/**
* @author evilnapsis
* @brief Agregar likes apartir del id y tipo de referencia con el usuario logeado.
**/
if (Session::exists("user_id") && !empty($_POST)) {
    $h = HeartData::getByRUT($_POST["r"], $_SESSION["user_id"], $_POST["t"]);
    if ($h == null) {
        $h = new HeartData();
        $h->ref_id = $_POST["r"];
        $h->user_id = $_SESSION["user_id"];
        $h->type_id = $_POST["t"];
        $h->add();
        echo HeartData::countByRT($_POST["r"], $_POST["t"])->c;
        /////////// send notifications
        $user_id = null;
        $author_id = null;
        if ($_POST["t"] == 1) {
            $post = PostData::getReceptorId($_POST["r"]);
            $user_id = $post->receptor_ref_id;
            $author_id = $post->author_ref_id;
        } else {
            if ($_POST["t"] == 2) {
                $post = ImageData::getUserId($_POST["r"]);
                $user_id = $post->user_id;
                $author_id = $post->user_id;
            }
        }
        if ($author_id != $_SESSION["user_id"] && $user_id != $_SESSION["user_id"]) {
            // si es el mismo autor del post, entonces no le notificamos