From 3b7d2cb2fd40d744a2415a470b4e323d13dd1b63 Mon Sep 17 00:00:00 2001 From: neoraider Date: Mon, 4 Dec 2006 00:11:05 +0000 Subject: Nav-Seiten durch Inserts ersetzt; Editor-Seiten jetzt in Templates. --- base.xml | 3 --- code/links.inc.php | 11 +--------- code/nav.inc.php | 50 +++++++++++++++++++++++++++--------------- code/pages.inc.php | 7 +++--- code/user.inc.php | 9 ++++++-- config/neon.sql | 29 ++++++++++++------------ core/modules.inc.php | 2 +- pages/base/default.xml | 4 ++-- pages/content/Pages:Copy.xml | 2 +- pages/content/Pages:Delete.xml | 2 +- pages/content/Pages:Edit.xml | 2 +- pages/content/Pages:Handle.xml | 2 +- pages/content/Pages:New.xml | 2 +- pages/content/Pages:Privs.xml | 2 +- pages/content/Pages:Rename.xml | 2 +- pages/editor/default.xml | 36 ------------------------------ pages/editor/phpexec.xml | 33 ---------------------------- pages/nav/Login.xml | 41 ---------------------------------- styles/TheWhiteOne/style.css | 2 +- templates/default.inc.php | 23 +++++++++++++++++-- templates/phpexec.inc.php | 19 +++++++++++++++- 21 files changed, 109 insertions(+), 174 deletions(-) delete mode 100644 pages/editor/default.xml delete mode 100644 pages/editor/phpexec.xml delete mode 100644 pages/nav/Login.xml diff --git a/base.xml b/base.xml index 625f42e..f37b64e 100644 --- a/base.xml +++ b/base.xml @@ -34,9 +34,6 @@ Users:New Users:Password Users:Rename - default - phpexec - Login diff --git a/code/links.inc.php b/code/links.inc.php index cb264cd..6c6fcd8 100644 --- a/code/links.inc.php +++ b/code/links.inc.php @@ -1,5 +1,5 @@ HasReadAccess($page, 'n')) { - $page = $GLOBALS['pages']->Get($page, 'n'); - return $page['content']; - } - - return ''; - } } $GLOBALS['links'] = new Links; diff --git a/code/nav.inc.php b/code/nav.inc.php index 02d9127..940ced2 100644 --- a/code/nav.inc.php +++ b/code/nav.inc.php @@ -3,33 +3,50 @@ class Nav { var $entries = array(); + var $root_entries = array(); function Nav() { $res = $GLOBALS['db']->Execute('SELECT * FROM nav ORDER BY id'); while(!$res->EOF) { - $this->entries[$res->fields[0]] = new NavEntry($res->fields[1], $res->fields[2], $res->fields[3]); - + $this->entries[$res->fields[0]] = new NavEntry($res->fields[1], $res->fields[2], $res->fields[3], $res->fields[4]); + $res->MoveNext(); } foreach($this->entries as $key => $entry) - if($entry->parent != 0) + if($entry->parent == 0) + $this->root_entries[$entry->gid][$entry->text] = &$this->entries[$key]; + elseif(isset($this->entries[$entry->parent])) $this->entries[$entry->parent]->Add(&$this->entries[$key]); } - function ParseEntries() { + function ParseNav($gid, $name) { $ret = ''; return $ret; } + function ParseInsert($name, $data) { + $res = $GLOBALS['db']->Execute('SELECT code FROM nav_inserts WHERE name = ?', $name); + + if(!$res->RecordCount()) return ' '; + + ob_start(); + + eval('?>' . $res->fields[0]); + + $ret = ob_get_contents(); + ob_end_clean(); + + return $ret; + } + function ParseLink($text, $link) { if(!$link) return $text; @@ -43,25 +60,21 @@ return $text; case '@': return '' . $text . ''; + case '-': + return $this->ParseInsert(substr($link, 1), $text); case '!': - $ret = $GLOBALS['links']->GetNavPage(substr($link, 1)); - - if($ret) - return $ret; - - return $text; - default: - return '' . $text . ''; + return '' . $text . ''; } } } class NavEntry { - var $parent, $text, $link; + var $parent, $gid, $text, $link; var $children = array(); - function NavEntry($parent, $text, $link) { + function NavEntry($parent, $gid, $text, $link) { $this->parent = $parent; + $this->gid = $gid; $this->text = $text; $this->link = $link; } @@ -72,7 +85,8 @@ function Parse() { $ccount = 0; - if($this->link) $ret = '
  • '; $a = $GLOBALS['nav']->ParseLink($this->text, $this->link); diff --git a/code/pages.inc.php b/code/pages.inc.php index 2024303..e3af67a 100644 --- a/code/pages.inc.php +++ b/code/pages.inc.php @@ -6,7 +6,7 @@ var $pages = array(); - function Get($page, $type, $extra = null) { + function Get($page, $type) { if(!$this->Exists($page, $type)) return array('title' => $page, 'content' => ErrorMessage('PageNotFound', array('page' => $page))); @@ -22,7 +22,7 @@ $data['_page'] = $page; $data['_type'] = $type; - return $GLOBALS['templates'][$pagedata['template']]->Get($data); + return $GLOBALS['templates'][$pagedata['template']]->GetPage($data); } function GetEditor($page, $type, $backlink) { @@ -39,8 +39,9 @@ $data = $pagedata['data']; $data['_page'] = $page; $data['_type'] = $type; + $data['_backlink'] = $backlink; - return $this->Get($pagedata['template'], 'e', array('_data' => $data, '_backlink' => $backlink)); + return $GLOBALS['templates'][$pagedata['template']]->GetEditor($data); } function Exists($page, $type) { diff --git a/code/user.inc.php b/code/user.inc.php index 7c9b907..cc04268 100644 --- a/code/user.inc.php +++ b/code/user.inc.php @@ -73,13 +73,18 @@ } function IsAdmin($id = -1) { - if($id < 0) return ($this->uid != 0 && $this->gid == 0); + if($id < 0) return ($this->gid == -1); - return ($id != 0 && $this->GetGid($id) == 0); + return ($this->GetGid($id) == -1); + } + + function GetUid() { + return $this->uid; } function GetGid($id = -1) { if($id < 0) return $this->gid; + if($id == 0) return 0; $res = $GLOBALS['db']->Execute('SELECT gid FROM users WHERE id = ?', $id); diff --git a/config/neon.sql b/config/neon.sql index e32c759..f4f8596 100644 --- a/config/neon.sql +++ b/config/neon.sql @@ -1,11 +1,11 @@ -- phpMyAdmin SQL Dump --- version 2.8.2-Debian-0.2 +-- version 2.9.1.1-Debian-1 -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 19. September 2006 um 01:09 --- Server Version: 5.0.24 --- PHP-Version: 5.1.6-1 +-- Erstellungszeit: 02. Dezember 2006 um 14:57 +-- Server Version: 5.0.27 +-- PHP-Version: 5.2.0-7 -- -- Datenbank: `neon` -- @@ -23,7 +23,7 @@ CREATE TABLE `config` ( `value` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`module`) -) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=6 ; -- -- Daten für Tabelle `config` @@ -33,6 +33,7 @@ INSERT INTO `config` (`id`, `name`, `module`, `value`) VALUES (1, 'language', 0, INSERT INTO `config` (`id`, `name`, `module`, `value`) VALUES (2, 'home', 0, 'Home:Startseite'); INSERT INTO `config` (`id`, `name`, `module`, `value`) VALUES (3, 'default_style', 0, 'TheWhiteOne'); INSERT INTO `config` (`id`, `name`, `module`, `value`) VALUES (4, 'title', 0, 'Neon - '); +INSERT INTO `config` (`id`, `name`, `module`, `value`) VALUES (5, 'default_base', 0, 'default'); -- -------------------------------------------------------- @@ -45,7 +46,7 @@ CREATE TABLE `groups` ( `name` varchar(100) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) TYPE=MyISAM AUTO_INCREMENT=4 AUTO_INCREMENT=4 ; +) TYPE=MyISAM AUTO_INCREMENT=4 ; -- -- Daten für Tabelle `groups` @@ -64,13 +65,13 @@ CREATE TABLE `modules` ( `name` varchar(255) NOT NULL, `enabled` tinyint(1) NOT NULL, PRIMARY KEY (`id`) -) TYPE=MyISAM AUTO_INCREMENT=5 AUTO_INCREMENT=5 ; +) TYPE=MyISAM AUTO_INCREMENT=6 ; -- -- Daten für Tabelle `modules` -- -INSERT INTO `modules` (`id`, `name`, `enabled`) VALUES (4, 'Dream', 1); +INSERT INTO `modules` (`id`, `name`, `enabled`) VALUES (5, 'Dream', 0); INSERT INTO `modules` (`id`, `name`, `enabled`) VALUES (3, 'BBCode', 1); -- -------------------------------------------------------- @@ -85,7 +86,7 @@ CREATE TABLE `nav` ( `text` tinytext NOT NULL, `link` tinytext NOT NULL, PRIMARY KEY (`id`) -) TYPE=MyISAM AUTO_INCREMENT=17 AUTO_INCREMENT=17 ; +) TYPE=MyISAM AUTO_INCREMENT=17 ; -- -- Daten für Tabelle `nav` @@ -116,10 +117,10 @@ CREATE TABLE `pages` ( `name` varchar(255) NOT NULL default '', `template` varchar(255) NOT NULL, `data` longtext NOT NULL, - `type` enum('c','n','e') NOT NULL default 'c', + `type` enum('c','n','e','b') NOT NULL default 'c', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`type`) -) TYPE=MyISAM AUTO_INCREMENT=58 AUTO_INCREMENT=58 ; +) TYPE=MyISAM AUTO_INCREMENT=59 ; -- -- Daten für Tabelle `pages` @@ -143,7 +144,7 @@ CREATE TABLE `privs` ( `writeaccess` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`type`) -) TYPE=MyISAM AUTO_INCREMENT=9 AUTO_INCREMENT=9 ; +) TYPE=MyISAM AUTO_INCREMENT=9 ; -- -- Daten für Tabelle `privs` @@ -168,12 +169,12 @@ CREATE TABLE `users` ( `lastaccess` timestamp NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user` (`user`) -) TYPE=MyISAM AUTO_INCREMENT=6 AUTO_INCREMENT=6 ; +) TYPE=MyISAM AUTO_INCREMENT=6 ; -- -- Daten für Tabelle `users` -- -INSERT INTO `users` (`id`, `sid`, `gid`, `user`, `password`, `lastaccess`) VALUES (1, '', 0, 'NeoRaider', 'gamezock', '2006-09-19 00:55:10'); +INSERT INTO `users` (`id`, `sid`, `gid`, `user`, `password`, `lastaccess`) VALUES (1, '', 0, 'NeoRaider', 'gamezock', '2006-10-15 03:12:57'); INSERT INTO `users` (`id`, `sid`, `gid`, `user`, `password`, `lastaccess`) VALUES (3, '', 0, 'sicarius', 'armleuchter', '2006-03-05 23:46:46'); INSERT INTO `users` (`id`, `sid`, `gid`, `user`, `password`, `lastaccess`) VALUES (4, '', 0, 'morti', 'return', '2006-03-05 22:02:27'); diff --git a/core/modules.inc.php b/core/modules.inc.php index a5c8d32..62a20e9 100644 --- a/core/modules.inc.php +++ b/core/modules.inc.php @@ -129,7 +129,7 @@ function GetPagePath($name, $type) { return $this->pages[$name . '.' . $type]['path'] . 'pages/' . - strtr($type, array('c' => 'content', 'e' => 'editor', 'n' => 'nav', 'b' => 'base')) . '/' . $name . '.xml'; + strtr($type, array('c' => 'content', 'b' => 'base')) . '/' . $name . '.xml'; } function GetTemplatePath($name) { diff --git a/pages/base/default.xml b/pages/base/default.xml index c537794..51fc115 100644 --- a/pages/base/default.xml +++ b/pages/base/default.xml @@ -10,7 +10,7 @@ '; ?> @@ -24,7 +24,7 @@
    - - - phpexec - - 9:0 - e - - - - ' . $title . ''; -?> -
    - - - - Titel:
    -
    - - -
    - ]]> -
    -
    -
    diff --git a/pages/editor/phpexec.xml b/pages/editor/phpexec.xml deleted file mode 100644 index 451f653..0000000 --- a/pages/editor/phpexec.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - phpexec - - 9:0 - e - - - - ' . $title . ''; -?> -
    - - - -
    - - -
    - ]]> -
    -
    -
    diff --git a/pages/nav/Login.xml b/pages/nav/Login.xml deleted file mode 100644 index 6379199..0000000 --- a/pages/nav/Login.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - Login - - 1:0 - n - - - - uid) { - echo '
    '; - ?> - -
    - - ]]> -
    -
    -
    diff --git a/styles/TheWhiteOne/style.css b/styles/TheWhiteOne/style.css index 2360f97..a75820c 100644 --- a/styles/TheWhiteOne/style.css +++ b/styles/TheWhiteOne/style.css @@ -139,7 +139,7 @@ div#nav div.login div.login_submit input { margin:0; } -div#nav li.nav_\%21Login { +div#nav li.nav- { list-style-image:none; } diff --git a/templates/default.inc.php b/templates/default.inc.php index 12609c6..c416f44 100644 --- a/templates/default.inc.php +++ b/templates/default.inc.php @@ -1,8 +1,8 @@ $title, 'content' => $content); } + + function GetEditor($data) { + $title = 'Edit \'' . $data['_page'] . '\''; + + $content = '

    ' . $title . '

    '; + $content .= '
    '; + $content .= ''; + $content .= ''; + $content .= ''; + $content .= 'Titel:
    '; + $content .= '
    '; + $content .= ''; + $content .= ''; + $content .= '
    '; + + return array('title' => $title, 'content' => $content); + } } $GLOBALS['templates']['default'] = new default_template; diff --git a/templates/phpexec.inc.php b/templates/phpexec.inc.php index 3e542df..18c33be 100644 --- a/templates/phpexec.inc.php +++ b/templates/phpexec.inc.php @@ -2,7 +2,7 @@ Uses('message', 'links'); class phpexec_template { - function Get($data) { + function GetPage($data) { $title = strtr($data['_page'], array(':' => ' - ')); ob_start(); @@ -14,6 +14,23 @@ return array('title' => $title, 'content' => $content); } + + function GetEditor($data) { + $title = 'Edit \'' . $data['_page'] . '\''; + + $content = '

    ' . $title . '

    '; + $content .= '
    '; + $content .= ''; + $content .= ''; + $content .= ''; + $content .= '
    '; + $content .= ''; + $content .= ''; + $content .= '
    '; + + return array('title' => $title, 'content' => $content); + } } $GLOBALS['templates']['phpexec'] = new phpexec_template; -- cgit v1.2.3