/**
  * Get Userlist HTML
  * 
  * @param Int $userID
  * @return String
  */
 public function getUserListHTML($userID, &$uIDs = array())
 {
     $users = BuckysPrivateMessenger::getUserList($userID);
     $html = '';
     foreach ($users as $row) {
         $newMsg = BuckysPrivateMessenger::getNewMessageCount($userID, $row['userID']);
         $html .= '<a href="#" class="single_chat_user ' . (!$row['online'] || !$row['buddyStatus'] ? "single_chat_user_offline" : '') . '" data-id="' . $row['userID'] . '" data-hash="' . buckys_encrypt_id($row['userID']) . '"> <img src="' . BuckysUser::getProfileIcon($row) . '" /><span> ' . $row['name'] . '</span></a>';
         $uIDs[] = $row['userID'];
     }
     return $html;
 }
/**
* Load Private Messenger
* 
*/
function loadMessenger()
{
    global $db, $userID;
    //Getting Friends from the Buddy List
    $messengerSettings = BuckysUser::getUserBasicInfo($userID);
    $uIDs = array();
    //Return HTML
    ob_start();
    ?>
    <div id="private_messenger_main_wrap">
        <div class="box_nav_row">
            <a href="#" class="close_box_link">&nbsp;</a>
<!--            <a href="#" class="minimize_box_link">&nbsp;</a>-->
        </div>
        <h2>Private Messenger</h2>
        <div class="chat_user_list" id="private_messenger_buddies_list">
            <?php 
    echo BuckysPrivateMessenger::getUserListHTML($userID, $uIDs);
    ?>
        </div>
        <div class="below_chat_user_list <?php 
    if ($messengerSettings['messenger_privacy'] == 'all') {
        ?>
add-user-to-buddylist-hidden<?php 
    }
    ?>
" id="add-user-to-buddylist">
            <form name="adduserform" id="adduserform">
                <h2>Add Friends</h2>
                <span id="add-user-to-buddylist-inputholder">
                    <input type="text" class="input below_chat_user_list_input" id="add-user-to-buddylist-input" />                
                    <input type="submit" value="Add" class="redButton" />
                </span>
<!--                <div id="selected-users-list"></div>-->
                <div class="clear"></div>
                <?php 
    echo render_loading_wrapper();
    ?>
            </form>
        </div>
        <div class="below_chat_user_list" id="messenger_btn_box">             
            <span><input type="button" id="settings_messenger_btn" class="redButton" value="Settings"></span>
        </div>
    </div>
    <?php 
    BuckysPrivateMessenger::updateConversationList($userID, $uIDs);
    $convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array();
    ?>
    <div id="private_messenger_conversation_wrap" <?php 
    if (!buckys_not_null($convList)) {
        ?>
style="display: none;"<?php 
    }
    ?>
>                            
        <div class="box_nav_row">
            <a href="#" class="close_box_link">&nbsp;</a>
            <a href="#" class="minimize_box_link">&nbsp;</a>            
            <div href="#" class="options_link" id="private-messenger-options-link">
                Options
                <ul>
                    <li><a href="#" id="pm-box-clear-history-link">Clear history</a></li>
                    <li><a href="#" id="pm-box-block-user-link">Block User</a></li>
                </ul>
            </div>            
        </div>
        <div id="private_messenger_conversation_lft">
            <div id="private_messenger_opened_chats"> 
                <?php 
    foreach ($convList as $i => $uID) {
        $tUInfo = BuckysUser::getUserBasicInfo($uID);
        ?>
<a href="#" data-id="<?php 
        echo $uID;
        ?>
" <?php 
        if ($i == 0) {
            ?>
class="actived"<?php 
        }
        ?>
 data-encrypted="<?php 
        echo buckys_encrypt_id($uID);
        ?>
"><?php 
        echo $tUInfo['firstName'] . " " . $tUInfo['lastName'];
        ?>
 <span title="close" class="close-conversation">X</span></a><?php 
    }
    ?>
                         
            </div>                    
        </div>        
        <div id="private_messenger_conversation_rgt">
            <?php 
    foreach ($convList as $i => $uID) {
        $tUInfo = BuckysUser::getUserBasicInfo($uID);
        ?>
                <div class="private_messenger_conversation_contr" <?php 
        if ($i > 0) {
            ?>
style="display: none;"<?php 
        }
        ?>
 id="private_messenger_conversation_contr<?php 
        echo $uID;
        ?>
">
                    <?php 
        echo BuckysPrivateMessenger::getMessagesHTML($userID, $uID, 'all');
        ?>
                </div>
            <?php 
    }
    ?>
              
            <div id="private_messenger_send_message_contr">
                <form name="newmessageform" id="newmessageform" action="" method="post">
                    <input class="under_private_message_conversation_area_input" id="new_private_message" class="input" type="text" />
                </form>
            </div>
        </div>        
        <div class="clear"></div>
    </div>    
    <?php 
    $html = ob_get_contents();
    ob_end_clean();
    return $html;
}
Exemple #3
0
    $password = trim($_POST['password']);
    $info = buckys_get_user_by_email($email);
    if (buckys_not_null($info)) {
        if (!buckys_validate_password($password, $info['password'])) {
            buckys_redirect('/register.php', MSG_INVALID_LOGIN_INFO, MSG_TYPE_ERROR);
        } else {
            if ($info['status'] == 0) {
                //Account Not Verified or Banned
                buckys_redirect('/index.php', !$info['token'] ? MSG_ACCOUNT_BANNED : MSG_ACCOUNT_NOT_VERIFIED, MSG_TYPE_ERROR);
            } else {
                //Login Success
                //Clear Login Attemps
                BuckysTracker::clearLoginAttemps();
                $_SESSION['userID'] = $info['userID'];
                //Init Some Session Values
                $_SESSION['converation_list'] = array();
                //If the keep me signed in is checked, save data to cookie
                if ($_POST['keep_sign_in'] == 1) {
                    setcookie('bkuid0', base64_encode($info['userID']), time() + COOKIE_LIFETIME, "/", "buckysroom.com");
                    $uidEncrypted = buckys_encrypt_id($info['userID']);
                    setcookie('bkuid1', base64_encode($uidEncrypted), time() + COOKIE_LIFETIME, "/", "buckysroom.com");
                    setcookie('bkuid2', base64_encode($_SESSION['user_encrypt_salt']), time() + COOKIE_LIFETIME, "/", "buckysroom.com");
                }
                buckys_redirect('/account.php');
            }
        }
    } else {
        //Email Incorrect
        buckys_redirect('/register.php', MSG_INVALID_LOGIN_INFO, MSG_TYPE_ERROR);
    }
}
                    ?>
&return=<?php 
                    echo base64_encode("/profile.php?user="******"
                                                data-type="buckys-ajax-link">Decline Friend Request</a>
                                            <br/>
                                        <?php 
                } else {
                    ?>
                                            <a href="/myfriends.php?action=request&friendID=<?php 
                    echo $row['userID'];
                    echo buckys_get_token_param();
                    ?>
&friendIDHash=<?php 
                    echo buckys_encrypt_id($row['userID']);
                    ?>
&return=<?php 
                    echo base64_encode("/profile.php?user="******"
                                                data-type="buckys-ajax-link">Send Friend Request</a>
                                            <br/>
                                        <?php 
                }
            }
        }
    }
    ?>
                            </p>
                            <?php 
"/></span>
                    <div class="clear"></div>
                </div>
                
                <!-- Submit Button -->
                <div class="btn-row">                        
                    <span class="inputholder"><input type="submit" class="redButton" value="Submit"/></span>
                    <div class="clear"></div>
                </div>                      
                <input type="hidden" name="action" value="delete_account" />
                <input type="hidden" name="userID" value="<?php 
echo $BUCKYS_GLOBALS['user']['userID'];
?>
" />
                <input type="hidden" name="userIDHash" value="<?php 
echo buckys_encrypt_id($BUCKYS_GLOBALS['user']['userID']);
?>
" />
            </form>
            
        </section>
    </section>
</section>
<script type="text/javascript">
    jQuery('#deleteaccountform').submit(function(){
        var form = $(this);
        var isValid = true;
                
        if(form.find('#password').val() == '')
        {
            form.find('#password').addClass('input-error');
                </div>

                <!-- Submit Button -->
                <div class="btn-row">
                    <span class="inputholder"><input type="submit" id="submit" name="submit" class="redButton"
                            value="Submit"/></span>

                    <div class="clear"></div>
                </div>
                <input type="hidden" name="action" value="change_password"/> <input type="hidden" name="userID"
                    value="<?php 
echo $TNB_GLOBALS['user']['userID'];
?>
"/> <input type="hidden" name="userIDHash"
                    value="<?php 
echo buckys_encrypt_id($TNB_GLOBALS['user']['userID']);
?>
"/>
            </form>

        </section>
    </section>
</section>
<script type="text/javascript">
    jQuery('#changepwdform').submit(function (){
        var form = $(this);
        var isValid = true;

        if(form.find('#currentPassword').val() == ''){
            form.find('#currentPassword').addClass('input-error');
            isValid = false;
Exemple #7
0
function render_single_comment($comment, $userID = null, $isReturn = false)
{
    global $BUCKYS_GLOBALS;
    $timeOffset = 0;
    if (buckys_not_null($userID)) {
        $userInfo = BuckysUser::getUserBasicInfo($userID);
        $timeOffset = $BUCKYS_GLOBALS['timezone'][$userInfo['timezone']];
    }
    ob_start();
    ?>
    <div class="comment-item">                 
        <a href="/profile.php?user=<?php 
    echo $comment['commenter'];
    ?>
" class="thumb"><img src="<?php 
    echo BuckysUser::getProfileIcon($comment['commenter']);
    ?>
" class="replyToPostIcons" /></a>
        <div class="comment-content">
            <a href="/profile.php?user=<?php 
    echo $comment['commenter'];
    ?>
" style="font-weight:bold"><?php 
    echo $comment['fullName'];
    ?>
</a>
            <br/>
            <?php 
    echo $comment['content'];
    ?>
            <br/>
            <span style=" color:#999999; "><?php 
    echo buckys_format_date($comment['posted_date']);
    ?>
</span> 
            
            <?php 
    if ($comment['commenter'] == $userID || $comment['poster'] == $userID) {
        ?>
            &middot;
            <a href="/comments.php?action=delete-comment&userID=<?php 
        echo $userID;
        ?>
&commentID=<?php 
        echo $comment['commentID'];
        ?>
&postID=<?php 
        echo $comment['postID'];
        ?>
" class="remove-comment-link">Delete</a>
            <?php 
    }
    if (buckys_not_null($userID) && !$comment['reportID'] && ($comment['commenter'] != $userID && $comment['poster'] != $userID)) {
        ?>
            &middot; <a href="/report_object.php" data-type="comment" data-id="<?php 
        echo $comment['commentID'];
        ?>
" data-idHash="<?php 
        echo buckys_encrypt_id($comment['commentID']);
        ?>
" class="report-link" style="color:#999999;">Report</a>
            <?php 
    }
    ?>
        </div>        
    </div>
    <?php 
    $html = ob_get_contents();
    ob_end_clean();
    if (!$isReturn) {
        echo $html;
    } else {
        return $html;
    }
}
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
    buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
if (isset($_POST['action']) && $_POST['action'] == 'get-users') {
    $users = BuckysUser::searchUsers($_REQUEST['term'], $userID);
    $result = [];
    foreach ($users as $row) {
        $result[] = ["id" => $row['userID'], 'label' => $row['fullName'], 'value' => $row['fullName'], 'hash' => buckys_encrypt_id($row['userID'])];
    }
    echo json_encode($result);
    buckys_exit();
}
if (isset($_POST['action']) && $_POST['action'] == 'send-money') {
    if (!isset($_POST['receiverID']) || !isset($_POST['receiverIDHash']) || !isset($_POST['amount']) || !buckys_check_id_encrypted($_POST['receiverID'], $_POST['receiverIDHash'])) {
        buckys_redirect('/credits.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
    }
    $result = BuckysTransaction::sendCredits($_POST['receiverID'], $_POST['amount']);
    if ($result === true) {
        buckys_redirect('/credits.php', MSG_SENT_CREDITS_SUCCESSFULLY);
    } else {
        buckys_redirect('/credits.php', $result, MSG_TYPE_ERROR);
    }
    exit;
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = BuckysTransaction::getNumOfCreditActivities($userID);
//Init Pagination Class
                                        class="block-link">Delete</a>
                                <?php 
        }
        ?>


                                <?php 
        if (buckys_is_logged_in() && $userID != $row['creatorID']) {
            ?>
                                    <a href="/report_object.php" data-type="reply"
                                        data-id="<?php 
            echo $row['replyID'];
            ?>
"
                                        data-idHash="<?php 
            echo buckys_encrypt_id($row['replyID']);
            ?>
"
                                        class="report-link">
                                        <?php 
            echo !$row['reportID'] ? 'Report' : 'You reported this.';
            ?>
                                    </a>
                                <?php 
        }
        ?>
								
                            </span>
                            </td>
                        </tr>
                    <?php 
                                    <input type="submit" id="save-btn" class="redButton" value="Post"
                                        style="display:block;"/>

                                    <div class="file-row">
                                        <input type="button" id="file_upload" name="file_upload" type="file"/>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div id="jcrop-row"></div>
                                <input type="hidden" name="action" value="submit-post"/> <input type="hidden"
                                    name="pageID" value="<?php 
        echo $pageData['pageID'];
        ?>
"> <input type="hidden"
                                    name="pageIDHash" value="<?php 
        echo buckys_encrypt_id($pageData['pageID']);
        ?>
">
                                <input type="hidden" name="x1" id="x1" value="0"/> <input type="hidden" name="x2"
                                    id="x2" value="0"/> <input type="hidden" name="y1" id="y1" value="0"/> <input
                                    type="hidden" name="y2" id="y2" value="0"/> <input type="hidden" name="width"
                                    id="width" value="0"/> <input type="hidden" name="type" id="type" value="text"/>
                                <?php 
        render_form_token();
        ?>
                                <?php 
        render_loading_wrapper();
        ?>
                            </form>
                        </div>
                        <div class="clear"></div>
">Approve Friend Request</a> <br/>
                <a href="/myfriends.php?action=decline&friendID=<?php 
                echo $profileID;
                ?>
&return=<?php 
                echo base64_encode("/profile.php?user="******">Decline Friend Request</a> <br/>
                <?php 
            } else {
                ?>
                <a href="/myfriends.php?action=request&friendID=<?php 
                echo $profileID;
                ?>
&friendIDHash=<?php 
                echo buckys_encrypt_id($profileID);
                ?>
&return=<?php 
                echo base64_encode("/profile.php?user="******">Send Friend Request</a> <br/>
                <?php 
            }
        }
    }
    //Show Message
    ?>
        <a href="/messages_compose.php?to=<?php 
    echo $profileID;
    ?>
">Send Message</a> <br/>
/**
 * Render report object link
 *
 * @param mixed  $objectID
 * @param string $reportType
 * @param mixed  $ownerID
 * @param mixed  $userID
 * @param bool   $reportID
 * @param string $prefix
 */
function render_report_link($objectID, $reportType = 'post', $ownerID = null, $userID = null, $reportID = false, $prefix = '')
{
    if ($userID) {
        if ($ownerID != $userID && !$reportID) {
            //Show Report Link
            echo $prefix;
            ?>
            <a href="/report_object.php" data-type="<?php 
            echo $reportType;
            ?>
" data-id="<?php 
            echo $objectID;
            ?>
"
                data-idHash="<?php 
            echo buckys_encrypt_id($objectID);
            ?>
" class="report-link">Report</a>
        <?php 
        }
        //Show Moderator Link
        if (buckys_check_user_acl(USER_ACL_MODERATOR) && $reportID) {
            $item_title = '';
            switch ($reportType) {
                case 'post':
                case 'topic':
                case 'reply':
                    $item_title = 'Post';
                    break;
                case 'comment':
                case 'video_comment':
                    $item_title = 'Comment';
                    break;
                case 'message':
                    $item_title = 'Message';
                    break;
                case 'trade_item':
                case 'shop_item':
                    $item_title = 'Item';
                    break;
            }
            ?>
            <?php 
            echo $prefix;
            ?>
            <span class="moderator-action-links">
                <a href="/reported.php?action=delete-objects&reportID=<?php 
            echo $reportID;
            ?>
">Delete <?php 
            echo $item_title;
            ?>
</a>
                &middot;
                <a href="/reported.php?action=approve-objects&reportID=<?php 
            echo $reportID;
            ?>
">Approve <?php 
            echo $item_title;
            ?>
</a>
                &middot;
                <a href="/reported.php?action=ban-users&reportID=<?php 
            echo $reportID;
            ?>
">Ban User</a>                                
            </span>
        <?php 
        }
    }
}
Exemple #13
0
/**
* Check ID Encrypted Value 
*/
function buckys_check_id_encrypted($gID, $encrypted)
{
    if (!isset($_SESSION['user_encrypt_salt'])) {
        return false;
        /*if( $userID != $encrypted )
              return false;
          else
              return true;*/
    } else {
        if (buckys_encrypt_id($gID) == $encrypted) {
            return true;
        } else {
            return false;
        }
    }
}
                    </div>
                    <div class="row">
                        <label>Subject: </label> <span><b><?php 
echo $message['subject'];
?>
</b></span>
                        <?php 
if ($userID != $message['sender'] && !$message['reportID']) {
    ?>
                            <a href="/report_object.php" data-type="message"
                                data-id="<?php 
    echo $message['messageID'];
    ?>
"
                                data-idHash="<?php 
    echo buckys_encrypt_id($message['messageID']);
    ?>
"
                                class="report-link">Report</a>
                        <?php 
}
?>
                        <?php 
if (buckys_check_user_acl(USER_ACL_MODERATOR) && $message['reportID']) {
    ?>
                            <span class="moderator-action-links">
                                <a href="/reported.php?action=approve-objects&reportID=<?php 
    echo $message['reportID'];
    ?>
">Approve Message</a>
                                &middot;
Exemple #15
0
</a>
                        <p><?php 
    echo $row['candidateText'];
    ?>
</p>
                        <?php 
    if (buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) {
        ?>
                        <a href="/moderator.php?type=<?php 
        echo $moderatorType;
        ?>
&action=choose-moderator&id=<?php 
        echo $row['candidateID'];
        ?>
&idHash=<?php 
        echo buckys_encrypt_id($row['candidateID']);
        ?>
" class="redButton">Choose Moderator</a>
                        <?php 
    }
    ?>
                    </div>                    
                    <div class="clear"></div>
                </div>
                <?php 
}
?>
            </div>
            <br />
            <br />
            <?php 
                    </tfoot>
                    <tbody>
                    <?php 
    foreach ($results['topics'] as $row) {
        ?>
                    <tr>
                        <td <?php 
        echo !BuckysForumTopic::isVoted($row['topicID']) ? 'class="post-votes"' : 'class="post-votes voted votedStatus1" title="' . MSG_ALREADY_CASTED_A_VOTE . '"';
        ?>
>
                            <a href="#" class="thumb-up" data-type='topic' data-id="<?php 
        echo $row['topicID'];
        ?>
"
                                data-hashed="<?php 
        echo buckys_encrypt_id($row['topicID']);
        ?>
">
                                <?php 
        if ($row['votes'] > 0) {
            echo '+';
        }
        echo $row['votes'];
        ?>
                            </a>
                        </td>
                        <td class="icon-column">
                            <a style="float: left;" href="/profile.php?user=<?php 
        echo $row['creatorID'];
        ?>
">
                            ?>
&return=<?php 
                            echo base64_encode("/profile.php?user="******"
                                                    data-type="buckys-ajax-link">Decline Friend Request</a>
                                                <br/>
                                            <?php 
                        } else {
                            ?>
                                                <a href="/myfriends.php?action=request&friendID=<?php 
                            echo $userData['userID'];
                            echo buckys_get_token_param();
                            ?>
&friendIDHash=<?php 
                            echo buckys_encrypt_id($userData['userID']);
                            ?>
&return=<?php 
                            echo base64_encode("/profile.php?user="******"
                                                    data-type="buckys-ajax-link">Send Friend Request</a>
                                                <br/>
                                            <?php 
                        }
                    }
                }
            }
            ?>
                                    </span> <a href="<?php 
            echo $sendMessageLink;