summaryrefslogtreecommitdiff
path: root/src/web/_model/apps/profile.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/web/_model/apps/profile.php65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/web/_model/apps/profile.php b/src/web/_model/apps/profile.php
deleted file mode 100644
index acec9c0..0000000
--- a/src/web/_model/apps/profile.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php /* Copyright (c) 2024 Freya Murphy */
-class Profile_model extends Model {
-
- private $request_model;
-
- function __construct($load) {
- parent::__construct($load);
- $this->request_model = $this->load->model('request');
- }
-
- public function get_data(): ?array {
- $uid = $this->request_model->get_int('id', FALSE);
- if ($uid === FALSE) {
- if ($this->main->session) {
- $uid = $this->main->user()['id'];
- } else {
- return NULL;
- }
- }
-
- $user = $this->db
- ->select('*')
- ->from('api.user u')
- ->where('u.id')
- ->eq($uid)
- ->row();
-
- if (!$user) {
- return NULL;
- }
-
- $following = FALSE;
- $followed = FALSE;
- $follow_id = NULL;
-
- if ($this->main->session) {
- $sid = $this->main->user()['id'];
- $res = $this->db->select('f.value, f.id')
- ->from('xssbook.follow f')
- ->where('f.follower_id')
- ->eq($sid)
- ->where('f.followee_id')
- ->eq($uid)
- ->row();
- $following = $res ? $res['value'] : FALSE;
- $follow_id = $res ? $res['id'] : NULL;
- $res = $this->db->select('f.value')
- ->from('xssbook.follow f')
- ->where('f.follower_id')
- ->eq($uid)
- ->where('f.followee_id')
- ->eq($sid)
- ->row();
- $followed = $res ? $res['value'] : FALSE;
- }
-
- $data = parent::get_data();
- $data['user'] = $user;
- $data['following'] = $following;
- $data['followed'] = $followed;
- $data['follow_id'] = $follow_id;
- $data['title'] = ucfirst(lang('title', sub: [$user['first_name']]));
- return $data;
- }
-}