Made the options in the Config table available site-wide.

This commit is contained in:
Kyle Johnson 2013-05-17 08:42:32 -04:00
parent 17c8b98a41
commit f1a590c805
1 changed files with 9 additions and 1 deletions

View File

@ -33,15 +33,23 @@ App::uses('Controller', 'Controller');
*/
class AppController extends Controller {
public $helpers = array('Html', 'Form');
public $components = array('Cookie', 'Session');
public function beforeFilter() {
parent::beforeFilter();
$this->loadModel('Config');
$this->Cookie->name = 'ZoneMinder';
if (!$this->Cookie->read('zmBandwidth')) {
$this->Cookie->write('zmBandwidth', 'low', false);
}
$this->set('zmBandwidth', $this->Cookie->read('zmBandwidth'));
$configFile = "/usr/local/etc/zm.conf";
$localConfigFile = basename($configFile);
$options = $this->Config->find('list', array('fields' => array('Name', 'Value')));
foreach ($options as $key => $value) {
Configure::write($key, $value);
}
}
}