diff --git a/_sakura/changelog.json b/_sakura/changelog.json
index f1eb335..b234a62 100644
--- a/_sakura/changelog.json
+++ b/_sakura/changelog.json
@@ -51,7 +51,8 @@
"20150823",
"20150825",
"20150826",
- "20150828"
+ "20150828",
+ "20150829"
]
@@ -2290,6 +2291,26 @@
"user": "Flashwave"
}
+ ],
+
+ "20150829": [
+
+ {
+ "type": "UPD",
+ "change": "Improved template error handling.",
+ "user": "Flashwave"
+ },
+ {
+ "type": "FIX",
+ "change": "Fixed PHP version checker not halting the script entirely.",
+ "user": "Flashwave"
+ },
+ {
+ "type": "UPD",
+ "change": "Make placeholder avatars different based on the templates.",
+ "user": "Flashwave"
+ }
+
]
}
diff --git a/_sakura/components/Templates.php b/_sakura/components/Templates.php
index 7b581a0..ef7d453 100644
--- a/_sakura/components/Templates.php
+++ b/_sakura/components/Templates.php
@@ -57,9 +57,12 @@ class Templates {
$twigEnv = [];
// Enable caching
- if(Configuration::getConfig('enable_tpl_cache'))
+ if(Configuration::getConfig('enable_tpl_cache')) {
+
$twigEnv['cache'] = ROOT .'cache';
+ }
+
// And now actually initialise the templating engine
self::$_ENG = new Twig_Environment($twigLoader, $twigEnv);
@@ -71,7 +74,15 @@ class Templates {
// Render template
public static function render($file, $tags) {
- return self::$_ENG->render($file, $tags);
+ try {
+
+ return self::$_ENG->render($file, $tags);
+
+ } catch(\Exception $e) {
+
+ trigger_error($e->getMessage(), E_USER_ERROR);
+
+ }
}
diff --git a/_sakura/sakura.php b/_sakura/sakura.php
index 84f7337..c583d12 100644
--- a/_sakura/sakura.php
+++ b/_sakura/sakura.php
@@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
-define('SAKURA_VERSION', '20150828');
+define('SAKURA_VERSION', '20150829');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false);
@@ -25,7 +25,7 @@ mb_internal_encoding('utf-8');
// Stop the execution if the PHP Version is older than 5.4.0
if(version_compare(phpversion(), '5.4.0', '<')) {
- trigger_error('Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.');
+ die('
Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.
');
}
@@ -69,21 +69,21 @@ ob_start(Configuration::getConfig('use_gzip') ? 'ob_gzhandler' : null);
// Create a user object for the current logged in user
$currentUser = new User(Session::$userId);
+// Prepare the name of the template to load (outside of SAKURA_NO_TPL because it's used in imageserve.php)
+$templateName = defined('SAKURA_MANAGE') ? Configuration::getConfig('manage_style') : (
+ (
+ isset($currentUser->data['userData']['userOptions']['useMisaki']) &&
+ $currentUser->data['userData']['userOptions']['useMisaki'] &&
+ $currentUser->checkPermission('SITE', 'ALTER_PROFILE')
+ ) ?
+ 'misaki' :
+ Configuration::getConfig('site_style')
+);
+
if(!defined('SAKURA_NO_TPL')) {
// Initialise templating engine
- Templates::init(
- defined('SAKURA_MANAGE') ?
- Configuration::getConfig('manage_style') : (
- (
- isset($currentUser->data['userData']['userOptions']['useMisaki']) &&
- $currentUser->data['userData']['userOptions']['useMisaki'] &&
- $currentUser->checkPermission('SITE', 'ALTER_PROFILE')
- ) ?
- 'misaki' :
- Configuration::getConfig('site_style')
- )
- );
+ Templates::init($templateName);
// Set base page rendering data
$renderData = [
diff --git a/_sakura/templates/misaki/global/header.tpl b/_sakura/templates/misaki/global/header.tpl
index c10e18a..aaef58b 100644
--- a/_sakura/templates/misaki/global/header.tpl
+++ b/_sakura/templates/misaki/global/header.tpl
@@ -70,7 +70,7 @@
// Space for things that need to happen onload
window.addEventListener("load", function() {
- {% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground) %}
+ {% if php.self == '/profile.php' ? (profile.data.userData.profileBackground and not profile.data.userData.userOptions.disableProfileParallax) : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground and not user.data.userData.userOptions.disableProfileParallax) %}
initialiseParallax('userBackground');
{% endif %}
diff --git a/main/content/images/banned-av-test.png b/main/content/data/broomcloset/images/banned-av.png
similarity index 100%
rename from main/content/images/banned-av-test.png
rename to main/content/data/broomcloset/images/banned-av.png
diff --git a/main/content/images/deactivated-av-test.png b/main/content/data/broomcloset/images/deactivated-av.png
similarity index 100%
rename from main/content/images/deactivated-av-test.png
rename to main/content/data/broomcloset/images/deactivated-av.png
diff --git a/main/content/images/no-av-test.png b/main/content/data/broomcloset/images/no-av.png
similarity index 100%
rename from main/content/images/no-av-test.png
rename to main/content/data/broomcloset/images/no-av.png
diff --git a/main/content/images/banned-av.png b/main/content/data/mio/images/banned-av.png
similarity index 100%
rename from main/content/images/banned-av.png
rename to main/content/data/mio/images/banned-av.png
diff --git a/main/content/images/deactivated-av.png b/main/content/data/mio/images/deactivated-av.png
similarity index 100%
rename from main/content/images/deactivated-av.png
rename to main/content/data/mio/images/deactivated-av.png
diff --git a/main/content/images/old-no-av.png b/main/content/data/mio/images/no-av.png
similarity index 100%
rename from main/content/images/old-no-av.png
rename to main/content/data/mio/images/no-av.png
diff --git a/main/content/data/misaki/images/banned-av.png b/main/content/data/misaki/images/banned-av.png
new file mode 100644
index 0000000..af5e90a
Binary files /dev/null and b/main/content/data/misaki/images/banned-av.png differ
diff --git a/main/content/data/misaki/images/deactivated-av.png b/main/content/data/misaki/images/deactivated-av.png
new file mode 100644
index 0000000..ace1874
Binary files /dev/null and b/main/content/data/misaki/images/deactivated-av.png differ
diff --git a/main/content/data/misaki/images/no-av.png b/main/content/data/misaki/images/no-av.png
new file mode 100644
index 0000000..4f7c608
Binary files /dev/null and b/main/content/data/misaki/images/no-av.png differ
diff --git a/main/content/data/yuuno/images/banned-av.png b/main/content/data/yuuno/images/banned-av.png
new file mode 100644
index 0000000..b7da007
Binary files /dev/null and b/main/content/data/yuuno/images/banned-av.png differ
diff --git a/main/content/data/yuuno/images/deactivated-av.png b/main/content/data/yuuno/images/deactivated-av.png
new file mode 100644
index 0000000..1b52de4
Binary files /dev/null and b/main/content/data/yuuno/images/deactivated-av.png differ
diff --git a/main/content/images/no-av.png b/main/content/data/yuuno/images/no-av.png
similarity index 100%
rename from main/content/images/no-av.png
rename to main/content/data/yuuno/images/no-av.png
diff --git a/main/imageserve.php b/main/imageserve.php
index 34157d3..6e6a1d6 100644
--- a/main/imageserve.php
+++ b/main/imageserve.php
@@ -25,14 +25,16 @@ if(isset($_GET['m'])) {
case 'avatar':
// Set paths
- $noAvatar = ROOT . Configuration::getConfig('no_avatar_img');
- $deactiveAvatar = ROOT . Configuration::getConfig('deactivated_avatar_img');
- $bannedAvatar = ROOT . Configuration::getConfig('banned_avatar_img');
+ $noAvatar = ROOT . str_replace('{{ TPL }}', $templateName, Configuration::getConfig('no_avatar_img'));
+ $deactiveAvatar = ROOT . str_replace('{{ TPL }}', $templateName, Configuration::getConfig('deactivated_avatar_img'));
+ $bannedAvatar = ROOT . str_replace('{{ TPL }}', $templateName, Configuration::getConfig('banned_avatar_img'));
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u']) || $_GET['u'] == 0) {
+
$serveImage = $noAvatar;
break;
+
}
// Get user data