HEX
Server: LiteSpeed
System: Linux in-mum-web921.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: u590867752 (590867752)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: /home/u590867752/domains/himanshuartinstitute.com/public_html/wall/user/my-circle.php
<?php

session_start();

header(
    "Cache-Control: no-cache, no-store, must-revalidate"
);
header("Pragma: no-cache");
header("Expires: 0");

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/baba/shiva.php"
);

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/user-auth.php"
);

/*
user-auth.php के बाद logged-in और active
user का username $login_user में उपलब्ध होगा।
*/
$login_user = trim(
    (string)($_SESSION["wall_user"] ?? "")
);

if($login_user === ""){
    header("Location: /wall/user/login.php");
    exit;
}


/* Logged-in active user की ID प्राप्त करें */
$user_statement = mysqli_prepare(
    $conn,
    "
    SELECT id
    FROM wall_users
    WHERE username = ?
      AND is_active = 1
    LIMIT 1
    "
);

if(!$user_statement){
    http_response_code(500);
    exit;
}

mysqli_stmt_bind_param(
    $user_statement,
    "s",
    $login_user
);

mysqli_stmt_execute($user_statement);

$user_result = mysqli_stmt_get_result(
    $user_statement
);

$logged_user = mysqli_fetch_assoc(
    $user_result
);

mysqli_stmt_close($user_statement);

if(!$logged_user){
    header("Location: /wall/user/login.php");
    exit;
}

$logged_user_id = (int)$logged_user["id"];


/*
केवल उन active artists की active posts लें
जिन्हें logged-in user follow करता है।
*/
$circle_statement = mysqli_prepare(
    $conn,
    "
    SELECT
        post.id,
        post.page_url,
        post.blog_name,
        post.image,
        post.post_type,
        post.youtube_video_id,
        post.likes,
        post.views,
        post.date,
        artist.username AS artist_username,
		artist.name AS artist_name,
		artist.image AS artist_image,
		artist.user_category AS artist_category

    FROM wall_follows AS follow_record

    INNER JOIN wall_users AS artist
        ON artist.id = follow_record.following_id
       AND artist.is_active = 1

    INNER JOIN HAIWALL AS post
        ON post.post_user COLLATE utf8mb4_unicode_ci
         = artist.username COLLATE utf8mb4_unicode_ci

    WHERE follow_record.follower_id = ?
      AND post.status = '1'
      AND COALESCE(post.is_report_blocked, 0) = 0

    ORDER BY post.date DESC, post.id DESC

    LIMIT 30
    "
);

if(!$circle_statement){
    error_log(
        "My Circle query preparation failed: "
        . mysqli_error($conn)
    );

    http_response_code(500);
    exit;
}

mysqli_stmt_bind_param(
    $circle_statement,
    "i",
    $logged_user_id
);

mysqli_stmt_execute($circle_statement);

$circle_posts = mysqli_stmt_get_result(
    $circle_statement
);

$circle_post_count = mysqli_num_rows(
    $circle_posts
);

?>
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">

<meta name="viewport"
      content="width=device-width, initial-scale=1.0">

<meta name="robots" content="noindex, follow">

<title>My Circle | HAI Wall</title>

<meta name="description"
      content="View the latest artwork shared by artists you follow on HAI Wall.">

<link rel="shortcut icon"
      href="/wall/bcknds/hai-wall.png"
      type="image/x-icon">

<link href="/wall/bcknds/css/wall-home.css?v=20260730-1"
      media="screen"
      rel="stylesheet"
      type="text/css">

<link href="/wall/bcknds/css/user-network-nav.css?v=20260730-5"
      media="screen"
      rel="stylesheet"
      type="text/css">

<link href="/wall/bcknds/css/my-circle.css?v=20260731-2"
      media="screen"
      rel="stylesheet"
      type="text/css">

<link rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>

<body>

<!-- HEADER -->
<?php
include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/header.php"
);
?>


<div class="container">

<!-- LEFT SIDEBAR -->
<div class="sidebar leftcolmn">

<?php
include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/top-liked-post.php"
);

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/new-users.php"
);
?>

</div>


<!-- CENTER CONTENT -->
<div>

<div class="haifeed-colum">

<div class="wall-container">

<?php

$network_page = "my-circle";

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/user-network-nav.php"
);

?>


<?php if($circle_post_count > 0){ ?>

<div class="circle-art-grid">

<?php while(
    $post = mysqli_fetch_assoc($circle_posts)
){ ?>

<?php

$post_title = !empty($post["blog_name"])
    ? trim((string)$post["blog_name"])
    : "Untitled Artwork";

$post_type = (string)(
    $post["post_type"] ?? "artwork"
);

if(
    !in_array(
        $post_type,
        [
            "artwork",
            "youtube",
            "poll"
        ],
        true
    )
){
    $post_type = "artwork";
}

$youtube_video_id = trim(
    (string)($post["youtube_video_id"] ?? "")
);

$is_youtube_post =
    $post_type === "youtube"
    &&
    preg_match(
        '/^[A-Za-z0-9_-]{11}$/',
        $youtube_video_id
    ) === 1;

$is_poll_post =
    $post_type === "poll";

if($is_youtube_post){

    $post_image_url =
        "https://i.ytimg.com/vi/"
        . rawurlencode($youtube_video_id)
        . "/hqdefault.jpg";

}elseif($is_poll_post){

    $post_image_url =
        "/wall/wall-feeds/default-poll.jpg";

}else{

    $post_image = !empty($post["image"])
        ? basename((string)$post["image"])
        : "default.jpg";

    $post_image_url =
        "/wall/wall-feeds/"
        . rawurlencode($post_image);
}

$post_url =
    "/wall/feed/"
    . rawurlencode(
        (string)$post["page_url"]
    );

$artist_username = trim(
    (string)$post["artist_username"]
);

$artist_name = !empty($post["artist_name"])
    ? trim((string)$post["artist_name"])
    : $artist_username;

if(function_exists("mb_convert_case")){
    $artist_name = mb_convert_case(
        mb_strtolower($artist_name, "UTF-8"),
        MB_CASE_TITLE,
        "UTF-8"
    );
}else{
    $artist_name = ucwords(
        strtolower($artist_name)
    );
}

$artist_image = !empty($post["artist_image"])
    ? basename((string)$post["artist_image"])
    : "default-user.png";

$artist_category = trim(
    (string)($post["artist_category"] ?? "")
);

$artist_profile_url =
    "/wall/user/profile.php?user="
    . rawurlencode($artist_username);

?>

<article class="circle-art-card">

<a
    href="<?=htmlspecialchars(
        $post_url,
        ENT_QUOTES,
        "UTF-8"
    )?>"
    class="circle-art-image"
    aria-label="View <?=htmlspecialchars(
        $post_title,
        ENT_QUOTES,
        "UTF-8"
    )?>"
>

<img
    src="<?=htmlspecialchars(
        $post_image_url,
        ENT_QUOTES,
        "UTF-8"
    )?>"
    loading="lazy"
    decoding="async"
    alt="<?=htmlspecialchars(
        $post_title,
        ENT_QUOTES,
        "UTF-8"
    )?>"
>

<?php if($is_youtube_post){ ?>

<span
    class="circle-video-play"
    aria-hidden="true"
></span>

<?php } ?>

</a>


<div class="circle-art-details">

<a
    href="<?=htmlspecialchars(
        $artist_profile_url,
        ENT_QUOTES,
        "UTF-8"
    )?>"
    class="circle-artist-link"
>

<img
    src="/wall/user/user-images/<?=rawurlencode(
        $artist_image
    )?>"
    class="circle-artist-image"
    loading="lazy"
    decoding="async"
    alt="<?=htmlspecialchars(
        $artist_name,
        ENT_QUOTES,
        "UTF-8"
    )?>"
>

<span class="circle-artist-text">

<span class="circle-artist-name">
<?=htmlspecialchars(
    $artist_name,
    ENT_QUOTES,
    "UTF-8"
)?>
</span>

<?php if($artist_category !== ""){ ?>

<span class="circle-artist-category">
<?=htmlspecialchars(
    $artist_category,
    ENT_QUOTES,
    "UTF-8"
)?>
</span>

<?php } ?>

</span>

</a>


<a
    href="<?=htmlspecialchars(
        $post_url,
        ENT_QUOTES,
        "UTF-8"
    )?>"
    class="circle-art-title"
>
<?=htmlspecialchars(
    $post_title,
    ENT_QUOTES,
    "UTF-8"
)?>
</a>


<div class="circle-art-stats">

<span title="Likes">
<i class="fa fa-heart"></i>
<?=max(0, (int)$post["likes"])?>
</span>

<span title="Views">
<i class="fa fa-eye"></i>
<?=max(0, (int)$post["views"])?>
</span>

</div>

</div>

</article>

<?php } ?>

</div>
<?php } else { ?>

<div class="profile-empty-posts">

<i class="fa fa-users"></i>

<h3>Your Circle is waiting</h3>

<p>
Follow artists to see their latest artwork here.
</p>

<p style="margin-top:15px;">

<a
    href="/wall/user/all-users.php"
    class="my-wall-create-btn"
>
    <i class="fa fa-search"></i>
    Discover Artists
</a>

</p>

</div>

<?php } ?>

</div>
</div>

</div>


<!-- RIGHT SIDEBAR -->
<div class="sidebar">

<div class="grynone">

<?php

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/latest-post-slider.php"
);

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/hai-blog-slider.php"
);

include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/follow-us.php"
);

?>

</div>

</div>

</div>


<!-- FOOTER -->
<?php
include(
    $_SERVER["DOCUMENT_ROOT"]
    . "/wall/bcknds/footer.php"
);
?>


<script src="/wall/bcknds/hai-blog-slidr.js"></script>
<script src="/wall/bcknds/search.js"></script>
<script src="/wall/bcknds/user-menu.js"></script>

</body>
</html>

<?php
mysqli_stmt_close($circle_statement);
?>