public function _index()
 {
     $infor = new profile();
     $pro = $infor->_getprofile();
     $this->values = array("user" => $_SESSION["USER"], "birth" => $pro->Birthday, "desc" => $pro->Desc, "gender" => $pro->Sex, "userid" => $_SESSION["USERID"], "nickname" => $_SESSION['NICK'], "title" => "我的Pic-ACGPIC");
     $this->RenderTemplate('user');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, $id = null)
 {
     $user = Auth::user();
     $validator = Validator::make($request->all(), ['firstname' => 'required', 'lastname' => 'required', 'country' => 'required', 'street' => 'required', 'email' => 'required', 'city' => 'required', 'state' => 'required', 'city' => 'required', 'postcode' => 'required', 'phone' => 'required']);
     if ($validator->fails()) {
         return Redirect::to('profile/create')->withErrors($validator)->withInput();
     } else {
         $profile = new profile();
         $profile->firstname = Input::get('firstname');
         $profile->lastname = Input::get('lastname');
         $profile->id_country = Input::get('country');
         $profile->street = Input::get('street');
         $profile->optionals = Input::get('optionals');
         $profile->email = Input::get('email');
         $profile->city = Input::get('city');
         $profile->state = Input::get('state');
         $profile->postcode = Input::get('postcode');
         $profile->phone = Input::get('phone');
         $profile->note = Input::get('note');
         if (!empty($user->id)) {
             $profile->id_user = $user->id;
         }
         $profile->save();
         return redirect('profile/detail/')->with('message', 'You have done successfully');
     }
 }
Example #3
0
 public function getPeopleNearby($itemId, $lat, $lng, $distance = 30)
 {
     if ($itemId == 0) {
         $itemId = $this->getMaxId();
         $itemId++;
     }
     $result = array("error" => false, "error_code" => ERROR_SUCCESS, "itemId" => $itemId, "items" => array());
     $tableName = "users";
     $origLat = $lat;
     $origLon = $lng;
     $dist = $distance;
     // This is the maximum distance (in miles) away from $origLat, $origLon in which to search
     $sql = "SELECT id, lat, lng, 3956 * 2 *\r\n          ASIN(SQRT( POWER(SIN(({$origLat} - lat)*pi()/180/2),2)\r\n          +COS({$origLat}*pi()/180 )*COS(lat*pi()/180)\r\n          *POWER(SIN(({$origLon}-lng)*pi()/180/2),2)))\r\n          as distance FROM {$tableName} WHERE\r\n          lng between ({$origLon}-{$dist}/cos(radians({$origLat}))*69)\r\n          and ({$origLon}+{$dist}/cos(radians({$origLat}))*69)\r\n          and lat between ({$origLat}-({$dist}/69))\r\n          and ({$origLat}+({$dist}/69))\r\n          and (id < {$itemId})\r\n          and (id <> {$this->requestFrom})\r\n          and (state = 0)\r\n          having distance < {$dist} ORDER BY id DESC limit 20";
     $stmt = $this->db->prepare($sql);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             while ($row = $stmt->fetch()) {
                 $profile = new profile($this->db, $row['id']);
                 $profile->setRequestFrom($this->requestFrom);
                 $profileInfo = $profile->get();
                 $profileInfo['distance'] = round($this->getDistance($lat, $lng, $profileInfo['lat'], $profileInfo['lng']), 1);
                 unset($profile);
                 array_push($result['items'], $profileInfo);
                 $result['itemId'] = $row['id'];
                 unset($profile);
             }
         }
     }
     return $result;
 }
 public function getAll($notifyId = 0)
 {
     if ($notifyId == 0) {
         $notifyId = $this->getMaxId();
         $notifyId++;
     }
     $notifications = array("error" => false, "error_code" => ERROR_SUCCESS, "notifyId" => $notifyId, "notifications" => array());
     $stmt = $this->db->prepare("SELECT * FROM notifications WHERE notifyToId = (:notifyToId) AND id < (:notifyId) ORDER BY id DESC LIMIT 20");
     $stmt->bindParam(':notifyToId', $this->requestFrom, PDO::PARAM_INT);
     $stmt->bindParam(':notifyId', $notifyId, PDO::PARAM_INT);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             while ($row = $stmt->fetch()) {
                 $time = new language($this->db, $this->language);
                 if ($row['notifyFromId'] == 0) {
                     $profileInfo = array("id" => 0, "state" => 0, "username" => "", "fullname" => "", "lowPhotoUrl" => "/img/profile_default_photo.png");
                 } else {
                     $profile = new profile($this->db, $row['notifyFromId']);
                     $profileInfo = $profile->get();
                     unset($profile);
                 }
                 $data = array("id" => $row['id'], "type" => $row['notifyType'], "itemId" => $row['itemId'], "fromUserId" => $profileInfo['id'], "fromUserState" => $profileInfo['state'], "fromUserUsername" => $profileInfo['username'], "fromUserFullname" => $profileInfo['fullname'], "fromUserPhotoUrl" => $profileInfo['lowPhotoUrl'], "createAt" => $row['createAt'], "timeAgo" => $time->timeAgo($row['createAt']));
                 array_push($notifications['notifications'], $data);
                 $notifications['notifyId'] = $row['id'];
                 unset($data);
             }
         }
     }
     return $notifications;
 }
Example #5
0
 public function userindex($uid)
 {
     //if($uid==$_SESSION['USERID'])
     //    header("Location:"."/home");
     $username = $this->getuserbyid($uid);
     $friendlist = new friend();
     $flist = $friendlist->_getfriend($uid);
     $isFriends = $friendlist->isFriends($uid);
     $prof = new profile();
     $desc = $prof->getdesc($uid);
     $imggroup = new imagegroup();
     $cover = $imggroup->getCoverByID($uid);
     $this->values = array("user" => $_SESSION["USER"], "userid" => $_SESSION['USERID'], "nickname" => $_SESSION['NICK'], "thisuserid" => $uid, "friends" => $flist, "thisdesc" => $desc, "isfriends" => $isFriends, "cover" => $cover, "thisnickname" => $username, "title" => $username . "的个人空间");
     $this->RenderTemplate("user");
 }
Example #6
0
 /**
  * @param int $newprofileId new value of profile id
  * @throws InvalidArgumentException if profile id is not an integer
  * @throws RangeException if profile id is negative
  **/
 public function setTrackId($trackId)
 {
     if ($newTrackId === null) {
         $this->profileId = null;
         return;
     }
     $newTrackId = filter_var($newTrackId, FILTER_VALIDATE_INT);
     if ($newTrackId == false) {
     }
     if ($newTrackId <= 0) {
         throw new RangeException("track id must be positve");
     }
     $this->trackId = $newTrackId;
     $track = new profile();
     //default, empty object
     $track->setProfileId(32);
     $track->setTrackId(128);
 }
Example #7
0
 public function getLeaderboard($limit = 10)
 {
     $widget = $limit == 10;
     // Is there cache
     if ($widget && ($cache = $this->app->cache->get('scoreboard', 1))) {
         return json_decode($cache);
     }
     $sql = 'SELECT users.user_id, username, score, (users_medals.user_id IS NOT NULL) AS donator, profile.gravatar,
                 IF (profile.gravatar = 1, users.email, profile.img) as `image`
                 FROM users
                 LEFT JOIN users_profile profile
                 ON users.user_id = profile.user_id
                 LEFT JOIN users_priv
                 ON users_priv.user_id = users.user_id
                 LEFT JOIN users_medals
                 ON users.user_id = users_medals.user_id AND users_medals.medal_id = (SELECT medal_id FROM medals WHERE label = "Donator")
                 WHERE COALESCE(show_leaderboard, 1) = 1
                 ORDER BY score DESC, user_id ASC
                 LIMIT ' . $limit;
     $st = $this->app->db->prepare($sql);
     $st->execute();
     $board = $st->fetchAll();
     $found = false;
     for ($n = 0; $n < ($widget ? 3 : count($board)); $n++) {
         $user = $board[$n];
         if (isset($user->image)) {
             $gravatar = isset($user->gravatar) && $user->gravatar == 1;
             $user->image = profile::getImg($user->image, $widget ? 18 : 22, $gravatar);
         } else {
             $user->image = profile::getImg(null, $widget ? 18 : 22);
         }
         if ($user->user_id == $this->app->user->uid) {
             $user->highlight = true;
             $found = true;
         }
     }
     if (!$widget && !$found) {
         // find users position
         $sql = 'SELECT COUNT(user_id) AS `position` FROM users WHERE score > :score';
         $st = $this->app->db->prepare($sql);
         $st->execute(array(':score' => $this->app->user->score));
         $result = $st->fetch();
         $result->extra = true;
         $result->highlight = true;
         $result->score = $this->app->user->score;
         $result->username = $this->app->user->username;
         $result->donator = $this->app->user->donator;
         $result->image = $this->app->user->image;
         $board[$limit] = $result;
     }
     // Cache
     if ($widget) {
         $this->app->cache->set('scoreboard', json_encode($board));
     }
     return $board;
 }
 public function query($queryText = '', $userId = 0, $gender = -1, $online = -1, $ageFrom = 13, $ageTo = 110)
 {
     $originQuery = $queryText;
     if ($userId == 0) {
         $userId = $this->lastIndex();
         $userId++;
     }
     $endSql = " ORDER BY regtime DESC LIMIT 20";
     $genderSql = "";
     if ($gender != -1) {
         $genderSql = " AND sex = {$gender}";
     }
     $onlineSql = "";
     if ($online != -1) {
         $current_time = time() - 15 * 60;
         $onlineSql = " AND last_authorize > {$current_time}";
     }
     $current_year = date("Y");
     $fromYear = $current_year - $ageFrom;
     $toYear = $current_year - $ageTo;
     $dateSql = " AND bYear < {$fromYear} AND bYear > {$toYear}";
     $users = array("error" => false, "error_code" => ERROR_SUCCESS, "itemCount" => $this->getCount($originQuery, $gender, $online, $ageFrom, $ageTo), "userId" => $userId, "query" => $originQuery, "users" => array());
     $queryText = "%" . $queryText . "%";
     $sql = "SELECT id, regtime FROM users WHERE state = 0 AND (login LIKE '{$queryText}' OR fullname LIKE '{$queryText}' OR email LIKE '{$queryText}' OR country LIKE '{$queryText}') AND id < {$userId}" . $genderSql . $onlineSql . $dateSql . $endSql;
     $stmt = $this->db->prepare($sql);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             while ($row = $stmt->fetch()) {
                 $profile = new profile($this->db, $row['id']);
                 $profile->setRequestFrom($this->requestFrom);
                 array_push($users['users'], $profile->get());
                 $users['userId'] = $row['id'];
                 unset($profile);
             }
         }
     }
     return $users;
 }
    public function load()
    {
        global $DB;
        global $user;
        $profile = new profile();
        $profile->load($user->profile);
        $profile_menus = implode(",", $profile->menus);
        if ($DB->query('SELECT * 
						 FROM nv_menus
						WHERE id IN (' . $profile_menus . ')
						  AND enabled = 1')) {
            $data = $DB->result();
            $menu_pos = $DB->result('id');
            for ($pm = 0; $pm < count($profile->menus); $pm++) {
                $p = array_search($profile->menus[$pm], $menu_pos);
                if ($p === false) {
                    continue;
                }
                $this->menus[] = $data[$p];
                $this->menus[count($this->menus) - 1]->items = $this->load_items($data[$p]->id, json_decode($data[$p]->functions));
            }
        }
    }
 public function getFriends()
 {
     // Get items
     $sql = "SELECT notification_id AS id, users.user_id AS uid, item_id, type,\n                               users_notifications.time AS timestamp, seen, username,\n                               profile.gravatar, IF (profile.gravatar = 1, users.email , profile.img) as `image`\n                               FROM users_notifications\n                               LEFT JOIN users\n                               ON users_notifications.from_id = users.user_id\n                               LEFT JOIN users_profile profile\n                               ON profile.user_id = users.user_id\n                               WHERE users_notifications.user_id = :uid\n                               AND `type` = 'friend'\n                               ORDER BY users_notifications.time DESC";
     $st = $this->app->db->prepare($sql);
     $st->bindParam(":uid", $this->app->user->uid);
     $st->execute();
     $result = $st->fetchAll();
     // Loop items, get details and create images
     foreach ($result as $key => &$res) {
         if ($res->type == 'friend') {
             // status
             $st = $this->app->db->prepare("SELECT status\n                        FROM users_friends\n                        WHERE user_id = :friend_id AND friend_id = :uid\n                        LIMIT 1");
             $st->execute(array(':uid' => $this->app->user->uid, ':friend_id' => $res->uid));
             $st->setFetchMode(PDO::FETCH_INTO, $res);
             $st->fetch();
             if ($res->status == true) {
                 unset($result[$key]);
                 continue;
             }
         }
         // Parse title
         if (isset($res->title)) {
             $res->title = $this->app->parse($res->title, false);
         }
         // Profile images
         if (isset($res->image)) {
             $gravatar = isset($res->gravatar) && $res->gravatar == 1;
             $res->img = profile::getImg($res->image, 28, $gravatar);
         } else {
             $res->img = profile::getImg(null, 28);
         }
         unset($res->image);
         unset($res->gravatar);
         unset($res->id);
         unset($res->item_id);
         $res->timestamp = $this->app->utils->fdate($res->timestamp);
     }
     $result = array_values($result);
     return $result;
 }
Example #11
0
                    <tr id="archive" bgcolor="">

                        <td nowrap width="45"  id=""><span class="whitetext_md"><B>&nbsp;Name / Title</B><hr></td>

                        <td nowrap width="45"><span class="whitetext_md"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Added</b><Hr></span></td>

                        <td nowrap width="45" ><span class="whitetext_md"><b>Expires</b><hr></span></td>

                        <td nowrap width="45"><span class="whitetext_md"><b>Hits</b><hr></span></td>

                        <td nowrap width="45"><span class="whitetext_md"><b>Syntax</b><hr></span></td>

                    </tr>

                    <tr><?$userpost = new profile(); $userpost->userspost($profieid)?>
      

                    </tr>

                </table>



                <Br><Br>





            </div>
Example #12
0
 *      altered character profile initialization to remove redundant query
 ***************************************************************************/
define('INCHARBROWSER', true);
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/global.php";
include_once "include/language.php";
include_once "include/functions.php";
//if character name isnt provided post error message and exit
if (!$_GET['char']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_NO_CHAR']);
} else {
    $charName = $_GET['char'];
}
//character initializations - rewritten 9/28/2014
$char = new profile($charName);
//the profile class will sanitize the character name
$charID = $char->char_id();
$name = $char->GetValue('name');
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id());
//block view if user level doesnt have permission
if ($mypermission['corpses']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_ITEM_NO_VIEW']);
}
// pull the characters corpses from the DB
$query = "SELECT zone.short_name, zone.zoneidnumber, character_corpses.isburried, character_corpses.x, character_corpses.y, character_corpses.rezzed, character_corpses.timeofdeath FROM zone, character_corpses WHERE character_corpses.charid = " . $charID . " AND zone.zoneidnumber = character_corpses.zoneid ORDER BY character_corpses.timeofdeath DESC;";
if (defined('DB_PERFORMANCE')) {
    dbp_query_stat('query', $query);
}
//added 9/28/2014
$results = mysql_query($query);
Example #13
0
 public function getThread($thread_id, $page = 1, $limit = 10, $admin = false)
 {
     $sql = "SELECT thread.thread_id AS `id`, thread.title, thread.slug, thread.deleted, thread.closed, thread.sticky,\n                    section.slug AS section_slug, replies.count AS replies, COALESCE(forum_users.watching, 0) AS `watching`, IF(section.priv_level,IF(users_levels.level_id > 0, 1, 0),1) AS `access`\n                    FROM forum_threads thread\n                    LEFT JOIN forum_users\n                    ON forum_users.thread_id = thread.thread_id AND forum_users.user_id = :uid\n                    LEFT JOIN forum_sections section\n                    ON section.section_id = thread.section_id\n                    LEFT JOIN (SELECT `thread_id`, count(*)-1 AS `count` FROM forum_posts WHERE deleted = 0 GROUP BY `thread_id`) replies\n                    ON replies.thread_id = thread.thread_id\n                    LEFT JOIN users_levels\n                    ON users_levels.user_id = :uid AND users_levels.completed > 0 AND users_levels.level_id = section.priv_level\n                    WHERE thread.thread_id = :thread_id AND (thread.section_id != 95 && (thread.section_id < 100 || thread.section_id > 233)) AND thread.deleted = 0\n                    LIMIT 1";
     $st = $this->app->db->prepare($sql);
     $st->execute(array(':thread_id' => $thread_id, ':uid' => $this->app->user->uid));
     $thread = $st->fetch();
     if (!$thread) {
         return false;
     }
     // does the user have access
     if (!$thread->access) {
         return false;
     }
     $thread->title = $this->app->parse($thread->title, false);
     if ($thread->closed) {
         $thread->title = '[closed] ' . $thread->title;
     }
     if ($thread->sticky) {
         $thread->title = '[sticky] ' . $thread->title;
     }
     // Get question
     $st = $this->app->db->prepare("SELECT post.post_id, users.user_id, users.username, post.body, post.posted, post.updated AS edited, profile.forum_signature AS signature,\n                profile.gravatar, IF (profile.gravatar = 1, users.email , profile.img) as `image`,\n                forum_posts.posts, users.score, coalesce(users_forum.karma, 0) AS `karma`, coalesce(user_karma.karma, 0) AS `user_karma`, (donate.medal_id IS NOT NULL) AS donator\n                FROM forum_posts post\n                LEFT JOIN users\n                ON users.user_id = post.author\n                LEFT JOIN users_profile profile\n                ON users.user_id = profile.user_id\n                LEFT JOIN users_medals donate\n                ON users.user_id = donate.user_id AND donate.medal_id = 19\n                LEFT JOIN (SELECT author, COUNT(*) AS `posts` FROM forum_posts WHERE deleted = 0 GROUP BY author) forum_posts\n                ON forum_posts.author = post.author\n                LEFT JOIN (SELECT post_id, SUM(karma) AS `karma` FROM users_forum GROUP BY post_id) users_forum\n                ON users_forum.post_id = post.post_id\n                LEFT JOIN (SELECT post_id, user_id, karma FROM users_forum) user_karma\n                ON user_karma.post_id = post.post_id AND user_karma.user_id = :uid\n                WHERE post.thread_id = :thread_id AND post.deleted = 0\n                ORDER BY `posted` ASC\n                LIMIT 1");
     $st->execute(array(':thread_id' => $thread_id, ':uid' => $this->app->user->uid));
     $thread->question = $st->fetch();
     // Get questioners image
     if (isset($thread->question->image)) {
         $gravatar = isset($thread->question->gravatar) && $thread->question->gravatar == 1;
         $thread->question->image = profile::getImg($thread->question->image, 60, $gravatar);
     } else {
         $thread->question->image = profile::getImg(null, 60);
     }
     $thread->p_start = ($page - 1) * $limit + 1;
     // Get replies
     $st = $this->app->db->prepare("SELECT post.post_id, users.user_id, users.username, post.body, post.posted, post.updated AS edited, profile.forum_signature AS signature,\n                profile.gravatar, IF (profile.gravatar = 1, users.email , profile.img) as `image`,\n                forum_posts.posts, users.score, coalesce(users_forum.karma, 0) AS `karma`, coalesce(user_karma.karma, 0) AS `user_karma`, (donate.medal_id IS NOT NULL) AS donator\n                FROM forum_posts post\n                LEFT JOIN users\n                ON users.user_id = post.author\n                LEFT JOIN users_profile profile\n                ON users.user_id = profile.user_id\n                LEFT JOIN users_medals donate\n                ON users.user_id = donate.user_id AND donate.medal_id = 19\n                LEFT JOIN (SELECT author, COUNT(*) AS `posts` FROM forum_posts WHERE deleted = 0 GROUP BY author) forum_posts\n                ON forum_posts.author = post.author\n                LEFT JOIN (SELECT post_id, SUM(karma) AS `karma` FROM users_forum GROUP BY post_id) users_forum\n                ON users_forum.post_id = post.post_id\n                LEFT JOIN (SELECT post_id, user_id, karma FROM users_forum) user_karma\n                ON user_karma.post_id = post.post_id AND user_karma.user_id = :uid\n                WHERE post.thread_id = :thread_id AND post.deleted = 0\n                ORDER BY `posted` ASC\n                LIMIT :l1, :l2");
     $st->bindValue(':thread_id', $thread_id);
     $st->bindValue(':uid', $this->app->user->uid);
     $st->bindValue(':l1', (int) $thread->p_start, PDO::PARAM_INT);
     $st->bindValue(':l2', (int) $limit, PDO::PARAM_INT);
     $st->execute();
     $thread->posts = $st->fetchAll();
     // Get posts images
     foreach ($thread->posts as $post) {
         if (isset($post->image)) {
             $gravatar = isset($post->gravatar) && $post->gravatar == 1;
             $post->image = profile::getImg($post->image, 50, $gravatar);
         } else {
             $post->image = profile::getImg(null, 50);
         }
     }
     $thread->p_end = $thread->p_start + count($thread->posts) - 1;
     // Get section slug
     $thread->section = $this->getSection($thread->section_slug);
     //Update view status
     if ($this->app->user->loggedIn) {
         $st = $this->app->db->prepare("INSERT INTO forum_users (`user_id`, `thread_id`)\n                        VALUES (:uid, :thread_id) ON DUPLICATE KEY UPDATE `viewed` = now()");
         $st->execute(array(':thread_id' => $thread_id, ':uid' => $this->app->user->uid));
         // Mark notifications as seen
         $st = $this->app->db->prepare("update users_notifications SET seen = 1 WHERE notification_id IN (\n                                                    SELECT notifications.id\n                                                    FROM (  select notification_id as `id`\n                                                            from users_notifications\n                                                            inner join forum_posts\n                                                            on users_notifications.item_id = forum_posts.post_id\n                                                            where (type='forum_reply' or type='forum_post') AND user_id = :uid AND thread_id = :thread_id AND seen = 0\n                                                         ) AS `notifications`\n                                                    );");
         $st->execute(array(':thread_id' => $thread_id, ':uid' => $this->app->user->uid));
     }
     return $thread;
 }
Example #14
0
 /**
  * Initaite Twig parser
  *
  * @param none
  *
  * @return void
  */
 private function initTwig()
 {
     // Load Twig
     require_once $this->config['path'] . '/files/vendor/Twig/Autoloader.php';
     Twig_Autoloader::register();
     $loader = new Twig_Loader_Filesystem($this->config['path'] . "/files/templates/");
     $this->twig = new Twig_Environment($loader, array('cache' => false, 'autoescape' => false));
     $wysiwyg = new Twig_SimpleFunction('wysiwyg', function ($name = "", $placeholder = "", $text = "") {
         $wysiwyg_name = $name;
         $wysiwyg_placeholder = $placeholder;
         $wysiwyg_text = $text;
         include 'elements/wysiwyg.php';
     });
     $this->twig->addFunction($wysiwyg);
     $csrf = new Twig_SimpleFunction('CSRFKey', function ($name) {
         echo $this->generateCSRFKey($name);
     });
     $this->twig->addFunction($csrf);
     $msg = new Twig_SimpleFunction('msg', function ($text, $type = "error") {
         $this->utils->message($text, $type);
     });
     $this->twig->addFunction($msg);
     $this->twig->addFilter('floor', new Twig_Filter_Function('floor'));
     $this->twig->addFilter('ceil', new Twig_Filter_Function('ceil'));
     $since = new Twig_Filter_Function(function ($time) {
         return $this->utils->timeSince($time);
     });
     $this->twig->addFilter('since', $since);
     $sinceShort = new Twig_Filter_Function(function ($time) {
         return $this->utils->timeSince($time, false, true);
     });
     $this->twig->addFilter('sinceShort', $sinceShort);
     $getImg = new Twig_SimpleFunction('getImg', function ($img, $size = 48, $gravatar = false) {
         echo profile::getImg($img, $size, $gravatar);
     });
     $this->twig->addFunction($getImg);
     $include = new Twig_SimpleFunction('include', function ($file) {
         $app = $this;
         include $file;
     });
     $this->twig->addFunction($include);
     $printForumSection = new Twig_SimpleFunction('printForumSection', function ($section) {
         $this->forum->printSectionsList($section, true);
     });
     $this->twig->addFunction($printForumSection);
 }
            $percent1[$i] = $count1[$key] / $total[$key] * 100;
            $percent1[$i] = @sprintf("%01.2f", $percent1[$i]);
        }
        @arsort($percent1);
        $keys = @array_keys($percent1);
        for ($a = 0; $a < count($percent1); $a++) {
            $key = $keys[$a];
            $skill_name = $skill_name1[$a];
            $percent = $percent1[$a];
            $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $match);
        }
        @sort($rem);
        for ($j = 0; $j < count($rem); $j++) {
            $key = $rem[$j];
            //$key1=$keys2[$key];
            $skill_id = $result[$key][skill_id];
            $qry = "select skill_name from {$skills} where skill_id='{$skill_id}'";
            $qry_res = $db_object->get_a_line($qry);
            $skill_name = $qry_res[skill_name];
            //$percent=($count1[$key1]/$total[$key1])*100;
            $percent = 0;
            $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $match);
        }
        $file = preg_replace($pattern, $str, $file);
        $file = $common->direct_replace($db_object, $file, $xArray);
        echo $file;
    }
}
$obj = new profile();
$obj->cultural_profile($db_object, $common, $user_id, $default, $post_var);
include_once "footer.php";
Example #16
0
?>
</h1>

<?php 
if (!count($profile->friendsList)) {
    $app->utils->message('You haven\'t added any friends yet', 'info');
} else {
    ?>
        <ul class='users-list'>
<?php 
    foreach ($profile->friendsList as $friend) {
        if (isset($friend->image)) {
            $gravatar = isset($friend->gravatar) && $friend->gravatar == 1;
            $friend->image = profile::getImg($friend->image, 48, $gravatar);
        } else {
            $friend->image = profile::getImg(null, 48);
        }
        ?>
            <li>
                <div>
                    <a href='/user/<?php 
        echo $friend->username;
        ?>
'>
                        <img src='<?php 
        echo $friend->image;
        ?>
' width='100%' alt='<?php 
        echo $friend->username;
        ?>
 profile picture'/>
Example #17
0
<?php

$model = $_REQUEST['model'];
$action = $_REQUEST['action'];
$objComm->checkSiteSession();
$SessUserDetails = $_SESSION['site']['pm_row'];
include_once MODELS . "/" . $model . "_model.php";
switch (strtoupper($action)) {
    case 'UPDATE':
        $objProfile = new profile();
        $objProfile->setUsers();
        $objComm->redirect1('index.php?model=profile');
        break;
    default:
        $objProfile = new profile();
        $row = $objProfile->getUser($SessUserDetails->UserID);
        break;
}
<?php

/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0;
    $itemId = helper::clearInt($itemId);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $profile = new profile($dbo, $accountId);
    $profile->setRequestFrom($accountId);
    $result = $profile->getILiked($itemId);
    echo json_encode($result);
    exit;
}
Example #19
0
<?php

header('Access-Control-Allow-Origin: *');
header('Content-type: application/json');
session_start();
require_once '../utils/dbconnection.php';
require_once "../model/modifProfile.php";
$errors = array();
$isFormGood = true;
$register = new profile();
if (!empty($_POST)) {
    if (!isset($_POST['username']) || strlen($_POST['username']) < 4) {
        $errors['username'] = '******';
        $isFormGood = false;
    }
    if (!isset($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $errors['email'] = 'Saisissez un email valide';
        $isFormGood = false;
    }
    if (!isset($_POST['password']) || strlen($_POST['password']) < 6) {
        $errors['password'] = '******';
        $isFormGood = false;
    }
    if (!isset($_POST['birthdate'])) {
        $errors['birthdate'] = 'Saisissez une date de naissance<br>';
        $isFormGood = false;
    }
    if (!isset($_POST['firstname']) || strlen($_POST['firstname']) <= 2) {
        $errors['firstname'] = 'Saisissez un prénom valide<br>';
        $isFormGood = false;
    }
 public function getILiked($itemId = 0)
 {
     if ($itemId == 0) {
         $itemId = $this->getMaxIdLikes();
         $itemId++;
     }
     $result = array("error" => false, "error_code" => ERROR_SUCCESS, "itemId" => $itemId, "items" => array());
     $stmt = $this->db->prepare("SELECT * FROM profile_likes WHERE fromUserId = (:fromUserId) AND id < (:itemId) AND removeAt = 0 ORDER BY id DESC LIMIT 20");
     $stmt->bindParam(':fromUserId', $this->id, PDO::PARAM_INT);
     $stmt->bindParam(':itemId', $itemId, PDO::PARAM_INT);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             while ($row = $stmt->fetch()) {
                 $profile = new profile($this->db, $row['toUserId']);
                 $profile->setRequestFrom($this->requestFrom);
                 $profileInfo = $profile->get();
                 unset($profile);
                 array_push($result['items'], $profileInfo);
                 $result['itemId'] = $row['id'];
                 unset($profile);
             }
         }
     }
     return $result;
 }
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $profileId = isset($_POST['profileId']) ? $_POST['profileId'] : 0;
    $profileId = helper::clearInt($profileId);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $profile = new profile($dbo, $profileId);
    $profile->setRequestFrom($accountId);
    $account = new account($dbo, $accountId);
    $accountInfo = $account->get();
    if ($profileId == $accountId) {
        $account->setLastActive();
    } else {
        if ($accountInfo['ghost'] == 0) {
            $guests = new guests($dbo, $profileId);
            $guests->setRequestFrom($accountId);
            $guests->add($accountId);
        }
    }
    $result = $profile->get();
    echo json_encode($result);
    exit;
Example #22
0
 *      added new aa tabs
 ***************************************************************************/
define('INCHARBROWSER', true);
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/global.php";
include_once "include/language.php";
include_once "include/functions.php";
//if character name isnt provided post error message and exit
if (!$_GET['char']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_NO_CHAR']);
} else {
    $charName = $_GET['char'];
}
//character initializations - rewritten 9/28/2014
$char = new profile($charName);
//the profile class will sanitize the character name
$charID = $char->char_id();
$name = $char->GetValue('name');
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id());
//block view if user level doesnt have permission
if ($mypermission['AAs']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_ITEM_NO_VIEW']);
}
$classbit = array(0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 1);
//rewritten to replace character blob - 9/929/3014
//this probably needs the logic rethought, this is a bandaid
$temp = $char->GetTable("character_alternate_abilities");
$aa_array = array();
foreach ($temp as $key => $value) {
    $aa_array[$value["aa_id"]] = $value["aa_value"];
            $percent = $percent1[$a];
            $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $match);
        }
        @sort($rem);
        if ($rem[0] == "") {
            echo $error_msg['cEmptyrecords'];
            include_once "footer.php";
            exit;
        }
        for ($j = 0; $j < count($rem); $j++) {
            $key = $rem[$j];
            //$key1=$keys2[$key];
            $skill_id = $result[$key][skill_id];
            $qry = "select skill_name from {$skills} where skill_id='{$skill_id}'";
            $qry_res = $db_object->get_a_line($qry);
            $skill_name = $qry_res[skill_name];
            //$percent=($count1[$key1]/$total[$key1])*100;
            $percent = 0;
            $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $match);
        }
        $file = preg_replace($pattern, $str, $file);
        $file = $common->direct_replace($db_object, $file, $xArray);
        echo $file;
    }
}
$obj = new profile();
if ($fBoss_id) {
    $user_id = $fBoss_id;
}
$obj->cultural_profile($db_object, $common, $user_id, $default, $error_msg);
include_once "footer.php";
Example #24
0
    $error_image = imagecreatetruecolor($signaturewidth, $signatureheight);
    $error_color = imagecolorallocate($error_image, $defaultcolor['r'], $defaultcolor['g'], $defaultcolor['b']);
    imagestring($error_image, 5, 10, 30, $error, $error_color);
    imagestring($error_image, 2, 10, 50, $message, $error_color);
    header("Content-Type: image/png");
    imagepng($error_image);
    ImageDestroy($error_image);
}
//if character name isnt provided post error message and exit
if (!$_GET['char']) {
    png_message_die($language['MESSAGE_ERROR'], $language['MESSAGE_NO_CHAR']);
} else {
    $charName = $_GET['char'];
}
//character initializations - rewritten 9/28/2014
$char = new profile($charName);
//the profile class will sanitize the character name
$charID = $char->char_id();
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id());
//block view if user level doesnt have permission
if ($mypermission['signatures']) {
    png_message_die($language['MESSAGE_ERROR'], $language['MESSAGE_ITEM_NO_VIEW']);
}
//load profile information for the character
$name = $char->GetValue('name');
$last_name = $char->GetValue('last_name');
$title = $char->GetValue('title');
$level = $char->GetValue('level');
$deity = $char->GetValue('deity');
$baseSTR = $char->GetValue('str');
//changed stats to lowercase 9/26/2014
Example #25
0
 *      altered character profile initialization to remove redundant query
 ***************************************************************************/
define('INCHARBROWSER', true);
include_once "include/config.php";
include_once "include/profile.php";
include_once "include/global.php";
include_once "include/language.php";
include_once "include/functions.php";
//if character name isnt provided post error message and exit
if (!$_GET['char']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_NO_CHAR']);
} else {
    $charName = $_GET['char'];
}
//character initializations - rewritten 9/28/2014
$char = new profile($charName);
//the profile class will sanitize the character name
$charID = $char->char_id();
$name = $char->GetValue('name');
$mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id());
//block view if user level doesnt have permission
if ($mypermission['skills']) {
    message_die($language['MESSAGE_ERROR'], $language['MESSAGE_ITEM_NO_VIEW']);
}
//drop page
$d_title = " - " . $name . $language['PAGE_TITLES_SKILLS'];
include "include/header.php";
$template->set_filenames(array('settings' => 'settings_body.tpl'));
//build body template
$template->set_filenames(array('skills' => 'skills_body.tpl'));
$template->assign_vars(array('NAME' => $name, '1H_BLUNT' => $char->GetValue('1h_blunt'), '1H_SLASHING' => $char->GetValue('1h_slashing'), '2H_BLUNT' => $char->GetValue('2h_blunt'), '2H_SLASHING' => $char->GetValue('2h_slashing'), 'ARCHERY' => $char->GetValue('archery'), 'BASH' => $char->GetValue('bash'), 'BLOCK' => $char->GetValue('block'), 'DEFENSE' => $char->GetValue('defense'), 'DISARM' => $char->GetValue('disarm'), 'DODGE' => $char->GetValue('dodge'), 'DOUBLE_ATTACK' => $char->GetValue('double_attack'), 'DUAL_WIELD' => $char->GetValue('dual_wield'), 'HAND_TO_HAND' => $char->GetValue('hand_to_hand'), 'KICK' => $char->GetValue('kick'), 'OFFENSE' => $char->GetValue('offense'), 'PARRY' => $char->GetValue('parry'), 'PIERCING' => $char->GetValue('piercing'), 'RIPOSTE' => $char->GetValue('riposte'), 'THROWING' => $char->GetValue('throwing'), 'INTIMIDATION' => $char->GetValue('intimidation'), 'TAUNT' => $char->GetValue('taunt'), 'ABJURATION' => $char->GetValue('abjuration'), 'ALTERATION' => $char->GetValue('alteration'), 'CHANNELING' => $char->GetValue('channeling'), 'CONJURATION' => $char->GetValue('conjuration'), 'DIVINATION' => $char->GetValue('divination'), 'EVOCATION' => $char->GetValue('evocation'), 'SPECIALIZE_ABJURE' => $char->GetValue('specialize_abjure'), 'SPECIALIZE_ALTERATION' => $char->GetValue('specialize_alteration'), 'SPECIALIZE_CONJURATION' => $char->GetValue('specialize_conjuration'), 'SPECIALIZE_DIVINATION' => $char->GetValue('specialize_divinatation'), 'SPECIALIZE_EVOCATION' => $char->GetValue('specialize_evocation'), 'DRAGON_PUNCH' => $char->GetValue('dragon_punch'), 'EAGLE_STRIKE' => $char->GetValue('eagle_strike'), 'ROUND_KICK' => $char->GetValue('round_kick'), 'TIGER_CLAW' => $char->GetValue('tiger_claw'), 'FLYING_KICK' => $char->GetValue('flying_kick'), 'MEND' => $char->GetValue('mend'), 'FEIGN_DEATH' => $char->GetValue('feign_death'), 'PICK_LOCK' => $char->GetValue('pick_lock'), 'APPLY_POISON' => $char->GetValue('apply_poison'), 'BACKSTAB' => $char->GetValue('backstab'), 'DISARM_TRAPS' => $char->GetValue('disarm_traps'), 'PICK_POCKETS' => $char->GetValue('pick_pockets'), 'SENSE_TRAPS' => $char->GetValue('sense_traps'), 'BERSERKING' => $char->GetValue('berserking'), 'FRENZY' => $char->GetValue('frenzy'), 'BRASS_INSTRUMENTS' => $char->GetValue('brass_instruments'), 'SINGING' => $char->GetValue('sing'), 'STRINGED_INSTRUMENTS' => $char->GetValue('stringed_instruments'), 'WIND_INSTRUMENTS' => $char->GetValue('wind_instruments'), 'PERCUSSION_INSTRUMENTS' => $char->GetValue('percussion_instruments'), 'BIND_WOUND' => $char->GetValue('bind_wound'), 'FORAGE' => $char->GetValue('forage'), 'HIDE' => $char->GetValue('hide'), 'MEDITATE' => $char->GetValue('meditate'), 'SAFE_FALL' => $char->GetValue('safe_fall'), 'SENSE_HEADING' => $char->GetValue('sense_heading'), 'SNEAK' => $char->GetValue('sneak'), 'SWIMMING' => $char->GetValue('swimming'), 'TRACKING' => $char->GetValue('tracking'), 'FISHING' => $char->GetValue('fishing'), 'ALCOHOL_TOLERANCE' => $char->GetValue('alcohol_tolerance'), 'BEGGING' => $char->GetValue('begging'), 'MAKE_POISON' => $char->GetValue('make_poison'), 'TINKERING' => $char->GetValue('tinkering'), 'RESEARCH' => $char->GetValue('research'), 'ALCHEMY' => $char->GetValue('alchemy'), 'BAKING' => $char->GetValue('baking'), 'TAILORING' => $char->GetValue('tailoring'), 'BLACKSMITHING' => $char->GetValue('blacksmithing'), 'FLETCHING' => $char->GetValue('fletching'), 'BREWING' => $char->GetValue('brewing'), 'JEWELRY_MAKING' => $char->GetValue('jewelry_making'), 'POTTERY' => $char->GetValue('pottery'), 'L_TRADE' => $language['SKILLS_TRADE'], 'L_OTHER' => $language['SKILLS_OTHER'], 'L_CLASS' => $language['SKILLS_CLASS'], 'L_CASTING' => $language['SKILLS_CASTING'], 'L_COMBAT' => $language['SKILLS_COMBAT'], 'L_LANGUAGE' => $language['SKILLS_LANGUAGE'], 'L_SKILLS' => $language['SKILLS_SKILLS'], 'L_DONE' => $language['BUTTON_DONE'], 'L_AAS' => $language['BUTTON_AAS'], 'L_KEYS' => $language['BUTTON_KEYS'], 'L_FLAGS' => $language['BUTTON_FLAGS'], 'L_SKILLS' => $language['BUTTON_SKILLS'], 'L_BOOKMARK' => $language['BUTTON_BOOKMARK'], 'L_CORPSE' => $language['BUTTON_CORPSE'], 'L_FACTION' => $language['BUTTON_FACTION'], 'L_INVENTORY' => $language['BUTTON_INVENTORY'], 'L_CHARMOVE' => $language['BUTTON_CHARMOVE']));
Example #26
0
 public function __construct($username, $public = false)
 {
     global $app;
     $this->app = $app;
     if ($public) {
         $st = $this->app->db->prepare("SELECT u.user_id as uid, u.username, u.score, u.email, profile.show_email, profile.about, profile.forum_signature,\n                    friends.status AS friends, profile.gravatar,\n                    IF (profile.gravatar = 1, u.email , profile.img) as `image`,\n                    IF (priv.site_priv = 2, true, false) AS admin, IF(priv.forum_priv = 2, true, false) AS moderator,\n                    coalesce(priv.site_priv, 1) AS `site_priv`, coalesce(priv.pm_priv, 1) AS `pm_priv`, coalesce(priv.forum_priv, 1) AS `forum_priv`, coalesce(priv.pub_priv, 1) AS `pub_priv`\n                    FROM users u\n                    LEFT JOIN users_profile profile\n                    ON u.user_id = profile.user_id\n                    LEFT JOIN users_friends friends\n                    ON (friends.user_id = u.user_id AND friends.friend_id = :user) OR (friends.user_id = :user AND friends.friend_id = u.user_id)\n                    LEFT JOIN users_priv priv\n                    ON u.user_id = priv.user_id\n                    WHERE u.user_id = :profile or u.username = :profile");
         $st->execute(array(':profile' => $username, ':user' => $this->app->user->uid));
         $st->setFetchMode(PDO::FETCH_INTO, $this);
         $res = $st->fetch();
         if (!$res) {
             return false;
         }
         // is this user allowed to see that stuff?
         if (!$this->app->user->admin_site_priv && !$this->show_email) {
             unset($this->email);
         }
         unset($this->show_email);
         if (isset($this->image)) {
             $gravatar = isset($this->gravatar) && $this->gravatar == 1;
             $this->image = profile::getImg($this->image, 198, $gravatar);
         } else {
             $this->image = profile::getImg(null, 198);
         }
         unset($this->gravatar);
         if (!$this->app->admin) {
             unset($this->site_priv);
             unset($this->pm_priv);
             unset($this->forum_priv);
             unset($this->pub_priv);
         }
         if ($this->friends === null) {
             unset($this->friends);
         }
     } else {
         $st = $this->app->db->prepare("SELECT u.user_id as uid, u.username, u.score, u.email, profile.*, activity.joined,\n                    activity.last_active, friends.status AS friends, friends.user_id AS friend, profile.gravatar,\n                    IF (profile.gravatar = 1, u.email , profile.img) as `image`,\n                    IF(priv.site_priv = 2, true, false) AS admin, IF(priv.forum_priv = 2, true, false) AS moderator,\n                    priv.*,\n                    forum_posts.posts, articles.articles, (donated.user_id IS NOT NULL) AS donator, (users_blocks.user_id IS NOT NULL) AS blocked, (users_blocks_me.user_id IS NOT NULL) AS blockedMe, karma.karma\n                    FROM users u\n                    LEFT JOIN users_profile profile\n                    ON u.user_id = profile.user_id\n                    LEFT JOIN users_activity activity\n                    ON u.user_id = activity.user_id\n                    LEFT JOIN users_friends friends\n                    ON (friends.user_id = u.user_id AND friends.friend_id = :user) OR (friends.user_id = :user AND friends.friend_id = u.user_id)\n                    LEFT JOIN users_blocks \n                    ON users_blocks.user_id = :user AND users_blocks.blocked_id = u.user_id\n                    LEFT JOIN users_blocks users_blocks_me\n                    ON users_blocks_me.user_id = u.user_id AND users_blocks_me.blocked_id = :user\n                    LEFT JOIN (SELECT author, COUNT(*) AS `posts` FROM forum_posts WHERE deleted = 0 GROUP BY author) forum_posts\n                    ON forum_posts.author = u.user_id\n                    LEFT JOIN (SELECT user_id, COUNT(*) AS `articles` FROM articles GROUP BY user_id) articles\n                    ON articles.user_id = u.user_id\n                    LEFT JOIN users_priv priv\n                    ON u.user_id = priv.user_id\n                    LEFT JOIN users_medals donated\n                    ON u.user_id = donated.user_id AND donated.medal_id = (SELECT medal_id FROM medals WHERE label = 'Donator')\n                    LEFT JOIN (SELECT SUM(karma) AS karma, forum_posts.author FROM users_forum INNER JOIN forum_posts ON users_forum.post_id = forum_posts.post_id AND forum_posts.deleted = 0 GROUP BY forum_posts.author) karma\n                    ON karma.author = u.user_id\n                    WHERE u.username = :profile");
         $st->execute(array(':profile' => $username, ':user' => $this->app->user->uid));
         $st->setFetchMode(PDO::FETCH_INTO, $this);
         $res = $st->fetch();
     }
     if (!$res) {
         return false;
     }
     if (isset($this->image)) {
         $gravatar = isset($this->gravatar) && $this->gravatar == 1;
         $this->image = profile::getImg($this->image, 198, $gravatar);
     } else {
         $this->image = profile::getImg(null, 198);
     }
     $st = $this->app->db->prepare('SELECT users_medals.medal_id, medals.label, medals.description, medals_colours.colour
                 FROM users_medals
                 INNER JOIN medals
                 ON users_medals.medal_id = medals.medal_id
                 INNER JOIN medals_colours
                 ON medals.colour_id = medals_colours.colour_id
                 WHERE users_medals.user_id = :uid');
     $st->execute(array(':uid' => $this->uid));
     $this->medals = $st->fetchAll();
     if (!$this->app->user->admin) {
         unset($this->site_priv);
         unset($this->pm_priv);
         unset($this->forum_priv);
         unset($this->pub_priv);
     }
     // Limit the amount of information public users can see
     if ($public) {
         return true;
     }
     $st = $this->app->db->prepare('SELECT u.user_id as uid, u.username, users_friends.status, u.score, profile.gravatar, IF (profile.gravatar = 1, u.email , profile.img) as `image`
                 FROM users_friends as friends
                 INNER JOIN users u
                 ON u.user_id = IF(friends.user_id = :uid, friends.friend_id, friends.user_id)
                 LEFT JOIN users_profile profile
                 ON u.user_id = profile.user_id
                 LEFT JOIN users_friends
                 ON (users_friends.user_id = u.user_id AND users_friends.friend_id = :user) OR (users_friends.user_id = :user AND users_friends.friend_id = u.user_id)
                 WHERE friends.status = 1 AND (friends.user_id = :uid OR friends.friend_id = :uid)
                 ORDER BY u.username');
     $st->execute(array(':uid' => $this->uid, ':user' => $this->app->user->uid));
     $this->friendsList = $st->fetchAll();
     // Parse content
     $this->name = $this->app->parse($this->name, false, false);
     if (isset($this->about)) {
         $this->about_plain = $this->app->parse($this->about, false, false);
         $this->about = $this->app->parse($this->about);
     }
     $this->feed = $this->getFeed();
     $this->links = $this->getLinks();
     $this->owner = $this->app->user->uid === $this->uid;
     // Check score and award medal?
     if ($this->score >= $this->app->max_score) {
         $this->score_perc = 100;
     } else {
         $this->score_perc = $this->score / $this->app->max_score * 100;
     }
 }
Example #27
0
 public function info($giftId)
 {
     $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
     $stmt = $this->db->prepare("SELECT * FROM gifts WHERE id = (:giftId) LIMIT 1");
     $stmt->bindParam(":giftId", $giftId, PDO::PARAM_INT);
     if ($stmt->execute()) {
         if ($stmt->rowCount() > 0) {
             $row = $stmt->fetch();
             $time = new language($this->db, $this->language);
             $profile = new profile($this->db, $row['giftFrom']);
             $profileInfo = $profile->get();
             unset($profile);
             $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "giftId" => $row['giftId'], "giftTo" => $row['giftTo'], "giftFrom" => $row['giftFrom'], "giftFromUserVip" => $profileInfo['vip'], "giftFromUserVerify" => $profileInfo['verify'], "giftFromUserUsername" => $profileInfo['username'], "giftFromUserFullname" => $profileInfo['fullname'], "giftFromUserPhoto" => $profileInfo['lowPhotoUrl'], "giftAnonymous" => $row['giftAnonymous'], "message" => htmlspecialchars_decode(stripslashes($row['message'])), "imgUrl" => $row['imgUrl'], "createAt" => $row['createAt'], "date" => date("Y-m-d H:i:s", $row['createAt']), "timeAgo" => $time->timeAgo($row['createAt']), "removeAt" => $row['removeAt']);
         }
     }
     return $result;
 }
/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $profileId = isset($_POST['profileId']) ? $_POST['profileId'] : 0;
    $profileId = helper::clearInt($profileId);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $blacklist = new blacklist($dbo);
    $blacklist->setRequestFrom($profileId);
    if (!$blacklist->isExists($accountId)) {
        $profile = new profile($dbo, $profileId);
        $profile->setRequestFrom($accountId);
        $result = $profile->addFollower($accountId);
    }
    echo json_encode($result);
    exit;
}
 function sendMail($subject, $message, $toEmail)
 {
     $profile = new profile();
     $adminRow = $profile->getAdminRow();
     $from = $adminRow["email"];
     $headers = "From: {$from}";
     $mail = new PHPMailer();
     $mail->From = $from;
     $mail->FromName = "Admin at Project My Skills";
     $mail->AddAddress($toEmail);
     $mail->Subject = $subject;
     $mail->Body = $message;
     $mail->IsHTML(true);
     $mail->IsSMTP();
     $mail->Host = 'ssl://smtp.gmail.com';
     $mail->Port = 465;
     $mail->SMTPAuth = true;
     $mail->Username = $from;
     $mail->Password = '******';
     if (!$mail->Send()) {
         return false;
     } else {
         return true;
     }
 }
Example #30
0
function profile()
{
    // The usual suspects.
    global $MySelf;
    global $DB;
    // Set the ID.
    $ID = sanitize($_GET[id]);
    numericCheck($_GET[id], 0);
    // Load the profile.
    $profile = new profile($ID);
    $username = ucfirst(idToUsername($ID));
    // Cache our permissions.
    $canSeeUsers = $MySelf->canSeeUsers();
    // Need the api.
    $api = new api($ID);
    // Create table header.
    $table = new table(2, true);
    $table->addHeader(">> About " . $username);
    $table->addRow();
    $table->addCol("Current rank:");
    $table->addCol(getRank($ID));
    $table->addRow();
    $table->addCol("Last login:"******"SELECT lastlogin FROM users WHERE id='" . $ID . "' AND deleted='0' LIMIT 1");
    $table->addCol(date("d.m.y. H:i:s", $lastLog[0]));
    $table->addRow();
    $table->addCol("Total logins:");
    $lastLog = $DB->getCol("SELECT COUNT(authkey) FROM auth WHERE user='******' LIMIT 1");
    $table->addCol(number_format($lastLog[0], 0));
    $table->addRow();
    $table->addCol("Valid api-key on file:");
    $table->addCol(yesno($api->valid(), true));
    $table->addRow();
    $table->addCol("Is available for mining:");
    if ($profile->isOwn()) {
        if ($profile->MinerFlag()) {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=false\">set not available</a>]";
        } else {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=true\">set available</a>]";
        }
    }
    $table->addCol(yesno($profile->MinerFlag(), true) . $temp);
    $table->addRow();
    $table->addCol("Is available for hauling:");
    if ($profile->isOwn()) {
        if ($profile->HaulerFlag()) {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=false\">set not available</a>]";
        } else {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=true\">set available</a>]";
        }
    }
    $table->addCol(yesno($profile->HaulerFlag(), true) . $temp);
    $table->addRow();
    $table->addCol("Is available for fighting:");
    if ($profile->isOwn()) {
        if ($profile->FighterFlag()) {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=false\">set not available</a>]";
        } else {
            $temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=true\">set available</a>]";
        }
    }
    $table->addCol(yesno($profile->FighterFlag(), true) . $temp);
    if ($profile->emailVisible() || $profile->isOwn()) {
        if ($profile->isOwn()) {
            if ($profile->emailVisible()) {
                $temp = " (public) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=hide\">hide from public</a>]";
            } else {
                $temp = " (hidden) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=show\">make public</a>]";
            }
        }
        $table->addRow();
        $table->addCol("Email address:");
        $email = $DB->getCol("SELECT email FROM users WHERE id='" . $ID . "' LIMIT 1");
        $table->addCol($email[0] . $temp);
    }
    // Statistics.
    $stats = new table(2, true);
    $stats->addHeader(">> Statistical breakdown");
    $miningRunsJoined = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'");
    $miningRunsJoined = $miningRunsJoined[0];
    $OpjoinUps = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'");
    $OpjoinUps = $OpjoinUps[0];
    $joinUps = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups");
    $joinUps = $joinUps[0];
    $haulingRuns = $DB->getCol("SELECT COUNT(id) FROM hauled WHERE hauler='" . $ID . "'");
    $haulingRuns = $haulingRuns[0];
    $timeMining = $DB->getCol("SELECT SUM(parted - joined) FROM joinups WHERE userid='" . $ID . "' AND parted >1");
    $timeMining = $timeMining[0];
    $timesKicked = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='1'");
    $timesKicked = $timesKicked[0];
    $timesRemoved = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='2'");
    $timesRemoved = $timesRemoved[0];
    $timesBanned = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='3'");
    $timesBanned = $timesBanned[0];
    $timesCharity = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups WHERE userid='" . $ID . "' AND charity='1'");
    $timesCharity = $timesCharity[0];
    $tmec = $DB->getCol("SELECT AVG(tmec) FROM runs WHERE isOfficial = 1");
    $tmecJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run = runs.id AND runs.endtime > 0 AND runs.isOfficial = 1");
    $tmecNotJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run <> runs.id AND runs.endtime > 0 AND runs.isOfficial = 1");
    $tmecDiff = $tmecJoined[0] - $tmecNotJoined[0];
    $stats->addRow();
    $stats->addCol("Mining operations joined:");
    if ($miningRunsJoined > 0) {
        $stats->addCol(number_format($joinUps, 0));
    } else {
        $stats->addCol("never joined.");
    }
    $stats->addRow();
    $stats->addCol("Total operations joinups:");
    if ($OpjoinUps > 0) {
        $stats->addCol(number_format($OpjoinUps, 0));
    } else {
        $stats->addCol("never joined.");
    }
    $stats->addRow();
    $stats->addCol("Hauling runs:");
    if ($haulingRuns > 0) {
        $stats->addCol(number_format($haulingRuns, 0));
    } else {
        $stats->addCol("never hauled.");
    }
    $stats->addRow();
    $stats->addCol("Time spent mining:");
    if ($timeMining > 0) {
        $stats->addCol(numberToString($timeMining));
    } else {
        $stats->addCol("never mined.");
    }
    $stats->addRow();
    $stats->addCol("Average TMEC:");
    $stats->addCol(number_format($tmec[0], 3));
    $stats->addRow();
    $stats->addCol("Average TMEC on Ops <b>with</b> " . $username . ":");
    $stats->addCol(number_format($tmecJoined[0], 3));
    $stats->addRow();
    $stats->addCol("Average TMEC on Ops <b>without</b> " . $username . ":");
    $stats->addCol(number_format($tmecNotJoined[0], 3));
    $stats->addRow();
    $stats->addCol("TMEC difference:");
    if ($tmecDiff >= 0) {
        $stats->addCol("<font color=\"#00ff00\">" . number_format($tmecDiff, 3), true . "</font>");
    } else {
        $stats->addCol("<font color=\"#ff0000\">" . number_format($tmecDiff, 3), true . "</font>");
    }
    $stats->addRow();
    $stats->addCol("Times removed from OP:");
    $stats->addCol(number_format($timesRemoved, 0));
    $stats->addRow();
    $stats->addCol("Times kicked from OP:");
    $stats->addCol(number_format($timesKicked, 0));
    $stats->addRow();
    $stats->addCol("Times banned from OP:");
    $stats->addCol(number_format($timesBanned, 0));
    $stats->addRow();
    $stats->addCol("Times declared charity:");
    $stats->addCol(number_format($timesCharity, 0));
    /*
     * Assemble the heavy-duty SQL query.
     * It is dynamic because this way we can easily add ores from 
     * config-system.php to the system without code rewrite.
     */
    /*
    	global $DBORE;
    	global $ORENAMES;
    	foreach ($DBORE as $ORE) {
    		$new = $ORE;
    		if ($last) {
    			$SQLADD .= "SUM(" . $last . ") AS total" . $last . ", ";
    		}
    		$last = $new;
    	}
    	$SQLADD .= "SUM(" . $last . ") AS total" . $last . " ";
    	$SQL = "SELECT " . $SQLADD . " FROM hauled WHERE hauler='" . $ID . "'";
    
    	// Now query it.
    	$totalOREDB = $DB->query("$SQL");
    	
    
    if (DB::isError($totalOREDB)) {
        *
         * This is not what you would really want to do in
         * your program.  It merely demonstrates what kinds
         * of data you can get back from error objects.
         *
        echo 'Standard Message: ' . $totalOREDB->getMessage() . "\n";
        echo '\n ';
        echo 'Standard Code: ' . $totalOREDB->getCode() . "\n";
        echo '\n ';
        echo 'DBMS/User Message: ' . $totalOREDB->getUserInfo() . "\n";
        echo '\n ';
        echo 'DBMS/Debug Message: ' . $totalOREDB->getDebugInfo() . "\n";
        echo '\n ';
        exit;
    }
    
    	// Create table.
    	$totalOre_table = new table(2, true);
    	$totalOre_table->addHeader(">> Total ore hauled");
    
    	// Loop through the result (single result!)
    	if ($totalOREDB->numRows() > 0) {
    		while ($totalORE = $totalOREDB->fetchRow()) {
    			// Now check each ore type.
    			foreach ($ORENAMES as $ORE) {
    				// And ignore never-hauled ore
    				if ($totalORE[total . $ORE] > 0) {
    					// We got some ore!
    					$totalOre_table->addRow();
    					$totalOre_table->addCol("<img width=\"20\" height=\"20\" src=\"./images/ores/" . $ORE . ".png\">Total " . $ORE . " hauled:");
    					$totalOre_table->addCol(number_format($totalORE[total . $ORE]));
    					$gotOre = true;
    				}
    			}
    		}
    		if ($gotOre) {
    			$oretable_r = "<br>" . $totalOre_table->flush();
    		}
    	}
    */
    // Image thingy.
    // We serve small images IGB.
    global $IGB;
    global $IGB_VISUAL;
    if ($IGB && $IGB_VISUAL) {
        $image = "<img src=\"portrait:" . $api->getCharacterID() . "\" SIZE=\"128\">";
    } else {
        $image = $profile->getImage("large");
    }
    $picTable = new table(true, 1);
    $picTable->addHeader(">> Picture of " . $username);
    $picTable->addRow();
    $picTable->addCol($image);
    $imageTable = $picTable->flush();
    // About
    if ($profile->GetAbout() && !$profile->isOwn()) {
        $aboutTable = new table(1, true);
        $aboutTable->addHeader(">> " . $username . " says...");
        $aboutTable->addRow();
        $aboutTable->addCol(nl2br($profile->GetAbout()));
        $aboutTable = "<br>" . $aboutTable->flush();
    }
    if ($profile->isOwn()) {
        $aboutTable = new table(1, true);
        $aboutTable->addHeader(">> Enter a public viewable text here");
        $aboutTable->addRow();
        $form = "<form action=\"index.php\" method=\"POST\">";
        $form .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
        $form .= "<input type=\"hidden\" name=\"action\" value=\"modprofile\">";
        $form .= "<input type=\"hidden\" name=\"id\" value=\"" . $ID . "\">";
        $aboutTable->addCol("<textarea rows=\"18\" cols=\"80\" name=\"about\">" . $profile->GetAbout() . "</textarea>");
        $aboutTable->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Update about\">");
        $aboutTable = "<br>" . $form . $aboutTable->flush() . "</form>";
    }
    // quick "jump to" -thingy.
    $peeps = $DB->query("SELECT DISTINCT username,id FROM users WHERE deleted = 0 AND canLogin = 1 ORDER BY username ASC");
    if ($peeps->numRows() > 0) {
        while ($p = $peeps->fetchRow()) {
            if ($ID == $p[id]) {
                $pdm .= "<option SELECTED value=\"" . $p[id] . "\">" . ucfirst($p[username]) . " (current)</option>";
            } else {
                $pdm .= "<option value=\"" . $p[id] . "\">" . ucfirst($p[username]) . "</option>";
            }
        }
        $pdm = "<select name=\"id\">" . $pdm . "</select></form>";
        $quickChooser = new table(1, true);
        $quickChooser->addHeader(">> Quick jump to profile");
        $quickChooser->addRow();
        $quickChooser->addCol($pdm);
        $quickChooser->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Switch\">");
        $quickChooser = "<form action=\"index.php\" method=\"GET\"><input type=\"hidden\" name=\"action\" value=\"profile\">" . $quickChooser->flush() . "</form>";
    }
    $page = "<h2>View profile</h2>" . $quickChooser . $imageTable . "<br>" . $table->flush() . "<br>" . $stats->flush() . $oretable_r . $aboutTable;
    return $page;
}