function write_file() { $snippets = $this->connection->db_assoc("SELECT * FROM `{$this->db_table}`"); $string = ''; foreach ($snippets as $snippet) { $name = $snippet['Name']; $data = trim($snippet['Content']); $string .= "<!--{$name}-->\n{$data}\n<!--/{$name}-->\n"; } RheinaufFile::write_file(INSTALL_PATH . '/Templates/Snippets.html', $string); }
function create_config() { $config_file = file_get_contents('Config.inc.php'); $config_file = preg_replace("/(define\\('PROJECT_NAME',').*?('\\))/", "define('PROJECT_NAME','{$this->project_name}')", $config_file); $config_file = preg_replace("/(define\\('DB_SERVER',').*?('\\))/", "define('DB_SERVER','{$this->db_server}')", $config_file); $config_file = preg_replace("/(define\\('DB_NAME',').*?('\\))/", "define('DB_NAME','{$this->db_name}')", $config_file); $config_file = preg_replace("/(define\\('DB_USER',').*?('\\))/", "define('DB_USER','{$this->db_user}')", $config_file); $config_file = preg_replace("/(define\\('DB_PASS',').*?('\\))/", "define('DB_PASS','{$this->db_pass}')", $config_file); $config_file = preg_replace("/(define\\('FTP_SERVER',').*?('\\))/", "define('FTP_SERVER','{$this->ftp_server}')", $config_file); $config_file = preg_replace("/(define\\('FTP_USER',').*?('\\))/", "define('FTP_USER','{$this->ftp_user}')", $config_file); $config_file = preg_replace("/(define\\('FTP_PASS',').*?('\\))/", "define('FTP_PASS','{$this->ftp_pass}')", $config_file); $config_file = preg_replace("/(define\\('FTP_ROOTDIR',').*?('\\))/", "define('FTP_ROOTDIR','{$this->ftp_root}')", $config_file); define('USE_FTP', true); define('FTP_SERVER', $this->ftp_server); define('FTP_USER', $this->ftp_user); define('FTP_PASS', $this->ftp_pass); define('FTP_ROOTDIR', $this->ftp_root); include_once 'System/RheinaufFile.php'; $this->docroot = docroot(); return RheinaufFile::write_file($this->docroot . $this->install_path . '/Config.inc.php', $config_file); }
function copy($old_name, $new_name) { $old_name = RheinaufFile::get_enc($old_name); $new_name = RheinaufFile::get_enc($new_name); if (defined('USE_FTP') && USE_FTP === true) { $old_file = file_get_contents($old_name); RheinaufFile::write_file($new_name, $old_file); } else { copy($old_name, $new_name); } }
function make_table($sql = '', $template = '', $make_template = false) { $db_table = $this->table; $vars = is_array($this->template_vars) ? $this->template_vars : array(); if ($this->edit_enabled) { if ($_GET['delete']) { $this->connection->db_query("DELETE FROM `{$db_table}` WHERE `id` = " . $_GET['delete']); } } if ($this->result_array) { $result = $this->result_array; } else { $order_by = $this->order_by ? $this->order_by : 'id'; $order_dir = $this->order_dir ? $this->order_dir : 'ASC'; $results_per_page = $this->results_per_page ? $this->results_per_page : ''; $start_by = $_GET['start'] ? $_GET['start'] : ($_GET['start'] = 0); $where = array(); foreach ($this->enable_search_for as $spalte) { if ($_GET[$spalte]) { $value = General::input_clean($_GET[$spalte], true); $where[] = "`{$spalte}` {$this->search_method} '{$value}'"; } } $where = $where ? "WHERE " . implode($this->search_combinate, $where) : ''; $group_by = $this->group_by ? "GROUP BY `{$this->group_by}`" : ''; if ($sql == '') { $sql = "SELECT * FROM `{$db_table}` {$where} {$group_by} ORDER BY `{$order_by}` {$order_dir}"; } if ($results_per_page || $start_by) { $num_rows = $this->num_rows = $this->connection->db_num_rows($sql); if (!$results_per_page) { $results_per_page = $num_rows; } $sql .= " LIMIT {$start_by},{$results_per_page}"; } $result = $this->result = $this->connection->db_assoc($sql); } if (!$template || $make_template) { $head = ''; $body = ''; foreach ($this->cols_array as $key => $col) { $type = $col['type']; $name = $col['name']; if ($type != 'ignore' && $type != 'hidden') { //$new_template .= "{IfNotEmpty:$key(<tr><td>$name</td><td>[$key]</td></tr>)}\n"; $head .= "<th>{$name}</th>"; $body .= "<td>{If:{$key}}</td>"; } } $new_template = ''; $new_template .= "<!--PRE-->\n<table>\n<thead>{$head}<td></td></thead>\n<tbody><!--/PRE-->\n"; $new_template .= "<!--LOOP-->\n<tr class=\"{If:alt_row}\">{$body}<td>{If:edit_btns}</td></tr>\n<!--/LOOP-->\n"; $new_template .= "<!--POST-->\n</tbody></table>\n<!--/POST-->\n"; if ($make_template) { RheinaufFile::write_file($template, $new_template); } $template = $new_template; } $template = new Template($template); $return_string = ''; $return_string .= $template->parse_template('PRE', $vars); $alternatig_rows = 0; foreach ($result as $entry) { $entry = array_merge($vars, $entry); foreach ($entry as $key => $value) { if (is_array($this->cols_array[$key]['options'])) { $entry[$key] = $this->cols_array[$key]['options'][$value]; } if ($this->cols_array[$key]['type'] == 'timestamp') { $entry[$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : ''; } if ($this->cols_array[$key]['type'] == 'upload') { $entry[$key] = rawurlencode($value); } elseif (!$this->cols_array[$key]['html']) { $entry[$key] = htmlspecialchars($value); } if ($this->cols_array[$key]['type'] == 'textarea') { $entry[$key] = nl2br($value); } if ($transform = $this->cols_array[$key]['transform']) { eval('$entry[$key] =' . $transform); } } if ($this->edit_enabled) { $icons['edit'] = Html::img('/' . INSTALL_PATH . '/Libraries/Icons/16x16/edit.png', ''); $icons['delete'] = Html::img('/' . INSTALL_PATH . '/Libraries/Icons/16x16/cancel.png', ''); $btns['edit'] = Html::a(SELF . '?edit=' . $entry['id'], $icons['edit'], array('title' => 'Eintrag bearbeiten')); $btns['delete'] = Html::a(SELF . '?delete=' . $entry['id'], $icons['delete'], array('title' => 'Eintrag löschen', 'onclick' => 'return delete_confirm(\'' . $entry['id'] . '\')')); $entry['edit_btns'] .= implode(' ', $btns); } $entry['alt_row'] = ' alt_row_' . $alternatig_rows; $return_string .= $template->parse_template('LOOP', $entry); $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; } $return_string .= $template->parse_template('POST', $vars); return $return_string; }
function save_tmp() { $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 . "tmp.html", $contents); print 'Gespeichert'; }
function copy($old_name, $new_name) { if (USE_FTP) { $old_file = file_get_contents($old_name); RheinaufFile::write_file($new_name, $old_file); } else { copy($old_name, $new_name); } }
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 make_table($where = '', $template = '', $make_template = false, $table_direction = 'horizontal') { $db_table = $this->table; $vars = is_array($this->template_vars) ? $this->template_vars : array(); if ($this->edit_enabled && $this->enable_events) { if (isset($_GET['editoptions']) && !$this->options_editor) { return $this->edit_options(); } if (isset($_GET['delete'])) { $this->delete_entry(); } if ($_GET['edit']) { return $this->make_form($_GET['edit']); } if (isset($_POST['edit_id'])) { $this->db_insert($_POST['edit_id']); } if (isset($_REQUEST['reentry'])) { return $this->make_form($_POST['edit_id'] ? $_POST['edit_id'] : $this->last_insert_id); } if (isset($_GET['new'])) { return $this->make_form(); } } if ($this->enable_events) { if (isset($_GET['getSuggestions'])) { return $this->getSuggestions(); } } if (isset($_GET['img'])) { $this->img_thumb(); } if (isset($this->result_array)) { $result = $this->result_array; } else { $order_by = $this->order_by ? $this->order_by : 'id'; if ($_GET['dir'] == 'desc') { $order_dir = 'DESC'; } else { if ($_GET['dir'] == 'asc') { $order_dir = 'ASC'; } else { $order_dir = $this->order_dir ? $this->order_dir : 'ASC'; } } if ($_GET['results_per_page']) { $results_per_page = $this->results_per_page = $_GET['results_per_page']; setcookie($this->results_per_page_cookie_name, $_GET['results_per_page'], 10000000000.0, '/'); } else { if ($_COOKIE[$this->results_per_page_cookie_name]) { $results_per_page = $this->results_per_page = $_COOKIE[$this->results_per_page_cookie_name]; } else { $results_per_page = $this->results_per_page; } } $results_per_page = General::input_clean($results_per_page, true); $start_by = $_GET['start'] ? $_GET['start'] : ($_GET['start'] = 0); $start_by = General::input_clean($start_by, true); foreach ($this->enable_search_for as $col) { if ($_GET[$col]) { $value = General::input_clean($_GET[$col], true); $search_method = $this->cols_array[$col]['search_method'] ? $this->cols_array[$col]['search_method'] : $this->search_method; switch ($search_method) { case '=': case '<': case '>': case '>=': case '<=': case 'LIKE': $where[] = "`{$col}` {$search_method} '{$value}'"; break; case 'LIKE %.%': $where[] = "`{$col}` LIKE '%{$value}%'"; break; case 'LIKE %.': $where[] = "`{$col}` LIKE '%{$value}'"; break; case 'LIKE .%': $where[] = "`{$col}` LIKE '{$value}%'"; break; } } } $where = $where ? "WHERE " . implode($this->search_combine, $where) : ''; $group_by = $this->group_by ? "GROUP BY `{$this->group_by}`" : ''; $order = $_GET['order'] ? rawurldecode($_GET['order']) : $order_by; $order = General::input_clean($order, true); if ($this->sql == '') { $sql = "SELECT * FROM `{$db_table}` {$where} {$group_by} ORDER BY `{$order}` {$order_dir}"; } else { $sql = $this->sql; } $num_rows = $this->num_rows = $this->connection->db_num_rows($sql); if (!$results_per_page) { $results_per_page = $this->results_per_page = $num_rows; } if ($results_per_page || $start_by) { $num_rows = $this->num_rows = $this->connection->db_num_rows($sql); if (!isset($_GET['allresults'])) { $sql .= " LIMIT {$start_by},{$results_per_page}"; } } /*if ($this->last_insert_id) { $sql = "SELECT * FROM `$db_table` $group_by ORDER BY `$order` $order_dir"; $result = $this->result = $this->connection->db_assoc($sql); for ($i = 0;$i<count($result);$i++) { if ($result[$i]['id'] == $this->last_insert_id) { $start_by = floor($i/$this->results_per_page) * $this->results_per_page; if ($start_by == $this->results_per_page) $start_by = 0; $url = SELF_URL.'?start='.$start_by.'&'.$this->GET_2_url(array('start')); $url = html_entity_decode($url); if (isset($_GET['noframe'])) $url .= '&noframe'; $url .= '#entry'.$this->last_insert_id; header("Location: $url"); exit; } } }*/ $result = $this->result = $this->connection->db_assoc($sql); } // now we have the result and can do things with it if (isset($_GET['export'])) { $this->export($result, 'id'); } if (!$template || $make_template) { $head = ''; $loop = ''; $alt_col = ''; $colspan = 0; foreach ($this->cols_array as $key => $col) { if ($key == 'id') { continue; } $type = $this->cols_array[$key]['type']; $button = '{' . $key . '_sort}'; if ($type != 'ignore' && $type != 'hidden') { $head .= "<th>{$button}</th>\n"; $loop .= "<td class=\"{$alt_col}{If:alt_row}\">{If:{$key}}</td>\n"; $alt_col = $alt_col !== '' ? '' : 'alt_col'; ++$colspan; } } $loop .= "<td class=\"{$alt_col}{If:alt_row}\">{If:edit_btns}</td>\n"; $loop = "<tr id=\"entry{id}\">\n{$loop}</tr>\n"; $search = count($this->enable_search_for) ? $this->search_form() : ''; $export_button = $this->show_export ? '<a href=\\"{SELF_URL}?export&allresults&{If:export_get_vars}\\"><img src=\\"/RheinaufCMS/System/Scaffold/icon_excel_doc.gif\\" alt=\\"Excel\\" title=\\"Ergebnisse als Excel-Tabelle speichern\\" /></a>' : ''; $new_template = ''; $new_template .= ' <!--PAGE_BROWSER--> <form method="get" action="{SELF_URL}" onsubmit="httpRequestSubmit(this);return false;"> {IfNotEmpty:prev_url(<a href="[prev_url]" class="button" onclick="httpRequestGET(\'[prev_url]&noframe\',setContent);return false">Zurück</a>)} {IfNotEmpty:next_url(<a href="[next_url]" class="button" onclick="httpRequestGET(\'[next_url]&noframe\',setContent);return false">Weiter</a>)} {If:new_btn} {num_entries} Einträge auf {num_pages} Seiten Zeige <input type="text" size="2" name="results_per_page" id="results_per_page" value="{results_per_page}" style="text-align:center"/> Einträge pro Seite <input type="submit" value="Aktualisieren" /> {If:results_per_page_get_vars} </form> <!--/PAGE_BROWSER-->'; $colspan_minus1 = $colspan - 1; $new_template .= "\r\n<!--PRE-->\r\n{$search}\r\n<table>\r\n<thead>\r\n<tr><td colspan=\"{$colspan_minus1}\">{page_browser}</td>\r\n<td>{$export_button} </td></tr>\r\n{IfNotEmpty:pagination(<tr><td colspan=\"{$colspan}\">Seite [pagination]</td></tr>)}\r\n<tr>{$head}</tr>\r\n</thead>\r\n<tbody>\r\n<!--/PRE-->\r\n<!--NO_RESULTS-->\r\n<tr><td colspan=\"{$colspan}\">Keine Einträge gefunden<td></tr>\r\n<!--/NO_RESULTS-->\r\n"; $new_template .= "<!--LOOP-->\n{$loop}\n<!--/LOOP-->\n"; $new_template .= "<!--POST-->\n</tbody><tfoot><tr><td colspan=\"{$colspan}\">{If:new_btn}</td></tr></tfoot></table>\n<!--/POST-->\n"; if ($make_template) { RheinaufFile::write_file($template, $new_template); } $template = $new_template; } $template = new Template($template); $return_string = ''; foreach ($this->enable_search_for as $search_field) { $vars[$search_field . "_search_value"] = $_GET[$search_field]; $vars['filter_get_vars'] = $this->GET_2_input(array_merge($this->enable_search_for, array('start'))); } if ($this->edit_enabled) { $icons['new'] = Html::img('/Libraries/Icons/16x16/edit_add.png', ''); $vars['new_btn'] = Html::a(SELF_URL . '?new&' . $this->GET_2_url(), $icons['new'] . 'Eintrag hinzufügen', array('title' => 'Eintrag hinzufügen', 'class' => 'button')); } $vars['set_filters'] = $this->get_filters("&"); $vars['export_get_vars'] = $this->GET_2_url(); $vars['num_pages'] = $pages = $this->get_pages(); $vars['num_entries'] = $num_rows; $vars['prev_url'] = ($prev = $this->prev_link()) ? SELF_URL . '?' . $prev . '&' . $this->GET_2_url('start') : ''; $vars['next_url'] = ($next = $this->next_link()) ? SELF_URL . '?' . $next . '&' . $this->GET_2_url('start') : ''; $vars['this_page'] = $this->get_page(); $vars['results_per_page_get_vars'] = $this->GET_2_input('results_per_page'); $vars['results_per_page'] = $results_per_page; $vars['page_browser'] = $template->parse_template('PAGE_BROWSER', $vars); $vars['pagination'] = $this->pagination(); foreach ($this->cols_array as $key => $value) { $name = $this->cols_array[$key]['name']; if ($_GET['order'] == $key) { if ($_GET['dir'] == 'asc') { $name .= '▲'; } else { $name .= '▼'; } //down $dir = $_GET['dir'] == 'desc' ? 'asc' : 'desc'; } else { if (!isset($_GET['order']) && $key == $this->order_by) { if ($this->order_dir == 'ASC') { $name .= '▲'; // up $dir = 'desc'; } else { $name .= '▼'; //down $dir = 'asc'; } } else { $dir = $this->order_dir == 'ASC' ? 'asc' : 'desc'; } } $vars[$key . '_sort'] = $this->make_btn_link(SELF_URL . '?' . $this->GET_2_url(array('order', 'dir')) . '&order=' . rawurlencode($key) . '&dir=' . $dir, $name, array('class' => 'button', 'style' => 'display:block')); } $return_string .= $template->parse_template('PRE', $vars); $alternatig_rows = 0; foreach ($result as $entry) { $entry = array_merge($vars, $entry); foreach ($entry as $key => $value) { $entry[$key . '_name'] = $this->cols_array[$key]['name']; if ($this->cols_array[$key]['options'] && ($this->cols_array[$key]['type'] == 'check' || $this->cols_array[$key]['type'] == 'radio' || $this->cols_array[$key]['type'] == 'select')) { $options[$key] = $this->get_options($this->cols_array[$key]['options'], $this->cols_array[$key]['options_sort'], $this->cols_array[$key]['options_insert_id']); $v = explode('&delim;', $value); $v = General::trim_array($v); $value = array(); foreach ($v as $k) { if ($options[$key][$k]) { $value[] = $options[$key][$k]; } else { $value[] = $k; } } $value = count($value) ? implode(', ', $value) : ''; } if ($this->cols_array[$key]['type'] == 'timestamp') { $value = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : ''; } if ($this->cols_array[$key]['type'] == 'upload') { $value = rawurlencode($value); } elseif ($this->cols_array[$key]['type'] != 'textarea') { $value = htmlspecialchars($value); } if ($this->cols_array[$key]['type'] == 'textarea' && !$this->cols_array[$key]['html']) { $value = nl2br(htmlspecialchars($value)); } if ($this->cols_array[$key]['max_length'] && strlen($value) > $this->cols_array[$key]['max_length']) { $value = General::clip_words($value, $this->cols_array[$key]['max_length']); } if ($transform = $this->cols_array[$key]['transform']) { if (is_callable($transform)) { $value = $transform($key, $value); } else { eval($transform); } } $entry[$key] = $value; } if ($this->edit_enabled) { $icons['edit'] = Html::img('/Libraries/Icons/16x16/edit.png', ''); $icons['delete'] = Html::img('/Libraries/Icons/16x16/cancel.png', ''); $entry['edit_btn_url'] = SELF_URL . '?edit=' . $entry['id'] . '&' . $this->GET_2_url(); $entry['delete_btn_url'] = SELF_URL . '?delete=' . $entry['id'] . '&' . $this->GET_2_url('delete', 'noframe'); $btns['edit'] = Html::a($entry['edit_btn_url'], $icons['edit'], array('title' => 'Eintrag bearbeiten')); $btns['delete'] = Html::a($entry['delete_btn_url'], $icons['delete'], array('title' => 'Eintrag löschen', 'onclick' => 'return delete_confirm(this,\'' . $entry['id'] . '\')')); $entry['edit_btn'] = $btns['edit']; $entry['delete_btn'] = $btns['delete']; $entry['edit_btns'] = implode(' ', $btns); } $entry['alt_row'] = ' alt_row_' . $alternatig_rows; $return_string .= $template->parse_template('LOOP', $entry); $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; } if (!count($result)) { $return_string .= $template->parse_template('NO_RESULTS', $vars); } $return_string .= $template->parse_template('POST', $vars); return $return_string; }
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); }
function make_table($sql = '', $template = '', $make_template = false) { $db_table = $this->table; $vars = is_array($this->template_vars) ? $this->template_vars : array(); if ($this->edit_enabled) { if ($_GET['delete']) { $this->connection->db_query("DELETE FROM `{$db_table}` WHERE `id` = " . $_GET['delete']); } } $order_by = $this->order_by ? $this->order_by : 'id'; $order_dir = $this->order_dir ? $this->order_dir : 'ASC'; $results_per_page = $this->results_per_page ? $this->results_per_page : ''; $start_by = $_GET['start'] ? $_GET['start'] : ($_GET['start'] = 0); if ($sql == '') { $sql = "SELECT * FROM `{$db_table}` ORDER BY `{$order_by}` {$order_dir}"; } if ($results_per_page || $start_by) { $num_rows = $this->num_rows = $this->connection->db_num_rows($sql); if (!$results_per_page) { $results_per_page = $num_rows; } $sql .= " LIMIT {$start_by},{$results_per_page}"; } $result = $this->connection->db_assoc($sql); if (!$template || $make_template) { $new_template = ''; $new_template .= "<!--PRE-->\n<table>\n<!--/PRE-->\n<!--LOOP-->\n"; foreach ($this->cols_array as $key => $col) { $type = $col['type']; $name = $col['name']; if ($type != 'ignore' && $type != 'hidden') { $new_template .= "{IfNotEmpty:{$key}(<tr><td>{$name}</td><td>[{$key}]</td></tr>)}\n"; } } $new_template .= "<!--/LOOP-->\n<!--POST-->\n</table>\n<!--/POST-->\n"; if ($make_template) { RheinaufFile::write_file($template, $new_template); } $template = $new_template; } $template = new Template($template); $return_string = ''; $return_string .= $template->parse_template('PRE', $vars); $alternatig_rows = 0; foreach ($result as $entry) { $month = Date::monat($entry['DTSTART']); if ($month_shown == $month) { $entry['MONTH_HEAD'] = ''; } else { $entry['MONTH_HEAD'] = $this->monate[intval($month)] . ' ' . Date::jahr($entry['DTSTART']); $month_shown = $month; } foreach ($entry as $key => $value) { if (is_array($this->cols_array[$key]['options'])) { $entry[$key] = $this->cols_array[$key]['options'][$value]; } if ($this->cols_array[$key]['type'] == 'timestamp') { $entry[$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : ''; } if (!$this->cols_array[$key]['html']) { $entry[$key] = Html::pcdata($entry[$key]); } } if ($this->edit_enabled) { $icons['edit'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit.png', ''); $icons['delete'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/cancel.png', ''); $btns['edit'] = Html::a(SELF . '?edit=' . $entry['id'], $icons['edit'], array('title' => 'Eintrag bearbeiten')); $btns['delete'] = Html::a(SELF . '?delete=' . $entry['id'], $icons['delete'], array('title' => 'Eintrag löschen', 'onclick' => 'return delete_confirm(\'' . $entry['id'] . '\')')); $entry['edit_btns'] .= implode(' ', $btns); } $entry['alt_row'] = ' alt_row_' . $alternatig_rows; $return_string .= $template->parse_template('LOOP', $entry); $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; } $return_string .= $template->parse_template('POST', $vars); return $return_string; }