stepDooPHP Diagnostics - session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/app/DooWebApp.php:47)

See file /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/protected/controller/NewsController.php


+ Error on line 13

        session_start();

<?php
Doo
::loadClass('RestController');

class 
NewsController extends RestController {

    public 
$_model = 'News';
    
    public 
$_url = 'aktuelles';
    
    public 
$_usePagination = true;
    
    public function 
__construct() {
        session_start();

        
$this->_data['title'] = 'Aktuelles';
    }
    
    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 
preview() {
        if(
$_SERVER['REQUEST_METHOD'] == 'POST') {
            
$files = $this->uploadFile("temp/");
            if(
$files) {
                
$_POST = array_merge($_POST, $files);
            }
            
$model = $this->getModel();
            if(isset(
$_POST['id']) && $_POST['id']) {
                
$model = $model->getById_first($_POST['id']);
            }
            foreach(
$_POST as $key => $value) {
                
$model->$key = $value;
            }
            
$this->out(
                
true,
                array(
$this->_model => $model), 
                
true, 
                
$this->getDetailSite()
            );
        }
    }
    
    
/**
     * 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('NewsSide', $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('NewsSide', $data['News']);
        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');
        return 
$data;
    }
    
    public function 
atom() {
        
$data = $this->setWhere()->find($this->fetchOptions());
        
$this->setContentType('xml');
        
$this->render('news.xml', array('News' => $data));
    }
    
}


* Stack Trace...

  1. /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/index.php(23) calling run()
  2. /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/app/DooWebApp.php(34) calling routeTo()
  3. /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/kb/app/DooWebApp.php(87) calling __construct()
  4. /var/www/vhosts/h146521.web17.servicehoster.ch/public_html/protected/controller/NewsController.php(13) calling session_start()


* Variables...  Conf .  GET  .  POST  .  Session  .  Cookie 


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(15) "/aktuelles.html"
  
["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) {
}

BACK TO TOP