resoving
This commit is contained in:
parent
91aa15d253
commit
febd8f0883
8 changed files with 69 additions and 47 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
|
@ -33,12 +33,15 @@ class AdminPageController extends Katharsis_Controller_Abstract
|
||||||
$upload = new Upload();
|
$upload = new Upload();
|
||||||
|
|
||||||
if($type == 'header') {
|
if($type == 'header') {
|
||||||
$upload->header($_FILES['myfile']);
|
$imagePath = $upload->header($_FILES['myfile']);
|
||||||
} else {
|
} 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PageController extends Katharsis_Controller_Abstract
|
||||||
|
|
||||||
$url = substr($method, 0, -6); // remove Action from urlAction
|
$url = substr($method, 0, -6); // remove Action from urlAction
|
||||||
|
|
||||||
$pageId = $this->_page->getIdByUrl($url);
|
$pageId = $this->_page->getIdByUrl($url, $preview);
|
||||||
|
|
||||||
if(!$pageId) {
|
if(!$pageId) {
|
||||||
throw new DidgeridooArtwork_Exception('Page konnte nicht geladen werden.');
|
throw new DidgeridooArtwork_Exception('Page konnte nicht geladen werden.');
|
||||||
|
|
|
@ -8,13 +8,13 @@ class Upload extends Katharsis_Model_Abstract
|
||||||
|
|
||||||
public function header($file)
|
public function header($file)
|
||||||
{
|
{
|
||||||
$dir = getcwd() . '/img/header';
|
$dir = getcwd() . '/public/img/header';
|
||||||
return $this->_uploadFile(null, $file, $dir);
|
return $this->_uploadFile(null, $file, $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function page($file)
|
public function page($file)
|
||||||
{
|
{
|
||||||
$dir = getcwd() . '/img/page';
|
$dir = getcwd() . '/public/img/page';
|
||||||
return $this->_uploadFile(null, $file, $dir, $file['name'] . '-' . time());
|
return $this->_uploadFile(null, $file, $dir, $file['name'] . '-' . time());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class Upload extends Katharsis_Model_Abstract
|
||||||
{
|
{
|
||||||
if($name === null)
|
if($name === null)
|
||||||
{
|
{
|
||||||
$name = $id . '-' . time();
|
$name = time();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -31,25 +31,37 @@ class Upload extends Katharsis_Model_Abstract
|
||||||
$name = $nameparts[0];
|
$name = $nameparts[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = new Verot_Upload($file);
|
if (!is_dir($dir)) {
|
||||||
return;
|
mkdir($dir);
|
||||||
$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();
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullName = $dir . '/' . $name . $ext;
|
||||||
|
|
||||||
|
if (!move_uploaded_file($file['tmp_name'], $fullName))
|
||||||
{
|
{
|
||||||
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 $fullName;
|
||||||
return $returnName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
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()
|
public function preController()
|
||||||
{
|
{
|
||||||
$view = Katharsis_View::getInstance();
|
$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);
|
$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 = "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
|
<?php
|
||||||
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
|
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
public function postController()
|
public function postController()
|
||||||
{
|
{
|
||||||
$view = Katharsis_View::getInstance();
|
$view = Katharsis_View::getInstance();
|
||||||
|
|
||||||
$view->stageContent = false;
|
$view->stageContent = false;
|
||||||
|
|
||||||
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
|
||||||
|
|
||||||
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
|
||||||
{
|
{
|
||||||
$view->stageContent = $view->render($templateName);
|
$view->stageContent = $view->render($templateName);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $view->render('main');
|
echo $view->render('main');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ chdir('..');
|
||||||
require_once('library/Katharsis/Bootstrap.php');
|
require_once('library/Katharsis/Bootstrap.php');
|
||||||
Katharsis_Autoload::init();
|
Katharsis_Autoload::init();
|
||||||
|
|
||||||
|
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_SetNames());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession());
|
Katharsis_Controller_Plugin::registerPlugin(new Katharsis_Controller_Plugin_StartSession());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Notice());
|
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_Access());
|
||||||
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Navigation());
|
Katharsis_Controller_Plugin::registerPlugin(new DidgeridooArtwork_Controller_Plugin_Navigation());
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Katharsis_Bootstrap::init();
|
Katharsis_Bootstrap::init();
|
||||||
Katharsis_Bootstrap::run();
|
Katharsis_Bootstrap::run();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue