+ Error on line 13
session_start();
<?php
Doo::loadClass('RestController');
class RepositoriesController extends RestController {
public $_model = 'Repositories';
public $_url = 'fundgrube';
public $_usePagination = true;
public function __construct() {
$this->_data['title'] = 'Fundgrube';
}
public function create() {
if(isset($_FILES['file'])) {
$files = $this->uploadFile('upload/');
echo $this->toJSON(array(
'success' => !!$files,
'data' => $files
));
}
$this->initPostVars(
array('user_id' => $_SESSION['user']['id'])
);
parent::create();
}
/**
* the delete function
* ex. url: {delete}/controller/id
*/
public function delete($entry = null) {
if($this->isAjax()) {
$entry = $this->getCurrentEntry();
if($entry) {
foreach(array('filename', 'thumb', 'midi') as $file) {
if($entry->$file && file_exists(Doo::conf()->SITE_PATH . $entry->$file)) {
unlink(Doo::conf()->SITE_PATH . $entry->$file);
}
}
}
}
parent::delete($entry);
}
private function uploadFile($path) {
Doo::loadHelper('DooGdImage');
$imageHelper = new DooGdImage(
Doo::conf()->SITE_PATH . $path,
Doo::conf()->SITE_PATH . $path
);
$fileName = $imageHelper->uploadImage('file');
if($fileName) {
$imageHelper->thumbSuffix = '_thumb';
$thumbName = $imageHelper->createThumb($fileName, 178, 121);
$thumbName = str_replace(Doo::conf()->SITE_PATH . $path, $path, $thumbName);
$imageHelper->thumbSuffix = '_midi';
$midiName = $imageHelper->createThumb($fileName, 420, 301);
$midiName = str_replace(Doo::conf()->SITE_PATH . $path, $path, $midiName);
$fileName = $path . $fileName;
return array(
'filename' => $fileName,
'midi' => $midiName,
'thumb' => $thumbName
);
} else {
return array();
}
}
public function importExcel() {
error_reporting(E_ALL ^ E_NOTICE);
Doo::loadHelper('DooFile');
Doo::loadClass('PHPExcel');
$dooFile = new DooFile();
$uploadPath = Doo::conf()->SITE_PATH . 'upload/';
$file = $dooFile->upload($uploadPath, 'file');
$imported = array();
if($file) {
$excel = new PHPExcel();
$reader = PHPExcel_IOFactory::createReader('Excel5');
$phpExcel = $reader->load($uploadPath . $file);
$sheets = $phpExcel->getAllSheets();
$sheet = $sheets[0]->toArray();
// assume
// col 0 => Bezeichnung
// col 1, 2, 3 => Masse
// col 4 => Tragstab
// col 5 => Querstab
// col 6 => Rand
// col 7 => Maschenteilung
// col 8 => Material
// col 9 => Menge
for($i = 1; $i < count($sheet); $i++) {
$row = $sheet[$i];
if($row[0]) {
$data = array(
'description' => $row[0],
'mass' => $row[1] . $row[2] . $row[3],
'tragstab' => $row[4],
'querstab' => $row[5],
'border' => $row[6],
'maschenteilung' => $row[7],
'material' => $row[8],
'count' => $row[9],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
);
$imported[] = $data;
$model = $this->getModel();
$id = $model->insertAttributes($data);
}
}
}
echo $this->toJSON(array(
'success' => true,
'records' => $imported,
'total' => count($imported)
));
}
/**
* the detail function is called by router
* ex. url: {get}/controller/id
*/
public function detail() {
$model = $this->getModel();
$model = $this->setWhere($model);
$news = $model->limit(10, null, 'updated_at');
if($news) {
$this->setData('RepositoriesSide', $news);
}
parent::detail();
}
public function fetchWhere($model) {
if(!$this->isAjax()) {
$model->isactive = 1;
return $model;
}
return parent::fetchWhere($model);
}
public function fetchOptions() {
return array(
'desc' => 'updated_at'
);
}
public function indexData($data) {
$this->setData('RepositoriesSide', $data['Repositories']);
return $data;
}
public function detailData($data) {
if($data) {
if(!$data->isactive) {
return false;
}
$this->setData('title', $data->title);
}
return $data;
}
public function createData($data) {
$data['created_at'] = date('Y-m-d H:i:s');
$data['updated_at'] = date('Y-m-d H:i:s');
return $data;
}
public function updateData($data) {
$data['updated_at'] = date('Y-m-d H:i:s');
return $data;
}
}
* Stack Trace...
- /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/index.php(23) calling run()
- /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/app/DooWebApp.php(34) calling routeTo()
- /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/app/DooWebApp.php(87) calling __construct()
- /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/protected/controller/RepositoriesController.php(13) calling session_start()
object(DooConfig)#1 (22) {
["AUTOLOAD"] => NULL
["SITE_PATH"] => string(59) "/var/www/vhosts/h146521.web17.servicehoster.ch/public_html/"
["PROTECTED_FOLDER"] => string(10) "protected/"
["BASE_PATH"] => string(62) "/var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/"
["LOG_PATH"] => NULL
["APP_URL"] => string(1) "/"
["SUBFOLDER"] => string(1) "/"
["APP_MODE"] => string(4) "prod"
["AUTOROUTE"] => bool(true)
["DEBUG_ENABLED"] => bool(false)
["ERROR_404_DOCUMENT"] => NULL
["ERROR_404_ROUTE"] => string(6) "/error"
["CACHE_PATH"] => NULL
["AUTO_VIEW_RENDER_PATH"] => string(14) "/fundgrube/:id"
["MEMCACHE"] => NULL
["TEMPLATE_ENGINE"] => string(7) "DooView"
["TEMPLATE_SHOW_COMMENT"] => NULL
["TEMPLATE_ALLOW_PHP"] => NULL
["TEMPLATE_COMPILE_ALWAYS"] => bool(true)
["TEMPLATE_GLOBAL_TAGS"] => NULL
["MODULES"] => NULL
["APP_NAMESPACE_ID"] => NULL
}
$_COOKIE Variables
array(0) {
}