コード例 #1
0
 /**
  * Installtion, Erstellen von Datenbanktabellen ausfuehren 
  *
  * *Description* 
  * 
  * @param string
  *
  * @return 
  */
 public function runInstallation()
 {
     // Array Message
     $successInstallation = array('error' => NULL, 'message' => 'Successfully Insert in Table');
     // durchlaufe Array mit MySQL-Query Create Table
     foreach (parent::dbStrukture() as $table => $query) {
         // Lösche Tabelle
         $this->db->query('DROP TABLE IF EXISTS ' . TBL_PRFX . $table);
         // Neue Tabelle in Datenbank erstellen
         if ($this->db->query($query['create'])) {
             // durchlaufe Array mit MySQL-Query Insert Into
             $stmt = $this->db->prepare($query['insert']);
             foreach ($this->arrData[$table] as $arrExec) {
                 $insertTable = $stmt->execute($arrExec);
             }
             // Meldung Eintrag erfolgreich
             if ($insertTable) {
                 $successInstallation = array('error' => false, 'message' => $successInstallation['message'] . ' +' . $table);
             } else {
                 // Fehlermeldung Abbruch bei Tabelle ...
                 $successInstallation = array('error' => true, 'message' => 'Insert canceled at Table ' . $table);
             }
         } else {
             // Fehlermeldung Abbruch bei Tabelle ...
             $successInstallation = array('error' => true, 'message' => 'Create canceled at Table ' . $table);
             break;
         }
     }
     if (!$successInstallation['error']) {
         $robots = PROJECT_ROOT . 'robots.txt';
         if (file_exists($robots)) {
             unlink($robots);
         }
         $sitemap = URL_REWRITING ? \Controller\Helpers::getHost() . '/sitemap.xml' : \Controller\Helpers::getHost() . '/xml.php?site=sitemap';
         $datei = fopen($robots, 'w');
         fwrite($datei, "Sitemap: " . $sitemap . "\r\n\r\nUser-agent: *\r\nDisallow:", 100);
         fclose($datei);
     }
     return $successInstallation;
 }
コード例 #2
0
 /**
  * Dateiname aus URL holen
  *
  * *Description* Übergebene GET Parameter aus URI verarbeiten
  *
  * @param string
  *
  * @return string
  */
 private function realURL($uri = NULL)
 {
     $this->page = MAINPAGE;
     if (empty($uri)) {
         $site = isset($this->request['site']) ? $this->request['site'] : NULL;
     } else {
         $site = $uri;
     }
     if (!empty($site) and $this->chkinst) {
         $path_parts = pathinfo($site);
         $categorys = $this->isCategory($path_parts['dirname']);
         $is_site = $this->isSite($path_parts['filename']);
         if (isset($path_parts['extension']) and $is_site and $path_parts['extension'] == EXTENSION and URL_REWRITING and empty($categorys)) {
             $this->response->modifyHeader('status', 200);
             $this->page = $path_parts['filename'];
         } elseif ($is_site and !URL_REWRITING and empty($categorys)) {
             $this->response->modifyHeader('status', 200);
             $this->page = $path_parts['filename'];
         } else {
             $this->page = 'error';
             // Weiterleitung 404 Fehlerseite
             if ($this->isSite($this->page)) {
                 $filename = \Controller\Helpers::buildLink($this->page);
             } else {
                 $filename = \Controller\Helpers::getHost() . '/';
             }
             // Set 404 response code
             $this->response->modifyHeader('status', 404, TRUE);
             $this->response->modifyHeader('location', $filename, TRUE);
         }
         // Weiterleitung Fehlerseite oder Admin
         if ($this->page == 'admin') {
             $this->response->modifyHeader('status', 301, TRUE);
             $this->response->modifyHeader('location', \Controller\Helpers::getHost() . '/admin.php', TRUE);
         }
     }
     //Page als globale Variable verfügbar machen
     \Controller\Helpers::setGlobals('Page', $this->page);
 }