diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 00735f4..9e070dd 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -31,7 +31,9 @@ "20150702", "20150703", "20150704", - "20150705" + "20150705", + "20150706", + "20150707" ] @@ -1481,6 +1483,28 @@ { "type": "ADD", "change": "Add code for topic view counter." + }, + { + "type": "FIX", + "change": "Fixed avatars with shit resolutions jumping to the side of the username." + } + + ], + + "20150706": [ + + { + "type": "ADD", + "change": "Added pending friend requests counter to the frontpage." + } + + ], + + "20150707": [ + + { + "type": "ADD", + "change": "Added post and topic count variable to the profile." } ] diff --git a/_sakura/components/Bans.php b/_sakura/components/Bans.php new file mode 100644 index 0000000..7e76549 --- /dev/null +++ b/_sakura/components/Bans.php @@ -0,0 +1,10 @@ + Database::count('posts', ['poster_id' => [$uid, '=']])[0], + 'topics' => count(Database::fetch('posts', true, ['poster_id' => [$uid, '=']], ['post_time'], null, ['topic_id'])) + ]; + + } + // Creating a new post public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $type = 0, $status = 0, $topic = 0) { diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index a9169cf..86256e5 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -1324,6 +1324,35 @@ class Users { } + // Get non-mutual friends + public static function getPendingFriends($uid = null) { + + // Assign $of automatically if it's not set + if(!$uid) + $uid = Session::$userId; + + // Get all friend entries from other people involved the current user + $friends = Database::fetch('friends', true, [ + 'fid' => [$uid, '='] + ]); + + // Create pending array + $pending = []; + + // Check if the friends are mutual + foreach($friends as $friend) { + + // Check if the friend is mutual + if(!self::checkFriend($friend, $uid)) + $pending[] = $friend; + + } + + // Return the pending friends + return $pending; + + } + // Check if a friend is mutual public static function checkFriend($fid, $uid = null) { @@ -1391,11 +1420,4 @@ class Users { } - // Checking bans - public static function checkBan($uid) { - - - - } - } diff --git a/_sakura/components/database/mysql.php b/_sakura/components/database/mysql.php index d1cc9fd..c19d355 100644 --- a/_sakura/components/database/mysql.php +++ b/_sakura/components/database/mysql.php @@ -103,13 +103,6 @@ class MySQL { } - // If $order is set and is an array continue - if(is_array($order)) { - - $prepare .= ' ORDER BY `'. $order[0] .'`'. (!empty($order[1]) && $order[1] ? ' DESC' : ''); - - } - // If $group is set and is an array continue if(is_array($group)) { @@ -124,6 +117,13 @@ class MySQL { } } + + // If $order is set and is an array continue + if(is_array($order)) { + + $prepare .= ' ORDER BY `'. $order[0] .'`'. (!empty($order[1]) && $order[1] ? ' DESC' : ''); + + } // If $limit is set and is an array continue if(is_array($limit)) { diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 4b915f6..a406e84 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150705'); +define('SAKURA_VERSION', '20150707'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_STABLE', false); define('SAKURA_COLOUR', '#6C3082'); diff --git a/_sakura/templates/misaki/main/profile.tpl b/_sakura/templates/misaki/main/profile.tpl index a17382c..c39ca2f 100644 --- a/_sakura/templates/misaki/main/profile.tpl +++ b/_sakura/templates/misaki/main/profile.tpl @@ -113,8 +113,8 @@ user not found, don't forget to make this sexy
Forum stats
- {% if profile.data.forum.posts %}{{ profile.data.forum.posts }}{% else %}0{% endif %} post{% if profile.data.forum.posts != 1 %}s{% endif %} - {% if profile.data.forum.threads %}{{ profile.data.forum.threads }}{% else %}0{% endif %} thread{% if profile.data.forum.threads != 1 %}s{% endif %} + {{ profile.forum_stats.posts }} post{% if profile.forum_stats.posts != 1 %}s{% endif %} + {% if profile.forum_stats.topics %}{{ profile.forum_stats.topics }}{% else %}0{% endif %} thread{% if profile.forum_stats.topics != 1 %}s{% endif %}
diff --git a/_sakura/templates/yuuno/elements/indexPanel.tpl b/_sakura/templates/yuuno/elements/indexPanel.tpl index 8d2fa3c..081b525 100644 --- a/_sakura/templates/yuuno/elements/indexPanel.tpl +++ b/_sakura/templates/yuuno/elements/indexPanel.tpl @@ -2,7 +2,7 @@
Hi, {{ user.data.username }}!
diff --git a/_sakura/templates/yuuno/forum/viewtopic.tpl b/_sakura/templates/yuuno/forum/viewtopic.tpl index 08d2862..4881c5d 100644 --- a/_sakura/templates/yuuno/forum/viewtopic.tpl +++ b/_sakura/templates/yuuno/forum/viewtopic.tpl @@ -15,9 +15,10 @@
{% if user.data.id == post.user.id %} + {% else %} {% if post.is_friend != 0 %}{% endif %} - + {% endif %} {% else %} diff --git a/_sakura/templates/yuuno/main/profile.tpl b/_sakura/templates/yuuno/main/profile.tpl index 9182144..17919e4 100644 --- a/_sakura/templates/yuuno/main/profile.tpl +++ b/_sakura/templates/yuuno/main/profile.tpl @@ -34,11 +34,11 @@
Joined {{ profile.user.regdate|date("l Y-m-d H:i T") }}
{% if profile.user.lastdate == 0 %} - User hasn't logged in yet. + {{ profile.user.username }} hasn't logged in yet. {% else %} Last Seen on {{ profile.user.lastdate|date("l Y-m-d H:i T") }} {% endif %}
- User has {% if not profile.user.posts %}no{% else %}{{ profile.user.posts }}{% endif %} forum post{% if profile.user.posts != 1 %}s{% endif %}. + {{ profile.user.username }} has {% if not profile.forum_stats.posts %}no{% else %}{{ profile.forum_stats.posts }}{% endif %} forum post{% if profile.forum_stats.posts != 1 %}s{% endif %}. {% if profile.fields is not null %}
{% if user.checklogin %} diff --git a/content/data/yuuno/css/yuuno.css b/content/data/yuuno/css/yuuno.css index 70252eb..5f44dc0 100644 --- a/content/data/yuuno/css/yuuno.css +++ b/content/data/yuuno/css/yuuno.css @@ -1709,7 +1709,8 @@ textarea.inputStyling { background: #EEE; box-shadow: 0 3px 7px #888; border-radius: 3px; - margin: 5px; + display: block; + margin: 0 auto 10px; } .forum.viewtopic .posts .userpanel .usertitle { diff --git a/main/index.php b/main/index.php index b579d41..d39fa75 100644 --- a/main/index.php +++ b/main/index.php @@ -16,7 +16,8 @@ $forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false; $renderData['newsPosts'] = ($forumMode ? null : Main::getNewsPosts(3)); $renderData['page'] = [ - 'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')) + 'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')), + 'friend_req' => Users::getPendingFriends() ]; $renderData['board'] = [ diff --git a/main/profile.php b/main/profile.php index e9ce1ed..2505074 100644 --- a/main/profile.php +++ b/main/profile.php @@ -24,12 +24,13 @@ if(isset($_GET['u'])) { 'profilePage' => Users::getProfilePage($_PROFILE_USER_DATA['userData'], true), 'fields' => Users::getUserProfileFields($_PROFILE_USER_DATA['userData'], true), 'warnings' => Users::getWarnings($_PROFILE_USER_DATA['id']), - 'friend' => Users::checkFriend($_PROFILE_USER_DATA['id']) + 'friend' => Users::checkFriend($_PROFILE_USER_DATA['id']), + 'forum_stats' => Forum::getUserStats($_PROFILE_USER_DATA['id']) ]; $renderData['page'] = [ - 'title' => ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $_PROFILE_USER_DATA['username']), - 'style' => (!empty($_PROFILE_USER_DATA['userData']['profileBackground']) ? [ + 'title' => ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $_PROFILE_USER_DATA['username']), + 'style' => (!empty($_PROFILE_USER_DATA['userData']['profileBackground']) ? [ '#userBackground' => [ 'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat center center / cover transparent !important', 'position' => 'fixed',