Compare commits

..

156 commits
v0.6 ... master

Author SHA1 Message Date
Karl Pannek
3304186ee6 Add patientenfragebogen 2021-04-10 10:18:52 +02:00
Karl Pannek
ef051b8c1b Change line color 2021-04-10 09:27:53 +02:00
Karl Pannek
786ab7ec7d Fix database bug that broke saving in admin 2021-03-27 17:11:21 +01:00
logsol
3215e6e7e1 Update logo 2021-03-22 15:12:44 +01:00
logsol
e7b8dbd83f Update address on main template footer 2021-03-22 15:01:17 +01:00
5dc738e18e Save latest db content 2020-06-16 18:52:15 +02:00
4265af9338 Upgrade to be able to run on PHp7 2020-06-16 18:51:51 +02:00
Logsol
b9e04c6ca3 fixed bug. inactive navigation items were not showing in admin center 2013-11-06 13:06:36 +01:00
Logsol
1462348fdf deleted diplom image 2013-07-19 17:34:53 +02:00
Logsol
241c4863ec worked a bit on diplomarbeit 2013-07-19 17:31:11 +02:00
Logsol
d02ad40d6a fixed pagerewriter 2013-07-19 17:00:03 +02:00
Logsol
50aecb6ca2 added page rewrite plugin 2013-07-19 16:41:54 +02:00
jeena
82f3f83219 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 16:35:28 +02:00
jeena
ce4538f32a page navi 2013-07-19 16:35:05 +02:00
Logsol
54bc9ffa8c lines between navi ul 2013-07-19 16:19:53 +02:00
Logsol
1f1bf6b3f1 changed navigation colors 2013-07-19 16:10:37 +02:00
Logsol
ed20df5824 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 16:05:08 +02:00
Logsol
ecbba5fcf5 changed navigation colors 2013-07-19 16:04:54 +02:00
jeena
3dffc7527d fixes 2013-07-19 15:48:26 +02:00
jeena
09f73677d8 added diplomarbeit header 2013-07-19 15:44:58 +02:00
jeena
5226cb4c3b added diplomarbeit header 2013-07-19 15:39:51 +02:00
jeena
a85745747e insert image 2013-07-19 15:34:33 +02:00
jeena
0632d1bf0b added img 2013-07-19 15:22:36 +02:00
jeena
ac1245212c added db backup 2013-07-19 15:12:48 +02:00
jeena
af8fa420b7 fixed box 2013-07-19 15:05:27 +02:00
jeena
8fcbee314d fixed col headlines 2013-07-19 15:01:00 +02:00
jeena
cae1da96bb more popup fixes 2013-07-19 14:52:24 +02:00
jeena
5d58f16e0f start new header 2013-07-19 14:45:00 +02:00
jeena
b80a0107e6 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 14:43:32 +02:00
jeena
1c23b43d68 fixed popup stuff 2013-07-19 14:43:25 +02:00
Logsol
b37241db2b added praxis thumbnail 2013-07-19 14:14:51 +02:00
Logsol
e1609f1569 changed codemirror path 2013-07-19 13:50:17 +02:00
Logsol
a760333fba added codemirror as submodule 2013-07-19 13:47:45 +02:00
Logsol
77cdbfb0b6 deleted image 2013-07-19 13:41:08 +02:00
Logsol
a27cfee2b2 added codemirror editor 2013-07-19 13:37:38 +02:00
Logsol
a6636bb85f Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 13:36:24 +02:00
Logsol
23bc2d6ecb added codemirror editor 2013-07-19 13:36:11 +02:00
jeena
3e61eb7c9d Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 13:34:36 +02:00
jeena
0f847d3cbf image 2013-07-19 13:34:29 +02:00
Logsol
eb150732fb added codemirror editor 2013-07-19 13:33:46 +02:00
jeena
1189487d4b fixed contact 2013-07-19 12:46:39 +02:00
jeena
e075de1fd0 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 12:23:56 +02:00
jeena
635f120d91 fixed 2col 2013-07-19 12:23:48 +02:00
Logsol
e429d9749e Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 12:23:13 +02:00
Logsol
e6317a6326 added defaults plugin, repaired navigation edit 2013-07-19 12:23:05 +02:00
jeena
8e882b0894 fixed cols width 2013-07-19 12:14:41 +02:00
Logsol
6b689ae915 fixed navigation bugs 2013-07-19 11:55:06 +02:00
Logsol
816dc9743b Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-19 11:27:33 +02:00
Logsol
88757bdb80 added more images 2013-07-19 11:27:25 +02:00
jeena
05031143a1 fixed col4 h2 2013-07-18 16:58:18 +02:00
jeena
d4d00b1fba fixed col4 h2 2013-07-18 16:54:54 +02:00
Logsol
8c294888e7 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-18 16:51:58 +02:00
Logsol
8b4b0f8837 therapy image 2013-07-18 16:51:46 +02:00
jeena
85a6f9ae1c fixed margin after h2 2013-07-18 16:49:07 +02:00
jeena
a7bb1783c0 fixed transparent submenu 2013-07-18 16:44:58 +02:00
jeena
e90422c213 col4 2013-07-18 16:29:32 +02:00
Logsol
9da731ebb3 added images for behandlung 2013-07-18 16:26:10 +02:00
jeena
61d106a874 font2 2013-07-18 15:43:49 +02:00
jeena
73a56807a3 font 2013-07-18 15:42:14 +02:00
jeena
ca8863c170 gray footer 2013-07-18 15:31:13 +02:00
jeena
f9ceb6561d facebook 2013-07-18 15:29:51 +02:00
jeena
31f4141c00 fixed facebook icon 2013-07-18 15:29:32 +02:00
jeena
53b64188d8 removed image 2013-07-18 15:08:45 +02:00
jeena
68cf5561a0 fixed image names 2013-07-18 15:07:30 +02:00
jeena
bd0132c4b4 fixed 3col startpage 2013-07-18 15:04:42 +02:00
Logsol
a4aaa23422 improved admin css (notice, nav-overview) 2013-07-18 14:57:59 +02:00
Logsol
8e5818860b Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-18 14:30:35 +02:00
Logsol
eecc2bca5f added images, changed plugin= to @ and pagesave-forward to page itself 2013-07-18 14:26:18 +02:00
jeena
74a885cf8c added some images 2013-07-18 14:24:42 +02:00
jeena
eba4f386df box problems 2013-07-18 13:52:08 +02:00
jeena
8b2fc1553f added line 2013-07-18 13:44:27 +02:00
jeena
9a8f65d33f more col fixes 2013-07-18 13:37:03 +02:00
Logsol
62699ab89c added images 2013-07-18 13:35:18 +02:00
jeena
d6861acfbd more col fixes 2013-07-18 13:30:41 +02:00
jeena
aebeeb0478 more col fixes 2013-07-18 13:23:54 +02:00
jeena
eee546a1c1 col fix 2013-07-18 13:14:35 +02:00
jeena
850a925ae4 changed col 2013-07-18 13:06:49 +02:00
jeena
b46d2550ec fixed paddings 2013-07-18 12:36:05 +02:00
jeena
9e50b44730 fixed paddings 2013-07-18 12:33:03 +02:00
Logsol
df99821c17 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-18 11:50:13 +02:00
Logsol
549cae8161 added kontakt header image 2013-07-18 11:49:16 +02:00
jeena
c83c93ef07 fixed font in textarea 2013-07-18 11:47:03 +02:00
Logsol
d350e231b2 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-18 11:44:05 +02:00
Logsol
65b7662d70 added page edit in admin navigation 2013-07-18 11:43:57 +02:00
jeena
12953ec13d cleaned up head 2013-07-18 11:43:42 +02:00
jeena
9730d84d5c added monospace font to textarea 2013-07-17 19:21:56 +02:00
Logsol
927f7dcca2 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-17 19:16:47 +02:00
Logsol
a78b3891e8 redesigned page plugin engine 2013-07-17 19:16:32 +02:00
jeena
1a35247fb7 fixed col2 css 2013-07-17 17:34:33 +02:00
jeena
3c4f4e43f6 fixed height of cite 2013-07-17 17:02:48 +02:00
jeena
b7b0f44098 added images 2013-07-17 16:44:10 +02:00
jeena
4c700f657d added images 2013-07-17 16:43:22 +02:00
jeena
e170aa2c3c Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-17 16:41:37 +02:00
Logsol
05fbd9e76a removed image paths from git ignore 2013-07-17 16:41:26 +02:00
jeena
e4c4eac4d6 fixed menu css 2013-07-17 16:40:58 +02:00
Logsol
775a1a7a71 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-17 16:05:08 +02:00
Logsol
f7f2163df5 finished uploading 2013-07-17 16:05:00 +02:00
jeena
e43fde0d7d typo 2013-07-17 15:59:56 +02:00
jeena
85598a0d85 added submenu html 2013-07-17 14:48:05 +02:00
jeena
598081b2a8 added image plugin 2013-07-10 14:52:49 +02:00
jeena
f95b70d17e Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-10 14:50:25 +02:00
jeena
1177167a65 fixed footer and css 2013-07-10 14:50:19 +02:00
Logsol
43152b3b68 repaired image selecta 2013-07-10 14:46:32 +02:00
Logsol
5b173f381c added page to commit 2013-07-10 14:29:36 +02:00
Logsol
febd8f0883 resoving 2013-07-10 14:27:24 +02:00
Logsol
91aa15d253 merged view 2013-07-10 14:18:06 +02:00
Logsol
f96b0d64dc Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-10 14:12:56 +02:00
Logsol
569592e239 deleted images 2013-07-10 14:11:37 +02:00
Logsol
3fbbc59450 added uploader script 2013-07-10 14:10:38 +02:00
jeena
193bfd2247 added base plugin 2013-07-10 13:12:17 +02:00
jeena
fcad3b07f1 fixed wrong case 2013-07-10 12:37:30 +02:00
Logsol
4bb0f353a2 resolved conflicts 2013-07-10 12:19:33 +02:00
Logsol
79a0690fad edited page mechanism 2013-07-10 12:15:34 +02:00
jeena
68feb66d08 fixed admin navigation css 2013-07-10 12:15:24 +02:00
jeena
6f143cc21f nicer admin navigation 2013-07-10 11:13:06 +02:00
Logsol
4c21bbcefd added header_image flag to page view and model, cleaned up uploader 2013-07-10 10:35:54 +02:00
Logsol
1a3664b517 added graphics, styled admin center 2013-07-10 09:49:56 +02:00
jeena
dc0b3a3f16 changed title 2013-07-09 00:14:53 +02:00
Logsol
35717248ca Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-09 00:09:25 +02:00
jeena
979594a35c fixed home link 2013-07-09 00:05:14 +02:00
Logsol
8d5a30b335 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-08 23:57:37 +02:00
Logsol
f6572151ec added index redirect plugin 2013-07-08 23:56:50 +02:00
jeena
e378498bf3 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-08 23:44:27 +02:00
jeena
42a1a40f4a better init db 2013-07-08 23:44:21 +02:00
jeena
1fe7cf3a6e fixed syntax error 2013-07-08 23:44:07 +02:00
jeena
85049635de added check if file is there 2013-07-08 23:43:30 +02:00
Logsol
0c80e23e72 added admin css 2013-07-08 23:42:20 +02:00
Logsol
1142ae8171 added forward from index to page/home 2013-07-08 23:20:54 +02:00
Logsol
bffe0f1660 cleaned project, repaired router 2013-07-08 22:52:36 +02:00
jeena
2156d3f5c6 added admin password file 2013-07-08 22:40:09 +02:00
jeena
b47299adca removed unnecessary file 2013-07-08 22:16:37 +02:00
Logsol
1979f850f9 cleaned up structure, fixed bugs 2013-07-08 22:14:56 +02:00
jeena
9119550d1c merge 2013-07-08 22:11:45 +02:00
jeena
7ac0191a1a added AdminController 2013-07-08 22:07:51 +02:00
Logsol
178be87cb6 Merge branch 'master' of github.com:jeena/seinheit.ch 2013-07-08 22:00:54 +02:00
Logsol
6ffd67045c resolved ds store conflicts, added plugins 2013-07-08 22:00:39 +02:00
jeena
b1d5d8f111 changes 2013-07-08 21:58:12 +02:00
jeena
eabbab94e9 cleaned db stuff 2013-07-08 21:52:39 +02:00
jeena
8a383aa084 cleaned db stuff 2013-07-08 21:52:39 +02:00
jeena
0941892470 fixed title 2013-07-08 21:35:48 +02:00
jeena
e65e31cbd2 fixed title 2013-07-08 21:35:48 +02:00
jeena
ae3997ba87 ported main.phtml 2013-07-08 21:34:08 +02:00
jeena
05de07abcd ported main.phtml 2013-07-08 21:34:08 +02:00
jeena
5f62111446 added admin css 2013-07-08 21:10:15 +02:00
jeena
336296b319 added admin css 2013-07-08 21:10:15 +02:00
jeena
f2f0167277 removed .DS_Store and added .gitignore 2013-07-08 21:06:50 +02:00
jeena
9424563c79 removed .DS_Store and added .gitignore 2013-07-08 21:06:50 +02:00
Logsol
57c0436f14 added some useful models and controllers 2013-07-08 21:02:22 +02:00
Logsol
1d4b2a3314 added some useful models and controllers 2013-07-08 21:02:22 +02:00
Logsol
a6873ee6c8 added some useful models and controllers 2013-07-08 20:55:46 +02:00
Logsol
9bb724147e added some useful models and controllers 2013-07-08 20:55:46 +02:00
jeena
be916018ba added css 2013-07-08 20:41:30 +02:00
jeena
91dfff568e added css 2013-07-08 20:41:30 +02:00
logsol
3c63bf20c1 Edited README.textile via GitHub 2011-10-05 18:59:41 +03:00
logsol
dd7eb43364 Edited README.textile via GitHub 2011-10-05 18:59:41 +03:00
fartman
64d572dd2d Added textile markup 2011-04-07 08:33:18 -07:00
115 changed files with 8090 additions and 1418 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.DS_Store
config/admin.ini
config/database.config.ini

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "public/lib/codemirror"]
path = public/lib/codemirror
url = git@github.com:marijnh/CodeMirror.git

View file

@ -0,0 +1,45 @@
<?php
class AdminController extends Katharsis_Controller_Abstract
{
public function indexAction()
{
if(!Access::isLoggedIn()) $this->_location('gate');
}
public function gateAction()
{
}
public function loginAction()
{
if($this->_getParam('password') == $this->getPassword())
{
$_SESSION['logged'] = 1;
$this->_location('index');
}
else
{
$this->_location('gate', null, array('wrongpassword' => ''));
}
}
public function logoutAction()
{
$_SESSION['logged'] = 0;
$this->_location('index', 'index');
}
// Private
private function getPassword()
{
$path = 'config/admin.ini';
if(!is_readable($path)) die($path . " not found");
$admin_ini = parse_ini_file($path);
$password = $admin_ini["password"];
return $password;
}
}

View file

@ -0,0 +1,53 @@
<?php
class AdminNavigationController extends Katharsis_Controller_Abstract
{
protected $_navi;
public function init()
{
$this->_navi = new Navigation();
}
public function indexAction()
{
$this->_view->list = $this->_navi->getAllItems(false);
}
public function editAction()
{
$this->_view->mainItems = $this->_navi->getMainItems();
$this->_view->item = $this->_navi->getItem($this->_getParam('id'));
$this->_view->sites = $this->_navi->getSites();
}
public function deleteAction()
{
$this->_navi->delete($this->_getParam('id'));
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich gelöscht!');
$this->_location('index');
}
public function saveAction()
{
$params = $this->_getAllParams();
$params['active'] = 0;
if($this->_getParam('active') && $this->_getParam('active') == 'on')
{
$params['active'] = 1;
}
$params['parentId'] = ($params['parentId'] == '0') ? null : $params['parentId'];
$this->_navi->save($params);
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich gespeichert!');
$this->_location('index');
}
public function moveAction()
{
$this->_navi->move($this->_getParam('direction'), $this->_getParam('id'));
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich verschoben!');
$this->_location('index');
}
}

View file

@ -0,0 +1,96 @@
<?php
class AdminPageController extends Katharsis_Controller_Abstract
{
protected $_page;
public function init()
{
$this->_page = new Page();
}
public function indexAction()
{
$this->_view->pages = $this->_page->getPages();
}
public function editAction()
{
$this->_view->page = $this->_page->getPage($this->_getParam('pageId'));
}
public function imageAction()
{
if($this->_getParam('type') == 'header') {
$type = 'header';
} else {
$type = 'page';
}
$this->_view->type = $type;
$path = getcwd().'/public/img/' . $type . '/';
if(isset($_FILES['myfile']))
{
$upload = new Upload();
if($type == 'header') {
$imagePath = $upload->header($_FILES['myfile']);
} else {
$imagePath = $upload->page($_FILES['myfile']);
}
$this->_view->imagePath = $imagePath;
echo $this->_view->render('AdminPage/uploadsuccess');
die();
}
if(isset($_GET['delete']))
{
$deleteFile = $path . $_GET['delete'];
if(file_exists($deleteFile)) {
unlink($deleteFile);
}
}
$ar = array();
if (is_readable($path) && $handle = opendir($path))
{
while (false !== ($file = readdir($handle))) {
if(is_dir($file)) continue;
$ar[] = $file;
}
closedir($handle);
}
$this->_view->files = $ar;
echo $this->_view->render('AdminPage/image');
die();
}
public function saveAction()
{
$params = $this->_getAllParams();
$params['active'] = 0;
if($this->_getParam('active') && $this->_getParam('active') == 'on')
{
$params['active'] = 1;
}
$this->_page->save($params);
DidgeridooArtwork_Notice::add('Page wurde erfolgreich gespeichert!');
$this->_location($this->_getParam('url'), 'page');
}
public function deleteAction()
{
$this->_page->delete($this->_getParam('pageId'));
DidgeridooArtwork_Notice::add('Page wurde erfolgreich gelöscht!');
$this->_location('index');
}
}

View file

@ -0,0 +1,5 @@
<?php
class AdminUploadController extends Katharsis_Controller_Abstract
{
// check adminPageController and Upload model
}

View file

@ -27,8 +27,7 @@ class IndexController extends Katharsis_Controller_Abstract
*/ */
public function indexAction() public function indexAction()
{ {
$this->_view->someVariableName = 'Katharsis'; // will be overwritten by IndexRedirect Plugin
echo $this->_view->render('welcome');
} }
/** /**

View file

@ -0,0 +1,40 @@
<?php
class PageController extends Katharsis_Controller_Abstract
{
protected $_page;
public function init()
{
$this->_page = new Page();
}
public function __call($method, $args)
{
$preview = false;
if(array_key_exists('preview', $this->_getAllParams()) && Access::isLoggedIn())
{
$preview = true;
}
$url = substr($method, 0, -6); // remove Action from urlAction
$pageId = $this->_page->getIdByUrl($url, $preview);
if(!$pageId) {
throw new DidgeridooArtwork_Exception('Page konnte nicht geladen werden.');
}
$pageData = $this->_page->getPage($pageId);
foreach($pageData as $key => $value) {
$this->_view->{$key} = $value;
}
$this->_view->content = DidgeridooArtwork_Page_Plugin::render($this->_view->content);
$content = $this->_view->render('Page/post');
$this->_view->stageContent = $content;
echo $this->_view->render('main');
die();
}
}

View file

@ -0,0 +1,16 @@
<?php
class Access extends Katharsis_Model_Abstract
{
public function init()
{
}
public static function isLoggedIn()
{
if(isset($_SESSION['logged']) && $_SESSION['logged'] == 1)
{
return true;
}
return false;
}
}

View file

@ -1,23 +0,0 @@
<?php
/**
* Example Model
* Use models do define an interface
* between data holders and your application. You can implement your
* business logic in model classes as well.
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Example extends Katharsis_Model_Abstract
{
/**
* Init method, will be called when this class is instanced
* Use this method instead of __construct()
*
* @return void
*/
public function init()
{
}
}

View file

@ -0,0 +1,297 @@
<?php
class Navigation extends Katharsis_Model_Abstract
{
public function init()
{
}
public function getAllItems($onlyActive = true)
{
$tidyResult = array();
$activityStatement = $onlyActive ? "AND active = 1" : "";
$result = $this->_con->fetchAll("SELECT * FROM navigation WHERE parent_id IS NULL " . $activityStatement . " ORDER BY sorting");
foreach($result as $item)
{
$subSet = array();
$sql = "SELECT * FROM navigation WHERE parent_id = :parentId ORDER BY sorting";
$sql = $this->_con->createStatement($sql, array('parentId' => $item['id']));
$item['children'] = $this->_con->fetchAll($sql);
$tidyResult[] = $item;
}
return $tidyResult;
}
public function getMainItems()
{
return $this->_con->fetchAll("SELECT id, name FROM navigation WHERE parent_id IS NULL AND active = 1 ORDER BY sorting");
}
public function getItem($id)
{
if($id !== null)
{
$sql = "SELECT * FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
if(!$result = $this->_con->fetchOne($sql))
{
throw new DidgeridooArtwork_Exception('Item with this id not existent');
}
}
else
{
$sql = "SHOW COLUMNS FROM navigation";
$res = $this->_con->fetchAll($sql);
foreach($res as $it)
{
$result[$it['Field']] = '';
}
}
return $result;
}
public function add()
{
}
public function delete($id)
{
$sql = "DELETE FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
$this->_con->run($sql);
}
public function move($direction, $id)
{
$sql = "SELECT sorting, parent_id FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
if($active = $this->_con->fetchOne($sql))
{
$parentPart = ($active['parent_id'] === null) ? "parent_id IS NULL" : "parent_id = :parentId";
if($direction == 'up')
{
$sql = "SELECT id, sorting FROM navigation
WHERE
" . $parentPart . "
AND sorting < :sorting
ORDER BY sorting DESC
LIMIT 1
";
}
else if($direction == 'down')
{
$sql = "SELECT id, sorting FROM navigation
WHERE
" . $parentPart . "
AND sorting > :sorting
ORDER BY sorting ASC
LIMIT 1
";
}
else
{
throw new DidgeridooArtwork_Exception('Wrong Direction');
}
$sql = $this->_con->createStatement($sql, array(':id' => $id, 'parentId' => $active['parent_id'], 'sorting' => $active['sorting']));
$passiveItem = $this->_con->fetchOne($sql);
//updating active item
$sql = "UPDATE navigation SET sorting = :sorting WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id, 'sorting' => $passiveItem['sorting']));
$this->_con->run($sql);
//updating passive item
$sql = "UPDATE navigation SET sorting = :sorting WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $passiveItem['id'], 'sorting' => $active['sorting']));
$this->_con->run($sql);
}
else
{
throw new DidgeridooArtwork_Exception('Wrong Parameters');
}
}
public static function buildLink($base, $item, $simpleMode = false)
{
if($item['link'] !== null)
{
return $item['link'];
}
$link = $base . '/' . $item['controller'];
if($simpleMode)
{
$link = $item['controller'];
}
if($item['action'] !== null)
{
$link .= '/' . $item['action'];
if($simpleMode) return $link;
if($item['controller'] == 'page')
{
$link .= '/preview';
}
}
return $link;
}
public static function getTitle()
{
if(substr(Katharsis_Request::getControllerName(), 0, 5) == 'admin')
{
return 'Admin';
}
$con = Katharsis_DatabaseConnector::getConnection();
if(Katharsis_Request::getControllerName() == 'page')
{
$sql = "SELECT title FROM page WHERE url = :url";
$sql = $con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
if($field = $con->fetchField($sql))
{
return $field;
}
}
$menuItemId = Katharsis_View::getInstance()->activeMenuItem;
$sql = "SELECT name FROM navigation WHERE id = :menuItemId";
$sql = $con->createStatement($sql, array('menuItemId' => $menuItemId));
if($field = $con->fetchField($sql))
{
return $field;
}
return Katharsis_Registry::getInstance()->defaults['title'];
}
public static function getSubtitle()
{
$con = Katharsis_DatabaseConnector::getConnection();
if(Katharsis_Request::getControllerName() == 'page')
{
$sql = "SELECT subtitle FROM page WHERE url = :url";
$sql = $con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
if($field = $con->fetchField($sql))
{
return $field;
}
}
return Katharsis_Registry::getInstance()->defaults['subtitle'];
}
public function getSites()
{
$sql = "SELECT url FROM page";
$sql = $this->_con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
$sites = $this->_con->fetchAll($sql);
foreach($sites as &$site)
{
$site = 'page/' . $site['url'];
}
$sites = array(
'defaults' => array(),
'pages' => $sites
);
if(isset(Katharsis_Registry::getInstance()->defaults['sites'])){
$sites['defaults'] = explode(", ", Katharsis_Registry::getInstance()->defaults['sites']);
}
return $sites;
}
public function save($params)
{
$transformed = $this->_transformUrl($params['url'], $params['external']);
$values = array(
'id' => $params['id'],
'name' => $params['name'],
'parent_id' => $params['parentId'],
'active' => $params['active']
);
$values = array_merge($values, $transformed);
if(isset($values['id']) && is_numeric($values['id']))
{
$sql = "UPDATE navigation
SET
name = :name,
controller = :controller,
action = :action,
link = :link,
parent_id = :parent_id,
active = :active
WHERE
id = :id
";
$sql = $this->_con->createStatement($sql, $values);
$this->_con->run($sql);
}
else
{
if($values['parent_id'] === null)
{
$sql = "SELECT max(sorting) + 1 as maxi FROM `navigation` WHERE parent_id IS NULL";
}
else
{
$sql = "SELECT max(sorting) + 1 as maxi FROM `navigation` WHERE parent_id = :parentId";
$sql = $this->_con->createStatement($sql, array('parentId' => $values['parent_id']));
}
$max = $this->_con->fetchField($sql);
$max = ($max === null) ? 1 : $max;
$values['sorting'] = $max;
$this->_con->insert('navigation', $values);
}
}
protected function _transformUrl($url, $external = null)
{
$values = array(
'controller' => null,
'action' => null,
'link' => null
);
if($url == '-external-')
{
$values['link'] = $external;
return $values;
}
$e = explode('/', $url);
if(array_key_exists(1, $e))
{
$values['controller'] = $e[0];
$values['action'] = $e[1];
}
else
{
$values['controller'] = $url;
}
return $values;
}
}

View file

@ -0,0 +1,86 @@
<?php
class Page extends Katharsis_Model_Abstract
{
public function init()
{
}
public function getIdByUrl($url, $preview = false)
{
$activeTerm = '';
if(!$preview)
{
$activeTerm = 'AND active = 1';
}
$sql = $this->_con->createStatement("SELECT id FROM page WHERE url = :url " . $activeTerm, array("url" => $url));
if($result = $this->_con->fetchOne($sql)){
return $result['id'];
}
}
public function getPages()
{
$sql = "SELECT id, title, subtitle, url, active FROM page ORDER BY id";
return $this->_con->fetchAll($sql);
}
public function getPage($pageId)
{
$default = $this->_con->getEmptyColumnArray('page');
if($pageId === null) return $default;
$sql = "SELECT * FROM page WHERE id = :pageId";
$sql = $this->_con->createStatement($sql, array('pageId' => $pageId));
if($result = $this->_con->fetchOne($sql))
{
return $result;
}
return $default;
}
public function save($params)
{
$values = array(
'title' => $params['title'],
'subtitle' => $params['subtitle'],
'url' => $params['url'],
'content' => $params['content'],
'active' => $params['active'],
'header_image' => $params['header_image']
);
if(isset($params['id']) && is_numeric($params['id']))
{
$values['id'] = $params['id'];
$sql = "UPDATE page
SET
title = :title,
subtitle = :subtitle,
url = :url,
content = :content,
active = :active,
header_image = :header_image
WHERE
id = :id
";
$sql = $this->_con->createStatement($sql, $values);
$this->_con->run($sql);
}
else
{
$this->_con->insert('page', $values);
}
}
public function delete($pageId)
{
$sql = "DELETE FROM page WHERE id = :pageId";
$sql = $this->_con->createStatement($sql, array('pageId' => (int) $pageId));
$this->_con->run($sql);
}
}
?>

View file

@ -0,0 +1,55 @@
<?php
class Upload extends Katharsis_Model_Abstract
{
public function init()
{
}
public function header($file)
{
$dir = getcwd() . '/public/img/header';
return $this->_uploadFile(null, $file, $dir);
}
public function page($file)
{
$dir = getcwd() . '/public/img/page';
return $this->_uploadFile(null, $file, $dir, $file['name'] . '-' . time());
}
protected function _uploadFile($id, $file, $dir, $name = null)
{
$name = time();
if (!is_dir($dir)) {
mkdir($dir);
}
$typeAccepted = array("image/jpeg", "image/gif", "image/png");
if(!in_array($file['type'], $typeAccepted)) {
throw new DidgeridooArtwork_Exception('Hochladen fehlgeschlagen. Dateityp nicht akzeptiert. Nur jpeg, gif und png möglich');
return false;
}
$ext = '';
switch($file['type']) {
case "image/jpeg":
$ext = '.jpg';
break;
case "image/gif":
$ext = '.gif';
break;
case "image/png":
$ext = '.png';
break;
}
if (!move_uploaded_file($file['tmp_name'], $dir . '/' . $name . $ext))
{
throw new DidgeridooArtwork_Exception('Hochladen fehlgeschlagen. (move_uploaded_file: false)');
return false;
}
return $name . $ext;
}
}

View file

@ -0,0 +1,11 @@
<div id="admin">
<form action="<?php echo $this->base ?>/admin/login" method="post">
<dl>
<dt>Admin</dt>
<dd>
<?php if($this->_getParam('wrongpassword')) echo 'passwort falsch<br/>' ?>
<input type="password" name="password" value="" /> <input type="submit" name="login" value="login" />
</dd>
</dl>
</form>
</div>

View file

@ -0,0 +1,5 @@
<div id="admin">
<p>
Willkommen im Admin Bereich.
</p>
</div>

View file

@ -0,0 +1,59 @@
<div id="admin">
<h3>Navigation/Menüpunkt bearbeiten</h3>
<form action="<?php echo $this->base ?>/adminNavigation/save"method="post">
<input type="hidden" name="id" value="<?php if($this->item['id']) echo $this->item['id'] ?>" />
<dl>
<dt>Aktiv</dt>
<dd>
<input type="checkbox" name="active" <?php if($this->item['active']) echo 'checked="checked"' ?> />
</dd>
</dl>
<dl>
<dt>Menüpunkttyp</dt>
<dd>
<select name="parentId">
<option value="0">Hauptpunkt</option>
<?php foreach($this->mainItems as $item): ?>
<option <?php if($item['id'] == $this->item['parent_id'] || $item['id'] == $this->_getParam('parentId')) echo 'selected="selected"' ?> value="<?php echo $item['id'] ?>">Unterpunkt von <?php echo $item['name'] ?></option>
<?php endforeach ?>
</select>
</dd>
</dl>
<dl>
<dt>Titel</dt>
<dd>
<input type="text" name="name" value="<?php echo $this->item['name'] ?>"/>
</dd>
</dl>
<dl>
<dt>Url</dt>
<dd>
<table>
<?php
// Wenn hier echte Controller hinzukommen sollen, einfach in der defaults.config.ini unter sites eintragen
if(!empty($this->sites['defaults'])): ?>
<tr>
<td>
<?php foreach($this->sites['defaults'] as $key => $site): ?>
<input type="radio" checked="checked" name="url" id="sitedefault_<?php echo $key ?>" value="<?php echo $site ?>"/><label for="sitedefault_<?php echo $key ?>"><?php echo $site ?></label><br/>
<?php endforeach ?>
</td>
<?php endif; ?>
<td>
<?php foreach($this->sites['pages'] as $key => $site): ?>
<input type="radio" name="url" id="sitepage_<?php echo $key ?>" value="<?php echo $site ?>"/><label for="sitepage_<?php echo $key ?>"><?php echo $site ?></label><br/>
<?php endforeach ?>
</td>
<td>
<input type="radio" name="url" id="sitenew" value="-external-"/><label for="sitenew">Externe Adresse:</label><br/>
<input type="text" name="external" value="http://"/>
</tr>
</table>
</dd>
</dl>
<p>
<input type="submit" name="save" value="speichern" />
</p>
</form>
</div>

View file

@ -0,0 +1,111 @@
<div id="admin">
<h3>Navigation Bearbeiten</h3>
<table>
<tr>
<th>
Aktiv
</th>
<th>
Name
</th>
<th colspan="7">
Link
</th>
</tr>
<?php $o=0; foreach($this->list as $parent): $i=0; ?>
<tr>
<td>
<?php if($parent['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $parent['name'] ?>
</td>
<td>
<?php echo Navigation::buildLink($this->base, $parent, true); ?>
</td>
<td>
<?php if($o!=0): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/up/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_up.png" alt="Nach oben verschieben" title="Nach oben verschieben"/>
</a>
<?php endif ?>
</td>
<td>
<?php if($o<count($this->list)-1): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/down/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_down.png" alt="Nach unten verschieben" title="Nach unten verschieben" />
</a>
<?php endif ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/delete/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/parentId/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/addSub.png" alt="Unterpunkt hinzufügen" title="Unterpunkt hinzufügen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo Navigation::buildLink($this->base, $parent, false); ?>">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php foreach($parent['children'] as $child): ?>
<tr class="sub">
<td>
<?php if($child['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $child['name'] ?>
</td>
<td>
<?php echo Navigation::buildLink($this->base, $child, true); ?>
</td>
<td>
<?php if($i!=0): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/up/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_up.png" alt="Nach oben verschieben" title="Nach oben verschieben"/>
</a>
<?php endif ?>
</td>
<td>
<?php if($i<count($parent['children'])-1): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/down/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_down.png" alt="Nach unten verschieben" title="Nach unten verschieben" />
</a>
<?php endif ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/delete/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
&nbsp;
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo Navigation::buildLink($this->base, $child, false); ?>">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php $i++; endforeach ?>
<?php $o++; endforeach ?>
</table>
<p>
<a href="<?php echo $this->base ?>/adminNavigation/edit">Neuen Hauptpunkt anlegen</a>
</p>
</div>

View file

@ -0,0 +1,70 @@
<div id="admin">
<h3>Page bearbeiten</h3>
<form action="<?php echo $this->base ?>/adminPage/save" method="post">
<div style="display: none"><input type="hidden" name="id" value="<?php echo $this->page['id'] ?>" /></div>
<dl>
<dt>Aktiv</dt>
<dd>
<input type="checkbox" name="active" <?php if($this->page['active']) echo 'checked="checked"' ?> />
</dd>
</dl>
<dl>
<dt>Titel</dt>
<dd>
<input class="textfield" type="text" name="title" value="<?php echo $this->page['title'] ?>"/>
</dd>
</dl>
<dl>
<dt>Untertitel</dt>
<dd>
<input class="textfield" type="text" name="subtitle" value="<?php echo $this->page['subtitle'] ?>"/>
</dd>
</dl>
<dl>
<dt>Url</dt>
<dd>
<input class="textfield" type="text" name="url" value="<?php echo $this->page['url'] ?>"/>
</dd>
</dl>
<dl>
<dt>Headerbild</dt>
<dd>
<input class="textfield" type="text" name="header_image" value="<?php echo $this->page['header_image'] ?>"/>
<a href="javascript: void(0);" onclick="window.open('/adminPage/image/type/header', 'fenster1', 'width=600,height=400,status=yes,scrollbars=yes,resizable=yes');">Auswählen</a>
</dd>
</dl>
<dl>
<dt>Inhalt</dt>
<dd>
<textarea id="content" name="content" rows="15" cols="80"><?php echo /*htmlentities*/($this->page['content']) ?></textarea>
</dd>
</dl>
<dl>
<dt>Bild&nbsp;für&nbsp;Inhalt</dt>
<dd>
<a href="javascript: void(0);" onclick="window.open('/adminPage/image/type/page', 'fenster2', 'width=600,height=400,status=yes,scrollbars=yes,resizable=yes');">Auswählen</a>
</dd>
</dl>
<p>
<input type="submit" name="save" value="speichern" />
</p>
</form>
</div>
<script src="<?php echo $this->base ?>/lib/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="<?php echo $this->base ?>/lib/codemirror/lib/codemirror.css">
<script src="<?php echo $this->base ?>/lib/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="<?php echo $this->base ?>/lib/codemirror/mode/javascript/javascript.js"></script>
<script src="<?php echo $this->base ?>/lib/codemirror/mode/css/css.js"></script>
<script src="<?php echo $this->base ?>/lib/codemirror/mode/xml/xml.js"></script>
<script type="text/javascript">
var myCodeMirror = CodeMirror.fromTextArea(
document.getElementById('content'),
{
mode: "htmlmixed"
}
);
</script>

View file

@ -0,0 +1,40 @@
<html>
<head>
<title><?php echo ucfirst($this->type) ?> Bilder - Seinheit</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/popup.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="<?php echo $this->base ?>/script/admin.js"></script>
</head>
<body>
<h1>Bild Hochladen</h1>
<form method="post" enctype="multipart/form-data">
<p>
<input name="myfile" type="file" size="50" maxlength="100000">
<input type="submit" value="Hochladen" />
</p>
</form>
<hr>
<h1>Bild Ausw&auml;hlen</h1>
<table>
<?php foreach($this->files as $file): ?>
<tr>
<td width="50%">
<a href="#" onclick="window.open('<?php echo "{$this->base}/img/{$this->type}/{$file}" ?>', 'Bild', 'width=800,height=600,status=yes,scrollbars=yes,resizable=yes'); return false;">
<img src="<?php echo "{$this->base}/img/{$this->type}/{$file}" ?>" >
</a>
</td>
<td>
<a href="javascript: void(0);" onclick="adminPageInsertImage(<?php echo "'{$this->type}', '{$file}'" ?>); window.close();" >Einf&uuml;gen</a>
</td>
<td>
<a href="?delete=<?php echo $file ?>" onclick="return confirm('Wirklich löschen?')">L&ouml;schen</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>

View file

@ -0,0 +1,57 @@
<div id="admin">
<h3>Page Übersicht</h3>
<table>
<tr>
<th>
Aktiv
</th>
<th>
Titel
</th>
<th>
Untertitel
</th>
<th>
Url
</th>
<th colspan="3">
&nbsp;
</th>
</tr>
<?php foreach($this->pages as $page): ?>
<tr>
<td>
<?php if($page['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $page['title'] ?>
</td>
<td>
<?php echo $page['subtitle'] ?>
</td>
<td>
<?php echo $page['url'] ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminPage/delete/pageId/<?php echo $page['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminPage/edit/pageId/<?php echo $page['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/page/<?php echo $page['url'] ?>/preview">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php endforeach ?>
</table>
<p>
<a href="<?php echo $this->base ?>/adminPage/edit">Neue Seite anlegen</a>
</p>
</div>

View file

@ -0,0 +1,12 @@
<script src="<?php echo $this->base ?>/script/admin.js"></script>
<script type="text/javascript">
adminPageInsertImage('<?php echo $this->type; ?>', '<?php echo $this->imagePath;?>');
setTimeout(function() {
window.self.close();
}, 800);
</script>
<h2>Das Hochladen war erfolgreich.</h2>

View file

@ -0,0 +1,34 @@
<div id="admin">
<h3>Produkt-Bild hinzufügen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Produkt
</dt>
<dd>
<?php echo $this->item['name'] ?>
</dd>
</dl>
<dl>
<dt>
Klein
</dt>
<dd>
<input type="file" value="" name="small" size="32" />
</dd>
</dl>
<dl>
<dt>
Groß
</dt>
<dd>
<input type="file" value="" name="big" size="32" />
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,34 @@
<div id="admin">
<h3>Produkt-Bild hinzufügen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Produkt
</dt>
<dd>
<?php echo $this->item['name'] ?>
</dd>
</dl>
<dl>
<dt>
Klein
</dt>
<dd>
<input type="file" value="" name="small" size="32" />
</dd>
</dl>
<dl>
<dt>
Groß
</dt>
<dd>
<input type="file" value="" name="big" size="32" />
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,17 @@
<div id="admin">
<h3>Hochladen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Datei
</dt>
<dd>
<input type="file" value="" name="myfile" size="32"/>
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,4 @@
<h3>Fehler</h3>
<p>
<?php echo $this->message ?>
</p>

View file

@ -0,0 +1,12 @@
<html>
<head>
<title>Swiss Didgeridoo Artwork</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/main.css" />
<link rel="shortcut icon" href="<?php echo $this->base ?>/img/leafs/favicon.ico" type="image/x-icon" />
</head>
<body id="index">
<a href="<?php echo $this->base ?>/page/home" title="Klick!" alt="Willkommensbild">
<img src="<?php echo $this->base ?>/img/leafs/index.png" />
</a>
</body>
</html>

View file

@ -0,0 +1,13 @@
<?php if($this->header_image): ?>
<img id="header_image" src="<?php echo $this->base ?>/img/header/<?php echo $this->header_image ?>" alt="">
<?php endif ?>
<?php if($this->title): ?>
<h1><?php echo $this->title ?></h1>
<?php endif ?>
<?php if($this->subtitle): ?>
<h2><?php echo $this->subtitle ?></h2>
<?php endif ?>
<div id="content">
<?php echo $this->content ?>
</div>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php if(Navigation::getTitle()) echo Navigation::getTitle() . " - "; ?>Seinheit</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/main.css" />
<?php if(Access::isLoggedIn()): ?>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/admin.css" />
<script src="<?php echo $this->base ?>/script/admin.js"></script>
<?php endif ?>
</head>
<body<?php if(Access::isLoggedIn()): ?> class="admin"<?php endif ?>>
<div id="container">
<header>
<?php if(Access::isLoggedIn()): ?>
<ul id="adminNavigation">
<li>Admin Bereich</li>
<li><a href="<?php echo $this->base ?>/adminNavigation">Navigationen</a></li>
<li><a href="<?php echo $this->base ?>/adminPage">Pages</a></li>
<?php if(Katharsis_Request::getControllerName() == 'page'): ?>
<li><a href="<?php echo $this->base ?>/adminPage/edit/pageId/<?php echo $this->id; ?>">Page Editieren</a></li>
<?php endif ?>
<li><a href="<?php echo $this->base ?>/admin/logout">Ausloggen</a></li>
</ul>
<?php endif ?>
<?php if($this->notices): ?>
<ul class="notices">
<?php foreach($this->notices as $notice): ?>
<li><?php echo $notice ?></li>
<?php endforeach ?>
</ul>
<?php endif ?>
<nav>
<a id="logo" href="<?php echo $this->base ?>/"><img src="<?php echo $this->base ?>/img/logo.png" alt="SEINHEIT logo"/></a>
<ul id="navi">
<?php foreach($this->mainNavigationItems as $item): ?>
<li<?php if($item['id'] == $this->activeMenuItem) echo ' class="active"'?>>
<?php if($item['link']): ?>
<a href="<?php echo $item['link'] ?>"><?php echo $item['name'] ?></a>
<?php else: ?>
<a href="<?php echo $this->base ."/". ($item['controller'] != "page" ? $item['controller'] . "/" : "") . $item['action'] ?>"><?php echo $item['name'] ?></a>
<?php endif ?>
<?php if(count($item['children']) > 0): ?>
<ul>
<?php foreach($item['children'] as $child): ?>
<li<?php if($child['id'] == $this->activeSubMenuItem) echo ' class="active"'?>>
<?php if($child['link']): ?>
<a href="<?php echo $child['link'] ?>"><?php echo $child['name'] ?></a>
<?php else: ?>
<a href="<?php echo $this->base ."/". ($child['controller'] != "page" ? $child['controller'] . "/" : "") . $child['action'] ?>">
<?php echo $child['name'] ?></a>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
</nav>
</header>
<article id="stage">
<?php echo $this->stageContent ?>
</article>
<footer>
<p id="social">
<a href="https://www.facebook.com/pages/Naturheilpraxis-SEINHEIT/190046497711632">
<img src="<?php echo $this->base ?>/img/facebook-icon.png" alt="SEINHEIT bei Facebook">
</a>
</p>
<p>Naturheilpraxis SEINHEIT. Kinga Pannek, Guyer-Zeller-Strasse 6, 8620 Wetzikon, Schweiz, Telefon: 078 684 86 75</p>
</footer>
</div>
</body>
</html>

View file

@ -1,12 +0,0 @@
<html>
<head>
<title></title>
<link href="<?=$this->base?>/style/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Welcome</h1>
<p>
This is an empty <?=$this->someVariableName?> project.
</p>
</body>
</html>

86
backup/db.sql Normal file

File diff suppressed because one or more lines are too long

1
config/admin.ini.example Normal file
View file

@ -0,0 +1 @@
password = test

View file

@ -1,5 +0,0 @@
; [connection:development:default]
; host = localhost
; user = root
; password =
; database = myDatabaseName

View file

@ -0,0 +1,5 @@
[connection:development:default]
host = 127.0.0.1
user = root
password =
database = seinheit_ch

42
config/dbinit.sql Normal file
View file

@ -0,0 +1,42 @@
/*!40101 SET NAMES utf8 */;
--
-- Table structure for table `navigation`
--
DROP TABLE IF EXISTS `navigation`;
CREATE TABLE `navigation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`controller` varchar(64) DEFAULT NULL,
`action` varchar(64) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`sorting` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
--
-- Table structure for table `page`
--
DROP TABLE IF EXISTS `page`;
CREATE TABLE `page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`subtitle` varchar(256) DEFAULT NULL,
`url` varchar(256) NOT NULL,
`content` text DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`header_image` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
--
-- Data
--
INSERT INTO `page` (`title`, `url`, `content`) VALUES ("Home", "home", "Wilkommen bei Katharsis");
INSERT INTO `navigation` (`name`, `link`) VALUES ("Home", "/");

View file

@ -0,0 +1,4 @@
title = Seinheit.
subtitle = Praxis für Traditionelle Europäische Medizin
email = info@seinheit.ch
#sites = news, blog

View file

@ -0,0 +1,17 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Access extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
if(Katharsis_Request::getControllerName() != 'admin')
{
$firstFive = substr(Katharsis_Request::getControllerName(), 0, 5);
if($firstFive == 'admin' && !Access::isLoggedIn())
{
Katharsis_Request::setControllerName('admin');
Katharsis_Request::setActionName('index');
}
}
}
}

View file

@ -0,0 +1,13 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Defaults extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$ini = parse_ini_file('config/defaults.config.ini', true);
$registry = Katharsis_Registry::getInstance();
$registry->defaults = $ini;
$view = Katharsis_View::getInstance();
$view->defaults = $ini;
}
}

View file

@ -0,0 +1,44 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Navigation extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$navigation = new Navigation();
$view->mainNavigationItems = $navigation->getAllItems();
/*
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id IS NULL AND active = 1 ORDER BY sorting";
$view->mainNavigationItems = $this->_con->fetchAll($sql);
$sql = "SELECT id, parent_id, controller, action FROM navigation WHERE (action = :action AND controller = :controller) OR (action IS NULL AND controller = :controller)";
$sql = $this->_con->createStatement($sql, array(
'controller' => Katharsis_Request::getControllerName(),
'action' => Katharsis_Request::getActionName()
));
if($row = $this->_con->fetchOne($sql))
{
$activeItemId = ($row['parent_id'] === null) ? $row['id'] : $row['parent_id'];
$view->activeMenuItem = $activeItemId;
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id = :parentId ORDER BY sorting";
$sql = $this->_con->createStatement($sql, array('parentId' => $activeItemId));
$view->subNavigationItems = $this->_con->fetchAll($sql);
if($row['parent_id'] !== null)
{
$view->activeSubMenuItem = $row['id'];
}
else
{
$actionpart = ($row['action'] === null) ? ' action IS NULL ' : ' action = :action';
$sql = "SELECT id FROM navigation WHERE controller = :controller AND " . $actionpart . " AND parent_id IS NOT NULL";
$sql = $this->_con->createStatement($sql, array('controller' => $row['controller'], 'action' => $row['action']));
$view->activeSubMenuItem = $this->_con->fetchField($sql);
}
}*/
}
}

View file

@ -0,0 +1,9 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Notice extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$view->notices = DidgeridooArtwork_Notice::get();
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Controller_Plugin_SetNames extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$sql = "SET NAMES utf8";
$this->_con->run($sql);
}
}

View file

@ -0,0 +1,16 @@
<?php
class DidgeridooArtwork_Exception extends Katharsis_Exception
{
protected $_important = false;
public function __construct($message, $important = false)
{
$this->_important = $important;
parent::__construct($message);
}
public function handle()
{
}
}

View file

@ -0,0 +1,23 @@
<?php
class DidgeridooArtwork_Notice
{
public static function add($notice)
{
if(!is_array($_SESSION['notices']))
{
$_SESSION['notices'] = array();
}
$_SESSION['notices'][] = $notice;
}
public static function get()
{
$notices = array();
if(array_key_exists('notices', $_SESSION))
{
$notices = $_SESSION['notices'];
}
$_SESSION['notices'] = array();
return $notices;
}
}

View file

@ -0,0 +1,25 @@
<?php
class DidgeridooArtwork_Page_Plugin
{
public static function render($content)
{
preg_match_all('~\{\@([^\}| ]*) ?([^\}]*)\}~', $content, $findings);
foreach($findings[1] as $key => $item)
{
$instanceName = "DidgeridooArtwork_Page_Plugin_" . ucfirst($findings[1][$key]);
if(!Katharsis_Autoload::findClass($instanceName))
{
throw new DidgeridooArtwork_Exception('PagePlugin ' . $instanceName . ' konnte nicht gefunden werden.', 1);
}
$object = new $instanceName;
$plugincontent = (string) $object->render(trim($findings[2][$key]));
$content = str_replace($findings[0][$key], $plugincontent, $content);
}
return $content;
}
}

View file

@ -0,0 +1,19 @@
<?php
abstract class DidgeridooArtwork_Page_Plugin_Abstract
{
protected $_con;
protected $_view;
public final function __construct()
{
$this->_con = Katharsis_DatabaseConnector::getConnection();
$this->_view = Katharsis_View::getInstance();
$this->init();
}
public function init()
{
}
abstract public function render($parameters);
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Base extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($after)
{
return $this->_view->base . '/' . $after;
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Image extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($imgName)
{
return $this->_view->base . "/img/page/" . $imgName;
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Mail extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
return $this->_view->render('Plugin/mail');
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Page_Plugin_MiniEventList extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$event = new Event();
$this->_view->pluginEvents = $event->getEventList();
return $this->_view->render('Plugin/minieventlist');
}
}

View file

@ -0,0 +1,10 @@
<?php
class DidgeridooArtwork_Page_Plugin_MiniNewsList extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$news = new News();
$this->_view->pluginNews = $news->getActiveNews();
return $this->_view->render('Plugin/mininewslist');
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Newsletter extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
return $this->_view->render('Plugin/newsletter');
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Page extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($pageName)
{
return $this->_view->base . "/" . $pageName;
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Page_Plugin_ShopVorschau extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$event = new Event();
$this->_view->pluginEvents = $event->getEventList();
return $this->_view->render('Plugin/shopvorschau');
}
}

View file

@ -1,51 +1,40 @@
<?php <?php
/** class Katharsis_Autoload
* Autoloader {
* Loads class files automatically when they are needed. protected static $_classLocations = array(
* 'library',
* @author Karl Pannek <info@katharsis.in> 'application/controller',
* @version 0.5.2 'application/model'
* @package Katharsis );
*/
class Katharsis_Autoload public static function init()
{ {
/** spl_autoload_register('Katharsis_Autoload::autoload');
* @var array }
*/
protected static $_classLocations = array( public static function autoload($classname)
'library', {
'application/controller', if($location = self::findClass($classname))
'application/model' {
); require_once $location;
return;
/** }
* Registering autoload method
* throw new exception('Autoload: could not load class "' . $classname . '"');
* @return void }
*/
public static function init() public static function findClass($classname)
{ {
spl_autoload_register('Katharsis_Autoload::autoload'); $name = str_replace("_", DIRECTORY_SEPARATOR, $classname);
}
foreach(self::$_classLocations as $location)
/** {
* Actual autoload method. Loads class files automatically when they are needed if(file_exists($location . DIRECTORY_SEPARATOR . $name . ".php"))
* {
* @return void return $location . DIRECTORY_SEPARATOR . $name . ".php";
*/ }
public static function autoload($classname) }
{ return false;
$name = str_replace("_", DIRECTORY_SEPARATOR, $classname); }
}
foreach(self::$_classLocations as $location) ?>
{
if(file_exists($location . DIRECTORY_SEPARATOR . $name . ".php"))
{
require_once $location . DIRECTORY_SEPARATOR . $name . ".php";
return;
}
}
die('Autoload: could not load class "' . $classname . '"');
}
}

View file

@ -1,29 +1,23 @@
<?php require_once('library/Katharsis/Autoload.php'); <?php
/** require_once('library/Katharsis/Autoload.php');
* Bootstrap Class
* Central application routing entity class Katharsis_Bootstrap
* {
* @author Karl Pannek <info@katharsis.in> public static function init()
* @version 0.5.2 {
* @package Katharsis $router = Katharsis_ControllerRouting::getInstance();
*/ $router->init();
class Katharsis_Bootstrap }
{
/** public static function run()
* Central application routing method {
* $router = Katharsis_ControllerRouting::getInstance();
* @return void
*/ Katharsis_Controller_Plugin::preControllerHook();
public static function run()
{ $router->route();
$router = Katharsis_ControllerRouting::getInstance();
Katharsis_Controller_Plugin::postControllerHook();
$router->init(); }
}
Katharsis_Controller_Plugin::preControllerHook(); ?>
$router->route();
Katharsis_Controller_Plugin::postControllerHook();
}
}

View file

@ -1,105 +1,57 @@
<?php <?php
/** abstract class Katharsis_Controller_Abstract
* Abstract Controller {
* All controllers must extend this class. protected $_con;
* protected $_view;
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2 public final function __construct()
* @package Katharsis {
*/ $this->_con = Katharsis_DatabaseConnector::getConnection();
abstract class Katharsis_Controller_Abstract $this->_view = Katharsis_View::getInstance();
{ $this->init();
/** }
* @var Katharsis_Db5
*/ public function init()
protected $_con; {
}
/**
* @var Katharsis_View public function __call($action, $params)
*/ {
protected $_view; throw new Katharsis_Exception('Die von Ihnen angeforderte Seite (Action) "' . substr($action, 0, -6) . '" konnte nicht gefunden werden.');
}
/**
* Instances class attributes, calles init method protected function _getParam($key)
* {
* @return void $params = Katharsis_Request::getParams();
*/ if(array_key_exists($key,$params))
public final function __construct() {
{ return $params[$key];
$this->_con = Katharsis_DatabaseConnector::getConnection(); }
$this->_view = Katharsis_View::getInstance(); return null;
$this->init(); }
}
protected function _getAllParams()
/** {
* Overwrite this method instead of using a constructor return Katharsis_Request::getParams();
* }
* @return void
*/ protected function _location($action, $controller = null, $getParams = null)
public function init() {
{ if($controller === null)
} {
$controller = Katharsis_Request::getControllerName();
/** }
* If subclass hasn't got a __call method, this exception will be thrown
* $paramstring = "";
* @return void if($getParams !== null)
*/ {
public function __call($action, $params) foreach($getParams as $key => $value)
{ {
throw new Katharsis_Exception('Action "' . $action . '" doesn\'t exist.'); $paramstring .= "/" . (string) $key . "/" . (string) $value;
} }
}
/**
* Returns a specific request parameter header("location: " . $this->_view->base . "/" . $controller . "/" . $action . $paramstring);
* }
* @param string $key }
* @return mixed ?>
*/
protected function _getParam($key)
{
$params = Katharsis_Request::getParams();
if(array_key_exists($key,$params))
{
return $params[$key];
}
return null;
}
/**
* Returns all request parameters
*
* @return array
*/
protected function _getAllParams()
{
return Katharsis_Request::getParams();
}
/**
* Forward to an other action
*
* @param string $action
* @param string $controller
* @param array $getParams
* @return void
*/
protected function _location($action, $controller = null, $getParams = null)
{
if($controller === null)
{
$controller = Katharsis_Request::getControllerName();
}
$paramstring = "";
if($getParams !== null)
{
foreach($getParams as $key => $value)
{
$paramstring .= "/" . (string) $key . "/" . (string) $value;
}
}
header("location: " . $this->_view->base . "/" . $controller . "/" . $action . $paramstring);
}
}

View file

@ -1,53 +1,27 @@
<?php <?php
/** class Katharsis_Controller_Plugin
* Central Plugin Class {
* protected static $_plugins;
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2 public static function registerPlugin($object)
* @package Katharsis {
*/ self::$_plugins[] = $object;
class Katharsis_Controller_Plugin }
{
/** public static function preControllerHook()
* @var array {
*/ foreach(self::$_plugins as $plugin)
protected static $_plugins; {
$plugin->preController();
/** }
* Register all plugins with this method }
* Plugins will be called in the same order as they have been registered
* public static function postControllerHook()
* @param object $object - an instance of your plugin {
* @return void foreach(self::$_plugins as $plugin)
*/ {
public static function registerPlugin($object) $plugin->postController();
{ }
self::$_plugins[] = $object; }
} }
?>
/**
* Processes preController methods of all plugins
*
* @return void
*/
public static function preControllerHook()
{
foreach(self::$_plugins as $plugin)
{
$plugin->preController();
}
}
/**
* Processes postController methods of all plugins
*
* @return void
*/
public static function postControllerHook()
{
foreach(self::$_plugins as $plugin)
{
$plugin->postController();
}
}
}

View file

@ -1,31 +1,19 @@
<?php <?php
/** abstract class Katharsis_Controller_Plugin_Abstract
* Abstract Controller Plugin {
* All controller plugins must extend this class. protected $_con;
*
* @author Karl Pannek <info@katharsis.in> public function __construct()
* @version 0.5.2 {
* @package Katharsis $this->_con = Katharsis_DatabaseConnector::getConnection();
*/ }
abstract class Katharsis_Controller_Plugin_Abstract
{ public function preController()
/** {
* Overwrite this method, if you want something to be processed }
* _before_ the controller is called
* public function postController()
* @return void {
*/ }
public function preController() }
{ ?>
}
/**
* Overwrite this method, if you want something to be processed
* _after_ the controller was called
*
* @return void
*/
public function postController()
{
}
}

View file

@ -0,0 +1,21 @@
<?php
class Katharsis_Controller_Plugin_AutoScriptControl extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$view->autoScriptFile = false;
$scriptName = ucfirst(Katharsis_Request::getControllerName()) . '/' . strtolower(Katharsis_Request::getActionName());
$autoScriptFile = 'scripts/DidgeridooArtwork/' . $scriptName . '.js';
$sl = DIRECTORY_SEPARATOR;
if(file_exists(getcwd() . $sl . str_replace('/', $sl, $autoScriptFile)))
{
$view->autoScriptFile = $view->base . '/' . $autoScriptFile;
}
}
}

View file

@ -1,32 +1,19 @@
<?php <?php
/**
* Autorender Controller Plugin
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
{ {
/**
* Renders a controller/action.phtml template automaticly after processing controller
*
* @return void
*/
public function postController() public function postController()
{ {
$view = Katharsis_View::getInstance(); $view = Katharsis_View::getInstance();
$view->stageContent = false;
$view->controllerAction = false; $templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
$templateName = strtolower(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName()); if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
if(file_exists('application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
{ {
$view->controllerAction = $templateName; $view->stageContent = $view->render($templateName);
} }
$view = Katharsis_View::getInstance();
echo $view->render('main'); echo $view->render('main');
} }
} }

View file

@ -0,0 +1,10 @@
<?php
class Katharsis_Controller_Plugin_StartSession extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
session_write_close();
session_start();
}
}
?>

View file

@ -1,136 +1,102 @@
<?php <?php
/** class Katharsis_ControllerRouting
* Controller Router {
* Specific routing entity protected static $_instance = null;
*
* @author Karl Pannek <info@katharsis.in> public static function getInstance()
* @version 0.5.2 {
* @package Katharsis if(self::$_instance === null)
*/ {
class Katharsis_ControllerRouting self::$_instance = new self();
{ }
/** return self::$_instance;
* @var Katharsis_ControllerRouting }
*/
protected static $_instance = null; protected function __construct()
{
/** Katharsis_Request::setControllerName('index');
* Singleton. Returns the same instance every time Katharsis_Request::setActionName('index');
* }
* @return Katharsis_ControllerRouting
*/ public function init()
public static function getInstance() {
{ $paramstring = "";
if(self::$_instance === null) $baseUrl = preg_replace('#(.*/)[^/]+#', '\1', $_SERVER['SCRIPT_NAME']);
{
self::$_instance = new self(); if(preg_match("~/([^/\?]+)/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
} {
return self::$_instance; $controller = $matches[1];
} $action = $matches[2];
$paramstring = $matches[3];
/** $params = $this->_buildParams($paramstring);
* Sets default controller and action names
* Katharsis_Request::setControllerName($controller);
* @return void Katharsis_Request::setActionName($action);
*/ }
protected function __construct() else if(preg_match("~/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
{ {
Katharsis_Request::setControllerName('index'); $controller = $matches[1];
Katharsis_Request::setActionName('index'); $paramstring = $matches[2];
} $params = $this->_buildParams($paramstring);
/** Katharsis_Request::setControllerName($controller);
* Initiates routing process }
* else
* @return void {
*/ if(array_key_exists('controller', $_GET))
public function init() {
{ $controller = $_GET['controller'];
$paramstring = ""; Katharsis_Request::setControllerName($controller);
$baseUrl = preg_replace('#(.*/)[^/]+#', '\1', $_SERVER['SCRIPT_NAME']); }
if(preg_match("~.*" . $baseUrl . "([^/\?]+)/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches)) if(array_key_exists('action', $_GET))
{ {
$controller = $matches[1]; $action = $_GET['action'];
$action = $matches[2]; Katharsis_Request::setActionName($action);
$paramstring = $matches[3]; }
$params = $this->_buildParams($paramstring);
$params = $_GET;
Katharsis_Request::setControllerName($controller); }
Katharsis_Request::setActionName($action);
} else if(preg_match("~.*" . $baseUrl . "([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches)) Katharsis_Request::setParams($params);
{
$controller = $matches[1]; Katharsis_View::getInstance()->requestHook();
$paramstring = $matches[2]; }
$params = $this->_buildParams($paramstring);
public function route()
Katharsis_Request::setControllerName($controller); {
} else $controllerName = ucfirst(Katharsis_Request::getControllerName()) . 'Controller';
{ $action = Katharsis_Request::getActionName() . 'Action';
if(array_key_exists('controller', $_GET))
{ if(class_exists($controllerName))
$controller = $_GET['controller']; {
Katharsis_Request::setControllerName($controller); $controllerObject = new $controllerName();
}
$controllerObject->$action();
if(array_key_exists('action', $_GET)) }
{
$action = $_GET['action']; }
Katharsis_Request::setActionName($action);
} protected function _buildParams($string)
{
$params = $_GET; $params = array();
} if(trim($string) !== '')
{
Katharsis_Request::setParams($params); $urlparams = explode("/", $string);
Katharsis_View::getInstance()->requestHook(); for($i = 0; $i < count($urlparams); $i=$i+2)
} {
if(array_key_exists($i+1, $urlparams))
{
/** $params[$urlparams[$i]] = $urlparams[$i+1];
* Routing processing method } else
* {
* @return void $params[$urlparams[$i]] = null;
*/ }
public function route() }
{ }
$controllerName = ucfirst(Katharsis_Request::getControllerName()) . 'Controller';
$action = Katharsis_Request::getActionName() . 'Action'; return $params;
}
if(class_exists($controllerName)) }
{ ?>
$controllerObject = new $controllerName();
$controllerObject->$action();
}
}
/**
* Splits parameters to an array and returns them
*
* @return array
*/
protected function _buildParams($string)
{
$params = array();
if(trim($string) !== '')
{
$urlparams = explode("/", $string);
for($i = 0; $i < count($urlparams); $i=$i+2)
{
if(array_key_exists($i+1, $urlparams))
{
$params[$urlparams[$i]] = $urlparams[$i+1];
} else
{
$params[$urlparams[$i]] = null;
}
}
}
return $params;
}
}

View file

@ -1,130 +1,92 @@
<?php <?php
/** class Katharsis_DatabaseConnector
* Database Connector {
* controls database connections public static $_conns = array();
*
* @author Karl Pannek <info@katharsis.in> protected static function connect($requestedName = null)
* @version 0.5.2 {
* @package Katharsis $ini = parse_ini_file('config/database.config.ini', true);
*/ if($ini !== array())
class Katharsis_DatabaseConnector {
{ $conInformation = self::_selectConnection($ini, $requestedName);
/** return self::_realConnect($conInformation);
* @var array } else
*/ {
public static $_conns = array(); return null;
}
/** }
* Reading ini file information and connecting
* public static function connectAll($requestedName = null)
* @param string $requestedName {
* @return Katharsis_Db5 $groups = parse_ini_file('config/database.config.ini', true);
*/
protected static function connect($requestedName = null) foreach($groups as $iniName => $conInformation)
{ {
$ini = parse_ini_file('config/database.config.ini', true); if(preg_match("~^connection:([^:]+)~", $iniName, $matches))
if($ini !== array()) {
{ self::getConnection($matches[1]);
$conInformation = self::_selectConnection($ini, $requestedName); }
return self::_realConnect($conInformation); }
} else }
{
return null; protected static function _realConnect($conInformation)
} {
} //$con = new PDO('mysql:host=' . $conInformation['host'] . ';dbname=' . $conInformation['database'], $conInformation['user'], $conInformation['password']);
/**
* Connects to all connections in config file $con = new Katharsis_Db5($conInformation['host'], $conInformation['user'], $conInformation['password'], $conInformation['database']);
*
* @param string $requestedName self::$_conns[$conInformation['name']]['connection'] = $con;
* @return void self::$_conns[$conInformation['name']]['info'] = $conInformation;
*/
public static function connectAll() return $con;
{ }
$groups = parse_ini_file('config/database.config.ini', true);
public static function getConnection($requestedName = null)
foreach($groups as $iniName => $conInformation) {
{ if($requestedName === null)
if(preg_match("~^connection:([^:]+)~", $iniName, $matches)) {
{ foreach(self::$_conns as $con)
self::getConnection($matches[1]); {
} if($con['info']['default'] === true)
} {
} return $con['connection'];
}
/** }
* Calling Katharsis Db connecting method return self::connect(null);
* } else
* @param string $requestedName {
* @return Katharsis_Db5 if(in_array($requestedName, array_keys(self::$_conns)))
*/ {
protected static function _realConnect($conInformation) return self::$_conns[$requestedName]['connection'];
{ }
$con = new Katharsis_Db5($conInformation['host'], $conInformation['user'], $conInformation['password'], $conInformation['database']); return self::connect($requestedName);
}
self::$_conns[$conInformation['name']]['connection'] = $con; }
self::$_conns[$conInformation['name']]['info'] = $conInformation;
protected static function _selectConnection($ini, $requestedName = null)
return $con; {
} foreach($ini as $name => $connectionInfo)
{
/** if($requestedName === null)
* Returns specified or default connection {
* if(preg_match("~^connection:([^:]+):default~", $name, $matches))
* @param string $requestedName {
* @return Katharsis_Db5 $connectionInfo['name'] = $matches[1];
*/ $connectionInfo['default'] = true;
public static function getConnection($requestedName = null) return $connectionInfo;
{ }
if($requestedName === null) } else
{ {
foreach(self::$_conns as $con) if(preg_match("~^connection:" . $requestedName . ".*~", $name))
{ {
if($con['info']['default'] === true) $connectionInfo['default'] = false;
{ $connectionInfo['name'] = $requestedName;
return $con['connection']; return $connectionInfo;
} }
} }
return self::connect(null); }
} else throw new Katharsis_Exception('Could not find database connection information for "' . $requestedName . '"');
{ }
if(in_array($requestedName, array_keys(self::$_conns))) }
{ ?>
return self::$_conns[$requestedName]['connection'];
}
return self::connect($requestedName);
}
}
/**
* Returns an array of connection information
*
* @param array $ini
* @param string $requestedName
* @return array
*/
protected static function _selectConnection($ini, $requestedName = null)
{
foreach($ini as $name => $connectionInfo)
{
if($requestedName === null)
{
if(preg_match("~^connection:([^:]+):default~", $name, $matches))
{
$connectionInfo['name'] = $matches[1];
$connectionInfo['default'] = true;
return $connectionInfo;
}
} else
{
if(preg_match("~^connection:" . $requestedName . ".*~", $name))
{
$connectionInfo['default'] = false;
$connectionInfo['name'] = $requestedName;
return $connectionInfo;
}
}
}
throw new Katharsis_Exception('Could not find database connection information for "' . $requestedName . '"');
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,4 @@
<?php <?php
/** class Katharsis_Exception extends Exception
* Katharsis Exception {
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Katharsis_Exception extends Exception
{
} }

View file

@ -1,36 +1,16 @@
<?php <?php
/** abstract class Katharsis_Model_Abstract
* Abstract Model {
* All models must extend this class. protected $_con;
*
* @author Karl Pannek <info@katharsis.in> public final function __construct()
* @version 0.5.2 {
* @package Katharsis $this->_con = Katharsis_DatabaseConnector::getConnection();
*/ $this->init();
abstract class Katharsis_Model_Abstract }
{
/** public function init()
* @var Katharsis_Db5 {
*/ }
protected $_con; }
?>
/**
* Instances class attributes, calles init method
*
* @return void
*/
public final function __construct()
{
$this->_con = Katharsis_DatabaseConnector::getConnection();
$this->init();
}
/**
* Overwrite this method instead of using a constructor
*
* @return void
*/
public function init()
{
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Katharsis Registry
* Global data pool
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Katharsis_Registry
{
/**
* @var Katharsis_Registry
*/
protected static $_instance = null;
/**
* @var array
*/
protected $_params = array();
/**
* Singleton. Returns the same instance every time
*
* @return Katharsis_Registry
*/
public static function getInstance()
{
if(self::$_instance === null)
{
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Magical get method, gets specific param
*
* @param string $name
* @return string
*/
public function __get($name)
{
if(array_key_exists($name, $this->_params))
{
return $this->_params[$name];
}
return null;
}
/**
* Magical set method, sets specific param
*
* @param string name
* @param string value
*/
public function __set($name, $value)
{
$this->_params[$name] = $value;
}
public function getAll()
{
return $this->_params;
}
}

View file

@ -1,93 +1,44 @@
<?php <?php
/** class Katharsis_Request
* Katharsis Request {
* Represents a http call protected static $_controller = null;
* protected static $_action = null;
* @author Karl Pannek <info@katharsis.in> protected static $_params = array();
* @version 0.5.2
* @package Katharsis public static function setControllerName($name)
*/ {
class Katharsis_Request self::$_controller = $name;
{ }
/**
* @var string public static function setActionName($name)
*/ {
protected static $_controller; self::$_action = $name;
}
/**
* @var string public static function setParams($params)
*/ {
protected static $_action; foreach($_POST as $key => $value)
{
/** $params[$key] = $value;
* @var array }
*/ self::$_params = $params;
protected static $_params = array();
}
/**
* Set name of controller public static function getControllerName()
* {
* @param string $name return self::$_controller;
* @return void }
*/
public static function setControllerName($name) public static function getActionName()
{ {
self::$_controller = $name; return self::$_action;
} }
/**
* Set name of action public static function getParams()
* {
* @param string $name return self::$_params;
* @return void }
*/ }
public static function setActionName($name) ?>
{
self::$_action = $name;
}
/**
* Set parameters
*
* @param array $params
* @return void
*/
public static function setParams($params)
{
foreach($_POST as $key => $value)
{
$params[$key] = $value;
}
self::$_params = $params;
}
/**
* Get controller name
*
* @return string
*/
public static function getControllerName()
{
return self::$_controller;
}
/**
* Get action name
*
* @return string
*/
public static function getActionName()
{
return self::$_action;
}
/**
* Get parameter array
*
* @return array
*/
public static function getParams()
{
return self::$_params;
}
}

View file

@ -1,29 +1,9 @@
<?php <?php
/**
* Katharsis View
* Controls anything related to the display level
*
* @author Karl Pannek <info@katharsis.in>
* @version 0.5.2
* @package Katharsis
*/
class Katharsis_View class Katharsis_View
{ {
/**
* @var Katharsis_View
*/
protected static $_instance = null; protected static $_instance = null;
protected $_items = array();
/**
* @var array
*/
protected $_params = array();
/**
* Singleton. Returns the same instance every time
*
* @return Katharsis_View
*/
public static function getInstance() public static function getInstance()
{ {
if(self::$_instance === null) if(self::$_instance === null)
@ -33,49 +13,30 @@ class Katharsis_View
return self::$_instance; return self::$_instance;
} }
/**
* Sets base application path
*
* @return void
*/
protected function __construct() protected function __construct()
{ {
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']); $base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
$this->_params['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : ''; $this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
} }
/**
* Magical get method, gets specific param
*
* @param string $name
* @return string
*/
public function __get($name) public function __get($name)
{ {
if(array_key_exists($name, $this->_params)) if(array_key_exists($name, $this->_items))
{ {
return $this->_params[$name]; if(is_array($this->_items[$name]))
{
return (array) $this->_items[$name];
}
return $this->_items[$name];
} }
return null; return null;
} }
/**
* Magical set method, sets specific param
*
* @param string name
* @param string value
*/
public function __set($name, $value) public function __set($name, $value)
{ {
$this->_params[$name] = $value; $this->_items[$name] = $value;
} }
/**
* Template rendering method
*
* @param string $template
* @return string
*/
public function render($template) public function render($template)
{ {
ob_start(); ob_start();
@ -89,13 +50,23 @@ class Katharsis_View
return $output; return $output;
} }
/**
* Sets Request params into View params
*
* @return void
*/
public function requestHook() public function requestHook()
{ {
$this->_params['params'] = Katharsis_Request::getParams();
} }
}
public function _getParam($key)
{
$params = Katharsis_Request::getParams();
if(array_key_exists($key,$params))
{
return $params[$key];
}
return null;
}
public function formatDate($date)
{
$date = explode("-", $date);
return $date[2] . '.' . $date[1] . '.' . $date[0];
}
}

View file

@ -0,0 +1,12 @@
<?php
class Local_Controller_Plugin_IndexRedirect extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
if(Katharsis_Request::getControllerName() == 'index' && Katharsis_Request::getActionName() == 'index')
{
Katharsis_Request::setControllerName('page');
Katharsis_Request::setActionName('home');
}
}
}

View file

@ -0,0 +1,28 @@
<?php
class Local_Controller_Plugin_PageRewrite extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$controller = Katharsis_Request::getControllerName();
if($controller === 'page') {
return;
}
if(substr($controller, 0, 5) === 'admin') {
return;
}
$defaultSites = array();
if(isset(Katharsis_Registry::getInstance()->defaults['sites'])){
$defaultSites = explode(", ", Katharsis_Registry::getInstance()->defaults['sites']);
}
if(in_array($controller, $defaultSites)) {
return;
}
Katharsis_Request::setControllerName('page');
Katharsis_Request::setActionName($controller);
}
}

4750
library/Verot/Upload.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,7 @@
RewriteEngine On RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} -d

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
public/img/header/1374241138.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
public/img/leafs/addSub.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
public/img/leafs/arrow_down.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

BIN
public/img/leafs/arrow_up.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

BIN
public/img/leafs/change.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
public/img/leafs/delete.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

BIN
public/img/leafs/preview.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

BIN
public/img/logo-old.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Some files were not shown because too many files have changed in this diff Show more