function getOnlineUsersInfo($sUserId, $bInit) { global $aXmlTemplates; $aSaved = getSavedUsers(); $aActive = getActiveUsers($sUserId); $aFriends = getFriends($sUserId); saveUsers($aActive); $sContents = ""; if ($bInit) { $aFullUsers = array_unique(array_merge($aActive['online'], $aFriends)); } else { $aFullUsers = array_diff($aActive['online'], $aSaved['online'], $aFriends); $aNewOfflineUsers = array_intersect($aSaved['online'], $aActive['offline']); $aNewOnlineUsers = array_intersect($aSaved['offline'], $aActive['online'], $aFriends); for ($i = 0; $i < count($aNewOfflineUsers); $i++) { $sContents .= parseXml($aXmlTemplates['user'], $aNewOfflineUsers[$i], FALSE_VAL); } for ($i = 0; $i < count($aNewOnlineUsers); $i++) { $sContents .= parseXml($aXmlTemplates['user'], $aNewOnlineUsers[$i], TRUE_VAL); } } $rResult = getUsersMedia($aFullUsers); if ($rResult != null) { for ($i = 0; $i < mysql_num_rows($rResult); $i++) { $aUser = mysql_fetch_assoc($rResult); $aUserInfo = getUserInfo($aUser['ID']); $sOnline = in_array($aUser['ID'], $aActive['online']) ? TRUE_VAL : FALSE_VAL; $sFriend = in_array($aUser['ID'], $aFriends) ? TRUE_VAL : FALSE_VAL; $sMusic = $aUser['CountMusic'] > 0 ? TRUE_VAL : FALSE_VAL; $sVideo = $aUser['CountVideo'] > 0 ? TRUE_VAL : FALSE_VAL; $sContents .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUserInfo['nick'], $aUserInfo['sex'], $aUserInfo['age'], $aUserInfo['photo'], $aUserInfo['profile'], $sOnline, $sFriend, $sMusic, $sVideo); } } return makeGroup($sContents, "users"); }
function getGames($db, $max_game, $max_player, $mode, $fid = false, $facebook = false) { $modes = array('joinable' => 0, 'started' => 1, 'ended' => 2, 'all' => -1, 'friends' => -2, 'friends_all' => -3); $m = $modes[$mode]; if ($m == -2) { $friends = filterFriends($db, getFriends($db, $fid, $facebook)); $sql = "SELECT games.gid,games.state,games.numplayers " . "FROM games,plays " . "WHERE plays.gameid=games.gid AND games.state=0 AND games.numplayers<=?"; $s = sizeof($friends); if (is_array($friends)) { if ($s == 0) { return array(); } if ($s == 1) { $sql_mid = " AND plays.playerid=?"; } else { $s--; $sql_mid = " AND ("; for ($i = 0; $i < $s; $i++) { $sql_mid .= "plays.playerid=? OR "; } $sql_mid .= 'plays.playerid=?)'; $sql .= $sql_mid; } } else { return array(); } $sql .= "ORDER BY gid DESC LIMIT ?"; $ids = array($max_player); foreach ($friends as $friend) { $ids[] = $friend['fid']; } $ids[] = $max_game; $query = $db->query($sql, $ids); return $query; } else { if ($m != -1) { $sql = "SELECT `gid`,`state`,`numplayers` FROM `games` WHERE `state`=? AND `numplayers`<= ? ORDER BY gid DESC LIMIT ?"; $query = $db->query($sql, array($m, $max_game, $max_player)); } else { $sql = "SELECT `gid`,`state`,`numplayers` FROM `games` ORDER BY gid DESC LIMIT ?"; $query = $db->query($sql, array($max_game)); } } return $query; }
} ?> </div> <?php } ?> <div id="friends"> <h3>Current Users:</h3> <?php $users = readUsers(); foreach ($users as $u) { if (!isPendingUser($u->username)) { $uname = $u->username; $picture = $u->pic; if (!in_array($u->username, getFriends($_SESSION['username']))) { ?> <div class="user"> <?php echo '<a href="profile.php?uname=' . $uname . '"><img class="thumbnails" src="' . $picture . '" alt="user1" /></a>'; ?> <?php echo $uname; ?> </div> <?php } } } ?> </div>
$objectDescrip = substrs($activeArray['content'], 30); $activeId = $activeArray['id']; $emailContent = getLangInfo('email', 'email_groupactive_invite_content'); } else { $id = $cyid; $type = 'group'; $invite_url = $db_bbsurl . '/u.php?a=invite&type=group&id=' . $cyid . '&uid=' . $winduid . '&hash=' . appkey($winduid, $type); $objectName = $colony['cname']; $objectDescrip = substrs($colony['descrip'], 30); $emailContent = getLangInfo('email', 'email_group_invite_content'); } if (empty($_POST['step'])) { S::gp("id", null, 2); //* @include_once pwCache::getPath(D_P.'data/bbscache/o_config.php'); pwCache::getData(D_P . 'data/bbscache/o_config.php'); $friend = getFriends($winduid) ? getFriends($winduid) : array(); foreach ($friend as $key => $value) { $frienddb[$value['ftid']][] = $value; } $query = $db->query("SELECT * FROM pw_friendtype WHERE uid=" . S::sqlEscape($winduid) . " ORDER BY ftid"); $friendtype = array(); while ($rt = $db->fetch_array($query)) { $friendtype[$rt['ftid']] = $rt; } $no_group_name = getLangInfo('other', 'no_group_name'); $friendtype[0] = array('ftid' => 0, 'uid' => $winduid, 'name' => $no_group_name); require_once PrintEot('thread_member'); footer(); } elseif ($_POST['step'] == 1) { // 发送email邀请 S::gp(array('emails', 'customdes'), 'P');
$savant->assign('list_of_my_apps', $applications_obj->listMyApplications(true)); $savant->display('social/tiny_applications.tmpl.php'); // echo '<div class="gadget_wrapper">'; // echo '<div class="gadget_title_bar">Applications</div>'; // echo '<div class="gadget_container">TODO: GADGETS/Applications</div>'; // echo '</div>'; ?> </div> <div class="my-contacts"> <?php //if friends array is not empty. if (!empty($friends)) { $savant->assign('friends', $friends); } else { $savant->assign('friends', getFriends($_SESSION['member_id'], SOCIAL_FRIEND_HOMEPAGE_MAX)); } $savant->assign('group_invitations', getGroupInvitations()); $savant->assign('group_requests', getGroupRequests()); $savant->assign('pending_requests', getPendingRequests()); $savant->display('social/friend_list.tmpl.php'); ?> </div> <?php $people_you_may_know = getPeopleYouMayKnow(); if (!empty($people_you_may_know)) { ?> <!-- people you may know --> <div class="people-you-may-know">
/** * Retrieve friends' recent activities * * @param int user id * @param boolean set TRUE to display all entry * @return The array of description of all the activities of the given user's friends. */ function getFriendsActivities($id, $displayAll = false) { $activities = array(); $friends = getFriends($id); if ($friends > 0) { $friends_ids = implode(', ', array_keys($friends)); if ($friends_ids != '') { $sql = 'SELECT * FROM %ssocial_activities WHERE member_id IN (%s) ORDER BY created_date DESC'; if (!$displayAll) { $sql .= ' LIMIT ' . SOCIAL_FRIEND_ACTIVITIES_MAX; } $rows_activities = queryDB($sql, array(TABLE_PREFIX, $friends_ids)); if (count($rows_activities) > 0) { foreach ($rows_activities as $row) { $activities[$row['id']]['member_id'] = $row['member_id']; $activities[$row['id']]['title'] = $row['title']; $activities[$row['id']]['created_date'] = $row['created_date']; } } return $activities; } else { return false; } } }
public function ajax_friends() { $friends = filterFriends($this->db, getFriends($this->db, $this->fid, $this->facebook)); $this->load->view('/player/friends', array('friends' => $friends)); }
InitGP(array('u', 'hash', 'app')); $u = (int) $u; !$u && Showmsg('undefined_action'); $thisbase = $basename . "q=invite&"; if ($winduid) { if (getOneFriend($u)) { Showmsg('mode_o_is_friend'); } } $friend = $db->get_one("SELECT m.uid,m.username,m.icon as face,m.honor,md.f_num,md.postnum,od.diarynum,od.photonum,od.owritenum,od.sharenum,od.groupnum FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid LEFT JOIN pw_ouserdata od ON m.uid=od.uid WHERE m.uid=" . pwEscape($u)); !$friend && Showmsg('undefined_action'); if ($hash != appkey($u, $app)) { Showmsg('mode_o_invite_hash_error'); } elseif ($winduid) { $o_u = $u; if (is_numeric($o_u) && strlen($hash) == 18) { require_once R_P . 'require/o_invite.php'; } refreshto("u.php?uid={$u}", 'add_friend_success'); } else { Cookie('o_invite', "{$u}\t{$hash}\t{$app}"); } require_once R_P . 'require/showimg.php'; list($friend['face']) = showfacedesign($friend['face'], 1, 'm'); if ($friend['f_num']) { $friends = getFriends($u, 0, 6, '', 1); } $forward = rawurlencode("u.php?uid={$u}"); require_once M_P . 'require/header.php'; require_once PrintEot('m_invite'); footer();
//Init Tagontonet require_once 'Tagontonet.php'; $tnet = new TagontoNET(); //Analyze request $Request = $_GET['r']; $TagLabel = $_GET['tag']; $Plugin = $_GET['pl']; $URI = $_GET['uri']; $tag = new TAG($TagLabel); //Getting the document on the right mood header("Content-Type: application/xml"); switch ($Request) { case 'GetFriends': //Check if a specific plugin has been requested $Plugin = $_GET['pl']; getFriends($tnet, $tag, $Plugin); break; case 'GetResources': //Check if a specific plugin has been requested tagRes($tnet, $tag, $Plugin); break; case 'ListPlugins': listPlugins($tnet); break; case 'ExtractTags': extractTags($tnet, $URI); break; default: break; //TODO return an "unknown command" message }
$aUserInfo = getUserInfo($sFriendId); $sOnline = in_array($iFriendId, $aOnlineFriends) ? TRUE_VAL : FALSE_VAL; $sContents .= parseXml($aXmlTemplates['user'], $sFriendId, $aUserInfo['nick'], $aUserInfo['sex'], $aUserInfo['age'], $sOnline, $aUserInfo['photo'], $aUserInfo['profile']); } $sContents = makeGroup($sContents, "users"); break; /** * Update friend's information. * @param id - user's ID, whose friends' info need to be updated. */ /** * Update friend's information. * @param id - user's ID, whose friends' info need to be updated. */ case "updateFriends": $aFriendIds = getFriends($sId); if (count($aFriendIds) == 0) { $sContents = ""; } else { $aOnlineFriends = getOnline($aFriendIds); for ($i = 0; $i < count($aOnlineFriends); $i++) { $sContents .= parseXml($aXmlTemplates['user'], $aOnlineFriends[$i]); } } $sContents = makeGroup($sContents, "users"); break; /** * Gets online user's information */ /** * Gets online user's information
$results = removeFriend($db, $_SESSION['id'], $_POST['deletefriendid'], $_SESSION['token']); switch ($results[SP::ERROR]) { case ERR::OK: echo "<p>Friend removed! <a href='friendslist.php'>See friends</a></p>"; break; case ERR::TOKEN_EXPIRED: case ERR::TOKEN_FAIL: case ERR::USER_NO_TOKEN: header("Location: logout.php?error=" . $results[SP::ERROR]); break; default: echo "<p>Could not remove friend. Error: " . $ERRORS[$results[SP::ERROR]] . "</p>"; break; } } else { $results = getFriends($db, $_SESSION['id'], $_SESSION['token']); $errorCode = $results[SP::ERROR]; unset($results[SP::ERROR]); switch ($errorCode) { case ERR::OK: if (count($results) == 0) { echo "<p>You have no friends ;_;</p>"; } foreach ($results as $num => $friend) { $friendInfo = getPublicUserDetails($db, $friend[FRIEND::FRIEND_ID]); echo <<<EOT t\t<div class="friendbox"> t\t\t<a href="profile.php?profileid={$friend[FRIEND::FRIEND_ID]}"> t\t\t\t<img class="avatar" src="avatar/{$friend[FRIEND::FRIEND_ID]}.jpg" /> t\t\t{$friendInfo[USER::DISP_NAME]}</a> t\t\t<form method="GET" action="makemessage.php">
/** * Retrieve friends' recent activities * * @param int user id * @param boolean set TRUE to display all entry * @return The array of description of all the activities of the given user's friends. */ function getFriendsActivities($id, $displayAll = false) { global $db; $activities = array(); $friends = getFriends($id); $friends_ids = implode(', ', array_keys($friends)); $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'social_activities WHERE member_id IN (' . $friends_ids . ') ORDER BY created_date DESC'; if (!$displayAll) { $sql .= ' LIMIT ' . SOCIAL_FRIEND_ACTIVITIES_MAX; } $result = mysql_query($sql, $db); if ($result) { while ($row = mysql_fetch_assoc($result)) { $activities[$row['id']]['member_id'] = $row['member_id']; $activities[$row['id']]['title'] = $row['title']; $activities[$row['id']]['created_date'] = $row['created_date']; } } return $activities; }
?> "> <input type="text" id="search_tbox" name="search_tbox" placeholder="Search for new Friends.. "/> <input type="submit" name="search_button" id="search_button" value="Search"/> <div class="friends_table"> <table> <tr><td> Your Friends </td> <td> Online</td></tr> <?php include 'conn/db_conn.php'; include 'func/quer.php'; include 'func/otherFunctions.php'; $link = connectDatabase(); $user = $_COOKIE['logged_in_user']; $friends = getFriends($user, $link); displayFriends($friends, $link); if (isset($_POST['search_button'])) { if (isset($_POST['search_tbox'])) { $text = $_POST['search_tbox']; $searchedFriends = searchFriend($text, $link); if (FALSE == $searchedFriends) { echo "<script type='text/javascript'>alert('No username found with such name');</script>"; } else { $temp = mysqli_fetch_assoc($searchedFriends); $_SESSION["username"] = $temp; header('Location: add_friend.php'); } } else { echo "<script type='text/javascript'>alert('Search fields are empty.');</script>"; }
if (!$db_groups_open) { $addwhere .= " AND f.type!='colony' AND f.type!='colony_post' AND f.type!='colony_photo'"; } $query = $db->query("SELECT f.*,m.username,m.groupid,m.icon FROM pw_feed f LEFT JOIN pw_members m ON f.uid=m.uid WHERE f.uid= " . pwEscape($u) . " {$addwhere} ORDER BY f.timestamp DESC LIMIT 30"); while ($rt = $db->fetch_array($query)) { $rt['descrip'] = parseFeed($rt['descrip']); if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) { $rt['descrip'] = appShield('ban_feed'); } $key = get_date($rt['timestamp'], 'y-m-d'); list($rt['faceurl']) = showfacedesign($rt['icon'], '1', 's'); $rt['appicon'] = getAppIcon($rt['type']); $feeds[$key][] = $rt; } } $friends = getFriends($u, 0, 18, '', 1); //$sendfriends = getFriends($winduid,0,0,false,1); //留言板 if ($privacy['msgboard']) { $boards = array(); require_once R_P . 'require/bbscode.php'; $wordsfb = L::loadClass('FilterUtil'); $query = $db->query("SELECT o.*,m.icon as face,m.groupid FROM pw_oboard o LEFT JOIN pw_members m ON o.uid=m.uid WHERE o.touid=" . pwEscape($u) . " ORDER BY o.id DESC " . pwLimit(0, 15)); while ($rt = $db->fetch_array($query)) { $rt['postdate'] = get_date($rt['postdate']); list($rt['face']) = showfacedesign($rt['face'], 1, 'm'); if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) { $rt['title'] = appShield('ban_feed'); } elseif (!$wordsfb->equal($rt['ifwordsfb'])) { $rt['title'] = $wordsfb->convert($rt['title'], array('id' => $rt['id'], 'type' => 'oboard', 'code' => $rt['ifwordsfb'])); }
<div class="row"> <div class="card"> <div class="titleOnCard">Upcoming Birthdays</div> <div class="friends"> <?php $friends = getFriends(); while ($friend = array_shift($friends)) { ?> <a href="choose.php?friendID=<?php echo $friend->id; ?> "><div class="friend clearFix"> <div class="profile-picture floater"> <img src="<?php echo $friend->picture; ?> " class="friendPic"/> </div> <div class="floater bdayInfo"> <div class="name"><?php echo $friend->name; ?> </div> <div class="birthday"><?php echo getBirthday($friend);
if ($groupid == 3 || $isU == 2 || $isU != 2 && $privacy['index']) { $SpaceShow = 1; } if (!$SpaceShow) { Showmsg('mode_o_index_right'); } } include_once D_P . 'data/bbscache/forum_cache.php'; $fids = trim(getSpecialFid() . ",'0'", ','); $shortcutforum = pwGetShortcut(); $force = $where = ''; $article = array(); $ordertype = 'postdate'; if ($a == 'friend') { $thisbase = $basename . 'a=friend&'; if ($friends = getFriends($winduid)) { $uids = array_keys($friends); !empty($fids) && ($where .= "fid NOT IN({$fids}) AND "); $where .= "authorid IN(" . pwImplode($uids) . ") AND ifcheck=1 AND ifhide=0 AND anonymous=0"; $where .= " AND postdate>" . pwEscape($timglimit); } else { //require_once(M_P.'require/header.php'); //require_once PrintEot('m_article'); //footer(); list($isheader, $isfooter, $tplname, $isleft) = array(true, true, "m_article", true); } $username = $windid; } elseif ($a == 'pc') { InitGP(array('pcid'), GP, 2); InitGP(array('see')); $pcid = (int) $pcid;
<?php !defined('P_W') && exit('Forbidden'); S::gp(array('u'), 'P', 2); if (!$u) { Showmsg('undefined_action'); } if ($u != $winduid) { Showmsg('undefined_action'); } $friends = getFriends($winduid, 0, 8, false, 1, 's'); $str = ''; if ($friends) { $friend_online = array(); foreach ($friends as $key => $value) { if ($value['uid'] == $winduid) { continue; } if ($value['thisvisit'] + $db_onlinetime * 1.5 > $timestamp) { $friend_online[] = array('uid' => $value['uid'], 'face' => $value['face'], 'username' => $value['username']); } } if ($friend_online) { $str = pwJsonEncode($friend_online); } } echo "success\t{$str}"; ajax_footer();
list($pages, $limit) = pwLimitPages($count, $page, "{$thisbase}{$addurl}"); } else { InitGP('ftid', '', 2); if (isset($_GET['ftid'])) { $ftype = (int) GetGP('ftid'); } $username = $windid; $query = $db->query("SELECT * FROM pw_friendtype WHERE uid=" . pwEscape($winduid) . " ORDER BY ftid"); $friendtype = array(); while ($rt = $db->fetch_array($query)) { $friendtype[$rt['ftid']] = $rt; } $count = $winddb['f_num']; list($pages, $limit) = pwLimitPages($count, $page, "{$thisbase}"); } $friends = getFriends($u, $start, $db_perpage, $ftype, 1); if ($friends) { foreach ($friends as $key => $value) { $value['isfriend'] = isFriend($winduid, $value['uid']); $friends[$key] = $value; } } } require_once M_P . 'require/header.php'; if ($space == 1) { require_once R_P . 'require/credit.php'; list($userdb, $ismyfriend, $friendcheck, $usericon, $usercredit, $totalcredit, $appcount, $p_list) = getAppleftinfo($u); require_once PrintEot('user_friend'); } else { require_once PrintEot('m_friend'); }
/** * Given an array list of friends, this function will add an attribute 'added' into the array if this person is already connected to the user. * @param int the user id * @param array the given array of friends * @return marked array */ function markFriends($id, $connections){ //get all friends $my_friends = getFriends($id); $pending_requests = getPendingRequests(true); foreach($my_friends as $friends){ //if it is in the connection, set the attribute if($connections[$friends] != null){ $connections[$friends]['added'] = 1; } } foreach ($pending_requests as $friends=>$garbage){ //if it is already added, set pending =1 if ($connections[$friends] != null){ $connections[$friends]['pending'] = 1; } } return $connections; }
<?php require_once "conf.php"; require_once "Utils.php"; require_once "header.html"; $user = getUser($facebook, APPURL); $friends = getFriends($facebook, $user); //print_r($friends); require_once "run.html";
function getUser($uname) { $q = new Querries(); $db = $q->getDB(); $array = $db->query(sprintf($q->GET_USER, $uname)); if (!$array instanceof Sqlite3Result) { return; } $res = $array->fetchArray(); $user = makeNewUser($res["username"], $res["password"], $res["name"], $res["gender"], $res["phone"], $res["email"], $res["admin"], $res["pictureLocation"], array(), array(), $res["bio"]); $db->close(); $user->friends = getFriends($uname); $user->pending = getRequests($uname); return $user; }
</div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> <div class="col-md-4"> <h3>Welcome:<i><?php echo $login_session; ?> </i></h3> <input href="#" type="button" class="myButton" onclick="redirect()" value="Start Test" ></input> <h3>First name: <small>Tõnis</small> </h3> <h3>Last name: <small>Nerep</small></h3> <!--<h3>Kasutaja alates: <small>01.01.2016</small></h3> <h3>Hinnatud: <big style="color:grey;">2</big> korda</h3> --> </div> <div class="col-md-6"> <h3>Test your friend:</h3> <?php getFriends(); ?> </div> <!--<b id="logout"><a href="logout.php">Log Out</a></b>--> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="assets/js/bootstrap.min.js"></script> </body> <p style="text-align:center;">Author:Tõnis Nerep</p> </html>
$link = new mysqli($servername, $username, $password, $dbname); if ($link->connect_error) { die("Connection failed: " . $link->connect_error); } //Do not have access to edit, if not owner of cookbook $isOwner = isOwner($user_id, $cookbook_id, $link); if ($isOwner == false) { header('Location: fail.php'); } $title = getCookbookTitle($cookbook_id, $link); //get title of cookbook $privacy = getPrivacy($cookbook_id, $link); //get privacy of cookbook //Check if privacy is friendly if ($privacy == "FRIENDLY") { $allemails = getFriends($cookbook_id, $link); } $sql = "SELECT name FROM Tag WHERE type='COOKBOOK' AND type_id = '{$cookbook_id}'"; $result = $link->query($sql); $i = 0; while ($row = $result->fetch_assoc()) { $tagsfromdb[$i] = $row['name']; $i++; } //all possible tags $alltags_array = array('1' => 'appetizer', '2' => 'paleo', '3' => 'american', '4' => 'beef', '5' => 'pork', '6' => 'asian', '7' => 'beverages', '8' => 'poultry', '9' => 'desi', '10' => 'breakfast/brunch', '11' => 'salad', '12' => 'greek', '13' => 'chicken', '14' => 'seafood', '15' => 'italian', '16' => 'desserts', '17' => 'soup', '18' => 'jamaican', '19' => 'gluten-free', '20' => 'vegan', '21' => 'latin', '22' => 'lunch', '23' => 'vegetarian'); if ($i > 0) { $c = getTags($tagsfromdb, $alltags_array); } else { foreach ($alltags_array as $k => $v) { $c[$k] = "";
$display_name_format = 2; } } $sql = 'SELECT login, first_name, second_name, last_name FROM %smembers WHERE member_id=%d'; $row = queryDB($sql, array(TABLE_PREFIX, $id), TRUE); return htmlentities_utf8(_AT($display_name_formats[$display_name_format], $row['login'], $row['first_name'], $row['second_name'], $row['last_name'])); } if (!$_SESSION['valid_user']) { require AT_INCLUDE_PATH . 'header.inc.php'; $info = array('INVALID_USER', $_SESSION['course_id']); $msg->printInfos($info); require AT_INCLUDE_PATH . 'footer.inc.php'; exit; } // default display my friends $friends = getFriends($_SESSION['member_id']); $rand_key = $addslashes($_POST['rand_key']); //should we excape? //paginator settings $page = intval($_GET['p']); if (!$page) { $page = 1; } $count = ($page - 1) * SOCIAL_FRIEND_SEARCH_MAX + 1; $offset = ($page - 1) * SOCIAL_FRIEND_SEARCH_MAX; //if $_GET['q'] is set, handle Ajax. if (isset($_GET['q'])) { $query = $_GET['q']; //don't need to addslashes here cause searchFriends will do it. if (isset($_POST['myFriendsOnly'])) { //retrieve a list of my friends
<?php // configuration require_once "../includes/config.php"; require "../includes/interactionService.php"; $db = new mysql_db(SERVER, USERNAME, PASSWORD, DATABASE); $username = $_SESSION["username"]; if (isset($_POST["receiver"])) { $receiver = $_POST["receiver"]; $message = $_POST["content"]; $sender = $username; sendMessage($sender, $receiver, $message); } $userid1 = $username; $friends = getFriends($userid1); $contacts = getContacts($userid1); $messages = getMessages($username); $contacts = array_merge($friends, $contacts); render("message_template.php", ["messages" => $messages, "contacts" => $contacts]); $db->sql_close();
<?php !defined('P_W') && exit('Forbidden'); if (empty($_POST['step'])) { S::gp(array('recall')); $friend = getFriends($winduid); if (empty($friend)) { Showmsg('no_friend'); } foreach ($friend as $key => $value) { $frienddb[$value['ftid']][] = $value; } $query = $db->query("SELECT * FROM pw_friendtype WHERE uid=" . S::sqlEscape($winduid) . " ORDER BY ftid"); $friendtype = array(); while ($rt = $db->fetch_array($query)) { $friendtype[$rt['ftid']] = $rt; } $no_group_name = getLangInfo('other', 'no_group_name'); $friendtype[0] = array('ftid' => 0, 'uid' => $winduid, 'name' => $no_group_name); require_once PrintEot('ajax'); ajax_footer(); } else { S::gp(array('selid')); if ($selid) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $memebers = $userService->getByUserIds($selid); foreach ($memebers as $rt) { $usernamedb[] = $rt['username']; } $usernamedbs = implode(",", $usernamedb);
//else{ if (is_uploaded_file($_FILES["file"]["tmp_name"])) { if (!move_uploaded_file($_FILES["file"]["tmp_name"], $upfile)) { $result = "6"; //Failed to move file from temporary directory $errortext = "failed to upload file, error code is {$result}"; } else { $title = $_POST['title']; $username = $_SESSION["username"]; $type = $_POST['type']; $catetory = $_POST['category']; $sharetype = $_POST['share']; $sharedfriends = array(); if ($sharetype == 1) { $arrBlock = split(',', str_replace(' ', '', $_POST['block'])); $friends = getFriends($username); foreach ($friends as $friend) { if (in_array($friend, $arrBlock)) { continue; } $sharedfriends[] = $friend; } } $path = $upfile; $detail = $_POST['description']; $candiscuss = isset($_POST['discuss']) ? 1 : 0; $canrate = isset($_POST['rate']) ? 1 : 0; $keywords = preg_replace('/\\s+/', '', $_POST['keywords']); //$keywords = ''; //foreach( $_POST['keyword'] as $word) { // $keywords .= $Keywords[$word]. ',';
} } else { if (!empty($_POST["foe"])) { if ($_POST["foe"] === $_SESSION["username"]) { $errortext_foe = "can't add yourself"; } else { if (existUser($_POST["foe"]) === 0) { $errortext_foe = "user " . $_POST["foe"] . " doesn't exist"; } else { addFoe($_SESSION["username"], $_POST["foe"]); $errortext_foe = "add foe successfully"; } } } } } $contacts = getContacts($_SESSION["username"]); $friends = getFriends($_SESSION["username"]); $foes = getFoes($_SESSION["username"]); render("contact_template.php", ["contacts" => $contacts, "friends" => $friends, "foes" => $foes, "errortext_contact" => $errortext_contact, "errortext_friend" => $errortext_friend, "errortext_foe" => $errortext_foe, "titile" => "Contact"]); } else { $contacts = getContacts($_SESSION["username"]); $friends = getFriends($_SESSION["username"]); $foes = getFoes($_SESSION["username"]); render("contact_template.php", ["contacts" => $contacts, "friends" => $friends, "foes" => $foes, "errortext_contact" => "", "errortext_friend" => "", "errortext_foe" => "", "titile" => "Contact"]); } } $db->sql_close(); ?>
$usr['entity'] = new HubbubEntity(); $usr['entity']->create($usr['erec'], true); $usr['id'] = $usr['entity']->ds['_key']; $u[] = $usr; $eidx[$usr['id']] = $usr['name']; } quickConnect($u[0]['id'], $u[1]['id']); quickConnect($u[0]['id'], $u[2]['id']); quickConnect($u[1]['id'], $u[3]['id']); quickConnect($u[4]['id'], $u[3]['id']); foreach($u as $usr) { $isFriend[$usr['id']][$usr['id']] = true; $friends[$usr['id']] = getFriends($usr['id']); foreach($friends[$usr['id']] as $frid) $isFriend[$usr['id']][$frid] = true; $line = $usr['name'].' ('.$usr['id'].') Friends: '.implode(', ', $friends[$usr['id']]); tlog(true, 'Connections '.$line, 'OK', 'fail'); } $post = new HubbubMessage('post'); $post->localUserEntity = $u[0]['id']; $post->owner($u[0]['erec']); $post->data['text'] = 'This is a realtime message. Umlauts like üöä should be preserved.'; $post->save(); tlog($post->ds['m_key'] > 0, 'Message created by user ('.$u[0]['id'].')', 'OK (#'.$post->ds['m_key'].')', 'fail'); // now let's see who has the message in their stream foreach($u as $usr)