From e0ad3aae09fe3a8425812d14093cf133ad385321 Mon Sep 17 00:00:00 2001 From: Stefan Brannfjell Date: Wed, 3 Sep 2014 00:59:12 +0200 Subject: [PATCH] Fix #153 You can now load sub files (custom pages created in layout folder) instead of the default Znote AAC files. (override system). --- engine/init.php | 27 +++++++++++++++++++++ layout/sub.php | 52 +++++++++++++++++++++++++++------------- layout/sub/downloads.php | 35 +++++++++++++++++++++++++++ sub.php | 14 +++++++---- 4 files changed, 106 insertions(+), 22 deletions(-) create mode 100644 layout/sub/downloads.php diff --git a/engine/init.php b/engine/init.php index e405099..9861a2e 100644 --- a/engine/init.php +++ b/engine/init.php @@ -113,4 +113,31 @@ if ($config['log_ip']) { //var_dump($v_activity, $v_register, $v_highscore, $v_c_char, $v_s_char, $v_form); //echo ' <--- IP logging activity past 10 seconds.'; } + +// Sub page override system +if ($config['allowSubPages']) { + require_once 'layout/sub.php'; + $filename = explode('/', $_SERVER['PHP_SELF']); + $filename = $filename[count($filename)-1]; + if (isset($subpages) && !empty($subpages)) { + foreach ($subpages as $page) { + if ($page['override'] && $page['file'] === $filename) { + require_once 'layout/overall/header.php'; + require_once 'layout/sub/'.$page['file']; + require_once 'layout/overall/footer.php'; + exit; + } + } + } else { + ?> +
+

Old layout!

+

The layout is running an outdated sub system which is not compatible with this version of Znote AAC.

+

The file /layout/sub.php is outdated. +
Please update it to look like THIS. +

+
+ \ No newline at end of file diff --git a/layout/sub.php b/layout/sub.php index 23a7c1a..bde9ca2 100644 --- a/layout/sub.php +++ b/layout/sub.php @@ -1,19 +1,37 @@ Sub page not recognized.

The sub page you requested is not recognized.

'; -} +/* Znote AAC Sub System + - Used to create custom pages + - Place the contents of the page in /layout/sub/ folder. + : You don't need to include init, header or footer. + Its already taken care of, just write the contents you want. + + Then add that page to the configuration below. Config syntax: + 'PAGENAME' => array( + 'file' => 'fileName.php', + 'override' => false + ), + ................ + There are 2 ways to view your page, by using sub.php file, or by overriding an existing default page. + 1: yourwebiste.com/sub.php?page=PAGENAME + 2: By having override => true, then it will load your sub file instead of the default znote aac file. + +*/ + +$subpages = array( + // website.com/sub.php?page=blank + 'blank' => array( + // layout/sub/blank.php + 'file' => 'blank.php', + // false means don't run this file instead of the regular file at website.com/blank.php + 'override' => false + ), + 'houses' => array( + 'file' => 'houses.php', + 'override' => false + ), + 'downloads' => array( + 'file' => 'downloads.php', + 'override' => false + ), +); ?> \ No newline at end of file diff --git a/layout/sub/downloads.php b/layout/sub/downloads.php new file mode 100644 index 0000000..6884525 --- /dev/null +++ b/layout/sub/downloads.php @@ -0,0 +1,35 @@ +
+

Downloads

+

Sub system Override DEMO

+

In order to play, you need an compatible IP changer and a Tibia client.

+ +

Download otland IP changer HERE.

+

Download Tibia client for windows HERE.

+

Download Tibia client for linux HERE.

+ +

How to connect and play:

+
    +
  1. + Download and install the tibia client if you havent already. +
  2. +
  3. + Download and run the IP changer. +
  4. +
  5. + In the IP changer, write this in the IP field: +
  6. +
  7. + In the IP changer, click on Settings and then Add new Tibia client. +
  8. +
  9. + In the IP changer, in the Version field, write your desired version. +
  10. +
  11. + In the IP changer, click on Browse, navigate to your desired Tibia version folder, select Tibia.exe and click Add. Then click Close +
  12. +
  13. + Now you can successfully login on the tibia client and play clicking on Apply every time you want.
    + If you do not have an account to login with, you need to register an account HERE. +
  14. +
+
\ No newline at end of file diff --git a/sub.php b/sub.php index 535469c..6fc8ad2 100644 --- a/sub.php +++ b/sub.php @@ -1,6 +1,10 @@ -Sub page not recognized.

The sub page you requested is not recognized.

'; + } +} else echo '

System disabled.

The sub page system is disabled.

'; - -include 'layout/overall/footer.php'; ?> \ No newline at end of file +require_once 'layout/overall/footer.php'; ?> \ No newline at end of file