diff --git a/.gitignore b/.gitignore index 6bfc4ca..f335e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ src/templates_c src/item_images - +**/.*.swp diff --git a/src/admin.php b/src/admin.php index 91ae062..6267664 100644 --- a/src/admin.php +++ b/src/admin.php @@ -20,7 +20,7 @@ $opt = $smarty->opt(); session_start(); if (!isset($_SESSION["userid"])) { - header("Location: " . getFullPath("login.php")); + header("Location: " . getFullPath("login.php") . "?from=admin.php"); exit; } else if ($_SESSION["admin"] != 1) { @@ -31,56 +31,79 @@ else { $userid = $_SESSION["userid"]; } +if (isset($_GET["familyid"])) { + $familyid = filter_var(trim($_GET["familyid"]), FILTER_SANITIZE_NUMBER_INT); + + if (filter_var($familyid, FILTER_SANITIZE_NUMBER_INT) === false || $familyid == "" || !is_numeric($familyid) || $familyid < 0) { + die("Invalid familyid ({$_GET["familyid"]})"); + } +} + +if (isset($_GET["userid"])) { + $userid = filter_var(trim($_GET["userid"]), FILTER_SANITIZE_NUMBER_INT); + + if (filter_var($userid, FILTER_SANITIZE_NUMBER_INT) === false || $userid == "" || !is_numeric($userid) || $userid < 0) { + die("Invalid userid ({$_GET["userid"]})"); + } +} + $action = $_GET["action"]; if ($action == "approve") { $pwd = generatePassword($opt); - if ($_GET["familyid"] != "") { + if ($familyid != "") { $stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}memberships(userid,familyid) VALUES(?, ?)"); - $stmt->bindValue(1, (int) $_GET["userid"], PDO::PARAM_INT); - $stmt->bindValue(2, (int) $_GET["familyid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $userid, PDO::PARAM_INT); + $stmt->bindValue(2, (int) $familyid, PDO::PARAM_INT); $stmt->execute(); } $stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}users SET approved = 1, password = {$opt["password_hasher"]}(?) WHERE userid = ?"); $stmt->bindParam(1, $pwd, PDO::PARAM_STR); - $stmt->bindValue(2, (int) $_GET["userid"], PDO::PARAM_INT); + $stmt->bindValue(2, (int) $userid, PDO::PARAM_INT); $stmt->execute(); - + // send the e-mails $stmt = $smarty->dbh()->prepare("SELECT username, email FROM {$opt["table_prefix"]}users WHERE userid = ?"); - $stmt->bindValue(1, (int) $_GET["userid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $userid, PDO::PARAM_INT); $stmt->execute(); if ($row = $stmt->fetch()) { mail( $row["email"], "Gift Registry application approved", - "Your Gift Registry application was approved by " . $_SESSION["fullname"] . ".\r\n" . - "Your username is " . $row["username"] . " and your password is '$pwd'.\r\n" . - "Log in to https://wishlist.erdelynet.com/ and change your password under\r\n" . - "Update Profile as soon as possible.", + "Your Gift Registry application was approved.\r\n" . + "Your username is {$row["username"]} and your password is '$pwd'.\r\n" . + "Log in to {$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}/ and change your password under " . + "'Update Profile' (menu at the top/right of the page) as soon as possible.\r\n" . + "\r\n" . + "There is a browser bookmarklet at {$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}/help.php\r\n" . + "\r\n" . + "Once you've logged in, you can see the people you can shop for under 'Available People To Shopping For'. " . + "Click on the icon next to each person you want to shop for to see their lists.\r\n" . + "\r\n" . + "If you have any questions or problems, email {$opt['email_from']}.\r\n", "From: {$opt["email_from"]}\r\nReply-To: {$opt["email_reply_to"]}\r\nX-Mailer: {$opt["email_xmailer"]}\r\n" - ) or die("Mail not accepted for " . $row["email"]); + ) or die("Mail not accepted for " . $row["email"]); } - header("Location: " . getFullPath("index.php")); + header("Location: " . getFullPath("families.php")); exit; } else if ($action == "reject") { // send the e-mails $stmt = $smarty->dbh()->prepare("SELECT email FROM {$opt["table_prefix"]}users WHERE userid = ?"); - $stmt->bindValue(1, (int) $_GET["userid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $userid, PDO::PARAM_INT); $stmt->execute(); if ($row = $stmt->fetch()) { mail( $row["email"], "Gift Registry application denied", - "Your Gift Registry application was denied by " . $_SESSION["fullname"] . ".", + "Your Gift Registry application was denied.", "From: {$opt["email_from"]}\r\nReply-To: {$opt["email_reply_to"]}\r\nX-Mailer: {$opt["email_xmailer"]}\r\n" - ) or die("Mail not accepted for " . $row["email"]); + ) or die("Mail not accepted for " . $row["email"]); } $stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}users WHERE userid = ?"); - $stmt->bindValue(1, (int) $_GET["userid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $userid, PDO::PARAM_INT); $stmt->execute(); - + header("Location: " . getFullPath("index.php")); exit; } diff --git a/src/categories.php b/src/categories.php index d9a5df6..eaabe8f 100644 --- a/src/categories.php +++ b/src/categories.php @@ -20,7 +20,7 @@ $opt = $smarty->opt(); session_start(); if (!isset($_SESSION["userid"])) { - header("Location: " . getFullPath("login.php")); + header("Location: " . getFullPath("login.php") . "?from=categories.php"); exit; } else if ($_SESSION["admin"] != 1) { @@ -31,38 +31,50 @@ else { $userid = $_SESSION["userid"]; } if (!empty($_GET["message"])) { - $message = $_GET["message"]; + $message = filter_var(trim($_GET["message"], FILTER_SANITIZE_STRING));; + $message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); } +$haserror = false; +$error_message = ""; $action = isset($_GET["action"]) ? $_GET["action"] : ""; if ($action == "insert" || $action == "update") { /* validate the data. */ - $category = trim($_GET["category"]); - - $haserror = false; + $category = filter_var(trim($_GET["category"]), FILTER_SANITIZE_STRING); + $category = htmlspecialchars($category, ENT_QUOTES, 'UTF-8'); + if ($category == "") { $haserror = true; - $category_error = "A category is required."; + $error_message = trim("$error_message A category is required."); + $category_error = true; + } +} + +if (isset($_GET["categoryid"])) { + $categoryid = filter_var(trim($_GET["categoryid"]), FILTER_SANITIZE_NUMBER_INT); + + if (filter_var($categoryid, FILTER_SANITIZE_NUMBER_INT) === false || $categoryid == "" || !is_numeric($categoryid) || $categoryid < 0) { + die("Invalid categoryid ({$_GET["categoryid"]})"); } } if ($action == "delete") { /* first, NULL all category FKs for items that use this category. */ $stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET category = NULL WHERE category = ?"); - $stmt->bindValue(1, (int) $_GET["categoryid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $categoryid, PDO::PARAM_INT); $stmt->execute(); $stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}categories WHERE categoryid = ?"); - $stmt->bindValue(1, (int) $_GET["categoryid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $categoryid, PDO::PARAM_INT); $stmt->execute(); - + header("Location: " . getFullPath("categories.php?message=Category+deleted.")); exit; } else if ($action == "edit") { $stmt = $smarty->dbh()->prepare("SELECT category FROM {$opt["table_prefix"]}categories WHERE categoryid = ?"); - $stmt->bindValue(1, (int) $_GET["categoryid"], PDO::PARAM_INT); + $stmt->bindValue(1, (int) $categoryid, PDO::PARAM_INT); $stmt->execute(); if ($row = $stmt->fetch()) { $category = $row["category"]; @@ -76,7 +88,7 @@ else if ($action == "insert") { $stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}categories(categoryid,category) VALUES(NULL, ?)"); $stmt->bindParam(1, $category, PDO::PARAM_STR); $stmt->execute(); - + header("Location: " . getFullPath("categories.php?message=Category+added.")); exit; } @@ -87,11 +99,11 @@ else if ($action == "update") { "SET category = ? " . "WHERE categoryid = ?"); $stmt->bindParam(1, $category, PDO::PARAM_STR); - $stmt->bindValue(2, (int) $_GET["categoryid"], PDO::PARAM_INT); + $stmt->bindValue(2, (int) $categoryid, PDO::PARAM_INT); $stmt->execute(); - + header("Location: " . getFullPath("categories.php?message=Category+updated.")); - exit; + exit; } } else { @@ -113,8 +125,8 @@ if (isset($action)) { $smarty->assign('action', $action); } $smarty->assign('categories', $categories); -if (isset($_GET["categoryid"])) { - $smarty->assign('categoryid', (int) $_GET["categoryid"]); +if (isset($categoryid)) { + $smarty->assign('categoryid', (int) $categoryid); } if (isset($message)) { $smarty->assign('message', $message); @@ -124,5 +136,8 @@ if (isset($category_error)) { $smarty->assign('category_error', $category_error); } $smarty->assign('haserror', isset($haserror) ? $haserror : false); +if ($error_message != "") { + $smarty->assign('error_message', $error_message); +} $smarty->display('categories.tpl'); ?> diff --git a/src/css/phpgiftrec.css b/src/css/phpgiftrec.old.css similarity index 100% rename from src/css/phpgiftrec.css rename to src/css/phpgiftrec.old.css diff --git a/src/css/phpgiftreg.css b/src/css/phpgiftreg.css new file mode 100644 index 0000000..1222d1b --- /dev/null +++ b/src/css/phpgiftreg.css @@ -0,0 +1,20 @@ +/* Ensure the main content takes up available space */ +html, body { + height: 100%; +} +body { + display: flex; + flex-direction: column; +} +main { + flex: 1; +} +.icon { + fill: currentcolor; +} + +.boldicon { + fill: currentcolor; + stroke: currentcolor; + stroke-width: 1; +} diff --git a/src/event.php b/src/event.php index 72137c9..9a038dc 100644 --- a/src/event.php +++ b/src/event.php @@ -20,7 +20,7 @@ $opt = $smarty->opt(); session_start(); if (!isset($_SESSION["userid"])) { - header("Location: " . getFullPath("login.php")); + header("Location: " . getFullPath("login.php") . "?from=event.php"); exit; } else { @@ -28,13 +28,21 @@ else { } if (!empty($_GET["message"])) { - $message = $_GET["message"]; + $message = filter_var(trim($_GET["message"], FILTER_SANITIZE_STRING));; + $message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); } if (isset($_GET["eventid"])) { - $eventid = $_GET["eventid"]; + $eventid = filter_var(trim($_GET["eventid"]), FILTER_SANITIZE_NUMBER_INT); + + if (filter_var($eventid, FILTER_SANITIZE_NUMBER_INT) === false || $eventid == "" || !is_numeric($eventid) || $eventid < 0) { + die("Invalid eventid ({$_GET["eventid"]})"); + } } +$haserror = false; +$error_message = ""; + // for security, let's make sure that if an eventid was passed in, it belongs // to $userid (or is a system event and the user is an admin). // all operations on this page should only be performed by the event's owner. @@ -62,7 +70,8 @@ $action = isset($_GET["action"]) ? $_GET["action"] : ""; if ($action == "insert" || $action == "update") { /* validate the data. */ - $description = trim($_GET["description"]); + $description = filter_var(trim($_GET["description"], FILTER_SANITIZE_STRING));; + $description = htmlspecialchars($description, ENT_QUOTES, 'UTF-8'); try { $eventdate = new DateTime($_GET["eventdate"]); } @@ -71,15 +80,16 @@ if ($action == "insert" || $action == "update") { } $recurring = (strtoupper($_GET["recurring"]) == "ON" ? 1 : 0); $systemevent = (strtoupper($_GET["systemevent"]) == "ON" ? 1 : 0); - - $haserror = false; + if ($description == "") { $haserror = true; - $description_error = "A description is required."; + $error_message = trim("$error_message A description is required."); + $description_error = true; } if ($eventdate == FALSE) { $haserror = true; - $eventdate_error = "Date is out of range for this server."; + $error_message = trim("$error_message Date is out of range for this server."); + $eventdate_error = true; } } @@ -101,7 +111,7 @@ else if ($action == "edit") { try { $stmt = $smarty->dbh()->prepare("SELECT description, eventdate, recurring, userid FROM {$opt["table_prefix"]}events WHERE eventid = ?"); $stmt->bindParam(1, $eventid, PDO::PARAM_INT); - + $stmt->execute(); // we know this will work, see above. @@ -131,7 +141,7 @@ else if ($action == "insert") { $stmt->bindParam(4, $recurring, PDO::PARAM_BOOL); $stmt->execute(); - + header("Location: " . getFullPath("event.php?message=Event+added.")); exit; } @@ -147,7 +157,7 @@ else if ($action == "update") { "userid = ?, " . "description = ?, " . "eventdate = ?, " . - "recurring = ? " . + "recurring = ? " . "WHERE eventid = ?"); $stmt->bindValue(1, $systemevent ? NULL : $userid, PDO::PARAM_BOOL); $stmt->bindParam(2, $description, PDO::PARAM_STR); @@ -198,6 +208,9 @@ try { } $smarty->assign('action', $action); $smarty->assign('haserror', isset($haserror) ? $haserror : false); + if ($error_message != "") { + $smarty->assign('error_message', $error_message); + } $smarty->assign('events', $events); $smarty->assign('eventdate', $eventdate->format($opt["date_format"])); if (isset($eventdate_error)) { diff --git a/src/families.php b/src/families.php index dd86a3d..a37fec3 100644 --- a/src/families.php +++ b/src/families.php @@ -20,8 +20,9 @@ $opt = $smarty->opt(); session_start(); $haserror = false; +$error_message = ""; if (!isset($_SESSION["userid"])) { - header("Location: " . getFullPath("login.php")); + header("Location: " . getFullPath("login.php") . "?from=families.php"); exit; } else if ($_SESSION["admin"] != 1) { @@ -32,24 +33,44 @@ else { $userid = $_SESSION["userid"]; } if (!empty($_GET["message"])) { - $message = $_GET["message"]; + $message = filter_var(trim($_GET["message"], FILTER_SANITIZE_STRING));; + $message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); } $action = empty($_GET["action"]) ? "" : $_GET["action"]; -if (!empty($_GET["familyid"])) - $familyid = (int) $_GET["familyid"]; -else - $familyid = 1; +if (isset($_GET["familyid"])) { + $familyid = filter_var(trim($_GET["familyid"]), FILTER_SANITIZE_NUMBER_INT); + + if (filter_var($familyid, FILTER_SANITIZE_NUMBER_INT) === false || $familyid == "" || !is_numeric($familyid) || $familyid < 0) { + die("Invalid familyid ({$_GET["familyid"]})"); + } +} + +if (empty($familyid)) $familyid = 1; + +if (isset($_GET["members"])) { + $members = isset($_GET["members"]) ? $_GET["members"] : array(); + if (!is_array($members)) { + die("Invalid data for members ({$_GET["members"]})"); + } + foreach ($members as $index => $member) { + $members[$index] = filter_var($member, FILTER_SANITIZE_NUMBER_INT); + if (filter_var($members[$index], FILTER_SANITIZE_NUMBER_INT) === false) { + die("Invalid data for members ({$_GET["members"]})"); + } + } +} if ($action == "insert" || $action == "update") { /* validate the data. */ - $familyname = trim($_GET["familyname"]); - - $haserror = false; + $familyname = filter_var(trim($_GET["familyname"]), FILTER_SANITIZE_STRING); + $familyname = htmlspecialchars($familyname, ENT_QUOTES, 'UTF-8'); + if ($familyname == "") { $haserror = true; - $familyname_error = "A family name is required."; + $error_message = "A family name is required."; + $familyname_error = true; } } @@ -63,7 +84,7 @@ if ($action == "delete") { $stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}families WHERE familyid = ?"); $stmt->bindValue(1, $familyid, PDO::PARAM_INT); $stmt->execute(); - + header("Location: " . getFullPath("families.php?message=Family+deleted.")); exit; } @@ -100,7 +121,7 @@ else if ($action == "insert") { catch (PDOException $e) { die("sql exception: " . $e->getMessage()); } - + header("Location: " . getFullPath("families.php?message=Family+added.")); exit; } @@ -118,13 +139,12 @@ else if ($action == "update") { catch (PDOException $e) { die("sql exception: " . $e->getMessage()); } - + header("Location: " . getFullPath("families.php?message=Family+updated.")); - exit; + exit; } } else if ($action == "members") { - $members = isset($_GET["members"]) ? $_GET["members"] : array(); try { /* first, delete all memberships for this family. */ $stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}memberships WHERE familyid = ?"); @@ -142,7 +162,7 @@ else if ($action == "members") { catch (PDOException $e) { die("sql exception: " . $e->getMessage()); } - + header("Location: " . getFullPath("families.php?message=Members+changed.")); exit; } @@ -176,6 +196,9 @@ try { $smarty->assign('action', $action); $smarty->assign('haserror', $haserror); + if ($error_message != "") { + $smarty->assign('error_message', $error_message); + } if (isset($familyname_error)) { $smarty->assign('familyname_error', $familyname_error); } diff --git a/src/forgot.php b/src/forgot.php index 5c7a45d..181b520 100644 --- a/src/forgot.php +++ b/src/forgot.php @@ -22,14 +22,14 @@ if (isset($_POST["action"]) && $_POST["action"] == "forgot") { $username = $_POST["username"]; try { - // make sure that username is valid + // make sure that username is valid $stmt = $smarty->dbh()->prepare("SELECT email FROM {$opt["table_prefix"]}users WHERE username = ?"); $stmt->bindParam(1, $username, PDO::PARAM_STR); - + $stmt->execute(); if ($row = $stmt->fetch()) { $email = $row["email"]; - + if ($email == "") $error = "The username '" . $username . "' does not have an e-mail address, so the password could not be sent."; else { @@ -42,7 +42,7 @@ if (isset($_POST["action"]) && $_POST["action"] == "forgot") { mail( $email, "Gift Registry password reset", - "Your Gift Registry account information:\r\n" . + "Your Gift Registry account information:\r\n" . "Your username is '" . $username . "' and your new password is '$pwd'.", "From: {$opt["email_from"]}\r\nReply-To: {$opt["email_reply_to"]}\r\nX-Mailer: {$opt["email_xmailer"]}\r\n" ) or die("Mail not accepted for $email"); @@ -64,6 +64,8 @@ if (isset($_POST["action"]) && $_POST["action"] == "forgot") { } } else { + if (!isset($username)) $username = ""; + $smarty->assign('username', $username); $smarty->display('forgot.tpl'); } ?> diff --git a/src/help.php b/src/help.php index 94af24f..338689b 100644 --- a/src/help.php +++ b/src/help.php @@ -21,13 +21,56 @@ $opt = $smarty->opt(); session_start(); if (!isset($_SESSION["userid"])) { - header("Location: " . getFullPath("login.php")); + header("Location: " . getFullPath("login.php") . "?from=help.php"); exit; } else { $userid = $_SESSION["userid"]; } +$action = ""; +if (!empty($_POST["action"])) { + $action = $_POST["action"]; + + if ($action == "save") { + if (!empty($_POST["show_helptext"])) + $show_helptext = ($_POST["show_helptext"] == "on" ? 1 : 0); + else + $show_helptext = 0; + + try { + $stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}users SET show_helptext = ? WHERE userid = ?"); + $stmt->bindParam(1, $show_helptext, PDO::PARAM_BOOL); + $stmt->bindParam(2, $userid, PDO::PARAM_INT); + $stmt->execute(); + } + catch (PDOException $e) { + die("sql exception: " . $e->getMessage()); + } + } + else { + die("Unknown verb."); + } +} + +try { + $stmt = $smarty->dbh()->prepare("SELECT show_helptext FROM {$opt["table_prefix"]}users WHERE userid = ?"); + $stmt->bindParam(1, $userid, PDO::PARAM_INT); + + $stmt->execute(); + if ($row = $stmt->fetch()) { + $smarty->assign('show_helptext', $row["show_helptext"]); + $_SESSION['show_helptext'] = $row["show_helptext"]; + } + else { + die("You don't exist."); + } +} +catch (PDOException $e) { + die("sql exception: " . $e->getMessage()); +} + +$smarty->assign('myurl', "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}"); $smarty->display('help.tpl'); ?> diff --git a/src/images/arrow-down-dark.png b/src/images/arrow-down-dark.png new file mode 100644 index 0000000..c9b1885 Binary files /dev/null and b/src/images/arrow-down-dark.png differ diff --git a/src/images/arrow-down.png b/src/images/arrow-down-light.png similarity index 100% rename from src/images/arrow-down.png rename to src/images/arrow-down-light.png diff --git a/src/images/arrow-up-dark.png b/src/images/arrow-up-dark.png new file mode 100644 index 0000000..d89351b Binary files /dev/null and b/src/images/arrow-up-dark.png differ diff --git a/src/images/arrow-up.png b/src/images/arrow-up-light.png similarity index 100% rename from src/images/arrow-up.png rename to src/images/arrow-up-light.png diff --git a/src/images/bin-dark.png b/src/images/bin-dark.png new file mode 100644 index 0000000..fd5d43d Binary files /dev/null and b/src/images/bin-dark.png differ diff --git a/src/images/bin.png b/src/images/bin-light.png similarity index 100% rename from src/images/bin.png rename to src/images/bin-light.png diff --git a/src/images/caret-ASC-dark.png b/src/images/caret-ASC-dark.png new file mode 100644 index 0000000..820c6b4 Binary files /dev/null and b/src/images/caret-ASC-dark.png differ diff --git a/src/images/caret-ASC-light.png b/src/images/caret-ASC-light.png new file mode 100644 index 0000000..e0e1819 Binary files /dev/null and b/src/images/caret-ASC-light.png differ diff --git a/src/images/caret-DESC-dark.png b/src/images/caret-DESC-dark.png new file mode 100644 index 0000000..e067440 Binary files /dev/null and b/src/images/caret-DESC-dark.png differ diff --git a/src/images/caret-DESC-light.png b/src/images/caret-DESC-light.png new file mode 100644 index 0000000..acc8e88 Binary files /dev/null and b/src/images/caret-DESC-light.png differ diff --git a/src/images/check2-dark.png b/src/images/check2-dark.png new file mode 100644 index 0000000..1eef473 Binary files /dev/null and b/src/images/check2-dark.png differ diff --git a/src/images/check2-light.png b/src/images/check2-light.png new file mode 100644 index 0000000..b1dbead Binary files /dev/null and b/src/images/check2-light.png differ diff --git a/src/images/circle-half-dark.png b/src/images/circle-half-dark.png new file mode 100644 index 0000000..ea20a1b Binary files /dev/null and b/src/images/circle-half-dark.png differ diff --git a/src/images/circle-half-light.png b/src/images/circle-half-light.png new file mode 100644 index 0000000..d71da36 Binary files /dev/null and b/src/images/circle-half-light.png differ diff --git a/src/images/cloud-add-dark.png b/src/images/cloud-add-dark.png new file mode 100644 index 0000000..ed9f804 Binary files /dev/null and b/src/images/cloud-add-dark.png differ diff --git a/src/images/cloud-add.png b/src/images/cloud-add-light.png similarity index 100% rename from src/images/cloud-add.png rename to src/images/cloud-add-light.png diff --git a/src/images/credit-card-3-dark.png b/src/images/credit-card-3-dark.png new file mode 100644 index 0000000..55d3ed6 Binary files /dev/null and b/src/images/credit-card-3-dark.png differ diff --git a/src/images/credit-card-3.png b/src/images/credit-card-3-light.png similarity index 100% rename from src/images/credit-card-3.png rename to src/images/credit-card-3-light.png diff --git a/src/images/delete-dark.png b/src/images/delete-dark.png new file mode 100644 index 0000000..2cb2677 Binary files /dev/null and b/src/images/delete-dark.png differ diff --git a/src/images/delete.png b/src/images/delete-light.png similarity index 100% rename from src/images/delete.png rename to src/images/delete-light.png diff --git a/src/images/image-dark.png b/src/images/image-dark.png new file mode 100644 index 0000000..db1d7fb Binary files /dev/null and b/src/images/image-dark.png differ diff --git a/src/images/image.png b/src/images/image-light.png similarity index 100% rename from src/images/image.png rename to src/images/image-light.png diff --git a/src/images/key-dark.png b/src/images/key-dark.png new file mode 100644 index 0000000..1fd6fe1 Binary files /dev/null and b/src/images/key-dark.png differ diff --git a/src/images/key-fill-dark.png b/src/images/key-fill-dark.png new file mode 100644 index 0000000..d336d64 Binary files /dev/null and b/src/images/key-fill-dark.png differ diff --git a/src/images/key-fill-light.png b/src/images/key-fill-light.png new file mode 100644 index 0000000..3ace69b Binary files /dev/null and b/src/images/key-fill-light.png differ diff --git a/src/images/key.png b/src/images/key-light.png similarity index 100% rename from src/images/key.png rename to src/images/key-light.png diff --git a/src/images/link-dark.png b/src/images/link-dark.png new file mode 100644 index 0000000..f5910ad Binary files /dev/null and b/src/images/link-dark.png differ diff --git a/src/images/link.png b/src/images/link-light.png similarity index 100% rename from src/images/link.png rename to src/images/link-light.png diff --git a/src/images/locked-dark.png b/src/images/locked-dark.png new file mode 100644 index 0000000..e83088e Binary files /dev/null and b/src/images/locked-dark.png differ diff --git a/src/images/locked.png b/src/images/locked-light.png similarity index 100% rename from src/images/locked.png rename to src/images/locked-light.png diff --git a/src/images/moon-stars-fill-dark.png b/src/images/moon-stars-fill-dark.png new file mode 100644 index 0000000..be26ffa Binary files /dev/null and b/src/images/moon-stars-fill-dark.png differ diff --git a/src/images/moon-stars-fill-light.png b/src/images/moon-stars-fill-light.png new file mode 100644 index 0000000..60f3b92 Binary files /dev/null and b/src/images/moon-stars-fill-light.png differ diff --git a/src/images/pencil-dark.png b/src/images/pencil-dark.png new file mode 100644 index 0000000..221fd5f Binary files /dev/null and b/src/images/pencil-dark.png differ diff --git a/src/images/pencil.png b/src/images/pencil-light.png similarity index 100% rename from src/images/pencil.png rename to src/images/pencil-light.png diff --git a/src/images/pencil-mwe.png b/src/images/pencil-mwe.png new file mode 100644 index 0000000..c8529af Binary files /dev/null and b/src/images/pencil-mwe.png differ diff --git a/src/images/person-circle-dark.png b/src/images/person-circle-dark.png new file mode 100644 index 0000000..e8175b8 Binary files /dev/null and b/src/images/person-circle-dark.png differ diff --git a/src/images/person-circle-light.png b/src/images/person-circle-light.png new file mode 100644 index 0000000..f33602c Binary files /dev/null and b/src/images/person-circle-light.png differ diff --git a/src/images/podcast-dark.png b/src/images/podcast-dark.png new file mode 100644 index 0000000..2e48af8 Binary files /dev/null and b/src/images/podcast-dark.png differ diff --git a/src/images/podcast.png b/src/images/podcast-light.png similarity index 100% rename from src/images/podcast.png rename to src/images/podcast-light.png diff --git a/src/images/return-dark.png b/src/images/return-dark.png new file mode 100644 index 0000000..4dd850f Binary files /dev/null and b/src/images/return-dark.png differ diff --git a/src/images/return.png b/src/images/return-light.png similarity index 100% rename from src/images/return.png rename to src/images/return-light.png diff --git a/src/images/split-2-dark.png b/src/images/split-2-dark.png new file mode 100644 index 0000000..3e9a7eb Binary files /dev/null and b/src/images/split-2-dark.png differ diff --git a/src/images/split-2.png b/src/images/split-2-light.png similarity index 100% rename from src/images/split-2.png rename to src/images/split-2-light.png diff --git a/src/images/store-dark.png b/src/images/store-dark.png new file mode 100644 index 0000000..836caa8 Binary files /dev/null and b/src/images/store-dark.png differ diff --git a/src/images/store.png b/src/images/store-light.png similarity index 100% rename from src/images/store.png rename to src/images/store-light.png diff --git a/src/images/sun-fill-dark.png b/src/images/sun-fill-dark.png new file mode 100644 index 0000000..0ca5a9e Binary files /dev/null and b/src/images/sun-fill-dark.png differ diff --git a/src/images/sun-fill-light.png b/src/images/sun-fill-light.png new file mode 100644 index 0000000..f875297 Binary files /dev/null and b/src/images/sun-fill-light.png differ diff --git a/src/images/unlocked-dark.png b/src/images/unlocked-dark.png new file mode 100644 index 0000000..7970298 Binary files /dev/null and b/src/images/unlocked-dark.png differ diff --git a/src/images/unlocked.png b/src/images/unlocked-light.png similarity index 100% rename from src/images/unlocked.png rename to src/images/unlocked-light.png diff --git a/src/includes/MySmarty.class.php b/src/includes/MySmarty.class.php index bbd8b21..65890c5 100644 --- a/src/includes/MySmarty.class.php +++ b/src/includes/MySmarty.class.php @@ -1,10 +1,10 @@ "wishlist@erdelynet.com", /* The e-mail Reply-To: header. */ - "email_reply_to" => "mike@erdelynet.com", + "email_reply_to" => "wishlist@erdelynet.com", /* The e-mail X-Mailer header. */ "email_xmailer" => "PHP/" . phpversion(), + /* Application name. */ + "app_name" => "Test Gift Registry", + /* Whether or not to show brief blurbs in certain spots which describe how features work. 0 = don't help text, @@ -125,7 +128,39 @@ function getGlobalOptions() { 0 = don't hide it, 1 = hide it */ - "hide_zero_price" => 1, + "hide_zero_price" => 0, + + /* Default raking + This is the default rankings list: + 5 = I'd love to get this + 4 = I would really, really like this + 3 = Would make me happy + 2 = Would be nice to have + 1 = Wouldn't mind it + */ + "default_ranking" => 3, + + /* Default category + This is the default categories list: + 1 = Miscellaneous + 2 = Music + 3 = Video Games + 4 = Clothing + 5 = Movies/DVD + 6 = Gift Certificates + 7 = Hobbies + 8 = Household + 9 = Electronics + 10 = Ornaments/Figurines + 11 = Automotive + 12 = Toys + 13 = Jewelry + 14 = Computer + 15 = Games + 16 = Tools + 17 = Books + */ + "default_category" => 1, /* Whether or not to hash passwords. Your version of MySQL may or may not support it. diff --git a/src/includes/smarty-3.1.48/COMPOSER_RELEASE_NOTES.txt b/src/includes/smarty-3.1.48/COMPOSER_RELEASE_NOTES.txt deleted file mode 100644 index 0644719..0000000 --- a/src/includes/smarty-3.1.48/COMPOSER_RELEASE_NOTES.txt +++ /dev/null @@ -1,31 +0,0 @@ - - -Starting with Smarty 3.1.21 Composer has been configured to load the packages from github. - -******************************************************************************* -* * -* NOTE: Because of this change you must clear your local composer cache with * -* the "composer clearcache" command * -* * -******************************************************************************* - -To get the latest stable version use - "require": { - "smarty/smarty": "~3.1" - } -in your composer.json file. - -To get the trunk version use - "require": { - "smarty/smarty": "~3.1@dev" - } - -The "smarty/smarty" package will start at libs/.... subfolder. - -To retrieve the development and documentation folders add - "require-dev": { - "smarty/smarty-dev": "~3.1@dev" - } - -If you are using (include) the composer generated autoloader.php which is located -in the /vendor folder it is no longer needed to require the Smarty.class.php file. \ No newline at end of file diff --git a/src/includes/smarty-3.1.48/INHERITANCE_RELEASE_NOTES.txt b/src/includes/smarty-3.1.48/INHERITANCE_RELEASE_NOTES.txt deleted file mode 100644 index 67936a8..0000000 --- a/src/includes/smarty-3.1.48/INHERITANCE_RELEASE_NOTES.txt +++ /dev/null @@ -1,91 +0,0 @@ -3.1.3" -New tags for inheritance parent and chilD -{parent} == {$smarty.block.parent} -{child} == {$smarty.block.child} -Both tags support the assign attribute like -{child assign=foo} - -3.1.31 -New tags for inheritance parent and child -{block_parent} == {$smarty.block.parent} -{block_child} == {$smarty.block.child} - -Since 3.1.28 you can mix inheritance by extends resource with the {extends} tag. -A template called by extends resource can extend a subtemplate or chain buy the {extends} tag. -Since 3.1.31 this feature can be turned off by setting the new Smarty property Smarty::$extends_recursion to false. - -3.1.28 -Starting with version 3.1.28 template inheritance is no longer a compile time process. -All {block} tag parent/child relations are resolved at run time. -This does resolve all known existing restrictions (see below). - -The $smarty::$inheritance_merge_compiled_includes property has been removed. -Any access to it is ignored. - -New features: - -Any code outside root {block} tags in child templates is now executed but any output will be ignored. - - {extends 'foo.tpl'} - {$bar = 'on'} // assigns variable $bar seen in parent templates - {block 'buh'}{/block} - - {extends 'foo.tpl'} - {$bar} // the output of variable bar is ignored - {block 'buh'}{/block} - -{block} tags can be dynamically en/disabled by conditions. - - {block 'root'} - {if $foo} - {block 'v1'} - .... - {/block} - {else} - {block 'v1'} - .... - {/block} - {/if} - {/block} - -{block} tags can have variable names. - - {block $foo} - .... - {/block} - -Starting with 3.1.28 you can mix inheritance by extends resource with the {extends} tag. -A template called by extends resource can extend a subtemplate or chain buy the {extends} tag. - -NOTE There is a BC break. If you used the extends resource {extends} tags have been ignored. - -THE FOLLOWING RESTRICTIONS ARE NO LONGER EXISTING: -In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags -is done at compile time and the parent and child templates are compiled in a single compiled template. -{include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because -it could be used in other context where the {block} extended with a different result. For that reasion -the compiled code of {include} subtemplates gets also merged in compiled inheritance template. - -Merging the code into a single compile template has some drawbacks. -1. You could not use variable file names in {include} Smarty would use the {include} of compilation time. -2. You could not use individual compile_id in {include} -3. Separate caching of subtemplate was not possible -4. Any change of the template directory structure between calls was not necessarily seen. - -Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out -that a couple of users did use some of above and now got exceptions. - -To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes. -For most backward compatibility its default setting is true. -With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases -could be rejected by exception. - - -If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged.You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option. -{include file='foo.bar' inline} - -1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id $smarty->compile_id = $foo; -2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the global compile_id as well $smarty->compile_id = $bar; -3. If call templates with different template_dir configurations and a parent could same named child template from different folders - you must make the folder name part of the compile_id. - diff --git a/src/includes/smarty-3.1.48/NEW_FEATURES.txt b/src/includes/smarty-3.1.48/NEW_FEATURES.txt deleted file mode 100644 index 0b2cae1..0000000 --- a/src/includes/smarty-3.1.48/NEW_FEATURES.txt +++ /dev/null @@ -1,291 +0,0 @@ - - -This file contains a brief description of new features which have been added to Smarty 3.1 - -Smarty 3.1.33-dev - Variable capture name in Smarty special variable - ================================================ - {$smarty.capture.$foo} can now be used to access the content of a named - capture block - -Smarty 3.1.32 - New tags for inheritance parent and child - ========================================= - {parent} == {$smarty.block.parent} - {child} == {$smarty.block.child} - Both tags support the assign attribute like - {child assign=foo} - - Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors() - =================================================================================== - These functions to start a special error handler are no longer needed as Smarty does - no longer use error suppression like @filemtime(). - For backward compatibility the functions still can be called. - - Using literals containing Smarty's left and right delimiter - =========================================================== - New Methods - $smarty->setLiterals(array $literals) - $smarty->addLiterals(array $literals) - to define literals containing Smarty delimiter. This can avoid the need for extreme usage - of {literal} {/literal} tags. - A) Treat '{{' and '}}' as literal - If Smarty::$auto_literal is enabled - {{ foo }} - will be treated now as literal. (This does apply for any number of delimiter repeatations). - However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag. - If you use - $smarty->setLiterals(array('{{','}}')); - {{foo}} is now a literal as well. - NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not - work any longer, but this should be very very raw occouring restriction. - B) Example 2 - Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals - $smarty->setLiterals(array('<--','-->')); - - - The capture buffers can now be accessed as array - ================================================ - {capture name='foo'} - bah - {\capture} - {capture name='buh'} - blar - {\capture} - {foreach $smarty.capture as $name => $buffer} - .... - {/foreach} - -Smarty 3.1.31 - New tags for inheritance parent and child - ========================================= - {block_parent} == {$smarty.block.parent} - {block_child} == {$smarty.block.child} - -Smarty 3.1.30 - - Loop optimization {foreach} and {section} - ========================================= - Smarty does optimize the {foreach} and {section} loops by removing code for not needed loop - properties. - The compiler collects needed properties by scanning the current template for $item@property, - $smarty.foreach.name.property and $smarty.section.name.property. - The compiler does not know if additional properties will be needed outside the current template scope. - Additional properties can be generated by adding them with the property attribute. - - Example: - index.tpl - {foreach $from as $item properties=[iteration, index]} - {include 'sub.tpl'} - {$item.total} - {/foreach} - - sub.tpl - {$item.index} {$item.iteration} {$item.total} - - In above example code for the 'total' property is automatically generated as $item.total is used in - index.tpl. Code for 'iteration' and 'index' must be added with properties=[iteration, index]. - - New tag {make_nocache} - ====================== - Syntax: {make_nocache $foo} - - This tag makes a variable which does exists normally only while rendering the compiled template - available in the cached template for use in not cached expressions. - - Expample: - {foreach from=$list item=item} -
  • {$item.name} {make_nocache $item}{if $current==$item.id} ACTIVE{/if}
  • - {/foreach} - - The {foreach} loop is rendered while processing the compiled template, but $current is a nocache - variable. Normally the {if $current==$item.id} would fail as the $item variable is unknown in the cached template. {make_nocache $item} does make the current $item value known in thee cached template. - - {make_nocache} is ignored when caching is disabled or the variable does exists as nocache variable. - - NOTE: if the variable value does contain objects these must have the __set_state method implemented. - - - Scope Attributes - ================ - The scope handling has been updated to cover all cases of variable assignments in templates. - - The tags {assign}, {append} direct assignments like {$foo = ...}, {$foo[...]= ...} support - the following optional scope attributes: - scope='parent' - the variable will be assigned in the current template and if the template - was included by {include} the calling template - scope='tpl_root' - the variable will be assigned in the outermost root template called by $smarty->display() - or $smarty->fetch() and is bubbled up all {include} sub-templates to the current template. - scope='smarty' - the variable will be assigned in the Smarty object and is bubbled up all {include} sub-templates - to the current template. - scope='global' - the variable will be assigned as Smarty object global variable and is bubbled up all {include} - sub-templates to the current template. - scope='root' - the variable will be assigned if a data object was used for variable definitions in the data - object or in the Smarty object otherwise and is bubbled up all {include} sub-templates to the - current template. - scope='local' - this scope has only a meaning if the tag is called within a template {function}. - The variable will be assigned in the local scope of the template function and the - template which did call the template function. - - - The {config_load} tag supports all of the above except the global scope. - - The scope attribute can be used also with the {include} tag. - Supported scope are parent, tpl_root, smarty, global and root. - A scope used together with the {include} tag will cause that with some exceptions any variable - assignment within that sub-template will update/assign the variable in other scopes according - to the above rules. It does include also variables assigned by plugins, tags supporting the assign=foo attribute and direct assignments in {if} and {while} like {if $foo=$bar}. - Excluded are the key and value variables of {foreach}, {for} loop variables , variables passed by attributes - in {include} and direct increments/decrements like {$foo++}, {$foo--} - - Note: The scopes should be used only to the extend really need. If a variable value assigned in an included - sub-template should be returned to the calling sub-template just use {$foo='bar' scope='parent'}. - Use scopes only with variables for which it's realy needed. Avoid general scope settings with the - {include} tag as it can have a performance impact. - - The {assign}, {append}, {config_load} and {$foo...=...} tags have a new option flag 'noscope'.Thi - Example: {$foo='bar' noscope} This will assign $foo only in the current template and any scope settings - at {include} is ignored. - - - Caching - ======= - Caching does now observe the template_dir setting and will create separate cache files if required - - Compiled Templates - ================== - The template_dir setting is now encoded in the uid of the file name. - The content of the compiled template may depend on the template_dir search order - {include .... inline} is used or $smarty->merge_compiled_includes is enabled - - APC - === - If APC is enabled force an apc_compile_file() when compiled or cached template was updated - -Smarty 3.1.28 - - OPCACHE - ======= - Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE. - Correct operation is no longer dependent on OPCACHE configuration settings. - - Template inheritance - ==================== - Template inheritance is now processed in run time. - See the INHERITANCE_RELEASE_NOTES - - Modifier regex_replace - ====================== - An optional limit parameter was added - - fetch() and display() - ===================== - The fetch() and display() methods of the template object accept now optionally the same parameter - as the corresponding Smarty methods to get the content of another template. - Example: - $template->display(); Does display template of template object - $template->display('foo.tpl'); Does display template 'foo.bar' - - File: resource - ============== - Multiple template_dir entries can now be selected by a comma separated list of indices. - The template_dir array is searched in the order of the indices. (Could be used to change the default search order) - Example: - $smarty->display('[1],[0]foo.bar'); - - Filter support - ============== - Optional filter names - An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name. - - $smarty->registerFilter('output', $callback, 'name'); - $smarty->unregister('output', 'name'); - - Closures - $smarty->registerFilter() does now accept closures. - - $smarty->registerFilter('pre', function($source) {return $source;}); - If no optional filter name was specified it gets the default name 'closure'. - If you register multiple closures register each with a unique filter name. - - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_1'); - - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_2'); - - -Smarty 3.1.22 - - Namespace support within templates - ================================== - Within templates you can now use namespace specifications on: - - Constants like foo\bar\FOO - - Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo() - - PHP function names like foo\bar\baz() - - Security - ======== - - disable special $smarty variable - - The Smarty_Security class has the new property $disabled_special_smarty_vars. - It's an array which can be loaded with the $smarty special variable names like - 'template_object', 'template', 'current_dir' and others which will be disabled. - Note: That this security check is performed at compile time. - - - limit template nesting - - Property $max_template_nesting of Smarty_Security does set the maximum template nesting level. - The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded - an Exception will be thrown. The default setting is 0 which does disable this check. - - - trusted static methods - - The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods. - It's an nested array of trusted class and method names. - Format: - array ( - 'class_1' => array('method_1', 'method_2'), // allowed methods - 'class_2' => array(), // all methods of class allowed - ) - To disable access for all methods of all classes set $trusted_static_methods = null; - The default value is an empty array() which does enables all methods of all classes, but for backward compatibility - the setting of $static_classes will be checked. - Note: That this security check is performed at compile time. - - - trusted static properties - - The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties. - It's an nested array of trusted class and property names. - Format: - array ( - 'class_1' => array('prop_1', 'prop_2'), // allowed properties listed - 'class_2' => array(), // all properties of class allowed - } - To disable access for all properties of all classes set $trusted_static_properties = null; - The default value is an empty array() which does enables all properties of all classes, but for backward compatibility - the setting of $static_classes will be checked. - Note: That this security check is performed at compile time. - - - trusted constants . - The Smarty_Security class has the new property $trusted_constants to restrict access to constants. - It's an array of trusted constant names. - Format: - array ( - 'SMARTY_DIR' , // allowed constant - } - If the array is empty (default) the usage of constants can be controlled with the - Smarty_Security::$allow_constants property (default true) - - - - Compiled Templates - ================== - Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html - property and creates different compiled templates files depending on the setting. - - Same applies to config files and the $config_overwrite, $config_booleanize and - $config_read_hidden properties. - - Debugging - ========= - The layout of the debug window has been changed for better readability - - New class constants - Smarty::DEBUG_OFF - Smarty::DEBUG_ON - Smarty::DEBUG_INDIVIDUAL - have been introduced for setting the $debugging property. - - Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window. - diff --git a/src/includes/smarty-3.1.48/README b/src/includes/smarty-3.1.48/README deleted file mode 100644 index 9a71519..0000000 --- a/src/includes/smarty-3.1.48/README +++ /dev/null @@ -1,575 +0,0 @@ -Smarty 3.x - -Author: Monte Ohrt -Author: Uwe Tews - -AN INTRODUCTION TO SMARTY 3 - -NOTICE FOR 3.1 release: - -Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution. - -NOTICE for 3.0.5 release: - -Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior: - -$smarty->error_reporting = E_ALL & ~E_NOTICE; - -NOTICE for 3.0 release: - -IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release. -We felt it is better to make these now instead of after a 3.0 release, then have to -immediately deprecate APIs in 3.1. Online documentation has been updated -to reflect these changes. Specifically: - ----- API CHANGES RC4 -> 3.0 ---- - -$smarty->register->* -$smarty->unregister->* -$smarty->utility->* -$samrty->cache->* - -Have all been changed to local method calls such as: - -$smarty->clearAllCache() -$smarty->registerFoo() -$smarty->unregisterFoo() -$smarty->testInstall() -etc. - -Registration of function, block, compiler, and modifier plugins have been -consolidated under two API calls: - -$smarty->registerPlugin(...) -$smarty->unregisterPlugin(...) - -Registration of pre, post, output and variable filters have been -consolidated under two API calls: - -$smarty->registerFilter(...) -$smarty->unregisterFilter(...) - -Please refer to the online documentation for all specific changes: - -http://www.smarty.net/documentation - ----- - -The Smarty 3 API has been refactored to a syntax geared -for consistency and modularity. The Smarty 2 API syntax is still supported, but -will throw a deprecation notice. You can disable the notices, but it is highly -recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run -through an extra rerouting wrapper. - -Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also, -all Smarty properties now have getters and setters. So for example, the property -$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be -retrieved with $smarty->getCacheDir(). - -Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were -just duplicate functions of the now available "get*" methods. - -Here is a rundown of the Smarty 3 API: - -$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null) -$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null) -$smarty->isCached($template, $cache_id = null, $compile_id = null) -$smarty->createData($parent = null) -$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) -$smarty->enableSecurity() -$smarty->disableSecurity() -$smarty->setTemplateDir($template_dir) -$smarty->addTemplateDir($template_dir) -$smarty->templateExists($resource_name) -$smarty->loadPlugin($plugin_name, $check = true) -$smarty->loadFilter($type, $name) -$smarty->setExceptionHandler($handler) -$smarty->addPluginsDir($plugins_dir) -$smarty->getGlobal($varname = null) -$smarty->getRegisteredObject($name) -$smarty->getDebugTemplate() -$smarty->setDebugTemplate($tpl_name) -$smarty->assign($tpl_var, $value = null, $nocache = false) -$smarty->assignGlobal($varname, $value = null, $nocache = false) -$smarty->assignByRef($tpl_var, &$value, $nocache = false) -$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false) -$smarty->appendByRef($tpl_var, &$value, $merge = false) -$smarty->clearAssign($tpl_var) -$smarty->clearAllAssign() -$smarty->configLoad($config_file, $sections = null) -$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true) -$smarty->getConfigVariable($variable) -$smarty->getStreamVariable($variable) -$smarty->getConfigVars($varname = null) -$smarty->clearConfig($varname = null) -$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true) -$smarty->clearAllCache($exp_time = null, $type = null) -$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) - -$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array()) - -$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) - -$smarty->registerFilter($type, $function_name) -$smarty->registerResource($resource_type, $function_names) -$smarty->registerDefaultPluginHandler($function_name) -$smarty->registerDefaultTemplateHandler($function_name) - -$smarty->unregisterPlugin($type, $tag) -$smarty->unregisterObject($object_name) -$smarty->unregisterFilter($type, $function_name) -$smarty->unregisterResource($resource_type) - -$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) -$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) -$smarty->testInstall() - -// then all the getters/setters, available for all properties. Here are a few: - -$caching = $smarty->getCaching(); // get $smarty->caching -$smarty->setCaching(true); // set $smarty->caching -$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices -$smarty->setCacheId($id); // set $smarty->cache_id -$debugging = $smarty->getDebugging(); // get $smarty->debugging - - -FILE STRUCTURE - -The Smarty 3 file structure is similar to Smarty 2: - -/libs/ - Smarty.class.php -/libs/sysplugins/ - internal.* -/libs/plugins/ - function.mailto.php - modifier.escape.php - ... - -A lot of Smarty 3 core functionality lies in the sysplugins directory; you do -not need to change any files here. The /libs/plugins/ folder is where Smarty -plugins are located. You can add your own here, or create a separate plugin -directory, just the same as Smarty 2. You will still need to create your own -/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and -/templates_c/ are writable. - -The typical way to use Smarty 3 should also look familiar: - -require('Smarty.class.php'); -$smarty = new Smarty; -$smarty->assign('foo','bar'); -$smarty->display('index.tpl'); - - -However, Smarty 3 works completely different on the inside. Smarty 3 is mostly -backward compatible with Smarty 2, except for the following items: - -*) Smarty 3 is PHP 5 only. It will not work with PHP 4. -*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true. -*) Delimiters surrounded by whitespace are no longer treated as Smarty tags. - Therefore, { foo } will not compile as a tag, you must use {foo}. This change - Makes Javascript/CSS easier to work with, eliminating the need for {literal}. - This can be disabled by setting $smarty->auto_literal = false; -*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated - but still work. You will want to update your calls to Smarty 3 for maximum - efficiency. - - -There are many things that are new to Smarty 3. Here are the notable items: - -LEXER/PARSER -============ - -Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this -means Smarty has some syntax additions that make life easier such as in-template -math, shorter/intuitive function parameter options, infinite function recursion, -more accurate error handling, etc. - - -WHAT IS NEW IN SMARTY TEMPLATE SYNTAX -===================================== - -Smarty 3 allows expressions almost anywhere. Expressions can include PHP -functions as long as they are not disabled by the security policy, object -methods and properties, etc. The {math} plugin is no longer necessary but -is still supported for BC. - -Examples: -{$x+$y} will output the sum of x and y. -{$foo = strlen($bar)} function in assignment -{assign var=foo value= $x+$y} in attributes -{$foo = myfunct( ($x+$y)*3 )} as function parameter -{$foo[$x+3]} as array index - -Smarty tags can be used as values within other tags. -Example: {$foo={counter}+3} - -Smarty tags can also be used inside double quoted strings. -Example: {$foo="this is message {counter}"} - -You can define arrays within templates. -Examples: -{assign var=foo value=[1,2,3]} -{assign var=foo value=['y'=>'yellow','b'=>'blue']} -Arrays can be nested. -{assign var=foo value=[1,[9,8],3]} - -There is a new short syntax supported for assigning variables. -Example: {$foo=$bar+2} - -You can assign a value to a specific array element. If the variable exists but -is not an array, it is converted to an array before the new values are assigned. -Examples: -{$foo['bar']=1} -{$foo['bar']['blar']=1} - -You can append values to an array. If the variable exists but is not an array, -it is converted to an array before the new values are assigned. -Example: {$foo[]=1} - -You can use a PHP-like syntax for accessing array elements, as well as the -original "dot" notation. -Examples: -{$foo[1]} normal access -{$foo['bar']} -{$foo['bar'][1]} -{$foo[$x+$x]} index may contain any expression -{$foo[$bar[1]]} nested index -{$foo[section_name]} smarty section access, not array access! - -The original "dot" notation stays, and with improvements. -Examples: -{$foo.a.b.c} => $foo['a']['b']['c'] -{$foo.a.$b.c} => $foo['a'][$b]['c'] with variable index -{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c'] with expression as index -{$foo.a.{$b.c}} => $foo['a'][$b['c']] with nested index - -note that { and } are used to address ambiguties when nesting the dot syntax. - -Variable names themselves can be variable and contain expressions. -Examples: -$foo normal variable -$foo_{$bar} variable name containing other variable -$foo_{$x+$y} variable name containing expressions -$foo_{$bar}_buh_{$blar} variable name with multiple segments -{$foo_{$x}} will output the variable $foo_1 if $x has a value of 1. - -Object method chaining is implemented. -Example: {$object->method1($x)->method2($y)} - -{for} tag added for looping (replacement for {section} tag): -{for $x=0, $y=count($foo); $x<$y; $x++} .... {/for} -Any number of statements can be used separated by comma as the first -initial expression at {for}. - -{for $x = $start to $end step $step} ... {/for}is in the SVN now . -You can use also -{for $x = $start to $end} ... {/for} -In this case the step value will be automatically 1 or -1 depending on the start and end values. -Instead of $start and $end you can use any valid expression. -Inside the loop the following special vars can be accessed: -$x@iteration = number of iteration -$x@total = total number of iterations -$x@first = true on first iteration -$x@last = true on last iteration - - -The Smarty 2 {section} syntax is still supported. - -New shorter {foreach} syntax to loop over an array. -Example: {foreach $myarray as $var}...{/foreach} - -Within the foreach loop, properties are access via: - -$var@key foreach $var array key -$var@iteration foreach current iteration count (1,2,3...) -$var@index foreach current index count (0,1,2...) -$var@total foreach $var array total -$var@first true on first iteration -$var@last true on last iteration - -The Smarty 2 {foreach} tag syntax is still supported. - -NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo. -If you want to access an array element with index foo, you must use quotes -such as {$bar['foo']}, or use the dot syntax {$bar.foo}. - -while block tag is now implemented: -{while $foo}...{/while} -{while $x lt 10}...{/while} - -Direct access to PHP functions: -Just as you can use PHP functions as modifiers directly, you can now access -PHP functions directly, provided they are permitted by security settings: -{time()} - -There is a new {function}...{/function} block tag to implement a template function. -This enables reuse of code sequences like a plugin function. It can call itself recursively. -Template function must be called with the new {call name=foo...} tag. - -Example: - -Template file: -{function name=menu level=0} - -{/function} - -{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' => - ['item3-3-1','item3-3-2']],'item4']} - -{call name=menu data=$menu} - - -Generated output: - * item1 - * item2 - * item3 - o item3-1 - o item3-2 - o item3-3 - + item3-3-1 - + item3-3-2 - * item4 - -The function tag itself must have the "name" attribute. This name is the tag -name when calling the function. The function tag may have any number of -additional attributes. These will be default settings for local variables. - -New {nocache} block function: -{nocache}...{/nocache} will declare a section of the template to be non-cached -when template caching is enabled. - -New nocache attribute: -You can declare variable/function output as non-cached with the nocache attribute. -Examples: - -{$foo nocache=true} -{$foo nocache} /* same */ - -{foo bar="baz" nocache=true} -{foo bar="baz" nocache} /* same */ - -{time() nocache=true} -{time() nocache} /* same */ - -Or you can also assign the variable in your script as nocache: -$smarty->assign('foo',$something,true); // third param is nocache setting -{$foo} /* non-cached */ - -$smarty.current_dir returns the directory name of the current template. - -You can use strings directly as templates with the "string" resource type. -Examples: -$smarty->display('string:This is my template, {$foo}!'); // php -{include file="string:This is my template, {$foo}!"} // template - - - -VARIABLE SCOPE / VARIABLE STORAGE -================================= - -In Smarty 2, all assigned variables were stored within the Smarty object. -Therefore, all variables assigned in PHP were accessible by all subsequent -fetch and display template calls. - -In Smarty 3, we have the choice to assign variables to the main Smarty object, -to user-created data objects, and to user-created template objects. -These objects can be chained. The object at the end of a chain can access all -variables belonging to that template and all variables within the parent objects. -The Smarty object can only be the root of a chain, but a chain can be isolated -from the Smarty object. - -All known Smarty assignment interfaces will work on the data and template objects. - -Besides the above mentioned objects, there is also a special storage area for -global variables. - -A Smarty data object can be created as follows: -$data = $smarty->createData(); // create root data object -$data->assign('foo','bar'); // assign variables as usual -$data->config_load('my.conf'); // load config file - -$data= $smarty->createData($smarty); // create data object having a parent link to -the Smarty object - -$data2= $smarty->createData($data); // create data object having a parent link to -the $data data object - -A template object can be created by using the createTemplate method. It has the -same parameter assignments as the fetch() or display() method. -Function definition: -function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) - -The first parameter can be a template name, a smarty object or a data object. - -Examples: -$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent -$tpl->assign('foo','bar'); // directly assign variables -$tpl->config_load('my.conf'); // load config file - -$tpl = $smarty->createTemplate('mytpl.tpl',$smarty); // create template having a parent link to the Smarty object -$tpl = $smarty->createTemplate('mytpl.tpl',$data); // create template having a parent link to the $data object - -The standard fetch() and display() methods will implicitly create a template object. -If the $parent parameter is not specified in these method calls, the template object -is will link back to the Smarty object as it's parent. - -If a template is called by an {include...} tag from another template, the -subtemplate links back to the calling template as it's parent. - -All variables assigned locally or from a parent template are accessible. If the -template creates or modifies a variable by using the {assign var=foo...} or -{$foo=...} tags, these new values are only known locally (local scope). When the -template exits, none of the new variables or modifications can be seen in the -parent template(s). This is same behavior as in Smarty 2. - -With Smarty 3, we can assign variables with a scope attribute which allows the -availablility of these new variables or modifications globally (ie in the parent -templates.) - -Possible scopes are local, parent, root and global. -Examples: -{assign var=foo value='bar'} // no scope is specified, the default 'local' -{$foo='bar'} // same, local scope -{assign var=foo value='bar' scope='local'} // same, local scope - -{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object -{$foo='bar' scope='parent'} // (normally the calling template) - -{assign var=foo value='bar' scope='root'} // Values will be exported up to the root object, so they can -{$foo='bar' scope='root'} // be seen from all templates using the same root. - -{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage, -{$foo='bar' scope='global'} // they are available to any and all templates. - - -The scope attribute can also be attached to the {include...} tag. In this case, -the specified scope will be the default scope for all assignments within the -included template. - - -PLUGINS -======= - -Smarty 3 plugins follow the same coding rules as in Smarty 2. -The main difference is that the template object is now passed in place of the smarty object. -The smarty object can be still be accessed through $template->smarty. - -smarty_plugintype_name (array $params, Smarty_Internal_Template $template) - -The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty 2 internals. - - -TEMPLATE INHERITANCE: -===================== - -With template inheritance you can define blocks, which are areas that can be -overridden by child templates, so your templates could look like this: - -parent.tpl: - - - {block name='title'}My site name{/block} - - -

    {block name='page-title'}Default page title{/block}

    -
    - {block name='content'} - Default content - {/block} -
    - - - -child.tpl: -{extends file='parent.tpl'} -{block name='title'} -Child title -{/block} - -grandchild.tpl: -{extends file='child.tpl'} -{block name='title'}Home - {$smarty.block.parent}{/block} -{block name='page-title'}My home{/block} -{block name='content'} - {foreach $images as $img} - {$img.description} - {/foreach} -{/block} - -We redefined all the blocks here, however in the title block we used {$smarty.block.parent}, -which tells Smarty to insert the default content from the parent template in its place. -The content block was overridden to display the image files, and page-title has also be -overridden to display a completely different title. - -If we render grandchild.tpl we will get this: - - - Home - Child title - - -

    My home

    -
    - image - image - image -
    - - - -NOTE: In the child templates everything outside the {extends} or {block} tag sections -is ignored. - -The inheritance tree can be as big as you want (meaning you can extend a file that -extends another one that extends another one and so on..), but be aware that all files -have to be checked for modifications at runtime so the more inheritance the more overhead you add. - -Instead of defining the parent/child relationships with the {extends} tag in the child template you -can use the resource as follow: - -$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl'); - -Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content -is appended or prepended to the child block content. - -{block name='title' append} My title {/block} - - -PHP STREAMS: -============ - -(see online documentation) - -VARIBLE FILTERS: -================ - -(see online documentation) - - -STATIC CLASS ACCESS AND NAMESPACE SUPPORT -========================================= - -You can register a class with optional namespace for the use in the template like: - -$smarty->register->templateClass('foo','name\name2\myclass'); - -In the template you can use it like this: -{foo::method()} etc. - - -======================= - -Please look through it and send any questions/suggestions/etc to the forums. - -http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168 - -Monte and Uwe diff --git a/src/includes/smarty-3.1.48/README.md b/src/includes/smarty-3.1.48/README.md deleted file mode 100644 index b57969c..0000000 --- a/src/includes/smarty-3.1.48/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Smarty 3 template engine -[smarty.net](https://www.smarty.net/) - -[![Build Status](https://travis-ci.org/smarty-php/smarty.svg?branch=master)](https://travis-ci.org/smarty-php/smarty) - -## Documentation - -For documentation see -[www.smarty.net/docs/en/](https://www.smarty.net/docs/en/) - -## Requirements - -Smarty can be run with PHP 5.2 to PHP 7.4. - -## Distribution repository - -> Smarty 3.1.28 introduces run time template inheritance - -> Read the NEW_FEATURES and INHERITANCE_RELEASE_NOTES file for recent extensions to Smarty 3.1 functionality - -Smarty versions 3.1.11 or later are now on GitHub and can be installed with Composer. - - -The "smarty/smarty" package will start at libs/.... subfolder. - -To get the latest stable version of Smarty 3.1 use: - -```json -"require": { - "smarty/smarty": "~3.1" -} -``` - -in your composer.json file. - -To get the trunk version use: - -```json -"require": { - "smarty/smarty": "~3.1@dev" -} -``` - -For a specific version use something like: - -```json -"require": { - "smarty/smarty": "3.1.19" -} -``` - -PHPUnit test can be installed by corresponding composer entries like: - -```json -"require": { - "smarty/smarty-phpunit": "3.1.19" -} -``` - -Similar applies for the lexer/parser generator. - -```json -"require": { - "smarty/smarty-lexer": "3.1.19" -} -``` - -Or you could use: - -```json -"require": { - "smarty/smarty-dev": "3.1.19" -} -``` - -Which is a wrapper to install all 3 packages. - -Composer can also be used for Smarty2 versions 2.6.24 to 2.6.30. diff --git a/src/includes/smarty-3.1.48/SECURITY.md b/src/includes/smarty-3.1.48/SECURITY.md deleted file mode 100644 index d98ea01..0000000 --- a/src/includes/smarty-3.1.48/SECURITY.md +++ /dev/null @@ -1,19 +0,0 @@ -# Security Policy - -## Supported Versions - -Smarty currently supports the latest minor version of Smarty 3 and Smarty 4. (Smarty 4 has not been released yet.) - -| Version | Supported | -| ------- | ------------------ | -| 4.0.x | :white_check_mark: | -| 3.1.x | :white_check_mark: | -| < 3.1 | :x: | - -## Reporting a Vulnerability - - If you have discovered a security issue with Smarty, please contact us at mail [at] simonwisselink.nl. Do not - disclose your findings publicly and PLEASE PLEASE do not file an Issue. - -We will try to confirm the vulnerability and develop a fix if appropriate. When we release the fix, we will publish -a security release. Please let us know if you want to be credited. diff --git a/src/includes/smarty-3.1.48/SMARTY_2_BC_NOTES.txt b/src/includes/smarty-3.1.48/SMARTY_2_BC_NOTES.txt deleted file mode 100644 index fd36bd3..0000000 --- a/src/includes/smarty-3.1.48/SMARTY_2_BC_NOTES.txt +++ /dev/null @@ -1,109 +0,0 @@ -= Known incompatibilities with Smarty 2 = - -== Syntax == - -Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported -by a wrapper but deprecated. See the README that comes with Smarty 3 for more -information. - -The {$array|@mod} syntax has always been a bit confusing, where an "@" is required -to apply a modifier to an array instead of the individual elements. Normally you -always want the modifier to apply to the variable regardless of its type. In Smarty 3, -{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the -modifier will still apply to the array. If you really want the modifier to apply to -each array element, you must loop the array in-template, or use a custom modifier that -supports array iteration. Most smarty functions already escape values where necessary -such as {html_options} - -== PHP Version == -Smarty 3 is PHP 5 only. It will not work with PHP 4. - -== {php} Tag == -The {php} tag is disabled by default. The use of {php} tags is -deprecated. It can be enabled with $smarty->allow_php_tag=true. - -But if you scatter PHP code which belongs together into several -{php} tags it may not work any longer. - -== Delimiters and whitespace == -Delimiters surrounded by whitespace are no longer treated as Smarty tags. -Therefore, { foo } will not compile as a tag, you must use {foo}. This change -Makes Javascript/CSS easier to work with, eliminating the need for {literal}. -This can be disabled by setting $smarty->auto_literal = false; - -== Unquoted Strings == -Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings -in parameters. Smarty3 is more restrictive. You can still pass strings without quotes -so long as they contain no special characters. (anything outside of A-Za-z0-9_) - -For example filename strings must be quoted - -{include file='path/foo.tpl'} - - -== Extending the Smarty class == -Smarty 3 makes use of the __construct method for initialization. If you are extending -the Smarty class, its constructor is not called implicitly if the your child class defines -its own constructor. In order to run Smarty's constructor, a call to parent::__construct() -within your child constructor is required. - - -class MySmarty extends Smarty { - function __construct() { - parent::__construct(); - - // your initialization code goes here - - } -} - - -== Autoloader == -Smarty 3 does register its own autoloader with spl_autoload_register. If your code has -an existing __autoload function then this function must be explicitly registered on -the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php -for further details. - -== Plugin Filenames == -Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames -to be lower case. Because of this, Smarty plugin file names must also be lowercase. -In Smarty 2, mixed case file names did work. - -== Scope of Special Smarty Variables == -In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach... -had global scope. If you had loops with the same name in subtemplates you could accidentally -overwrite values of parent template. - -In Smarty 3 these special Smarty variable have only local scope in the template which -is defining the loop. If you need their value in a subtemplate you have to pass them -as parameter. - -{include file='path/foo.tpl' index=$smarty.section.foo.index} - - -== SMARTY_RESOURCE_CHAR_SET == -Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset. -This is now used also on modifiers like escape as default charset. If your templates use -other charsets make sure that you define the constant accordingly. Otherwise you may not -get any output. - -== newline at {if} tags == -A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source. -If one of the {if} tags is at the line end you will now get a newline in the HTML output. - -== trigger_error() == -The API function trigger_error() has been removed because it did just map to PHP trigger_error. -However it's still included in the Smarty2 API wrapper. - -== Smarty constants == -The constants -SMARTY_PHP_PASSTHRU -SMARTY_PHP_QUOTE -SMARTY_PHP_REMOVE -SMARTY_PHP_ALLOW -have been replaced with class constants -Smarty::PHP_PASSTHRU -Smarty::PHP_QUOTE -Smarty::PHP_REMOVE -Smarty::PHP_ALLOW - diff --git a/src/includes/smarty-3.1.48/SMARTY_3.0_BC_NOTES.txt b/src/includes/smarty-3.1.48/SMARTY_3.0_BC_NOTES.txt deleted file mode 100644 index 24bdec6..0000000 --- a/src/includes/smarty-3.1.48/SMARTY_3.0_BC_NOTES.txt +++ /dev/null @@ -1,24 +0,0 @@ -== Smarty2 backward compatibility == -All Smarty2 specific API functions and deprecated functionality has been moved -to the SmartyBC class. - -== {php} Tag == -The {php} tag is no longer available in the standard Smarty calls. -The use of {php} tags is deprecated and only available in the SmartyBC class. - -== {include_php} Tag == -The {include_php} tag is no longer available in the standard Smarty calls. -The use of {include_php} tags is deprecated and only available in the SmartyBC class. - -== php template resource == -The support of the php template resource is removed. - -== $cache_dir, $compile_dir, $config_dir, $template_dir access == -The mentioned properties can't be accessed directly any longer. You must use -corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir() - -== obsolete Smarty class properties == -The following no longer used properties are removed: -$allow_php_tag -$allow_php_template -$deprecation_notices \ No newline at end of file diff --git a/src/includes/smarty-3.1.48/SMARTY_3.1_NOTES.txt b/src/includes/smarty-3.1.48/SMARTY_3.1_NOTES.txt deleted file mode 100644 index d7c23cc..0000000 --- a/src/includes/smarty-3.1.48/SMARTY_3.1_NOTES.txt +++ /dev/null @@ -1,306 +0,0 @@ -Smarty 3.1 Notes -================ - -Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all -backward compatibility has been moved to a separate class file named -SmartyBC.class.php. If you require compatibility with 2.0, you will -need to use this class. - -Some differences from 3.0 are also present. 3.1 begins the journey of -requiring setters/getters for property access. So far this is only -implemented on the five directory properties: template_dir, -plugins_dir, configs_dir, compile_dir and cache_dir. These properties -are now protected, it is required to use the setters/getters instead. -That said, direct property access will still work, however slightly -slower since they will now fall through __set() and __get() and in -turn passed through the setter/getter methods. 3.2 will exhibit a full -list of setter/getter methods for all (currently) public properties, -so code-completion in your IDE will work as expected. - -There is absolutely no PHP allowed in templates any more. All -deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC -class if you need any backward compatibility. - -Internal Changes - - Full UTF-8 Compatibility - -The plugins shipped with Smarty 3.1 have been rewritten to fully -support UTF-8 strings if Multibyte String is available. Without -MBString UTF-8 cannot be handled properly. For those rare cases where -templates themselves have to juggle encodings, the new modifiers -to_charset and from_charset may come in handy. - - Plugin API and Performance - -All Plugins (modifiers, functions, blocks, resources, -default_template_handlers, etc) are now receiving the -Smarty_Internal_Template instance, where they were supplied with the -Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template -mimics the behavior of Smarty, this API simplification should not -require any changes to custom plugins. - -The plugins shipped with Smarty 3.1 have been rewritten for better -performance. Most notably {html_select_date} and {html_select_time} -have been improved vastly. Performance aside, plugins have also been -reviewed and generalized in their API. {html_select_date} and -{html_select_time} now share almost all available options. - -The escape modifier now knows the $double_encode option, which will -prevent entities from being encoded again. - -The capitalize modifier now know the $lc_rest option, which makes sure -all letters following a capital letter are lower-cased. - -The count_sentences modifier now accepts (.?!) as -legitimate endings of a sentence - previously only (.) was -accepted - -The new unescape modifier is there to reverse the effects of the -escape modifier. This applies to the escape formats html, htmlall and -entity. - - default_template_handler_func - -The invocation of $smarty->$default_template_handler_func had to be -altered. Instead of a Smarty_Internal_Template, the fifth argument is -now provided with the Smarty instance. New footprint: - - -/** - * Default Template Handler - * - * called when Smarty's file: resource is unable to load a requested file - * - * @param string $type resource type (e.g. "file", "string", "eval", "resource") - * @param string $name resource name (e.g. "foo/bar.tpl") - * @param string &$content template's content - * @param integer &$modified template's modification time - * @param Smarty $smarty Smarty instance - * @return string|boolean path to file or boolean true if $content and $modified - * have been filled, boolean false if no default template - * could be loaded - */ -function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) { - if (false) { - // return corrected filepath - return "/tmp/some/foobar.tpl"; - } elseif (false) { - // return a template directly - $content = "the template source"; - $modified = time(); - return true; - } else { - // tell smarty that we failed - return false; - } -} - - Stuff done to the compiler - -Many performance improvements have happened internally. One notable -improvement is that all compiled templates are now handled as PHP -functions. This speeds up repeated templates tremendously, as each one -calls an (in-memory) PHP function instead of performing another file -include/scan. - -New Features - - Template syntax - - {block}..{/block} - -The {block} tag has a new hide option flag. It does suppress the block -content if no corresponding child block exists. -EXAMPLE: -parent.tpl -{block name=body hide} child content "{$smarty.block.child}" was -inserted {block} -In the above example the whole block will be suppressed if no child -block "body" is existing. - - {setfilter}..{/setfilter} - -The new {setfilter} block tag allows the definition of filters which -run on variable output. -SYNTAX: -{setfilter filter1|filter2|filter3....} -Smarty3 will lookup up matching filters in the following search order: -1. variable filter plugin in plugins_dir. -2. a valid modifier. A modifier specification will also accept -additional parameter like filter2:'foo' -3. a PHP function -{/setfilter} will turn previous filter setting off again. -{setfilter} tags can be nested. -EXAMPLE: -{setfilter filter1} - {$foo} - {setfilter filter2} - {$bar} - {/setfilter} - {$buh} -{/setfilter} -{$blar} -In the above example filter1 will run on the output of $foo, filter2 -on $bar, filter1 again on $buh and no filter on $blar. -NOTES: -- {$foo nofilter} will suppress the filters -- These filters will run in addition to filters defined by -registerFilter('variable',...), autoLoadFilter('variable',...) and -defined default modifier. -- {setfilter} will effect only the current template, not included -subtemplates. - - Resource API - -Smarty 3.1 features a new approach to resource management. The -Smarty_Resource API allows simple, yet powerful integration of custom -resources for templates and configuration files. It offers simple -functions for loading data from a custom resource (e.g. database) as -well as define new template types adhering to the special -non-compiling (e,g, plain php) and non-compile-caching (e.g. eval: -resource type) resources. - -See demo/plugins/resource.mysql.php for an example custom database -resource. - -Note that old-fashioned registration of callbacks for resource -management has been deprecated but is still possible with SmartyBC. - - CacheResource API - -In line with the Resource API, the CacheResource API offers a more -comfortable handling of output-cache data. With the -Smarty_CacheResource_Custom accessing databases is made simple. With -the introduction of Smarty_CacheResource_KeyValueStore the -implementation of resources like memcache or APC became a no-brainer; -simple hash-based storage systems are now supporting hierarchical -output-caches. - -See demo/plugins/cacheresource.mysql.php for an example custom -database CacheResource. -See demo/plugins/cacheresource.memcache.php for an example custom -memcache CacheResource using the KeyValueStore helper. - -Note that old-fashioned registration of $cache_handler is not possible -anymore. As the functionality had not been ported to Smarty 3.0.x -properly, it has been dropped from 3.1 completely. - -Locking facilities have been implemented to avoid concurrent cache -generation. Enable cache locking by setting -$smarty->cache_locking = true; - - Relative Paths in Templates (File-Resource) - -As of Smarty 3.1 {include file="../foo.tpl"} and {include -file="./foo.tpl"} will resolve relative to the template they're in. -Relative paths are available with {include file="..."} and -{extends file="..."}. As $smarty->fetch('../foo.tpl') and -$smarty->fetch('./foo.tpl') cannot be relative to a template, an -exception is thrown. - - Addressing a specific $template_dir - -Smarty 3.1 introduces the $template_dir index notation. -$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} -require the template bar.tpl to be loaded from $template_dir['foo']; -Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to -define indexes along with the actual directories. - - Mixing Resources in extends-Resource - -Taking the php extends: template resource one step further, it is now -possible to mix resources within an extends: call like -$smarty->fetch("extends:file:foo.tpl|db:bar.tpl"); - -To make eval: and string: resources available to the inheritance -chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been -introduced. Supplying the base64 or urlencode flags will trigger -decoding the TPL_STRING in with either base64_decode() or urldecode(). - - extends-Resource in template inheritance - -Template based inheritance may now inherit from php's extends: -resource like {extends file="extends:foo.tpl|db:bar.tpl"}. - - New Smarty property escape_html - -$smarty->escape_html = true will autoescape all template variable -output by calling htmlspecialchars({$output}, ENT_QUOTES, -SMARTY_RESOURCE_CHAR_SET). -NOTE: -This is a compile time option. If you change the setting you must make -sure that the templates get recompiled. - - New option at Smarty property compile_check - -The automatic recompilation of modified templates can now be -controlled by the following settings: -$smarty->compile_check = COMPILECHECK_OFF (false) - template files -will not be checked -$smarty->compile_check = COMPILECHECK_ON (true) - template files will -always be checked -$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will -be checked if caching is enabled and there is no existing cache file -or it has expired - - Automatic recompilation on Smarty version change - -Templates will now be automatically recompiled on Smarty version -changes to avoide incompatibillities in the compiled code. Compiled -template checked against the current setting of the SMARTY_VERSION -constant. - - default_config_handler_func() - -Analogous to the default_template_handler_func() -default_config_handler_func() has been introduced. - - default_plugin_handler_func() - -An optional default_plugin_handler_func() can be defined which gets called -by the compiler on tags which can't be resolved internally or by plugins. -The default_plugin_handler() can map tags to plugins on the fly. - -New getters/setters - -The following setters/getters will be part of the official -documentation, and will be strongly recommended. Direct property -access will still work for the foreseeable future... it will be -transparently routed through the setters/getters, and consequently a -bit slower. - -array|string getTemplateDir( [string $index] ) -replaces $smarty->template_dir; and $smarty->template_dir[$index]; -Smarty setTemplateDir( array|string $path ) -replaces $smarty->template_dir = "foo"; and $smarty->template_dir = -array("foo", "bar"); -Smarty addTemplateDir( array|string $path, [string $index]) -replaces $smarty->template_dir[] = "bar"; and -$smarty->template_dir[$index] = "bar"; - -array|string getConfigDir( [string $index] ) -replaces $smarty->config_dir; and $smarty->config_dir[$index]; -Smarty setConfigDir( array|string $path ) -replaces $smarty->config_dir = "foo"; and $smarty->config_dir = -array("foo", "bar"); -Smarty addConfigDir( array|string $path, [string $index]) -replaces $smarty->config_dir[] = "bar"; and -$smarty->config_dir[$index] = "bar"; - -array getPluginsDir() -replaces $smarty->plugins_dir; -Smarty setPluginsDir( array|string $path ) -replaces $smarty->plugins_dir = "foo"; -Smarty addPluginsDir( array|string $path ) -replaces $smarty->plugins_dir[] = "bar"; - -string getCompileDir() -replaces $smarty->compile_dir; -Smarty setCompileDir( string $path ) -replaces $smarty->compile_dir = "foo"; - -string getCacheDir() -replaces $smarty->cache_dir; -Smarty setCacheDir( string $path ) -replaces $smarty->cache_dir; diff --git a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.apc.php b/src/includes/smarty-3.1.48/demo/plugins/cacheresource.apc.php deleted file mode 100644 index 7867cc5..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.apc.php +++ /dev/null @@ -1,85 +0,0 @@ - $v) { - $_res[ $k ] = $v; - } - return $_res; - } - - /** - * Save values for a set of keys to cache - * - * @param array $keys list of values to save - * @param int $expire expiration time - * - * @return boolean true on success, false on failure - */ - protected function write(array $keys, $expire = null) - { - foreach ($keys as $k => $v) { - apc_store($k, $v, $expire); - } - return true; - } - - /** - * Remove values from cache - * - * @param array $keys list of keys to delete - * - * @return boolean true on success, false on failure - */ - protected function delete(array $keys) - { - foreach ($keys as $k) { - apc_delete($k); - } - return true; - } - - /** - * Remove *all* values from cache - * - * @return boolean true on success, false on failure - */ - protected function purge() - { - return apc_clear_cache('user'); - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.memcache.php b/src/includes/smarty-3.1.48/demo/plugins/cacheresource.memcache.php deleted file mode 100644 index 71fe9d3..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.memcache.php +++ /dev/null @@ -1,99 +0,0 @@ -memcache = new Memcached(); - } else { - $this->memcache = new Memcache(); - } - $this->memcache->addServer('127.0.0.1', 11211); - } - - /** - * Read values for a set of keys from cache - * - * @param array $keys list of keys to fetch - * - * @return array list of values with the given keys used as indexes - * @return boolean true on success, false on failure - */ - protected function read(array $keys) - { - $res = array(); - foreach ($keys as $key) { - $k = sha1($key); - $res[$key] = $this->memcache->get($k); - } - return $res; - } - - /** - * Save values for a set of keys to cache - * - * @param array $keys list of values to save - * @param int $expire expiration time - * - * @return boolean true on success, false on failure - */ - protected function write(array $keys, $expire = null) - { - foreach ($keys as $k => $v) { - $k = sha1($k); - if (class_exists('Memcached')) { - $this->memcache->set($k, $v, $expire); - } else { - $this->memcache->set($k, $v, 0, $expire); - } - } - return true; - } - - /** - * Remove values from cache - * - * @param array $keys list of keys to delete - * - * @return boolean true on success, false on failure - */ - protected function delete(array $keys) - { - foreach ($keys as $k) { - $k = sha1($k); - $this->memcache->delete($k); - } - return true; - } - - /** - * Remove *all* values from cache - * - * @return boolean true on success, false on failure - */ - protected function purge() - { - return $this->memcache->flush(); - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.mysql.php b/src/includes/smarty-3.1.48/demo/plugins/cacheresource.mysql.php deleted file mode 100644 index c5037eb..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.mysql.php +++ /dev/null @@ -1,183 +0,0 @@ -CREATE TABLE IF NOT EXISTS `output_cache` ( - * `id` CHAR(40) NOT NULL COMMENT 'sha1 hash', - * `name` VARCHAR(250) NOT NULL, - * `cache_id` VARCHAR(250) NULL DEFAULT NULL, - * `compile_id` VARCHAR(250) NULL DEFAULT NULL, - * `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - * `content` LONGTEXT NOT NULL, - * PRIMARY KEY (`id`), - * INDEX(`name`), - * INDEX(`cache_id`), - * INDEX(`compile_id`), - * INDEX(`modified`) - * ) ENGINE = InnoDB; - * - * @package CacheResource-examples - * @author Rodney Rehm - */ -class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom -{ - /** - * @var \PDO - */ - protected $db; - - /** - * @var \PDOStatement - */ - protected $fetch; - - /** - * @var \PDOStatement - */ - protected $fetchTimestamp; - - /** - * @var \PDOStatement - */ - protected $save; - - /** - * Smarty_CacheResource_Mysql constructor. - * - * @throws \SmartyException - */ - public function __construct() - { - try { - $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } catch (PDOException $e) { - throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); - } - $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id'); - $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id'); - $this->save = $this->db->prepare( - 'REPLACE INTO output_cache (id, name, cache_id, compile_id, content) - VALUES (:id, :name, :cache_id, :compile_id, :content)' - ); - } - - /** - * fetch cached content and its modification time from data source - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) - * - * @return void - */ - protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime) - { - $this->fetch->execute(array('id' => $id)); - $row = $this->fetch->fetch(); - $this->fetch->closeCursor(); - if ($row) { - $content = $row[ 'content' ]; - $mtime = strtotime($row[ 'modified' ]); - } else { - $content = null; - $mtime = null; - } - } - - /** - * Fetch cached content's modification timestamp from data source - * - * @note implementing this method is optional. Only implement it if modification times can be accessed faster than - * loading the complete cached content. - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * - * @return integer|boolean timestamp (epoch) the template was modified, or false if not found - */ - protected function fetchTimestamp($id, $name, $cache_id, $compile_id) - { - $this->fetchTimestamp->execute(array('id' => $id)); - $mtime = strtotime($this->fetchTimestamp->fetchColumn()); - $this->fetchTimestamp->closeCursor(); - return $mtime; - } - - /** - * Save content to cache - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null - * @param string $content content to cache - * - * @return boolean success - */ - protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content) - { - $this->save->execute( - array('id' => $id, - 'name' => $name, - 'cache_id' => $cache_id, - 'compile_id' => $compile_id, - 'content' => $content,) - ); - return !!$this->save->rowCount(); - } - - /** - * Delete content from cache - * - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration or null - * - * @return integer number of deleted caches - */ - protected function delete($name, $cache_id, $compile_id, $exp_time) - { - // delete the whole cache - if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { - // returning the number of deleted caches would require a second query to count them - $query = $this->db->query('TRUNCATE TABLE output_cache'); - return -1; - } - // build the filter - $where = array(); - // equal test name - if ($name !== null) { - $where[] = 'name = ' . $this->db->quote($name); - } - // equal test compile_id - if ($compile_id !== null) { - $where[] = 'compile_id = ' . $this->db->quote($compile_id); - } - // range test expiration time - if ($exp_time !== null) { - $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; - } - // equal test cache_id and match sub-groups - if ($cache_id !== null) { - $where[] = - '(cache_id = ' . - $this->db->quote($cache_id) . - ' OR cache_id LIKE ' . - $this->db->quote($cache_id . '|%') . - ')'; - } - // run delete query - $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); - return $query->rowCount(); - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo.php b/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo.php deleted file mode 100644 index a80cd69..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo.php +++ /dev/null @@ -1,346 +0,0 @@ -setCachingType('pdo'); - * $smarty->loadPlugin('Smarty_CacheResource_Pdo'); - * $smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdo($cnx, 'smarty_cache')); - * - * @author Beno!t POLASZEK - 2014 - */ -class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom -{ - /** - * @var string[] - */ - protected $fetchStatements = array('default' => 'SELECT %2$s - FROM %1$s - WHERE 1 - AND id = :id - AND cache_id IS NULL - AND compile_id IS NULL', - 'withCacheId' => 'SELECT %2$s - FROM %1$s - WHERE 1 - AND id = :id - AND cache_id = :cache_id - AND compile_id IS NULL', - 'withCompileId' => 'SELECT %2$s - FROM %1$s - WHERE 1 - AND id = :id - AND compile_id = :compile_id - AND cache_id IS NULL', - 'withCacheIdAndCompileId' => 'SELECT %2$s - FROM %1$s - WHERE 1 - AND id = :id - AND cache_id = :cache_id - AND compile_id = :compile_id'); - - /** - * @var string - */ - protected $insertStatement = 'INSERT INTO %s - - SET id = :id, - name = :name, - cache_id = :cache_id, - compile_id = :compile_id, - modified = CURRENT_TIMESTAMP, - expire = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL :expire SECOND), - content = :content - - ON DUPLICATE KEY UPDATE - name = :name, - cache_id = :cache_id, - compile_id = :compile_id, - modified = CURRENT_TIMESTAMP, - expire = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL :expire SECOND), - content = :content'; - - /** - * @var string - */ - protected $deleteStatement = 'DELETE FROM %1$s WHERE %2$s'; - - /** - * @var string - */ - protected $truncateStatement = 'TRUNCATE TABLE %s'; - - /** - * @var string - */ - protected $fetchColumns = 'modified, content'; - - /** - * @var string - */ - protected $fetchTimestampColumns = 'modified'; - - /** - * @var \PDO - */ - protected $pdo; - - /** - * @var - */ - protected $table; - - /** - * @var null - */ - protected $database; - - /** - * Constructor - * - * @param PDO $pdo PDO : active connection - * @param string $table : table (or view) name - * @param string $database : optional - if table is located in another db - * - * @throws \SmartyException - */ - public function __construct(PDO $pdo, $table, $database = null) - { - if (is_null($table)) { - throw new SmartyException("Table name for caching can't be null"); - } - $this->pdo = $pdo; - $this->table = $table; - $this->database = $database; - $this->fillStatementsWithTableName(); - } - - /** - * Fills the table name into the statements. - * - * @return $this Current Instance - * @access protected - */ - protected function fillStatementsWithTableName() - { - foreach ($this->fetchStatements as &$statement) { - $statement = sprintf($statement, $this->getTableName(), '%s'); - } - $this->insertStatement = sprintf($this->insertStatement, $this->getTableName()); - $this->deleteStatement = sprintf($this->deleteStatement, $this->getTableName(), '%s'); - $this->truncateStatement = sprintf($this->truncateStatement, $this->getTableName()); - return $this; - } - - /** - * Gets the fetch statement, depending on what you specify - * - * @param string $columns : the column(s) name(s) you want to retrieve from the database - * @param string $id unique cache content identifier - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * - * @access protected - * @return \PDOStatement - */ - protected function getFetchStatement($columns, $id, $cache_id = null, $compile_id = null) - { - $args = array(); - if (!is_null($cache_id) && !is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCacheIdAndCompileId' ] and - $args = array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id); - } elseif (is_null($cache_id) && !is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCompileId' ] and - $args = array('id' => $id, 'compile_id' => $compile_id); - } elseif (!is_null($cache_id) && is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCacheId' ] and $args = array('id' => $id, 'cache_id' => $cache_id); - } else { - $query = $this->fetchStatements[ 'default' ] and $args = array('id' => $id); - } - $query = sprintf($query, $columns); - $stmt = $this->pdo->prepare($query); - foreach ($args as $key => $value) { - $stmt->bindValue($key, $value); - } - return $stmt; - } - - /** - * fetch cached content and its modification time from data source - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) - * - * @return void - * @access protected - */ - protected function fetch($id, $name, $cache_id = null, $compile_id = null, &$content, &$mtime) - { - $stmt = $this->getFetchStatement($this->fetchColumns, $id, $cache_id, $compile_id); - $stmt->execute(); - $row = $stmt->fetch(); - $stmt->closeCursor(); - if ($row) { - $content = $this->outputContent($row[ 'content' ]); - $mtime = strtotime($row[ 'modified' ]); - } else { - $content = null; - $mtime = null; - } - } - - /** - * Fetch cached content's modification timestamp from data source - * {@internal implementing this method is optional. - * Only implement it if modification times can be accessed faster than loading the complete cached content.}} - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * - * @return integer|boolean timestamp (epoch) the template was modified, or false if not found - * @access protected - */ - // protected function fetchTimestamp($id, $name, $cache_id = null, $compile_id = null) { - // $stmt = $this->getFetchStatement($this->fetchTimestampColumns, $id, $cache_id, $compile_id); - // $stmt -> execute(); - // $mtime = strtotime($stmt->fetchColumn()); - // $stmt -> closeCursor(); - // return $mtime; - // } - /** - * Save content to cache - * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null - * @param string $content content to cache - * - * @return boolean success - * @access protected - */ - protected function save($id, $name, $cache_id = null, $compile_id = null, $exp_time, $content) - { - $stmt = $this->pdo->prepare($this->insertStatement); - $stmt->bindValue('id', $id); - $stmt->bindValue('name', $name); - $stmt->bindValue('cache_id', $cache_id, (is_null($cache_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR); - $stmt->bindValue('compile_id', $compile_id, (is_null($compile_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR); - $stmt->bindValue('expire', (int)$exp_time, PDO::PARAM_INT); - $stmt->bindValue('content', $this->inputContent($content)); - $stmt->execute(); - return !!$stmt->rowCount(); - } - - /** - * Encodes the content before saving to database - * - * @param string $content - * - * @return string $content - * @access protected - */ - protected function inputContent($content) - { - return $content; - } - - /** - * Decodes the content before saving to database - * - * @param string $content - * - * @return string $content - * @access protected - */ - protected function outputContent($content) - { - return $content; - } - - /** - * Delete content from cache - * - * @param string|null $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param integer|null|-1 $exp_time seconds till expiration or null - * - * @return integer number of deleted caches - * @access protected - */ - protected function delete($name = null, $cache_id = null, $compile_id = null, $exp_time = null) - { - // delete the whole cache - if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { - // returning the number of deleted caches would require a second query to count them - $this->pdo->query($this->truncateStatement); - return -1; - } - // build the filter - $where = array(); - // equal test name - if ($name !== null) { - $where[] = 'name = ' . $this->pdo->quote($name); - } - // equal test cache_id and match sub-groups - if ($cache_id !== null) { - $where[] = - '(cache_id = ' . - $this->pdo->quote($cache_id) . - ' OR cache_id LIKE ' . - $this->pdo->quote($cache_id . '|%') . - ')'; - } - // equal test compile_id - if ($compile_id !== null) { - $where[] = 'compile_id = ' . $this->pdo->quote($compile_id); - } - // for clearing expired caches - if ($exp_time === Smarty::CLEAR_EXPIRED) { - $where[] = 'expire < CURRENT_TIMESTAMP'; - } // range test expiration time - elseif ($exp_time !== null) { - $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; - } - // run delete query - $query = $this->pdo->query(sprintf($this->deleteStatement, join(' AND ', $where))); - return $query->rowCount(); - } - - /** - * Gets the formatted table name - * - * @return string - * @access protected - */ - protected function getTableName() - { - return (is_null($this->database)) ? "`{$this->table}`" : "`{$this->database}`.`{$this->table}`"; - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo_gzip.php b/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo_gzip.php deleted file mode 100644 index 5560b9e..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/cacheresource.pdo_gzip.php +++ /dev/null @@ -1,42 +0,0 @@ -setCachingType('pdo_gzip'); - * $smarty->loadPlugin('Smarty_CacheResource_Pdo_Gzip'); - * $smarty->registerCacheResource('pdo_gzip', new Smarty_CacheResource_Pdo_Gzip($cnx, 'smarty_cache')); - * - * @require Smarty_CacheResource_Pdo class - * @author Beno!t POLASZEK - 2014 - */ -class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo -{ - /** - * Encodes the content before saving to database - * - * @param string $content - * - * @return string $content - * @access protected - */ - protected function inputContent($content) - { - return gzdeflate($content); - } - - /** - * Decodes the content before saving to database - * - * @param string $content - * - * @return string $content - * @access protected - */ - protected function outputContent($content) - { - return gzinflate($content); - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/resource.extendsall.php b/src/includes/smarty-3.1.48/demo/plugins/resource.extendsall.php deleted file mode 100644 index a547d41..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/resource.extendsall.php +++ /dev/null @@ -1,62 +0,0 @@ -smarty->getTemplateDir() as $key => $directory) { - try { - $s = Smarty_Resource::source(null, $source->smarty, 'file:' . '[' . $key . ']' . $source->name); - if (!$s->exists) { - continue; - } - $sources[ $s->uid ] = $s; - $uid .= $s->filepath; - $timestamp = $s->timestamp > $timestamp ? $s->timestamp : $timestamp; - } catch (SmartyException $e) { - } - } - if (!$sources) { - $source->exists = false; - return; - } - $sources = array_reverse($sources, true); - reset($sources); - $s = current($sources); - $source->components = $sources; - $source->filepath = $s->filepath; - $source->uid = sha1($uid . $source->smarty->_joined_template_dir); - $source->exists = true; - $source->timestamp = $timestamp; - } - - /** - * Disable timestamp checks for extendsall resource. - * The individual source components will be checked. - * - * @return bool false - */ - public function checkTimestamps() - { - return false; - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/resource.mysql.php b/src/includes/smarty-3.1.48/demo/plugins/resource.mysql.php deleted file mode 100644 index 95a3c2b..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/resource.mysql.php +++ /dev/null @@ -1,101 +0,0 @@ -CREATE TABLE IF NOT EXISTS `templates` ( - * `name` varchar(100) NOT NULL, - * `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - * `source` text, - * PRIMARY KEY (`name`) - * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - * Demo data: - *
    INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello
    - * world"}{$x}');
    - * - * - * @package Resource-examples - * @author Rodney Rehm - */ -class Smarty_Resource_Mysql extends Smarty_Resource_Custom -{ - /** - * PDO instance - * - * @var \PDO - */ - protected $db; - - /** - * prepared fetch() statement - * - * @var \PDOStatement - */ - protected $fetch; - - /** - * prepared fetchTimestamp() statement - * - * @var \PDOStatement - */ - protected $mtime; - - /** - * Smarty_Resource_Mysql constructor. - * - * @throws \SmartyException - */ - public function __construct() - { - try { - $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } catch (PDOException $e) { - throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); - } - $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); - $this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name'); - } - - /** - * Fetch a template and its modification time from database - * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) - * - * @return void - */ - protected function fetch($name, &$source, &$mtime) - { - $this->fetch->execute(array('name' => $name)); - $row = $this->fetch->fetch(); - $this->fetch->closeCursor(); - if ($row) { - $source = $row[ 'source' ]; - $mtime = strtotime($row[ 'modified' ]); - } else { - $source = null; - $mtime = null; - } - } - - /** - * Fetch a template's modification time from database - * - * @note implementing this method is optional. Only implement it if modification times can be accessed faster than - * loading the comple template source. - * - * @param string $name template name - * - * @return integer timestamp (epoch) the template was modified - */ - protected function fetchTimestamp($name) - { - $this->mtime->execute(array('name' => $name)); - $mtime = $this->mtime->fetchColumn(); - $this->mtime->closeCursor(); - return strtotime($mtime); - } -} diff --git a/src/includes/smarty-3.1.48/demo/plugins/resource.mysqls.php b/src/includes/smarty-3.1.48/demo/plugins/resource.mysqls.php deleted file mode 100644 index 148a8dd..0000000 --- a/src/includes/smarty-3.1.48/demo/plugins/resource.mysqls.php +++ /dev/null @@ -1,77 +0,0 @@ -CREATE TABLE IF NOT EXISTS `templates` ( - * `name` varchar(100) NOT NULL, - * `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - * `source` text, - * PRIMARY KEY (`name`) - * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - * Demo data: - *
    INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello
    - * world"}{$x}');
    - * - * - * @package Resource-examples - * @author Rodney Rehm - */ -class Smarty_Resource_Mysqls extends Smarty_Resource_Custom -{ - /** - * PDO instance - * - * @var \PDO - */ - protected $db; - - /** - * prepared fetch() statement - * - * @var \PDOStatement - */ - protected $fetch; - - /** - * Smarty_Resource_Mysqls constructor. - * - * @throws \SmartyException - */ - public function __construct() - { - try { - $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } catch (PDOException $e) { - throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); - } - $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); - } - - /** - * Fetch a template and its modification time from database - * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) - * - * @return void - */ - protected function fetch($name, &$source, &$mtime) - { - $this->fetch->execute(array('name' => $name)); - $row = $this->fetch->fetch(); - $this->fetch->closeCursor(); - if ($row) { - $source = $row[ 'source' ]; - $mtime = strtotime($row[ 'modified' ]); - } else { - $source = null; - $mtime = null; - } - } -} diff --git a/src/includes/smarty-3.1.48/libs/Autoloader.php b/src/includes/smarty-3.1.48/libs/Autoloader.php deleted file mode 100644 index c09361b..0000000 --- a/src/includes/smarty-3.1.48/libs/Autoloader.php +++ /dev/null @@ -1,110 +0,0 @@ - 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',); - - /** - * Registers Smarty_Autoloader backward compatible to older installations. - * - * @param bool $prepend Whether to prepend the autoloader or not. - */ - public static function registerBC($prepend = false) - { - /** - * register the class autoloader - */ - if (!defined('SMARTY_SPL_AUTOLOAD')) { - define('SMARTY_SPL_AUTOLOAD', 0); - } - if (SMARTY_SPL_AUTOLOAD - && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false - ) { - $registeredAutoLoadFunctions = spl_autoload_functions(); - if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) { - spl_autoload_register(); - } - } else { - self::register($prepend); - } - } - - /** - * Registers Smarty_Autoloader as an SPL autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not. - */ - public static function register($prepend = false) - { - self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR; - self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : - self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR; - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); - } else { - spl_autoload_register(array(__CLASS__, 'autoload')); - } - } - - /** - * Handles auto loading of classes. - * - * @param string $class A class name. - */ - public static function autoload($class) - { - if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) { - return; - } - $_class = strtolower($class); - if (isset(self::$rootClasses[ $_class ])) { - $file = self::$SMARTY_DIR . self::$rootClasses[ $_class ]; - if (is_file($file)) { - include $file; - } - } else { - $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; - if (is_file($file)) { - include $file; - } - } - return; - } -} diff --git a/src/includes/smarty-3.1.48/libs/Smarty.class.php b/src/includes/smarty-3.1.48/libs/Smarty.class.php deleted file mode 100644 index a34c55e..0000000 --- a/src/includes/smarty-3.1.48/libs/Smarty.class.php +++ /dev/null @@ -1,1424 +0,0 @@ - - * @author Uwe Tews - * @author Rodney Rehm - * @package Smarty - */ -/** - * set SMARTY_DIR to absolute path to Smarty library files. - * Sets SMARTY_DIR only if user application has not already defined it. - */ -if (!defined('SMARTY_DIR')) { - /** - * - */ - define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); -} -/** - * set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins. - * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it. - */ -if (!defined('SMARTY_SYSPLUGINS_DIR')) { - /** - * - */ - define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR); -} -if (!defined('SMARTY_PLUGINS_DIR')) { - /** - * - */ - define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DIRECTORY_SEPARATOR); -} -if (!defined('SMARTY_MBSTRING')) { - /** - * - */ - define('SMARTY_MBSTRING', function_exists('mb_get_info')); -} -if (!defined('SMARTY_RESOURCE_CHAR_SET')) { - // UTF-8 can only be done properly when mbstring is available! - /** - * @deprecated in favor of Smarty::$_CHARSET - */ - define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1'); -} -if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) { - /** - * @deprecated in favor of Smarty::$_DATE_FORMAT - */ - define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y'); -} -/** - * Load Smarty_Autoloader - */ -if (!class_exists('Smarty_Autoloader')) { - include dirname(__FILE__) . '/bootstrap.php'; -} -/** - * Load always needed external class files - */ -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php'; -require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php'; - -/** - * This is the main Smarty class - * - * @package Smarty - * - * The following methods will be dynamically loaded by the extension handler when they are called. - * They are located in a corresponding Smarty_Internal_Method_xxxx class - * - * @method int clearAllCache(int $exp_time = null, string $type = null) - * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) - * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, $max_errors = null) - * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, $max_errors = null) - * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) - */ -class Smarty extends Smarty_Internal_TemplateBase -{ - /** - * smarty version - */ - const SMARTY_VERSION = '3.1.48'; - /** - * define variable scopes - */ - const SCOPE_LOCAL = 1; - const SCOPE_PARENT = 2; - const SCOPE_TPL_ROOT = 4; - const SCOPE_ROOT = 8; - const SCOPE_SMARTY = 16; - const SCOPE_GLOBAL = 32; - /** - * define caching modes - */ - const CACHING_OFF = 0; - const CACHING_LIFETIME_CURRENT = 1; - const CACHING_LIFETIME_SAVED = 2; - /** - * define constant for clearing cache files be saved expiration dates - */ - const CLEAR_EXPIRED = -1; - /** - * define compile check modes - */ - const COMPILECHECK_OFF = 0; - const COMPILECHECK_ON = 1; - const COMPILECHECK_CACHEMISS = 2; - /** - * define debug modes - */ - const DEBUG_OFF = 0; - const DEBUG_ON = 1; - const DEBUG_INDIVIDUAL = 2; - /** - * modes for handling of "" tags in templates. - */ - const PHP_PASSTHRU = 0; //-> print tags as plain text - const PHP_QUOTE = 1; //-> escape tags as entities - const PHP_REMOVE = 2; //-> escape tags as entities - const PHP_ALLOW = 3; //-> escape tags as entities - /** - * filter types - */ - const FILTER_POST = 'post'; - const FILTER_PRE = 'pre'; - const FILTER_OUTPUT = 'output'; - const FILTER_VARIABLE = 'variable'; - /** - * plugin types - */ - const PLUGIN_FUNCTION = 'function'; - const PLUGIN_BLOCK = 'block'; - const PLUGIN_COMPILER = 'compiler'; - const PLUGIN_MODIFIER = 'modifier'; - const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; - - /** - * assigned global tpl vars - */ - public static $global_tpl_vars = array(); - - /** - * Flag denoting if Multibyte String functions are available - */ - public static $_MBSTRING = SMARTY_MBSTRING; - - /** - * The character set to adhere to (e.g. "UTF-8") - */ - public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; - - /** - * The date format to be used internally - * (accepts date() and strftime()) - */ - public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; - - /** - * Flag denoting if PCRE should run in UTF-8 mode - */ - public static $_UTF8_MODIFIER = 'u'; - - /** - * Flag denoting if operating system is windows - */ - public static $_IS_WINDOWS = false; - - /** - * auto literal on delimiters with whitespace - * - * @var boolean - */ - public $auto_literal = true; - - /** - * display error on not assigned variables - * - * @var boolean - */ - public $error_unassigned = false; - - /** - * look up relative file path in include_path - * - * @var boolean - */ - public $use_include_path = false; - - /** - * flag if template_dir is normalized - * - * @var bool - */ - public $_templateDirNormalized = false; - - /** - * joined template directory string used in cache keys - * - * @var string - */ - public $_joined_template_dir = null; - - /** - * flag if config_dir is normalized - * - * @var bool - */ - public $_configDirNormalized = false; - - /** - * joined config directory string used in cache keys - * - * @var string - */ - public $_joined_config_dir = null; - - /** - * default template handler - * - * @var callable - */ - public $default_template_handler_func = null; - - /** - * default config handler - * - * @var callable - */ - public $default_config_handler_func = null; - - /** - * default plugin handler - * - * @var callable - */ - public $default_plugin_handler_func = null; - - /** - * flag if template_dir is normalized - * - * @var bool - */ - public $_compileDirNormalized = false; - - /** - * flag if plugins_dir is normalized - * - * @var bool - */ - public $_pluginsDirNormalized = false; - - /** - * flag if template_dir is normalized - * - * @var bool - */ - public $_cacheDirNormalized = false; - - /** - * force template compiling? - * - * @var boolean - */ - public $force_compile = false; - - /** - * use sub dirs for compiled/cached files? - * - * @var boolean - */ - public $use_sub_dirs = false; - - /** - * allow ambiguous resources (that are made unique by the resource handler) - * - * @var boolean - */ - public $allow_ambiguous_resources = false; - - /** - * merge compiled includes - * - * @var boolean - */ - public $merge_compiled_includes = false; - - /* - * flag for behaviour when extends: resource and {extends} tag are used simultaneous - * if false disable execution of {extends} in templates called by extends resource. - * (behaviour as versions < 3.1.28) - * - * @var boolean - */ - public $extends_recursion = true; - - /** - * force cache file creation - * - * @var boolean - */ - public $force_cache = false; - - /** - * template left-delimiter - * - * @var string - */ - public $left_delimiter = "{"; - - /** - * template right-delimiter - * - * @var string - */ - public $right_delimiter = "}"; - - /** - * array of strings which shall be treated as literal by compiler - * - * @var array string - */ - public $literals = array(); - - /** - * class name - * This should be instance of Smarty_Security. - * - * @var string - * @see Smarty_Security - */ - public $security_class = 'Smarty_Security'; - - /** - * implementation of security class - * - * @var Smarty_Security - */ - public $security_policy = null; - - /** - * controls handling of PHP-blocks - * - * @var integer - */ - public $php_handling = self::PHP_PASSTHRU; - - /** - * controls if the php template file resource is allowed - * - * @var bool - */ - public $allow_php_templates = false; - - /** - * debug mode - * Setting this to true enables the debug-console. - * - * @var boolean - */ - public $debugging = false; - - /** - * This determines if debugging is enable-able from the browser. - * - * - * @var string - */ - public $debugging_ctrl = 'NONE'; - - /** - * Name of debugging URL-param. - * Only used when $debugging_ctrl is set to 'URL'. - * The name of the URL-parameter that activates debugging. - * - * @var string - */ - public $smarty_debug_id = 'SMARTY_DEBUG'; - - /** - * Path of debug template. - * - * @var string - */ - public $debug_tpl = null; - - /** - * When set, smarty uses this value as error_reporting-level. - * - * @var int - */ - public $error_reporting = null; - - /** - * Controls whether variables with the same name overwrite each other. - * - * @var boolean - */ - public $config_overwrite = true; - - /** - * Controls whether config values of on/true/yes and off/false/no get converted to boolean. - * - * @var boolean - */ - public $config_booleanize = true; - - /** - * Controls whether hidden config sections/vars are read from the file. - * - * @var boolean - */ - public $config_read_hidden = false; - - /** - * locking concurrent compiles - * - * @var boolean - */ - public $compile_locking = true; - - /** - * Controls whether cache resources should use locking mechanism - * - * @var boolean - */ - public $cache_locking = false; - - /** - * seconds to wait for acquiring a lock before ignoring the write lock - * - * @var float - */ - public $locking_timeout = 10; - - /** - * resource type used if none given - * Must be an valid key of $registered_resources. - * - * @var string - */ - public $default_resource_type = 'file'; - - /** - * caching type - * Must be an element of $cache_resource_types. - * - * @var string - */ - public $caching_type = 'file'; - - /** - * config type - * - * @var string - */ - public $default_config_type = 'file'; - - /** - * check If-Modified-Since headers - * - * @var boolean - */ - public $cache_modified_check = false; - - /** - * registered plugins - * - * @var array - */ - public $registered_plugins = array(); - - /** - * registered objects - * - * @var array - */ - public $registered_objects = array(); - - /** - * registered classes - * - * @var array - */ - public $registered_classes = array(); - - /** - * registered filters - * - * @var array - */ - public $registered_filters = array(); - - /** - * registered resources - * - * @var array - */ - public $registered_resources = array(); - - /** - * registered cache resources - * - * @var array - */ - public $registered_cache_resources = array(); - - /** - * autoload filter - * - * @var array - */ - public $autoload_filters = array(); - - /** - * default modifier - * - * @var array - */ - public $default_modifiers = array(); - - /** - * autoescape variable output - * - * @var boolean - */ - public $escape_html = false; - - /** - * start time for execution time calculation - * - * @var int - */ - public $start_time = 0; - - /** - * required by the compiler for BC - * - * @var string - */ - public $_current_file = null; - - /** - * internal flag to enable parser debugging - * - * @var bool - */ - public $_parserdebug = false; - - /** - * This object type (Smarty = 1, template = 2, data = 4) - * - * @var int - */ - public $_objType = 1; - - /** - * Debug object - * - * @var Smarty_Internal_Debug - */ - public $_debug = null; - - /** - * template directory - * - * @var array - */ - protected $template_dir = array('./templates/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedTemplateDir = array(); - - /** - * config directory - * - * @var array - */ - protected $config_dir = array('./configs/'); - - /** - * flags for normalized template directory entries - * - * @var array - */ - protected $_processedConfigDir = array(); - - /** - * compile directory - * - * @var string - */ - protected $compile_dir = './templates_c/'; - - /** - * plugins directory - * - * @var array - */ - protected $plugins_dir = array(); - - /** - * cache directory - * - * @var string - */ - protected $cache_dir = './cache/'; - - /** - * removed properties - * - * @var string[] - */ - protected $obsoleteProperties = array( - 'resource_caching', 'template_resource_caching', 'direct_access_security', - '_dir_perms', '_file_perms', 'plugin_search_order', - 'inheritance_merge_compiled_includes', 'resource_cache_mode', - ); - - /** - * List of private properties which will call getter/setter on a direct access - * - * @var string[] - */ - protected $accessMap = array( - 'template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', - 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', - 'cache_dir' => 'CacheDir', - ); - - /** - * Initialize new Smarty object - */ - public function __construct() - { - $this->_clearTemplateCache(); - parent::__construct(); - if (is_callable('mb_internal_encoding')) { - mb_internal_encoding(Smarty::$_CHARSET); - } - $this->start_time = microtime(true); - if (isset($_SERVER[ 'SCRIPT_NAME' ])) { - Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]); - } - // Check if we're running on windows - Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; - // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8 - if (Smarty::$_CHARSET !== 'UTF-8') { - Smarty::$_UTF8_MODIFIER = ''; - } - } - - /** - * Enable error handler to mute expected messages - * - * @return boolean - * @deprecated - */ - public static function muteExpectedErrors() - { - return Smarty_Internal_ErrorHandler::muteExpectedErrors(); - } - - /** - * Disable error handler muting expected messages - * - * @deprecated - */ - public static function unmuteExpectedErrors() - { - restore_error_handler(); - } - - /** - * Check if a template resource exists - * - * @param string $resource_name template name - * - * @return bool status - * @throws \SmartyException - */ - public function templateExists($resource_name) - { - // create source object - $source = Smarty_Template_Source::load(null, $this, $resource_name); - return $source->exists; - } - - /** - * Loads security class and enables security - * - * @param string|Smarty_Security $security_class if a string is used, it must be class-name - * - * @return Smarty current Smarty instance for chaining - * @throws \SmartyException - */ - public function enableSecurity($security_class = null) - { - Smarty_Security::enableSecurity($this, $security_class); - return $this; - } - - /** - * Disable security - * - * @return Smarty current Smarty instance for chaining - */ - public function disableSecurity() - { - $this->security_policy = null; - return $this; - } - - /** - * Add template directory(s) - * - * @param string|array $template_dir directory(s) of template sources - * @param string $key of the array element to assign the template dir to - * @param bool $isConfig true for config_dir - * - * @return Smarty current Smarty instance for chaining - */ - public function addTemplateDir($template_dir, $key = null, $isConfig = false) - { - if ($isConfig) { - $processed = &$this->_processedConfigDir; - $dir = &$this->config_dir; - $this->_configDirNormalized = false; - } else { - $processed = &$this->_processedTemplateDir; - $dir = &$this->template_dir; - $this->_templateDirNormalized = false; - } - if (is_array($template_dir)) { - foreach ($template_dir as $k => $v) { - if (is_int($k)) { - // indexes are not merged but appended - $dir[] = $v; - } else { - // string indexes are overridden - $dir[ $k ] = $v; - unset($processed[ $key ]); - } - } - } else { - if ($key !== null) { - // override directory at specified index - $dir[ $key ] = $template_dir; - unset($processed[ $key ]); - } else { - // append new directory - $dir[] = $template_dir; - } - } - return $this; - } - - /** - * Get template directories - * - * @param mixed $index index of directory to get, null to get all - * @param bool $isConfig true for config_dir - * - * @return array|string list of template directories, or directory of $index - */ - public function getTemplateDir($index = null, $isConfig = false) - { - if ($isConfig) { - $dir = &$this->config_dir; - } else { - $dir = &$this->template_dir; - } - if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) { - $this->_normalizeTemplateConfig($isConfig); - } - if ($index !== null) { - return isset($dir[ $index ]) ? $dir[ $index ] : null; - } - return $dir; - } - - /** - * Set template directory - * - * @param string|array $template_dir directory(s) of template sources - * @param bool $isConfig true for config_dir - * - * @return \Smarty current Smarty instance for chaining - */ - public function setTemplateDir($template_dir, $isConfig = false) - { - if ($isConfig) { - $this->config_dir = array(); - $this->_processedConfigDir = array(); - } else { - $this->template_dir = array(); - $this->_processedTemplateDir = array(); - } - $this->addTemplateDir($template_dir, null, $isConfig); - return $this; - } - - /** - * Add config directory(s) - * - * @param string|array $config_dir directory(s) of config sources - * @param mixed $key key of the array element to assign the config dir to - * - * @return Smarty current Smarty instance for chaining - */ - public function addConfigDir($config_dir, $key = null) - { - return $this->addTemplateDir($config_dir, $key, true); - } - - /** - * Get config directory - * - * @param mixed $index index of directory to get, null to get all - * - * @return array configuration directory - */ - public function getConfigDir($index = null) - { - return $this->getTemplateDir($index, true); - } - - /** - * Set config directory - * - * @param $config_dir - * - * @return Smarty current Smarty instance for chaining - */ - public function setConfigDir($config_dir) - { - return $this->setTemplateDir($config_dir, true); - } - - /** - * Adds directory of plugin files - * - * @param null|array|string $plugins_dir - * - * @return Smarty current Smarty instance for chaining - */ - public function addPluginsDir($plugins_dir) - { - if (empty($this->plugins_dir)) { - $this->plugins_dir[] = SMARTY_PLUGINS_DIR; - } - $this->plugins_dir = array_merge($this->plugins_dir, (array)$plugins_dir); - $this->_pluginsDirNormalized = false; - return $this; - } - - /** - * Get plugin directories - * - * @return array list of plugin directories - */ - public function getPluginsDir() - { - if (empty($this->plugins_dir)) { - $this->plugins_dir[] = SMARTY_PLUGINS_DIR; - $this->_pluginsDirNormalized = false; - } - if (!$this->_pluginsDirNormalized) { - if (!is_array($this->plugins_dir)) { - $this->plugins_dir = (array)$this->plugins_dir; - } - foreach ($this->plugins_dir as $k => $v) { - $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, '/\\') . DIRECTORY_SEPARATOR, true); - } - $this->_cache[ 'plugin_files' ] = array(); - $this->_pluginsDirNormalized = true; - } - return $this->plugins_dir; - } - - /** - * Set plugins directory - * - * @param string|array $plugins_dir directory(s) of plugins - * - * @return Smarty current Smarty instance for chaining - */ - public function setPluginsDir($plugins_dir) - { - $this->plugins_dir = (array)$plugins_dir; - $this->_pluginsDirNormalized = false; - return $this; - } - - /** - * Get compiled directory - * - * @return string path to compiled templates - */ - public function getCompileDir() - { - if (!$this->_compileDirNormalized) { - $this->_normalizeDir('compile_dir', $this->compile_dir); - $this->_compileDirNormalized = true; - } - return $this->compile_dir; - } - - /** - * - * @param string $compile_dir directory to store compiled templates in - * - * @return Smarty current Smarty instance for chaining - */ - public function setCompileDir($compile_dir) - { - $this->_normalizeDir('compile_dir', $compile_dir); - $this->_compileDirNormalized = true; - return $this; - } - - /** - * Get cache directory - * - * @return string path of cache directory - */ - public function getCacheDir() - { - if (!$this->_cacheDirNormalized) { - $this->_normalizeDir('cache_dir', $this->cache_dir); - $this->_cacheDirNormalized = true; - } - return $this->cache_dir; - } - - /** - * Set cache directory - * - * @param string $cache_dir directory to store cached templates in - * - * @return Smarty current Smarty instance for chaining - */ - public function setCacheDir($cache_dir) - { - $this->_normalizeDir('cache_dir', $cache_dir); - $this->_cacheDirNormalized = true; - return $this; - } - - /** - * creates a template object - * - * @param string $template the resource handle of the template file - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - * @param boolean $do_clone flag is Smarty object shall be cloned - * - * @return \Smarty_Internal_Template template object - * @throws \SmartyException - */ - public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true) - { - if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) { - $parent = $cache_id; - $cache_id = null; - } - if ($parent !== null && is_array($parent)) { - $data = $parent; - $parent = null; - } else { - $data = null; - } - if (!$this->_templateDirNormalized) { - $this->_normalizeTemplateConfig(false); - } - $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id); - $tpl = null; - if ($this->caching && isset(Smarty_Internal_Template::$isCacheTplObj[ $_templateId ])) { - $tpl = $do_clone ? clone Smarty_Internal_Template::$isCacheTplObj[ $_templateId ] : - Smarty_Internal_Template::$isCacheTplObj[ $_templateId ]; - $tpl->inheritance = null; - $tpl->tpl_vars = $tpl->config_vars = array(); - } elseif (!$do_clone && isset(Smarty_Internal_Template::$tplObjCache[ $_templateId ])) { - $tpl = clone Smarty_Internal_Template::$tplObjCache[ $_templateId ]; - $tpl->inheritance = null; - $tpl->tpl_vars = $tpl->config_vars = array(); - } else { - /* @var Smarty_Internal_Template $tpl */ - $tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null); - $tpl->templateId = $_templateId; - } - if ($do_clone) { - $tpl->smarty = clone $tpl->smarty; - } - $tpl->parent = $parent ? $parent : $this; - // fill data if present - if (!empty($data) && is_array($data)) { - // set up variable values - foreach ($data as $_key => $_val) { - $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val); - } - } - if ($this->debugging || $this->debugging_ctrl === 'URL') { - $tpl->smarty->_debug = new Smarty_Internal_Debug(); - // check URL debugging control - if (!$this->debugging && $this->debugging_ctrl === 'URL') { - $tpl->smarty->_debug->debugUrl($tpl->smarty); - } - } - return $tpl; - } - - /** - * Takes unknown classes and loads plugin files for them - * class name format: Smarty_PluginType_PluginName - * plugin filename format: plugintype.pluginname.php - * - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded - * - * @return string |boolean filepath of loaded file or false - * @throws \SmartyException - */ - public function loadPlugin($plugin_name, $check = true) - { - return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check); - } - - /** - * Get unique template id - * - * @param string $template_name - * @param null|mixed $cache_id - * @param null|mixed $compile_id - * @param null $caching - * @param \Smarty_Internal_Template $template - * - * @return string - * @throws \SmartyException - */ - public function _getTemplateId( - $template_name, - $cache_id = null, - $compile_id = null, - $caching = null, - Smarty_Internal_Template $template = null - ) { - $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : - $template_name; - $cache_id = $cache_id === null ? $this->cache_id : $cache_id; - $compile_id = $compile_id === null ? $this->compile_id : $compile_id; - $caching = (int)($caching === null ? $this->caching : $caching); - if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) { - $_templateId = - Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) . - "#{$cache_id}#{$compile_id}#{$caching}"; - } else { - $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}"; - } - if (isset($_templateId[ 150 ])) { - $_templateId = sha1($_templateId); - } - return $_templateId; - } - - /** - * Normalize path - * - remove /./ and /../ - * - make it absolute if required - * - * @param string $path file path - * @param bool $realpath if true - convert to absolute - * false - convert to relative - * null - keep as it is but - * remove /./ /../ - * - * @return string - */ - public function _realpath($path, $realpath = null) - { - $nds = array('/' => '\\', '\\' => '/'); - preg_match( - '%^(?(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?(.*))$%u', - $path, - $parts - ); - $path = $parts[ 'path' ]; - if ($parts[ 'root' ] === '\\') { - $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ]; - } else { - if ($realpath !== null && !$parts[ 'root' ]) { - $path = getcwd() . DIRECTORY_SEPARATOR . $path; - } - } - // normalize DIRECTORY_SEPARATOR - $path = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $path); - $parts[ 'root' ] = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $parts[ 'root' ]); - do { - $path = preg_replace( - array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'), - DIRECTORY_SEPARATOR, - $path, - -1, - $count - ); - } while ($count > 0); - return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path); - } - - /** - * Empty template objects cache - */ - public function _clearTemplateCache() - { - Smarty_Internal_Template::$isCacheTplObj = array(); - Smarty_Internal_Template::$tplObjCache = array(); - } - - /** - * @param boolean $use_sub_dirs - */ - public function setUseSubDirs($use_sub_dirs) - { - $this->use_sub_dirs = $use_sub_dirs; - } - - /** - * @param int $error_reporting - */ - public function setErrorReporting($error_reporting) - { - $this->error_reporting = $error_reporting; - } - - /** - * @param boolean $escape_html - */ - public function setEscapeHtml($escape_html) - { - $this->escape_html = $escape_html; - } - - /** - * Return auto_literal flag - * - * @return boolean - */ - public function getAutoLiteral() - { - return $this->auto_literal; - } - - /** - * Set auto_literal flag - * - * @param boolean $auto_literal - */ - public function setAutoLiteral($auto_literal = true) - { - $this->auto_literal = $auto_literal; - } - - /** - * @param boolean $force_compile - */ - public function setForceCompile($force_compile) - { - $this->force_compile = $force_compile; - } - - /** - * @param boolean $merge_compiled_includes - */ - public function setMergeCompiledIncludes($merge_compiled_includes) - { - $this->merge_compiled_includes = $merge_compiled_includes; - } - - /** - * Get left delimiter - * - * @return string - */ - public function getLeftDelimiter() - { - return $this->left_delimiter; - } - - /** - * Set left delimiter - * - * @param string $left_delimiter - */ - public function setLeftDelimiter($left_delimiter) - { - $this->left_delimiter = $left_delimiter; - } - - /** - * Get right delimiter - * - * @return string $right_delimiter - */ - public function getRightDelimiter() - { - return $this->right_delimiter; - } - - /** - * Set right delimiter - * - * @param string - */ - public function setRightDelimiter($right_delimiter) - { - $this->right_delimiter = $right_delimiter; - } - - /** - * @param boolean $debugging - */ - public function setDebugging($debugging) - { - $this->debugging = $debugging; - } - - /** - * @param boolean $config_overwrite - */ - public function setConfigOverwrite($config_overwrite) - { - $this->config_overwrite = $config_overwrite; - } - - /** - * @param boolean $config_booleanize - */ - public function setConfigBooleanize($config_booleanize) - { - $this->config_booleanize = $config_booleanize; - } - - /** - * @param boolean $config_read_hidden - */ - public function setConfigReadHidden($config_read_hidden) - { - $this->config_read_hidden = $config_read_hidden; - } - - /** - * @param boolean $compile_locking - */ - public function setCompileLocking($compile_locking) - { - $this->compile_locking = $compile_locking; - } - - /** - * @param string $default_resource_type - */ - public function setDefaultResourceType($default_resource_type) - { - $this->default_resource_type = $default_resource_type; - } - - /** - * @param string $caching_type - */ - public function setCachingType($caching_type) - { - $this->caching_type = $caching_type; - } - - /** - * Test install - * - * @param null $errors - */ - public function testInstall(&$errors = null) - { - Smarty_Internal_TestInstall::testInstall($this, $errors); - } - - /** - * Get Smarty object - * - * @return Smarty - */ - public function _getSmartyObj() - { - return $this; - } - - /** - * <> Generic getter. - * Calls the appropriate getter function. - * Issues an E_USER_NOTICE if no valid getter is found. - * - * @param string $name property name - * - * @return mixed - */ - public function __get($name) - { - if (isset($this->accessMap[ $name ])) { - $method = 'get' . $this->accessMap[ $name ]; - return $this->{$method}(); - } elseif (isset($this->_cache[ $name ])) { - return $this->_cache[ $name ]; - } elseif (in_array($name, $this->obsoleteProperties)) { - return null; - } else { - trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); - } - return null; - } - - /** - * <> Generic setter. - * Calls the appropriate setter function. - * Issues an E_USER_NOTICE if no valid setter is found. - * - * @param string $name property name - * @param mixed $value parameter passed to setter - * - */ - public function __set($name, $value) - { - if (isset($this->accessMap[ $name ])) { - $method = 'set' . $this->accessMap[ $name ]; - $this->{$method}($value); - } elseif (in_array($name, $this->obsoleteProperties)) { - return; - } elseif (is_object($value) && method_exists($value, $name)) { - $this->$name = $value; - } else { - trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); - } - } - - /** - * Normalize and set directory string - * - * @param string $dirName cache_dir or compile_dir - * @param string $dir filepath of folder - */ - private function _normalizeDir($dirName, $dir) - { - $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DIRECTORY_SEPARATOR, true); - if (class_exists('Smarty_Internal_ErrorHandler', false)) { - if (!isset(Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ])) { - Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ] = null; - } - } - } - - /** - * Normalize template_dir or config_dir - * - * @param bool $isConfig true for config_dir - */ - private function _normalizeTemplateConfig($isConfig) - { - if ($isConfig) { - $processed = &$this->_processedConfigDir; - $dir = &$this->config_dir; - } else { - $processed = &$this->_processedTemplateDir; - $dir = &$this->template_dir; - } - if (!is_array($dir)) { - $dir = (array)$dir; - } - foreach ($dir as $k => $v) { - if (!isset($processed[ $k ])) { - $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true); - $processed[ $k ] = true; - } - } - $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true; - $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) : - $this->_joined_template_dir = join('#', $this->template_dir); - } -} diff --git a/src/includes/smarty-3.1.48/libs/SmartyBC.class.php b/src/includes/smarty-3.1.48/libs/SmartyBC.class.php deleted file mode 100644 index 0550e46..0000000 --- a/src/includes/smarty-3.1.48/libs/SmartyBC.class.php +++ /dev/null @@ -1,477 +0,0 @@ - - * @author Uwe Tews - * @author Rodney Rehm - * @package Smarty - */ -/** - * @ignore - */ -require_once dirname(__FILE__) . '/Smarty.class.php'; - -/** - * Smarty Backward Compatibility Wrapper Class - * - * @package Smarty - */ -class SmartyBC extends Smarty -{ - /** - * Smarty 2 BC - * - * @var string - */ - public $_version = self::SMARTY_VERSION; - - /** - * This is an array of directories where trusted php scripts reside. - * - * @var array - */ - public $trusted_dir = array(); - - /** - * Initialize new SmartyBC object - */ - public function __construct() - { - parent::__construct(); - } - - /** - * wrapper for assign_by_ref - * - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to assign - */ - public function assign_by_ref($tpl_var, &$value) - { - $this->assignByRef($tpl_var, $value); - } - - /** - * wrapper for append_by_ref - * - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to append - * @param boolean $merge flag if array elements shall be merged - */ - public function append_by_ref($tpl_var, &$value, $merge = false) - { - $this->appendByRef($tpl_var, $value, $merge); - } - - /** - * clear the given assigned template variable. - * - * @param string $tpl_var the template variable to clear - */ - public function clear_assign($tpl_var) - { - $this->clearAssign($tpl_var); - } - - /** - * Registers custom function to be used in templates - * - * @param string $function the name of the template function - * @param string $function_impl the name of the PHP function to register - * @param bool $cacheable - * @param mixed $cache_attrs - * - * @throws \SmartyException - */ - public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null) - { - $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); - } - - /** - * Unregister custom function - * - * @param string $function name of template function - */ - public function unregister_function($function) - { - $this->unregisterPlugin('function', $function); - } - - /** - * Registers object to be used in templates - * - * @param string $object name of template object - * @param object $object_impl the referenced PHP object to register - * @param array $allowed list of allowed methods (empty = all) - * @param boolean $smarty_args smarty argument format, else traditional - * @param array $block_methods list of methods that are block format - * - * @throws SmartyException - * @internal param array $block_functs list of methods that are block format - */ - public function register_object( - $object, - $object_impl, - $allowed = array(), - $smarty_args = true, - $block_methods = array() - ) { - settype($allowed, 'array'); - settype($smarty_args, 'boolean'); - $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); - } - - /** - * Unregister object - * - * @param string $object name of template object - */ - public function unregister_object($object) - { - $this->unregisterObject($object); - } - - /** - * Registers block function to be used in templates - * - * @param string $block name of template block - * @param string $block_impl PHP function to register - * @param bool $cacheable - * @param mixed $cache_attrs - * - * @throws \SmartyException - */ - public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null) - { - $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); - } - - /** - * Unregister block function - * - * @param string $block name of template function - */ - public function unregister_block($block) - { - $this->unregisterPlugin('block', $block); - } - - /** - * Registers compiler function - * - * @param string $function name of template function - * @param string $function_impl name of PHP function to register - * @param bool $cacheable - * - * @throws \SmartyException - */ - public function register_compiler_function($function, $function_impl, $cacheable = true) - { - $this->registerPlugin('compiler', $function, $function_impl, $cacheable); - } - - /** - * Unregister compiler function - * - * @param string $function name of template function - */ - public function unregister_compiler_function($function) - { - $this->unregisterPlugin('compiler', $function); - } - - /** - * Registers modifier to be used in templates - * - * @param string $modifier name of template modifier - * @param string $modifier_impl name of PHP function to register - * - * @throws \SmartyException - */ - public function register_modifier($modifier, $modifier_impl) - { - $this->registerPlugin('modifier', $modifier, $modifier_impl); - } - - /** - * Unregister modifier - * - * @param string $modifier name of template modifier - */ - public function unregister_modifier($modifier) - { - $this->unregisterPlugin('modifier', $modifier); - } - - /** - * Registers a resource to fetch a template - * - * @param string $type name of resource - * @param array $functions array of functions to handle resource - */ - public function register_resource($type, $functions) - { - $this->registerResource($type, $functions); - } - - /** - * Unregister a resource - * - * @param string $type name of resource - */ - public function unregister_resource($type) - { - $this->unregisterResource($type); - } - - /** - * Registers a prefilter function to apply - * to a template before compiling - * - * @param callable $function - * - * @throws \SmartyException - */ - public function register_prefilter($function) - { - $this->registerFilter('pre', $function); - } - - /** - * Unregister a prefilter function - * - * @param callable $function - */ - public function unregister_prefilter($function) - { - $this->unregisterFilter('pre', $function); - } - - /** - * Registers a postfilter function to apply - * to a compiled template after compilation - * - * @param callable $function - * - * @throws \SmartyException - */ - public function register_postfilter($function) - { - $this->registerFilter('post', $function); - } - - /** - * Unregister a postfilter function - * - * @param callable $function - */ - public function unregister_postfilter($function) - { - $this->unregisterFilter('post', $function); - } - - /** - * Registers an output filter function to apply - * to a template output - * - * @param callable $function - * - * @throws \SmartyException - */ - public function register_outputfilter($function) - { - $this->registerFilter('output', $function); - } - - /** - * Unregister an outputfilter function - * - * @param callable $function - */ - public function unregister_outputfilter($function) - { - $this->unregisterFilter('output', $function); - } - - /** - * load a filter of specified type and name - * - * @param string $type filter type - * @param string $name filter name - * - * @throws \SmartyException - */ - public function load_filter($type, $name) - { - $this->loadFilter($type, $name); - } - - /** - * clear cached content for the given template and cache id - * - * @param string $tpl_file name of template file - * @param string $cache_id name of cache_id - * @param string $compile_id name of compile_id - * @param string $exp_time expiration time - * - * @return boolean - */ - public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) - { - return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); - } - - /** - * clear the entire contents of cache (all templates) - * - * @param string $exp_time expire time - * - * @return boolean - */ - public function clear_all_cache($exp_time = null) - { - return $this->clearCache(null, null, null, $exp_time); - } - - /** - * test to see if valid cache exists for this template - * - * @param string $tpl_file name of template file - * @param string $cache_id - * @param string $compile_id - * - * @return bool - * @throws \Exception - * @throws \SmartyException - */ - public function is_cached($tpl_file, $cache_id = null, $compile_id = null) - { - return $this->isCached($tpl_file, $cache_id, $compile_id); - } - - /** - * clear all the assigned template variables. - */ - public function clear_all_assign() - { - $this->clearAllAssign(); - } - - /** - * clears compiled version of specified template resource, - * or all compiled template files if one is not specified. - * This function is for advanced use only, not normally needed. - * - * @param string $tpl_file - * @param string $compile_id - * @param string $exp_time - * - * @return boolean results of {@link smarty_core_rm_auto()} - */ - public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) - { - return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); - } - - /** - * Checks whether requested template exists. - * - * @param string $tpl_file - * - * @return bool - * @throws \SmartyException - */ - public function template_exists($tpl_file) - { - return $this->templateExists($tpl_file); - } - - /** - * Returns an array containing template variables - * - * @param string $name - * - * @return array - */ - public function get_template_vars($name = null) - { - return $this->getTemplateVars($name); - } - - /** - * Returns an array containing config variables - * - * @param string $name - * - * @return array - */ - public function get_config_vars($name = null) - { - return $this->getConfigVars($name); - } - - /** - * load configuration values - * - * @param string $file - * @param string $section - * @param string $scope - */ - public function config_load($file, $section = null, $scope = 'global') - { - $this->ConfigLoad($file, $section, $scope); - } - - /** - * return a reference to a registered object - * - * @param string $name - * - * @return object - */ - public function get_registered_object($name) - { - return $this->getRegisteredObject($name); - } - - /** - * clear configuration values - * - * @param string $var - */ - public function clear_config($var = null) - { - $this->clearConfig($var); - } - - /** - * trigger Smarty error - * - * @param string $error_msg - * @param integer $error_type - */ - public function trigger_error($error_msg, $error_type = E_USER_WARNING) - { - trigger_error("Smarty error: $error_msg", $error_type); - } -} diff --git a/src/includes/smarty-3.1.48/libs/bootstrap.php b/src/includes/smarty-3.1.48/libs/bootstrap.php deleted file mode 100644 index 2c83046..0000000 --- a/src/includes/smarty-3.1.48/libs/bootstrap.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -/** - * Load and register Smarty Autoloader - */ -if (!class_exists('Smarty_Autoloader')) { - include dirname(__FILE__) . '/Autoloader.php'; -} -Smarty_Autoloader::register(true); diff --git a/src/includes/smarty-3.1.48/libs/plugins/block.textformat.php b/src/includes/smarty-3.1.48/libs/plugins/block.textformat.php deleted file mode 100644 index 5e49463..0000000 --- a/src/includes/smarty-3.1.48/libs/plugins/block.textformat.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @throws \SmartyException - */ -function smarty_block_textformat($params, $content, Smarty_Internal_Template $template, &$repeat) -{ - if (is_null($content)) { - return; - } - if (Smarty::$_MBSTRING) { - $template->_checkPlugins( - array( - array( - 'function' => 'smarty_modifier_mb_wordwrap', - 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php' - ) - ) - ); - } - $style = null; - $indent = 0; - $indent_first = 0; - $indent_char = ' '; - $wrap = 80; - $wrap_char = "\n"; - $wrap_cut = false; - $assign = null; - foreach ($params as $_key => $_val) { - switch ($_key) { - case 'style': - case 'indent_char': - case 'wrap_char': - case 'assign': - $$_key = (string)$_val; - break; - case 'indent': - case 'indent_first': - case 'wrap': - $$_key = (int)$_val; - break; - case 'wrap_cut': - $$_key = (bool)$_val; - break; - default: - trigger_error("textformat: unknown attribute '{$_key}'"); - } - } - if ($style === 'email') { - $wrap = 72; - } - // split into paragraphs - $_paragraphs = preg_split('![\r\n]{2}!', $content); - foreach ($_paragraphs as &$_paragraph) { - if (!$_paragraph) { - continue; - } - // convert mult. spaces & special chars to single space - $_paragraph = - preg_replace( - array( - '!\s+!' . Smarty::$_UTF8_MODIFIER, - '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER - ), - array( - ' ', - '' - ), - $_paragraph - ); - // indent first line - if ($indent_first > 0) { - $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; - } - // wordwrap sentences - if (Smarty::$_MBSTRING) { - $_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); - } else { - $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); - } - // indent lines - if ($indent > 0) { - $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph); - } - } - $_output = implode($wrap_char . $wrap_char, $_paragraphs); - if ($assign) { - $template->assign($assign, $_output); - } else { - return $_output; - } -} diff --git a/src/includes/smarty-3.1.48/libs/plugins/function.counter.php b/src/includes/smarty-3.1.48/libs/plugins/function.counter.php deleted file mode 100644 index a4129e7..0000000 --- a/src/includes/smarty-3.1.48/libs/plugins/function.counter.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} - * (Smarty online manual) - * - * @param array $params parameters - * @param Smarty_Internal_Template $template template object - * - * @return string|null - */ -function smarty_function_counter($params, $template) -{ - static $counters = array(); - $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default'; - if (!isset($counters[ $name ])) { - $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1); - } - $counter =& $counters[ $name ]; - if (isset($params[ 'start' ])) { - $counter[ 'start' ] = $counter[ 'count' ] = (int)$params[ 'start' ]; - } - if (!empty($params[ 'assign' ])) { - $counter[ 'assign' ] = $params[ 'assign' ]; - } - if (isset($counter[ 'assign' ])) { - $template->assign($counter[ 'assign' ], $counter[ 'count' ]); - } - if (isset($params[ 'print' ])) { - $print = (bool)$params[ 'print' ]; - } else { - $print = empty($counter[ 'assign' ]); - } - if ($print) { - $retval = $counter[ 'count' ]; - } else { - $retval = null; - } - if (isset($params[ 'skip' ])) { - $counter[ 'skip' ] = $params[ 'skip' ]; - } - if (isset($params[ 'direction' ])) { - $counter[ 'direction' ] = $params[ 'direction' ]; - } - if ($counter[ 'direction' ] === 'down') { - $counter[ 'count' ] -= $counter[ 'skip' ]; - } else { - $counter[ 'count' ] += $counter[ 'skip' ]; - } - return $retval; -} diff --git a/src/includes/smarty-3.1.48/libs/plugins/function.cycle.php b/src/includes/smarty-3.1.48/libs/plugins/function.cycle.php deleted file mode 100644 index 07ffcc5..0000000 --- a/src/includes/smarty-3.1.48/libs/plugins/function.cycle.php +++ /dev/null @@ -1,92 +0,0 @@ - - * @author credit to Mark Priatel - * @author credit to Gerard - * @author credit to Jason Sweat - * @version 1.3 - * - * @param array $params parameters - * @param Smarty_Internal_Template $template template object - * - * @return string|null - */ -function smarty_function_cycle($params, $template) -{ - static $cycle_vars; - $name = (empty($params[ 'name' ])) ? 'default' : $params[ 'name' ]; - $print = (isset($params[ 'print' ])) ? (bool)$params[ 'print' ] : true; - $advance = (isset($params[ 'advance' ])) ? (bool)$params[ 'advance' ] : true; - $reset = (isset($params[ 'reset' ])) ? (bool)$params[ 'reset' ] : false; - if (!isset($params[ 'values' ])) { - if (!isset($cycle_vars[ $name ][ 'values' ])) { - trigger_error('cycle: missing \'values\' parameter'); - return; - } - } else { - if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] !== $params[ 'values' ]) { - $cycle_vars[ $name ][ 'index' ] = 0; - } - $cycle_vars[ $name ][ 'values' ] = $params[ 'values' ]; - } - if (isset($params[ 'delimiter' ])) { - $cycle_vars[ $name ][ 'delimiter' ] = $params[ 'delimiter' ]; - } elseif (!isset($cycle_vars[ $name ][ 'delimiter' ])) { - $cycle_vars[ $name ][ 'delimiter' ] = ','; - } - if (is_array($cycle_vars[ $name ][ 'values' ])) { - $cycle_array = $cycle_vars[ $name ][ 'values' ]; - } else { - $cycle_array = explode($cycle_vars[ $name ][ 'delimiter' ], $cycle_vars[ $name ][ 'values' ]); - } - if (!isset($cycle_vars[ $name ][ 'index' ]) || $reset) { - $cycle_vars[ $name ][ 'index' ] = 0; - } - if (isset($params[ 'assign' ])) { - $print = false; - $template->assign($params[ 'assign' ], $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]); - } - if ($print) { - $retval = $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]; - } else { - $retval = null; - } - if ($advance) { - if ($cycle_vars[ $name ][ 'index' ] >= count($cycle_array) - 1) { - $cycle_vars[ $name ][ 'index' ] = 0; - } else { - $cycle_vars[ $name ][ 'index' ]++; - } - } - return $retval; -} diff --git a/src/includes/smarty-3.1.48/libs/plugins/function.fetch.php b/src/includes/smarty-3.1.48/libs/plugins/function.fetch.php deleted file mode 100644 index 768761b..0000000 --- a/src/includes/smarty-3.1.48/libs/plugins/function.fetch.php +++ /dev/null @@ -1,204 +0,0 @@ - - * - * @param array $params parameters - * @param Smarty_Internal_Template $template template object - * - * @throws SmartyException - * @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable - */ -function smarty_function_fetch($params, $template) -{ - if (empty($params[ 'file' ])) { - trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE); - return; - } - // strip file protocol - if (stripos($params[ 'file' ], 'file://') === 0) { - $params[ 'file' ] = substr($params[ 'file' ], 7); - } - $protocol = strpos($params[ 'file' ], '://'); - if ($protocol !== false) { - $protocol = strtolower(substr($params[ 'file' ], 0, $protocol)); - } - if (isset($template->smarty->security_policy)) { - if ($protocol) { - // remote resource (or php stream, …) - if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) { - return; - } - } else { - // local file - if (!$template->smarty->security_policy->isTrustedResourceDir($params[ 'file' ])) { - return; - } - } - } - $content = ''; - if ($protocol === 'http') { - // http fetch - if ($uri_parts = parse_url($params[ 'file' ])) { - // set defaults - $host = $server_name = $uri_parts[ 'host' ]; - $timeout = 30; - $accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'; - $agent = 'Smarty Template Engine ' . Smarty::SMARTY_VERSION; - $referer = ''; - $uri = !empty($uri_parts[ 'path' ]) ? $uri_parts[ 'path' ] : '/'; - $uri .= !empty($uri_parts[ 'query' ]) ? '?' . $uri_parts[ 'query' ] : ''; - $_is_proxy = false; - if (empty($uri_parts[ 'port' ])) { - $port = 80; - } else { - $port = $uri_parts[ 'port' ]; - } - if (!empty($uri_parts[ 'user' ])) { - $user = $uri_parts[ 'user' ]; - } - if (!empty($uri_parts[ 'pass' ])) { - $pass = $uri_parts[ 'pass' ]; - } - // loop through parameters, setup headers - foreach ($params as $param_key => $param_value) { - switch ($param_key) { - case 'file': - case 'assign': - case 'assign_headers': - break; - case 'user': - if (!empty($param_value)) { - $user = $param_value; - } - break; - case 'pass': - if (!empty($param_value)) { - $pass = $param_value; - } - break; - case 'accept': - if (!empty($param_value)) { - $accept = $param_value; - } - break; - case 'header': - if (!empty($param_value)) { - if (!preg_match('![\w\d-]+: .+!', $param_value)) { - trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); - return; - } else { - $extra_headers[] = $param_value; - } - } - break; - case 'proxy_host': - if (!empty($param_value)) { - $proxy_host = $param_value; - } - break; - case 'proxy_port': - if (!preg_match('!\D!', $param_value)) { - $proxy_port = (int)$param_value; - } else { - trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); - return; - } - break; - case 'agent': - if (!empty($param_value)) { - $agent = $param_value; - } - break; - case 'referer': - if (!empty($param_value)) { - $referer = $param_value; - } - break; - case 'timeout': - if (!preg_match('!\D!', $param_value)) { - $timeout = (int)$param_value; - } else { - trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); - return; - } - break; - default: - trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); - return; - } - } - if (!empty($proxy_host) && !empty($proxy_port)) { - $_is_proxy = true; - $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout); - } else { - $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); - } - if (!$fp) { - trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE); - return; - } else { - if ($_is_proxy) { - fputs($fp, 'GET ' . $params[ 'file' ] . " HTTP/1.0\r\n"); - } else { - fputs($fp, "GET $uri HTTP/1.0\r\n"); - } - if (!empty($host)) { - fputs($fp, "Host: $host\r\n"); - } - if (!empty($accept)) { - fputs($fp, "Accept: $accept\r\n"); - } - if (!empty($agent)) { - fputs($fp, "User-Agent: $agent\r\n"); - } - if (!empty($referer)) { - fputs($fp, "Referer: $referer\r\n"); - } - if (isset($extra_headers) && is_array($extra_headers)) { - foreach ($extra_headers as $curr_header) { - fputs($fp, $curr_header . "\r\n"); - } - } - if (!empty($user) && !empty($pass)) { - fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n"); - } - fputs($fp, "\r\n"); - while (!feof($fp)) { - $content .= fgets($fp, 4096); - } - fclose($fp); - $csplit = preg_split("!\r\n\r\n!", $content, 2); - $content = $csplit[ 1 ]; - if (!empty($params[ 'assign_headers' ])) { - $template->assign($params[ 'assign_headers' ], preg_split("!\r\n!", $csplit[ 0 ])); - } - } - } else { - trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE); - return; - } - } else { - $content = @file_get_contents($params[ 'file' ]); - if ($content === false) { - throw new SmartyException("{fetch} cannot read resource '" . $params[ 'file' ] . "'"); - } - } - if (!empty($params[ 'assign' ])) { - $template->assign($params[ 'assign' ], $content); - } else { - return $content; - } -} diff --git a/src/includes/smarty-3.1.48/libs/plugins/function.html_checkboxes.php b/src/includes/smarty-3.1.48/libs/plugins/function.html_checkboxes.php deleted file mode 100644 index 302358e..0000000 --- a/src/includes/smarty-3.1.48/libs/plugins/function.html_checkboxes.php +++ /dev/null @@ -1,286 +0,0 @@ -' output=$names} - * {html_checkboxes values=$ids checked=$checked separator='
    ' output=$names} - * - * Params: - * - * - name (optional) - string default "checkbox" - * - values (required) - array - * - options (optional) - associative array - * - checked (optional) - array default not set - * - separator (optional) - ie
    or   - * - output (optional) - the output next to each checkbox - * - assign (optional) - assign the output as an array to this variable - * - escape (optional) - escape the content (not value), defaults to true - * - * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} - * (Smarty online manual) - * @author Christopher Kvarme - * @author credits to Monte Ohrt - * @version 1.0 - * - * @param array $params parameters - * @param Smarty_Internal_Template $template template object - * - * @return string - * @uses smarty_function_escape_special_chars() - * @throws \SmartyException - */ -function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) -{ - $template->_checkPlugins( - array( - array( - 'function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' - ) - ) - ); - $name = 'checkbox'; - $values = null; - $options = null; - $selected = array(); - $separator = ''; - $escape = true; - $labels = true; - $label_ids = false; - $output = null; - $extra = ''; - foreach ($params as $_key => $_val) { - switch ($_key) { - case 'name': - case 'separator': - $$_key = (string)$_val; - break; - case 'escape': - case 'labels': - case 'label_ids': - $$_key = (bool)$_val; - break; - case 'options': - $$_key = (array)$_val; - break; - case 'values': - case 'output': - $$_key = array_values((array)$_val); - break; - case 'checked': - case 'selected': - if (is_array($_val)) { - $selected = array(); - foreach ($_val as $_sel) { - if (is_object($_sel)) { - if (method_exists($_sel, '__toString')) { - $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); - } else { - trigger_error( - 'html_checkboxes: selected attribute contains an object of class \'' . - get_class($_sel) . '\' without __toString() method', - E_USER_NOTICE - ); - continue; - } - } else { - $_sel = smarty_function_escape_special_chars((string)$_sel); - } - $selected[ $_sel ] = true; - } - } elseif (is_object($_val)) { - if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string)$_val->__toString()); - } else { - trigger_error( - 'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', - E_USER_NOTICE - ); - } - } else { - $selected = smarty_function_escape_special_chars((string)$_val); - } - break; - case 'checkboxes': - trigger_error( - 'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', - E_USER_WARNING - ); - $options = (array)$_val; - break; - case 'assign': - break; - case 'strict': - break; - case 'disabled': - case 'readonly': - if (!empty($params[ 'strict' ])) { - if (!is_scalar($_val)) { - trigger_error( - "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", - E_USER_NOTICE - ); - } - if ($_val === true || $_val === $_key) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; - } - break; - } - // omit break; to fall through! - // no break - default: - if (!is_array($_val)) { - $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; - } else { - trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); - } - break; - } - } - if (!isset($options) && !isset($values)) { - return ''; - } /* raise error here? */ - $_html_result = array(); - if (isset($options)) { - foreach ($options as $_key => $_val) { - $_html_result[] = - smarty_function_html_checkboxes_output( - $name, - $_key, - $_val, - $selected, - $extra, - $separator, - $labels, - $label_ids, - $escape - ); - } - } else { - foreach ($values as $_i => $_key) { - $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; - $_html_result[] = - smarty_function_html_checkboxes_output( - $name, - $_key, - $_val, - $selected, - $extra, - $separator, - $labels, - $label_ids, - $escape - ); - } - } - if (!empty($params[ 'assign' ])) { - $template->assign($params[ 'assign' ], $_html_result); - } else { - return implode("\n", $_html_result); - } -} - -/** - * @param $name - * @param $value - * @param $output - * @param $selected - * @param $extra - * @param $separator - * @param $labels - * @param $label_ids - * @param bool $escape - * - * @return string - */ -function smarty_function_html_checkboxes_output( - $name, - $value, - $output, - $selected, - $extra, - $separator, - $labels, - $label_ids, - $escape = true -) { - $_output = ''; - if (is_object($value)) { - if (method_exists($value, '__toString')) { - $value = (string)$value->__toString(); - } else { - trigger_error( - 'html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', - E_USER_NOTICE - ); - return ''; - } - } else { - $value = (string)$value; - } - if (is_object($output)) { - if (method_exists($output, '__toString')) { - $output = (string)$output->__toString(); - } else { - trigger_error( - 'html_options: output is an object of class \'' . get_class($output) . - '\' without __toString() method', - E_USER_NOTICE - ); - return ''; - } - } else { - $output = (string)$output; - } - if ($labels) { - if ($label_ids) { - $_id = smarty_function_escape_special_chars( - preg_replace( - '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, - '_', - $name . '_' . $value - ) - ); - $_output .= '