Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
![]() |
baea40db5f |
3
.gitignore
vendored
|
@ -1,3 +0,0 @@
|
|||
.DS_Store
|
||||
config/admin.ini
|
||||
config/database.config.ini
|
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
|||
[submodule "public/lib/codemirror"]
|
||||
path = public/lib/codemirror
|
||||
url = git@github.com:marijnh/CodeMirror.git
|
|
@ -1,45 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
class AdminUploadController extends Katharsis_Controller_Abstract
|
||||
{
|
||||
// check adminPageController and Upload model
|
||||
}
|
|
@ -27,7 +27,8 @@ class IndexController extends Katharsis_Controller_Abstract
|
|||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
// will be overwritten by IndexRedirect Plugin
|
||||
$this->_view->someVariableName = 'Katharsis';
|
||||
echo $this->_view->render('welcome');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
23
application/model/Example.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?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()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,55 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<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>
|
|
@ -1,5 +0,0 @@
|
|||
<div id="admin">
|
||||
<p>
|
||||
Willkommen im Admin Bereich.
|
||||
</p>
|
||||
</div>
|
|
@ -1,59 +0,0 @@
|
|||
<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>
|
|
@ -1,111 +0,0 @@
|
|||
<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>
|
|
@ -1,70 +0,0 @@
|
|||
<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>
|
|
@ -1,40 +0,0 @@
|
|||
<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>
|
|
@ -1,57 +0,0 @@
|
|||
<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>
|
|
@ -1,12 +0,0 @@
|
|||
<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>
|
|
@ -1,34 +0,0 @@
|
|||
<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>
|
|
@ -1,34 +0,0 @@
|
|||
<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>
|
|
@ -1,17 +0,0 @@
|
|||
<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>
|
|
@ -1,4 +0,0 @@
|
|||
<h3>Fehler</h3>
|
||||
<p>
|
||||
<?php echo $this->message ?>
|
||||
</p>
|
|
@ -1,12 +0,0 @@
|
|||
<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>
|
|
@ -1,13 +0,0 @@
|
|||
<?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>
|
|
@ -1,86 +0,0 @@
|
|||
<!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>
|
12
application/view/welcome.phtml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<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>
|
|
@ -1 +0,0 @@
|
|||
password = test
|
5
config/database.config.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
; [connection:development:default]
|
||||
; host = localhost
|
||||
; user = root
|
||||
; password =
|
||||
; database = myDatabaseName
|
|
@ -1,5 +0,0 @@
|
|||
[connection:development:default]
|
||||
host = 127.0.0.1
|
||||
user = root
|
||||
password =
|
||||
database = seinheit_ch
|
|
@ -1,42 +0,0 @@
|
|||
|
||||
/*!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", "/");
|
|
@ -1,4 +0,0 @@
|
|||
title = Seinheit.
|
||||
subtitle = Praxis für Traditionelle Europäische Medizin
|
||||
email = info@seinheit.ch
|
||||
#sites = news, blog
|
|
@ -1,17 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Controller_Plugin_Notice extends Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preController()
|
||||
{
|
||||
$view = Katharsis_View::getInstance();
|
||||
$view->notices = DidgeridooArtwork_Notice::get();
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?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);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Base extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($after)
|
||||
{
|
||||
return $this->_view->base . '/' . $after;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Image extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($imgName)
|
||||
{
|
||||
return $this->_view->base . "/img/page/" . $imgName;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Mail extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($parameters)
|
||||
{
|
||||
return $this->_view->render('Plugin/mail');
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Newsletter extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($parameters)
|
||||
{
|
||||
return $this->_view->render('Plugin/newsletter');
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Page extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($pageName)
|
||||
{
|
||||
return $this->_view->base . "/" . $pageName;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?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,40 +1,51 @@
|
|||
<?php
|
||||
class Katharsis_Autoload
|
||||
{
|
||||
protected static $_classLocations = array(
|
||||
'library',
|
||||
'application/controller',
|
||||
'application/model'
|
||||
);
|
||||
|
||||
public static function init()
|
||||
{
|
||||
spl_autoload_register('Katharsis_Autoload::autoload');
|
||||
}
|
||||
|
||||
public static function autoload($classname)
|
||||
{
|
||||
if($location = self::findClass($classname))
|
||||
{
|
||||
require_once $location;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new exception('Autoload: could not load class "' . $classname . '"');
|
||||
}
|
||||
|
||||
public static function findClass($classname)
|
||||
{
|
||||
$name = str_replace("_", DIRECTORY_SEPARATOR, $classname);
|
||||
|
||||
foreach(self::$_classLocations as $location)
|
||||
{
|
||||
if(file_exists($location . DIRECTORY_SEPARATOR . $name . ".php"))
|
||||
{
|
||||
return $location . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Autoloader
|
||||
* Loads class files automatically when they are needed.
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_Autoload
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $_classLocations = array(
|
||||
'library',
|
||||
'application/controller',
|
||||
'application/model'
|
||||
);
|
||||
|
||||
/**
|
||||
* Registering autoload method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init()
|
||||
{
|
||||
spl_autoload_register('Katharsis_Autoload::autoload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual autoload method. Loads class files automatically when they are needed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function autoload($classname)
|
||||
{
|
||||
$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,23 +1,29 @@
|
|||
<?php
|
||||
require_once('library/Katharsis/Autoload.php');
|
||||
|
||||
class Katharsis_Bootstrap
|
||||
{
|
||||
public static function init()
|
||||
{
|
||||
$router = Katharsis_ControllerRouting::getInstance();
|
||||
$router->init();
|
||||
}
|
||||
|
||||
public static function run()
|
||||
{
|
||||
$router = Katharsis_ControllerRouting::getInstance();
|
||||
|
||||
Katharsis_Controller_Plugin::preControllerHook();
|
||||
|
||||
$router->route();
|
||||
|
||||
Katharsis_Controller_Plugin::postControllerHook();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php require_once('library/Katharsis/Autoload.php');
|
||||
/**
|
||||
* Bootstrap Class
|
||||
* Central application routing entity
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_Bootstrap
|
||||
{
|
||||
/**
|
||||
* Central application routing method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function run()
|
||||
{
|
||||
$router = Katharsis_ControllerRouting::getInstance();
|
||||
|
||||
$router->init();
|
||||
|
||||
Katharsis_Controller_Plugin::preControllerHook();
|
||||
|
||||
$router->route();
|
||||
|
||||
Katharsis_Controller_Plugin::postControllerHook();
|
||||
}
|
||||
}
|
|
@ -1,57 +1,105 @@
|
|||
<?php
|
||||
abstract class Katharsis_Controller_Abstract
|
||||
{
|
||||
protected $_con;
|
||||
protected $_view;
|
||||
|
||||
public final function __construct()
|
||||
{
|
||||
$this->_con = Katharsis_DatabaseConnector::getConnection();
|
||||
$this->_view = Katharsis_View::getInstance();
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function __call($action, $params)
|
||||
{
|
||||
throw new Katharsis_Exception('Die von Ihnen angeforderte Seite (Action) "' . substr($action, 0, -6) . '" konnte nicht gefunden werden.');
|
||||
}
|
||||
|
||||
protected function _getParam($key)
|
||||
{
|
||||
$params = Katharsis_Request::getParams();
|
||||
if(array_key_exists($key,$params))
|
||||
{
|
||||
return $params[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function _getAllParams()
|
||||
{
|
||||
return Katharsis_Request::getParams();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Abstract Controller
|
||||
* All controllers must extend this class.
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
abstract class Katharsis_Controller_Abstract
|
||||
{
|
||||
/**
|
||||
* @var Katharsis_Db5
|
||||
*/
|
||||
protected $_con;
|
||||
|
||||
/**
|
||||
* @var Katharsis_View
|
||||
*/
|
||||
protected $_view;
|
||||
|
||||
/**
|
||||
* Instances class attributes, calles init method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public final function __construct()
|
||||
{
|
||||
$this->_con = Katharsis_DatabaseConnector::getConnection();
|
||||
$this->_view = Katharsis_View::getInstance();
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite this method instead of using a constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* If subclass hasn't got a __call method, this exception will be thrown
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __call($action, $params)
|
||||
{
|
||||
throw new Katharsis_Exception('Action "' . $action . '" doesn\'t exist.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a specific request parameter
|
||||
*
|
||||
* @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,27 +1,53 @@
|
|||
<?php
|
||||
class Katharsis_Controller_Plugin
|
||||
{
|
||||
protected static $_plugins;
|
||||
|
||||
public static function registerPlugin($object)
|
||||
{
|
||||
self::$_plugins[] = $object;
|
||||
}
|
||||
|
||||
public static function preControllerHook()
|
||||
{
|
||||
foreach(self::$_plugins as $plugin)
|
||||
{
|
||||
$plugin->preController();
|
||||
}
|
||||
}
|
||||
|
||||
public static function postControllerHook()
|
||||
{
|
||||
foreach(self::$_plugins as $plugin)
|
||||
{
|
||||
$plugin->postController();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Central Plugin Class
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_Controller_Plugin
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $_plugins;
|
||||
|
||||
/**
|
||||
* Register all plugins with this method
|
||||
* Plugins will be called in the same order as they have been registered
|
||||
*
|
||||
* @param object $object - an instance of your plugin
|
||||
* @return void
|
||||
*/
|
||||
public static function registerPlugin($object)
|
||||
{
|
||||
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,19 +1,31 @@
|
|||
<?php
|
||||
abstract class Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
protected $_con;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_con = Katharsis_DatabaseConnector::getConnection();
|
||||
}
|
||||
|
||||
public function preController()
|
||||
{
|
||||
}
|
||||
|
||||
public function postController()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Abstract Controller Plugin
|
||||
* All controller plugins must extend this class.
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
abstract class Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Overwrite this method, if you want something to be processed
|
||||
* _before_ the controller is called
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?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,19 +1,32 @@
|
|||
<?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
|
||||
{
|
||||
/**
|
||||
* Renders a controller/action.phtml template automaticly after processing controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postController()
|
||||
{
|
||||
$view = Katharsis_View::getInstance();
|
||||
|
||||
$view->stageContent = false;
|
||||
|
||||
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
||||
$view->controllerAction = false;
|
||||
|
||||
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
||||
$templateName = strtolower(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
||||
|
||||
if(file_exists('application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
||||
{
|
||||
$view->stageContent = $view->render($templateName);
|
||||
$view->controllerAction = $templateName;
|
||||
}
|
||||
|
||||
$view = Katharsis_View::getInstance();
|
||||
echo $view->render('main');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
class Katharsis_Controller_Plugin_StartSession extends Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preController()
|
||||
{
|
||||
session_write_close();
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,102 +1,136 @@
|
|||
<?php
|
||||
class Katharsis_ControllerRouting
|
||||
{
|
||||
protected static $_instance = null;
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if(self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
Katharsis_Request::setControllerName('index');
|
||||
Katharsis_Request::setActionName('index');
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$paramstring = "";
|
||||
$baseUrl = preg_replace('#(.*/)[^/]+#', '\1', $_SERVER['SCRIPT_NAME']);
|
||||
|
||||
if(preg_match("~/([^/\?]+)/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
|
||||
{
|
||||
$controller = $matches[1];
|
||||
$action = $matches[2];
|
||||
$paramstring = $matches[3];
|
||||
$params = $this->_buildParams($paramstring);
|
||||
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
Katharsis_Request::setActionName($action);
|
||||
}
|
||||
else if(preg_match("~/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
|
||||
{
|
||||
$controller = $matches[1];
|
||||
$paramstring = $matches[2];
|
||||
$params = $this->_buildParams($paramstring);
|
||||
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(array_key_exists('controller', $_GET))
|
||||
{
|
||||
$controller = $_GET['controller'];
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
}
|
||||
|
||||
if(array_key_exists('action', $_GET))
|
||||
{
|
||||
$action = $_GET['action'];
|
||||
Katharsis_Request::setActionName($action);
|
||||
}
|
||||
|
||||
$params = $_GET;
|
||||
}
|
||||
|
||||
Katharsis_Request::setParams($params);
|
||||
|
||||
Katharsis_View::getInstance()->requestHook();
|
||||
}
|
||||
|
||||
public function route()
|
||||
{
|
||||
$controllerName = ucfirst(Katharsis_Request::getControllerName()) . 'Controller';
|
||||
$action = Katharsis_Request::getActionName() . 'Action';
|
||||
|
||||
if(class_exists($controllerName))
|
||||
{
|
||||
$controllerObject = new $controllerName();
|
||||
|
||||
$controllerObject->$action();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Controller Router
|
||||
* Specific routing entity
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_ControllerRouting
|
||||
{
|
||||
/**
|
||||
* @var Katharsis_ControllerRouting
|
||||
*/
|
||||
protected static $_instance = null;
|
||||
|
||||
/**
|
||||
* Singleton. Returns the same instance every time
|
||||
*
|
||||
* @return Katharsis_ControllerRouting
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if(self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default controller and action names
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
Katharsis_Request::setControllerName('index');
|
||||
Katharsis_Request::setActionName('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates routing process
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$paramstring = "";
|
||||
$baseUrl = preg_replace('#(.*/)[^/]+#', '\1', $_SERVER['SCRIPT_NAME']);
|
||||
|
||||
if(preg_match("~.*" . $baseUrl . "([^/\?]+)/([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
|
||||
{
|
||||
$controller = $matches[1];
|
||||
$action = $matches[2];
|
||||
$paramstring = $matches[3];
|
||||
$params = $this->_buildParams($paramstring);
|
||||
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
Katharsis_Request::setActionName($action);
|
||||
} else if(preg_match("~.*" . $baseUrl . "([^/\?]+)/*([^\?]*)~", $_SERVER['REQUEST_URI'], $matches))
|
||||
{
|
||||
$controller = $matches[1];
|
||||
$paramstring = $matches[2];
|
||||
$params = $this->_buildParams($paramstring);
|
||||
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
} else
|
||||
{
|
||||
if(array_key_exists('controller', $_GET))
|
||||
{
|
||||
$controller = $_GET['controller'];
|
||||
Katharsis_Request::setControllerName($controller);
|
||||
}
|
||||
|
||||
if(array_key_exists('action', $_GET))
|
||||
{
|
||||
$action = $_GET['action'];
|
||||
Katharsis_Request::setActionName($action);
|
||||
}
|
||||
|
||||
$params = $_GET;
|
||||
}
|
||||
|
||||
Katharsis_Request::setParams($params);
|
||||
|
||||
Katharsis_View::getInstance()->requestHook();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Routing processing method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function route()
|
||||
{
|
||||
$controllerName = ucfirst(Katharsis_Request::getControllerName()) . 'Controller';
|
||||
$action = Katharsis_Request::getActionName() . 'Action';
|
||||
|
||||
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,92 +1,130 @@
|
|||
<?php
|
||||
class Katharsis_DatabaseConnector
|
||||
{
|
||||
public static $_conns = array();
|
||||
|
||||
protected static function connect($requestedName = null)
|
||||
{
|
||||
$ini = parse_ini_file('config/database.config.ini', true);
|
||||
if($ini !== array())
|
||||
{
|
||||
$conInformation = self::_selectConnection($ini, $requestedName);
|
||||
return self::_realConnect($conInformation);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function connectAll($requestedName = null)
|
||||
{
|
||||
$groups = parse_ini_file('config/database.config.ini', true);
|
||||
|
||||
foreach($groups as $iniName => $conInformation)
|
||||
{
|
||||
if(preg_match("~^connection:([^:]+)~", $iniName, $matches))
|
||||
{
|
||||
self::getConnection($matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static function _realConnect($conInformation)
|
||||
{
|
||||
//$con = new PDO('mysql:host=' . $conInformation['host'] . ';dbname=' . $conInformation['database'], $conInformation['user'], $conInformation['password']);
|
||||
|
||||
|
||||
$con = new Katharsis_Db5($conInformation['host'], $conInformation['user'], $conInformation['password'], $conInformation['database']);
|
||||
|
||||
self::$_conns[$conInformation['name']]['connection'] = $con;
|
||||
self::$_conns[$conInformation['name']]['info'] = $conInformation;
|
||||
|
||||
return $con;
|
||||
}
|
||||
|
||||
public static function getConnection($requestedName = null)
|
||||
{
|
||||
if($requestedName === null)
|
||||
{
|
||||
foreach(self::$_conns as $con)
|
||||
{
|
||||
if($con['info']['default'] === true)
|
||||
{
|
||||
return $con['connection'];
|
||||
}
|
||||
}
|
||||
return self::connect(null);
|
||||
} else
|
||||
{
|
||||
if(in_array($requestedName, array_keys(self::$_conns)))
|
||||
{
|
||||
return self::$_conns[$requestedName]['connection'];
|
||||
}
|
||||
return self::connect($requestedName);
|
||||
}
|
||||
}
|
||||
|
||||
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 . '"');
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Database Connector
|
||||
* controls database connections
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_DatabaseConnector
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $_conns = array();
|
||||
|
||||
/**
|
||||
* Reading ini file information and connecting
|
||||
*
|
||||
* @param string $requestedName
|
||||
* @return Katharsis_Db5
|
||||
*/
|
||||
protected static function connect($requestedName = null)
|
||||
{
|
||||
$ini = parse_ini_file('config/database.config.ini', true);
|
||||
if($ini !== array())
|
||||
{
|
||||
$conInformation = self::_selectConnection($ini, $requestedName);
|
||||
return self::_realConnect($conInformation);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to all connections in config file
|
||||
*
|
||||
* @param string $requestedName
|
||||
* @return void
|
||||
*/
|
||||
public static function connectAll()
|
||||
{
|
||||
$groups = parse_ini_file('config/database.config.ini', true);
|
||||
|
||||
foreach($groups as $iniName => $conInformation)
|
||||
{
|
||||
if(preg_match("~^connection:([^:]+)~", $iniName, $matches))
|
||||
{
|
||||
self::getConnection($matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calling Katharsis Db connecting method
|
||||
*
|
||||
* @param string $requestedName
|
||||
* @return Katharsis_Db5
|
||||
*/
|
||||
protected static function _realConnect($conInformation)
|
||||
{
|
||||
$con = new Katharsis_Db5($conInformation['host'], $conInformation['user'], $conInformation['password'], $conInformation['database']);
|
||||
|
||||
self::$_conns[$conInformation['name']]['connection'] = $con;
|
||||
self::$_conns[$conInformation['name']]['info'] = $conInformation;
|
||||
|
||||
return $con;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns specified or default connection
|
||||
*
|
||||
* @param string $requestedName
|
||||
* @return Katharsis_Db5
|
||||
*/
|
||||
public static function getConnection($requestedName = null)
|
||||
{
|
||||
if($requestedName === null)
|
||||
{
|
||||
foreach(self::$_conns as $con)
|
||||
{
|
||||
if($con['info']['default'] === true)
|
||||
{
|
||||
return $con['connection'];
|
||||
}
|
||||
}
|
||||
return self::connect(null);
|
||||
} else
|
||||
{
|
||||
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,4 +1,11 @@
|
|||
<?php
|
||||
class Katharsis_Exception extends Exception
|
||||
{
|
||||
<?php
|
||||
/**
|
||||
* Katharsis Exception
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_Exception extends Exception
|
||||
{
|
||||
}
|
|
@ -1,16 +1,36 @@
|
|||
<?php
|
||||
abstract class Katharsis_Model_Abstract
|
||||
{
|
||||
protected $_con;
|
||||
|
||||
public final function __construct()
|
||||
{
|
||||
$this->_con = Katharsis_DatabaseConnector::getConnection();
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Abstract Model
|
||||
* All models must extend this class.
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
abstract class Katharsis_Model_Abstract
|
||||
{
|
||||
/**
|
||||
* @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()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
<?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,44 +1,93 @@
|
|||
<?php
|
||||
class Katharsis_Request
|
||||
{
|
||||
protected static $_controller = null;
|
||||
protected static $_action = null;
|
||||
protected static $_params = array();
|
||||
|
||||
public static function setControllerName($name)
|
||||
{
|
||||
self::$_controller = $name;
|
||||
}
|
||||
|
||||
public static function setActionName($name)
|
||||
{
|
||||
self::$_action = $name;
|
||||
}
|
||||
|
||||
public static function setParams($params)
|
||||
{
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
$params[$key] = $value;
|
||||
}
|
||||
self::$_params = $params;
|
||||
|
||||
}
|
||||
|
||||
public static function getControllerName()
|
||||
{
|
||||
return self::$_controller;
|
||||
}
|
||||
|
||||
public static function getActionName()
|
||||
{
|
||||
return self::$_action;
|
||||
}
|
||||
|
||||
|
||||
public static function getParams()
|
||||
{
|
||||
return self::$_params;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Katharsis Request
|
||||
* Represents a http call
|
||||
*
|
||||
* @author Karl Pannek <info@katharsis.in>
|
||||
* @version 0.5.2
|
||||
* @package Katharsis
|
||||
*/
|
||||
class Katharsis_Request
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $_controller;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $_action;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $_params = array();
|
||||
|
||||
/**
|
||||
* Set name of controller
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public static function setControllerName($name)
|
||||
{
|
||||
self::$_controller = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name of action
|
||||
*
|
||||
* @param string $name
|
||||
* @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,9 +1,29 @@
|
|||
<?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
|
||||
{
|
||||
/**
|
||||
* @var Katharsis_View
|
||||
*/
|
||||
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()
|
||||
{
|
||||
if(self::$_instance === null)
|
||||
|
@ -13,30 +33,49 @@ class Katharsis_View
|
|||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets base application path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
|
||||
$this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
|
||||
$this->_params['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Magical get method, gets specific param
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if(array_key_exists($name, $this->_items))
|
||||
if(array_key_exists($name, $this->_params))
|
||||
{
|
||||
if(is_array($this->_items[$name]))
|
||||
{
|
||||
return (array) $this->_items[$name];
|
||||
}
|
||||
return $this->_items[$name];
|
||||
return $this->_params[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magical set method, sets specific param
|
||||
*
|
||||
* @param string name
|
||||
* @param string value
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$this->_items[$name] = $value;
|
||||
$this->_params[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template rendering method
|
||||
*
|
||||
* @param string $template
|
||||
* @return string
|
||||
*/
|
||||
public function render($template)
|
||||
{
|
||||
ob_start();
|
||||
|
@ -50,23 +89,13 @@ class Katharsis_View
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Request params into View params
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
RewriteEngine On
|
||||
|
||||
RewriteBase /
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
|
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 206 KiB |
Before Width: | Height: | Size: 283 KiB |
Before Width: | Height: | Size: 218 KiB |
Before Width: | Height: | Size: 318 KiB |
Before Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 230 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 383 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 102 KiB |