Compare commits
156 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3304186ee6 | ||
![]() |
ef051b8c1b | ||
![]() |
786ab7ec7d | ||
![]() |
3215e6e7e1 | ||
![]() |
e7b8dbd83f | ||
5dc738e18e | |||
4265af9338 | |||
![]() |
b9e04c6ca3 | ||
![]() |
1462348fdf | ||
![]() |
241c4863ec | ||
![]() |
d02ad40d6a | ||
![]() |
50aecb6ca2 | ||
![]() |
82f3f83219 | ||
![]() |
ce4538f32a | ||
![]() |
54bc9ffa8c | ||
![]() |
1f1bf6b3f1 | ||
![]() |
ed20df5824 | ||
![]() |
ecbba5fcf5 | ||
![]() |
3dffc7527d | ||
![]() |
09f73677d8 | ||
![]() |
5226cb4c3b | ||
![]() |
a85745747e | ||
![]() |
0632d1bf0b | ||
![]() |
ac1245212c | ||
![]() |
af8fa420b7 | ||
![]() |
8fcbee314d | ||
![]() |
cae1da96bb | ||
![]() |
5d58f16e0f | ||
![]() |
b80a0107e6 | ||
![]() |
1c23b43d68 | ||
![]() |
b37241db2b | ||
![]() |
e1609f1569 | ||
![]() |
a760333fba | ||
![]() |
77cdbfb0b6 | ||
![]() |
a27cfee2b2 | ||
![]() |
a6636bb85f | ||
![]() |
23bc2d6ecb | ||
![]() |
3e61eb7c9d | ||
![]() |
0f847d3cbf | ||
![]() |
eb150732fb | ||
![]() |
1189487d4b | ||
![]() |
e075de1fd0 | ||
![]() |
635f120d91 | ||
![]() |
e429d9749e | ||
![]() |
e6317a6326 | ||
![]() |
8e882b0894 | ||
![]() |
6b689ae915 | ||
![]() |
816dc9743b | ||
![]() |
88757bdb80 | ||
![]() |
05031143a1 | ||
![]() |
d4d00b1fba | ||
![]() |
8c294888e7 | ||
![]() |
8b4b0f8837 | ||
![]() |
85a6f9ae1c | ||
![]() |
a7bb1783c0 | ||
![]() |
e90422c213 | ||
![]() |
9da731ebb3 | ||
![]() |
61d106a874 | ||
![]() |
73a56807a3 | ||
![]() |
ca8863c170 | ||
![]() |
f9ceb6561d | ||
![]() |
31f4141c00 | ||
![]() |
53b64188d8 | ||
![]() |
68cf5561a0 | ||
![]() |
bd0132c4b4 | ||
![]() |
a4aaa23422 | ||
![]() |
8e5818860b | ||
![]() |
eecc2bca5f | ||
![]() |
74a885cf8c | ||
![]() |
eba4f386df | ||
![]() |
8b2fc1553f | ||
![]() |
9a8f65d33f | ||
![]() |
62699ab89c | ||
![]() |
d6861acfbd | ||
![]() |
aebeeb0478 | ||
![]() |
eee546a1c1 | ||
![]() |
850a925ae4 | ||
![]() |
b46d2550ec | ||
![]() |
9e50b44730 | ||
![]() |
df99821c17 | ||
![]() |
549cae8161 | ||
![]() |
c83c93ef07 | ||
![]() |
d350e231b2 | ||
![]() |
65b7662d70 | ||
![]() |
12953ec13d | ||
![]() |
9730d84d5c | ||
![]() |
927f7dcca2 | ||
![]() |
a78b3891e8 | ||
![]() |
1a35247fb7 | ||
![]() |
3c4f4e43f6 | ||
![]() |
b7b0f44098 | ||
![]() |
4c700f657d | ||
![]() |
e170aa2c3c | ||
![]() |
05fbd9e76a | ||
![]() |
e4c4eac4d6 | ||
![]() |
775a1a7a71 | ||
![]() |
f7f2163df5 | ||
![]() |
e43fde0d7d | ||
![]() |
85598a0d85 | ||
![]() |
598081b2a8 | ||
![]() |
f95b70d17e | ||
![]() |
1177167a65 | ||
![]() |
43152b3b68 | ||
![]() |
5b173f381c | ||
![]() |
febd8f0883 | ||
![]() |
91aa15d253 | ||
![]() |
f96b0d64dc | ||
![]() |
569592e239 | ||
![]() |
3fbbc59450 | ||
![]() |
193bfd2247 | ||
![]() |
fcad3b07f1 | ||
![]() |
4bb0f353a2 | ||
![]() |
79a0690fad | ||
![]() |
68feb66d08 | ||
![]() |
6f143cc21f | ||
![]() |
4c21bbcefd | ||
![]() |
1a3664b517 | ||
![]() |
dc0b3a3f16 | ||
![]() |
35717248ca | ||
![]() |
979594a35c | ||
![]() |
8d5a30b335 | ||
![]() |
f6572151ec | ||
![]() |
e378498bf3 | ||
![]() |
42a1a40f4a | ||
![]() |
1fe7cf3a6e | ||
![]() |
85049635de | ||
![]() |
0c80e23e72 | ||
![]() |
1142ae8171 | ||
![]() |
bffe0f1660 | ||
![]() |
2156d3f5c6 | ||
![]() |
b47299adca | ||
![]() |
1979f850f9 | ||
![]() |
9119550d1c | ||
![]() |
7ac0191a1a | ||
![]() |
178be87cb6 | ||
![]() |
6ffd67045c | ||
![]() |
b1d5d8f111 | ||
![]() |
eabbab94e9 | ||
![]() |
8a383aa084 | ||
![]() |
0941892470 | ||
![]() |
e65e31cbd2 | ||
![]() |
ae3997ba87 | ||
![]() |
05de07abcd | ||
![]() |
5f62111446 | ||
![]() |
336296b319 | ||
![]() |
f2f0167277 | ||
![]() |
9424563c79 | ||
![]() |
57c0436f14 | ||
![]() |
1d4b2a3314 | ||
![]() |
a6873ee6c8 | ||
![]() |
9bb724147e | ||
![]() |
be916018ba | ||
![]() |
91dfff568e | ||
![]() |
3c63bf20c1 | ||
![]() |
dd7eb43364 | ||
![]() |
64d572dd2d |
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
config/admin.ini
|
||||||
|
config/database.config.ini
|
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "public/lib/codemirror"]
|
||||||
|
path = public/lib/codemirror
|
||||||
|
url = git@github.com:marijnh/CodeMirror.git
|
|
@ -8,15 +8,15 @@ Katharsis Framework is written in native, object-orientated PHP5 code only. It k
|
||||||
|
|
||||||
h1. List of Features
|
h1. List of Features
|
||||||
|
|
||||||
# lightweight and fast processing
|
* lightweight and fast processing
|
||||||
# facilitates project maintenance by keeping your code clean
|
* facilitates project maintenance by keeping your code clean
|
||||||
# preserves a tidy project structure
|
* preserves a tidy project structure
|
||||||
# provides great extensibility
|
* provides great extensibility
|
||||||
# easy-to-use plugin interface
|
* easy-to-use plugin interface
|
||||||
# supports "pretty URLs"
|
* supports "pretty URLs"
|
||||||
# entirely object orientated
|
* entirely object orientated
|
||||||
|
|
||||||
h1. Requirements
|
h1. Requirements
|
||||||
|
|
||||||
# PHP enabled web server
|
* PHP enabled web server
|
||||||
# PHP v. 5.0 or greater
|
* PHP v. 5.0 or greater
|
45
application/controller/AdminController.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
53
application/controller/AdminNavigationController.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
96
application/controller/AdminPageController.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
5
application/controller/AdminUploadController.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
class AdminUploadController extends Katharsis_Controller_Abstract
|
||||||
|
{
|
||||||
|
// check adminPageController and Upload model
|
||||||
|
}
|
|
@ -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');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
40
application/controller/PageController.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
16
application/model/Access.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
297
application/model/Navigation.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
86
application/model/Page.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
55
application/model/Upload.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
11
application/view/Admin/gate.phtml
Normal 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>
|
5
application/view/Admin/index.phtml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<div id="admin">
|
||||||
|
<p>
|
||||||
|
Willkommen im Admin Bereich.
|
||||||
|
</p>
|
||||||
|
</div>
|
59
application/view/AdminNavigation/edit.phtml
Normal 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>
|
111
application/view/AdminNavigation/index.phtml
Normal 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>
|
||||||
|
|
||||||
|
</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>
|
70
application/view/AdminPage/edit.phtml
Normal 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 für 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>
|
40
application/view/AdminPage/image.phtml
Normal 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ä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ügen</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="?delete=<?php echo $file ?>" onclick="return confirm('Wirklich löschen?')">Löschen</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
57
application/view/AdminPage/index.phtml
Normal 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">
|
||||||
|
|
||||||
|
</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>
|
12
application/view/AdminPage/uploadsuccess.phtml
Normal 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>
|
34
application/view/AdminUpload/double.phtml
Normal 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>
|
34
application/view/AdminUpload/product.phtml
Normal 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>
|
17
application/view/AdminUpload/simple.phtml
Normal 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>
|
4
application/view/Error/index.phtml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<h3>Fehler</h3>
|
||||||
|
<p>
|
||||||
|
<?php echo $this->message ?>
|
||||||
|
</p>
|
12
application/view/Page/index.phtml
Normal 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>
|
13
application/view/Page/post.phtml
Normal 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>
|
86
application/view/main.phtml
Normal 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>
|
|
@ -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
1
config/admin.ini.example
Normal file
|
@ -0,0 +1 @@
|
||||||
|
password = test
|
|
@ -1,5 +0,0 @@
|
||||||
; [connection:development:default]
|
|
||||||
; host = localhost
|
|
||||||
; user = root
|
|
||||||
; password =
|
|
||||||
; database = myDatabaseName
|
|
5
config/database.config.ini.example
Normal 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
|
@ -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", "/");
|
4
config/defaults.config.ini
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
title = Seinheit.
|
||||||
|
subtitle = Praxis für Traditionelle Europäische Medizin
|
||||||
|
email = info@seinheit.ch
|
||||||
|
#sites = news, blog
|
17
library/DidgeridooArtwork/Controller/Plugin/Access.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
library/DidgeridooArtwork/Controller/Plugin/Defaults.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
44
library/DidgeridooArtwork/Controller/Plugin/Navigation.php
Normal 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);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
9
library/DidgeridooArtwork/Controller/Plugin/Notice.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
11
library/DidgeridooArtwork/Controller/Plugin/SetNames.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
16
library/DidgeridooArtwork/Exception.php
Normal 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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
23
library/DidgeridooArtwork/Notice.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
25
library/DidgeridooArtwork/Page/Plugin.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
19
library/DidgeridooArtwork/Page/Plugin/Abstract.php
Normal 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);
|
||||||
|
}
|
8
library/DidgeridooArtwork/Page/Plugin/Base.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
8
library/DidgeridooArtwork/Page/Plugin/Image.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
8
library/DidgeridooArtwork/Page/Plugin/Mail.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
11
library/DidgeridooArtwork/Page/Plugin/MiniEventList.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
10
library/DidgeridooArtwork/Page/Plugin/MiniNewsList.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
8
library/DidgeridooArtwork/Page/Plugin/Newsletter.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
8
library/DidgeridooArtwork/Page/Plugin/Page.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
11
library/DidgeridooArtwork/Page/Plugin/ShopVorschau.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 . '"');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
21
library/Katharsis/Controller/Plugin/AutoScriptControl.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
library/Katharsis/Controller/Plugin/StartSession.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
class Katharsis_Controller_Plugin_StartSession extends Katharsis_Controller_Plugin_Abstract
|
||||||
|
{
|
||||||
|
public function preController()
|
||||||
|
{
|
||||||
|
session_write_close();
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 . '"');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
{
|
|
||||||
}
|
}
|
|
@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
66
library/Katharsis/Registry.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
library/Local/Controller/Plugin/IndexRedirect.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
library/Local/Controller/Plugin/PageRewrite.php
Normal 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
|
@ -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
|
||||||
|
|
BIN
public/file/Diplomarbeit-Kinga-Pannek-2012.pdf
Normal file
BIN
public/file/Patientenfragebogen.pdf
Normal file
BIN
public/img/facebook-icon.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
public/img/header/1374074370.jpg
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
public/img/header/1374140846.jpg
Normal file
After Width: | Height: | Size: 283 KiB |
BIN
public/img/header/1374149063.jpg
Normal file
After Width: | Height: | Size: 218 KiB |
BIN
public/img/header/1374149247.jpg
Normal file
After Width: | Height: | Size: 318 KiB |
BIN
public/img/header/1374156504.jpg
Normal file
After Width: | Height: | Size: 246 KiB |
BIN
public/img/header/1374229998.jpg
Normal file
After Width: | Height: | Size: 230 KiB |
BIN
public/img/header/1374237882.jpg
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
public/img/header/1374240086.jpg
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
public/img/header/1374241138.jpg
Executable file
After Width: | Height: | Size: 40 KiB |
BIN
public/img/header/AR8R8476.JPG
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
public/img/leafs/addSub.png
Executable file
After Width: | Height: | Size: 174 B |
BIN
public/img/leafs/arrow_down.png
Executable file
After Width: | Height: | Size: 162 B |
BIN
public/img/leafs/arrow_up.png
Executable file
After Width: | Height: | Size: 163 B |
BIN
public/img/leafs/change.png
Executable file
After Width: | Height: | Size: 193 B |
BIN
public/img/leafs/delete.png
Executable file
After Width: | Height: | Size: 195 B |
BIN
public/img/leafs/preview.png
Executable file
After Width: | Height: | Size: 182 B |
BIN
public/img/logo-old.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/img/logo.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
public/img/page/1374073671.jpg
Normal file
After Width: | Height: | Size: 383 KiB |
BIN
public/img/page/1374149150.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/img/page/1374149151.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/img/page/1374149159.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/img/page/1374156604.jpg
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
public/img/page/1374156883.jpg
Normal file
After Width: | Height: | Size: 68 KiB |