add current dev version (WIP)
authorStricted <info@stricted.de>
Wed, 23 Dec 2015 19:15:10 +0000 (20:15 +0100)
committerStricted <info@stricted.de>
Wed, 23 Dec 2015 19:15:10 +0000 (20:15 +0100)
34 files changed:
cache/.gitignore [new file with mode: 0644]
config.inc.php.example
database.sql
index.php
js/default/functions.js
lib/api/page/ServerPage.class.php
lib/page/LoginPage.class.php
lib/system/DNS.class.php
lib/system/RequestHandler.class.php
lib/system/SingletonFactory.class.php [new file with mode: 0644]
lib/system/SystemException.class.php
lib/system/User.class.php
lib/system/api/smarty
lib/system/cache/CacheHandler.class.php [new file with mode: 0644]
lib/system/cache/builder/AbstractCacheBuilder.class.php [new file with mode: 0644]
lib/system/cache/builder/ControllerCacheBuilder.class.php [new file with mode: 0644]
lib/system/cache/builder/DNSApiCacheBuilder.class.php [new file with mode: 0644]
lib/system/cache/builder/ICacheBuilder.class.php [new file with mode: 0644]
lib/system/cache/source/DiskCacheSource.class.php [new file with mode: 0644]
lib/system/cache/source/ICacheSource.class.php [new file with mode: 0644]
lib/system/template/plugins/block.link.php [new file with mode: 0644]
lib/system/template/plugins/function.pages.php
lib/system/template/plugins/prefilter.hascontent.php
templates/default/apiManagement.tpl
templates/default/domainAdd.tpl
templates/default/error.tpl
templates/default/header.tpl
templates/default/index.tpl
templates/default/login.tpl
templates/default/recordAdd.tpl
templates/default/recordEdit.tpl
templates/default/recordList.tpl
templates/default/secAdd.tpl
templates/default/secList.tpl

diff --git a/cache/.gitignore b/cache/.gitignore
new file mode 100644 (file)
index 0000000..66ca35b
--- /dev/null
@@ -0,0 +1 @@
+*.php
\ No newline at end of file
index 1169b315dd06dd217358cd62fca20abe193e41b4..178a25f8896b9b622e035facb687a343ca105fcb 100644 (file)
@@ -1,8 +1,8 @@
-<?php
-$driver = "mysql";
-$host = "localhost";
-$port = 3306;
-$user = "";
-$pass = "";
-$db = "";
+<?php\r
+$driver = "mysql";\r
+$host = "localhost";\r
+$port = 3306;\r
+$user = "";\r
+$pass = "";\r
+$db = "";\r
 $tpl = "default";
\ No newline at end of file
index 32cf91f5b7d5013ac10abf3cda36e6ef05adc8ad..0a7b67a75503987d09d2da7f437df314e67c37b1 100644 (file)
@@ -119,6 +119,7 @@ INSERT INTO dns_options VALUES (9, 'dns_soa_retry', '7200');
 INSERT INTO dns_options VALUES (10, 'dns_soa_expire', '604800');
 INSERT INTO dns_options VALUES (11, 'dns_soa_minimum_ttl', '60');
 INSERT INTO dns_options VALUES (12, 'enable_dnssec', '1');
+INSERT INTO dns_options VALUES (13, 'cache_source_type', 'disk');
 
 
 INSERT INTO `dns_user` VALUES (1, 'admin', 'example@example.net', '$2a$08$XfcfTGc1LlmOHWUt/2sfNeFLEwqESy6wmrIIJMyQS1j5pwembqiae', '0', '2');
index 54d9dc980dc426700d5ccd33488fc7824abbb6ee..e4f891330a42c1c4b89bec8d3beb5af65f1f404d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,8 @@ namespace dns;
 use dns\system\DNS;
 
 session_start();
-
+ini_set('display_errors', 1);
+ini_set('error_reporting', E_ALL);
 /**
  * @author      Jan Altensen (Stricted)
  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
index f87f682d1552d40fa71548d36b82d53cdf13d677..94323616f76788f80f801e8cbaa37c9420b11e0d 100644 (file)
@@ -43,7 +43,7 @@ $(document).ready(function(){
                                        }
                                
                                        $.ajax({
-                                               url: 'index.php?page=action',
+                                               url: 'index.php?Action',
                                                data: {
                                                        action: action,
                                                        dataID: deleteID
@@ -76,7 +76,7 @@ $(document).ready(function(){
                $('#requestApiKey').unbind('click');
                $("#requestApiKey").on('click', function(e){
                        $.ajax({
-                               url: 'index.php?page=action',
+                               url: 'index.php?Action',
                                data: {
                                        action: 'requestApiKey',
                                        dataID: 1
@@ -121,7 +121,7 @@ $(document).ready(function(){
                                }
                                
                                $.ajax({
-                                       url: 'index.php?page=action',
+                                       url: 'index.php?Action',
                                        data: {
                                                action: action,
                                                dataID: dataID
@@ -239,7 +239,7 @@ $(document).ready(function(){
                        var t = $(this);
                        var dataID = t.attr('export-id');
                        $.ajax({
-                               url: 'index.php?page=action',
+                               url: 'index.php?Action',
                                data: {
                                        action: 'export',
                                        dataID: dataID
@@ -316,7 +316,7 @@ $(document).ready(function(){
                                var origin = $('#importModal').find('.modal-body').find('#importOrigin').val();
                                var zone = $('#importModal').find('.modal-body').find('#importTextarea').val();
                                $.ajax({
-                                       url: 'index.php?page=action',
+                                       url: 'index.php?Action',
                                        data: {
                                                action: 'import',
                                                dataID: dataID ? dataID : 0, /* 0 for new zone otherwise soaID for existing zone*/
@@ -332,11 +332,11 @@ $(document).ready(function(){
                                                else {
                                                        if (!dataID) {
                                                                // redirect to main page on success
-                                                               $(location).attr('href','index.php?page=DomainList');
+                                                               $(location).attr('href','index.php?DomainList');
                                                        }
                                                        else {
                                                                // redirect to record list on success
-                                                               $(location).attr('href','index.php?page=RecordList&id=' + dataID);
+                                                               $(location).attr('href','index.php?RecordList/' + dataID);
                                                        }
                                                }
                                        }
index e0386baadf4fd143a24a4cfb592162dda1a090f5..4554fc9f004eaf1f7a1e9a894d36b4aa1fb719a1 100644 (file)
@@ -1,6 +1,7 @@
 <?php
-namespace dns\page;
+namespace dns\api\page;
 use dns\page\AbstractPage;
+use dns\system\cache\builder\DNSApiCacheBuilder;
 use dns\system\DNS;
 
 /**
@@ -24,33 +25,7 @@ class ServerPage extends AbstractPage {
                        exit;
                }
                else {
-                       $data = array();
-                       
-                       $sql = "SELECT * FROM dns_soa where active = ?";
-                       $statement = DNS::getDB()->query($sql, array(1));
-                       
-                       while ($zone = DNS::getDB()->fetch_array($statement)) {
-                               $data[$zone['origin']] = array();
-                               $data[$zone['origin']]['soa'] = $zone;
-                               $data[$zone['origin']]['rr'] = array();
-                               $data[$zone['origin']]['sec'] = array();
-                               
-                               /* resource records */
-                               $sql2 = "SELECT * FROM dns_rr where zone = ? and active = ?";
-                               $statement2 = DNS::getDB()->query($sql2, array($zone['id'], 1));
-                               while ($rr = DNS::getDB()->fetch_array($statement2)) {
-                                       $data[$zone['origin']]['rr'][] = $rr;
-                               }
-                               
-                               if (ENABLE_DNSSEC) {
-                                       /* dnssec keys */
-                                       $sql3 = "SELECT * FROM dns_sec where zone = ? and active = ?";
-                                       $statement3 = DNS::getDB()->query($sql3, array($zone['id'], 1));
-                                       while ($sec = DNS::getDB()->fetch_array($statement3)) {
-                                               $data[$zone['origin']]['sec'][] = $sec;
-                                       }
-                               }
-                       }
+                       $data = DNSApiCacheBuilder::getInstance()->getData();
 
                        header('Content-Type: application/json');
                        echo json_encode($data, JSON_PRETTY_PRINT);
index e2da1c8f3df2de5e2968118cdb9705597b402d23..283ce7a189fff690ab0597fa35721982f112cc78 100644 (file)
@@ -20,7 +20,7 @@ class LoginPage extends AbstractPage {
                                }
                                
                                User::login(trim($_POST['username']), trim($_POST['password']), $remember);
-                               header("Location: ?page=index");
+                               header("Location: index.php?index");
                        }
                }
        }
index 87edc9d57fd09338dd272caa1a371c6fbebed508..1b1dc515d8ff30ef7b506a81c2c544a8792149c8 100644 (file)
@@ -138,9 +138,11 @@ class DNS {
                if (error_reporting() != 0) {
                        $type = 'error';
                        switch ($errorNo) {
-                               case 2: $type = 'warning';
+                               case 2:
+                                       $type = 'warning';
                                        break;
-                               case 8: $type = 'notice';
+                               case 8:
+                                       $type = 'notice';
                                        break;
                        }
                        
@@ -285,7 +287,12 @@ class DNS {
                require_once(DNS_DIR.'/lib/system/api/smarty/libs/Smarty.class.php');
                self::$tplObj = new \Smarty;
                
-               self::getTPL()->setTemplateDir(DNS_DIR.(empty(self::$module) ? '' : '/'.self::$module)."/templates/".$tpl);
+               if (!empty(self::$module)) {
+                       // try first to load the template from module then from core
+                       self::getTPL()->addTemplateDir(DNS_DIR.'/'.self::$module."/templates/".$tpl);
+               }
+               
+               self::getTPL()->addTemplateDir(DNS_DIR."/templates/".$tpl);
                self::getTPL()->setCompileDir(DNS_DIR.(empty(self::$module) ? '' : '/'.self::$module)."/templates/compiled/".$tpl);
                self::getTPL()->setPluginsDir(array(
                        DNS_DIR."/lib/system/api/smarty/libs/plugins",
index bf616112ee93bbc1957fe871967ef7f48ea5f4c3..89e94418a9415706fc87c65631103da5ad875d95 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace dns\system;
+use dns\system\cache\builder\ControllerCacheBuilder;
 
 /**
  * @author      Jan Altensen (Stricted)
@@ -7,43 +8,48 @@ namespace dns\system;
  * @copyright   2013-2015 Jan Altensen (Stricted)
  */
 class RequestHandler {
+       protected $pattern = "";
+       protected $routeData = array();
+       protected $controllers = array();
+       
        /**
         * init RequestHandler
         */
        public function __construct ($module = '') {
-               $className = "";
-               $pages = glob(DNS_DIR.'/lib/'.(empty($module) ? '' : $module.'/').'page/*Page.class.php');
-               if (isset($_GET["page"]) && !empty($_GET["page"])) {
-                       if (strtolower($_GET["page"]) != "abstract") {
-                               foreach ($pages as $page) {
-                                       $page = str_replace('Page.class.php', '', basename($page));
-                                       if (strtolower($_GET["page"]) == strtolower($page)) {
-                                               $class = "\\dns".(empty($module) ? '' : "\\".$module)."\\page\\".$page."Page";
-                                               if (class_exists($class) && is_subclass_of($class, '\\dns\\page\\AbstractPage')) {
-                                                       $className = $class;
-                                               }
-                                               break;
-                                       }
-                               }
-                       }
+               $this->pattern = '~/?(?:(?P<controller>[A-Za-z0-9\-]+)(?:/(?P<id>\d+)(?:-(?P<title>[^/]+))?)?)?~x';
+               $this->getControllers($module);
+               
+               if (DNS::getSession()->username !== null) {
+                       DNS::getTPL()->assign(array("username" => DNS::getSession()->username));
                }
                else {
-                       $className = '\\dns'.(empty($module) ? '' : '\\'.$module).'\\page\\IndexPage';
+                       DNS::getTPL()->assign(array("username" => ''));
                }
                
-               if (!User::isLoggedIn() && $className != '\dns\page\LoginPage' && $className != '\dns\page\ApiPage') {
-                       DNS::getTPL()->display('login.tpl');
-                       exit;
+               $className = "";
+               if (!empty($_SERVER['QUERY_STRING'])) {
+                       $this->matches($_SERVER['QUERY_STRING']);
+                       $this->registerRouteData();
+               }
+               else {
+                       $className = '\\dns'.(empty($module) ? '' : '\\'.$module).'\\page\\IndexPage';
                }
                
-               if (DNS::getSession()->username !== null) {
-                       DNS::getTPL()->assign(array("username" => DNS::getSession()->username));
+               if (isset($this->routeData['controller']) && !empty($this->routeData['controller'])) {
+                       $controller = strtolower($this->routeData['controller']);
+                       if (isset($this->controllers[$controller]) && !empty($this->controllers[$controller])) {
+                               $className = $this->controllers[$controller];
+                       }
+                       else {
+                               @header('HTTP/1.0 404 Not Found');
+                               DNS::getTPL()->assign(array("activeMenuItem" => '', "error" => 'The link you are trying to reach is no longer available or invalid.'));
+                               DNS::getTPL()->display('error.tpl');
+                               exit;
+                       }
                }
                
-               if (empty($className)) {
-                       @header('HTTP/1.0 404 Not Found');
-                       DNS::getTPL()->assign(array("activeMenuItem" => '', "error" => 'The link you are trying to reach is no longer available or invalid.'));
-                       DNS::getTPL()->display('error.tpl');
+               if (!User::isLoggedIn() && $className != '\dns\page\LoginPage' && $className != '\dns\page\ApiPage') {
+                       DNS::getTPL()->display('login.tpl');
                        exit;
                }
                
@@ -80,4 +86,45 @@ class RequestHandler {
                        exit;
                }
        }
+
+       /**
+        * Registers route data within $_GET and $_REQUEST.
+        */
+       protected function registerRouteData() {
+               foreach ($this->routeData as $key => $value) {
+                       $_GET[$key] = $value;
+                       $_REQUEST[$key] = $value;
+               }
+       }
+       
+       public function getControllers ($module) {
+               
+               $this->controllers = ControllerCacheBuilder::getInstance()->getData(array('module' => $module));
+               /*
+               $pages = glob(DNS_DIR.'/lib/'.(empty($module) ? '' : $module.'/').'page/*Page.class.php');
+               
+               foreach ($pages as $page) {
+                       $page = str_replace('Page.class.php', '', basename($page));
+
+                       $class = "\\dns".(empty($module) ? '' : "\\".$module)."\\page\\".$page."Page";
+                       if (class_exists($class) && is_subclass_of($class, '\\dns\\page\\AbstractPage')) {
+                               $this->controllers[strtolower($page)] = $class;
+                       }
+               }
+               */
+       }
+       
+       public function matches($requestURL) {
+               if (preg_match($this->pattern, $requestURL, $matches)) {
+                       foreach ($matches as $key => $value) {
+                               if (!is_numeric($key)) {
+                                       $this->routeData[$key] = $value;
+                               }
+                       }
+                       
+                       return true;
+               }
+               
+               return false;
+       }
 }
diff --git a/lib/system/SingletonFactory.class.php b/lib/system/SingletonFactory.class.php
new file mode 100644 (file)
index 0000000..c5fee78
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+namespace dns\system;
+
+/**
+ * Basis class for singleton classes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system
+ * @category   Community Framework
+ */
+abstract class SingletonFactory {
+       /**
+        * list of singletons
+        * @var array<SingletonFactory>
+        */
+       protected static $__singletonObjects = array();
+       
+       /**
+        * Singletons do not support a public constructor. Override init() if
+        * your class needs to initialize components on creation.
+        */
+       protected final function __construct() {
+               $this->init();
+       }
+       
+       /**
+        * Called within __construct(), override if neccessary.
+        */
+       protected function init() { }
+       
+       /**
+        * Object cloning is disallowed.
+        */
+       protected final function __clone() { }
+       
+       /**
+        * Object serializing is disallowed.
+        */
+       public final function __sleep() {
+               throw new \Exception('Serializing of Singletons is not allowed');
+       }
+       
+       /**
+        * Returns an unique instance of current child class.
+        * 
+        * @return      \dns\system\SingletonFactory
+        */
+       public static final function getInstance() {
+               $className = get_called_class();
+               if (!array_key_exists($className, self::$__singletonObjects)) {
+                       self::$__singletonObjects[$className] = null;
+                       self::$__singletonObjects[$className] = new $className();
+               }
+               else if (self::$__singletonObjects[$className] === null) {
+                       throw new \Exception("Infinite loop detected while trying to retrieve object for '".$className."'");
+               }
+               
+               return self::$__singletonObjects[$className];
+       }
+       
+       /**
+        * Returns whether this singleton is already initialized.
+        * 
+        * @return      boolean
+        */
+       public static final function isInitialized() {
+               $className = get_called_class();
+               
+               return isset(self::$__singletonObjects[$className]);
+       }
+}
index e616371e46d003d1698802f727dcf6117aee72d9..03ea54e3d3908f824ed28e3a0ee767e467d743b0 100644 (file)
-<?php\r
-namespace dns\system;\r
-\r
-/**\r
- * A SystemException is thrown when an unexpected error occurs.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2015 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.exception\r
- * @category   Community Framework\r
- */\r
-// @codingStandardsIgnoreFile\r
-class SystemException extends \Exception {\r
-       /**\r
-        * error description\r
-        * @var string\r
-        */\r
-       protected $description = null;\r
-       \r
-       /**\r
-        * additional information\r
-        * @var string\r
-        */\r
-       protected $information = '';\r
-       \r
-       /**\r
-        * additional information\r
-        * @var string\r
-        */\r
-       protected $functions = '';\r
-    \r
-       /**\r
-        * exception id\r
-        * @var string\r
-        */\r
-       protected $exceptionID = '';\r
-       \r
-       /**\r
-        * Creates a new SystemException.\r
-        * \r
-        * @param       string          $message        error message\r
-        * @param       integer         $code           error code\r
-        * @param       string          $description    description of the error\r
-        * @param       \Exception      $previous       repacked Exception\r
-        */\r
-       public function __construct($message = '', $code = 0, $description = '', \Exception $previous = null) {\r
-               parent::__construct((string) $message, (int) $code, $previous);\r
-               $this->description = $description;\r
-       }\r
-       \r
-       /**\r
-        * Removes database password from stack trace.\r
-        * @see \Exception::getTraceAsString()\r
-        */\r
-       public function __getTraceAsString() {\r
-               $e = ($this->getPrevious() ?: $this);\r
-        $string = $e->getTraceAsString();\r
-               $string = preg_replace('/PDO->__construct\(.*\)/', 'PDO->__construct(...)', $string);\r
-               $string = preg_replace('/DB->__construct\(.*\)/', 'DB->__construct(...)', $string);\r
-               return $string;\r
-       }\r
-    \r
-       /**\r
-        * @see \Exception::getMessage()\r
-        */\r
-       public function _getMessage() {\r
-               $e = ($this->getPrevious() ?: $this);\r
-               return $e->getMessage();\r
-       }\r
-    \r
-       /**\r
-        * Returns the description of this exception.\r
-        * \r
-        * @return      string\r
-        */\r
-       public function getDescription() {\r
-               return $this->description;\r
-       }\r
-       \r
-       /**\r
-        * Returns exception id\r
-        * \r
-        * @return      string\r
-        */\r
-       public function getExceptionID() {\r
-               if (empty($this->exceptionID)) {\r
-                       $this->logError();\r
-               }\r
-               \r
-               return $this->exceptionID;\r
-       }\r
-    \r
-       /**\r
-        * Writes an error to log file.\r
-        */\r
-       protected function logError() {\r
-               if (!empty($this->exceptionID)) {\r
-                       return;\r
-               }\r
-               \r
-               $logFile = DNS_DIR . '/log/' . gmdate('Y-m-d', time()) . '.txt';\r
-               \r
-               // try to create file\r
-               @touch($logFile);\r
-               \r
-               // validate if file exists and is accessible for us\r
-               if (!file_exists($logFile) || !is_writable($logFile)) {\r
-                       /*\r
-                               We cannot recover if we reached this point, the server admin\r
-                               is urged to fix his pretty much broken configuration.\r
-                               \r
-                               GLaDOS: Look at you, sailing through the air majestically, like an eagle... piloting a blimp.\r
-                       */\r
-                       return;\r
-               }\r
-               \r
-               $e = ($this->getPrevious() ?: $this);\r
-               \r
-               // don't forget to update ExceptionLogViewPage, when changing the log file format\r
-               $message = gmdate('r', time())."\n".\r
-                       'Message: '.$e->getMessage()."\n".\r
-                       'File: '.$e->getFile().' ('.$e->getLine().")\n".\r
-                       'PHP version: '.phpversion()."\n".\r
-                       'DNS version: '.DNS_VERSION."\n".\r
-                       'Request URI: '.(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '')."\n".\r
-                       'Referrer: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')."\n".\r
-                       'User-Agent: '.(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')."\n".\r
-                       'Information: '.json_encode($this->information)."\n".\r
-                       "Stacktrace: \n  ".implode("\n  ", explode("\n", $this->__getTraceAsString()))."\n";\r
-               \r
-               // calculate Exception-ID\r
-               $this->exceptionID = sha1($message);\r
-               $message = "<<<<<<<<".$this->exceptionID."<<<<\n".$message."<<<<\n\n";\r
-               \r
-               // append\r
-               @file_put_contents($logFile, $message, FILE_APPEND);\r
-       }\r
-    \r
-       /**\r
-        * @see \wcf\system\exception\IPrintableException::show()\r
-        */\r
-       public function show() {\r
-               // send status code\r
-               @header('HTTP/1.1 503 Service Unavailable');\r
-               \r
-               // print report\r
-               $e = ($this->getPrevious() ?: $this);\r
-               ?><!DOCTYPE html>\r
-               <html>\r
-                       <head>\r
-                               <title>Fatal error: <?php echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); ?></title>\r
-                               <meta charset="utf-8" />\r
-                               <style>\r
-                                       .systemException {\r
-                                               font-family: 'Trebuchet MS', Arial, sans-serif !important;\r
-                                               font-size: 80% !important;\r
-                                               text-align: left !important;\r
-                                               border: 1px solid #036;\r
-                                               border-radius: 7px;\r
-                                               background-color: #eee !important;\r
-                                               overflow: auto !important;\r
-                                       }\r
-                                       .systemException h1 {\r
-                                               font-size: 130% !important;\r
-                                               font-weight: bold !important;\r
-                                               line-height: 1.1 !important;\r
-                                               text-decoration: none !important;\r
-                                               text-shadow: 0 -1px 0 #003 !important;\r
-                                               color: #fff !important;\r
-                                               word-wrap: break-word !important;\r
-                                               border-bottom: 1px solid #036;\r
-                                               border-top-right-radius: 6px;\r
-                                               border-top-left-radius: 6px;\r
-                                               background-color: #369 !important;\r
-                                               margin: 0 !important;\r
-                                               padding: 5px 10px !important;\r
-                                       }\r
-                                       .systemException div {\r
-                                               border-top: 1px solid #fff;\r
-                                               border-bottom-right-radius: 6px;\r
-                                               border-bottom-left-radius: 6px;\r
-                                               padding: 0 10px !important;\r
-                                       }\r
-                                       .systemException h2 {\r
-                                               font-size: 130% !important;\r
-                                               font-weight: bold !important;\r
-                                               color: #369 !important;\r
-                                               text-shadow: 0 1px 0 #fff !important;\r
-                                               margin: 5px 0 !important;\r
-                                       }\r
-                                       .systemException pre, .systemException p {\r
-                                               text-shadow: none !important;\r
-                                               color: #555 !important;\r
-                                               margin: 0 !important;\r
-                                       }\r
-                                       .systemException pre {\r
-                                               font-size: .85em !important;\r
-                                               font-family: "Courier New" !important;\r
-                                               text-overflow: ellipsis;\r
-                                               padding-bottom: 1px;\r
-                                               overflow: hidden !important;\r
-                                       }\r
-                                       .systemException pre:hover{\r
-                                               text-overflow: clip;\r
-                                               overflow: auto !important;\r
-                                       }\r
-                               </style>\r
-                       </head>\r
-                       <body>\r
-                               <div class="systemException">\r
-                                       <h1>Fatal error: <?php if(!$this->getExceptionID()) { ?>Unable to write log file, please make &quot;<?php echo DNS_DIR; ?>/log/&quot; writable!<?php } else { echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); } ?></h1>\r
-                    \r
-                    <?php if (DNS::debugModeIsEnabled()) { ?>\r
-                                               <div>\r
-                                                       <?php if ($this->getDescription()) { ?><p><br /><?php echo $this->getDescription(); ?></p><?php } ?>\r
-                                                       \r
-                                                       <h2>Information:</h2>\r
-                                                       <p>\r
-                                                               <b>error message:</b> <?php echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); ?><br>\r
-                                                               <b>error code:</b> <?php echo intval($e->getCode()); ?><br>\r
-                                                               <?php echo $this->information; ?>\r
-                                                               <b>file:</b> <?php echo htmlspecialchars($e->getFile(), ENT_COMPAT, 'UTF-8'); ?> (<?php echo $e->getLine(); ?>)<br>\r
-                                                               <b>php version:</b> <?php echo htmlspecialchars(phpversion(), ENT_COMPAT, 'UTF-8'); ?><br>\r
-                                                               <b>dns version:</b> <?php echo DNS_VERSION; ?><br>\r
-                                                               <b>date:</b> <?php echo gmdate('r'); ?><br>\r
-                                                               <b>request:</b> <?php if (isset($_SERVER['REQUEST_URI'])) echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_COMPAT, 'UTF-8'); ?><br>\r
-                                                               <b>referer:</b> <?php if (isset($_SERVER['HTTP_REFERER'])) echo htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8'); ?><br>\r
-                                                       </p>\r
-                                                       \r
-                                                       <h2>Stacktrace:</h2>\r
-                                                       <pre><?php echo htmlspecialchars($this->__getTraceAsString(), ENT_COMPAT, 'UTF-8'); ?></pre>\r
-                                               </div>\r
-                    <?php } else { ?>\r
-                                               <div>\r
-                                                       <h2>Information:</h2>\r
-                                                       <p>\r
-                                                               <?php if (!$this->getExceptionID()) { ?>\r
-                                                                       Unable to write log file, please make &quot;<?php echo DNS_DIR; ?>/log/&quot; writable!\r
-                                                               <?php } else { ?>\r
-                                                                       <b>ID:</b> <code><?php echo $this->getExceptionID(); ?></code><br>\r
-                                                                       Please send the ID above to the site administrator.\r
-                                                               <?php } ?>\r
-                                                       </p>\r
-                                               </div>\r
-                    <?php } ?>\r
-                                       <?php echo $this->functions; ?>\r
-                               </div>\r
-                       </body>\r
-               </html>\r
-               \r
-               <?php\r
-       }\r
-}\r
+<?php
+namespace dns\system;
+
+/**
+ * A SystemException is thrown when an unexpected error occurs.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2015 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.exception
+ * @category   Community Framework
+ */
+// @codingStandardsIgnoreFile
+class SystemException extends \Exception {
+       /**
+        * error description
+        * @var string
+        */
+       protected $description = null;
+       
+       /**
+        * additional information
+        * @var string
+        */
+       protected $information = '';
+       
+       /**
+        * additional information
+        * @var string
+        */
+       protected $functions = '';
+    
+       /**
+        * exception id
+        * @var string
+        */
+       protected $exceptionID = '';
+       
+       /**
+        * Creates a new SystemException.
+        * 
+        * @param       string          $message        error message
+        * @param       integer         $code           error code
+        * @param       string          $description    description of the error
+        * @param       \Exception      $previous       repacked Exception
+        */
+       public function __construct($message = '', $code = 0, $description = '', \Exception $previous = null) {
+               parent::__construct((string) $message, (int) $code, $previous);
+               $this->description = $description;
+       }
+       
+       /**
+        * Removes database password from stack trace.
+        * @see \Exception::getTraceAsString()
+        */
+       public function __getTraceAsString() {
+               $e = ($this->getPrevious() ?: $this);
+        $string = $e->getTraceAsString();
+               $string = preg_replace('/PDO->__construct\(.*\)/', 'PDO->__construct(...)', $string);
+               $string = preg_replace('/DB->__construct\(.*\)/', 'DB->__construct(...)', $string);
+               return $string;
+       }
+    
+       /**
+        * @see \Exception::getMessage()
+        */
+       public function _getMessage() {
+               $e = ($this->getPrevious() ?: $this);
+               return $e->getMessage();
+       }
+    
+       /**
+        * Returns the description of this exception.
+        * 
+        * @return      string
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+       
+       /**
+        * Returns exception id
+        * 
+        * @return      string
+        */
+       public function getExceptionID() {
+               if (empty($this->exceptionID)) {
+                       $this->logError();
+               }
+               
+               return $this->exceptionID;
+       }
+    
+       /**
+        * Writes an error to log file.
+        */
+       protected function logError() {
+               if (!empty($this->exceptionID)) {
+                       return;
+               }
+               
+               $logFile = DNS_DIR . '/log/' . gmdate('Y-m-d', time()) . '.txt';
+               
+               // try to create file
+               @touch($logFile);
+               
+               // validate if file exists and is accessible for us
+               if (!file_exists($logFile) || !is_writable($logFile)) {
+                       /*
+                               We cannot recover if we reached this point, the server admin
+                               is urged to fix his pretty much broken configuration.
+                               
+                               GLaDOS: Look at you, sailing through the air majestically, like an eagle... piloting a blimp.
+                       */
+                       return;
+               }
+               
+               $e = ($this->getPrevious() ?: $this);
+               
+               // don't forget to update ExceptionLogViewPage, when changing the log file format
+               $message = gmdate('r', time())."\n".
+                       'Message: '.$e->getMessage()."\n".
+                       'File: '.$e->getFile().' ('.$e->getLine().")\n".
+                       'PHP version: '.phpversion()."\n".
+                       'DNS version: '.DNS_VERSION."\n".
+                       'Request URI: '.(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '')."\n".
+                       'Referrer: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '')."\n".
+                       'User-Agent: '.(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')."\n".
+                       'Information: '.json_encode($this->information)."\n".
+                       "Stacktrace: \n  ".implode("\n  ", explode("\n", $this->__getTraceAsString()))."\n";
+               
+               // calculate Exception-ID
+               $this->exceptionID = sha1($message);
+               $message = "<<<<<<<<".$this->exceptionID."<<<<\n".$message."<<<<\n\n";
+               
+               // append
+               @file_put_contents($logFile, $message, FILE_APPEND);
+       }
+    
+       /**
+        * @see \wcf\system\exception\IPrintableException::show()
+        */
+       public function show() {
+               // send status code
+               @header('HTTP/1.1 503 Service Unavailable');
+               
+               // print report
+               $e = ($this->getPrevious() ?: $this);
+               ?><!DOCTYPE html>
+               <html>
+                       <head>
+                               <title>Fatal error: <?php echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); ?></title>
+                               <meta charset="utf-8" />
+                               <style>
+                                       .systemException {
+                                               font-family: 'Trebuchet MS', Arial, sans-serif !important;
+                                               font-size: 80% !important;
+                                               text-align: left !important;
+                                               border: 1px solid #036;
+                                               border-radius: 7px;
+                                               background-color: #eee !important;
+                                               overflow: auto !important;
+                                       }
+                                       .systemException h1 {
+                                               font-size: 130% !important;
+                                               font-weight: bold !important;
+                                               line-height: 1.1 !important;
+                                               text-decoration: none !important;
+                                               text-shadow: 0 -1px 0 #003 !important;
+                                               color: #fff !important;
+                                               word-wrap: break-word !important;
+                                               border-bottom: 1px solid #036;
+                                               border-top-right-radius: 6px;
+                                               border-top-left-radius: 6px;
+                                               background-color: #369 !important;
+                                               margin: 0 !important;
+                                               padding: 5px 10px !important;
+                                       }
+                                       .systemException div {
+                                               border-top: 1px solid #fff;
+                                               border-bottom-right-radius: 6px;
+                                               border-bottom-left-radius: 6px;
+                                               padding: 0 10px !important;
+                                       }
+                                       .systemException h2 {
+                                               font-size: 130% !important;
+                                               font-weight: bold !important;
+                                               color: #369 !important;
+                                               text-shadow: 0 1px 0 #fff !important;
+                                               margin: 5px 0 !important;
+                                       }
+                                       .systemException pre, .systemException p {
+                                               text-shadow: none !important;
+                                               color: #555 !important;
+                                               margin: 0 !important;
+                                       }
+                                       .systemException pre {
+                                               font-size: .85em !important;
+                                               font-family: "Courier New" !important;
+                                               text-overflow: ellipsis;
+                                               padding-bottom: 1px;
+                                               overflow: hidden !important;
+                                       }
+                                       .systemException pre:hover{
+                                               text-overflow: clip;
+                                               overflow: auto !important;
+                                       }
+                               </style>
+                       </head>
+                       <body>
+                               <div class="systemException">
+                                       <h1>Fatal error: <?php if(!$this->getExceptionID()) { ?>Unable to write log file, please make &quot;<?php echo DNS_DIR; ?>/log/&quot; writable!<?php } else { echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); } ?></h1>
+                    
+                    <?php if (DNS::debugModeIsEnabled()) { ?>
+                                               <div>
+                                                       <?php if ($this->getDescription()) { ?><p><br /><?php echo $this->getDescription(); ?></p><?php } ?>
+                                                       
+                                                       <h2>Information:</h2>
+                                                       <p>
+                                                               <b>error message:</b> <?php echo htmlspecialchars($this->_getMessage(), ENT_COMPAT, 'UTF-8'); ?><br>
+                                                               <b>error code:</b> <?php echo intval($e->getCode()); ?><br>
+                                                               <?php echo $this->information; ?>
+                                                               <b>file:</b> <?php echo htmlspecialchars($e->getFile(), ENT_COMPAT, 'UTF-8'); ?> (<?php echo $e->getLine(); ?>)<br>
+                                                               <b>php version:</b> <?php echo htmlspecialchars(phpversion(), ENT_COMPAT, 'UTF-8'); ?><br>
+                                                               <b>dns version:</b> <?php echo DNS_VERSION; ?><br>
+                                                               <b>date:</b> <?php echo gmdate('r'); ?><br>
+                                                               <b>request:</b> <?php if (isset($_SERVER['REQUEST_URI'])) echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_COMPAT, 'UTF-8'); ?><br>
+                                                               <b>referer:</b> <?php if (isset($_SERVER['HTTP_REFERER'])) echo htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8'); ?><br>
+                                                       </p>
+                                                       
+                                                       <h2>Stacktrace:</h2>
+                                                       <pre><?php echo htmlspecialchars($this->__getTraceAsString(), ENT_COMPAT, 'UTF-8'); ?></pre>
+                                               </div>
+                    <?php } else { ?>
+                                               <div>
+                                                       <h2>Information:</h2>
+                                                       <p>
+                                                               <?php if (!$this->getExceptionID()) { ?>
+                                                                       Unable to write log file, please make &quot;<?php echo DNS_DIR; ?>/log/&quot; writable!
+                                                               <?php } else { ?>
+                                                                       <b>ID:</b> <code><?php echo $this->getExceptionID(); ?></code><br>
+                                                                       Please send the ID above to the site administrator.
+                                                               <?php } ?>
+                                                       </p>
+                                               </div>
+                    <?php } ?>
+                                       <?php echo $this->functions; ?>
+                               </div>
+                       </body>
+               </html>
+               
+               <?php
+       }
+}
index baa0d18b3b1f0209ea2a3628c9a9ed96e8ae8b98..17d02d0ddd09946326eac906093933675f9fe5c6 100644 (file)
@@ -73,7 +73,7 @@ class User {
                                DNS::getSession()->register('username', $row["username"]);
                                DNS::getSession()->register('userID', $row["userID"]);
                                DNS::getSession()->register('status', intval($row["status"]));
-                               
+                               DNS::getSession()->register('csrf_token', DNS::generateRandomID());
                                return true;
                        }
                }
@@ -81,6 +81,10 @@ class User {
                return false;
        }
        
+       public static function getSecurityToken () {
+               return DNS::getSession()->csrf_token;
+       }       
+       
        /**
         * login the user
         *
@@ -98,6 +102,7 @@ class User {
                                DNS::getSession()->register('username', $row["username"]);
                                DNS::getSession()->register('userID', $row["userID"]);
                                DNS::getSession()->register('status', intval($row["status"]));
+                               DNS::getSession()->register('csrf_token', DNS::generateRandomID());
                                
                                if ($remember === true) {
                                        $sha1UserID = sha1($row["userID"]);
index 4537d8aae6c4a26f5439bc3a05d3437d25c2c4d2..35480f10e7ce9b0fdaf23d3799d7b79463919b1e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4537d8aae6c4a26f5439bc3a05d3437d25c2c4d2
+Subproject commit 35480f10e7ce9b0fdaf23d3799d7b79463919b1e
diff --git a/lib/system/cache/CacheHandler.class.php b/lib/system/cache/CacheHandler.class.php
new file mode 100644 (file)
index 0000000..88b861a
--- /dev/null
@@ -0,0 +1,140 @@
+<?php
+namespace dns\system\cache;
+use dns\system\cache\builder\ICacheBuilder;
+use dns\system\cache\source\DiskCacheSource;
+use dns\system\SingletonFactory;
+
+define('CACHE_SOURCE_TYPE', 'disk');
+
+/**
+ * Manages transparent cache access.
+ * 
+ * @author     Alexander Ebert, Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheHandler extends SingletonFactory {
+       /**
+        * cache source object
+        * @var \dns\system\cache\source\ICacheSource
+        */
+       protected $cacheSource = null;
+       
+       /**
+        * Creates a new CacheHandler object.
+        */
+       protected function init() {
+               // init cache source object
+               try {
+                       $className = 'dns\system\cache\source\\'.ucfirst(CACHE_SOURCE_TYPE).'CacheSource';
+                       if (class_exists($className)) {
+                               $this->cacheSource = new $className();
+                       }
+                       else {
+                               // fallback to disk cache
+                               $this->cacheSource = new DiskCacheSource();
+                       }
+               }
+               catch (\Exception $e) {
+                       if (CACHE_SOURCE_TYPE != 'disk') {
+                               // fallback to disk cache
+                               $this->cacheSource = new DiskCacheSource();
+                       }
+                       else {
+                               throw $e;
+                       }
+               }
+       }
+       
+       /**
+        * Flush cache for given resource.
+        * 
+        * @param       \dns\system\cache\builder\ICacheBuilder         $cacheBuilder
+        * @param       array                                           $parameters
+        */
+       public function flush(ICacheBuilder $cacheBuilder, array $parameters) {
+               $this->getCacheSource()->flush($this->getCacheName($cacheBuilder, $parameters), empty($parameters));
+       }
+       
+       /**
+        * Flushes the entire cache.
+        */
+       public function flushAll() {
+               $this->getCacheSource()->flushAll();
+       }
+       
+       /**
+        * Returns cached value for given resource, false if no cache exists.
+        * 
+        * @param       \dns\system\cache\builder\ICacheBuilder         $cacheBuilder
+        * @param       array                                           $parameters
+        * @return      mixed
+        */
+       public function get(ICacheBuilder $cacheBuilder, array $parameters) {
+               return $this->getCacheSource()->get($this->getCacheName($cacheBuilder, $parameters), $cacheBuilder->getMaxLifetime());
+       }
+       
+       /**
+        * Caches a value for given resource,
+        * 
+        * @param       \dns\system\cache\builder\ICacheBuilder         $cacheBuilder
+        * @param       array                                           $parameters
+        * @param       array                                           $data
+        */
+       public function set(ICacheBuilder $cacheBuilder, array $parameters, array $data) {
+               $this->getCacheSource()->set($this->getCacheName($cacheBuilder, $parameters), $data, $cacheBuilder->getMaxLifetime());
+       }
+       
+       /**
+        * Returns cache index hash.
+        * 
+        * @param       array           $parameters
+        * @return      string
+        */
+       public function getCacheIndex(array $parameters) {
+               return sha1(serialize($this->orderParameters($parameters)));
+       }
+       
+       /**
+        * Builds cache name.
+        * 
+        * @param       \dns\system\cache\builder\ICacheBuilder         $cacheBuilder
+        * @param       array                                           $parameters
+        * @return      string
+        */
+       protected function getCacheName(ICacheBuilder $cacheBuilder, array $parameters = array()) {
+               $className = explode('\\', get_class($cacheBuilder));
+               $cacheName = str_replace('CacheBuilder', '', array_pop($className));
+               if (!empty($parameters)) {
+                       $cacheName .= '-' . $this->getCacheIndex($parameters);
+               }
+               
+               return ucfirst($cacheName);
+       }
+       
+       /**
+        * Returns the cache source object.
+        * 
+        * @return      \dns\system\cache\source\ICacheSource
+        */
+       public function getCacheSource() {
+               return $this->cacheSource;
+       }
+       
+       /**
+        * Unifys parameter order, numeric indizes will be discarded.
+        * 
+        * @param       array           $parameters
+        * @return      array
+        */
+       protected function orderParameters($parameters) {
+               if (!empty($parameters)) {
+                       array_multisort($parameters);
+               }
+               
+               return $parameters;
+       }
+}
diff --git a/lib/system/cache/builder/AbstractCacheBuilder.class.php b/lib/system/cache/builder/AbstractCacheBuilder.class.php
new file mode 100644 (file)
index 0000000..d2ffe24
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+namespace dns\system\cache\builder;
+use dns\system\cache\CacheHandler;
+use dns\system\SingletonFactory;
+
+/**
+ * Default implementation for cache builders.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category   Community Framework
+ */
+abstract class AbstractCacheBuilder extends SingletonFactory implements ICacheBuilder {
+       /**
+        * list of cache resources by index
+        * @var array<array>
+        */
+       protected $cache = array();
+       
+       /**
+        * maximum cache lifetime in seconds, '0' equals infinite
+        * @var integer
+        */
+       protected $maxLifetime = 0;
+       
+       /**
+        * @see \dns\system\cache\builder\ICacheBuilder::getData()
+        */
+       public function getData(array $parameters = array(), $arrayIndex = '') {
+               $index = CacheHandler::getInstance()->getCacheIndex($parameters);
+               
+               if (!isset($this->cache[$index])) {
+                       // fetch cache or rebuild if missing
+                       $this->cache[$index] = CacheHandler::getInstance()->get($this, $parameters);
+                       if ($this->cache[$index] === null) {
+                               $this->cache[$index] = $this->rebuild($parameters);
+                               
+                               // update cache
+                               CacheHandler::getInstance()->set($this, $parameters, $this->cache[$index]);
+                       }
+               }
+               
+               if (!empty($arrayIndex)) {
+                       if (!isset($this->cache[$index][$arrayIndex])) {
+                               throw new \Exception("array index '".$arrayIndex."' does not exist in cache resource");
+                       }
+                       
+                       return $this->cache[$index][$arrayIndex];
+               }
+               
+               return $this->cache[$index];
+       }
+       
+       /**
+        * @see \dns\system\cache\builder\ICacheBuilder::getMaxLifetime()
+        */
+       public function getMaxLifetime() {
+               return $this->maxLifetime;
+       }
+       
+       /**
+        * @see \dns\system\cache\builder\ICacheBuilder::reset()
+        */
+       public function reset(array $parameters = array()) {
+               CacheHandler::getInstance()->flush($this, $parameters);
+       }
+       
+       /**
+        * Rebuilds cache for current resource.
+        * 
+        * @param       array           $parameters
+        */
+       abstract protected function rebuild(array $parameters);
+}
diff --git a/lib/system/cache/builder/ControllerCacheBuilder.class.php b/lib/system/cache/builder/ControllerCacheBuilder.class.php
new file mode 100644 (file)
index 0000000..0e1b128
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace dns\system\cache\builder;
+use dns\system\DNS;
+
+/**
+ * @author      Jan Altensen (Stricted)
+ * @copyright   2013-2015 Jan Altensen (Stricted)
+ */
+class ControllerCacheBuilder extends AbstractCacheBuilder {
+       /**
+        * @see \dns\system\cache\builder\AbstractCacheBuilder::$maxLifetime
+        */
+       protected $maxLifetime = 3600;
+       
+       /**
+        * @see \dns\system\cache\builder\AbstractCacheBuilder::rebuild()
+        */
+       public function rebuild(array $parameters) {
+               $data = array();
+               
+               $pages = glob(DNS_DIR.'/lib/'.(empty($parameters['module']) ? '' : $parameters['module'].'/').'page/*Page.class.php');
+               
+               foreach ($pages as $page) {
+                       $page = str_replace('Page.class.php', '', basename($page));
+
+                       $class = "\\dns".(empty($parameters['module']) ? '' : "\\".$parameters['module'])."\\page\\".$page."Page";
+                       if (class_exists($class) && is_subclass_of($class, '\\dns\\page\\AbstractPage')) {
+                               $data[strtolower($page)] = $class;
+                       }
+               }
+               
+               return $data;
+       }
+}
diff --git a/lib/system/cache/builder/DNSApiCacheBuilder.class.php b/lib/system/cache/builder/DNSApiCacheBuilder.class.php
new file mode 100644 (file)
index 0000000..97d7346
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+namespace dns\system\cache\builder;
+use dns\system\DNS;
+
+/**
+ * @author      Jan Altensen (Stricted)
+ * @copyright   2013-2015 Jan Altensen (Stricted)
+ */
+class DNSApiCacheBuilder extends AbstractCacheBuilder {
+       /**
+        * @see \dns\system\cache\builder\AbstractCacheBuilder::$maxLifetime
+        */
+       protected $maxLifetime = 30;
+       
+       /**
+        * @see \dns\system\cache\builder\AbstractCacheBuilder::rebuild()
+        */
+       public function rebuild(array $parameters) {
+               $data = array();
+               
+               $sql = "SELECT * FROM dns_soa where active = ?";
+               $statement = DNS::getDB()->query($sql, array(1));
+               
+               while ($zone = DNS::getDB()->fetch_array($statement)) {
+                       $data[$zone['origin']] = array();
+                       $data[$zone['origin']]['soa'] = $zone;
+                       $data[$zone['origin']]['rr'] = array();
+                       $data[$zone['origin']]['sec'] = array();
+                       
+                       /* resource records */
+                       $sql2 = "SELECT * FROM dns_rr where zone = ? and active = ?";
+                       $statement2 = DNS::getDB()->query($sql2, array($zone['id'], 1));
+                       while ($rr = DNS::getDB()->fetch_array($statement2)) {
+                               $data[$zone['origin']]['rr'][] = $rr;
+                       }
+                       
+                       if (ENABLE_DNSSEC) {
+                               /* dnssec keys */
+                               $sql3 = "SELECT * FROM dns_sec where zone = ? and active = ?";
+                               $statement3 = DNS::getDB()->query($sql3, array($zone['id'], 1));
+                               while ($sec = DNS::getDB()->fetch_array($statement3)) {
+                                       $data[$zone['origin']]['sec'][] = $sec;
+                               }
+                       }
+               }
+               
+               return $data;
+       }
+}
diff --git a/lib/system/cache/builder/ICacheBuilder.class.php b/lib/system/cache/builder/ICacheBuilder.class.php
new file mode 100644 (file)
index 0000000..608e05b
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+namespace dns\system\cache\builder;
+
+/**
+ * A cache builder provides data for the cache handler that ought to be cached.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category   Community Framework
+ */
+interface ICacheBuilder {
+       /**
+        * Returns the data that ought to be cached.
+        * 
+        * @param       array           $parameters
+        * @param       string          $arrayIndex
+        * @return      array
+        */
+       public function getData(array $parameters = array(), $arrayIndex = '');
+       
+       /**
+        * Returns maximum lifetime for cache resource.
+        * 
+        * @return      integer
+        */
+       public function getMaxLifetime();
+       
+       /**
+        * Flushes cache. If no parameters are given, all caches starting with
+        * the same cache name will be flushed too.
+        * 
+        * @param       array           $parameters
+        */
+       public function reset(array $parameters = array());
+}
diff --git a/lib/system/cache/source/DiskCacheSource.class.php b/lib/system/cache/source/DiskCacheSource.class.php
new file mode 100644 (file)
index 0000000..162522f
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+namespace dns\system\cache\source;
+
+/**
+ * DiskCacheSource is an implementation of CacheSource that stores the cache as simple files in the file system.
+ * 
+ * @author     Alexander Ebert, Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.source
+ * @category   Community Framework
+ */
+class DiskCacheSource implements ICacheSource {
+       /**
+        * @see \dns\system\cache\source\ICacheSource::flush()
+        */
+       public function flush($cacheName, $useWildcard) {
+               if ($useWildcard) {
+                       $this->removeFiles('cache.'.$cacheName.'*.php');
+               }
+               else {
+                       $this->removeFiles('cache.'.$cacheName.'.php');
+               }
+       }
+       
+       /**
+        * @see \dns\system\cache\source\ICacheSource::flushAll()
+        */
+       public function flushAll() {
+               $this->removeFiles('cache.*.php');
+       }
+       
+       /**
+        * @see \dns\system\cache\source\ICacheSource::get()
+        */
+       public function get($cacheName, $maxLifetime) {
+               $filename = $this->getFilename($cacheName);
+               if ($this->needRebuild($filename, $maxLifetime)) {
+                       return null;
+               }
+               
+               // load cache
+               try {
+                       return $this->readCache($cacheName, $filename);
+               }
+               catch (\Exception $e) {
+                       return null;
+               }
+       }
+       
+       /**
+        * @see \dns\system\cache\source\ICacheSource::set()
+        */
+       public function set($cacheName, $value, $maxLifetime) {
+               $filename = $this->getFilename($cacheName);
+               $content = "<?php exit; /* cache: ".$cacheName." (generated at ".gmdate('r').") DO NOT EDIT THIS FILE */ ?>\n";
+               $content .= serialize($value);
+               
+               if (!file_exists($filename)) {
+                       @touch($filename);
+               }
+               
+               $handler = fOpen($filename, "a+");
+               fWrite($handler, $content);
+               fClose($handler);
+       }
+       
+       /**
+        * Returns cache filename.
+        * 
+        * @param       string          $cacheName
+        * @return      string
+        */
+       protected function getFilename($cacheName) {
+               return DNS_DIR.'/cache/cache.'.$cacheName.'.php';
+       }
+       
+       /**
+        * Removes files matching given pattern.
+        * 
+        * @param       string          $pattern
+        */
+       protected function removeFiles($pattern) {
+               $directory = DNS_DIR.'cache/';
+               
+               foreach (glob($directory.$pattern) as $filename) {
+                       @unlink($filename);
+               }
+       }
+       
+       /**
+        * Determines wheater the cache needs to be rebuild or not.
+        * 
+        * @param       string          $filename
+        * @param       integer         $maxLifetime
+        * @return      boolean
+        */
+       protected function needRebuild($filename, $maxLifetime) {
+               // cache does not exist
+               if (!file_exists($filename)) {
+                       return true;
+               }
+               
+               // cache is empty
+               if (!@filesize($filename)) {
+                       return true;
+               }
+               
+               // cache resource was marked as obsolete
+               if (($mtime = filemtime($filename)) <= 1) {
+                       return true;
+               }
+               
+               // maxlifetime expired
+               if ($maxLifetime > 0 && (time() - $mtime) > $maxLifetime) {
+                       return true;
+               }
+               
+               // do not rebuild cache
+               return false;
+       }
+       
+       /**
+        * Loads the file of a cached resource.
+        * 
+        * @param       string          $cacheName
+        * @param       string          $filename
+        * @return      mixed
+        */
+       protected function readCache($cacheName, $filename) {
+               // get file contents
+               $contents = file_get_contents($filename);
+               
+               // find first newline
+               $position = strpos($contents, "\n");
+               if ($position === false) {
+                       throw new \Exception("Unable to load cache resource '".$cacheName."'");
+               }
+               
+               // cut contents
+               $contents = substr($contents, $position + 1);
+               
+               // unserialize
+               $value = @unserialize($contents);
+               if ($value === false) {
+                       throw new \Exception("Unable to load cache resource '".$cacheName."'");
+               }
+               
+               return $value;
+       }
+}
diff --git a/lib/system/cache/source/ICacheSource.class.php b/lib/system/cache/source/ICacheSource.class.php
new file mode 100644 (file)
index 0000000..95237fb
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+namespace dns\system\cache\source;
+
+/**
+ * Any cache sources should implement this interface.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.source
+ * @category   Community Framework
+ */
+interface ICacheSource {
+       /**
+        * Flushes a specific cache, optionally removing caches which share the same name.
+        * 
+        * @param       string          $cacheName
+        * @param       boolean         $useWildcard
+        */
+       public function flush($cacheName, $useWildcard);
+       
+       /**
+        * Clears the cache completely.
+        */
+       public function flushAll();
+       
+       /**
+        * Returns a cached variable.
+        * 
+        * @param       string          $cacheName
+        * @param       integer         $maxLifetime
+        * @return      mixed
+        */
+       public function get($cacheName, $maxLifetime);
+       
+       /**
+        * Stores a variable in the cache.
+        * 
+        * @param       string          $cacheName
+        * @param       mixed           $value
+        * @param       integer         $maxLifetime
+        */
+       public function set($cacheName, $value, $maxLifetime);
+}
diff --git a/lib/system/template/plugins/block.link.php b/lib/system/template/plugins/block.link.php
new file mode 100644 (file)
index 0000000..c976980
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+function smarty_block_link($params, $content, $template, &$repeat) {
+       if ($repeat) {
+               return;
+       }
+       
+       if (!array_key_exists('controller', $params)) {
+               $params['controller'] = null;
+       }
+       
+       if (!array_key_exists('id', $params)) {
+               $params['id'] = null;
+       }
+       
+       if (!array_key_exists('title', $params)) {
+               $params['title'] = null;
+       }
+       
+       $url = 'index.php?'.$params['controller'];
+       
+       if (!empty($params['id'])) {
+               if (!empty($params['title'])) {
+                       $url .= '/'.$params['id'].'-'.$params['title'];
+               }
+               else {
+                       $url .= '/'.$params['id'];
+               }
+       }
+       
+       if (!empty($content)) {
+               if (strpos($content, '&') !== 0) {
+                       $url .= '&';
+               }
+               
+               $url .= $content;
+       }
+       
+       return @htmlspecialchars($url, ENT_COMPAT, 'UTF-8');;
+}
\ No newline at end of file
index 7408973eb979d3c14ea47eeaafe5423373cd7a68..ea20fd9f33e504688a388cbcb0533557a29b881d 100644 (file)
@@ -18,7 +18,7 @@ function smarty_function_pages($tagArgs, $tplObj) {
        $html = '';
        
        if ($tagArgs['pages'] > 1) {
-               $link = "index.php?page=".$tagArgs['controller'].(isset($tagArgs['id']) ? "&id=".$tagArgs['id'] : "");
+               $link = "index.php?".$tagArgs['controller'].(isset($tagArgs['id']) ? "/".$tagArgs['id'] : "");
                
                if (!isset($tagArgs['pageNo'])) {
                        if (($tagArgs['pageNo'] = $tplObj->smarty->getTemplateVars('pageNo')) === null) {
index 304995465da4b057dcdafeb457dfb517db0c1d7c..addd485ff0d960c5b3e2c6e83e66f41f9cc0e840 100644 (file)
@@ -22,7 +22,7 @@
  * @category   Community Framework
  */
 
-function smarty_prefilter_hascontent($source, &$smarty) {
+function smarty_prefilter_hascontent($source, $smarty) {
        $ldq = preg_quote($smarty->left_delimiter, '~');
        $rdq = preg_quote($smarty->right_delimiter, '~');
        
index 1d3cccc656fcd312df14e95c2a73697a8cfbf2c5..d6d7b696d9973c9edb3e440547c478e8a3366e37 100644 (file)
@@ -2,8 +2,8 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-                       <li class="active"><a href="index.php?page=ApiManagement">API</a></li>
+                       <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='ApiManagement'}{/link}">API</a></li>
                </ol>
        </div>
 </div>
index 201024f7eb031d1ee59c9fe4891c4f29c3e075a8..cd1bf680b1b3672966d03db66add5bb2c63ec989 100644 (file)
@@ -2,8 +2,8 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-                       <li class="active"><a href="index.php?page=DomainAdd">Domain hinzufügen</a></li>
+                       <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='DomainAdd'}{/link}">Domain hinzufügen</a></li>
                </ol>
        </div>
 </div>
@@ -12,7 +12,7 @@
                Domain erfolgreich hinzugefügt.
        </div>
 {/if}
-<form method="post" action="index.php?page=DomainAdd">
+<form method="post" action="{link controller='DomainAdd'}{/link}">
        <div class="row">
                <div class="col-lg-12">
                        <div class="panel panel-default">
index 278fb81a0491905b583b806a8548f9c511916885..b102eaadedd7a4835f801371c7c13fd51e3452e3 100644 (file)
@@ -2,7 +2,7 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li class="active"><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
                </ol>
        </div>
 </div>
index acf6af3880ac7f98dfd362fe0c30d4dd2df08557..fb61f6b735e9126ec14135001cb53930c08a377f 100644 (file)
@@ -29,7 +29,7 @@
                                                <span class="icon-bar"></span>
                                                <span class="icon-bar"></span>
                                        </button>
-                                       <a class="navbar-brand" href="index.html"><i class="fa fa-wrench"></i> Domain Control Panel</a>
+                                       <a class="navbar-brand" href="{link controller='Index'}{/link}"><i class="fa fa-wrench"></i> Domain Control Panel</a>
                                </div>
                                
                                <ul class="nav navbar-top-links navbar-right">
@@ -38,7 +38,7 @@
                                                <i class="fa fa-user fa-fw"></i> {$username} <i class="fa fa-caret-down"></i>
                                                </a>
                                                <ul class="dropdown-menu dropdown-user">
-                                                       <li><a href="index.php?page=logout"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
+                                                       <li><a href="{link controller='logout'}{/link}"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
                                                </ul>
                                        </li>
                                </ul>
                                                        <li{if $activeMenuItem == 'index' || $activeMenuItem == 'add' || $activeMenuItem == 'update'} class="active"{/if}>
                                                                <a href="#"><i class="fa fa-home"></i> Domains<span class="fa arrow"></span></a>
                                                                <ul class="{if $activeMenuItem == 'index' || $activeMenuItem == 'add' || $activeMenuItem == 'update'}nav nav-second-level collapse in{else}nav nav-second-level{/if}">
-                                                                       <li><a {if $activeMenuItem == 'index'}class="active" {/if}href="index.php?page=DomainList"><i class="fa fa-list"></i> Auflisten</a></li>
-                                                                       {if $isReseller === true}<li><a {if $activeMenuItem == 'add'}class="active" {/if}href="index.php?page=DomainAdd"><i class="fa fa-plus"></i> Hinzufügen</a></li>{/if}
+                                                                       <li><a {if $activeMenuItem == 'index'}class="active" {/if}href="{link controller='DomainList'}{/link}"><i class="fa fa-list"></i> Auflisten</a></li>
+                                                                       {if $isReseller === true}<li><a {if $activeMenuItem == 'add'}class="active" {/if}href="{link controller='DomainAdd'}{/link}"><i class="fa fa-plus"></i> Hinzufügen</a></li>{/if}
                                                                </ul>
                                                        </li>
                                                        <li{if $activeMenuItem == 'settings' || $activeMenuItem == 'api'} class="active"{/if}>
                                                                <a href="#"><i class="fa fa-cogs"></i> Settings<span class="fa arrow"></span></a>
                                                                <ul class="{if $activeMenuItem == 'settings' || $activeMenuItem == 'api'}nav nav-second-level collapse in{else}nav nav-second-level{/if}">
-                                                                       <li><a {if $activeMenuItem == 'index'}class="api" {/if}href="index.php?page=ApiManagement"><i class="fa fa-key"></i> API</a></li>
+                                                                       <li><a {if $activeMenuItem == 'index'}class="api" {/if}href="{link controller='ApiManagement'}{/link}"><i class="fa fa-key"></i> API</a></li>
                                                                </ul>
                                                        </li>
                                                </ul>
index 77f407da0a8e34a135486e700fdcf4ec8c442d41..1c79aa973fd18f244a1405e894a41c0e321e486d 100644 (file)
@@ -2,7 +2,7 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li class="active"><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
                </ol>
        </div>
 </div>
@@ -10,7 +10,7 @@
 <div class="row">
        <div class="col-lg-12">
                <div class="page-header pull-right">
-                       <a href="#" class="btn btn-gr-gray"><i class="fa fa-plus"></i> Domain hinzufügen</a>
+                       <a href="{link controller='DomainAdd'}{/link}" class="btn btn-gr-gray"><i class="fa fa-plus"></i> Domain hinzufügen</a>
                </div>
        </div>
 </div>
@@ -26,9 +26,9 @@
                                                <table class="table table-bordered table-hover radius table-striped">
                                                        <thead>
                                                                <tr>
-                                                                       <th><a class="sorting{if $sortField == 'id'}_{$sortOrder|strtolower}{/if}" href="index.php?page=DomainList&pageNo={$pageNo}&sortField=id&sortOrder={if $sortField == 'id' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">ID</a></th>
-                                                                       <th><a class="sorting{if $sortField == 'origin'}_{$sortOrder|strtolower}{/if}" href="index.php?page=DomainList&pageNo={$pageNo}&sortField=origin&sortOrder={if $sortField == 'origin' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">Name</a></th>
-                                                                       <th><a class="sorting{if $sortField == 'serial'}_{$sortOrder|strtolower}{/if}" href="index.php?page=DomainList&pageNo={$pageNo}&sortField=serial&sortOrder={if $sortField == 'serial' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">Serial</a></th>
+                                                                       <th><a class="sorting{if $sortField == 'id'}_{$sortOrder|strtolower}{/if}" href="{link controller='DomainList'}&pageNo={$pageNo}&sortField=id&sortOrder={if $sortField == 'id' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">ID</a></th>
+                                                                       <th><a class="sorting{if $sortField == 'origin'}_{$sortOrder|strtolower}{/if}" href="{link controller='DomainList'}&pageNo={$pageNo}&sortField=origin&sortOrder={if $sortField == 'origin' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">Name</a></th>
+                                                                       <th><a class="sorting{if $sortField == 'serial'}_{$sortOrder|strtolower}{/if}" href="{link controller='DomainList'}&pageNo={$pageNo}&sortField=serial&sortOrder={if $sortField == 'serial' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">Serial</a></th>
                                                                        <th>Records</th>
                                                                        {if $isReseller === true || $smarty.const.ENABLE_DNSSEC}<th>Manage</th>{/if}
                                                                </tr>
                                                                {foreach from=$domains item=domain}
                                                                <tr>
                                                                        <td>{$domain['id']}</td>
-                                                                       <td>{if $domain['active'] != 1}<span class="badge badge-red">{lang}domain.disabled{/lang}</span> {/if}<a href="index.php?page=RecordList&id={$domain['id']}">{$domain['origin']}</a></td>
+                                                                       <td>{if $domain['active'] != 1}<span class="badge badge-red">{lang}domain.disabled{/lang}</span> {/if}<a href="{link controller='RecordList' id=$domain['id'] title=$domain['origin']}{/link}">{$domain['origin']}</a></td>
                                                                        <td>{$domain['serial']}</td>
                                                                        <td>{$domain['rrc']}</td>
                                                                        <td>
                                                                                {if $isReseller === true}<span class="fa fa{if $domain['active']}-check{/if}-square-o ttips pointer toggleDomain" toggle-id="{$domain['id']}" title="{if $domain['active']}{lang}button.disable{/lang}{else}{lang}button.enable{/lang}{/if}" data-disable-message="{lang}button.disable{/lang}" data-enable-message="{lang}button.enable{/lang}"></span>&nbsp;{/if}
-                                                                               {if $smarty.const.ENABLE_DNSSEC}<a href="index.php?page=SecList&id={$domain['id']}" class="ttips" title="Edit DNSSEC"><span class="fa fa-key"></span></a>&nbsp;{/if}
+                                                                               {if $smarty.const.ENABLE_DNSSEC}<a href="{link controller='SecList' id=$domain['id'] title=$domain['origin']}{/link}" class="ttips" title="Edit DNSSEC"><span class="fa fa-key"></span></a>&nbsp;{/if}
                                                                                {if $isReseller === true}<span class="fa fa-remove ttips pointer deleteDomain" delete-id="{$domain['id']}" delete-confirm="{lang}domain.delete.message{/lang}" title="{lang}button.delete{/lang}"></span>{/if}
                                                                        </td>
                                                                </tr>
index 1a5e67b8760f70fe32021a78a202ea49fe730918..c735610f049f5a752ec2ea8d41a7fdf6945a6bcc 100644 (file)
@@ -25,7 +25,7 @@
                                                        <h3 class="panel-title">Please Sign In</h3>
                                                </div>
                                                <div class="panel-body">
-                                                       <form method="post" action="index.php?page=login">
+                                                       <form method="post" action="index.php?login">
                                                                <fieldset>
                                                                        <div class="form-group">
                                                                                <input class="form-control" placeholder="Username" name="username" type="username" autofocus>
index f7b396c6d69dcb739581a7713cd3657730cab8ff..345e44987421522a54acb140a584df7487a6203d 100644 (file)
@@ -2,15 +2,15 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-                       <li class="active"><a href="index.php?page=RecordList&id={$soa['id']}">{$soa['origin']}</a></li>
+                       <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='RecordList' id=$soa['id'] title=$soa['origin']}{/link}">{$soa['origin']}</a></li>
                </ol>
        </div>
 </div>
 <div class="row">
        <div class="col-lg-12">
                <div class="page-header pull-right">
-                       <a href="index.php?page=RecordList&id={$soa['id']}" class="btn btn-gr-gray"><i class="fa fa-list"></i> Einträge auflisten</a>
+                       <a href="{link controller='RecordList' id=$soa['id'] title=$soa['origin']}{/link}" class="btn btn-gr-gray"><i class="fa fa-list"></i> Einträge auflisten</a>
                </div>
        </div>
 </div>
@@ -19,7 +19,7 @@
                Record erfolgreich hinzugefügt.
        </div>
 {/if}
-<form method="post" action="index.php?page=RecordAdd&id={$soa['id']}">
+<form method="post" action="{link controller='RecordAdd' id=$soa['id']}{/link}">
        <div class="row">
                <div class="col-lg-12">
                        <div class="panel panel-default">
index 197ecf561fb0d809fc426f4f59c967956e9c7f32..7f33ba4cc045f5d4aa65825c0f06d31776060cbd 100644 (file)
@@ -2,15 +2,15 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-                       <li class="active"><a href="index.php?page=RecordList&id={$soa['id']}">{$soa['origin']}</a></li>
+                       <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='RecordList' id=$soa['id'] title=$soa['origin']}{/link}">{$soa['origin']}</a></li>
                </ol>
        </div>
 </div>
 <div class="row">
        <div class="col-lg-12">
                <div class="page-header pull-right">
-                       <a href="index.php?page=RecordList&id={$soa['id']}" class="btn btn-gr-gray"><i class="fa fa-list"></i> Einträge auflisten</a>
+                       <a href="{link controller='RecordList' id=$soa['id'] title=$soa['origin']}{/link}" class="btn btn-gr-gray"><i class="fa fa-list"></i> Einträge auflisten</a>
                </div>
        </div>
 </div>
@@ -19,7 +19,7 @@
                Record erfolgreich bearbeitet.
        </div>
 {/if}
-<form method="post" action="index.php?page=RecordEdit&id={$rr['id']}">
+<form method="post" action="{link controller='RecordEdit' id=$soa['id']}{/link}">
        <div class="row">
                <div class="col-lg-12">
                        <div class="panel panel-default">
index c5c0e8e2741dafbdab87db0e5aee2c764bbbdd08..52f52179bbdf68cdfadbf6e61db29e876fa72042 100644 (file)
@@ -2,16 +2,16 @@
 <div class="row">
        <div class="col-lg-12">
                <ol class="breadcrumb">
-                       <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-                       <li class="active"><a href="index.php?page=RecordList&id={$soa['id']}">{$soa['origin']}</a></li>
+                       <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+                       <li class="active"><a href="{link controller='RecordList' id=$soa['id'] title=$soa['origin']}{/link}">{$soa['origin']}</a></li>
                </ol>
        </div>
 </div>
 <div class="row">
        <div class="col-lg-12">
                <div class="page-header pull-right">
-                       <a href="index.php?page=DomainList" class="btn btn-gr-gray"><i class="fa fa-list"></i> Domains auflisten</a>
-                       <a href="index.php?page=RecordAdd&id={$soa['id']}" class="btn btn-gr-gray"><i class="fa fa-plus"></i> Eintrag hinzufügen</a>
+                       <a href="{link controller='DomainList'}{/link}" class="btn btn-gr-gray"><i class="fa fa-list"></i> Domains auflisten</a>
+                       <a href="{link controller='RecordAdd' id=$soa['id']}{/link}" class="btn btn-gr-gray"><i class="fa fa-plus"></i> Eintrag hinzufügen</a>
                        <a href="#" id="export" export-id="{$soa['id']}" class="btn btn-gr-gray"><i class="fa fa-download"></i> Exportieren</a>
                </div>
        </div>
                                        <table class="table table-bordered table-hover radius table-striped">
                                                <thead>
                                                        <tr>
-                                                               <th><a class="sorting{if $sortField == 'id'}_{$sortOrder|strtolower}{/if}" href="index.php?page=RecordList&id={$soa['id']}&pageNo={$pageNo}&sortField=id&sortOrder={if $sortField == 'id' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">ID</th>
-                                                               <th><a class="sorting{if $sortField == 'name'}_{$sortOrder|strtolower}{/if}" href="index.php?page=RecordList&id={$soa['id']}&pageNo={$pageNo}&sortField=name&sortOrder={if $sortField == 'name' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">Host</th>
-                                                               <th><a class="sorting{if $sortField == 'ttl'}_{$sortOrder|strtolower}{/if}" href="index.php?page=RecordList&id={$soa['id']}&pageNo={$pageNo}&sortField=ttl&sortOrder={if $sortField == 'ttl' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">TTL</th>
-                                                               <th><a class="sorting{if $sortField == 'type'}_{$sortOrder|strtolower}{/if}" href="index.php?page=RecordList&id={$soa['id']}&pageNo={$pageNo}&sortField=type&sortOrder={if $sortField == 'type' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">Type</th>
+                                                               <th><a class="sorting{if $sortField == 'id'}_{$sortOrder|strtolower}{/if}" href="{link controller='RecordList' id=$soa['id']}&pageNo={$pageNo}&sortField=id&sortOrder={if $sortField == 'id' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">ID</th>
+                                                               <th><a class="sorting{if $sortField == 'name'}_{$sortOrder|strtolower}{/if}" href="{link controller='RecordList' id=$soa['id']}&pageNo={$pageNo}&sortField=name&sortOrder={if $sortField == 'name' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">Host</th>
+                                                               <th><a class="sorting{if $sortField == 'ttl'}_{$sortOrder|strtolower}{/if}" href="{link controller='RecordList' id=$soa['id']}&pageNo={$pageNo}&sortField=ttl&sortOrder={if $sortField == 'ttl' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">TTL</th>
+                                                               <th><a class="sorting{if $sortField == 'type'}_{$sortOrder|strtolower}{/if}" href="{link controller='RecordList' id=$soa['id']}&pageNo={$pageNo}&sortField=type&sortOrder={if $sortField == 'type' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">Type</th>
                                                                <th>Prio</th>
-                                                               <th><a class="sorting{if $sortField == 'data'}_{$sortOrder|strtolower}{/if}" href="index.php?page=RecordList&id={$soa['id']}&pageNo={$pageNo}&sortField=data&sortOrder={if $sortField == 'data' && $sortOrder == 'ASC'}DESC{else}ASC{/if}">Data</th>
+                                                               <th><a class="sorting{if $sortField == 'data'}_{$sortOrder|strtolower}{/if}" href="{link controller='RecordList' id=$soa['id']}&pageNo={$pageNo}&sortField=data&sortOrder={if $sortField == 'data' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">Data</th>
                                                                <th>Manage</th>
                                                        </tr>
                                                </thead>
@@ -47,7 +47,7 @@
                                                                <td>{$record['aux']}</td>
                                                                <td>{if $record['data']|strlen > 40}{$record['data']|substr:0:40}&hellip;{else}{$record['data']}{/if}</td>
                                                                <td>
-                                                                       <a href="index.php?page=RecordEdit&id={$record['id']}"><span class="fa fa-pencil ttips pointer" title="Edit"></span></a>
+                                                                       <a href="{link controller='RecordEdit' id=$soa['id']}{/link}"><span class="fa fa-pencil ttips pointer" title="Edit"></span></a>
                                                                        <span class="fa fa{if $record['active']}-check{/if}-square-o ttips pointer toggleRecord" toggle-id="{$record['id']}" title="{if $record['active']}{lang}button.disable{/lang}{else}{lang}button.enable{/lang}{/if}" data-disable-message="{lang}button.disable{/lang}" data-enable-message="{lang}button.enable{/lang}"></span>
                                                                        <span class="fa fa-remove ttips pointer deleteRecord" delete-id="{$record['id']}" delete-confirm="{lang}record.delete.message{/lang}" title="{lang}button.delete{/lang}"></span>
                                                                </td>
index ec434bdacbebdc413baa410e2a30137b668983ec..bb1993deceb7b05d8b68b4a82c254b016ad2ade1 100644 (file)
@@ -1,14 +1,14 @@
 {include file="header.tpl"}
 <div class="c-block" id="breadcrumbs">
        <ol class="breadcrumb">
-               <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-               <li class="active"><a href="index.php?page=SecList&id={$soa['id']}">{$soa['origin']}</a></li>
+               <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+               <li class="active"><a href="{link controller='SecList' id=$soa['id'] title=$soa['origin']}{/link}">{$soa['origin']}</a></li>
        </ol>
 </div>
 <div class="row">
        <div class="col-lg-12">
                <div class="page-header pull-right">
-                       <a href="index.php?page=SecList&id={$soa['id']}" class="btn btn-gr-gray"><i class="fa fa-list"></i> DESSEC auflisten</a>
+                       <a href="{link controller='SecList' id=$soa['id'] title=$soa['origin']}{/link}" class="btn btn-gr-gray"><i class="fa fa-list"></i> DESSEC auflisten</a>
                </div>
        </div>
 </div>
@@ -17,7 +17,7 @@
                Record erfolgreich hinzugefügt.
        </div>
 {/if}
-<form method="post" action="index.php?page=SecAdd&id={$soa['id']}">
+<form method="post" action="{link controller='SecAdd' id=$soa['id'] title=$soa['origin']}{/link}">
        <div class="row">
                <div class="col-lg-12">
                        <div class="panel panel-default">
index 4bf967da0cb79207ab801af81a708cc4c5ae79fc..d63eb284f50a9bcae6766758dac17001e1eab3f1 100644 (file)
@@ -1,8 +1,8 @@
 {include file="header.tpl"}
 <div class="c-block" id="breadcrumbs">
        <ol class="breadcrumb">
-               <li><a href="index.php?page=DomainList"><i class="fa fa-home"></i> Domain Control Panel</a></li>
-               <li class="active"><a href="index.php?page=SecList&id={$soa['id']}">{$soa['origin']}</a></li>
+               <li><a href="{link controller='DomainList'}{/link}"><i class="fa fa-home"></i> Domain Control Panel</a></li>
+               <li class="active"><a href="{link controller='SecList' id=$soa['id'] title=$soa['origin']}{/link}">{$soa['origin']}</a></li>
        </ol>
 </div>
 {if !empty($ds)}