Compare commits
15 commits
main
...
prod/pluto
Author | SHA1 | Date | |
---|---|---|---|
e137821b94 | |||
599e0694e9 | |||
9100297724 | |||
f354c14dbd | |||
06b74b7139 | |||
3878482b85 | |||
4f01604d85 | |||
59c5198e11 | |||
ad5abb2af3 | |||
190da415bd | |||
e77d4364eb | |||
eeae574cb2 | |||
b5716bb14c | |||
64baf4332f | |||
2975a830fc |
19 changed files with 1273 additions and 173 deletions
398
src/archive.php
Normal file
398
src/archive.php
Normal file
|
@ -0,0 +1,398 @@
|
|||
<?php
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
require_once(dirname(__FILE__) . "/includes/funcLib.php");
|
||||
require_once(dirname(__FILE__) . "/includes/MySmarty.class.php");
|
||||
$smarty = new MySmarty();
|
||||
$opt = $smarty->opt();
|
||||
|
||||
session_start();
|
||||
if (!isset($_SESSION["userid"])) {
|
||||
header("Location: " . getFullPath("login.php"));
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$userid = $_SESSION["userid"];
|
||||
}
|
||||
|
||||
if (!empty($_GET["message"])) {
|
||||
$message = filter_var(trim($_GET["message"], FILTER_SANITIZE_STRING));;
|
||||
$message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
/* if we've got `page' on the query string, set the session page indicator. */
|
||||
if (isset($_GET["offset"])) {
|
||||
$offset = filter_var(trim($_GET["offset"]), FILTER_SANITIZE_NUMBER_INT);
|
||||
if (filter_var($offset, FILTER_SANITIZE_NUMBER_INT) === false || $offset == "" || !is_numeric($offset) || $offset < 0) {
|
||||
die("Invalid page offset ({$_GET["offset"]})");
|
||||
}
|
||||
$_SESSION["offset"] = $offset;
|
||||
}
|
||||
else if (isset($_SESSION["offset"])) {
|
||||
$offset = $_SESSION["offset"];
|
||||
}
|
||||
else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (!empty($_GET["action"])) {
|
||||
$action = $_GET["action"];
|
||||
if ($action == "ack") {
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}messages SET isread = 1 WHERE messageid = ?");
|
||||
$stmt->bindValue(1, (int) $messageid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
else if ($action == "approve") {
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}shoppers SET pending = 0 WHERE shopper = ? AND mayshopfor = ?");
|
||||
$stmt->bindValue(1, (int) $shopper, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
sendMessage($userid,(int) $shopper,$_SESSION["fullname"] . " has approved your request to shop for him/her.", $smarty->dbh(), $smarty->opt());
|
||||
}
|
||||
else if ($action == "decline") {
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}shoppers WHERE shopper = ? AND mayshopfor = ?");
|
||||
$stmt->bindValue(1, (int) $shopper, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
sendMessage($userid,(int) $shopper,$_SESSION["fullname"] . " has declined your request to shop for him/her.", $smarty->dbh(), $smarty->opt());
|
||||
}
|
||||
else if ($action == "request") {
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}shoppers(shopper,mayshopfor,pending) VALUES(?, ?, ?)");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindValue(2, (int) $shopfor, PDO::PARAM_INT);
|
||||
$stmt->bindValue(3, $opt["shop_requires_approval"], PDO::PARAM_BOOL);
|
||||
$stmt->execute();
|
||||
if ($opt["shop_requires_approval"]) {
|
||||
sendMessage($userid,(int) $shopfor,$_SESSION["fullname"] . " has requested to shop for you. Please approve or decline this request.", $smarty->dbh(), $smarty->opt());
|
||||
}
|
||||
}
|
||||
else if ($action == "cancel") {
|
||||
// this works for either cancelling a request or "unshopping" for a user.
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}shoppers WHERE shopper = ? AND mayshopfor = ?");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindValue(2, (int) $shopfor, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
else if ($action == "subscribe") {
|
||||
// ensure the current user can shop for that user first.
|
||||
$stmt = $smarty->dbh()->prepare("SELECT pending FROM {$opt["table_prefix"]}shoppers WHERE shopper = ? AND mayshopfor = ?");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindValue(2, (int) $shoppee, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
if ($row = $stmt->fetch()) {
|
||||
if ($row["pending"]) {
|
||||
die("You aren't allowed to shop for that user yet.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
die("You aren't allowed to shop for that user.");
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}subscriptions(publisher, subscriber) VALUES(?, ?)");
|
||||
$stmt->bindValue(1, (int) $shoppee, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
else if ($action == "unsubscribe") {
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}subscriptions WHERE publisher = ? AND subscriber = ?");
|
||||
$stmt->bindValue(1, (int) $shoppee, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$reset_sortdir = false;
|
||||
if (!empty($_GET["mysort"])) {
|
||||
$mysort = filter_var(trim($_GET["mysort"]), FILTER_SANITIZE_STRING);
|
||||
$mysort = htmlspecialchars($mysort, ENT_QUOTES, 'UTF-8');
|
||||
if (isset($_SESSION["mysort"]) && $_SESSION["mysort"] != $mysort) {
|
||||
$reset_sortdir = true;
|
||||
}
|
||||
$_SESSION["mysort"] = $mysort;
|
||||
}
|
||||
|
||||
if (!empty($_GET["sortdir"]) && !$reset_sortdir) {
|
||||
$sortdir = strtoupper(trim($_GET["sortdir"])) == "DESC" ? "DESC" : "ASC";
|
||||
$_SESSION["sortdir"] = $sortdir;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION["sortdir"]) || $reset_sortdir) {
|
||||
$sortdir = "ASC";
|
||||
$_SESSION["sortdir"] = $sortdir;
|
||||
}
|
||||
|
||||
if (!isset($_SESSION["mysort"])) {
|
||||
$sortby = "rankorder {$_SESSION['sortdir']}, i.name";
|
||||
$_SESSION["mysort"] = "ranking";
|
||||
}
|
||||
else {
|
||||
switch ($_SESSION["mysort"]) {
|
||||
case "name":
|
||||
$sortby = "i.name {$_SESSION['sortdir']}";
|
||||
break;
|
||||
case "source":
|
||||
$sortby = "source {$_SESSION['sortdir']}, rankorder, i.name";
|
||||
break;
|
||||
case "quantity":
|
||||
$sortby = "quantity {$_SESSION['sortdir']}, rankorder, i.name";
|
||||
break;
|
||||
case "price":
|
||||
$sortby = "price {$_SESSION['sortdir']}, rankorder, i.name";
|
||||
break;
|
||||
case "category":
|
||||
$sortby = "c.category {$_SESSION['sortdir']}, rankorder, i.name";
|
||||
break;
|
||||
default:
|
||||
$sortby = "rankorder {$_SESSION['sortdir']}, i.name";
|
||||
}
|
||||
}
|
||||
$stmt = $smarty->dbh()->prepare("SELECT itemid, name, description, i.category as catid, c.category, price, price as pricenum, source, url, i.ranking as rankid, rendered, comment, quantity, image_filename, public FROM {$opt["table_prefix"]}items i LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking WHERE userid = ? and i.archive = true ORDER BY " . $sortby);
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$myitems_count = 0;
|
||||
$myitems = array();
|
||||
for ($i = 0; $i < $offset; $i++, ++$myitems_count) {
|
||||
$row = $stmt->fetch();
|
||||
}
|
||||
$i = 0;
|
||||
while ($i++ < $opt["items_per_page"] && $row = $stmt->fetch()) {
|
||||
$row['price'] = formatPrice($row['price'], $opt);
|
||||
$row['urlhost'] = preg_replace("/^(https?:\/\/)?(www\.)?([^\/]+)(\/.*)?$/", "$3", $row['url']);
|
||||
$myitems[] = $row;
|
||||
++$myitems_count;
|
||||
}
|
||||
while ($stmt->fetch()) {
|
||||
++$myitems_count;
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT categoryid, category FROM {$opt["table_prefix"]}categories ORDER BY category");
|
||||
$stmt->execute();
|
||||
$categories = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$categories[] = $row;
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT ranking, title FROM {$opt["table_prefix"]}ranks ORDER BY rankorder");
|
||||
$stmt->execute();
|
||||
$ranks = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$ranks[] = $row;
|
||||
}
|
||||
|
||||
if (!$opt["auto_connect_family_members"]) {
|
||||
# When family members are not automatic shoppers
|
||||
$stmt = $smarty->dbh()->prepare("SELECT u.userid, u.fullname, u.comment, u.list_stamp, ISNULL(sub.subscriber) AS is_unsubscribed, COUNT(i.itemid) AS itemcount " .
|
||||
"FROM {$opt["table_prefix"]}shoppers s " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u ON u.userid = s.mayshopfor " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}items i ON u.userid = i.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}subscriptions sub ON sub.publisher = u.userid AND sub.subscriber = ? " .
|
||||
"WHERE s.shopper = ? " .
|
||||
"AND pending = 0 " .
|
||||
"GROUP BY u.userid, u.fullname, u.list_stamp " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoppees = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
if ($row['list_stamp'] == 0) {
|
||||
$row['list_stamp'] = '-';
|
||||
}
|
||||
else {
|
||||
$listStampDate = new DateTime($row['list_stamp']);
|
||||
$row['list_stamp'] = $listStampDate->format($opt["date_format"]);
|
||||
}
|
||||
$shoppees[] = $row;
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT DISTINCT u.userid, u.fullname, s.pending " .
|
||||
"FROM {$opt["table_prefix"]}memberships mymem " .
|
||||
"INNER JOIN {$opt["table_prefix"]}memberships others " .
|
||||
"ON others.familyid = mymem.familyid AND others.userid <> ? " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u " .
|
||||
"ON u.userid = others.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}shoppers s " .
|
||||
"ON s.mayshopfor = others.userid AND s.shopper = ? " .
|
||||
"WHERE mymem.userid = ? " .
|
||||
"AND (s.pending IS NULL OR s.pending = 1) " .
|
||||
"AND u.approved = 1 " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$prospects = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$prospects[] = $row;
|
||||
}
|
||||
} else {
|
||||
# When family members are automatically connected as shoppers
|
||||
$stmt = $smarty->dbh()->prepare("SELECT u.userid, u.fullname, u.comment, u.list_stamp, ISNULL(sub.subscriber) AS is_unsubscribed, COUNT(i.itemid) AS itemcount " .
|
||||
"FROM {$opt["table_prefix"]}users u " .
|
||||
"JOIN {$opt["table_prefix"]}memberships m ON u.userid = m.userid " .
|
||||
"LEFT JOIN {$opt["table_prefix"]}items i ON u.userid = i.userid " .
|
||||
"LEFT JOIN {$opt["table_prefix"]}subscriptions sub ON sub.publisher = u.userid AND sub.subscriber = ? " .
|
||||
"WHERE m.familyid IN ( " .
|
||||
"SELECT familyid " .
|
||||
"FROM {$opt["table_prefix"]}memberships " .
|
||||
"WHERE userid = ? " .
|
||||
") " .
|
||||
"AND u.userid != ? " .
|
||||
"GROUP BY u.userid, u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoppees = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
if ($row['list_stamp'] == 0) {
|
||||
$row['list_stamp'] = '-';
|
||||
}
|
||||
else {
|
||||
$listStampDate = new DateTime($row['list_stamp']);
|
||||
$row['list_stamp'] = $listStampDate->format($opt["date_format"]);
|
||||
}
|
||||
$shoppees[] = $row;
|
||||
}
|
||||
$prospects = array();
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT messageid, u.fullname, message, created " .
|
||||
"FROM {$opt["table_prefix"]}messages m " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u ON u.userid = m.sender " .
|
||||
"WHERE m.recipient = ? " .
|
||||
"AND m.isread = 0 " .
|
||||
"ORDER BY created DESC");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$messages = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$createdDateTime = new DateTime($row['created']);
|
||||
$row['created'] = $createdDateTime->format($opt["date_format"]);
|
||||
$messages[] = $row;
|
||||
}
|
||||
|
||||
$query = "SELECT CONCAT(YEAR(CURDATE()),'-',MONTH(eventdate),'-',DAYOFMONTH(eventdate)) AS DateThisYear, " .
|
||||
"TO_DAYS(CONCAT(YEAR(CURDATE()),'-',MONTH(eventdate),'-',DAYOFMONTH(eventdate))) AS ToDaysDateThisYear, " .
|
||||
"CONCAT(YEAR(CURDATE()) + 1,'-',MONTH(eventdate),'-',DAYOFMONTH(eventdate)) AS DateNextYear, " .
|
||||
"TO_DAYS(CONCAT(YEAR(CURDATE()) + 1,'-',MONTH(eventdate),'-',DAYOFMONTH(eventdate))) AS ToDaysDateNextYear, " .
|
||||
"TO_DAYS(CURDATE()) AS ToDaysToday, " .
|
||||
"TO_DAYS(eventdate) AS ToDaysEventDate, " .
|
||||
"e.userid, u.fullname, description, eventdate, recurring, s.pending " .
|
||||
"FROM {$opt["table_prefix"]}events e " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}users u ON u.userid = e.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}shoppers s ON s.mayshopfor = e.userid AND s.shopper = ? ";
|
||||
if ($opt["show_own_events"])
|
||||
$query .= "WHERE (pending = 0 OR pending IS NULL)";
|
||||
else
|
||||
$query .= "WHERE (e.userid <> ? OR e.userid IS NULL) AND (pending = 0 OR pending IS NULL)";
|
||||
$query .= "ORDER BY u.fullname";
|
||||
$stmt = $smarty->dbh()->prepare($query);
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
if (!$opt["show_own_events"])
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$events = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$event_fullname = $row["fullname"];
|
||||
$days_left = -1;
|
||||
if (!$row["recurring"] && (($row["ToDaysEventDate"] - $row["ToDaysToday"]) >= 0) && (($row["ToDaysEventDate"] - $row["ToDaysToday"]) <= $opt["event_threshold"])) {
|
||||
$days_left = $row["ToDaysEventDate"] - $row["ToDaysToday"];
|
||||
$event_date = new DateTime($row["eventdate"]);
|
||||
}
|
||||
else if ($row["recurring"] && (($row["ToDaysDateThisYear"] - $row["ToDaysToday"]) >= 0) && (($row["ToDaysDateThisYear"] - $row["ToDaysToday"]) <= $opt["event_threshold"])) {
|
||||
$days_left = $row["ToDaysDateThisYear"] - $row["ToDaysToday"];
|
||||
$event_date = new DateTime($row["DateThisYear"]);
|
||||
}
|
||||
else if ($row["recurring"] && (($row["ToDaysDateNextYear"] - $row["ToDaysToday"]) >= 0) && (($row["ToDaysDateNextYear"] - $row["ToDaysToday"]) <= $opt["event_threshold"])) {
|
||||
$days_left = $row["ToDaysDateNextYear"] - $row["ToDaysToday"];
|
||||
$event_date = new DateTime($row["DateNextYear"]);
|
||||
}
|
||||
if ($days_left >= 0) {
|
||||
$thisevent = array(
|
||||
'fullname' => $event_fullname,
|
||||
'eventname' => $row['description'],
|
||||
'daysleft' => $days_left,
|
||||
'date' => $event_date->format($opt["date_format"])
|
||||
);
|
||||
$events[] = $thisevent;
|
||||
}
|
||||
}
|
||||
|
||||
function compareEvents($a, $b) {
|
||||
if ($a["daysleft"] == $b["daysleft"])
|
||||
return 0;
|
||||
else
|
||||
return ($a["daysleft"] > $b["daysleft"]) ? 1 : -1;
|
||||
}
|
||||
|
||||
// i couldn't figure out another way to do this, so here goes.
|
||||
// sort() wanted to sort based on the array keys, which were 0..n - 1, so that was useless.
|
||||
usort($events, "compareEvents");
|
||||
|
||||
if ($opt["shop_requires_approval"]) {
|
||||
$query = "SELECT u.userid, u.fullname " .
|
||||
"FROM {$opt["table_prefix"]}shoppers s " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u ON u.userid = s.shopper " .
|
||||
"WHERE s.mayshopfor = ? " .
|
||||
"AND s.pending = 1 " .
|
||||
"ORDER BY u.fullname";
|
||||
$stmt = $smarty->dbh()->prepare($query);
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$pending = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$pending[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (($_SESSION["admin"] == 1) && $opt["newuser_requires_approval"]) {
|
||||
$query = "SELECT userid, fullname, email, approved, initialfamilyid, familyname " .
|
||||
"FROM {$opt["table_prefix"]}users u " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}families f ON f.familyid = u.initialfamilyid " .
|
||||
"WHERE approved = 0 " .
|
||||
"ORDER BY fullname";
|
||||
$stmt = $smarty->dbh()->prepare($query);
|
||||
$stmt->execute();
|
||||
$approval = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$approval[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('fullname', $_SESSION['fullname']);
|
||||
if (isset($message)) {
|
||||
$smarty->assign('message', $message);
|
||||
}
|
||||
$smarty->assign('mysort', $_SESSION['mysort']);
|
||||
$smarty->assign('sortdir', $_SESSION['sortdir']);
|
||||
$smarty->assign('categories', $categories);
|
||||
$smarty->assign('ranks', $ranks);
|
||||
$smarty->assign('myitems', $myitems);
|
||||
$smarty->assign('myitems_count', $myitems_count);
|
||||
$smarty->assign('offset', $offset);
|
||||
$smarty->assign('shoppees', $shoppees);
|
||||
$smarty->assign('prospects', $prospects);
|
||||
$smarty->assign('messages', $messages);
|
||||
$smarty->assign('events', $events);
|
||||
if (isset($pending)) {
|
||||
$smarty->assign('pending', $pending);
|
||||
}
|
||||
if (isset($approval)) {
|
||||
$smarty->assign('approval', $approval);
|
||||
}
|
||||
$smarty->assign('userid', $userid);
|
||||
$smarty->display('archive.tpl');
|
||||
?>
|
|
@ -54,11 +54,12 @@ if (!empty($_POST["action"])) {
|
|||
}
|
||||
|
||||
try {
|
||||
$stmt = $smarty->dbh()->prepare("SELECT show_helptext FROM {$opt["table_prefix"]}users WHERE userid = ?");
|
||||
$stmt = $smarty->dbh()->prepare("SELECT email, show_helptext FROM {$opt["table_prefix"]}users WHERE userid = ?");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
|
||||
$stmt->execute();
|
||||
if ($row = $stmt->fetch()) {
|
||||
$smarty->assign('email', $row["email"]);
|
||||
$smarty->assign('show_helptext', $row["show_helptext"]);
|
||||
$_SESSION['show_helptext'] = $row["show_helptext"];
|
||||
}
|
||||
|
|
BIN
src/images/archive-fill-dark.png
Normal file
BIN
src/images/archive-fill-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 628 B |
BIN
src/images/archive-fill-light.png
Normal file
BIN
src/images/archive-fill-light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 614 B |
BIN
src/images/basket3-fill-dark.png
Normal file
BIN
src/images/basket3-fill-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 708 B |
BIN
src/images/basket3-fill-light.png
Normal file
BIN
src/images/basket3-fill-light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 672 B |
|
@ -62,6 +62,12 @@ function getGlobalOptions() {
|
|||
*/
|
||||
"newuser_default_family" => 1,
|
||||
|
||||
/* Automatically make family members shoppers for each other
|
||||
0 = manual connections
|
||||
1 = auto connect family members
|
||||
*/
|
||||
"auto_connect_family_members" => 1,
|
||||
|
||||
/* Whether or not whom an item is reserved/bought by is hidden. */
|
||||
"anonymous_purchasing" => 0,
|
||||
|
||||
|
@ -87,6 +93,13 @@ function getGlobalOptions() {
|
|||
*/
|
||||
"show_helptext" => 1,
|
||||
|
||||
/* Whether or not clicking the Archive Item link requires a JavaScript-based
|
||||
confirmation.
|
||||
0 = don't show confirmation,
|
||||
1 = show confirmation
|
||||
*/
|
||||
"confirm_item_archives" => 1,
|
||||
|
||||
/* Whether or not clicking the Delete Item link requires a JavaScript-based
|
||||
confirmation.
|
||||
0 = don't show confirmation,
|
||||
|
|
|
@ -61,6 +61,13 @@ function getGlobalOptions() {
|
|||
*/
|
||||
"show_helptext" => 0,
|
||||
|
||||
/* Whether or not clicking the Archive Item link requires a JavaScript-based
|
||||
confirmation.
|
||||
0 = don't show confirmation,
|
||||
1 = show confirmation
|
||||
*/
|
||||
"confirm_item_archives" => 0,
|
||||
|
||||
/* Whether or not clicking the Delete Item link requires a JavaScript-based
|
||||
confirmation.
|
||||
0 = don't show confirmation,
|
||||
|
|
117
src/index.php
117
src/index.php
|
@ -190,7 +190,7 @@ else {
|
|||
$sortby = "rankorder {$_SESSION['sortdir']}, i.name";
|
||||
}
|
||||
}
|
||||
$stmt = $smarty->dbh()->prepare("SELECT itemid, name, description, i.category as catid, c.category, price, price as pricenum, source, url, i.ranking as rankid, rendered, comment, quantity, image_filename FROM {$opt["table_prefix"]}items i LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking WHERE userid = ? ORDER BY " . $sortby);
|
||||
$stmt = $smarty->dbh()->prepare("SELECT itemid, name, description, i.category as catid, c.category, price, price as pricenum, source, url, i.ranking as rankid, rendered, comment, quantity, created, image_filename, public FROM {$opt["table_prefix"]}items i LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking WHERE userid = ? and i.archive = false ORDER BY " . $sortby);
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$myitems_count = 0;
|
||||
|
@ -223,49 +223,82 @@ while ($row = $stmt->fetch()) {
|
|||
$ranks[] = $row;
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT u.userid, u.fullname, u.comment, u.list_stamp, ISNULL(sub.subscriber) AS is_unsubscribed, COUNT(i.itemid) AS itemcount " .
|
||||
"FROM {$opt["table_prefix"]}shoppers s " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u ON u.userid = s.mayshopfor " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}items i ON u.userid = i.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}subscriptions sub ON sub.publisher = u.userid AND sub.subscriber = ? " .
|
||||
"WHERE s.shopper = ? " .
|
||||
"AND pending = 0 " .
|
||||
"GROUP BY u.userid, u.fullname, u.list_stamp " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoppees = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
if ($row['list_stamp'] == 0) {
|
||||
$row['list_stamp'] = '-';
|
||||
if (!$opt["auto_connect_family_members"]) {
|
||||
# When family members are not automatic shoppers
|
||||
$stmt = $smarty->dbh()->prepare("SELECT u.userid, u.fullname, u.comment, u.list_stamp, ISNULL(sub.subscriber) AS is_unsubscribed, COUNT(i.itemid) AS itemcount " .
|
||||
"FROM {$opt["table_prefix"]}shoppers s " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u ON u.userid = s.mayshopfor " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}items i ON u.userid = i.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}subscriptions sub ON sub.publisher = u.userid AND sub.subscriber = ? " .
|
||||
"WHERE s.shopper = ? " .
|
||||
"AND pending = 0 " .
|
||||
"GROUP BY u.userid, u.fullname, u.list_stamp " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoppees = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
if ($row['list_stamp'] == 0) {
|
||||
$row['list_stamp'] = '-';
|
||||
}
|
||||
else {
|
||||
$listStampDate = new DateTime($row['list_stamp']);
|
||||
$row['list_stamp'] = $listStampDate->format($opt["date_format"]);
|
||||
}
|
||||
$shoppees[] = $row;
|
||||
}
|
||||
else {
|
||||
$listStampDate = new DateTime($row['list_stamp']);
|
||||
$row['list_stamp'] = $listStampDate->format($opt["date_format"]);
|
||||
}
|
||||
$shoppees[] = $row;
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT DISTINCT u.userid, u.fullname, s.pending " .
|
||||
"FROM {$opt["table_prefix"]}memberships mymem " .
|
||||
"INNER JOIN {$opt["table_prefix"]}memberships others " .
|
||||
"ON others.familyid = mymem.familyid AND others.userid <> ? " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u " .
|
||||
"ON u.userid = others.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}shoppers s " .
|
||||
"ON s.mayshopfor = others.userid AND s.shopper = ? " .
|
||||
"WHERE mymem.userid = ? " .
|
||||
"AND (s.pending IS NULL OR s.pending = 1) " .
|
||||
"AND u.approved = 1 " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$prospects = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$prospects[] = $row;
|
||||
$stmt = $smarty->dbh()->prepare("SELECT DISTINCT u.userid, u.fullname, s.pending " .
|
||||
"FROM {$opt["table_prefix"]}memberships mymem " .
|
||||
"INNER JOIN {$opt["table_prefix"]}memberships others " .
|
||||
"ON others.familyid = mymem.familyid AND others.userid <> ? " .
|
||||
"INNER JOIN {$opt["table_prefix"]}users u " .
|
||||
"ON u.userid = others.userid " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}shoppers s " .
|
||||
"ON s.mayshopfor = others.userid AND s.shopper = ? " .
|
||||
"WHERE mymem.userid = ? " .
|
||||
"AND (s.pending IS NULL OR s.pending = 1) " .
|
||||
"AND u.approved = 1 " .
|
||||
"ORDER BY u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$prospects = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
$prospects[] = $row;
|
||||
}
|
||||
} else {
|
||||
# When family members are automatically connected as shoppers
|
||||
$stmt = $smarty->dbh()->prepare("SELECT u.userid, u.fullname, u.comment, u.list_stamp, ISNULL(sub.subscriber) AS is_unsubscribed, COUNT(i.itemid) AS itemcount " .
|
||||
"FROM {$opt["table_prefix"]}users u " .
|
||||
"JOIN {$opt["table_prefix"]}memberships m ON u.userid = m.userid " .
|
||||
"LEFT JOIN {$opt["table_prefix"]}items i ON u.userid = i.userid " .
|
||||
"LEFT JOIN {$opt["table_prefix"]}subscriptions sub ON sub.publisher = u.userid AND sub.subscriber = ? " .
|
||||
"WHERE m.familyid IN ( " .
|
||||
"SELECT familyid " .
|
||||
"FROM {$opt["table_prefix"]}memberships " .
|
||||
"WHERE userid = ? " .
|
||||
") " .
|
||||
"AND u.userid != ? " .
|
||||
"GROUP BY u.userid, u.fullname");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $userid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoppees = array();
|
||||
while ($row = $stmt->fetch()) {
|
||||
if ($row['list_stamp'] == 0) {
|
||||
$row['list_stamp'] = '-';
|
||||
}
|
||||
else {
|
||||
$listStampDate = new DateTime($row['list_stamp']);
|
||||
$row['list_stamp'] = $listStampDate->format($opt["date_format"]);
|
||||
}
|
||||
$shoppees[] = $row;
|
||||
}
|
||||
$prospects = array();
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT messageid, u.fullname, message, created " .
|
||||
|
|
56
src/item.php
56
src/item.php
|
@ -36,6 +36,7 @@ $url = "";
|
|||
$category = 1;
|
||||
$ranking = 3;
|
||||
$comment = "";
|
||||
$public = 0;
|
||||
$quantity = 1;
|
||||
$image_url = "";
|
||||
$image_filename = "";
|
||||
|
@ -78,6 +79,7 @@ if (!empty($_REQUEST["action"])) {
|
|||
$category = isset($_REQUEST["category"]) ? trim($_REQUEST["category"]) : "1";
|
||||
$ranking = isset($_REQUEST["ranking"]) ? $_REQUEST["ranking"] : "3";
|
||||
$comment = isset($_REQUEST["comment"]) ? $_REQUEST["comment"] : "";
|
||||
$public = isset($_REQUEST["public"]) ? $_REQUEST["public"] : 0;
|
||||
if (isset($_REQUEST["pricesymbol"]) && $_REQUEST["pricesymbol"] != $opt["currency_symbol"]) {
|
||||
$price = "";
|
||||
$comment = trim("$comment Price not in {$opt['currency_symbol']}, it is {$_REQUEST["pricesymbol"]}{$_REQUEST['price']}.");
|
||||
|
@ -200,6 +202,34 @@ if (!empty($_REQUEST["action"])) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == "archive") {
|
||||
try {
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=true WHERE itemid = ?");
|
||||
$stmt->bindValue(1, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
header("Location: " . getFullPath("index.php?message=Item+archived."));
|
||||
exit;
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
die("sql exception: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "unarchive") {
|
||||
try {
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=false WHERE itemid = ?");
|
||||
$stmt->bindValue(1, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
header("Location: " . getFullPath("archive.php?message=Item+unarchived."));
|
||||
exit;
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
die("sql exception: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "delete") {
|
||||
try {
|
||||
/* find out if this item is bought or reserved. */
|
||||
|
@ -241,7 +271,7 @@ if (!empty($_REQUEST["action"])) {
|
|||
}
|
||||
}
|
||||
else if ($action == "edit") {
|
||||
$stmt = $smarty->dbh()->prepare("SELECT name, description, price, source, category, url, ranking, comment, quantity, image_filename FROM {$opt["table_prefix"]}items WHERE itemid = ?");
|
||||
$stmt = $smarty->dbh()->prepare("SELECT name, description, price, source, category, url, ranking, comment, public, quantity, image_filename FROM {$opt["table_prefix"]}items WHERE itemid = ?");
|
||||
$stmt->bindValue(1, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
|
@ -254,6 +284,7 @@ if (!empty($_REQUEST["action"])) {
|
|||
$category = $row["category"];
|
||||
$ranking = $row["ranking"];
|
||||
$comment = $row["comment"];
|
||||
$public = $row["public"];
|
||||
$quantity = (int) $row["quantity"];
|
||||
$image_filename = $row["image_filename"];
|
||||
}
|
||||
|
@ -267,13 +298,14 @@ if (!empty($_REQUEST["action"])) {
|
|||
$category = 1;
|
||||
$ranking = 3;
|
||||
$comment = "";
|
||||
$public = 0;
|
||||
$quantity = 1;
|
||||
$image_filename = "";
|
||||
}
|
||||
else if ($action == "insert") {
|
||||
if (!$haserror) {
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,name,description,price,source,category,url,ranking,comment,quantity,image_filename) " .
|
||||
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,name,description,price,source,category,url,ranking,comment,public,quantity,created,image_filename) " .
|
||||
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $name, PDO::PARAM_STR);
|
||||
$stmt->bindParam(3, $description, PDO::PARAM_STR);
|
||||
|
@ -283,11 +315,13 @@ if (!empty($_REQUEST["action"])) {
|
|||
$stmt->bindParam(7, $url, PDO::PARAM_STR);
|
||||
$stmt->bindParam(8, $ranking, PDO::PARAM_INT);
|
||||
$stmt->bindParam(9, $comment, PDO::PARAM_STR);
|
||||
$stmt->bindParam(10, $quantity, PDO::PARAM_INT);
|
||||
$stmt->bindParam(10, $public, PDO::PARAM_BOOL);
|
||||
$stmt->bindParam(11, $quantity, PDO::PARAM_INT);
|
||||
$stmt->bindParam(12, date('Y-m-d H:i:s'));
|
||||
if (!isset($image_base_filename) || $image_base_filename == "") {
|
||||
$image_base_filename = NULL;
|
||||
}
|
||||
$stmt->bindParam(11, $image_base_filename, PDO::PARAM_STR);
|
||||
$stmt->bindParam(13, $image_base_filename, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
|
||||
stampUser($userid, $smarty->dbh(), $smarty->opt());
|
||||
|
@ -309,6 +343,7 @@ if (!empty($_REQUEST["action"])) {
|
|||
"url = ?, " .
|
||||
"ranking = ?, " .
|
||||
"comment = ?, " .
|
||||
"public = ?, " .
|
||||
"quantity = ? " .
|
||||
($image_base_filename != "" ? ", image_filename = ? " : "") .
|
||||
"WHERE itemid = ?");
|
||||
|
@ -320,13 +355,15 @@ if (!empty($_REQUEST["action"])) {
|
|||
$stmt->bindParam(6, $url, PDO::PARAM_STR);
|
||||
$stmt->bindParam(7, $ranking, PDO::PARAM_INT);
|
||||
$stmt->bindParam(8, $comment, PDO::PARAM_STR);
|
||||
$stmt->bindParam(9, $quantity, PDO::PARAM_INT);
|
||||
$stmt->bindParam(9, $public, PDO::PARAM_BOOL);
|
||||
$stmt->bindParam(10, $quantity, PDO::PARAM_INT);
|
||||
error_log("public = $public");
|
||||
if ($image_base_filename != "") {
|
||||
$stmt->bindParam(10, $image_base_filename, PDO::PARAM_STR);
|
||||
$stmt->bindValue(11, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
$stmt->bindParam(11, $image_base_filename, PDO::PARAM_STR);
|
||||
$stmt->bindValue(12, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
}
|
||||
else {
|
||||
$stmt->bindValue(10, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
$stmt->bindValue(11, (int) $_REQUEST["itemid"], PDO::PARAM_INT);
|
||||
}
|
||||
$stmt->execute();
|
||||
|
||||
|
@ -400,6 +437,7 @@ if (isset($url_error)) {
|
|||
}
|
||||
$smarty->assign('image_filename', $image_filename);
|
||||
$smarty->assign('comment', $comment);
|
||||
$smarty->assign('public', $public);
|
||||
$smarty->assign('categories', $categories);
|
||||
$smarty->assign('ranks', $ranks);
|
||||
header("Location: " . getFullPath("index.php"));
|
||||
|
|
|
@ -73,13 +73,16 @@ try {
|
|||
if ($quantity == 1) {
|
||||
/* just delete the alloc and the item and get out.
|
||||
yes, it's possible the item was RESERVED, not PURCHASED. */
|
||||
deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
|
||||
// don't delete images for archived items
|
||||
// deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
|
||||
|
||||
/*
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}allocs WHERE itemid = ?");
|
||||
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
*/
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}items WHERE itemid = ?");
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=true WHERE itemid = ?");
|
||||
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
|
@ -97,8 +100,9 @@ try {
|
|||
|
||||
if ($actual == $quantity) {
|
||||
// now they're all gone.
|
||||
deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
|
||||
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}items WHERE itemid = ?");
|
||||
// don't delete images for archived items
|
||||
// deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
|
||||
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=true WHERE itemid = ?");
|
||||
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
|
95
src/shop.php
95
src/shop.php
|
@ -18,26 +18,47 @@ require_once(dirname(__FILE__) . "/includes/MySmarty.class.php");
|
|||
$smarty = new MySmarty();
|
||||
$opt = $smarty->opt();
|
||||
|
||||
session_start();
|
||||
if (!isset($_SESSION["userid"])) {
|
||||
header("Location: " . getFullPath("login.php") . "?from=shop.php");
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$userid = $_SESSION["userid"];
|
||||
}
|
||||
$public_view = 0;
|
||||
if (isset($_GET["list"])) {
|
||||
$list = filter_var(strtolower(trim($_GET["list"])), FILTER_SANITIZE_EMAIL);;
|
||||
$list = htmlspecialchars($list, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$opt['show_helptext'] = $_SESSION['show_helptext'];
|
||||
|
||||
if (isset($_GET["shopfor"])) {
|
||||
$shopfor = filter_var(trim($_GET["shopfor"]), FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
if (filter_var($shopfor, FILTER_SANITIZE_NUMBER_INT) === false || $shopfor == "" || !is_numeric($shopfor) || $shopfor < 0) {
|
||||
die("Invalid shopfor ({$_GET["shopfor"]})");
|
||||
if (filter_var($list, FILTER_SANITIZE_EMAIL) === false || $list == "") {
|
||||
die("Invalid listid ({$_GET["list"]})");
|
||||
}
|
||||
$stmt = $smarty->dbh()->prepare("SELECT userid FROM {$opt["table_prefix"]}users WHERE email = ?");
|
||||
$stmt->bindParam(1, $list, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
if ($row = $stmt->fetch()) {
|
||||
$shopfor = (int) $row["userid"];
|
||||
$public_view = 1;
|
||||
} else {
|
||||
die("Invalid listid ({$_GET["list"]})");
|
||||
}
|
||||
}
|
||||
|
||||
if ($public_view == 0) {
|
||||
session_start();
|
||||
if (!isset($_SESSION["userid"])) {
|
||||
header("Location: " . getFullPath("login.php") . "?from=shop.php");
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
$userid = $_SESSION["userid"];
|
||||
}
|
||||
|
||||
$opt['show_helptext'] = $_SESSION['show_helptext'];
|
||||
|
||||
if (isset($_GET["shopfor"])) {
|
||||
$shopfor = filter_var(trim($_GET["shopfor"]), FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
if (filter_var($shopfor, FILTER_SANITIZE_NUMBER_INT) === false || $shopfor == "" || !is_numeric($shopfor) || $shopfor < 0) {
|
||||
die("Invalid shopfor ({$_GET["shopfor"]})");
|
||||
}
|
||||
$shopfor = (int) $shopfor;
|
||||
//} else {
|
||||
// header("Location: " . getFullPath("index.php"));
|
||||
}
|
||||
$shopfor = (int) $shopfor;
|
||||
//} else {
|
||||
// header("Location: " . getFullPath("index.php"));
|
||||
}
|
||||
|
||||
if ($shopfor == $userid) {
|
||||
|
@ -142,13 +163,17 @@ if (!empty($_GET["action"])) {
|
|||
}
|
||||
}
|
||||
|
||||
$stmt = $smarty->dbh()->prepare("SELECT * FROM {$opt["table_prefix"]}shoppers WHERE shopper = ? AND mayshopfor = ? AND pending = 0");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $shopfor, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
if (!($stmt->fetch())) {
|
||||
echo "Nice try! (You can't shop for someone who hasn't approved it.)";
|
||||
exit;
|
||||
if (!$opt["auto_connect_family_members"]) {
|
||||
if ($public_view == 0) {
|
||||
$stmt = $smarty->dbh()->prepare("SELECT * FROM {$opt["table_prefix"]}shoppers WHERE shopper = ? AND mayshopfor = ? AND pending = 0");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $shopfor, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
if (!($stmt->fetch())) {
|
||||
echo "Nice try! (You can't shop for someone who hasn't approved it.)";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_GET["sortdir"])) {
|
||||
|
@ -198,18 +223,23 @@ else {
|
|||
for those items with a quantity of 1. if the item's quantity > 1 we'll query alloc when we
|
||||
get to that record. the theory is that most items will have quantity = 1 so we'll make the least
|
||||
number of trips. */
|
||||
$stmt = $smarty->dbh()->prepare("SELECT i.itemid, name, description, price, price as pricenum, source, i.category as catid, c.category, url, r.title as rank, i.ranking as rankid, image_filename, " .
|
||||
$sql = "SELECT i.itemid, name, description, price, price as pricenum, source, i.category as catid, c.category, url, r.title as rank, i.ranking as rankid, image_filename, public, " .
|
||||
"ub.fullname AS bfullname, ub.userid AS boughtid, " .
|
||||
"ur.fullname AS rfullname, ur.userid AS reservedid, " .
|
||||
"rendered, i.comment, i.quantity " .
|
||||
"rendered, i.comment, i.quantity, created " .
|
||||
"FROM {$opt["table_prefix"]}items i " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}allocs a ON a.itemid = i.itemid AND i.quantity = 1 " . // only join allocs for single-quantity items.
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}users ub ON ub.userid = a.userid AND a.bought = 1 " .
|
||||
"LEFT OUTER JOIN {$opt["table_prefix"]}users ur ON ur.userid = a.userid AND a.bought = 0 " .
|
||||
"WHERE i.userid = ? " .
|
||||
"ORDER BY " . $sortby);
|
||||
"WHERE i.userid = ? AND i.archive = false ";
|
||||
if ($public_view) {
|
||||
$sql .= "AND public = 1 ";
|
||||
}
|
||||
$sql .= "ORDER BY " . $sortby;
|
||||
error_log("sql = '$sql'");
|
||||
$stmt = $smarty->dbh()->prepare($sql);
|
||||
$stmt->bindParam(1, $shopfor, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$shoprows = array();
|
||||
|
@ -238,7 +268,7 @@ while ($row = $stmt->fetch()) {
|
|||
$itemallocs[] = ($allocrow['quantity'] . " bought by you.");
|
||||
}
|
||||
else {
|
||||
if (!$opt["anonymous_purchasing"]) {
|
||||
if (!$opt["anonymous_purchasing"] && !$public_view) {
|
||||
$itemallocs[] = ($allocrow['quantity'] . " bought by " . $allocrow['bfullname'] . ".");
|
||||
}
|
||||
else {
|
||||
|
@ -252,11 +282,11 @@ while ($row = $stmt->fetch()) {
|
|||
$itemallocs[] = ($allocrow['quantity'] . " reserved by you.");
|
||||
}
|
||||
else {
|
||||
if (!$opt["anonymous_purchasing"]) {
|
||||
if (!$opt["anonymous_purchasing"] && !$public_view) {
|
||||
$itemallocs[] = ($allocrow['quantity'] . " reserved by " . $allocrow['rfullname'] . ".");
|
||||
}
|
||||
else {
|
||||
$itemallocs[] = ($allocrow['quanitity'] . " reserved.");
|
||||
$itemallocs[] = ($allocrow['quantity'] . " reserved.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,6 +322,7 @@ $smarty->assign('ucomment', $ucomment);
|
|||
$smarty->assign('shopfor', $shopfor);
|
||||
$smarty->assign('shoprows', $shoprows);
|
||||
$smarty->assign('userid', $userid);
|
||||
$smarty->assign('public_view', $public_view);
|
||||
if (isset($_GET["message"])) {
|
||||
$message = $_GET["message"];
|
||||
}
|
||||
|
|
|
@ -78,6 +78,10 @@ CREATE TABLE `items` (
|
|||
`comment` text,
|
||||
`quantity` int(11) NOT NULL default '0',
|
||||
`image_filename` varchar(255) default NULL,
|
||||
`public` tinyint(1) NOT NULL default '0',
|
||||
`archive` tinyint(1) NOT NULL default '0',
|
||||
`archive` tinyint(1) NOT NULL default '0',
|
||||
`created` datetime default NULL,
|
||||
PRIMARY KEY (`itemid`)
|
||||
);
|
||||
|
||||
|
|
418
src/templates/archive.tpl
Normal file
418
src/templates/archive.tpl
Normal file
|
@ -0,0 +1,418 @@
|
|||
{*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{$opt.app_name} - Archive for {$fullname|escape:'htmlall'}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="css/phpgiftreg.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1/font/bootstrap-icons.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/lightbox2@2/dist/css/lightbox.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/lightbox2@2/dist/js/lightbox.min.js" crossorigin="anonymous"></script>
|
||||
<script src="js/themeswitcher.js"></script>
|
||||
<script src="js/bs-components.js"></script>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
{if $opt.confirm_item_archives}
|
||||
$('a[rel=confirmitemarchive]').click(function(event) {
|
||||
var desc = $(this).attr('data-content');
|
||||
if (!window.confirm('Are you sure you want to archive "' + desc + '"?')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
{/if}
|
||||
{if $opt.confirm_item_deletes}
|
||||
$('a[rel=confirmitemdelete]').click(function(event) {
|
||||
var desc = $(this).attr('data-content');
|
||||
if (!window.confirm('Are you sure you want to delete "' + desc + '"?')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
{/if}
|
||||
{if $opt.shop_requires_approval}
|
||||
$('a[rel=confirmunshop]').click(function(event) {
|
||||
var fn = $(this).attr('data-content');
|
||||
if (!window.confirm('Are you sure you no longer wish to shop for ' + fn + '?')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
{/if}
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
{include file='navbar.tpl'}
|
||||
<main>
|
||||
<div class="container">
|
||||
{if isset($message)}
|
||||
<div class="alert alert-success" role="alert">
|
||||
{$message|escape:'htmlall'}
|
||||
</div> <!-- alert -->
|
||||
{/if}
|
||||
{if $opt.show_helptext}
|
||||
<div class="card text-bg-info mb-3">
|
||||
<div class="card-header">Help</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
<li>You can click the column headers to sort by that attribute.</li>
|
||||
<li>List each item seperately on your list - do not combine items. (i.e. list each book of a 4-part series separately.)</li>
|
||||
<li>Once you've bought or decided not to buy an item, remember to return to the recipient's gift lists and mark it accordingly.</li>
|
||||
<li>If someone purchases an item on your list, click <img src="images/return-light.png" /> to mark it as received.</li>
|
||||
<li>To unarchive an item on your list, click <img src="images/basket3-fill-light.png" />.</li>
|
||||
</ul>
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
{/if}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><h1>My Items</h1></div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="colheader"><a href="index.php?mysort=name{if $mysort == "name"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Name{if $mysort == "name"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="colheader"><a href="index.php?mysort=ranking{if $mysort == "ranking"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Ranking{if $mysort == "ranking"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="colheader"><a href="index.php?mysort=quantity{if $mysort == "quantity"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Quantity{if $mysort == "quantity"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="colheader"><a href="index.php?mysort=category{if $mysort == "category"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Category{if $mysort == "category"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="colheader"><a href="index.php?mysort=source{if $mysort == "source"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Store{if $mysort == "source"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="colheader"><a href="index.php?mysort=price{if $mysort == "price"}&sortdir={$sortdir == "DESC" ? "ASC" : "DESC"}{/if}">Price{if $mysort == "price"} <img class="theme-image" data-light-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" data-dark-src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-dark.png" src="images/caret-{$sortdir == "DESC" ? "DESC" : "ASC"}-light.png" border="0" />{/if}</a></th>
|
||||
<th class="rcolheader">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$myitems item=row}
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<form name="itemform" id="itemform_{$row.itemid}" method="POST" action="item.php" enctype="multipart/form-data" class="well form-horizontal">
|
||||
<div class="modal" tabindex="-1" id="editmodal_{$row.itemid}">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Item Info: {$row.name|truncate:60}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div> <!-- modal-header -->
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="itemid" value="{$row.itemid}">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="description">Name</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="name" name="name" type="text" value="{$row.name|escape:'htmlall'}" class="form-control{if isset($name_error)} is-invalid{/if}" placeholder="Name" maxlength="100" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="description">Description</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<textarea id="description" name="description" class="form-control{if isset($description_error)} is-invalid{/if}" rows="3" cols="40">{$row.description|escape:'htmlall'}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="category">Category</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<select id="category" name="category" class="form-select">
|
||||
{foreach from=$categories item=catrow}
|
||||
<option value="{$catrow.categoryid}" {if $catrow.categoryid == $row.catid}SELECTED{/if}>{$catrow.category|escape:'htmlall'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="price">Price ({$opt.currency_symbol})</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="price" name="price" type="text" value="{$row.pricenum|escape:'htmlall'}" class="form-control{if isset($price_error)} is-invalid{/if}" placeholder="0.00">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="source">Store/Retailer</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="source" name="source" type="text" value="{$row.source|escape:'htmlall'}" class="form-control{if isset($source_error)} is-invalid{/if}" maxlength="255" placeholder="Source">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="ranking">Ranking</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<select id="ranking" size="{count($ranks)}" name="ranking" multiple="multiple" class="form-select">
|
||||
{foreach from=$ranks item=rankrow}
|
||||
<option value="{$rankrow.ranking}" {if $rankrow.ranking == $row.rankid}SELECTED{/if}>{$rankrow.title}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $opt.allow_multiples}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="quantity">Quantity</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="quantity" name="quantity" type="text" value="{$row.quantity|escape:'htmlall'}" class="form-control{if isset($quantity_error)} is-invalid{/if}" maxlength="3">
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<input type="hidden" name="quantity" value="1">
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="url">URL</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="url" name="url" type="text" inputmode="url" autocapitalize="off" spellcheck="false" value="{$row.url|escape:'htmlall'}" class="form-control{if isset($url_error)} is-invalid{/if}" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="control-label" for="image">Image</label>
|
||||
</div>
|
||||
{if $opt.allow_images}
|
||||
<div class="col">
|
||||
{if $row.image_filename == ''}
|
||||
<input type="radio" name="image" value="none" CHECKED>
|
||||
No image.<br />
|
||||
<input type="radio" name="image" value="upload" id="ifnew">
|
||||
Upload image:
|
||||
<input type="file" id="imagefile" name="imagefile">
|
||||
{else}
|
||||
<input type="radio" name="image" value="remove">
|
||||
Remove existing image.<br />
|
||||
<input type="radio" name="image" value="keep" CHECKED>
|
||||
Keep existing image.<br />
|
||||
<input type="radio" name="image" value="replace" id="ifreplace">
|
||||
Replace existing image:
|
||||
<input type="file" id="imagefile" name="imagefile">
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="public">Make public</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="public" name="public" type="checkbox" class="form-check-input" {if $row.public == 1}checked{/if}>
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="comment">Comment</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<textarea id="comment" name="comment" class="form-control{if isset($comment_error)} is-invalid{/if}" rows="2" cols="40">{$row.comment|escape:'htmlall'}</textarea>
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- modal-body -->
|
||||
<div class="modal-footer">
|
||||
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url}" target="_blank" title="{$row.url}"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
|
||||
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
|
||||
<a role="button" class="btn btn-secondary" href="receive.php?itemid={$row.itemid}" ><img alt="Mark Item Received" src="images/return-dark.png" title="Mark Item Received" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" href="item.php?action=unarchive&itemid={$row.itemid}"><img alt="Unarchive Item" title="Unarchive Item" src="images/basket3-fill-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-danger" rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}"><img alt="Delete Item" title="Delete Item" src="images/bin-dark.png" border="0" /></a>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div> <!-- modal-footer -->
|
||||
</div> <!-- modal-content -->
|
||||
</div> <!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
</form>
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#editmodal_{$row.itemid}">
|
||||
<span title="{$row.description|escape:'htmlall'}">{$row.name|truncate:50|escape:'htmlall'}</span>
|
||||
</a>
|
||||
<span title="{$row.description|escape:'htmlall'}">
|
||||
{if $row.public == 1} <img alt="Item is Public" class="theme-image" data-light-src="images/globe-light.png" data-dark-src="images/globe-dark.png" src="images/globe-light.png" border="0" title="Item is Public">{/if}
|
||||
</td>
|
||||
<td nowrap class="text-center">{$row.rankid}</td>
|
||||
<td nowrap class="text-center">{$row.quantity}</td>
|
||||
<td>{$row.category|default:" "}</td>
|
||||
<td>{$row.source|default:" "}</td>
|
||||
<td align="right">{$row.price}</td>
|
||||
<td align="right" nowrap>
|
||||
{if $row.url != ''}
|
||||
<a href="{$row.url}" target="_blank" title="{$row.url}"><img class="theme-image" data-light-src="images/link-light.png" data-dark-src="images/link-dark.png" src="images/link-light.png" border="0" alt="Link" /></a>
|
||||
{/if}
|
||||
{if $row.image_filename != '' && $opt.allow_images}
|
||||
<a href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img class="theme-image" data-light-src="images/image-light.png" data-dark-src="images/image-dark.png" src="images/image-light.png" border="0" alt="Image" /></a>
|
||||
{/if}
|
||||
<a href="receive.php?itemid={$row.itemid}" class="text-decoration-none"><img alt="Mark Item Received" class="theme-image" data-light-src="images/return-light.png" data-dark-src="images/return-dark.png" src="images/return-light.png" border="0" title="Mark Item Received" /></a>
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#editmodal_{$row.itemid}"><img alt="Edit Item" class="theme-image" data-light-src="images/pencil-light.png" data-dark-src="images/pencil-dark.png" src="images/pencil-light.png" border="0" title="Edit Item" /></a>
|
||||
<a href="item.php?action=unarchive&itemid={$row.itemid}" class="text-decoration-none"><img alt="Unarchive Item" class="theme-image" data-light-src="images/basket3-fill-light.png" data-dark-src="images/basket3-fill-dark.png" src="images/basket3-fill-light.png" border="0" alt="Unarchive" title="Unarchive Item" /></a>
|
||||
<a rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}" class="text-decoration-none"><img alt="Delete Item" class="theme-image" data-light-src="images/bin-light.png" data-dark-src="images/bin-dark.png" src="images/bin-light.png" border="0" alt="Delete" title="Delete Item" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- table-responsive -->
|
||||
{if $myitems_count > $opt.items_per_page || $offset > 0}
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination justify-content-center">
|
||||
<li class="page-item{if $offset + $opt.items_per_page < $myitems_count} disabled{/if}"><a class="page-link" href="index.php?offset={$offset - $opt.items_per_page}">«</a></li>
|
||||
{for $i=0 to $myitems_count step $opt.items_per_page}
|
||||
<li class="page-item{if $offset >= $i && $offset < $i + $opt.items_per_page} active{/if}"><a class="page-link" href="index.php?offset={$i}">{$i + $opt.items_per_page}</a></li>
|
||||
{/for}
|
||||
<li class="page-item{if $offset >= $opt.items_per_page} disabled{/if}"><a class="page-link" href="index.php?offset={$offset + $opt.items_per_page}">»</a></li>
|
||||
</ul>
|
||||
</nav> <!-- pagination -->
|
||||
{/if}
|
||||
</div> <!-- card-body -->
|
||||
<div class="card-footer text-body-secondary">
|
||||
<form name="itemform" id="additemform" method="POST" action="item.php" enctype="multipart/form-data" class="well form-horizontal">
|
||||
<div class="modal" tabindex="-1" id="addmodal">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Add Item</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div> <!-- modal-header -->
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="action" value="insert">
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="description">Name</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="name" name="name" type="text" value="" class="form-control{if isset($name_error)} is-invalid{/if}" placeholder="Name" maxlength="100" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="description">Description</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<textarea id="description" name="description" class="form-control{if isset($description_error)} is-invalid{/if}" rows="2" cols="40"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="category">Category</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<select id="category" name="category" class="form-select">
|
||||
{foreach from=$categories item=catrow}
|
||||
<option value="{$catrow.categoryid}" {if $catrow.categoryid == $opt.default_category}SELECTED{/if}>{$catrow.category|escape:'htmlall'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="price">Price ({$opt.currency_symbol})</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="price" name="price" type="text" value="" class="form-control{if isset($price_error)} is-invalid{/if}" placeholder="0.00">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="source">Store/Retailer</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="source" name="source" type="text" value="" class="form-control{if isset($source_error)} is-invalid{/if}" maxlength="255" placeholder="Source">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="ranking">Ranking</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<select id="ranking" size="{count($ranks)}" name="ranking" multiple="multiple" class="form-select">
|
||||
{foreach from=$ranks item=rankrow}
|
||||
<option value="{$rankrow.ranking}" {if $rankrow.ranking == $opt.default_ranking}SELECTED{/if}>{$rankrow.title}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $opt.allow_multiples}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="quantity">Quantity</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="quantity" name="quantity" type="text" value="" class="form-control{if isset($quantity_error)} is-invalid{/if}" maxlength="3">
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<input type="hidden" name="quantity" value="1">
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="url">URL</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="url" name="url" type="text" inputmode="url" autocapitalize="off" spellcheck="false" value="" class="form-control{if isset($url_error)} is-invalid{/if}" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="control-label" for="image">Image</label>
|
||||
</div>
|
||||
{if $opt.allow_images}
|
||||
<div class="col">
|
||||
<input type="radio" name="image" value="none" CHECKED>
|
||||
No image.<br />
|
||||
<input type="radio" name="image" value="upload" id="ifnew">
|
||||
Upload image:
|
||||
<input type="file" id="imagefile" name="imagefile">
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="public">Make public</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="public" name="public" type="checkbox" class="form-check-input">
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="comment">Comment</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<textarea id="comment" name="comment" class="form-control{if isset($comment_error)} is-invalid{/if}" rows="2" cols="40"></textarea>
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- modal-body -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div> <!-- modal-footer -->
|
||||
</div> <!-- modal-content -->
|
||||
</div> <!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
</form>
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#addmodal">Add a new item</a>
|
||||
</div> <!-- card-footer -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- container -->
|
||||
</main>
|
||||
{include file='footer.tpl'}
|
||||
</body>
|
||||
</html>
|
|
@ -75,6 +75,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- col -->
|
||||
<div class="col">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">What's New</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
<li>2024-12-31: Items can be marked "Public" and shared with others via
|
||||
<div class="input-group">
|
||||
<input type="text" id="readonlyText" class="form-control" value="{$myurl}/shop.php?list={$email}" readonly>
|
||||
<button class="btn btn-primary" id="copyButton">Copy</button>
|
||||
</div>
|
||||
</li>
|
||||
<li>2024-12-31: Marking items as received archives them instead of deletes them</li>
|
||||
<li>2024-12-31: Items can be archived and the Item Archive can be viewed under the profile icon (top-right)</li>
|
||||
<li>2024-12-17: You are automatically a shopper for your family members</li>
|
||||
</ul>
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- col -->
|
||||
<div class="col">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">Gift Registry Help</div>
|
||||
|
@ -141,5 +159,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- container -->
|
||||
</main>
|
||||
{include file='footer.tpl'}
|
||||
<script>
|
||||
document.getElementById('copyButton').addEventListener('click', function() {
|
||||
// Get the text from the input field
|
||||
const textBox = document.getElementById('readonlyText');
|
||||
textBox.select();
|
||||
textBox.setSelectionRange(0, 99999); // For mobile devices
|
||||
|
||||
// Copy the text to the clipboard
|
||||
navigator.clipboard.writeText(textBox.value)
|
||||
.then(() => {
|
||||
// Show success message
|
||||
const alert = document.getElementById('copyAlert');
|
||||
alert.classList.remove('d-none');
|
||||
setTimeout(() => {
|
||||
alert.classList.add('d-none');
|
||||
}, 2000); // Hide the alert after 2 seconds
|
||||
})
|
||||
.catch(err => console.error('Failed to copy text:', err));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,6 +30,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
<script src="js/bs-components.js"></script>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
{if $opt.confirm_item_archives}
|
||||
$('a[rel=confirmitemarchive]').click(function(event) {
|
||||
var desc = $(this).attr('data-content');
|
||||
if (!window.confirm('Are you sure you want to archive "' + desc + '"?')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
{/if}
|
||||
{if $opt.confirm_item_deletes}
|
||||
$('a[rel=confirmitemdelete]').click(function(event) {
|
||||
var desc = $(this).attr('data-content');
|
||||
|
@ -68,6 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
<li>List each item seperately on your list - do not combine items. (i.e. list each book of a 4-part series separately.)</li>
|
||||
<li>Once you've bought or decided not to buy an item, remember to return to the recipient's gift lists and mark it accordingly.</li>
|
||||
<li>If someone purchases an item on your list, click <img src="images/return-light.png" /> to mark it as received.</li>
|
||||
<li>To archive an item on your list, click <img src="images/archive-fill-light.png" />.</li>
|
||||
</ul>
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
|
@ -203,6 +212,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="public">Make public</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="public" name="public" type="checkbox" class="form-check-input" {if $row.public == 1}checked{/if}>
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="comment">Comment</label>
|
||||
|
@ -212,22 +229,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- modal-body -->
|
||||
<div class="modal-footer">
|
||||
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url}" target="_blank" title="{$row.url}"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
|
||||
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
|
||||
<a role="button" class="btn btn-secondary" href="receive.php?itemid={$row.itemid}" ><img alt="Mark Item Received" src="images/return-dark.png" title="Mark Item Received" border="0" /></a>
|
||||
<a role="button" class="btn btn-danger" rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}"><img alt="Delete Item" title="Delete Item" src="images/bin-dark.png" border="0" /></a>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<div class="modal-footer d-flex justify-content-between">
|
||||
<span>{if isset($row.created)}Added: {$row.created|date_format:"%F"}{/if}</span>
|
||||
<div>
|
||||
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url}" target="_blank" title="{$row.url}"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
|
||||
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
|
||||
<a role="button" class="btn btn-secondary" href="receive.php?itemid={$row.itemid}" ><img alt="Mark Item Received" src="images/return-dark.png" title="Mark Item Received" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" rel="confirmitemarchive" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=archive&itemid={$row.itemid}"><img alt="Archive Item" title="Archive Item" src="images/archive-fill-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-danger" rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}"><img alt="Delete Item" title="Delete Item" src="images/bin-dark.png" border="0" /></a>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</div> <!-- modal-footer -->
|
||||
</div> <!-- modal-content -->
|
||||
</div> <!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
</form>
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#editmodal_{$row.itemid}">
|
||||
<span title="{$row.description|escape:'htmlall'}">{$row.name|truncate:50|escape:'htmlall'}</span>
|
||||
<span title="{$row.description|escape:'htmlall'}{if isset($row.created)} (Added: {$row.created|date_format:"%F"}){/if}">{$row.name|truncate:50|escape:'htmlall'}</span>
|
||||
</a>
|
||||
<span title="{$row.description|escape:'htmlall'}">
|
||||
{if $row.public == 1} <img alt="Item is Public" class="theme-image" data-light-src="images/globe-light.png" data-dark-src="images/globe-dark.png" src="images/globe-light.png" border="0" title="Item is Public">{/if}
|
||||
</td>
|
||||
<td nowrap class="text-center">{$row.rankid}</td>
|
||||
<td nowrap class="text-center">{$row.quantity}</td>
|
||||
|
@ -243,6 +265,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
{/if}
|
||||
<a href="receive.php?itemid={$row.itemid}" class="text-decoration-none"><img alt="Mark Item Received" class="theme-image" data-light-src="images/return-light.png" data-dark-src="images/return-dark.png" src="images/return-light.png" border="0" title="Mark Item Received" /></a>
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#editmodal_{$row.itemid}"><img alt="Edit Item" class="theme-image" data-light-src="images/pencil-light.png" data-dark-src="images/pencil-dark.png" src="images/pencil-light.png" border="0" title="Edit Item" /></a>
|
||||
<a rel="confirmitemarchive" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=archive&itemid={$row.itemid}" class="text-decoration-none"><img alt="Archive Item" class="theme-image" data-light-src="images/archive-fill-light.png" data-dark-src="images/archive-fill-dark.png" src="images/archive-fill-light.png" border="0" alt="Archive" title="Archive Item" /></a>
|
||||
<a rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}" class="text-decoration-none"><img alt="Delete Item" class="theme-image" data-light-src="images/bin-light.png" data-dark-src="images/bin-dark.png" src="images/bin-light.png" border="0" alt="Delete" title="Delete Item" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -363,6 +386,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="public">Make public</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input id="public" name="public" type="checkbox" class="form-check-input">
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
<div class="row row-cols-2 mb-2 g-3 align-items-center">
|
||||
<div class="col-4">
|
||||
<label class="col-form-label" for="comment">Comment</label>
|
||||
|
@ -433,43 +464,45 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- col -->
|
||||
<div class="col mb-3">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">Available People To Shopping For</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="colheader">Name</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$prospects item=row}
|
||||
<tr>
|
||||
<td>{$row.fullname|escape:'htmlall'}</td>
|
||||
<td align="right" nowrap>
|
||||
{if $row.pending}
|
||||
<a href="index.php?action=cancel&shopfor={$row.userid}"><img class="theme-image" data-light-src="images/delete-light.png" data-dark-src="images/delete-dark.png" src="images/delete-light.png" border="0" alt="Cancel" title="Cancel" /></a>
|
||||
{else}
|
||||
<a href="index.php?action=request&shopfor={$row.userid}">
|
||||
{if $opt.shop_requires_approval}
|
||||
<img class="theme-image" data-light-src="images/cloud-add-light.png" data-dark-src="images/cloud-add-dark.png" src="images/cloud-add-light.png" border="0" alt="Request" title="Request" />
|
||||
{else}
|
||||
<img class="theme-image" data-light-src="images/cloud-add-light.png" data-dark-src="images/cloud-add-dark.png" src="images/cloud-add-light.png" border="0" alt="Add" title="Add" />
|
||||
{/if}
|
||||
</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- table-responsive -->
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- col -->
|
||||
{if !$opt.auto_connect_family_members}
|
||||
<div class="col mb-3">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">Available People To Shopping For</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="colheader">Name</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$prospects item=row}
|
||||
<tr>
|
||||
<td>{$row.fullname|escape:'htmlall'}</td>
|
||||
<td align="right" nowrap>
|
||||
{if $row.pending}
|
||||
<a href="index.php?action=cancel&shopfor={$row.userid}"><img class="theme-image" data-light-src="images/delete-light.png" data-dark-src="images/delete-dark.png" src="images/delete-light.png" border="0" alt="Cancel" title="Cancel" /></a>
|
||||
{else}
|
||||
<a href="index.php?action=request&shopfor={$row.userid}">
|
||||
{if $opt.shop_requires_approval}
|
||||
<img class="theme-image" data-light-src="images/cloud-add-light.png" data-dark-src="images/cloud-add-dark.png" src="images/cloud-add-light.png" border="0" alt="Request" title="Request" />
|
||||
{else}
|
||||
<img class="theme-image" data-light-src="images/cloud-add-light.png" data-dark-src="images/cloud-add-dark.png" src="images/cloud-add-light.png" border="0" alt="Add" title="Add" />
|
||||
{/if}
|
||||
</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- table-responsive -->
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div> <!-- col -->
|
||||
{/if}
|
||||
<div class="col mb-3">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">Messages</div>
|
||||
|
|
|
@ -111,6 +111,7 @@ Inspired from https://getbootstrap.com/docs/4.0/components/navbar/#supported-con
|
|||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-settings">
|
||||
<a class="dropdown-item" href="profile.php">Update Profile</a>
|
||||
<a class="dropdown-item" href="archive.php">Item Archive</a>
|
||||
<a class="dropdown-item" href="login.php?action=logout">Logout</a>
|
||||
</div>
|
||||
</li>
|
||||
|
|
66
src/templates/public_navbar.tpl
Normal file
66
src/templates/public_navbar.tpl
Normal file
|
@ -0,0 +1,66 @@
|
|||
{*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*}
|
||||
{*
|
||||
Inspired from https://getbootstrap.com/docs/4.0/components/navbar/#supported-content
|
||||
*}
|
||||
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary mb-4">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php"><img src="images/wishlist.png" height=25px width=25px /> {$opt.app_name}</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item dropdown">
|
||||
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle d-flex align-items-center"
|
||||
id="bd-theme"
|
||||
type="button"
|
||||
aria-expanded="false"
|
||||
data-bs-toggle="dropdown"
|
||||
data-bs-display="static"
|
||||
aria-label="Toggle theme (auto)">
|
||||
<img width="20" height="20" class="theme-image-active mt-1 me-2" data-light-light-src="images/sun-fill-light.png" data-dark-dark-src="images/moon-stars-fill-dark.png" data-auto-light-src="images/circle-half-light.png" data-auto-dark-src="images/circle-half-dark.png" src="images/circle-half-light.png">
|
||||
<span class="d-lg-none ms-2" id="bd-theme-text">Toggle theme</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme-text">
|
||||
<li>
|
||||
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto" aria-pressed="true">
|
||||
<img width="20" height="20" class="theme-image mt-1 me-2" data-light-src="images/circle-half-light.png" data-dark-src="images/circle-half-dark.png" src="images/circle-half-light.png">
|
||||
Auto
|
||||
<img id="theme-auto" width="20" height="20" class="theme-image theme-image-check mt-1 me-2 d-none" data-light-src="images/check2-light.png" data-dark-src="images/check2-dark.png" src="images/check2-light.png">
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
|
||||
<img width="20" height="20" class="theme-image mt-1 me-2" data-light-src="images/sun-fill-light.png" data-dark-src="images/sun-fill-dark.png" src="images/sun-fill-light.png">
|
||||
Light
|
||||
<img id="theme-light" width="20" height="20" class="theme-image theme-image-check mt-1 me-2 d-none" data-light-src="images/check2-light.png" data-dark-src="images/check2-dark.png" src="images/check2-light.png">
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark" aria-pressed="false">
|
||||
<img width="20" height="20" class="theme-image mt-1 me-2" data-light-src="images/moon-stars-fill-light.png" data-dark-src="images/moon-stars-fill-dark.png" src="images/moon-stars-fill-light.png">
|
||||
Dark
|
||||
<img id="theme-dark" width="20" height="20" class="theme-image theme-image-check mt-1 me-2 d-none" data-light-src="images/check2-light.png" data-dark-src="images/check2-dark.png" src="images/check2-light.png">
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
|
@ -35,7 +35,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</script>
|
||||
</head>
|
||||
<body>
|
||||
{include file='navbar.tpl' isadmin=$isadmin}
|
||||
{if !$public_view}
|
||||
{include file='navbar.tpl' isadmin=$isadmin}
|
||||
{else}
|
||||
{include file='public_navbar.tpl'}
|
||||
{/if}
|
||||
<main>
|
||||
<div class="container">
|
||||
{if isset($message)}
|
||||
|
@ -52,7 +56,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
<li>If you return something you've purchased, come back and click the <img src="images/return-light.png"> icon. It will remain reserved for you.</li>
|
||||
<li>Just because an item has a URL listed doesn't mean you have to buy it from there (unless the comment says so).</li>
|
||||
<li>You can click the column headers to sort by that attribute.</li>
|
||||
<li>If you see something you'd like for yourself, click the <img src="images/split-2-light.png"> icon to copy it to your own list.</li>
|
||||
{if !$public_view}
|
||||
<li>If you see something you'd like for yourself, click the <img src="images/split-2-light.png"> icon to copy it to your own list.</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
|
@ -167,33 +173,38 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- modal-body -->
|
||||
<div class="modal-footer">
|
||||
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url|escape:'htmlall'}" target="_blank"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
|
||||
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
|
||||
{if $row.quantity > 1}
|
||||
{if $row.avail > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$reservetext|escape:'htmlall'}" title="{$reservetext|escape:'htmlall'}" src="images/locked-dark.png" border="0" /></a>{/if}
|
||||
{if $row.avail > 0 || $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>{/if}
|
||||
{if $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>{/if}
|
||||
{if $row.ibought > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=return&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Return Item" title="Return Item" src="images/return-dark.png" border="0" /></a>{/if}
|
||||
{else}
|
||||
{if $row.rfullname == '' && $row.bfullname == ''}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Reserve Item" title="Reserve Item" src="images/locked-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
|
||||
{elseif $row.rfullname != ''}
|
||||
{if $row.reservedid == $userid}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
|
||||
<div class="modal-footer d-flex justify-content-between">
|
||||
<span>{if isset($row.created)}Added: {$row.created|date_format:"%F"}{/if}</span>
|
||||
<div>
|
||||
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url|escape:'htmlall'}" target="_blank"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
|
||||
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
|
||||
{if $row.quantity > 1}
|
||||
{if $row.avail > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$reservetext|escape:'htmlall'}" title="{$reservetext|escape:'htmlall'}" src="images/locked-dark.png" border="0" /></a>{/if}
|
||||
{if $row.avail > 0 || $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>{/if}
|
||||
{if $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>{/if}
|
||||
{if $row.ibought > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=return&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Return Item" title="Return Item" src="images/return-dark.png" border="0" /></a>{/if}
|
||||
{else}
|
||||
{if $row.rfullname == '' && $row.bfullname == ''}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Reserve Item" title="Reserve Item" src="images/locked-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
|
||||
{elseif $row.rfullname != ''}
|
||||
{if $row.reservedid == $userid}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" src="images/split-2-dark.png" border="0" /></a>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
{if !$public_view}
|
||||
<a role="button" class="btn btn-secondary" href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" src="images/split-2-dark.png" border="0" /></a>
|
||||
{/if}
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div> <!-- modal-footer -->
|
||||
</div> <!-- modal-content -->
|
||||
</div> <!-- modal-dialog -->
|
||||
</div> <!-- modal -->
|
||||
<a href="#" data-bs-toggle="modal" data-bs-target="#modal_{$row.itemid}">
|
||||
<span title="{$row.description|escape:'htmlall'}">{$row.name|truncate:50|escape:'htmlall'}</span>
|
||||
<span title="{$row.description|escape:'htmlall'}{if isset($row.created)} (Added: {$row.created|date_format:"%F"}){/if}">{$row.name|truncate:50|escape:'htmlall'}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td nowrap class="text-center">{$row.rankid}</td>
|
||||
|
@ -249,7 +260,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
{* </td> *}
|
||||
{else}
|
||||
<td> <!-- status -->
|
||||
{if $opt.anonymous_purchasing}
|
||||
{if $opt.anonymous_purchasing || $public_view}
|
||||
<i>Reserved.</i>
|
||||
{else}
|
||||
<i>Reserved by {$row.rfullname|escape:'htmlall'}.</i>
|
||||
|
@ -286,7 +297,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
{/if}
|
||||
{/if}
|
||||
{* <td> *}
|
||||
<a href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" class="theme-image" data-light-src="images/split-2-light.png" data-dark-src="images/split-2-dark.png" src="images/split-2-light.png" border="0" /></a>
|
||||
{if !$public_view}
|
||||
<a href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" class="theme-image" data-light-src="images/split-2-light.png" data-dark-src="images/split-2-dark.png" src="images/split-2-light.png" border="0" /></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
@ -296,25 +309,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
</div> <!-- card body -->
|
||||
<div class="card-footer text-body-secondary"><a onClick="printPage()" href="#">Send to printer</a></div>
|
||||
</div> <!-- card -->
|
||||
<div class="row row-cols-1 row-cols-md-2 g4 d-flex d-flex justify-content-center">
|
||||
<div class="col mb-3">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><h1>{$ufullname|escape:'htmlall'} Info</h1></div>
|
||||
<div class="card-body">
|
||||
{if $uemail != ''}
|
||||
Email Address: {$uemail|escape:'htmlall'}<br /><br />
|
||||
{/if}
|
||||
{if $ucomment != ''}
|
||||
{$ucomment|escape:'htmlall'|nl2br}
|
||||
{/if}
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
{if !$public_view}
|
||||
<div class="row row-cols-1 row-cols-md-2 g4 d-flex d-flex justify-content-center">
|
||||
<div class="col mb-3">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><h1>{$ufullname|escape:'htmlall'} Info</h1></div>
|
||||
<div class="card-body">
|
||||
{if $uemail != ''}
|
||||
Email Address: {$uemail|escape:'htmlall'}<br /><br />
|
||||
{/if}
|
||||
{if $ucomment != ''}
|
||||
{$ucomment|escape:'htmlall'|nl2br}
|
||||
{/if}
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
</div> <!-- col -->
|
||||
</div> <!-- row -->
|
||||
{/if}
|
||||
<div class="card text-bg-info mb-3">
|
||||
<div class="card-header">Legend</div>
|
||||
<div class="card-body text-center">
|
||||
<img src="images/locked-light.png" alt="Reserve" title="Reserve"> = Reserve, <img src="images/unlocked-light.png" alt="Release" title="Release"> = Release, <img src="images/credit-card-3-light.png" alt="Purchase" title="Purchase"> = Purchase, <img src="images/return-light.png" alt="Return" title="Return"> = Return, <img src="images/split-2-light.png" alt="I Want This Too" title="I Want This Too"> = I Want This Too
|
||||
<img src="images/locked-light.png" alt="Reserve" title="Reserve"> = Reserve, <img src="images/unlocked-light.png" alt="Release" title="Release"> = Release, <img src="images/credit-card-3-light.png" alt="Purchase" title="Purchase"> = Purchase, <img src="images/return-light.png" alt="Return" title="Return"> = Return{if !$public_view}, <img src="images/split-2-light.png" alt="I Want This Too" title="I Want This Too"> = I Want This Too{/if}
|
||||
</div> <!-- card body -->
|
||||
</div> <!-- card -->
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue