コード例 #1
0
ファイル: followers.php プロジェクト: asanchez78/comicdb
<?php

$followerList = $userInfo->followerList;
$followerCount = count($followerList);
if ($followerCount > 0) {
    $followerBlock = '';
    foreach ($followerList as $followerUser) {
        $followerSearch = new userInfo();
        $followerSearch->userMeta($followerUser);
        if (isset($followerSearch->user_first_name)) {
            $follower_first_name = $followerSearch->user_first_name;
        } else {
            $follower_first_name = '';
        }
        if (isset($followerSearch->user_last_name)) {
            $follower_last_name = $followerSearch->user_last_name;
        } else {
            $follower_last_name = '';
        }
        $followerBlock .= '<li><a href="/profile.php?user='******'">';
        if (isset($followerSearch->user_avatar)) {
            $followerAvatar = $followerSearch->user_avatar;
            $followerBlock .= '<img src="' . $followerSearch->user_avatar . '" alt="' . $follower_first_name . ' ' . $follower_last_name . '" class="img-circle img-responsive" />';
        } else {
            $gravatar_hash = $followerSearch->follow_email_hash;
            $followerAvatar = '//www.gravatar.com/avatar/' . $gravatar_hash . '?s=60&d=' . urlencode('http://comicmanager.com/assets/avatar-deadpool.png');
            $followerBlock .= '<img src="' . $followerAvatar . '" alt="' . $follower_first_name . ' ' . $follower_last_name . '" class="img-circle img-responsive" />';
        }
        $followerBlock .= '</a></li>';
    }
} else {
コード例 #2
0
ファイル: profile.php プロジェクト: asanchez78/comicdb
<?php

require_once 'views/head.php';
$profile_name = filter_input(INPUT_GET, 'user');
$comic = new comicSearch();
$user = new userInfo();
if (isset($profile_name) && $profile_name != '') {
    $user->userLookup($profile_name);
    $profileID = $user->browse_user_id;
    $profileEmail = $user->browse_user_email_hash;
} else {
    $profileID = $userID;
    $profileEmail = $userEmail;
}
// Grab all fields from users_meta for the user ID
$user->userMeta($profileID);
if (isset($user->user_first_name)) {
    $first_name = $user->user_first_name;
} else {
    $first_name = '';
}
if (isset($user->user_last_name)) {
    $last_name = $user->user_last_name;
} else {
    $last_name = '';
}
if ($first_name === '' && $last_name === '') {
    if (isset($profile_name) && $profile_name != '') {
        $first_name = $profile_name;
    } else {
        $first_name = $userName;
コード例 #3
0
ファイル: feed.php プロジェクト: asanchez78/comicdb
<?php

$userInfo = new userInfo();
$userInfo->userMeta($userID);
$followList = preg_replace('/}{/', ',', $userInfo->user_follows);
$followList = substr($followList, 1, -1);
$feedLength = 150;
$userInfo->showFeed($followList, $feedLength);
?>
<section data-module="feed">
  <ul class="nolist user-feed-container">
    <?php 
echo $userInfo->feed;
?>
  </ul>
</section>
コード例 #4
0
ファイル: follow_button.php プロジェクト: asanchez78/comicdb
<?php

$followers = new userInfo();
$followers->userMeta($userID);
// Checks to see if the user is already following the profile
if (isset($followers->user_follows)) {
    $followList = preg_split('/\\D/', $followers->user_follows, NULL, PREG_SPLIT_NO_EMPTY);
    foreach ($followList as $followUser) {
        if ($followUser == $profileID) {
            $userFollowing = true;
        }
    }
}
?>
<div data-module="follow_button">
  <form method="post" name="follow_form" action="">
    <input type="hidden" name="profile_id" value="<?php 
echo $profileID;
?>
" />
    <input type="hidden" name="user_id" value="<?php 
echo $userID;
?>
" />
    <?php 
if (isset($userFollowing)) {
    if ($userFollowing == true) {
        ?>
        <input type="hidden" name="followed" value="false" />
        <button class="btn btn-sm btn-default" type="submit"><i class="fa fa-fw fa-user-times"></i> <span class="hidden-xs hidden-sm">Unfollow</span></button>
      <?php 
コード例 #5
0
ファイル: following.php プロジェクト: asanchez78/comicdb
<?php

if (isset($userInfo->user_follows)) {
    $followBlock = '';
    $followList = preg_split('/\\D/', $userInfo->user_follows, NULL, PREG_SPLIT_NO_EMPTY);
    $followCount = count($followList);
    foreach ($followList as $followUser) {
        $followSearch = new userInfo();
        $followSearch->userFollows($followUser);
        $followSearch->userMeta($followUser);
        if (isset($followSearch->user_first_name)) {
            $follow_first_name = $followSearch->user_first_name;
        } else {
            $follow_first_name = '';
        }
        if (isset($followSearch->user_last_name)) {
            $follow_last_name = $followSearch->user_last_name;
        } else {
            $follow_last_name = '';
        }
        $followBlock .= '<li><a href="/profile.php?user='******'">';
        if (isset($followSearch->user_avatar)) {
            $followAvatar = $followSearch->user_avatar;
            $followBlock .= '<img src="' . $followSearch->user_avatar . '" alt="' . $follow_first_name . ' ' . $follow_last_name . '" class="img-circle img-responsive" />';
        } else {
            $gravatar_hash = $followSearch->follow_email_hash;
            $followAvatar = '//www.gravatar.com/avatar/' . $gravatar_hash . '?s=60&d=' . urlencode('http://comicmanager.com/assets/avatar-deadpool.png');
            $followBlock .= '<img src="' . $followAvatar . '" alt="' . $follow_first_name . ' ' . $follow_last_name . '" class="img-circle img-responsive" />';
        }
        $followBlock .= '</a></li>';
    }
コード例 #6
0
ファイル: form_submit.php プロジェクト: asanchez78/comicdb
<?php

// This local function will do the brunt of the work for us, so all we have to do is pass in a few variables to it.
$followUser = function ($profile_id, $user_id, $toggle) {
    $connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    $fieldCheck = new userInfo();
    // Let's grab the users's current follow list to compare.
    $fieldCheck->userMeta($user_id);
    if (isset($fieldCheck->user_follows)) {
        // Split the list string into an array
        $followList = preg_split('/\\D/', $fieldCheck->user_follows, NULL, PREG_SPLIT_NO_EMPTY);
        $followCount = count($followList);
    } else {
        $followCount = 0;
    }
    // Follow / Unfollow
    if ($toggle == 'true') {
        // Follow the user
        if (isset($fieldCheck->user_follows)) {
            $sql = "UPDATE users_meta\n          SET meta_value = CONCAT_WS('', meta_value, '{{$profile_id}}') \n          WHERE meta_key='user_follows' AND user_id='{$user_id}'";
        } else {
            $sql = "INSERT INTO users_meta (user_id, meta_key, meta_value) \n          VALUES ('{$user_id}', 'user_follows', '{{$profile_id}}')";
        }
    } else {
        // Unfollow the user
        if ($followCount > 1) {
            $sql = "UPDATE users_meta \n          SET meta_value=REPLACE(meta_value,'{{$profile_id}}','') \n          WHERE meta_key='user_follows' \n          AND user_id='{$user_id}'";
        } else {
            // Is this the only user? Remove the key.
            $sql = "DELETE FROM users_meta \n          WHERE meta_key='user_follows' \n          AND user_id='{$user_id}'";
        }