Ejemplo n.º 1
0
 /**
  * Default Action
  *
  * @return MVC\HTMLView
  */
 public function index()
 {
     if (file_exists($this->project . '/.htaccess') && file_exists($this->project . '/config.ini')) {
         apine_internal_redirect('/home');
     }
     if (!file_exists($this->project . '/.htaccess')) {
         $htaccess_parent = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->parent);
         // Load .htaccess templace
         ob_start();
         include_once $this->parent . '/Installation/htaccess_install.php';
         $content = ob_get_contents();
         ob_end_clean();
         // Create htaccess
         $file = fopen($this->project . '/.htaccess', 'x+');
         fwrite($file, $content);
         fclose($file);
     }
     if (Core\Request::is_get()) {
         $zones = timezone_identifiers_list();
         $locations = array();
         foreach ($zones as $zone) {
             $zone = explode('/', $zone);
             // 0 => Continent, 1 => City
             // Only use "friendly" continent names
             if ($zone[0] == 'Africa' || $zone[0] == 'America' || $zone[0] == 'Antarctica' || $zone[0] == 'Arctic' || $zone[0] == 'Asia' || $zone[0] == 'Atlantic' || $zone[0] == 'Australia' || $zone[0] == 'Europe' || $zone[0] == 'Indian' || $zone[0] == 'Pacific') {
                 if (isset($zone[1]) != '') {
                     if (!isset($locations[$zone[0]])) {
                         $locations[$zone[0]] = array("name" => $zone[0], 'zones' => array());
                     }
                     $locations[$zone[0]]['zones'][$zone[0] . '/' . $zone[1]] = array("code" => $zone[0] . '/' . $zone[1], "name" => str_replace('_', ' ', $zone[1]));
                 }
             }
         }
         //include $this->parent . '/Installation/locales.php';
         if (!class_exists('\\TinyTemplate\\Engine')) {
             $this->_view = new InstallView("Install APIne Framework", $this->parent . '/Views/install_view.html', $this->parent . '/Views/install_layout.html');
         } else {
             $this->_view = new HTMLView();
             $this->_view->set_title("Install APIne Framework");
             $this->_view->set_layout($this->parent . '/Views/install_layout');
             $this->_view->set_view($this->parent . '/Views/install_view');
         }
         $this->_view->set_param('timezones', $locations);
         $this->_view->set_param('locales', $this->locales);
     }
     return $this->_view;
 }