foreach ($entries as $entry) { $tpl->SetCurrentBlock("eintrag"); $tpl->SetVariable("titel", $entry[title]); $tpl->SetVariable("date", $entry[date]); $tpl->SetVariable("entry_id", $entry[entry_id]); $tpl->ParseCurrentBlock("eintrag"); } } else { $headtpl->SetVariable("titel", "Data not found"); $error_message = "No Data found. Mistmistmist"; } } elseif ($_GET[action] == "tools") { if ($_SESSION[password] == $PASSWORD) { $headtpl->SetVariable("titel", "Tools"); $tpl->loadTemplatefile("tools.tpl.html", true, true); if ($entries = return_query("SELECT entry_id,title FROM enz_entries ORDER BY entry_id")) { foreach ($entries as $entry) { $tpl->SetCurrentBlock("eintrag"); $tpl->SetVariable("titel", $entry[title]); $tpl->SetVariable("entry_id", $entry[entry_id]); $tpl->ParseCurrentBlock("eintrag"); } } } else { $headtpl->SetVariable("titel", "Login"); $tpl->loadTemplatefile("login.tpl.html", true, false); } } elseif ($_GET[action] == "logout") { $headtpl->SetVariable("titel", "Logging out"); unset($_SESSION[password]); unset($_SESSION);
function update_crosslinks($entry) { // do word-replacement if ($all_words = return_query("SELECT entry_id,title FROM enz_entries")) { foreach ($all_words as $word) { if ($word[title] != $entry[title]) { $entry[text] = ereg_replace(" {$word['title']} ", " <a href=\"index.php?action=entry&id=" . $word[entry_id] . "\">>" . $word[title] . "</a> ", $entry[text]); } } } // andere ersetzungen // URLS $entry = preg_replace("`(http|ftp)+(s)?:(//)((\\w|\\.|\\-|_)+)(/)?(\\S+)?`i", "<a href=\"\\0\" target=\"_blank\">\\4</a>", $entry); return $entry; }