Merge branch 'master' of github.com:jeena/seinheit.ch
This commit is contained in:
commit
f95b70d17e
11 changed files with 146 additions and 126 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
config/admin.ini
|
||||
config/database.config.ini
|
||||
public/img/header
|
||||
public/img/page
|
||||
|
|
|
@ -26,19 +26,22 @@ class AdminPageController extends Katharsis_Controller_Abstract
|
|||
$type = 'page';
|
||||
}
|
||||
|
||||
$path = getcwd().'/img/' . $type . '/';
|
||||
$path = getcwd().'/public/img/' . $type . '/';
|
||||
|
||||
if(isset($_FILES['myfile']))
|
||||
{
|
||||
$upload = new Upload();
|
||||
|
||||
if($type == 'header') {
|
||||
$upload->header($_FILES['myfile']);
|
||||
$imagePath = $upload->header($_FILES['myfile']);
|
||||
} else {
|
||||
$upload->page($_FILES['myfile']);
|
||||
$imagePath = $upload->page($_FILES['myfile']);
|
||||
}
|
||||
|
||||
echo 'Das Hochladen war erfolgreich.<br><br>';
|
||||
$this->_view->imagePath = $imagePath;
|
||||
|
||||
echo $this->_view->render('AdminPage/uploadsuccess');
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +54,7 @@ class AdminPageController extends Katharsis_Controller_Abstract
|
|||
}
|
||||
|
||||
$ar = array();
|
||||
if (is_readable($path) && $handle = opendir())
|
||||
if (is_readable($path) && $handle = opendir($path))
|
||||
{
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if(is_dir($file)) continue;
|
||||
|
@ -60,6 +63,7 @@ class AdminPageController extends Katharsis_Controller_Abstract
|
|||
|
||||
closedir($handle);
|
||||
}
|
||||
$this->_view->type = $type;
|
||||
$this->_view->files = $ar;
|
||||
echo $this->_view->render('AdminPage/image');
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class PageController extends Katharsis_Controller_Abstract
|
|||
|
||||
$url = substr($method, 0, -6); // remove Action from urlAction
|
||||
|
||||
$pageId = $this->_page->getIdByUrl($url);
|
||||
$pageId = $this->_page->getIdByUrl($url, $preview);
|
||||
|
||||
if(!$pageId) {
|
||||
throw new DidgeridooArtwork_Exception('Page konnte nicht geladen werden.');
|
||||
|
|
|
@ -8,13 +8,13 @@ class Upload extends Katharsis_Model_Abstract
|
|||
|
||||
public function header($file)
|
||||
{
|
||||
$dir = getcwd() . '/img/header';
|
||||
$dir = getcwd() . '/public/img/header';
|
||||
return $this->_uploadFile(null, $file, $dir);
|
||||
}
|
||||
|
||||
public function page($file)
|
||||
{
|
||||
$dir = getcwd() . '/img/page';
|
||||
$dir = getcwd() . '/public/img/page';
|
||||
return $this->_uploadFile(null, $file, $dir, $file['name'] . '-' . time());
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ class Upload extends Katharsis_Model_Abstract
|
|||
{
|
||||
if($name === null)
|
||||
{
|
||||
$name = $id . '-' . time();
|
||||
$name = time();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -31,25 +31,35 @@ class Upload extends Katharsis_Model_Abstract
|
|||
$name = $nameparts[0];
|
||||
}
|
||||
}
|
||||
|
||||
$handle = new Verot_Upload($file);
|
||||
return;
|
||||
$handle->file_new_name_body = $name;
|
||||
|
||||
if ($handle->uploaded)
|
||||
{
|
||||
$handle->Process($dir);
|
||||
if (!$handle->processed)
|
||||
{
|
||||
throw new DidgeridooArtwork_Exception('Datei konnte nicht verschoben werden (' . $handle->error . ').');
|
||||
}
|
||||
$handle->Clean();
|
||||
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir);
|
||||
}
|
||||
else
|
||||
|
||||
$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('Datei konnte nicht hochgeladen werden (' . $handle->error . ').');
|
||||
throw new DidgeridooArtwork_Exception('Hochladen fehlgeschlagen. (move_uploaded_file: false)');
|
||||
return false;
|
||||
}
|
||||
$returnName = $handle->file_dst_name;
|
||||
return $returnName;
|
||||
return $name . $ext;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Swiss Didgeridoo Artwork</title>
|
||||
<title>Seinheit</title>
|
||||
<link rel="stylesheet" type="text/css" href="/style/main.css" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="Description" content="Swiss Didgeridoo Artwork - Online Shop" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -18,8 +17,8 @@
|
|||
<ul style="padding-left: 16px; list-style-type: none">
|
||||
<?php foreach($this->files as $file): ?>
|
||||
<li>
|
||||
<a href="javascript: void(0);" onclick="window.open('/img/page/<?php echo $file; ?>', 'Bild', 'width=400,height=300,status=yes,scrollbars=yes,resizable=yes');"><img src="/img/page/<?php echo $file; ?>" width="50" height="50" /></a>
|
||||
<a href="javascript: void(0);" onclick="opener.document.getElementById('src').value='/img/page/<?php echo $file; ?>'; window.close();" >Einfügen</a>
|
||||
<a href="javascript: void(0);" onclick="window.open('/img/page/<?php echo $file; ?>', 'Bild', 'width=400,height=300,status=yes,scrollbars=yes,resizable=yes');"><img src="/img/<?php echo $this->type; ?>/<?php echo $file; ?>" width="50" height="50" /></a>
|
||||
<a href="javascript: void(0);" onclick="opener.document.getElementById('src').value='/img/<?php echo $this->type; ?>/<?php echo $file; ?>'; window.close();" >Einfügen</a>
|
||||
<a href="?delete=<?php echo $file ?>" style="float:right; margin-top: 35px">Löschen</a>
|
||||
|
||||
</li>
|
||||
|
|
10
application/view/AdminPage/uploadsuccess.phtml
Normal file
10
application/view/AdminPage/uploadsuccess.phtml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<h2>Das Hochladen war erfolgreich.</h2>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
opener.document.forms[0].header_image.value = '<?php echo $this->imagePath;?>';
|
||||
setTimeout(function() {
|
||||
window.self.close();
|
||||
}, 800);
|
||||
|
||||
</script>
|
|
@ -4,7 +4,7 @@ class DidgeridooArtwork_Controller_Plugin_Navigation extends Katharsis_Controlle
|
|||
public function preController()
|
||||
{
|
||||
$view = Katharsis_View::getInstance();
|
||||
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id IS NULL ORDER BY sorting";
|
||||
$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)";
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
<?php
|
||||
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
public function postController()
|
||||
{
|
||||
$view = Katharsis_View::getInstance();
|
||||
|
||||
$view->stageContent = false;
|
||||
|
||||
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
||||
|
||||
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
||||
{
|
||||
$view->stageContent = $view->render($templateName);
|
||||
}
|
||||
|
||||
echo $view->render('main');
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
|
||||
{
|
||||
public function postController()
|
||||
{
|
||||
$view = Katharsis_View::getInstance();
|
||||
|
||||
$view->stageContent = false;
|
||||
|
||||
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
||||
|
||||
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
||||
{
|
||||
$view->stageContent = $view->render($templateName);
|
||||
}
|
||||
|
||||
echo $view->render('main');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,73 +1,72 @@
|
|||
<?php
|
||||
class Katharsis_View
|
||||
{
|
||||
protected static $_instance = null;
|
||||
protected $_items = array();
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if(self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
|
||||
$this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if(array_key_exists($name, $this->_items))
|
||||
{
|
||||
if(is_array($this->_items[$name]))
|
||||
{
|
||||
return (array) $this->_items[$name];
|
||||
}
|
||||
return $this->_items[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$this->_items[$name] = $value;
|
||||
}
|
||||
|
||||
public function render($template)
|
||||
{
|
||||
ob_start();
|
||||
if(file_exists('application/view/' . $template . '.phtml'))
|
||||
{
|
||||
include('application/view/' . $template . '.phtml');
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function requestHook()
|
||||
{
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
class Katharsis_View
|
||||
{
|
||||
protected static $_instance = null;
|
||||
protected $_items = array();
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if(self::$_instance === null)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
|
||||
$this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if(array_key_exists($name, $this->_items))
|
||||
{
|
||||
if(is_array($this->_items[$name]))
|
||||
{
|
||||
return (array) $this->_items[$name];
|
||||
}
|
||||
return $this->_items[$name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$this->_items[$name] = $value;
|
||||
}
|
||||
|
||||
public function render($template)
|
||||
{
|
||||
ob_start();
|
||||
if(file_exists('application/view/' . $template . '.phtml'))
|
||||
{
|
||||
include('application/view/' . $template . '.phtml');
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function requestHook()
|
||||
{
|
||||
}
|
||||
|
||||
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,7 +12,6 @@ chdir('..');
|
|||
require_once('library/Katharsis/Bootstrap.php');
|
||||
Katharsis_Autoload::init();
|
||||
|
||||
|
||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames());
|
||||
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession());
|
||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Notice());
|
||||
|
@ -22,7 +21,6 @@ Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_Auto
|
|||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Access());
|
||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Navigation());
|
||||
|
||||
|
||||
try {
|
||||
Katharsis_Bootstrap::init();
|
||||
Katharsis_Bootstrap::run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue