diff --git a/_sakura/changelog.json b/_sakura/changelog.json index eb50d8e..ba51c70 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -22,7 +22,8 @@ "20150604", "20150619", "20150620", - "20150621" + "20150621", + "20150627" ] @@ -1293,6 +1294,15 @@ "change": "Added a bbcode parser." } + ], + + "20150627": [ + + { + "type": "UPD", + "change": "Put the Forum Listing and Front Page in the same PHP file as they both request nearly identical info (only difference is probably news post/forum posts)." + } + ] } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index 3b99439..35355c2 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -708,6 +708,32 @@ class Users { } + // Get the available profile fields + public static function getProfileFields() { + + // Get profile fields + $profileFields = Database::fetch('profilefields'); + + // If there's nothing just return null + if(!count($profileFields)) + return null; + + // Create output array + $fields = []; + + // Iterate over the fields and clean them up + foreach($profileFields as $field) { + + $fields[$field['id']] = $field; + $fields[$field['id']]['ident'] = Main::cleanString($field['name'], true, true); + + } + + // Return the yeahs + return $fields; + + } + // Get user's profile fields public static function getUserProfileFields($id, $inputIsData = false) { diff --git a/_sakura/sakura.php b/_sakura/sakura.php index c867716..9f672d2 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150625'); +define('SAKURA_VERSION', '20150627'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VTYPE', 'Development'); define('SAKURA_COLOUR', '#6C3082'); diff --git a/_sakura/templates/yuuno/main/forgotpassword.tpl b/_sakura/templates/yuuno/main/forgotpassword.tpl index 725152b..ef70aa6 100644 --- a/_sakura/templates/yuuno/main/forgotpassword.tpl +++ b/_sakura/templates/yuuno/main/forgotpassword.tpl @@ -2,7 +2,6 @@
Forgot Password
- diff --git a/main/.htaccess b/main/.htaccess index b500ebc..fdc457d 100644 --- a/main/.htaccess +++ b/main/.htaccess @@ -70,9 +70,9 @@ RewriteRule ^a/([0-9]+)$|a/([0-9]+).png$ imageserve.php?m=avatar&u=$1 [L,QSA] RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1 [L,QSA] # Forum -RewriteRule ^forum/?$ forum/index.php [L,QSA] -RewriteRule ^forum/([0-9]+)/?$ forum/viewforum.php?id=$2 [L,QSA] -RewriteRule ^forum/(thread|topic)/([0-9]+)/?$ forum/viewtopic.php?id=$2 [L,QSA] +RewriteRule ^forum/?$ index.php?forums=true [L,QSA] +RewriteRule ^forum/([0-9]+)/?$ viewforum.php?id=$2 [L,QSA] +RewriteRule ^forum/(thread|topic|[0-9+])/([0-9]+)/?$ viewtopic.php?id=$2 [L,QSA] # Management RewriteRule ^manage/?$ manage.php [L,QSA] diff --git a/main/forum/index.php b/main/forum/index.php deleted file mode 100644 index 1429650..0000000 --- a/main/forum/index.php +++ /dev/null @@ -1,28 +0,0 @@ - 'Forum Listing', - 'boards' => Forum::getBoardList() -]; -$renderData['stats'] = [ - 'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'), - 'newestUser' => ($_INDEX_NEWEST_USER = max($_INDEX_USERS)), - 'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'), - 'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'), - 'onlineUsers' => Users::checkAllOnline(), - 'topicCount' => '0 topics', - 'postCount' => '0 posts' -]; - -// Print page contents -print Templates::render('forum/index.tpl', $renderData); diff --git a/main/forum/viewtopic.php b/main/forum/viewtopic.php deleted file mode 100644 index dd3eded..0000000 --- a/main/forum/viewtopic.php +++ /dev/null @@ -1,10 +0,0 @@ - Configuration::getConfig('sitename') + 'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')), + 'boards' => ($forumMode ? Forum::getBoardList() : null) ]; $renderData['stats'] = [ 'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'), @@ -25,4 +30,4 @@ $renderData['stats'] = [ ]; // Print page contents -print Templates::render('main/index.tpl', $renderData); +print Templates::render(($forumMode ? 'forum' : 'main') .'/index.tpl', $renderData); diff --git a/main/forum/posting.php b/main/posting.php similarity index 100% rename from main/forum/posting.php rename to main/posting.php diff --git a/main/settings.php b/main/settings.php index 821f3e8..764f17e 100644 --- a/main/settings.php +++ b/main/settings.php @@ -223,7 +223,15 @@ if(Users::checkLogin()) { // Section specific switch($currentPage) { - // Notification history + // Profile + case 'profile': + $renderData['profile'] = [ + 'user' => Users::getUserProfileData(Session::$userId), + 'fields' => Database::fetch('profilefields') + ]; + break; + + // Friends case 'friends': $renderData['friends'] = Users::getFriends(); break; diff --git a/main/forum/viewforum.php b/main/viewforum.php similarity index 52% rename from main/forum/viewforum.php rename to main/viewforum.php index fb4ba8d..15a7460 100644 --- a/main/forum/viewforum.php +++ b/main/viewforum.php @@ -7,4 +7,4 @@ namespace Sakura; // Include components -require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php'; +require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; diff --git a/main/viewtopic.php b/main/viewtopic.php new file mode 100644 index 0000000..2a2d105 --- /dev/null +++ b/main/viewtopic.php @@ -0,0 +1,11 @@ +