diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 8787f9a..893fa11 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -60,7 +60,8 @@ "20150904", "20150905", "20150906", - "20150907" + "20150907", + "20150908" ] @@ -2589,6 +2590,36 @@ "user": "Flashwave" } + ], + + "20150908": [ + + { + "type": "REM", + "change": "Removed ability to switch to Misaki through the site options (it's currently very broken).", + "user": "Flashwave" + }, + { + "type": "UPD", + "change": "Hide Groups menu from the Settings page as the backend functionality is delayed until after the first stable.", + "user": "Flashwave" + }, + { + "type": "FIX", + "change": "Fixed checkboxes not doing what they're supposed to do.", + "user": "Flashwave" + }, + { + "type": "ADD", + "change": "Added birthdate changing.", + "user": "Flashwave" + }, + { + "type": "UPD", + "change": "Made dates on profile a bit more readable.", + "user": "Flashwave" + } + ] } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 823b4dc..351861e 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -827,14 +827,17 @@ $errorPage .= ' } // Time elapsed - public static function timeElapsed($timestamp) { + public static function timeElapsed($timestamp, $append = ' ago', $none = 'Just now') { // Subtract the entered timestamp from the current timestamp $time = time() - $timestamp; // If the new timestamp is below 1 return a standard string - if($time < 1) - return 'Just now'; + if($time < 1) { + + return $none; + + } // Array containing time "types" $times = [ @@ -857,7 +860,7 @@ $errorPage .= ' $round = round($calc); // Return the string - return $round .' '. $times[$secs] . ($round == 1 ? '' : 's') .' ago'; + return $round .' '. $times[$secs] . ($round == 1 ? '' : 's') . $append; } diff --git a/_sakura/components/User.php b/_sakura/components/User.php index 1a7c5ed..673c514 100644 --- a/_sakura/components/User.php +++ b/_sakura/components/User.php @@ -135,9 +135,9 @@ class User { } // Get all the friend of this user - public function getFriends() { + public function getFriends($timestamps = false, $getData = false, $checkOnline = false) { - return Users::getFriends($this->data['id']); + return Users::getFriends($this->data['id'], $timestamps, $getData, $checkOnline); } @@ -155,6 +155,19 @@ class User { } + // Get amount of time since user events + public function elapsed($append = ' ago', $none = 'Just now') { + + return [ + + 'joined' => Main::timeElapsed($this->data['regdate'], $append, $none), + 'lastOnline' => Main::timeElapsed($this->data['lastdate'], $append, $none), + 'birth' => Main::timeElapsed(strtotime($this->data['birthday']), $append, $none) + + ]; + + } + // Get the user's profile fields public function profileFields() { diff --git a/_sakura/sakura.php b/_sakura/sakura.php index b822dc7..9d7963e 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150907'); +define('SAKURA_VERSION', '20150908'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_STABLE', false); @@ -75,15 +75,7 @@ $currentUser = new User(Session::$userId); $urls = new Urls(); // 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') -); +$templateName = defined('SAKURA_MANAGE') ? Configuration::getConfig('manage_style') : Configuration::getConfig('site_style'); if(!defined('SAKURA_NO_TPL')) { @@ -98,6 +90,8 @@ if(!defined('SAKURA_NO_TPL')) { * Attempt to use a class instead of an assoc. array for the * template variables since twig supports this to make accessing * certain functions, like the time elapsed function easier. + * Update 2015-09-08: Apparently this will be added in PHP 7 so + * we'll be looking out for that. */ 'sakura' => [ diff --git a/_sakura/templates/yuuno/profile/index.tpl b/_sakura/templates/yuuno/profile/index.tpl index a694b9e..013adc3 100644 --- a/_sakura/templates/yuuno/profile/index.tpl +++ b/_sakura/templates/yuuno/profile/index.tpl @@ -37,15 +37,18 @@ {% endif %}