From 1db3bddd5e3d29ee3b913582646e1321efb71a00 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 4 Jan 2016 02:46:23 +0100 Subject: [PATCH] article page --- mojotrollz/page/autoload.inc | 3 ++- mojotrollz/page/default_article/autoload.inc | 2 ++ .../page/default_article/default_article.php | 14 ++++++++++++++ mojotrollz/page/default_article/tpl/article.tpl | 15 +++++++++++++++ mojotrollz/page/page_mojotrollz.php | 3 +++ mojotrollz/sql/mysql/system_api.sql | 3 ++- mojotrollz/sql/mysql/system_page.sql | 2 ++ 7 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 mojotrollz/page/default_article/autoload.inc create mode 100644 mojotrollz/page/default_article/default_article.php create mode 100644 mojotrollz/page/default_article/tpl/article.tpl diff --git a/mojotrollz/page/autoload.inc b/mojotrollz/page/autoload.inc index a7a7ef3..055f428 100644 --- a/mojotrollz/page/autoload.inc +++ b/mojotrollz/page/autoload.inc @@ -5,4 +5,5 @@ require_once dirname(__FILE__).'/default_start/autoload.inc'; require_once dirname(__FILE__).'/default_impressum/autoload.inc'; require_once dirname(__FILE__).'/default_login/autoload.inc'; require_once dirname(__FILE__).'/default_serverlist/autoload.inc'; -require_once dirname(__FILE__).'/default_beta/autoload.inc'; \ No newline at end of file +require_once dirname(__FILE__).'/default_beta/autoload.inc'; +require_once dirname(__FILE__).'/default_article/autoload.inc'; \ No newline at end of file diff --git a/mojotrollz/page/default_article/autoload.inc b/mojotrollz/page/default_article/autoload.inc new file mode 100644 index 0000000..8fd92c5 --- /dev/null +++ b/mojotrollz/page/default_article/autoload.inc @@ -0,0 +1,2 @@ +id = $id;} + + public function html(){ + $element = \SYSTEM\PAGE\text::get_adv($this->id); + $element['published'] = date_format(new DateTime($element['time_create']), 'H:i d-m-Y'); + $element['ago'] = \SYSTEM\time::time_ago_string(strtotime($element['time_create'])); + $element = array_merge($element,\SYSTEM\PAGE\text::tag('time')); + return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_article/tpl/article.tpl'), $element); + } +} \ No newline at end of file diff --git a/mojotrollz/page/default_article/tpl/article.tpl b/mojotrollz/page/default_article/tpl/article.tpl new file mode 100644 index 0000000..5030c7b --- /dev/null +++ b/mojotrollz/page/default_article/tpl/article.tpl @@ -0,0 +1,15 @@ +
+
+
+

Author: ${author_name}

+

${ago}

+
+
+ ${text} +

Published: ${published}

+
+
+ +
+
+
\ No newline at end of file diff --git a/mojotrollz/page/page_mojotrollz.php b/mojotrollz/page/page_mojotrollz.php index dedf4fb..be57ce3 100644 --- a/mojotrollz/page/page_mojotrollz.php +++ b/mojotrollz/page/page_mojotrollz.php @@ -24,4 +24,7 @@ class page_mojotrollz extends \SYSTEM\API\api_default { public static function page_beta($key=null){ return (new default_beta($key))->html();} + + public static function page_article($id){ + return (new default_article($id))->html();} } \ No newline at end of file diff --git a/mojotrollz/sql/mysql/system_api.sql b/mojotrollz/sql/mysql/system_api.sql index 9b4b55b..fa7e516 100644 --- a/mojotrollz/sql/mysql/system_api.sql +++ b/mojotrollz/sql/mysql/system_api.sql @@ -7,4 +7,5 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (213, 0, 2, 11, 'register', 'wowpassword', 'STRING'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (214, 0, 3, 11, 'register', 'betakey', 'STRING'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 1, 3, 1, 'beta', 'key', 'STRING'); \ No newline at end of file +REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 1, 3, 1, 'beta', 'key', 'STRING'); +REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (215, 1, 2, 1, 'article', 'id', 'STRING'); \ No newline at end of file diff --git a/mojotrollz/sql/mysql/system_page.sql b/mojotrollz/sql/mysql/system_page.sql index 22ced30..2002626 100644 --- a/mojotrollz/sql/mysql/system_page.sql +++ b/mojotrollz/sql/mysql/system_page.sql @@ -6,3 +6,5 @@ REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login` REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (20, 1, 'login', 'login', -1, 0, 0, '#content', './?page=login', 'init_login', 'default_login'); REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (25, 1, 'beta', 'beta', -1, 0, 0, '#content', './?page=beta&key=${key}', 'init_beta', 'default_beta'); + +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (30, 1, 'article', 'article', -1, 0, 0, '#content', './?page=article&id=${article}', 'init_article', 'default_article');