public function testIni() { $ini = ECCINI::instance('core-save.ini', 'settings'); $ini->setVariable('test', 'key', 'value'); $ini->setVariable('infos', 'debug', 0); $ini->setVariable('database', 'driver', 'mysql'); $ini->saveFile(); echo 'saved'; }
public function setTheme($themeDir = null) { if (is_null($themeDir)) { $path = ECCINI::instance('design.ini')->getVariable('theme', 'path'); } else { $path = $themeDir; } $this->getTheme($path); }
public function toggleDebug() { $ECCINI = ECCINI::instance(); $ECCDebug = new ECCDebug(); if ($ECCDebug->getDebug()) { /* * Set debug off with ECCINI write method */ } else { /* * Set debug on with ECCINI write method */ } ECCSystem::redirectToURI('/admin/settings/'); }
use kernel\classes\DB\ECCPdo; use kernel\classes\ECCDebug; use kernel\classes\ECCINI; $ECCDebug = new ECCDebug(); if (ECCINI::exist()) { if (!$ECCDebug->getDebug()) { ini_set("display_errors", 0); } } else { ini_set("display_errors", 0); } try { if (!ECCINI::exist()) { throw new PDOException('ECCIni required'); } $ini = ECCINI::instance(); $infos = $ini->getSection('database'); $host = $infos['host']; $port = $infos['port']; $dbname = $infos['dbname']; $username = $infos['username']; $passwd = $infos['passwd']; $prefix = $infos['prefix']; $driver = $infos['driver']; switch ($driver) { case 'pdo': default: $options = array(ECCPdo::ATTR_PERSISTENT => true, ECCPdo::ATTR_ERRMODE => ECCPdo::ERRMODE_EXCEPTION, ECCPdo::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); $dsn = 'mysql:host=' . $host . ';port=' . $port . ';dbname=' . $dbname; $dao = new ECCPdo($dsn, $username, $passwd, $options, $prefix); break;