Exemple #1
0
 */
/**
 * Check PHP version
 */
if (version_compare(phpversion(), '5.0.0', '<') === true) {
    die('ERROR: Your PHP version is ' . phpversion() . '. GioCMS requires PHP 5.0.0 or newer.');
}
@session_start();
ini_set("display_errors", 1);
error_reporting(E_ALL);
date_default_timezone_set('Asia/Saigon');
define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('ROOT_DIR', dirname(__FILE__));
define('CONFIG_DIR', ROOT_DIR . DS . 'configs');
define('TEMP_DIR', ROOT_DIR . DS . 'temp');
define('TEMPLATE_DIR', ROOT_DIR . DS . 'templates');
define('LIB_DIR', ROOT_DIR . DS . 'libraries');
define('MOD_DIR', ROOT_DIR . DS . 'modules');
set_include_path(PS . LIB_DIR . DS . 'htmlpurifier' . PS . get_include_path());
require LIB_DIR . DS . 'gio' . DS . 'core' . DS . 'AutoLoader.php';
require LIB_DIR . DS . 'PEAR' . DS . 'Services' . DS . 'JSON.php';
/**
 * Set Exception Handler
 */
set_exception_handler(array('Gio_Core_Exception', 'exception'));
/**
 * Register plugin
 */
Gio_Core_Application::getInstance()->registerPlugin('Modules_Core_Controllers_Plugins_OfflineMessage')->registerPlugin('Modules_Core_Controllers_Plugins_AdminAuth')->registerPlugin('Modules_Core_Controllers_Plugins_RuleChecker')->registerPlugin('Modules_Core_Controllers_Plugins_HookLoader')->run();
Exemple #2
0
 public function step1Action()
 {
     /**
      * Remove all plugins
      */
     Gio_Core_Application::getInstance()->removePlugins();
     if (Gio_Core_Application::_initInstallChecker()) {
         $this->redirect($this->view->url('core_index_index'));
     }
     $this->setTemplate('admin');
     $this->setLayout('install');
     $request = $this->getRequest();
     $configs = Gio_Core_Config_Xml::getConfig();
     $request = Gio_Core_Request::getInstance();
     if ((string) $configs->web->url != $request->getBaseUrl()) {
         $configs->server->static = $request->getBaseUrl();
         $configs->server->resource = $request->getBaseUrl();
         $configs->web->url = $request->getBaseUrl();
     }
     $this->view->configs = $configs;
     $timezone = array('timezone' => array('date' => (string) $configs->timezone->date, 'datetime' => (string) $configs->timezone->datetime));
     $localization = array('localization' => array('enable' => (string) $configs->localization->enable, 'languages' => array('default' => (string) $configs->localization->languages->default, 'list' => (string) $configs->localization->languages->list, 'details' => array())));
     if ($configs->localization->languages->list != null) {
         $list = explode(',', $configs->localization->languages->list);
         foreach ($list as $value) {
             $localization['localization']['languages']['details'][$value] = (string) $configs->localization->languages->details->{$value};
         }
     }
     $languagesFile = ROOT_DIR . DS . 'configs' . DS . 'languages.xml';
     if (!file_exists($languagesFile)) {
         return;
     }
     $languagesXml = @simplexml_load_file($languagesFile);
     if (null == $languagesXml) {
         return;
     }
     $locales = array();
     foreach ($languagesXml->language as $language) {
         $arr = explode('|', $language);
         $locales[$arr[0]] = array('code' => $arr[0], 'localName' => $arr[1], 'englishName' => $arr[2]);
     }
     $this->view->locales = $locales;
     if ($request->isPost()) {
         $act = $request->getPost('act');
         switch ($act) {
             case 'testdbconn':
                 $this->setNoRender();
                 $this->disableLayout();
                 $this->_testdbconn();
                 break;
             case '':
             default:
                 $configs = $request->getPost('configs');
                 $data = Modules_Core_Services_Installer::validate($configs);
                 if (isset($data['messages_error']) && $data['messages_error']) {
                     $this->view->errorMessages = $data['messages'];
                     $configs = Gio_Core_Array::toObject($configs);
                     $this->view->configs = $configs;
                     return;
                 }
                 $install = array('install' => array('version' => Gio_Core_Cms::getVersion(), 'date' => date('Y-m-d H:i:s'), 'author' => Gio_Core_Cms::getAuthor()));
                 $configs = array_merge($configs, $install);
                 $configs = array_merge($configs, $localization);
                 $configs = array_merge($configs, $timezone);
                 $content = utf8_decode(Gio_Core_Array::toXml($configs, 'config'));
                 $fileName = Gio_Core_Config_Xml::getConfigFile();
                 Gio_Core_File::writeToFile($fileName, $content);
                 $adminInfo = array('username' => 'admin', 'password' => '123456', 'email' => '*****@*****.**', 'fullname' => 'Ninhgio');
                 Modules_Core_Services_Installer::install(false, $adminInfo);
                 $this->redirect($this->view->url('core_index_index'));
                 break;
         }
     }
 }