$cfgv) { foreach ($cfgv as $cfgfk=>$cfgfv) { $cfgfk = strtolower($cfgfk); $cfgf["{$cfgk}/{$cfgfk}"] = $cfgfv; } } $cfg = array_merge($cfg, $cfgf); require_once("$libpath/classes/db/class.mysql.php"); // Connect $mysql = new Mysql($cfg["db/hostname"], $cfg["db/database"], $cfg["db/username"], $cfg["db/password"]); $conn = $mysql->conn; $mysql->execute("SET NAMES UTF8"); $rs = $mysql->fetch("select * from config", true); foreach ($rs as $rsk) { if (!isset($cfg[$rsk["key"]])) $cfg_q[$rsk["key"]] = $rsk["value"]; } $cfg = array_merge($cfg, $cfg_q); $cfg["path"] = $base."/.."; //require_once("$libpath/classes/email/class.phpmailer.php"); require_once("$libpath/classes/validation/class.validator.php"); require_once("$libpath/classes/validation/class.formvalidator.php"); //require_once("$libpath/classes/email/class.mimemailer.php"); require_once("$libpath/classes/paging/class.paging.php"); require_once("$libpath/classes/templates/class.phpbbtemplate.php"); require_once("$libpath/common.inc.php"); require_once("$base/common.inc.php"); $template = new Template ($cfg["path"].'/templates'); ########################### $files = array ( 'header' => 'header.tpl', 'footer' => 'footer.tpl', 'forfatter' => 'forfatter.tpl', 'index' => 'index.tpl', 'forfatterregister' => 'forfatterregister.tpl', 'omoss' => 'omoss.tpl', 'personlig' => 'personlig.tpl', 'skrivestua' => 'skrivestua.tpl', 'ordtak' => 'ordtak.tpl', 'ordtakregister' => 'ordtakregister.tpl', 'fritekstsok' => 'fritekstsok.tpl', 'batforerproven' => 'batforerproven.tpl', 'ferdige-taler' => 'ferdige-taler.tpl', 'personlig-tale' => 'personlig-tale.tpl', 'konfirmasjonstaler' => 'konfirmasjonstaler.tpl', 'bryllupstaler' => 'bryllupstaler.tpl', 'konfirmasjonssanger' => 'konfirmasjonssanger.tpl', 'bryllupssanger' => 'bryllupssanger.tpl', 'taleguiden' => 'taleguiden.tpl', 'forloverboken' => 'forloverboken.tpl', 'forloverboka' => 'forloverboka.tpl', 'tips-til-talen' => 'tips-til-talen.tpl', 'emne' => 'emne.tpl', 'emneregister' => 'emneregister.tpl', 'sitat' => 'sitat.tpl', //search templates // search by quote in all quotes and ordtak quotes 'quote' => 'quote.tpl', //template for no results page 'no_results' => 'no_results.tpl', // for search author 'authors' => 'authors.tpl', // for search author 'forfatterregister_all' => 'forfatterregister_all.tpl', ); $template->set_filenames($files); ########################### $stat_ordtak = $mysql->q("SELECT COUNT(*) as num FROM quotes"); $stat_forfatter = $mysql->q("SELECT COUNT(*) as num FROM authors WHERE lastname!='Ordtak'"); if (($cfg["dayquotetime"]+86400)q("SELECT * FROM quotes ORDER BY RAND()"); $mysql->execute("UPDATE config SET value='".$quote["id"]."' WHERE `key`='dayquoteid'"); $mysql->execute("UPDATE config SET value='".time()."' WHERE `key`='dayquotetime'"); } $day_quote = $mysql->q("SELECT * FROM quotes WHERE id='".$cfg["dayquoteid"]."'"); $day_quote_author = $mysql->q("SELECT * FROM authors WHERE id='".$day_quote["authorid"]."'"); $sql = "SELECT * FROM cats_stat, cats WHERE cats_stat.cat_id=cats.id ORDER by cats_stat.count desc LIMIT 5"; $cats = $mysql->fetch($sql); foreach ($cats as $key=>$cat){ $vars["cat{$key}_id"] = $cat['id']; $vars["cat{$key}_name"] = $cat['name']; } $sql = "SELECT * FROM authors_stat, authors WHERE authors_stat.author_id=authors.id ORDER by authors_stat.count desc LIMIT 5"; $authors = $mysql->fetch($sql); foreach ($authors as $key=>$author){ $vars["author{$key}_id"] = $author['id']; $vars["author{$key}_firstname"] = $author['firstname']; $vars["author{$key}_lastname"] = $author['lastname']; } $sql = "SELECT * FROM last_keywords ORDER by search_date DESC LIMIT 5"; $keywords = $mysql->fetch($sql); foreach ($keywords as $key=>$keyword){ //$vars["keyword{$key}_id"] = $keyword['id']; $vars["keyword{$key}_keyword"] = $keyword['keyword']; $vars["keyword{$key}_search_type"] = $keyword['search_type']; } $vars["stat_ordtak"] = $stat_ordtak["num"]; $vars["stat_emner"] = $stat_emner["num"]; $vars["stat_forfatter"] = $stat_forfatter["num"]; $vars["day_quote"] = $day_quote["quote"]; $vars["day_firstname"] = $day_quote_author["firstname"]; $vars["day_lastname"] = $day_quote_author["lastname"]; $template->assign_vars($vars); ob_start(); $template->pparse("header"); $params["header"] = ob_get_contents(); ob_end_clean(); ob_start(); $template->pparse("footer"); $params["footer"] = ob_get_contents(); ob_end_clean(); $alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ?>