File structure changes

This commit is contained in:
flash 2015-06-27 13:03:11 +02:00
parent 273cfe7bd2
commit e88635441e
12 changed files with 70 additions and 49 deletions

View file

@ -22,7 +22,8 @@
"20150604", "20150604",
"20150619", "20150619",
"20150620", "20150620",
"20150621" "20150621",
"20150627"
] ]
@ -1293,6 +1294,15 @@
"change": "Added a bbcode parser." "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)."
}
] ]
} }

View file

@ -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 // Get user's profile fields
public static function getUserProfileFields($id, $inputIsData = false) { public static function getUserProfileFields($id, $inputIsData = false) {

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20150625'); define('SAKURA_VERSION', '20150627');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_VTYPE', 'Development'); define('SAKURA_VTYPE', 'Development');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');

View file

@ -2,7 +2,6 @@
<div class="content news settings"> <div class="content news settings">
<div class="head">Forgot Password</div> <div class="head">Forgot Password</div>
<form method="post" action="/authenticate" id="passwordForm"> <form method="post" action="/authenticate" id="passwordForm">
<input type="hidden" name="redirect" value="//iihsalf.net/" />
<input type="hidden" name="session" value="{{ php.sessionid }}" /> <input type="hidden" name="session" value="{{ php.sessionid }}" />
<input type="hidden" name="time" value="{{ php.time }}" /> <input type="hidden" name="time" value="{{ php.time }}" />
<input type="hidden" name="uid" value="{{ auth.userId }}" /> <input type="hidden" name="uid" value="{{ auth.userId }}" />

View file

@ -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] RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1 [L,QSA]
# Forum # Forum
RewriteRule ^forum/?$ forum/index.php [L,QSA] RewriteRule ^forum/?$ index.php?forums=true [L,QSA]
RewriteRule ^forum/([0-9]+)/?$ forum/viewforum.php?id=$2 [L,QSA] RewriteRule ^forum/([0-9]+)/?$ viewforum.php?id=$2 [L,QSA]
RewriteRule ^forum/(thread|topic)/([0-9]+)/?$ forum/viewtopic.php?id=$2 [L,QSA] RewriteRule ^forum/(thread|topic|[0-9+])/([0-9]+)/?$ viewtopic.php?id=$2 [L,QSA]
# Management # Management
RewriteRule ^manage/?$ manage.php [L,QSA] RewriteRule ^manage/?$ manage.php [L,QSA]

View file

@ -1,28 +0,0 @@
<?php
/*
* Sakura Forum Index
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
// Add page specific things
$renderData['page'] = [
'title' => '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);

View file

@ -1,10 +0,0 @@
<?php
/*
* Sakura Forum Topic Viewer
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';

View file

@ -9,10 +9,15 @@ namespace Sakura;
// Include components // Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
//print Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1); //print Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1);
// Are we in forum mode?
$forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false;
// Add page specific things // Add page specific things
$renderData['newsPosts'] = Main::getNewsPosts(3); $renderData['newsPosts'] = ($forumMode ? null : Main::getNewsPosts(3));
$renderData['page'] = [ $renderData['page'] = [
'title' => Configuration::getConfig('sitename') 'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')),
'boards' => ($forumMode ? Forum::getBoardList() : null)
]; ];
$renderData['stats'] = [ $renderData['stats'] = [
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'), '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 page contents
print Templates::render('main/index.tpl', $renderData); print Templates::render(($forumMode ? 'forum' : 'main') .'/index.tpl', $renderData);

View file

@ -223,7 +223,15 @@ if(Users::checkLogin()) {
// Section specific // Section specific
switch($currentPage) { switch($currentPage) {
// Notification history // Profile
case 'profile':
$renderData['profile'] = [
'user' => Users::getUserProfileData(Session::$userId),
'fields' => Database::fetch('profilefields')
];
break;
// Friends
case 'friends': case 'friends':
$renderData['friends'] = Users::getFriends(); $renderData['friends'] = Users::getFriends();
break; break;

View file

@ -7,4 +7,4 @@
namespace Sakura; namespace Sakura;
// Include components // Include components
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php'; require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';

11
main/viewtopic.php Normal file
View file

@ -0,0 +1,11 @@
<?php
/*
* Sakura Forum Topic Viewer
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
print 'THIS IS VIEWTOPIC';