function show($meldung = '') { if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) { header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); } if ($_SESSION['uuid']) { $vars['uuid'] = $_SESSION['uuid']; } else { $vars['uuid'] = $_SESSION['uuid'] = General::uuid(); } $template = $this->system->login_template ? $this->system->login_template : INSTALL_PATH . '/Templates/Login.template.html'; $login_form = new Template($template); $meldungen = Template::get_all_parts($login_form->template); $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung; $vars['action'] = SELF_URL; if (isset($_GET['logout'])) { $vars['user'] = $_GET['logout']; $vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars); return Html::div($login_form->parse_template('FORM', $vars)); } if (!isset($_POST['user']) || !isset($_POST['pass'])) { $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN']; return Html::div($login_form->parse_template('FORM', $vars)); } else { $vars['meldung'] .= Html::br() . $meldungen['FAIL']; return Html::div($login_form->parse_template('FORM', $vars)); } }
function make_table($sql = '', $template = '') { $db_table = $this->table; $vars = is_array($this->template_vars) ? $this->template_vars : array(); $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'] : 0; if ($sql == '') { $sql = "SELECT * FROM `{$db_table}` ORDER BY `{$order_by}` {$order_dir}"; } $vars['pages'] = $this->get_pages($sql); $vars['page'] = $this->get_page(); if ($results_per_page || $start_by) { if (!$this->num_rows) { $num_rows = $this->num_rows = $this->connection->db_num_rows($sql); } else { $num_rows = $this->num_rows; } if (!$results_per_page) { $results_per_page = $num_rows; } $sql .= " LIMIT {$start_by},{$results_per_page}"; } $result = $this->connection->db_assoc($sql); $template = new Template($template); $return_string = ''; $return_string .= $template->parse_template('PRE', $vars); $alternatig_rows = 0; $loop_count = 0; $einzel = 0; $row = ''; for ($i = 0; $i < ($count = count($result)); $i++) { $loop_count++; $result[$i] = array_merge($vars, $result[$i]); foreach ($result[$i] as $key => $value) { if (is_array($this->cols_array[$key]['options'])) { $result[$i][$key] = $this->cols_array[$key]['options'][$value]; } if ($this->cols_array[$key]['type'] == 'timestamp') { $result[$i][$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : ''; } if ($this->cols_array[$key]['type'] == 'upload') { $result[$i][$key] = rawurlencode($value); } elseif (!$this->cols_array[$key]['html']) { $result[$i][$key] = htmlspecialchars($value); } } $result[$i]['alt_row'] = ' alt_row_' . $alternatig_rows; $return_string .= $template->parse_template('LOOP', $result[$i]); $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; //$einzel = ($einzel == $this->results_per_page-1) ? 0 : $einzel++; $einzel++; } $return_string .= $template->parse_template('POST', $vars); return $return_string; }
function show() { $page = new Template(INSTALL_PATH . '/Module/Kontakt/Kontakt.template.html'); $return_string = ''; $vars = array(); if (!$this->mail_sent) { $return_string .= $page->parse_template('Formular', $vars); } else { $return_string .= $page->parse_template('Danke', $vars); } return $return_string; }
function main() { global $db; if (isset($_REQUEST['id'])) { $result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1"); while ($row = $result->FetchNextObject()) { do_header(); $header = new Template(); $header->open_template('cheats_header'); $header->addvar('{id}', $row->ID); $header->addvar('{title}', stripslashes($row->TITLE)); $header->parse_template(); $header->print_template(); $cheats = $db->Execute("SELECT id,Modid,title,cheat FROM `Obsedb_cheats` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`"); while ($cheat = $cheats->FetchNextObject()) { // CHEAT HTML echo "<b>" . clean($cheat->TITLE) . "</b><br />\n \t\t\t " . stripslashes($cheat->CHEAT) . "<br /><br />"; // END CHEAT HTML } do_footer(); } } else { do_header(); echo "<b>System Error Message</b><br />"; echo "You cannot access this page directly, please go back and select a Mod.<br />"; echo "If the problem persists, please contact the webmaster."; do_footer(); } }
function view() { global $db; if (!is_numeric($_REQUEST['id'])) { die("Critical Error: Aborting script operations."); } $result = $db->Execute("SELECT * FROM Obsedb_companies WHERE id = {$_REQUEST['id']} LIMIT 1"); $company = array(); $company['title'] = stripslashes($result->fields['title']); $company['description'] = clean($result->fields['description']); if (!empty($result->fields['homepage'])) { $company['homepage'] = '<a href="' . stripslashes($result->fields['homepage']) . '" target="_blank">' . stripslashes($result->fields['homepage']) . '</a>'; } if (!empty($result->fields['logo'])) { $company['logo'] .= "<img src=\""; $company['logo'] .= stripslashes($result->fields['logo']); $company['logo'] .= "\" alt=\"" . $company['title'] . " align=\"right\" hspace=\"2\" vspace=\"2\">"; } $result = $db->Execute("\n\t\t\tSELECT id, title, section, developer\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE developer = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;"); while ($row = $result->FetchNextObject()) { $company['dev_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />'; } $result = $db->Execute("\n\t\t\tSELECT id, title, section, publisher\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE publisher = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;"); while ($row = $result->FetchNextObject()) { $company['pub_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />'; } do_header(); $template = new Template(); $template->open_template('company_profile'); $template->addvar('{title}', $company['title']); $template->addvar('{homepage}', $company['homepage']); $template->addvar('{logo}', $company['logo']); $template->addvar('{description}', $company['description']); $template->parse_template(); $template->print_template(); if (!empty($company['dev_links'])) { $company_profile_devlinks = new Template(); $company_profile_devlinks->open_template('company_profile_devlinks'); $company_profile_devlinks->addvar('{links}', $company['dev_links']); $company_profile_devlinks->parse_template(); $company_profile_devlinks->print_template(); } if (!empty($company['pub_links'])) { $company_profile_publinks = new Template(); $company_profile_publinks->open_template('company_profile_publinks'); $company_profile_publinks->addvar('{links}', $company['pub_links']); $company_profile_publinks->parse_template(); $company_profile_publinks->print_template(); } do_footer(); }
function show($meldung = '') { if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) { header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); } $vars['uuid'] = $_SESSION['uuid'] = General::uuid(); $template = $this->system->login_template ? $this->system->login_template : INSTALL_PATH . '/Templates/Login.template.html'; $login_form = new Template($template); $meldungen = Template::get_all_parts($login_form->template); $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung; $vars['action'] = SELF_URL; if (isset($_GET['logout'])) { $vars['user'] = $_GET['logout']; $vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars); } if (isset($_GET['recover'])) { if ($_POST['recover_submit']) { $email = General::input_clean($_POST['email'], true); foreach ($this->system->user_tables as $t) { $sql = "SELECT * FROM `{$t}` WHERE `E-Mail` = '{$email}'"; $result = $this->system->connection->db_single_row($sql); if ($result) { break; } } if ($result) { $mail = $login_form->parse_template('RECOVER_MAIL', $result); mail($result['E-Mail'], 'Ihr ' . PROJECT_NAME . ' Passwort', $mail, 'From: ' . PROJECT_NAME . '<noreply@' . preg_replace('/^www\\./i', '', $_SERVER['HTTP_HOST']) . '>'); return $login_form->parse_template('RECOVER_THANKYOU', $result); } else { return $login_form->parse_template('RECOVER_NOFOUND', $result); } } else { $vars['meldung'] = 'Bitte geben Sie Ihre E-Mail-Adresse ein: '; } return Html::div($login_form->parse_template('RECOVER_FORM', $vars)); } if (!isset($_POST['user']) || !isset($_POST['pass'])) { $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN']; return Html::div($login_form->parse_template('FORM', $vars)); } else { /*if ($this->check_login($system)) { //if (HTTPS) header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); } else {*/ $vars['meldung'] .= Html::br() . $meldungen['FAIL']; return Html::div($login_form->parse_template('FORM', $vars)); // } } }
function main() { global $db; // Get Mod Info if (isset($_REQUEST['id'])) { $result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1"); while ($row = $result->FetchNextObject()) { $cheats = $db->Execute("SELECT id,Modid FROM `Obsedb_cheats` WHERE Modid = {$_REQUEST['id']} LIMIT 1"); if ($cheats->RecordCount() >= 1) { $cheat_link = "<a href=\"cheats.php?id={$row->ID}\">Cheats</a>"; } else { $cheat_link = "Cheats"; } do_header(); $tplHeader = new Template(); $tplHeader->open_template('downloads_header'); $tplHeader->addvar('{title}', stripslashes($row->TITLE)); $tplHeader->addvar('{id}', $row->ID); $tplHeader->addvar('{cheat_link}', $cheat_link); $tplHeader->parse_template(); $tplHeader->print_template(); $downloads = $db->Execute("SELECT id,Modid,title,download FROM `Obsedb_downloads` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`"); while ($download = $downloads->FetchNextObject()) { // DOWNLOAD HTML echo "<a href='" . stripslashes($download->DOWNLOAD) . "'>" . clean($download->TITLE) . "</a><br /><br />"; // END DOWNLOAD HTML } $tplFooter = new Template(); $tplFooter->open_template('downloads_footer'); $tplFooter->parse_template(); $tplFooter->print_template(); do_footer(); } } else { do_header(); echo "<b>System Error Message</b><br />"; echo "You cannot access this page directly, please go back and select a Mod.<br />"; echo "If the problem persists, please contact the webmaster."; do_footer(); } }
function mailbag_main() { global $db; do_header(); $tplHeader = new Template(); $tplHeader->open_template('mailbag_header'); $tplHeader->print_template(); $tplItem = new Template(); $tplItem->open_template('mailbag_item'); $result = $db->Execute("SELECT * FROM `Obsedb_mailbag` ORDER BY `id` DESC"); while ($row = $result->FetchNextObject()) { $tplItem->addvar('{title}', stripslashes($row->TITLE)); $tplItem->addvar('{message}', clean($row->MESSAGE)); $tplItem->addvar('{reply}', clean($row->REPLY)); $tplItem->parse_template(); $tplItem->print_template(); } $tplFooter = new Template(); $tplFooter->open_template('mailbag_footer'); $tplFooter->print_template(); do_footer(); }
function ConstructPage($pObj) { $this->pObj = $pObj; $template = $pObj->page_props['Template']; $anc = array_reverse($pObj->page_props['Ancestors']); while (!$template && $anc) { $template = $anc[0]['Template']; array_shift($anc); } $template = $template ? $template : INSTALL_PATH . '/Templates/Default.template.html'; //$pObj->page_props['Module'] = 'Admin()'; $content = ($mod = $pObj->page_props['Module']) ? "{Modul:{$mod}}" : INSTALL_PATH . '/Content/' . $pObj->page_props['File'] . '/content.html'; $content = new Template($content, $this->pObj); $parsed_content = $content->parse_template('', $this->pObj->page_props); $this->pObj->page_props = $content->pObj->page_props; $this->pObj->page_props['MAIN_CONTENT'] = $parsed_content; $template = new Template($template, $this->pObj); $parsed_template = $template->parse_template('BODY', $this->pObj->page_props); $this->pObj->page_props = $template->pObj->page_props; $this->pObj->page_props['BODY'] = $parsed_template; print_r($this->pObj->page_props); //$head = $this->head(); return; }
function detail() { $id = $_GET['id']; $result_array = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>BuddyListe` WHERE `id`={$id}"); $page = new Template(INSTALL_PATH . '/Module/BuddyListe/Templates/Detail.template.html'); $vars = $result_array[0]; if ($vars['Bilder']) { $bilder_array = array(); $bilder_array = explode(';', $vars['Bilder']); $bilder_string = ''; foreach ($bilder_array as $bild) { $bilder_string .= '<img src="' . $bild . '" alt="Projektbild" />'; $vars['Bilder'] = $bilder_string; } } return $page->parse_template('TEMPLATE', $vars); }
function test_escape() { $t = new Template('UTF-8'); $this->assertEquals('one {{ two }} three', $t->parse_template('one \\{{ two \\}} three')); $this->assertEquals('one {" two "} three', $t->parse_template('one \\{" two \\"} three')); $this->assertEquals('one {" two "} three', $t->parse_template('one \\{\' two \\\'} three')); $this->assertEquals('one {% two %} three', $t->parse_template('one \\{% two \\%} three')); $this->assertEquals('one {! two !} three', $t->parse_template('one \\{! two \\!} three')); $this->assertEquals('one {# two #} three', $t->parse_template('one \\{# two \\#} three')); }
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; }
<?php global $spconfig; $limit = $spconfig['frontpage_popular_Mods_limit']; $counter = 0; $ModQuery = $db->Execute("\n SELECT g.id,g.title,p.title AS platform \n FROM Obsedb_Mods AS g, Obsedb_Mods_sections AS p \n WHERE g.section = p.id AND\n g.published = '1'\n ORDER BY g.views DESC\n LIMIT 0,{$limit};"); while ($row = $ModQuery->FetchNextObject()) { $counter++; $Mods .= "<div style=\"padding: 3px;\">\n" . " <a href=\"Moddetails.php?id={$row->ID}\"><b>" . stripslashes($row->TITLE) . "</b></a> " . "({$row->PLATFORM})"; } $frontpagePopularMods = new Template(); $frontpagePopularMods->open_template('frontpage_popular_Mods'); $frontpagePopularMods->addvar('{Mods}', $Mods); $frontpagePopularMods->parse_template(); $frontpagePopularMods->print_template(); // Clear Mods variable unset($Mods);
<?php // Template Information // ====================================================================== // This template displays a table of the newest Mods that // have been added to the site. // // You can alter the number of Mods displayed by changing // the limit in the SQL statement. The default limit is 10. // ====================================================================== global $spconfig; $limit = $spconfig['frontpage_latest_Mods_limit']; $result = $db->Execute("\n SELECT g.id,g.title,p.title AS platform \n FROM Obsedb_Mods AS g, Obsedb_Mods_sections AS p \n WHERE g.section = p.id AND\n g.published = '1'\n ORDER BY `id` DESC\n LIMIT 0,{$limit};"); while ($row = $result->FetchNextObject()) { $Mods .= "<div style=\"padding: 3px;\">" . "<b><a href=\"Moddetails.php?id={$row->ID}\">" . stripslashes($row->TITLE) . "</a></b> " . "(" . stripslashes($row->PLATFORM) . ")" . "</div>\n"; } $frontpageLatestMods = new Template(); $frontpageLatestMods->open_template('frontpage_latest_Mods'); $frontpageLatestMods->addvar('{Mods}', $Mods); $frontpageLatestMods->parse_template(); $frontpageLatestMods->print_template(); unset($Mods);
$Modlist_header->addvar('{title}', $label_title); $Modlist_header->addvar('{genre}', $label_genre); $Modlist_header->addvar('{release}', $label_release); $Modlist_header->addvar('{section}', $label_section); $Modlist_header->parse_template(); $Modlist_header->print_template(); unset($Modlist_header); $Modlist_row = new Template(); $Modlist_row->open_template('Modlist_row'); $result = $db->Execute($sql) or die($db->ErrorMsg()); while ($row = $result->FetchNextObject()) { $bgcolor = $bgcolor == "#FFFFFF" ? "#E9E9E9" : "#FFFFFF"; $section = stripslashes($sections["{$row->SECTION}"]); $publisher = stripslashes($companies["{$row->PUBLISHER}"]); $developer = stripslashes($companies["{$row->DEVELOPER}"]); $Modlist_row->addvar('{id}', $row->ID); $Modlist_row->addvar('{title}', stripslashes($row->TITLE)); $Modlist_row->addvar('{bgcolor}', $bgcolor); $Modlist_row->addvar('{section}', $section); $Modlist_row->addvar('{genre}', stripslashes($row->GENRE)); $Modlist_row->addvar('{release}', stripslashes($row->RELEASE_DATE)); $Modlist_row->parse_template(); $Modlist_row->print_template(); } unset($Modlist_row); $Modlist_footer = new Template(); $Modlist_footer->open_template('Modlist_footer'); $Modlist_footer->print_template(); unset($Modlist_footer); do_footer(); }
function test_escape() { $t = new Template('UTF-8'); $this->assertEquals('one {{ two }} three', $t->parse_template('one \\{{ two \\}} three')); }
function logged_in_message() { $template = new Template(INSTALL_PATH . '/Module/PageLogin/Login.template.html'); $vars['user'] = $_SESSION['RheinaufCMS_User']['Name']; return $template->parse_template('LOGGED_IN', $vars); }
function showlarge() { $this->noframe = true; $sql = "SELECT * FROM `{$this->db_table}` WHERE `id` = '" . $_GET['showlarge'] . "'"; $result = $this->connection->db_assoc($sql); $vars = $result[0]; $template = new Template(INSTALL_PATH . '/Module/LocationsFrontend/Templates/Bild.template.html'); return $template->parse_template('BIG_IMG', $vars); }
function make_form($edit = '', $action = null, $action_parameter_filter = array(), $template = null) { if ($edit) { $values = $this->get_entry($edit); $edit = is_array($edit) ? current($edit) : $edit; } $GLOBALS['scripts'] .= Html::script("onLoad.push(checkConditions);"); //$GLOBALS['scripts'] .= Html::script("onLoad.push(sizeTextAreas);"); $return = ''; $url = $action ? $action : SELF_URL; $url .= strstr($url, '?') ? '&' : '?'; $url .= $this->GET_2_url(array_merge(array('edit', 'new', 'noframe', 'reentry'), $action_parameter_filter)); //$url .= ($_GET['edit']) ? '#entry'.$_GET['edit'] : ''; $return .= Form::form_tag($url, 'post', 'multipart/form-data', array('onsubmit' => "loading();return checkform();")); $table = new Table(2, array('class' => 'scaffold')); $return .= $this->text_above_form; if ($this->show_buttons_above_form) { $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($this->show_cancel) { $input .= Form::add_input('button', 'cancel', 'Abbrechen', array('class' => 'button', 'onclick' => 'cancelEdit(this)')); } $table->add_td(array(array(2 => $input))); } foreach ($this->cols_array as $key => $col) { $name = $key; //$show_name = General::wrap_string($col['name'],30); $show_name = $col['name']; $show_name .= $col['required'] ? ' *' : ''; $id = 'input_' . $GLOBALS['input_id']; $encoded_name = rawurlencode($name); $attr_array = $col['attributes']; if ($col['disabled']) { $attr_array['disabled'] = 'disabled'; } else { if ($attr_array['disabled']) { unset($attr_array['disabled']); } } if ($this->re_entry || isset($_REQUEST['reentry']) && $_POST[$name]) { $value = $_POST[$name]; } else { if ($values[$key]) { $value = $values[$key]; } else { if ($col['value']) { $value = $col['value']; } else { $value = ''; } } } if (isset($col['options'])) { $options = $this->get_options($col['options'], $col['options_sort'], $col['options_insert_id']); if (!$col['options_hide_edit_button']) { $edit_options_btn = is_string($col['options']) && $this->edit_enabled ? Html::a("javascript:void(0);", 'Optionen bearbeiten', array('class' => 'button', 'onclick' => "window.open('" . SELF_URL . "?nomenu&editoptions={$encoded_name}','scaff_dialog','toolbar=no,menubar=yes,personalbar=no,width=500,scrollbars=yes,resizable=yes,modal=yes,dependable=yes');var refresh=document.getElementById('{$id}_refresh');refresh.style.display='';refresh.focus();return false;")) : ''; $edit_options_btn .= Form::add_input('submit', 'reentry', 'Aktualisieren', array('id' => $id . '_refresh', 'style' => 'display:none')); $edit_options_btn = Html::br() . $edit_options_btn; } } if ($name != 'id') { switch ($col['type']) { case 'text': $attr_array['id'] = $id; if (isset($col['length'])) { $attr_array['size'] = $field['length']; $attr_array['maxlength'] = $field['length']; } else { if (!stristr($attr_array['style'], 'width')) { $attr_array['style'] .= "width:{$this->input_width};"; } } if ($col['multiple']) { $input = Form::add_input('text', $encoded_name . '[]', $value, $attr_array); $info .= Html::a('javascript:void(0);', '+', array('onclick' => 'cloneInput(\'' . $id . '\')')); } else { $input = Form::add_input('text', $encoded_name, $value, $attr_array); } break; case 'select': $attr_array['id'] = $id; $select = new Select($encoded_name, array_merge($attr_array, array('onchange' => "selectOtherOption('{$id}','" . $col['other_option'] . "')"))); $select->add_option('', '--Bitte auswählen--'); $attr_array = array(); if (is_array($options)) { if (!in_array($value, $options) && !key_exists($value, $options)) { $col['other'] = $value; } foreach ($options as $option => $name) { if ($value == $option) { $attr_array['selected'] = 'selected'; } else { unset($attr_array['selected']); } $select->add_option($option, $name, $attr_array); } if ($col['other_option']) { if ($col['other']) { $attr_array['selected'] = 'selected'; } $attr_array['onclick'] = 'otherOption(this,\'' . rawurlencode($encoded_name) . '\')'; $select->add_option('', $col['other_option'], $attr_array); } else { unset($attr_array['onclick']); } } $input = $select->flush_select(); if ($col['other']) { $input .= Form::add_input('text', $encoded_name, $col['other'], array('onfocus' => "selectOtherOption('{$id}','" . $col['other_option'] . "')", 'id' => $id . '_other')); } $input .= $edit_options_btn; break; case 'radio': $attr_array['id'] = $id; $attr_array = array(); $input = ''; foreach ($options as $option => $name) { if ($value == $option) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } if (isset($col['condition'][$option])) { $condition = "{input:'" . $encoded_name . "',value:'" . $option . "',target:'" . $col['condition'][$option] . "'}"; $input .= Html::script("conditions.push({$condition})"); //$attr_array['onchange'] = "checkCondition($condition)"; } else { //unset($attr_array['onchange']); } if (isset($col['condition'])) { $attr_array['onchange'] = "checkCondition({$condition})"; } else { unset($attr_array['onchange']); } $input .= Form::add_input('radio', $encoded_name, $option, $attr_array) . ' ' . $name . Html::br(); } if ($col['condition']) { } $input .= $edit_options_btn; break; case 'check': $input = ''; if (!is_array($value)) { $value = explode('&delim;', $value); } foreach ($options as $option => $name) { if (is_array($value) && in_array($option, $value)) { $attr_array['checked'] = 'checked'; } else { unset($attr_array['checked']); } $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br(); } if ($col['other_option']) { $other = array_diff($value, $options); $input .= $col['other_option'] . ' ' . Form::add_input('text', $encoded_name . '[]', implode(', ', $other)) . Html::br(); } $input .= $edit_options_btn; $input = Html::div($input, array('id' => $id, 'name' => $encoded_name)); break; case 'textarea': $attr_array['id'] = $id; if ($col['attributes']['cols']) { $col['attributes']['cols']; } else { if (!stristr($attr_array['style'], 'width')) { $attr_array['style'] .= "width:{$this->input_width};"; } } $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10; if ($col['max_length']) { $attr_array['onkeydown'] = 'return maxLength(event,this,' . $col['max_length'] . ')'; } $input = Form::add_textarea($encoded_name, $value, $attr_array); //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')')); if ($col['max_length']) { $input .= Html::span("Noch " . Html::span($col['max_length'] - strlen($value), array('id' => $id . '_charsleft')) . " Zeichen"); } if ($col['options']) { $input .= Html::br() . $edit_options_btn; } if ($col['html']) { $this->xinha_scripts(); } break; case 'upload': $input = ''; $value = $values[$key]; $entries = array(); if (!is_array($value)) { $entries = explode('&delim;', $value); } else { $entries = $value; } $upload_folder = ''; if (is_string($this->upload_folder)) { $this->upload_folder = array($this->upload_folder); } foreach ($this->upload_folder as $col_name) { $upload_folder .= $values[$col_name]; } $upload_folder .= '/'; if (count(General::trim_array($entries)) > 0) { $subtable = new Table(3); foreach ($entries as $file) { $img_info = @getimagesize($this->upload_path . $upload_folder . $file); if ($img_info) { $thumb = Html::img(SELF_URL . '?img=' . rawurlencode($upload_folder . $file) . '&x=100', $file); } else { $thumb = ''; } $check = Form::add_input('hidden', $encoded_name . '[]', $file); $check .= Html::br() . Form::add_input('checkbox', $encoded_name . '_delfile[]', $file, array("onclick" => "confirmDelPic(this)")) . ' Datei löschen'; $subtable->add_td(array($thumb, $file . $check)); } $input .= $subtable->flush_table(); if ($col['upload_max_count']) { $input .= Html::span("Maximal " . $col['upload_max_count'] . " Dateien" . Html::br(), array('class' => 'klein')); } } if ($col['upload_max_count'] && count(General::trim_array($entries)) >= $col['upload_max_count']) { continue; } $attr_array['id'] = $id; //$input = ($value) ? $value.Form::add_input('hidden',$encoded_name,$value,$attr_array).Html::br().Html::span('Neue Datei verknüpfen:',array('class'=>'klein')).Html::br():''; $input .= Form::add_input('file', $encoded_name . '_upload[]'); // if ($col['upload_max_count']) // { $input .= Form::add_input('submit', 'reentry', 'Hochladen'); // } if ($col['upload_extensions']) { $input .= Html::br() . Html::span("Erlaubte Erweiterungen: " . implode(', ', $col['upload_extensions']), array('class' => 'klein')); } if ($col['upload_size']) { $input .= Html::br() . Html::span("Maximale Dateigröße: " . $col['upload_size'] . 'KB', array('class' => 'klein')); } break; case 'EFM': break; case 'custom': $input = $col['custom_input']; break; case 'timestamp': $this->calendar_script(); $attr_array['id'] = 'tag_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.'; $attr_array['id'] = 'monat_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.'; $attr_array['id'] = 'jahr_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . ' '; $attr_array['id'] = 'stunde_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':'; $attr_array['id'] = 'minute_' . $GLOBALS['input_id']; $attr_array['size'] = '2'; $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array); $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id)); $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id'])); $script = ' Calendar.setup( { inputField : "' . $id . '", // ID of the input field ifFormat : "%Y/%m/%d", // the date format button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button showsTime : false, timeFormat : "24", showOthers : true, onSelect : onSelect, onUpdate : onUpd, inputId : ' . $GLOBALS['input_id'] . ', prevInput : "test" } ); timefields.push("' . $id . '"); '; $input .= Html::script($script); break; case 'email': preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches); $name_value = trim($matches[1]); $mail_value = $matches[2]; $attr_array['id'] = 'name_' . $GLOBALS['input_id']; $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array); $attr_array['id'] = 'mail_' . $GLOBALS['input_id']; $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array); break; case 'info': $input = $col['value']; //$hidden_inputs .= Form::add_input('hidden',$encoded_name,$value,$attr_array); break; case 'hidden': $attr_array['id'] = $id; $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array); $input = ''; break; case 'ignore': unset($input); break; case 'changed': $input = Form::add_textarea('', $value, array("disabled" => "disabled")) . Form::add_input('hidden', $encoded_name, $value); break; } if ($col['required'] && $input) { if ($col['type'] == 'timestamp') { $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');"); $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');"); } else { $input .= Html::script("\nrequired_fields.push('{$id}');"); } } $alternatig_rows = $alternatig_rows == 1 ? 0 : 1; $td_atributes['class'] = ' alt_row_' . $alternatig_rows; if ($col['hidden']) { $td_atributes['style'] = 'display:none;'; } else { unset($td_atributes['style']); } if ($col['info']) { if (!$GLOBALS['toolTipScriptLoaded']) { $GLOBALS['scripts'] .= Html::script(null, array('src' => '/Libraries/ToolTip/ToolTip.js')); $GLOBALS['scripts'] .= Html::script('onLoad.push(toolTipOnLoad)'); $GLOBALS['toolTipScriptLoaded'] = true; } $trigger_id = 'info' . $GLOBALS['input_id']; $source_id = "tooltip" . $GLOBALS['input_id']; $info = ' ' . Html::img('/' . INSTALL_PATH . "/System/Scaffold/info.gif", strip_tags($col['info']), array('id' => $trigger_id, 'title' => strip_tags($col['info']))); $info .= Html::div($col['info'], array('id' => $source_id, "style" => "display:none")); $info .= Html::script("toolTips.push({trigger : '{$trigger_id}',source : '{$source_id}',className : 'tooltip'});"); } else { $info = ''; } if ($input) { $table->add_td(array(Form::add_label($id, $show_name) . $info, $input), $td_atributes); } ++$GLOBALS['input_id']; } } $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button')); if ($this->show_cancel) { if ($this->use_ajax) { $input .= Form::add_input('button', 'cancel', 'Abbrechen', array('class' => 'button', 'onclick' => 'cancelEdit(this)')); } else { $input .= Form::add_input('submit', 'cancel', 'Abbrechen', array('class' => 'button')); } } $input .= Form::add_input('hidden', 'edit_id', $edit ? $edit : ''); $input .= Form::add_input('hidden', 'submit', 'submit'); $input .= $hidden_inputs; $table->add_td(array(array(2 => $input))); $return .= $table->flush_table(); $return .= Form::close_form(); if ($template) { $t = new Template($template); $vars['form'] = $return; return $t->parse_template(null, $vars); } else { return $return; } }
function login($meldung = '', $navi = true) { $page = new Seite($this->path_information); $login_form = new Template(INSTALL_PATH . '/Templates/Login.template.html'); $meldungen = Template::get_all_parts($login_form->template); $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung; $vars['action'] = SELF; if (isset($_GET['logout'])) { $vars['user'] = $_GET['logout']; $vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars); } $vars['title'] = $this->seite != 'index' ? $this->rubrik . ' | ' . $this->seite : $this->rubrik; if ($navi) { $navi = new Navi($this->path_information, $this->navi); $vars['navi'] = $navi->rubriken(); } if (!isset($_POST['user']) || !isset($_POST['pass'])) { $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN']; die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars)); } else { if ($this->check_login()) { header("Location: " . 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); } else { die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars)); } } }
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 do_footer() { global $bottom; $footer = new Template(); $footer->open_template('footer'); $footer->addvar('{bottom}', $bottom); $footer->parse_template(); $footer->print_template(); }
$Mod->addvar('{publisher}', $publisher_link); $Mod->addvar('{genre}', stripslashes($row->GENRE)); $Mod->addvar('{release}', stripslashes($row->RELEASE_DATE)); $Mod->addvar('{multiplayer}', stripslashes($row->MULTIPLAYER)); $Mod->addvar('{custom_fields}', $customfields); $Mod->addvar('{platform}', $platform); $Mod->addvar('{system}', stripslashes($row->REQ_SYSTEM)); $Mod->addvar('{ram}', stripslashes($row->REQ_RAM)); $Mod->addvar('{video}', stripslashes($row->REQ_VIDEO)); $Mod->addvar('{space}', stripslashes($row->REQ_SPACE)); $Mod->addvar('{mouse}', stripslashes($row->REQ_MOUSE)); $Mod->addvar('{directx}', stripslashes($row->REQ_DIRECTX)); $Mod->addvar('{sound}', stripslashes($row->REQ_SOUND)); $Mod->addvar('{description}', clean($row->DESCRIPTION)); $Mod->addvar('{views}', stripslashes($row->VIEWS)); $Mod->parse_template(); $Mod->print_template(); build_matrix('Mods', $row->ID); if ($userinfo[id] == '0') { print "Please log in to post comments.<br />"; require_once "templates/login_form.inc.php"; } else { require_once "templates/Mods_postcomment.inc.php"; } $result = $db->Execute("SELECT id,Mod_id,username,date,comment FROM Obsedb_Mods_comments WHERE Mod_id = '{$id}' ORDER BY DATE_FORMAT(date,'%y%c%d%H%i%s')"); $x = 1; while ($row = $result->FetchNextObject()) { $row->DATE = strtotime($row->DATE); $row->DATE = date('M jS, Y g:i a', $row->DATE); if ($x == 1) { print "\n\t \t\t<div style=\"padding: 10px; background: #f5f5f5;\">\n\t \t\tby <b>{$row->USERNAME}</b> on {$row->DATE}<br />\n\t \t\t<font style='font-size: 10pt;line-height: 150%;'>{$row->COMMENT}</font></div>";
function parse_single($sql, $template) { $vars = is_array($this->template_vars) ? $this->template_vars : array(); $result = $this->connection->db_single_row($sql); $template = new Template($template); $return_string = ''; $result = array_merge($result, $vars); foreach ($result as $key => $value) { if (is_array($this->cols_array[$key]['options'])) { $result[$key] = $this->cols_array[$key]['options'][$value]; } if ($this->cols_array[$key]['type'] == 'timestamp') { $result[$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : ''; } if ($this->cols_array[$key]['type'] == 'upload') { $result[$key] = rawurlencode($value); } elseif (!$this->cols_array[$key]['html']) { $result[$key] = htmlspecialchars($value); } //if ($this->cols_array[$key]['type'] == 'textarea') //{ $result[$key] = nl2br($value); //} } $result['Dateiname'] = rawurlencode($result['Dateiname']); $result['alt_row'] = ' alt_row_' . $alternatig_rows; $result['Beschreibung_clipped'] = $this->clip_words($result['Beschreibung'], 200); $result['more'] = preg_match('/\\.\\.\\.$/s', $result['Beschreibung_clipped']) ? 'more' : ''; $return_string .= $template->parse_template('LOOP', $result); return $return_string; }
function kontakt() { $this->noframe = true; $cal_id = $_GET['Kontakt']; $cal_entry = $this->connection->db_single_row("SELECT * FROM `{$this->db_table}` WHERE `id` = '{$cal_id}'"); $empf = $cal_entry['CONTACT']; if (!class_exists('Kontakt')) { include_once 'Kontakt.php'; } $vars = array(); $cont = new Kontakt($empf); $vars['contact_form'] = $cont->show(); $page = new Template(INSTALL_PATH . '/Module/Kalender/Templates/Kontakt.template.html'); return $page->parse_template('', $vars); }
/** Load a module template **/ public function template($name, $vars = array(), $return = FALSE) { /* check module */ if (stripos($name, '_control')) { $base = 'controls/'; } else { $base = 'tpl/'; } list($path, $_file) = Modules::find(strtolower($name), $this->_module, $base); if ($path == FALSE) { if (stripos($name, '/')) { $tpl = $_file; } } else { $tpl = $path . $_file; } $objfile = APPPATH . './views/tpl_cache/' . str_replace('/', '_', $tpl) . '.php'; if (!file_exists($objfile)) { require_once APPPATH . 'libraries/Template' . EXT; $template = new Template($path); //$this->library('template')->parse_template($tpl); $template->parse_template($tpl); } $viewfile = 'tpl_cache/' . str_replace('/', '_', $tpl); return $this->view($viewfile, $vars, $return); }
function login($meldung = '', $template = '') { die('DEPRECATED LOGIN METHOD: ' . __FILE__ . ' ' . __LINE__); if (!isset($_SESSION)) { session_start(); } if (isset($_POST['user']) && isset($_POST['pass']) && $this->check_login()) { return true; } $vars['uuid'] = $_SESSION['uuid'] = General::uuid(); if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) { header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); } $page = new Seite($this, $template); $login_form = new Template(INSTALL_PATH . '/Templates/Login.template.html'); $meldungen = Template::get_all_parts($login_form->template); $vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung; $vars['action'] = SELF_URL; $vars['title'] = $this->seite != 'index' ? $this->rubrik . ' | ' . $this->seite : $this->rubrik; if ($navi) { $navi = new Navi($this); $vars['navi'] = $navi->rubriken(); } if (!isset($_POST['user']) || !isset($_POST['pass'])) { $vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN']; die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars)); } else { if ($this->check_login()) { //if (HTTPS) header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); header("Location: " . 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); } else { die($page->header($vars) . Html::div($login_form->parse_template('FORM', $vars)) . $page->footer($vars)); } } }
/** ------------------------------------- /** Class/Method handler /** -------------------------------------*/ function class_handler() { global $FNS, $TMPL, $DB, $PREFS; $classes = array(); // Fill an array with the names of all the classes that we previously extracted from the tags for ($i = 0; $i < count($this->tag_data); $i++) { // Should we use the tag cache file? if ($this->tag_data[$i]['cache'] == 'CURRENT') { // If so, replace the marker in the tag with the cache data $this->log_item("Tag Cached and Cache is Current"); $this->replace_marker($i, $this->get_cache_file($this->tag_data[$i]['cfile'])); } else { // Is a module or plug-in being requested? if (!in_array($this->tag_data[$i]['class'], $this->modules)) { if (!in_array($this->tag_data[$i]['class'], $this->plugins)) { global $LANG, $PREFS, $OUT; $this->log_item("Invalid Tag"); if ($PREFS->ini('debug') >= 1) { if ($this->tag_data[$i]['tagparts']['0'] == $this->tag_data[$i]['tagparts']['1'] && !isset($this->tag_data[$i]['tagparts']['2'])) { unset($this->tag_data[$i]['tagparts']['1']); } $error = $LANG->line('error_tag_syntax'); $error .= '<br /><br />'; $error .= htmlspecialchars(LD); $error .= 'exp:' . implode(':', $this->tag_data[$i]['tagparts']); $error .= htmlspecialchars(RD); $error .= '<br /><br />'; $error .= $LANG->line('error_fix_syntax'); $OUT->fatal_error($error); } else { return false; } } else { $classes[] = 'pi.' . $this->tag_data[$i]['class']; $this->log_item("Plugin Tag: " . ucfirst($this->tag_data[$i]['class']) . '/' . $this->tag_data[$i]['method']); } } else { $classes[] = $this->tag_data[$i]['class']; $this->log_item("Module Tag: " . ucfirst($this->tag_data[$i]['class']) . '/' . $this->tag_data[$i]['method']); } } } // Remove duplicate class names and re-order the array $classes = array_values(array_unique($classes)); // Dynamically require the file that contains each class $this->log_item("Including Files for Tag and Modules"); for ($i = 0; $i < count($classes); $i++) { // But before we do, make sure it hasn't already been included... if (!class_exists($classes[$i])) { if (substr($classes[$i], 0, 3) == 'pi.') { require_once PATH_PI . $classes[$i] . EXT; } else { require_once PATH_MOD . $classes[$i] . '/mod.' . $classes[$i] . EXT; } } } /** ----------------------------------- /** Only Retrieve Data if Not Done Before and Modules Being Called /** -----------------------------------*/ if (sizeof($this->module_data) == 0 && sizeof(array_intersect($this->modules, $classes)) > 0) { $query = $DB->query("SELECT module_version, module_name FROM exp_modules"); foreach ($query->result as $row) { $this->module_data[$row['module_name']] = array('version' => $row['module_version']); } } // Final data processing // Loop through the master array containing our extracted template data $this->log_item("Beginning Final Tag Data Processing"); reset($this->tag_data); for ($i = 0; $i < count($this->tag_data); $i++) { if ($this->tag_data[$i]['cache'] != 'CURRENT') { $this->log_item("Calling Class/Method: " . ucfirst($this->tag_data[$i]['class']) . "/" . $this->tag_data[$i]['method']); /* --------------------------------- /* Plugin as Parameter /* /* - Example: weblog="{exp:some_plugin}" /* - A bit of a hidden feature. Has been tested but not quite /* ready to say it is ready for prime time as I might want to /* move it to earlier in processing so that if there are /* multiple plugins being used as parameters it is only called /* once instead of for every single parameter. - Paul /* ---------------------------------*/ if (substr_count($this->tag_data[$i]['tag'], LD . 'exp') > 1 && isset($this->tag_data[$i]['params']['parse']) && $this->tag_data[$i]['params']['parse'] == 'inward') { foreach ($this->tag_data[$i]['params'] as $name => $param) { if (stristr($this->tag_data[$i]['params'][$name], LD . 'exp')) { $this->log_item("Plugin in Parameter, Processing Plugin First"); $TMPL2 = $FNS->clone_object($this); while (is_int(strpos($TMPL2->tag_data[$i]['params'][$name], LD . 'exp:'))) { $TMPL = new Template(); $TMPL->start_microtime = $this->start_microtime; $TMPL->template = $TMPL2->tag_data[$i]['params'][$name]; $TMPL->tag_data = array(); $TMPL->var_single = array(); $TMPL->var_cond = array(); $TMPL->var_pair = array(); $TMPL->plugins = $TMPL2->plugins; $TMPL->modules = $TMPL2->modules; $TMPL->parse_template(); $TMPL->class_handler(); $TMPL->loop_count = 0; $TMPL2->tag_data[$i]['params'][$name] = $TMPL->template; $TMPL2->log = array_merge($TMPL2->log, $TMPL->log); } foreach (get_object_vars($TMPL2) as $key => $value) { $this->{$key} = $value; } unset($TMPL2); $TMPL = $this; } } } /** --------------------------------- /** Nested Plugins... /** ---------------------------------*/ if (in_array($this->tag_data[$i]['class'], $this->plugins) && strpos($this->tag_data[$i]['block'], LD . 'exp:') !== false) { if (!isset($this->tag_data[$i]['params']['parse']) or $this->tag_data[$i]['params']['parse'] != 'inward') { $this->log_item("Nested Plugins in Tag, Parsing Outward First"); $TMPL2 = $FNS->clone_object($this); while (is_int(strpos($TMPL2->tag_data[$i]['block'], LD . 'exp:'))) { $TMPL = new Template(); $TMPL->start_microtime = $this->start_microtime; $TMPL->template = $TMPL2->tag_data[$i]['block']; $TMPL->tag_data = array(); $TMPL->var_single = array(); $TMPL->var_cond = array(); $TMPL->var_pair = array(); $TMPL->plugins = $TMPL2->plugins; $TMPL->modules = $TMPL2->modules; $TMPL->parse_template(); $TMPL->class_handler(); $TMPL->loop_count = 0; $TMPL2->tag_data[$i]['block'] = $TMPL->template; $TMPL2->log = array_merge($TMPL2->log, $TMPL->log); } foreach (get_object_vars($TMPL2) as $key => $value) { $this->{$key} = $value; } unset($TMPL2); $TMPL = $this; } } // Assign the data chunk, parameters // We moved the no_results_block here because of nested tags. The first // parsed tag has priority for that conditional. $this->tagdata = str_replace($this->tag_data[$i]['no_results_block'], '', $this->tag_data[$i]['block']); $this->tagparams = $this->tag_data[$i]['params']; $this->tagchunk = $this->tag_data[$i]['chunk']; $this->tagproper = $this->tag_data[$i]['tag']; $this->tagparts = $this->tag_data[$i]['tagparts']; $this->no_results = $this->tag_data[$i]['no_results']; $this->search_fields = $this->tag_data[$i]['search_fields']; /** ------------------------------------- /** Assign Sites for Tag /** -------------------------------------*/ $this->_fetch_site_ids(); /** ------------------------------------- /** Relationship Data Pulled Out /** -------------------------------------*/ // If the weblog:entries tag or search:search_results is being called // we need to extract any relationship data that might be present. // Note: This needs to happen before extracting the variables // in the tag so it doesn't get confused as to which entry the // variables belong to. if ($this->tag_data[$i]['class'] == 'weblog' and $this->tag_data[$i]['method'] == 'entries' or $this->tag_data[$i]['class'] == 'search' and $this->tag_data[$i]['method'] == 'search_results') { $this->tagdata = $this->assign_relationship_data($this->tagdata); } // Fetch the variables for this particular tag $vars = $FNS->assign_variables($this->tag_data[$i]['block']); if (count($this->related_markers) > 0) { foreach ($this->related_markers as $mkr) { if (!isset($vars['var_single'][$mkr])) { $vars['var_single'][$mkr] = $mkr; } } $this->related_markers = array(); } $this->var_single = $vars['var_single']; $this->var_pair = $vars['var_pair']; // Redundant see above loop for related_markers - R.S. //if ($this->related_id != '') //{ // $this->var_single[$this->related_id] = $this->related_id; // $this->related_id = ''; //} // Assign Conditional Variables if (!in_array($this->tag_data[$i]['class'], $this->native_modules)) { $this->var_cond = $FNS->assign_conditional_variables($this->tag_data[$i]['block'], SLASH, LD, RD); } // Assign the class name and method name $class_name = ucfirst($this->tag_data[$i]['class']); if ($class_name == 'Commerce') { // The Commerce module is special in that it has its own modules and its // constructor handles everything for us $meth_name = 'commerce'; } else { $meth_name = $this->tag_data[$i]['method']; } // Dynamically instantiate the class. // If module, only if it is installed... if (in_array($this->tag_data[$i]['class'], $this->modules) && !isset($this->module_data[$class_name])) { $this->log_item("Problem Processing Module: Module Not Installed"); } else { $this->log_item(" -> Class Called: " . $class_name); $EE = new $class_name(); } /** ---------------------------------- /** Does method exist? Is This A Module and Is It Installed? /** ----------------------------------*/ if (in_array($this->tag_data[$i]['class'], $this->modules) && !isset($this->module_data[$class_name]) or !method_exists($EE, $meth_name)) { global $LANG, $PREFS, $OUT; $this->log_item("Tag Not Processed: Method Inexistent or Module Not Installed"); if ($PREFS->ini('debug') >= 1) { if ($this->tag_data[$i]['tagparts']['0'] == $this->tag_data[$i]['tagparts']['1'] && !isset($this->tag_data[$i]['tagparts']['2'])) { unset($this->tag_data[$i]['tagparts']['1']); } $error = $LANG->line('error_tag_module_processing'); $error .= '<br /><br />'; $error .= htmlspecialchars(LD); $error .= 'exp:' . implode(':', $this->tag_data[$i]['tagparts']); $error .= htmlspecialchars(RD); $error .= '<br /><br />'; $error .= str_replace('%x', $this->tag_data[$i]['class'], str_replace('%y', $meth_name, $LANG->line('error_fix_module_processing'))); $OUT->fatal_error($error); } else { return; } } /* OK, lets grab the data returned from the class. First, however, lets determine if the tag has one or two segments. If it only has one, we don't want to call the constructor again since it was already called during instantiation. Note: If it only has one segment, only the object constructor will be called. Since constructors can't return a value just by initialializing the object the output of the class must be assigned to a variable called $this->return_data */ $this->log_item(" -> Method Called: " . $meth_name); if (strtolower($class_name) == $meth_name) { $return_data = isset($EE->return_data) ? $EE->return_data : ''; } else { $return_data = $EE->{$meth_name}(); } /** ---------------------------------- /** 404 Page Triggered, Cease All Processing of Tags From Now On /** ----------------------------------*/ if ($this->cease_processing === TRUE) { return; } $this->log_item(" -> Data Returned"); // Write cache file if needed if ($this->tag_data[$i]['cache'] == 'EXPIRED') { $this->write_cache_file($this->tag_data[$i]['cfile'], $return_data); } // Replace the temporary markers we added earlier with the fully parsed data $this->replace_marker($i, $return_data); // Initialize data in case there are susequent loops $this->var_single = array(); $this->var_cond = array(); $this->var_pair = array(); unset($return_data); unset($class_name); unset($meth_name); unset($EE); } } }