diff --git a/cron.php b/cron.php index f1a7309..7ad6ab2 100644 --- a/cron.php +++ b/cron.php @@ -17,13 +17,12 @@ if (function_exists('posix_getuid')) { // Define that this page won't require templating define('SAKURA_NO_TPL', true); +// To prevent the CLI from showing up +define('SAKURA_CRON', true); + // Include components require_once 'sakura.php'; -// Override expiration variables -ignore_user_abort(true); -set_time_limit(0); - // Clean expired sessions Database::delete('sessions', [ 'session_expire' => [time(), '<'], diff --git a/libraries/DB.php b/libraries/DB.php new file mode 100644 index 0000000..9742e89 --- /dev/null +++ b/libraries/DB.php @@ -0,0 +1,24 @@ + div:not(:last-child) { + display: inline-block; + border: 1px solid #9475B2; + text-align: center; + width: 200px; + margin: 4px 0; + border-radius: 3px; + box-shadow: inset 0 0 1px #9475B2; + background: #E4CFFF; + transition: background .2s, box-shadow .2s; +} + +.profile-friends > div:not(:last-child):hover { + background: #C2AFFE; + box-shadow: inset 0 0 2px #9475B2; +} + +.profile-friends > div > .friends-list-data { + display: block; +} + +.profile-friends > div > .friends-list-data > .friends-list-name { + font-size: 1.2em; + line-height: 1.5em; + padding-bottom: 4px; +} + /* * Panel table */ diff --git a/public/profile.php b/public/profile.php index ba5c7cf..ae94d96 100644 --- a/public/profile.php +++ b/public/profile.php @@ -21,10 +21,11 @@ $profile = User::construct(isset($_GET['u']) ? $_GET['u'] : 0); // Views array $views = [ 'index', - /*'friends', - 'threads', - 'posts',*/ + 'friends', + //'threads', + //'posts', 'comments', + //'groups', ]; // Assign the object to a renderData variable diff --git a/sakura.php b/sakura.php index 02df199..5781b41 100644 --- a/sakura.php +++ b/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20160122'); +define('SAKURA_VERSION', '20160126'); define('SAKURA_VLABEL', 'Amethyst'); define('SAKURA_COLOUR', '#9966CC'); @@ -18,6 +18,10 @@ define('ROOT', __DIR__ . '/'); // Turn error reporting on for the initial startup sequence error_reporting(-1); +// Override expiration variables +ignore_user_abort(true); +set_time_limit(0); + // Set internal encoding method mb_internal_encoding('utf-8'); @@ -38,6 +42,7 @@ require_once ROOT . 'libraries/BBcode.php'; require_once ROOT . 'libraries/Comments.php'; require_once ROOT . 'libraries/Config.php'; require_once ROOT . 'libraries/CSRF.php'; +require_once ROOT . 'libraries/DB.php'; require_once ROOT . 'libraries/Database.php'; require_once ROOT . 'libraries/File.php'; require_once ROOT . 'libraries/Hashing.php'; @@ -86,7 +91,7 @@ Config::initDB(); Whois::setServers(ROOT . Config::local('data', 'whoisservers')); // Check if we're using console -if (php_sapi_name() === 'cli') { +if (php_sapi_name() === 'cli' && !defined('SAKURA_CRON')) { $console = new Console\Application; $console->run($argv); exit; diff --git a/templates/yuuno/main/profile.twig b/templates/yuuno/main/profile.twig index 4bc0ac2..b44b547 100644 --- a/templates/yuuno/main/profile.twig +++ b/templates/yuuno/main/profile.twig @@ -22,10 +22,10 @@ - {% else %} + {% elseif get.old %}
-
+
{{ profile.username }}'s Avatar
{% if profile.mainRankId > 1 and profile.checkBan|length < 1 %} {{ profile.title }} @@ -46,8 +46,8 @@
{# - - shh #} + shh #} + {##} {% if not noUserpage %} @@ -149,5 +149,152 @@
+ {% else %} +
+
+
+
+
+
+

{{ profile.username }}

+ {% if profile.isPremium[0] %}Tenshi {% endif %}{{ profile.country }} {{ profile.title }} +
+
+ Joined {{ profile.elapsed.joined }} +
+ {% if profile.lastOnline < 1 %} + {{ profile.username }} hasn't logged in yet. + {% else %} + Last online {{ profile.elapsed.lastOnline }} + {% endif %} + {% if profile.birthday != '0000-00-00' and profile.birthday|split('-')[0] > 0 %} +
Age {{ profile.birthday(true) }} years old  + {% endif %} +
+
+
+
+
+ + {# + #} + + {##} + {% if not noUserpage %} + + {% endif %} +
+ {% if session.checkLogin %} +
+ {% if user.id == profile.id %} + + {% else %} + {% if user.isFriends(profile.id) != 0 %}{% endif %} + + {##} + {% endif %} + {% if user.permission(constant('Sakura\\Perms\\Manage::CAN_RESTRICT_USERS'), constant('Sakura\\Perms::MANAGE')) %} + + {% endif %} +
+ {% endif %} +
+
+
+
+ {% include 'profile/' ~ profileView ~ '.twig' %} +
+
+
+ + + + + + + + + + + + + +
Threads{{ profile.forumStats.topics }}
Posts{{ profile.forumStats.posts }}
Friends{{ profile.friends(2)|length }}
+
+ {% if profile.profileFields or user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')) %} + {% if session.checkLogin %} + + {% for name,field in profile.profileFields %} + + + + + {% endfor %} + {% if user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')) %} + + + + + + + + + + + + + {% endif %} +
+ {{ field.name }} + + {% if name == 'youtube' %} + {% if field.youtubetype == true %}{{ profile.username }}'s Channel{% else %}{{ field.value }}{% endif %} + {% else %} + {% if field.islink %} + + {% endif %} + {{ field.value }} + {% if field.islink %} + + {% endif %} + {% endif %} +
E-mail address{{ profile.email }}
Register IP{{ profile.registerIp }}
Last IP{{ profile.lastIp }}
+ {% else %} + Log in to view the full profile! + {% endif %} + {% endif %} +
+ Account Standing + {% if profile.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) %} +

Deactivated

+ {% elseif profile.checkBan %} +

Banned

+ {% elseif profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %} +

Restricted

+ {% elseif profile.getWarnings %} +

Bad

+ {% else %} +

Good

+ {% endif %} + {% if profile.getWarnings %} + + + + + + + {% for warning in profile.getWarnings %} + + + + + + {% endfor %} +
ActionDurationReason
{{ warning.warning_action_text }}{{ warning.warning_length }} minute{% if warning.warning_length != 1 %}s{% endif %}{{ warning.warning_reason }}
+ {% endif %} +
+
+
+
{% endif %} {% endblock %} diff --git a/templates/yuuno/profile/comments.twig b/templates/yuuno/profile/comments.twig index 19fb703..d125229 100644 --- a/templates/yuuno/profile/comments.twig +++ b/templates/yuuno/profile/comments.twig @@ -1,3 +1,6 @@ {% set comments = profile.profileComments.comments %} {% set commentsCategory = 'profile-' ~ profile.id %} +
+

Comments

+
{% include 'elements/comments.twig' %} diff --git a/templates/yuuno/profile/friends.twig b/templates/yuuno/profile/friends.twig index e69de29..132f1b1 100644 --- a/templates/yuuno/profile/friends.twig +++ b/templates/yuuno/profile/friends.twig @@ -0,0 +1,24 @@ +{% set friends = profile.friends(2)|batch(12) %} + +{% set paginationPages = friends %} +{% set paginationUrl %}{{ urls.format('SETTING_MODE', ['friends', 'listing']) }}{% endset %} + +
+

Friends

+
+
+ {% for friend in friends[get.page|default(1) - 1] %} + + {% endfor %} +
+ {% if friends|length > 1 %} +
+ {% include 'elements/pagination.twig' %} +
+ {% endif %} +
\ No newline at end of file diff --git a/templates/yuuno/settings/friends.listing.twig b/templates/yuuno/settings/friends.listing.twig index 5077046..0974be6 100644 --- a/templates/yuuno/settings/friends.listing.twig +++ b/templates/yuuno/settings/friends.listing.twig @@ -27,7 +27,7 @@ window.addEventListener("load", function() {
{% for friend in friends[get.page|default(1) - 1] %}
- + {{ friend.username }}
{{ friend.username }}
diff --git a/templates/yuuno/settings/friends.requests.twig b/templates/yuuno/settings/friends.requests.twig index ebfb25a..ff146fc 100644 --- a/templates/yuuno/settings/friends.requests.twig +++ b/templates/yuuno/settings/friends.requests.twig @@ -27,7 +27,7 @@ window.addEventListener("load", function() {
{% for friend in friends[get.page|default(1) - 1] %}