Profile backgrounds
This commit is contained in:
parent
ff488c6b84
commit
b336e65909
6 changed files with 63 additions and 14 deletions
|
@ -22,7 +22,8 @@
|
||||||
"20150430",
|
"20150430",
|
||||||
"20150501",
|
"20150501",
|
||||||
"20150502",
|
"20150502",
|
||||||
"20150503"
|
"20150503",
|
||||||
|
"20150503.1"
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -880,6 +881,15 @@
|
||||||
"change": "Begin work on forum script."
|
"change": "Begin work on forum script."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
"20150503.1": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "ADD",
|
||||||
|
"change": "Added profile backgrounds."
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20150503');
|
define('SAKURA_VERSION', '20150503.1');
|
||||||
define('SAKURA_VLABEL', 'Heliotrope');
|
define('SAKURA_VLABEL', 'Heliotrope');
|
||||||
define('SAKURA_VTYPE', 'Development');
|
define('SAKURA_VTYPE', 'Development');
|
||||||
define('SAKURA_COLOUR', '#DF73FF');
|
define('SAKURA_COLOUR', '#DF73FF');
|
||||||
|
|
|
@ -14,6 +14,17 @@
|
||||||
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/yuuno.css" />
|
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/yuuno.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
||||||
|
{% if page.style %}
|
||||||
|
<style type="text/css">
|
||||||
|
{% for element,properties in page.style %}
|
||||||
|
{{ element|raw }} {
|
||||||
|
{% for property,value in properties %}
|
||||||
|
{{ property|raw }}: {{ value|raw }};
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
<!-- JS -->
|
<!-- JS -->
|
||||||
<script type="text/javascript" src="{{ sakura.resources }}/js/yuuno.js"></script>
|
<script type="text/javascript" src="{{ sakura.resources }}/js/yuuno.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -108,7 +119,7 @@
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body{% if page.background %} style="background: url('{{ page.background }}') no-repeat fixed center center / cover inherit !important;"{% endif %}>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<span id="top"></span>
|
<span id="top"></span>
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="content profile">
|
<div class="content profile"{% if page.background %} style="background: rgba(211, 191, 255, .8) !important;"{% endif %}>
|
||||||
<div class="{% if profile.profpage|length > 1 %}content-right {% endif %}content-column">
|
<div class="{% if profile.profpage|length > 1 %}content-right {% endif %}content-column">
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<img src="/a/{{ profile.user.id }}" alt="{{ profile.user.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.online %}484{% else %}844{% endif %};" />
|
<img src="/a/{{ profile.user.id }}" alt="{{ profile.user.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.online %}484{% else %}844{% endif %};" />
|
||||||
|
|
|
@ -14,9 +14,11 @@ header('Content-Type: application/octet-stream');
|
||||||
|
|
||||||
// Check if the m(ode) GET request is set
|
// Check if the m(ode) GET request is set
|
||||||
if(isset($_GET['m'])) {
|
if(isset($_GET['m'])) {
|
||||||
|
|
||||||
switch($_GET['m']) {
|
switch($_GET['m']) {
|
||||||
|
|
||||||
case 'avatar':
|
case 'avatar':
|
||||||
// Set path to no avatar picture
|
// Set paths
|
||||||
$noAvatar = ROOT .'content/images/no-av.png';
|
$noAvatar = ROOT .'content/images/no-av.png';
|
||||||
$deactiveAvatar = ROOT .'content/images/deactivated-av.png';
|
$deactiveAvatar = ROOT .'content/images/deactivated-av.png';
|
||||||
$bannedAvatar = ROOT .'content/images/banned-av.png';
|
$bannedAvatar = ROOT .'content/images/banned-av.png';
|
||||||
|
@ -52,10 +54,11 @@ if(isset($_GET['m'])) {
|
||||||
// Check if the avatar exist and assign it to a value
|
// Check if the avatar exist and assign it to a value
|
||||||
$serveImage = $avatarDirPath . $user['avatar_url'];
|
$serveImage = $avatarDirPath . $user['avatar_url'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'background':
|
case 'background':
|
||||||
// Set path to no avatar picture
|
// Set paths
|
||||||
$noBackground = ROOT .'content/pixel.png';
|
$noBackground = ROOT .'content/pixel.png';
|
||||||
|
$bgDirPath = ROOT .'content/images/backgrounds/';
|
||||||
|
|
||||||
// If ?u= isn't set or if it isn't numeric
|
// If ?u= isn't set or if it isn't numeric
|
||||||
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
|
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
|
||||||
|
@ -63,16 +66,32 @@ if(isset($_GET['m'])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get user data
|
||||||
|
$user = Users::getUser($_GET['u']);
|
||||||
|
|
||||||
|
// If user is deactivated don't display background
|
||||||
|
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
|
||||||
|
$serveImage = $noBackground;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if user has an avatar set
|
||||||
|
if(empty($user['background_url']) || !file_exists($bgDirPath . $user['background_url'])) {
|
||||||
|
$serveImage = $noAvatar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the avatar exist and assign it to a value
|
// Check if the avatar exist and assign it to a value
|
||||||
$serveImage = empty(Users::getUser($_GET['u'])['profilebg']) ? $noBackground : Users::getUser($_GET['u'])['profilebg'];
|
$serveImage = $bgDirPath . $user['background_url'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$serveImage = ROOT .'content/pixel.png';
|
$serveImage = ROOT .'content/pixel.png';
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
} else
|
||||||
$serveImage = ROOT .'content/pixel.png';
|
$serveImage = ROOT .'content/pixel.png';
|
||||||
}
|
|
||||||
|
|
||||||
$serveImage = file_get_contents($serveImage);
|
$serveImage = file_get_contents($serveImage);
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,17 @@ if(isset($_GET['u'])) {
|
||||||
'profpage' => Main::mdParse(base64_decode($_PROFILE_USER_DATA['profile_md'])),
|
'profpage' => Main::mdParse(base64_decode($_PROFILE_USER_DATA['profile_md'])),
|
||||||
'data' => Users::getUserProfileData($_PROFILE_USER_DATA['id'])
|
'data' => Users::getUserProfileData($_PROFILE_USER_DATA['id'])
|
||||||
];
|
];
|
||||||
|
$renderData['page'] = [
|
||||||
$renderData['page']['title'] = ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $renderData['profile']['user']['username']);
|
'title' => ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $_PROFILE_USER_DATA['username']),
|
||||||
|
'style' => ($_PROFILE_USER_DATA['background_url'] ? [
|
||||||
|
'body' => [
|
||||||
|
'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat fixed center center / cover transparent !important'
|
||||||
|
],
|
||||||
|
'.profile' => [
|
||||||
|
'background' => 'rgba(211, 191, 255, .8) !important'
|
||||||
|
]
|
||||||
|
] : null)
|
||||||
|
];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Reference in a new issue