Exemple #1
0
 /**
  * Create a new config model object
  *
  * @param array $data
  * @return Config
  */
 public function __construct(array $data = [])
 {
     parent::__construct($data);
     $server = new Server();
     $config = Table\Config::getConfig();
     $distro = $server->getDistro();
     $this->data['overview'] = ['version' => \Phire\Module::VERSION, 'domain' => $config['domain'], 'document_root' => $config['document_root'], 'base_path' => BASE_PATH == '' ? ' ' : BASE_PATH, 'application_path' => APP_PATH == '' ? ' ' : APP_PATH, 'content_path' => CONTENT_PATH, 'modules_path' => MODULES_PATH, 'operating_system' => $server->getOs() . (!empty($distro) ? ' (' . $distro . ')' : null), 'software' => $server->getServer() . ' ' . $server->getServerVersion(), 'database_version' => Table\Config::db()->version(), 'php_version' => $server->getPhp(), 'installed_on' => $config['installed_on'] != '0000-00-00 00:00:00' ? date($config['datetime_format'], strtotime($config['installed_on'])) : '', 'updated_on' => $config['updated_on'] != '0000-00-00 00:00:00' ? date($config['datetime_format'], strtotime($config['updated_on'])) : ''];
     $config['datetime_formats'] = ['M j Y', 'F d, Y', 'm/d/Y', 'Y/m/d', 'F d, Y g:i A', 'M j Y g:i A', 'm/d/Y g:i A', 'Y/m/d g:i A'];
     $config['system_themes'] = [];
     $config['custom_system_themes'] = [];
     $dir = new Dir(__DIR__ . '/../../data/themes');
     foreach ($dir->getFiles() as $file) {
         if ($file != 'index.html') {
             $config['system_themes'][$file] = $file;
         }
     }
     if (isset($_SERVER['DOCUMENT_ROOT'])) {
         $dir = new Dir($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH . '/phire/themes');
         foreach ($dir->getFiles() as $file) {
             if ($file != 'index.html') {
                 $config['custom_system_themes'][$file] = $file;
             }
         }
     }
     sort($config['system_themes']);
     sort($config['custom_system_themes']);
     $this->data['config'] = $config;
     $this->data['modules'] = Table\Modules::findAll(['order' => 'id DESC', 'limit' => 5])->rows();
 }
Exemple #2
0
 /**
  * Constructor
  *
  * Instantiate a model object
  *
  * @param  array $data
  * @return self
  */
 public function __construct(array $data = [])
 {
     parent::__construct($data);
     $config = Table\Config::findById('social_config');
     if (isset($config->value) && !empty($config->value) && $config->value != '') {
         $cfg = unserialize($config->value);
         $this->data = array_merge($this->data, $cfg);
     }
 }