function template($assign_array, $file) { global $smarty; $path_parts = pathinfo($file); if (substr(strrchr($file, "."), 1) != "tpl") { $tpl_file = 'includes' . substr($path_parts['dirname'], strpos($path_parts['dirname'], 'includes') + 8) . "/" . basename($path_parts['basename'], '.' . $path_parts['extension']) . '.tpl'; } else { $tpl_file = $file; } reset_smarty(); $smarty->assign($assign_array); return $smarty->fetch($tpl_file); }
$vars = array_merge_recursive($vars, $config); include_once $vars['templates']['path'] . $vars['templates']['default'] . '/config.php'; $vars = array_merge($vars, $template_config); include_once ROOT_PATH . "globals/functions.php"; $php_start = getmicrotime(); include_once ROOT_PATH . "globals/classes/mysql.php"; include_once ROOT_PATH . "globals/classes/construct.php"; include_once ROOT_PATH . "globals/classes/form.php"; include_once ROOT_PATH . "globals/classes/table.php"; if (!file_exists($vars['smarty']['class'])) { die("WiND error: Cannot find Smarty lib. Please check config.php ..."); } include_once $vars['smarty']['class']; if ($vars['template']['version'] < $vars['info']['min_template_version'] || $vars['template']['version'] > $vars['info']['version']) { die("WiND error: Template version does not match."); } $smarty = new Smarty(); $smarty->template_dir = $vars['templates']['path'] . $vars['templates']['default'] . '/'; $smarty->plugins_dir = array($vars['templates']['path'] . $vars['templates']['default'] . '/plugins/', 'plugins'); $smarty->compile_dir = $vars['templates']['compiled_path'] . $vars['templates']['default'] . '/'; $smarty->register_modifier('stripslashes', 'stripslashes'); reset_smarty(); $construct = new construct(); if ($vars['mail']['smtp'] != '') { ini_set('SMTP', $vars['mail']['smtp']); ini_set('smtp_port', $vars['mail']['smtp_port']); } $db = new mysql($vars['db']['server'], $vars['db']['username'], $vars['db']['password'], $vars['db']['database']); if ($db->error) { die("WiND MySQL database error: {$db->error_report}"); }