r20160122.1

This commit is contained in:
flash 2016-01-22 21:07:44 +01:00
parent 01e7dbf1ce
commit 9fb540daf8
12 changed files with 49 additions and 41 deletions

View file

@ -6,6 +6,7 @@
"twig/twig": "*",
"phpmailer/phpmailer": "*",
"paypal/rest-api-sdk-php": "*",
"jbbcode/jbbcode": "^1.3"
"jbbcode/jbbcode": "*",
"corneltek/cliframework": "*"
}
}

View file

@ -12,7 +12,6 @@ namespace Sakura;
class Comments
{
public $comments = []; // Array containing comments
private $commenters = []; // Array containing User objects
public $category; // Comment category
public $count = 0; // Amount of comments
@ -45,14 +44,8 @@ class Comments
// Sort comments
foreach ($comments as $comment) {
// Check if we already have an object for this user
if (!array_key_exists($comment['comment_poster'], $this->commenters)) {
// Create new object
$this->commenters[$comment['comment_poster']] = User::construct($comment['comment_poster']);
}
// Attach the poster
$comment['comment_poster'] = $this->commenters[$comment['comment_poster']];
$comment['comment_poster'] = User::construct($comment['comment_poster']);
$comment['comment_text'] = Utils::parseEmotes(Utils::cleanString($comment['comment_text']));
// Get likes and dislikes

View file

@ -0,0 +1,23 @@
<?php
/*
* CLI Main
*/
namespace Sakura\Console;
/**
* Class Console
* @package Sakura
*/
class Application extends \CLIFramework\Application
{
// Application info
const NAME = 'Sakura';
const VERSION = SAKURA_VERSION;
// Initialiser
public function init()
{
parent::init();
}
}

View file

@ -120,7 +120,6 @@ class Post
// Update the post
Database::update('posts', [
[
'post_id' => $this->id,
'topic_id' => $thread->id,
'forum_id' => $thread->forum,
'poster_id' => $this->poster->id,

View file

@ -12,7 +12,6 @@ namespace Sakura;
class News
{
public $posts = []; // Posts array
private $posters = []; // Posters array (so we don't create a new user object every time)
// Initialise the news object
public function __construct($category)
@ -23,14 +22,8 @@ class News
// Attach poster data
foreach ($posts as $post) {
// Check if we already have an object for this user
if (!array_key_exists($post['user_id'], $this->posters)) {
// Create new object
$this->posters[$post['user_id']] = User::construct($post['user_id']);
}
// Attach the poster
$post['news_poster'] = $this->posters[$post['user_id']];
$post['news_poster'] = User::construct($post['user_id']);
// Load comments
$post['news_comments'] = $this->comments = new Comments('news-' . $category . '-' . $post['news_id']);

View file

@ -173,6 +173,12 @@ class User
$this->permissions = new Perms(Perms::SITE);
}
// Update
public function update()
{
// placeholder
}
// Get user birthday
public function birthday($age = false)
{

View file

@ -704,7 +704,7 @@ class Users
}
// Get all users
public static function getAllUsers($includeInactive = true, $includeAbyss = false)
public static function getAllUsers($includeInactive = true, $includeRestricted = false)
{
// Execute query
$getUsers = Database::fetch('users', true);
@ -721,6 +721,11 @@ class Users
continue;
}
// Skip if inactive and not include restricted users
if (!$includeRestricted && $user->permission(Site::RESTRICTED)) {
continue;
}
$users[$user->id] = $user;
}

View file

@ -239,7 +239,6 @@ a.default:active {
.content-column {
position: relative;
min-height: 600px;
}
.content-left {
@ -1930,7 +1929,6 @@ textarea.inputStyling {
width: 100%;
border-spacing: 0;
margin-top: 2px;
word-break: break-all;
}
.forum .topicList thead,

View file

@ -25,7 +25,7 @@ if (Users::checkLogin()) {
&& $_GET['rank']
&& array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) ? $_GET['rank'] : 0
)),
'users' => ($_MEMBERLIST_ACTIVE && !$_MEMBERLIST_NFOUND ? Users::getUsersInRank($_MEMBERLIST_ACTIVE) : Users::getAllUsers()),
'users' => ($_MEMBERLIST_ACTIVE ? Users::getUsersInRank($_MEMBERLIST_ACTIVE) : Users::getAllUsers(false)),
'membersPerPage' => Config::get('members_per_page'),
];

View file

@ -54,6 +54,7 @@ require_once ROOT . 'libraries/User.php';
require_once ROOT . 'libraries/Users.php';
require_once ROOT . 'libraries/Utils.php';
require_once ROOT . 'libraries/Whois.php';
require_once ROOT . 'libraries/Console/Application.php';
require_once ROOT . 'libraries/Forum/Forum.php';
require_once ROOT . 'libraries/Forum/Post.php';
require_once ROOT . 'libraries/Forum/Thread.php';
@ -84,6 +85,13 @@ Config::initDB();
// Assign servers file to whois class
Whois::setServers(ROOT . Config::local('data', 'whoisservers'));
// Check if we're using console
if (php_sapi_name() === 'cli') {
$console = new Console\Application;
$console->run($argv);
exit;
}
// Check if we the system has a cron service
if (Config::get('no_cron_service')) {
// If not do an "asynchronous" call to the cron.php script

View file

@ -60,24 +60,6 @@
// Space for things that need to happen onload
window.addEventListener("load", function() {
// Check if we can use SSL
if (window.location.protocol.toLowerCase() === "http:") {
// Build check string
var sslCheckDest = 'https://' + window.location.host + sakuraVars.content + '/pixel.png';
// Create a new image
var sslCheck = new Image();
// Add an onload
sslCheck.onload = function() {
window.location.assign(window.location.href.toLowerCase().replace('http://', 'https://'));
}
// Set the source
sslCheck.src = sslCheckDest;
}
{% if session.checkLogin %}
// Convert href to object in logout link
prepareAjaxLink('headerLogoutLink', 'submitPost', ', true, "Logging out..."');

View file

@ -30,7 +30,7 @@
{% if profile.mainRankId > 1 and profile.checkBan|length < 1 %}
<span style="font-size: .8em;">{{ profile.title }}</span>
<h1 style="color: {{ profile.colour }}; text-shadow: 0 0 7px {% if profile.colour != 'inherit' %}{{ profile.colour }}{% else %}#222{% endif %}; padding: 0 0 2px;" {% if profile.getUsernameHistory %} title="Known as {{ profile.getUsernameHistory[0]['username_old'] }} before {{ profile.getUsernameHistory[0]['change_time']|date(sakura.dateFormat) }}." {% endif %}>{{ profile.username }}</h1>
{% if profile.isPremium[0] %}<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi" style="vertical-align: middle;" /> {% endif %}<img src="{{ sakura.contentPath }}/images/flags/{{ profile.country|lower }}.png" alt="{{ profile.country.short }}" style="vertical-align: middle;" /> <span style="font-size: .8em; line-height: 11px;">{{ profile.country.long }}</span>
{% if profile.isPremium[0] %}<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi" style="vertical-align: middle;" /> {% endif %}<img src="{{ sakura.contentPath }}/images/flags/{{ profile.country|lower }}.png" alt="{{ profile.country }}" style="vertical-align: middle;" /> <span style="font-size: .8em; line-height: 11px;">{{ profile.country(true) }}</span>
{% if session.checkLogin %}
<div class="user-actions">
{% if user.id == profile.id %}