function module_table()
 {
     $this->installed = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Module` WHERE `SYSTEM` = 0 ORDER BY `id` ASC");
     $this->available_modules = RheinaufFile::dir_array(INSTALL_PATH . '/Module', false, 'php');
     foreach ($this->available_modules as $module) {
         $class_name = preg_replace('/\\.php/', '', $module);
         if ($module != 'Navi.php') {
             if (RheinaufFile::is_file(INSTALL_PATH . '/Module/' . $class_name . '/Install.php')) {
                 include_once INSTALL_PATH . '/Module/' . $class_name . '/Install.php';
                 $class_name .= 'Install';
             } else {
                 include_once $module;
             }
         }
         if (is_callable(array($class_name, 'about'))) {
             eval('$module_about = ' . $class_name . '::about();');
             switch ($module_about['type']) {
                 case 'inPage':
                     $this->inPageModules[] = $module_about;
                     break;
                 case 'installable':
                     $this->installableModules[] = $module_about;
                     break;
             }
         }
     }
     $return_string = '';
     $this->return .= Html::h(3, 'Installierbare Module');
     $table = new Table(2);
     $table->add_th(array('Installierbare Module', 'Installierte Module'));
     $form = new Form();
     $form->form_tag(SELF_URL);
     $installed_modules = array();
     foreach ($this->installed as $installed) {
         $installed_modules[] = $installed['Name'];
     }
     $installables_select = new Select('installable', array('size' => '10', 'style' => 'width:150px'));
     foreach ($this->installableModules as $modul) {
         if (!in_array($modul['Name'], $installed_modules)) {
             $installables_select->add_option(rawurlencode($modul['Name']), $modul['Name']);
         }
     }
     $installed_select = new Select('installed', array('size' => '10', 'style' => 'width:150px'));
     foreach ($installed_modules as $modul) {
         $installed_select->add_option(rawurlencode($modul), $modul);
     }
     $table->add_td(array($installables_select->flush_select(), $installed_select->flush_select()));
     $install_submit = Form::add_input('submit', 'install', 'Installieren');
     $uninstall_submit = Form::add_input('submit', 'uninstall', 'Deinstallieren');
     $table->add_td(array($install_submit, $uninstall_submit), array('style' => 'text-align:center'));
     $form->add_custom($table->flush_table());
     $this->return .= $form->flush_form();
     $this->return .= Html::h(3, 'Aufruf über Template');
     $table = new Table(2, array('style' => 'width:500px'));
     $table->add_th(array('Modul', 'Einbindung'));
     foreach ($this->inPageModules as $module) {
         $table->add_td(array(Html::bold($module['Name']), $module['Usage']));
     }
     $this->return .= $table->flush_table();
 }
 function ls($path = '')
 {
     $return = '';
     $list_dirs = RheinaufFile::dir_array($this->start_folder . $path, true);
     $ul = new HtmlList();
     natcasesort($list_dirs);
     foreach ($list_dirs as $dir) {
         $url = $path . '/' . $dir;
         $ul->add_li($this->dir_link($url, $dir) . $this->ls($url));
     }
     if (!$this->show_only_folders) {
         $list_files = RheinaufFile::dir_array($this->start_folder . $path, false);
         natcasesort($list_files);
         foreach ($list_files as $file) {
             $url = $path . '/' . $file;
             $ul->add_li($this->file_link($url, $file));
         }
     }
     return $ul->flush_list();
 }
 function frontend_module_table()
 {
     $this->frontend_not_installed = RheinaufFile::dir_array(INSTALL_PATH . '/Module', false, 'php');
     $return_string = '';
     $table = new Table(1);
     $table->add_caption('Frontend-Module');
     $installed_modules = array();
     foreach ($this->frontend_installed as $installed) {
         $installed_modules[] = $installed['Name'];
     }
     foreach ($this->frontend_not_installed as $not_installed) {
         $not_installed = preg_replace('#(.*?).php$#', "\$1", $not_installed);
         if (!in_array($not_installed, $installed_modules)) {
             $table->add_td(array('<em>' . $not_installed . '</em>' . Html::a('/Admin/Module?newfrontend=' . rawurlencode($not_installed), '&gt;&gt;', array('title' => 'Installieren'))));
         }
     }
     foreach ($this->frontend_installed as $installed) {
         $table->add_td(array($installed['Name']));
     }
     $this->return .= $table->flush_table();
 }
 function ls()
 {
     $return = '';
     if ($_GET['list']) {
         $array = split('/', $_GET['list']);
         array_pop($array);
         $return .= Html::a(SELF . '?list=' . implode('/', $array) . "#{$this->list_id}", 'Eine Ebene höher<br />');
     }
     $list_dirs = RheinaufFile::dir_array($this->start_folder . $this->list_path, true);
     natcasesort($list_dirs);
     for ($i = 0; $i < count($list_dirs); $i++) {
         $return .= Html::a(SELF . '?list=' . $this->list_path . '/' . $list_dirs[$i] . "#{$this->list_id}", $this->icons['folder'] . ' ' . $list_dirs[$i]) . '<br />';
     }
     $list_files = RheinaufFile::dir_array($this->start_folder . $this->list_path, false);
     natcasesort($list_files);
     for ($i = 0; $i < count($list_files); $i++) {
         $return .= $this->file_link($this->start_folder . $this->list_path . '/' . $list_files[$i], $list_files[$i]) . '<br />';
     }
     if (count($list_dirs) == 0 && count($list_files) == 0) {
         $return .= 'Verzeichnis ist leer';
     }
     return $return;
 }
 function scan()
 {
     if ($_POST['Dateiname']) {
         $this->scaff->db_insert();
         $meldung = 'Datei ' . $_POST['Dateiname'] . ' gespeichert.';
     }
     $db_files = $this->connection->db_assoc("SELECT `Dateiname` FROM `{$this->db_table}`");
     $scanned_files = RheinaufFile::dir_array($this->filepath, false, 'jpg');
     $existent_files = array();
     foreach ($db_files as $entry) {
         $existent_files[] = $entry['Dateiname'];
     }
     $new_files = array();
     foreach ($existent_files as $file) {
         if (!in_array($file, $scanned_files)) {
             $this->connection->db_query("DELETE FROM `{$this->db_table}` WHERE `Dateiname`='{$file}'");
         }
     }
     foreach ($scanned_files as $file) {
         if (!in_array($file, $existent_files)) {
             $new_files[] = $file;
         }
     }
     if (count($new_files) == 0) {
         return 'Keine neuen Bilder';
     }
     $this->scaff->cols_array['Dateiname']['type'] = 'info';
     $this->scaff->cols_array['Dateiname']['value'] = $new_files[0];
     $this->scaff->cols_array['delete']['type'] = 'custom';
     $this->scaff->cols_array['delete']['custom_input'] = Html::a(SELF . "?delete_file=" . $new_files[0], 'Datei löschen', array('class' => 'button', 'onclick' => "return confirm('Datei löschen?');"));
     $this->maxscale($this->filepath . $new_files[0]);
     $this->make_thumbs($new_files[0]);
     return $meldung . Html::div($this->scaff->make_form(), array('style' => 'float:left')) . Html::div(Html::img(SELF . '/InputPreview?img=' . $new_files[0]));
 }
 function save()
 {
     $folder = $this->work_folder();
     $contents = General::utf_8_decode($_POST['editor_text']);
     $contents = $this->strip_baseURL($contents);
     if (!RheinaufFile::is_dir($folder)) {
         RheinaufFile::mkdir($folder);
         RheinaufFile::chmod($folder, '0777');
     }
     RheinaufFile::write_file($folder . Date::now() . ".html", $contents);
     if (RheinaufFile::is_file($folder . 'tmp.html')) {
         RheinaufFile::unlink($folder . 'tmp.html');
     }
     $files = RheinaufFile::dir_array($folder, false, 'html');
     rsort($files, SORT_NUMERIC);
     while (count($files) > 10) {
         $f = end($files);
         if ($f != 'content.html') {
             RheinaufFile::delete($folder . $f);
         }
         array_pop($files);
     }
     if (RheinaufFile::write_file($folder . "content.html", $contents)) {
         $saved = 'true';
         $as = isset($_REQUEST['workingversion']) ? ' als Arbeitsversion' : ' als Liveversion';
         $message = 'Gespeichert' . $as;
     } else {
         $saved = 'false';
         $message = 'Beim Speichern ist ein Fehler aufgetreten.\\nBitte versuchen Sie es noch einmal.\\nSollte sich das Problem nicht beheben lassen, melden Sie es bitte dem Administrator.';
     }
     die("{'saved':{$saved},'message':'{$message}'};");
 }
 function save()
 {
     $folder = $this->work_folder();
     $contents = General::utf_8_decode($_POST['editor_text']);
     $contents = $this->strip_baseURL($contents);
     if (!is_dir($folder)) {
         RheinaufFile::mkdir($folder);
         RheinaufFile::chmod($folder, '0777');
     }
     RheinaufFile::write_file($folder . Date::now() . ".html", $contents);
     if (is_file($folder . 'tmp.html')) {
         unlink($folder . 'tmp.html');
     }
     $files = RheinaufFile::dir_array($folder, false, 'html');
     rsort($files, SORT_NUMERIC);
     while (count($files) > 5) {
         RheinaufFile::delete($folder . end($files));
         array_pop($files);
     }
     RheinaufFile::write_file($folder . "content.html", $contents);
     print 'Fertig';
 }
 function get_names()
 {
     return RheinaufFile::dir_array(DOCUMENT_ROOT . INSTALL_PATH . $this->gal_path, false, '.jpg');
 }