12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
-
- namespace SCF\Core;
-
-
- class System {
-
- /**
- * @var \SCF\Core\Database
- */
- private $_db;
-
- /**
- * @var array
- */
- private $system = [];
-
- /**
- * System constructor.
- * @param \SCF\Core\Database $db
- */
- public function __construct(Database $db)
- {
- $this->_db = $db;
- $this->getSettings();
- }
-
- /**
- * Collect settings from Database
- */
- private function getSettings()
- {
- $this->_db->query("SELECT * FROM system_settings");
- $this->createSettings($this->_db->fetchArray());
-
- }
-
- /**
- * Returns vardump of all Settings in $this->system
- */
- public function sysAll()
- {
- return var_dump($this->system);
-
- }
-
- /**
- * @param $dbArray
- */
- private function createSettings($dbArray)
- {
- foreach ($dbArray as $item)
- {
- $this->system[$item['setting']] = $item['value'];
- }
- }
-
- /**
- * @param $value
- * @return string
- */
- public function getValue($value)
- {
- if(!$value) {
- return $value . 'not Defined';
- }
-
- return $this->system[$value];
- }
-
- /**
- * @return mixed
- */
- public function getVersion()
- {
- $cmsversion = explode('|', $this->system['cms_vers']);
- return $cmsversion[0];
- }
- }
|