Commit f13e1f9e authored by Imran Hussain's avatar Imran Hussain

Smarty 3

parent b9b770fd
......@@ -54,7 +54,7 @@ if (isset($_REQUEST['search']) && (trim($_REQUEST['search']) != "")) {
} else {
$mode = "taglist";
$smarty->assign("tags", $DB->GetAll("SELECT name FROM bookcategories"));
}
}
} elseif (isset($pathlist[$library_index + 1]) && is_numeric($pathlist[$library_index + 1])) {
// We're displaying a specific book
......@@ -115,7 +115,7 @@ if (isset($_REQUEST['search']) && (trim($_REQUEST['search']) != "")) {
$msgbody .= " {$book['title']} by {$book['author']} from the library.\n\n";
$msgbody .= "Visit https://$preferred_hostname$path to process this request.";
mail($librarian_mail, "Book Request", $msgbody);
$smarty->assign("checkout_request", true);
}
......@@ -123,7 +123,6 @@ if (isset($_REQUEST['search']) && (trim($_REQUEST['search']) != "")) {
$book['title'] = htmlentities2($book['title']);
$book['author'] = htmlentities2($book['author']);
$book['onloan'] = ($book['onloan'] == 't') ? true : false;
if (!isset($book['description'])) {
// no book description in the database, try using Amazon data
......@@ -152,7 +151,7 @@ if (isset($_REQUEST['search']) && (trim($_REQUEST['search']) != "")) {
if ($session->loggedin) {
$members = new Members;
$smarty->assign("memberlist", $members->getMemberList());
$secondary = $smarty->get_template_vars("secondary");
$secondary = $smarty->getTemplateVars("secondary");
$secondary .= $smarty->fetch('library-loan.tpl');
$smarty->assign("secondary", $secondary);
}
......
......@@ -131,7 +131,7 @@ if ($session->loggedin) {
}
$smarty->assign("stats", $stats);
$secondary = $smarty->get_template_vars("secondary");
$secondary = $smarty->getTemplateVars("secondary");
$secondary .= $smarty->fetch("banana-leaders.tpl");
$smarty->assign("secondary", $secondary);
......@@ -148,7 +148,6 @@ if ($session->loggedin) {
$smarty->assign("public_members", $public_usernames);
}
$smarty->assign('url', $component['path']);
$smarty->assign('extra_styles', "/css/members.css");
$result = $smarty->fetch('members.tpl');
......
......@@ -128,7 +128,7 @@ if (!$session->loggedin) {
}
$folders = load_folders();
$smarty->assign_by_ref("folders", $folders);
$smarty->assignByRef("folders", $folders);
$smarty->assign("extra_styles", array("/css/forum/SUCS.css"));
unset($mode);
......
<?php
error_reporting(E_STRICT);
// Display execution time?
//$displaytime = TRUE;
......@@ -29,8 +30,8 @@ require("../lib/error.php");
// Include the Smarty templating engine
define('SMARTY_DIR', '/usr/share/php/smarty3/');
require("/usr/share/php/smarty3/SmartyBC.class.php");
$smarty = new SmartyBC();
require("/usr/share/php/smarty3/Smarty.class.php");
$smarty = new Smarty();
$smarty->setTemplateDir($base."templates");
$smarty->setCompileDir($base."templates_c");
$smarty->addPluginsDir($base."plugins");
......@@ -53,7 +54,7 @@ $sucsDB->SetFetchMode(ADODB_FETCH_ASSOC);
// Include the session library
require($base."lib/session.php");
$session = new Session;
$smarty->assign_by_ref("session", $session);
$smarty->assignByRef("session", $session);
// include feedback form stuff
......@@ -115,7 +116,7 @@ if (isset($_SERVER['PATH_INFO'])) {
// Determine which component to run
$pathlist = explode('/', parse_url($pathinfo,PHP_URL_PATH));
while (end($pathlist) === "") array_pop($pathlist);
$smarty->assign_by_ref("pathlist", $pathlist);
$smarty->assignByRef("pathlist", $pathlist);
$path = '';
$query = "select * from pagemap where path='/' ";
$params = array();
......@@ -130,7 +131,7 @@ foreach($pathlist as $item) {
}
// Determine the path of the request
$smarty->assign_by_ref("path", $path);
$smarty->assignByRef("path", $path);
$query .= "order by depth desc";
$pagemap = $DB->GetAll($query, $params);
......
......@@ -26,8 +26,8 @@ if (isset($session->groups[$permission])) {
if (trim ($_POST['why']) !== "") {
$number = intval($_POST['number']);
$why = $_POST['why'];
$why = $_POST['why'];
if ( abs($number) <= $maxbanana ){
$DB->Query("INSERT INTO awards (username, score, whn, who, why) VALUES (?,?,NOW(),?,?)", array($who, $number, $session->username, $why));
......@@ -39,14 +39,14 @@ if (isset($session->groups[$permission])) {
} else {
trigger_error("No reason entered for the awarding of bananas.", E_USER_WARNING);
}
}
}
} elseif ($session->loggedin) {
if ($_REQUEST['action'] == "award") {
$number = intval($_POST['number']);
$why = $_POST['why'];
$why = $_POST['why'];
// Send a mail to someone about them bananas
// Send a mail to someone about them bananas
$msgbody = $session->username." thinks $who deserves $number bananas:\r\n";
$msgbody .= "\"$why\"\r\n\r\nVisit https://sucs.org/Community/Members/$who if you want to make an award.";
mail($contact, "Banana Award Nomination", $msgbody, $msgheaders);
......@@ -56,7 +56,7 @@ if (isset($session->groups[$permission])) {
}
$secondary = $smarty->get_template_vars("secondary");
$secondary = $smarty->getTemplateVars("secondary");
$secondary .= $smarty->fetch('banana-award.tpl');
$smarty->assign('secondary', $secondary);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment