bunch of fuck
This commit is contained in:
parent
8a6ba4c499
commit
8d13762fbd
8 changed files with 136 additions and 66 deletions
|
@ -142,10 +142,6 @@
|
||||||
"type": "FIX",
|
"type": "FIX",
|
||||||
"change": "Replace broken template tags."
|
"change": "Replace broken template tags."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "FIX",
|
|
||||||
"change": "Replace broken template tags."
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "ADD",
|
"type": "ADD",
|
||||||
"change": "Upload remaining assets."
|
"change": "Upload remaining assets."
|
||||||
|
@ -1269,6 +1265,18 @@
|
||||||
{
|
{
|
||||||
"type": "ADD",
|
"type": "ADD",
|
||||||
"change": "Added friends system."
|
"change": "Added friends system."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Changed & to & in some URLs."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Fixed settings page being usable when logged out."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REM",
|
||||||
|
"change": "Removed remaining code for the old profile API."
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
{% if user.checklogin %}
|
{% if user.checklogin %}
|
||||||
<div class="head">Hi, {{ user.data.username }}!</div>
|
<div class="head">Hi, {{ user.data.username }}!</div>
|
||||||
<img src="//{{ sakura.urls.main }}/a/{{ user.data.id }}" class="default-avatar-setting homepage-menu-avatar" />
|
<a href="//{{ sakura.urls.main }}/settings/avatar"><img src="//{{ sakura.urls.main }}/a/{{ user.data.id }}" class="default-avatar-setting homepage-menu-avatar" /></a>
|
||||||
<ul>
|
<ul class="panel-quick-links">
|
||||||
<li><a href="//{{ sakura.urls.main }}/settings/profile" class="underline">Edit profile</a></li>
|
<li><a href="//{{ sakura.urls.main }}/friends" title="View friends list"><span class="fa fa-users"></span><span class="count">0</span></a></li>
|
||||||
<li><a href="//{{ sakura.urls.main }}/settings/avatar" class="underline">Change avatar</a></li>
|
<li><a href="//{{ sakura.urls.main }}/messages" title="View private messages"><span class="fa fa-envelope"></span><span class="count">0</span></a></li>
|
||||||
<li><a href="//{{ sakura.urls.main }}/settings/sessions" class="underline">View active sessions</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -226,7 +226,7 @@
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/messages" title="Read your private message">Messages</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/messages" title="Read your private message">Messages</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/manage" title="Manage the site">Manage</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/manage" title="Manage the site">Manage</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if sakura.lockauth %}
|
{% if sakura.lockauth %}
|
||||||
<div class="menu-item" style="padding-left: 10px; padding-right: 10px;">Authentication is locked</div>
|
<div class="menu-item" style="padding-left: 10px; padding-right: 10px;">Authentication is locked</div>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<a class="fa fa-pencil-square" title="Edit your profile" href="//{{ sakura.urls.main }}/settings/profile"></a>
|
<a class="fa fa-pencil-square" title="Edit your profile" href="//{{ sakura.urls.main }}/settings/profile"></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if profile.friend != 0 %}<a class="fa fa-{% if profile.friend == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
|
{% if profile.friend != 0 %}<a class="fa fa-{% if profile.friend == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
|
||||||
<a class="fa fa-user-{% if profile.friend == 0 %}plus{% else %}times{% endif %}" title="{% if profile.friend == 0 %}Add {{ profile.user.username }} as a friend{% else %}Remove friend{% endif %}" href="//{{ sakura.urls.main }}/friends?{% if profile.friend == 0 %}add{% else %}remove{% endif %}={{ profile.user.id }}&session={{ php.sessionid }}&time={{ php.time }}&redirect={{ sakura.currentpage }}" id="profileFriendToggle"></a>
|
<a class="fa fa-user-{% if profile.friend == 0 %}plus{% else %}times{% endif %}" title="{% if profile.friend == 0 %}Add {{ profile.user.username }} as a friend{% else %}Remove friend{% endif %}" href="//{{ sakura.urls.main }}/friends?{% if profile.friend == 0 %}add{% else %}remove{% endif %}={{ profile.user.id }}&session={{ php.sessionid }}&time={{ php.time }}&redirect={{ sakura.currentpage }}" id="profileFriendToggle"></a>
|
||||||
<a class="fa fa-flag" title="Report {{ profile.user.username }}" href="//{{ sakura.urls.main }}/report/{{ profile.user.id }}"></a>
|
<a class="fa fa-flag" title="Report {{ profile.user.username }}" href="//{{ sakura.urls.main }}/report/{{ profile.user.id }}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,13 +54,16 @@ RewriteRule ^members/([a-z]+)/([0-9]+)/p([0-9]+)/?$ members.php?sort=$1&rank=$2&
|
||||||
## Profiles
|
## Profiles
|
||||||
RewriteRule ^u/?$ profile.php [L,QSA]
|
RewriteRule ^u/?$ profile.php [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/?$ profile.php?u=$1 [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/?$ profile.php?u=$1 [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/api/?$ profile.php?data [L,QSA]
|
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/header/?$ imageserve.php?m=header&u=$1 [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/header/?$ imageserve.php?m=header&u=$1 [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/groups/?$ profile.php?u=$1&view=groups [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/groups/?$ profile.php?u=$1&view=groups [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/friends/?$ profile.php?u=$1$view=friends [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/friends/?$ profile.php?u=$1$view=friends [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/threads/?$ profile.php?u=$1$view=threads [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/threads/?$ profile.php?u=$1$view=threads [L,QSA]
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/posts/?$ profile.php?u=$1$view=posts [L,QSA]
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/posts/?$ profile.php?u=$1$view=posts [L,QSA]
|
||||||
|
|
||||||
|
## Groups
|
||||||
|
RewriteRule ^g/?$ group.php [L,QSA]
|
||||||
|
RewriteRule ^g/([0-9]+)/?$ group.php?g=$1 [L,QSA]
|
||||||
|
|
||||||
# Serving Images
|
# Serving Images
|
||||||
RewriteRule ^a/([0-9]+)$|a/([0-9]+).png$ imageserve.php?m=avatar&u=$1 [L,QSA]
|
RewriteRule ^a/([0-9]+)$|a/([0-9]+).png$ imageserve.php?m=avatar&u=$1 [L,QSA]
|
||||||
RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1 [L,QSA]
|
RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1 [L,QSA]
|
||||||
|
|
55
main/group.php
Normal file
55
main/group.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Sakura User Groups
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Declare Namespace
|
||||||
|
namespace Sakura;
|
||||||
|
|
||||||
|
// Include components
|
||||||
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
/*
|
||||||
|
// Get group data
|
||||||
|
if(isset($_GET['g'])) {
|
||||||
|
|
||||||
|
$renderData['profile'] = [
|
||||||
|
'notset' => false,
|
||||||
|
'user' => ($_PROFILE_USER_DATA = Users::getUser(($_USER_USERNAME_ID = Users::userExists($_GET['u'], false)) ? $_USER_USERNAME_ID : $_GET['u'])),
|
||||||
|
'rank' => ($_PROFILE_RANK_DATA = Users::getRank($_PROFILE_USER_DATA['rank_main'])),
|
||||||
|
'colour' => ($_PROFILE_USER_DATA['name_colour'] == null ? $_PROFILE_RANK_DATA['colour'] : $_PROFILE_USER_DATA['name_colour']),
|
||||||
|
'ranktitle' => ($_PROFILE_USER_DATA['usertitle'] == null ? $_PROFILE_RANK_DATA['title'] : $_PROFILE_USER_DATA['usertitle']),
|
||||||
|
'data' => ($_PROFILE_PROFILE_DATA = Users::getUserProfileData($_PROFILE_USER_DATA, true)),
|
||||||
|
'country' => Main::getCountryName($_PROFILE_USER_DATA['country']),
|
||||||
|
'istenshi' => Users::checkUserTenshi($_PROFILE_USER_DATA['id']),
|
||||||
|
'online' => Users::checkUserOnline($_PROFILE_USER_DATA['id']),
|
||||||
|
'profilePage' => Users::getProfilePage($_PROFILE_PROFILE_DATA, true),
|
||||||
|
'fields' => Users::getUserProfileFields($_PROFILE_PROFILE_DATA, true),
|
||||||
|
'warnings' => Users::getWarnings($_PROFILE_USER_DATA['id']),
|
||||||
|
'friend' => Users::checkFriend($_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_PROFILE_DATA['profileBackground']) ? [
|
||||||
|
'#userBackground' => [
|
||||||
|
'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat center center / cover transparent !important',
|
||||||
|
'position' => 'fixed',
|
||||||
|
'top' => '0',
|
||||||
|
'bottom' => '0',
|
||||||
|
'right' => '0',
|
||||||
|
'left' => '0',
|
||||||
|
'z-index' => '-1'
|
||||||
|
]
|
||||||
|
] : null)
|
||||||
|
];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$renderData['profile']['notset'] = true;
|
||||||
|
$renderData['page']['title'] = 'User not found!';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
print Templates::render('main/profile.tpl', $renderData);
|
||||||
|
*/
|
|
@ -9,18 +9,6 @@ namespace Sakura;
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
|
||||||
// Catch old profile API and return error
|
|
||||||
if(isset($_REQUEST['data'])) {
|
|
||||||
|
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
|
||||||
header('Access-Control-Allow-Origin: *');
|
|
||||||
|
|
||||||
print json_encode(['error' => true]);
|
|
||||||
|
|
||||||
exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get user data
|
// Get user data
|
||||||
if(isset($_GET['u'])) {
|
if(isset($_GET['u'])) {
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// Friends
|
// Friends
|
||||||
} elseif(isset($_REQUEST['friend-action']) && $_REQUEST['friend-action']) {
|
} elseif(isset($_REQUEST['friend-action']) && $_REQUEST['friend-action'] && Users::checkLogin()) {
|
||||||
|
|
||||||
// Continue
|
// Continue
|
||||||
$continue = true;
|
$continue = true;
|
||||||
|
@ -58,6 +58,13 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
|
||||||
// Compare time and session so we know the link isn't forged
|
// Compare time and session so we know the link isn't forged
|
||||||
if(!isset($_REQUEST['add']) && !isset($_REQUEST['remove'])) {
|
if(!isset($_REQUEST['add']) && !isset($_REQUEST['remove'])) {
|
||||||
|
|
||||||
|
if(!isset($_REQUEST['ajax'])) {
|
||||||
|
|
||||||
|
header('Location: /settings/friends');
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Action failed',
|
'title' => 'Action failed',
|
||||||
'redirect' => $redirect,
|
'redirect' => $redirect,
|
||||||
|
@ -71,7 +78,7 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare time and session so we know the link isn't forged
|
// Compare time and session so we know the link isn't forged
|
||||||
if($_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')] == Session::$userId) {
|
if($continue && $_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')] == Session::$userId) {
|
||||||
|
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Action failed',
|
'title' => 'Action failed',
|
||||||
|
@ -182,6 +189,8 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Users::checkLogin()) {
|
||||||
|
|
||||||
// Settings page list
|
// Settings page list
|
||||||
$pages = [
|
$pages = [
|
||||||
'home' => ['General', 'Home'],
|
'home' => ['General', 'Home'],
|
||||||
|
@ -221,3 +230,11 @@ switch($currentPage) {
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
print Templates::render('settings/'. $currentPage .'.tpl', $renderData);
|
print Templates::render('settings/'. $currentPage .'.tpl', $renderData);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
print Templates::render('global/header.tpl', $renderData);
|
||||||
|
print Templates::render('elements/restricted.tpl', $renderData);
|
||||||
|
print Templates::render('global/footer.tpl', $renderData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Reference in a new issue