This commit is contained in:
flash 2015-04-01 19:45:05 +02:00
parent df27981146
commit e5e7c0aaaf
2 changed files with 20 additions and 3 deletions

View file

@ -62,6 +62,13 @@ class Main {
} }
// Parse markdown
private static function mdParse($text) {
return $_MD->text($text);
}
// Verify ReCAPTCHA // Verify ReCAPTCHA
public static function verifyCaptcha($response) { public static function verifyCaptcha($response) {
@ -167,7 +174,8 @@ class Main {
// Get contents from the database // Get contents from the database
$infopage = Database::fetch('infopages', false, ['shorthand' => [$id, '=']]); $infopage = Database::fetch('infopages', false, ['shorthand' => [$id, '=']]);
print_r($infopage); // Return the data if there is any else just return false
return count($infopage) ? $infopage : false;
} }

View file

@ -12,10 +12,19 @@ require_once '/var/www/flashii.net/_sakura/sakura.php';
// Set default variables // Set default variables
$renderData['page'] = [ $renderData['page'] = [
'title' => 'Info pages', 'title' => 'Info pages',
'content' => 'Unable to load the requested info page.' 'content' => Main::mdParse("# Unable to load the requested info page.\r\n\r\nCheck the URL and try again.")
]; ];
$ipData = Main::loadInfoPage(isset($_GET['r']) ? strtolower($_GET['r']) : ''); // Get info page data from the database
if($ipData = Main::loadInfoPage(isset($_GET['r']) ? strtolower($_GET['r']) : '')) {
// Assign new proper variable
$renderData['page'] = [
'title' => $ipData['title'],
'content' => Main::mdParse($ipData['content'])
]
}
// Print page contents // Print page contents
print Main::$_TPL->render('main/infopage.tpl', $renderData); print Main::$_TPL->render('main/infopage.tpl', $renderData);