function Template($template) { if (@RheinaufFile::is_file($template)) $this->template = RheinaufFile::get_file($template); else $this->template = $template; if (@RheinaufFile::is_file($snippet_pfad = INSTALL_PATH.'/Templates/Snippets.html')) { $this->snippets = $this->get_all_parts(file_get_contents($snippet_pfad)); } }
function create_tables() { include 'Config.inc.php'; $sql_file = RheinaufFile::get_file('tables.sql'); $connection = new RheinaufDB(); $connection->debug = false; preg_match_all('/.*?[^(]*;/ms', $sql_file, $sql_queries); foreach ($sql_queries[0] as $query) { if (!$connection->db_query($query) || mysql_error()) { print 'Fehler beim Datenbankzugriff. Installation abgebrochen<br />' . mysql_error(); return; } } $connection->db_query("INSERT INTO `RheinaufCMS>User` ( `Name`, `Login`, `Password`, `Group`) \r\n\t\t\t\t\t\t\t\tVALUES ( '" . $_POST['admin_name'] . "', '" . $_POST['admin_name'] . "', '" . $_POST['admin_pass'] . "', 'Admin')"); print 'Tabellen geschrieben<br />'; }
function revert() { $file = $_GET['revert']; $folder = $this->work_folder(); RheinaufFile::copy($folder . $file, $folder . 'content.html'); print RheinaufFile::get_file($folder . 'content.html'); if ($file == 'tmp.html') { RheinaufFile::unlink($folder . $file); } }
function htaccess_update() { $navi = $this->navi; $htaccess = RheinaufFile::get_file(DOCUMENT_ROOT . '.htaccess'); preg_match('!(.*?#--REWRITE_RULES--#).*?(#--/REWRITE_RULES--#)!s', $htaccess, $matches); $new_htaccess = "\n"; $regex_esc = '?*+()^$|[].'; $rubrik_key = 0; foreach ($navi as $entry) { $rubrik = addcslashes($this->path_encode($this->I18n_get_real($entry['Rubrik'])), $regex_esc); $page_key = 0; foreach ($entry['Subnavi'] as $sub_entry) { $seite = addcslashes($this->path_encode($this->I18n_get_real($sub_entry['Seite'])), $regex_esc); $new_htaccess .= 'RewriteRule ^' . $rubrik . '/' . $seite . ' CMSinit.php?r=' . $rubrik_key . '&s=' . $page_key . ' [L,NC,QSA]' . "\n"; $page_key++; } $new_htaccess .= 'RewriteRule ^' . $rubrik . ' CMSinit.php?r=' . $rubrik_key . '&s=0 [L,NC,QSA]' . "\n"; $rubrik_key++; } $new_htaccess = $matches[1] . $new_htaccess . $matches[2]; RheinaufFile::write_file(DOCUMENT_ROOT . '.htaccess', $new_htaccess); }
function Template($template) { if (@RheinaufFile::is_file($template)) $this->template = RheinaufFile::get_file($template); else $this->template = $template; }
function htaccess_update() { $navi = $this->navi; $htaccess = RheinaufFile::get_file(DOCUMENT_ROOT . '.htaccess'); preg_match('!(.*?#--REWRITE_RULES--#).*?(#--/REWRITE_RULES--#.*?)!s', $htaccess, $matches); $closed_urls = "\n"; $open_urls = "\n\n#Nach hinten offene URLs für Module mit beliebigen Unterseiten\n"; $regex_esc = '?*+()^$|[].'; $rubrik_key = 0; foreach ($navi as $entry) { $rubrik = addcslashes($this->path_encode($this->I18n_get_real($entry['Rubrik'])), $regex_esc); $page_key = 0; foreach ($entry['Subnavi'] as $sub_entry) { $seite = addcslashes($this->path_encode($this->I18n_get_real($sub_entry['Seite'])), $regex_esc); if ($seite == 'index') { continue; } $page_key++; $closed_urls .= 'RewriteRule ^' . $rubrik . '/' . $seite . '/$ CMSinit.php?r=' . $rubrik_key . '&s=' . $page_key . '&%{QUERY_STRING} [L,NC]' . "\n"; $open_urls .= 'RewriteRule ^' . $rubrik . '/' . $seite . ' CMSinit.php?r=' . $rubrik_key . '&s=' . $page_key . '&%{QUERY_STRING} [L,NC]' . "\n"; } $closed_urls .= 'RewriteRule ^' . $rubrik . '/$ CMSinit.php?r=' . $rubrik_key . '&s=0&%{QUERY_STRING} [L,NC]' . "\n"; $open_urls .= 'RewriteRule ^' . $rubrik . ' CMSinit.php?r=' . $rubrik_key . '&s=0&%{QUERY_STRING} [L,NC]' . "\n"; $rubrik_key++; } $new_htaccess = $matches[1] . $closed_urls . $open_urls . $matches[2]; RheinaufFile::write_file(DOCUMENT_ROOT . '.htaccess', $new_htaccess); }