Inheritance: extends Storage
Ejemplo n.º 1
0
 /**
  * Добавляет друга в группу
  * 
  * @param integer $friendID
  * @throws FriendsException Если пользователь не является другом
  * @throws FriendsException Если пользователь уже в группе
  */
 public function addFriend($friendID)
 {
     $friends = new Friends();
     if (!$friends->checkHasFriend($friendID)) {
         throw new FriendsException(FriendsException::FRND_NOT_EX, $friendID);
     }
     if (!$this->checkFriendInGroup($friendID)) {
         $this->_sql->query("INSERT INTO `USERS_FRIENDS_IN_GROUPS` VALUES(0,{$friendID},{$this->id})");
     } else {
         throw new FriendsException(FriendsException::GRP_FRND_CNT_ADD, $this->id);
     }
 }
Ejemplo n.º 2
0
 /**
  * check if values $_REQUEST[''] exist - then get friend by id (existing friend)
  * if values not exist then create a new friend (new friend)
  * @return array
  */
 protected function run()
 {
     if (array_key_exists('id', $_REQUEST) and $_REQUEST['id'] > 0) {
         $friend = Friends::getFriendByID($_REQUEST['id']);
     } else {
         $friend = new Friend();
     }
     /**
      * if $_POST_[""] is not empty then set the values into the template
      * else set error massage if one of the $_POST[""] is empty
      */
     if (!empty($_POST["name"]) and !empty($_POST["adress"]) and !empty($_POST["email"])) {
         $friend->setName($_POST["name"]);
         $friend->setAdress($_POST["adress"]);
         $friend->setEmail($_POST["email"]);
         /**
          * records can be saved after editing or creating
          * exit the program after a successful storage
          * error massage when email address exists because email address is unique
          */
         if ($friend->save()) {
             header('location:index.php?module=listoffriends');
             exit;
         } else {
             $var = array('fehler' => "Die Person existiert bereits in der Datenbank");
         }
     } elseif (!empty($_POST["name"]) or !empty($_POST["adress"]) or !empty($_POST["email"])) {
         $var = array('fehler' => "Es sind nicht alle Datenfelder ausgefüllt");
     }
     $var['friend'] = $friend;
     return $var;
 }
Ejemplo n.º 3
0
function render($twig, $sdata = array())
{
    if (!isset($_GET['steamid'])) {
        // no steamid given, f**k off
        echo $twig->render('404.php', $sdata);
        return false;
    }
    if ($_GET['steamid'] == $_SESSION['steamid'] || $_SESSION['admin'] === true) {
        // if you're looking at yourself you get your full history
        // same goes for admins
        $player = new Player(array('search' => $_GET['steamid'], 'fullhistory' => true));
    } else {
        // otherwise it's just the latest 10 runs
        $player = new Player(array('search' => $_GET['steamid']));
    }
    if ($player->steamid == false) {
        // no player found
        echo $twig->render('404.php', $sdata);
        return false;
    }
    // is this player our friend?
    $f = new Friends();
    $is_friend = $f->checkFriend($_SESSION['steamid'], $player->steamid);
    // add or remove him from our friends list
    if (isset($_GET['friend']) && !$is_friend) {
        $f->addFriend($_SESSION['steamid'], $player->steamid);
        $is_friend = !$is_friend;
        header("Location: /player/" . $player->steamid);
    } elseif (isset($_GET['friend']) && $is_friend) {
        $f->removeFriend($_SESSION['steamid'], $player->steamid);
        $is_friend = !$is_friend;
        header("Location: /player/" . $player->steamid);
    }
    // get followers
    $followers = $f->getFollowersForSteamId($player->steamid);
    // send out to render
    $data = array('player' => $player, 'is_friend' => $is_friend, 'followers' => $followers, 'stats' => $player->stats);
    if (isset($_GET['json'])) {
        print json_encode($data);
    } else {
        echo $twig->render('player.php', array_merge($sdata, $data));
    }
}
    /**
     * 
     * returns the comma separated id of user friends
     * if no friend exists it returns -1;
     */
    public static function getFriendIdList()
    {
        $sql = 'SELECT IF (friend1!=' . Yii::app()->user->id . ', friend1, friend2) as friend
				FROM ' . Friends::model()->tableName() . '
				WHERE (friend1 = ' . Yii::app()->user->id . '
					   OR friend2 = ' . Yii::app()->user->id . ') 
					  AND status = 1';
        $friendsResult = Yii::app()->db->createCommand($sql)->queryAll();
        $length = count($friendsResult);
        $friends = array();
        for ($i = 0; $i < $length; $i++) {
            array_push($friends, $friendsResult[$i]['friend']);
        }
        $result = -1;
        if (count($friends) > 0) {
            $result = implode(',', $friends);
        }
        return $result;
    }
Ejemplo n.º 5
0
<?php

require_once 'inc/bootstrap.inc.php';
require_once 'inc/guard.inc.php';
// Friends model
require_once dirname(__FILE__) . '/core/Friends.class.php';
$friendsModel = new Friends();
// Get friends
$friends = $friendsModel->getAllFriends($_SESSION['auth']['user_id'], 6);
shuffle($friends['friends']);
// Get friend requests
$friendRequests = $friendsModel->getFriendRequests($_SESSION['auth']['user_id']);
require_once 'templates/home.tpl.php';
Ejemplo n.º 6
0
        if (isset($_SESSION["persist_login"])) {
            Application::generateToken($_SESSION["steamid"]);
        }
    }
}
if (isset($_COOKIE['authtoken']) && !isset($_SESSION['steamid'])) {
    $steamid_login = Application::checkLogin($_COOKIE['authtoken']);
    if ($steamid_login) {
        $_SESSION["steamid"] = $steamid_login;
    }
}
// check session privileges
if (isset($_SESSION['steamid'])) {
    $_SESSION['admin'] = Admin::checkAdminPrivilege($_SESSION['steamid']);
    // handle friends list
    $f = new Friends();
    $friends = $f->getFriendsForSteamId($_SESSION['steamid']);
}
// handle steam oauth return
if (isset($_GET['return']) && isset($_SESSION['steamid'])) {
    header('Location: ' . $config['core']['uri'] . '/player/' . $_SESSION['steamid']);
}
// handle the /me url
if (isset($_GET['me'])) {
    if (isset($_SESSION['steamid'])) {
        header('Location: ' . $config['core']['uri'] . '/player/' . $_SESSION['steamid']);
    } else {
        echo $twig->render('404.php');
        exit;
    }
}
 public function clientByBranch()
 {
     $id = \Input::get('id');
     $list = \Friends::where('parent_id', '=', $id)->get();
     $option = "<option value=''>----Select Client-----</option><option value='in-house'>In House </option>";
     foreach ($list as $value) {
         $option .= "<option value='{$value->child_id}'>" . $value->user->company->company_name . "</option>";
         // $json[$value->child_id]=$value->user->company->company_name;
     }
     echo $option;
     return;
 }
Ejemplo n.º 8
0
     httpResponse($invite->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'friends'):
     $friends = new Friends($db, $user);
     httpResponse($friends->query());
     break;
 case validateRoute('POST', 'friends'):
     $friends = new Friends($db, $user);
     httpResponse($friends->create($postdata));
     break;
 case validateRoute('DELETE', 'friends/\\d+'):
     $friends = new Friends($db, $user);
     httpResponse($friends->delete((int) $params[1]));
     break;
 case validateRoute('PATCH', 'friends/\\d+'):
     $friends = new Friends($db, $user);
     httpResponse($friends->update((int) $params[1]), $postdata);
     break;
 case validateRoute('GET', 'blocked'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->query());
     break;
 case validateRoute('POST', 'blocked'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->create($postdata));
     break;
 case validateRoute('DELETE', 'blocked/\\d+'):
     $blocked = new Blocked($db, $user);
     httpResponse($blocked->delete((int) $params[1]));
     break;
 case validateRoute('GET', 'bookmarks'):
Ejemplo n.º 9
0
<?php

if (!isset($id)) {
    $id = "";
}
if ($user1->pol == 2) {
    $ending1 = "а";
    $ending2 = "ё";
} else {
    $ending1 = null;
    $ending2 = "го";
}
if ($page != "friends") {
    // Блок кода приведенный ниже подключается на странице friends.php, и здесь исключается возможность переопределения.
    $self = new Friends($user->id, $db);
    $selfFriendsIds = $self->getConfirmedFriends();
    $selfNotConfFriends = $self->getNotConfirmedFriends();
    $selfFriendsRequests = $self->getFriendsRequests();
    $requestsCount = count($selfFriendsRequests);
}
?>
<div class="leftUserBlock">
	<div class="userAvatar">
    	<img src="avatars/<? echo $user1->avatar; ?>" width="150px" height="150px">
	</div>
    <div class="userFunctions">
    	<ul>
			<? if ($id == $user->id || empty($id)) {?>
        		<li <? if($page == "im") echo "class='active'"; ?>><a href="im.php">Личные сообщения</a></li>
            <? } else {?>
            	<li><a href="im.php">Отправить сообщение</a></li>
 /**
  * shows all Friends in the output template
  * @return array
  */
 protected function run()
 {
     $var['friends'] = Friends::getAllFriends();
     return $var;
 }
Ejemplo n.º 11
0
 /**
  * Преобразует данные из объекта User в ассоциативный массив
  * 
  * @param User $usr
  * @return Array
  */
 public function getForView(&$usr)
 {
     $friender = new Friends();
     if ($usr != NULL) {
         foreach ($usr as $value) {
             $out["id"] = $value->id;
             $out["name"] = $value->name . " " . $value->secondName;
             $out["photo"] = $value->getPhoto();
             $out["online"] = $value->isOnline();
             $out["isFriend"] = $friender->checkHasFriend($value->id);
             $outer[] = $out;
         }
     }
     return $outer;
 }
Ejemplo n.º 12
0
 public function actionSetPrivacyRights()
 {
     if (isset($_REQUEST['groupId'])) {
         $groupId = (int) $_REQUEST['groupId'];
     }
     $model = new GroupPrivacySettingsForm();
     $processOutput = true;
     // collect user input data
     if (isset($_POST['GroupPrivacySettingsForm'])) {
         $model->attributes = $_POST['GroupPrivacySettingsForm'];
         if ($model->validate()) {
             //echo $_POST['GroupPrivacySettingsForm']['allowToSeeMyPosition'];
             //echo $model->allowToSeeMyPosition;
             if (isset($model->allowToSeeMyPosition)) {
                 //					if($model->allowToSeeMyPosition) //Checked
                 //					{
                 //						echo 'CHECKED';
                 //					}
                 //					else //Unchecked
                 //					{
                 //						echo 'UNCHECKED';
                 //					}
                 if (Groups::model()->updateByPk($groupId, array("allowedToSeeOwnersPosition" => $model->allowToSeeMyPosition)) >= 0) {
                     //echo 'SAVED';
                     $errorOccured = false;
                     //Take all the user-group relation rows that the selected group added to
                     $relationRowsSelectedGroupBelongsTo = UserGroupRelation::model()->findAll('groupId=:groupId', array(':groupId' => $groupId));
                     //Get only the user ID fields into $group_members from the obtained rows
                     foreach ($relationRowsSelectedGroupBelongsTo as $relationRow) {
                         $friendship = Friends::model()->find(array('condition' => '(friend1=:friend1Id AND friend2=:friend2Id) OR (friend1=:friend2Id AND friend2=:friend1Id)', 'params' => array(':friend1Id' => Yii::app()->user->id, ':friend2Id' => $relationRow->userId)));
                         if ($friendship != null) {
                             if ($friendship->friend1 == Yii::app()->user->id) {
                                 $friendship->friend1Visibility = $model->allowToSeeMyPosition;
                             } else {
                                 $friendship->friend2Visibility = $model->allowToSeeMyPosition;
                             }
                             if ($friendship->save()) {
                                 //Privacy setting saved
                             } else {
                                 $errorOccured = true;
                                 //									if($friendship->friend1 == Yii::app()->user->id)
                                 //									{
                                 //										echo 'f1:user - f2:'.$relationRow->userId.' cannot be saved';
                                 //									}
                                 //									else
                                 //									{
                                 //										echo 'f1:'.$relationRow->userId.' - f2:user cannot be saved';
                                 //									}
                             }
                         } else {
                             //The friendship between the logged in user and $relationRow->userId not found
                             $errorOccured = true;
                             //echo 'friendship does not exist';
                         }
                     }
                     if ($errorOccured == false) {
                         echo CJSON::encode(array("result" => "1"));
                     } else {
                         echo CJSON::encode(array("result" => "0"));
                     }
                     Yii::app()->end();
                 } else {
                     echo CJSON::encode(array("result" => "0"));
                     Yii::app()->end();
                 }
             } else {
                 //$model->allowToSeeMyPosition is UNSET
             }
         }
         if (Yii::app()->request->isAjaxRequest) {
             $processOutput = false;
         }
     } else {
         $group = Groups::model()->findByPk($groupId);
         $model->allowToSeeMyPosition = $group->allowedToSeeOwnersPosition;
     }
     Yii::app()->clientScript->scriptMap['jquery.js'] = false;
     Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
     $this->renderPartial('groupPrivacySettings', array('model' => $model, 'groupId' => $groupId), false, $processOutput);
 }
Ejemplo n.º 13
0
<?php

require_once 'classes/friends.php';
$friends = new Friends();
$action = isset($_GET['action']) ? $_GET['action'] : '';
if ($action == "add") {
    $id = (int) $_GET['friendid'];
    $userid = $_SESSION['userid'];
    $add = $friends->addFriend($id, $userid);
    if ($add < 0) {
        $msg = 'Failed to add this friend to your friends list.';
        return;
    }
    if (empty($add)) {
        event::fire('USER_ADD_FRIEND');
        $msg = "An email has been sent to your friend for confirmation!";
        $friends->sendFriendVerification($userid, $id);
    } else {
        $msg = $add;
    }
    return $msg;
}
if ($action == "remove") {
    $id = (int) $_GET['friendid'];
    $userid = $_SESSION['userid'];
    $add = $friends->removeFriend($id, $userid);
    if ($remove < 0) {
        $msg = 'Failed to remove this friend from your friends list.';
        return;
    }
    if (empty($remove)) {
Ejemplo n.º 14
0
Archivo: right.php Proyecto: Klym/flame
                                    <div id='userLogin'><a href="page.php"><? echo $user->login ?></a></div>
                                </div>
                                <div id='bottomInfo'>
                                    <p>Имя: <strong><? echo $user->name.' '.$user->fam; ?></strong></p>
                                    <p>Группа: <strong><? echo $user->access; ?></strong></p>
                                    <p>E-Mail: <strong><? echo $user->email; ?></strong></p>
                                    <p>Ваш ip: <strong><? echo $_SERVER['REMOTE_ADDR']; ?></strong></p>
                                    <p>Вы пользователь №<strong><? echo $user->id; ?></strong></p>
                                    <p>Личных сообщений: <strong>0</strong></p>
                                </div>
                            </div>
                            <div id='pdaSsyl'>
                                <?
									// Количество заявок в друзья в блоке PDA следует выводить, только если пользователь находится за пределами страниц с личной информацией. Все страницы, не включая личных - индексируются, и для них определен отдельный класс Page. $page на всех личных страницах имеет тип string, а на индексируемых - object и является экземпляром класса Page.
                                    if ($page instanceof Page) {
                                        $friends = new Friends($user->id,$db);
                                        $requestsCount = count($friends->getFriendsRequests());
                                    }
                                ?>
                                <a href='page.php'>Моя страница<? if($requestsCount > 0 && $page instanceof Page) echo " (+".$requestsCount.")";?></a>                                     
                                <a href='exit.php'>Выход</a>                                            
                            </div>
                            <? } ?>
                        </div>
                    </div>
                </div>
                <div class="rightBlockFooter"></div>
            </div>
        </div>
        <div class='rightBlock'>
            <div class="rightBlockHeader">Мини-чат</div>
Ejemplo n.º 15
0
    if ($login->errors) {
        foreach ($login->errors as $error) {
            // echo $error;
            echo "<script>console.log('PHP: " . json_encode($error) . "');</script>";
        }
    }
    if ($login->messages) {
        foreach ($login->messages as $message) {
            // echo $message;
            echo "<script>console.log('PHP: " . json_encode($message) . "');</script>";
        }
    }
}
require_once "../../config/db.php";
require_once "Friends.php";
$friends = new Friends();
?>
<!doctype html>
<html lang="en"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Group Finder</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="/css/roboto.css"/>
    <link rel="stylesheet" type="text/css" href="/css/material.css"/>
    <link rel="stylesheet" type="text/css" href="/css/ripples.css"/>
    <link rel="stylesheet" type="text/css" href="/css/dashboard.css"/>
    <!-- <link rel="stylesheet" type="text/css" href="/css/selectize.css"/> -->
    <!-- <link rel="stylesheet" type="text/css" href="/css/timeline-style.css"/> -->
Ejemplo n.º 16
0
<?php

session_start();
require "blocks/autoload.php";
require "blocks/db.php";
require "blocks/user.php";
$data = file_get_contents("php://input");
$data = json_decode($data);
$friend = new Friends($user->id, $db, $data[1]);
if ($data[0] == 0) {
    $friend->delFriend();
} else {
    $result = $friend->addFriend();
    echo $result;
}
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFriends0()
 {
     return $this->hasMany(Friends::className(), ['customer_user_name2' => 'customer_user_name']);
 }
Ejemplo n.º 18
0
 /**
  * Unfollow / stop being a fan of user X
  *
  * @param int $unfollow - user to stop following
  * @return bool
  */
 public function unfollow($user_id = 0)
 {
     $friends = Friends::instance();
     return $friends->updateFriends($this, $user_id, 'unfollow');
 }
 public function actionRejectFrienshipRequest()
 {
     $output = array('errno' => 0, 'html' => '');
     //check session
     if (!Yii::app()->user->isGuest) {
         //check friendship exist
         if ($this->are_they_friends) {
             //Update status of frienship
             $condition = "(from_user = :user_knight1 AND to_user = :knight1 AND status = :status1) OR (from_user = :knight2 AND to_user = :user_knight2 AND status = :status2)";
             $params = array(':knight1' => $this->knight->users_id, ':knight2' => $this->knight->users_id, ':user_knight1' => $this->user_data['knights']->users_id, ':user_knight2' => $this->user_data['knights']->users_id, ':status1' => Friends::STATUS_ACCEPT, ':status2' => Friends::STATUS_ACCEPT);
             $friendRelationship = Friends::model()->find($condition, $params);
             $friendRelationship->delete_by_user = Yii::app()->user->users_id;
             $friendRelationship->end_date = date('Y-m-d H:i:s');
             if ($friendRelationship->from_user == Yii::app()->user->users_id) {
                 $friendRelationship->status = Friends::STATUS_FINISHED_BY_SENDER;
             } else {
                 $friendRelationship->status = Friends::STATUS_FINISHED_BY_RECEIVER;
             }
             if ($friendRelationship->save()) {
                 $output['errno'] = 0;
                 $output['html'] = '<p>Seguro que le has partido el corazón. Ya no sois amigos.</p>';
             } else {
                 $output['html'] = $this->renderPartial('dialog_confirmRejectFrienshipRequest');
                 Yii::trace('[CHARACTER][actionConfirmRejectFrienshipRequest] No se puede actualizar la relación de amistad para terminarla.', 'error');
             }
         } else {
             $output['html'] = '<p>Sir ' . $this->knight->name . ' y tú no sois amigos.</p>';
         }
     } else {
         $output['html'] = '<p>La sessión ha expirado. Debes volver a hacer login.</p>';
     }
     //Show output
     echo CJSON::encode($output);
 }
Ejemplo n.º 20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //transaction strats
     \DB::beginTransaction();
     //delete user in user table
     $userDel = \User::find($id);
     if (!$userDel->delete()) {
         \DB::rollback();
         return \Redirect::back()->with('error', 'Failed to delete');
     }
     //delete user from friends table
     $friendDel = \Friends::where('child_id', '=', $id)->first();
     if (!$friendDel->delete()) {
         \DB::rollback();
         return \Redirect::back()->with('error', 'Failed to delete');
     }
     //delete clients company
     $companyDel = \Company::where('user_id', '=', $id)->first();
     if (!$companyDel->delete()) {
         \DB::rollback();
         return \Redirect::back()->with('error', 'Failed to delete');
     } else {
         \DB::commit();
         return \Redirect::back()->with('success', 'Successfully deleted');
     }
 }
Ejemplo n.º 21
0
    if ($login->errors) {
        foreach ($login->errors as $error) {
            // echo $error;
            echo "<script>console.log('PHP: " . json_encode($error) . "');</script>";
        }
    }
    if ($login->messages) {
        foreach ($login->messages as $message) {
            // echo $message;
            echo "<script>console.log('PHP: " . json_encode($message) . "');</script>";
        }
    }
}
require_once "../../config/db.php";
require_once "Friends.php";
$friends = new Friends();
?>
<!doctype html>
<html lang="en"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Group Finder</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="/css/roboto.css"/>
    <link rel="stylesheet" type="text/css" href="/css/material.css"/>
    <link rel="stylesheet" type="text/css" href="/css/ripples.css"/>
    <link rel="stylesheet" type="text/css" href="/css/dashboard.css"/>
    <!-- <link rel="stylesheet" type="text/css" href="/css/selectize.css"/> -->
    <!-- <link rel="stylesheet" type="text/css" href="/css/timeline-style.css"/> -->
Ejemplo n.º 22
0
<?php

#####################################################
/**
 * The page settings
 */
require 'config.php';
//Configuration settings
require $baseDir . 'includes/standard_page_load.php';
//Loads most common features (i.e. Facebook api)
$title = 'Followers';
//The page title
$Friends = new Friends($user["id"], $Database);
//Instantiate the friends class
#####################################################
/**
 * Start the html of the page with the page header
 */
require $baseDir . 'includes/templates/page_header.php';
//The html for the heading of the page
?>

	<div class="wrapper">
		<?php 
require $baseDir . 'includes/templates/left_menu.php';
/*Display the default left menu*/
?>
			
		<!--START TIMELINE-->
		<div class="container">
			<div class="top-heading">
Ejemplo n.º 23
0
});
/* Handle get my requested friends */
$app->get('/user/me/friends/requested', function ($request, $response) {
    $token = parseToken($request);
    return Friends::requested($response, $token);
});
/* Handle get my friends */
$app->get('/user/me/friends', function ($request, $response) {
    $token = parseToken($request);
    return Friends::get($response, $token, null);
});
/* Handle get user accepted friends */
$app->get('/user/{id:[0-9]+}/friends', function ($request, $response, $args) {
    $token = parseToken($request);
    $friend_id = $args['id'];
    return Friends::get($response, $token, $friend_id);
});
/* Handle like post */
$app->put('/post/{id:[0-9]+}/like', function ($request, $response, $args) {
    $token = parseToken($request);
    $post_id = $args['id'];
    return Posts::like($response, $token, $post_id);
});
/* Handle dislike post */
$app->delete('/post/{id:[0-9]+}/like', function ($request, $response, $args) {
    $token = parseToken($request);
    $post_id = $args['id'];
    return Posts::dislike($response, $token, $post_id);
});
/* Handle get post likes */
$app->get('/post/{id:[0-9]+}/like', function ($request, $response, $args) {
Ejemplo n.º 24
0
<?php

session_start();
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
require_once dirname(__FILE__) . "/../lib/DB.class.php";
require_once dirname(__FILE__) . "/../lib/User.class.php";
require_once dirname(__FILE__) . "/../lib/Login.class.php";
require_once dirname(__FILE__) . "/../lib/Post.class.php";
require_once dirname(__FILE__) . "/../lib/friends.class.php";
$user = new User();
$login = new Login();
$post = new Post();
$friends = new Friends();
//UPLOAD PROFILE PHOTO
$app->post('/upload/profile', function () {
    global $user, $app;
    if ($_FILES) {
        $type = pathinfo("../cover-pics/" . $_FILES["pic"]["name"], PATHINFO_EXTENSION);
        if ($type !== "jpg" && $type !== "png" && $type !== "jpeg" && $type !== "gif") {
            echo "notimage";
        } else {
            $file = explode("/", $_FILES["pic"]["type"]);
            if (file_exists("../user-pics/" . $_FILES["pic"]["name"])) {
                echo "imageexists";
            } else {
                if ($_FILES["pic"]["size"] > 500000) {
                    echo "toobig";
                } else {
                    move_uploaded_file($_FILES["pic"]["tmp_name"], "../user-pics/" . $_FILES["pic"]["name"]);
Ejemplo n.º 25
0
								</table>
								</marquee>
									 </td>
								</tr>
								
							</table>
						<?php 
?>
					</tr>
				</table>
			</div>
			<div class="green_content_bottom">
			</div>
		</div>
		<?php 
$friends = new Friends();
$friends->setFriends($_GET['user']);
if ($friends->num_top_friends > 0) {
    ?>
		<div class="green_contentbox">
			<div class="green_content_top">
				<h3 class="content_box_header">Friend Space - Top Friends</h3>
			</div>
			<div class="green_content">
				<table width="95%"  cellspacing="0">
					<tr>
						<?php 
    if ($friends->num_top_friends < 8) {
        for ($i = 1; $i <= 8; $i++) {
            if ($friends->top_friends[$i]) {
                echo '<td>';
Ejemplo n.º 26
0
 public static function clientByBranch($id)
 {
     $list = \Friends::where('parent_id', '=', $id)->get();
     return $list;
 }
Ejemplo n.º 27
0
<?php

require_once 'inc/bootstrap.inc.php';
require_once 'inc/guard.inc.php';
// Users model
require_once dirname(__FILE__) . '/core/Users.class.php';
$usersModel = new User();
// Friends model
require_once dirname(__FILE__) . '/core/Friends.class.php';
$friendsModel = new Friends();
// Get viewed user
$viewedUser = $usersModel->getUserById((int) $_GET['user_id']);
// Get friends
$friendsAll = $friendsModel->getAllFriends($viewedUser['user_id'])['friends'];
// Get friends
$friends = $friendsModel->getAllFriends($viewedUser['user_id'], 6);
shuffle($friends['friends']);
// Get friend requests
$friendRequests = $friendsModel->getFriendRequests($_SESSION['auth']['user_id']);
$page['friends_box_title'] = 'Friends';
$page['is_me'] = (int) $viewedUser['user_id'] === (int) $_SESSION['auth']['user_id'];
$page['viewed_user'] = $viewedUser;
$page['friend'] = $friendsModel->getFriendStatus($_SESSION['auth']['user_id'], $viewedUser['user_id']);
require_once 'templates/friends.tpl.php';
Ejemplo n.º 28
0
<?php

require_once 'inc/bootstrap.inc.php';
require_once 'inc/guard.inc.php';
// Friends model
require_once dirname(__FILE__) . '/core/Friends.class.php';
$friendsModel = new Friends();
// Get friends
$friends = $friendsModel->getAllFriends($_SESSION['auth']['user_id'], 6);
shuffle($friends['friends']);
// Get friend requests
$friendRequests = $friendsModel->getFriendRequests($_SESSION['auth']['user_id']);
$notifications = $friendsModel->getNotifications();
require_once 'templates/notifications.tpl.php';
Ejemplo n.º 29
0
$selfNotConfFriends = $self->getNotConfirmedFriends();
$selfFriendsRequests = $self->getFriendsRequests();
$friendsCount = count($selfFriendsIds);
$requestsCount = count($selfFriendsRequests);
if ($id != $user->id && !empty($id)) {
    try {
        $user1 = new User();
        $user1->db = $db;
        $user1->getUserInfo($id);
    } catch (DataException $e) {
        die(require "blocks/errorTemplate.php");
    }
} else {
    $user1 = $user;
}
$friend = new Friends($user1->id, $db);
if ($position == "requests" && empty($id)) {
    $friendsIds = $selfFriendsRequests;
} else {
    $friendsIds = $friend->getConfirmedFriends();
    $friendsCount = count($friendsIds);
}
for ($i = 0; $i < count($friendsIds); $i++) {
    $friend->getFriendInfo($friendsIds[$i]);
}
$friends = Friends::$friend;
$endings = array('г', 'га', 'зей');
?>
<!DOCTYPE html>
<html>
<head>
Ejemplo n.º 30
0
<?php

if (session_id() === "" && $_SESSION['user_login_status'] != 1) {
    session_start();
}
// include the configs / constants for the database connection
require_once "../../config/db.php";
require_once "Friends.php";
$friends = new Friends();
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>

	<link rel="stylesheet" type="text/css" href="/css/bootstrap.css"/>
  	<link rel="stylesheet" type="text/css" href="/css/roboto.css"/>
  	<link rel="stylesheet" type="text/css" href="/css/material.css"/>
  	<link rel="stylesheet" type="text/css" href="/css/ripples.css"/>
	<link rel="stylesheet" href="/css/reset.css"> <!-- CSS reset -->
	<link rel="stylesheet" href="/css/contentFilter-style.css"> <!-- Resource style -->
	<script src="/js/modernizr.js"></script> <!-- Modernizr -->
	<script type="text/javascript" src="/js/jquery.js"></script>
	<title>Group Finder</title>
	<script type="text/javascript">
	function addFriend(friend){
	   $.ajax({
		   type:"post",