diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/active_auctions.php b/active_auctions.php
old mode 100644
new mode 100755
index 2caadddda..0791f8d2a
--- a/active_auctions.php
+++ b/active_auctions.php
@@ -1,6 +1,6 @@
checkUserValid($user_id);
-} elseif ($user->logged_in) {
- $user_id = $user->user_data['id'];
-} else {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'active_auctions.php';
- header('location: user_login.php');
- exit;
+if (isset($_GET['user_id']) && !empty($_GET['user_id']))
+{
+ $user_id = intval($_GET['user_id']);
+ // check trying to access valid user id
+ $user->checkUserValid($user_id);
}
+elseif ($user->logged_in)
+{
+ $user_id = $user->user_data['id'];
+}
+else
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'active_auctions.php';
+ header('location: user_login.php');
+ exit;
+}
+
+$NOW = time();
// get number of active auctions for this user
$query = "SELECT count(id) AS auctions FROM " . $DBPrefix . "auctions
WHERE user = :user_id
AND closed = 0
- AND suspended = 0
- AND starts <= CURRENT_TIMESTAMP";
+ AND starts <= :time";
$params = array();
$params[] = array(':user_id', $user_id, 'int');
+$params[] = array(':time', $NOW, 'int');
$db->query($query, $params);
$num_auctions = $db->result('auctions');
// Handle pagination
-if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '' || $_GET['PAGE'] < 1) {
- $OFFSET = 0;
- $PAGE = 1;
-} else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '' || $_GET['PAGE'] < 1)
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
-$PAGES = ceil($num_auctions / $system->SETTINGS['perpage']);
-if (!isset($PAGES) || $PAGES < 1) {
- $PAGES = 1;
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
+$PAGES = ceil($num_auctions / $system->SETTINGS['perpage']);
+if (!isset($PAGES) || $PAGES < 1) $PAGES = 1;
$query = "SELECT * FROM " . $DBPrefix . "auctions
WHERE user = :user_id
AND closed = 0
- AND suspended = 0
- AND starts <= CURRENT_TIMESTAMP
+ AND starts <= :time
ORDER BY ends ASC LIMIT :offset, :perpage";
$params = array();
$params[] = array(':user_id', $user_id, 'int');
+$params[] = array(':time', $NOW, 'int');
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
$k = 0;
-while ($row = $db->fetch()) {
- if (strlen($row['pict_url']) > 0) {
- $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'];
- } else {
- $row['pict_url'] = get_lang_img('nopicture.gif');
- }
-
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
-
- $template->assign_block_vars('auctions', array(
- 'BGCOLOUR' => (!($k % 2)) ? '' : 'class="alt-row"',
- 'ID' => $row['id'],
- 'PIC_URL' => $row['pict_url'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'BNIMG' => get_lang_img(($row['bn_only'] == 0) ? 'buy_it_now.gif' : 'bn_only.png'),
- 'BNVALUE' => $row['buy_now'],
- 'BNFORMAT' => $system->print_money($row['buy_now']),
- 'BIDVALUE' => $row['current_bid'],
- 'BIDFORMAT' => $system->print_money($row['current_bid']),
- 'NUM_BIDS' => $row['num_bids'],
- 'TIMELEFT' => $dt->formatTimeLeft($difference),
-
- 'B_BUY_NOW' => ($row['buy_now'] > 0 && ($row['bn_only'] || $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])))),
- 'B_BNONLY' => ($row['bn_only'])
- ));
- $k++;
+while ($row = $db->fetch())
+{
+ if (strlen($row['pict_url']) > 0)
+ {
+ $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url'];
+ }
+ else
+ {
+ $row['pict_url'] = get_lang_img('nopicture.gif');
+ }
+
+ $difference = $row['ends'] - $NOW;
+
+ $template->assign_block_vars('auctions', array(
+ 'BGCOLOUR' => (!($k % 2)) ? '' : 'class="alt-row"',
+ 'ID' => $row['id'],
+ 'PIC_URL' => $row['pict_url'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'BNIMG' => get_lang_img(($row['bn_only'] == 0) ? 'buy_it_now.gif' : 'bn_only.png'),
+ 'BNVALUE' => $row['buy_now'],
+ 'BNFORMAT' => $system->print_money($row['buy_now']),
+ 'BIDVALUE' => $row['current_bid'],
+ 'BIDFORMAT' => $system->print_money($row['current_bid']),
+ 'NUM_BIDS' => $row['num_bids'],
+ 'TIMELEFT' => FormatTimeLeft($difference),
+
+ 'B_BUY_NOW' => ($row['buy_now'] > 0 && ($row['bn_only'] || $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])))),
+ 'B_BNONLY' => ($row['bn_only'])
+ ));
+ $k++;
}
// get this user's nick
@@ -102,39 +112,41 @@
$page_title = $MSG['219'] . ': ' . $TPL_user_nick;
$LOW = $PAGE - 5;
-if ($LOW <= 0) {
- $LOW = 1;
-}
+if ($LOW <= 0) $LOW = 1;
$COUNTER = $LOW;
$pagenation = '';
-while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- if ($PAGE == $COUNTER) {
- $pagenation .= '' . $COUNTER . ' ';
- } else {
- $pagenation .= '' . $COUNTER . ' ';
- }
- $COUNTER++;
+while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+{
+ if ($PAGE == $COUNTER)
+ {
+ $pagenation .= '' . $COUNTER . ' ';
+ }
+ else
+ {
+ $pagenation .= '' . $COUNTER . ' ';
+ }
+ $COUNTER++;
}
$template->assign_vars(array(
- 'B_MULPAG' => ($PAGES > 1),
- 'B_NOTLAST' => ($PAGE < $PAGES),
- 'B_NOTFIRST' => ($PAGE > 1),
-
- 'USER_RSSFEED' => sprintf($MSG['932'], $TPL_user_nick),
- 'USER_ID' => $user_id,
- 'USERNAME' => $TPL_user_nick,
- 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
- 'NEXT' => intval($PAGE + 1),
- 'PREV' => intval($PAGE - 1),
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES,
- 'PAGENA' => $pagenation
- ));
+ 'B_MULPAG' => ($PAGES > 1),
+ 'B_NOTLAST' => ($PAGE < $PAGES),
+ 'B_NOTFIRST' => ($PAGE > 1),
+
+ 'USER_RSSFEED' => sprintf($MSG['932'], $TPL_user_nick),
+ 'USER_ID' => $user_id,
+ 'USERNAME' => $TPL_user_nick,
+ 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
+ 'NEXT' => intval($PAGE + 1),
+ 'PREV' => intval($PAGE - 1),
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES,
+ 'PAGENA' => $pagenation
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'active_auctions.tpl'
- ));
+ 'body' => 'active_auctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/admin/aboutus.php b/admin/aboutus.php
old mode 100644
new mode 100755
index f152b1aec..c641c092b
--- a/admin/aboutus.php
+++ b/admin/aboutus.php
@@ -1,6 +1,6 @@
writesetting("aboutus", ynbool($_POST['aboutus']), "str");
- $system->writesetting("aboutustext", $system->cleanvars($_POST['aboutustext'], true), "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Update database
+ $system->writesetting("aboutus", ynbool($_POST['aboutus']), "str");
+ $system->writesetting("aboutustext", $system->cleanvars($_POST['aboutustext'], true), "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['about_us_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5079']));
}
-loadblock($MSG['active_about_us'], $MSG['active_about_us_explain'], 'yesno', 'aboutus', $system->SETTINGS['aboutus'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['5077'], $MSG['5076'], 'yesno', 'aboutus', $system->SETTINGS['aboutus'], array($MSG['030'], $MSG['029']));
$CKEditor = new CKEditor();
$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
@@ -35,17 +36,18 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-loadblock($MSG['about_us_content'], $MSG['about_us_content_explain'], $CKEditor->editor('aboutustext', $system->SETTINGS['aboutustext']));
+loadblock($MSG['5078'], $MSG['5080'], $CKEditor->editor('aboutustext', $system->SETTINGS['aboutustext']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0018'],
- 'PAGENAME' => $MSG['about_us_page']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0018'],
+ 'PAGENAME' => $MSG['5074']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/accounts.php b/admin/accounts.php
old mode 100644
new mode 100755
index 44346757c..894bcc381
--- a/admin/accounts.php
+++ b/admin/accounts.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'accounts.php') {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'accounts.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$where_sql = '';
$params = array();
-if ($from_date != 0) {
- $where_sql = 'paid_date > \'' . $dt->convertToDatetime($from_date) . '\'';
- $params[] = array(':from_date', $dt->convertToDatetime($from_date) , 'str');
+if ($from_date != 0)
+{
+ $where_sql = 'paid_date > \'' . FormatTimeStamp($from_date) . '\'';
+ $params[] = array(':from_date', FormatTimeStamp($from_date) , 'str');
}
-if ($to_date != 0) {
- if (!empty($where_sql)) {
- $where_sql .= ' AND ';
- }
- $where_sql .= 'paid_date < \'' . $dt->convertToDatetime($to_date) . '\'';
- $params[] = array(':to_date', $dt->convertToDatetime($to_date) , 'str');
+if ($to_date != 0)
+{
+ if (!empty($where_sql))
+ {
+ $where_sql .= ' AND ';
+ }
+ $where_sql .= 'paid_date < \'' . FormatTimeStamp($to_date) . '\'';
+ $params[] = array(':to_date', FormatTimeStamp($to_date) , 'str');
}
-if ($list_type == 'm' || $list_type == 'w' || $list_type == 'd') {
- $OFFSET = 0;
- $PAGE = 1;
- $PAGES = 1;
- $show_pagnation = false;
- if ($list_type == 'm') {
- $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
+if ($list_type == 'm' || $list_type == 'w' || $list_type == 'd')
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+ $PAGES = 1;
+ $show_pagnation = false;
+ if ($list_type == 'm')
+ {
+ $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . "
GROUP BY month, year ORDER BY year, month";
- } elseif ($list_type == 'w') {
- $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
+ }
+ elseif ($list_type == 'w')
+ {
+ $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . "
GROUP BY week, year ORDER BY year, week";
- } else {
- $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
+ }
+ else
+ {
+ $query = "SELECT *, SUM(amount) As total FROM " . $DBPrefix . "accounts
" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . "
GROUP BY day, year ORDER BY year, day";
- }
- $db->query($query, $params);
+ }
+ $db->query($query, $params);
- while ($row = $db->fetch()) {
- if ($list_type == 'm') {
- $date = $MSG['MON_00' . $row['month'] . 'E'] . ', ' . $row['year'];
- } elseif ($list_type == 'w') {
- $date = $MSG['week'] . ' ' . $row['week'] . ', ' . $row['year'];
- } else {
- $date = $dt->formatDate($row['paid_date']);
- }
- $template->assign_block_vars('accounts', array(
- 'DATE' => $date,
- 'AMOUNT' => $system->print_money($row['amount']),
- 'TOTAL' => ((!empty($row['total'])) ? $row['total'] : '')
- ));
- }
-} else {
- $_SESSION['RETURN_LIST'] = 'accounts.php';
- $_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
- $show_pagnation = true;
+ $bg = '';
+ while ($row = $db->fetch())
+ {
+ if ($list_type == 'm')
+ {
+ $date = $MSG['MON_00' . $row['month'] . 'E'] . ', ' . $row['year'];
+ }
+ elseif ($list_type == 'w')
+ {
+ $date = $MSG['828'] . ' ' . $row['week'] . ', ' . $row['year'];
+ }
+ else
+ {
+ $date = FormatDate($row['paid_date']);
+ }
+ $template->assign_block_vars('accounts', array(
+ 'DATE' => $date,
+ 'AMOUNT' => $system->print_money($row['amount']),
+ 'BG' => $bg,
+ 'TOTAL' => ((!empty($row['total'])) ? $row['total'] : '')
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ }
+}
+else
+{
+ $_SESSION['RETURN_LIST'] = 'accounts.php';
+ $_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
+ $show_pagnation = true;
- $query = "SELECT COUNT(id) As accounts FROM " . $DBPrefix . "accounts" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '');
- $db->direct_query($query);
- $num_accounts = $db->numrows();
- $PAGES = ($num_accounts == 0) ? 1 : ceil($num_accounts / $system->SETTINGS['perpage']);
- $query = "SELECT * FROM " . $DBPrefix . "accounts
+ $query = "SELECT COUNT(id) As accounts FROM " . $DBPrefix . "accounts" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '');
+ $db->direct_query($query);
+ $num_accounts = $db->numrows();
+ $PAGES = ($num_accounts == 0) ? 1 : ceil($num_accounts / $system->SETTINGS['perpage']);
+ $query = "SELECT * FROM " . $DBPrefix . "accounts
" . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . " ORDER BY paid_date LIMIT " . $OFFSET . ", " . $system->SETTINGS['perpage'];
- $db->direct_query($query);
+ $db->direct_query($query);
- while ($row = $db->fetch()) {
- $template->assign_block_vars('accounts', array(
- 'ID' => $row['id'],
- 'NICK' => $row['nick'],
- 'RNAME' => $row['name'],
- 'DATE' => $dt->formatDate($row['paid_date'], 'd F Y - H:i'),
- 'AMOUNT' => $system->print_money($row['amount']),
- 'TEXT' => $row['text']
- ));
- }
+ $bg = '';
+ while ($row = $db->fetch())
+ {
+ $template->assign_block_vars('accounts', array(
+ 'ID' => $row['id'],
+ 'NICK' => $row['nick'],
+ 'RNAME' => $row['name'],
+ 'DATE' => ArrangeDateNoCorrection($row['paid_date']),
+ 'AMOUNT' => $system->print_money($row['amount']),
+ 'TEXT' => $row['text'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ }
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'TYPE' => $list_type,
- 'FROM_DATE' => ($from_date == 0) ? '' : $from_date,
- 'TO_DATE' => ($to_date == 0) ? '' : $to_date,
- 'PAGNATION' => $show_pagnation,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'TYPE' => $list_type,
+ 'FROM_DATE' => ($from_date == 0) ? '' : $from_date,
+ 'TO_DATE' => ($to_date == 0) ? '' : $to_date,
+ 'PAGNATION' => $show_pagnation,
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'accounts.tpl'
- ));
+ 'body' => 'accounts.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/activatenewsletter.php b/admin/activatenewsletter.php
old mode 100644
new mode 100755
index f39b0fb5c..4b100f93b
--- a/admin/activatenewsletter.php
+++ b/admin/activatenewsletter.php
@@ -1,6 +1,6 @@
writesetting('newsletter', $_POST['newsletter'], 'int');
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['newsletter_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("newsletter", intval($_POST['newsletter']),"int");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0049']));
}
-loadblock($MSG['activate_newsletter'], $MSG['activate_newsletter_explain'], 'batch', 'newsletter', $system->SETTINGS['newsletter'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['603'], $MSG['604'], 'batch', 'newsletter', $system->SETTINGS['newsletter'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0010'],
- 'PAGENAME' => $MSG['25_0079']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0010'],
+ 'PAGENAME' => $MSG['25_0079']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/admin/addnew.php b/admin/addnew.php
old mode 100644
new mode 100755
index cc0033dc7..c598c6090
--- a/admin/addnew.php
+++ b/admin/addnew.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- } else {
- $query = "INSERT INTO " . $DBPrefix . "news (title, content, suspended)
- VALUES (:title, :content, :suspended)";
- $params = array();
- $params[] = array(':title', $system->cleanvars($_POST['title'][$system->SETTINGS['defaultlanguage']]), 'str');
- $params[] = array(':content', $system->cleanvars($_POST['content'][$system->SETTINGS['defaultlanguage']], true), 'str');
- $params[] = array(':suspended', $_POST['suspended'], 'int');
- $db->query($query, $params);
- $news_id = $db->lastInsertId();
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Data check
+ if (!isset($_POST['title']) || !isset($_POST['content']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
+ else
+ {
+ // clean up everything
+ foreach ($_POST['title'] as $k => $v)
+ {
+ $_POST['title'][$k] = $system->cleanvars($v);
+ $_POST['content'][$k] = $system->cleanvars($_POST['content'][$k], true);
+ }
- // Insert into translation table
- foreach ($LANGUAGES as $k => $v) {
- $query = "INSERT INTO " . $DBPrefix . "news_translated VALUES (:news_id, :lang, :title, :content)";
- $params = array();
- $params[] = array(':title', $system->cleanvars($_POST['title'][$k]), 'str');
- $params[] = array(':content', $system->cleanvars($_POST['content'][$k], true), 'str');
- $params[] = array(':lang', $k, 'str');
- $params[] = array(':news_id', $news_id, 'int');
- $db->query($query, $params);
- }
- header('location: news.php');
- exit;
- }
+ $query = "INSERT INTO " . $DBPrefix . "news VALUES (NULL, :title, :content, :time, :suspended)";
+ $params = array();
+ $params[] = array(':title', $system->cleanvars($_POST['title'][$system->SETTINGS['defaultlanguage']]), 'str');
+ $params[] = array(':content', $system->cleanvars($_POST['content'][$system->SETTINGS['defaultlanguage']], true), 'str');
+ $params[] = array(':time', time(), 'int');
+ $params[] = array(':suspended', $_POST['suspended'], 'int');
+ $db->query($query, $params);
+ $news_id = $db->lastInsertId();
+
+ // Insert into translation table
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "news_translated VALUES (:news_id, :lang, :title, :content)";
+ $params = array();
+ $params[] = array(':title', $system->cleanvars($_POST['title'][$k]), 'str');
+ $params[] = array(':content', $system->cleanvars($_POST['content'][$k], true), 'str');
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':news_id', $news_id, 'int');
+ $db->query($query, $params);
+ }
+ header('location: news.php');
+ exit;
+ }
}
$CKEditor = new CKEditor();
@@ -54,26 +66,28 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-foreach ($LANGUAGES as $k => $language) {
- $template->assign_block_vars('lang', array(
- 'LANG' => $language,
- 'TITLE' => (isset($_POST['title'][$k])) ? $_POST['title'][$k] : '',
- 'CONTENT' => $CKEditor->editor('content[' . $k . ']', (isset($_POST['content'][$k]) ? $_POST['content'][$k] : ''))
- ));
+foreach ($LANGUAGES as $k => $language)
+{
+ $template->assign_block_vars('lang', array(
+ 'LANG' => $language,
+ 'TITLE' => (isset($_POST['title'][$k])) ? $_POST['title'][$k] : '',
+ 'CONTENT' => $CKEditor->editor('content[' . $k . ']', (isset($_POST['content'][$k]) ? $_POST['content'][$k] : ''))
+ ));
}
$template->assign_vars(array(
- 'TITLE' => $MSG['518'],
- 'BUTTON' => $MSG['518'],
- 'ID' => '', // inserting new user so needs to be blank
+ 'TITLE' => $MSG['518'],
+ 'BUTTON' => $MSG['518'],
+ 'ID' => '', // inserting new user so needs to be blank
- 'B_ACTIVE' => ((isset($_POST['suspended']) && $_POST['suspended'] == 0) || !isset($_POST['suspended'])),
- 'B_INACTIVE' => (isset($_POST['suspended']) && $_POST['suspended'] == 1)
- ));
+ 'B_ACTIVE' => ((isset($_POST['suspended']) && $_POST['suspended'] == 0) || !isset($_POST['suspended'])),
+ 'B_INACTIVE' => (isset($_POST['suspended']) && $_POST['suspended'] == 1)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'addnew.tpl'
- ));
+ 'body' => 'addnew.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/adminusers.php b/admin/adminusers.php
old mode 100644
new mode 100755
index 8674293b3..07f314011
--- a/admin/adminusers.php
+++ b/admin/adminusers.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['1100']));
- } else {
- $query = "DELETE FROM " . $DBPrefix . "adminusers WHERE id IN (:delete)";
- $params = array();
- $params[] = array(':delete', implode(',', $_POST['delete']), 'str');
- $db->query($query, $params);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1101']));
- }
+if (isset($_POST['delete']) && is_array($_POST['delete']))
+{
+ if (in_array($_SESSION['WEBID_ADMIN_IN'], $_POST['delete']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['1100']));
+ }
+ else
+ {
+ $query = "DELETE FROM " . $DBPrefix . "adminusers WHERE id IN (:delete)";
+ $params = array();
+ $params[] = array(':delete', implode(',', $_POST['delete']), 'str');
+ $db->query($query, $params);
+ }
}
$STATUS = array(
- 0 => '' . $MSG['567'] . ' ',
- 1 => '' . $MSG['566'] . ' '
+ 0 => '' . $MSG['567'] . ' ',
+ 1 => '' . $MSG['566'] . ' '
);
$query = "SELECT * FROM " . $DBPrefix . "adminusers ORDER BY username";
$db->direct_query($query);
-while ($User = $db->fetch()) {
- $created = $dt->printDateTz($User['created']);
- if ($User['lastlogin'] == $User['created']) {
- $lastlogin = $MSG['570'];
- } else {
- $lastlogin = $dt->printDateTz($User['lastlogin']);
- }
- $template->assign_block_vars('users', array(
- 'ID' => $User['id'],
- 'USERNAME' => $User['username'],
- 'STATUS' => $STATUS[$User['status']],
- 'CREATED' => $created,
- 'LASTLOGIN' => $lastlogin
- ));
+$bg = '';
+while ($User = $db->fetch())
+{
+ $created = substr($User['created'], 4, 2) . '/' . substr($User['created'], 6, 2) . '/' . substr($User['created'], 0, 4);
+ if ($User['lastlogin'] == 0)
+ {
+ $lastlogin = $MSG['570'];
+ }
+ else
+ {
+ $lastlogin = date('d/m/Y H:i:s', $User['lastlogin'] + $system->tdiff);
+ }
+ $template->assign_block_vars('users', array(
+ 'ID' => $User['id'],
+ 'USERNAME' => $User['username'],
+ 'STATUS' => $STATUS[$User['status']],
+ 'CREATED' => $created,
+ 'LASTLOGIN' => $lastlogin,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminusers.tpl'
- ));
+ 'body' => 'adminusers.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/analytics.php b/admin/analytics.php
old mode 100644
new mode 100755
index 426d9e165..bcefaceac
--- a/admin/analytics.php
+++ b/admin/analytics.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['google_analytics_updated']));
}
-loadblock($MSG['analytics_tracking_code'], $MSG['analytics_tracking_code_hint'], 'textarea', 'trackingcode', $system->SETTINGS['googleanalytics']);
+loadblock($MSG['google_analytics_tracking_code'], $MSG['google_analytics_tracking_code_hint'], 'textarea', 'trackingcode', $system->SETTINGS['googleanalytics']);
$template->assign_vars(array(
'SITEURL' => $system->SETTINGS['siteurl'],
'TYPENAME' => $MSG['25_0023'],
- 'PAGENAME' => $MSG['analytics'],
+ 'PAGENAME' => $MSG['google_analytics'],
));
include 'header.php';
@@ -40,3 +40,4 @@
));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/auctions.php b/admin/auctions.php
old mode 100644
new mode 100755
index a948902a5..861cadec3
--- a/admin/auctions.php
+++ b/admin/auctions.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_numeric_values']));
- } elseif ($_POST['maxpicturesize'] == 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_max_pic_size_zero']));
- } elseif (!empty($_POST['maxpicturesize']) && !intval($_POST['maxpicturesize'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_max_pic_size_numeric']));
- } elseif (!empty($_POST['maxpictures']) && !intval($_POST['maxpictures'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_max_num_pics_numeric']));
- } else {
- $system->writesetting("proxy_bidding", ynbool($_POST['proxy_bidding']), 'str');
- $system->writesetting("edit_starttime", $_POST['edit_starttime'], 'int');
- $system->writesetting("edit_endtime", $_POST['edit_endtime'], 'int');
- $system->writesetting("cust_increment", $_POST['cust_increment'], 'int');
- $system->writesetting("hours_countdown", $_POST['hours_countdown'], 'int');
- $system->writesetting("ao_hpf_enabled", ynbool($_POST['ao_hpf_enabled']), 'str');
- $system->writesetting("ao_hi_enabled", ynbool($_POST['ao_hi_enabled']), 'str');
- $system->writesetting("ao_bi_enabled", ynbool($_POST['ao_bi_enabled']), 'str');
- $system->writesetting("subtitle", ynbool($_POST['subtitle']), 'str');
- $system->writesetting("extra_cat", ynbool($_POST['extra_cat']), 'str');
- $system->writesetting("autorelist", ynbool($_POST['autorelist']), 'str');
- $system->writesetting("autorelist_max", $_POST['autorelist_max'], 'int');
- $system->writesetting("ae_status", ynbool($_POST['status']), 'str');
- $system->writesetting("ae_timebefore", $_POST['timebefore'], 'int');
- $system->writesetting("ae_extend", $_POST['extend'], 'int');
- $system->writesetting("picturesgallery", $_POST['picturesgallery'], 'int');
- $system->writesetting("maxpictures", $_POST['maxpictures'], 'int');
- $system->writesetting("maxuploadsize", ($_POST['maxpicturesize'] * 1024), 'int');
- $system->writesetting("thumb_show", $_POST['thumb_show'], 'int');
- $system->writesetting("gallery_max_width_height", $_POST['gallery_max_width_height'], 'int');
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if ($_POST['status'] == 'enabled' && (!is_numeric($_POST['timebefore']) || !is_numeric($_POST['extend'])))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['2_0038']));
+ }
+ elseif ($_POST['maxpicturesize'] == 0)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_707));
+ }
+ elseif (!empty($_POST['maxpicturesize']) && !intval($_POST['maxpicturesize']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_708));
+ }
+ elseif (!empty($_POST['maxpictures']) && !intval($_POST['maxpictures']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_706));
+ }
+ else
+ {
+ $system->writesetting("proxy_bidding",ynbool($_POST['proxy_bidding']), 'str');
+ $system->writesetting("edit_starttime", $_POST['edit_starttime'], 'int');
+ $system->writesetting("edit_endtime", $_POST['edit_endtime'], 'int');
+ $system->writesetting("cust_increment", $_POST['cust_increment'], 'int');
+ $system->writesetting("hours_countdown", $_POST['hours_countdown'], 'int');
+ $system->writesetting("ao_hpf_enabled", ynbool($_POST['ao_hpf_enabled']), 'str');
+ $system->writesetting("ao_hi_enabled", ynbool($_POST['ao_hi_enabled']), 'str');
+ $system->writesetting("ao_bi_enabled", ynbool($_POST['ao_bi_enabled']), 'str');
+ $system->writesetting("subtitle", ynbool($_POST['subtitle']), 'str');
+ $system->writesetting("extra_cat", ynbool($_POST['extra_cat']), 'str');
+ $system->writesetting("autorelist", ynbool($_POST['autorelist']), 'str');
+ $system->writesetting("autorelist_max", $_POST['autorelist_max'], 'int');
+ $system->writesetting("ae_status", ynbool($_POST['status']), 'str');
+ $system->writesetting("ae_timebefore", $_POST['timebefore'], 'int');
+ $system->writesetting("ae_extend", $_POST['extend'], 'int');
+ $system->writesetting("picturesgallery", $_POST['picturesgallery'], 'int');
+ $system->writesetting("maxpictures", $_POST['maxpictures'], 'int');
+ $system->writesetting("maxuploadsize", ($_POST['maxpicturesize'] * 1024), 'int');
+ $system->writesetting("thumb_show", $_POST['thumb_show'], 'int');
+ $system->writesetting("gallery_max_width_height", $_POST['gallery_max_width_height'], 'int');
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['auction_settings_updated']));
- }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5088']));
+ }
}
-loadblock($MSG['enable_proxy_bidding'], $MSG['enable_proxy_bidding_explain'], 'yesno', 'proxy_bidding', $system->SETTINGS['proxy_bidding'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_custom_start_date'], $MSG['enable_custom_start_date_explain'], 'batch', 'edit_starttime', $system->SETTINGS['edit_starttime'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_custom_end_date'], $MSG['enable_custom_end_date_explain'], 'batch', 'edit_endtime', $system->SETTINGS['edit_endtime'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_custom_increments'], $MSG['enable_custom_increments_explain'], 'batch', 'cust_increment', $system->SETTINGS['cust_increment'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['hours_until_countdown'], $MSG['hours_until_countdown_explain'], 'days', 'hours_countdown', $system->SETTINGS['hours_countdown'], array($MSG['25_0037']));
+loadblock($MSG['427'], $MSG['428'], 'yesno', 'proxy_bidding', $system->SETTINGS['proxy_bidding'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['5090'], $MSG['5089'], 'batch', 'edit_starttime', $system->SETTINGS['edit_starttime'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['allow_custom_end_date'], $MSG['allow_custom_end_date_explain'], 'batch', 'edit_endtime', $system->SETTINGS['edit_endtime'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['068'], $MSG['070'], 'batch', 'cust_increment', $system->SETTINGS['cust_increment'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['5091'], $MSG['5095'], 'days', 'hours_countdown', $system->SETTINGS['hours_countdown'], array($MSG['25_0037']));
-loadblock($MSG['additional_auction_options'], '', '', '', '', array(), true);
-loadblock($MSG['enable_featured_items'], $MSG['enable_featured_items_explain'], 'yesno', 'ao_hpf_enabled', $system->SETTINGS['ao_hpf_enabled'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_hightlighted_items'], $MSG['enable_hightlighted_items_explain'], 'yesno', 'ao_hi_enabled', $system->SETTINGS['ao_hi_enabled'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_bold_items'], $MSG['enable_bold_items_explain'], 'yesno', 'ao_bi_enabled', $system->SETTINGS['ao_bi_enabled'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_subtitles'], $MSG['enable_subtitles_explain'], 'yesno', 'subtitle', $system->SETTINGS['subtitle'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_second_cat'], $MSG['enable_second_cat_explain'], 'yesno', 'extra_cat', $system->SETTINGS['extra_cat'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_auto_relist'], $MSG['enable_auto_relist_explain'], 'yesno', 'autorelist', $system->SETTINGS['autorelist'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['max_relists'], $MSG['max_relists_explain'], 'days', 'autorelist_max', $system->SETTINGS['autorelist_max']);
+loadblock($MSG['897'], '', '', '', '', array(), true);
+loadblock($MSG['142'], $MSG['157'], 'yesno', 'ao_hpf_enabled', $system->SETTINGS['ao_hpf_enabled'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['162'], $MSG['164'], 'yesno', 'ao_hi_enabled', $system->SETTINGS['ao_hi_enabled'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['174'], $MSG['194'], 'yesno', 'ao_bi_enabled', $system->SETTINGS['ao_bi_enabled'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['797'], $MSG['798'], 'yesno', 'subtitle', $system->SETTINGS['subtitle'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['799'], $MSG['800'], 'yesno', 'extra_cat', $system->SETTINGS['extra_cat'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['849'], $MSG['850'], 'yesno', 'autorelist', $system->SETTINGS['autorelist'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['851'], $MSG['852'], 'days', 'autorelist_max', $system->SETTINGS['autorelist_max']);
// auction extension options
-loadblock($MSG['auction_extension_settings'], '', '', '', '', array(), true); // :O
-loadblock($MSG['enable_auto_extension'], $MSG['enable_auto_extension_explain'], 'yesno', 'status', $system->SETTINGS['ae_status'], array($MSG['yes'], $MSG['no']));
-$string = sprintf($MSG['auto_extend_auction_by'], ' ', ' ');
+loadblock($MSG['2_0032'], '', '', '', '', array(), true); // :O
+loadblock($MSG['2_0034'], $MSG['2_0039'], 'yesno', 'status', $system->SETTINGS['ae_status'], array($MSG['030'], $MSG['029']));
+$string = $MSG['2_0035'] . ' ' . $MSG['2_0036'] . ' ' . $MSG['2_0037'];
loadblock('', $string, '');
// picture gallery options
loadblock($MSG['663'], '', '', '', '', array(), true);
-loadblock($MSG['enable_picture_gallery'], $MSG['enable_picture_gallery_explain'], 'batch', 'picturesgallery', $system->SETTINGS['picturesgallery'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['gallery_images_allowance'], '', 'days', 'maxpictures', $system->SETTINGS['maxpictures']);
-loadblock($MSG['gallery_image_max_kb'], $MSG['gallery_image_max_kb_explain'], 'decimals', 'maxpicturesize', ($system->SETTINGS['maxuploadsize'] / 1024), array($MSG['672']));
-loadblock($MSG['thumbnail_size'], $MSG['thumbnail_size_explain'], 'decimals', 'thumb_show', $system->SETTINGS['thumb_show'], array($MSG['pixels']));
-loadblock($MSG['gallery_image_max_size'], $MSG['gallery_image_max_size_explain'], 'decimals', 'gallery_max_width_height', $system->SETTINGS['gallery_max_width_height'], array($MSG['pixels']));
+loadblock($MSG['665'], $MSG['664'], 'batch', 'picturesgallery', $system->SETTINGS['picturesgallery'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['666'], '', 'days', 'maxpictures', $system->SETTINGS['maxpictures']);
+loadblock($MSG['671'], $MSG['25_0187'], 'decimals', 'maxpicturesize', ($system->SETTINGS['maxuploadsize'] / 1024), array($MSG['672']));
+loadblock($MSG['25_0107'], $MSG['896'], 'decimals', 'thumb_show', $system->SETTINGS['thumb_show'], array($MSG['2__0045']));
+loadblock($MSG['gallery_image_max_size'], $MSG['gallery_image_max_size_explain'], 'decimals', 'gallery_max_width_height', $system->SETTINGS['gallery_max_width_height'], array($MSG['2__0045']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['auction_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['5087']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/banips.php b/admin/banips.php
old mode 100644
new mode 100755
index c741222df..8cd4ccafc
--- a/admin/banips.php
+++ b/admin/banips.php
@@ -1,6 +1,6 @@
cleanvars($_POST['ip']), 'str');
- $db->query($query, $params);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['ip_banned']));
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_cannot_ban_self']));
- }
- }
- if (isset($_POST['delete']) && is_array($_POST['delete'])) {
- foreach ($_POST['delete'] as $k => $v) {
- $query = "DELETE FROM " . $DBPrefix . "usersips WHERE id = :ip_id";
- $params = array();
- $params[] = array(':ip_id', $v, 'int');
- $db->query($query, $params);
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => sprintf($MSG['ip_bans_removed'], count($_POST['delete']))));
- }
- if (isset($_POST['accept']) && is_array($_POST['accept'])) {
- foreach ($_POST['accept'] as $k => $v) {
- $query = "UPDATE " . $DBPrefix . "usersips SET action = 'accept' WHERE id = :ip_id";
- $params = array();
- $params[] = array(':ip_id', $v, 'int');
- $db->query($query, $params);
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => sprintf($MSG['ip_bans_removed'], count($_POST['accept']))));
- }
- if (isset($_POST['deny']) && is_array($_POST['deny'])) {
- foreach ($_POST['deny'] as $k => $v) {
- if ($_POST['ip'] != $admin_ip) {
- $query = "UPDATE " . $DBPrefix . "usersips SET action = 'deny' WHERE id = :ip_id";
- $params = array();
- $params[] = array(':ip_id', $v, 'int');
- $db->query($query, $params);
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_cannot_ban_self']));
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => sprintf($MSG['ip_bans_added'], count($_POST['deny']))));
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (isset($_POST['ip']) && !empty($_POST['ip']))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "usersips VALUES
+ (NULL, 'NOUSER', :user_ip, 'next', 'deny')";
+ $params = array();
+ $params[] = array(':user_ip', $system->cleanvars($_POST['ip']), 'str');
+ $db->query($query, $params);
+ }
+ if (isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ foreach ($_POST['delete'] as $k => $v)
+ {
+ $query = "DELETE FROM " . $DBPrefix . "usersips WHERE id = :ip_id";
+ $params = array();
+ $params[] = array(':ip_id', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
+ if (isset($_POST['accept']) && is_array($_POST['accept']))
+ {
+ foreach ($_POST['accept'] as $k => $v)
+ {
+ $query = "UPDATE " . $DBPrefix . "usersips SET action = 'accept' WHERE id = :ip_id";
+ $params = array();
+ $params[] = array(':ip_id', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
+ if (isset($_POST['deny']) && is_array($_POST['deny']))
+ {
+ foreach ($_POST['deny'] as $k => $v)
+ {
+ $query = "UPDATE " . $DBPrefix . "usersips SET action = 'deny' WHERE id = :ip_id";
+ $params = array();
+ $params[] = array(':ip_id', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
}
$query = "SELECT * FROM " . $DBPrefix . "usersips WHERE user = 'NOUSER'";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('ips', array(
- 'ID' => $row['id'],
- 'IP' => $row['ip'],
- 'ACTION' => $row['action']
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('ips', array(
+ 'ID' => $row['id'],
+ 'IP' => $row['ip'],
+ 'ACTION' => $row['action'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'banips.tpl'
- ));
+ 'body' => 'banips.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/banners.php b/admin/banners.php
old mode 100644
new mode 100755
index 864ca61c2..4d67051fb
--- a/admin/banners.php
+++ b/admin/banners.php
@@ -1,6 +1,6 @@
writesetting("banners", $_POST['banners'], "int");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("banners", intval($_POST['banners']), "int");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['banner_settings_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['600']));
}
-loadblock($MSG['activate_banner_support'], $MSG['activate_banner_support_explain'], 'batch', 'banners', $system->SETTINGS['banners'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['597'], $MSG['_0014'], 'batch', 'banners', $system->SETTINGS['banners'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'TYPENAME' => $MSG['25_0011'],
- 'PAGENAME' => $MSG['banner_admin'] . ' : ' . $MSG['5205']
- ));
+ 'TYPENAME' => $MSG['25_0011'],
+ 'PAGENAME' => $MSG['_0008'] . ' : ' . $MSG['5205']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/admin/boards.php b/admin/boards.php
old mode 100644
new mode 100755
index 5ae1f2976..14050b823
--- a/admin/boards.php
+++ b/admin/boards.php
@@ -1,6 +1,6 @@
$v) {
- $query = "DELETE FROM " . $DBPrefix . "community WHERE id = :id";
- $params = array(array(':id', $v, 'int'));
- $db->query($query, $params);
- $query = "DELETE FROM " . $DBPrefix . "comm_messages WHERE boardid = :id";
- $params = array(array(':id', $v, 'int'));
- $db->query($query, $params);
- }
+if (isset($_POST['delete']) && is_array($_POST['delete']))
+{
+ foreach ($_POST['delete'] as $k => $v)
+ {
+ $query = "DELETE FROM " . $DBPrefix . "community WHERE id = :id";
+ $params = array(array(':id', $v, 'int'));
+ $db->query($query, $params);
+ $query = "DELETE FROM " . $DBPrefix . "comm_messages WHERE boardid = :id";
+ $params = array(array(':id', $v, 'int'));
+ $db->query($query, $params);
+ }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['boards_removed']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5044']));
}
// get list of boards
$query = "SELECT * FROM " . $DBPrefix . "community ORDER BY name";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('boards', array(
- 'ID' => $row['id'],
- 'NAME' => $row['name'],
- 'ACTIVE' => $row['active'],
- 'MSGTOSHOW' => $row['msgstoshow'],
- 'MSGCOUNT' => $row['messages']
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('boards', array(
+ 'ID' => $row['id'],
+ 'NAME' => $row['name'],
+ 'ACTIVE' => $row['active'],
+ 'MSGTOSHOW' => $row['msgstoshow'],
+ 'MSGCOUNT' => $row['messages']
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'boards.tpl'
- ));
+ 'body' => 'boards.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/boardsettings.php b/admin/boardsettings.php
old mode 100644
new mode 100755
index e5d858df5..c4e4db1d1
--- a/admin/boardsettings.php
+++ b/admin/boardsettings.php
@@ -1,6 +1,6 @@
writesetting("boards", ynbool($_POST['boards']), "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("boards", ynbool($_POST['boards']), "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['msg_board_settings_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5051']));
}
-loadblock($MSG['enable_message_boards'], $MSG['enable_message_boards_explain'], 'yesno', 'boards', $system->SETTINGS['boards'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['5048'], '', 'yesno', 'boards', $system->SETTINGS['boards'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0018'],
- 'PAGENAME' => $MSG['msg_board_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0018'],
+ 'PAGENAME' => $MSG['5047']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
-include 'footer.php';
+include 'footer.php';
\ No newline at end of file
diff --git a/admin/buyerprivacy.php b/admin/buyerprivacy.php
old mode 100644
new mode 100755
index 974f08b56..5fca3c881
--- a/admin/buyerprivacy.php
+++ b/admin/buyerprivacy.php
@@ -1,6 +1,6 @@
writesetting("buyerprivacy", ynbool($_POST['buyerprivacy']), "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Update database
+ $system->writesetting("buyerprivacy", ynbool($_POST['buyerprivacy']), "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['bidder_privacy_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['247']));
}
-loadblock($MSG['enable_bidder_privacy'], $MSG['enable_bidder_privacy_explain'], 'yesno', 'buyerprivacy', $system->SETTINGS['buyerprivacy'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['237'], $MSG['238'], 'yesno', 'buyerprivacy', $system->SETTINGS['buyerprivacy'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['bidder_privacy'],
- 'B_TITLES' => true
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['236'],
+ 'B_TITLES' => true
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/buyitnow.php b/admin/buyitnow.php
old mode 100644
new mode 100755
index 0afbd0fe2..78ad91b4a
--- a/admin/buyitnow.php
+++ b/admin/buyitnow.php
@@ -1,6 +1,6 @@
100) ? 100 : $bn_only_percent;
- $bn_only_percent = ($bn_only_percent < 0) ? 0 : $bn_only_percent;
- // reset the bn_only blockers
- if ($bn_only_percent > $system->SETTINGS['bn_only_percent']) {
- $query = "UPDATE " . $DBPrefix . "users SET bn_only = 1 WHERE bn_only = 0";
- $db->direct_query($query);
- }
-
- $system->writesetting("buy_now", $_POST['buy_now'], "int");
- $system->writesetting("bn_only", $_POST['bn_only'], "str");
- $system->writesetting("bn_only_disable", $_POST['bn_only_disable'], "str");
- $system->writesetting("bn_only_percent", $bn_only_percent, "int");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['buy_it_now_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $bn_only_percent = ($_POST['bn_only_percent'] > 100) ? 100 : ($_POST['bn_only_percent'] < 0) ? 0 : intval($_POST['bn_only_percent']);
+ // reset the bn_only blockers
+ if ($bn_only_percent > $system->SETTINGS['bn_only_percent'])
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET bn_only = 1 WHERE bn_only = 0";
+ $db->direct_query($query);
+ }
+
+ $system->writesetting("buy_now", $_POST['buy_now'], "int");
+ $system->writesetting("bn_only", $_POST['bn_only'], "str");
+ $system->writesetting("bn_only_disable", $_POST['bn_only_disable'], "str");
+ $system->writesetting("bn_only_percent", $bn_only_percent, "int");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0066']));
}
-loadblock($MSG['enable_buy_it_now'], $MSG['enable_buy_it_now_explain'], 'batch', 'buy_now', $system->SETTINGS['buy_now'], array($MSG['no'], $MSG['yes']));
-loadblock($MSG['enable_buy_it_now_only'], $MSG['enable_buy_it_now_only_explain'], 'yesno', 'bn_only', $system->SETTINGS['bn_only'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_bin_only_auto_disable'], $MSG['enable_bin_only_auto_disable_explain'], 'yesno', 'bn_only_disable', $system->SETTINGS['bn_only_disable'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['buy_it_now_only_limit'], '', 'percent', 'bn_only_percent', $system->SETTINGS['bn_only_percent'], array($MSG['357']));
+loadblock($MSG['920'], $MSG['921'], 'batch', 'buy_now', $system->SETTINGS['buy_now'], array($MSG['029'], $MSG['030']));
+loadblock($MSG['30_0064'], $MSG['30_0065'], 'yesno', 'bn_only', $system->SETTINGS['bn_only'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['355'], $MSG['358'], 'yesno', 'bn_only_disable', $system->SETTINGS['bn_only_disable'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['356'], '', 'percent', 'bn_only_percent', $system->SETTINGS['bn_only_percent'], array($MSG['357']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['2__0025']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['2__0025']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/categories.php b/admin/categories.php
old mode 100644
new mode 100755
index 41e2e80e8..610a69b79
--- a/admin/categories.php
+++ b/admin/categories.php
@@ -1,6 +1,6 @@
get_virtual_root();
- $tree = $catscontrol->display_tree($root['left_id'], $root['right_id'], '|___');
- return $tree;
+ global $catscontrol;
+
+ $root = $catscontrol->get_virtual_root();
+ $tree = $catscontrol->display_tree($root['left_id'], $root['right_id'], '|___');
+ return $tree;
}
function rebuild_cat_file()
{
- global $system, $DBPrefix, $db;
- $query = "SELECT cat_id, cat_name, parent_id FROM " . $DBPrefix . "categories ORDER BY cat_name";
- $db->direct_query($query);
- $cats = array();
- while ($catarr = $db->fetch()) {
- $cats[$catarr['cat_id']] = $catarr['cat_name'];
- $allcats[] = $catarr;
- }
-
- $output = "SETTINGS['defaultlanguage'] . '/categories.inc.php', 'w');
- fputs($handle, $output);
+ global $system, $DBPrefix, $db;
+ $query = "SELECT cat_id, cat_name, parent_id FROM " . $DBPrefix . "categories ORDER BY cat_name";
+ $db->direct_query($query);
+ $cats = array();
+ while ($catarr = $db->fetch())
+ {
+ $cats[$catarr['cat_id']] = $catarr['cat_name'];
+ $allcats[] = $catarr;
+ }
+
+ $output = "";
+
+ $handle = fopen (MAIN_PATH . 'language/' . $system->SETTINGS['defaultlanguage'] . '/categories.inc.php', 'w');
+ fputs($handle, $output);
}
-if (isset($_POST['action'])) {
- if ($_POST['action'] == "Process") {
- //update all categories that arnt being deleted
- if (isset($_POST['categories']) && is_array($_POST['categories'])) {
- foreach ($_POST['categories'] as $k => $v) {
- if (!isset($_POST['delete'][$k])) {
- $query = "UPDATE " . $DBPrefix . "categories SET
- cat_name = :name,
- cat_colour = :colour,
- cat_image = :image
- WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':name', $_POST['categories'][$k], 'str');
- $params[] = array(':colour', $_POST['colour'][$k], 'str');
- $params[] = array(':image', $_POST['image'][$k], 'str');
- $params[] = array(':cat_id', $k, 'int');
- $db->query($query, $params);
- }
- }
- }
- //add category if need be
- if (!empty($_POST['new_category']) && isset($_POST['parent'])) {
- $add_data = array(
- 'cat_name' => $_POST['new_category'],
- 'cat_colour' => $_POST['cat_colour'],
- 'cat_image' => $_POST['cat_image']
- );
- $catscontrol->add($_POST['parent'], 0, $add_data);
- }
- if (!empty($_POST['mass_add']) && isset($_POST['parent'])) {
- $add = explode("\n", $_POST['mass_add']);
- if (is_array($add)) {
- foreach ($add as $v) {
- $add_data = array('cat_name' => $v);
- $catscontrol->add($_POST['parent'], 0, $add_data);
- }
- }
- }
- if (isset($_POST['delete']) && is_array($_POST['delete'])) {
- // Get data from the database
- $query = "SELECT COUNT(a.id) as COUNT, c.* FROM " . $DBPrefix . "categories c
- LEFT JOIN " . $DBPrefix . "auctions a ON ( a.category = c.cat_id )
- WHERE c.cat_id IN (" . implode(',', $_POST['delete']) . ")
- GROUP BY c.cat_id ORDER BY cat_name";
- $db->direct_query($query);
-
- while ($row = $db->fetch()) {
- $template->assign_block_vars('categories', array(
- 'ID' => $row['cat_id'],
- 'NAME' => $row['cat_name'],
- 'HAS_CHILDREN' => ($row['COUNT'] > 0 || $row['left_id'] != ($row['right_id'] - 1))
- ));
- }
- // build message
- $template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : ''
- ));
-
- $template->set_filenames(array(
- 'body' => 'categoryconfirm.tpl'
- ));
- $template->display('body');
- include 'footer.php';
- exit;
- }
- rebuild_cat_file();
- include 'util_cc1.php';
- }
-
- if ($_POST['action'] == "Yes") {
- //delete categories that are selected
- if (isset($_POST['delete']) && is_array($_POST['delete'])) {
- foreach ($_POST['delete'] as $k => $v) {
- $k = intval($k);
- if ($v == 'delete') {
- //never delete categories without using this function it will mess up your database big time
- $catscontrol->delete($k);
- } elseif ($v == 'move') {
- if (isset($_POST['moveid'][$k]) && !empty($_POST['moveid'][$k])
- && is_numeric($_POST['moveid'][$k]) && $catscontrol->check_category($_POST['moveid'][$k])) {
- // first move the parent
- $catscontrol->move($k, $_POST['moveid'][$k]);
- // remove the parent and raise the children up a level
- $catscontrol->delete($k, true);
- $query = "UPDATE " . $DBPrefix . "auctions SET category = :cat_new WHERE category = :cat_old";
- $params = array();
- $params[] = array(':cat_new', $_POST['moveid'][$k], 'str');
- $params[] = array(':cat_old', $k, 'int');
- $db->query($query, $params);
- } else {
- $ERR = $MSG['move_category_missing_id'];
- }
- }
- }
- }
- rebuild_cat_file();
- resync_category_counters();
- include 'util_cc1.php';
- }
- if (isset($ERR)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $ERR));
- }
+if (isset($_POST['action']))
+{
+ if ($_POST['action'] == "Process")
+ {
+ //update all categories that arnt being deleted
+ if (isset($_POST['categories']) && is_array($_POST['categories']))
+ {
+ foreach ($_POST['categories'] as $k => $v)
+ {
+ if (!isset($_POST['delete'][$k]))
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET
+ cat_name = :name,
+ cat_colour = :colour,
+ cat_image = :image
+ WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':name', $_POST['categories'][$k], 'str');
+ $params[] = array(':colour', $_POST['colour'][$k], 'str');
+ $params[] = array(':image', $_POST['image'][$k], 'str');
+ $params[] = array(':cat_id', $k, 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+ //add category if need be
+ if (!empty($_POST['new_category']) && isset($_POST['parent']))
+ {
+ $add_data = array(
+ 'cat_name' => $_POST['new_category'],
+ 'cat_colour' => $_POST['cat_colour'],
+ 'cat_image' => $_POST['cat_image']
+ );
+ $catscontrol->add($_POST['parent'], 0, $add_data);
+ }
+ if (!empty($_POST['mass_add']) && isset($_POST['parent']))
+ {
+ $add = explode("\n", $_POST['mass_add']);
+ if (is_array($add))
+ {
+ foreach ($add as $v)
+ {
+ $add_data = array('cat_name' => $v);
+ $catscontrol->add($_POST['parent'], 0, $add_data);
+ }
+ }
+ }
+ if (isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ // Get data from the database
+ $query = "SELECT COUNT(a.id) as COUNT, c.* FROM " . $DBPrefix . "categories c
+ LEFT JOIN " . $DBPrefix . "auctions a ON ( a.category = c.cat_id )
+ WHERE c.cat_id IN (" . implode(',', $_POST['delete']) . ")
+ GROUP BY c.cat_id ORDER BY cat_name";
+ $db->direct_query($query);
+
+ $message = $MSG['843'] . '
';
+ // build message
+ $template->assign_vars(array(
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'ID' => '',
+ 'MESSAGE' => (($counter > 0) ? $message : '') . '' . $MSG['838'] . implode(', ', $names) . '
',
+ 'TYPE' => 1
+ ));
+
+ $template->set_filenames(array(
+ 'body' => 'confirm.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
+ exit;
+ }
+ rebuild_cat_file();
+ include 'util_cc1.php';
+ }
+
+ if ($_POST['action'] == "Yes")
+ {
+ //delete categories that are selected
+ if (isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ foreach ($_POST['delete'] as $k => $v)
+ {
+ $k = intval($k);
+ if ($v == 'delete')
+ {
+ //never delete categories without using this function it will mess up your database big time
+ $catscontrol->delete($k);
+ }
+ elseif ($v == 'move')
+ {
+ if (isset($_POST['moveid'][$k]) && !empty($_POST['moveid'][$k])
+ && is_numeric($_POST['moveid'][$k]) && $catscontrol->check_category($_POST['moveid'][$k]))
+ {
+ // first move the parent
+ $catscontrol->move($k, $_POST['moveid'][$k]);
+ // remove the parent and raise the children up a level
+ $catscontrol->delete($k, true);
+ $query = "UPDATE " . $DBPrefix . "auctions SET category = :cat_new WHERE category = :cat_old";
+ $params = array();
+ $params[] = array(':cat_new', $_POST['moveid'][$k], 'str');
+ $params[] = array(':cat_old', $k, 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $ERR = $MSG['844'];
+ }
+ }
+ }
+ }
+ rebuild_cat_file();
+ resync_category_counters();
+ include 'util_cc1.php';
+ }
+ if (!isset($ERR))
+ {
+ $ERR = $MSG['086'];
+ }
}
-//show the page
-if (!isset($_GET['parent'])) {
- $query = "SELECT left_id, right_id, level, cat_id FROM " . $DBPrefix . "categories WHERE parent_id = -1";
- $params = array();
-} else {
- $parent = intval($_GET['parent']);
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :parent_id";
- $params = array();
- $params[] = array(':parent_id', $parent, 'int');
+//show the page...
+if (!isset($_GET['parent']))
+{
+ $query = "SELECT left_id, right_id, level, cat_id FROM " . $DBPrefix . "categories WHERE parent_id = -1";
+ $params = array();
+}
+else
+{
+ $parent = intval($_GET['parent']);
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :parent_id";
+ $params = array();
+ $params[] = array(':parent_id', $parent, 'int');
}
$db->query($query, $params);
$parent_node = $db->result();
-if (!isset($_GET['parent'])) {
- $parent = $parent_node['cat_id'];
+if (!isset($_GET['parent']))
+{
+ $parent = $parent_node['cat_id'];
}
$crumb_string = '';
-if ($parent != 0) {
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- $template->assign_block_vars('crumbs', array(
- 'CAT_ID' => $crumbs[$i]['cat_id'],
- 'CAT_NAME' => $crumbs[$i]['cat_name']
- ));
- }
+if ($parent != 0)
+{
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($i > 0)
+ {
+ $crumb_string .= ' > ';
+ }
+ $crumb_string .= '' . $crumbs[$i]['cat_name'] . ' ';
+ }
}
$children = $catscontrol->get_children($parent_node['left_id'], $parent_node['right_id'], $parent_node['level']);
-for ($i = 0; $i < count($children); $i++) {
- $child = $children[$i];
- $template->assign_block_vars('cats', array(
- 'CAT_ID' => $child['cat_id'],
- 'CAT_NAME' => htmlspecialchars($child['cat_name']),
- 'CAT_COLOUR' => $child['cat_colour'],
- 'CAT_IMAGE' => $child['cat_image'],
-
- 'B_SUBCATS' => ($child['left_id'] != ($child['right_id'] - 1)),
- 'B_AUCTIONS' => ($child['counter'] > 0)
- ));
+for ($i = 0; $i < count($children); $i++)
+{
+ $child = $children[$i];
+ $template->assign_block_vars('cats', array(
+ 'CAT_ID' => $child['cat_id'],
+ 'CAT_NAME' => htmlspecialchars($child['cat_name']),
+ 'CAT_COLOUR' => $child['cat_colour'],
+ 'CAT_IMAGE' => $child['cat_image'],
+
+ 'B_SUBCATS' => ($child['left_id'] != ($child['right_id'] - 1)),
+ 'B_AUCTIONS' => ($child['counter'] > 0)
+ ));
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'CRUMBS' => $crumb_string,
- 'PARENT' => $parent
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'CRUMBS' => $crumb_string,
+ 'PARENT' => $parent
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'categories.tpl'
- ));
+ 'body' => 'categories.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/categoriestrans.php b/admin/categoriestrans.php
old mode 100644
new mode 100755
index 6e8490fb5..6c35a6834
--- a/admin/categoriestrans.php
+++ b/admin/categoriestrans.php
@@ -1,6 +1,6 @@
SETTINGS['defaultlanguage'];
+$lang = (isset($_GET['lang'])) ? $_GET['lang'] : 'EN';
$catscontrol = new MPTTcategories();
-function search_cats()
+function search_cats($parent_id, $level)
{
- global $catscontrol;
- $catstr = '';
- $root = $catscontrol->get_virtual_root();
- $tree = $catscontrol->display_tree($root['left_id'], $root['right_id'], '|___');
- foreach ($tree as $k => $v) {
- $v = str_replace("'", "\'", $v);
- $catstr .= ",\n" . $k . " => '" . addslashes($v) . "'";
- }
- return $catstr;
+ global $catscontrol;
+ $catstr = '';
+ $root = $catscontrol->get_virtual_root();
+ $tree = $catscontrol->display_tree($root['left_id'], $root['right_id'], '|___');
+ foreach ($tree as $k => $v)
+ {
+ $v = str_replace("'", "\'", $v);
+ $catstr .= ",\n" . $k . " => '" . addslashes($v) . "'";
+ }
+ return $catstr;
}
function rebuild_cat_file($cats)
{
- global $lang;
- $output = " $v) {
- $v = str_replace("'", "\'", $v);
- $output .= "$k => '$v'";
- $i++;
- if ($i < $num_rows) {
- $output .= ",\n";
- } else {
- $output .= "\n";
- }
- }
+ $i = 0;
+ foreach ($cats as $k => $v)
+ {
+ $v = str_replace("'", "\'", $v);
+ $output .= "$k => '$v'";
+ $i++;
+ if ($i < $num_rows)
+ $output .= ",\n";
+ else
+ $output .= "\n";
+ }
- $output .= ");\n\n";
+ $output .= ");\n\n";
- $output .= "$" . "category_plain = array(\n0 => ''";
+ $output .= "$" . "category_plain = array(\n0 => ''";
- $output .= search_cats();
+ $output .= search_cats(0, 0);
- $output .= ");";
+ $output .= ");\n?>";
- $handle = fopen(MAIN_PATH . 'language/' . $lang . '/categories.inc.php', 'w');
- fputs($handle, $output);
- fclose($handle);
+ $handle = fopen (MAIN_PATH . 'language/' . $lang . '/categories.inc.php', 'w');
+ fputs($handle, $output);
+ fclose($handle);
}
-if (isset($_POST['categories'])) {
- rebuild_cat_file($_POST['categories']);
- include 'util_cc1.php';
+if (isset($_POST['categories']))
+{
+ rebuild_cat_file($_POST['categories']);
+ include 'util_cc1.php';
}
include MAIN_PATH . 'language/' . $lang . '/categories.inc.php';
$query = "SELECT cat_id, cat_name FROM " . $DBPrefix . "categories ORDER BY cat_name";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- // set category data
- $template->assign_block_vars('cats', array(
- 'CAT_ID' => $row['cat_id'],
- 'CAT_NAME' => htmlspecialchars($row['cat_name']),
- 'TRAN_CAT' => isset($category_names[$row['cat_id']])? $category_names[$row['cat_id']] : ''
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ // set category data
+ $template->assign_block_vars('cats', array(
+ 'CAT_ID' => $row['cat_id'],
+ 'CAT_NAME' => htmlspecialchars($row['cat_name']),
+ 'TRAN_CAT' => isset($category_names[$row['cat_id']])? $category_names[$row['cat_id']] : '',
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'categoriestrans.tpl'
- ));
+ 'body' => 'categoriestrans.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/catsorting.php b/admin/catsorting.php
old mode 100644
new mode 100755
index 4a7f8830c..7e5f9bddb
--- a/admin/catsorting.php
+++ b/admin/catsorting.php
@@ -1,6 +1,6 @@
writesetting("catsorting", $system->cleanvars($_POST['catsorting']), "str");
- $system->writesetting("catstoshow", $_POST['catstoshow'], "int");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("catsorting", $system->cleanvars($_POST['catsorting']), "str");
+ $system->writesetting("catstoshow", intval($_POST['catstoshow']),"int");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['category_sorting_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['25_0150']));
}
-loadblock('', $MSG['category_sorting_explain'], 'sortstacked', 'catsorting', $system->SETTINGS['catsorting'], array($MSG['category_sorting_alpha'], $MSG['category_sorting_count']));
-loadblock($MSG['categories_to_show'], $MSG['categories_to_show_explain'], 'percent', 'catstoshow', $system->SETTINGS['catstoshow']);
+loadblock('', $MSG['25_0147'], 'sortstacked', 'catsorting', $system->SETTINGS['catsorting'], array($MSG['25_0148'], $MSG['25_0149']));
+loadblock($MSG['30_0030'], $MSG['30_0029'], 'percent', 'catstoshow', $system->SETTINGS['catstoshow']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['category_sorting']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['25_0146']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/checkversion.php b/admin/checkversion.php
old mode 100644
new mode 100755
index 309a6d2ab..950414a84
--- a/admin/checkversion.php
+++ b/admin/checkversion.php
@@ -1,6 +1,6 @@
SETTINGS['version_check']) {
- case 'unstable':
- $url = 'http://raw.githubusercontent.com/renlok/WeBid/dev/install/thisversion.txt';
- break;
- default:
- $url = 'http://raw.githubusercontent.com/renlok/WeBid/master/install/thisversion.txt';
- break;
-}
-if (!($realversion = load_file_from_url($url))) {
- $text = $MSG['error_file_access_disabled'];
- $realversion = $MSG['unknown'];
- $myversion = $system->SETTINGS['version'];
-} else {
- if (version_compare($system->SETTINGS['version'], $realversion, "<")) {
- $myversion = '' . $system->SETTINGS['version'] . ' ';
- $text = $MSG['outdated_version'];
- } else {
- $myversion = '' . $system->SETTINGS['version'] . ' ';
- $text = $MSG['current_version'];
- }
+if (!($realversion = load_file_from_url('http://www.webidsupport.com/version.txt')))
+{
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_25_0002));
+ $realversion = 'Unknown';
}
+if (version_compare($system->SETTINGS['version'], $realversion, "<"))
+{
+ $myversion = '' . $system->SETTINGS['version'] . ' ';
+ $text = $MSG['30_0211'];
+}
+else
+{
+ $myversion = '' . $system->SETTINGS['version'] . ' ';
+ $text = $MSG['30_0212'];
+}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TEXT' => $text,
- 'MYVERSION' => $myversion,
- 'REALVERSION' => $realversion
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TEXT' => $text,
+ 'MYVERSION' => $myversion,
+ 'REALVERSION' => $realversion
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'checkversion.tpl'
- ));
+ 'body' => 'checkversion.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/clear_image_cache.php b/admin/clear_image_cache.php
old mode 100644
new mode 100755
index fd5ac1537..57ceba98b
--- a/admin/clear_image_cache.php
+++ b/admin/clear_image_cache.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['image_cache_cleared']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0033']));
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'clear_image_cache.tpl'
- ));
+ 'body' => 'clear_image_cache.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/clearcache.php b/admin/clearcache.php
old mode 100644
new mode 100755
index ae04a9628..5bffd5cb1
--- a/admin/clearcache.php
+++ b/admin/clearcache.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['cache_cleared']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0033']));
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'clearcache.tpl'
- ));
+ 'body' => 'clearcache.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/contactseller.php b/admin/contactseller.php
old mode 100644
new mode 100755
index 8ba777e9a..dbef7463a
--- a/admin/contactseller.php
+++ b/admin/contactseller.php
@@ -1,6 +1,6 @@
writesetting("contactseller", $system->cleanvars($_POST['contactseller']), "str");
- $system->writesetting("users_email", ynbool($_POST['users_email']), 'str');
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("contactseller", $system->cleanvars($_POST['contactseller']), "str");
+ $system->writesetting("users_email", ynbool($_POST['users_email']), 'str');
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['25_0155']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['25_0155']));
}
-loadblock($MSG['contact_seller'], $MSG['contact_seller_explain'], 'select3contact', 'contactseller', $system->SETTINGS['contactseller'], array($MSG['contact_seller_anyone'], $MSG['contact_seller_users_only'], $MSG['contact_seller_disabled']));
-loadblock($MSG['hide_user_emails'], $MSG['hide_user_emails_explain'], 'yesno', 'users_email', $system->SETTINGS['users_email'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['25_0216'], $MSG['25_0217'], 'select3contact', 'contactseller', $system->SETTINGS['contactseller'], array($MSG['25_0218'], $MSG['25_0219'], $MSG['25_0220']));
+loadblock($MSG['30_0085'], $MSG['30_0084'], 'yesno', 'users_email', $system->SETTINGS['users_email'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['contact_seller']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['25_0216']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/cookiespolicy.php b/admin/cookiespolicy.php
index 8c9f0dfd9..720624a40 100755
--- a/admin/cookiespolicy.php
+++ b/admin/cookiespolicy.php
@@ -1,50 +1,52 @@
-writesetting("cookiespolicy", ynbool($_POST['cookiespolicy']), "str");
- $system->writesetting("cookiespolicytext", $system->cleanvars($_POST['cookiespolicytext'], true), "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['cookie_policy_updated']));
-}
-loadblock($MSG['enable_cookie_policy'], $MSG['enable_cookie_policy_explain'], 'yesno', 'cookiespolicy', $system->SETTINGS['cookiespolicy'], array($MSG['yes'], $MSG['no']));
-
-$CKEditor = new CKEditor();
-$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
-$CKEditor->returnOutput = true;
-$CKEditor->config['width'] = 550;
-$CKEditor->config['height'] = 400;
-
-loadblock($MSG['cookie_policy_content'], $MSG['editor_help'], $CKEditor->editor('cookiespolicytext', $system->SETTINGS['cookiespolicytext']));
-
-$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0018'],
- 'PAGENAME' => $MSG['cookie_policy']
- ));
-
-include 'header.php';
-$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
-$template->display('body');
-include 'footer.php';
+writesetting("cookiespolicy", ynbool($_POST['cookiespolicy']), "str");
+ $system->writesetting("cookiespolicytext", $system->cleanvars($_POST['cookiespolicytext'], true), "str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1115']));
+}
+loadblock($MSG['1111'], $MSG['1112'], 'yesno', 'cookiespolicy', $system->SETTINGS['cookiespolicy'], array($MSG['030'], $MSG['029']));
+
+$CKEditor = new CKEditor();
+$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
+$CKEditor->returnOutput = true;
+$CKEditor->config['width'] = 550;
+$CKEditor->config['height'] = 400;
+
+loadblock($MSG['1113'], $MSG['5080'], $CKEditor->editor('cookiespolicytext', $system->SETTINGS['cookiespolicytext']));
+
+$template->assign_vars(array(
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0018'],
+ 'PAGENAME' => $MSG['1114']
+ ));
+
+include 'header.php';
+$template->set_filenames(array(
+ 'body' => 'adminpages.tpl'
+ ));
+$template->display('body');
+include 'footer.php';
+?>
diff --git a/admin/counters.php b/admin/counters.php
old mode 100644
new mode 100755
index 39ee8bca6..626ec28fa
--- a/admin/counters.php
+++ b/admin/counters.php
@@ -1,6 +1,6 @@
writesetting("counter_auctions", isset($_POST['auctions'])? 'y' : 'n', "str");
- $system->writesetting("counter_users", isset($_POST['users'])? 'y' : 'n', "str");
- $system->writesetting("counter_online", isset($_POST['online'])? 'y' : 'n', "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission
+ $system->writesetting("counter_auctions", isset($_POST['auctions'])? 'y' : 'n',"str");
+ $system->writesetting("counter_users", isset($_POST['users'])? 'y' : 'n',"str");
+ $system->writesetting("counter_online", isset($_POST['online'])? 'y' : 'n',"str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['counter_settings_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['2__0063']));
}
-loadblock($MSG['counters_shown'], $MSG['counters_shown_explain']);
-loadblock($MSG['counters_active'], '', 'checkbox', 'auctions', $system->SETTINGS['counter_auctions']);
-loadblock($MSG['counters_registered'], '', 'checkbox', 'users', $system->SETTINGS['counter_users']);
-loadblock($MSG['counters_online'], '', 'checkbox', 'online', $system->SETTINGS['counter_online']);
+loadblock($MSG['2__0062'], $MSG['2__0058']);
+loadblock($MSG['2__0060'], '', 'checkbox', 'auctions', $system->SETTINGS['counter_auctions']);
+loadblock($MSG['2__0061'], '', 'checkbox', 'users', $system->SETTINGS['counter_users']);
+loadblock($MSG['2__0059'], '', 'checkbox', 'online', $system->SETTINGS['counter_online']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['counter_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['2__0057']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/countries.php b/admin/countries.php
old mode 100644
new mode 100755
index 0d48e26c3..062da7b73
--- a/admin/countries.php
+++ b/admin/countries.php
@@ -1,6 +1,6 @@
0) {
- // we use a single SQL query to quickly do ALL our deletes
- $query = "DELETE FROM " . $DBPrefix . "countries WHERE ";
- $params = array();
+if (isset($_POST['act']))
+{
+ // remove any countries that need to be
+ if (isset($_POST['delete']) && count($_POST['delete']) > 0)
+ {
+ // we use a single SQL query to quickly do ALL our deletes
+ $query = "DELETE FROM " . $DBPrefix . "countries WHERE ";
+ $params = array();
- // if this is the first country being deleted it don't
- // precede it with an " or " in the SQL string
- for ($i = 0; $i < count($_POST['delete']); $i++) {
- if ($i > 0) {
- $query .= " OR ";
- }
- $query .= "country = :country" . $i;
- $params[] = array(':country' . $i, $_POST['delete'][$i], 'str');
- }
- $db->query($query, $params);
- }
+ // if this is the first country being deleted it don't
+ // precede it with an " or " in the SQL string
+ for ($i = 0; $i < count($_POST['delete']); $i++)
+ {
+ if ($i > 0)
+ {
+ $query .= " OR ";
+ }
+ $query .= "country = :country" . $i;
+ $params[] = array(':country' . $i, $_POST['delete'][$i], 'str');
+ }
+ $db->query($query, $params);
+ }
- //update countries with new names
- for ($i = 0; $i < count($_POST['old_countries']); $i++) {
- if ($_POST['old_countries'][$i] != $_POST['new_countries'][$i]) {
- $query = "UPDATE " . $DBPrefix . "countries SET
- country = :country_new
- WHERE country = :country_old";
- $params = array();
- $params[] = array(':country_new', $_POST['new_countries'][$i], 'str');
- $params[] = array(':country_old', $_POST['old_countries'][$i], 'str');
- $db->query($query, $params);
- }
- }
+ //update countries with new names
+ for ($i = 0; $i < count($_POST['old_countries']); $i++)
+ {
+ if ($_POST['old_countries'][$i] != $_POST['new_countries'][$i])
+ {
+ $query = "UPDATE " . $DBPrefix . "countries SET
+ country = :country_new
+ WHERE country = :country_old";
+ $params = array();
+ $params[] = array(':country_new', $_POST['new_countries'][$i], 'str');
+ $params[] = array(':country_old', $_POST['old_countries'][$i], 'str');
+ $db->query($query, $params);
+ }
+ }
- // If a new country was added, insert it into database
- if (!empty($_POST['new_countries'][(count($_POST['new_countries']) - 1)])) {
- $query = "INSERT INTO " . $DBPrefix . "countries (country) VALUES (:country)";
- $params = array();
- $params[] = array(':country', $_POST['new_countries'][(count($_POST['new_countries']) - 1)], 'str');
- $db->query($query, $params);
- }
+ // If a new country was added, insert it into database
+ if (!empty($_POST['new_countries'][(count($_POST['new_countries']) - 1)]))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "countries (country) VALUES (:country)";
+ $params = array();
+ $params[] = array(':country', $_POST['new_countries'][(count($_POST['new_countries']) - 1)], 'str');
+ $db->query($query, $params);
+ }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['countries_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1028']));
}
-$query = "SELECT country_id, c.country, count(u.id) AS user_count
- FROM " . $DBPrefix . "countries c
- LEFT JOIN " . $DBPrefix . "users u ON (c.country = u.country)
- GROUP BY country_id, c.country";
+$query = "SELECT country_id, c.country, count(u.id) AS user_count
+ FROM " . $DBPrefix . "countries c
+ LEFT JOIN " . $DBPrefix . "users u ON (c.country = u.country)
+ GROUP BY country_id, c.country";
$db->direct_query($query);
$countries = $db->fetchall();
-foreach ($countries as $country) {
- $can_delete = true;
- if ($country['user_count'] != 0 || $country['country'] == $system->SETTINGS['defaultcountry']) {
- $can_delete = false;
- }
+foreach($countries as $country)
+{
+ $can_delete = true;
+ if ($country['user_count'] != 0 || $country['country'] == $system->SETTINGS['defaultcountry']) {
+ $can_delete = false;
+ }
- $template->assign_block_vars('countries', array(
- 'COUNTRY' => $country['country'],
- 'B_CAN_DELETE' => $can_delete
- ));
+ $template->assign_block_vars('countries', array(
+ 'COUNTRY' => $country['country'],
+ 'SELECTBOX' => ($can_delete) ? ' ' : ' '
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'countries.tpl'
- ));
+ 'body' => 'countries.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
diff --git a/admin/currency.php b/admin/currency.php
old mode 100644
new mode 100755
index 77e0290d7..6aa3a5b12
--- a/admin/currency.php
+++ b/admin/currency.php
@@ -1,6 +1,6 @@
direct_query($query);
-if ($db->numrows() > 0) {
- while ($row = $db->fetch()) {
- $CURRENCIES[$row['id']] = $row['symbol'] . ' ' . $row['ime'] . ' (' . $row['valuta'] . ')';
- $CURRENCIES_SYMBOLS[$row['id']] = $row['symbol'];
- }
+if ($db->numrows() > 0)
+{
+ while ($row = $db->fetch())
+ {
+ $CURRENCIES[$row['id']] = $row['symbol'] . ' ' . $row['ime'] . ' (' . $row['valuta'] . ')';
+ $CURRENCIES_SYMBOLS[$row['id']] = $row['symbol'];
+ }
}
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- // Data check
- if (empty($_POST['currency'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif (!empty($_POST['moneydecimals']) && !is_numeric($_POST['moneydecimals'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_051));
- } else {
- if (!empty($_POST['country']) && !empty($_POST['currency_type']) && !empty($_POST['currency_abbreviation'])) {
- $query = "INSERT INTO " . $DBPrefix . "rates VALUES (NULL, :country, :currency_type, :currency_abbreviation);";
- $params = array();
- $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
- $params[] = array(':currency_type', $system->cleanvars($_POST['currency_type']), 'str');
- $params[] = array(':currency_abbreviation', $system->cleanvars($_POST['currency_abbreviation']), 'str');
- $db->query($query, $params);
- $new_id = $db->lastInsertId();
- $CURRENCIES[$new_id] = $_POST['currency_abbreviation'] . ' ' . $_POST['country'] . ' (' . $_POST['currency_type'] . ')';
- $system->writesetting("currency", $system->cleanvars($_POST['currency_abbreviation']), 'str');
- } else {
- $system->writesetting("currency", $system->cleanvars($CURRENCIES_SYMBOLS[$_POST['currency']]), 'str');
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Data check
+ if (empty($_POST['currency']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif (!empty($_POST['moneydecimals']) && !is_numeric($_POST['moneydecimals']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_051));
+ }
+ else
+ {
+ if (!empty($_POST['country']) && !empty($_POST['currency_type']) && !empty($_POST['currency_abbreviation']))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "rates VALUES (NULL, :country, :currency_type, :currency_abbreviation);";
+ $params = array();
+ $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
+ $params[] = array(':currency_type', $system->cleanvars($_POST['currency_type']), 'str');
+ $params[] = array(':currency_abbreviation', $system->cleanvars($_POST['currency_abbreviation']), 'str');
+ $db->query($query, $params);
+ $new_id = $db->lastInsertId();
+ $CURRENCIES[$new_id] = $_POST['currency_abbreviation'] . ' ' . $_POST['country'] . ' (' . $_POST['currency_type'] . ')';
+ $system->writesetting("currency", $system->cleanvars($_POST['currency_abbreviation']), 'str');
+ }
+ else
+ {
+ $system->writesetting("currency", $system->cleanvars($CURRENCIES_SYMBOLS[$_POST['currency']]), 'str');
+ }
- // Update database
- $system->writesetting("moneyformat", $_POST['moneyformat'], 'int');
- $system->writesetting("moneydecimals", $_POST['moneydecimals'], 'int');
- $system->writesetting("moneysymbol", $_POST['moneysymbol'], 'int');
+ // Update database
+ $system->writesetting("moneyformat", $_POST['moneyformat'], 'int');
+ $system->writesetting("moneydecimals", $_POST['moneydecimals'], 'int');
+ $system->writesetting("moneysymbol", $_POST['moneysymbol'], 'int');
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['currency_settings_updated']));
- }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['553']));
+ }
}
-foreach ($CURRENCIES_SYMBOLS as $k => $v) {
- if ($v == $system->SETTINGS['currency']) {
- $selectsetting = $k;
- }
+foreach ($CURRENCIES_SYMBOLS as $k => $v)
+{
+ if ($v == $system->SETTINGS['currency'])
+ {
+ $selectsetting = $k;
+ }
}
-loadblock($MSG['default_currency'], $MSG['default_currency_explain'], generateSelect('currency', $CURRENCIES));
-loadblock($MSG['money_format'], '', 'batchstacked', 'moneyformat', $system->SETTINGS['moneyformat'], array($MSG['money_format_us'], $MSG['money_format_euro']));
-loadblock($MSG['money_decimals'], $MSG['money_decimals_explain'], 'decimals', 'moneydecimals', $system->SETTINGS['moneydecimals']);
-loadblock($MSG['money_symbol_position'], '', 'batchstacked', 'moneysymbol', $system->SETTINGS['moneysymbol'], array($MSG['money_symbol_position_before'], $MSG['money_symbol_position_after']));
+loadblock($MSG['5008'], '', generateSelect('currency', $CURRENCIES));
+loadblock('', $MSG['5138']);
+loadblock($MSG['544'], '', 'batchstacked', 'moneyformat', $system->SETTINGS['moneyformat'], array($MSG['545'], $MSG['546']));
+loadblock($MSG['548'], $MSG['547'], 'decimals', 'moneydecimals', $system->SETTINGS['moneydecimals']);
+loadblock($MSG['549'], '', 'batchstacked', 'moneysymbol', $system->SETTINGS['moneysymbol'], array($MSG['550'], $MSG['551']));
loadblock($MSG['new_currency'], '', '', '', '', array(), true);
loadblock($MSG['014'], $MSG['curreny_country_explain'], 'text', 'country', (isset($_POST['country'])) ? $_POST['country'] : '');
loadblock($MSG['currency_name'], $MSG['curreny_name_explain'], 'text', 'currency_type', (isset($_POST['currency_type'])) ? $_POST['currency_type'] : '');
loadblock($MSG['curreny_symbol'], $MSG['curreny_symbol_explain'], 'text', 'currency_abbreviation', (isset($_POST['currency_abbreviation'])) ? $_POST['currency_abbreviation'] : '');
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'OPTIONHTML' => '',
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['currency_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'OPTIONHTML' => $html,
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['5004']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/defaultcountry.php b/admin/defaultcountry.php
old mode 100644
new mode 100755
index 1ceb032f1..f7f22817b
--- a/admin/defaultcountry.php
+++ b/admin/defaultcountry.php
@@ -1,6 +1,6 @@
writesetting("defaultcountry", $_POST['country'], "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("defaultcountry", $_POST['country'], "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['default_country_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5323']));
}
$query = "SELECT country_id, country FROM " . $DBPrefix . "countries";
@@ -30,22 +31,24 @@
$countries = $db->fetchall();
$options = array();
-foreach ($countries as $country) {
- $options[$country['country']] = $country['country'];
+foreach($countries as $country)
+{
+ $options[$country['country']] = $country['country'];
}
$selectsetting = $system->SETTINGS['defaultcountry'];
-loadblock($MSG['default_country'], $MSG['default_country_explain'], generateSelect('country', $options, false));
+loadblock($MSG['5322'], $MSG['5321'], generateSelect('country', $options, false));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['default_country']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['5322']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/deleteauction.php b/admin/deleteauction.php
old mode 100644
new mode 100755
index 1d6736985..de2c4c8af
--- a/admin/deleteauction.php
+++ b/admin/deleteauction.php
@@ -1,6 +1,6 @@
query($query, $params);
- $auc_data = $db->result();
-
- if ($auc_data['suspended'] == 2) {
- $query = "DELETE FROM `" . $DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
- $db->query($query, $params);
- }
-
- // Delete related values
- $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
- $db->query($query, $params);
-
- // delete bids
- $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
- $db->query($query, $params);
-
- // Delete proxybids
- $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
- $db->query($query, $params);
-
- // Delete file in counters
- $query = "DELETE FROM " . $DBPrefix . "auccounter WHERE auction_id = :auc_id";
- $db->query($query, $params);
-
- if ($auc_data['suspended'] == 0 && $auc_data['closed'] == 0) {
- // update main counters
- $query = "UPDATE " . $DBPrefix . "counters SET auctions = (auctions - 1), bids = (bids - :num_bids)";
- $params = array();
- $params[] = array(':num_bids', $auc_data['num_bids'], 'int');
- $db->query($query, $params);
-
- // update recursive categories
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $auc_data['category'], 'int');
- $db->query($query, $params);
-
- $parent_node = $db->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
-
- // Delete auctions images
- if (is_dir(UPLOAD_PATH . $auc_id)) {
- if ($dir = opendir(UPLOAD_PATH . $auc_id)) {
- while ($file = readdir($dir)) {
- if ($file != '.' && $file != '..') {
- @unlink(UPLOAD_PATH . $auc_id . '/' . $file);
- }
- }
- closedir($dir);
- rmdir(UPLOAD_PATH . $auc_id);
- }
- }
-
- $URL = $_SESSION['RETURN_LIST'];
- //unset($_SESSION['RETURN_LIST']);
- header('location: ' . $URL);
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- $URL = $_SESSION['RETURN_LIST'];
- //unset($_SESSION['RETURN_LIST']);
- header('location: ' . $URL);
- exit;
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ $catscontrol = new MPTTcategories();
+ $auc_id = intval($_POST['id']);
+ // uses same parameters in every query
+ $params = array();
+ $params[] = array(':auc_id', $auc_id, 'int');
+
+ // get auction data
+ $query = "SELECT category, num_bids, suspended, closed FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
+ $db->query($query, $params);
+ $auc_data = $db->result();
+
+ if ($auc_data['suspended'] == 2)
+ {
+ $query = "DELETE FROM `" . $DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $auc_id, 'int');
+ $db->query($query, $params);
+ }
+
+ $params = array();
+ $params[] = array(':auc_id', $auc_id, 'int');
+
+ // Delete related values
+ $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
+ $db->query($query, $params);
+
+ // delete bids
+ $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
+ $db->query($query, $params);
+
+ // Delete proxybids
+ $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
+ $db->query($query, $params);
+
+ // Delete file in counters
+ $query = "DELETE FROM " . $DBPrefix . "auccounter WHERE auction_id = :auc_id";
+ $db->query($query, $params);
+
+ if ($auc_data['suspended'] == 0 && $auc_data['closed'] == 0)
+ {
+ // update main counters
+ $query = "UPDATE " . $DBPrefix . "counters SET auctions = (auctions - 1), bids = (bids - :num_bids)";
+ $params = array();
+ $params[] = array(':num_bids', $auc_data['num_bids'], 'int');
+ $db->query($query, $params);
+
+ // update recursive categories
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $auc_data['category'], 'int');
+ $db->query($query, $params);
+
+ $parent_node = $db->result();
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+
+ // Delete auctions images
+ if (is_dir(UPLOAD_PATH . $auc_id))
+ {
+ if ($dir = opendir(UPLOAD_PATH . $auc_id))
+ {
+ while ($file = readdir($dir))
+ {
+ if ($file != '.' && $file != '..')
+ {
+ @unlink(UPLOAD_PATH . $auc_id . '/' . $file);
+ }
+ }
+ closedir($dir);
+ rmdir(UPLOAD_PATH . $auc_id);
+ }
+ }
+
+ $URL = $_SESSION['RETURN_LIST'];
+ //unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ $URL = $_SESSION['RETURN_LIST'];
+ //unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
}
$query = "SELECT title FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
@@ -113,14 +130,15 @@
$title = $db->result('title');
$template->assign_vars(array(
- 'ID' => $_GET['id'],
- 'MESSAGE' => sprintf($MSG['confirm_auction_delete'], $title),
- 'TYPE' => 1
- ));
+ 'ID' => $_GET['id'],
+ 'MESSAGE' => sprintf($MSG['833'], $title),
+ 'TYPE' => 1
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/deletebanner.php b/admin/deletebanner.php
old mode 100644
new mode 100755
index fdc8436a7..2b4b1fcd4
--- a/admin/deletebanner.php
+++ b/admin/deletebanner.php
@@ -1,6 +1,6 @@
query($query, $params);
@@ -43,3 +45,4 @@
// Redirect
header('location: userbanners.php?id=' . $banneruser);
+?>
diff --git a/admin/deletemessage.php b/admin/deletemessage.php
old mode 100644
new mode 100755
index 9fd18d6f1..a189701e8
--- a/admin/deletemessage.php
+++ b/admin/deletemessage.php
@@ -1,6 +1,6 @@
query($query, $params);
- // Update messages counter
- $query = "UPDATE " . $DBPrefix . "community SET messages = messages - 1 WHERE id = :board_id";
- $params = array();
- $params[] = array(':board_id', $board_id, 'int');
- $db->query($query, $params);
- header('location: editmessages.php?id=' . $board_id);
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- header('location: editmessages.php?id=' . $board_id);
- exit;
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ $query = "DELETE FROM " . $DBPrefix . "comm_messages WHERE id = :msg_id";
+ $params = array();
+ $params[] = array(':msg_id', $msg_id, 'int');
+ $db->query($query, $params);
+ // Update messages counter
+ $query = "UPDATE " . $DBPrefix . "community SET messages = messages - 1 WHERE id = :board_id";
+ $params = array();
+ $params[] = array(':board_id', $board_id, 'int');
+ $db->query($query, $params);
+ header('location: editmessages.php?id=' . $board_id);
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ header('location: editmessages.php?id=' . $board_id);
+ exit;
}
$template->assign_vars(array(
- 'ID' => $msg_id,
- 'MESSAGE' => sprintf($MSG['confirm_msg_delete'], $msg_id),
- 'TYPE' => 1
- ));
+ 'ID' => $msg_id,
+ 'MESSAGE' => sprintf($MSG['834'], $msg_id),
+ 'TYPE' => 1
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/deletenews.php b/admin/deletenew.php
old mode 100644
new mode 100755
similarity index 61%
rename from admin/deletenews.php
rename to admin/deletenew.php
index 42daf1d8c..1f60d9e7d
--- a/admin/deletenews.php
+++ b/admin/deletenew.php
@@ -1,6 +1,6 @@
query($query, $params);
+ header('location: news.php');
+ exit;
}
-
-if (isset($_POST['action']) && $_POST['action'] == "Yes") {
- $query = "DELETE FROM " . $DBPrefix . "news WHERE id = :news_id";
- $params = array();
- $params[] = array(':news_id', $_POST['id'], 'int');
- $db->query($query, $params);
- header('location: news.php');
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- header('location: news.php');
- exit;
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ header('location: news.php');
+ exit;
}
$query = "SELECT title FROM " . $DBPrefix . "news WHERE id = :news_id";
@@ -44,15 +40,16 @@
$title = $db->result('title');
$template->assign_vars(array(
- 'ID' => $_GET['id'],
- 'MESSAGE' => sprintf($MSG['confirm_news_delete'], $title),
- 'TYPE' => 1
- ));
+ 'ID' => $_GET['id'],
+ 'MESSAGE' => sprintf($MSG['832'], $title),
+ 'TYPE' => 1
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/deleteuser.php b/admin/deleteuser.php
old mode 100644
new mode 100755
index b3360db33..005f32a99
--- a/admin/deleteuser.php
+++ b/admin/deleteuser.php
@@ -1,6 +1,6 @@
query($query, $params);
- $num_auctions = $db->result('COUNT');
-
- if ($num_auctions > 0) {
- $has_auctions = true;
- }
-
- // Check if the user is BIDDER in some auction
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "bids WHERE bidder = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- $num_bids = $db->result('COUNT');
-
- if ($num_bids > 0) {
- $has_bids = true;
- }
-
- // check if user is suspended or not
- $query = "SELECT suspended FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- $suspended = $db->result('suspended');
-
- // delete user
- $query = "DELETE FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
-
- if ($has_auctions) {
- // update categories table
- $query = "SELECT c.level, c.left_id, c.right_id FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "categories c ON (a.category = c.cat_id)
- WHERE a.user = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- $auction_data = $db->fetchall();
- foreach ($auction_data as $row) {
- $crumbs = $catscontrol->get_bread_crumbs($row['left_id'], $row['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
-
- // delete user's auctions
- $query = "DELETE FROM " . $DBPrefix . "auctions WHERE user = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- }
-
- if ($has_bids) {
- // update auctions table
- $query = "SELECT a.id, a.current_bid, b.bid FROM " . $DBPrefix . "bids b
- LEFT JOIN " . $DBPrefix . "auctions a ON (b.auction = a.id)
- WHERE b.bidder = :user_id ORDER BY b.bid DESC";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- $bid_data = $db->fetchall();
- foreach ($bid_data as $row) {
- $params = array();
- $extra = '';
- // check if user is highest bidder
- if ($row['current_bid'] == $row['bid']) {
- $query = "SELECT id, bid FROM " . $DBPrefix . "bids WHERE auction = :auc_id ORDER BY bid DESC LIMIT 1, 1";
- $params[] = array(':auc_id', $row['id'], 'int');
- $db->query($query, $params);
- $next_bid = $db->result();
- // set new highest bid
- $params = array();
- $extra = ", current_bid = :current_bid, current_bid_id = :current_bid_id";
- $params[] = array(':current_bid', $next_bid['bid'], 'float');
- $params[] = array(':current_bid_id', $next_bid['bid_id'], 'int');
- }
- $query = "UPDATE " . $DBPrefix . "auctions SET num_bids = num_bids - 1" . $extra . " WHERE id = :auc_id";
- $params[] = array(':auc_id', $row['id'], 'int');
- $db->query($query, $params);
- }
-
- // delete bids
- $query = "DELETE FROM " . $DBPrefix . "bids WHERE bidder = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- }
-
- // Update user counters
- if ($suspended == 0) {
- $query = "UPDATE " . $DBPrefix . "counters set users = users - 1, bids = bids - :num_bids, auctions = auctions - :num_auctions";
- } else {
- $query = "UPDATE " . $DBPrefix . "counters set inactiveusers = inactiveusers - 1, bids = bids - :num_bids, auctions = auctions - :num_auctions";
- }
- $params = array();
- $params[] = array(':num_bids', $num_bids, 'int');
- $params[] = array(':num_auctions', $num_auctions, 'int');
- $db->query($query, $params);
-
- header('location: listusers.php');
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- header('location: listusers.php');
- exit;
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ $catscontrol = new MPTTcategories();
+
+ // Check if the users has some auction
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE user = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ $num_auctions = $db->result('COUNT');
+
+ if ($num_auctions > 0)
+ {
+ $has_auctions = true;
+ }
+
+ // Check if the user is BIDDER in some auction
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "bids WHERE bidder = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ $num_bids = $db->result('COUNT');
+
+ if ($num_bids > 0)
+ {
+ $has_bids = true;
+ }
+
+ // check if user is suspended or not
+ $query = "SELECT suspended FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ $suspended = $db->result('suspended');
+
+ // delete user
+ $query = "DELETE FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+
+ if ($has_auctions)
+ {
+ // update categories table
+ $query = "SELECT c.level, c.left_id, c.right_id FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "categories c ON (a.category = c.cat_id)
+ WHERE a.user = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ $auction_data = $db->fetchall();
+ foreach ($auction_data as $row)
+ {
+ $crumbs = $catscontrol->get_bread_crumbs($row['left_id'], $row['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+
+ // delete user's auctions
+ $query = "DELETE FROM " . $DBPrefix . "auctions WHERE user = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ }
+
+ if ($has_bids)
+ {
+ // update auctions table
+ $query = "SELECT a.id, a.current_bid, b.bid FROM " . $DBPrefix . "bids b
+ LEFT JOIN " . $DBPrefix . "auctions a ON (b.auction = a.id)
+ WHERE b.bidder = :user_id ORDER BY b.bid DESC";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ $bid_data = $db->fetchall();
+ foreach ($bid_data as $row)
+ {
+ $params = array();
+ // check if user is highest bidder
+ if ($row['current_bid'] == $row['bid'])
+ {
+ $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :auc_id ORDER BY bid DESC LIMIT 1, 1";
+ $params[] = array(':auc_id', $row['id'], 'int');
+ $db->query($query, $params);
+ $next_bid = $db->result('bid');
+ // set new highest bid
+ $params = array();
+ $extra = ", current_bid = :next_bid, current_bid_id = :current_bid_id";
+ $params[] = array(':next_bid', $next_bid, 'float');
+ $params[] = array(':current_bid_id', $row['id'], 'int');
+ }
+ $query = "UPDATE " . $DBPrefix . "auctions SET num_bids = num_bids - 1" . $extra . " WHERE id = :auc_id";
+ $params[] = array(':auc_id', $row['id'], 'int');
+ $db->query($query, $params);
+ }
+
+ // delete bids
+ $query = "DELETE FROM " . $DBPrefix . "bids WHERE bidder = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ }
+
+ // Update user counters
+ if ($suspended == 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "counters set users = users - 1, bids = bids - :num_bids, auctions = auctions - :num_auctions";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "counters set inactiveusers = inactiveusers - 1, bids = bids - :num_bids, auctions = auctions - :num_auctions";
+ }
+ $params = array();
+ $params[] = array(':num_bids', $num_bids, 'int');
+ $params[] = array(':num_auctions', $num_auctions, 'int');
+ $db->query($query, $params);
+
+ header('location: listusers.php');
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ header('location: listusers.php');
+ exit;
}
// Check if the users has some auction
@@ -154,22 +167,24 @@
$db->query($query, $params);
$num_auctions = $db->result('COUNT');
-if ($num_auctions > 0) {
- $error_message = $MSG['user_has_active_auctions'];
- $i = 0;
- while ($row = $db->fetch()) {
- if ($i >= 10) {
- break;
- }
- $has_auctions = true;
- $error_message .= $row['id'] . ' - ' . $row['title'] . ' ';
- $i++;
- }
- if ($num_auctions != $i) {
- $error_message .= '' . sprintf($MSG['plus_x_more'], $num_auctions - $i) . '
';
- }
-
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $error_message));
+if ($num_auctions > 0)
+{
+ $error_message = $MSG['420'];
+ $i = 0;
+ while ($row = $db->fetch())
+ {
+ if ($i >= 10)
+ break;
+ $has_auctions = true;
+ $error_message .= $row['id'] . ' - ' . $row['title'] . ' ';
+ $i++;
+ }
+ if ($num_auctions != $i)
+ {
+ $error_message .= '' . sprintf($MSG['568'], $num_auctions - $i) . '
';
+ }
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $error_message));
}
// Check if the user is BIDDER in some auction
@@ -179,10 +194,11 @@
$db->query($query, $params);
$num_bids = $db->result('COUNT');
-if ($num_bids > 0) {
- $has_bids = true;
+if ($num_bids > 0)
+{
+ $has_bids = true;
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => sprintf($MSG['user_has_x_bids'], $num_bids)));
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => sprintf($MSG['421'], $num_bids)));
}
$query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
@@ -192,15 +208,16 @@
$username = $db->result('nick');
$template->assign_vars(array(
- 'ID' => $id,
- 'MESSAGE' => sprintf($MSG['confirm_user_delete'], $username),
- 'TYPE' => 1
- ));
+ 'ID' => $id,
+ 'MESSAGE' => sprintf($MSG['835'], $username),
+ 'TYPE' => 1
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/deleteuserfeed.php b/admin/deleteuserfeed.php
old mode 100644
new mode 100755
index 4c7cfca18..615fb4ab4
--- a/admin/deleteuserfeed.php
+++ b/admin/deleteuserfeed.php
@@ -1,6 +1,6 @@
query($query, $params);
- // get the current feedback count
- $query = "SELECT SUM(rate) as FSUM, COUNT(feedback) as FNUM FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user_id, 'int');
- $db->query($query, $params);
- $fb_data = $db->result();
- // update feedback count
- $query = "UPDATE " . $DBPrefix . "users SET rate_sum = :rate_sum, rate_num = :rate_num WHERE id = :user_id";
- $params = array();
- $params[] = array(':rate_sum', $fb_data['SUM'], 'int');
- $params[] = array(':rate_num', $fb_data['NUM'], 'int');
- $params[] = array(':user_id', $user_id, 'int');
- $db->query($query, $params);
- header('location: userfeedback.php?id=' . $user_id);
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- header('location: userfeedback.php?id=' . $user_id);
- exit;
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ // delete the feedback entry
+ $query = "DELETE FROM " . $DBPrefix . "feedbacks WHERE id = :feedback_id";
+ $params = array();
+ $params[] = array(':feedback_id', $id, 'int');
+ $db->query($query, $params);
+ // get the current feedback count
+ $query = "SELECT SUM(rate) as FSUM, count(feedback) as FNUM FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user_id, 'int');
+ $db->query($query, $params);
+ $fb_data = $db->result();
+ // update feedback count
+ $query = "UPDATE " . $DBPrefix . "users SET rate_sum = :rate_sum, rate_num = :rate_num WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':rate_sum', $fb_data['SUM'], 'int');
+ $params[] = array(':rate_num', $fb_data['NUM'], 'int');
+ $params[] = array(':user_id', $user_id, 'int');
+ $db->query($query, $params);
+ header('location: userfeedback.php?id=' . $user_id);
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ header('location: userfeedback.php?id=' . $user_id);
+ exit;
}
$template->assign_vars(array(
- 'ID' => $id,
- 'USERID' => $user_id,
- 'MESSAGE' => sprintf($MSG['confirm_feedback_delete'], $id),
- 'TYPE' => 2
- ));
+ 'ID' => $id,
+ 'USERID' => $user_id,
+ 'MESSAGE' => sprintf($MSG['848'], $id),
+ 'TYPE' => 2
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/displaysettings.php b/admin/displaysettings.php
old mode 100644
new mode 100755
index 20239545f..8b4820eed
--- a/admin/displaysettings.php
+++ b/admin/displaysettings.php
@@ -1,6 +1,6 @@
writesetting("perpage", $_POST['perpage'], 'int');
- $system->writesetting("featuredperpage", $_POST['featuredperpage'], 'int');
- $system->writesetting("thumb_list", $_POST['thumb_list'], 'int');
- $system->writesetting("loginbox", $_POST['loginbox'], 'int');
- $system->writesetting("newsbox", $_POST['newsbox'], 'int');
- $system->writesetting("newstoshow", $_POST['newstoshow'], 'int');
- $system->writesetting("homefeaturednumber", $_POST['homefeaturednumber'], 'int');
- $system->writesetting("lastitemsnumber", $_POST['lastitemsnumber'], 'int');
- $system->writesetting("hotitemsnumber", $_POST['hotitemsnumber'], 'int');
- $system->writesetting("endingsoonnumber", $_POST['endingsoonnumber'], 'int');
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['display_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission & update database
+ $system->writesetting("perpage", $_POST['perpage'], 'int');
+ $system->writesetting("featuredperpage", $_POST['featuredperpage'], 'int');
+ $system->writesetting("thumb_list", $_POST['thumb_list'], 'int');
+ $system->writesetting("loginbox", $_POST['loginbox'], 'int');
+ $system->writesetting("newsbox", $_POST['newsbox'], 'int');
+ $system->writesetting("newstoshow",$_POST['newstoshow'], 'int');
+ $system->writesetting("homefeaturednumber", $_POST['homefeaturednumber'], 'int');
+ $system->writesetting("lastitemsnumber", $_POST['lastitemsnumber'], 'int');
+ $system->writesetting("hotitemsnumber", $_POST['hotitemsnumber'], 'int');
+ $system->writesetting("endingsoonnumber", $_POST['endingsoonnumber'], 'int');
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['795']));
}
-loadblock($MSG['show_per_page'], $MSG['show_per_page_explain'], 'days', 'perpage', $system->SETTINGS['perpage']);
-loadblock($MSG['max_featured_items'], $MSG['max_featured_items_explain'], 'days', 'featuredperpage', $system->SETTINGS['featuredperpage']);
-loadblock($MSG['thumbnail_size'], $MSG['thumbnail_size_explain'], 'decimals', 'thumb_list', $system->SETTINGS['thumb_list'], array($MSG['pixels']));
+loadblock($MSG['789'], $MSG['790'], 'days', 'perpage', $system->SETTINGS['perpage']);
+loadblock('', $MSG['max_featured_items'], 'days', 'featuredperpage', $system->SETTINGS['featuredperpage']);
+loadblock($MSG['25_0107'], $MSG['808'], 'decimals', 'thumb_list', $system->SETTINGS['thumb_list'], array($MSG['2__0045']));
-loadblock($MSG['front_page_settings'], '', '', '', '', array(), true);
-loadblock($MSG['home_page_featured'], $MSG['home_page_featured_explain'], 'days', 'homefeaturednumber', $system->SETTINGS['homefeaturednumber']);
-loadblock($MSG['home_page_recent'], $MSG['home_page_recent_explain'], 'days', 'lastitemsnumber', $system->SETTINGS['lastitemsnumber']);
-loadblock($MSG['home_page_hot'], $MSG['home_page_hot_explain'], 'days', 'hotitemsnumber', $system->SETTINGS['hotitemsnumber']);
-loadblock($MSG['home_page_ending_soon'], $MSG['home_page_ending_soon_explain'], 'days', 'endingsoonnumber', $system->SETTINGS['endingsoonnumber']);
-loadblock($MSG['home_page_login'], $MSG['home_page_login_explain'], 'batch', 'loginbox', $system->SETTINGS['loginbox'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['home_page_news'], $MSG['home_page_news_explain'], 'batch', 'newsbox', $system->SETTINGS['newsbox'], array($MSG['yes'], $MSG['no']));
-loadblock('', $MSG['number_news_shown'], 'days', 'newstoshow', $system->SETTINGS['newstoshow']);
+loadblock($MSG['807'], '', '', '', '', array(), true);
+loadblock($MSG['5011'], $MSG['5012'], 'days', 'homefeaturednumber', $system->SETTINGS['homefeaturednumber']);
+loadblock($MSG['5013'], $MSG['5014'], 'days', 'lastitemsnumber', $system->SETTINGS['lastitemsnumber']);
+loadblock($MSG['5015'], $MSG['5016'], 'days', 'hotitemsnumber', $system->SETTINGS['hotitemsnumber']);
+loadblock($MSG['5017'], $MSG['5018'], 'days', 'endingsoonnumber', $system->SETTINGS['endingsoonnumber']);
+loadblock($MSG['532'], $MSG['537'], 'batch', 'loginbox', $system->SETTINGS['loginbox'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['533'], $MSG['538'], 'batch', 'newsbox', $system->SETTINGS['newsbox'], array($MSG['030'], $MSG['029']));
+loadblock('', $MSG['554'], 'days', 'newstoshow', $system->SETTINGS['newstoshow']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['display_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['788']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/durations.php b/admin/durations.php
old mode 100644
new mode 100755
index 03f095103..ed9cee946
--- a/admin/durations.php
+++ b/admin/durations.php
@@ -1,6 +1,6 @@
$v) {
- if ((isset($_POST['delete']) && !in_array($k, $_POST['delete']) || !isset($_POST['delete'])) && !empty($_POST['new_durations'][$k]) && !empty($_POST['new_days'][$k])) {
- $rebuilt_durations[] = $_POST['new_durations'][$k];
- $rebuilt_days[] = $_POST['new_days'][$k];
- }
- }
+ foreach ($_POST['new_durations'] as $k => $v)
+ {
+ if ((isset($_POST['delete']) && !in_array($k, $_POST['delete']) || !isset($_POST['delete'])) && !empty($_POST['new_durations'][$k]) && !empty($_POST['new_days'][$k]))
+ {
+ $rebuilt_durations[] = $_POST['new_durations'][$k];
+ $rebuilt_days[] = $_POST['new_days'][$k];
+ }
+ }
- $query = "DELETE FROM " . $DBPrefix . "durations";
- $db->direct_query($query);
+ $query = "DELETE FROM " . $DBPrefix . "durations";
+ $db->direct_query($query);
- for ($i = 0; $i < count($rebuilt_durations); $i++) {
- $query = "INSERT INTO " . $DBPrefix . "durations VALUES (:day_count, :day_string)";
- $params = array();
- $params[] = array(':day_count', $rebuilt_days[$i], 'int');
- $params[] = array(':day_string', $rebuilt_durations[$i], 'str');
- $db->query($query, $params);
- }
+ for ($i = 0; $i < count($rebuilt_durations); $i++)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "durations VALUES (:day_count, :day_string)";
+ $params = array();
+ $params[] = array(':day_count', $rebuilt_days[$i], 'int');
+ $params[] = array(':day_string', $rebuilt_durations[$i], 'str');
+ $db->query($query, $params);
+ }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['duration_table_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['123']));
}
$query = "SELECT * FROM " . $DBPrefix . "durations ORDER BY days";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('dur', array(
- 'DAYS' => $row['days'],
- 'DESC' => $row['description']
- ));
+$i = 0;
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('dur', array(
+ 'ID' => $i,
+ 'DAYS' => $row['days'],
+ 'DESC' => $row['description']
+ ));
+ $i++;
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'durations.tpl'
- ));
+ 'body' => 'durations.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/editadminuser.php b/admin/editadminuser.php
old mode 100644
new mode 100755
index 75029b4b9..c687c570b
--- a/admin/editadminuser.php
+++ b/admin/editadminuser.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_054));
- } elseif ($_POST['password'] != $_POST['repeatpassword']) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
- } else {
- // Update
- $query = "UPDATE " . $DBPrefix . "adminusers SET";
- $params = array();
- if (!empty($_POST['password'])) {
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query .= " password = :password, ";
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
- }
- $query .= " status = :status WHERE id = :admin_id";
- $params[] = array(':status', $_POST['status'], 'bool');
- $params[] = array(':admin_id', $id, 'int');
- $db->query($query, $params);
- header('location: adminusers.php');
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if ((!empty($_POST['password']) && empty($_POST['repeatpassword'])) || (empty($_POST['password']) && !empty($_POST['repeatpassword'])))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_054));
+ }
+ elseif ($_POST['password'] != $_POST['repeatpassword'])
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
+ }
+ else
+ {
+ // Update
+ $query = "UPDATE " . $DBPrefix . "adminusers SET";
+ $params = array();
+ if (!empty($_POST['password']))
+ {
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query .= " password = :password, ";
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
+ }
+ $query .= " status = :status WHERE id = :admin_id";
+ $params[] = array(':status', $_POST['status'], 'bool');
+ $params[] = array(':admin_id', $id, 'int');
+ $db->query($query, $params);
+ header('location: adminusers.php');
+ exit;
+ }
}
$query = "SELECT * FROM " . $DBPrefix . "adminusers WHERE id = :admin_id";
@@ -55,32 +56,39 @@
$db->query($query, $params);
$user_data = $db->result();
-// Data check
-if (!$user_data) {
- header('location: adminusers.php');
- exit;
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $CREATED = substr($user_data['created'], 4, 2) . '/' . substr($user_data['created'], 6, 2) . '/' . substr($user_data['created'], 0, 4);
+}
+else
+{
+ $CREATED = substr($user_data['created'], 6, 2) . '/' . substr($user_data['created'], 4, 2) . '/' . substr($user_data['created'], 0, 4);
}
-if ($user_data['lastlogin'] == $user_data['created']) {
- $LASTLOGIN = $MSG['570'];
-} else {
- $LASTLOGIN = $dt->printDateTz($user_data['lastlogin']);
+if ($user_data['lastlogin'] == 0)
+{
+ $LASTLOGIN = $MSG['570'];
+}
+else
+{
+ $LASTLOGIN = FormatDate($user_data['lastlogin']);
}
$template->assign_vars(array(
- 'ID' => $id,
- 'USERNAME' => $user_data['username'],
- 'CREATED' => $dt->printDateTz($user_data['created']),
- 'LASTLOGIN' => $LASTLOGIN,
+ 'ID' => $id,
+ 'USERNAME' => $user_data['username'],
+ 'CREATED' => $CREATED,
+ 'LASTLOGIN' => $LASTLOGIN,
- 'B_ACTIVE' => ($user_data['status'] == 1),
- 'B_INACTIVE' => ($user_data['status'] == 0)
- ));
+ 'B_ACTIVE' => ($user_data['status'] == 1),
+ 'B_INACTIVE' => ($user_data['status'] == 0)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editadminuser.tpl'
- ));
+ 'body' => 'editadminuser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editauction.php b/admin/editauction.php
old mode 100644
new mode 100755
index 26757aa77..81b78d059
--- a/admin/editauction.php
+++ b/admin/editauction.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_601));
- } elseif (isset($_POST['current_bid']) && $_POST['current_bid'] < $_POST['min_bid'] && $_POST['current_bid'] != 0) { // bid > min_bid
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_current_bid_too_low']));
- } else {
- // Retrieve auction data
- $query = "SELECT * from " . $DBPrefix . "auctions WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $AUCTION = $db->result();
-
- if ($AUCTION['category'] != $_POST['category']) {
- // and increase new category counters
- $ct = intval($_POST['category']);
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $ct, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] == $ct) {
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + 1, sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- } else {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- }
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
-
- // and decrease old category counters
- $cta = intval($AUCTION['category']);
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $cta, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] == $cta) {
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- } else {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- }
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
-
- if ($AUCTION['secondcat'] != $_POST['secondcat']) {
- // and increase new category counters
- $ct = intval($_POST['secondcat']);
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $ct, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] == $ct) {
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + 1, sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- } else {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- }
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
-
- // and decrease old category counters
- $cta = intval($AUCTION['secondcat']);
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $cta, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] == $cta) {
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- } else {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- }
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
-
- // clean unwanted images
- if (isset($_POST['gallery']) && is_array($_POST['gallery'])) {
- $uploaded = load_gallery($_POST['id']);
- foreach ($uploaded as $img) {
- if (in_array($img, $_POST['gallery'])) {
- unlink(MAIN_PATH . $img);
- }
- }
- }
-
- $start_date = new DateTime($AUCTION['starts'], $dt->UTCtimezone);
- $start_date->add(new DateInterval('P' . intval($_POST['duration']) . 'D'));
- $auction_ends = $start_date->format('Y-m-d H:i:s');
-
- $query = "UPDATE " . $DBPrefix . "auctions SET
- title = :title,
- subtitle = :subtitle,
- ends = :ends,
- duration = :duration,
- category = :category,
- secondcat = :secondcat,
- description = :description,
- quantity = :quantity,
- minimum_bid = :minimum_bid,
- shipping_cost = :shipping_cost,
- buy_now = :buy_now,
- bn_only = :bn_only,
- reserve_price = :reserve_price,
- increment = :increment,
- shipping = :shipping,
- payment = :payment,
- international = :international,
- shipping_terms = :shipping_terms,
- bold = :bold,
- highlighted = :highlighted,
- featured = :featured
- WHERE id = :auc_id";
- $params = array();
- $params[] = array(':title', $system->cleanvars($_POST['title']), 'str');
- $params[] = array(':subtitle', $system->cleanvars($_POST['subtitle']), 'str');
- $params[] = array(':ends', $auction_ends, 'str');
- $params[] = array(':duration', $_POST['duration'], 'int');
- $params[] = array(':category', $_POST['category'], 'int');
- $params[] = array(':secondcat', $_POST['secondcat'], 'int');
- $params[] = array(':description', $_POST['description'], 'str');
- $params[] = array(':quantity', $_POST['quantity'], 'int');
- $params[] = array(':minimum_bid', $system->input_money($_POST['min_bid']), 'float');
- $params[] = array(':shipping_cost', $system->input_money($_POST['shipping_cost']), 'float');
- $params[] = array(':buy_now', $system->input_money($_POST['buy_now']), 'float');
- $params[] = array(':bn_only', $_POST['buy_now_only'], 'bool');
- $params[] = array(':reserve_price', $system->input_money($_POST['reserve_price']), 'float');
- $params[] = array(':increment', $system->input_money($_POST['customincrement']), 'float');
- $params[] = array(':shipping', $_POST['shipping'], 'str');
- $params[] = array(':payment', implode(', ', $_POST['payment']), 'str');
- $params[] = array(':international', (isset($_POST['international'])), 'bool');
- $params[] = array(':shipping_terms', $system->cleanvars($_POST['shipping_terms']), 'str');
- $params[] = array(':bold', (isset($_POST['is_bold'])), 'bool');
- $params[] = array(':highlighted', (isset($_POST['is_highlighted'])), 'bool');
- $params[] = array(':featured', (isset($_POST['is_featured'])), 'bool');
- $params[] = array(':auc_id', $_POST['id'], 'int');
- $db->query($query, $params);
-
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
- }
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- }
+if (isset($_POST['action']))
+{
+ // Check that all the fields are not NULL
+ if (!empty($_POST['id']) && !empty($_POST['title']) && !empty($_POST['duration']) && !empty($_POST['category']) && !empty($_POST['description']) && !empty($_POST['min_bid']))
+ {
+ // fix values
+ $_POST['quantity'] = (empty($_POST['quantity'])) ? 1 : $_POST['quantity'];
+ $_POST['customincrement'] = (empty($_POST['customincrement'])) ? 0 : $_POST['customincrement'];
+ // Check the input values for validity.
+ if ($_POST['quantity'] < 1) // 1 or more items being sold
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_701));
+ }
+ elseif (isset($_POST['current_bid']) && $_POST['current_bid'] < $_POST['min_bid'] && $_POST['current_bid'] != 0) // bid > min_bid
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_702));
+ }
+ else
+ {
+ // Retrieve auction data
+ $query = "SELECT * from " . $DBPrefix . "auctions WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $AUCTION = $db->result();
+
+ $a_start = $AUCTION['starts'];
+ $a_ends = $a_start + ($_POST['duration'] * 24 * 60 * 60);
+
+ if ($AUCTION['category'] != $_POST['category'])
+ {
+ // and increase new category counters
+ $ct = intval($_POST['category']);
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $ct, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] == $ct)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + 1, sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ }
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+
+ // and decrease old category counters
+ $cta = intval($AUCTION['category']);
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $cta, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] == $cta)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ }
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+
+ if ($AUCTION['secondcat'] != $_POST['secondcat'])
+ {
+ // and increase new category counters
+ $ct = intval($_POST['secondcat']);
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $ct, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] == $ct)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + 1, sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ }
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+
+ // and decrease old category counters
+ $cta = intval($AUCTION['secondcat']);
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $cta, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] == $cta)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter - 1, sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ }
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+
+ // clean unwanted images
+ if (isset($_POST['gallery']) && is_array($_POST['gallery']))
+ {
+ $uploaded = load_gallery($_POST['id']);
+ foreach ($uploaded as $img)
+ {
+ if (in_array($img, $_POST['gallery']))
+ {
+ unlink(MAIN_PATH . $img);
+ }
+ }
+ }
+
+ $query = "UPDATE " . $DBPrefix . "auctions SET
+ title = :title,
+ subtitle = :subtitle,
+ ends = :ends,
+ duration = :duration,
+ category = :category,
+ secondcat = :secondcat,
+ description = :description,
+ quantity = :quantity,
+ minimum_bid = :minimum_bid,
+ shipping_cost = :shipping_cost,
+ buy_now = :buy_now,
+ bn_only = :bn_only,
+ reserve_price = :reserve_price,
+ increment = :increment,
+ shipping = :shipping,
+ payment = :payment,
+ international = :international,
+ shipping_terms = :shipping_terms,
+ bold = :bold,
+ highlighted = :highlighted,
+ featured = :featured
+ WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':title', $system->cleanvars($_POST['title']), 'str');
+ $params[] = array(':subtitle', $system->cleanvars($_POST['subtitle']), 'str');
+ $params[] = array(':ends', $a_ends, 'int');
+ $params[] = array(':duration', $system->cleanvars($_POST['duration']), 'str');
+ $params[] = array(':category', $_POST['category'], 'int');
+ $params[] = array(':secondcat', $_POST['secondcat'], 'int');
+ $params[] = array(':description', $_POST['description'], 'str');
+ $params[] = array(':quantity', $_POST['quantity'], 'int');
+ $params[] = array(':minimum_bid', $system->input_money($_POST['min_bid']), 'float');
+ $params[] = array(':shipping_cost', $system->input_money($_POST['shipping_cost']), 'float');
+ $params[] = array(':buy_now', $system->input_money($_POST['buy_now']), 'float');
+ $params[] = array(':bn_only', $_POST['buy_now_only'], 'bool');
+ $params[] = array(':reserve_price', $system->input_money($_POST['reserve_price']), 'float');
+ $params[] = array(':increment', $system->input_money($_POST['customincrement']), 'float');
+ $params[] = array(':shipping', $_POST['shipping'], 'str');
+ $params[] = array(':payment', implode(', ', $_POST['payment']), 'str');
+ $params[] = array(':international', ((isset($_POST['international'])) ? 1 : 0), 'int');
+ $params[] = array(':shipping_terms', $system->cleanvars($_POST['shipping_terms']), 'str');
+ $params[] = array(':bold', (isset($_POST['is_bold'])), 'bool');
+ $params[] = array(':highlighted', (isset($_POST['is_highlighted'])), 'bool');
+ $params[] = array(':featured', (isset($_POST['is_featured'])), 'bool');
+ $params[] = array(':auc_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ unset($_SESSION['RETURN_LIST'], $_SESSION['RETURN_LIST_OFFSET']);
+ header('location: ' . $URL);
+ exit;
+ }
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
}
$auc_id = intval($_REQUEST['id']);
-$query = "SELECT u.nick, a.* FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- WHERE a.id = :auc_id";
+$query = "SELECT u.nick, a.* FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ WHERE a.id = :auc_id";
$params = array();
$params[] = array(':auc_id', $auc_id, 'int');
$db->query($query, $params);
-if ($db->numrows() == 0) {
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
+if ($db->numrows() == 0)
+{
+ if (!isset($_SESSION['RETURN_LIST']))
+ {
+ $URL = 'listauctions.php';
+ }
+ else
+ {
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ }
+ unset($_SESSION['RETURN_LIST'], $_SESSION['RETURN_LIST_OFFSET']);
+ header('location: ' . $URL);
+ exit;
}
$auction_data = $db->result();
// DURATIONS
+$dur_list = ''; // empty string to begin HTML list
$query = "SELECT days, description FROM " . $DBPrefix . "durations";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('dur', array(
- 'DAYS' => $row['days'],
- 'SELECTED' => ($row['days'] == $auction_data['duration']),
- 'DESC' => $row['description']
- ));
+while ($row = $db->fetch())
+{
+ $dur_list .= '' . "\n";
}
// CATEGORIES
-if (isset($category_plain) && count($category_plain) > 0) {
- foreach ($category_plain as $cat_id => $cat_name) {
- $template->assign_block_vars('cats1', array(
- 'CAT_ID' => $cat_id,
- 'CAT_NAME' => $cat_name,
- 'SELECTED' => ($cat_id == $auction_data['category'])
- ));
- $template->assign_block_vars('cats2', array(
- 'CAT_ID' => $cat_id,
- 'CAT_NAME' => $cat_name,$cat_name,
- 'SELECTED' => ($cat_id == $auction_data['secondcat'])
- ));
- }
+$categories_list1 = '' . "\n";
+if (isset($category_plain) && count($category_plain) > 0)
+{
+ foreach ($category_plain as $k => $v)
+ {
+ $categories_list1 .= ' ' . $v . ' ' . "\n";
+ }
}
+$categories_list1 .= ' ' . "\n";
+
+$categories_list2 = '' . "\n";
+if (isset($category_plain) && count($category_plain) > 0)
+{
+ foreach ($category_plain as $k => $v)
+ {
+ $categories_list2 .= ' ' . $v . ' ' . "\n";
+ }
+}
+$categories_list2 .= ' ' . "\n";
// Pictures Gellery
$K = 0;
$UPLOADED_PICTURES = array();
-if (file_exists(UPLOAD_PATH . $auc_id)) {
- // load dem pictures
- $UPLOADED_PICTURES = load_gallery($auc_id);
-
- if (is_array($UPLOADED_PICTURES)) {
- foreach ($UPLOADED_PICTURES as $k => $v) {
- $TMP = @getimagesize('../' . $v);
- if ($TMP[2] >= 1 && $TMP[2] <= 3) {
- $template->assign_block_vars('gallery', array(
- 'V' => $v
- ));
- }
- }
- }
+if (file_exists(UPLOAD_PATH . $auc_id))
+{
+ // load dem pictures
+ $UPLOADED_PICTURES = load_gallery($auc_id);
+
+ if (is_array($UPLOADED_PICTURES))
+ {
+ foreach ($UPLOADED_PICTURES as $k => $v)
+ {
+ $TMP = @getimagesize('../' . $v);
+ if ($TMP[2] >= 1 && $TMP[2] <= 3)
+ {
+ $template->assign_block_vars('gallery', array(
+ 'V' => $v
+ ));
+ }
+ }
+ }
}
// payments
@@ -290,11 +355,13 @@ function load_gallery($auc_id)
$payment_methods = '';
$query = "SELECT * FROM " . $DBPrefix . "payment_options";
$db->direct_query($query);
-while ($payment_method = $db->fetch()) {
- if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0) {
- $checked = (in_array($payment_method['name'], $payment)) ? 'checked' : '';
- $payment_methods .= ' ' . $payment_method['displayname'] . '
';
- }
+while ($payment_method = $db->fetch())
+{
+ if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0)
+ {
+ $checked = (in_array($payment_method['name'], $payment)) ? 'checked' : '';
+ $payment_methods .= ' ' . $payment_method['displayname'] . '
';
+ }
}
$CKEditor = new CKEditor();
@@ -304,40 +371,44 @@ function load_gallery($auc_id)
$CKEditor->config['height'] = 400;
$template->assign_vars(array(
- 'ID' => intval($_REQUEST['id']),
- 'USER' => $auction_data['nick'],
- 'TITLE' => $auction_data['title'],
- 'SUBTITLE' => $auction_data['subtitle'],
- 'EDITOR' => $CKEditor->editor('description', $auction_data['description']),
- 'CURRENT_BID' => $system->print_money_nosymbol($auction_data['current_bid']),
- 'MIN_BID' => $system->print_money_nosymbol($auction_data['minimum_bid']),
- 'QTY' => $auction_data['quantity'],
- 'PAYMENTS' => $payment_methods,
- 'ATYPE' => $system->SETTINGS['auction_types'][$auction_data['auction_type']],
-
- 'SHIPPING_COST' => $system->print_money_nosymbol($auction_data['shipping_cost']),
- 'RESERVE' => $system->print_money_nosymbol($auction_data['reserve_price']),
- 'BN_ONLY_Y' => ($auction_data['bn_only']) ? 'checked' : '',
- 'BN_ONLY_N' => ($auction_data['bn_only']) ? '' : 'checked',
- 'BN_PRICE' => $system->print_money_nosymbol($auction_data['buy_now']),
- 'CUSTOM_INC' => ($auction_data['increment'] > 0) ? $system->print_money_nosymbol($auction_data['increment']) : '',
- 'SHIPPING1' => ($auction_data['shipping'] == 1 || empty($auction_data['shipping'])) ? 'checked' : '',
- 'SHIPPING2' => ($auction_data['shipping'] == 2) ? 'checked' : '',
- 'INTERNATIONAL' => (!empty($auction_data['international'])) ? 'checked' : '',
- 'SHIPPING_TERMS' => $auction_data['shipping_terms'],
- 'IS_BOLD' => ($auction_data['bold']) ? 'checked' : '',
- 'IS_HIGHLIGHTED' => ($auction_data['highlighted']) ? 'checked' : '',
- 'IS_FEATURED' => ($auction_data['featured']) ? 'checked' : '',
- 'SUSPENDED' => ($auction_data['suspended'] == 0) ? $MSG['no'] : $MSG['yes'],
-
- 'B_MKFEATURED' => ($system->SETTINGS['ao_hpf_enabled'] == 'y'),
- 'B_MKBOLD' => ($system->SETTINGS['ao_bi_enabled'] == 'y'),
- 'B_MKHIGHLIGHT' => ($system->SETTINGS['ao_hi_enabled'] == 'y')
- ));
+ 'ID' => intval($_REQUEST['id']),
+ 'USER' => $auction_data['nick'],
+ 'TITLE' => $auction_data['title'],
+ 'SUBTITLE' => $auction_data['subtitle'],
+ 'DURLIST' => $dur_list,
+ 'CATLIST1' => $categories_list1,
+ 'CATLIST2' => $categories_list2,
+ 'EDITOR' => $CKEditor->editor('description', $auction_data['description']),
+ 'CURRENT_BID' => $system->print_money_nosymbol($auction_data['current_bid']),
+ 'MIN_BID' => $system->print_money_nosymbol($auction_data['minimum_bid']),
+ 'QTY' => $auction_data['quantity'],
+ 'PAYMENTS' => $payment_methods,
+ 'ATYPE' => $system->SETTINGS['auction_types'][$auction_data['auction_type']],
+
+ 'SHIPPING_COST' => $system->print_money_nosymbol($auction_data['shipping_cost']),
+ 'RESERVE' => $system->print_money_nosymbol($auction_data['reserve_price']),
+ 'BN_ONLY_Y' => ($auction_data['bn_only']) ? 'checked' : '',
+ 'BN_ONLY_N' => ($auction_data['bn_only']) ? '' : 'checked',
+ 'BN_PRICE' => $system->print_money_nosymbol($auction_data['buy_now']),
+ 'CUSTOM_INC' => ($auction_data['increment'] > 0) ? $system->print_money_nosymbol($auction_data['increment']) : '',
+ 'SHIPPING1' => ($auction_data['shipping'] == 1 || empty($auction_data['shipping'])) ? 'checked' : '',
+ 'SHIPPING2' => ($auction_data['shipping'] == 2) ? 'checked' : '',
+ 'INTERNATIONAL' => (!empty($auction_data['international'])) ? 'checked' : '',
+ 'SHIPPING_TERMS' => $auction_data['shipping_terms'],
+ 'IS_BOLD' => ($auction_data['bold']) ? 'checked' : '',
+ 'IS_HIGHLIGHTED' => ($auction_data['highlighted']) ? 'checked' : '',
+ 'IS_FEATURED' => ($auction_data['featured']) ? 'checked' : '',
+ 'SUSPENDED' => ($auction_data['suspended'] == 0) ? $MSG['029'] : $MSG['030'],
+
+ 'B_MKFEATURED' => ($system->SETTINGS['ao_hpf_enabled'] == 'y'),
+ 'B_MKBOLD' => ($system->SETTINGS['ao_bi_enabled'] == 'y'),
+ 'B_MKHIGHLIGHT' => ($system->SETTINGS['ao_hi_enabled'] == 'y')
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editauction.tpl'
- ));
+ 'body' => 'editauction.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editbanner.php b/admin/editbanner.php
old mode 100644
new mode 100755
index c469074ec..86e974888
--- a/admin/editbanner.php
+++ b/admin/editbanner.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } else {
- if ($_FILES['bannerfile']['tmp_name'] != '' && $_FILES['bannerfile']['tmp_name'] != 'none') {
- // Handle upload
- if (!file_exists(UPLOAD_PATH . 'banners')) {
- umask();
- mkdir(UPLOAD_PATH . 'banners', 0777);
- }
- if (!file_exists(UPLOAD_PATH . 'banners/' . $id)) {
- umask();
- mkdir(UPLOAD_PATH . 'banners/' . $id, 0777);
- }
-
- $TARGET = UPLOAD_PATH . 'banners/' . $id . '/' . $_FILES['bannerfile']['name'];
- list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['bannerfile']['tmp_name']);
- $filename = basename($_FILES['bannerfile']['name']);
- $file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
- $file_types = array('gif', 'jpg', 'jpeg', 'png', 'swf');
- if (!in_array($file_ext, $file_types)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_wrong_file_type']));
- } else {
- $imageType = image_type_to_mime_type($imageType);
- switch ($imageType) {
- case 'image/gif':
- $FILETYPE = 'gif';
- break;
- case 'image/pjpeg':
- case 'image/jpeg':
- case 'image/jpg':
- $FILETYPE = 'jpg';
- break;
- case 'image/png':
- case 'image/x-png':
- $FILETYPE = 'png';
- break;
- case 'application/x-shockwave-flash':
- $FILETYPE = 'swf';
- break;
- }
- if (!empty($_FILES['bannerfile']['tmp_name']) && $_FILES['bannerfile']['tmp_name'] != 'none') {
- move_uploaded_file($_FILES['bannerfile']['tmp_name'], $TARGET);
- chmod($TARGET, 0666);
- }
- }
- }
-
- // Update database
- $extrasql = '';
- $params = array();
- if ($_FILES['bannerfile']['tmp_name'] != '' && $_FILES['bannerfile']['tmp_name'] != 'none') {
- $extrasql = "name = :bannerfile,
- type = :type,
- width = :imagewidth,
- height = :imageheight,";
- $params[] = array(':bannerfile', $_FILES['bannerfile']['name'], 'str');
- $params[] = array(':type', $FILETYPE, 'str');
- $params[] = array(':imagewidth', $imagewidth, 'int');
- $params[] = array(':imageheight', $imageheight, 'int');
- }
-
- $query = "UPDATE " . $DBPrefix . "banners
- SET " . $extrasql . "
- url = :url,
- sponsortext = :sponsortext,
- alt = :alt,
- purchased = :purchased
- WHERE id = :id";
- $params[] = array(':url', $_POST['url'], 'str');
- $params[] = array(':sponsortext', $_POST['sponsortext'], 'str');
- $params[] = array(':alt', $_POST['alt'], 'str');
- $params[] = array(':purchased', $_POST['purchased'], 'int');
- $params[] = array(':id', $banner, 'int');
- $db->query($query, $params);
-
- $query = "DELETE FROM " . $DBPrefix . "bannerscategories WHERE banner = :banner_id";
- $params = array();
- $params[] = array(':banner_id', $banner, 'int');
- $db->query($query, $params);
-
- $query = "DELETE FROM " . $DBPrefix . "bannerskeywords WHERE banner = :banner_id";
- $params = array();
- $params[] = array(':banner_id', $banner, 'int');
- $db->query($query, $params);
-
- // Handle filters
- if (isset($_POST['category']) && is_array($_POST['category'])) {
- foreach ($_POST['category'] as $k => $v) {
- $query = "INSERT INTO " . $DBPrefix . "bannerscategories VALUES (:banner_id, :cat)";
- $params = array();
- $params[] = array(':banner_id', $banner, 'int');
- $params[] = array(':cat', $v, 'int');
- $db->query($query, $params);
- }
- }
- if (!empty($_POST['keywords'])) {
- $KEYWORDS = explode("\n", $_POST['keywords']);
- foreach ($KEYWORDS as $k => $v) {
- if (!empty($v)) {
- $query = "INSERT INTO " . $DBPrefix . "bannerskeywords VALUES (:banner_id, :keyword)";
- $params = array();
- $params[] = array(':banner_id', $banner, 'int');
- $params[] = array(':keyword', $system->cleanvars(trim($v)), 'str');
- $db->query($query, $params);
- }
- }
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'insert')
+{
+ // Data integrity
+ if (empty($_FILES['bannerfile']) || empty($_POST['url']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ else
+ {
+ if ($_FILES['bannerfile']['tmp_name'] != '' && $_FILES['bannerfile']['tmp_name'] != 'none')
+ {
+ // Handle upload
+ if (!file_exists(UPLOAD_PATH . 'banners'))
+ {
+ umask();
+ mkdir(UPLOAD_PATH . 'banners', 0777);
+ }
+ if (!file_exists(UPLOAD_PATH . 'banners/' . $id))
+ {
+ umask();
+ mkdir(UPLOAD_PATH . 'banners/' . $id, 0777);
+ }
+
+ $TARGET = UPLOAD_PATH . 'banners/' . $id . '/' . $_FILES['bannerfile']['name'];
+ list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['bannerfile']['tmp_name']);
+ $filename = basename($_FILES['bannerfile']['name']);
+ $file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
+ $file_types = array('gif', 'jpg', 'jpeg', 'png', 'swf');
+ if (!in_array($file_ext, $file_types))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['_0048']));
+ }
+ else
+ {
+ $imageType = image_type_to_mime_type($imageType);
+ switch ($imageType)
+ {
+ case 'image/gif':
+ $FILETYPE = 'gif';
+ break;
+ case 'image/pjpeg':
+ case 'image/jpeg':
+ case 'image/jpg':
+ $FILETYPE = 'jpg';
+ break;
+ case 'image/png':
+ case 'image/x-png':
+ $FILETYPE = 'png';
+ break;
+ case 'application/x-shockwave-flash':
+ $FILETYPE = 'swf';
+ break;
+ }
+ if (!empty($_FILES['bannerfile']['tmp_name']) && $_FILES['bannerfile']['tmp_name'] != 'none')
+ {
+ move_uploaded_file($_FILES['bannerfile']['tmp_name'], $TARGET);
+ chmod($TARGET, 0666);
+ }
+ }
+ }
+
+ // Update database
+ $extrasql = '';
+ $params = array();
+ if ($_FILES['bannerfile']['tmp_name'] != '' && $_FILES['bannerfile']['tmp_name'] != 'none')
+ {
+ $extrasql = "name = :bannerfile,
+ type = :type,
+ width = :imagewidth,
+ height = :imageheight,";
+ $params[] = array(':bannerfile', $_FILES['bannerfile']['name'], 'str');
+ $params[] = array(':type', $FILETYPE, 'str');
+ $params[] = array(':imagewidth', $imagewidth, 'int');
+ $params[] = array(':imageheight', $imageheight, 'int');
+ }
+
+ $query = "UPDATE " . $DBPrefix . "banners
+ SET " . $extrasql . "
+ url = :url,
+ sponsortext = :sponsortext,
+ alt = :alt,
+ purchased = :purchased
+ WHERE id = :id";
+ $params[] = array(':url', $_POST['url'], 'str');
+ $params[] = array(':sponsortext', $_POST['sponsortext'], 'str');
+ $params[] = array(':alt', $_POST['alt'], 'str');
+ $params[] = array(':purchased', $_POST['purchased'], 'int');
+ $params[] = array(':id', $banner, 'int');
+ $db->query($query, $params);
+
+ $query = "DELETE FROM " . $DBPrefix . "bannerscategories WHERE banner = :banner_id";
+ $params = array();
+ $params[] = array(':banner_id', $banner, 'int');
+ $db->query($query, $params);
+
+ $query = "DELETE FROM " . $DBPrefix . "bannerskeywords WHERE banner = :banner_id";
+ $params = array();
+ $params[] = array(':banner_id', $banner, 'int');
+ $db->query($query, $params);
+
+ // Handle filters
+ if (isset($_POST['category']) && is_array($_POST['category']))
+ {
+ foreach ($_POST['category'] as $k => $v)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bannerscategories VALUES (:banner_id, :cat)";
+ $params = array();
+ $params[] = array(':banner_id', $banner, 'int');
+ $params[] = array(':cat', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
+ if (!empty($_POST['keywords']))
+ {
+ $KEYWORDS = explode("\n", $_POST['keywords']);
+ foreach ($KEYWORDS as $k => $v)
+ {
+ if (!empty($v))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bannerskeywords VALUES (:banner_id, :keyword)";
+ $params = array();
+ $params[] = array(':banner_id', $banner, 'int');
+ $params[] = array(':keyword', $system->cleanvars(trim($v)), 'str');
+ $db->query($query, $params);
+ }
+ }
+ }
+ }
}
-// Retrieve user's banner
+// Retrieve user's banners
$query = "SELECT * FROM " . $DBPrefix . "banners WHERE id = :banner_id";
$params = array();
$params[] = array(':banner_id', $banner, 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $BANNER = $row;
- $template->assign_block_vars('banners', array(
- 'ID' => $row['id'],
- 'TYPE' => $row['type'],
- 'NAME' => $row['name'],
- 'BANNER' => UPLOAD_FOLDER . 'banners/' . $id . '/' . $row['name'],
- 'WIDTH' => $row['width'],
- 'HEIGHT' => $row['height'],
- 'URL' => $row['url'],
- 'ALT' => $row['alt'],
- 'SPONSERTEXT' => $row['sponsortext'],
- 'VIEWS' => $row['views'],
- 'CLICKS' => $row['clicks'],
- 'PURCHASED' => $row['purchased']
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $BANNER = $row;
+ $template->assign_block_vars('banners', array(
+ 'ID' => $row['id'],
+ 'TYPE' => $row['type'],
+ 'NAME' => $row['name'],
+ 'BANNER' => UPLOAD_FOLDER . 'banners/' . $id . '/' . $row['name'],
+ 'WIDTH' => $row['width'],
+ 'HEIGHT' => $row['height'],
+ 'URL' => $row['url'],
+ 'ALT' => $row['alt'],
+ 'SPONSERTEXT' => $row['sponsortext'],
+ 'VIEWS' => $row['views'],
+ 'CLICKS' => $row['clicks'],
+ 'PURCHASED' => $row['purchased'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// Retrieve user's information
@@ -164,8 +185,9 @@
$params = array();
$params[] = array(':banner_id', $id, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- $USER = $db->result();
+if ($db->numrows() > 0)
+{
+ $USER = $db->result();
}
// Retrieve filters
@@ -175,51 +197,61 @@
$params[] = array(':banner_id', $banner, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- while ($row = $db->fetch()) {
- $CATEGORIES[] = $row['category'];
- }
+if ($db->numrows() > 0)
+{
+ while ($row = $db->fetch())
+ {
+ $CATEGORIES[] = $row['category'];
+ }
}
$KEYWORDS = '';
$query = "SELECT * FROM " . $DBPrefix . "bannerskeywords WHERE banner = :banner_id";
$params = array();
$params[] = array(':banner_id', $banner, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- while ($row = $db->fetch()) {
- $KEYWORDS .= $row['keyword'] . "\n";
- }
+if ($db->numrows() > 0)
+{
+ while ($row = $db->fetch())
+ {
+ $KEYWORDS .= $row['keyword'] . "\n";
+ }
}
// -------------------------------------- category
-if (isset($category_plain) && count($category_plain) > 0) {
- foreach ($category_plain as $cat_id => $cat_name) {
- $template->assign_block_vars('categories', array(
- 'CAT_ID' => $cat_id,
- 'CAT_NAME' => $cat_name,
- 'B_SELECTED' => (in_array($cat_id, $CATEGORIES))
- ));
- }
+$TPL_categories_list = '' . "\n";
+if (isset($category_plain) && count($category_plain) > 0)
+{
+ foreach ($category_plain as $k => $v)
+ {
+ if (is_array($CATEGORIES))
+ $select = (in_array($k, $CATEGORIES)) ? ' selected="true"' : '';
+ else
+ $select = '';
+ $TPL_categories_list .= '' . $v . ' ' . "\n";
+ }
}
+$TPL_categories_list .= ' ';
$template->assign_vars(array(
- 'ID' => $id,
- 'NAME' => $USER['name'],
- 'COMPANY' => $USER['company'],
- 'EMAIL' => $USER['email'],
- // form values
- 'BANNERID' => $banner,
- 'URL' => $BANNER['url'],
- 'SPONSORTEXT' => $BANNER['sponsortext'],
- 'ALT' => $BANNER['alt'],
- 'PURCHASED' => $BANNER['purchased'],
- 'KEYWORDS' => $KEYWORDS,
- 'NOTEDIT' => false
- ));
+ 'ID' => $id,
+ 'NAME' => $USER['name'],
+ 'COMPANY' => $USER['company'],
+ 'EMAIL' => $USER['email'],
+ // form values
+ 'BANNERID' => $banner,
+ 'URL' => $BANNER['url'],
+ 'SPONSORTEXT' => $BANNER['sponsortext'],
+ 'ALT' => $BANNER['alt'],
+ 'PURCHASED' => $BANNER['purchased'],
+ 'KEYWORDS' => $KEYWORDS,
+ 'CATEGORIES' => $TPL_categories_list,
+ 'NOTEDIT' => false
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'userbanners.tpl'
- ));
+ 'body' => 'userbanners.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editbannersuser.php b/admin/editbannersuser.php
old mode 100644
new mode 100755
index 8b340aeed..7c6553315
--- a/admin/editbannersuser.php
+++ b/admin/editbannersuser.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- $USER = $_POST;
- } elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
- $USER = $_POST;
- } else {
- // Update database
- $query = "UPDATE " . $DBPrefix . "bannersusers SET
- name = :name,
- company = :company,
- email = :email
- WHERE id = :id";
- $params = array();
- $params[] = array(':name', $_POST['name'], 'str');
- $params[] = array(':company', $_POST['company'], 'str');
- $params[] = array(':email', $_POST['email'], 'str');
- $params[] = array(':id', $id, 'int');
- $db->query($query, $params);
- header('location: managebanners.php');
- exit;
- }
-} else {
- $query = "SELECT * FROM " . $DBPrefix . "bannersusers WHERE id = :id";
- $params = array();
- $params[] = array(':id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $USER = $db->result();
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (empty($_POST['name']) || empty($_POST['company']) || empty($_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ $USER = $_POST;
+ }
+ elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
+ $USER = $_POST;
+ }
+ else
+ {
+ // Update database
+ $query = "UPDATE " . $DBPrefix . "bannersusers SET
+ name = :name,
+ company = :company,
+ email = :email
+ WHERE id = :id";
+ $params = array();
+ $params[] = array(':name', $_POST['name'], 'str');
+ $params[] = array(':company', $_POST['company'], 'str');
+ $params[] = array(':email', $_POST['email'], 'str');
+ $params[] = array(':id', $id, 'int');
+ $db->query($query, $params);
+ header('location: managebanners.php');
+ exit;
+ }
+}
+else
+{
+ $query = "SELECT * FROM " . $DBPrefix . "bannersusers WHERE id = :id";
+ $params = array();
+ $params[] = array(':id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $USER = $db->result();
+ }
}
$template->assign_vars(array(
- 'ID' => $id,
- 'NAME' => (isset($USER['name'])) ? $USER['name'] : '',
- 'COMPANY' => (isset($USER['company'])) ? $USER['company'] : '',
- 'EMAIL' => (isset($USER['email'])) ? $USER['email'] : ''
- ));
+ 'ID' => $id,
+ 'NAME' => (isset($USER['name'])) ? $USER['name'] : '',
+ 'COMPANY' => (isset($USER['company'])) ? $USER['company'] : '',
+ 'EMAIL' => (isset($USER['email'])) ? $USER['email'] : ''
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editbanneruser.tpl'
- ));
+ 'body' => 'editbanneruser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editboards.php b/admin/editboards.php
old mode 100644
new mode 100755
index 88633e09f..0e2dabc1f
--- a/admin/editboards.php
+++ b/admin/editboards.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif (!is_numeric($_POST['msgstoshow'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_msg_numeric']));
- } elseif (intval($_POST['msgstoshow'] == 0)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_msg_not_zero']));
- } else {
- $query = "UPDATE " . $DBPrefix . "community
- SET name = :name,
- msgstoshow = :msgstoshow,
- active = :active
- WHERE id = :id";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
- $params[] = array(':msgstoshow', $_POST['msgstoshow'], 'int');
- $params[] = array(':active', $_POST['active'], 'bool');
- $params[] = array(':id', $_POST['id'], 'int');
- $db->query($query, $params);
- header('location: boards.php');
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (empty($_POST['name']) || empty($_POST['msgstoshow']) || empty($_POST['active']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif (!is_numeric($_POST['msgstoshow']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5000));
+ }
+ elseif (intval($_POST['msgstoshow'] == 0))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5001));
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "community
+ SET name = :name,
+ msgstoshow = :msgstoshow,
+ active = :active
+ WHERE id = :id";
+ $params = array();
+ $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
+ $params[] = array(':msgstoshow', $_POST['msgstoshow'], 'int');
+ $params[] = array(':active', $_POST['active'], 'bool');
+ $params[] = array(':id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ header('location: boards.php');
+ exit;
+ }
}
$id = intval($_GET['id']);
@@ -59,20 +61,21 @@
$board_data = $db->result();
$template->assign_vars(array(
- 'NAME' => $board_data['name'],
- 'MESSAGES' => $board_data['messages'],
- 'LAST_POST' => ($board_data['messages'] > 0) ? $dt->formatDate($board_data['lastmessage']) : '--',
- 'MSGTOSHOW' => $board_data['msgstoshow'],
+ 'NAME' => $board_data['name'],
+ 'MESSAGES' => $board_data['messages'],
+ 'LAST_POST' => ($board_data['lastmessage'] > 0) ? FormatDate($board_data['lastmessage']) : '--',
+ 'MSGTOSHOW' => $board_data['msgstoshow'],
- 'B_ACTIVE' => ($board_data['active'] == 1),
- 'B_DEACTIVE' => ($board_data['active'] == 0),
- 'ID' => $id
- ));
+ 'B_ACTIVE' => ($board_data['active'] == 1),
+ 'B_DEACTIVE' => ($board_data['active'] == 0),
+ 'ID' => $id
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editboards.tpl'
- ));
+ 'body' => 'editboards.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editfaq.php b/admin/editfaq.php
old mode 100644
new mode 100755
index acbcdf64b..16065b77d
--- a/admin/editfaq.php
+++ b/admin/editfaq.php
@@ -1,6 +1,6 @@
SETTINGS['defaultlanguage']])
- || empty($_POST['answer'][$system->SETTINGS['defaultlanguage']])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_067));
- $faq = $_POST;
- } else {
- $query = "UPDATE " . $DBPrefix . "faqs SET category = :category,
- question = :question,
- answer = :answer
- WHERE id = :faq_id";
- $params = array();
- $params[] = array(':category', $_POST['category'], 'int');
- $params[] = array(':question', $_POST['question'][$system->SETTINGS['defaultlanguage']], 'str');
- $params[] = array(':answer', $system->cleanvars($_POST['answer'][$system->SETTINGS['defaultlanguage']], true), 'str');
- $params[] = array(':faq_id', $_POST['id'], 'int');
- $db->query($query, $params);
- foreach ($LANGUAGES as $lang_code) {
- $query = "SELECT question FROM " . $DBPrefix . "faqs_translated WHERE lang = :lang AND id = :faq_id";
- $params = array();
- $params[] = array(':lang', $lang_code, 'str');
- $params[] = array(':faq_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $params = array();
- $params[] = array(':lang', $lang_code, 'str');
- $params[] = array(':question', $_POST['question'][$lang_code], 'str');
- $params[] = array(':answer', $system->cleanvars($_POST['answer'][$lang_code]), 'str');
- if ($db->numrows() > 0) {
- $query = "UPDATE " . $DBPrefix . "faqs_translated SET
- question = :question,
- answer = :answer
- WHERE id = :faq_id AND lang = :lang";
- } else {
- $query = "INSERT INTO " . $DBPrefix . "faqs_translated VALUES
- (:faq_id, :lang, :question, :answer)";
- $params[] = array(':faq_id', $_POST['id'], 'int');
- }
- $db->query($query, $params);
- }
- header('location: faqs.php');
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (empty($_POST['question'][$system->SETTINGS['defaultlanguage']])
+ || empty($_POST['answer'][$system->SETTINGS['defaultlanguage']]))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_067));
+ $faq = $_POST;
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "faqs SET category = :category,
+ question = :question,
+ answer = :answer
+ WHERE id = :faq_id";
+ $params = array();
+ $params[] = array(':category', $_POST['category'], 'int');
+ $params[] = array(':question', $_POST['question'][$system->SETTINGS['defaultlanguage']], 'str');
+ $params[] = array(':answer', $system->cleanvars($_POST['answer'][$system->SETTINGS['defaultlanguage']]), 'str');
+ $params[] = array(':faq_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ reset($LANGUAGES);
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $query = "SELECT question FROM " . $DBPrefix . "faqs_translated WHERE lang = :lang AND id = :faq_id";
+ $params = array();
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':faq_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $params = array();
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':question', $_POST['question'][$k], 'str');
+ $params[] = array(':answer', $system->cleanvars($_POST['answer'][$k]), 'str');
+ if ($db->numrows() > 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "faqs_translated SET
+ question = :question,
+ answer = :answer
+ WHERE id = :faq_id AND lang = :lang";
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "faqs_translated VALUES
+ (:faq_id, :lang, :question, :answer)";
+ $params[] = array(':faq_id', $_POST['id'], 'int');
+ }
+ $db->query($query, $params);
+ }
+ header('location: faqs.php');
+ exit;
+ }
}
// load categories
$query = "SELECT * FROM " . $DBPrefix . "faqscategories ORDER BY category";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('cats', array(
- 'ID' => $row['id'],
- 'CAT' => $row['category']
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('cats', array(
+ 'ID' => $row['id'],
+ 'CAT' => $row['category']
+ ));
}
// Get data from the database
@@ -84,9 +88,10 @@
$params = array();
$params[] = array(':faq_id', $_GET['id'], 'int');
$db->query($query, $params);
-while ($row = $db->fetch()) {
- $QUESTION_tr[$row['lang']] = $row['question'];
- $ANSWER_tr[$row['lang']] = $row['answer'];
+while ($row = $db->fetch())
+{
+ $QUESTION_tr[$row['lang']] = $row['question'];
+ $ANSWER_tr[$row['lang']] = $row['answer'];
}
$CKEditor = new CKEditor();
@@ -95,16 +100,18 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-foreach ($LANGUAGES as $lang_code) {
- $template->assign_block_vars('qs', array(
- 'LANG' => $lang_code,
- 'QUESTION' => (isset($_POST['question'][$lang_code])) ? $_POST['question'][$lang_code] : (isset($QUESTION_tr[$lang_code])? $QUESTION_tr[$lang_code] : '')
- ));
- $answer = (isset($_POST['answer'][$lang_code])) ? $_POST['answer'][$lang_code] : (isset($ANSWER_tr[$lang_code]) ? $ANSWER_tr[$lang_code] : '');
- $template->assign_block_vars('as', array(
- 'LANG' => $lang_code,
- 'ANSWER' => $CKEditor->editor('answer[' . $lang_code . ']', $answer)
- ));
+reset($LANGUAGES);
+foreach ($LANGUAGES as $k => $v)
+{
+ $template->assign_block_vars('qs', array(
+ 'LANG' => $k,
+ 'QUESTION' => (isset($_POST['question'][$k])) ? $_POST['question'][$k] : (isset($QUESTION_tr[$k])? $QUESTION_tr[$k] : '')
+ ));
+ $answer = (isset($_POST['answer'][$k])) ? $_POST['answer'][$k] : (isset($ANSWER_tr[$k]) ? $ANSWER_tr[$k] : '');
+ $template->assign_block_vars('as', array(
+ 'LANG' => $k,
+ 'ANSWER' => $CKEditor->editor('answer[' . $k . ']', $answer)
+ ));
}
// Get data from the database
@@ -115,15 +122,16 @@
$faq = $db->result();
$template->assign_vars(array(
- 'ID' => $faq['id'],
- 'FAQ_NAME' => $faq['question'],
- 'FAQ_CAT' => $faq['category']
- ));
+ 'ID' => $faq['id'],
+ 'FAQ_NAME' => $faq['question'],
+ 'FAQ_CAT' => $faq['category']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editfaq.tpl'
- ));
+ 'body' => 'editfaq.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editfaqscategory.php b/admin/editfaqscategory.php
old mode 100644
new mode 100755
index 9e7c8582d..84fd4c8e5
--- a/admin/editfaqscategory.php
+++ b/admin/editfaqscategory.php
@@ -1,6 +1,6 @@
SETTINGS['defaultlanguage']]) == 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_049));
- } else {
- $query = "UPDATE " . $DBPrefix . "faqscategories SET category = :category WHERE id = :id";
- $params = array();
- $params[] = array(':category', $system->cleanvars($_POST['category'][$system->SETTINGS['defaultlanguage']]), 'str');
- $params[] = array(':id', $_POST['id'], 'int');
- $db->query($query, $params);
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (strlen($_POST['category'][$system->SETTINGS['defaultlanguage']]) == 0)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_049));
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "faqscategories SET category = :category WHERE id = :id";
+ $params = array();
+ $params[] = array(':category', $system->cleanvars($_POST['category'][$system->SETTINGS['defaultlanguage']]), 'str');
+ $params[] = array(':id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ }
- foreach ($_POST['category'] as $k => $v) {
- $query = "SELECT category FROM " . $DBPrefix . "faqscat_translated WHERE lang = :lang AND id = :id";
- $params = array();
- $params[] = array(':lang', $k, 'str');
- $params[] = array(':id', $_POST['id'], 'str');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $query = "UPDATE " . $DBPrefix . "faqscat_translated SET
- category = :category
- WHERE lang = :lang AND id = :id";
- } else {
- $query = "INSERT INTO " . $DBPrefix . "faqscat_translated
- VALUES (:id, :lang, :category)";
- }
- $params = array();
- $params[] = array(':category', $system->cleanvars($_POST['category'][$k]), 'str');
- $params[] = array(':lang', $k, 'str');
- $params[] = array(':id', $_POST['id'], 'int');
- $db->query($query, $params);
- }
- header('location: faqscategories.php');
- exit;
+ foreach ($_POST['category'] as $k => $v)
+ {
+ $query = "SELECT category FROM " . $DBPrefix . "faqscat_translated WHERE lang = :lang AND id = :id";
+ $params = array();
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':id', $_POST['id'], 'str');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "faqscat_translated SET
+ category = :category
+ WHERE lang = :lang AND id = :id";
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "faqscat_translated
+ VALUES (:id, :lang, :category)";
+ }
+ $params = array();
+ $params[] = array(':category', $system->cleanvars($_POST['category'][$k]), 'str');
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ }
+ header('location: faqscategories.php');
+ exit;
}
$query = "SELECT * FROM " . $DBPrefix . "faqscat_translated WHERE id = :id";
@@ -66,26 +68,29 @@
// get all translations
$tr = array();
-while ($row = $db->fetch()) {
- $tr[$row['lang']] = $row['category'];
+while ($row = $db->fetch())
+{
+ $tr[$row['lang']] = $row['category'];
}
-foreach ($LANGUAGES as $k => $v) {
- $k = trim($k);
- $template->assign_block_vars('flangs', array(
- 'LANGUAGE' => $k,
- 'TRANSLATION' => isset($tr[$k])? $tr[$k] : ''
- ));
+foreach ($LANGUAGES as $k => $v)
+{
+ $k = trim($k);
+ $template->assign_block_vars('flangs', array(
+ 'LANGUAGE' => $k,
+ 'TRANSLATION' => isset($tr[$k])? $tr[$k] : ''
+ ));
}
$template->assign_vars(array(
- 'FAQ_NAME' => $tr[$system->SETTINGS['defaultlanguage']],
- 'ID' => $_GET['id']
- ));
+ 'FAQ_NAME' => $tr[$system->SETTINGS['defaultlanguage']],
+ 'ID' => $_GET['id']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editfaqscategory.tpl'
- ));
+ 'body' => 'editfaqscategory.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/editmessage.php b/admin/editmessage.php
old mode 100644
new mode 100755
index eaf962f52..29e9651a7
--- a/admin/editmessage.php
+++ b/admin/editmessage.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } else {
- $query = "UPDATE " . $DBPrefix . "comm_messages SET message = :message WHERE id = :id";
- $params = array();
- $params[] = array(':message', $system->cleanvars($_POST['message']), 'str');
- $params[] = array(':id', $_POST['msg'], 'int');
- $db->query($query, $params);
- header("Location: editmessages.php?id=" . $_POST['id']);
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (!isset($_POST['message']) || empty($_POST['message']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "comm_messages SET message = :message WHERE id = :id";
+ $params = array();
+ $params[] = array(':message', $system->cleanvars($_POST['message']), 'str');
+ $params[] = array(':id', $_POST['msg'], 'int');
+ $db->query($query, $params);
+ header("Location: editmessages.php?id=" . $_POST['id']);
+ exit;
+ }
}
// Retrieve board name for breadcrumbs
@@ -57,17 +55,18 @@
$data = $db->result();
$template->assign_vars(array(
- 'BOARD_NAME' => $board_name,
- 'MESSAGE' => nl2br((isset($_POST['message'])) ? $_POST['message'] : $data['message']),
- 'USER' => ($data['user'] > 0) ? $data['username'] : $MSG['5061'],
- 'POSTED' => $dt->formatDate($data['msgdate']),
- 'BOARD_ID' => $board_id,
- 'MSG_ID' => $msg
- ));
+ 'BOARD_NAME' => $board_name,
+ 'MESSAGE' => nl2br((isset($_POST['message'])) ? $_POST['message'] : $data['message']),
+ 'USER' => ($data['user'] > 0) ? $data['username'] : $MSG['5061'],
+ 'POSTED' => FormatDate($data['msgdate']),
+ 'BOARD_ID' => $board_id,
+ 'MSG_ID' => $msg
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editmessage.tpl'
- ));
+ 'body' => 'editmessage.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/editmessages.php b/admin/editmessages.php
old mode 100644
new mode 100755
index 6817be217..0e127adfc
--- a/admin/editmessages.php
+++ b/admin/editmessages.php
@@ -1,6 +1,6 @@
query($query, $params);
- // Update counter
- $query = "SELECT count(id) as COUNTER from " . $DBPrefix . "comm_messages WHERE boardid = :id";
- $db->query($query, $gparams);
- $message_count = $db->result('COUNTER');
- $query = "UPDATE " . $DBPrefix . "community SET messages = :message_count WHERE id = :id";
- $params = $gparams;
- $params[] = array(':message_count', $message_count, 'int');
- $db->query($query, $params);
- }
+if (isset($_POST['action']) && $_POST['action'] == 'purge')
+{
+ if (is_numeric($_POST['days']))
+ {
+ // Build date
+ $DATE = time() - $_POST['days'] * 3600 * 24;
+ $query = "DELETE FROM " . $DBPrefix . "comm_messages WHERE msgdate <= :msgdate AND boardid = :id";
+ $params = $gparams;
+ $params[] = array(':msgdate', $DATE, 'int');
+ $db->query($query, $params);
+ // Update counter
+ $query = "SELECT count(id) as COUNTER from " . $DBPrefix . "comm_messages WHERE boardid = :id";
+ $db->query($query, $gparams);
+ $message_count = $db->result('COUNTER');
+ $query = "UPDATE " . $DBPrefix . "community SET messages = :message_count WHERE id = :id";
+ $params = $gparams;
+ $params[] = array(':message_count', $message_count, 'int');
+ $db->query($query, $params);
+ }
}
-$_SESSION['RETURN_LIST'] = 'editmessages.php?id=' . $id;
-
// Retrieve board name for breadcrumbs
$query = "SELECT name FROM " . $DBPrefix . "community WHERE id = :id";
$db->query($query, $gparams);
@@ -56,24 +52,29 @@
$query = "SELECT * FROM " . $DBPrefix . "comm_messages WHERE boardid = :id";
$db->query($query, $gparams);
-while ($msg_data = $db->fetch()) {
- $template->assign_block_vars('msgs', array(
- 'ID' => $msg_data['id'],
- 'MESSAGE' => nl2br($msg_data['message']),
- 'POSTED_BY' => $msg_data['username'],
- 'POSTED_AT' => $dt->formatDate($msg_data['msgdate'])
- ));
+$bg = '';
+while ($msg_data = $db->fetch())
+{
+ $template->assign_block_vars('msgs', array(
+ 'ID' => $msg_data['id'],
+ 'MESSAGE' => nl2br($msg_data['message']),
+ 'POSTED_BY' => $msg_data['username'],
+ 'POSTED_AT' => FormatDate($msg_data['msgdate']),
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
$template->assign_vars(array(
- 'BOARD_NAME' => $board_name,
- 'ID' => $id
- ));
+ 'BOARD_NAME' => $board_name,
+ 'ID' => $id
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'editmessages.tpl'
- ));
+ 'body' => 'editmessages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/editnew.php b/admin/editnew.php
old mode 100644
new mode 100755
index bdd78bfee..7d991df03
--- a/admin/editnew.php
+++ b/admin/editnew.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- } else {
- // clean up everything
- $news_id = intval($_POST['id']);
- $query = "UPDATE " . $DBPrefix . "news SET
- title = :title,
- content = :content,
- suspended = :suspended
- WHERE id = :id";
- $params = array();
- $params[] = array(':title', $system->cleanvars($_POST['title'][$system->SETTINGS['defaultlanguage']]), 'str');
- $params[] = array(':content', $system->cleanvars($_POST['content'][$system->SETTINGS['defaultlanguage']], true), 'str');
- $params[] = array(':suspended', $_POST['suspended'], 'int');
- $params[] = array(':id', $news_id, 'int');
- $db->query($query, $params);
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Data check
+ if (empty($_POST['title']) || empty($_POST['content']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
+ else
+ {
+ // clean up everything
+ foreach ($_POST['title'] as $k => $v)
+ {
+ $_POST['title'][$k] = $system->cleanvars($v);
+ $_POST['content'][$k] = $system->cleanvars($_POST['content'][$k], true);
+ }
- foreach ($LANGUAGES as $k => $v) {
- $query = "SELECT id FROM " . $DBPrefix . "news_translated WHERE lang = :lang AND id = :news_id";
- $params = array();
- $params[] = array(':lang', $k, 'str');
- $params[] = array(':news_id', $news_id, 'int');
- $db->query($query, $params);
+ $news_id = intval($_POST['id']);
+ $query = "UPDATE " . $DBPrefix . "news SET
+ title = :title,
+ content = :content,
+ suspended = :suspended
+ WHERE id = :id";
+ $params = array();
+ $params[] = array(':title', $_POST['title'][$system->SETTINGS['defaultlanguage']], 'str');
+ $params[] = array(':content', $_POST['content'][$system->SETTINGS['defaultlanguage']], 'str');
+ $params[] = array(':suspended', $_POST['suspended'], 'int');
+ $params[] = array(':id', $news_id, 'int');
+ $db->query($query, $params);
- if ($db->numrows() > 0) {
- $query = "UPDATE " . $DBPrefix . "news_translated SET
- title = :title,
- content = :content
- WHERE lang = :lang AND id = :news_id";
- } else {
- $query = "INSERT INTO " . $DBPrefix . "news_translated VALUES
- (:news_id, :lang, :title, :content)";
- }
- $params = array();
- $params[] = array(':title', $system->cleanvars($_POST['title'][$k]), 'str');
- $params[] = array(':content', $system->cleanvars($_POST['content'][$k], true), 'str');
- $params[] = array(':lang', $k, 'str');
- $params[] = array(':news_id', $news_id, 'int');
- $db->query($query, $params);
- }
- header('location: news.php');
- exit;
- }
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $query = "SELECT id FROM " . $DBPrefix . "news_translated WHERE lang = :lang AND id = :news_id";
+ $params = array();
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':news_id', $news_id, 'int');
+ $db->query($query, $params);
+
+ if ($db->numrows() > 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "news_translated SET
+ title = :title,
+ content = :content
+ WHERE lang = :lang AND id = :news_id";
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "news_translated VALUES
+ (:news_id, :lang, :title, :content)";
+ }
+ $params = array();
+ $params[] = array(':title', $_POST['title'][$k], 'str');
+ $params[] = array(':content', $_POST['content'][$k], 'str');
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':news_id', $news_id, 'int');
+ $db->query($query, $params);
+ }
+ header('location: news.php');
+ exit;
+ }
}
// get news story
$query = "SELECT t.*, n.suspended FROM " . $DBPrefix . "news_translated t
- LEFT JOIN " . $DBPrefix . "news n ON (n.id = t.id) WHERE t.id = :id";
+ LEFT JOIN " . $DBPrefix . "news n ON (n.id = t.id) WHERE t.id = :id";
$params = array();
$params[] = array(':id', $_GET['id'], 'int');
$db->query($query, $params);
@@ -84,29 +99,33 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-while ($arr = $db->fetch()) {
- $suspended = $arr['suspended'];
- $template->assign_block_vars('lang', array(
- 'LANG' => $arr['lang'],
- 'TITLE' => $arr['title'],
- 'CONTENT' => $CKEditor->editor('content[' . $arr['lang'] . ']', $arr['content'])
- ));
+$CONT_tr = array();
+$TIT_tr = array();
+while ($arr = $db->fetch())
+{
+ $suspended = $arr['suspended'];
+ $template->assign_block_vars('lang', array(
+ 'LANG' => $arr['lang'],
+ 'TITLE' => $arr['title'],
+ 'CONTENT' => $CKEditor->editor('content[' . $arr['lang'] . ']', $arr['content'])
+ ));
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TITLE' => $MSG['edit_news'],
- 'BUTTON' => $MSG['530'],
- 'ID' => intval($_GET['id']),
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TITLE' => $MSG['343'],
+ 'BUTTON' => $MSG['530'],
+ 'ID' => intval($_GET['id']),
- 'B_ACTIVE' => ((isset($suspended) && $suspended == 0) || !isset($suspended)),
- 'B_INACTIVE' => (isset($suspended) && $suspended == 1),
- ));
+ 'B_ACTIVE' => ((isset($suspended) && $suspended == 0) || !isset($suspended)),
+ 'B_INACTIVE' => (isset($suspended) && $suspended == 1),
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'addnew.tpl'
- ));
+ 'body' => 'addnew.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/edituser.php b/admin/edituser.php
old mode 100644
new mode 100755
index d7aed09cd..f4171a230
--- a/admin/edituser.php
+++ b/admin/edituser.php
@@ -1,6 +1,6 @@
query($query, $params);
$user_data = $db->result();
-if ($user_data['birthdate'] != 0) {
- $birth_day = substr($user_data['birthdate'], 6, 2);
- $birth_month = substr($user_data['birthdate'], 4, 2);
- $birth_year = substr($user_data['birthdate'], 0, 4);
-
- if ($system->SETTINGS['datesformat'] == 'USA') {
- $birthdate = $birth_month . '/' . $birth_day . '/' . $birth_year;
- } else {
- $birthdate = $birth_day . '/' . $birth_month . '/' . $birth_year;
- }
-} else {
- $birthdate = '';
+if ($user_data['birthdate'] != 0)
+{
+ $birth_day = substr($user_data['birthdate'], 6, 2);
+ $birth_month = substr($user_data['birthdate'], 4, 2);
+ $birth_year = substr($user_data['birthdate'], 0, 4);
+
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $birthdate = $birth_month . '/' . $birth_day . '/' . $birth_year;
+ }
+ else
+ {
+ $birthdate = $birth_day . '/' . $birth_month . '/' . $birth_year;
+ }
+}
+else
+{
+ $birthdate = '';
}
// Retrieve users signup settings
$MANDATORY_FIELDS = unserialize($system->SETTINGS['mandatory_fields']);
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- if (strlen($_POST['name']) > 0 && strlen($_POST['email']) > 0) {
- if (!empty($_POST['birthdate'])) {
- $DATE = explode('/', $_POST['birthdate']);
- if ($system->SETTINGS['datesformat'] == 'USA') {
- $birth_day = $DATE[1];
- $birth_month = $DATE[0];
- $birth_year = $DATE[2];
- } else {
- $birth_day = $DATE[0];
- $birth_month = $DATE[1];
- $birth_year = $DATE[2];
- }
-
- if (strlen($birth_year) == 2) {
- $birth_year = '19' . $birth_year;
- }
- }
-
- if (isset($_POST['balance'])) {
- $balance_clean = str_replace('-', '', $_POST['balance']);
- }
-
- if (strlen($_POST['password']) > 0 && ($_POST['password'] != $_POST['repeat_password'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
- } elseif (strlen($_POST['email']) < 5) { //Primitive mail check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5033));
- } elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
- } elseif (!preg_match('/^([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})$/', $_POST['birthdate']) && $MANDATORY_FIELDS['birthdate'] == 'y') { //Birthdate check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
- } elseif (strlen($_POST['zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y') { //Primitive zip check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_616));
- } elseif (strlen($_POST['phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y') { //Primitive phone check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_617));
- } elseif (empty($_POST['address']) && $MANDATORY_FIELDS['address'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5034));
- } elseif (empty($_POST['city']) && $MANDATORY_FIELDS['city'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5035));
- } elseif (empty($_POST['prov']) && $MANDATORY_FIELDS['prov'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5036));
- } elseif (empty($_POST['country']) && $MANDATORY_FIELDS['country'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5037));
- } elseif (empty($_POST['group'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_044));
- } elseif (!$system->CheckMoney($balance_clean)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_081));
- } else {
- if (!empty($_POST['birthdate'])) {
- $birthdate = $birth_year . $birth_month . $birth_day;
- } else {
- $birthdate = 0;
- }
-
- $query = "UPDATE " . $DBPrefix . "users SET
- name = :name,
- email = :email,
- address = :address,
- city = :city,
- prov = :prov,
- country = :country,
- zip = :zip,
- phone = :phone,
- birthdate = :birthdate,
- groups = :groups,
- balance = :balance";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
- $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
- $params[] = array(':birthdate', $birthdate, 'int');
- $params[] = array(':address', $system->cleanvars($_POST['address']), 'str');
- $params[] = array(':city', $system->cleanvars($_POST['city']), 'str');
- $params[] = array(':prov', $system->cleanvars($_POST['prov']), 'str');
- $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
- $params[] = array(':zip', $system->cleanvars($_POST['zip']), 'str');
- $params[] = array(':phone', $system->cleanvars($_POST['phone']), 'str');
- $params[] = array(':groups', implode(',', $_POST['group']), 'str');
- $params[] = array(':balance', $system->input_money($_POST['balance']), 'float');
- if (strlen($_POST['password']) > 0) {
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query .= ", password = :password";
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
- }
- if ($system->SETTINGS['fee_disable_acc'] == 'y' && $user_data['suspended'] != 8 && $user_data['suspended'] != 1) {
- // process balance positive and negative allowed and compare to max allowed credit before it is marked/unmarked as suspendeds
- if ($_POST['balance'] >= -$system->SETTINGS['fee_max_debt']) {
- $query .= ", suspended = 0";
- } elseif ($_POST['balance'] < -$system->SETTINGS['fee_max_debt']) {
- $query .= ", suspended = 7";
- }
- }
-
- $query .= " WHERE id = :user_id";
- $params[] = array(':user_id', $userid, 'int');
- $db->query($query, $params);
-
- header('location: listusers.php?PAGE=' . intval($_POST['offset']));
- exit;
- }
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if ($_POST['name'] && $_POST['email'])
+ {
+ if (!empty($_POST['birthdate']))
+ {
+ $DATE = explode('/', $_POST['birthdate']);
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $birth_day = $DATE[1];
+ $birth_month = $DATE[0];
+ $birth_year = $DATE[2];
+ }
+ else
+ {
+ $birth_day = $DATE[0];
+ $birth_month = $DATE[1];
+ $birth_year = $DATE[2];
+ }
+
+ if (strlen($birth_year) == 2)
+ {
+ $birth_year = '19' . $birth_year;
+ }
+ }
+
+ if (isset($_POST['balance']))
+ {
+ $balance_clean = str_replace('-', '', $_POST['balance']);
+ }
+
+ if (strlen($_POST['password']) > 0 && ($_POST['password'] != $_POST['repeat_password']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
+ }
+ elseif (strlen($_POST['email']) < 5) //Primitive mail check
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5033));
+ }
+ elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
+ }
+ elseif (!preg_match('/^([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})$/', $_POST['birthdate']) && $MANDATORY_FIELDS['birthdate'] == 'y')
+ { //Birthdate check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
+ }
+ elseif (strlen($_POST['zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y')
+ { //Primitive zip check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_616));
+ }
+ elseif (strlen($_POST['phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y')
+ { //Primitive phone check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_617));
+ }
+ elseif (empty($_POST['address']) && $MANDATORY_FIELDS['address'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5034));
+ }
+ elseif (empty($_POST['city']) && $MANDATORY_FIELDS['city'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5035));
+ }
+ elseif (empty($_POST['prov']) && $MANDATORY_FIELDS['prov'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5036));
+ }
+ elseif (empty($_POST['country']) && $MANDATORY_FIELDS['country'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5037));
+ }
+ elseif (empty($_POST['group']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_044));
+ }
+ elseif (empty($_POST['balance']) && $system->SETTINGS['moneydecimals'] != 0)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
+ elseif (!$system->CheckMoney($balance_clean))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_081));
+ }
+ else
+ {
+ if (!empty($_POST['birthdate']))
+ {
+ $birthdate = $birth_year . $birth_month . $birth_day;
+ }
+ else
+ {
+ $birthdate = 0;
+ }
+
+ $query = "UPDATE " . $DBPrefix . "users SET
+ name = :name,
+ email = :email,
+ address = :address,
+ city = :city,
+ prov = :prov,
+ country = :country,
+ zip = :zip,
+ phone = :phone,
+ birthdate = :birthdate,
+ groups = :groups,
+ balance = :balance";
+ $params = array();
+ $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
+ $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
+ $params[] = array(':birthdate', $birthdate, 'int');
+ $params[] = array(':address', $system->cleanvars($_POST['address']), 'str');
+ $params[] = array(':city', $system->cleanvars($_POST['city']), 'str');
+ $params[] = array(':prov', $system->cleanvars($_POST['prov']), 'str');
+ $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
+ $params[] = array(':zip', $system->cleanvars($_POST['zip']), 'str');
+ $params[] = array(':phone', $system->cleanvars($_POST['phone']), 'str');
+ $params[] = array(':groups', implode(',', $_POST['group']), 'str');
+ $params[] = array(':balance', $system->input_money($_POST['balance']), 'float');
+ if (strlen($_POST['password']) > 0)
+ {
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query .= ", password = :password";
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
+ }
+ if ($system->SETTINGS['fee_disable_acc'] == 'y' && $user_data['suspended'] != 8 && $user_data['suspended'] != 1)
+ {
+ // process balance positive and negative allowed and compare to max allowed credit before it is marked/unmarked as suspendeds
+ if ($_POST['balance'] >= -$system->SETTINGS['fee_max_debt'])
+ {
+ $query .= ", suspended = 0";
+ }
+ elseif ($_POST['balance'] < -$system->SETTINGS['fee_max_debt'])
+ {
+ $query .= ", suspended = 7";
+ }
+ }
+
+ $query .= " WHERE id = :user_id";
+ $params[] = array(':user_id', $userid, 'int');
+ $db->query($query, $params);
+
+ header('location: listusers.php?PAGE=' . intval($_POST['offset']));
+ exit;
+ }
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
}
$query = "SELECT country_id, country FROM " . $DBPrefix . "countries";
$db->direct_query($query);
-while ($country = $db->fetch()) {
- $template->assign_block_vars('countries', array(
- 'COUNTRY' => $country['country'],
- 'B_SELECTED' => ($country['country'] == $user_data['country'])
- ));
+$countries = $db->fetchall();
+$country_list = '';
+
+foreach($countries as $country)
+{
+ $country_list .= ' ' . "\n";
}
$query = "SELECT id, group_name FROM ". $DBPrefix . "groups";
$db->direct_query($query);
+$usergroups = '';
$groups = explode(',', $user_data['groups']);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('usergroups', array(
- 'ID' => $row['id'],
- 'NAME' => $row['group_name'],
- 'B_SELECTED' => (in_array($row['id'], $groups))
- ));
+while ($row = $db->fetch())
+{
+ $member = (in_array($row['id'], $groups)) ? ' checked' : '';
+ $usergroups .= ' ' . $row['group_name'] . '
';
}
$template->assign_vars(array(
- 'REALNAME' => $user_data['name'],
- 'USERNAME' => $user_data['nick'],
- 'EMAIL' => $user_data['email'],
- 'ADDRESS' => $user_data['address'],
- 'CITY' => $user_data['city'],
- 'PROV' => $user_data['prov'],
- 'ZIP' => $user_data['zip'],
- 'COUNTRY' => $user_data['country'],
- 'PHONE' => $user_data['phone'],
- 'BALANCE' => $system->print_money_nosymbol($user_data['balance']),
- 'DOB' => $birthdate,
- 'ID' => $userid,
- 'OFFSET' => $_GET['offset'],
- 'REQUIRED' => array(
- ($MANDATORY_FIELDS['birthdate'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['address'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['city'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['prov'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['country'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['zip'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['tel'] == 'y') ? ' *' : ''
- )
- ));
+ 'REALNAME' => $user_data['name'],
+ 'USERNAME' => $user_data['nick'],
+ 'EMAIL' => $user_data['email'],
+ 'ADDRESS' => $user_data['address'],
+ 'CITY' => $user_data['city'],
+ 'PROV' => $user_data['prov'],
+ 'ZIP' => $user_data['zip'],
+ 'COUNTRY' => $user_data['country'],
+ 'PHONE' => $user_data['phone'],
+ 'BALANCE' => $system->print_money_nosymbol($user_data['balance']),
+ 'DOB' => $birthdate,
+ 'COUNTRY_LIST' => $country_list,
+ 'ID' => $userid,
+ 'OFFSET' => $_GET['offset'],
+ 'USERGROUPS' => $usergroups,
+ 'REQUIRED' => array(
+ ($MANDATORY_FIELDS['birthdate'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['address'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['city'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['prov'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['country'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['zip'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['tel'] == 'y') ? ' *' : ''
+ )
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'edituser.tpl'
- ));
+ 'body' => 'edituser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/edituserfeed.php b/admin/edituserfeed.php
old mode 100644
new mode 100755
index 84af5b9a9..efd0c1163
--- a/admin/edituserfeed.php
+++ b/admin/edituserfeed.php
@@ -1,6 +1,6 @@
query($query, $params);
-
- // Update user's record
- $query = "SELECT SUM(rate) as FSUM, count(feedback) as FNUM FROM " . $DBPrefix . "feedbacks
- WHERE rated_user_id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user, 'int');
- $db->query($query, $params);
- $SUM = $db->result('FSUM');
- $NUM = $db->result('FNUM');
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $user = intval($_POST['user']);
+ $query = "UPDATE " . $DBPrefix . "feedbacks SET
+ rate = :rate,
+ feedback = :feedback
+ WHERE id = :feedback_id";
+ $params = array();
+ $params[] = array(':rate', $_POST['aTPL_rate'], 'int');
+ $params[] = array(':feedback', $_POST['TPL_feedback'], 'str');
+ $params[] = array(':feedback_id', $id, 'int');
+ $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "users SET rate_sum = :SUM, rate_num = :NUM WHERE id = :user_id";
- $params = array();
- $params[] = array(':SUM', $SUM, 'int');
- $params[] = array(':NUM', $NUM, 'int');
- $params[] = array(':user_id', $user, 'int');
- $db->query($query, $params);
+ // Update user's record
+ $query = "SELECT SUM(rate) as FSUM, count(feedback) as FNUM FROM " . $DBPrefix . "feedbacks
+ WHERE rated_user_id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user, 'int');
+ $db->query($query, $params);
+ $SUM = $db->result('FSUM');
+ $NUM = $db->result('FNUM');
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['183']));
+ $query = "UPDATE " . $DBPrefix . "users SET rate_sum = :SUM, rate_num = :NUM WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':SUM', $SUM, 'int');
+ $params[] = array(':NUM', $NUM, 'int');
+ $params[] = array(':user_id', $user, 'int');
+ $db->query($query, $params);
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['183']));
}
$query = "SELECT u.nick, u.id, f.rater_user_nick, f.feedback, f.rate FROM " . $DBPrefix . "feedbacks f
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = f.rated_user_id) WHERE f.id = :feedback_id";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = f.rated_user_id) WHERE f.id = :feedback_id";
$params = array();
$params[] = array(':feedback_id', $id, 'int');
$db->query($query, $params);
@@ -66,18 +61,19 @@
$feedback = $db->result();
$template->assign_vars(array(
- 'RATED_USER' => $feedback['nick'],
- 'RATED_USER_ID' => $feedback['id'],
- 'RATER_USER' => $feedback['rater_user_nick'],
- 'FEEDBACK' => $feedback['feedback'],
- 'SEL1' => ($feedback['rate'] == 1),
- 'SEL2' => ($feedback['rate'] == 0),
- 'SEL3' => ($feedback['rate'] == -1)
- ));
+ 'RATED_USER' => $feedback['nick'],
+ 'RATED_USER_ID' => $feedback['id'],
+ 'RATER_USER' => $feedback['rater_user_nick'],
+ 'FEEDBACK' => $feedback['feedback'],
+ 'SEL1' => ($feedback['rate'] == 1),
+ 'SEL2' => ($feedback['rate'] == 0),
+ 'SEL3' => ($feedback['rate'] == -1)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'edituserfeed.tpl'
- ));
+ 'body' => 'edituserfeed.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/emailsettings.php b/admin/emailsettings.php
old mode 100644
new mode 100755
index d1575bcf4..a3cfd9fe2
--- a/admin/emailsettings.php
+++ b/admin/emailsettings.php
@@ -1,6 +1,6 @@
'WEBID MAIL', '1' => 'MAIL', '2' => 'SMTP', '4' => 'SENDMAIL', '5'=> 'QMAIL', '3' => 'NEVER SEND EMAILS (may be useful for testing purposes)');
$smtp_secure_options =array('none' => 'None', 'tls' => 'TLS', 'ssl' => 'SSL');
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- // checks
- if (intval($_POST['mail_protocol']) == 2) {
- if (empty($_POST['smtp_host']) || empty($_POST['smtp_username']) || empty($_POST['smtp_password']) || empty($_POST['smtp_port']) || intval($_POST['smtp_port']) <= 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_missing_SMTP_settings']));
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // checks
+ if (intval($_POST['mail_protocol']) == 2)
+ {
+ if (empty($_POST['smtp_host']) || empty($_POST['smtp_username']) || empty($_POST['smtp_password']) || empty($_POST['smtp_port']) || intval($_POST['smtp_port']) <= 0 )
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['1132']));
+ }
+ }
- if (array_key_exists(intval($_POST['mail_protocol']), $mail_protocol)) {
- if (intval($_POST['mail_protocol']) !== 2) {
- $system->writesetting("mail_protocol", $_POST['mail_protocol'], 'int');
- $system->writesetting("mail_parameter", $_POST['mail_parameter'], 'str');
- $system->writesetting("alert_emails", $_POST['alert_emails'], 'str');
- } else {
- $system->writesetting("mail_protocol", 2, 'int');
- $system->writesetting("smtp_authentication", $_POST['smtp_authentication'], 'str');
- $system->writesetting("smtp_security", $_POST['smtp_security'], 'str');
- $system->writesetting("smtp_port", (!empty($_POST['smtp_port']) && is_numeric($_POST['smtp_port']))? (int)($_POST['smtp_port']) : '', 'int');
- $system->writesetting("smtp_username", (!empty($_POST['smtp_username'])? $_POST['smtp_username'] : ''), 'str');
- $system->writesetting("smtp_password", (!empty($_POST['smtp_password'])? $_POST['smtp_password'] : ''), 'str');
- $system->writesetting("smtp_host", (!empty($_POST['smtp_host'])? $_POST['smtp_host'] : ''), 'str');
- $system->writesetting("smtp_emails", $_POST['alert_emails'], 'str');
- }
- $INFO = $MSG['email_settings_updated'];
- }
+ if (array_key_exists(intval($_POST['mail_protocol']), $mail_protocol))
+ {
+ if (intval($_POST['mail_protocol']) !== 2)
+ {
+ $system->writesetting("mail_protocol", $_POST['mail_protocol'], 'int');
+ $system->writesetting("mail_parameter", $_POST['mail_parameter'], 'str');
+ $system->writesetting("alert_emails", $_POST['alert_emails'], 'str');
+ }
+ else
+ {
+ $system->writesetting("mail_protocol", 2, 'int');
+ $system->writesetting("smtp_authentication", $_POST['smtp_authentication'], 'str');
+ $system->writesetting("smtp_security", $_POST['smtp_security'], 'str');
+ $system->writesetting("smtp_port",(!empty($_POST['smtp_port']) && is_numeric($_POST['smtp_port']))? (int)($_POST['smtp_port']) : '', 'int');
+ $system->writesetting("smtp_username", (!empty($_POST['smtp_username'])? $_POST['smtp_username'] : ''), 'str');
+ $system->writesetting("smtp_password", (!empty($_POST['smtp_password'])? $_POST['smtp_password'] : ''), 'str');
+ $system->writesetting("smtp_host", (!empty($_POST['smtp_host'])? $_POST['smtp_host'] : ''), 'str');
+ $system->writesetting("smtp_emails", $_POST['alert_emails'], 'str');
+ }
+ $INFO = $MSG['email_settings_updated'];
+ }
}
$selectsetting = isset($system->SETTINGS['mail_protocol'])? $system->SETTINGS['mail_protocol'] : '0';
-loadblock($MSG['mail_protocol'], '', generateSelect('mail_protocol', $mail_protocol));
-loadblock($MSG['mail_parameters'], '' . $MSG['mail_parameters_explain'], 'text', 'mail_parameter', $system->SETTINGS['mail_parameter']);
-loadblock($MSG['SMTP_settings'] .' ' . $MSG['SMTP_settings_explain'], '', '', '', '', array(), true);
-loadblock($MSG['SMTP_authentication'], ' ', 'yesno', 'smtp_authentication', $system->SETTINGS['smtp_authentication'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['1119'], '', generateSelect('mail_protocol', $mail_protocol));
+loadblock($MSG['1120'] , '' . $MSG['1121'], 'text', 'mail_parameter', $system->SETTINGS['mail_parameter']);
+loadblock($MSG['1133'] .' ' . $MSG['1141'], '', '', '', '', array(), true);
+loadblock($MSG['1128'], ' ', 'yesno', 'smtp_authentication', $system->SETTINGS['smtp_authentication'], array($MSG['030'], $MSG['029']));
$selectsetting = isset($system->SETTINGS['smtp_security'])? $system->SETTINGS['smtp_security'] : 'none';
-loadblock($MSG['SMTP_security'], ' ', generateSelect('smtp_security', $smtp_secure_options));
-loadblock($MSG['SMTP_port'], ' ', 'text', 'smtp_port', $system->SETTINGS['smtp_port']);
-loadblock($MSG['SMTP_username'], ' ', 'text', 'smtp_username', $system->SETTINGS['smtp_username']);
-loadblock($MSG['SMTP_password'], ' ', 'text', 'smtp_password', $system->SETTINGS['smtp_password']);
-loadblock($MSG['SMTP_host'], ' ' . $MSG['SMTP_host_explain'], 'text', 'smtp_host', $system->SETTINGS['smtp_host']);
-loadblock($MSG['other_admin_emails'], sprintf($MSG['other_admin_emails_explain'], $system->SETTINGS['adminmail']), 'text', 'alert_emails', $system->SETTINGS['alert_emails']);
+loadblock($MSG['1127'] , ' ', generateSelect('smtp_security', $smtp_secure_options));
+loadblock($MSG['1126'] , ' ', 'text', 'smtp_port', $system->SETTINGS['smtp_port']);
+loadblock($MSG['1124'], ' ', 'text', 'smtp_username', $system->SETTINGS['smtp_username']);
+loadblock($MSG['1125'] , ' ', 'text', 'smtp_password', $system->SETTINGS['smtp_password']);
+loadblock($MSG['1122'] , ' ', 'text', 'smtp_host', $system->SETTINGS['smtp_host']);
+loadblock($MSG['1129'] , sprintf($MSG['1130'], $system->SETTINGS['adminmail']), 'text', 'alert_emails', $system->SETTINGS['alert_emails']);
+
+$mail_info2 = '';
// send test email
-if (isset($_GET['test_email'])) {
- $user_name = filter_var($_POST["user_name"], FILTER_SANITIZE_STRING);
- $to_email = filter_var($_POST["user_email"], FILTER_SANITIZE_EMAIL);
- $subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING);
- $message = filter_var($_POST["message"], FILTER_SANITIZE_STRING);
+if (isset($_GET['test_email']))
+{
+ $user_name = filter_var($_POST["user_name"], FILTER_SANITIZE_STRING);
+ $to_email = filter_var($_POST["user_email"], FILTER_SANITIZE_EMAIL);
+ $subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING);
+ $message = filter_var($_POST["message"], FILTER_SANITIZE_STRING);
- $emailer = new email_handler();
- $send_mail = $emailer->email_basic($subject, $to_email, $message);
- // responce to jquery - $send_mail will have any errors found already imploded
- if($send_mail) {
- $output = json_encode(array('type'=>'error', 'text' => sprintf($MSG['email_sending_failure'], $send_mail)));
- die($output);
- }else{
- $output = json_encode(array('type'=>'message', 'text' => $MSG['email_sending_success']));
- die($output);
- }
+ $emailer = new email_handler();
+ $emailer->email_basic($subject, $to_email, $message);
+ die();
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['524'],
- 'PAGENAME' => $MSG['email_settings'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['524'],
+ 'PAGENAME' => $MSG['1131'],
- 'MAIL_PROTOCOL' => $mail_protocol[$system->SETTINGS['mail_protocol']],
- 'SMTP_AUTH' => $system->SETTINGS['smtp_authentication'],
- 'SMTP_SEC' => $system->SETTINGS['smtp_security'],
- 'SMTP_PORT' => (!empty($system->SETTINGS['smtp_port']) && is_numeric($system->SETTINGS['smtp_port'])) ? $system->SETTINGS['smtp_port'] : 25,
- 'SMTP_USER' => $system->SETTINGS['smtp_username'],
- 'SMTP_PASS' => $system->SETTINGS['smtp_password'],
- 'SMTP_HOST' => $system->SETTINGS['smtp_host'],
- 'ALERT_EMAILS' => $system->SETTINGS['alert_emails'],
- 'ADMIN_EMAIL' => $system->SETTINGS['adminmail'],
- ));
+ 'MAIL_PROTOCOL' => $mail_protocol[$system->SETTINGS['mail_protocol']],
+ 'SMTP_AUTH' => $system->SETTINGS['smtp_authentication'],
+ 'SMTP_SEC' => $system->SETTINGS['smtp_security'],
+ 'SMTP_PORT' => (!empty($system->SETTINGS['smtp_port']) && is_numeric($system->SETTINGS['smtp_port'])) ? $system->SETTINGS['smtp_port'] : 25,
+ 'SMTP_USER' => $system->SETTINGS['smtp_username'],
+ 'SMTP_PASS' => $system->SETTINGS['smtp_password'],
+ 'SMTP_HOST' => $system->SETTINGS['smtp_host'],
+ 'ALERT_EMAILS' => $system->SETTINGS['alert_emails'],
+ 'ADMIN_EMAIL' => $system->SETTINGS['adminmail'],
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'emailsettings.tpl'
- ));
+ 'body' => 'emailsettings.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/enablefees.php b/admin/enablefees.php
old mode 100644
new mode 100755
index daba4b1ee..97d0b43ab
--- a/admin/enablefees.php
+++ b/admin/enablefees.php
@@ -1,6 +1,6 @@
SETTINGS['fee_max_debt'] < $_POST['fee_max_debt']) {
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE suspended = 7 AND balance > :fee_max_debt";
- $params = array();
- $params[] = array(':fee_max_debt', $_POST['fee_max_debt'], 'int');
- $db->query($query, $params);
- }
- // Update database
- $system->writesetting("fees", $_POST['fees'], "str");
- $system->writesetting("fee_type", $_POST['fee_type'], "int");
- $system->writesetting("fee_max_debt", $system->input_money($_POST['fee_max_debt']), "float");
- $system->writesetting("fee_signup_bonus", $system->input_money($_POST['fee_signup_bonus']), "float");
- $system->writesetting("fee_disable_acc", $_POST['fee_disable_acc'], "str");
- $system->writesetting("payment_gateway_sandbox", $_POST['payment_gateway_sandbox'], "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['fee_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // update users
+ if ($system->SETTINGS['fee_max_debt'] < $_POST['fee_max_debt'])
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE suspended = 7 AND balance > :fee_max_debt";
+ $params = array();
+ $params[] = array(':fee_max_debt', $_POST['fee_max_debt'], 'int');
+ $db->query($query, $params);
+ }
+ // Update database
+ $system->writesetting("fees", $_POST['fees'], "str");
+ $system->writesetting("fee_type", $_POST['fee_type'], "int");
+ $system->writesetting("fee_max_debt", $system->input_money($_POST['fee_max_debt']), "float");
+ $system->writesetting("fee_signup_bonus", $system->input_money($_POST['fee_signup_bonus']), "float");
+ $system->writesetting("fee_disable_acc", $_POST['fee_disable_acc'], "str");
+ $system->writesetting("payment_gateway_sandbox", $_POST['payment_gateway_sandbox'], "str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['761']));
}
-loadblock($MSG['enable_fees'], $MSG['enable_fees_explain'], 'yesno', 'fees', $system->SETTINGS['fees'], array($MSG['759'], $MSG['760']));
-loadblock($MSG['set_payment_type'], $MSG['set_payment_type_explain'], 'batchstacked', 'fee_type', $system->SETTINGS['fee_type'], array($MSG['balance_mode'], $MSG['live_payments']));
+loadblock($MSG['395'], $MSG['397'], 'yesno', 'fees', $system->SETTINGS['fees'], array($MSG['759'], $MSG['760']));
+loadblock($MSG['729'], $MSG['730'], 'batchstacked', 'fee_type', $system->SETTINGS['fee_type'], array($MSG['731'], $MSG['732']));
-loadblock($MSG['payment_sandbox'], $MSG['payment_sandbox_explain'], 'bool', 'payment_gateway_sandbox', $system->SETTINGS['payment_gateway_sandbox'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['1155'], $MSG['1154'], 'bool', 'payment_gateway_sandbox', $system->SETTINGS['payment_gateway_sandbox'], array($MSG['030'], $MSG['029']));
-loadblock($MSG['balance_mode_settings'], '', '', '', '', array(), true);
-loadblock($MSG['max_debt'], $MSG['max_debt_explain'], 'days', 'fee_max_debt', $system->SETTINGS['fee_max_debt']);
-loadblock($MSG['signup_credit'], $MSG['signup_credit_explain'], 'days', 'fee_signup_bonus', $system->SETTINGS['fee_signup_bonus']);
-loadblock($MSG['suspend_debt_accounts'], $MSG['suspend_debt_accounts_explain'], 'yesno', 'fee_disable_acc', $system->SETTINGS['fee_disable_acc'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['733'], '', '', '', '', array(), true);
+loadblock($MSG['734'], $MSG['735'], 'days', 'fee_max_debt', $system->SETTINGS['fee_max_debt']);
+loadblock($MSG['736'], $MSG['737'], 'days', 'fee_signup_bonus', $system->SETTINGS['fee_signup_bonus']);
+loadblock($MSG['738'], $MSG['739'], 'yesno', 'fee_disable_acc', $system->SETTINGS['fee_disable_acc'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0012'],
- 'PAGENAME' => $MSG['enable_fees'],
- 'B_TITLES' => true
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0012'],
+ 'PAGENAME' => $MSG['395'],
+ 'B_TITLES' => true
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/errorhandling.php b/admin/errorhandling.php
old mode 100644
new mode 100755
index cd9e1e8d9..f6ed44333
--- a/admin/errorhandling.php
+++ b/admin/errorhandling.php
@@ -1,6 +1,6 @@
writesetting("errortext", $system->cleanvars($_POST['errortext'], true), "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['error_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("errortext", $system->cleanvars($_POST['errortext'], true), "str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['413']));
}
$CKEditor = new CKEditor();
@@ -32,17 +33,18 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-loadblock($MSG['error_text'], $MSG['error_text_explain'], $CKEditor->editor('errortext', $system->SETTINGS['errortext']));
+loadblock($MSG['411'], $MSG['410'], $CKEditor->editor('errortext', $system->SETTINGS['errortext']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['error_handling']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['409']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/errorlog.php b/admin/errorlog.php
old mode 100644
new mode 100755
index 684230a15..369e74247
--- a/admin/errorlog.php
+++ b/admin/errorlog.php
@@ -1,6 +1,6 @@
direct_query($query);
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['error_log_purged']));
+if (isset($_POST['action']) && $_POST['action'] == 'clearlog')
+{
+ $query = "DELETE FROM " . $DBPrefix . "logs WHERE type = 'error'";
+ $db->direct_query($query);
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['889']));
}
$data = '';
-if ($type == 'distinct') {
- $query = "SELECT DISTINCT(message) FROM " . $DBPrefix . "logs WHERE type = 'error'";
- $db->direct_query($query);
- while ($row = $db->fetch()) {
- $data .= $row['message'] . ' ';
- }
-} else {
- $query = "SELECT * FROM " . $DBPrefix . "logs WHERE type = 'error'";
- $db->direct_query($query);
- while ($row = $db->fetch()) {
- $data .= '' . $dt->printDateTz($row['timestamp']) . ' : ' . $row['message'] . ' ';
- }
+if ($type == 'distinct')
+{
+ $query = "SELECT DISTINCT(message) FROM " . $DBPrefix . "logs WHERE type = 'error'";
+ $db->direct_query($query);
+ while ($row = $db->fetch())
+ {
+ $data .= $row['message'] . ' ';
+ }
+}
+else
+{
+ $query = "SELECT * FROM " . $DBPrefix . "logs WHERE type = 'error'";
+ $db->direct_query($query);
+ while ($row = $db->fetch())
+ {
+ $data .= '' . date('d-m-Y, H:i:s', $row['timestamp'] + $system->tdiff) . ' : ' . $row['message'] . ' ';
+ }
}
-if ($data == '') {
- $data = $MSG['error_log_empty'];
+if ($data == '')
+{
+ $data = $MSG['888'];
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPE' => $type,
- 'ERRORLOG' => $data
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPE' => $type,
+ 'ERRORLOG' => $data
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'errorlog.tpl'
- ));
+ 'body' => 'errorlog.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/excludeauction.php b/admin/excludeauction.php
old mode 100644
new mode 100755
index 12825e763..f13a5661f
--- a/admin/excludeauction.php
+++ b/admin/excludeauction.php
@@ -1,6 +1,6 @@
query($query, $params);
- $auc_data = $db->result();
-
- if ($auc_data['suspended'] > 0) {
- if (!is_null($auc_data['reason']) && $auc_data['reason'] == 1) {
- alert_auction_watchers($id, $auc_data['title'], $auc_data['description']);
-
- $query = "DELETE FROM `" . $DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- }
-
- // update auction table
- $query = "UPDATE " . $DBPrefix . "auctions SET suspended = 0 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
-
- if ($auc_data['closed']) {
- $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions - 1), closedauctions = (closedauctions + 1)";
- $db->direct_query($query);
- } else {
- $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions - 1), auctions = (auctions + 1)";
- $db->direct_query($query);
-
- // update recursive categories
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $auc_data['category'], 'int');
- $db->query($query, $params);
-
- $parent_node = $db->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
- } else {
- // suspend auction
- $query = "UPDATE " . $DBPrefix . "auctions SET suspended = 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
-
- if ($auc_data['closed']) {
- $query ="UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions + 1), closedauctions = (closedauctions - 1)";
- $db->direct_query($query);
- } else {
- $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions + 1), auctions = (auctions - 1)";
- $db->direct_query($query);
-
- // update recursive categories
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $auc_data['category'], 'int');
- $db->query($query, $params);
-
- $parent_node = $db->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- }
- }
-
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ $catscontrol = new MPTTcategories();
+ $id = intval($_POST['id']);
+
+ // get auction data
+ $query = "SELECT a.title, a.description, a.category, a.closed, a.suspended, m.reason FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE a.id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ $auc_data = $db->result();
+
+ if ($auc_data['suspended'] > 0)
+ {
+ if (!is_null($auc_data['reason']) && $auc_data['reason'] == 1)
+ {
+ alert_auction_watchers($id, $auc_data['title'], $auc_data['description']);
+
+ $query = "DELETE FROM `" . $DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ }
+
+ // update auction table
+ $query = "UPDATE " . $DBPrefix . "auctions SET suspended = 0 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+
+ if ($auc_data['closed'])
+ {
+ $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions - 1), closedauctions = (closedauctions + 1)";
+ $db->direct_query($query);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions - 1), auctions = (auctions + 1)";
+ $db->direct_query($query);
+
+ // update recursive categories
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $auc_data['category'], 'int');
+ $db->query($query, $params);
+
+ $parent_node = $db->result();
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+ else
+ {
+ // suspend auction
+ $query = "UPDATE " . $DBPrefix . "auctions SET suspended = 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+
+ if ($auc_data['closed'])
+ {
+ $query ="UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions + 1), closedauctions = (closedauctions - 1)";
+ $db->direct_query($query);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = (suspendedauctions + 1), auctions = (auctions - 1)";
+ $db->direct_query($query);
+
+ // update recursive categories
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $auc_data['category'], 'int');
+ $db->query($query, $params);
+
+ $parent_node = $db->result();
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
}
$query = "SELECT u.nick, a.title, a.starts, a.description, a.category, d.description as duration,
- a.suspended, a.current_bid, a.quantity, a.reserve_price
- FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "durations d ON (d.days = a.duration)
- WHERE a.id = :auc_id";
+ a.suspended, a.current_bid, a.quantity, a.reserve_price
+ FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "durations d ON (d.days = a.duration)
+ WHERE a.id = :auc_id";
$params = array();
-$params[] = array(':auc_id', $id, 'int');
+$params[] = array(':auc_id', $_GET['id'], 'int');
$db->query($query, $params);
$auc_data = $db->result();
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $date = date('m/d/Y', $auc_data['starts'] + $system->tdiff);
+}
+else
+{
+ $date = date('d/m/Y', $auc_data['starts'] + $system->tdiff);
+}
+
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'PAGE_TITLE' => ($auc_data['suspended'] > 0) ? $MSG['unsuspend_auction'] : $MSG['suspend_auction'],
- 'ID' => $id,
- 'TITLE' => htmlspecialchars($auc_data['title']),
- 'NICK' => $auc_data['nick'],
- 'STARTS' => $dt->formatDate($auc_data['starts']),
- 'DURATION' => $auc_data['duration'],
- 'CATEGORY' => $category_names[$auc_data['category']],
- 'DESCRIPTION' => $auc_data['description'],
- 'CURRENT_BID' => $system->print_money($auc_data['current_bid']),
- 'QTY' => $auc_data['quantity'],
- 'RESERVE_PRICE' => $system->print_money($auc_data['reserve_price']),
- 'SUSPENDED' => $auc_data['suspended']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'PAGE_TITLE' => ($auc_data['suspended'] > 0) ? $MSG['322'] : $MSG['321'],
+ 'ID' => $_GET['id'],
+ 'TITLE' => htmlspecialchars($auc_data['title']),
+ 'NICK' => $auc_data['nick'],
+ 'STARTS' => $date,
+ 'DURATION' => $auc_data['duration'],
+ 'CATEGORY' => $category_names[$auc_data['category']],
+ 'DESCRIPTION' => $auc_data['description'],
+ 'CURRENT_BID' => $system->print_money($auc_data['current_bid']),
+ 'QTY' => $auc_data['quantity'],
+ 'RESERVE_PRICE' => $system->print_money($auc_data['reserve_price']),
+ 'SUSPENDED' => $auc_data['suspended'],
+ 'OFFSET' => $_REQUEST['offset']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'excludeauction.tpl'
- ));
+ 'body' => 'excludeauction.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/excludeuser.php b/admin/excludeuser.php
old mode 100644
new mode 100755
index be3abeb11..876a1cbf0
--- a/admin/excludeuser.php
+++ b/admin/excludeuser.php
@@ -1,6 +1,6 @@
query($query, $params);
- $USER = $db->result();
+if (isset($_POST['action']) && $_POST['action'] == "Yes")
+{
+ $query = "SELECT name, email, suspended FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $USER = $db->result();
- if ($_POST['mode'] == 'activate') {
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - 1, users = users + 1";
- $db->direct_query($query);
+ if ($_POST['mode'] == 'activate')
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - 1, users = users + 1";
+ $db->direct_query($query);
- $was_suspended = ($USER['suspended'] == 1 ? true : false);
+ $was_suspended = ($USER['suspended'] == 1 ? true : false);
- if (!$was_suspended) {
- include INCLUDE_PATH . 'email/user_approved.php';
- } else {
- include INCLUDE_PATH . 'email/user_reactivated.php';
- }
- } else {
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 1 WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers + 1, users = users - 1";
- $db->direct_query($query);
+ if (!$was_suspended)
+ {
+ include INCLUDE_PATH . 'email/user_approved.php';
+ }
+ else
+ {
+ include INCLUDE_PATH . 'email/user_reactivated.php';
+ }
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 1 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers + 1, users = users - 1";
+ $db->direct_query($query);
- include INCLUDE_PATH . 'email/user_suspended.php';
- }
+ include INCLUDE_PATH . 'email/user_suspended.php';
+ }
- header('location: listusers.php');
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- header('location: listusers.php');
- exit;
+ header('location: listusers.php?PAGE=' . intval($_POST['offset']));
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ header('location: listusers.php?PAGE=' . intval($_POST['offset']));
+ exit;
}
// load the page
@@ -71,57 +81,69 @@
$user_data = $db->result();
// create tidy DOB string
-if ($user_data['birthdate'] == 0) {
- $birthdate = '';
-} else {
- $birth_day = substr($user_data['birthdate'], 6, 2);
- $birth_month = substr($user_data['birthdate'], 4, 2);
- $birth_year = substr($user_data['birthdate'], 0, 4);
+if ($user_data['birthdate'] == 0)
+{
+ $birthdate = '';
+}
+else
+{
+ $birth_day = substr($user_data['birthdate'], 6, 2);
+ $birth_month = substr($user_data['birthdate'], 4, 2);
+ $birth_year = substr($user_data['birthdate'], 0, 4);
- if ($system->SETTINGS['datesformat'] == 'USA') {
- $birthdate = $birth_month . '/' . $birth_day . '/' . $birth_year;
- } else {
- $birthdate = $birth_day . '/' . $birth_month . '/' . $birth_year;
- }
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $birthdate = $birth_month . '/' . $birth_day . '/' . $birth_year;
+ }
+ else
+ {
+ $birthdate = $birth_day . '/' . $birth_month . '/' . $birth_year;
+ }
}
$mode = 'activate';
-switch ($user_data['suspended']) {
- case 0:
- $action = $MSG['suspend_user'];
- $question = $MSG['suspend_user_confirm'];
- $mode = 'suspend';
- break;
- case 10:
- case 8:
- $action = $MSG['activate_user'];
- $question = $MSG['activate_user_confirm'];
- break;
- default:
- $action = $MSG['reactivate_user'];
- $question = $MSG['reactivate_user_confirm'];
- break;
+switch ($user_data['suspended'])
+{
+ case 0:
+ $action = $MSG['305'];
+ $question = $MSG['308'];
+ $mode = 'suspend';
+ break;
+ case 8:
+ $action = $MSG['515'];
+ $question = $MSG['815'];
+ break;
+ case 10:
+ $action = $MSG['299'];
+ $question = $MSG['418'];
+ break;
+ default:
+ $action = $MSG['306'];
+ $question = $MSG['309'];
+ break;
}
$template->assign_vars(array(
- 'ACTION' => $action,
- 'REALNAME' => $user_data['name'],
- 'USERNAME' => $user_data['nick'],
- 'EMAIL' => $user_data['email'],
- 'ADDRESS' => $user_data['address'],
- 'PROV' => $user_data['prov'],
- 'ZIP' => $user_data['zip'],
- 'COUNTRY' => $user_data['country'],
- 'PHONE' => $user_data['phone'],
- 'DOB' => $birthdate,
- 'QUESTION' => $question,
- 'MODE' => $mode,
- 'ID' => $_GET['id']
- ));
+ 'ACTION' => $action,
+ 'REALNAME' => $user_data['name'],
+ 'USERNAME' => $user_data['nick'],
+ 'EMAIL' => $user_data['email'],
+ 'ADDRESS' => $user_data['address'],
+ 'PROV' => $user_data['prov'],
+ 'ZIP' => $user_data['zip'],
+ 'COUNTRY' => $user_data['country'],
+ 'PHONE' => $user_data['phone'],
+ 'DOB' => $birthdate,
+ 'QUESTION' => $question,
+ 'MODE' => $mode,
+ 'ID' => $_GET['id'],
+ 'OFFSET' => $_GET['offset']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'excludeuser.tpl'
- ));
+ 'body' => 'excludeuser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/faqs.php b/admin/faqs.php
old mode 100644
new mode 100755
index d5e68345f..4bcf6542d
--- a/admin/faqs.php
+++ b/admin/faqs.php
@@ -1,6 +1,6 @@
query($query, $params);
- $query = "DELETE FROM " . $DBPrefix . "faqs_translated WHERE id = :faq_id";
- $db->query($query, $params);
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['faqs_deleted']));
+if (isset($_POST['delete']) && is_array($_POST['delete']))
+{
+ foreach ($_POST['delete'] as $val)
+ {
+ $params = array();
+ $params[] = array(':faq_id', $val, 'int');
+ $query = "DELETE FROM " . $DBPrefix . "faqs WHERE id = :faq_id";
+ $db->query($query, $params);
+ $query = "DELETE FROM " . $DBPrefix . "faqs_translated WHERE id = :faq_id";
+ $db->query($query, $params);
+ }
}
// Get data from the database
$query = "SELECT * FROM " . $DBPrefix . "faqscategories ORDER BY category";
$db->direct_query($query);
$faq_cats = $db->fetchall();
-foreach ($faq_cats as $row) {
- $template->assign_block_vars('cats', array(
- 'CAT' => $row['category']
- ));
+foreach ($faq_cats as $row)
+{
+ $template->assign_block_vars('cats', array(
+ 'CAT' => $row['category']
+ ));
- $query = "SELECT id, question FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $row['id'], 'int');
- $db->query($query, $params);
- while ($cat_row = $db->fetch()) {
- $template->assign_block_vars('cats.faqs', array(
- 'ID' => $cat_row['id'],
- 'FAQ' => $cat_row['question']
- ));
- }
+ $query = "SELECT id, question FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $row['id'], 'int');
+ $db->query($query, $params);
+ while ($cat_row = $db->fetch())
+ {
+ $template->assign_block_vars('cats.faqs', array(
+ 'ID' => $cat_row['id'],
+ 'FAQ' => $cat_row['question']
+ ));
+ }
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'faqs.tpl'
- ));
+ 'body' => 'faqs.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/faqscategories.php b/admin/faqscategories.php
old mode 100644
new mode 100755
index e85a12cb6..5e8786012
--- a/admin/faqscategories.php
+++ b/admin/faqscategories.php
@@ -1,6 +1,6 @@
SETTINGS['defaultlanguage']])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } else {
- $query = "INSERT INTO " . $DBPrefix . "faqscategories (category) VALUES (:cat_name)";
- $params = array();
- $params[] = array(':cat_name', $_POST['cat_name'][$system->SETTINGS['defaultlanguage']], 'str');
- $db->query($query, $params);
- $id = $db->lastInsertId();
- foreach ($LANGUAGES as $lang_code) {
- $query = "INSERT INTO " . $DBPrefix . "faqscat_translated VALUES (:cat_id, :lang, :cat_name)";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $params[] = array(':lang', $lang_code, 'str');
- $params[] = array(':cat_name', $_POST['cat_name'][$lang_code], 'str');
- $db->query($query, $params);
- }
- }
- }
+if (isset($_POST['action']))
+{
+ // add category
+ if ($_POST['action'] == "Insert")
+ {
+ if (empty($_POST['cat_name'][$system->SETTINGS['defaultlanguage']]))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "faqscategories values (NULL, :cat_name)";
+ $params = array();
+ $params[] = array(':cat_name', $_POST['cat_name'][$system->SETTINGS['defaultlanguage']], 'str');
+ $db->query($query, $params);
+ $id = $db->lastInsertId();
+ reset($LANGUAGES);
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "faqscat_translated VALUES (:cat_id, :lang, :cat_name)";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':cat_name', $_POST['cat_name'][$k], 'str');
+ $db->query($query, $params);
+ }
+ }
+ }
- // Delete categories
- if ($_POST['action'] == "Yes" && isset($_POST['delete']) && is_array($_POST['delete'])) {
- foreach ($_POST['delete'] as $k => $v) {
- if ($v == 'delete') {
- // get a list of all faqs within the category
- $query = "SELECT id FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $k, 'int');
- $db->query($query, $params);
- $ids = '0';
- while ($row = $db->fetch()) {
- $ids .= ',' . $row['id'];
- }
- // delete faqs in this category
- $query = "DELETE FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $k, 'int');
- $db->query($query, $params);
- // delete translated faqs in this category
- $query = "DELETE FROM " . $DBPrefix . "faqs_translated WHERE id IN (:id_list)";
- $params = array();
- $params[] = array(':id_list', $ids, 'str');
- $db->query($query, $params);
- } else {
- $move = explode(':', $v);
- $query = "UPDATE " . $DBPrefix . "faqs SET category = :new_cat WHERE category = :old_cat";
- $params = array();
- $params[] = array(':new_cat', $move[1], 'int');
- $params[] = array(':old_cat', $k, 'int');
- $db->query($query, $params);
- }
- // delete the category
- $query = "DELETE FROM " . $DBPrefix . "faqscategories WHERE id = :faq_id";
- $params = array();
- $params[] = array(':faq_id', $k, 'int');
- $db->query($query, $params);
- // delete the translated category
- $query = "DELETE FROM " . $DBPrefix . "faqscat_translated WHERE id = :faq_id";
- $params = array();
- $params[] = array(':faq_id', $k, 'int');
- $db->query($query, $params);
- }
- }
+ // Delete categories
+ if ($_POST['action'] == "Yes" && isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ foreach ($_POST['delete'] as $k => $v)
+ {
+ if ($v == 'delete')
+ {
+ // get a list of all faqs within the category
+ $query = "SELECT id FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $k, 'int');
+ $db->query($query, $params);
+ $ids = '0';
+ while ($row = $db->fetch())
+ {
+ $ids .= ',' . $row['id'];
+ }
+ // delete faqs in this category
+ $query = "DELETE FROM " . $DBPrefix . "faqs WHERE category = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $k, 'int');
+ $db->query($query, $params);
+ // delete translated faqs in this category
+ $query = "DELETE FROM " . $DBPrefix . "faqs_translated WHERE id IN (:id_list)";
+ $params = array();
+ $params[] = array(':id_list', $ids, 'str');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $move = explode(':', $v);
+ $query = "UPDATE " . $DBPrefix . "faqs SET category = :new_cat WHERE category = :old_cat";
+ $params = array();
+ $params[] = array(':new_cat', $move[1], 'int');
+ $params[] = array(':old_cat', $k, 'int');
+ $db->query($query, $params);
+ }
+ // delete the category
+ $query = "DELETE FROM " . $DBPrefix . "faqscategories WHERE id = :faq_id";
+ $params = array();
+ $params[] = array(':faq_id', $k, 'int');
+ $db->query($query, $params);
+ // delete the translated category
+ $query = "DELETE FROM " . $DBPrefix . "faqscat_translated WHERE id = :faq_id";
+ $params = array();
+ $params[] = array(':faq_id', $k, 'int');
+ $db->query($query, $params);
+ }
+ }
- // delete check
- if ($_POST['action'] == "Delete" && isset($_POST['delete']) && is_array($_POST['delete'])) {
- // get cats FAQs can be moved to
- $delete = implode(',', $_POST['delete']);
- $query = "SELECT category, id FROM " . $DBPrefix . "faqscategories WHERE id NOT IN (:delete_list)";
- $params = array();
- $params[] = array(':delete_list', $delete, 'str');
- $db->query($query, $params);
- $move = '';
- while ($row = $db->fetch()) {
- $move .= '' . $MSG['840'] . $row['category'] . ' ';
- }
- // Get data from the database
- $query = "SELECT COUNT(f.id) as COUNT, c.category, c.id FROM " . $DBPrefix . "faqscategories c
- LEFT JOIN " . $DBPrefix . "faqs f ON ( f.category = c.id )
- WHERE c.id IN (:delete_list) GROUP BY c.id ORDER BY category";
- $params = array();
- $params[] = array(':delete_list', $delete, 'int');
- $db->query($query, $params);
+ // delete check
+ if ($_POST['action'] == "Delete" && isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ // get cats FAQs can be moved to
+ $delete = implode(',', $_POST['delete']);
+ $query = "SELECT category, id FROM " . $DBPrefix . "faqscategories WHERE id NOT IN (:delete_list)";
+ $params = array();
+ $params[] = array(':delete_list', $delete, 'str');
+ $db->query($query, $params);
+ $move = '';
+ while ($row = $db->fetch())
+ {
+ $move .= '' . $MSG['840'] . $row['category'] . ' ';
+ }
+ // Get data from the database
+ $query = "SELECT COUNT(f.id) as COUNT, c.category, c.id FROM " . $DBPrefix . "faqscategories c
+ LEFT JOIN " . $DBPrefix . "faqs f ON ( f.category = c.id )
+ WHERE c.id IN (:delete_list) GROUP BY c.id ORDER BY category";
+ $params = array();
+ $params[] = array(':delete_list', $delete, 'int');
+ $db->query($query, $params);
- $names = array();
- while ($row = $db->fetch()) {
- $template->assign_block_vars('faqcats', array(
- 'ID' => $row['id'],
- 'CATEGORY' => $row['category'],
- 'COUNT' => $row['COUNT'],
- 'DROPDOWN' => $move
- ));
- $names[] = $row['category'] . ' ';
- }
- // build message
- $template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'CAT_LIST' => implode(', ', $names)
- ));
+ $message = $MSG['839'] . '';
+ $names = array();
+ $counter = 0;
+ while ($row = $db->fetch())
+ {
+ $names[] = $row['category'] . ' ';
+ if ($row['COUNT'] > 0)
+ {
+ $message .= '';
+ $message .= '' . $row['category'] . ' ';
+ $message .= '';
+ $message .= '' . $MSG['008'] . ' ';
+ $message .= $move;
+ $message .= ' ';
+ $message .= ' ';
+ $message .= ' ';
+ $counter++;
+ }
+ }
+ $message .= '
';
+ // build message
+ $template->assign_vars(array(
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'ID' => '',
+ 'MESSAGE' => (($counter > 0) ? $message : '') . '' . $MSG['838'] . implode(', ', $names) . '
',
+ 'TYPE' => 1
+ ));
- $template->set_filenames(array(
- 'body' => 'faqcatconfirm.tpl'
- ));
- $template->display('body');
- exit;
- }
+ $template->set_filenames(array(
+ 'body' => 'confirm.tpl'
+ ));
+ $template->display('body');
+ exit;
+ }
}
// Get data from the database
@@ -133,30 +160,36 @@
LEFT JOIN " . $DBPrefix . "faqs f ON ( f.category = c.id )
GROUP BY c.id ORDER BY category";
$db->direct_query($query);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('cats', array(
- 'ID' => $row['id'],
- 'CATEGORY' => $row['category'],
- 'FAQSTXT' => sprintf($MSG['contains_x_faqs'], $row['COUNT']),
- 'FAQS' => $row['COUNT']
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('cats', array(
+ 'ID' => $row['id'],
+ 'CATEGORY' => $row['category'],
+ 'FAQSTXT' => sprintf($MSG['837'], $row['COUNT']),
+ 'FAQS' => $row['COUNT'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
-foreach ($LANGUAGES as $k => $v) {
- $template->assign_block_vars('lang', array(
- 'LANG' => $k,
- 'B_NODEFAULT' => ($k != $system->SETTINGS['defaultlanguage'])
- ));
+foreach ($LANGUAGES as $k => $v)
+{
+ $template->assign_block_vars('lang', array(
+ 'LANG' => $k,
+ 'B_NODEFAULT' => ($k != $system->SETTINGS['defaultlanguage'])
+ ));
}
$template->assign_vars(array(
- 'B_ADDCAT' => (isset($_GET['do']) && $_GET['do'] == 'add')
- ));
+ 'B_ADDCAT' => (isset($_GET['do']) && $_GET['do'] == 'add')
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'faqscategories.tpl'
- ));
+ 'body' => 'faqscategories.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
diff --git a/admin/fee_gateways.php b/admin/fee_gateways.php
old mode 100644
new mode 100755
index ec0174aa0..cc478d495
--- a/admin/fee_gateways.php
+++ b/admin/fee_gateways.php
@@ -1,6 +1,6 @@
direct_query($query);
$gateway_data = $db->fetchAll();
-if (isset($_POST['action'])) {
- // build the sql
- foreach ($gateway_data as $k => $gateway) {
- if (isset($_POST[$gateway['name']])) {
- $query = "UPDATE " . $DBPrefix . "payment_options SET
- gateway_admin_address = :gateway_admin_address,
- gateway_admin_password = :gateway_admin_password,
- gateway_required = :gateway_required,
- gateway_active = :gateway_active
- WHERE id = :id";
- $params = array();
- $params[] = array(':gateway_admin_address', $_POST[$gateway['name']]['address'], 'str');
- $params[] = array(':gateway_admin_password', $_POST[$gateway['name']]['password'], 'str');
- $params[] = array(':gateway_required', (isset($_POST[$gateway['name']]['required']) ? 1 : 0), 'bool');
- $params[] = array(':gateway_active', (isset($_POST[$gateway['name']]['active']) ? 1 : 0), 'bool');
- $params[] = array(':id', $_POST[$gateway['name']]['id'], 'int');
- $db->query($query, $params);
- $gateway_data[$k]['gateway_admin_address'] = $_POST[$gateway['name']]['address'];
- $gateway_data[$k]['gateway_admin_password'] = $_POST[$gateway['name']]['password'];
- $gateway_data[$k]['gateway_required'] = (isset($_POST[$gateway['name']]['required']) ? 1 : 0);
- $gateway_data[$k]['gateway_active'] = (isset($_POST[$gateway['name']]['active']) ? 1 : 0);
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['gateway_settings_update']));
+if (isset($_POST['action']))
+{
+ // build the sql
+ foreach ($gateway_data as $k => $gateway)
+ {
+ if (isset($_POST[$gateway['name']]))
+ {
+ $query = "UPDATE " . $DBPrefix . "payment_options SET
+ gateway_admin_address = :gateway_admin_address,
+ gateway_admin_password = :gateway_admin_password,
+ gateway_required = :gateway_required,
+ gateway_active = :gateway_active
+ WHERE id = :id";
+ $params = array();
+ $params[] = array(':gateway_admin_address', $_POST[$gateway['name']]['address'], 'str');
+ $params[] = array(':gateway_admin_password', $_POST[$gateway['name']]['password'], 'str');
+ $params[] = array(':gateway_required', (isset($_POST[$gateway['name']]['required']) ? 1 : 0), 'bool');
+ $params[] = array(':gateway_active', (isset($_POST[$gateway['name']]['active']) ? 1 : 0), 'bool');
+ $params[] = array(':id', $_POST[$gateway['name']]['id'], 'int');
+ $db->query($query, $params);
+ $gateway_data[$k]['gateway_admin_address'] = $_POST[$gateway['name']]['address'];
+ $gateway_data[$k]['gateway_admin_password'] = $_POST[$gateway['name']]['password'];
+ $gateway_data[$k]['gateway_required'] = (isset($_POST[$gateway['name']]['required']) ? 1 : 0);
+ $gateway_data[$k]['gateway_active'] = (isset($_POST[$gateway['name']]['active']) ? 1 : 0);
+ }
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['762']));
}
-foreach ($gateway_data as $gateway) {
- $template->assign_block_vars('gateways', array(
- 'GATEWAY_ID' => $gateway['id'],
- 'NAME' => $gateway['displayname'],
- 'PLAIN_NAME' => $gateway['name'],
- 'ENABLED' => ($gateway['gateway_active'] == 1) ? 'checked' : '',
- 'REQUIRED' => ($gateway['gateway_required'] == 1) ? 'checked' : '',
- 'ADDRESS' => $gateway['gateway_admin_address'],
- 'PASSWORD' => $gateway['gateway_admin_password'],
- 'WEBSITE' => $gateway_links[$gateway['name']],
- 'ADDRESS_NAME' => isset($address_string[$gateway['name']]) ? $address_string[$gateway['name']] : $gateway['name'],
- 'PASSWORD_NAME' => isset($password_string[$gateway['name']]) ? $password_string[$gateway['name']] : '',
+foreach ($gateway_data as $gateway)
+{
+ $template->assign_block_vars('gateways', array(
+ 'GATEWAY_ID' => $gateway['id'],
+ 'NAME' => $gateway['displayname'],
+ 'PLAIN_NAME' => $gateway['name'],
+ 'ENABLED' => ($gateway['gateway_active'] == 1) ? 'checked' : '',
+ 'REQUIRED' => ($gateway['gateway_required'] == 1) ? 'checked' : '',
+ 'ADDRESS' => $gateway['gateway_admin_address'],
+ 'PASSWORD' => $gateway['gateway_admin_password'],
+ 'WEBSITE' => $gateway_links[$gateway['name']],
+ 'ADDRESS_NAME' => isset($address_string[$gateway['name']]) ? $address_string[$gateway['name']] : $gateway['name'],
+ 'PASSWORD_NAME' => isset($password_string[$gateway['name']]) ? $password_string[$gateway['name']] : '',
- 'B_PASSWORD' => isset($password_string[$gateway['name']])
- ));
+ 'B_PASSWORD' => isset($password_string[$gateway['name']])
+ ));
}
+$template->assign_vars(array(
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
+
include 'header.php';
$template->set_filenames(array(
- 'body' => 'fee_gateways.tpl'
- ));
+ 'body' => 'fee_gateways.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/fees.php b/admin/fees.php
old mode 100644
new mode 100755
index b308e696c..9c611dde6
--- a/admin/fees.php
+++ b/admin/fees.php
@@ -1,6 +1,6 @@
0,
- 'buyer_fee' => 1,
- 'setup_fee' => 1,
- 'featured_fee' => 0,
- 'bold_fee' => 0,
- 'highlighted_fee' => 0,
- 'subtitle_fee' => 0,
- 'extracat_fee' => 0,
- 'reserve_fee' => 0,
- 'picture_fee' => 0,
- 'relist_fee' => 0,
- 'buynow_fee' => 0,
- 'endauc_fee' => 1
- );
+ 'signup_fee' => 0,
+ 'buyer_fee' => 1,
+ 'setup_fee' => 1,
+ 'featured_fee' => 0,
+ 'bold_fee' => 0,
+ 'highlighted_fee' => 0,
+ 'subtitle_fee' => 0,
+ 'extracat_fee' => 0,
+ 'reserve_fee' => 0,
+ 'picture_fee' => 0,
+ 'relist_fee' => 0,
+ 'buynow_fee' => 0,
+ 'endauc_fee' => 1
+ );
$feenames = array(
- 'signup_fee' => $MSG['430'],
- 'buyer_fee' => $MSG['775'],
- 'setup_fee' => $MSG['432'],
- 'featured_fee' => $MSG['433'],
- 'bold_fee' => $MSG['439'],
- 'highlighted_fee' => $MSG['434'],
- 'subtitle_fee' => $MSG['803'],
- 'extracat_fee' => $MSG['804'],
- 'reserve_fee' => $MSG['440'],
- 'picture_fee' => $MSG['435'],
- 'relist_fee' => $MSG['437'],
- 'buynow_fee' => $MSG['436'],
- 'endauc_fee' => $MSG['791']
- );
+ 'signup_fee' => $MSG['430'],
+ 'buyer_fee' => $MSG['775'],
+ 'setup_fee' => $MSG['432'],
+ 'featured_fee' => $MSG['433'],
+ 'bold_fee' => $MSG['439'],
+ 'highlighted_fee' => $MSG['434'],
+ 'subtitle_fee' => $MSG['803'],
+ 'extracat_fee' => $MSG['804'],
+ 'reserve_fee' => $MSG['440'],
+ 'picture_fee' => $MSG['435'],
+ 'relist_fee' => $MSG['437'],
+ 'buynow_fee' => $MSG['436'],
+ 'endauc_fee' => $MSG['791']
+ );
-if (isset($_GET['type']) && isset($fees[$_GET['type']])) {
- if ($fees[$_GET['type']] == 0) {
- if (isset($_POST['action']) && $_POST['action'] == 'update') {
- if (!$system->CheckMoney($_POST['value'])) {
- $errmsg = $ERR_058;
- } else {
- $query = "UPDATE " . $DBPrefix . "fees SET value = :value WHERE type = :type";
- $params = array();
- $params[] = array(':value', $system->input_money($_POST['value']), 'float');
- $params[] = array(':type', $_GET['type'], 'str');
- $db->query($query, $params);
- $errmsg = $feenames[$_GET['type']] . $MSG['359'];
- }
- }
- $query = "SELECT value FROM " . $DBPrefix . "fees WHERE type = :type";
- $params = array();
- $params[] = array(':type', $_GET['type'], 'str');
- $db->query($query, $params);
- $value = $db->result('value');
+if(isset($_GET['type']) && isset($fees[$_GET['type']]))
+{
+ if($fees[$_GET['type']] == 0)
+ {
+ if(isset($_POST['action']) && $_POST['action'] == 'update')
+ {
+ if(!$system->CheckMoney($_POST['value']))
+ {
+ $errmsg = $ERR_058;
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "fees SET value = :value WHERE type = :type";
+ $params = array();
+ $params[] = array(':value', $system->input_money($_POST['value']), 'float');
+ $params[] = array(':type', $_GET['type'], 'str');
+ $db->query($query, $params);
+ $errmsg = $feenames[$_GET['type']] . $MSG['359'];
+ }
+ }
+ $query = "SELECT value FROM " . $DBPrefix . "fees WHERE type = :type";
+ $params = array();
+ $params[] = array(':type', $_GET['type'], 'str');
+ $db->query($query, $params);
+ $value = $db->result('value');
- $template->assign_vars(array(
- 'VALUE' => $system->print_money_nosymbol($value),
- 'CURRENCY' => $system->SETTINGS['currency']
- ));
- } elseif ($fees[$_GET['type']] == 1) {
- $level_added = false;
- if (isset($_POST['action']) && $_POST['action'] == 'update') {
- for ($i = 0; $i < count($_POST['tier_id']); $i++) {
- $value = $_POST['value'][$i];
- if ($_POST['type'][$i] == 'flat') {
- $value = $system->input_money($value);
- }
- $query = "UPDATE " . $DBPrefix . "fees SET
- fee_from = :fee_from,
- fee_to = :fee_to,
- value = :value,
- fee_type = :fee_type
- WHERE id = :fee_id";
- $params = array();
- $params[] = array(':fee_from', $system->input_money($_POST['fee_from'][$i]), 'float');
- $params[] = array(':fee_to', $system->input_money($_POST['fee_to'][$i]), 'float');
- $params[] = array(':value', $value, 'float');
- $params[] = array(':fee_type', $_POST['type'][$i], 'str');
- $params[] = array(':fee_id', $_POST['tier_id'][$i], 'int');
- $db->query($query, $params);
- $errmsg = $feenames[$_GET['type']] . $MSG['359'];
- }
- if (isset($_POST['fee_delete'])) {
- for ($i = 0; $i < count($_POST['fee_delete']); $i++) {
- $query = "DELETE FROM " . $DBPrefix . "fees WHERE id = :fee_id";
- $params = array();
- $params[] = array(':fee_id', $_POST['fee_delete'][$i], 'int');
- $db->query($query, $params);
- }
- }
- if (!empty($_POST['new_fee_from']) && !empty($_POST['new_fee_to']) && !empty($_POST['new_value']) && !empty($_POST['new_type'])) {
- if ($_POST['new_fee_from'] <= $_POST['new_fee_to']) {
- $value = $_POST['new_value'];
- if ($_POST['new_type'] == 'flat') {
- $value = $system->input_money($value);
- }
- $query = "INSERT INTO " . $DBPrefix . "fees VALUES
- (NULL, :fee_from, :fee_to, :new_type, :value, :type)";
- $params = array();
- $params[] = array(':fee_from', $system->input_money($_POST['new_fee_from']), 'float');
- $params[] = array(':fee_to', $system->input_money($_POST['new_fee_to']), 'float');
- $params[] = array(':new_type', $_POST['new_type'], 'str');
- $params[] = array(':value', $value, 'float');
- $params[] = array(':type', $_GET['type'], 'str');
- $db->query($query, $params);
- $level_added = true;
- } else {
- $errmsg = $MSG['error_from_must_be_less_than_to'];
- }
- }
- }
- $query = "SELECT * FROM " . $DBPrefix . "fees WHERE type = :type ORDER BY fee_from ASC";
- $params = array();
- $params[] = array(':type', $_GET['type'], 'str');
- $db->query($query, $params);
- while ($row = $db->fetch()) {
- $template->assign_block_vars('fees', array(
- 'ID' => $row['id'],
- 'FROM' => $system->print_money_nosymbol($row['fee_from']),
- 'TO' => $system->print_money_nosymbol($row['fee_to']),
- 'FLATTYPE' => ($row['fee_type'] == 'flat') ? ' selected="selected"' : '',
- 'PERCTYPE' => ($row['fee_type'] == 'perc') ? ' selected="selected"' : '',
- 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money_nosymbol($row['value']) : $row['value']
- ));
- }
+ $template->assign_vars(array(
+ 'VALUE' => $system->print_money_nosymbol($value),
+ 'CURRENCY' => $system->SETTINGS['currency']
+ ));
+ }
+ elseif($fees[$_GET['type']] == 1)
+ {
+ $level_added = false;
+ if(isset($_POST['action']) && $_POST['action'] == 'update')
+ {
+ for($i = 0; $i < count($_POST['tier_id']); $i++)
+ {
+ $value = $_POST['value'][$i];
+ if ($_POST['type'][$i] == 'flat')
+ {
+ $value = $system->input_money($value);
+ }
+ $query = "UPDATE " . $DBPrefix . "fees SET
+ fee_from = :fee_from,
+ fee_to = :fee_to,
+ value = :value,
+ fee_type = :fee_type
+ WHERE id = :fee_id";
+ $params = array();
+ $params[] = array(':fee_from', $system->input_money($_POST['fee_from'][$i]), 'float');
+ $params[] = array(':fee_to', $system->input_money($_POST['fee_to'][$i]), 'float');
+ $params[] = array(':value', $value, 'float');
+ $params[] = array(':fee_type', $_POST['type'][$i], 'str');
+ $params[] = array(':fee_id', $_POST['tier_id'][$i], 'int');
+ $db->query($query, $params);
+ $errmsg = $feenames[$_GET['type']] . $MSG['359'];
+ }
+ if (isset($_POST['fee_delete']))
+ {
+ for($i = 0; $i < count($_POST['fee_delete']); $i++)
+ {
+ $query = "DELETE FROM " . $DBPrefix . "fees WHERE id = :fee_id";
+ $params = array();
+ $params[] = array(':fee_id', $_POST['fee_delete'][$i], 'int');
+ $db->query($query, $params);
+ }
+ }
+ if(!empty($_POST['new_fee_from']) && !empty($_POST['new_fee_to']) && !empty($_POST['new_value']) && !empty($_POST['new_type']))
+ {
+ if ($_POST['new_fee_from'] <= $_POST['new_fee_to'])
+ {
+ $value = $_POST['new_value'];
+ if ($_POST['new_type'] == 'flat')
+ {
+ $value = $system->input_money($value);
+ }
+ $query = "INSERT INTO " . $DBPrefix . "fees VALUES
+ (NULL, :fee_from, :fee_to, :new_type, :value, :type)";
+ $params = array();
+ $params[] = array(':fee_from', $system->input_money($_POST['new_fee_from']), 'float');
+ $params[] = array(':fee_to', $system->input_money($_POST['new_fee_to']), 'float');
+ $params[] = array(':new_type', $_POST['new_type'], 'str');
+ $params[] = array(':value', $value, 'float');
+ $params[] = array(':type', $_GET['type'], 'str');
+ $db->query($query, $params);
+ $level_added = true;
+ }
+ else
+ {
+ $errmsg = $ERR_713;
+ }
+ }
+ }
+ $query = "SELECT * FROM " . $DBPrefix . "fees WHERE type = :type ORDER BY fee_from ASC";
+ $params = array();
+ $params[] = array(':type', $_GET['type'], 'str');
+ $db->query($query, $params);
+ while($row = $db->fetch())
+ {
+ $template->assign_block_vars('fees', array(
+ 'ID' => $row['id'],
+ 'FROM' => $system->print_money_nosymbol($row['fee_from']),
+ 'TO' => $system->print_money_nosymbol($row['fee_to']),
+ 'FLATTYPE' => ($row['fee_type'] == 'flat') ? ' selected="selected"' : '',
+ 'PERCTYPE' => ($row['fee_type'] == 'perc') ? ' selected="selected"' : '',
+ 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money_nosymbol($row['value']) : $row['value']
+ ));
+ }
- $template->assign_vars(array(
- 'CURRENCY' => $system->SETTINGS['currency'],
- 'FEE_FROM' => (isset($_POST['new_fee_from']) && !$level_added) ? $_POST['new_fee_from'] : '',
- 'FEE_TO' => (isset($_POST['new_fee_to']) && !$level_added) ? $_POST['new_fee_to'] : '',
- 'FEE_VALUE' => (isset($_POST['new_value']) && !$level_added) ? $_POST['new_value'] : '',
- 'FEE_TYPE' => (isset($_POST['new_type']) && !$level_added) ? $_POST['new_type'] : ''
- ));
- }
+ $template->assign_vars(array(
+ 'CURRENCY' => $system->SETTINGS['currency'],
+ 'FEE_FROM' => (isset($_POST['new_fee_from']) && !$level_added) ? $_POST['new_fee_from'] : '',
+ 'FEE_TO' => (isset($_POST['new_fee_to']) && !$level_added) ? $_POST['new_fee_to'] : '',
+ 'FEE_VALUE' => (isset($_POST['new_value']) && !$level_added) ? $_POST['new_value'] : '',
+ 'FEE_TYPE' => (isset($_POST['new_type']) && !$level_added) ? $_POST['new_type'] : ''
+ ));
+ }
}
$query = "SELECT COUNT(id) as count FROM " . $DBPrefix . "payment_options WHERE is_gateway = 1 AND gateway_admin_address != ''";
@@ -156,14 +175,16 @@
$gateway_check = $db->result('count');
$template->assign_vars(array(
- 'B_NOT_SETUP_CORRECTLY' => ($gateway_check == 0),
- 'B_SINGLE' => (isset($_GET['type']) && isset($fees[$_GET['type']]) && $fees[$_GET['type']] == 0),
- 'FEETYPE' => (isset($_GET['type']) && isset($feenames[$_GET['type']])) ? $feenames[$_GET['type']] : ''
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'B_NOT_SETUP_CORRECTLY' => ($gateway_check == 0),
+ 'B_SINGLE' => (isset($_GET['type']) && isset($fees[$_GET['type']]) && $fees[$_GET['type']] == 0) ? true : false,
+ 'FEETYPE' => (isset($_GET['type']) && isset($feenames[$_GET['type']])) ? $feenames[$_GET['type']] : ''
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'fees.tpl'
- ));
+ 'body' => 'fees.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/footer.php b/admin/footer.php
old mode 100644
new mode 100755
index edf502a54..5edce912c
--- a/admin/footer.php
+++ b/admin/footer.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'L_COPY' => empty($system->SETTINGS['copyright']) ? '' : '' . htmlspecialchars($system->SETTINGS['copyright']) . '
',
- 'L_COPY_YEAR' => date("Y"),
- ));
+ 'L_COPY' => empty($system->SETTINGS['copyright']) ? '' : '' . htmlspecialchars($system->SETTINGS['copyright']) . '
',
+ 'L_COPY_YEAR' => date("Y"),
+ ));
$template->set_filenames(array(
- 'footer' => 'footer.tpl'
- ));
-$template->display('footer');
+ 'footer' => 'footer.tpl'
+ ));
+$template->display('footer');
\ No newline at end of file
diff --git a/admin/header.php b/admin/header.php
old mode 100644
new mode 100755
index 2f0e9e71b..ebb85fd19
--- a/admin/header.php
+++ b/admin/header.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'THEME' => $system->SETTINGS['admin_theme'],
- 'LOGO' => ($system->SETTINGS['logo']) ? ' ' : ' '
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'THEME' => $system->SETTINGS['admin_theme'],
+ 'LOGO' => ($system->SETTINGS['logo']) ? ' ' : ' '
+ ));
$template->set_filenames(array(
- 'header' => 'header.tpl'
- ));
+ 'header' => 'header.tpl'
+ ));
$template->display('header');
diff --git a/admin/help.php b/admin/help.php
old mode 100644
new mode 100755
index 9239c78a7..d176f376a
--- a/admin/help.php
+++ b/admin/help.php
@@ -1,6 +1,6 @@
assign_vars(array());
+
include 'header.php';
$template->set_filenames(array(
- 'body' => 'help.tpl'
- ));
+ 'body' => 'help.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/admin/increments.php b/admin/increments.php
old mode 100644
new mode 100755
index 67c325816..906675135
--- a/admin/increments.php
+++ b/admin/increments.php
@@ -1,6 +1,6 @@
CheckMoney($lows[$i]) || !$system->CheckMoney($highs[$i]) || !$system->CheckMoney($increments[$i]))
+ {
+ $errors = true;
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_030));
+ }
+ if ($lows[$i] > $highs[$i])
+ {
+ $errors = true;
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_713));
+ }
+ }
+ }
- for ($i = 0; $i < count($increments); $i++) {
- if (!empty($lows[$i]) && !empty($highs[$i]) && !empty($increments[$i]) && !ToBeDeleted($ids[$i])) {
- if (!$system->CheckMoney($lows[$i]) || !$system->CheckMoney($highs[$i]) || !$system->CheckMoney($increments[$i])) {
- $errors = true;
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_030));
- }
- if ($lows[$i] > $highs[$i]) {
- $errors = true;
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_from_must_be_less_than_to']));
- }
- }
- }
+ if (!$errors)
+ {
+ for ($i = 0; $i < count($increments); $i++)
+ {
+ if (!ToBeDeleted($ids[$i]))
+ {
+ if (!(intval($lows[$i]) == 0 && intval($highs[$i]) == 0 && intval($increments[$i]) == 0))
+ {
+ if (!isset($ids[$i]) || empty($ids[$i]))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "increments VALUES
+ (NULL, :low, :high, :inc)";
+ $params = array();
+ $params[] = array(':low', $system->input_money($lows[$i]), 'float');
+ $params[] = array(':high', $system->input_money($highs[$i]), 'float');
+ $params[] = array(':inc', $system->input_money($increments[$i]), 'float');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "increments SET
+ low = :low,
+ high = :high,
+ increment = :inc
+ WHERE id = :inc_id";
+ $params = array();
+ $params[] = array(':low', $system->input_money($lows[$i]), 'float');
+ $params[] = array(':high', $system->input_money($highs[$i]), 'float');
+ $params[] = array(':inc', $system->input_money($increments[$i]), 'float');
+ $params[] = array(':inc_id', $ids[$i], 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+ else
+ {
+ $query = "DELETE FROM " . $DBPrefix . "increments WHERE id = :inc_id";
+ $params = array();
+ $params[] = array(':inc_id', $ids[$i], 'int');
+ $db->query($query, $params);
+ }
- if (!$errors) {
- for ($i = 0; $i < count($increments); $i++) {
- if (!ToBeDeleted($ids[$i])) {
- if (!(intval($lows[$i]) == 0 && intval($highs[$i]) == 0 && intval($increments[$i]) == 0)) {
- if (!isset($ids[$i]) || empty($ids[$i])) {
- $query = "INSERT INTO " . $DBPrefix . "increments VALUES
- (NULL, :low, :high, :inc)";
- $params = array();
- $params[] = array(':low', $system->input_money($lows[$i]), 'float');
- $params[] = array(':high', $system->input_money($highs[$i]), 'float');
- $params[] = array(':inc', $system->input_money($increments[$i]), 'float');
- $db->query($query, $params);
- } else {
- $query = "UPDATE " . $DBPrefix . "increments SET
- low = :low,
- high = :high,
- increment = :inc
- WHERE id = :inc_id";
- $params = array();
- $params[] = array(':low', $system->input_money($lows[$i]), 'float');
- $params[] = array(':high', $system->input_money($highs[$i]), 'float');
- $params[] = array(':inc', $system->input_money($increments[$i]), 'float');
- $params[] = array(':inc_id', $ids[$i], 'int');
- $db->query($query, $params);
- }
- }
- } else {
- $query = "DELETE FROM " . $DBPrefix . "increments WHERE id = :inc_id";
- $params = array();
- $params[] = array(':inc_id', $ids[$i], 'int');
- $db->query($query, $params);
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['increments_updated']));
- }
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['160']));
+ }
}
$query = "SELECT * FROM " . $DBPrefix . "increments ORDER BY low";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('increments', array(
- 'ID' => $row['id'],
- 'HIGH' => $system->print_money_nosymbol($row['high']),
- 'LOW' => $system->print_money_nosymbol($row['low']),
- 'INCREMENT' => $system->print_money_nosymbol($row['increment'])
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('increments', array(
+ 'ID' => $row['id'],
+ 'HIGH' => $system->print_money_nosymbol($row['high']),
+ 'LOW' => $system->print_money_nosymbol($row['low']),
+ 'INCREMENT' => $system->print_money_nosymbol($row['increment'])
+ ));
}
+$template->assign_vars(array(
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
+
include 'header.php';
$template->set_filenames(array(
- 'body' => 'increments.tpl'
- ));
+ 'body' => 'increments.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
old mode 100644
new mode 100755
index 8c0502747..98747fdc9
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['cache_cleared']));
- break;
-
- case 'clear_image_cache':
- if (is_dir(UPLOAD_PATH . '/cache')) {
- $dir = opendir(UPLOAD_PATH . '/cache');
- while (($myfile = readdir($dir)) !== false) {
- if ($myfile != '.' && $myfile != '..' && $myfile != 'index.php') {
- unlink(IMAGE_CACHE_PATH . $myfile);
- }
- }
- closedir($dir);
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['image_cache_cleared']));
- break;
-
- case 'updatecounters':
- //update users counter
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "users WHERE suspended = 0";
- $db->direct_query($query);
- $USERS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET users = :USERS";
- $params = array();
- $params[] = array(':USERS', $USERS, 'int');
- $db->query($query, $params);
-
- //update suspended users counter
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "users WHERE suspended != 0";
- $db->direct_query($query);
- $USERS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = :USERS";
- $params = array();
- $params[] = array(':USERS', $USERS, 'int');
- $db->query($query, $params);
-
- //update auction counter
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 0 AND suspended = 0";
- $db->direct_query($query);
- $AUCTIONS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET auctions = :AUCTIONS";
- $params = array();
- $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
- $db->query($query, $params);
-
- //update closed auction counter
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 1";
- $db->direct_query($query);
- $AUCTIONS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET closedauctions = :AUCTIONS";
- $params = array();
- $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
- $db->query($query, $params);
-
- //update suspended auctions counter
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 0 and suspended != 0";
- $db->direct_query($query);
- $AUCTIONS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = :AUCTIONS";
- $params = array();
- $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
- $db->query($query, $params);
-
- //update bids
- $query = "SELECT COUNT(b.id) As COUNT FROM " . $DBPrefix . "bids b
- LEFT JOIN " . $DBPrefix . "auctions a ON (b.auction = a.id)
- WHERE a.closed = 0 AND a.suspended = 0";
- $db->direct_query($query);
- $BIDS = $db->result('COUNT');
- $query = "UPDATE " . $DBPrefix . "counters SET bids = :BIDS";
- $params = array();
- $params[] = array(':BIDS', $BIDS, 'int');
- $db->query($query, $params);
-
- resync_category_counters();
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['counters_updated']));
- break;
- }
+if (isset($_GET['action']))
+{
+ switch($_GET['action'])
+ {
+ case 'clearcache':
+ if (is_dir(MAIN_PATH . 'cache'))
+ {
+ $dir = opendir(MAIN_PATH . 'cache');
+ while (($myfile = readdir($dir)) !== false)
+ {
+ if ($myfile != '.' && $myfile != '..' && $myfile != 'index.php')
+ {
+ unlink(CACHE_PATH . $myfile);
+ }
+ }
+ closedir($dir);
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0033']));
+ break;
+
+ case 'clear_image_cache':
+ if (is_dir(UPLOAD_PATH . '/cache'))
+ {
+ $dir = opendir(UPLOAD_PATH . '/cache');
+ while (($myfile = readdir($dir)) !== false)
+ {
+ if ($myfile != '.' && $myfile != '..' && $myfile != 'index.php')
+ {
+ unlink(IMAGE_CACHE_PATH . $myfile);
+ }
+ }
+ closedir($dir);
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['30_0033a']));
+ break;
+
+ case 'updatecounters':
+ //update users counter
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "users WHERE suspended = 0";
+ $db->direct_query($query);
+ $USERS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET users = :USERS";
+ $params = array();
+ $params[] = array(':USERS', $USERS, 'int');
+ $db->query($query, $params);
+
+ //update suspended users counter
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "users WHERE suspended != 0";
+ $db->direct_query($query);
+ $USERS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = :USERS";
+ $params = array();
+ $params[] = array(':USERS', $USERS, 'int');
+ $db->query($query, $params);
+
+ //update auction counter
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 0 AND suspended = 0";
+ $db->direct_query($query);
+ $AUCTIONS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET auctions = :AUCTIONS";
+ $params = array();
+ $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
+ $db->query($query, $params);
+
+ //update closed auction counter
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 1";
+ $db->direct_query($query);
+ $AUCTIONS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET closedauctions = :AUCTIONS";
+ $params = array();
+ $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
+ $db->query($query, $params);
+
+ //update suspended auctions counter
+ $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "auctions WHERE closed = 0 and suspended != 0";
+ $db->direct_query($query);
+ $AUCTIONS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET suspendedauctions = :AUCTIONS";
+ $params = array();
+ $params[] = array(':AUCTIONS', $AUCTIONS, 'int');
+ $db->query($query, $params);
+
+ //update bids
+ $query = "SELECT COUNT(b.id) As COUNT FROM " . $DBPrefix . "bids b
+ LEFT JOIN " . $DBPrefix . "auctions a ON (b.auction = a.id)
+ WHERE a.closed = 0 AND a.suspended = 0";
+ $db->direct_query($query);
+ $BIDS = $db->result('COUNT');
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = :BIDS";
+ $params = array();
+ $params[] = array(':BIDS', $BIDS, 'int');
+ $db->query($query, $params);
+
+ resync_category_counters();
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1029']));
+ break;
+ }
}
$query = "SELECT * FROM " . $DBPrefix . "counters";
@@ -126,72 +134,74 @@
$ACCESS['uniquevisitors'] = (!isset($ACCESS['uniquevisitors']) || empty($ACCESS['uniquevisitors'])) ? 0 : $ACCESS['uniquevisitors'];
$ACCESS['usersessions'] = (!isset($ACCESS['usersessions']) || empty($ACCESS['usersessions'])) ? 0 : $ACCESS['usersessions'];
-if ($system->SETTINGS['activationtype'] == 0) {
- $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users WHERE suspended = 10";
- $db->direct_query($query);
- $uuser_count = $db->result('COUNT');
+if ($system->SETTINGS['activationtype'] == 0)
+{
+ $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users WHERE suspended = 10";
+ $db->direct_query($query);
+ $uuser_count = $db->result('COUNT');
}
// version check
-$realversion = '0.0';
+switch ($system->SETTINGS['version_check'])
+{
+ case 'unstable':
+ $url = 'http://www.webidsupport.com/version_unstable.txt';
+ break;
+ default:
+ $url = 'http://www.webidsupport.com/version.txt';
+ break;
+}
+
+if (!($realversion = load_file_from_url($url)))
+{
+ $ERR = $ERR_25_0002;
+ $realversion = 'Unknown';
+}
+
$update_available = false;
-if ($system->SETTINGS['version_check'] !== "") {
- switch ($system->SETTINGS['version_check']) {
- case 'unstable':
- $url = 'http://raw.githubusercontent.com/renlok/WeBid/dev/install/thisversion.txt';
- break;
- default:
- $url = 'http://raw.githubusercontent.com/renlok/WeBid/master/install/thisversion.txt';
- break;
- }
-
- if (!($realversion = load_file_from_url($url))) {
- $ERR = $MSG['error_file_access_disabled'];
- $realversion = $MSG['unknown'];
- }
-
- if (version_compare($system->SETTINGS['version'], $realversion, "<")) {
- $update_available = true;
- $realversion = $MSG['outdated_version'];
- }
+if (version_compare($system->SETTINGS['version'], $realversion, "<"))
+{
+ $update_available = true;
+ $text = $MSG['30_0211'];
}
//getting the correct email settings
$mail_protocol = array('0' => 'WEBID MAIL', '1' => 'MAIL', '2' => 'SMTP', '4' => 'SENDMAIL', '5'=> 'QMAIL', '3' => 'NEVER SEND EMAILS (may be useful for testing purposes)');
$template->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'ADMINMAIL' => $system->SETTINGS['adminmail'],
- 'CRON' => ($system->SETTINGS['cron'] == 1) ? '' . $MSG['batch'] . ' ' . $MSG['25_0027'] : '' . $MSG['non_batch'] . ' ',
- 'GALLERY' => ($system->SETTINGS['picturesgallery'] == 1) ? '' . $MSG['2__0066'] . ' ' . $MSG['gallery_images_allowance'] . ': ' . $system->SETTINGS['maxpictures'] . ' ' . $MSG['gallery_image_max_kb'] . ': ' . $system->SETTINGS['maxuploadsize']/1024 . ' KB' : '' . $MSG['2__0067'] . ' ',
- 'BUY_NOW' => ($system->SETTINGS['buy_now'] == 1) ? '' . $MSG['2__0067'] . ' ' : '' . $MSG['2__0066'] . ' ',
- 'CURRENCY' => $system->SETTINGS['currency'],
- 'TIMEZONE' => $timezones[$system->SETTINGS['timezone']],
- 'DATEFORMAT' => $system->SETTINGS['datesformat'],
- 'DATEEXAMPLE' => ($system->SETTINGS['datesformat'] == 'USA') ? $MSG['american_dates'] : $MSG['european_dates'],
- 'DEFULTCONTRY' => $system->SETTINGS['defaultcountry'],
- 'USERCONF' => $system->SETTINGS['activationtype'],
- 'EMAIL_HANDLER' => $mail_protocol[$system->SETTINGS['mail_protocol']],
-
- 'C_USERS' => $COUNTERS['users'],
- 'C_IUSERS' => $COUNTERS['inactiveusers'],
- 'C_UUSERS' => (isset($uuser_count)) ? $uuser_count : '',
- 'C_AUCTIONS' => $COUNTERS['auctions'],
- 'C_CLOSED' => $COUNTERS['closedauctions'],
- 'C_BIDS' => $COUNTERS['bids'],
-
- 'A_PAGEVIEWS' => $ACCESS['pageviews'],
- 'A_UVISITS' => $ACCESS['uniquevisitors'],
- 'A_USESSIONS' => $ACCESS['usersessions'],
-
- 'THIS_VERSION' => $system->SETTINGS['version'],
- 'CUR_VERSION' => $realversion,
- 'UPDATE_AVAILABLE' => $update_available
- ));
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'ADMINMAIL' => $system->SETTINGS['adminmail'],
+ 'CRON' => ($system->SETTINGS['cron'] == 1) ? '' . $MSG['373'] . ' ' . $MSG['25_0027'] : '' . $MSG['374'] . ' ',
+ 'GALLERY' => ($system->SETTINGS['picturesgallery'] == 1) ? '' . $MSG['2__0066'] . ' ' . $MSG['666'] . ': ' . $system->SETTINGS['maxpictures'] . ' ' . $MSG['671'] . ': ' . $system->SETTINGS['maxuploadsize']/1024 . ' KB' : '' . $MSG['2__0067'] . ' ',
+ 'BUY_NOW' => ($system->SETTINGS['buy_now'] == 1) ? '' . $MSG['2__0067'] . ' ' : '' . $MSG['2__0066'] . ' ',
+ 'CURRENCY' => $system->SETTINGS['currency'],
+ 'TIMEZONE' => $timezones[$system->SETTINGS['timezone']],
+ 'DATEFORMAT' => $system->SETTINGS['datesformat'],
+ 'DATEEXAMPLE' => ($system->SETTINGS['datesformat'] == 'USA') ? $MSG['382'] : $MSG['383'],
+ 'DEFULTCONTRY' => $system->SETTINGS['defaultcountry'],
+ 'USERCONF' => $system->SETTINGS['activationtype'],
+ 'EMAIL_HANDLER' => $mail_protocol[$system->SETTINGS['mail_protocol']],
+
+ 'C_USERS' => $COUNTERS['users'],
+ 'C_IUSERS' => $COUNTERS['inactiveusers'],
+ 'C_UUSERS' => (isset($uuser_count)) ? $uuser_count : '',
+ 'C_AUCTIONS' => $COUNTERS['auctions'],
+ 'C_CLOSED' => $COUNTERS['closedauctions'],
+ 'C_BIDS' => $COUNTERS['bids'],
+
+ 'A_PAGEVIEWS' => $ACCESS['pageviews'],
+ 'A_UVISITS' => $ACCESS['uniquevisitors'],
+ 'A_USESSIONS' => $ACCESS['usersessions'],
+
+ 'THIS_VERSION' => $system->SETTINGS['version'],
+ 'CUR_VERSION' => $realversion,
+ 'UPDATE_AVAILABLE' => $update_available
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'home.tpl'
- ));
+ 'body' => 'home.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/invoice.php b/admin/invoice.php
old mode 100644
new mode 100755
index 7800820ce..b8acbcd7e
--- a/admin/invoice.php
+++ b/admin/invoice.php
@@ -1,6 +1,6 @@
SETTINGS['perpage']);
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == 1)
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+}
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = (($PAGE - 1) * $system->SETTINGS['perpage']);
}
$where_sql = '';
@@ -40,36 +43,42 @@
$pagenation_link = '';
$params = array();
// if we are searching for a user get their id
-if ($searchuser) {
- $query = "SELECT id FROM " . $DBPrefix . "users WHERE nick = :nick";
- $params = array();
- $params[] = array(':nick', $system->cleanvars($username), 'str');
- $db->query($query, $params);
- $user_id = $db->result('id');
- $where_sql .= 'user_id = :user_id';
- $params[] = array(':user_id', $user_id, 'int');
- $pagenation_link .= '&username=' . $username;
+if ($searchuser)
+{
+ $query = "SELECT id FROM " . $DBPrefix . "users WHERE nick = :nick";
+ $params = array();
+ $params[] = array(':nick', $system->cleanvars($username), 'str');
+ $db->query($query, $params);
+ $user_id = $db->result('id');
+ $where_sql .= 'user_id = :user_id';
+ $params[] = array(':user_id', $user_id, 'int');
+ $pagenation_link .= '&username=' . $username;
}
// within a timeframe?
-if ($from_date != 0) {
- if (!empty($where_sql)) {
- $where_sql .= ' AND ';
- }
- $where_sql = 'date > :from_date';
- $params[] = array(':from_date', strtotime($from_date), 'int');
- $pagenation_link .= '&from_date=' . $from_date;
+if ($from_date != 0)
+{
+ if (!empty($where_sql))
+ {
+ $where_sql .= ' AND ';
+ }
+ $where_sql = 'date > :from_date';
+ $params[] = array(':from_date', strtotime($from_date), 'int');
+ $pagenation_link .= '&from_date=' . $from_date;
}
-if ($to_date != 0) {
- if (!empty($where_sql)) {
- $where_sql .= ' AND ';
- }
- $where_sql .= 'date < :to_date';
- $params[] = array(':to_date', strtotime($to_date), 'int');
- $pagenation_link .= '&to_date=' . $to_date;
+if ($to_date != 0)
+{
+ if (!empty($where_sql))
+ {
+ $where_sql .= ' AND ';
+ }
+ $where_sql .= 'date < :to_date';
+ $params[] = array(':to_date', strtotime($to_date), 'int');
+ $pagenation_link .= '&to_date=' . $to_date;
}
-if ($group == 'g') {
- $group_sql = " GROUP BY user_id ";
- $pagenation_link .= '&group=' . $group;
+if ($group == 'g')
+{
+ $group_sql = " GROUP BY user_id ";
+ $pagenation_link .= '&group=' . $group;
}
$join_sql .= " LEFT JOIN " . $DBPrefix . "users u ON (u.id = " . $DBPrefix . "useraccounts.user_id) ";
@@ -83,126 +92,146 @@
$PAGES = ($TOTALAUCTIONS == 0) ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
$query = "SELECT * " . $pull_sql . " FROM " . $DBPrefix . "useraccounts
- " . ((!empty($join_sql)) ? $join_sql : '') . "
- " . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . "
- " . ((!empty($group_sql)) ? $group_sql : '') . " ORDER BY date LIMIT :OFFSET , :perpage";
+ " . ((!empty($join_sql)) ? $join_sql : '') . "
+ " . ((!empty($where_sql)) ? ' WHERE ' . $where_sql : '') . "
+ " . ((!empty($group_sql)) ? $group_sql : '') . " ORDER BY date LIMIT :OFFSET , :perpage";
$params[] = array(':OFFSET', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
$total_all = 0;
-while ($row = $db->fetch()) {
- // build invoice info
- $info = '';
- $auc_id = false;
- if ($row['setup'] != 0) {
- $info .= $MSG['432'] . ' ' . $system->print_money($row['setup']) . ' ';
- $auc_id = true;
- }
- if ($row['featured'] != 0) {
- $info .= $MSG['433'] . ' ' . $system->print_money($row['featured']) . ' ';
- $auc_id = true;
- }
- if ($row['bold'] != 0) {
- $info .= $MSG['439'] . ' ' . $system->print_money($row['bold']) . ' ';
- $auc_id = true;
- }
- if ($row['highlighted'] != 0) {
- $info .= $MSG['434'] . ' ' . $system->print_money($row['highlighted']) . ' ';
- $auc_id = true;
- }
- if ($row['subtitle'] != 0) {
- $info .= $MSG['803'] . ' ' . $system->print_money($row['subtitle']) . ' ';
- $auc_id = true;
- }
- if ($row['relist'] != 0) {
- $info .= $MSG['437'] . ' ' . $system->print_money($row['relist']) . ' ';
- $auc_id = true;
- }
- if ($row['reserve'] != 0) {
- $info .= $MSG['440'] . ' ' . $system->print_money($row['reserve']) . ' ';
- $auc_id = true;
- }
- if ($row['buynow'] != 0) {
- $info .= $MSG['436'] . ' ' . $system->print_money($row['buynow']) . ' ';
- $auc_id = true;
- }
- if ($row['picture'] != 0) {
- $info .= $MSG['435'] . ' ' . $system->print_money($row['picture']) . ' ';
- $auc_id = true;
- }
- if ($row['extracat'] != 0) {
- $info .= $MSG['804'] . ' ' . $system->print_money($row['extracat']) . ' ';
- $auc_id = true;
- }
- if ($row['signup'] != 0) {
- $info .= $MSG['768'] . ' ' . $system->print_money($row['signup']) . ' ';
- }
- if ($row['buyer'] != 0) {
- $info .= $MSG['775'] . ' ' . $system->print_money($row['buyer']) . ' ';
- $auc_id = true;
- }
- if ($row['finalval'] != 0) {
- $info .= $MSG['791'] . ' ' . $system->print_money($row['finalval']) . ' ';
- $auc_id = true;
- }
- if ($row['balance'] != 0) {
- $info .= $MSG['935'] . ' ' . $system->print_money($row['balance']) . ' ';
- }
-
- if ($auc_id) {
- $info = '' . $MSG['1034'] . ' ' . $row['auc_id'] . ' ' . $info;
- }
-
- $template->assign_block_vars('invoices', array(
- 'INVOICE' => $row['useracc_id'],
- 'AUC_ID' => $row['auc_id'],
- 'USER' => (!$searchuser) ? $row['nick'] : '',
- 'DATE' => $dt->printDateTz($row['date']),
- 'INFO' => $info,
- 'TOTAL' => $system->print_money($row['total']),
- 'PAID' => ($row['paid'] == 1), // true if paid
- 'PDF' => $system->SETTINGS['siteurl'] . 'item_invoice.php?id=' . $row['auc_id'],
- ));
- $total_all = $row['total'] + $total_all;
+while ($row = $db->fetch())
+{
+ $DATE = $row['date'] + $system->tdiff;
+
+ // build invoice info
+ $info = '';
+ $auc_id = false;
+ if ($row['setup'] != 0)
+ {
+ $info .= $MSG['432'] . ' ' . $system->print_money($row['setup']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['featured'] != 0)
+ {
+ $info .= $MSG['433'] . ' ' . $system->print_money($row['featured']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['bold'] != 0)
+ {
+ $info .= $MSG['439'] . ' ' . $system->print_money($row['bold']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['highlighted'] != 0)
+ {
+ $info .= $MSG['434'] . ' ' . $system->print_money($row['highlighted']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['subtitle'] != 0)
+ {
+ $info .= $MSG['803'] . ' ' . $system->print_money($row['subtitle']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['relist'] != 0)
+ {
+ $info .= $MSG['437'] . ' ' . $system->print_money($row['relist']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['reserve'] != 0)
+ {
+ $info .= $MSG['440'] . ' ' . $system->print_money($row['reserve']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['buynow'] != 0)
+ {
+ $info .= $MSG['436'] . ' ' . $system->print_money($row['buynow']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['picture'] != 0)
+ {
+ $info .= $MSG['435'] . ' ' . $system->print_money($row['picture']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['extracat'] != 0)
+ {
+ $info .= $MSG['804'] . ' ' . $system->print_money($row['extracat']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['signup'] != 0)
+ {
+ $info .= $MSG['768'] . ' ' . $system->print_money($row['signup']) . ' ';
+ }
+ if ($row['buyer'] != 0)
+ {
+ $info .= $MSG['775'] . ' ' . $system->print_money($row['buyer']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['finalval'] != 0)
+ {
+ $info .= $MSG['791'] . ' ' . $system->print_money($row['finalval']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['balance'] != 0)
+ {
+ $info .= $MSG['935'] . ' ' . $system->print_money($row['balance']) . ' ';
+ }
+
+ if ($auc_id)
+ {
+ $info = '' . $MSG['1034'] . ' ' . $row['auc_id'] . ' ' . $info;
+ }
+
+ $template->assign_block_vars('invoices', array(
+ 'INVOICE' => $row['useracc_id'],
+ 'AUC_ID' => $row['auc_id'],
+ 'USER' => (!$searchuser) ? $row['nick'] : '',
+ 'DATE' => ArrangeDateNoCorrection($DATE),
+ 'INFO' => $info,
+ 'TOTAL' => $system->print_money($row['total']),
+ 'PAID' => ($row['paid'] == 1), // true if paid
+ 'PDF' => $system->SETTINGS['siteurl'] . 'item_invoice.php?id=' . $row['auc_id'],
+ ));
+ $total_all = $row['total'] + $total_all;
+ $in_date[] = $DATE;
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$_SESSION['INVOICE_RETURN'] = 'admin/invoice.php';
$template->assign_vars(array(
- 'GROUP' => isset($_GET['group']) ? $_GET['group'] : 'i',
- 'FROM_DATE' => ($from_date == 0) ? '' : $from_date,
- 'TO_DATE' => ($to_date == 0) ? '' : $to_date,
- 'USER_SEARCH' => (!$searchuser) ? '' : $username,
- 'NO_USER_SEARCH' => (!$searchuser),
- 'HASH' => $_SESSION['WEBID_ADMIN_NUMBER'],
-
- 'PAGNATION' => ($PAGES > 1),
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'GROUP' => isset($_GET['group']) ? $_GET['group'] : 'i',
+ 'FROM_DATE' => ($from_date == 0) ? '' : $from_date,
+ 'TO_DATE' => ($to_date == 0) ? '' : $to_date,
+ 'USER_SEARCH' => (!$searchuser) ? '' : $username,
+ 'NO_USER_SEARCH' => (!$searchuser),
+ 'HASH' => $_SESSION['WEBID_ADMIN_NUMBER'],
+
+ 'PAGNATION' => ($PAGES > 1),
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'invoice.tpl'
- ));
+ 'body' => 'invoice.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/invoice_settings.php b/admin/invoice_settings.php
old mode 100644
new mode 100755
index ac90e8169..c35127367
--- a/admin/invoice_settings.php
+++ b/admin/invoice_settings.php
@@ -1,6 +1,6 @@
writesetting("invoice_yellow_line", $system->cleanvars($_POST['invoice_yellow_line']), "str");
- $system->writesetting("invoice_thankyou", $system->cleanvars($_POST['invoice_thankyou']), "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['invoice_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("invoice_yellow_line", $system->cleanvars($_POST['invoice_yellow_line']), "str");
+ $system->writesetting("invoice_thankyou", $system->cleanvars($_POST['invoice_thankyou']), "str");
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1095']));
}
-loadblock($MSG['invoice_notice'], $MSG['invoice_notice_explain'], 'textarea', 'invoice_yellow_line', $system->SETTINGS['invoice_yellow_line']);
-loadblock($MSG['invoice_end_msg'], $MSG['invoice_end_msg_explain'], 'textarea', 'invoice_thankyou', $system->SETTINGS['invoice_thankyou']);
+loadblock($MSG['1096'], $MSG['1097'], 'textarea', 'invoice_yellow_line', $system->SETTINGS['invoice_yellow_line']);
+loadblock($MSG['1098'], $MSG['1099'], 'textarea', 'invoice_thankyou', $system->SETTINGS['invoice_thankyou']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0012'],
- 'PAGENAME' => $MSG['invoice_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0012'],
+ 'PAGENAME' => $MSG['1094']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/listauctions.php b/admin/listauctions.php
old mode 100644
new mode 100755
index f7a3b95b3..49ca62c54
--- a/admin/listauctions.php
+++ b/admin/listauctions.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
- (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'listauctions.php')) {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
+ (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'listauctions.php'))
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'listauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
-$query = "SELECT COUNT(a.id) as auctions FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.closed = 0 " . $user_sql;
+$query = "SELECT COUNT(a.id) as auctions FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.closed = 0 " . $user_sql;
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(r.id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.closed = 0 " . $user_sql . " GROUP BY a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, m.reason ORDER BY nick LIMIT :offset, :perpage";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.closed = 0 " . $user_sql . " GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-$username = '';
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'TIMESREPORTED' => $row['times_reported'],
- 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => false
- ));
- $username = $row['nick'];
+$username = $bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'TIMESREPORTED' => $row['times_reported'],
+ 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => false,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ $username = $row['nick'];
}
// this is used when viewing a users auctions
-if ((!isset($username) || empty($username)) && $uid > 0) {
- $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $uid, 'int');
- $db->query($query, $params);
- $username = $db->result('nick');
+if ((!isset($username) || empty($username)) && $uid > 0)
+{
+ $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $uid, 'int');
+ $db->query($query, $params);
+ $username = $db->result('nick');
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['view_open_auctions'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => ($uid > 0),
- 'USERNAME' => $username,
+ 'PAGE_TITLE' => $MSG['067'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => ($uid > 0),
+ 'USERNAME' => $username,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listauctions.tpl'
- ));
+ 'body' => 'listauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/listclosedauctions.php b/admin/listclosedauctions.php
old mode 100644
new mode 100755
index 86a1c2b3b..b7ebd70bb
--- a/admin/listclosedauctions.php
+++ b/admin/listclosedauctions.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listclosedauctions.php') {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listclosedauctions.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'listclosedauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
$query = "SELECT COUNT(a.id) as auctions FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.closed = 1 AND a.suspended = 0";
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.closed = 1 AND a.suspended = 0";
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(w.id) as winners, COUNT(r.id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- LEFT JOIN " . $DBPrefix . "winners w ON (w.auction = a.id)
- LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.closed = 1 AND a.suspended = 0 GROUP BY a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, m.reason ORDER BY nick LIMIT :offset, :perpage";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ LEFT JOIN " . $DBPrefix . "winners w ON (w.auction = a.id)
+ LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.closed = 1 AND a.suspended = 0 GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'TIMESREPORTED' => $row['times_reported'],
- 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => ($row['winners'] == 0) ? false : true
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'TIMESREPORTED' => $row['times_reported'],
+ 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => ($row['winners'] == 0) ? false : true,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['214'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => false, // needs decaring as listauctions.tpl is shared and expects B_SEARCHUSER to be declared. Used in users->view actions link
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PAGE_TITLE' => $MSG['214'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => false, // needs decaring as listauctions.tpl is shared and expects B_SEARCHUSER to be declared. Used in users->view actions link
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listauctions.tpl'
- ));
+ 'body' => 'listauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/listreportedauctions.php b/admin/listreportedauctions.php
old mode 100644
new mode 100755
index 6f2727d2e..fb0742a31
--- a/admin/listreportedauctions.php
+++ b/admin/listreportedauctions.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listreportedauctions.php') {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listreportedauctions.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'listreportedauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
$query = "SELECT COUNT(a.id) As auctions FROM " . $DBPrefix . "auctions a
- INNER JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- WHERE a.closed = 0 AND a.suspended = 0 " . $user_sql;
+ INNER JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ WHERE a.closed = 0 AND a.suspended = 0 " . $user_sql;
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(r.auction_id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- INNER JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.closed = 0 AND a.suspended = 0 " . $user_sql . " GROUP BY a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, m.reason ORDER BY nick LIMIT :offset, :perpage";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ INNER JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.closed = 0 AND a.suspended = 0 " . $user_sql . " GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-$username = '';
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'TIMESREPORTED' => $row['times_reported'],
- 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => false
- ));
- $username = $row['nick'];
+$username = $bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'TIMESREPORTED' => $row['times_reported'],
+ 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => false,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ $username = $row['nick'];
}
// this is used when viewing a users auctions
-if ((!isset($username) || empty($username)) && $uid > 0) {
- $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $uid, 'int');
- $db->query($query, $params);
- $username = $db->result('nick');
+if ((!isset($username) || empty($username)) && $uid > 0)
+{
+ $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $uid, 'int');
+ $db->query($query, $params);
+ $username = $db->result('nick');
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['view_reported_auctions'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => ($uid > 0),
- 'USERNAME' => $username,
+ 'PAGE_TITLE' => $MSG['view_reported_auctions'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => ($uid > 0),
+ 'USERNAME' => $username,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listauctions.tpl'
- ));
+ 'body' => 'listauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/listsuspendedauctions.php b/admin/listsuspendedauctions.php
old mode 100644
new mode 100755
index c85d14544..d06e308b6
--- a/admin/listsuspendedauctions.php
+++ b/admin/listsuspendedauctions.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
- (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'listsuspendedauctions.php')) {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
+ (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'listsuspendedauctions.php'))
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'listsuspendedauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
$query = "SELECT COUNT(a.id) as auctions FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.suspended != 0";
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.suspended != 0";
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
-$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(r.id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE m.reason IS NULL AND a.suspended != 0 GROUP BY a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, m.reason ORDER BY nick LIMIT :offset, :perpage";
+$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(r.id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ LEFT JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE m.reason IS NULL AND a.suspended != 0 GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'TIMESREPORTED' => $row['times_reported'],
- 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => false
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'TIMESREPORTED' => $row['times_reported'],
+ 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => false,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['view_suspended_auctions'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => false, // needs decaring as listauctions.tpl is shared and expects B_SEARCHUSER to be declared. Used in users->view actions link
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PAGE_TITLE' => $MSG['5227'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => false, // needs decaring as listauctions.tpl is shared and expects B_SEARCHUSER to be declared. Used in users->view actions link
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listauctions.tpl'
- ));
+ 'body' => 'listauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/listusers.php b/admin/listusers.php
old mode 100644
new mode 100755
index dc3ff5adb..fad8a0d62
--- a/admin/listusers.php
+++ b/admin/listusers.php
@@ -1,6 +1,6 @@
query($query, $params);
- if ($db->numrows() > 0) {
- $USER = $db->result();
-
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'ADMINMAIL' => $system->SETTINGS['adminmail'],
- 'CONFIRMURL' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $USER['id'] . '&hash=' . md5($MD5_PREFIX . $USER['hash']),
- 'C_NAME' => $USER['name']
- ));
- $emailer->email_uid = $USER['id'];
- $emailer->email_sender($USER['email'], 'usermail.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['098']);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['059']));
- }
-}
-
-if (isset($_GET['payreminder']) && isset($_GET['id']) && is_numeric($_GET['id'])) {
- $query = "SELECT id, name, email, balance FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_GET['id'], 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $USER = $db->result();
-
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'LINK' => $system->SETTINGS['siteurl'] . 'outstanding.php',
- 'C_NAME' => $USER['name'],
- 'BALANCE' => $USER['balance']
- ));
- $emailer->email_uid = $USER['id'];
- $emailer->email_sender($USER['email'], 'payment_reminder.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['766']);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['765']));
- }
-}
-
-if (isset($_GET['usersfilter'])) {
- $_SESSION['usersfilter'] = $_GET['usersfilter'];
- switch ($_GET['usersfilter']) {
- case 'all':
- unset($_SESSION['usersfilter']);
- unset($Q);
- break;
- case 'active':
- $Q = 0;
- break;
- case 'admin':
- $Q = 1;
- break;
- case 'confirmed':
- $Q = 8;
- break;
- case 'fee':
- $Q = 9;
- break;
- case 'admin_approve':
- $Q = 10;
- break;
- }
-} elseif (!isset($_GET['usersfilter']) && isset($_SESSION['usersfilter'])) {
- switch ($_SESSION['usersfilter']) {
- case 'active':
- $Q = 0;
- break;
- case 'admin':
- $Q = 1;
- break;
- case 'confirmed':
- $Q = 8;
- break;
- case 'fee':
- $Q = 9;
- break;
- case 'admin_approve':
- $Q = 10;
- break;
- }
-} else {
- unset($_SESSION['usersfilter']);
- unset($Q);
+if (isset($_GET['resend']) && isset($_GET['id']) && is_numeric($_GET['id']))
+{
+ $query = "SELECT id, nick, name, email, hash FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_GET['id'], 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $USER = $db->result();
+
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ADMINMAIL' => $system->SETTINGS['adminmail'],
+ 'CONFIRMURL' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $USER['id'] . '&hash=' . md5($MD5_PREFIX . $USER['hash']),
+ 'C_NAME' => $USER['name']
+ ));
+ $emailer->email_uid = $USER['id'];
+ $emailer->email_sender($USER['email'], 'usermail.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['098']);
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['059']));
+ }
+}
+
+if (isset($_GET['payreminder']) && isset($_GET['id']) && is_numeric($_GET['id']))
+{
+ $query = "SELECT id, name, email, balance FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_GET['id'], 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $USER = $db->result();
+
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'LINK' => $system->SETTINGS['siteurl'] . 'outstanding.php',
+ 'C_NAME' => $USER['name'],
+ 'BALANCE' => $USER['balance']
+ ));
+ $emailer->email_uid = $USER['id'];
+ $emailer->email_sender($USER['email'], 'payment_reminder.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['766']);
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['765']));
+ }
+}
+
+if (isset($_GET['usersfilter']))
+{
+ $_SESSION['usersfilter'] = $_GET['usersfilter'];
+ switch($_GET['usersfilter'])
+ {
+ case 'all':
+ unset($_SESSION['usersfilter']);
+ unset($Q);
+ break;
+ case 'active':
+ $Q = 0;
+ break;
+ case 'admin':
+ $Q = 1;
+ break;
+ case 'confirmed':
+ $Q = 8;
+ break;
+ case 'fee':
+ $Q = 9;
+ break;
+ case 'admin_approve':
+ $Q = 10;
+ break;
+ }
+}
+elseif (!isset($_GET['usersfilter']) && isset($_SESSION['usersfilter']))
+{
+ switch($_SESSION['usersfilter'])
+ {
+ case 'active':
+ $Q = 0;
+ break;
+ case 'admin':
+ $Q = 1;
+ break;
+ case 'confirmed':
+ $Q = 8;
+ break;
+ case 'fee':
+ $Q = 9;
+ break;
+ case 'admin_approve':
+ $Q = 10;
+ break;
+ }
+}
+else
+{
+ unset($_SESSION['usersfilter']);
+ unset($Q);
}
// Retrieve active users from the database
$params = array();
-if (isset($Q)) {
- $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users WHERE suspended = " . $Q;
-} elseif (isset($_POST['keyword'])) {
- $keyword = $system->cleanvars($_POST['keyword']);
- $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users
- WHERE name LIKE :name OR nick LIKE :nick OR email LIKE :email";
- $params[] = array(':name', '%' . $keyword . '%', 'str');
- $params[] = array(':nick', '%' . $keyword . '%', 'str');
- $params[] = array(':email', '%' . $keyword . '%', 'str');
-} else {
- $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users";
+if (isset($Q))
+{
+ $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users WHERE suspended = " . $Q;
+}
+elseif (isset($_POST['keyword']))
+{
+ $keyword = $system->cleanvars($_POST['keyword']);
+ $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users
+ WHERE name LIKE :name OR nick LIKE :nick OR email LIKE :email";
+ $params[] = array(':name', '%' . $keyword . '%', 'str');
+ $params[] = array(':nick', '%' . $keyword . '%', 'str');
+ $params[] = array(':email', '%' . $keyword . '%', 'str');
+}
+else
+{
+ $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "users";
}
$db->query($query, $params);
$TOTALUSERS = $db->result('COUNT');
-
// get page limits
-if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE'])) {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listusers.php') {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'listusers.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'listusers.php';
@@ -141,67 +161,79 @@
$PAGES = ($TOTALUSERS == 0) ? 1 : ceil($TOTALUSERS / $system->SETTINGS['perpage']);
$params = array();
-if (isset($Q)) {
- $query = "SELECT * FROM " . $DBPrefix . "users WHERE suspended = " . $Q;
-} elseif (isset($_POST['keyword'])) {
- $query = "SELECT * FROM " . $DBPrefix . "users
- WHERE name LIKE :name OR nick LIKE :nick OR email LIKE :email";
- $params[] = array(':name', '%' . $keyword . '%', 'str');
- $params[] = array(':nick', '%' . $keyword . '%', 'str');
- $params[] = array(':email', '%' . $keyword . '%', 'str');
-} else {
- $query = "SELECT * FROM " . $DBPrefix . "users";
+if (isset($Q))
+{
+ $query = "SELECT * FROM " . $DBPrefix . "users WHERE suspended = " . $Q;
+}
+elseif (isset($_POST['keyword']))
+{
+ $query = "SELECT * FROM " . $DBPrefix . "users
+ WHERE name LIKE :name OR nick LIKE :nick OR email LIKE :email";
+ $params[] = array(':name', '%' . $keyword . '%', 'str');
+ $params[] = array(':nick', '%' . $keyword . '%', 'str');
+ $params[] = array(':email', '%' . $keyword . '%', 'str');
+}
+else
+{
+ $query = "SELECT * FROM " . $DBPrefix . "users";
}
$query .= " ORDER BY nick"; // ordered by
$query .= " LIMIT :offset, :perpage";
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
+$bg = '';
+
+
$db->query($query, $params);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('users', array(
- 'ID' => $row['id'],
- 'NICK' => $row['nick'],
- 'NAME' => $row['name'],
- 'COUNTRY' => $row['country'],
- 'EMAIL' => $row['email'],
- 'NEWSLETTER' => ($row['nletter'] == 1) ? $MSG['yes'] : $MSG['no'],
- 'SUSPENDED' => $row['suspended'],
- 'BALANCE' => $system->print_money($row['balance']),
- 'BALANCE_CLEAN' => $row['balance']
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('users', array(
+ 'ID' => $row['id'],
+ 'NICK' => $row['nick'],
+ 'NAME' => $row['name'],
+ 'COUNTRY' => $row['country'],
+ 'EMAIL' => $row['email'],
+ 'NEWSLETTER' => ($row['nletter'] == 1) ? $MSG['030'] : $MSG['029'],
+ 'SUSPENDED' => $row['suspended'],
+ 'BALANCE' => $system->print_money($row['balance']),
+ 'BALANCE_CLEAN' => $row['balance'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'TOTALUSERS' => $TOTALUSERS,
- 'USERFILTER' => (isset($_SESSION['usersfilter'])) ? $_SESSION['usersfilter'] : '',
+ 'TOTALUSERS' => $TOTALUSERS,
+ 'USERFILTER' => (isset($_SESSION['usersfilter'])) ? $_SESSION['usersfilter'] : '',
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listusers.tpl'
- ));
+ 'body' => 'listusers.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/loggedin.inc.php b/admin/loggedin.inc.php
old mode 100644
new mode 100755
index ece86fde9..68bb729fb
--- a/admin/loggedin.inc.php
+++ b/admin/loggedin.inc.php
@@ -1,6 +1,6 @@
check
- $valid_req = ($_POST['csrftoken'] == $_SESSION['csrftoken']);
- } else {
- $valid_req = true;
- } # Neither GET nor POST params exist => permit
- if (!$valid_req) {
- global $MSG, $ERR_077;
+if(isset($_SESSION['csrftoken']))
+{
+ # Token should exist as soon as a user is logged in
+ if(1 < count($_POST)) # More than 2 parameters in a POST (csrftoken + 1 more) => check
+ $valid_req = ($_POST['csrftoken'] == $_SESSION['csrftoken']);
+ else
+ $valid_req = true; # Neither GET nor POST params exist => permit
+ if(!$valid_req)
+ {
+ global $MSG, $ERR_077;
- $_SESSION['msg_title'] = $MSG['936'];
- $_SESSION['msg_body'] = $ERR_077;
- header('location: ../message.php');
- exit; // kill the page
- }
-} else {
- header("location: login.php");
- exit;
+ $_SESSION['msg_title'] = $MSG['936'];
+ $_SESSION['msg_body'] = $ERR_077;
+ header('location: ../message.php');
+ exit; // kill the page
+ }
+}
+else
+{
+ header("location: login.php");
+ exit;
}
-if (checklogin()) {
- header("location: login.php");
- exit;
-} else {
- // update admin notes
- if (isset($_POST['anotes'])) {
- $query = "UPDATE " . $DBPrefix . "adminusers SET notes = :admin_note WHERE id = :admin_id";
- $params = array();
- $params[] = array(':admin_note', $_POST['anotes'], 'str');
- $params[] = array(':admin_id', $_SESSION['WEBID_ADMIN_IN'], 'int');
- $db->query($query, $params);
- }
+if (checklogin())
+{
+ header("location: login.php");
+ exit;
+}
+else
+{
+ // update admin notes
+ if (isset($_POST['anotes']))
+ {
+ $query = "UPDATE " . $DBPrefix . "adminusers SET notes = :admin_note WHERE id = :admin_id";
+ $params = array();
+ $params[] = array(':admin_note', $_POST['anotes'], 'str');
+ $params[] = array(':admin_id', $_SESSION['WEBID_ADMIN_IN'], 'int');
+ $db->query($query, $params);
+ }
- $mth = 'MON_0' . date('m', $_SESSION['WEBID_ADMIN_TIME']);
- $return = date('d', $_SESSION['WEBID_ADMIN_TIME']) . ' ' . $MSG[$mth] . ', ' . date('Y - H:i', $_SESSION['WEBID_ADMIN_TIME']);
- $template->assign_vars(array(
- 'DOCDIR' => $DOCDIR,
- 'THEME' => $system->SETTINGS['theme'],
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'CHARSET' => $CHARSET,
- 'ADMIN_USER' => $_SESSION['WEBID_ADMIN_USER'],
- 'ADMIN_ID' => $_SESSION['WEBID_ADMIN_IN'],
- 'CURRENT_PAGE' => $current_page,
- 'LAST_LOGIN' => $return,
- 'ADMIN_NOTES' => getAdminNotes(),
- 'L_COPY_YEAR' => date("Y")
- ));
- foreach ($LANGUAGES as $lang => $value) {
- $template->assign_block_vars('langs', array(
- 'LANG' => $value,
- 'B_DEFAULT' => ($lang == $language)
- ));
- }
+ $mth = 'MON_0' . date('m', $_SESSION['WEBID_ADMIN_TIME']);
+ $return = date('d', $_SESSION['WEBID_ADMIN_TIME']) . ' ' . $MSG[$mth] . ', ' . date('Y - H:i', $_SESSION['WEBID_ADMIN_TIME']);
+ $template->assign_vars(array(
+ 'DOCDIR' => $DOCDIR,
+ 'THEME' => $system->SETTINGS['theme'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'CHARSET' => $CHARSET,
+ 'ADMIN_USER' => $_SESSION['WEBID_ADMIN_USER'],
+ 'ADMIN_ID' => $_SESSION['WEBID_ADMIN_IN'],
+ 'CURRENT_PAGE' => $current_page,
+ 'LAST_LOGIN' => $return,
+ 'ADMIN_NOTES' => getAdminNotes(),
+ 'L_COPY_YEAR' => date("Y")
+ ));
+ foreach ($LANGUAGES as $lang => $value)
+ {
+ $template->assign_block_vars('langs', array(
+ 'LANG' => $value,
+ 'B_DEFAULT' => ($lang == $language)
+ ));
+ }
}
+?>
diff --git a/admin/login.php b/admin/login.php
old mode 100644
new mode 100755
index 838c7e95c..71280bd3b
--- a/admin/login.php
+++ b/admin/login.php
@@ -1,6 +1,6 @@
direct_query($query);
- if ($db->numrows() > 0) {
- header('location: login.php');
- exit;
- }
- if ($_POST['password'] != $_POST['repeat_password']) {
- $ERR = $ERR_006;
- } else {
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query = "INSERT INTO " . $DBPrefix . "adminusers (username, password, hash, status) VALUES
- (:username, :password, :hash, 1)";
- $params = array();
- $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
- $params[] = array(':hash', get_hash(), 'str');
- $db->query($query, $params);
- // Redirect
- header('location: login.php');
- exit;
- }
- break;
+if (isset($_POST['action']))
+{
+ switch ($_POST['action'])
+ {
+ case 'insert':
+ // Additional security check
+ $query = "SELECT id FROM " . $DBPrefix . "adminusers";
+ $db->direct_query($query);
+ if ($db->numrows() > 0)
+ {
+ header('location: login.php');
+ exit;
+ }
+ if ($_POST['password'] != $_POST['repeat_password'])
+ {
+ $ERR = $ERR_006;
+ }
+ else
+ {
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query = "INSERT INTO " . $DBPrefix . "adminusers (username, password, hash, created, lastlogin, status) VALUES
+ (:username, :password, :hash, :created, :lastlogin, 1)";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
+ $params[] = array(':hash', get_hash(), 'str');
+ $params[] = array(':created', date('Ymd'), 'str');
+ $params[] = array(':lastlogin', time(), 'int');
+ $db->query($query, $params);
+ // Redirect
+ header('location: login.php');
+ exit;
+ }
+ break;
- case 'login':
- if (strlen($_POST['username']) == 0 || strlen($_POST['password']) == 0) {
- $ERR = $ERR_047;
- } elseif (!preg_match('([a-zA-Z0-9]*)', $_POST['username'])) {
- $ERR = $ERR_071;
- } else {
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query = "SELECT id, hash, password, password_type FROM " . $DBPrefix . "adminusers WHERE username = :username AND status = 1";
- $params = array();
- $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
- $db->query($query, $params);
- $admin = $db->result();
+ case 'login':
+ if (strlen($_POST['username']) == 0 || strlen($_POST['password']) == 0)
+ {
+ $ERR = $ERR_047;
+ }
+ elseif (!preg_match('([a-zA-Z0-9]*)', $_POST['username']))
+ {
+ $ERR = $ERR_071;
+ }
+ else
+ {
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query = "SELECT id, hash, password, password_type FROM " . $DBPrefix . "adminusers WHERE username = :username AND status = 1";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
+ $db->query($query, $params);
+ $admin = $db->result();
- if ($admin['password_type'] == 0 && $admin['password'] == md5($MD5_PREFIX . $_POST['password'])) {
- $query = "UPDATE " . $DBPrefix . "adminusers SET password = :password, password_type = 1 WHERE id = :admin_id";
- $params = array();
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'int');
- $params[] = array(':admin_id', $admin['id'], 'int');
- $db->query($query, $params);
+ if ($admin['password_type'] == 0 && $admin['password'] == md5($MD5_PREFIX . $_POST['password']))
+ {
+ $query = "UPDATE " . $DBPrefix . "adminusers SET password = :password, password_type = 1 WHERE id = :admin_id";
+ $params = array();
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'int');
+ $params[] = array(':admin_id', $admin['id'], 'int');
+ $db->query($query, $params);
- $query = "SELECT id, hash, password, password_type FROM " . $DBPrefix . "adminusers WHERE username = :username AND status = 1";
- $params = array();
- $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
- $db->query($query, $params);
- $admin = $db->result();
- }
-
- if ($db->numrows() == 0 || !($phpass->CheckPassword($_POST['password'], $admin['password']))) {
- $ERR = $ERR_048;
- } else {
- // generate a random unguessable token
- $_SESSION['csrftoken'] = md5(uniqid(rand(), true));
- // Set sessions vars
- $_SESSION['WEBID_ADMIN_NUMBER'] = strspn($admin['password'], $admin['hash']);
- $_SESSION['WEBID_ADMIN_PASS'] = $admin['password'];
- $_SESSION['WEBID_ADMIN_IN'] = $admin['id'];
- $_SESSION['WEBID_ADMIN_USER'] = $_POST['username'];
- $_SESSION['WEBID_ADMIN_TIME'] = $system->ctime;
- // Update last login information for this user
- $query = "UPDATE " . $DBPrefix . "adminusers SET lastlogin = CURRENT_TIMESTAMP WHERE id = :admin_id";
- $params = array();
- $params[] = array(':admin_id', $admin['id'], 'int');
- $db->query($query, $params);
- // Redirect
- header('location: index.php');
- exit;
- }
- }
- break;
- }
+ $query = "SELECT id, hash, password, password_type FROM " . $DBPrefix . "adminusers WHERE username = :username AND status = 1";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
+ $db->query($query, $params);
+ $admin = $db->result();
+ }
+
+ if ($db->numrows() == 0 || !($phpass->CheckPassword($_POST['password'], $admin['password'])))
+ {
+ $ERR = $ERR_048;
+ }
+ else
+ {
+ // generate a random unguessable token
+ $_SESSION['csrftoken'] = md5(uniqid(rand(), true));
+ // Set sessions vars
+ $_SESSION['WEBID_ADMIN_NUMBER'] = strspn($admin['password'], $admin['hash']);
+ $_SESSION['WEBID_ADMIN_PASS'] = $admin['password'];
+ $_SESSION['WEBID_ADMIN_IN'] = $admin['id'];
+ $_SESSION['WEBID_ADMIN_USER'] = $_POST['username'];
+ $_SESSION['WEBID_ADMIN_TIME'] = $system->ctime;
+ // Update last login information for this user
+ $query = "UPDATE " . $DBPrefix . "adminusers SET lastlogin = :lastlogin WHERE id = :admin_id";
+ $params = array();
+ $params[] = array(':lastlogin', time(), 'int');
+ $params[] = array(':admin_id', $admin['id'], 'int');
+ $db->query($query, $params);
+ // Redirect
+ header('location: index.php');
+ exit;
+ }
+ }
+ break;
+ }
}
$query = "SELECT id FROM " . $DBPrefix . "adminusers LIMIT 1";
$db->direct_query($query);
$template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'THEME' => $system->SETTINGS['admin_theme'],
- 'L_COPY_YEAR' => date("Y"),
- 'PAGE' => ($db->numrows() == 0) ? 1 : 2
- ));
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'THEME' => $system->SETTINGS['admin_theme'],
+ 'L_COPY_YEAR' => date("Y"),
+ 'PAGE' => ($db->numrows() == 0) ? 1 : 2
+ ));
$template->set_filenames(array(
- 'body' => 'login.tpl'
- ));
+ 'body' => 'login.tpl'
+ ));
$template->display('body');
+include 'footer.php';
+?>
diff --git a/admin/logo_upload.php b/admin/logo_upload.php
old mode 100644
new mode 100755
index bac04a8e3..975cb3bb7
--- a/admin/logo_upload.php
+++ b/admin/logo_upload.php
@@ -1,6 +1,6 @@
3) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_602));
- } elseif (!empty($_FILES['logo']['tmp_name']) && $_FILES['logo']['tmp_name'] != "none") {
- if (move_uploaded_file($_FILES['logo']['tmp_name'], UPLOAD_PATH . 'logo/' . $_FILES['logo']['name'])) {
- $system->writesetting("logo", $_FILES['logo']['name'], "str");
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['upload_failed']));
- }
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['logo_upload_success']));
+if (isset($_POST['action']) && $_POST['action'] == "update")
+{
+ if (isset($_FILES['logo']['tmp_name']) && !empty($_FILES['logo']['tmp_name']))
+ {
+ // Handle logo upload
+ $inf = GetImageSize($_FILES['logo']['tmp_name']);
+ if ($inf[2] < 1 || $inf[2] > 3)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_602));
+ }
+ else if (!empty($_FILES['logo']['tmp_name']) && $_FILES['logo']['tmp_name'] != "none")
+ {
+ if (move_uploaded_file($_FILES['logo']['tmp_name'], UPLOAD_PATH . 'logo/' . $_FILES['logo']['name']))
+ {
+ $system->writesetting("logo", $_FILES['logo']['name'], "str");
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['upload_failed']));
+ }
+ }
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['logo_upload_success']));
}
$logoURL = $system->SETTINGS['siteurl'] . 'uploaded/logo/' . $system->SETTINGS['logo'];
-loadblock($MSG['your_logo'], $MSG['current_logo'], 'image', 'logo', $system->SETTINGS['logo']);
-loadblock('', $MSG['upload_new_logo'], 'upload', 'logo', $system->SETTINGS['logo']);
+loadblock($MSG['531'], $MSG['556'], 'image', 'logo', $system->SETTINGS['logo']);
+loadblock('', $MSG['602'], 'upload', 'logo', $system->SETTINGS['logo']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'IMAGEURL' => $logoURL,
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'IMAGEURL' => $logoURL,
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'logo_upload.tpl'
- ));
+ 'body' => 'logo_upload.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/logout.php b/admin/logout.php
old mode 100644
new mode 100755
index 3110b16ff..997f7c8d1
--- a/admin/logout.php
+++ b/admin/logout.php
@@ -1,6 +1,6 @@
+
\ No newline at end of file
diff --git a/admin/maintainance.php b/admin/maintainance.php
new file mode 100755
index 000000000..0510ca255
--- /dev/null
+++ b/admin/maintainance.php
@@ -0,0 +1,68 @@
+query($query, $params);
+ if ($db->numrows() == 0 && $_POST['maintainancemodeactive'] == 1)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_025));
+ }
+ else
+ {
+ $system->writesetting("superuser", $superuser, 'string');
+ $system->writesetting("maintainance_text", $system->cleanvars($_POST['maintainancetext'], true), 'string');
+ $system->writesetting("maintainance_mode_active", $_POST['maintainancemodeactive'], 'bool');
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['_0005']));
+ }
+}
+
+loadblock('', $MSG['_0002']);
+loadblock($MSG['_0006'], '', 'bool', 'maintainancemodeactive', $system->SETTINGS['maintainance_mode_active'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['003'], '', 'text', 'superuser', $system->SETTINGS['superuser'], array($MSG['030'], $MSG['029']));
+
+$CKEditor = new CKEditor();
+$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
+$CKEditor->returnOutput = true;
+$CKEditor->config['width'] = 550;
+$CKEditor->config['height'] = 400;
+
+loadblock($MSG['_0004'], '', $CKEditor->editor('maintainancetext', $system->SETTINGS['maintainance_text']));
+
+$template->assign_vars(array(
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5436'],
+ 'PAGENAME' => $MSG['_0001']
+ ));
+
+include 'header.php';
+$template->set_filenames(array(
+ 'body' => 'adminpages.tpl'
+ ));
+$template->display('body');
+include 'footer.php';
+?>
diff --git a/admin/maintenance.php b/admin/maintenance.php
deleted file mode 100644
index bdfb19eed..000000000
--- a/admin/maintenance.php
+++ /dev/null
@@ -1,62 +0,0 @@
-query($query, $params);
- if ($db->numrows() == 0 && $_POST['maintenancemodeactive'] == 1) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_025));
- } else {
- $system->writesetting("superuser", $superuser, 'string');
- $system->writesetting("maintenance_text", $system->cleanvars($_POST['maintenancetext'], true), 'string');
- $system->writesetting("maintenance_mode_active", $_POST['maintenancemodeactive'], 'bool');
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['maintenance_settings_updated']));
- }
-}
-
-loadblock($MSG['enable_maintenance_mode'], $MSG['enable_maintenance_mode_explain'], 'bool', 'maintenancemodeactive', $system->SETTINGS['maintenance_mode_active'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['username'], '', 'text', 'superuser', $system->SETTINGS['superuser'], array($MSG['yes'], $MSG['no']));
-
-$CKEditor = new CKEditor();
-$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
-$CKEditor->returnOutput = true;
-$CKEditor->config['width'] = 550;
-$CKEditor->config['height'] = 400;
-
-loadblock($MSG['maintenance_mode_msg'], '', $CKEditor->editor('maintenancetext', $system->SETTINGS['maintenance_text']));
-
-$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5436'],
- 'PAGENAME' => $MSG['maintenance_settings']
- ));
-
-include 'header.php';
-$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
-$template->display('body');
-include 'footer.php';
diff --git a/admin/managebanners.php b/admin/managebanners.php
old mode 100644
new mode 100755
index 435aec4c2..5f089cdba
--- a/admin/managebanners.php
+++ b/admin/managebanners.php
@@ -1,6 +1,6 @@
$v) {
- $params = array();
- $params[] = array(':user_id', $v, 'int');
- $query = "DELETE FROM " . $DBPrefix . "banners WHERE user = :user_id";
- $db->query($query, $params);
- $query = "DELETE FROM " . $DBPrefix . "bannersusers WHERE id = :user_id";
- $db->query($query, $params);
- }
+if (isset($_POST['delete']) && is_array($_POST['delete']))
+{
+ foreach ($_POST['delete'] as $k => $v)
+ {
+ $params = array();
+ $params[] = array(':user_id', $v, 'int');
+ $query = "DELETE FROM " . $DBPrefix . "banners WHERE user = :user_id";
+ $db->query($query, $params);
+ $query = "DELETE FROM " . $DBPrefix . "bannersusers WHERE id = :user_id";
+ $db->query($query, $params);
+ }
}
// Retrieve users from the database
$query = "SELECT u.*, COUNT(b.user) as count FROM " . $DBPrefix . "bannersusers u
- LEFT JOIN " . $DBPrefix . "banners b ON (b.user = u.id)
- GROUP BY u.id ORDER BY u.name";
+ LEFT JOIN " . $DBPrefix . "banners b ON (b.user = u.id)
+ GROUP BY u.id ORDER BY u.name";
$db->direct_query($query);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('busers', array(
- 'ID' => $row['id'],
- 'NAME' => $row['name'],
- 'COMPANY' => $row['company'],
- 'EMAIL' => $row['email'],
- 'NUM_BANNERS' => $row['count']
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('busers', array(
+ 'ID' => $row['id'],
+ 'NAME' => $row['name'],
+ 'COMPANY' => $row['company'],
+ 'EMAIL' => $row['email'],
+ 'NUM_BANNERS' => $row['count'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'managebanners.tpl'
- ));
+ 'body' => 'managebanners.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/membertypes.php b/admin/membertypes.php
old mode 100644
new mode 100755
index 20fa916f2..359ab15da
--- a/admin/membertypes.php
+++ b/admin/membertypes.php
@@ -1,6 +1,6 @@
query($query, $params);
- }
+ // delete with the deletes
+ if (isset($_POST['delete']) && is_array($_POST['delete']))
+ {
+ $idslist = implode(',', $_POST['delete']);
+ $query = "DELETE FROM " . $DBPrefix . "membertypes WHERE id IN (:idslist)";
+ $params = array();
+ $params[] = array(':idslist', $idslist, 'str');
+ $db->query($query, $params);
+ }
- // now update everything else
- if (is_array($old_membertypes)) {
- foreach ($old_membertypes as $id => $val) {
- if ($val != $new_membertypes[$id]) {
- $query = "UPDATE " . $DBPrefix . "membertypes SET
- feedbacks = :feedbacks,
- icon = :icon
- WHERE id = :id";
- $params = array();
- $params[] = array(':feedbacks', $new_membertypes[$id]['feedbacks'], 'int');
- $params[] = array(':icon', $new_membertypes[$id]['icon'], 'str');
- $params[] = array(':id', $id, 'int');
- $db->query($query, $params);
- }
- }
- }
+ // now update everything else
+ if (is_array($old_membertypes))
+ {
+ foreach ($old_membertypes as $id => $val)
+ {
+ if ( $val != $new_membertypes[$id])
+ {
+ $query = "UPDATE " . $DBPrefix . "membertypes SET
+ feedbacks = :feedbacks,
+ icon = :icon
+ WHERE id = :id";
+ $params = array();
+ $params[] = array(':feedbacks', $new_membertypes[$id]['feedbacks'], 'int');
+ $params[] = array(':icon', $new_membertypes[$id]['icon'], 'str');
+ $params[] = array(':id', $id, 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
- // If a new membertype was added, insert it into database
- if (!empty($new_membertype['feedbacks'])) {
- $query = "INSERT INTO " . $DBPrefix . "membertypes VALUES (NULL, :feedbacks, :icon);";
- $params = array();
- $params[] = array(':feedbacks', $new_membertype['feedbacks'], 'int');
- $params[] = array(':icon', $new_membertype['icon'], 'str');
- $db->query($query, $params);
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['member_types_updates']));
+ // If a new membertype was added, insert it into database
+ if (!empty($new_membertype['feedbacks']))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "membertypes VALUES (NULL, :feedbacks, :icon);";
+ $params = array();
+ $params[] = array(':feedbacks', $new_membertype['feedbacks'], 'int');
+ $params[] = array(':icon', $new_membertype['icon'], 'str');
+ $db->query($query, $params);
+ }
+ rebuild_table_file('membertypes');
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['836']));
}
-$query = "SELECT id, feedbacks, icon FROM " . $DBPrefix . "membertypes ORDER BY feedbacks DESC;";
-$db->direct_query($query);
-while ($membertype = $db->fetch()) {
- $template->assign_block_vars('mtype', array(
- 'ID' => $membertype['id'],
- 'FEEDBACK' => $membertype['feedbacks'],
- 'ICON' => $membertype['icon']
- ));
+foreach ($membertypes as $id => $quest)
+{
+ $template->assign_block_vars('mtype', array(
+ 'ID' => $quest['id'],
+ 'FEEDBACK' => $quest['feedbacks'],
+ 'ICON' => $quest['icon']
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'membertypes.tpl'
- ));
+ 'body' => 'membertypes.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/metatags.php b/admin/metatags.php
old mode 100644
new mode 100755
index 9b93174ac..489bc6c38
--- a/admin/metatags.php
+++ b/admin/metatags.php
@@ -1,6 +1,6 @@
writesetting("descriptiontag", $system->cleanvars($_POST['descriptiontag']), "str");
- $system->writesetting("keywordstag", $system->cleanvars($_POST['keywordstag']), "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['metatag_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("descriptiontag", $system->cleanvars($_POST['descriptiontag']),"str");
+ $system->writesetting("keywordstag", $system->cleanvars($_POST['keywordstag']),"str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['25_0185']));
}
-loadblock($MSG['metatag_desc'], $MSG['metatag_desc_explain'], 'textarea', 'descriptiontag', $system->SETTINGS['descriptiontag']);
-loadblock($MSG['metatag_keywords'], $MSG['metatag_keywords_explain'], 'textarea', 'keywordstag', $system->SETTINGS['keywordstag']);
+loadblock($MSG['25_0180'], $MSG['25_0182'], 'textarea', 'descriptiontag', $system->SETTINGS['descriptiontag']);
+loadblock($MSG['25_0181'], $MSG['25_0184'], 'textarea', 'keywordstag', $system->SETTINGS['keywordstag']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['metatag_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['25_0178']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/moderateauctions.php b/admin/moderateauctions.php
old mode 100644
new mode 100755
index 66b285f13..12fc8396f
--- a/admin/moderateauctions.php
+++ b/admin/moderateauctions.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
- (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'moderateauctions.php')) {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) &&
+ (isset($_SESSION['RETURN_LIST']) && $_SESSION['RETURN_LIST'] == 'moderateauctions.php'))
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'moderateauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
$query = "SELECT COUNT(a.id) as auctions FROM " . $DBPrefix . "auctions a
- INNER JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- WHERE a.closed = 0 " . $user_sql;
+ INNER JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ WHERE a.closed = 0 " . $user_sql;
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name, COUNT(r.auction_id) as times_reported, m.reason FROM " . $DBPrefix . "auctions a
- INNER JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
- WHERE a.closed = 0 " . $user_sql . " GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
+ INNER JOIN " . $DBPrefix . "auction_moderation m ON (a.id = m.auction_id)
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ LEFT JOIN " . $DBPrefix . "reportedauctions r ON (a.id = r.auction_id)
+ WHERE a.closed = 0 " . $user_sql . " GROUP BY a.id ORDER BY nick LIMIT :offset, :perpage";
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-$username = '';
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'TIMESREPORTED' => $row['times_reported'],
- 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => false
- ));
- $username = $row['nick'];
+$username = $bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'TIMESREPORTED' => $row['times_reported'],
+ 'IN_MODERATION_QUEUE' => !is_null($row['reason']),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => false,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ $username = $row['nick'];
}
// this is used when viewing a users auctions
-if ((!isset($username) || empty($username)) && $uid > 0) {
- $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $uid, 'int');
- $db->query($query, $params);
- $username = $db->result('nick');
+if ((!isset($username) || empty($username)) && $uid > 0)
+{
+ $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $uid, 'int');
+ $db->query($query, $params);
+ $username = $db->result('nick');
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['moderate_auctions'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => ($uid > 0),
- 'USERNAME' => $username,
+ 'PAGE_TITLE' => $MSG['moderate_auctions'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => ($uid > 0),
+ 'USERNAME' => $username,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'listauctions.tpl'
- ));
+ 'body' => 'listauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/moderation.php b/admin/moderation.php
old mode 100644
new mode 100755
index daa7e360c..be4b695fd
--- a/admin/moderation.php
+++ b/admin/moderation.php
@@ -1,6 +1,6 @@
writesetting("use_moderation", $_POST['use_moderation'], 'bool');
- $system->writesetting("auction_moderation", $_POST['auction_moderation'], 'int');
- $system->writesetting("new_auction_moderation", $_POST['new_auction_moderation'], 'int');
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $system->writesetting("use_moderation", $_POST['use_moderation'], 'bool');
+ $system->writesetting("auction_moderation", $_POST['auction_moderation'], 'int');
+ $system->writesetting("new_auction_moderation", $_POST['new_auction_moderation'], 'int');
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['moderation_settings_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['moderation_settings_updated']));
}
loadblock($MSG['moderation'], '', 'bool', 'use_moderation', $system->SETTINGS['use_moderation'], array($MSG['759'], $MSG['760']));
@@ -33,14 +34,15 @@
loadblock($MSG['new_auction_moderation'], '', 'select3num', 'new_auction_moderation', $system->SETTINGS['new_auction_moderation'], array($MSG['moderation_disabled'], $MSG['moderation_pre_moderation'], $MSG['moderation_post_moderation']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['moderation_settings'],
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['moderation_settings'],
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/multilingual.php b/admin/multilingual.php
old mode 100644
new mode 100755
index b17f70a3e..0c63973da
--- a/admin/multilingual.php
+++ b/admin/multilingual.php
@@ -1,6 +1,6 @@
writesetting("defaultlanguage", $system->cleanvars($_POST['defaultlanguage']), "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['multilingual_support_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update' && isset($_POST['defaultlanguage']))
+{
+ // clean submission and update database
+ $system->writesetting("defaultlanguage", $system->cleanvars($_POST['defaultlanguage']),"str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['multilingual_support_settings_updated']));
}
$html = '';
-if (is_array($LANGUAGES)) {
- foreach ($LANGUAGES as $lang_code) {
- $html .= ' SETTINGS['defaultlanguage'] == $lang_code) ? ' checked="checked"' : '') . '>
-
- ' . $lang_code . (($system->SETTINGS['defaultlanguage'] == $lang_code) ? ' ' . $MSG['current_default_language'] : '') . ' ';
- }
+if (is_array($LANGUAGES))
+{
+ reset($LANGUAGES);
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $html .= ' SETTINGS['defaultlanguage'] == $k) ? ' checked="checked"' : '') . '>
+
+ ' . $v . (($system->SETTINGS['defaultlanguage'] == $k) ? ' ' . $MSG['2__0005'] : '') . ' ';
+ }
}
-loadblock($MSG['default_language'], $MSG['default_language_explain'], $html);
+loadblock($MSG['2__0004'], $MSG['2__0003'], $html);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['multilingual_support']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['2__0002']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/newadminuser.php b/admin/newadminuser.php
old mode 100644
new mode 100755
index aab09b64f..bfb7f4ce4
--- a/admin/newadminuser.php
+++ b/admin/newadminuser.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif ((!empty($_POST['password']) && empty($_POST['repeatpassword'])) || empty($_POST['password']) && !empty($_POST['repeatpassword'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_054));
- } elseif ($_POST['password'] != $_POST['repeatpassword']) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
- } else {
- // Check if "username" already exists in the database
- $query = "SELECT id FROM " . $DBPrefix . "adminusers WHERE username = :username";
- $params = array();
- $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $ERR = sprintf($ERR_055, $_POST['username']);
- } else {
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query = "INSERT INTO " . $DBPrefix . "adminusers (username, password, hash, created, status)
- VALUES (:username, :password, :hash, :created, :status)";
- $params = array();
- $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
- $params[] = array(':hash', get_hash(), 'str');
- $params[] = array(':created', date('Ymd'), 'str');
- $params[] = array(':status', $_POST['status'], 'bool');
- $db->query($query, $params);
- header('location: adminusers.php');
- exit;
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['repeatpassword']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif ((!empty($_POST['password']) && empty($_POST['repeatpassword'])) || empty($_POST['password']) && !empty($_POST['repeatpassword']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_054));
+ }
+ elseif ($_POST['password'] != $_POST['repeatpassword'])
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
+ }
+ else
+ {
+ // Check if "username" already exists in the database
+ $query = "SELECT id FROM " . $DBPrefix . "adminusers WHERE username = :username";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $ERR = sprintf($ERR_055, $_POST['username']);
+ }
+ else
+ {
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query = "INSERT INTO " . $DBPrefix . "adminusers VALUES
+ (NULL, :username, :password, :hash, :created, '0', :status, '')";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['username']), 'str');
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
+ $params[] = array(':hash', get_hash(), 'str');
+ $params[] = array(':created', date('Ymd'), 'str');
+ $params[] = array(':status', $_POST['status'], 'bool');
+ $db->query($query, $params);
+ header('location: adminusers.php');
+ exit;
+ }
+ }
}
-loadblock($MSG['username'], '', 'text', 'username', '');
-loadblock($MSG['password'], '', 'password', 'password', '');
+loadblock($MSG['003'], '', 'text', 'username', '');
+loadblock($MSG['004'], '', 'password', 'password', '');
loadblock($MSG['564'], '', 'password', 'repeatpassword', '');
loadblock('', '', 'bool', 'status', '1', array($MSG['566'], $MSG['567']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0010'],
- 'PAGENAME' => $MSG['new_admin_user']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0010'],
+ 'PAGENAME' => $MSG['367']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/newbannersuser.php b/admin/newbannersuser.php
old mode 100644
new mode 100755
index d1d8b15a2..dba2ee3c7
--- a/admin/newbannersuser.php
+++ b/admin/newbannersuser.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
- } else {
- // Update database
- $query = "INSERT INTO " . $DBPrefix . "bannersusers VALUES (NULL, :name, :company, :email)";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
- $params[] = array(':company', $system->cleanvars($_POST['company']), 'str');
- $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
- $db->query($query, $params);
- $ID = $db->lastInsertId();
- header('location: userbanners.php?id=' . $ID);
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'insert')
+{
+ if (empty($_POST['name']) || empty($_POST['company']) || empty($_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
+ }
+ else
+ {
+ // Update database
+ $query = "INSERT INTO " . $DBPrefix . "bannersusers VALUES (NULL, :name, :company, :email)";
+ $params = array();
+ $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
+ $params[] = array(':company', $system->cleanvars($_POST['company']), 'str');
+ $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
+ $db->query($query, $params);
+ $ID = $db->lastInsertId();
+ header('location: userbanners.php?id=' . $ID);
+ exit;
+ }
}
$template->assign_vars(array(
- 'NAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
- 'COMPANY' => (isset($_POST['company'])) ? $_POST['company'] : '',
- 'EMAIL' => (isset($_POST['email'])) ? $_POST['email'] : ''
- ));
+ 'NAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
+ 'COMPANY' => (isset($_POST['company'])) ? $_POST['company'] : '',
+ 'EMAIL' => (isset($_POST['email'])) ? $_POST['email'] : ''
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'newbanneruser.tpl'
- ));
+ 'body' => 'newbanneruser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/newboard.php b/admin/newboard.php
old mode 100644
new mode 100755
index 6ed78a38e..e0f01f973
--- a/admin/newboard.php
+++ b/admin/newboard.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif (!is_numeric($_POST['msgstoshow'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_msg_numeric']));
- } elseif (intval($_POST['msgstoshow'] == 0)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_msg_not_zero']));
- } else {
- $query = "INSERT INTO " . $DBPrefix . "community VALUES (NULL, :name, 0, 0, :msgstoshow, :active)";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
- $params[] = array(':msgstoshow', $_POST['msgstoshow'], 'int');
- $params[] = array(':active', $_POST['active'], 'bool');
- $db->query($query, $params);
- header('location: boards.php');
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'insert')
+{
+ if (empty($_POST['name']) || empty($_POST['msgstoshow']) || empty($_POST['active']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif (!is_numeric($_POST['msgstoshow']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5000));
+ }
+ elseif (intval($_POST['msgstoshow'] == 0))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5001));
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "community VALUES (NULL, :name, 0, 0, :msgstoshow, :active)";
+ $params = array();
+ $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
+ $params[] = array(':msgstoshow', $_POST['msgstoshow'], 'int');
+ $params[] = array(':active', $_POST['active'], 'bool');
+ $db->query($query, $params);
+ header('location: boards.php');
+ exit;
+ }
}
$template->assign_vars(array(
- 'NAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
- 'MSGTOSHOW' => (isset($_POST['msgstoshow'])) ? $_POST['msgstoshow'] : '',
- 'B_ACTIVE' => ((isset($_POST['active']) && $_POST['active'] == 1) || !isset($_POST['active'])),
- 'B_DEACTIVE' => (isset($_POST['active']) && $_POST['active'] == 0)
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+
+ 'NAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
+ 'MSGTOSHOW' => (isset($_POST['msgstoshow'])) ? $_POST['msgstoshow'] : '',
+ 'B_ACTIVE' => ((isset($_POST['active']) && $_POST['active'] == 1) || !isset($_POST['active'])),
+ 'B_DEACTIVE' => (isset($_POST['active']) && $_POST['active'] == 0)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'newboard.tpl'
- ));
+ 'body' => 'newboard.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/newfaq.php b/admin/newfaq.php
old mode 100644
new mode 100755
index f0adb6bc9..3280a6c72
--- a/admin/newfaq.php
+++ b/admin/newfaq.php
@@ -1,6 +1,6 @@
SETTINGS['defaultlanguage']]) || empty($_POST['answer'][$system->SETTINGS['defaultlanguage']])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_067));
- } else {
- $query = "INSERT INTO " . $DBPrefix . "faqs values (NULL, :question, :answer, :category)";
- $params = array();
- $params[] = array(':question', $system->cleanvars($_POST['question'][$system->SETTINGS['defaultlanguage']]), 'str');
- $params[] = array(':answer', $system->cleanvars($_POST['answer'][$system->SETTINGS['defaultlanguage']], true), 'str');
- $params[] = array(':category', $_POST['category'], 'int');
- $db->query($query, $params);
- $id = $db->lastInsertId();
- // Insert into translation table
- foreach ($LANGUAGES as $lang_code) {
- $query = "INSERT INTO " . $DBPrefix . "faqs_translated VALUES (:id, :lang, :question, :answer)";
- $params = array();
- $params[] = array(':id', $id, 'int');
- $params[] = array(':lang', $lang_code, 'str');
- $params[] = array(':question', $system->cleanvars($_POST['question'][$lang_code]), 'str');
- $params[] = array(':answer', $system->cleanvars($_POST['answer'][$lang_code], true), 'str');
- $db->query($query, $params);
- }
- header('location: faqs.php');
- exit;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (empty($_POST['question'][$system->SETTINGS['defaultlanguage']]) || empty($_POST['answer'][$system->SETTINGS['defaultlanguage']]))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_067));
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "faqs values (NULL, :question, :answer, :category)";
+ $params = array();
+ $params[] = array(':question', $system->cleanvars($_POST['question'][$system->SETTINGS['defaultlanguage']]), 'str');
+ $params[] = array(':answer', $system->cleanvars($_POST['answer'][$system->SETTINGS['defaultlanguage']], true), 'str');
+ $params[] = array(':category', $_POST['category'], 'int');
+ $db->query($query, $params);
+ $id = $db->lastInsertId();
+ // Insert into translation table.
+ reset($LANGUAGES);
+ foreach ($LANGUAGES as $k => $v)
+ {
+ $query = "INSERT INTO ".$DBPrefix."faqs_translated VALUES (:id, :lang, :question, :answer)";
+ $params = array();
+ $params[] = array(':id', $id, 'int');
+ $params[] = array(':lang', $k, 'str');
+ $params[] = array(':question', $system->cleanvars($_POST['question'][$k]), 'str');
+ $params[] = array(':answer', $system->cleanvars($_POST['answer'][$k], true), 'str');
+ $db->query($query, $params);
+ }
+ header('location: faqs.php');
+ exit;
+ }
}
// Get data from the database
$query = "SELECT * FROM " . $DBPrefix . "faqscategories";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('cats', array(
- 'ID' => $row['id'],
- 'CATEGORY' => $row['category']
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('cats', array(
+ 'ID' => $row['id'],
+ 'CATEGORY' => $row['category']
+ ));
}
-$CKEditor = new CKEditor();
-$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
-$CKEditor->returnOutput = true;
-$CKEditor->config['width'] = 550;
-$CKEditor->config['height'] = 400;
-
-foreach ($LANGUAGES as $lang_code) {
- $template->assign_block_vars('qs', array(
- 'LANG' => $lang_code,
- 'QUESTION' => (isset($_POST['question'][$lang_code])) ? $_POST['question'][$lang_code] : ''
- ));
- $template->assign_block_vars('as', array(
- 'LANG' => $lang_code,
- 'ANSWER' => $CKEditor->editor('answer[' . $lang_code . ']', isset($_POST['answer'][$lang_code]) ? $_POST['answer'][$lang_code] : '')
- ));
+foreach ($LANGUAGES as $k => $language)
+{
+ $template->assign_block_vars('lang', array(
+ 'LANG' => $language,
+ 'TITLE' => (isset($_POST['title'][$k])) ? $_POST['title'][$k] : '',
+ 'CONTENT' => (isset($_POST['content'][$k])) ? $_POST['content'][$k] : ''
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'newfaq.tpl'
- ));
+ 'body' => 'newfaq.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
diff --git a/admin/news.php b/admin/news.php
old mode 100644
new mode 100755
index 1b4cb85da..fa4b3c9be
--- a/admin/news.php
+++ b/admin/news.php
@@ -1,6 +1,6 @@
SETTINGS['perpage'];
-} else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '')
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'news.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
$_SESSION['RETURN_LIST'] = 'news.php';
@@ -42,45 +47,49 @@
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('news', array(
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'DATE' => $dt->formatDate($row['new_date']),
- 'SUSPENDED' => $row['suspended']
- ));
+$k = 0;
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('news', array(
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'DATE' => FormatDate($row['new_date']),
+ 'SUSPENDED' => $row['suspended'],
+ 'BG' => (!($k % 2)) ? '' : 'class="bg"'
+ ));
+ $k++;
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'NEWS_COUNT' => $new_count,
+ 'NEWS_COUNT' => $new_count,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'news.tpl'
- ));
+ 'body' => 'news.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/newsletter.php b/admin/newsletter.php
old mode 100644
new mode 100755
index 037205f0b..2a52942a5
--- a/admin/newsletter.php
+++ b/admin/newsletter.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_subject_or_body_missing']));
- } else {
- $COUNTER = 0;
- $query = "SELECT email FROM " . $DBPrefix . "users WHERE nletter = 1";
- switch ($_POST['usersfilter']) {
- case 'active':
- $query .= ' AND suspended = 0';
- break;
- case 'admin':
- $query .= ' AND suspended = 1';
- break;
- case 'fee':
- $query .= ' AND suspended = 9';
- break;
- case 'confirmed':
- $query .= ' AND suspended = 8';
- break;
- }
- $headers = 'From:' . $system->SETTINGS['sitename'] . ' <' . $system->SETTINGS['adminmail'] . '>' . "\n" . 'Content-Type: text/html; charset=' . $CHARSET;
- $db->direct_query($query);
- while ($row = $db->fetch()) {
- if (mail($row['email'], $subject, $content, $headers)) {
- $COUNTER++;
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => sprintf($MSG['5300'], $COUNTER)));
- }
-} elseif (isset($_POST['action']) && $_POST['action'] == 'preview') {
- $is_preview = true;
+if (isset($_POST['action']) && $_POST['action'] == 'submit')
+{
+ if (empty($subject) || empty($content))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5014));
+ }
+ else
+ {
+ $COUNTER = 0;
+ $query = "SELECT email FROM " . $DBPrefix . "users WHERE nletter = 1";
+ switch($_POST['usersfilter'])
+ {
+ case 'active':
+ $query .= ' AND suspended = 0';
+ break;
+ case 'admin':
+ $query .= ' AND suspended = 1';
+ break;
+ case 'fee':
+ $query .= ' AND suspended = 9';
+ break;
+ case 'confirmed':
+ $query .= ' AND suspended = 8';
+ break;
+ }
+ $headers = 'From:' . $system->SETTINGS['sitename'] . ' <' . $system->SETTINGS['adminmail'] . '>' . "\n" . 'Content-Type: text/html; charset=' . $CHARSET;
+ $db->direct_query($query);
+ while ($row = $db->fetch())
+ {
+ if (mail($row['email'], $subject, $content, $headers))
+ {
+ $COUNTER++;
+ }
+ }
+ $ERR = $COUNTER . $MSG['5300'];
+ }
+}
+elseif (isset($_POST['action']) && $_POST['action'] == 'preview')
+{
+ $is_preview = true;
}
-$USERSFILTER = array('all' => $MSG['all_users'],
- 'active' => $MSG['active_users'],
- 'admin' => $MSG['suspended_by_admin'],
- 'fee' => $MSG['signup_fee_unpaid'],
- 'confirmed' => $MSG['account_never_confirmed']);
+$USERSFILTER = array('all' => $MSG['5296'],
+ 'active' => $MSG['5291'],
+ 'admin' => $MSG['5294'],
+ 'fee' => $MSG['5293'],
+ 'confirmed' => $MSG['5292']);
$selectsetting = (isset($_POST['usersfilter'])) ? $_POST['usersfilter'] : '';
@@ -71,17 +80,19 @@
$CKEditor->config['height'] = 400;
$template->assign_vars(array(
- 'SELECTBOX' => generateSelect('usersfilter', $USERSFILTER),
- 'SUBJECT' => $subject,
- 'EDITOR' => $CKEditor->editor('content', $content),
- 'PREVIEW' => $content,
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'SELECTBOX' => generateSelect('usersfilter', $USERSFILTER),
+ 'SUBJECT' => $subject,
+ 'EDITOR' => $CKEditor->editor('content', $content),
+ 'PREVIEW' => $content,
- 'B_PREVIEW' => $is_preview
- ));
+ 'B_PREVIEW' => $is_preview
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'newsletter.tpl'
- ));
+ 'body' => 'newsletter.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/newuser.php b/admin/newuser.php
old mode 100644
new mode 100755
index f554959e1..9476958eb
--- a/admin/newuser.php
+++ b/admin/newuser.php
@@ -1,6 +1,6 @@
SETTINGS['mandatory_fields']);
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- if ($_POST['name'] && $_POST['email']) {
- if (!empty($_POST['birthdate'])) {
- $DATE = explode('/', $_POST['birthdate']);
- if ($system->SETTINGS['datesformat'] == 'USA') {
- $birth_day = $DATE[1];
- $birth_month = $DATE[0];
- $birth_year = $DATE[2];
- } else {
- $birth_day = $DATE[0];
- $birth_month = $DATE[1];
- $birth_year = $DATE[2];
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if ($_POST['name'] && $_POST['email'])
+ {
+ if (!empty($_POST['birthdate']))
+ {
+ $DATE = explode('/', $_POST['birthdate']);
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $birth_day = $DATE[1];
+ $birth_month = $DATE[0];
+ $birth_year = $DATE[2];
+ }
+ else
+ {
+ $birth_day = $DATE[0];
+ $birth_month = $DATE[1];
+ $birth_year = $DATE[2];
+ }
- if (strlen($birth_year) == 2) {
- $birth_year = '19' . $birth_year;
- }
- }
+ if (strlen($birth_year) == 2)
+ {
+ $birth_year = '19' . $birth_year;
+ }
+ }
- if (isset($_POST['balance'])) {
- $balance_clean = str_replace('-', '', $_POST['balance']);
- }
+ if (isset($_POST['balance']))
+ {
+ $balance_clean = str_replace('-', '', $_POST['balance']);
+ }
- if ($_POST['password'] == '') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_004));
- } elseif (strlen($_POST['password']) < 6) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_011));
- } elseif ($_POST['password'] != $_POST['repeat_password']) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
- } elseif ($_POST['username'] == '') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_003));
- } elseif (strlen($_POST['username']) < 6) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_010));
- } elseif (strlen($_POST['email']) < 5) { //Primitive mail check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5033));
- } elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
- } elseif (!preg_match('/^([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})$/', $_POST['birthdate']) && $MANDATORY_FIELDS['birthdate'] == 'y') { //Birthdate check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
- } elseif (strlen($_POST['zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y') { //Primitive zip check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_616));
- } elseif (strlen($_POST['phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y') { //Primitive phone check
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_617));
- } elseif (empty($_POST['address']) && $MANDATORY_FIELDS['address'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5034));
- } elseif (empty($_POST['city']) && $MANDATORY_FIELDS['city'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5035));
- } elseif (empty($_POST['prov']) && $MANDATORY_FIELDS['prov'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5036));
- } elseif (empty($_POST['country']) && $MANDATORY_FIELDS['country'] == 'y') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5037));
- } elseif (empty($_POST['group'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_044));
- } elseif (empty($_POST['balance']) && $system->SETTINGS['moneydecimals'] != 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- } elseif (!$system->CheckMoney($balance_clean)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_081));
- } else {
- if (!empty($_POST['birthdate'])) {
- $birthdate = $birth_year . $birth_month . $birth_day;
- } else {
- $birthdate = 0;
- }
- // check username is unique
- $query = "SELECT COUNT(nick) as COUNT FROM " . $DBPrefix . "users WHERE nick = :name";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['username']), 'str');
- $db->query($query, $params);
- $username_duplicate = $db->result('COUNT');
- // check email is unique
- $query = "SELECT COUNT(email) as COUNT FROM " . $DBPrefix . "users WHERE email = :email";
- $params = array();
- $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
- $db->query($query, $params);
- $email_duplicate = $db->result('COUNT');
- if ($username_duplicate > 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_111));
- } elseif ($email_duplicate > 0) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_115));
- } else {
- $query = "INSERT INTO " . $DBPrefix . "users (name, nick, email, address, city, prov, country, zip, phone, birthdate, groups, balance, password)
- VALUES (:name, :nick, :email, :address, :city, :prov, :country, :zip, :phone, :birthdate, :groups, :balance, :password)";
- $params = array();
- $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
- $params[] = array(':nick', $system->cleanvars($_POST['username']), 'str');
- $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
- $params[] = array(':birthdate', $birthdate, 'int');
- $params[] = array(':address', $system->cleanvars($_POST['address']), 'str');
- $params[] = array(':city', $system->cleanvars($_POST['city']), 'str');
- $params[] = array(':prov', $system->cleanvars($_POST['prov']), 'str');
- $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
- $params[] = array(':zip', $system->cleanvars($_POST['zip']), 'str');
- $params[] = array(':phone', $system->cleanvars($_POST['phone']), 'str');
- $params[] = array(':groups', implode(',', $_POST['group']), 'str');
- $params[] = array(':balance', $system->input_money($_POST['balance']), 'float');
- // generate password hash
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
- $db->query($query, $params);
+ if ($_POST['password'] == '')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_004));
+ }
+ elseif (strlen($_POST['password']) < 6)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_011));
+ }
+ elseif ($_POST['password'] != $_POST['repeat_password'])
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_006));
+ }
+ elseif ($_POST['username'] == '')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_003));
+ }
+ elseif (strlen($_POST['username']) < 6)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_010));
+ }
+ elseif (strlen($_POST['email']) < 5) //Primitive mail check
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5033));
+ }
+ elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['email']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_008));
+ }
+ elseif (!preg_match('/^([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})$/', $_POST['birthdate']) && $MANDATORY_FIELDS['birthdate'] == 'y')
+ { //Birthdate check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
+ }
+ elseif (strlen($_POST['zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y')
+ { //Primitive zip check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_616));
+ }
+ elseif (strlen($_POST['phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y')
+ { //Primitive phone check
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_617));
+ }
+ elseif (empty($_POST['address']) && $MANDATORY_FIELDS['address'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5034));
+ }
+ elseif (empty($_POST['city']) && $MANDATORY_FIELDS['city'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5035));
+ }
+ elseif (empty($_POST['prov']) && $MANDATORY_FIELDS['prov'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5036));
+ }
+ elseif (empty($_POST['country']) && $MANDATORY_FIELDS['country'] == 'y')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5037));
+ }
+ elseif (empty($_POST['group']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_044));
+ }
+ elseif (empty($_POST['balance']) && $system->SETTINGS['moneydecimals'] != 0)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
+ elseif (!$system->CheckMoney($balance_clean))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_081));
+ }
+ else
+ {
+ if (!empty($_POST['birthdate']))
+ {
+ $birthdate = $birth_year . $birth_month . $birth_day;
+ }
+ else
+ {
+ $birthdate = 0;
+ }
- header('location: listusers.php');
- exit;
- }
- }
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
- }
+ $query = "INSERT INTO " . $DBPrefix . "users (name, nick, email, address, city, prov, country, zip, phone, birthdate, groups, balance, password)
+ VALUES (:name, :nick, :email, :address, :city, :prov, :country, :zip, :phone, :birthdate, :groups, :balance, :password)";
+ $params = array();
+ $params[] = array(':name', $system->cleanvars($_POST['name']), 'str');
+ $params[] = array(':nick', $system->cleanvars($_POST['username']), 'str');
+ $params[] = array(':email', $system->cleanvars($_POST['email']), 'str');
+ $params[] = array(':birthdate', $birthdate, 'int');
+ $params[] = array(':address', $system->cleanvars($_POST['address']), 'str');
+ $params[] = array(':city', $system->cleanvars($_POST['city']), 'str');
+ $params[] = array(':prov', $system->cleanvars($_POST['prov']), 'str');
+ $params[] = array(':country', $system->cleanvars($_POST['country']), 'str');
+ $params[] = array(':zip', $system->cleanvars($_POST['zip']), 'str');
+ $params[] = array(':phone', $system->cleanvars($_POST['phone']), 'str');
+ $params[] = array(':groups', implode(',', $_POST['group']), 'str');
+ $params[] = array(':balance', $system->input_money($_POST['balance']), 'float');
+ // generate password hash
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $params[] = array(':password', $phpass->HashPassword($_POST['password']), 'str');
+ $db->query($query, $params);
+
+ header('location: listusers.php');
+ exit;
+ }
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_112));
+ }
}
$query = "SELECT country_id, country FROM " . $DBPrefix . "countries";
@@ -136,51 +167,55 @@
$countries = $db->fetchall();
$country_list = '';
-foreach ($countries as $country) {
- $country_list .= '' . "\n";
+foreach($countries as $country)
+{
+ $country_list .= ' ' . "\n";
}
$query = "SELECT id, group_name FROM ". $DBPrefix . "groups";
$db->direct_query($query);
$usergroups = '';
$groups = (isset($_POST['group'])) ? $_POST['group'] : [];
-while ($row = $db->fetch()) {
- $member = (in_array($row['id'], $groups)) ? ' checked' : '';
- $usergroups .= ' ' . $row['group_name'] . '
';
+while ($row = $db->fetch())
+{
+ $member = (in_array($row['id'], $groups)) ? ' checked' : '';
+ $usergroups .= ' ' . $row['group_name'] . '
';
}
$template->assign_vars(array(
- 'REALNAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
- 'USERNAME' => (isset($_POST['username'])) ? $_POST['username'] : '',
- 'EMAIL' => (isset($_POST['email'])) ? $_POST['email'] : '',
- 'ADDRESS' => (isset($_POST['address'])) ? $_POST['address'] : '',
- 'CITY' => (isset($_POST['city'])) ? $_POST['city'] : '',
- 'PROV' => (isset($_POST['prov'])) ? $_POST['prov'] : '',
- 'ZIP' => (isset($_POST['zip'])) ? $_POST['zip'] : '',
- 'COUNTRY' => (isset($_POST['country'])) ? $_POST['country'] : '',
- 'PHONE' => (isset($_POST['phone'])) ? $_POST['phone'] : '',
- 'BALANCE' => $system->print_money_nosymbol((isset($_POST[''])) ? $_POST['balance'] : 0.00),
- 'DOB' => (isset($_POST['birthdate'])) ? $_POST['birthdate'] : '',
- 'COUNTRY_LIST' => $country_list,
- 'USERGROUPS' => $usergroups,
- 'REQUIRED' => array(
- ($MANDATORY_FIELDS['birthdate'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['address'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['city'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['prov'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['country'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['zip'] == 'y') ? ' *' : '',
- ($MANDATORY_FIELDS['tel'] == 'y') ? ' *' : ''
- )
- ));
+ 'REALNAME' => (isset($_POST['name'])) ? $_POST['name'] : '',
+ 'USERNAME' => (isset($_POST['username'])) ? $_POST['username'] : '',
+ 'EMAIL' => (isset($_POST['email'])) ? $_POST['email'] : '',
+ 'ADDRESS' => (isset($_POST['address'])) ? $_POST['address'] : '',
+ 'CITY' => (isset($_POST['city'])) ? $_POST['city'] : '',
+ 'PROV' => (isset($_POST['prov'])) ? $_POST['prov'] : '',
+ 'ZIP' => (isset($_POST['zip'])) ? $_POST['zip'] : '',
+ 'COUNTRY' => (isset($_POST['country'])) ? $_POST['country'] : '',
+ 'PHONE' => (isset($_POST['phone'])) ? $_POST['phone'] : '',
+ 'BALANCE' => $system->print_money_nosymbol((isset($_POST[''])) ? $_POST['balance'] : 0.00),
+ 'DOB' => (isset($_POST['birthdate'])) ? $_POST['birthdate'] : '',
+ 'COUNTRY_LIST' => $country_list,
+ 'USERGROUPS' => $usergroups,
+ 'REQUIRED' => array(
+ ($MANDATORY_FIELDS['birthdate'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['address'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['city'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['prov'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['country'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['zip'] == 'y') ? ' *' : '',
+ ($MANDATORY_FIELDS['tel'] == 'y') ? ' *' : ''
+ )
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'newuser.tpl'
- ));
+ 'body' => 'newuser.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/payments.php b/admin/payments.php
old mode 100644
new mode 100755
index 480a73200..47ec43d26
--- a/admin/payments.php
+++ b/admin/payments.php
@@ -1,6 +1,6 @@
$payment) {
- if (isset($_POST['delete']) && in_array($payment_id, $_POST['delete'])) {
- $query = "DELETE FROM " . $DBPrefix . "payment_options WHERE id = :id";
- $params = [[':id', $payment['id'], 'int']];
- $db->query($query, $params);
- } else {
- // clean the clean name
- if ($payment['clean'] == '') {
- $payment['clean'] = $payment['name'];
- }
- $payment['clean'] = preg_replace("/[^a-z]/", '', strtolower($payment['clean']));
- $query = "UPDATE " . $DBPrefix . "payment_options
- SET name = :name,
- displayname = :displayname
- WHERE id = :id";
- $params = [
- [':id', $payment['id'], 'int'],
- [':name', $payment['clean'], 'str'],
- [':displayname', $payment['name'], 'str'],
- ];
- $db->query($query, $params);
- }
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (isset($_POST['payment']))
+ {
+ foreach ($_POST['payment'] as $payment_id => $payment)
+ {
+ if (isset($payment['delete']))
+ {
+ $query = "DELETE FROM " . $DBPrefix . "payment_options WHERE id = :id";
+ $params = [[':id', $payment['id'], 'int']];
+ $db->query($query, $params);
+ }
+ else
+ {
+ // clean the clean name
+ if ($payment['clean'] == '')
+ {
+ $payment['clean'] = $payment['name'];
+ }
+ $payment['clean'] = preg_replace("/[^a-z]/", '', strtolower($payment['clean']));
+ $query = "UPDATE " . $DBPrefix . "payment_options
+ SET name = :name,
+ displayname = :displayname
+ WHERE id = :id";
+ $params = [
+ [':id', $payment['id'], 'int'],
+ [':name', $payment['clean'], 'str'],
+ [':displayname', $payment['name'], 'str'],
+ ];
+ $db->query($query, $params);
+ }
+ }
+ }
- if ($_POST['new_payments'] != '') {
- $display_name = $_POST['new_payments'];
- $clean_name = $_POST['new_payments_clean'];
- if ($clean_name == '') {
- $clean_name = $display_name;
- }
- $clean_name = preg_replace("/[^a-z]/", '', strtolower($clean_name));
- $query = "INSERT INTO " . $DBPrefix . "payment_options (name, displayname, is_gateway) VALUES (:name, :displayname, 0)";
- $params = [
- [':name', $clean_name, 'str'],
- [':displayname', $display_name, 'str'],
- ];
- $db->query($query, $params);
- }
+ if ($_POST['new_payments'] != '' && $_POST['new_payments_clean'] != '')
+ {
+ $query = "INSERT INTO " . $DBPrefix . "payment_options (name, displayname, is_gateway) VALUES (:name, :displayname, 0)";
+ $params = [
+ [':name', $_POST['new_payments_clean'], 'str'],
+ [':displayname', $_POST['new_payments'], 'str'],
+ ];
+ $db->query($query, $params);
+ }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['payment_methods_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['093']));
}
$query = "SELECT * FROM " . $DBPrefix . "payment_options WHERE is_gateway = 0";
$db->direct_query($query);
-while ($payment_type = $db->fetch()) {
- $template->assign_block_vars('payments', array(
- 'NAME' => $payment_type['displayname'],
- 'CLEAN' => $payment_type['name'],
- 'ID' => $payment_type['id']
- ));
+while ($payment_type = $db->fetch())
+{
+ $template->assign_block_vars('payments', array(
+ 'NAME' => $payment_type['displayname'],
+ 'CLEAN' => $payment_type['name'],
+ 'ID' => $payment_type['id']
+ ));
}
+
+$template->assign_vars(array(
+ 'SITEURL' => $system->SETTINGS['siteurl']
+ ));
+
include 'header.php';
$template->set_filenames(array(
- 'body' => 'payments.tpl'
- ));
+ 'body' => 'payments.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
diff --git a/admin/privacypolicy.php b/admin/privacypolicy.php
old mode 100644
new mode 100755
index 15a33cc9e..7b630a1ef
--- a/admin/privacypolicy.php
+++ b/admin/privacypolicy.php
@@ -1,6 +1,6 @@
writesetting("privacypolicy", ynbool($_POST['privacypolicy']), "str");
- $system->writesetting("privacypolicytext", $system->cleanvars($_POST['privacypolicytext'], true), "str");
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission
+ $system->writesetting("privacypolicy", ynbool($_POST['privacypolicy']), "str");
+ $system->writesetting("privacypolicytext", $system->cleanvars($_POST['privacypolicytext'], true), "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['privacy_policy_updated']));
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['406']));
}
-loadblock($MSG['enable_privacy_policy'], $MSG['enable_privacy_policy_explain'], 'yesno', 'privacypolicy', $system->SETTINGS['privacypolicy'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['403'], $MSG['405'], 'yesno', 'privacypolicy', $system->SETTINGS['privacypolicy'], array($MSG['030'], $MSG['029']));
$CKEditor = new CKEditor();
$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
@@ -34,17 +35,18 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-loadblock($MSG['privacy_policy_content'], $MSG['editor_help'], $CKEditor->editor('privacypolicytext', $system->SETTINGS['privacypolicytext']));
+loadblock($MSG['404'], $MSG['5080'], $CKEditor->editor('privacypolicytext', $system->SETTINGS['privacypolicytext']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0018'],
- 'PAGENAME' => $MSG['privacy_policy']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0018'],
+ 'PAGENAME' => $MSG['402']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/profile.php b/admin/profile.php
old mode 100644
new mode 100755
index 92d2b8b57..41eaf60d8
--- a/admin/profile.php
+++ b/admin/profile.php
@@ -1,6 +1,6 @@
SETTINGS['mandatory_fields']);
$DISPLAYED_FIELDS = unserialize($system->SETTINGS['displayed_feilds']);
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- $MANDATORY_FIELDS = array(
- 'birthdate' => $_POST['birthdate'],
- 'address' => $_POST['address'],
- 'city' => $_POST['city'],
- 'prov' => $_POST['prov'],
- 'country' => $_POST['country'],
- 'zip' => $_POST['zip'],
- 'tel' => $_POST['tel']
- );
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $MANDATORY_FIELDS = array(
+ 'birthdate' => $_POST['birthdate'],
+ 'address' => $_POST['address'],
+ 'city' => $_POST['city'],
+ 'prov' => $_POST['prov'],
+ 'country' => $_POST['country'],
+ 'zip' => $_POST['zip'],
+ 'tel' => $_POST['tel']
+ );
- $DISPLAYED_FIELDS = array(
- 'birthdate_regshow' => $_POST['birthdate_regshow'],
- 'address_regshow' => $_POST['address_regshow'],
- 'city_regshow' => $_POST['city_regshow'],
- 'prov_regshow' => $_POST['prov_regshow'],
- 'country_regshow' => $_POST['country_regshow'],
- 'zip_regshow' => $_POST['zip_regshow'],
- 'tel_regshow' => $_POST['tel_regshow']
- );
+ $DISPLAYED_FIELDS = array(
+ 'birthdate_regshow' => $_POST['birthdate_regshow'],
+ 'address_regshow' => $_POST['address_regshow'],
+ 'city_regshow' => $_POST['city_regshow'],
+ 'prov_regshow' => $_POST['prov_regshow'],
+ 'country_regshow' => $_POST['country_regshow'],
+ 'zip_regshow' => $_POST['zip_regshow'],
+ 'tel_regshow' => $_POST['tel_regshow']
+ );
- // common sense check field cant be required if its not visible
- $required = array_keys($MANDATORY_FIELDS);
- $display = array_keys($DISPLAYED_FIELDS);
- for ($i = 0; $i < 7; $i++) {
- if ($MANDATORY_FIELDS[$required[$i]] == 'y' && $DISPLAYED_FIELDS[$display[$i]] == 'n') {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_required_field_cannot_be_hidden']));
- }
- }
- if (!isset($ERR)) {
- $mdata = serialize($MANDATORY_FIELDS);
- $sdata = serialize($DISPLAYED_FIELDS);
- $system->writesetting("mandatory_fields", $mdata, "str");
- $system->writesetting("displayed_feilds", $sdata, "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['registration_fields_updated']));
- }
+ // common sense check field cant be required if its not visible
+ $required = array_keys($MANDATORY_FIELDS);
+ $display = array_keys($DISPLAYED_FIELDS);
+ for ($i = 0; $i < 7; $i++)
+ {
+ if ($MANDATORY_FIELDS[$required[$i]] == 'y' && $DISPLAYED_FIELDS[$display[$i]] == 'n')
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['809']));
+ }
+ }
+ if (!isset($ERR))
+ {
+ $mdata = serialize($MANDATORY_FIELDS);
+ $sdata = serialize($DISPLAYED_FIELDS);
+ $system->writesetting("mandatory_fields", $mdata, "str");
+ $system->writesetting("displayed_feilds", $sdata, "str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['779']));
+ }
}
$template->assign_vars(array(
- 'REQUIRED_0' => ($MANDATORY_FIELDS['birthdate'] == 'y'),
- 'REQUIRED_1' => ($MANDATORY_FIELDS['address'] == 'y'),
- 'REQUIRED_2' => ($MANDATORY_FIELDS['city'] == 'y'),
- 'REQUIRED_3' => ($MANDATORY_FIELDS['prov'] == 'y'),
- 'REQUIRED_4' => ($MANDATORY_FIELDS['country'] == 'y'),
- 'REQUIRED_5' => ($MANDATORY_FIELDS['zip'] == 'y'),
- 'REQUIRED_6' => ($MANDATORY_FIELDS['tel'] == 'y'),
- 'DISPLAYED_0' => ($DISPLAYED_FIELDS['birthdate_regshow'] == 'y'),
- 'DISPLAYED_1' => ($DISPLAYED_FIELDS['address_regshow'] == 'y'),
- 'DISPLAYED_2' => ($DISPLAYED_FIELDS['city_regshow'] == 'y'),
- 'DISPLAYED_3' => ($DISPLAYED_FIELDS['prov_regshow'] == 'y'),
- 'DISPLAYED_4' => ($DISPLAYED_FIELDS['country_regshow'] == 'y'),
- 'DISPLAYED_5' => ($DISPLAYED_FIELDS['zip_regshow'] == 'y'),
- 'DISPLAYED_6' => ($DISPLAYED_FIELDS['tel_regshow'] == 'y')
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'REQUIRED_0' => ($MANDATORY_FIELDS['birthdate'] == 'y') ? true : false,
+ 'REQUIRED_1' => ($MANDATORY_FIELDS['address'] == 'y') ? true : false,
+ 'REQUIRED_2' => ($MANDATORY_FIELDS['city'] == 'y') ? true : false,
+ 'REQUIRED_3' => ($MANDATORY_FIELDS['prov'] == 'y') ? true : false,
+ 'REQUIRED_4' => ($MANDATORY_FIELDS['country'] == 'y') ? true : false,
+ 'REQUIRED_5' => ($MANDATORY_FIELDS['zip'] == 'y') ? true : false,
+ 'REQUIRED_6' => ($MANDATORY_FIELDS['tel'] == 'y') ? true : false,
+ 'DISPLAYED_0' => ($DISPLAYED_FIELDS['birthdate_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_1' => ($DISPLAYED_FIELDS['address_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_2' => ($DISPLAYED_FIELDS['city_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_3' => ($DISPLAYED_FIELDS['prov_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_4' => ($DISPLAYED_FIELDS['country_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_5' => ($DISPLAYED_FIELDS['zip_regshow'] == 'y') ? true : false,
+ 'DISPLAYED_6' => ($DISPLAYED_FIELDS['tel_regshow'] == 'y') ? true : false
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'profile.tpl'
- ));
+ 'body' => 'profile.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/removefrommoderation.php b/admin/removefrommoderation.php
old mode 100644
new mode 100755
index 91a6b7bb6..61a2de2ab
--- a/admin/removefrommoderation.php
+++ b/admin/removefrommoderation.php
@@ -1,6 +1,6 @@
query($query, $params);
+ $query = "DELETE FROM `" . $DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
-} elseif (isset($_POST['action']) && $_POST['action'] == "No") {
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
+}
+elseif (isset($_POST['action']) && $_POST['action'] == "No")
+{
+ $URL = $_SESSION['RETURN_LIST'] . '?offset=' . $_SESSION['RETURN_LIST_OFFSET'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
}
$query = "SELECT u.nick, a.title, a.starts, a.description, a.category, d.description as duration,
- a.suspended, a.current_bid, a.quantity, a.reserve_price
- FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "durations d ON (d.days = a.duration)
- WHERE a.id = :auc_id";
+ a.suspended, a.current_bid, a.quantity, a.reserve_price
+ FROM " . $DBPrefix . "auctions a
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "durations d ON (d.days = a.duration)
+ WHERE a.id = :auc_id";
$params = array();
$params[] = array(':auc_id', $_GET['id'], 'int');
$db->query($query, $params);
$auc_data = $db->result();
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $date = date('m/d/Y', $auc_data['starts'] + $system->tdiff);
+}
+else
+{
+ $date = date('d/m/Y', $auc_data['starts'] + $system->tdiff);
+}
+
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['remove_auction_from_moderation'],
- 'ID' => $_GET['id'],
- 'TITLE' => htmlspecialchars($auc_data['title']),
- 'NICK' => $auc_data['nick'],
- 'STARTS' => $dt->formatDate($auc_data['starts']),
- 'DURATION' => $auc_data['duration'],
- 'CATEGORY' => $category_names[$auc_data['category']],
- 'DESCRIPTION' => $auc_data['description'],
- 'CURRENT_BID' => $system->print_money($auc_data['current_bid']),
- 'QTY' => $auc_data['quantity'],
- 'RESERVE_PRICE' => $system->print_money($auc_data['reserve_price']),
- 'SUSPENDED' => $auc_data['suspended'],
- 'OFFSET' => $_REQUEST['offset']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'PAGE_TITLE' => $MSG['remove_auction_from_moderation'],
+ 'ID' => $_GET['id'],
+ 'TITLE' => htmlspecialchars($auc_data['title']),
+ 'NICK' => $auc_data['nick'],
+ 'STARTS' => $date,
+ 'DURATION' => $auc_data['duration'],
+ 'CATEGORY' => $category_names[$auc_data['category']],
+ 'DESCRIPTION' => $auc_data['description'],
+ 'CURRENT_BID' => $system->print_money($auc_data['current_bid']),
+ 'QTY' => $auc_data['quantity'],
+ 'RESERVE_PRICE' => $system->print_money($auc_data['reserve_price']),
+ 'SUSPENDED' => $auc_data['suspended'],
+ 'OFFSET' => $_REQUEST['offset']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'removefrommoderation.tpl'
- ));
+ 'body' => 'removefrommoderation.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/searchauctions.php b/admin/searchauctions.php
old mode 100644
new mode 100755
index 8c28f6efc..d55651974
--- a/admin/searchauctions.php
+++ b/admin/searchauctions.php
@@ -1,6 +1,6 @@
0) {
- $auction_sql = " AND a.id = " . intval($_SESSION['searchauctionsauctionid']);
+ $auction_sql = " AND a.id = " . intval($_SESSION['searchauctionsauctionid']);
}
if (isset($_SESSION['usernick']) && $_SESSION['usernick'] != '') {
- $usernick_sql = " AND u.nick = '" . $_SESSION['usernick'] . "'" ;
+ $usernick_sql = " AND u.nick = '" . $_SESSION['usernick'] . "'" ;
}
if (isset($_SESSION['searchauctionsuid']) && $_SESSION['searchauctionsuid'] > 0) {
- $user_sql = " AND a.user = " . intval($_SESSION['searchauctionsuid']);
+ $user_sql = " AND a.user = " . intval($_SESSION['searchauctionsuid']);
}
if (isset($_SESSION['searchauctionstitlekeywords']) && $_SESSION['searchauctionstitlekeywords'] != '') {
- $titlekeywords_sql = " AND INSTR(LCASE(a.title), '" . strtolower($_SESSION['searchauctionstitlekeywords']) . "') > 0";
-}
-$auctiontype_sql = "a.id > 0";
-if (!empty($_SESSION['searchauctionsauctiontype'])) {
- switch ($_SESSION['searchauctionsauctiontype']) {
- case 1: // open auctions
- $auctiontype_sql = "a.closed = 0 and a.suspended = 0";
- break;
- case 2: // closed auctions
- $auctiontype_sql = "a.closed = 1";
- break;
- case 3: // suspended auctions
- $auctiontype_sql = "a.suspended != 0";
- break;
- default: // all auctions
- $auctiontype_sql = "";
- }
+ $titlekeywords_sql = " AND INSTR(LCASE(a.title), '" . strtolower($_SESSION['searchauctionstitlekeywords']) . "') > 0";
+}
+$auctiontype_sql = "a.closed = 1";
+if (!empty($_SESSION['searchauctionsauctiontype']))
+{
+ switch ($_SESSION['searchauctionsauctiontype'])
+ {
+ case 1: // open auctions
+ $auctiontype_sql = "a.closed = 0";
+ break;
+ case 2: // closed auctions
+ $auctiontype_sql = "a.closed = 1";
+ break;
+ case 3: // suspended auctions
+ $auctiontype_sql = "a.suspended != 0";
+ break;
+ default: // all auctions
+ $auctiontype_sql = "";
+ }
}
// If a new search is posted, you need to unset $_SESSION['RETURN_LIST_OFFSET'] to get page 1.
-if (isset($_POST['auctionid'])) {
- unset($_SESSION['RETURN_LIST_OFFSET']);
+if (isset($_POST['auctionid']))
+{
+ unset($_SESSION['RETURN_LIST_OFFSET']);
}
// Set offset and limit for pagination
-if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE'])) {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'searchauctions.php') {
- $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
-} else {
- $OFFSET = 0;
- $PAGE = 1;
+if (isset($_GET['PAGE']) && is_numeric($_GET['PAGE']))
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+elseif (isset($_SESSION['RETURN_LIST_OFFSET']) && $_SESSION['RETURN_LIST'] == 'searchauctions.php')
+{
+ $PAGE = intval($_SESSION['RETURN_LIST_OFFSET']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+}
+else
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
$_SESSION['RETURN_LIST'] = 'searchauctions.php';
$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
$query = "SELECT COUNT(a.id) As auctions FROM " . $DBPrefix . "auctions a INNER JOIN " . $DBPrefix . "users u
- ON (u.id = a.user) WHERE " . $auctiontype_sql . $auction_sql . $usernick_sql . $user_sql . $titlekeywords_sql;
+ ON (u.id = a.user) WHERE " . $auctiontype_sql . $auction_sql . $usernick_sql . $user_sql . $titlekeywords_sql;
$db->direct_query($query);
$num_auctions = $db->result('auctions');
$PAGES = ($num_auctions == 0) ? 1 : ceil($num_auctions / $system->SETTINGS['perpage']);
$query = "SELECT a.id, u.nick, a.title, a.starts, a.ends, a.suspended, c.cat_name FROM " . $DBPrefix . "auctions a
- INNER JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
- WHERE " . $auctiontype_sql . $auction_sql . $usernick_sql . $user_sql . $titlekeywords_sql . "
- ORDER BY nick, starts, title LIMIT :offset, :perpage";
+ INNER JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ LEFT JOIN " . $DBPrefix . "categories c ON (c.cat_id = a.category)
+ WHERE " . $auctiontype_sql . $auction_sql . $usernick_sql . $user_sql . $titlekeywords_sql .
+ " ORDER BY nick, starts, title LIMIT :offset, :perpage";
+//echo $query;
$params = array();
$params[] = array(':offset', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('auctions', array(
- 'SUSPENDED' => $row['suspended'],
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'START_TIME' => $dt->printDateTz($row['starts']),
- 'END_TIME' => $dt->printDateTz($row['ends']),
- 'USERNAME' => $row['nick'],
- 'CATEGORY' => $row['cat_name'],
- 'B_HASWINNERS' => false
- ));
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('auctions', array(
+ 'SUSPENDED' => $row['suspended'],
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'START_TIME' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'END_TIME' => ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'USERNAME' => $row['nick'],
+ 'CATEGORY' => $row['cat_name'],
+ 'B_HASWINNERS' => false,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
// Set the HTML for the auction type radio buttons.
/*
- This creates an array of the values for the radio buttons for each option type to the language file names for each.
- 0 = all auctions
- 1 = open auctions (includes suspended)
- 2 = closed auctions (includes suspended)
- 3 = suspended auctions
+ This creates an array of the values for the radio buttons for each option type to the language file names for each.
+ 0 = all auctions
+ 1 = open auctions (includes suspended)
+ 2 = closed auctions (includes suspended)
+ 3 = suspended auctions
*/
-$types = array(0 => '619a', 1 => '619', 2 => '204', 3 => '2__0056');
+$types = array(0=>'619a', 1=>619, 2=>204, 3=>'2__0056');
$auctiontypeshtml = '';
-foreach ($types as $key => $val) {
- if (isset($_SESSION['searchauctionsauctiontype']) && $key == $_SESSION['searchauctionsauctiontype']) {
- $auctiontypeshtml .= ' ' . str_ireplace('auctions', '', $MSG[$val]) . ' ';
- } else {
- $auctiontypeshtml .= ' ' . str_ireplace('auctions', '', $MSG[$val]) . ' ';
- }
+foreach ($types as $key => $val)
+{
+ if (isset($_SESSION['searchauctionsauctiontype']) && $key == $_SESSION['searchauctionsauctiontype'])
+ {
+ $auctiontypeshtml .= ' ' . str_ireplace('auctions', '', $MSG[$val]) . ' ';
+ }
+ else
+ {
+ $auctiontypeshtml .= ' ' . str_ireplace('auctions', '', $MSG[$val]) . ' ';
+ }
}
$template->assign_vars(array(
- 'PAGE_TITLE' => $MSG['search_auctions'],
- 'NUM_AUCTIONS' => $num_auctions,
- 'B_SEARCHUSER' => ((isset($_SESSION['searchauctionsuid']) && $_SESSION['searchauctionsuid'] > 0) || (isset($_SESSION['usernick']) && $_SESSION['usernick'] != '')) ? true : false,
- 'USERNICK' => isset($_SESSION['usernick'])? $_SESSION['usernick'] : '',
- 'AUCTIONID' => isset($_SESSION['searchauctionsauctionid'])? $_SESSION['searchauctionsauctionid'] : '',
- 'USERID' => isset($_SESSION['searchauctionsuid'])? $_SESSION['searchauctionsuid'] : '',
- 'TITLEKEYWORDS' => isset($_SESSION['searchauctionstitlekeywords'])? $_SESSION['searchauctionstitlekeywords'] : '',
- 'AUCTIONTYPE' => $auctiontypeshtml,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PAGE_TITLE' => $MSG['067a'],
+ 'NUM_AUCTIONS' => $num_auctions,
+ 'B_SEARCHUSER' => ((isset($_SESSION['searchauctionsuid']) && $_SESSION['searchauctionsuid'] > 0) || (isset($_SESSION['usernick']) && $_SESSION['usernick'] != '')) ? true : false,
+ 'USERNICK' => isset($_SESSION['usernick'])? $_SESSION['usernick'] : '',
+ 'AUCTIONID' => isset($_SESSION['searchauctionsauctionid'])? $_SESSION['searchauctionsauctionid'] : '',
+ 'USERID' => isset($_SESSION['searchauctionsuid'])? $_SESSION['searchauctionsuid'] : '',
+ 'TITLEKEYWORDS' => isset($_SESSION['searchauctionstitlekeywords'])? $_SESSION['searchauctionstitlekeywords'] : '',
+ 'AUCTIONTYPE' => $auctiontypeshtml,
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'searchauctions.tpl'
- ));
+ 'body' => 'searchauctions.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/settings.php b/admin/settings.php
old mode 100644
new mode 100755
index 1b737c4b2..13ccac485
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } elseif (!is_numeric($_POST['archiveafter'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
- } else {
- // Update data
- $system->writesetting(array(
- array("sitename", $_POST['sitename'], 'str'),
- array("adminmail", $_POST['adminmail'], 'str'),
- array("siteurl", $_POST['siteurl'], 'str'),
- array("copyright", $_POST['copyright'], 'str'),
- array("cron", $_POST['cron'], 'int'),
- array("archiveafter", $_POST['archiveafter'], 'int'),
- array("cache_theme", $_POST['cache_theme'], 'str'),
- array("https", $_POST['https'], 'str'),
- array("https_url", $_POST['https_url'], 'str'),
- ));
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['general_settings_updated']));
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Data check
+ if (empty($_POST['sitename']) || empty($_POST['siteurl']) || empty($_POST['adminmail']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ elseif (!is_numeric($_POST['archiveafter']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_043));
+ }
+ else
+ {
+ // Update data
+ $system->writesetting(array(
+ array("sitename", $_POST['sitename'], 'str'),
+ array("adminmail", $_POST['adminmail'], 'str'),
+ array("siteurl", $_POST['siteurl'], 'str'),
+ array("copyright", $_POST['copyright'], 'str'),
+ array("cron", $_POST['cron'], 'int'),
+ array("archiveafter", $_POST['archiveafter'], 'int'),
+ array("cache_theme", $_POST['cache_theme'], 'str'),
+ array("https", $_POST['https'], 'str'),
+ array("https_url", $_POST['https_url'], 'str'),
+ ));
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['542']));
+ }
}
// general settings
-loadblock($MSG['site_name'], $MSG['site_name_explain'], 'text', 'sitename', $system->SETTINGS['sitename']);
-loadblock($MSG['site_url'], $MSG['site_url_explain'], 'text', 'siteurl', $system->SETTINGS['siteurl']);
-loadblock($MSG['admin_email'], $MSG['admin_email_explain'], 'text', 'adminmail', $system->SETTINGS['adminmail']);
-loadblock($MSG['copyright_msg'], $MSG['copyright_msg_explain'], 'text', 'copyright', $system->SETTINGS['copyright']);
+loadblock($MSG['527'], $MSG['535'], 'text', 'sitename', $system->SETTINGS['sitename']);
+loadblock($MSG['528'], $MSG['536'], 'text', 'siteurl', $system->SETTINGS['siteurl']);
+loadblock($MSG['540'], $MSG['541'], 'text', 'adminmail', $system->SETTINGS['adminmail']);
+loadblock($MSG['191'], $MSG['192'], 'text', 'copyright', $system->SETTINGS['copyright']);
// batch settings
-loadblock($MSG['batch_settings'], '', '', '', '', array(), true);
-loadblock($MSG['run_cron'], $MSG['run_cron_explain'], 'batch', 'cron', $system->SETTINGS['cron'], array($MSG['batch'], $MSG['non_batch']));
-loadblock($MSG['clear_closed_auctions'], $MSG['clear_closed_auctions_explain'], 'days', 'archiveafter', $system->SETTINGS['archiveafter'], array($MSG['5115']));
+loadblock($MSG['348'], '', '', '', '', array(), true);
+loadblock($MSG['372'], $MSG['371'], 'batch', 'cron', $system->SETTINGS['cron'], array($MSG['373'], $MSG['374']));
+loadblock($MSG['376'], $MSG['375'], 'days', 'archiveafter', $system->SETTINGS['archiveafter'], array($MSG['377']));
// optimisation settings
-loadblock($MSG['optimisation'], '', '', '', '', array(), true);
-loadblock($MSG['enable_template_cache'], $MSG['enable_template_cache_explain'], 'yesno', 'cache_theme', $system->SETTINGS['cache_theme'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['725'], '', '', '', '', array(), true);
+loadblock($MSG['726'], $MSG['727'], 'yesno', 'cache_theme', $system->SETTINGS['cache_theme'], array($MSG['030'], $MSG['029']));
-// SSL settings
-loadblock($MSG['ssl_support'], '', '', '', '', array(), true);
-loadblock($MSG['enable_ssl'], $MSG['enable_ssl_explain'], 'yesno', 'https', $system->SETTINGS['https'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['ssl_url'], $MSG['ssl_url_explain'], 'text', 'https_url', $system->SETTINGS['https_url']);
+// SLL settings
+loadblock($MSG['1022'], '', '', '', '', array(), true);
+loadblock($MSG['1023'], $MSG['1024'], 'yesno', 'https', $system->SETTINGS['https'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['801'], $MSG['802'], 'text', 'https_url', $system->SETTINGS['https_url']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['general_settings'],
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['526'],
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/spam.php b/admin/spam.php
old mode 100644
new mode 100755
index 3ba2c4e52..ce7faae96
--- a/admin/spam.php
+++ b/admin/spam.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_recaptcha_missing_keys']));
- } else {
- $system->writesetting("recaptcha_public", $_POST['recaptcha_public'], 'str');
- $system->writesetting("recaptcha_private", $_POST['recaptcha_private'], 'str');
- $system->writesetting("spam_sendtofriend", $_POST['spam_sendtofriend'], 'int');
- $system->writesetting("spam_reportitem", $_POST['spam_reportitem'], 'int');
- $system->writesetting("spam_register", $_POST['spam_register'], 'int');
- $system->writesetting("spam_blocked_email_enabled", $_POST['spam_blocked_email_enabled'], 'bool');
- $system->writesetting("spam_blocked_email_domains", $_POST['spam_blocked_email_domains'], 'str');
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['spam_settings_updated']));
- }
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (($_POST['spam_sendtofriend'] == 2 || $_POST['spam_register'] == 2 || $_POST['spam_reportitem'] == 2) && empty($_POST['recaptcha_public']) && empty($_POST['recaptcha_private']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['751']));
+ }
+ else
+ {
+ $system->writesetting("recaptcha_public", $_POST['recaptcha_public'], 'str');
+ $system->writesetting("recaptcha_private", $_POST['recaptcha_private'], 'str');
+ $system->writesetting("spam_sendtofriend", $_POST['spam_sendtofriend'], 'int');
+ $system->writesetting("spam_reportitem", $_POST['spam_reportitem'], 'int');
+ $system->writesetting("spam_register", $_POST['spam_register'], 'int');
+ $system->writesetting("spam_blocked_email_enabled", $_POST['spam_blocked_email_enabled'], 'bool');
+ $system->writesetting("spam_blocked_email_domains", $_POST['spam_blocked_email_domains'], 'str');
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['750']));
+ }
}
-loadblock($MSG['recaptcha_public_key'], $MSG['recaptcha_public_key_explain'], 'text', 'recaptcha_public', $system->SETTINGS['recaptcha_public']);
-loadblock($MSG['recaptcha_secret_key'], '', 'text', 'recaptcha_private', $system->SETTINGS['recaptcha_private']);
-loadblock($MSG['registration_captcha_type'], $MSG['registration_captcha_type_explain'], 'select3num', 'spam_register', $system->SETTINGS['spam_register'], array($MSG['740'], $MSG['741'], $MSG['742']));
-loadblock($MSG['friend_captcha_type'], '', 'select3num', 'spam_sendtofriend', $system->SETTINGS['spam_sendtofriend'], array($MSG['740'], $MSG['741'], $MSG['742']));
+loadblock($MSG['746'], $MSG['748'], 'text', 'recaptcha_public', $system->SETTINGS['recaptcha_public']);
+loadblock($MSG['747'], '', 'text', 'recaptcha_private', $system->SETTINGS['recaptcha_private']);
+loadblock($MSG['743'], $MSG['745'], 'select3num', 'spam_register', $system->SETTINGS['spam_register'], array($MSG['740'], $MSG['741'], $MSG['742']));
+loadblock($MSG['744'], '', 'select3num', 'spam_sendtofriend', $system->SETTINGS['spam_sendtofriend'], array($MSG['740'], $MSG['741'], $MSG['742']));
loadblock($MSG['item_report_captcha_type'], '', 'select3num', 'spam_reportitem', $system->SETTINGS['spam_reportitem'], array($MSG['740'], $MSG['741'], $MSG['742']));
loadblock($MSG['spam_blocked_email_enabled'], '', 'bool', 'spam_blocked_email_enabled', $system->SETTINGS['spam_blocked_email_enabled'], array($MSG['759'], $MSG['760']));
loadblock($MSG['spam_blocked_email_domains'], $MSG['spam_blocked_email_domains_explain'], 'textarea', 'spam_blocked_email_domains', $system->SETTINGS['spam_blocked_email_domains']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['5142'],
- 'PAGENAME' => $MSG['spam_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['5142'],
+ 'PAGENAME' => $MSG['749']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/stats_settings.php b/admin/stats_settings.php
old mode 100644
new mode 100755
index 760c5d8b5..21ca11d44
--- a/admin/stats_settings.php
+++ b/admin/stats_settings.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'warning', 'MESSAGE' => $MSG['error_stat_type_missing']));
- $statssettings['activate'] = 'n';
- $statssettings['accesses'] = 'n';
- $statssettings['browsers'] = 'n';
- } else {
- if (!isset($_POST['accesses'])) {
- $_POST['accesses'] = 'n';
- }
- if (!isset($_POST['browsers'])) {
- $_POST['browsers'] = 'n';
- }
- if (!isset($_POST['domains'])) {
- $_POST['domains'] = 'n';
- }
- // Update database
- $query = "UPDATE " . $DBPrefix . "statssettings SET
- activate = :activate,
- accesses = :accesses,
- browsers = :browsers";
- $params = array();
- $params[] = array(':activate', $_POST['activate'], 'str');
- $params[] = array(':accesses', $_POST['accesses'], 'str');
- $params[] = array(':browsers', $_POST['browsers'], 'str');
- $db->query($query, $params);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['statistics_settings_updated']));
- $statssettings = $_POST;
- }
-} else {
- $query = "SELECT * FROM " . $DBPrefix . "statssettings";
- $db->direct_query($query);
- $statssettings = $db->result();
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (isset($_POST['activate']) && $_POST['activate'] == 'y' && (!isset($_POST['accesses']) && !isset($_POST['browsers']) && !isset($_POST['domains'])))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_5002));
+ $statssettings['activate'] = 'n';
+ $statssettings['accesses'] = 'n';
+ $statssettings['browsers'] = 'n';
+ }
+ else
+ {
+ if (!isset($_POST['accesses'])) $_POST['accesses'] = 'n';
+ if (!isset($_POST['browsers'])) $_POST['browsers'] = 'n';
+ if (!isset($_POST['domains'])) $_POST['domains'] = 'n';
+ // Update database
+ $query = "UPDATE " . $DBPrefix . "statssettings SET
+ activate = :activate,
+ accesses = :accesses,
+ browsers = :browsers";
+ $params = array();
+ $params[] = array(':activate', $_POST['activate'], 'str');
+ $params[] = array(':accesses', $_POST['accesses'], 'str');
+ $params[] = array(':browsers', $_POST['browsers'], 'str');
+ $db->query($query, $params);
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5148']));
+ $statssettings = $_POST;
+ }
+}
+else
+{
+ $query = "SELECT * FROM " . $DBPrefix . "statssettings";
+ $db->direct_query($query);
+ $statssettings = $db->result();
}
-loadblock('', $MSG['statistics_explain']);
-loadblock($MSG['enable_statistics'], '', 'yesno', 'activate', $statssettings['activate'], array($MSG['yes'], $MSG['no']));
-loadblock('', $MSG['stat_types_explain']);
-loadblock('', '', 'checkbox', 'accesses', $statssettings['accesses'], array($MSG['enable_user_access_stats']));
-loadblock('', '', 'checkbox', 'browsers', $statssettings['browsers'], array($MSG['enable_browser_stats']));
+loadblock('', $MSG['5144']);
+loadblock($MSG['5149'], '', 'yesno', 'activate', $statssettings['activate'], array($MSG['030'], $MSG['029']));
+loadblock('', $MSG['5150']);
+loadblock('' , '', 'checkbox', 'accesses', $statssettings['accesses'], array($MSG['5145']));
+loadblock('' , '', 'checkbox', 'browsers', $statssettings['browsers'], array($MSG['5146']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0023'],
- 'PAGENAME' => $MSG['5142']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0023'],
+ 'PAGENAME' => $MSG['5142']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/tax.php b/admin/tax.php
old mode 100644
new mode 100755
index f4e592ee0..0f648a81e
--- a/admin/tax.php
+++ b/admin/tax.php
@@ -1,6 +1,6 @@
writesetting("taxuser", $_POST['taxuser'], "str");
- $system->writesetting("tax", $_POST['tax'], "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['tax_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $system->writesetting("taxuser", $_POST['taxuser'],"str");
+ $system->writesetting("tax", $_POST['tax'],"str");
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['1089']));
}
-loadblock($MSG['enable_tax'], $MSG['enable_tax_explain'], 'yesno', 'tax', $system->SETTINGS['tax'], array($MSG['yes'], $MSG['no']));
-loadblock($MSG['enable_user_tax'], $MSG['enable_user_tax_explain'], 'yesno', 'taxuser', $system->SETTINGS['taxuser'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['1090'], $MSG['1091'], 'yesno', 'tax', $system->SETTINGS['tax'], array($MSG['030'], $MSG['029']));
+loadblock($MSG['1092'], $MSG['1093'], 'yesno', 'taxuser', $system->SETTINGS['taxuser'], array($MSG['030'], $MSG['029']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0012'],
- 'PAGENAME' => $MSG['tax_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0012'],
+ 'PAGENAME' => $MSG['1088']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/tax_levels.php b/admin/tax_levels.php
old mode 100644
new mode 100755
index 9f435bf2a..3293282b2
--- a/admin/tax_levels.php
+++ b/admin/tax_levels.php
@@ -1,6 +1,6 @@
cleanvars($_POST['tax_name']), 'str');
- $params[] = array(':tax_rate', $system->cleanvars($_POST['tax_rate']), 'str');
- $params[] = array(':countries_seller', $system->cleanvars($seller_countries), 'str');
- $params[] = array(':countries_buyer', $system->cleanvars($buyer_countries), 'str');
- $params[] = array(':tax_id', $_POST['tax_id'], 'int');
- $db->query($query, $params);
- } else {
- $query = "INSERT INTO " . $DBPrefix . "tax (tax_name, tax_rate, countries_seller, countries_buyer) VALUES
- (:tax_name, :tax_rate, :countries_seller, :countries_buyer)";
- $params = array();
- $params[] = array(':tax_name', $system->cleanvars($_POST['tax_name']), 'str');
- $params[] = array(':tax_rate', $system->cleanvars($_POST['tax_rate']), 'str');
- $params[] = array(':countries_seller', $system->cleanvars($seller_countries), 'str');
- $params[] = array(':countries_buyer', $system->cleanvars($buyer_countries), 'str');
- $db->query($query, $params);
- }
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_002));
- }
+ if (!empty($_POST['tax_name']))
+ {
+ if ($_POST['tax_id'] != '')
+ {
+ $query = "UPDATE " . $DBPrefix . "tax SET
+ tax_name = :tax_name,
+ tax_rate = :tax_rate,
+ countries_seller = :countries_seller,
+ countries_buyer = :countries_buyer
+ WHERE id = :tax_id";
+ $params = array();
+ $params[] = array(':tax_name', $system->cleanvars($_POST['tax_name']), 'str');
+ $params[] = array(':tax_rate', $system->cleanvars($_POST['tax_rate']), 'str');
+ $params[] = array(':countries_seller', $system->cleanvars($seller_countries), 'str');
+ $params[] = array(':countries_buyer', $system->cleanvars($buyer_countries), 'str');
+ $params[] = array(':tax_id', $_POST['tax_id'], 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "tax (tax_name, tax_rate, countries_seller, countries_buyer) VALUES
+ (:tax_name, :tax_rate, :countries_seller, :countries_buyer)";
+ $params = array();
+ $params[] = array(':tax_name', $system->cleanvars($_POST['tax_name']), 'str');
+ $params[] = array(':tax_rate', $system->cleanvars($_POST['tax_rate']), 'str');
+ $params[] = array(':countries_seller', $system->cleanvars($seller_countries), 'str');
+ $params[] = array(':countries_buyer', $system->cleanvars($buyer_countries), 'str');
+ $db->query($query, $params);
+ }
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_002));
+ }
}
// update site fee
-if (isset($_POST['action']) && $_POST['action'] == 'sitefee') {
- $query = "UPDATE " . $DBPrefix . "tax SET fee_tax = 0";
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "tax SET fee_tax = 1 WHERE id = :tax_id";
- $params = array();
- $params[] = array(':tax_id', $_POST['site_fee'], 'int');
- $db->query($query, $params);
+if (isset($_POST['action']) && $_POST['action'] == 'sitefee')
+{
+ $query = "UPDATE " . $DBPrefix . "tax SET fee_tax = 0";
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "tax SET fee_tax = 1 WHERE id = :tax_id";
+ $params = array();
+ $params[] = array(':tax_id', $_POST['site_fee'], 'int');
+ $db->query($query, $params);
}
$tax_seller_data = array();
$tax_buyer_data = array();
-if (isset($_GET['type']) && $_GET['type'] == 'edit') {
- $query = "SELECT * FROM " . $DBPrefix . "tax WHERE id = :tax_id";
- $params = array();
- $params[] = array(':tax_id', $_GET['id'], 'int');
- $db->query($query, $params);
- $data = $db->result();
- $tax_seller_data = explode(' ', $data['countries_seller']);
- $tax_buyer_data = explode(' ', $data['countries_buyer']);
+if (isset($_GET['type']) && $_GET['type'] == 'edit')
+{
+ $query = "SELECT * FROM " . $DBPrefix . "tax WHERE id = :tax_id";
+ $params = array();
+ $params[] = array(':tax_id', $_GET['id'], 'int');
+ $db->query($query, $params);
+ $data = $db->result();
+ $tax_seller_data = explode(' ', $data['countries_seller']);
+ $tax_buyer_data = explode(' ', $data['countries_buyer']);
}
-if (isset($_GET['type']) && $_GET['type'] == 'delete') {
- $query = "DELETE FROM " . $DBPrefix . "tax WHERE id = :tax_id";
- $params = array();
- $params[] = array(':tax_id', $_GET['id'], 'int');
- $db->query($query, $params);
- header('location: tax_levels.php');
+if (isset($_GET['type']) && $_GET['type'] == 'delete')
+{
+ $query = "DELETE FROM " . $DBPrefix . "tax WHERE id = :tax_id";
+ $params = array();
+ $params[] = array(':tax_id', $_GET['id'], 'int');
+ $db->query($query, $params);
+ header('location: tax_levels.php');
}
// get tax levels
$query = "SELECT * FROM " . $DBPrefix . "tax";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('tax_rates', array(
- 'ID' => $row['id'],
- 'TAX_NAME' => $row['tax_name'],
- 'TAX_RATE' => floatval($row['tax_rate']),
- 'TAX_SELLER' => $row['countries_seller'],
- 'TAX_BUYER' => $row['countries_buyer'],
- 'TAX_SITE_RATE' => $row['fee_tax']
- ));
+while($row = $db->fetch())
+{
+ $template->assign_block_vars('tax_rates', array(
+ 'ID' => $row['id'],
+ 'TAX_NAME' => $row['tax_name'],
+ 'TAX_RATE' => floatval($row['tax_rate']),
+ 'TAX_SELLER' => $row['countries_seller'],
+ 'TAX_BUYER' => $row['countries_buyer'],
+ 'TAX_SITE_RATE' => $row['fee_tax']
+ ));
}
// get countries and make a list
@@ -108,31 +119,32 @@
$db->direct_query($query);
$tax_seller = '';
$tax_buyer = '';
-while ($row = $db->fetch()) {
- if (in_array($row['country'], $tax_seller_data)) {
- $tax_seller .= ' ' . $row['country'] . ' ';
- } else {
- $tax_seller .= '' . $row['country'] . ' ';
- }
- if (in_array($row['country'], $tax_buyer_data)) {
- $tax_buyer .= '' . $row['country'] . ' ';
- } else {
- $tax_buyer .= '' . $row['country'] . ' ';
- }
+while($row = $db->fetch())
+{
+ if (in_array($row['country'], $tax_seller_data))
+ $tax_seller .= '' . $row['country'] . ' ';
+ else
+ $tax_seller .= '' . $row['country'] . ' ';
+ if (in_array($row['country'], $tax_buyer_data))
+ $tax_buyer .= '' . $row['country'] . ' ';
+ else
+ $tax_buyer .= '' . $row['country'] . ' ';
+
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TAX_ID' => (isset($data['id'])) ? $data['id'] : '',
- 'TAX_NAME' => (isset($data['tax_name'])) ? $data['tax_name'] : '',
- 'TAX_RATE' => (isset($data['tax_rate'])) ? $data['tax_rate'] : '',
- 'TAX_SELLER' => $tax_seller,
- 'TAX_BUYER' => $tax_buyer
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TAX_ID' => (isset($data['id'])) ? $data['id'] : '',
+ 'TAX_NAME' => (isset($data['tax_name'])) ? $data['tax_name'] : '',
+ 'TAX_RATE' => (isset($data['tax_rate'])) ? $data['tax_rate'] : '',
+ 'TAX_SELLER' => $tax_seller,
+ 'TAX_BUYER' => $tax_buyer
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'tax_levels.tpl'
- ));
+ 'body' => 'tax_levels.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/terms.php b/admin/terms.php
old mode 100644
new mode 100755
index a146919fd..9f2d1003b
--- a/admin/terms.php
+++ b/admin/terms.php
@@ -1,6 +1,6 @@
writesetting("terms", ynbool($_POST['terms']), "str");
- $system->writesetting("termstext", $system->cleanvars($_POST['termstext'], true), "str");
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['terms_conditions_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // clean submission and update database
+ $system->writesetting("terms", ynbool($_POST['terms']), "str");
+ $system->writesetting("termstext", $system->cleanvars($_POST['termstext'], true), "str");
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5084']));
}
-loadblock($MSG['enable_terms_conditions'], $MSG['enable_terms_conditions_explain'], 'yesno', 'terms', $system->SETTINGS['terms'], array($MSG['yes'], $MSG['no']));
+loadblock($MSG['5082'], $MSG['5081'], 'yesno', 'terms', $system->SETTINGS['terms'], array($MSG['030'], $MSG['029']));
$CKEditor = new CKEditor();
$CKEditor->basePath = $system->SETTINGS['siteurl'] . '/js/ckeditor/';
@@ -35,18 +36,19 @@
$CKEditor->config['width'] = 550;
$CKEditor->config['height'] = 400;
-loadblock($MSG['terms_conditions_content'], $MSG['editor_help'], $CKEditor->editor('termstext', $system->SETTINGS['termstext']));
+loadblock($MSG['5083'], $MSG['5080'], $CKEditor->editor('termstext', $system->SETTINGS['termstext']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPE' => 'con',
- 'TYPENAME' => $MSG['25_0018'],
- 'PAGENAME' => $MSG['terms_conditions_page']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPE' => 'con',
+ 'TYPENAME' => $MSG['25_0018'],
+ 'PAGENAME' => $MSG['5075']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/theme.php b/admin/theme.php
old mode 100644
new mode 100755
index 05aa557bc..cfaf25a2d
--- a/admin/theme.php
+++ b/admin/theme.php
@@ -1,6 +1,6 @@
writesetting("theme", $_POST['dtheme'], 'str');
- $system->writesetting("admin_theme", $_POST['admin_theme'], 'str');
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (is_dir($theme_root . '/' . $_POST['dtheme']) && !empty($_POST['dtheme']) && strstr($_POST['dtheme'], 'admin') === false)
+ {
+ // Update database
+ $system->writesetting("theme", $_POST['dtheme'], 'str');
+ $system->writesetting("admin_theme", $_POST['admin_theme'], 'str');
- $template->set_template();
+ $template->set_template();
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['default_theme_updated']));
- } else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_theme_missing']));
- }
-} elseif (isset($_POST['action']) && ($_POST['action'] == 'add' || $_POST['action'] == 'edit')) {
- $filename = ($_POST['action'] == 'add') ? $_POST['new_filename'] : $_POST['filename'];
- $fh = fopen($theme_root . $_POST['theme'] . '/' . $filename, 'w') or die("can't open file " . $theme_root . $_POST['theme'] . '/' . $filename);
- fwrite($fh, $_POST['content']);
- fclose($fh);
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['26_0005']));
+ }
+ else
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_068));
+ }
+}
+elseif (isset($_POST['action']) && ($_POST['action'] == 'add' || $_POST['action'] == 'edit'))
+{
+ $filename = ($_POST['action'] == 'add') ? $_POST['new_filename'] : $_POST['filename'];
+ $fh = fopen($theme_root . $_POST['theme'] . '/' . $filename, 'w') or die("can't open file " . $theme_root . $_POST['theme'] . '/' . $filename);
+ fwrite($fh, $_POST['content']);
+ fclose($fh);
}
-if (is_dir($theme_root)) {
- if ($dir = opendir($theme_root)) {
- while (($atheme = readdir($dir)) !== false) {
- $theme_path = $theme_root . '/' . $atheme;
- $list_files = (isset($_GET['do']) && isset($_GET['theme']) && $_GET['do'] == 'listfiles' && $_GET['theme'] == $atheme);
- if ($atheme != 'CVS' && is_dir($theme_path) && substr($atheme, 0, 1) != '.') {
- $THEMES[$atheme] = $atheme;
- if (strstr($atheme, 'admin') === false) {
- $template->assign_block_vars('themes', array(
- 'NAME' => $atheme,
- 'B_CHECKED' => ($system->SETTINGS['theme'] == $atheme),
- 'B_LISTFILES' => $list_files
- ));
- } else {
- $template->assign_block_vars('admin_themes', array(
- 'NAME' => $atheme,
- 'B_CHECKED' => ($system->SETTINGS['admin_theme'] == $atheme),
- 'B_LISTFILES' => $list_files
- ));
- }
+$abg = $bg = '';
+if (is_dir($theme_root))
+{
+ if ($dir = opendir($theme_root))
+ {
+ while (($atheme = readdir($dir)) !== false)
+ {
+ $theme_path = $theme_root . '/' . $atheme;
+ $list_files = (isset($_GET['do']) && isset($_GET['theme']) && $_GET['do'] == 'listfiles' && $_GET['theme'] == $atheme);
+ if ($atheme != 'CVS' && is_dir($theme_path) && substr($atheme, 0, 1) != '.')
+ {
+ $THEMES[$atheme] = $atheme;
+ if (strstr($atheme, 'admin') === false)
+ {
+ $template->assign_block_vars('themes', array(
+ 'NAME' => $atheme,
+ 'B_CHECKED' => ($system->SETTINGS['theme'] == $atheme),
+ 'B_LISTFILES' => $list_files,
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ }
+ else
+ {
+ $template->assign_block_vars('admin_themes', array(
+ 'NAME' => $atheme,
+ 'B_CHECKED' => ($system->SETTINGS['admin_theme'] == $atheme),
+ 'B_LISTFILES' => $list_files,
+ 'BG' => $abg
+ ));
+ $abg = ($abg == '') ? 'class="bg"' : '';
+ }
- if ($list_files) {
- // list files
- $handler = opendir($theme_path);
+ if ($list_files)
+ {
+ // list files
+ $handler = opendir($theme_path);
- // keep going until all files in directory have been read
- $files = array();
- while ($file = readdir($handler)) {
- $extension = substr($file, strrpos($file, '.') + 1);
- if (in_array($extension, array('tpl', 'html', 'css'))) {
- $files[] = $file;
- }
- }
- sort($files);
- for ($i = 0; $i < count($files); $i++) {
- if (strstr($atheme, 'admin') === false) {
- $template->assign_block_vars('themes.files', array(
- 'FILE' => $files[$i]
- ));
- } else {
- $template->assign_block_vars('admin_themes.files', array(
- 'FILE' => $files[$i]
- ));
- }
- }
- }
- }
- }
- closedir($dir);
- }
+ // keep going until all files in directory have been read
+ $files = array();
+ while ($file = readdir($handler))
+ {
+ $extension = substr($file, strrpos($file, '.') + 1);
+ if (in_array($extension, array('tpl', 'html', 'css')))
+ {
+ $files[] = $file;
+ }
+ }
+ sort($files);
+ for ($i = 0; $i < count($files); $i++)
+ {
+ if (strstr($atheme, 'admin') === false)
+ {
+ $template->assign_block_vars('themes.files', array(
+ 'FILE' => $files[$i]
+ ));
+ }
+ else
+ {
+ $template->assign_block_vars('admin_themes.files', array(
+ 'FILE' => $files[$i]
+ ));
+ }
+ }
+ }
+ }
+ }
+ closedir($dir);
+ }
}
$edit_file = false;
-if (isset($_POST['file']) && !empty($_POST['theme'])) {
- $theme_path = $theme_root . '/' . $_POST['theme'];
- if ($_POST['theme'] != 'CVS' && is_dir($theme_path) && substr($_POST['theme'], 0, 1) != '.') {
- $edit_file = true;
- $filename = $_POST['file'];
- $theme = $_POST['theme'];
- $filecontents = htmlentities(file_get_contents($theme_path . '/' . $filename));
- }
-} elseif (isset($_GET['do']) && $_GET['do'] == 'addfile') {
- $edit_file = true;
- $theme = $_GET['theme'];
+if (isset($_POST['file']) && !empty($_POST['theme']))
+{
+ $theme_path = $theme_root . '/' . $_POST['theme'];
+ if ($_POST['theme'] != 'CVS' && is_dir($theme_path) && substr($_POST['theme'], 0, 1) != '.')
+ {
+ $edit_file = true;
+ $filename = $_POST['file'];
+ $theme = $_POST['theme'];
+ $filecontents = htmlentities(file_get_contents($theme_path . '/' . $filename));
+ }
+}
+elseif (isset($_GET['do']) && $_GET['do'] == 'addfile')
+{
+ $edit_file = true;
+ $theme = $_GET['theme'];
}
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
- 'FILENAME' => isset($filename) ? $filename : '',
- 'EDIT_THEME' => isset($theme) ? $theme : '',
- 'FILECONTENTS' => isset($filecontents) ? $filecontents : '',
+ 'FILENAME' => isset($filename) ? $filename : '',
+ 'EDIT_THEME' => isset($theme) ? $theme : '',
+ 'FILECONTENTS' => isset($filecontents) ? $filecontents : '',
- 'B_EDIT_FILE' => $edit_file
- ));
+ 'B_EDIT_FILE' => $edit_file
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'theme.tpl'
- ));
+ 'body' => 'theme.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/time.php b/admin/time.php
old mode 100644
new mode 100755
index cbebea7fe..5f44259b1
--- a/admin/time.php
+++ b/admin/time.php
@@ -1,6 +1,6 @@
writesetting("timezone", $_POST['timezone'], "str");
- $system->writesetting("datesformat", $_POST['datesformat'], "str");
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['time_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Update database
+ $system->writesetting("timezone", $_POST['timezone'], "str");
+ $system->writesetting("datesformat", $_POST['datesformat'], "str");
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['347']));
}
$selectsetting = $system->SETTINGS['timezone'];
$html = generateSelect('timezone', $timezones);
//load the template
-loadblock($MSG['date_format'], $MSG['date_format_explain'], 'datestacked', 'datesformat', $system->SETTINGS['datesformat'], array($MSG['american_dates'], $MSG['european_dates']));
-loadblock($MSG['default_time_zone'], $MSG['default_time_zone_explain'], 'dropdown', 'timezone', $system->SETTINGS['timezone']);
+loadblock($MSG['363'], $MSG['379'], 'datestacked', 'datesformat', $system->SETTINGS['datesformat'], array($MSG['382'], $MSG['383']));
+loadblock($MSG['346'], $MSG['345'], 'dropdown', 'timezone', $system->SETTINGS['timezone']);
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['time_settings'],
- 'DROPDOWN' => $html
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['344'],
+ 'DROPDOWN' => $html
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/userbanners.php b/admin/userbanners.php
old mode 100644
new mode 100755
index 2df487d8a..46c1e2cf4
--- a/admin/userbanners.php
+++ b/admin/userbanners.php
@@ -1,6 +1,6 @@
assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
- } else {
- // Handle upload
- if (!file_exists(UPLOAD_PATH . 'banners')) {
- umask();
- mkdir(UPLOAD_PATH . 'banners', 0777);
- }
- if (!file_exists(UPLOAD_PATH . 'banners/' . $id)) {
- umask();
- mkdir(UPLOAD_PATH . 'banners/' . $id, 0777);
- }
-
- $TARGET = UPLOAD_PATH . 'banners/' . $id . '/' . $_FILES['bannerfile']['name'];
- if (file_exists($TARGET)) {
- $ERR = sprintf($MSG['_0047'], $TARGET);
- } else {
- list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['bannerfile']['tmp_name']);
- $filename = basename($_FILES['bannerfile']['name']);
- $file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
- $file_types = array('gif', 'jpg', 'jpeg', 'png', 'swf');
- if (!in_array(strtolower($file_ext), $file_types)) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_wrong_file_type']));
- } else {
- $imageType = image_type_to_mime_type($imageType);
- switch ($imageType) {
- case 'image/gif':
- $FILETYPE = 'gif';
- break;
- case 'image/pjpeg':
- case 'image/jpeg':
- case 'image/jpg':
- $FILETYPE = 'jpg';
- break;
- case 'image/png':
- case 'image/x-png':
- $FILETYPE = 'png';
- break;
- case 'application/x-shockwave-flash':
- $FILETYPE = 'swf';
- break;
- }
- if (!empty($_FILES['bannerfile']['tmp_name']) && $_FILES['bannerfile']['tmp_name'] != 'none') {
- move_uploaded_file($_FILES['bannerfile']['tmp_name'], $TARGET);
- chmod($TARGET, 0666);
- }
-
- // Update database
- $query = "INSERT INTO " . $DBPrefix . "banners VALUES
- (NULL, :name,
- :filetype, 0, 0, :url,
- :sponsortext, :alttext,
- :purchased, :imagewidth, :imageheight, :id)";
- $params = array();
- $params[] = array(':name', $_FILES['bannerfile']['name'], 'str');
- $params[] = array(':filetype', $FILETYPE, 'str');
- $params[] = array(':url', $_POST['url'], 'str');
- $params[] = array(':sponsortext', $_POST['sponsortext'], 'str');
- $params[] = array(':alttext', $_POST['alt'], 'str');
- $params[] = array(':purchased', $_POST['purchased'], 'int');
- $params[] = array(':imagewidth', $imagewidth, 'int');
- $params[] = array(':imageheight', $imageheight, 'int');
- $params[] = array(':id', $id, 'int');
- $db->query($query, $params);
- $ID = $db->lastInsertId();
-
- // Handle filters
- if (isset($_POST['category']) && is_array($_POST['category'])) {
- foreach ($_POST['category'] as $k => $v) {
- $query = "INSERT INTO " . $DBPrefix . "bannerscategories VALUES (:id, :category)";
- $params = array();
- $params[] = array(':id', $ID, 'int');
- $params[] = array(':category', $v, 'int');
- $db->query($query, $params);
- }
- }
- if (!empty($_POST['keywords'])) {
- $KEYWORDS = explode("\n", $_POST['keywords']);
-
- foreach ($KEYWORDS as $k => $v) {
- if (!empty($v)) {
- $query = "INSERT INTO " . $DBPrefix . "bannerskeywords VALUES (:id, :keyword)";
- $params = array();
- $params[] = array(':id', $ID, 'int');
- $params[] = array(':keyword', $system->cleanvars(trim($v)), 'str');
- $db->query($query, $params);
- }
- }
- }
- header('location: userbanners.php?id=' . $id);
- exit;
- }
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'insert')
+{
+ // Data integrity
+ if (empty($_FILES['bannerfile']) || empty($_POST['url']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_047));
+ }
+ else
+ {
+ // Handle upload
+ if (!file_exists(UPLOAD_PATH . 'banners'))
+ {
+ umask();
+ mkdir(UPLOAD_PATH . 'banners', 0777);
+ }
+ if (!file_exists(UPLOAD_PATH . 'banners/' . $id))
+ {
+ umask();
+ mkdir(UPLOAD_PATH . 'banners/' . $id, 0777);
+ }
+
+ $TARGET = UPLOAD_PATH . 'banners/' . $id . '/' . $_FILES['bannerfile']['name'];
+ if (file_exists($TARGET))
+ {
+ $ERR = sprintf($MSG['_0047'], $TARGET);
+ }
+ else
+ {
+ list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['bannerfile']['tmp_name']);
+ $filename = basename($_FILES['bannerfile']['name']);
+ $file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
+ $file_types = array('gif', 'jpg', 'jpeg', 'png', 'swf');
+ if (!in_array(strtolower($file_ext), $file_types))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['_0048']));
+ }
+ else
+ {
+ $imageType = image_type_to_mime_type($imageType);
+ switch ($imageType)
+ {
+ case 'image/gif':
+ $FILETYPE = 'gif';
+ break;
+ case 'image/pjpeg':
+ case 'image/jpeg':
+ case 'image/jpg':
+ $FILETYPE = 'jpg';
+ break;
+ case 'image/png':
+ case 'image/x-png':
+ $FILETYPE = 'png';
+ break;
+ case 'application/x-shockwave-flash':
+ $FILETYPE = 'swf';
+ break;
+ }
+ if (!empty($_FILES['bannerfile']['tmp_name']) && $_FILES['bannerfile']['tmp_name'] != 'none')
+ {
+ move_uploaded_file($_FILES['bannerfile']['tmp_name'], $TARGET);
+ chmod($TARGET, 0666);
+ }
+
+ // Update database
+ $query = "INSERT INTO " . $DBPrefix . "banners VALUES
+ (NULL, :name,
+ :filetype, 0, 0, :url,
+ :sponsortext, :alttext,
+ :purchased, :imagewidth, :imageheight, :id)";
+ $params = array();
+ $params[] = array(':name', $_FILES['bannerfile']['name'], 'str');
+ $params[] = array(':filetype', $FILETYPE, 'str');
+ $params[] = array(':url', $_POST['url'], 'str');
+ $params[] = array(':sponsortext', $_POST['sponsortext'], 'str');
+ $params[] = array(':alttext', $_POST['alt'], 'str');
+ $params[] = array(':purchased', $_POST['purchased'], 'int');
+ $params[] = array(':imagewidth', $imagewidth, 'int');
+ $params[] = array(':imageheight', $imageheight, 'int');
+ $params[] = array(':id', $id, 'int');
+ $db->query($query, $params);
+ $ID = $db->lastInsertId();
+
+ // Handle filters
+ if (isset($_POST['category']) && is_array($_POST['category']))
+ {
+ foreach ($_POST['category'] as $k => $v)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bannerscategories VALUES (:id, :category)";
+ $params = array();
+ $params[] = array(':id', $ID, 'int');
+ $params[] = array(':category', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
+ if (!empty($_POST['keywords']))
+ {
+ $KEYWORDS = explode("\n", $_POST['keywords']);
+
+ foreach ($KEYWORDS as $k => $v)
+ {
+ if (!empty($v))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bannerskeywords VALUES (:id, :keyword)";
+ $params = array();
+ $params[] = array(':id', $ID, 'int');
+ $params[] = array(':keyword', $system->cleanvars(trim($v)), 'str');
+ $db->query($query, $params);
+ }
+ }
+ }
+ header('location: userbanners.php?id=' . $id);
+ exit;
+ }
+ }
+ }
}
+$BANNERS = array();
// Retrieve user's information
$query = "SELECT id, name, company, email FROM " . $DBPrefix . "bannersusers WHERE id = :id";
$params = array();
@@ -132,66 +152,62 @@
$params = array();
$params[] = array(':user_id', $USER['id'], 'int');
$db->query($query, $params);
-
-while ($row = $db->fetch()) {
- $template->assign_block_vars('banners', array(
- 'ID' => $row['id'],
- 'TYPE' => $row['type'],
- 'NAME' => $row['name'],
- 'BANNER' => UPLOAD_FOLDER . 'banners/' . $id . '/' . $row['name'],
- 'WIDTH' => $row['width'],
- 'HEIGHT' => $row['height'],
- 'URL' => $row['url'],
- 'ALT' => $row['alt'],
- 'SPONSERTEXT' => $row['sponsortext'],
- 'VIEWS' => $row['views'],
- 'CLICKS' => $row['clicks'],
- 'PURCHASED' => $row['purchased']
- ));
-}
-
-// Retrieve filters
-$CATEGORIES = array();
-$query = "SELECT * FROM " . $DBPrefix . "bannerscategories WHERE banner = :banner_id";
-$params = array();
-$params[] = array(':banner_id', $banner, 'int');
-$db->query($query, $params);
-
-if ($db->numrows() > 0) {
- while ($row = $db->fetch()) {
- $CATEGORIES[] = $row['category'];
- }
+$bg = '';
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('banners', array(
+ 'ID' => $row['id'],
+ 'TYPE' => $row['type'],
+ 'NAME' => $row['name'],
+ 'BANNER' => UPLOAD_FOLDER . 'banners/' . $id . '/' . $row['name'],
+ 'WIDTH' => $row['width'],
+ 'HEIGHT' => $row['height'],
+ 'URL' => $row['url'],
+ 'ALT' => $row['alt'],
+ 'SPONSERTEXT' => $row['sponsortext'],
+ 'VIEWS' => $row['views'],
+ 'CLICKS' => $row['clicks'],
+ 'PURCHASED' => $row['purchased'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
}
// category
-if (isset($category_plain) && count($category_plain) > 0) {
- foreach ($category_plain as $cat_id => $cat_name) {
- $template->assign_block_vars('categories', array(
- 'CAT_ID' => $cat_id,
- 'CAT_NAME' => $cat_name,
- 'B_SELECTED' => false
- ));
- }
+$TPL_categories_list = '' . "\n";
+if (isset($category_plain) && count($category_plain) > 0)
+{
+ foreach ($category_plain as $k => $v)
+ {
+ if (isset($_POST['categories']) && is_array($_POST['categories']))
+ $select = (in_array($k, $_POST['categories'])) ? ' selected="true"' : '';
+ else
+ $select = '';
+ $TPL_categories_list .= "\t" . '' . $v . ' ' . "\n";
+ }
}
+$TPL_categories_list .= ' ' . "\n";
$template->assign_vars(array(
- 'ID' => $id,
- 'NAME' => $USER['name'],
- 'COMPANY' => $USER['company'],
- 'EMAIL' => $USER['email'],
- // form values
- 'BANNERID' => '',
- 'URL' => (isset($_POST['url'])) ? $_POST['url'] : '',
- 'SPONSORTEXT' => (isset($_POST['sponsortext'])) ? $_POST['sponsortext'] : '',
- 'ALT' => (isset($_POST['alt'])) ? $_POST['alt'] : '',
- 'PURCHASED' => (isset($_POST['purchased'])) ? $_POST['purchased'] : '',
- 'KEYWORDS' => (isset($_POST['keywords'])) ? $_POST['keywords'] : '',
- 'NOTEDIT' => true
- ));
+ 'ID' => $id,
+ 'NAME' => $USER['name'],
+ 'COMPANY' => $USER['company'],
+ 'EMAIL' => $USER['email'],
+ // form values
+ 'BANNERID' => '',
+ 'URL' => (isset($_POST['url'])) ? $_POST['url'] : '',
+ 'SPONSORTEXT' => (isset($_POST['sponsortext'])) ? $_POST['sponsortext'] : '',
+ 'ALT' => (isset($_POST['alt'])) ? $_POST['alt'] : '',
+ 'PURCHASED' => (isset($_POST['purchased'])) ? $_POST['purchased'] : '',
+ 'KEYWORDS' => (isset($_POST['keywords'])) ? $_POST['keywords'] : '',
+ 'CATEGORIES' => $TPL_categories_list,
+ 'NOTEDIT' => true
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'userbanners.tpl'
- ));
+ 'body' => 'userbanners.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/userfeedback.php b/admin/userfeedback.php
old mode 100644
new mode 100755
index 327ae32de..9adfd9077
--- a/admin/userfeedback.php
+++ b/admin/userfeedback.php
@@ -1,6 +1,6 @@
query($query, $params);
+$bg = '';
-if ($db->numrows() > 0) {
- $arr = $db->result();
- $num_fbs = $arr['rate_num'];
- // get page limits
- if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '') {
- $OFFSET = 0;
- $PAGE = 1;
- } else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
- }
- $PAGES = ($num_fbs == 0) ? 1 : ceil($num_fbs / $system->SETTINGS['perpage']);
+if ($db->numrows() > 0)
+{
+ $arr = $db->result();
+ $num_fbs = $arr['rate_num'];
+ // get page limits
+ if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '')
+ {
+ $OFFSET = 0;
+ $PAGE = 1;
+ }
+ else
+ {
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+ }
+ $PAGES = ($num_fbs == 0) ? 1 : ceil($num_fbs / $system->SETTINGS['perpage']);
- $query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
- $params = array();
- $params[] = array(':feedback', $arr['rate_sum'], 'int');
- $db->query($query, $params);
- $feedback_icon = $db->result('icon');
+ $i = 0;
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $arr['rate_sum'] || $i++ == (count($membertypes)-1))
+ {
+ $feedback_image = ' ';
+ break;
+ }
+ }
- $query = "SELECT * FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = " . $secid . " ORDER by feedbackdate DESC";
- $params = array();
- $params[] = array(':user_id', $secid, 'int');
- $db->query($query, $params);
- while ($arrfeed = $db->fetch()) {
- switch ($arrfeed['rate']) {
- case 1:
- $fb_type = 'positive';
- break;
- case -1:
- $fb_type = 'negative';
- break;
- case 0:
- $fb_type = 'neutral';
- break;
- }
+ $query = "SELECT * FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = " . $secid . " ORDER by feedbackdate DESC";
+ $params = array();
+ $params[] = array(':user_id', $secid, 'int');
+ $db->query($query, $params);
+ while ($arrfeed = $db->fetch())
+ {
+ switch($arrfeed['rate'])
+ {
+ case 1:
+ $fb_type = 'positive';
+ break;
+ case -1:
+ $fb_type = 'negative';
+ break;
+ case 0:
+ $fb_type = 'neutral';
+ break;
+ }
- $template->assign_block_vars('feedback', array(
- 'FB_TYPE' => $fb_type,
- 'FB_FROM' => $arrfeed['rater_user_nick'],
- 'FB_TIME' => $dt->formatDate($arrfeed['feedbackdate']),
- 'FB_MSG' => nl2br($arrfeed['feedback']),
- 'FB_ID' => $arrfeed['id']
- ));
- }
-} else {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_105));
+ $template->assign_block_vars('feedback', array(
+ 'FB_TYPE' => $fb_type,
+ 'FB_FROM' => $arrfeed['rater_user_nick'],
+ 'FB_TIME' => FormatDate($arrfeed['feedbackdate'], '/', false),
+ 'FB_MSG' => nl2br($arrfeed['feedback']),
+ 'FB_ID' => $arrfeed['id'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ }
+}
+else
+{
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_105));
}
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
-$_SESSION['RETURN_LIST'] = 'userfeedback.php?id=' . $secid;
-$_SESSION['RETURN_LIST_OFFSET'] = $PAGE;
-
$template->assign_vars(array(
- 'ID' => $secid,
- 'NICK' => $arr['nick'],
- 'FB_NUM' => $arr['rate_num'],
- 'FB_ICON' => $feedback_icon,
+ 'ID' => $secid,
+ 'NICK' => $arr['nick'],
+ 'FB_NUM' => $arr['rate_num'],
+ 'FB_IMG' => $feedback_image,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'userfeedback.tpl'
- ));
+ 'body' => 'userfeedback.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/usergroups.php b/admin/usergroups.php
old mode 100644
new mode 100755
index 84b86ea78..2a04eeef5
--- a/admin/usergroups.php
+++ b/admin/usergroups.php
@@ -1,6 +1,6 @@
query($query, $params);
- $group = $db->result();
-
- $can_delete = ($group['auto_join'] == 0);
-
- $template->assign_vars(array(
- 'GROUP_ID' => $group['id'],
- 'EDIT_NAME' => $group['group_name'],
- 'CAN_SELL_Y' => ($group['can_sell'] == 1) ? 'selected="true"' : '',
- 'CAN_SELL_N' => ($group['can_sell'] == 0) ? 'selected="true"' : '',
- 'CAN_BUY_Y' => ($group['can_buy'] == 1) ? 'selected="true"' : '',
- 'CAN_BUY_N' => ($group['can_buy'] == 0) ? 'selected="true"' : '',
- 'NO_FEES_Y' => ($group['no_fees'] == 1) ? 'selected="true"' : '',
- 'NO_FEES_N' => ($group['no_fees'] == 0) ? 'selected="true"' : '',
- 'AUTO_JOIN_Y' => ($group['auto_join'] == 1) ? 'selected="true"' : '',
- 'AUTO_JOIN_N' => ($group['auto_join'] == 0) ? 'selected="true"' : '',
- 'USER_COUNT' => $group['count'],
- 'NOT_DEFAULT_GROUP' => $can_delete
- ));
- $edit = true;
- }
- if ($_GET['action'] == 'new') {
- $template->assign_vars(array(
- 'USER_COUNT' => 0
- ));
- $edit = true;
- }
+if (isset($_GET['action']) && !isset($_POST['action']))
+{
+ if ($_GET['action'] == 'edit' && isset($_GET['id']))
+ {
+ $query = "SELECT * FROM ". $DBPrefix . "groups WHERE id = :groupid";
+ $params = array();
+ $params[] = array(':groupid', $_GET['id'], 'int');
+ $db->query($query, $params);
+ $group = $db->result();
+
+ $can_delete = ($group['auto_join'] == 0);
+
+ $template->assign_vars(array(
+ 'GROUP_ID' => $group['id'],
+ 'EDIT_NAME' => $group['group_name'],
+ 'CAN_SELL_Y' => ($group['can_sell'] == 1) ? 'selected="true"' : '',
+ 'CAN_SELL_N' => ($group['can_sell'] == 0) ? 'selected="true"' : '',
+ 'CAN_BUY_Y' => ($group['can_buy'] == 1) ? 'selected="true"' : '',
+ 'CAN_BUY_N' => ($group['can_buy'] == 0) ? 'selected="true"' : '',
+ 'AUTO_JOIN_Y' => ($group['auto_join'] == 1) ? 'selected="true"' : '',
+ 'AUTO_JOIN_N' => ($group['auto_join'] == 0) ? 'selected="true"' : '',
+ 'USER_COUNT' => $group['count'],
+ 'NOT_DEFAULT_GROUP' => $can_delete
+ ));
+ $edit = true;
+ }
+ if ($_GET['action'] == 'new')
+ {
+ $template->assign_vars(array(
+ 'USER_COUNT' => 0
+ ));
+ $edit = true;
+ }
}
-if (isset($_POST['action'])) {
- $auto_join = true;
- // check other groups are auto-join as every user needs a group
- if ($_POST['auto_join'] == 0) {
- $query = "SELECT id FROM ". $DBPrefix . "groups WHERE auto_join = 1";
- $db->direct_query($query);
- $auto_join = false;
- while ($row = $db->fetch()) {
- if ($row['id'] != $_POST['id']) {
- $auto_join = true;
- }
- }
- if (!$auto_join) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['error_must_have_one_autojoin']));
- }
- }
- if (($_GET['action'] == 'edit' || (isset($_GET['id']) && is_numeric($_GET['id']))) && !isset($ERR)) {
- if ($_GET['action'] == 'edit' && isset($_POST['remove'])) {
- // prevent removal of webid default Group 1 or Group 2
- if (intval($_POST['id']) == 1 || intval($_POST['id']) == 2) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['cannot_delete_default_user_groups']));
- } else {
- $query = "DELETE FROM " . $DBPrefix . "groups WHERE id = :group_id";
- $params = array();
- $params[] = array(':group_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['user_group_deleted']));
- }
- } else {
- if (empty($_POST['group_name'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['user_group_name_empty_update']));
- } else {
- $query = "UPDATE ". $DBPrefix . "groups SET
- group_name = :group_name,
- count = :count,
- can_sell = :can_sell,
- can_buy = :can_buy,
- no_fees = :no_fees,
- auto_join = :auto_join
- WHERE id = :group_id";
- $params = array();
- $params[] = array(':group_name', $system->cleanvars($_POST['group_name']), 'str');
- $params[] = array(':count', $_POST['user_count'], 'int');
- $params[] = array(':can_sell', $_POST['can_sell'], 'int');
- $params[] = array(':can_buy', $_POST['can_buy'], 'int');
- $params[] = array(':no_fees', $_POST['no_fees'], 'int');
- $params[] = array(':auto_join', (($auto_join) ? $_POST['auto_join'] : 1), 'int');
- $params[] = array(':group_id', $_POST['id'], 'int');
- $db->query($query, $params);
- }
- }
- }
- if ($_GET['action'] == 'new' || empty($_GET['id'])) {
- if (empty($_POST['group_name'])) {
- $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['user_group_name_empty_new']));
- } else {
- $query = "INSERT INTO ". $DBPrefix . "groups (group_name, count, can_sell, can_buy, no_fees, auto_join) VALUES
- (:group_name, :count, :can_sell, :can_buy, :no_fees, :auto_join)";
- $params = array();
- $params[] = array(':group_name', $system->cleanvars($_POST['group_name']), 'str');
- $params[] = array(':count', $_POST['user_count'], 'int');
- $params[] = array(':can_sell', $_POST['can_sell'], 'int');
- $params[] = array(':can_buy', $_POST['can_buy'], 'int');
- $params[] = array(':no_fees', $_POST['no_fees'], 'int');
- $params[] = array(':auto_join', (($auto_join) ? $_POST['auto_join'] : 1), 'int');
- $db->query($query, $params);
- }
- }
+if (isset($_POST['action']))
+{
+ $auto_join = true;
+ // check other groups are auto-join as every user needs a group
+ if ($_POST['auto_join'] == 0)
+ {
+ $query = "SELECT id FROM ". $DBPrefix . "groups WHERE auto_join = 1";
+ $db->direct_query($query);
+ $auto_join = false;
+ while ($row = $db->fetch())
+ {
+ if ($row['id'] != $_POST['id'])
+ {
+ $auto_join = true;
+ }
+ }
+ if (!$auto_join)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $ERR_050));
+ }
+ }
+ if (($_GET['action'] == 'edit' || (isset($_GET['id']) && is_numeric($_GET['id']))) && !isset($ERR))
+ {
+ if ($_GET['action'] == 'edit' && isset($_POST['remove']))
+ {
+ // prevent removal of webid default Group 1 or Group 2
+ if(intval($_POST['id']) == 1 || intval($_POST['id']) == 2)
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['cannot_delete_default_user_groups']));
+ }
+ else
+ {
+ $query = "DELETE FROM " . $DBPrefix . "groups WHERE id = :group_id";
+ $params = array();
+ $params[] = array(':group_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['user_group_deleted']));
+ }
+ }
+ else
+ {
+ if (empty($_POST['group_name']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['user_group_name_empty_update']));
+ }
+ else
+ {
+ $query = "UPDATE ". $DBPrefix . "groups SET
+ group_name = :group_name,
+ count = :count,
+ can_sell = :can_sell,
+ can_buy = :can_buy,
+ auto_join = :auto_join
+ WHERE id = :group_id";
+ $params = array();
+ $params[] = array(':group_name', $system->cleanvars($_POST['group_name']), 'str');
+ $params[] = array(':count', $_POST['user_count'], 'int');
+ $params[] = array(':can_sell', $_POST['can_sell'], 'int');
+ $params[] = array(':can_buy', $_POST['can_buy'], 'int');
+ $params[] = array(':auto_join', (($auto_join) ? $_POST['auto_join'] : 1), 'int');
+ $params[] = array(':group_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+ if ($_GET['action'] == 'new' || empty($_GET['id']))
+ {
+ if (empty($_POST['group_name']))
+ {
+ $template->assign_block_vars('alerts', array('TYPE' => 'error', 'MESSAGE' => $MSG['user_group_name_empty_new']));
+ }
+ else
+ {
+ $query = "INSERT INTO ". $DBPrefix . "groups (group_name, count, can_sell, can_buy, auto_join) VALUES
+ (:group_name, :count, :can_sell, :can_buy, :auto_join)";
+ $params = array();
+ $params[] = array(':group_name', $system->cleanvars($_POST['group_name']), 'str');
+ $params[] = array(':count', $_POST['user_count'], 'int');
+ $params[] = array(':can_sell', $_POST['can_sell'], 'int');
+ $params[] = array(':can_buy', $_POST['can_buy'], 'int');
+ $params[] = array(':auto_join', (($auto_join) ? $_POST['auto_join'] : 1), 'int');
+ $db->query($query, $params);
+ }
+
+ }
}
$groups_array = array();
@@ -130,88 +148,102 @@
$query = "SELECT groups, id, nick FROM ". $DBPrefix . "users";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- if (!empty($row['groups'])) {
- $exploded_groups = explode(',', $row['groups']);
- foreach ($exploded_groups as $group_id) {
- if (!isset($groups_array[$group_id])) {
- $groups_array[$group_id] = 1;
- } else {
- $groups_array[$group_id]++;
- }
- }
- } else {
- $groups_unknown[] = $row;
- }
+while ($row = $db->fetch())
+{
+ if (!empty($row['groups']))
+ {
+ $exploded_groups = explode(',', $row['groups']);
+ foreach ($exploded_groups as $group_id)
+ {
+ if (!isset($groups_array[$group_id]))
+ {
+ $groups_array[$group_id] = 1;
+ }
+ else
+ {
+ $groups_array[$group_id]++;
+ }
+ }
+ }
+ else
+ {
+ $groups_unknown[] = $row;
+ }
}
$query = "SELECT * FROM ". $DBPrefix . "groups";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('groups', array(
- 'ID' => $row['id'],
- 'NAME' => $row['group_name'],
- 'CAN_SELL' => ($row['can_sell'] == 1) ? $MSG['yes'] : $MSG['no'],
- 'CAN_BUY' => ($row['can_buy'] == 1) ? $MSG['yes'] : $MSG['no'],
- 'NO_FEES' => ($row['no_fees'] == 1) ? $MSG['yes'] : $MSG['no'],
- 'AUTO_JOIN' => ($row['auto_join'] == 1) ? $MSG['yes'] : $MSG['no'],
- 'USER_COUNT' => isset($groups_array[$row['id']]) ? $groups_array[$row['id']] : 0 // $row['count']
- ));
- unset($groups_array[$row['id']]);
- // TODO: automatically control user group count when users join/leave groups
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('groups', array(
+ 'ID' => $row['id'],
+ 'NAME' => $row['group_name'],
+ 'CAN_SELL' => ($row['can_sell'] == 1) ? $MSG['030'] : $MSG['029'],
+ 'CAN_BUY' => ($row['can_buy'] == 1) ? $MSG['030'] : $MSG['029'],
+ 'AUTO_JOIN' => ($row['auto_join'] == 1) ? $MSG['030'] : $MSG['029'],
+ 'USER_COUNT' => isset($groups_array[$row['id']]) ? $groups_array[$row['id']] : 0 // $row['count']
+ ));
+ unset($groups_array[$row['id']]);
+ // TODO: automatically control user group count when users join/leave groups
}
// non assigned users
-if (!empty($groups_unknown)) {
- $template->assign_block_vars('groups_unknown', array(
- 'ID' => $MSG['empty_line'],
- 'NAME' => $MSG['empty_line'],
- 'USER_COUNT' => !empty($groups_array['unknown']) ? $groups_array['unknown'] : 0
- ));
-
- foreach ($groups_unknown as $k => $v) {
- $template->assign_block_vars('groups_unknown.list_users', array(
- 'ID' => $v['id'],
- 'NAME' => $v['nick'],
- 'TYPE' => 1
- ));
- }
+if (!empty($groups_unknown))
+{
+ $template->assign_block_vars('groups_unknown', array(
+ 'ID' => $MSG['empty_line'],
+ 'NAME' => $MSG['empty_line'],
+ 'USER_COUNT' => !empty($groups_array['unknown']) ? $groups_array['unknown'] : 0
+ ));
+
+ foreach ($groups_unknown as $k => $v)
+ {
+ $template->assign_block_vars('groups_unknown.list_users', array(
+ 'ID' => $v['id'],
+ 'NAME' => $v['nick'],
+ 'TYPE' => 1
+ ));
+ }
}
// assigned to non existstant groups
-if (!empty($groups_array)) {
- foreach ($groups_array as $k => $v) {
- $template->assign_block_vars('groups_unknown', array(
- 'ID' => $k,
- 'NAME' => $MSG['unknown'],
- 'USER_COUNT' => $v
- ));
- $query = "SELECT groups, id, nick FROM ". $DBPrefix . "users WHERE groups LIKE :group_name";
- $params = array();
- $params[] = array(':group_name', '%' . $k . '%', 'str');
- $db->query($query, $params);
- // TODO: automatically remove users from groups when the group is deleted
-
- while ($row = $db->fetch()) {
- $template->assign_block_vars('groups_unknown.list_users', array(
- 'ID' => $row['id'],
- 'NAME' => $row['nick'],
- 'TYPE' => 2
- ));
- }
- }
+if (!empty($groups_array))
+{
+ foreach ($groups_array as $k => $v)
+ {
+ $template->assign_block_vars('groups_unknown', array(
+ 'ID' => $k,
+ 'NAME' => $MSG['text_unknown'],
+ 'USER_COUNT' => $v
+ ));
+ $query = "SELECT groups, id, nick FROM ". $DBPrefix . "users WHERE groups LIKE :group_name";
+ $params = array();
+ $params[] = array(':group_name', '%' . $k . '%', 'str');
+ $db->query($query, $params);
+ // TODO: automatically remove users from groups when the group is deleted
+
+ while ($row = $db->fetch())
+ {
+ $template->assign_block_vars('groups_unknown.list_users', array(
+ 'ID' => $row['id'],
+ 'NAME' => $row['nick'],
+ 'TYPE' => 2
+ ));
+ }
+ }
}
$template->assign_vars(array(
- 'GROUPS_UNKNOWN' => (count($groups_unknown) > 0),
- 'B_EDIT' => $edit,
- 'NOT_DEFAULT_GROUP' => $can_delete
- ));
+ 'GROUPS_UNKNOWN' => (count($groups_unknown) > 0),
+ 'B_EDIT' => $edit,
+ 'NOT_DEFAULT_GROUP' => $can_delete
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'usergroups.tpl'
- ));
+ 'body' => 'usergroups.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/usersettings.php b/admin/usersettings.php
old mode 100644
new mode 100755
index 95b24ae26..a5ea0d33e
--- a/admin/usersettings.php
+++ b/admin/usersettings.php
@@ -1,6 +1,6 @@
writesetting("usersauth", $_POST['usersauth'], 'str');
- $system->writesetting("activationtype", $_POST['usersconf'], 'int');
- $system->writesetting("prune_unactivated_users", $_POST['prune_unactivated_users'], 'bool');
- $system->writesetting("prune_unactivated_users_days", $_POST['prune_unactivated_users_days'], 'int');
- $system->writesetting("bidding_visable_to_guest", $_POST['bidding_visable_to_guest'], 'bool');
- $system->writesetting("email_admin_on_signup", $_POST['email_admin_on_signup'], 'bool');
- $system->writesetting("user_request_seller_permission", $_POST['user_request_seller_permission'], 'bool');
-
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['user_settings_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $system->writesetting("usersauth", $_POST['usersauth'], 'str');
+ $system->writesetting("activationtype", $_POST['usersconf'], 'int');
+ $system->writesetting("prune_unactivated_users", $_POST['prune_unactivated_users'], 'bool');
+ $system->writesetting("prune_unactivated_users_days", $_POST['prune_unactivated_users_days'], 'int');
+ $system->writesetting("bidding_visable_to_guest", $_POST['bidding_visable_to_guest'], 'bool');
+ $system->writesetting("email_admin_on_signup", $_POST['email_admin_on_signup'], 'bool');
+ $system->writesetting("user_request_seller_permission", $_POST['user_request_seller_permission'], 'bool');
+
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['895']));
}
-loadblock($MSG['enable_reauthentication'], $MSG['enable_reauthentication_explain'], 'yesnostacked', 'usersauth', $system->SETTINGS['usersauth'], array($MSG['2__0066'], $MSG['2__0067']));
-loadblock($MSG['user_confirm_method'], $MSG['user_confirm_method_explain'], 'select3num', 'usersconf', $system->SETTINGS['activationtype'], array($MSG['25_0152_b'], $MSG['25_0152_c'], $MSG['25_0152_d']));
+loadblock($MSG['25_0151'], $MSG['25_0152'], 'yesnostacked', 'usersauth', $system->SETTINGS['usersauth'], array($MSG['2__0066'], $MSG['2__0067']));
+loadblock($MSG['25_0151_a'], $MSG['25_0152_a'], 'select3num', 'usersconf', $system->SETTINGS['activationtype'], array($MSG['25_0152_b'], $MSG['25_0152_c'], $MSG['25_0152_d']));
loadblock($MSG['prune_unactivated_users'], $MSG['prune_unactivated_users_explain'], 'bool', 'prune_unactivated_users', $system->SETTINGS['prune_unactivated_users'], array($MSG['759'], $MSG['760']));
-loadblock($MSG['prune_unactivated_users_days'], $MSG['prune_unactivated_users_days_explain'], 'days', 'prune_unactivated_users_days', $system->SETTINGS['prune_unactivated_users_days'], array($MSG['5115']));
+loadblock($MSG['prune_unactivated_users_days'], $MSG['prune_unactivated_users_days_explain'], 'days', 'prune_unactivated_users_days', $system->SETTINGS['prune_unactivated_users_days'], array($MSG['377']));
loadblock($MSG['bidding_visable_to_guest'], $MSG['bidding_visable_to_guest_explain'], 'bool', 'bidding_visable_to_guest', $system->SETTINGS['bidding_visable_to_guest'], array($MSG['759'], $MSG['760']));
loadblock($MSG['email_admin_on_signup'], $MSG['email_admin_on_signup_explain'], 'bool', 'email_admin_on_signup', $system->SETTINGS['email_admin_on_signup'], array($MSG['759'], $MSG['760']));
loadblock($MSG['user_request_seller_permission'], $MSG['user_request_seller_permission_explain'], 'bool', 'user_request_seller_permission', $system->SETTINGS['user_request_seller_permission'], array($MSG['759'], $MSG['760']));
$template->assign_vars(array(
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'TYPENAME' => $MSG['25_0008'],
- 'PAGENAME' => $MSG['user_settings']
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'TYPENAME' => $MSG['25_0008'],
+ 'PAGENAME' => $MSG['894']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'adminpages.tpl'
- ));
+ 'body' => 'adminpages.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/util_cc1.php b/admin/util_cc1.php
old mode 100644
new mode 100755
index e020a3af6..902756d55
--- a/admin/util_cc1.php
+++ b/admin/util_cc1.php
@@ -1,6 +1,6 @@
$v) {
- include MAIN_PATH . 'language/' . $k . '/messages.inc.php';
- include MAIN_PATH . 'language/' . $k . '/categories.inc.php';
- $cat_strings = [];
- //build array of category names
- foreach ($categories as $category) {
- $cat_strings[$category['cat_id']] = $category_names[$category['cat_id']];
- }
- // sort the array
- asort($cat_strings);
-
- // build select dropdown
- $output = "\t" . '' . $MSG['277'] . ' ' . "\n";
- $output.= "\t" . '---------------------- ' . "\n";
- foreach ($cat_strings as $cat_id => $category_name) {
- $output .= "\t" . '' . $category_name . ' ' . "\n";
- }
- $handle = fopen(MAIN_PATH . 'language/' . $k . '/categories_select_box.inc.php', 'w');
- fputs($handle, $output);
- fclose($handle);
+foreach ($LANGUAGES as $k => $v)
+{
+ include MAIN_PATH . 'language/' . $k . '/messages.inc.php';
+ include MAIN_PATH . 'language/' . $k . '/categories.inc.php';
+ $cat_strings = [];
+ //build array of category names
+ foreach ($categories as $category)
+ {
+ $cat_strings[$category['cat_id']] = $category_names[$category['cat_id']];
+ }
+ // sort the array
+ asort($cat_strings);
+
+ // build select dropdown
+ $output = "\t" . '' . $MSG['277'] . ' ' . "\n";
+ $output.= "\t" . '---------------------- ' . "\n";
+ foreach ($cat_strings as $cat_id => $category_name)
+ {
+ $output .= "\t" . '' . $category_name . ' ' . "\n";
+ }
+ $handle = fopen (MAIN_PATH . 'language/' . $k . '/categories_select_box.inc.php', 'w');
+ fputs($handle, $output);
+ fclose($handle);
}
-$template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['category_table_updated']));
+$template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['086']));
+?>
diff --git a/admin/viewaccessstats.php b/admin/viewaccessstats.php
old mode 100644
new mode 100755
index 4ec6790b5..8d18e24ef
--- a/admin/viewaccessstats.php
+++ b/admin/viewaccessstats.php
@@ -1,6 +1,6 @@
query($query, $params);
// set the arrays up
$data_line = array();
$data_max = array();
-while ($row = $db->fetch()) {
- if ($listby == 'w') {
- $date = $row['year'] . '/' . $row['month'] . '/' . $row['day'];
- $weekno = date('W', strtotime($date) + $system->tdiff);
- if (!isset($data_line[$weekno])) {
- $data_line[$weekno] = array();
- $data_line[$weekno]['pageviews'] = 0;
- $data_line[$weekno]['uniquevisitors'] = 0;
- $data_line[$weekno]['usersessions'] = 0;
- }
- if (!isset($data_max[$weekno])) {
- $data_max[$weekno] = 0;
- }
- $data_line[$weekno]['pageviews'] += $row['pageviews'];
- $data_line[$weekno]['uniquevisitors'] += $row['uniquevisitors'];
- $data_line[$weekno]['usersessions'] += $row['usersessions'];
- $data_max[$weekno] += $row['pageviews'];
- } elseif ($listby == 'm') {
- $monthno = $row['month'] . $row['year'];
- if (!isset($data_line[$monthno])) {
- $data_line[$monthno] = array();
- $data_line[$monthno]['month'] = $row['month'];
- $data_line[$monthno]['year'] = $row['year'];
- $data_line[$monthno]['pageviews'] = 0;
- $data_line[$monthno]['uniquevisitors'] = 0;
- $data_line[$monthno]['usersessions'] = 0;
- }
- if (!isset($data_max[$monthno])) {
- $data_max[$monthno] = 0;
- }
- $data_line[$monthno]['pageviews'] += $row['pageviews'];
- $data_line[$monthno]['uniquevisitors'] += $row['uniquevisitors'];
- $data_line[$monthno]['usersessions'] += $row['usersessions'];
- $data_max[$monthno] += $row['pageviews'];
- } else {
- $data_line[] = $row;
- $data_max[] = $row['pageviews'];
- }
- $TOTAL_PAGEVIEWS += $row['pageviews'];
- $TOTAL_UNIQUEVISITORS += $row['uniquevisitors'];
- $TOTAL_USERSESSIONS += $row['usersessions'];
+while ($row = $db->fetch())
+{
+ if ($listby == 'w')
+ {
+ $date = $row['year'] . '/' . $row['month'] . '/' . $row['day'];
+ $weekno = date('W', strtotime($date) + $system->tdiff);
+ if (!isset($data_line[$weekno]))
+ {
+ $data_line[$weekno] = array();
+ $data_line[$weekno]['pageviews'] = 0;
+ $data_line[$weekno]['uniquevisitors'] = 0;
+ $data_line[$weekno]['usersessions'] = 0;
+ }
+ if (!isset($data_max[$weekno]))
+ {
+ $data_max[$weekno] = 0;
+ }
+ $data_line[$weekno]['pageviews'] += $row['pageviews'];
+ $data_line[$weekno]['uniquevisitors'] += $row['uniquevisitors'];
+ $data_line[$weekno]['usersessions'] += $row['usersessions'];
+ $data_max[$weekno] += $row['pageviews'];
+ }
+ elseif ($listby == 'm')
+ {
+ $monthno = $row['month'] . $row['year'];
+ if (!isset($data_line[$monthno]))
+ {
+ $data_line[$monthno] = array();
+ $data_line[$monthno]['month'] = $row['month'];
+ $data_line[$monthno]['year'] = $row['year'];
+ $data_line[$monthno]['pageviews'] = 0;
+ $data_line[$monthno]['uniquevisitors'] = 0;
+ $data_line[$monthno]['usersessions'] = 0;
+ }
+ if (!isset($data_max[$monthno]))
+ {
+ $data_max[$monthno] = 0;
+ }
+ $data_line[$monthno]['pageviews'] += $row['pageviews'];
+ $data_line[$monthno]['uniquevisitors'] += $row['uniquevisitors'];
+ $data_line[$monthno]['usersessions'] += $row['usersessions'];
+ $data_max[$monthno] += $row['pageviews'];
+ }
+ else
+ {
+ $data_line[] = $row;
+ $data_max[] = $row['pageviews'];
+ }
+ $TOTAL_PAGEVIEWS += $row['pageviews'];
+ $TOTAL_UNIQUEVISITORS += $row['uniquevisitors'];
+ $TOTAL_USERSESSIONS += $row['usersessions'];
}
ksort($data_line);
$MAX = (count($data_max) > 0) ? max($data_max) : 0;
-foreach ($data_line as $k => $v) {
- if ($listby == 'w') {
- $date = $k;
- } elseif ($listby == 'm') {
- $date = $v['month'] . '/' . $v['year'];
- } else {
- $date = $v['day'] . '/' . $v['month'] . '/' . $v['year'];
- }
- $template->assign_block_vars('sitestats', array(
- 'DATE' => $date,
- 'PAGEVIEWS' => $v['pageviews'],
- 'PAGEVIEWS_WIDTH' => ($v['pageviews'] * 100) / $MAX,
- 'UNIQUEVISITORS' => $v['uniquevisitors'],
- 'UNIQUEVISITORS_WIDTH' => ($v['uniquevisitors'] * 100) / $MAX,
- 'USERSESSIONS' => $v['usersessions'],
- 'USERSESSIONS_WIDTH' => ($v['usersessions'] * 100) / $MAX
- ));
+foreach ($data_line as $k => $v)
+{
+ if ($listby == 'w')
+ {
+ $date = $k;
+ }
+ elseif ($listby == 'm')
+ {
+ $date = $v['month'] . '/' . $v['year'];
+ }
+ else
+ {
+ $date = $v['day'] . '/' . $v['month'] . '/' . $v['year'];
+ }
+ $template->assign_block_vars('sitestats', array(
+ 'DATE' => $date,
+ 'PAGEVIEWS' => $v['pageviews'],
+ 'PAGEVIEWS_WIDTH' => ($v['pageviews'] * 100) / $MAX,
+ 'UNIQUEVISITORS' => $v['uniquevisitors'],
+ 'UNIQUEVISITORS_WIDTH' => ($v['uniquevisitors'] * 100) / $MAX,
+ 'USERSESSIONS' => $v['usersessions'],
+ 'USERSESSIONS_WIDTH' => ($v['usersessions'] * 100) / $MAX
+ ));
}
$template->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'TOTAL_PAGEVIEWS' => $TOTAL_PAGEVIEWS,
- 'TOTAL_UNIQUEVISITORS' => $TOTAL_UNIQUEVISITORS,
- 'TOTAL_USERSESSIONS' => $TOTAL_USERSESSIONS,
- 'STATSMONTH' => $statsview,
- 'STATSTEXT' => $statstext
- ));
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'TOTAL_PAGEVIEWS' => $TOTAL_PAGEVIEWS,
+ 'TOTAL_UNIQUEVISITORS' => $TOTAL_UNIQUEVISITORS,
+ 'TOTAL_USERSESSIONS' => $TOTAL_USERSESSIONS,
+ 'STATSMONTH' => $statsview,
+ 'STATSTEXT' => $statstext
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'viewaccessstats.tpl'
- ));
+ 'body' => 'viewaccessstats.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/viewbrowserstats.php b/admin/viewbrowserstats.php
old mode 100644
new mode 100755
index a61a4bd0c..e7f778342
--- a/admin/viewbrowserstats.php
+++ b/admin/viewbrowserstats.php
@@ -1,6 +1,6 @@
fetch()) {
- $BROWSERS[$row['browser']] = $row['counter'];
- $TOTAL = $TOTAL + $row['counter'];
-
- if ($row['counter'] > $MAX) {
- $MAX = $row['counter'];
- }
+while ($row = $db->fetch())
+{
+ $BROWSERS[$row['browser']] = $row['counter'];
+ $TOTAL = $TOTAL + $row['counter'];
+
+ if ($row['counter'] > $MAX)
+ {
+ $MAX = $row['counter'];
+ }
}
-foreach ($BROWSERS as $k => $v) {
- $template->assign_block_vars('sitestats', array(
- 'BROWSER' => $k,
- 'NUM' => $BROWSERS[$k],
- 'WIDTH' => ($BROWSERS[$k] * 100) / $MAX,
- 'PERCENTAGE' => ceil(intval($BROWSERS[$k] * 100 / $TOTAL))
- ));
+foreach ($BROWSERS as $k => $v)
+{
+ $template->assign_block_vars('sitestats', array(
+ 'BROWSER' => $k,
+ 'NUM' => $BROWSERS[$k],
+ 'WIDTH' => ($BROWSERS[$k] * 100) / $MAX,
+ 'PERCENTAGE' => ceil(intval($BROWSERS[$k] * 100 / $TOTAL))
+ ));
}
$template->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'STATSMONTH' => date('F Y', $system->ctime)
- ));
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'STATSMONTH' => date('F Y', $system->ctime)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'viewbrowserstats.tpl'
- ));
+ 'body' => 'viewbrowserstats.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/viewfilters.php b/admin/viewfilters.php
old mode 100644
new mode 100755
index 19822ed0f..a612358b2
--- a/admin/viewfilters.php
+++ b/admin/viewfilters.php
@@ -1,6 +1,6 @@
query($query, $params);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('cats', array(
- 'CATEGORY' => $row['cat_name']
- ));
+if ($db->numrows() > 0)
+{
+ while ($row = $db->fetch())
+ {
+ $CATEGORIES .= '' . $row['cat_name'] . '
';
+ }
}
-
$query = "SELECT keyword FROM " . $DBPrefix . "bannerskeywords WHERE banner = :banner";
$params = array();
$params[] = array(':banner', $banner, 'int');
$db->query($query, $params);
+$count = $db->numrows();
-while ($row = $db->fetch()) {
- $template->assign_block_vars('keywords', array(
- 'KEYWORD' => $row['keyword']
- ));
+if ($count > 0)
+{
+ while ($row = $db->fetch())
+ {
+ $KEYWORDS .= '' . $row['keyword'] . '
';
+ }
}
+?>
-$template->set_filenames(array(
- 'body' => 'viewfilters.tpl'
- ));
-$template->display('body');
+
+
+Banner filters
+
+
+
+
+
+ Banner filter
+ Close
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Close
+
+
\ No newline at end of file
diff --git a/admin/viewplatformstats.php b/admin/viewplatformstats.php
old mode 100644
new mode 100755
index 162714f27..a3c684982
--- a/admin/viewplatformstats.php
+++ b/admin/viewplatformstats.php
@@ -1,6 +1,6 @@
fetch()) {
- $PLATFORMS[$row['platform']] = $row['counter'];
- $TOTAL = $TOTAL + $row['counter'];
+while ($row = $db->fetch())
+{
+ $PLATFORMS[$row['platform']] = $row['counter'];
+ $TOTAL = $TOTAL + $row['counter'];
- if ($row['counter'] > $MAX) {
- $MAX = $row['counter'];
- }
+ if ($row['counter'] > $MAX)
+ {
+ $MAX = $row['counter'];
+ }
}
-if (isset($PLATFORMS) && is_array($PLATFORMS)) {
- foreach ($PLATFORMS as $k => $v) {
- $template->assign_block_vars('sitestats', array(
- 'PLATFORM' => $k,
- 'NUM' => $PLATFORMS[$k],
- 'WIDTH' => ($PLATFORMS[$k] * 100) / $MAX,
- 'PERCENTAGE' => ceil(intval($PLATFORMS[$k] * 100 / $TOTAL))
- ));
- }
+if (isset($PLATFORMS) && is_array($PLATFORMS))
+{
+ foreach ($PLATFORMS as $k => $v)
+ {
+ $template->assign_block_vars('sitestats', array(
+ 'PLATFORM' => $k,
+ 'NUM' => $PLATFORMS[$k],
+ 'WIDTH' => ($PLATFORMS[$k] * 100) / $MAX,
+ 'PERCENTAGE' => ceil(intval($PLATFORMS[$k] * 100 / $TOTAL))
+ ));
+ }
}
$template->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'STATSMONTH' => date('F Y', $system->ctime)
- ));
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'STATSMONTH' => date('F Y', $system->ctime)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'viewplatformstats.tpl'
- ));
+ 'body' => 'viewplatformstats.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/viewuserips.php b/admin/viewuserips.php
old mode 100644
new mode 100755
index 8b22dc1a3..3e72f3a2b
--- a/admin/viewuserips.php
+++ b/admin/viewuserips.php
@@ -1,6 +1,6 @@
query($query, $params);
- }
- }
- if (isset($_POST['deny']) && is_array($_POST['deny'])) {
- foreach ($_POST['deny'] as $v) {
- $query = "UPDATE " . $DBPrefix . "usersips SET action = 'deny' WHERE id = :ip_id";
- $params = array();
- $params[] = array(':ip_id', $v, 'int');
- $db->query($query, $params);
- }
- }
+$uloffset = intval($_REQUEST['offset']);
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ if (isset($_POST['deny']) && is_array($_POST['accept']))
+ {
+ foreach ($_POST['accept'] as $v)
+ {
+ $query = "UPDATE " . $DBPrefix . "usersips SET action = 'accept' WHERE id = :ip_id";
+ $params = array();
+ $params[] = array(':ip_id', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
+ if (isset($_POST['deny']) && is_array($_POST['deny']))
+ {
+ foreach ($_POST['deny'] as $v)
+ {
+ $query = "UPDATE " . $DBPrefix . "usersips SET action = 'deny' WHERE id = :ip_id";
+ $params = array();
+ $params[] = array(':ip_id', $v, 'int');
+ $db->query($query, $params);
+ }
+ }
}
$query = "SELECT COUNT(*) As ips FROM " . $DBPrefix . "usersips WHERE user = :user_id";
@@ -52,12 +51,15 @@
$num_ips = $db->result('ips');
// Handle pagination
-if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '') {
- $OFFSET = 0;
- $PAGE = 1;
-} else {
- $PAGE = $_GET['PAGE'];
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == '')
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+}
+else
+{
+ $PAGE = $_GET['PAGE'];
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
$PAGES = ($num_ips == 0) ? 1 : ceil($num_ips / $system->SETTINGS['perpage']);
@@ -65,12 +67,15 @@
$params = array();
$params[] = array(':user_id', $id, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- $USER = $db->result();
-} else {
- // no such user
- header('location: listusers.php');
- exit;
+if ($db->numrows() > 0)
+{
+ $USER = $db->result();
+}
+else
+{
+ // no such user
+ header('location: listusers.php');
+ exit;
}
$query = "SELECT id, type, ip, action FROM " . $DBPrefix . "usersips WHERE user = :user_id LIMIT :OFFSET, :perpage";
@@ -79,49 +84,57 @@
$params[] = array(':OFFSET', $OFFSET, 'int');
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- while ($row = $db->fetch()) {
- $template->assign_block_vars('ips', array(
- 'TYPE' => $row['type'],
- 'ID' => $row['id'],
- 'IP' => $row['ip'],
- 'ACTION' => $row['action']
- ));
- }
+if ($db->numrows() > 0)
+{
+ $bg = '';
+ while ($row = $db->fetch())
+ {
+ $template->assign_block_vars('ips', array(
+ 'TYPE' => $row['type'],
+ 'ID' => $row['id'],
+ 'IP' => $row['ip'],
+ 'ACTION' => $row['action'],
+ 'BG' => $bg
+ ));
+ $bg = ($bg == '') ? 'class="bg"' : '';
+ }
}
// get pagenation
$url_id = 'id=' . $id;
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'ID' => $id,
- 'NICK' => $USER['nick'],
- 'LASTLOGIN' => $dt->printDateTz($USER['lastlogin']),
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ID' => $id,
+ 'NICK' => $USER['nick'],
+ 'LASTLOGIN' => date('Y-m-d H:i:s', strtotime($USER['lastlogin']) + $system->tdiff),
+ 'OFFSET' => $uloffset,
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'viewuserips.tpl'
- ));
+ 'body' => 'viewuserips.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/admin/viewwinners.php b/admin/viewwinners.php
old mode 100644
new mode 100755
index 482fed5b6..e23250088
--- a/admin/viewwinners.php
+++ b/admin/viewwinners.php
@@ -1,6 +1,6 @@
error
+if (!isset($_GET['id']))
+{
+ $URL = $_SESSION['RETURN_LIST'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
}
$id = intval($_GET['id']);
// Retrieve auction's data
$query = "SELECT a.title, a.minimum_bid, a.starts, a.ends, a.auction_type, u.name, u.nick FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
- WHERE a.id = :id";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.user)
+ WHERE a.id = :id";
$params = array();
$params[] = array(':id', $id, 'int');
$db->query($query, $params);
-if ($db->numrows() == 0) {
- $URL = $_SESSION['RETURN_LIST'];
- header('location: ' . $URL);
- exit;
+if ($db->numrows() == 0)
+{
+ $URL = $_SESSION['RETURN_LIST'];
+ unset($_SESSION['RETURN_LIST']);
+ header('location: ' . $URL);
+ exit;
}
$AUCTION = $db->result();
// Retrieve winners
$query = "SELECT w.bid, w.qty, u.name, u.nick FROM " . $DBPrefix . "winners w
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = w.winner)
- WHERE w.auction = :id";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = w.winner)
+ WHERE w.auction = :id";
$params = array();
$params[] = array(':id', $id, 'int');
$db->query($query, $params);
$winners = false;
-while ($row = $db->fetch()) {
- $winners = true;
- $template->assign_block_vars('winners', array(
- 'W_NICK' => $row['nick'],
- 'W_NAME' => $row['name'],
- 'BID' => $system->print_money($row['bid']),
- 'QTY' => $row['qty']
- ));
+while ($row = $db->fetch())
+{
+ $winners = true;
+ $template->assign_block_vars('winners', array(
+ 'W_NICK' => $row['nick'],
+ 'W_NAME' => $row['name'],
+ 'BID' => $system->print_money($row['bid']),
+ 'QTY' => $row['qty']
+ ));
}
// Retrieve bids
$query = "SELECT b.bid, b.quantity, u.name, u.nick FROM " . $DBPrefix . "bids b
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
- WHERE b.auction = :id";
+ LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
+ WHERE b.auction = :id";
$params = array();
$params[] = array(':id', $id, 'int');
$db->query($query, $params);
$bids = false;
-while ($row = $db->fetch()) {
- $bids = true;
- $template->assign_block_vars('bids', array(
- 'W_NICK' => $row['nick'],
- 'W_NAME' => $row['name'],
- 'BID' => $system->print_money($row['bid']),
- 'QTY' => $row['quantity']
- ));
+while ($row = $db->fetch())
+{
+ $bids = true;
+ $template->assign_block_vars('bids', array(
+ 'W_NICK' => $row['nick'],
+ 'W_NAME' => $row['name'],
+ 'BID' => $system->print_money($row['bid']),
+ 'QTY' => $row['quantity']
+ ));
}
$template->assign_vars(array(
- 'ID' => $id,
- 'TITLE' => $AUCTION['title'],
- 'S_NICK' => $AUCTION['nick'],
- 'S_NAME' => $AUCTION['name'],
- 'MIN_BID' => $system->print_money($AUCTION['minimum_bid']),
- 'STARTS' => $dt->formatDate($AUCTION['starts']),
- 'ENDS' => $dt->formatDate($AUCTION['ends']),
- 'AUCTION_TYPE' => $system->SETTINGS['auction_types'][$AUCTION['auction_type']],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ID' => $id,
+ 'TITLE' => htmlspecialchars($AUCTION['title']),
+ 'S_NICK' => $AUCTION['nick'],
+ 'S_NAME' => $AUCTION['name'],
+ 'MIN_BID' => $system->print_money($AUCTION['minimum_bid']),
+ 'STARTS' => FormatDate($AUCTION['starts']),
+ 'ENDS' => FormatDate($AUCTION['ends']),
+ 'AUCTION_TYPE' => $system->SETTINGS['auction_types'][$AUCTION['auction_type']],
- 'B_WINNERS' => $winners,
- 'B_BIDS' => $bids
- ));
+ 'B_WINNERS' => $winners,
+ 'B_BIDS' => $bids
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'viewwinners.tpl'
- ));
+ 'body' => 'viewwinners.tpl'
+ ));
$template->display('body');
+
include 'footer.php';
+?>
\ No newline at end of file
diff --git a/admin/wordsfilter.php b/admin/wordsfilter.php
old mode 100644
new mode 100755
index e7c26d1b8..073db6b14
--- a/admin/wordsfilter.php
+++ b/admin/wordsfilter.php
@@ -1,6 +1,6 @@
writesetting("wordsfilter", ynbool($_POST['wordsfilter']), 'str');
-
- //purge the old wordlist
- $query = "DELETE FROM " . $DBPrefix . "filterwords";
- $db->direct_query($query);
-
- //rebuild the wordlist
- $TMP = explode("\n", $_POST['filtervalues']);
- if (is_array($TMP)) {
- foreach ($TMP as $k => $v) {
- $v = trim($v);
- if (!empty($v)) {
- $query = "INSERT INTO " . $DBPrefix . "filterwords VALUES (:word)";
- $params = array();
- $params[] = array(':word', $v, 'str');
- $db->query($query, $params);
- }
- }
- }
- $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['word_filter_updated']));
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ $system->writesetting("wordsfilter", ynbool($_POST['wordsfilter']), 'str');
+
+ //purge the old wordlist
+ $query = "DELETE FROM " . $DBPrefix . "filterwords";
+ $db->direct_query($query);
+
+ //rebuild the wordlist
+ $TMP = explode("\n", $_POST['filtervalues']);
+ if (is_array($TMP))
+ {
+ foreach ($TMP as $k => $v)
+ {
+ $v = trim($v);
+ if (!empty($v))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "filterwords VALUES (:word)";
+ $params = array();
+ $params[] = array(':word', $v, 'str');
+ $db->query($query, $params);
+ }
+ }
+ }
+ $template->assign_block_vars('alerts', array('TYPE' => 'success', 'MESSAGE' => $MSG['5073']));
}
$query = "SELECT * FROM " . $DBPrefix . "filterwords";
$db->direct_query($query);
$WORDSLIST = '';
-while ($word = $db->fetch()) {
- $WORDSLIST .= $word['word'] . "\n";
+while ($word = $db->fetch())
+{
+ $WORDSLIST .= $word['word'] . "\n";
}
$template->assign_vars(array(
- 'WORDLIST' => $WORDSLIST,
- 'WFYES' => ($system->SETTINGS['wordsfilter'] == 'y') ? ' checked="checked"' : '',
- 'WFNO' => ($system->SETTINGS['wordsfilter'] == 'n') ? ' checked="checked"' : ''
- ));
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'WORDLIST' => $WORDSLIST,
+ 'WFYES' => ($system->SETTINGS['wordsfilter'] == 'y') ? ' checked="checked"' : '',
+ 'WFNO' => ($system->SETTINGS['wordsfilter'] == 'n') ? ' checked="checked"' : ''
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'wordfilter.tpl'
- ));
+ 'body' => 'wordfilter.tpl'
+ ));
$template->display('body');
include 'footer.php';
+?>
diff --git a/adsearch.php b/adsearch.php
old mode 100644
new mode 100755
index 395218f21..10b86e50b
--- a/adsearch.php
+++ b/adsearch.php
@@ -1,6 +1,6 @@
cleanvars($_SESSION['advs']['title']) . '%', 'str');
- }
- $wher .= "(au.title like :liketitle OR au.id = :idtitle)) AND ";
- $asparams[] = array(':idtitle', $_SESSION['advs']['title'], 'int');
- $asparams[] = array(':liketitle', '%' . $system->cleanvars($_SESSION['advs']['title']) . '%', 'str');
- }
-
- if (!empty($_SESSION['advs']['seller'])) {
- $query = "SELECT id FROM " . $DBPrefix . "users WHERE nick = :seller_nick";
- $params = array();
- $params[] = array(':seller_nick', $system->cleanvars($_SESSION['advs']['seller']), 'str');
- $db->query($query, $params);
-
- if ($db->numrows() > 0) {
- $SELLER_ID = $db->result('id');
- $wher .= "(au.user = :seller_id) AND ";
- $asparams[] = array(':seller_id', $SELLER_ID, 'int');
- } else {
- $ERR = $ERR_100;
- }
- }
-
- if (!empty($_SESSION['advs']['groups'])) {
- $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
- $wher .= "(u.groups RLIKE :user_group) AND ";
- $asparams[] = array(':user_group', '[[:<:]]' . $system->cleanvars($_SESSION['advs']['groups']) . '[[:>:]]', 'str');
- }
-
- if (isset($_SESSION['advs']['buyitnow'])) {
- $wher .= "(au.buy_now > 0 AND (au.bn_only = 1 OR au.bn_only = 0 && (au.num_bids = 0 OR (au.reserve_price > 0 AND au.current_bid < au.reserve_price)))) AND ";
- }
-
- if (isset($_SESSION['advs']['buyitnowonly'])) {
- $wher .= "(au.bn_only = 1) AND ";
- }
-
- if (!empty($_SESSION['advs']['zipcode'])) {
- $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
- $wher .= "(u.zip LIKE :user_zip) AND ";
- $asparams[] = array(':user_zip', $system->cleanvars($_SESSION['advs']['zipcode']), 'str');
- }
-
- if (!isset($_SESSION['advs']['closed'])) {
- $wher .= "(au.closed = 0) AND ";
- }
-
- if (!empty($_SESSION['advs']['type'])) {
- $wher .= "(au.auction_type = :auc_type) AND ";
- $asparams[] = array(':auc_type', $_SESSION['advs']['type'], 'int');
- }
-
- if (!empty($_SESSION['advs']['category'])) {
- $query = "SELECT right_id, left_id FROM " . $DBPrefix . "categories WHERE cat_id = " . intval($_SESSION['advs']['category']);
- $params = array();
- $params[] = array(':cat_id', $_SESSION['advs']['category'], 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
- $children = $catscontrol->get_children_list($parent_node['left_id'], $parent_node['right_id']);
- $childarray = array($_SESSION['advs']['category']);
- foreach ($children as $k => $v) {
- $childarray[] = $v['cat_id'];
- }
- $catalist = '(';
- $catalist .= implode(',', $childarray);
- $catalist .= ')';
- $wher .= "(au.category IN " . $catalist;
- if ($system->SETTINGS['extra_cat'] == 'y') {
- $wher .= " OR au.secondcat IN " . $catalist;
- }
- $wher .= ") AND ";
- }
-
- if (!empty($_SESSION['advs']['maxprice'])) {
- $wher .= "(au.minimum_bid <= :max_price) AND ";
- $asparams[] = array(':max_price', $system->input_money($_SESSION['advs']['maxprice']), 'float');
- }
- if (!empty($_SESSION['advs']['minprice'])) {
- $wher .= "(au.minimum_bid >= :min_price) AND ";
- $asparams[] = array(':min_price', $system->input_money($_SESSION['advs']['minprice']), 'float');
- }
-
- if (!empty($_SESSION['advs']['ending']) && ($_SESSION['advs']['ending'] == '1' || $_SESSION['advs']['ending'] == '2' || $_SESSION['advs']['ending'] == '4' || $_SESSION['advs']['ending'] == '6')) {
- $wher .= "(au.ends <= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL " . $_SESSION['advs']['ending'] . " DAY)) AND ";
- }
-
- if (!empty($_SESSION['advs']['country'])) {
- $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
- $wher .= "(u.country = :user_country) AND ";
- $asparams[] = array(':user_country', $system->cleanvars($_SESSION['advs']['country']), 'str');
- }
-
- if (isset($_SESSION['advs']['payment'])) {
- if (is_array($_SESSION['advs']['payment']) && count($_SESSION['advs']['payment']) > 1) {
- $pri = false;
- $i = 0;
- foreach ($payment as $key => &$val) {
- if (!$pri) {
- $ora = "((au.payment LIKE :payment" . ($i) . ")";
- $asparams[] = array(":payment" . ($i), '%' . $system->cleanvars($val) . '%', 'str');
- } else {
- $ora .= " OR (au.payment LIKE :payment" . ($i) . ")";
- $asparams[] = array(":payment" . ($i), '%' . $system->cleanvars($val) . '%', 'str');
- }
- $pri = true;
- $i++;
- }
- $ora .= ") AND";
- } else {
- $ora = "(au.payment LIKE :payment) AND ";
- $asparams[] = array(':payment', '%' . $system->cleanvars($_SESSION['advs']['payment'][0]) . '%', 'str');
- }
- }
-
- if (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'starts') {
- $by = 'au.starts DESC';
- } elseif (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'min_bid') {
- $by = 'au.minimum_bid ASC';
- } elseif (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'max_bid') {
- $by = 'au.minimum_bid DESC';
- } else {
- $by = 'au.ends ASC';
- }
+if (isset($_SESSION['advs']) && is_array($_SESSION['advs']))
+{
+ $searching = true;
+ if (!empty($_SESSION['advs']['title']))
+ {
+ $wher .= '(';
+ if (isset($_SESSION['advs']['desc']))
+ {
+ $wher .= "(au.description LIKE :likedescription) OR ";
+ $asparams[] = array(':likedescription', '%' . $system->cleanvars($_SESSION['advs']['title']) . '%', 'str');
+ }
+ $wher .= "(au.title like :liketitle OR au.id = :idtitle)) AND ";
+ $asparams[] = array(':idtitle', intval($_SESSION['advs']['title']), 'int');
+ $asparams[] = array(':liketitle', '%' . $system->cleanvars($_SESSION['advs']['title']) . '%', 'str');
+ }
+
+ if (!empty($_SESSION['advs']['seller']))
+ {
+ $query = "SELECT id FROM " . $DBPrefix . "users WHERE nick = :seller_nick";
+ $params = array();
+ $params[] = array(':seller_nick', $system->cleanvars($_SESSION['advs']['seller']), 'str');
+ $db->query($query, $params);
+
+ if ($db->numrows() > 0)
+ {
+ $SELLER_ID = $db->result('id');
+ $wher .= "(au.user = :seller_id) AND ";
+ $asparams[] = array(':seller_id', $SELLER_ID, 'int');
+ }
+ else
+ {
+ $ERR = $ERR_100;
+ }
+ }
+
+ if (!empty($_SESSION['advs']['groups']))
+ {
+ $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
+ $wher .= "(u.groups RLIKE :user_group) AND ";
+ $asparams[] = array(':user_group', '[[:<:]]' . $system->cleanvars($_SESSION['advs']['groups']) . '[[:>:]]', 'str');
+ }
+
+ if (isset($_SESSION['advs']['buyitnow']))
+ {
+ $wher .= "(au.buy_now > 0 AND (au.bn_only = 1 OR au.bn_only = 0 && (au.num_bids = 0 OR (au.reserve_price > 0 AND au.current_bid < au.reserve_price)))) AND ";
+ }
+
+ if (isset($_SESSION['advs']['buyitnowonly']))
+ {
+ $wher .= "(au.bn_only = 1) AND ";
+ }
+
+ if (!empty($_SESSION['advs']['zipcode']))
+ {
+ $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
+ $wher .= "(u.zip LIKE :user_zip) AND ";
+ $asparams[] = array(':user_zip', $system->cleanvars($_SESSION['advs']['zipcode']), 'str');
+ }
+
+ if (!isset($_SESSION['advs']['closed']))
+ {
+ $wher .= "(au.closed = 0) AND ";
+ }
+
+ if (!empty($_SESSION['advs']['type']))
+ {
+ $wher .= "(au.auction_type = :auc_type) AND ";
+ $asparams[] = array(':auc_type', $_SESSION['advs']['type'], 'int');
+ }
+
+ if (!empty($_SESSION['advs']['category']))
+ {
+ $query = "SELECT right_id, left_id FROM " . $DBPrefix . "categories WHERE cat_id = " . intval($_SESSION['advs']['category']);
+ $params = array();
+ $params[] = array(':cat_id', $_SESSION['advs']['category'], 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+ $children = $catscontrol->get_children_list($parent_node['left_id'], $parent_node['right_id']);
+ $childarray = array($_SESSION['advs']['category']);
+ foreach ($children as $k => $v)
+ {
+ $childarray[] = $v['cat_id'];
+ }
+ $catalist = '(';
+ $catalist .= implode(',', $childarray);
+ $catalist .= ')';
+ $wher .= "(au.category IN " . $catalist;
+ if ($system->SETTINGS['extra_cat'] == 'y')
+ {
+ $wher .= " OR au.secondcat IN " . $catalist;
+ }
+ $wher .= ") AND ";
+ }
+
+ if (!empty($_SESSION['advs']['maxprice']))
+ {
+ $wher .= "(au.minimum_bid <= :max_price) AND ";
+ $asparams[] = array(':max_price', $system->input_money($_SESSION['advs']['maxprice']), 'float');
+ }
+ if (!empty($_SESSION['advs']['minprice']))
+ {
+ $wher .= "(au.minimum_bid >= :min_price) AND ";
+ $asparams[] = array(':min_price', $system->input_money($_SESSION['advs']['minprice']), 'float');
+ }
+
+ if (!empty($_SESSION['advs']['ending']) && ($_SESSION['advs']['ending'] == '1' || $_SESSION['advs']['ending'] == '2' || $_SESSION['advs']['ending'] == '4' || $_SESSION['advs']['ending'] == '6'))
+ {
+ $wher .= "(au.ends <= :auc_ending) AND ";
+ $asparams[] = array(':auc_ending', time() + ($_SESSION['advs']['ending'] * 86400), 'int');
+ }
+
+ if (!empty($_SESSION['advs']['country']))
+ {
+ $userjoin = "LEFT JOIN " . $DBPrefix . "users u ON (u.id = au.user)";
+ $wher .= "(u.country = :user_country) AND ";
+ $asparams[] = array(':user_country', $system->cleanvars($_SESSION['advs']['country']), 'str');
+ }
+
+ if (isset($_SESSION['advs']['payment']))
+ {
+ if (is_array($_SESSION['advs']['payment']) && count($_SESSION['advs']['payment']) > 1)
+ {
+ $pri = false;
+ $i = 0;
+ foreach ($payment as $key => &$val)
+ {
+ if (!$pri)
+ {
+ $ora = "((au.payment LIKE :payment" . ($i) . ")";
+ $asparams[] = array(":payment" . ($i), '%' . $system->cleanvars($val) . '%', 'str');
+ }
+ else
+ {
+ $ora .= " OR (au.payment LIKE :payment" . ($i) . ") AND ";
+ $asparams[] = array(":payment" . ($i), '%' . $system->cleanvars($val) . '%', 'str');
+ }
+ $pri = true;
+ $i++;
+ }
+ $ora .= ") ";
+ }
+ else
+ {
+ $ora = "(au.payment LIKE :payment) AND ";
+ $asparams[] = array(':payment', '%' . $system->cleanvars($_SESSION['advs']['payment'][0]) . '%', 'str');
+ }
+ }
+
+ if (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'starts')
+ {
+ $by = 'au.starts DESC';
+ }
+ elseif (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'min_bid')
+ {
+ $by = 'au.minimum_bid ASC';
+ }
+ elseif (isset($_SESSION['advs']['SortProperty']) && $_SESSION['advs']['SortProperty'] == 'max_bid')
+ {
+ $by = 'au.minimum_bid DESC';
+ }
+ else
+ {
+ $by = 'au.ends ASC';
+ }
}
-if ($searching && !isset($ERR)) {
- // retrieve records corresponding to passed page number
- if ($PAGE <= 0) {
- $PAGE = 1;
- }
-
- // determine limits for SQL query
- $left_limit = ($PAGE - 1) * $system->SETTINGS['perpage'];
-
- // get total number of records
- $query = "SELECT count(*) AS total FROM " . $DBPrefix . "auctions au
- " . $userjoin . "
- WHERE au.suspended = 0
- AND " . $wher . $ora . "
- au.starts <= CURRENT_TIMESTAMP
- ORDER BY ". $by;
- $db->query($query, $asparams);
- $total = $db->result('total');
-
- // get number of pages
- $PAGES = intval($total / $system->SETTINGS['perpage']);
- if (($total % $system->SETTINGS['perpage']) > 0) {
- ++$PAGES;
- }
-
- // get records corresponding to this page
- $query = "SELECT au.* FROM " . $DBPrefix . "auctions au
- " . $userjoin . "
- WHERE au.suspended = 0
- AND " . $wher . $ora . "
- au.starts <= CURRENT_TIMESTAMP
- ORDER BY " . $by . " LIMIT :offset, :perpage";
- $params = $asparams;
- $params[] = array(':offset', $left_limit, 'int');
- $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
-
- // get featured items
- $query_feat = "SELECT au.* FROM " . $DBPrefix . "auctions au
- " . $userjoin . "
- WHERE au.suspended = 0
- AND " . $wher . $ora . "
- featured = 1
- AND au.starts <= CURRENT_TIMESTAMP
- ORDER BY " . $by . " LIMIT :offset, 5";
- $params_feat = $asparams;
- $params_feat[] = array(':offset',(($PAGE - 1) * 5), 'int');
-
- if ($total > 0) {
- include INCLUDE_PATH . 'browseitems.inc.php';
- browseItems($query, $params, $query_feat, $params_feat, $total, 'adsearch.php');
-
- include 'header.php';
- $template->set_filenames(array(
- 'body' => 'asearch_result.tpl'
- ));
- $template->display('body');
- include 'footer.php';
- exit;
- } else {
- $ERR = $ERR_122;
- }
+if ($searching && !isset($ERR))
+{
+ // retrieve records corresponding to passed page number
+ if ($PAGE <= 0) $PAGE = 1;
+
+ // determine limits for SQL query
+ $left_limit = ($PAGE - 1) * $system->SETTINGS['perpage'];
+ $asparams[] = array(':time', $now, 'int');
+
+ // get total number of records
+ $query = "SELECT count(*) AS total FROM " . $DBPrefix . "auctions au
+ " . $userjoin . "
+ WHERE au.suspended = 0
+ AND " . $wher . $ora . "
+ au.starts <= :time
+ ORDER BY ". $by;
+ $db->query($query, $asparams);
+ $total = $db->result('total');
+
+ // get number of pages
+ $PAGES = intval($total / $system->SETTINGS['perpage']);
+ if (($total % $system->SETTINGS['perpage']) > 0)
+ ++$PAGES;
+
+ // get records corresponding to this page
+ $query = "SELECT au.* FROM " . $DBPrefix . "auctions au
+ " . $userjoin . "
+ WHERE au.suspended = 0
+ AND " . $wher . $ora . "
+ au.starts <= :time
+ ORDER BY " . $by . " LIMIT :offset, :perpage";
+ $params = $asparams;
+ $params[] = array(':offset', $left_limit, 'int');
+ $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
+
+ // get featured items
+ $query_feat = "SELECT au.* FROM " . $DBPrefix . "auctions au
+ " . $userjoin . "
+ WHERE au.suspended = 0
+ AND " . $wher . $ora . "
+ featured = 1
+ AND au.starts <= :time
+ ORDER BY " . $by . " LIMIT :offset, 5";
+ $params_feat = $asparams;
+ $params_feat[] = array(':offset',(($PAGE - 1) * 5), 'int');
+
+ if ($total > 0)
+ {
+ include INCLUDE_PATH . 'browseitems.inc.php';
+ browseItems($query, $params, $query_feat, $params_feat, $total, 'adsearch.php');
+
+ include 'header.php';
+ $template->set_filenames(array(
+ 'body' => 'asearch_result.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
+ exit;
+ }
+ else
+ {
+ $ERR = $ERR_122;
+ }
}
// payments
$payment_methods = '';
$query = "SELECT * FROM " . $DBPrefix . "payment_options";
$db->direct_query($query);
-while ($payment_method = $db->fetch()) {
- if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0) {
- $checked = (in_array($payment_method['name'], $payment)) ? 'checked' : '';
- $payment_methods .= ' ' . $payment_method['displayname'] . '
';
- }
+while ($payment_method = $db->fetch())
+{
+ if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0)
+ {
+ $checked = (in_array($payment_method['name'], $payment)) ? 'checked' : '';
+ $payment_methods .= ' ' . $payment_method['displayname'] . '
';
+ }
}
// category
$TPL_categories_list = '' . "\n";
-if (isset($category_plain) && count($category_plain) > 0) {
- $category = (isset($_SESSION['advs']['category'])) ? $_SESSION['advs']['category'] : '';
- foreach ($category_plain as $k => $v) {
- $TPL_categories_list .= "\t\t" . '' . $v . ' ' . "\n";
- }
+if (isset($category_plain) && count($category_plain) > 0)
+{
+ $category = (isset($_SESSION['advs']['category'])) ? $_SESSION['advs']['category'] : '';
+ foreach ($category_plain as $k => $v)
+ {
+ $TPL_categories_list .= "\t\t" . '' . $v . ' ' . "\n";
+ }
}
$TPL_categories_list .= ' ' . "\n";
// variant fields construction
@@ -263,8 +312,9 @@
$countries = $db->fetchall();
$country = (isset($_SESSION['advs']['country'])) ? $_SESSION['advs']['country'] : '';
$TPL_countries_list .= "\t" . '' . $MSG['any_country'] . ' ' . "\n";
-foreach ($countries as $country) {
- $TPL_countries_list .= "\t" . '' . $country['country'] . ' ' . "\n";
+foreach($countries as $country)
+{
+ $TPL_countries_list .= "\t" . '' . $country['country'] . ' ' . "\n";
}
$TPL_countries_list .= '' . "\n";
@@ -273,22 +323,23 @@
$user_group = (isset($_SESSION['advs']['groups'])) ? $_SESSION['advs']['groups'] : '';
$query = "SELECT id, group_name FROM ". $DBPrefix . "groups";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $TPL_user_group_list .= "\t" . '' . $row['group_name'] . ' ' . "\n";
+while ($row = $db->fetch())
+{
+ $TPL_user_group_list .= "\t" . '' . $row['group_name'] . ' ' . "\n";
}
$template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'CATEGORY_LIST' => $TPL_categories_list,
- 'CURRENCY' => $system->SETTINGS['currency'],
- 'PAYMENTS_LIST' => $payment_methods,
- 'COUNTRY_LIST' => $TPL_countries_list,
- 'USER_GROUP_LIST' => $TPL_user_group_list
- ));
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'CATEGORY_LIST' => $TPL_categories_list,
+ 'CURRENCY' => $system->SETTINGS['currency'],
+ 'PAYMENTS_LIST' => $payment_methods,
+ 'COUNTRY_LIST' => $TPL_countries_list,
+ 'USER_GROUP_LIST' => $TPL_user_group_list
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'advanced_search.tpl'
- ));
+ 'body' => 'advanced_search.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/ajax.php b/ajax.php
index d29f954c0..6ee0ae3fe 100755
--- a/ajax.php
+++ b/ajax.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'auction_watch.php';
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'auction_watch.php';
+ header('location: user_login.php');
+ exit;
}
// insert a new watch item
-if (isset($_GET['insert']) && $_GET['insert'] == 'true' && !empty($_REQUEST['add'])) {
- $requestadd = $_REQUEST['add'];
- // Check if this keyword is not already added
- $auctions = trim($user->user_data['auc_watch']);
- unset($match); // just incase
- if (!empty($auctions)) {
- $checkarray = explode(' ', $requestadd);
- $requestadd = '';
- foreach ($checkarray as $check) {
- if (strpos($auctions, $check) === false) {
- $requestadd .= $check . ' ';
- }
- }
- }
+if (isset($_GET['insert']) && $_GET['insert'] == 'true' && !empty($_REQUEST['add']))
+{
+ $requestadd = $_REQUEST['add'];
+ // Check if this keyword is not already added
+ $auctions = trim($user->user_data['auc_watch']);
+ unset($match); // just incase
+ if (!empty($auctions))
+ {
+ $checkarray = explode(' ', $requestadd);
+ $requestadd = '';
+ foreach ($checkarray as $check)
+ {
+ if (strpos($auctions, $check) === false)
+ {
+ $requestadd .= $check . ' ';
+ }
+ }
+ }
- if (!isset($match) || empty($match)) {
- $auction_watch = trim($auctions . ' ' . $requestadd);
- $query = "UPDATE " . $DBPrefix . "users SET auc_watch = :auc_watch WHERE id = :id";
- $params = array(
- array(':auc_watch', $system->cleanvars($auction_watch), 'str'),
- array(':id', $user->user_data['id'], 'int'),
- );
- $db->query($query, $params);
- $user->user_data['auc_watch'] = $auction_watch;
- }
+ if (!isset($match) || empty($match))
+ {
+ $auction_watch = trim($auctions . ' ' . $requestadd);
+ $query = "UPDATE " . $DBPrefix . "users SET auc_watch = :auc_watch WHERE id = :id";
+ $params = array(
+ array(':auc_watch', $system->cleanvars($auction_watch), 'str'),
+ array(':id', $user->user_data['id'], 'int'),
+ );
+ $db->query($query, $params);
+ $user->user_data['auc_watch'] = $auction_watch;
+ }
}
// Delete auction from auction watch
-if (isset($_GET['delete'])) {
- $item_to_delete = $_GET['delete'];
- $currently_watched_auctions = explode(' ', trim($user->user_data['auc_watch']));
-
- $auctions_to_watch = array();
+if (isset($_GET['delete']))
+{
+ $item_to_delete = $_GET['delete'];
+ $currently_watched_auctions = explode(' ', trim($user->user_data['auc_watch']));
+
+ $auctions_to_watch = array();
- for ($j = 0; $j < count($currently_watched_auctions); $j++) {
- if ($currently_watched_auctions[$j] != $item_to_delete) {
- array_push($auctions_to_watch, $currently_watched_auctions[$j]);
- }
- }
+ for ($j = 0; $j < count($currently_watched_auctions); $j++)
+ {
+ if ($currently_watched_auctions[$j] != $item_to_delete)
+ {
+ array_push($auctions_to_watch, $currently_watched_auctions[$j]);
+ }
+ }
- $query = "UPDATE " . $DBPrefix . "users SET auc_watch = :auc_watch WHERE id = :id";
- $params = array(
- array(':auc_watch', implode(' ', $auctions_to_watch), 'str'),
- array(':id', $user->user_data['id'], 'int'),
- );
- $db->query($query, $params);
- $user->user_data['auc_watch'] = implode(' ', $auctions_to_watch);
+ $query = "UPDATE " . $DBPrefix . "users SET auc_watch = :auc_watch WHERE id = :id";
+ $params = array(
+ array(':auc_watch', implode(' ', $auctions_to_watch), 'str'),
+ array(':id', $user->user_data['id'], 'int'),
+ );
+ $db->query($query, $params);
+ $user->user_data['auc_watch'] = implode(' ', $auctions_to_watch);
}
$auctions = trim($user->user_data['auc_watch']);
-if ($auctions != '') {
- $auction = explode(' ', $auctions);
- for ($j = 0; $j < count($auction); $j++) {
- $template->assign_block_vars('items', array(
- 'ITEM' => $auction[$j],
- 'ITEMENCODE' => urlencode($auction[$j])
- ));
- }
+if ($auctions != '')
+{
+ $auction = explode(' ', $auctions);
+ for ($j = 0; $j < count($auction); $j++)
+ {
+ $template->assign_block_vars('items', array(
+ 'ITEM' => $auction[$j],
+ 'ITEMENCODE' => urlencode($auction[$j])
+ ));
+ }
}
include 'header.php';
$TMP_usmenutitle = $MSG['471'];
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'auction_watch.tpl'
- ));
+ 'body' => 'auction_watch.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/batch.php b/batch.php
old mode 100644
new mode 100755
index 8d9aa040c..a58917056
--- a/batch.php
+++ b/batch.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5002'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'bid.php?id=' . $id;
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5002'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'bid.php?id=' . $id;
+ header('location: user_login.php');
+ exit;
}
$bidder_id = $user->user_data['id'];
-if (in_array($user->user_data['suspended'], array(5, 6, 7))) {
- header('location: message.php');
- exit;
+if (in_array($user->user_data['suspended'], array(5, 6, 7)))
+{
+ header('location: message.php');
+ exit;
}
-if (!$user->permissions['can_buy']) {
- $_SESSION['TMP_MSG'] = $MSG['819'];
- header('location: user_menu.php');
- exit;
+if (!$user->can_buy)
+{
+ $_SESSION['TMP_MSG'] = $MSG['819'];
+ header('location: user_menu.php');
+ exit;
}
function get_increment($val, $input_check = true)
{
- global $db, $DBPrefix, $system;
-
- if ($input_check) {
- $val = $system->input_money($val);
- }
- // Get bid increment for current bid and calculate minimum bid
- $query = "SELECT increment FROM " . $DBPrefix . "increments WHERE
- ((low <= :val0 AND high >= :val1) OR
- (low < :val2 AND high < :val3)) ORDER BY increment DESC";
- $params = array();
- $params[] = array(':val0', $val, 'float');
- $params[] = array(':val1', $val, 'float');
- $params[] = array(':val2', $val, 'float');
- $params[] = array(':val3', $val, 'float');
- $db->query($query, $params);
- if ($db->numrows() != 0) {
- $increment = $db->result('increment');
- }
- return $increment;
+ global $db, $DBPrefix, $system;
+
+ if ($input_check)
+ $val = $system->input_money($val);
+ // get the increment value for the current bid
+ $query = "SELECT increment FROM " . $DBPrefix . "increments
+ WHERE low <= :val AND high >= :val
+ ORDER BY increment DESC";
+ $params = array();
+ $params[] = array(':val', $val, 'float');
+ $db->query($query, $params);
+ $increment = $db->result('increment');
+ return $increment;
}
function extend_auction($id, $ends)
{
- global $system, $db, $DBPrefix;
-
- if ($system->SETTINGS['ae_status'] == 'y' && (strtotime($ends) - $system->SETTINGS['ae_timebefore']) < time()) {
- $query = "UPDATE " . $DBPrefix . "auctions SET ends = DATE_ADD(ends, INTERVAL " . $system->SETTINGS['ae_extend'] . " SECOND) WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- }
+ global $system, $db, $DBPrefix;
+
+ if ($system->SETTINGS['ae_status'] == 'y' && ($ends - $system->SETTINGS['ae_timebefore']) < time())
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET ends = ends + :ae_extend WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':ae_extend', $system->SETTINGS['ae_extend'], 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ }
}
// first check if valid auction ID passed
$query = "SELECT a.*, u.nick, u.email, u.id AS uId FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "users u ON (a.user = u.id)
- WHERE a.id = :auc_id";
+ LEFT JOIN " . $DBPrefix . "users u ON (a.user = u.id)
+ WHERE a.id = :auc_id";
$params = array();
$params[] = array(':auc_id', $id, 'int');
$db->query($query, $params);
// such auction does not exist
-if ($db->numrows() == 0) {
- $template->assign_vars(array(
- 'TITLE_MESSAGE' => $MSG['415'],
- 'BODY_MESSAGE' => $ERR_606
- ));
- include 'header.php';
- $template->set_filenames(array(
- 'body' => 'message.tpl'
- ));
- $template->display('body');
- include 'footer.php';
- exit; // kill the page
+if ($db->numrows() == 0)
+{
+ $template->assign_vars(array(
+ 'TITLE_MESSAGE' => $MSG['415'],
+ 'BODY_MESSAGE' => $ERR_606
+ ));
+ include 'header.php';
+ $template->set_filenames(array(
+ 'body' => 'message.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
+ exit; // kill the page
}
// check user entered a bid
-if (empty($bid) && !isset($errmsg)) {
- $errmsg = $ERR_072;
+if (empty($bid) && !isset($errmsg))
+{
+ $errmsg = $ERR_072;
}
// check the bid is valid
-if (!$system->CheckMoney($bid) && !isset($errmsg)) {
- $errmsg = $ERR_058;
-} else {
- // reformat bid to valid number
- $bid = round($system->input_money($bid), 2);
+if (!$system->CheckMoney($bid) && !isset($errmsg))
+{
+ $errmsg = $ERR_058;
+}
+else
+{
+ // reformat bid to valid number
+ $bid = round($system->input_money($bid), 2);
}
$Data = $db->result();
@@ -121,16 +126,20 @@ function extend_auction($id, $ends)
$current_bid = $Data['current_bid'];
$pict_url_plain = $Data['pict_url'];
$reserve = $Data['reserve_price'];
+$c = $Data['ends'];
$cbid = ($current_bid == 0) ? $minimum_bid : $current_bid;
-if ((strtotime($Data['ends']) <= time() || $Data['closed']) && !isset($errmsg)) {
- $errmsg = $ERR_614;
+if (($Data['ends'] <= time() || $Data['closed']) && !isset($errmsg))
+{
+ $errmsg = $ERR_614;
}
-if ((strtotime($Data['starts']) > time()) && !isset($errmsg)) {
- $errmsg = $ERR_073;
+if (($Data['starts'] > time()) && !isset($errmsg))
+{
+ $errmsg = $ERR_073;
}
-if ($aquantity < $qty) {
- $errmsg = $ERR_608;
+if ($aquantity < $qty)
+{
+ $errmsg = $ERR_608;
}
$query = "SELECT bid, bidder FROM " . $DBPrefix . "bids WHERE auction = :auc_id ORDER BY bid DESC, id DESC LIMIT 1";
@@ -138,447 +147,514 @@ function extend_auction($id, $ends)
$params[] = array(':auc_id', $id, 'int');
$db->query($query, $params);
$last_highest_bid = array();
-if ($db->numrows() > 0) {
- $last_highest_bid = $db->result();
- $high_bid = $last_highest_bid['bid'];
- $WINNING_BIDDER = $last_highest_bid['bidder'];
- $ARETHEREBIDS = ' | ' . $MSG['105'] . ' ';
-} else {
- $high_bid = $current_bid;
- $WINNING_BIDDER = 0;
+if ($db->numrows() > 0)
+{
+ $last_highest_bid = $db->result();
+ $high_bid = $last_highest_bid['bid'];
+ $WINNING_BIDDER = $last_highest_bid['bidder'];
+ $ARETHEREBIDS = ' | ' . $MSG['105'] . ' ';
+}
+else
+{
+ $high_bid = $current_bid;
+ $WINNING_BIDDER = 0;
}
-if ($customincrement > 0) {
- $increment = $customincrement;
-} else {
- $increment = get_increment($high_bid, false);
+if ($customincrement > 0)
+{
+ $increment = $customincrement;
+}
+else
+{
+ $increment = get_increment($high_bid, false);
}
-if (ceil($high_bid) == 0 || $atype == 2) {
- $next_bid = $minimum_bid;
-} else {
- $next_bid = $high_bid + $increment;
+if (ceil($high_bid) == 0 || $atype == 2)
+{
+ $next_bid = $minimum_bid;
+}
+else
+{
+ $next_bid = $high_bid + $increment;
}
$tmpmsg = CheckBidData();
-if ($tmpmsg != 0 && !isset($errmsg)) {
- $errmsg = ${'ERR_' . $tmpmsg};
+if ($tmpmsg != 0 && !isset($errmsg))
+{
+ $errmsg = ${'ERR_' . $tmpmsg};
}
-if (isset($_POST['action']) && !isset($errmsg)) {
- if ($system->SETTINGS['usersauth'] == 'y') {
- if (strlen($_POST['password']) == 0) {
- $errmsg = $ERR_004;
- }
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- if (!($phpass->CheckPassword($_POST['password'], $user->user_data['password']))) {
- $errmsg = $ERR_611;
- }
- }
- $send_email = false;
- // make the bid
- if ($atype == 1 && !isset($errmsg)) { // normal auction
- if ($system->SETTINGS['proxy_bidding'] == 'n') {
- // is it the highest bid?
- if ($current_bid < $bid) {
- // did you outbid someone?
- $query = "SELECT u.id FROM " . $DBPrefix . "bids b, " . $DBPrefix . "users u WHERE b.auction = :auc_id AND b.bidder = u.id and u.suspended = 0 ORDER BY bid DESC";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- // send outbid email if there are previous bidders and they where not you
- if ($db->numrows() > 0 && $db->result('id') != $bidder_id) {
- $send_email = true;
- }
- // Also update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':bid', $bid, 'float');
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':bid', $bid, 'float');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- extend_auction($item_id, $Data['ends']);
- $bidding_ended = true;
- }
- } elseif ($WINNING_BIDDER == $bidder_id) {
- $query = "SELECT bid FROM " . $DBPrefix . "proxybid p
- LEFT JOIN " . $DBPrefix . "users u ON (p.userid = u.id)
- WHERE userid = :user_id AND itemid = :item_id ORDER BY bid DESC";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':item_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $WINNER_PROXYBID = $db->result('bid');
- if ($WINNER_PROXYBID >= $bid) {
- $errmsg = $ERR_040;
- } else {
- // Just update proxy_bid
- $query = "UPDATE " . $DBPrefix . "proxybid SET bid = :newbid
- WHERE userid = :user_id
- AND itemid = :item_id AND bid = :oldbid";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':item_id', $id, 'int');
- $params[] = array(':oldbid', $WINNER_PROXYBID, 'float');
- $params[] = array(':newbid', $bid, 'float');
- $db->query($query, $params);
-
- if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve) {
- // Also update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :reserve, :qty)";
- $params = array();
- $params[] = array(':reserve', $reserve, 'float');
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :reserve, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':reserve', $reserve, 'float');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- }
- extend_auction($item_id, $Data['ends']);
- $bidding_ended = true;
- }
- }
- }
- if (!$bidding_ended && !isset($errmsg) && $system->SETTINGS['proxy_bidding'] == 'y') {
- $query = "SELECT p.userid, p.bid FROM " . $DBPrefix . "proxybid p, " . $DBPrefix . "users u WHERE itemid = :item_id AND p.userid = u.id and u.suspended = 0 ORDER by bid DESC LIMIT 1";
- $params = array();
- $params[] = array(':item_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() == 0) { // First bid
- $query = "INSERT INTO " . $DBPrefix . "proxybid VALUES (:auc_id, :bidder_id, :bid)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $db->query($query, $params);
-
- if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve) {
- $next_bid = $reserve;
- }
- // Also update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $next_bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- // Only updates current bid if it is a new bidder, not the current one
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':bid', $next_bid, 'float');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 1)";
- $db->direct_query($query);
- } else { // This is not the first bid
- $proxy_bid_data = $db->result();
- $proxy_bidder_id = $proxy_bid_data['userid'];
- $proxy_max_bid = $proxy_bid_data['bid'];
-
- if ($proxy_max_bid < $bid) {
- if ($proxy_bidder_id != $bidder_id) {
- $send_email = true;
- }
- $next_bid = $proxy_max_bid + $increment;
- if (($proxy_max_bid + $increment) > $bid) {
- $next_bid = $bid;
- }
-
- $query = "SELECT userid, itemid FROM " . $DBPrefix . "proxybid WHERE itemid = :item_id AND userid = :bidder_id";
- $params = array();
- $params[] = array(':item_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "proxybid VALUES (:auc_id, :bidder_id, :bid)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $db->query($query, $params);
- } else {
- $query = "UPDATE " . $DBPrefix . "proxybid SET bid = :newbid WHERE userid = :bidder_id AND itemid = :item_id";
- $params = array();
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':item_id', $id, 'int');
- $params[] = array(':newbid', $bid, 'float');
- $db->query($query, $params);
- }
-
- if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve) {
- $next_bid = $reserve;
- }
- // Fake bid to maintain a coherent history
- if ($current_bid < $proxy_max_bid) {
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
- $params[] = array(':bid', $proxy_max_bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $fakebids = 1;
- } else {
- $fakebids = 0;
- }
- // Update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $next_bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + (1 + :fakebids))";
- $params = array();
- $params[] = array(':fakebids', $fakebids, 'int');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = (num_bids + 1 + :fakebids) WHERE id = :auc_id";
- $params = array();
- $params[] = array(':bid', $next_bid, 'float');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':fakebids', $fakebids, 'int');
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- } elseif ($proxy_max_bid == $bid) {
- echo 0;
- $cbid = $proxy_max_bid;
- $errmsg = $MSG['701'];
- // Update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
- $params[] = array(':bid', $cbid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 2)";
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 2 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':bid', $cbid, 'float');
- $db->query($query, $params);
- if ($customincrement == 0) {
- // get new increment
- $increment = get_increment($cbid);
- } else {
- $increment = $customincrement;
- }
- $next_bid = $cbid + $increment;
- } elseif ($proxy_max_bid > $bid) {
- // Update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- if ($customincrement == 0) {
- // get new increment
- $increment = get_increment($bid);
- } else {
- $increment = $customincrement;
- }
- if ($bid + $increment - $proxy_max_bid >= 0) {
- $cbid = $proxy_max_bid;
- } else {
- $cbid = $bid + $increment;
- }
- $errmsg = $MSG['701'];
- // Update bids table
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
- $params[] = array(':bid', $cbid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 2)";
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 2 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':bid', $cbid, 'float');
- $db->query($query, $params);
- if ($customincrement == 0) {
- // get new increment
- $increment = get_increment($cbid);
- } else {
- $increment = $customincrement;
- }
- $next_bid = $cbid + $increment;
- }
- }
- extend_auction($item_id, $Data['ends']);
- }
- } elseif ($atype == 2 && !isset($errmsg)) { // dutch auction
- // If the bidder already bid on this auction there new bbid must be higher
- $query = "SELECT bid, quantity FROM " . $DBPrefix . "bids WHERE bidder = :bidder_id AND auction = :auc_id ORDER BY bid DESC LIMIT 1";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $PREVIOUSBID = $db->result();
- if (($bid * $qty) <= ($PREVIOUSBID['bid'] * $PREVIOUSBID['quantity'])) {
- $errmsg = $ERR_059;
- }
- }
- if (!isset($errmsg)) {
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :bidder_id, :bid, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':bidder_id', $bidder_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 1)";
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $params[] = array(':bid', $bid, 'float');
- $db->query($query, $params);
- extend_auction($item_id, $Data['ends']);
- }
- }
-
- // if there was a previous bidder tell them they have been outbid
- if (count($last_highest_bid) > 0) {
- $OldWinner_id = $last_highest_bid['bidder'];
-
- $query = "SELECT nick, name, email FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $OldWinner_id, 'int');
- $db->query($query, $params);
- $OldWinner = $db->result();
-
- $OldWinner_nick = $OldWinner['nick'];
- $OldWinner_name = $OldWinner['name'];
- $OldWinner_email = $OldWinner['email'];
- }
- // Update counters table with the new bid
- // Send notification if auction id matches (Item Watch)
- $query = "SELECT name, email, item_watch, id FROM " . $DBPrefix . "users WHERE item_watch LIKE :auc_id AND id != :user_id";
- $params = array();
- $params[] = array(':user_id', $bidder_id, 'int');
- $params[] = array(':auc_id', '%' . $id . '%', 'str');
- $db->query($query, $params);
-
- $fetch = $db->fetchall();
- foreach ($fetch as $row) {
- // double check there is a match
- $watch_values = explode(' ', $row['item_watch']);
- if (in_array(strval($id), $watch_values)) {
- // Get data about the auction
- $query = "SELECT title, current_bid FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- $auction_data = $db->result();
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'REALNAME' => $row['name'],
- 'TITLE' => $auction_data['title'],
- 'BID' => $system->print_money($bid, false),
- 'AUCTION_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id
- ));
- $emailer->email_uid = $row['id'];
- $emailer->email_sender($row['email'], 'item_watch.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['472']);
- }
- }
- // End of Item watch
- if ($send_email) {
- $ends_string = $dt->printDateTz($Data['ends']);
- $new_bid = $system->print_money($next_bid);
- // Send e-mail message
- include INCLUDE_PATH . 'email/outbid.php';
- }
-
- if (defined('TrackUserIPs')) {
- // log auction bid IP
- $system->log('user', 'Bid $' . $bid . '(previous bid was $' . $current_bid . ') on Item', $bidder_id, $id);
- }
- $template->assign_vars(array(
- 'PAGE' => 2,
- 'BID_HISTORY' => (isset($ARETHEREBIDS)) ? $ARETHEREBIDS : '',
- 'TITLE' => $item_title,
- 'ID' => $id,
- 'BID' => $system->print_money($bid),
- 'TQTY' => 0
- ));
+if (isset($_POST['action']) && !isset($errmsg))
+{
+ if ($system->SETTINGS['usersauth'] == 'y')
+ {
+ if (strlen($_POST['password']) == 0)
+ {
+ $errmsg = $ERR_004;
+ }
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ if (!($phpass->CheckPassword($_POST['password'], $user->user_data['password'])))
+ {
+ $errmsg = $ERR_611;
+ }
+ }
+ $send_email = false;
+ // make the bid
+ if ($atype == 1 && !isset($errmsg)) // normal auction
+ {
+ if ($system->SETTINGS['proxy_bidding'] == 'n')
+ {
+ // is it the highest bid?
+ if ($current_bid < $bid)
+ {
+ // did you outbid someone?
+ $query = "SELECT u.id FROM " . $DBPrefix . "bids b, " . $DBPrefix . "users u WHERE b.auction = :auc_id AND b.bidder = u.id and u.suspended = 0 ORDER BY bid DESC";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ // send outbid email if there are previous bidders and they where not you
+ if ($db->numrows() > 0 && $db->result('id') != $bidder_id)
+ {
+ $send_email = true;
+ }
+ // Also update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':bid', $bid, 'float');
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':bid', $bid, 'float');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ extend_auction($item_id, $c);
+ $bidding_ended = true;
+ }
+ }
+ elseif ($WINNING_BIDDER == $bidder_id)
+ {
+ $query = "SELECT bid FROM " . $DBPrefix . "proxybid p
+ LEFT JOIN " . $DBPrefix . "users u ON (p.userid = u.id)
+ WHERE userid = :user_id AND itemid = :item_id ORDER BY bid DESC";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':item_id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $WINNER_PROXYBID = $db->result('bid');
+ if ($WINNER_PROXYBID >= $bid)
+ {
+ $errmsg = $ERR_040;
+ }
+ else
+ {
+ // Just update proxy_bid
+ $query = "UPDATE " . $DBPrefix . "proxybid SET bid = :newbid
+ WHERE userid = :user_id
+ AND itemid = :item_id AND bid = :oldbid";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':item_id', $id, 'int');
+ $params[] = array(':oldbid', $WINNER_PROXYBID, 'float');
+ $params[] = array(':newbid', $bid, 'float');
+ $db->query($query, $params);
+
+ if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve)
+ {
+ // Also update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :reserve, :time, :qty)";
+ $params = array();
+ $params[] = array(':reserve', $reserve, 'float');
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :reserve, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':reserve', $reserve, 'float');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ }
+ extend_auction($item_id, $c);
+ $bidding_ended = true;
+ }
+ }
+ }
+ if (!$bidding_ended && !isset($errmsg) && $system->SETTINGS['proxy_bidding'] == 'y')
+ {
+ $query = "SELECT p.userid, p.bid FROM " . $DBPrefix . "proxybid p, " . $DBPrefix . "users u WHERE itemid = :item_id AND p.userid = u.id and u.suspended = 0 ORDER by bid DESC LIMIT 1";
+ $params = array();
+ $params[] = array(':item_id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() == 0) // First bid
+ {
+ $query = "INSERT INTO " . $DBPrefix . "proxybid VALUES (:auc_id, :bidder_id, :bid)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $db->query($query, $params);
+
+ if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve)
+ {
+ $next_bid = $reserve;
+ }
+ // Also update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $next_bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ // Only updates current bid if it is a new bidder, not the current one
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':bid', $next_bid, 'float');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 1)";
+ $db->direct_query($query);
+ }
+ else // This is not the first bid
+ {
+ $proxy_bid_data = $db->result();
+ $proxy_bidder_id = $proxy_bid_data['userid'];
+ $proxy_max_bid = $proxy_bid_data['bid'];
+
+ if ($proxy_max_bid < $bid)
+ {
+ if ($proxy_bidder_id != $bidder_id)
+ {
+ $send_email = true;
+ }
+ $next_bid = $proxy_max_bid + $increment;
+ if (($proxy_max_bid + $increment) > $bid)
+ {
+ $next_bid = $bid;
+ }
+
+ $query = "SELECT userid, itemid FROM " . $DBPrefix . "proxybid WHERE itemid = :item_id AND userid = :bidder_id";
+ $params = array();
+ $params[] = array(':item_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "proxybid VALUES (:auc_id, :bidder_id, :bid)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "proxybid SET bid = :newbid WHERE userid = :bidder_id AND itemid = :item_id";
+ $params = array();
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':item_id', $id, 'int');
+ $params[] = array(':newbid', $bid, 'float');
+ $db->query($query, $params);
+ }
+
+ if ($reserve > 0 && $reserve > $current_bid && $bid >= $reserve)
+ {
+ $next_bid = $reserve;
+ }
+ // Fake bid to maintain a coherent history
+ if ($current_bid < $proxy_max_bid)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
+ $params[] = array(':bid', $proxy_max_bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $fakebids = 1;
+ }
+ else
+ {
+ $fakebids = 0;
+ }
+ // Update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $next_bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + (1 + :fakebids))";
+ $params = array();
+ $params[] = array(':fakebids', $fakebids, 'int');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = (num_bids + 1 + :fakebids) WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':bid', $next_bid, 'float');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':fakebids', $fakebids, 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ }
+ elseif ($proxy_max_bid == $bid)
+ {
+ echo 0;
+ $cbid = $proxy_max_bid;
+ $errmsg = $MSG['701'];
+ // Update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
+ $params[] = array(':bid', $cbid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 2)";
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 2 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':bid', $cbid, 'float');
+ $db->query($query, $params);
+ if ($customincrement == 0)
+ {
+ // get new increment
+ $increment = get_increment($cbid);
+ }
+ else
+ {
+ $increment = $customincrement;
+ }
+ $next_bid = $cbid + $increment;
+ }
+ elseif ($proxy_max_bid > $bid)
+ {
+ // Update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ if ($customincrement == 0)
+ {
+ // get new increment
+ $increment = get_increment($bid);
+ }
+ else
+ {
+ $increment = $customincrement;
+ }
+ if ($bid + $increment - $proxy_max_bid >= 0)
+ {
+ $cbid = $proxy_max_bid;
+ }
+ else
+ {
+ $cbid = $bid + $increment;
+ }
+ $errmsg = $MSG['701'];
+ // Update bids table
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $proxy_bidder_id, 'int');
+ $params[] = array(':bid', $cbid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 2)";
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 2 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':bid', $cbid, 'float');
+ $db->query($query, $params);
+ if ($customincrement == 0)
+ {
+ // get new increment
+ $increment = get_increment($cbid);
+ }
+ else
+ {
+ $increment = $customincrement;
+ }
+ $next_bid = $cbid + $increment;
+ }
+ }
+ extend_auction($item_id, $c);
+ }
+ }
+ elseif ($atype == 2 && !isset($errmsg)) // dutch auction
+ {
+ // If the bidder already bid on this auction there new bbid must be higher
+ $query = "SELECT bid, quantity FROM " . $DBPrefix . "bids WHERE bidder = :bidder_id AND auction = :auc_id ORDER BY bid DESC LIMIT 1";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $PREVIOUSBID = $db->result();
+ if (($bid * $qty) <= ($PREVIOUSBID['bid'] * $PREVIOUSBID['quantity']))
+ {
+ $errmsg = $ERR_059;
+ }
+ }
+ if (!isset($errmsg))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :bidder_id, :bid, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':bidder_id', $bidder_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids + 1)";
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "auctions SET current_bid = :bid, current_bid_id = :current_bid_id, num_bids = num_bids + 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':bid', $bid, 'float');
+ $db->query($query, $params);
+ }
+ }
+
+ // if there was a previous bidder tell them they have been outbid
+ if (count($last_highest_bid) > 0)
+ {
+ $OldWinner_id = $last_highest_bid['bidder'];
+
+ $query = "SELECT nick, name, email FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $OldWinner_id, 'int');
+ $db->query($query, $params);
+ $OldWinner = $db->result();
+
+ $OldWinner_nick = $OldWinner['nick'];
+ $OldWinner_name = $OldWinner['name'];
+ $OldWinner_email = $OldWinner['email'];
+ }
+ // Update counters table with the new bid
+ // Send notification if auction id matches (Item Watch)
+ $query = "SELECT name, email, item_watch, id FROM " . $DBPrefix . "users WHERE item_watch LIKE :auc_id AND id != :user_id";
+ $params = array();
+ $params[] = array(':user_id', $bidder_id, 'int');
+ $params[] = array(':auc_id', '%' . $id . '%', 'str');
+ $db->query($query, $params);
+
+ $fetch = $db->fetchall();
+ foreach ($fetch as $row)
+ {
+ // double check there is a match
+ $watch_values = explode(' ', $row['item_watch']);
+ if (in_array(strval($id), $watch_values))
+ {
+ // Get data about the auction
+ $query = "SELECT title, current_bid FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ $auction_data = $db->result();
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'REALNAME' => $row['name'],
+ 'TITLE' => $auction_data['title'],
+ 'BID' => $system->print_money($auction_data['current_bid'], false),
+ 'AUCTION_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id
+ ));
+ $emailer->email_uid = $row['id'];
+ $emailer->email_sender($row['email'], 'item_watch.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['472']);
+ }
+ }
+ // End of Item watch
+ if ($send_email)
+ {
+ $month = date('m', $c + $system->tdiff);
+ $ends_string = $MSG['MON_0' . $month] . ' ' . date('d, Y H:i', $c + $system->tdiff);
+ $new_bid = $system->print_money($next_bid);
+ // Send e-mail message
+ include INCLUDE_PATH . 'email/outbid.php';
+ }
+
+ if (defined('TrackUserIPs'))
+ {
+ // log auction bid IP
+ $system->log('user', 'Bid $' . $bid . '(previous bid was $' . $current_bid . ') on Item', $bidder_id, $id);
+ }
+ $template->assign_vars(array(
+ 'PAGE' => 2,
+ 'BID_HISTORY' => (isset($ARETHEREBIDS)) ? $ARETHEREBIDS : '',
+ 'TITLE' => $item_title,
+ 'ID' => $id,
+ 'BID' => $system->print_money($bid),
+ 'TQTY' => 0
+ ));
}
-if (!isset($_POST['action']) || isset($errmsg)) {
- // just set the needed template variables
- $template->assign_vars(array(
- 'PAGE' => 1,
- 'ERROR' => (isset($errmsg)) ? $errmsg : '',
- 'BID_HISTORY' => (isset($ARETHEREBIDS)) ? $ARETHEREBIDS : '',
- 'ID' => $id,
- 'IMAGE' => (!empty($pict_url_plain)) ? ' ' : '',
- 'TITLE' => $item_title,
- 'CURRENT_BID' => $system->print_money($cbid),
- 'ATYPE' => $atype,
- 'BID' => $system->print_money_nosymbol($bid),
- 'NEXT_BID' => $system->print_money($next_bid),
- 'QTY' => $qty,
- 'TQTY' => $aquantity,
- 'AGREEMENT' => sprintf($MSG['25_0086'], $system->print_money($qty * $bid)),
- 'CURRENCY' => $system->SETTINGS['currency'],
-
- 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
- ));
+if (!isset($_POST['action']) || isset($errmsg))
+{
+ // just set the needed template variables
+ $template->assign_vars(array(
+ 'PAGE' => 1,
+ 'ERROR' => (isset($errmsg)) ? $errmsg : '',
+ 'BID_HISTORY' => (isset($ARETHEREBIDS)) ? $ARETHEREBIDS : '',
+ 'ID' => $id,
+ 'IMAGE' => (!empty($pict_url_plain)) ? ' ' : ' ',
+ 'TITLE' => $item_title,
+ 'CURRENT_BID' => $system->print_money($cbid),
+ 'ATYPE' => $atype,
+ 'BID' => $system->print_money_nosymbol($bid),
+ 'NEXT_BID' => $system->print_money($next_bid),
+ 'QTY' => $qty,
+ 'TQTY' => $aquantity,
+ 'AGREEMENT' => sprintf($MSG['25_0086'], $system->print_money($qty * $bid)),
+ 'CURRENCY' => $system->SETTINGS['currency'],
+
+ 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'bid.tpl'
- ));
+ 'body' => 'bid.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/boards.php b/boards.php
old mode 100644
new mode 100755
index 48f7c2ce1..739ccb7cf
--- a/boards.php
+++ b/boards.php
@@ -1,6 +1,6 @@
SETTINGS['boards'] == 'n') {
- header('location: index.php');
+if ($system->SETTINGS['boards'] == 'n')
+{
+ header('location: index.php');
}
-if (!$user->checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'boards.php';
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'boards.php';
+ header('location: user_login.php');
+ exit;
}
// Retrieve message boards from the database
$query = "SELECT * FROM " . $DBPrefix . "community WHERE active = 1 ORDER BY name";
$db->direct_query($query);
-while ($row = $db->fetch()) {
- $template->assign_block_vars('boards', array(
- 'NAME' => $row['name'],
- 'ID' => $row['id'],
- 'NUMMSG' => $row['messages'],
- 'LASTMSG' => ($row['messages'] > 0) ? $dt->formatDate($row['lastmessage']) : '--'
- ));
+while ($row = $db->fetch())
+{
+ $template->assign_block_vars('boards', array(
+ 'NAME' => $row['name'],
+ 'ID' => $row['id'],
+ 'NUMMSG' => $row['messages'],
+ 'LASTMSG' => (!empty($row['lastmessage'])) ? FormatDate($row['lastmessage']) : '--'
+ ));
}
include 'header.php';
$template->set_filenames(array(
- 'body' => 'boards.tpl'
- ));
+ 'body' => 'boards.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/browse.php b/browse.php
old mode 100644
new mode 100755
index cef0ce9fb..605f106e5
--- a/browse.php
+++ b/browse.php
@@ -1,6 +1,6 @@
query($query, $params);
$parent_node = $db->result();
$id = (isset($parent_node['cat_id'])) ? $parent_node['cat_id'] : $id;
$catalist = '';
-if ($parent_node['left_id'] != 1) {
- $children = $catscontrol->get_children_list($parent_node['left_id'], $parent_node['right_id']);
- $childarray = array($id);
- foreach ($children as $k => $v) {
- $childarray[] = $v['cat_id'];
- }
- $catalist = '(';
- $catalist .= implode(',', $childarray);
- $catalist .= ')';
- $all_items = false;
+if ($parent_node['left_id'] != 1)
+{
+ $children = $catscontrol->get_children_list($parent_node['left_id'], $parent_node['right_id']);
+ $childarray = array($id);
+ foreach ($children as $k => $v)
+ {
+ $childarray[] = $v['cat_id'];
+ }
+ $catalist = '(';
+ $catalist .= implode(',', $childarray);
+ $catalist .= ')';
+ $all_items = false;
}
+$NOW = time();
+
/*
specified category number
look into table - and if we don't have such category - redirect to full list
@@ -55,147 +62,177 @@
$db->query($query, $params);
$category = $db->result();
-if ($db->numrows() == 0) {
- // redirect to global categories list
- header('location: browse.php?id=0');
- exit;
-} else {
- // Retrieve the translated category name
- $cat_id = $category['cat_id'];
- $current_cat_name = $category_names[$cat_id];
- $TPL_categories_string = '';
- $crumbs = $catscontrol->get_bread_crumbs($category['left_id'], $category['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] > 0) {
- if ($i > 0) {
- $TPL_categories_string .= ' > ';
- }
- $TPL_categories_string .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
- }
- }
-
- // get list of subcategories of this category
- $subcat_count = 0;
- $query = "SELECT * FROM " . $DBPrefix . "categories WHERE parent_id = :parent_id ORDER BY cat_name";
- $params = array();
- $params[] = array(':parent_id', $id, 'int');
- $db->query($query, $params);
- $need_to_continue = 1;
- $cycle = 1;
-
- $TPL_main_value = '';
- while ($row = $db->fetch()) {
- ++$subcat_count;
- if ($cycle == 1) {
- $TPL_main_value .= '' . "\n";
- }
- $sub_counter = $row['sub_counter'];
- $cat_counter = $row['counter'];
- if ($sub_counter != 0) {
- $count_string = ' (' . $sub_counter . ')';
- } else {
- if ($cat_counter != 0) {
- $count_string = ' (' . $cat_counter . ')';
- } else {
- $count_string = '';
- }
- }
- if ($row['cat_colour'] != '') {
- $BG = 'bgcolor=' . $row['cat_colour'];
- } else {
- $BG = '';
- }
- // Retrieve the translated category name
- $row['cat_name'] = $category_names[$row['cat_id']];
- $catimage = (!empty($row['cat_image'])) ? ' ' : '';
- $TPL_main_value .= "\t" . '' . $catimage . '' . $row['cat_name'] . $count_string . ' ' . "\n";
-
- ++$cycle;
- if ($cycle == 4) {
- $cycle = 1;
- $TPL_main_value .= ' ' . "\n";
- }
- }
-
- if ($cycle >= 2 && $cycle <= 3) {
- while ($cycle < 4) {
- $TPL_main_value .= ' ' . "\n";
- ++$cycle;
- }
- $TPL_main_value .= '' . "\n";
- }
-
- $insql = "(category IN " . $catalist;
- if ($system->SETTINGS['extra_cat'] == 'y') {
- $insql .= " OR secondcat IN " . $catalist;
- }
- $insql = (!$all_items) ? $insql . ") AND" : '';
-
- // get total number of records
- $query = "SELECT count(*) as COUNT FROM " . $DBPrefix . "auctions
- WHERE " . $insql . " starts <= CURRENT_TIMESTAMP
+if ($db->numrows() == 0)
+{
+ // redirect to global categories list
+ header ('location: browse.php?id=0');
+ exit;
+}
+else
+{
+ // Retrieve the translated category name
+ $cat_id = $category['cat_id'];
+ $current_cat_name = $category_names[$cat_id];
+ $TPL_categories_string = '';
+ $crumbs = $catscontrol->get_bread_crumbs($category['left_id'], $category['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] > 0)
+ {
+ if ($i > 0)
+ {
+ $TPL_categories_string .= ' > ';
+ }
+ $TPL_categories_string .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
+ }
+ }
+
+ // get list of subcategories of this category
+ $subcat_count = 0;
+ $query = "SELECT * FROM " . $DBPrefix . "categories WHERE parent_id = :parent_id ORDER BY cat_name";
+ $params = array();
+ $params[] = array(':parent_id', $id, 'int');
+ $db->query($query, $params);
+ $need_to_continue = 1;
+ $cycle = 1;
+
+ $TPL_main_value = '';
+ while ($row = $db->fetch())
+ {
+ ++$subcat_count;
+ if ($cycle == 1)
+ {
+ $TPL_main_value .= '' . "\n";
+ }
+ $sub_counter = $row['sub_counter'];
+ $cat_counter = $row['counter'];
+ if ($sub_counter != 0)
+ {
+ $count_string = ' (' . $sub_counter . ')';
+ }
+ else
+ {
+ if ($cat_counter != 0)
+ {
+ $count_string = ' (' . $cat_counter . ')';
+ }
+ else
+ {
+ $count_string = '';
+ }
+ }
+ if ($row['cat_colour'] != '')
+ {
+ $BG = 'bgcolor=' . $row['cat_colour'];
+ }
+ else
+ {
+ $BG = '';
+ }
+ // Retrieve the translated category name
+ $row['cat_name'] = $category_names[$row['cat_id']];
+ $catimage = (!empty($row['cat_image'])) ? ' ' : '';
+ $TPL_main_value .= "\t" . '' . $catimage . '' . $row['cat_name'] . $count_string . ' ' . "\n";
+
+ ++$cycle;
+ if ($cycle == 4)
+ {
+ $cycle = 1;
+ $TPL_main_value .= ' ' . "\n";
+ }
+ }
+
+ if ($cycle >= 2 && $cycle <= 3)
+ {
+ while ($cycle < 4)
+ {
+ $TPL_main_value .= ' ' . "\n";
+ ++$cycle;
+ }
+ $TPL_main_value .= '' . "\n";
+ }
+
+ $insql = "(category IN " . $catalist;
+ if ($system->SETTINGS['extra_cat'] == 'y')
+ {
+ $insql .= " OR secondcat IN " . $catalist;
+ }
+ $insql = (!$all_items) ? $insql . ") AND" : '';
+
+ // get total number of records
+ $query = "SELECT count(*) as COUNT FROM " . $DBPrefix . "auctions
+ WHERE " . $insql . " starts <= :time
AND closed = 0
AND suspended = 0";
- $params = array();
- if (!empty($_POST['catkeyword'])) {
- $query .= " AND title LIKE :title";
- $params[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
- }
- $db->query($query, $params);
- $TOTALAUCTIONS = $db->result('COUNT');
-
- // Handle pagination
- if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE'])) {
- $OFFSET = 0;
- $PAGE = 1;
- } else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
- }
- $PAGES = ($TOTALAUCTIONS == 0) ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
-
- $query = "SELECT * FROM " . $DBPrefix . "auctions
- WHERE " . $insql . " starts <= CURRENT_TIMESTAMP
+ $params = array();
+ $params[] = array(':time', $NOW, 'int');
+ if (!empty($_POST['catkeyword']))
+ {
+ $query .= " AND title LIKE :title";
+ $params[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
+ }
+ $db->query($query, $params);
+ $TOTALAUCTIONS = $db->result('COUNT');
+
+ // Handle pagination
+ if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE']))
+ {
+ $OFFSET = 0;
+ $PAGE = 1;
+ }
+ else
+ {
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+ }
+ $PAGES = ($TOTALAUCTIONS == 0) ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
+
+ $query = "SELECT * FROM " . $DBPrefix . "auctions
+ WHERE " . $insql . " starts <= :time
AND closed = 0
AND suspended = 0";
- $params = array();
- if (!empty($_POST['catkeyword'])) {
- $query .= " AND title LIKE :title";
- $params[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
- }
- $query .= " ORDER BY ends ASC LIMIT :offset, :perpage";
- $params[] = array(':offset', $OFFSET, 'int');
- $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
-
- // get featured items
- $query_feat = "SELECT * FROM " . $DBPrefix . "auctions
- WHERE " . $insql . " starts <= CURRENT_TIMESTAMP
+ $params = array();
+ $params[] = array(':time', $NOW, 'int');
+ if (!empty($_POST['catkeyword']))
+ {
+ $query .= " AND title LIKE :title";
+ $params[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
+ }
+ $query .= " ORDER BY ends ASC LIMIT :offset, :perpage";
+ $params[] = array(':offset', $OFFSET, 'int');
+ $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
+
+ // get featured items
+ $query_feat = "SELECT * FROM " . $DBPrefix . "auctions
+ WHERE " . $insql . " starts <= :time
AND closed = 0
AND suspended = 0
AND featured = 1";
- $params_feat = array();
- if (!empty($_POST['catkeyword'])) {
- $query_feat .= " AND title LIKE :title";
- $params_feat[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
- }
- $query_feat .= " ORDER BY ends ASC LIMIT :offset, " . $system->SETTINGS['featuredperpage'];
- $params_feat[] = array(':offset', (($PAGE - 1) * $system->SETTINGS['featuredperpage']), 'int');
-
- include INCLUDE_PATH . 'browseitems.inc.php';
- browseItems($query, $params, $query_feat, $params_feat, $TOTALAUCTIONS, 'browse.php', 'id=' . $id);
-
- $template->assign_vars(array(
- 'ID' => $id,
- 'TOP_HTML' => $TPL_main_value,
- 'CAT_STRING' => $TPL_categories_string,
- 'NUM_AUCTIONS' => $TOTALAUCTIONS
- ));
+ $params_feat = array();
+ $params_feat[] = array(':time', $NOW, 'int');
+ if (!empty($_POST['catkeyword']))
+ {
+ $query_feat .= " AND title LIKE :title";
+ $params_feat[] = array(':title', '%' . $system->cleanvars($_POST['catkeyword']) . '%', 'str');
+ }
+ $query_feat .= " ORDER BY ends ASC LIMIT :offset, " . $system->SETTINGS['featuredperpage'];
+ $params_feat[] = array(':offset', (($PAGE - 1) * $system->SETTINGS['featuredperpage']), 'int');
+
+ include INCLUDE_PATH . 'browseitems.inc.php';
+ browseItems($query, $params, $query_feat, $params_feat, $TOTALAUCTIONS, 'browse.php', 'id=' . $id);
+
+ $template->assign_vars(array(
+ 'ID' => $id,
+ 'TOP_HTML' => $TPL_main_value,
+ 'CAT_STRING' => $TPL_categories_string,
+ 'NUM_AUCTIONS' => $TOTALAUCTIONS
+ ));
}
$page_title = $current_cat_name;
include 'header.php';
$template->set_filenames(array(
- 'body' => 'browsecats.tpl'
- ));
+ 'body' => 'browsecats.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/buy_now.php b/buy_now.php
old mode 100644
new mode 100755
index 782e81893..73636c829
--- a/buy_now.php
+++ b/buy_now.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5002'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'buy_now.php?id=' . $id;
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5002'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'buy_now.php?id=' . $id;
+ header('location: user_login.php');
+ exit;
}
-if (in_array($user->user_data['suspended'], array(5, 6, 7))) {
- header('location: message.php');
- exit;
+if (in_array($user->user_data['suspended'], array(5, 6, 7)))
+{
+ header('location: message.php');
+ exit;
}
-if (!$user->permissions['can_buy']) {
- $_SESSION['TMP_MSG'] = $MSG['819'];
- header('location: user_menu.php');
- exit;
+if (!$user->can_buy)
+{
+ $_SESSION['TMP_MSG'] = $MSG['819'];
+ header('location: user_menu.php');
+ exit;
}
unset($ERR);
+$NOW = time();
$query = "SELECT * FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
$params = array();
@@ -44,42 +49,50 @@
$Auction = $db->result();
// such auction does not exist
-if ($db->numrows() == 0) {
- $template->assign_vars(array(
- 'TITLE_MESSAGE' => $MSG['415'],
- 'BODY_MESSAGE' => $ERR_606
- ));
- include 'header.php';
- $template->set_filenames(array(
- 'body' => 'message.tpl'
- ));
- $template->display('body');
- include 'footer.php';
- exit; // kill the page
+if ($db->numrows() == 0)
+{
+ $template->assign_vars(array(
+ 'TITLE_MESSAGE' => $MSG['415'],
+ 'BODY_MESSAGE' => $ERR_606
+ ));
+ include 'header.php';
+ $template->set_filenames(array(
+ 'body' => 'message.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
+ exit; // kill the page
}
-if ($Auction['closed']) {
- header('location: item.php?id=' . $_REQUEST['id']);
- exit;
+if ($Auction['closed'])
+{
+ header('location: item.php?id=' . $_REQUEST['id']);
+ exit;
}
-if (strtotime($Auction['starts']) > time()) {
- $ERR = $ERR_073;
+if ($Auction['starts'] > time())
+{
+ $ERR = $ERR_073;
}
// If there are bids for this auction -> error
-if ($Auction['bn_only'] == 0) {
- if (!($Auction['buy_now'] > 0 && ($Auction['num_bids'] == 0 || ($Auction['reserve_price'] > 0 && $Auction['current_bid'] < $Auction['reserve_price']) || ($Auction['current_bid'] < $Auction['buy_now'])))) {
- $ERR = $ERR_712;
- } else {
- $query = "SELECT MAX(bid) AS maxbid FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- $maxbid = $db->result('maxbid');
- if (($maxbid > 0 && $maxbid >= $Auction['reserve_price'])) {
- $ERR = $ERR_712;
- }
- }
+if ($Auction['bn_only'] == 0)
+{
+ if (!($Auction['buy_now'] > 0 && ($Auction['num_bids'] == 0 || ($Auction['reserve_price'] > 0 && $Auction['current_bid'] < $Auction['reserve_price']) || ($Auction['current_bid'] < $Auction['buy_now']))))
+ {
+ $ERR = $ERR_712;
+ }
+ else
+ {
+ $query = "SELECT MAX(bid) AS maxbid FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ $maxbid = $db->result('maxbid');
+ if (($maxbid > 0 && $maxbid >= $Auction['reserve_price']))
+ {
+ $ERR = $ERR_712;
+ }
+ }
}
// get user's details
@@ -90,233 +103,279 @@
$Seller = $db->result();
// Get current total rate value for user
-$query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
-$params = array();
-$params[] = array(':feedback', $Seller['rate_sum'], 'int');
-$db->query($query, $params);
-$feedback_icon = $db->result('icon');
+$total_rate = $Seller['rate_sum'];
+
+$i = 0;
+foreach ($membertypes as $k => $l)
+{
+ if ($k >= $total_rate || $i++ == (count($membertypes) - 1))
+ {
+ $TPL_rate_radio = ' ';
+ break;
+ }
+}
$qty = (isset($_REQUEST['qty'])) ? intval($_REQUEST['qty']) : 1;
$buy_done = 0;
-if (isset($_POST['action']) && $_POST['action'] == 'buy') {
- if ($system->SETTINGS['usersauth'] == 'y') {
- // check if password entered
- if (strlen($_POST['password']) == 0) {
- $ERR = $ERR_610;
- }
- // check if password is correct
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- if (!($phpass->CheckPassword($_POST['password'], $user->user_data['password']))) {
- $ERR = $ERR_611;
- }
- }
- // check if buyer is not the seller
- if ($user->user_data['id'] == $Auction['user']) {
- $ERR = $ERR_711;
- }
- // check auction still has items left to buy
- if (isset($qty) && $qty > $Auction['quantity']) {
- $ERR = $ERR_608;
- } elseif (!isset($qty) || $qty < 1) {
- $ERR = $ERR_601;
- }
- // perform final actions
- if (!isset($ERR)) {
- $query = "INSERT INTO " . $DBPrefix . "bids (auction, bidder, bid, quantity)
- VALUES (:auc_id, :user_id, :buy_now, :qty)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':buy_now', $Auction['buy_now'], 'float');
- $params[] = array(':qty', $qty, 'int');
- $db->query($query, $params);
- $current_bid_id = $db->lastInsertId();
- if (defined('TrackUserIPs')) {
- // log auction BIN IP
- $system->log('user', 'BIN on Item', $user->user_data['id'], $id);
- }
- if ($Auction['bn_only'] == 0) {
- $query = "UPDATE " . $DBPrefix . "auctions SET ends = CURRENT_TIMESTAMP, bn_sale = 1, num_bids = num_bids + 1, current_bid = :buy_now, current_bid_id = :current_bid_id WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':buy_now', $Auction['buy_now'], 'float');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "counters SET bids = bids + 1";
- $db->direct_query($query);
- // so its not over written by the cron
- $tmpauc = $Auction;
- include 'cron.php';
- $Auction = $tmpauc;
- unset($tmpauc);
- } else {
- $query = "UPDATE " . $DBPrefix . "auctions SET quantity = quantity - :quantity WHERE id = :auc_id";
- $params = array();
- $params[] = array(':quantity', $qty, 'int');
- $params[] = array(':auc_id', $id, 'int');
- $db->query($query, $params);
- // force close if all items sold
- if (($Auction['quantity'] - $qty) == 0) {
- $query = "UPDATE " . $DBPrefix . "auctions SET ends = CURRENT_TIMESTAMP, bn_sale = 1, current_bid = :current_bid, current_bid_id = :current_bid_id, sold = 'y', num_bids = num_bids + 1, closed = 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':current_bid', $Auction['buy_now'], 'int');
- $params[] = array(':current_bid_id', $current_bid_id, 'int');
- $db->query($query, $params);
- }
- // do stuff that is important
- $query = "SELECT id, name, nick, email, address, city, prov, zip, country FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $Winner = $db->result();
- $bf_paid = 1;
- $ff_paid = 1;
+if (isset($_POST['action']) && $_POST['action'] == 'buy')
+{
+ if ($system->SETTINGS['usersauth'] == 'y')
+ {
+ // check if password entered
+ if (strlen($_POST['password']) == 0)
+ {
+ $ERR = $ERR_610;
+ }
+ // check if password is correct
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ if (!($phpass->CheckPassword($_POST['password'], $user->user_data['password'])))
+ {
+ $ERR = $ERR_611;
+ }
+ }
+ // check if buyer is not the seller
+ if ($user->user_data['id'] == $Auction['user'])
+ {
+ $ERR = $ERR_711;
+ }
+ // check auction still has items left to buy
+ if (isset($qty) && $qty > $Auction['quantity'])
+ {
+ $ERR = $ERR_608;
+ }
+ else if (!isset($qty) || $qty < 1)
+ {
+ $ERR = $ERR_601;
+ }
+ // perform final actions
+ if (!isset($ERR))
+ {
+ $query = "INSERT INTO " . $DBPrefix . "bids VALUES (NULL, :auc_id, :user_id, :buy_now, :time, :qty)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':buy_now', $Auction['buy_now'], 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':qty', $qty, 'int');
+ $db->query($query, $params);
+ $current_bid_id = $db->lastInsertId();
+ if (defined('TrackUserIPs'))
+ {
+ // log auction BIN IP
+ $system->log('user', 'BIN on Item', $user->user_data['id'], $id);
+ }
+ if ($Auction['bn_only'] == 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET ends = :time, bn_sale = 1, num_bids = num_bids + 1, current_bid = :buy_now, current_bid_id = :current_bid_id WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':buy_now', $Auction['buy_now'], 'float');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = bids + 1";
+ $db->direct_query($query);
+ // so its not over written by the cron
+ $tmpauc = $Auction;
+ include 'cron.php';
+ $Auction = $tmpauc;
+ unset($tmpauc);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET quantity = quantity - :quantity WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':quantity', $qty, 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $db->query($query, $params);
+ // force close if all items sold
+ if (($Auction['quantity'] - $qty) == 0)
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET ends = :time, bn_sale = 1, current_bid = :current_bid, current_bid_id = :current_bid_id, sold = 'y', num_bids = num_bids + 1, closed = 1 WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':current_bid', $Auction['buy_now'], 'int');
+ $params[] = array(':current_bid_id', $current_bid_id, 'int');
+ $db->query($query, $params);
+ }
+ // do stuff that is important
+ $query = "SELECT id, name, nick, email, address, city, prov, zip, country FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $Winner = $db->result();
+ $bf_paid = 1;
+ $ff_paid = 1;
- // work out & add fee
- if ($system->SETTINGS['fees'] == 'y' && !$user->permissions['no_fees']) {
- $query = "SELECT value, fee_type FROM " . $DBPrefix . "fees WHERE type = 'buyer_fee'";
- $db->direct_query($query);
- $row = $db->result();
- $fee_type = $row['fee_type'];
- if ($row['fee_type'] == 'flat') {
- $fee_value = $row['value'] * $qty;
- } else {
- $fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']) * $qty;
- }
- if ($system->SETTINGS['fee_type'] == 1 || $fee_value <= 0) {
- // add balance & invoice
- $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :user_id";
- $params = array();
- $params[] = array(':fee_value', $fee_value, 'float');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, buyer, total, paid) VALUES
- (:user_id, :auc_id, :buyer, :total, 1)";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':buyer', $fee_value, 'int');
- $params[] = array(':total', $fee_value, 'int');
- $db->query($query, $params);
- } else {
- $bf_paid = 0;
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 6 WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- }
- // do the final value fees
- $query = "SELECT value, fee_type, fee_from, fee_to FROM " . $DBPrefix . "fees WHERE type = 'endauc_fee' ORDER BY value ASC";
- $db->direct_query($query);
- $fee_value = 0;
- while ($row = $db->fetch()) {
- if (floatval($Auction['buy_now']) >= $row['fee_from'] && floatval($Auction['buy_now']) <= $row['fee_to']) {
- if ($row['fee_type'] == 'flat') {
- $fee_value = $row['value'] * $qty;
- } else {
- $fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']) * $qty;
- }
- }
- }
- if ($system->SETTINGS['fee_type'] == 1 || $fee_value <= 0) {
- // add user balance & invoice
- $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :user_id";
- $params = array();
- $params[] = array(':fee_value', $fee_value, 'float');
- $params[] = array(':user_id', $Auction['user'], 'int');
- $db->query($query, $params);
- $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, finalval, total, paid)
- VALUES (:user_id, :auc_id, :finalval, :total, 1)";
- $params = array();
- $params[] = array(':user_id', $Auction['user'], 'int');
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':finalval', $fee_value, 'float');
- $params[] = array(':total', $fee_value, 'float');
- $db->query($query, $params);
- } else {
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 5 WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $Auction['user'], 'int');
- $db->query($query, $params);
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'ID' => $Auction['id'],
- 'TITLE' => htmlspecialchars($Auction['title']),
- 'NAME' => $Seller['name'],
- 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=7&auction_id=' . $Auction['id']
- ));
- $emailer->email_uid = $Auction['user'];
- $emailer->email_sender($Seller['email'], 'final_value_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['523']);
- $ff_paid = 0;
- }
- }
- // check if you have made a bin order already, see if we can merge the orders
- $new_winner = true;
- if ($Auction['bn_only'] == 1) {
- $query = "SELECT id, qty FROM " . $DBPrefix . "winners WHERE auction = :auc_id AND winner = :winner_id AND bid = :buy_now AND paid = 0 AND shipped = 0";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $params[] = array(':buy_now', $Auction['buy_now'], 'float');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $winner_data = $db->result();
- $winner_id = $winner_data['id'];
- $new_qty = $winner_data['qty'] + $qty;
- $query = "UPDATE " . $DBPrefix . "winners SET qty = :quantity, auc_shipping_cost = :auc_shipping_cost WHERE id = :winner_id";
- $params = array();
- $params[] = array(':quantity', $new_qty, 'int');
- $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction, $new_qty), 'float');
- $params[] = array(':winner_id', $winner_id, 'str');
- $db->query($query, $params);
- $new_winner = false;
- }
- }
- // work out shipping cost
- if ($new_winner) {
- $query = "INSERT INTO " . $DBPrefix . "winners
- (auction, seller, winner, bid, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
- (:auc_id, :seller_id, :winner_id, :buy_now, 0, 0, :quantity, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':seller_id', $Auction['user'], 'int');
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $params[] = array(':buy_now', $Auction['buy_now'], 'float');
- $params[] = array(':quantity', $qty, 'int');
- $params[] = array(':bf_paid', $bf_paid, 'float');
- $params[] = array(':ff_paid', $ff_paid, 'float');
- $params[] = array(':auc_title', $Auction['title'], 'str');
- $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction, $qty), 'float');
- $params[] = array(':auc_payment', $Auction['payment'], 'str');
- $db->query($query, $params);
- $winner_id = $db->lastInsertId();
- }
+ // work out & add fee
+ if ($system->SETTINGS['fees'] == 'y')
+ {
+ $query = "SELECT value, fee_type FROM " . $DBPrefix . "fees WHERE type = 'buyer_fee'";
+ $db->direct_query($query);
+ $row = $db->result();
+ $fee_type = $row['fee_type'];
+ if ($row['fee_type'] == 'flat')
+ {
+ $fee_value = $row['value'] * $qty;
+ }
+ else
+ {
+ $fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']) * $qty;
+ }
+ if ($system->SETTINGS['fee_type'] == 1 || $fee_value <= 0)
+ {
+ // add balance & invoice
+ $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':fee_value', $fee_value, 'float');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, date, buyer, total, paid) VALUES
+ (:user_id, :auc_id, :time, :buyer, :total, 1)";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':buyer', $fee_value, 'int');
+ $params[] = array(':total', $fee_value, 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $bf_paid = 0;
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 6 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ }
+ // do the final value fees
+ $query = "SELECT value, fee_type, fee_from, fee_to FROM " . $DBPrefix . "fees WHERE type = 'endauc_fee' ORDER BY value ASC";
+ $db->direct_query($query);
+ $fee_value = 0;
+ while ($row = $db->fetch())
+ {
+ if (floatval($Auction['buy_now']) >= $row['fee_from'] && floatval($Auction['buy_now']) <= $row['fee_to'])
+ {
+ if ($row['fee_type'] == 'flat')
+ {
+ $fee_value = $row['value'] * $qty;
+ }
+ else
+ {
+ $fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']) * $qty;
+ }
+ }
+ }
+ if ($system->SETTINGS['fee_type'] == 1 || $fee_value <= 0)
+ {
+ // add user balance & invoice
+ $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':fee_value', $fee_value, 'float');
+ $params[] = array(':user_id', $Auction['user'], 'int');
+ $db->query($query, $params);
+ $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, date, finalval, total, paid) VALUES
+ (:user_id, :auc_id, :time, :finalval, :total, 1)";
+ $params = array();
+ $params[] = array(':user_id', $Auction['user'], 'int');
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':finalval', $fee_value, 'float');
+ $params[] = array(':total', $fee_value, 'float');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 5 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $Auction['user'], 'int');
+ $db->query($query, $params);
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'ID' => $Auction['id'],
+ 'TITLE' => htmlspecialchars($Auction['title']),
+ 'NAME' => $Seller['name'],
+ 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=7&auction_id=' . $Auction['id']
+ ));
+ $emailer->email_uid = $Auction['user'];
+ $emailer->email_sender($Seller['email'], 'final_value_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['523']);
+ $ff_paid = 0;
+ }
+ }
+ // check if you have made a bin order already, see if we can merge the orders
+ $new_winner = true;
+ if ($Auction['bn_only'] == 1)
+ {
+ $query = "SELECT id, qty FROM " . $DBPrefix . "winners WHERE auction = :auc_id AND winner = :winner_id AND bid = :buy_now AND paid = 0 AND shipped = 0";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $params[] = array(':buy_now', $Auction['buy_now'], 'float');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $winner_data = $db->result();
+ $winner_id = $winner_data['id'];
+ $new_qty = $winner_data['qty'] + $qty;
+ $query = "UPDATE " . $DBPrefix . "winners SET qty = :quantity, auc_shipping_cost = :auc_shipping_cost WHERE id = :winner_id";
+ $params = array();
+ $params[] = array(':quantity', $new_qty, 'int');
+ $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction, $new_qty), 'float');
+ $params[] = array(':winner_id', $winner_id, 'str');
+ $db->query($query, $params);
+ $new_winner = false;
+ }
+ }
+ // work out shipping cost
+ if ($new_winner)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "winners
+ (auction, seller, winner, bid, closingdate, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
+ (:auc_id, :seller_id, :winner_id, :buy_now, :time, 0, 0, :quantity, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
+ $params = array();
+ $params[] = array(':auc_id', $id, 'int');
+ $params[] = array(':seller_id', $Auction['user'], 'int');
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $params[] = array(':buy_now', $Auction['buy_now'], 'float');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':quantity', $qty, 'int');
+ $params[] = array(':bf_paid', $bf_paid, 'float');
+ $params[] = array(':ff_paid', $ff_paid, 'float');
+ $params[] = array(':auc_title', $Auction['title'], 'str');
+ $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction, $qty), 'float');
+ $params[] = array(':auc_payment', $Auction['payment'], 'str');
+ $db->query($query, $params);
+ $winner_id = $db->lastInsertId();
+ }
- // get end string
- $ends_string = $dt->printDateTz($Auction['ends']);
- $Auction['current_bid'] = $Auction['buy_now'];
- include INCLUDE_PATH . 'email/endauction_multi_item_win.php';
- include INCLUDE_PATH . 'email/seller_partial_winner.php';
+ // get end string
+ $month = date('m', $Auction['ends'] + $system->tdiff);
+ $ends_string = $MSG['MON_0' . $month] . ' ' . date('d, Y H:i', $Auction['ends'] + $system->tdiff);
+ $Auction['current_bid'] = $Auction['buy_now'];
+ include INCLUDE_PATH . 'email/endauction_multi_item_win.php';
+ include INCLUDE_PATH . 'email/seller_partial_winner.php';
- if ($system->SETTINGS['fees'] == 'y' && !$user->permissions['no_fees'] && $system->SETTINGS['fee_type'] == 2 && $fee_value > 0) {
- $_SESSION['auction_id'] = $id;
- header('location: pay.php?a=6');
- exit;
- }
+ if ($system->SETTINGS['fees'] == 'y' && $system->SETTINGS['fee_type'] == 2 && $fee > 0)
+ {
+ $_SESSION['auction_id'] = $id;
+ header('location: pay.php?a=6');
+ exit;
+ }
- if ($Auction['initial_quantity'] == 1 || ($Auction['quantity'] - $qty) == 0) {
- $tmpauc = $Auction;
- include 'cron.php';
- $Auction = $tmpauc;
- unset($tmpauc);
- }
- }
+ if ($Auction['initial_quantity'] == 1 || ($Auction['quantity'] - $qty) == 0)
+ {
+ $tmpauc = $Auction;
+ include 'cron.php';
+ $Auction = $tmpauc;
+ unset($tmpauc);
+ }
+ }
- $buy_done = 1;
- }
+ $buy_done = 1;
+ }
}
$additional_shipping = $Auction['additional_shipping_cost'] * ($qty - 1);
@@ -324,26 +383,26 @@
$BN_total = ($Auction['buy_now'] * $qty) + $shipping_cost;
$template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'ID' => $_REQUEST['id'],
- 'WINID' => (isset($winner_id)) ? $winner_id : 0,
- 'TITLE' => htmlspecialchars($Auction['title']),
- 'BN_PRICE' => $system->print_money($Auction['buy_now']),
- 'SHIPPINGCOST' => ($shipping_cost > 0) ? $system->print_money($shipping_cost) : 0,
- 'BN_TOTAL' => $system->print_money($BN_total),
- 'SELLER' => ' ' . $Seller['nick'] . ' ',
- 'SELLERNUMFBS' => '(' . $Seller['rate_sum'] . ') ',
- 'FB_ICON' => $feedback_icon,
- 'LEFT' => $Auction['quantity'],
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'ID' => $_REQUEST['id'],
+ 'WINID' => (isset($winner_id)) ? $winner_id : 0,
+ 'TITLE' => htmlspecialchars($Auction['title']),
+ 'BN_PRICE' => $system->print_money($Auction['buy_now']),
+ 'SHIPPINGCOST' => ($shipping_cost > 0) ? $system->print_money($shipping_cost) : 0,
+ 'BN_TOTAL' => $system->print_money($BN_total),
+ 'SELLER' => ' ' . $Seller['nick'] . ' ',
+ 'SELLERNUMFBS' => '(' . $total_rate . ') ',
+ 'FBICON' => $TPL_rate_radio,
+ 'LEFT' => $Auction['quantity'],
- 'B_QTY' => ($Auction['quantity'] > 1),
- 'B_NOTBOUGHT' => ($buy_done != 1),
- 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
- ));
+ 'B_QTY' => ($Auction['quantity'] > 1),
+ 'B_NOTBOUGHT' => ($buy_done != 1),
+ 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'buy_now.tpl'
- ));
+ 'body' => 'buy_now.tpl'
+ ));
$template->display('body');
require('footer.php');
diff --git a/buying.php b/buying.php
old mode 100644
new mode 100755
index e8db91b42..e15e0bee7
--- a/buying.php
+++ b/buying.php
@@ -1,6 +1,6 @@
logged_in) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'buying.php';
- header('location: user_login.php');
- exit;
+if (!$user->logged_in)
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'buying.php';
+ header('location: user_login.php');
+ exit;
}
// the user has received the item
-if (isset($_GET['shipped'])) {
- $query = "UPDATE " . $DBPrefix . "winners SET shipped = 2 WHERE id = :get_shipped AND winner = :user_id";
- $params[] = array(':get_shipped', $_GET['shipped'], 'int');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
+if (isset($_GET['shipped']))
+{
+ $query = "UPDATE " . $DBPrefix . "winners SET shipped = 2 WHERE id = :get_shipped AND winner = :user_id";
+ $params[] = array(':get_shipped', $_GET['shipped'], 'int');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
}
@@ -42,17 +44,20 @@
$db->query($query, $params);
$TOTALAUCTIONS = $db->result('COUNT');
-if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE'])) {
- $OFFSET = 0;
- $PAGE = 1;
-} else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE']))
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+}
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
$PAGES = ($TOTALAUCTIONS == 0) ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
// Get closed auctions with winners
-$query = "SELECT DISTINCT a.id, a.qty, a.seller, a.paid, a.feedback_win, a.bid, a.auction, a.shipped, a.closingdate, b.title, b.ends, b.shipping_cost, b.additional_shipping_cost, b.shipping, u.nick, u.email
+$query = "SELECT DISTINCT a.id, a.qty, a.seller, a.paid, a.feedback_win, a.bid, a.auction, a.shipped, b.title, b.ends, b.shipping_cost, b.additional_shipping_cost, b.shipping, u.nick, u.email
FROM " . $DBPrefix . "winners a
LEFT JOIN " . $DBPrefix . "auctions b ON (a.auction = b.id)
LEFT JOIN " . $DBPrefix . "users u ON (u.id = a.seller)
@@ -65,58 +70,59 @@
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
$db->query($query, $params);
-while ($row = $db->fetch()) {
- $totalcost = ($row['qty'] > 1) ? ($row['bid'] * $row['qty']) : $row['bid'];
- $additional_shipping = $row['additional_shipping_cost'] * ($row['qty'] - 1);
- $totalcost = ($row['shipping'] == 2) ? $totalcost : ($totalcost + $row['shipping_cost'] + $additional_shipping);
+while ($row = $db->fetch())
+{
+ $totalcost = ($row['qty'] > 1) ? ($row['bid'] * $row['qty']) : $row['bid'];
+ $additional_shipping = $row['additional_shipping_cost'] * ($row['qty'] - 1);
+ $totalcost = ($row['shipping'] == 2) ? $totalcost : ($totalcost + $row['shipping_cost'] + $additional_shipping);
- $template->assign_block_vars('items', array(
- 'AUC_ID' => $row['auction'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'ID' => $row['id'],
- 'ENDS' => $dt->formatDate($row['ends']),
- 'BID' => $row['bid'],
- 'FBID' => $system->print_money($row['bid']),
- 'QTY' => ($row['qty'] > 0) ? $row['qty'] : 1,
- 'TOTAL' => $system->print_money($totalcost),
- 'B_PAID' => ($row['paid'] == 1),
- 'SHIPPED' => $row['shipped'],
+ $template->assign_block_vars('items', array(
+ 'AUC_ID' => $row['auction'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'ID' => $row['id'],
+ 'ENDS' => FormatDate($row['ends']),
+ 'BID' => $row['bid'],
+ 'FBID' => $system->print_money($row['bid']),
+ 'QTY' => ($row['qty'] > 0) ? $row['qty'] : 1,
+ 'TOTAL' => $system->print_money($totalcost),
+ 'B_PAID' => ($row['paid'] == 1),
+ 'SHIPPED' => $row['shipped'],
- 'SELLNICK' => $row['nick'],
- 'SELLEMAIL' => $row['email'],
- 'FB_LINK' => ($row['feedback_win'] == 0) ? '' . $MSG['207'] . ' ' : ''
- ));
+ 'SELLNICK' => $row['nick'],
+ 'SELLEMAIL' => $row['email'],
+ 'FB_LINK' => ($row['feedback_win'] == 0) ? '' . $MSG['207'] . ' ' : ''
+ ));
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$template->assign_vars(array(
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES,
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES,
));
include 'header.php';
$TMP_usmenutitle = $MSG['454'];
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'buying.tpl'
- ));
+ 'body' => 'buying.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/leave_feedback.php b/buysellnofeedback.php
old mode 100644
new mode 100755
similarity index 55%
rename from leave_feedback.php
rename to buysellnofeedback.php
index db575f742..c13c5485c
--- a/leave_feedback.php
+++ b/buysellnofeedback.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'leave_feedback.php';
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'buysellnofeedback.php';
+ header('location: user_login.php');
+ exit;
}
$query = "SELECT DISTINCT a.auction, a.seller, a.winner, a.bid, b.id, b.current_bid, b.title, a.qty, a.closingdate
@@ -33,40 +34,48 @@
$params[] = array(':user_idw', $user->user_data['id'], 'int');
$db->query($query, $params);
+$k = 0;
$feedback_data = $db->fetchall();
-foreach ($feedback_data as $row) {
- $them = ($row['winner'] == $user->user_data['id']) ? $row['seller'] : $row['winner'];
- // Get details
- $query = "SELECT u.nick, u.email
+foreach ($feedback_data as $row)
+{
+ $them = ($row['winner'] == $user->user_data['id']) ? $row['seller'] : $row['winner'];
+ // Get details
+ $query = "SELECT u.nick, u.email
FROM " . $DBPrefix . "users u
WHERE u.id = :them";
- $params = array();
- $params[] = array(':them', $them, 'int');
- $db->query($query, $params);
- $info = $db->result();
+ $params = array();
+ $params[] = array(':them', $them, 'int');
+ $db->query($query, $params);
+ $info = $db->result();
- $template->assign_block_vars('fbs', array(
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'WINORSELLNICK' => $info['nick'],
- 'WINORSELL' => ($row['winner'] == $user->user_data['id']) ? $MSG['25_0002'] : $MSG['25_0001'],
- 'WINORSELLEMAIL' => $info['email'],
- 'BID' => $row['bid'],
- 'BIDFORM' => $system->print_money($row['bid']),
- 'QTY' => ($row['qty'] == 0) ? 1 : $row['qty'],
- 'WINNER' => $row['winner'],
- 'SELLER' => $row['seller'],
- 'CLOSINGDATE' => $dt->formatDate($row['closingdate']),
- 'WS' => ($row['winner'] == $user->user_data['id']) ? 'w' : 's'
- ));
+ $template->assign_block_vars('fbs', array(
+ 'ID' => $row['id'],
+ 'ROWCOLOUR' => ($k % 2) ? 'bgcolor="#FFFEEE"' : '',
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'WINORSELLNICK' => $info['nick'],
+ 'WINORSELL' => ($row['winner'] == $user->user_data['id']) ? $MSG['25_0002'] : $MSG['25_0001'],
+ 'WINORSELLEMAIL' => $info['email'],
+ 'BID' => $row['bid'],
+ 'BIDFORM' => $system->print_money($row['bid']),
+ 'QTY' => ($row['qty'] == 0) ? 1 : $row['qty'],
+ 'WINNER' => $row['winner'],
+ 'SELLER' => $row['seller'],
+ 'CLOSINGDATE' => FormatDate($row['closingdate'], '/', false),
+ 'WS' => ($row['winner'] == $user->user_data['id']) ? 'w' : 's'
+ ));
+ $k++;
}
+$template->assign_vars(array(
+ 'NUM_AUCTIONS' => $k
+ ));
+
$TPL_rater_nick = $user->user_data['nick'];
include 'header.php';
$TMP_usmenutitle = $MSG['207'];
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'leave_feedback.tpl'
- ));
+ 'body' => 'sellbuyfeedback.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/cache/index.php b/cache/index.php
old mode 100644
new mode 100755
diff --git a/calendar.html b/calendar.html
new file mode 100755
index 000000000..5416d35a1
--- /dev/null
+++ b/calendar.html
@@ -0,0 +1,152 @@
+
+
+
+Select Date, Please.
+
+
+
+
+
+
+
diff --git a/clickthrough.php b/clickthrough.php
old mode 100644
new mode 100755
index a8f9c0648..0d198b0ac
--- a/clickthrough.php
+++ b/clickthrough.php
@@ -1,6 +1,6 @@
checkUserValid($user_id);
-} elseif ($user->logged_in) {
- $user_id = $user->user_data['id'];
-} else {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'closed_auctions.php';
- header('location: user_login.php');
- exit;
+if (!empty($_GET['user_id']))
+{
+ $user_id = intval($_GET['user_id']);
+ // check trying to access valid user id
+ $user->checkUserValid($user_id);
+}
+elseif ($user->logged_in)
+{
+ $user_id = $user->user_data['id'];
+}
+else
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'closed_auctions.php';
+ header('location: user_login.php');
+ exit;
}
// get number of closed auctions for this user
@@ -37,17 +42,18 @@
$TOTALAUCTIONS = $db->result('auctions');
// Handle pagination
-if (!isset($_GET['PAGE']) || $_GET['PAGE'] == 1 || $_GET['PAGE'] == '') {
- $OFFSET = 0;
- $PAGE = 1;
-} else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == 1 || $_GET['PAGE'] == '')
+{
+ $OFFSET = 0;
+ $PAGE = 1;
}
-$PAGES = ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
-if ($PAGES < 1) {
- $PAGES = 1;
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
+$PAGES = ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']);
+if ($PAGES < 1) $PAGES = 1;
$query = "SELECT * FROM " . $DBPrefix . "auctions
WHERE user = :user_id
@@ -60,47 +66,54 @@
$db->query($query, $params);
$auction_data = $db->fetchall();
-foreach ($auction_data as $row) {
- $bid = $row['current_bid'];
- $starting_price = $row['current_bid'];
-
- if (strlen($row['pict_url']) > 0) {
- $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'];
- } else {
- $row['pict_url'] = get_lang_img('nopicture.gif');
- }
-
- // number of bids for this auction
- $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :user_id";
- $params = array();
- $params[] = array(':user_id', $row['id'], 'int');
- $db->query($query, $params);
- $num_bids = $db->numrows();
-
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
-
- $template->assign_block_vars('auctions', array(
- 'BGCOLOUR' => (!($TOTALAUCTIONS % 2)) ? '' : 'class="alt-row"',
- 'ID' => $row['id'],
- 'PIC_URL' => $row['pict_url'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'BNIMG' => get_lang_img(($row['bn_only'] == 0) ? 'buy_it_now.gif' : 'bn_only.png'),
- 'BNVALUE' => $row['buy_now'],
- 'BNFORMAT' => $system->print_money($row['buy_now']),
- 'BIDVALUE' => $row['minimum_bid'],
- 'BIDFORMAT' => $system->print_money($row['minimum_bid']),
- 'NUM_BIDS' => $num_bids,
- 'TIMELEFT' => $difference->format('%a') . ' ' . $MSG['126'],
-
- 'B_BUY_NOW' => ($row['buy_now'] > 0 && ($row['bn_only'] || $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])))),
- 'B_BNONLY' => ($row['bn_only'])
- ));
+foreach ($auction_data as $row)
+{
+ $bid = $row['current_bid'];
+ $starting_price = $row['current_bid'];
+
+ if (strlen($row['pict_url']) > 0)
+ {
+ $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url'];
+ }
+ else
+ {
+ $row['pict_url'] = get_lang_img('nopicture.gif');
+ }
+
+ // number of bids for this auction
+ $query_ = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $row['id'], 'int');
+ $db->query($query, $params);
+ $num_bids = $db->numrows();
+
+ $difference = time() - $row['ends'];
+ $days_difference = intval($difference / 86400);
+ $difference = $difference - ($days_difference * 86400);
+
+ if (intval($difference / 3600) > 12) $days_difference++;
+
+ $template->assign_block_vars('auctions', array(
+ 'BGCOLOUR' => (!($TOTALAUCTIONS % 2)) ? '' : 'class="alt-row"',
+ 'ID' => $row['id'],
+ 'PIC_URL' => $row['pict_url'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'BNIMG' => get_lang_img(($row['bn_only'] == 0) ? 'buy_it_now.gif' : 'bn_only.png'),
+ 'BNVALUE' => $row['buy_now'],
+ 'BNFORMAT' => $system->print_money($row['buy_now']),
+ 'BIDVALUE' => $row['minimum_bid'],
+ 'BIDFORMAT' => $system->print_money($row['minimum_bid']),
+ 'NUM_BIDS' => $num_bids,
+ 'TIMELEFT' => $days_difference . ' ' . $MSG['126a'],
+
+ 'B_BUY_NOW' => ($row['buy_now'] > 0 && ($row['bn_only'] || $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])))),
+ 'B_BNONLY' => ($row['bn_only'])
+ ));
}
-if ($TOTALAUCTIONS == 0) {
- $template->assign_block_vars('no_auctions', array());
+if ($TOTALAUCTIONS == 0)
+{
+ $template->assign_block_vars('no_auctions', array());
}
// get this user's nick
@@ -111,38 +124,40 @@
$TPL_user_nick = $db->result('nick');
$LOW = $PAGE - 5;
-if ($LOW <= 0) {
- $LOW = 1;
-}
+if ($LOW <= 0) $LOW = 1;
$COUNTER = $LOW;
$pagenation = '';
-while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- if ($PAGE == $COUNTER) {
- $pagenation .= '' . $COUNTER . ' ';
- } else {
- $pagenation .= '' . $COUNTER . ' ';
- }
- $COUNTER++;
+while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+{
+ if ($PAGE == $COUNTER)
+ {
+ $pagenation .= '' . $COUNTER . ' ';
+ }
+ else
+ {
+ $pagenation .= '' . $COUNTER . ' ';
+ }
+ $COUNTER++;
}
$template->assign_vars(array(
- 'B_MULPAG' => ($PAGES > 1),
- 'B_NOTLAST' => ($PAGE < $PAGES),
- 'B_NOTFIRST' => ($PAGE > 1),
-
- 'USER_ID' => $user_id,
- 'USERNAME' => $TPL_user_nick,
- 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
- 'NEXT' => intval($PAGE + 1),
- 'PREV' => intval($PAGE - 1),
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES,
- 'PAGENA' => $pagenation
- ));
+ 'B_MULPAG' => ($PAGES > 1),
+ 'B_NOTLAST' => ($PAGE < $PAGES),
+ 'B_NOTFIRST' => ($PAGE > 1),
+
+ 'USER_ID' => $user_id,
+ 'USERNAME' => $TPL_user_nick,
+ 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
+ 'NEXT' => intval($PAGE + 1),
+ 'PREV' => intval($PAGE - 1),
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES,
+ 'PAGENA' => $pagenation
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'auctions_closed.tpl'
- ));
+ 'body' => 'auctions_closed.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/common.php b/common.php
old mode 100644
new mode 100755
index 093a37ec6..4dd170f8d
--- a/common.php
+++ b/common.php
@@ -1,7 +1,7 @@
connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix);
}
-$db->direct_query("SET time_zone = '+0:00'");
+
+include_once(MODELS_DIR.'categories.models.php');
+include_once(MODELS_DIR.'auctions.models.php');
+include_once(MODELS_DIR.'bids.models.php');
$system = new global_class();
$template = new Template();
$user = new User();
include INCLUDE_PATH . 'messages.inc.php';
$system->loadAuctionTypes();
-if (!(defined('WeBidDebug') && WeBidDebug)) {
- $error_reporting = E_ALL^E_NOTICE;
-} else {
- $error_reporting = E_ALL;
-}
set_error_handler('WeBidErrorHandler', $error_reporting);
-if ($user->logged_in) {
- $system->tdiff = $system->getUserOffset(time(), $user->user_data['timezone']);
- $system->ctime = $system->getUserTimestamp(time(), $user->user_data['timezone']) + $system->tdiff;
+if($user->logged_in)
+{
+ $system->tdiff = $system->getUserOffset(time(), $user->user_data['timezone']);
+ $system->ctime = $system->getUserTimestamp(time(), $user->user_data['timezone']) + $system->tdiff;
}
-$dt = new Date($system, $user);
// delete REDIRECT_AFTER_LOGIN value automatically so you are never forwarded to an old page
-if (isset($_SESSION['REDIRECT_AFTER_LOGIN']) && !defined('AtLogin')) {
- unset($_SESSION['REDIRECT_AFTER_LOGIN']);
+if(isset($_SESSION['REDIRECT_AFTER_LOGIN']) && !defined('AtLogin'))
+{
+ unset($_SESSION['REDIRECT_AFTER_LOGIN']);
}
$template->set_template();
diff --git a/confirm.php b/confirm.php
old mode 100644
new mode 100755
index a8eb61315..97dcfec5e
--- a/confirm.php
+++ b/confirm.php
@@ -1,6 +1,6 @@
query($query, $params);
- $user_data = $db->result();
-
- if ($db->numrows() == 0) {
- $errmsg = $ERR_025;
- } elseif (!isset($_GET['hash']) || md5($MD5_PREFIX . $user_data['hash']) != $_GET['hash']) {
- $errmsg = $ERR_033;
- } elseif ($user_data['suspended'] == 0) {
- $errmsg = $ERR_039;
- } elseif ($user_data['suspended'] == 2) {
- $errmsg = $ERR_039;
- }
-
- if (isset($errmsg)) {
- $page = 'error';
- } else {
- $page = 'confirm';
- }
+if (isset($_GET['id']) && isset($_GET['hash']) && !isset($_POST['action']))
+{
+ $query = "SELECT suspended, hash FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_GET['id'], 'int');
+ $db->query($query, $params);
+ $user_data = $db->result();
+
+ if ($db->numrows() == 0)
+ {
+ $errmsg = $ERR_025;
+ }
+ elseif (!isset($_GET['hash']) || md5($MD5_PREFIX . $user_data['hash']) != $_GET['hash'])
+ {
+ $errmsg = $ERR_033;
+ }
+ elseif ($user_data['suspended'] == 0)
+ {
+ $errmsg = $ERR_039;
+ }
+ elseif ($user_data['suspended'] == 2)
+ {
+ $errmsg = $ERR_039;
+ }
+
+ if (isset($errmsg))
+ {
+ $page = 'error';
+ }
+ else
+ {
+ $page = 'confirm';
+ }
}
-if (!isset($_GET['id']) && !isset($_POST['action'])) {
- $errmsg = $ERR_025;
- $page = 'error';
+if (!isset($_GET['id']) && !isset($_POST['action']))
+{
+ $errmsg = $ERR_025;
+ $page = 'error';
}
-if (isset($_POST['action']) && $_POST['action'] == "Confirm") {
- $query = "SELECT hash FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
- $user_data = $db->result();
-
- if (md5($MD5_PREFIX . $user_data['hash']) == $_POST['hash']) {
- // User wants to confirm his/her registration
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE id = :user_id AND suspended = 8";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
-
- $query = "UPDATE " . $DBPrefix . "counters SET users = users + 1, inactiveusers = inactiveusers - 1";
- $db->direct_query($query);
-
- // login user
- $query = "SELECT id, hash, password FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $login_data = $db->result();
- $password = $login_data['password'];
- $_SESSION['WEBID_LOGGED_IN'] = $login_data['id'];
- $_SESSION['WEBID_LOGGED_NUMBER'] = strspn($password, $login_data['hash']);
- $_SESSION['WEBID_LOGGED_PASS'] = $password;
-
- // Update "last login" fields in users table
- $query = "UPDATE " . $DBPrefix . "users SET lastlogin = CURRENT_TIMESTAMP WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
- $db->query($query, $params);
-
- $query = "SELECT id FROM " . $DBPrefix . "usersips WHERE USER = :user_id AND ip = :ip";
- $params = array();
- $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
- $params[] = array(':ip', $_SERVER['REMOTE_ADDR'], 'str');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "usersips (user, ip, type, action)
- VALUES (:user_id, :ip, 'confirm', 'accept')";
- $params = array();
- $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
- $params[] = array(':ip', $_SERVER['REMOTE_ADDR'], 'str');
- $db->query($query, $params);
- }
- }
-
- $page = 'confirmed';
- } else {
- $errmsg = $ERR_033;
- $page = 'error';
- }
+if (isset($_POST['action']) && $_POST['action'] == "Confirm")
+{
+ $query = "SELECT hash FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ $user_data = $db->result();
+
+ if (md5($MD5_PREFIX . $user_data['hash']) == $_POST['hash'])
+ {
+ // User wants to confirm his/her registration
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 0 WHERE id = :user_id AND suspended = 8";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+
+ $query = "UPDATE " . $DBPrefix . "counters SET users = users + 1, inactiveusers = inactiveusers - 1";
+ $db->direct_query($query);
+
+ // login user
+ $query = "SELECT id, hash, password FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $login_data = $db->result();
+ $password = $login_data['password'];
+ $_SESSION['WEBID_LOGGED_IN'] = $login_data['id'];
+ $_SESSION['WEBID_LOGGED_NUMBER'] = strspn($password, $login_data['hash']);
+ $_SESSION['WEBID_LOGGED_PASS'] = $password;
+
+ // Update "last login" fields in users table
+ $query = "UPDATE " . $DBPrefix . "users SET lastlogin = :lastlogin WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':lastlogin', date("Y-m-d H:i:s"), 'str');
+ $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
+ $db->query($query, $params);
+
+ $query = "SELECT id FROM " . $DBPrefix . "usersips WHERE USER = :user_id AND ip = :ip";
+ $params = array();
+ $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
+ $params[] = array(':ip', $_SERVER['REMOTE_ADDR'], 'str');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "usersips VALUES
+ (NULL, :user_id, :ip, 'after', 'accept')";
+ $params = array();
+ $params[] = array(':user_id', $_SESSION['WEBID_LOGGED_IN'], 'int');
+ $params[] = array(':ip', $_SERVER['REMOTE_ADDR'], 'str');
+ $db->query($query, $params);
+ }
+ }
+
+ $page = 'confirmed';
+ }
+ else
+ {
+ $errmsg = $ERR_033;
+ $page = 'error';
+ }
}
-if (isset($_POST['action']) && $_POST['action'] == "Refuse") {
- $query = "SELECT hash FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
- if (md5($MD5_PREFIX . $db->result('hash')) == $_POST['hash']) {
- // User doesn't want to confirm the registration
- $query = "DELETE FROM " . $DBPrefix . "users WHERE id = :user_id AND suspended = 8";
- $params = array();
- $params[] = array(':user_id', $_POST['id'], 'int');
- $db->query($query, $params);
-
- $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - 1";
- $db->direct_query($query);
- $page = 'refused';
- } else {
- $errmsg = $ERR_033;
- $page = 'error';
- }
+if (isset($_POST['action']) && $_POST['action'] == "Refuse")
+{
+ $query = "SELECT hash FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+ if (md5($MD5_PREFIX . $db->result('hash')) == $_POST['hash'])
+ {
+ // User doesn't want to confirm the registration
+ $query = "DELETE FROM " . $DBPrefix . "users WHERE id = :user_id AND suspended = 8";
+ $params = array();
+ $params[] = array(':user_id', $_POST['id'], 'int');
+ $db->query($query, $params);
+
+ $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - 1";
+ $db->direct_query($query);
+ $page = 'refused';
+ }
+ else
+ {
+ $errmsg = $ERR_033;
+ $page = 'error';
+ }
}
$template->assign_vars(array(
- 'ERROR' => (isset($errmsg)) ? $errmsg : '',
- 'USERID' => (isset($_GET['id'])) ? $_GET['id'] : '',
- 'HASH' => (isset($_GET['hash'])) ? $_GET['hash'] : '',
- 'PAGE' => $page
- ));
+ 'ERROR' => (isset($errmsg)) ? $errmsg : '',
+ 'USERID' => (isset($_GET['id'])) ? $_GET['id'] : '',
+ 'HASH' => (isset($_GET['hash'])) ? $_GET['hash'] : '',
+ 'PAGE' => $page
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'confirm.tpl'
- ));
+ 'body' => 'confirm.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/contents.php b/contents.php
old mode 100644
new mode 100755
index 926d60a13..d530b9150
--- a/contents.php
+++ b/contents.php
@@ -1,6 +1,6 @@
SETTINGS['termstext'];
- break;
- case 'priv':
- $TITLE = $MSG['401'];
- $CONTENT = $system->SETTINGS['privacypolicytext'];
- break;
- case 'cookies':
- $TITLE = $MSG['cookie_policy'];
- $CONTENT = $system->SETTINGS['cookiespolicytext'];
- break;
- default:
- case 'aboutus':
- $TITLE = $MSG['5085'];
- $CONTENT = $system->SETTINGS['aboutustext'];
- break;
+switch ($_GET['show'])
+{
+ case 'aboutus':
+ $TITLE = $MSG['5085'];
+ $CONTENT = $system->SETTINGS['aboutustext'];
+ break;
+ case 'terms':
+ $TITLE = $MSG['5086'];
+ $CONTENT = $system->SETTINGS['termstext'];
+ break;
+ case 'priv':
+ $TITLE = $MSG['401'];
+ $CONTENT = $system->SETTINGS['privacypolicytext'];
+ break;
+ case 'cookies':
+ $TITLE = $MSG['1110'];
+ $CONTENT = $system->SETTINGS['cookiespolicytext'];
+ break;
}
$template->assign_vars(array(
- 'TITLE' => $TITLE,
- 'CONTENT' => $CONTENT
- ));
+ 'TITLE' => $TITLE,
+ 'CONTENT' => $CONTENT
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'contents.tpl'
- ));
+ 'body' => 'contents.tpl'
+ ));
$template->display('body');
-include 'footer.php';
+include 'footer.php';
\ No newline at end of file
diff --git a/cron.php b/cron.php
old mode 100644
new mode 100755
index 8faaa0e77..4348e7cf5
--- a/cron.php
+++ b/cron.php
@@ -1,6 +1,6 @@
direct_query($query);
- $row = $db->result();
- $buyer_fee = (isset($row['value'])) ? $row['value'] : 0;
- $buyer_fee_type = (isset($row['fee_type'])) ? $row['fee_type'] : 'flat';
+$query = "SELECT value, fee_type FROM " . $DBPrefix . "fees WHERE type = 'buyer_fee'";
+$db->direct_query($query);
+$row = $db->result();
+$buyer_fee = (isset($row['value'])) ? $row['value'] : 0;
+$buyer_fee_type = (isset($row['fee_type'])) ? $row['fee_type'] : 'flat';
// get closed auction fee
- $query = "SELECT * FROM " . $DBPrefix . "fees WHERE type = 'endauc_fee' ORDER BY value ASC";
- $db->direct_query($query);
- $endauc_fee = array();
- while ($row = $db->fetch()) {
- $endauc_fee[] = $row;
- }
+$query = "SELECT * FROM " . $DBPrefix . "fees WHERE type = 'endauc_fee' ORDER BY value ASC";
+$db->direct_query($query);
+$endauc_fee = array();
+while($row = $db->fetch())
+{
+ $endauc_fee[] = $row;
+}
// get a list of all ended auctions
- $query = "SELECT a.*, u.email, u.endemailmode, u.nick, u.payment_details, u.name, u.groups
+$query = "SELECT a.*, u.email, u.endemailmode, u.nick, u.payment_details, u.name
FROM " . $DBPrefix . "auctions a
LEFT JOIN " . $DBPrefix . "users u ON (a.user = u.id)
- WHERE a.ends <= CURRENT_TIMESTAMP
+ WHERE a.ends <= :time
AND ((a.closed = 0)
OR (a.closed = 1
AND a.reserve_price > 0
AND a.num_bids > 0
AND a.current_bid < a.reserve_price
AND a.sold = 's'))";
- $db->direct_query($query);
-
- $count_auctions = $num = $db->numrows();
- printLog($num . ' auctions to close');
-
- $n = 1;
- $auction_data = $db->fetchall();
- foreach ($auction_data as $Auction) { // loop auctions
- $n++;
- $report_text = '';
- printLog("\n" . 'Processing auction: ' . $Auction['id']);
- $Auction['description'] = strip_tags($Auction['description']);
-
- // Send notification to all users watching this auction
- sendWatchEmails($Auction['id'], $Auction['title']);
-
- // set seller array
- $Seller = array(
- 'id' => $Auction['user'],
- 'email' => $Auction['email'],
- 'endemailmode' => $Auction['endemailmode'],
- 'nick' => $Auction['nick'],
- 'payment_details' => $Auction['payment_details'],
- 'name' => $Auction['name'],
- 'groups' => $Auction['groups']
- );
-
- // get an order list of bids of the item (high to low)
- $winner_present = false;
- $query = "SELECT u.* FROM " . $DBPrefix . "bids b
+$params = array();
+$params[] = array(':time', $NOW, 'int');
+$db->query($query, $params);
+
+$count_auctions = $num = $db->numrows();
+printLog($num . ' auctions to close');
+
+$n = 1;
+$auction_data = $db->fetchall();
+foreach ($auction_data as $Auction) // loop auctions
+{
+ $n++;
+ $report_text = '';
+ printLog("\n" . 'Processing auction: ' . $Auction['id']);
+ $Auction['description'] = strip_tags($Auction['description']);
+
+ // Send notification to all users watching this auction
+ sendWatchEmails($Auction['id']);
+
+ // set seller array
+ $Seller = array(
+ 'id' => $Auction['user'],
+ 'email' => $Auction['email'],
+ 'endemailmode' => $Auction['endemailmode'],
+ 'nick' => $Auction['nick'],
+ 'payment_details' => $Auction['payment_details'],
+ 'name' => $Auction['name']);
+
+ // get an order list of bids of the item (high to low)
+ $winner_present = false;
+ $query = "SELECT u.* FROM " . $DBPrefix . "bids b
LEFT JOIN " . $DBPrefix . "users u ON (b.bidder = u.id)
WHERE auction = :auc_id ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- $num_bids = $db->numrows();
-
- // send email to seller - to notify him
- // create a "report" to seller depending of what kind auction is
- // Standard auction
- if ($Auction['auction_type'] == 1) {
- if ($num_bids > 0 && ($Auction['current_bid'] >= $Auction['reserve_price'] || $Auction['sold'] == 's')) {
- $Winner = $db->result();
- $Winner['quantity'] = $Auction['quantity'];
- $WINNING_BID = $Auction['current_bid'];
- $winner_present = true;
- }
-
- if ($winner_present && $Auction['bn_only'] == 0) {
- $report_text = $Winner['nick'] . "\n";
- if ($system->SETTINGS['users_email'] == 'n') {
- $report_text .= ' (' . $Winner['email'] . ' )' . "\n";
- }
- if ($Winner['address'] != '') {
- $report_text .= $MSG['30_0086'] . $Winner['address'] . ' ' . $Winner['city'] . ' ' . $Winner['prov'] . ' ' . $Winner['zip'] . ', ' . $Winner['country'];
- }
- $bf_paid = 1; // buyer fee payed?
- $ff_paid = 1; // auction end fee payed?
- // work out & add fee
- if ($system->SETTINGS['fees'] == 'y') {
- sortFees();
- }
-
- // Add winner's data to "winners" table
- $query = "INSERT INTO " . $DBPrefix . "winners
- (auction, seller, winner, bid, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
- (:auc_id, :seller_id, :winner_id, :current_bid, 0, 0, 1, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $params[] = array(':current_bid', $Auction['current_bid'], 'float');
- $params[] = array(':bf_paid', $bf_paid, 'int');
- $params[] = array(':ff_paid', $ff_paid, 'int');
- $params[] = array(':auc_title', $Auction['title'], 'str');
- $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction), 'float');
- $params[] = array(':auc_payment', $Auction['payment'], 'str');
- $db->query($query, $params);
- } elseif ($winner_present && $Auction['bn_only']) {
- $query = "SELECT b.bidder, b.quantity, u.nick, u.email, u.name, u.address, u.city, u.zip, u.prov, u.country
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ $num_bids = $db->numrows();
+
+ // send email to seller - to notify him
+ // create a "report" to seller depending of what kind auction is
+ $atype = intval($Auction['auction_type']);
+ // Standard auction
+ if ($atype == 1)
+ {
+ if ($num_bids > 0 && ($Auction['current_bid'] >= $Auction['reserve_price'] || $Auction['sold'] == 's'))
+ {
+ $Winner = $db->result();
+ $Winner['quantity'] = $Auction['quantity'];
+ $WINNING_BID = $Auction['current_bid'];
+ $winner_present = true;
+ }
+
+ if ($winner_present && $Auction['bn_only'] == 0)
+ {
+ $report_text = $Winner['nick'] . "\n";
+ if ($system->SETTINGS['users_email'] == 'n')
+ {
+ $report_text .= ' (' . $Winner['email'] . ' )' . "\n";
+ }
+ if ($Winner['address'] != '')
+ {
+ $report_text .= $MSG['30_0086'] . $Winner['address'] . ' ' . $Winner['city'] . ' ' . $Winner['prov'] . ' ' . $Winner['zip'] . ', ' . $Winner['country'];
+ }
+ $bf_paid = 1; // buyer fee payed?
+ $ff_paid = 1; // auction end fee payed?
+ // work out & add fee
+ if ($system->SETTINGS['fees'] == 'y')
+ {
+ sortFees();
+ }
+
+ // Add winner's data to "winners" table
+ $query = "INSERT INTO " . $DBPrefix . "winners
+ (auction, seller, winner, bid, closingdate, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
+ (:auc_id, :seller_id, :winner_id, :current_bid, :time, 0, 0, 1, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':current_bid', $Auction['current_bid'], 'float');
+ $params[] = array(':bf_paid', $bf_paid, 'int');
+ $params[] = array(':ff_paid', $ff_paid, 'int');
+ $params[] = array(':auc_title', $Auction['title'], 'str');
+ $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction), 'float');
+ $params[] = array(':auc_payment', $Auction['payment'], 'str');
+ $db->query($query, $params);
+ }
+ else if ($winner_present && $Auction['bn_only'])
+ {
+ $query = "SELECT b.bidder, b.quantity, u.nick, u.email, u.name, u.address, u.city, u.zip, u.prov, u.country
FROM " . $DBPrefix . "bids b
LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
WHERE b.auction = :auc_id
ORDER BY b.bid DESC, b.bidwhen ASC, b.id DESC";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
-
- $WINNERS_ID = array();
- $winner_array = array();
- $bid_data = $db->fetchall();
- foreach ($bid_data as $row) {
- $Winner = array(
- 'id' => $row['bidder'],
- 'nick' => $row['nick'],
- 'email' => $row['email'],
- 'name' => $row['name'],
- 'address' => $row['address'],
- 'city' => $row['city'],
- 'zip' => $row['zip'],
- 'prov' => $row['prov'],
- 'country' => $row['country']);
- // set arrays
- $WINNERS_ID[] = $row['bidder'];
- $Winner['maxbid'] = $Auction['buy_now'];
- $items_got = $row['quantity'];
- $winner_array[] = $Winner; // set array ready for emails
- $report_text .= ' ' . $MSG['131'] . ' ' . $Winner['nick'];
- if ($system->SETTINGS['users_email'] != 'n') {
- $report_text .= ' (' . $Winner['email'] . ')';
- }
- $report_text .= ' ' . $MSG['5492'] . ' ' . $items_got . " \n";
- $report_text .= ' ' . $MSG['30_0086'] . $Winner['address'] . ' ' . $Winner['city'] . ' ' . $Winner['country'] . " \n\n";
- }
- } else {
- $report_text = $MSG['429'];
- }
- } // Dutch Auction
- elseif ($Auction['auction_type'] == 2) {
- // find out winners sorted by bid
- $query = "SELECT *, MAX(bid) AS maxbid
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+
+ $WINNERS_ID = array();
+ $winner_array = array();
+ $bid_data = $db->fetchall();
+ foreach ($bid_data as $row)
+ {
+ $Winner = array(
+ 'id' => $row['bidder'],
+ 'nick' => $row['nick'],
+ 'email' => $row['email'],
+ 'name' => $row['name'],
+ 'address' => $row['address'],
+ 'city' => $row['city'],
+ 'zip' => $row['zip'],
+ 'prov' => $row['prov'],
+ 'country' => $row['country']);
+ // set arrays
+ $WINNERS_ID[] = $row['bidder'];
+ $Winner['maxbid'] = $Auction['buy_now'];
+ $items_got = $row['quantity'];
+ $winner_array[] = $Winner; // set array ready for emails
+ $report_text .= ' ' . $MSG['131'] . ' ' . $Winner['nick'];
+ if ($system->SETTINGS['users_email'] != 'n')
+ {
+ $report_text .= ' (' . $Winner['email'] . ')';
+ }
+ $report_text .= ' ' . $MSG['5492'] . ' ' . $items_got . " \n";
+ $report_text .= ' ' . $MSG['30_0086'] . $Winner['address'] .' ' . $Winner['city'] . ' '.$Winner['country'] ." \n\n";
+ }
+ }
+ else
+ {
+ $report_text = $MSG['429'];
+ }
+ }
+ // Dutch Auction
+ elseif ($atype == 2)
+ {
+ // find out winners sorted by bid
+ $query = "SELECT *, MAX(bid) AS maxbid
FROM " . $DBPrefix . "bids WHERE auction = :auc_id GROUP BY bidder
ORDER BY maxbid DESC, quantity DESC, id DESC";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
-
- $num_bids = $num_bids + $db->numrows();
- $WINNERS_ID = array();
- $winner_array = array();
- $items_count = $Auction['quantity'];
- $items_sold = 0;
- $bidder_data = $db->fetchall(); // load every bid
- foreach ($bidder_data as $row) {
- if (!in_array($row['bidder'], $WINNERS_ID)) {
- $winner_present = true;
- $items_wanted = $row['quantity'];
- $items_got = 0;
- if ($items_wanted <= $items_count) {
- $items_got = $items_wanted;
- } else {
- $items_got = $items_count;
- }
- $items_count -= $items_got;
- $items_sold += $items_got;
-
- // Retrieve winner nick from the database
- $query = "SELECT id, nick, email, name, address, city, zip, prov, country
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+
+ $num_bids = $num_bids + $db->numrows();
+ $WINNERS_ID = array();
+ $winner_array = array();
+ $items_count = $Auction['quantity'];
+ $items_sold = 0;
+ $bidder_data = $db->fetchall(); // load every bid
+ foreach ($bidder_data as $row)
+ {
+ if (!in_array($row['bidder'], $WINNERS_ID))
+ {
+ $winner_present = true;
+ $items_wanted = $row['quantity'];
+ $items_got = 0;
+ if ($items_wanted <= $items_count)
+ {
+ $items_got = $items_wanted;
+ }
+ else
+ {
+ $items_got = $items_count;
+ }
+ $items_count -= $items_got;
+ $items_sold += $items_got;
+
+ // Retrieve winner nick from the database
+ $query = "SELECT id, nick, email, name, address, city, zip, prov, country
FROM " . $DBPrefix . "users WHERE id = :bidder LIMIT 1";
- $params = array();
- $params[] = array(':bidder', $row['bidder'], 'int');
- $db->query($query, $params);
- $Winner = $db->result();
- // set arrays
- $WINNERS_ID[] = $row['bidder'];
- $Winner['maxbid'] = $row['maxbid'];
- $Winner['quantity'] = $items_got;
- $Winner['wanted'] = $items_wanted;
- $winner_array[] = $Winner; // set array ready for emails
- $report_text .= ' ' . $MSG['159'] . ' ' . $Winner['nick'];
- if ($system->SETTINGS['users_email'] == 'n') {
- $report_text .= ' (' . $Winner['email'] . ')';
- }
- $report_text .= ' ' . $items_got . ' ' . $MSG['5492'] . ', ' . $MSG['5493'] . ' ' . $system->print_money($row['bid']) . ' ' . $MSG['5495'] . ' - (' . $MSG['5494'] . ' ' . $items_wanted . ' ' . $MSG['5492'] . ')' . "\n";
- $report_text .= ' ' . $MSG['30_0086'] . $ADDRESS . "\n";
-
- $bf_paid = 1;
- $ff_paid = 1;
- // work out & add fee
- if ($system->SETTINGS['fees'] == 'y') {
- sortFees();
- }
-
- // Add winner's data to "winners" table
- $query = "INSERT INTO " . $DBPrefix . "winners
- (auction, seller, winner, bid, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
- (:auc_id, :seller_id, :winner_id, :current_bid, 0, 0, :items_got, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $params[] = array(':winner_id', $row['bidder'], 'int');
- $params[] = array(':items_got', $items_got, 'int');
- $params[] = array(':current_bid', $row['maxbid'], 'float');
- $params[] = array(':bf_paid', $bf_paid, 'int');
- $params[] = array(':ff_paid', $ff_paid, 'int');
- $params[] = array(':auc_title', $Auction['title'], 'str');
- $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction), 'float');
- $params[] = array(':auc_payment', $Auction['payment'], 'str');
- $db->query($query, $params);
- }
- if ($items_count == 0) {
- break;
- }
- }
- } // end auction ends
- printLogL('mail to seller: ' . $Seller['email'], 1);
-
- $ends_string = $dt->printDateTz($Auction['ends']);
-
- $close_auction = true;
- // deal with the automatic relists find which auctions are to be relisted
- if ($Auction['relist'] > 0 && ($Auction['relist'] - $Auction['relisted']) > 0 && $Auction['suspended'] == 0) {
- $query = "SELECT id FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- $_BIDSNUM = $db->numrows();
-
- // noone won the auction so remove bids and start it again
- if ($_BIDSNUM == 0 || ($_BIDSNUM > 0 && $Auction['reserve_price'] > 0 && !$winner_present)) {
- // Calculate end time
- $start_date = new DateTime('now', $dt->UTCtimezone);
- $start_date->add(new DateInterval('P' . intval($Auction['duration']) . 'D'));
- $auction_ends = $start_date->format('Y-m-d H:i:s');
-
- $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- $query = "UPDATE " . $DBPrefix . "auctions SET starts = CURRENT_TIMESTAMP, ends = :ends,
+ $params = array();
+ $params[] = array(':bidder', $row['bidder'], 'int');
+ $db->query($query, $params);
+ $Winner = $db->result();
+ // set arrays
+ $WINNERS_ID[] = $row['bidder'];
+ $Winner['maxbid'] = $row['maxbid'];
+ $Winner['quantity'] = $items_got;
+ $Winner['wanted'] = $items_wanted;
+ $winner_array[] = $Winner; // set array ready for emails
+ $report_text .= ' ' . $MSG['159'] . ' ' . $Winner['nick'];
+ if ($system->SETTINGS['users_email'] == 'n')
+ {
+ $report_text .= ' (' . $Winner['email'] . ')';
+ }
+ $report_text .= ' ' . $items_got . ' ' . $MSG['5492'] . ', ' . $MSG['5493'] . ' ' . $system->print_money($row['bid']) . ' ' . $MSG['5495'] . ' - (' . $MSG['5494'] . ' ' . $items_wanted . ' ' . $MSG['5492'] . ')' . "\n";
+ $report_text .= ' ' . $MSG['30_0086'] . $ADDRESS . "\n";
+
+ $bf_paid = 1;
+ $ff_paid = 1;
+ // work out & add fee
+ if ($system->SETTINGS['fees'] == 'y')
+ {
+ sortFees();
+ }
+
+ // Add winner's data to "winners" table
+ $query = "INSERT INTO " . $DBPrefix . "winners
+ (auction, seller, winner, bid, closingdate, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES
+ (:auc_id, :seller_id, :winner_id, :current_bid, :time, 0, 0, :items_got, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $params[] = array(':winner_id', $row['bidder'], 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':items_got', $items_got, 'int');
+ $params[] = array(':current_bid', $row['maxbid'], 'float');
+ $params[] = array(':bf_paid', $bf_paid, 'int');
+ $params[] = array(':ff_paid', $ff_paid, 'int');
+ $params[] = array(':auc_title', $Auction['title'], 'str');
+ $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction), 'float');
+ $params[] = array(':auc_payment', $Auction['payment'], 'str');
+ $db->query($query, $params);
+ }
+ if ($items_count == 0)
+ {
+ break;
+ }
+ }
+ } // end auction ends
+ printLogL ('mail to seller: ' . $Seller['email'], 1);
+
+ $month = date('m', $Auction['ends'] + $system->tdiff);
+ $ends_string = $MSG['MON_0' . $month] . ' ' . date('d, Y H:i', $Auction['ends'] + $system->tdiff);
+
+ $close_auction = true;
+ // deal with the automatic relists find which auctions are to be relisted
+ if ($Auction['relist'] > 0 && ($Auction['relist'] - $Auction['relisted']) > 0 && $Auction['suspended'] == 0)
+ {
+ $query = "SELECT id FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ $_BIDSNUM = $db->numrows();
+
+ // noone won the auction so remove bids and start it again
+ if ($_BIDSNUM == 0 || ($_BIDSNUM > 0 && $Auction['reserve_price'] > 0 && !$winner_present))
+ {
+ // Calculate end time
+ $_ENDS = $NOW + ($Auction['duration'] * 24 * 60 * 60);
+
+ $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ $query = "UPDATE " . $DBPrefix . "auctions SET starts = :time, ends = :ends,
current_bid = 0, num_bids = 0, relisted = relisted + 1 WHERE id = :auc_id";
- $params = array();
- $params[] = array(':ends', $auction_ends, 'str');
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- $close_auction = false;
- $count_auctions--;
- }
- }
-
- if ($Auction['suspended'] != 0) {
- $count_auctions--;
- }
-
- if ($close_auction) {
- // update category tables
- $cat_id = $Auction['category'];
- $root_cat = $cat_id;
- $second_cat = false;
- while ($cat_id != -1 && isset($categories[$cat_id])) {
- // update counter for this category
- $R_counter = intval($categories[$cat_id]['counter']) - 1;
- $R_sub_counter = intval($categories[$cat_id]['sub_counter']) - 1;
- if ($cat_id == $root_cat) {
- --$R_counter;
- }
- if ($R_counter < 0) {
- $R_counter = 0;
- }
- if ($R_sub_counter < 0) {
- $R_sub_counter = 0;
- }
- $categories[$cat_id]['counter'] = $R_counter;
- $categories[$cat_id]['sub_counter'] = $R_sub_counter;
- $categories[$cat_id]['updated'] = true;
- if ($cat_id == $categories[$cat_id]['parent_id']) { // incase something messes up
- break;
- }
- $cat_id = $categories[$cat_id]['parent_id'];
-
- if (!$second_cat && !($cat_id != -1 && isset($categories[$cat_id])) && $system->SETTINGS['extra_cat'] == 'y' && $Auction['secondcat'] != 0) {
- $second_cat = true;
- $cat_id = $Auction['secondcat'];
- $root_cat = $cat_id;
- }
- }
-
- // Close auction
- if ($Auction['sold'] != 's' and $Auction['num_bids'] > 0 and $Auction['reserve_price'] > 0 and $Auction['current_bid'] < $Auction['reserve_price']) {
- $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = :auc_id";
- } else {
- $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = :auc_id";
- }
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- }
-
- if ($winner_present) {
- if ($Auction['bn_only'] == 0 && $Auction['auction_type'] != 2) {
- // Send mail to the seller
- $added_winner_names = array();
- if (is_array($Winner)) {
- // Send mail to the buyer
- $added_winner_names[] = $Winner['nick'] . ' (' . $Winner['email'] . ' )';
- include INCLUDE_PATH . 'email/endauction_youwin_nodutch.php';
- }
- if ($Seller['endemailmode'] !== 'cum') {
- include INCLUDE_PATH . 'email/endauction_winner.php';
- } else {
- // Add in the database to send later as cumulitave email to seller
- $added_winner_names_cs = implode(", ", $added_winner_names);
- $query = "INSERT INTO " . $DBPrefix . "pendingnotif (auction_id, seller_id, winners, auction, seller)
- VALUES (:auc_id, :seller_id, :winner_names, :auc_data, :seller_data)";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $params[] = array(':winner_names', $added_winner_names_cs, 'str');
- $params[] = array(':auc_data', serialize($Auction), 'str');
- $params[] = array(':seller_data', serialize($Seller), 'str');
- $db->query($query, $params);
- }
- } // elseif bn_only == y
- else {
- // emails for buyers already sent in buy_now.php
- // email to seller for partial items already sent in buy_now.php
- // prepare to send auction closed to seller
- // retreive buyers
- if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0) {
- $added_winner_names = array();
- foreach ($winner_array as $key => $value) {
- if ($Auction['auction_type'] == 2) {
- // Send mail to the buyer
- $Winner = $value;
- include INCLUDE_PATH . 'email/endauction_youwin.php';
- }
- $added_winner_names[] = $value['nick'] . ' (' . $value['email'] . ' )';
- }
- $added_winner_names_cs = implode(", ", $added_winner_names);
-
- // Send mail to the seller
- if ($Seller['endemailmode'] != 'cum') {
- $report_text = $added_winner_names_cs;
- include INCLUDE_PATH . 'email/seller_end_buynowonly.php';
- } else {
- // Add in the database to send later as cumulitave email to seller
- $query = "INSERT INTO " . $DBPrefix . "pendingnotif (auction_id, seller_id, winners, auction, seller)
- VALUES (:auc_id, :seller_id, :winner_names, :auc_data, :seller_data)";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $params[] = array(':winner_names', $added_winner_names_cs, 'str');
- $params[] = array(':auc_data', serialize($Auction), 'str');
- $params[] = array(':seller_data', serialize($Seller), 'str');
- $db->query($query, $params);
- }
- }
- }
- } else {
- // Send mail to the seller if no winner
- if ($Seller['endemailmode'] != 'cum') {
- include INCLUDE_PATH . 'email/endauction_nowinner.php';
- } else {
- // Save in the database to send later
- $query = "INSERT INTO " . $DBPrefix . "pendingnotif (auction_id, seller_id, winners, auction, seller)
- VALUES (:auc_id, :seller_id, '', :auction_data, :seller_data)";
- $params = array();
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $params[] = array(':seller_id', $Auction['id'], 'int');
- $params[] = array(':auction_data', serialize($Auction), 'str');
- $params[] = array(':seller_data', serialize($Seller), 'str');
- $db->query($query, $params);
- }
- }
- // Update bid counter
- $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids - :num_bids)";
- $params = array();
- $params[] = array(':num_bids', $num_bids, 'int');
- $db->query($query, $params);
- }
-
- $query = "UPDATE " . $DBPrefix . "counters SET auctions = (auctions - :num_aucsa), closedauctions = (closedauctions + :num_aucsb)";
- $params = array();
- $params[] = array(':num_aucsa', $count_auctions, 'int');
- $params[] = array(':num_aucsb', $count_auctions, 'int');
- $db->query($query, $params);
+ $params = array();
+ $params[] = array(':time', $NOW, 'int');
+ $params[] = array(':ends', $_ENDS, 'int');
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ $close_auction = false;
+ $count_auctions--;
+ }
+ }
+
+ if ($Auction['suspended'] != 0)
+ {
+ $count_auctions--;
+ }
+
+ if ($close_auction)
+ {
+ // update category tables
+ $cat_id = $Auction['category'];
+ $root_cat = $cat_id;
+ $second_cat = false;
+ while ($cat_id != -1 && isset($categories[$cat_id]))
+ {
+ // update counter for this category
+ $R_counter = intval($categories[$cat_id]['counter']) - 1;
+ $R_sub_counter = intval($categories[$cat_id]['sub_counter']) - 1;
+ if ($cat_id == $root_cat)
+ --$R_counter;
+ if ($R_counter < 0)
+ $R_counter = 0;
+ if ($R_sub_counter < 0)
+ $R_sub_counter = 0;
+ $categories[$cat_id]['counter'] = $R_counter;
+ $categories[$cat_id]['sub_counter'] = $R_sub_counter;
+ $categories[$cat_id]['updated'] = true;
+ if ($cat_id == $categories[$cat_id]['parent_id']) // incase something messes up
+ break;
+ $cat_id = $categories[$cat_id]['parent_id'];
+
+ if (!$second_cat && !($cat_id != -1 && isset($categories[$cat_id])) && $system->SETTINGS['extra_cat'] == 'y' && $Auction['secondcat'] != 0)
+ {
+ $second_cat = true;
+ $cat_id = $Auction['secondcat'];
+ $root_cat = $cat_id;
+ }
+ }
+
+ // Close auction
+ if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price'])
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = :auc_id";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = :auc_id";
+ }
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $db->query($query, $params);
+ }
+
+ if ($winner_present)
+ {
+ if ($Auction['bn_only'] == 0 && $atype != 2)
+ {
+ // Send mail to the seller
+ $added_winner_names = array();
+ if (is_array($Winner))
+ {
+ // Send mail to the buyer
+ $added_winner_names[] = $Winner['nick'] . ' (' . $Winner['email'] . ' )';
+ include INCLUDE_PATH . 'email/endauction_youwin_nodutch.php';
+ }
+ if ($Seller['endemailmode'] !== 'cum')
+ {
+ include INCLUDE_PATH . 'email/endauction_winner.php';
+ }
+ else
+ {
+ // Add in the database to send later as cumulitave email to seller
+ $added_winner_names_cs = implode(", ", $added_winner_names);
+ $query = "INSERT INTO " . $DBPrefix . "pendingnotif VALUES
+ (NULL, :auc_id, :seller_id, :winner_names, :auc_data, :seller_data, :date)";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $params[] = array(':winner_names', $added_winner_names_cs, 'str');
+ $params[] = array(':auc_data', serialize($Auction), 'str');
+ $params[] = array(':seller_data', serialize($Seller), 'str');
+ $params[] = array(':date', gmdate('Ymd'), 'str');
+ $db->query($query, $params);
+ }
+ }
+ // elseif bn_only == y
+ else
+ {
+ // emails for buyers already sent in buy_now.php
+ // email to seller for partial items already sent in buy_now.php
+ // prepare to send auction closed to seller
+ // retreive buyers
+ if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)
+ {
+ $added_winner_names = array();
+ foreach ($winner_array as $key => $value)
+ {
+ if ($atype == 2)
+ {
+ // Send mail to the buyer
+ $Winner = $value;
+ include INCLUDE_PATH . 'email/endauction_youwin.php';
+ }
+ $added_winner_names[] = $value['nick'] . ' (' . $value['email'] . ' )';
+ }
+ $added_winner_names_cs = implode(", ", $added_winner_names);
+
+ // Send mail to the seller
+ if ($Seller['endemailmode'] != 'cum')
+ {
+ $report_text = $added_winner_names_cs;
+ include INCLUDE_PATH . 'email/seller_end_buynowonly.php';
+ }
+ else
+ {
+ // Add in the database to send later as cumulitave email to seller
+ $query = "INSERT INTO " . $DBPrefix . "pendingnotif VALUES
+ (NULL, :auc_id, :seller_id, :winner_names, :auc_data, :seller_data, :date)";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $params[] = array(':winner_names', $added_winner_names_cs, 'str');
+ $params[] = array(':auc_data', serialize($Auction), 'str');
+ $params[] = array(':seller_data', serialize($Seller), 'str');
+ $params[] = array(':date', gmdate('Ymd'), 'str');
+ $db->query($query, $params);
+ }
+ }
+ }
+ }
+ else
+ {
+ // Send mail to the seller if no winner
+ if ($Seller['endemailmode'] != 'cum')
+ {
+ include INCLUDE_PATH . 'email/endauction_nowinner.php';
+ }
+ else
+ {
+ // Save in the database to send later
+ $query = "INSERT INTO " . $DBPrefix . "pendingnotif VALUES
+ (NULL, :auc_id, :seller_id, '', :auction_data, :seller_data, :date)";
+ $params = array();
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':seller_id', $Auction['id'], 'int');
+ $params[] = array(':auction_data', serialize($Auction), 'str');
+ $params[] = array(':seller_data', serialize($Seller), 'str');
+ $params[] = array(':date', date('Ymd'), 'int');
+ $db->query($query, $params);
+ }
+ }
+ // Update bid counter
+ $query = "UPDATE " . $DBPrefix . "counters SET bids = (bids - :num_bids)";
+ $params = array();
+ $params[] = array(':num_bids', $num_bids, 'int');
+ $db->query($query, $params);
+}
-// TODO needs rewriting
- /*
+$query = "UPDATE " . $DBPrefix . "counters SET auctions = (auctions - :num_aucsa), closedauctions = (closedauctions + :num_aucsb)";
+$params = array();
+$params[] = array(':num_aucsa', $count_auctions, 'int');
+$params[] = array(':num_aucsb', $count_auctions, 'int');
+$db->query($query, $params);
- */
- if (count($categories) > 0) {
- foreach ($categories as $cat_id => $category) {
- if ($category['updated']) {
- $query = "UPDATE " . $DBPrefix . "categories SET
+// TODO needs rewriting
+/*
+
+*/
+if (count($categories) > 0)
+{
+ foreach ($categories as $cat_id => $category)
+ {
+ if ($category['updated'])
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET
counter = :counter,
sub_counter = :sub_counter
WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':counter', $category['counter'], 'int');
- $params[] = array(':sub_counter', $category['sub_counter'], 'int');
- $params[] = array(':cat_id', $cat_id, 'int');
- $db->query($query, $params);
- }
- }
- }
-
- if ($system->SETTINGS['prune_unactivated_users'] == 1) {
- // prune unactivated user accounts
- printLog("\n");
- printLog("++++++ Prune unactivated user accounts");
-
- $query = "SELECT COUNT(id) AS COUNT FROM " . $DBPrefix . "users WHERE reg_date <= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL " . $system->SETTINGS['prune_unactivated_users_days'] . " DAY) AND suspended = 8";
- $db->direct_query($query);
-
- $pruneCount = $db->result('COUNT');
- printLog($pruneCount . " accounts to prune");
- if ($pruneCount > 0) {
- $query = "DELETE FROM " . $DBPrefix . "users WHERE reg_date <= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL " . $system->SETTINGS['prune_unactivated_users_days'] . " DAY) AND suspended = 8";
- $db->direct_query($query);
-
- $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - " . $pruneCount;
- $db->direct_query($query);
- }
- }
+ $params = array();
+ $params[] = array(':counter', $category['counter'], 'int');
+ $params[] = array(':sub_counter', $category['sub_counter'], 'int');
+ $params[] = array(':cat_id', $cat_id, 'int');
+ $db->query($query, $params);
+ }
+ }
+}
+
+if ($system->SETTINGS['prune_unactivated_users'] == 1)
+{
+ // prune unactivated user accounts
+ printLog("\n");
+ printLog("++++++ Prune unactivated user accounts");
+
+ $pruneAccountTime = time() - (60 * 60 * 24 * $system->SETTINGS['prune_unactivated_users_days']);
+
+ $query = "SELECT id FROM " . $DBPrefix . "users WHERE reg_date <= :pruneAccountTime AND suspended = 8";
+ $params = array();
+ $params[] = array(':pruneAccountTime', $pruneAccountTime, 'int');
+ $db->query($query, $params);
+
+ $pruneCount = $db->numrows();
+ printLog($pruneCount . " accounts to prune");
+ if ($pruneCount > 0)
+ {
+ $query = "DELETE FROM " . $DBPrefix . "users WHERE reg_date <= :pruneAccountTime AND suspended = 8";
+ $params = array();
+ $params[] = array(':pruneAccountTime', $pruneAccountTime, 'int');
+ $db->query($query, $params);
+
+ $query = "UPDATE " . $DBPrefix . "counters SET inactiveusers = inactiveusers - " . $pruneCount;
+ $db->direct_query($query);
+ }
+}
// "remove" old auctions (archive them)
- if ($system->SETTINGS['archiveafter'] > 0) {
- printLog("\n");
- printLog("++++++ Archiving old auctions");
-
- $query = "SELECT id FROM " . $DBPrefix . "auctions WHERE ends <= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL " . $system->SETTINGS['archiveafter'] . " DAY)";
- $db->direct_query($query);
-
- $num = $db->numrows();
- printLog($num . " auctions to archive");
- if ($num > 0) {
- $auction_data = $db->fetchall();
- foreach ($auction_data as $AuctionInfo) {
- printLogL("Processing auction: " . $AuctionInfo['id'], 0);
-
- // delete auction
- $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
- $db->query($query, $params);
-
- // delete bids for this auction
- $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
- $db->query($query, $params);
-
- // Delete proxybid entries
- $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
- $db->query($query, $params);
-
- // Delete counter entries
- $query = "DELETE FROM " . $DBPrefix . "auccounter WHERE auction_id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
- $db->query($query, $params);
-
- // Delete all images
- if (is_dir(UPLOAD_PATH . $AuctionInfo['id'])) {
- if ($dir = opendir(UPLOAD_PATH . $AuctionInfo['id'])) {
- while ($file = readdir($dir)) {
- if ($file != '.' && $file != '..') {
- @unlink(UPLOAD_PATH . $AuctionInfo['id'] . '/' . $file);
- }
- }
- closedir($dir);
- rmdir(UPLOAD_PATH . $AuctionInfo['id']);
- }
- }
- }
- }
- }
+printLog("\n");
+printLog("++++++ Archiving old auctions");
+
+$expireAuction = 60 * 60 * 24 * $system->SETTINGS['archiveafter']; // time of auction expiration (in seconds)
+$expiredTime = time() - $expireAuction;
+
+$query = "SELECT id FROM " . $DBPrefix . "auctions WHERE ends <= :expiredTime";
+$params = array();
+$params[] = array(':expiredTime', $expiredTime, 'int');
+$db->query($query, $params);
+
+$num = $db->numrows();
+printLog($num . " auctions to archive");
+if ($num > 0)
+{
+ $auction_data = $db->fetchall();
+ foreach ($auction_data as $AuctionInfo)
+ {
+ printLogL("Processing auction: " . $AuctionInfo['id'], 0);
+
+ // delete auction
+ $query = "DELETE FROM " . $DBPrefix . "auctions WHERE id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
+ $db->query($query, $params);
+
+ // delete bids for this auction
+ $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
+ $db->query($query, $params);
+
+ // Delete proxybid entries
+ $query = "DELETE FROM " . $DBPrefix . "proxybid WHERE itemid = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
+ $db->query($query, $params);
+
+ // Delete counter entries
+ $query = "DELETE FROM " . $DBPrefix . "auccounter WHERE auction_id = :auc_id";
+ $params = array();
+ $params[] = array(':auc_id', $AuctionInfo['id'], 'int');
+ $db->query($query, $params);
+
+ // Delete all images
+ if (is_dir(UPLOAD_PATH . $AuctionInfo['id']))
+ {
+ if ($dir = opendir(UPLOAD_PATH . $AuctionInfo['id']))
+ {
+ while ($file = readdir($dir))
+ {
+ if ($file != '.' && $file != '..')
+ {
+ @unlink(UPLOAD_PATH . $AuctionInfo['id'] . '/' . $file);
+ }
+ }
+ closedir($dir);
+ rmdir(UPLOAD_PATH . $AuctionInfo['id']);
+ }
+ }
+ }
+}
// send cumulative emails
- $query = "SELECT id, name, email FROM " . $DBPrefix . "users WHERE endemailmode = 'cum'";
- $db->direct_query($query);
-
- $user_data = $db->fetchall();
- foreach ($user_data as $row) {
- $query = "SELECT * FROM " . $DBPrefix . "pendingnotif WHERE thisdate < CURRENT_TIMESTAMP AND seller_id = :seller_id";
- $params = array();
- $params[] = array(':seller_id', $row['id'], 'int');
- $db->query($query, $params);
-
- if ($db->numrows() > 0) {
- $pending_data = $db->fetchall();
- $report_winner = 0;
- $report = "";
- $report .= " " . $MSG['BUY_NOW_ONLY_TPL_0100'] . " ";
- $report .= "" . $MSG['168'] . " " . $MSG['453'] . " ";
- foreach ($pending_data as $pending) {
- $Auction = unserialize($pending['auction']);
- $Seller = unserialize($pending['seller']);
- $report .= "" . $Auction['title'] . " (ID: " . $Auction['id'] . ") ";
- if (strlen($pending['winners']) > 0) {
- $report .= "" . $pending['winners'] . " ";
- $report_winner = 1;
- } else {
- $report .= "" . $MSG['1032'] . " ";
- }
- $query = "DELETE FROM " . $DBPrefix . "pendingnotif WHERE id = :pending_id";
- $params = array();
- $params[] = array(':pending_id', $pending['id'], 'int');
- $db->query($query, $params);
- }
- $report .= "
";
- include INCLUDE_PATH . 'email/endauction_cumulative.php';
- }
- }
+$query = "SELECT id, name, email FROM " . $DBPrefix . "users WHERE endemailmode = 'cum'";
+$db->direct_query($query);
+
+$user_data = $db->fetchall();
+foreach ($auction_data as $row)
+{
+ $query = "SELECT * FROM " . $DBPrefix . "pendingnotif WHERE thisdate < :date AND seller_id = :seller_id";
+ $params = array();
+ $params[] = array(':seller_id', $row['id'], 'int');
+ $params[] = array(':date', date('Ymd'), 'int');
+ $db->query($query, $params);
+
+ if ($db->numrows() > 0)
+ {
+ $pending_data = $db->fetchall();
+ $report_winner = 0;
+ $report = "";
+ $report .= " " . $MSG['BUY_NOW_ONLY_TPL_0100'] . " ";
+ $report .= "" . $MSG['168'] . " " . $MSG['453'] . " ";
+ foreach ($pending_data as $pending)
+ {
+ $Auction = unserialize($pending['auction']);
+ $Seller = unserialize($pending['seller']);
+ $report .= "" . $Auction['title'] . " (ID: " . $Auction['id'] . ") ";
+ if(strlen($pending['winners']) > 0)
+ {
+ $report .= "" . $pending['winners'] . " ";
+ $report_winner = 1;
+ }
+ else
+ {
+ $report .= "" . $MSG['1032'] . " ";
+ }
+ $query = "DELETE FROM " . $DBPrefix . "pendingnotif WHERE id = :pending_id";
+ $params = array();
+ $params[] = array(':pending_id', $pending['id'], 'int');
+ $db->query($query, $params);
+ }
+ $report .= "
";
+ include INCLUDE_PATH . 'email/endauction_cumulative.php';
+ }
+}
// send buyer fee emails
- if ($buyer_fee > 0) {
- for ($i = 0; $i < count($buyer_emails); $i++) {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'ID' => $buyer_emails[$i]['id'],
- 'TITLE' => htmlspecialchars($buyer_emails[$i]['title']),
- 'NAME' => $buyer_emails[$i]['name'],
- 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=6&auction_id=' . $Auction['id']
- ));
- $emailer->email_uid = $buyer_emails[$i]['uid'];
- $emailer->email_sender($buyer_emails[$i]['email'], 'buyer_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['522']);
- }
- }
- for ($i = 0; $i < count($seller_emails); $i++) {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'ID' => $seller_emails[$i]['id'],
- 'TITLE' => htmlspecialchars($seller_emails[$i]['title']),
- 'NAME' => $seller_emails[$i]['name'],
- 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=7&auction_id=' . $Auction['id']
- ));
- $emailer->email_uid = $seller_emails[$i]['uid'];
- $emailer->email_sender($seller_emails[$i]['email'], 'final_value_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['523']);
- }
+if ($buyer_fee > 0)
+{
+ for ($i = 0; $i < count($buyer_emails); $i++)
+ {
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'ID' => $buyer_emails[$i]['id'],
+ 'TITLE' => htmlspecialchars($buyer_emails[$i]['title']),
+ 'NAME' => $buyer_emails[$i]['name'],
+ 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=6&auction_id=' . $Auction['id']
+ ));
+ $emailer->email_uid = $buyer_emails[$i]['uid'];
+ $emailer->email_sender($buyer_emails[$i]['email'], 'buyer_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['522']);
+ }
+}
+for ($i = 0; $i < count($seller_emails); $i++)
+{
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'ID' => $seller_emails[$i]['id'],
+ 'TITLE' => htmlspecialchars($seller_emails[$i]['title']),
+ 'NAME' => $seller_emails[$i]['name'],
+ 'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=7&auction_id=' . $Auction['id']
+ ));
+ $emailer->email_uid = $seller_emails[$i]['uid'];
+ $emailer->email_sender($seller_emails[$i]['email'], 'final_value_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['523']);
+}
// Purging thumbnails cache
- if (!file_exists(UPLOAD_PATH . 'cache')) {
- mkdir(UPLOAD_PATH . 'cache', 0777);
- }
-
- if (!file_exists(UPLOAD_PATH . 'cache/purge')) {
- touch(UPLOAD_PATH . 'cache/purge');
- }
-
- $purgecachetime = filectime(UPLOAD_PATH . 'cache/purge');
- if ((time() - $purgecachetime) > 86400) {
- $dir = UPLOAD_PATH . 'cache';
- if ($dh = opendir($dir)) {
- while (($file = readdir($dh)) !== false) {
- if ($file != 'purge' && !is_dir($dir . '/' . $file) && (time() - filectime($dir . '/' . $file)) > 86400) {
- unlink($dir . '/' . $file);
- }
- }
- closedir($dh);
- }
- touch(UPLOAD_PATH . 'cache/purge');
- }
+if (!file_exists(UPLOAD_PATH . 'cache'))
+{
+ mkdir(UPLOAD_PATH . 'cache', 0777);
+}
-// finish cron script
- printLog("=========================== ENDING CRON: " . date('F d, Y H:i:s') . "\n");
- flock($fp, LOCK_UN); // release the lock
+if (!file_exists(UPLOAD_PATH . 'cache/purge'))
+{
+ touch(UPLOAD_PATH . 'cache/purge');
+}
+
+$purgecachetime = filectime(UPLOAD_PATH . 'cache/purge');
+if ((time() - $purgecachetime) > 86400)
+{
+ $dir = UPLOAD_PATH . 'cache';
+ if ($dh = opendir($dir))
+ {
+ while (($file = readdir($dh)) !== false)
+ {
+ if ($file != 'purge' && !is_dir($dir . '/' . $file) && (time() - filectime($dir . '/' . $file)) > 86400)
+ unlink($dir . '/' . $file);
+ }
+ closedir($dh);
+ }
+ touch(UPLOAD_PATH . 'cache/purge');
}
-fclose($fp);
\ No newline at end of file
+// finish cron script
+printLog ("=========================== ENDING CRON: " . date('F d, Y H:i:s') . "\n");
diff --git a/docs/COPYRIGHT b/docs/COPYRIGHT
old mode 100644
new mode 100755
index 70b8b3b66..a2cfd448c
--- a/docs/COPYRIGHT
+++ b/docs/COPYRIGHT
@@ -1,6 +1,6 @@
-- Copyrights --
-WeBid (C) 2008 - 2017 WeBidSupport.com
+WeBid (C) 2008 - 2016 WeBidSupport.com
WeBid contains code from the following packages:
diff --git a/docs/LICENSE b/docs/LICENSE
old mode 100644
new mode 100755
diff --git a/docs/changes.txt b/docs/changes.txt
old mode 100644
new mode 100755
index 760287c71..01b14fd28
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -1 +1,21 @@
-See: http://bugs.webidsupport.com/changelog_page.php
\ No newline at end of file
+1.2.0 - 10/10/13
+-----------------------------
+- Fixed DOB string when user does not have one entered when suspending/activating user account
+- Fix error in install SQL
+- Fixed proxy bidding (Bug #459) (Thanks Bushstar)
+- Fixed toocheckout code
+- Added Serbia to countries list closedrelisted table
+- Added relistall check box to close auctions page (Thanks david62311)
+- Fixed reserve not met Items being incorrectly marked as sold in the database (Bug #464) (Thanks pani100)
+- Fixed shipping fee not being added to cost of item (Bug #454)
+- Fixed link in pay.php to contact seller (Bug #445) (Thanks pani100)
+- Fixed admin invoices view
+- Fixed browse categories header name
+- Added admin warnings for if fees are not set up correctly
+- Added confirmation notices when you do an action in user control panel
+- Moved the add new news button in admin so its visable
+- Fixed buy it now not setting an auction to close if all item have been purchased
+- Cleaned up outstanding page
+- Added option to enable payment sandboxes to test the IPN
+
+for older changes check out http://www.webidsupport.com/wiki/Change_Log
\ No newline at end of file
diff --git a/docs/install.txt b/docs/install.txt
old mode 100644
new mode 100755
index 91c93ced0..ba76b6710
--- a/docs/install.txt
+++ b/docs/install.txt
@@ -128,6 +128,8 @@ The Install.php script included with WeBid will:
NOTE: After install is complete, change config.inc.php to CHMOD 644 (the installer will rename the file).
+ > /includes/membertypes.inc.php 777
+
> /language/EN/categories.inc.php 777
> /language/EN/categories_select_box.inc.php 777
diff --git a/docs/readme.txt b/docs/readme.txt
old mode 100644
new mode 100755
index c00c4f598..49e7f6566
--- a/docs/readme.txt
+++ b/docs/readme.txt
@@ -16,10 +16,11 @@ INSTALLATION
1. Upload all the files except the docs directory
2. CHMOD the uploaded directory to 0644
3. CHMOD the includes/config.inc.php.new to 0777
-4. CHMOD the language/EN/categories.inc.php to 0777
-5. CHMOD the language/EN/categories_select_box.inc.php to 0777
-6. CHMOD the cache directory to 0777
-7. go to http://yoursite/webid/install/install.php and follow the steps
+5. CHMOD the includes/membertypes.inc.php to 0777
+6. CHMOD the language/EN/categories.inc.php to 0777
+7. CHMOD the language/EN/categories_select_box.inc.php to 0777
+8. CHMOD the cache directory to 0777
+9. go to http://yoursite/webid/install/install.php and follow the steps
For a more detailed set of instructions read install.txt
diff --git a/edit_active_auction.php b/edit_active_auction.php
old mode 100644
new mode 100755
index d905bb272..e732dd639
--- a/edit_active_auction.php
+++ b/edit_active_auction.php
@@ -1,7 +1,7 @@
logged_in) {
$_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
$_SESSION['REDIRECT_AFTER_LOGIN'] = 'select_category.php';
@@ -24,125 +26,144 @@
exit;
}
-$query = "SELECT id FROM " . $DBPrefix . "bids WHERE auction = :auc_id";
-$params = array();
-$params[] = array(':auc_id', $id, 'int');
-$db->query($query, $params);
-if ($db->numrows() > 0) {
+if (Bids::ignoreBids($id)) {
header('location: index.php');
exit;
}
-
-if (!isset($_POST['action'])) { // already closed auctions
- // Get Closed auctions data
+/**
+ * already closed auctions
+ */
+if (!isset($_POST['action'])) {
+ /**
+ * Get Closed auctions data
+ */
unset($_SESSION['UPLOADED_PICTURES']);
unset($_SESSION['UPLOADED_PICTURES_SIZE']);
- $query = "SELECT * FROM " . $DBPrefix . "auctions WHERE id = :auc_id AND user = :user_id";
- $params = array();
- $params[] = array(':auc_id', $id, 'int');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $RELISTEDAUCTION = $db->result();
- $difference = strtotime($RELISTEDAUCTION['ends']) - time();
-
- if ($user->user_data['id'] == $RELISTEDAUCTION['user'] && $difference > 0) {
- $_SESSION['SELL_auction_id'] = $RELISTEDAUCTION['id'];
- $_SESSION['SELL_starts'] = $RELISTEDAUCTION['starts'];
- $_SESSION['SELL_ends'] = $RELISTEDAUCTION['ends'];
- $_SESSION['SELL_title'] = htmlspecialchars($RELISTEDAUCTION['title']);
- $_SESSION['SELL_subtitle'] = htmlspecialchars($RELISTEDAUCTION['subtitle']);
- $_SESSION['SELL_description'] = $RELISTEDAUCTION['description'];
- $_SESSION['SELL_atype'] = $RELISTEDAUCTION['auction_type'];
- $_SESSION['SELL_buy_now_only'] = $RELISTEDAUCTION['bn_only'];
- $_SESSION['SELL_suspended'] = $RELISTEDAUCTION['suspended'];
- $_SESSION['SELL_iquantity'] = $RELISTEDAUCTION['quantity'];
- $_SESSION['SELL_is_bold'] = $RELISTEDAUCTION['bold'];
- $_SESSION['SELL_is_highlighted'] = $RELISTEDAUCTION['highlighted'];
- $_SESSION['SELL_is_featured'] = $RELISTEDAUCTION['featured'];
- $_SESSION['SELL_is_taxed'] = $RELISTEDAUCTION['tax'];
- $_SESSION['SELL_tax_included'] = $RELISTEDAUCTION['taxinc'];
- $_SESSION['SELL_current_fee'] = $RELISTEDAUCTION['current_fee'];
- if ($RELISTEDAUCTION['bn_only'] == 0) {
- $_SESSION['SELL_minimum_bid'] = $system->print_money_nosymbol($RELISTEDAUCTION['minimum_bid']);
+
+ $relisted_auction = Auctions::forUserId($id, $user->user_data['id']);
+ $difference = $relisted_auction['ends'] - $now;
+
+ if ($user->user_data['id'] == $relisted_auction['user'] && $difference > 0) {
+ $_SESSION['SELL_auction_id'] = $relisted_auction['id'];
+ $_SESSION['SELL_starts'] = $relisted_auction['starts'] + $system->tdiff;
+ $_SESSION['SELL_ends'] = $relisted_auction['ends'];
+ $_SESSION['SELL_title'] = htmlspecialchars($relisted_auction['title']);
+ $_SESSION['SELL_subtitle'] = htmlspecialchars($relisted_auction['subtitle']);
+ $_SESSION['SELL_description'] = $relisted_auction['description'];
+ $_SESSION['SELL_atype'] = $relisted_auction['auction_type'];
+ $_SESSION['SELL_buy_now_only'] = $relisted_auction['bn_only'];
+ $_SESSION['SELL_suspended'] = $relisted_auction['suspended'];
+ $_SESSION['SELL_iquantity'] = $relisted_auction['quantity'];
+ $_SESSION['SELL_is_bold'] = $relisted_auction['bold'];
+ $_SESSION['SELL_is_highlighted'] = $relisted_auction['highlighted'];
+ $_SESSION['SELL_is_featured'] = $relisted_auction['featured'];
+ $_SESSION['SELL_is_taxed'] = $relisted_auction['tax'];
+ $_SESSION['SELL_tax_included'] = $relisted_auction['taxinc'];
+ $_SESSION['SELL_current_fee'] = $relisted_auction['current_fee'];
+
+ if ($relisted_auction['bn_only'] == 0) {
+ $_SESSION['SELL_minimum_bid'] = $system->print_money_nosymbol($relisted_auction['minimum_bid']);
} else {
$_SESSION['SELL_minimum_bid'] = 0;
}
- if (floatval($RELISTEDAUCTION['reserve_price']) > 0) {
- $_SESSION['SELL_reserve_price'] = $system->print_money_nosymbol($RELISTEDAUCTION['reserve_price']);
- $_SESSION['SELL_with_reserve'] = 'yes';
+ if (floatval($relisted_auction['reserve_price']) > 0) {
+ $_SESSION['SELL_reserve_price'] = $system->print_money_nosymbol($relisted_auction['reserve_price']);
+ $_SESSION['SELL_with_reserve'] = 'yes';
} else {
$_SESSION['SELL_reserve_price'] = '';
- $_SESSION['SELL_with_reserve'] = 'no';
+ $_SESSION['SELL_with_reserve'] = 'no';
}
- $_SESSION['SELL_original_sellcat1'] = $_SESSION['SELL_sellcat1'] = $RELISTEDAUCTION['category'];
- $_SESSION['SELL_original_sellcat2'] = $_SESSION['SELL_sellcat2'] = $RELISTEDAUCTION['secondcat'];
+ $_SESSION['SELL_original_sellcat1'] = $_SESSION['SELL_sellcat1'] = $relisted_auction['category'];
+ $_SESSION['SELL_original_sellcat2'] = $_SESSION['SELL_sellcat2'] = $relisted_auction['secondcat'];
- if (floatval($RELISTEDAUCTION['buy_now']) > 0) {
- $_SESSION['SELL_buy_now_price'] = $system->print_money_nosymbol($RELISTEDAUCTION['buy_now']);
- $_SESSION['SELL_with_buy_now'] = 'yes';
+ if (floatval($relisted_auction['buy_now']) > 0) {
+ $_SESSION['SELL_buy_now_price'] = $system->print_money_nosymbol($relisted_auction['buy_now']);
+ $_SESSION['SELL_with_buy_now'] = 'yes';
} else {
$_SESSION['SELL_buy_now_price'] = '';
- $_SESSION['SELL_with_buy_now'] = 'no';
+ $_SESSION['SELL_with_buy_now'] = 'no';
}
- $_SESSION['SELL_duration'] = $RELISTEDAUCTION['duration'];
- $_SESSION['SELL_relist'] = $RELISTEDAUCTION['relist'];
- if (floatval($RELISTEDAUCTION['increment']) > 0) {
- $_SESSION['SELL_increment'] = 2;
- $_SESSION['SELL_customincrement'] = $system->print_money_nosymbol($RELISTEDAUCTION['increment']);
- } else {
- $_SESSION['SELL_increment'] = 1;
- $_SESSION['SELL_customincrement'] = 0;
+
+ $_SESSION['SELL_duration'] = $relisted_auction['duration'];
+ $_SESSION['SELL_relist'] = $relisted_auction['relist'];
+
+ if (floatval($relisted_auction['increment']) > 0) {
+ $_SESSION['SELL_increment'] = 2;
+ $_SESSION['SELL_customincrement'] = $system->print_money_nosymbol($relisted_auction['increment']);
+ } else {
+ $_SESSION['SELL_increment'] = 1;
+ $_SESSION['SELL_customincrement'] = 0;
}
- $_SESSION['SELL_shipping_cost'] = $system->print_money_nosymbol($RELISTEDAUCTION['shipping_cost']);
- $_SESSION['SELL_additional_shipping_cost'] = $system->print_money_nosymbol($RELISTEDAUCTION['additional_shipping_cost']);
- $_SESSION['SELL_shipping'] = $RELISTEDAUCTION['shipping'];
- $_SESSION['SELL_shipping_terms'] = $RELISTEDAUCTION['shipping_terms'];
- $_SESSION['SELL_payment'] = explode(', ', $RELISTEDAUCTION['payment']);
- $_SESSION['SELL_international'] = $RELISTEDAUCTION['international'];
- $_SESSION['SELL_file_uploaded'] = $RELISTEDAUCTION['photo_uploaded'];
- $_SESSION['SELL_pict_url'] = $RELISTEDAUCTION['pict_url'];
- $_SESSION['SELL_pict_url_temp'] = str_replace('thumb-', '', $RELISTEDAUCTION['pict_url']);
-
- // get gallery images
+
+ $_SESSION['SELL_shipping_cost'] = $system->print_money_nosymbol($relisted_auction['shipping_cost']);
+ $_SESSION['SELL_additional_shipping_cost'] = $system->print_money_nosymbol(
+ $relisted_auction['additional_shipping_cost']
+ );
+ $_SESSION['SELL_shipping'] = $relisted_auction['shipping'];
+ $_SESSION['SELL_shipping_terms'] = $relisted_auction['shipping_terms'];
+ $_SESSION['SELL_payment'] = explode(', ', $relisted_auction['payment']);
+ $_SESSION['SELL_international'] = $relisted_auction['international'];
+ $_SESSION['SELL_file_uploaded'] = $relisted_auction['photo_uploaded'];
+ $_SESSION['SELL_pict_url'] = $relisted_auction['pict_url'];
+ $_SESSION['SELL_pict_url_temp'] = str_replace('thumb-', '', $relisted_auction['pict_url']);
+
+ /**
+ * get gallery images
+ */
$UPLOADED_PICTURES = array();
$file_types = array('gif', 'jpg', 'jpeg', 'png');
+
if (is_dir(UPLOAD_PATH . $id)) {
- $dir = opendir(UPLOAD_PATH . $id);
+ $dir = opendir(UPLOAD_PATH.$id);
while (($myfile = readdir($dir)) !== false) {
- if ($myfile != '.' && $myfile != '..' && !is_file($myfile)) {
+ if ($myfile <> '.' && $myfile != '..' && !is_file($myfile)) {
$file_ext = strtolower(substr($myfile, strrpos($myfile, '.') + 1));
- if (in_array($file_ext, $file_types) && (strstr($RELISTEDAUCTION['pict_url'], 'thumb-') === false || $RELISTEDAUCTION['pict_url'] != $myfile)) {
+ if (in_array(
+ $file_ext,
+ $file_types
+ ) && (strstr(
+ $relisted_auction['pict_url'],
+ 'thumb-'
+ ) === false || $relisted_auction['pict_url'] <> $myfile)) {
$UPLOADED_PICTURES[] = $myfile;
}
}
}
closedir($dir);
}
+
$_SESSION['UPLOADED_PICTURES'] = $UPLOADED_PICTURES;
if (count($UPLOADED_PICTURES) > 0) {
- if (!file_exists(UPLOAD_PATH . session_id())) {
+ if (!file_exists(UPLOAD_PATH.session_id())) {
umask();
- mkdir(UPLOAD_PATH . session_id(), 0777);
+ mkdir(UPLOAD_PATH.session_id(), 0777);
}
foreach ($UPLOADED_PICTURES as $k => $v) {
- $system->move_file(UPLOAD_FOLDER . intval($_GET['id']) . '/' . $v, UPLOAD_FOLDER . session_id() . '/' . $v, false);
+ $system->move_file(
+ UPLOAD_FOLDER.(int)$_GET['id'].'/'.$v,
+ UPLOAD_FOLDER.session_id().'/'.$v,
+ false
+ );
}
- if (!empty($RELISTEDAUCTION['pict_url'])) {
- $system->move_file(UPLOAD_FOLDER . intval($_GET['id']) . '/' . $RELISTEDAUCTION['pict_url'], UPLOAD_FOLDER . session_id() . '/' . $RELISTEDAUCTION['pict_url'], false);
+ if (!empty($relisted_auction['pict_url'])) {
+ $system->move_file(
+ UPLOAD_FOLDER.(int)$_GET['id'].'/'.$relisted_auction['pict_url'],
+ UPLOAD_FOLDER.session_id().'/'.$relisted_auction['pict_url'],
+ false
+ );
}
}
$_SESSION['SELL_action'] = 'edit';
- if (strtotime($RELISTEDAUCTION['starts']) > time()) {
+
+ if ($relisted_auction['starts'] > $now) {
$_SESSION['SELL_caneditstartdate'] = true;
} else {
$_SESSION['SELL_caneditstartdate'] = false;
}
- $_SESSION['SELL_hash'] = md5(microtime() . rand(0, 50));
- $_SESSION['SELL_submitted'][$_SESSION['SELL_hash']] = false;
header('location: sell.php?mode=recall');
} else {
header('location: index.php');
diff --git a/edit_data.php b/edit_data.php
old mode 100644
new mode 100755
index 2753aa1db..f32900bf4
--- a/edit_data.php
+++ b/edit_data.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'edit_data.php';
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'edit_data.php';
+ header('location: user_login.php');
+ exit;
}
// Retrieve users signup settings
@@ -31,55 +32,82 @@
function generateSelect($name, $options, $selectsetting)
{
- $html = '';
- foreach ($options as $option => $value) {
- if ($selectsetting == $option) {
- $html .= '' . $value . ' ';
- } else {
- $html .= '' . $value . ' ';
- }
- }
- $html .= ' ';
- return $html;
+ $html = '';
+ foreach ($options as $option => $value)
+ {
+ if ($selectsetting == $option)
+ {
+ $html .= '' . $value . ' ';
+ }
+ else
+ {
+ $html .= '' . $value . ' ';
+ }
+ }
+ $html .= ' ';
+ return $html;
}
$query = "SELECT * FROM " . $DBPrefix . "payment_options WHERE is_gateway = 1";
$db->direct_query($query);
$gateway_data = $db->fetchAll();
-if (isset($_POST['action']) && $_POST['action'] == 'update') {
- // Check data
- if ($_POST['TPL_email']) {
- if (strlen($_POST['TPL_password']) < 6 && strlen($_POST['TPL_password']) > 0) {
- $ERR = $ERR_011;
- } elseif ($_POST['TPL_password'] != $_POST['TPL_repeat_password']) {
- $ERR = $ERR_109;
- } elseif (strlen($_POST['TPL_email']) < 5) {
- $ERR = $ERR_110;
- } elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['TPL_email'])) {
- $ERR = $ERR_008;
- } elseif (strlen($_POST['TPL_zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y') {
- $ERR = $ERR_616;
- } elseif (strlen($_POST['TPL_phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y') {
- $ERR = $ERR_617;
- } elseif ((empty($_POST['TPL_day']) || empty($_POST['TPL_month']) || empty($_POST['TPL_year'])) && $MANDATORY_FIELDS['birthdate'] == 'y') {
- $ERR = $MSG['948'];
- } elseif (!empty($_POST['TPL_day']) && !empty($_POST['TPL_month']) && !empty($_POST['TPL_year']) && !checkdate($_POST['TPL_month'], $_POST['TPL_day'], $_POST['TPL_year'])) {
- $ERR = $ERR_117;
- }
- foreach ($gateway_data as $gateway) {
- if ($gateway['gateway_required'] == 1 && isset($_POST[$gateway['name']]['address']) && empty($_POST[$gateway['name']]['address'])) {
- $ERR = $error_string[$gateway['name']];
- }
- }
- if (!isset($ERR)) {
- if (!empty($_POST['TPL_day']) && !empty($_POST['TPL_month']) && !empty($_POST['TPL_year'])) {
- $TPL_birthdate = $_POST['TPL_year'] . $_POST['TPL_month'] . $_POST['TPL_day'];
- } else {
- $TPL_birthdate = '';
- }
-
- $query = "UPDATE " . $DBPrefix . "users SET email = :email,
+if (isset($_POST['action']) && $_POST['action'] == 'update')
+{
+ // Check data
+ if ($_POST['TPL_email'])
+ {
+ if (strlen($_POST['TPL_password']) < 6 && strlen($_POST['TPL_password']) > 0)
+ {
+ $ERR = $ERR_011;
+ }
+ elseif ($_POST['TPL_password'] != $_POST['TPL_repeat_password'])
+ {
+ $ERR = $ERR_109;
+ }
+ elseif (strlen($_POST['TPL_email']) < 5)
+ {
+ $ERR = $ERR_110;
+ }
+ elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['TPL_email']))
+ {
+ $ERR = $ERR_008;
+ }
+ elseif (strlen($_POST['TPL_zip']) < 4 && $MANDATORY_FIELDS['zip'] == 'y')
+ {
+ $ERR = $ERR_616;
+ }
+ elseif (strlen($_POST['TPL_phone']) < 3 && $MANDATORY_FIELDS['tel'] == 'y')
+ {
+ $ERR = $ERR_617;
+ }
+ elseif ((empty($_POST['TPL_day']) || empty($_POST['TPL_month']) || empty($_POST['TPL_year'])) && $MANDATORY_FIELDS['birthdate'] == 'y')
+ {
+ $ERR = $MSG['948'];
+ }
+ elseif (!empty($_POST['TPL_day']) && !empty($_POST['TPL_month']) && !empty($_POST['TPL_year']) && !checkdate($_POST['TPL_month'], $_POST['TPL_day'], $_POST['TPL_year']))
+ {
+ $ERR = $ERR_117;
+ }
+ foreach ($gateway_data as $gateway)
+ {
+ if ($gateway['gateway_required'] == 1 && isset($_POST[$gateway['name']]['address']) && empty($_POST[$gateway['name']]['address']))
+ {
+ $ERR = $error_string[$gateway['name']];
+ }
+ }
+ if (!isset($ERR))
+ {
+ if (!empty($_POST['TPL_day']) && !empty($_POST['TPL_month']) && !empty($_POST['TPL_year']))
+ {
+ $TPL_birthdate = $_POST['TPL_year'] . $_POST['TPL_month'] . $_POST['TPL_day'];
+ }
+ else
+ {
+ $TPL_birthdate = '';
+ }
+
+ $query = "UPDATE " . $DBPrefix . "users SET email = :email,
birthdate = :birthdate,
address = :address,
city = :city,
@@ -90,56 +118,64 @@ function generateSelect($name, $options, $selectsetting)
timezone = :timezone,
emailtype = :emailtype,
nletter = :nletter";
- $params = array();
- $params[] = array(':email', $system->cleanvars($_POST['TPL_email']), 'str');
- $params[] = array(':birthdate', ((empty($TPL_birthdate)) ? 0 : $TPL_birthdate), 'int');
- $params[] = array(':address', $system->cleanvars($_POST['TPL_address']), 'str');
- $params[] = array(':city', $system->cleanvars($_POST['TPL_city']), 'str');
- $params[] = array(':prov', $system->cleanvars($_POST['TPL_prov']), 'str');
- $params[] = array(':country', $system->cleanvars($_POST['TPL_country']), 'str');
- $params[] = array(':zip', $system->cleanvars($_POST['TPL_zip']), 'str');
- $params[] = array(':phone', $system->cleanvars($_POST['TPL_phone']), 'str');
- $params[] = array(':timezone', $_POST['TPL_timezone'], 'str');
- $params[] = array(':emailtype', $system->cleanvars($_POST['TPL_emailtype']), 'str');
- $params[] = array(':nletter', intval($_POST['TPL_nletter']), 'int');
-
- if (strlen($_POST['TPL_password']) > 0) {
- // hash the password
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $query .= ", password = :password";
- $params[] = array(':password', $phpass->HashPassword($_POST['TPL_password']), 'str');
- }
-
- $query .= " WHERE id = :user_id";
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
-
- foreach ($gateway_data as $gateway) {
- if (isset($_POST[$gateway['name']]['address']) && !empty($_POST[$gateway['name']]['address'])) {
- $params = array();
- $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "usergateways WHERE gateway_id = :gateway_id AND user_id = :user_id";
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':gateway_id', $gateway['id'], 'int');
- $db->query($query, $params);
- $usergateways = $db->result();
- if ($usergateways['COUNT'] == 0) {
- $query = "INSERT INTO " . $DBPrefix . "usergateways (gateway_id, user_id, address, password) VALUES (:gateway_id, :user_id, :address, :password)";
- } else {
- $query = "UPDATE " . $DBPrefix . "usergateways SET address = :address, password = :password
+ $params = array();
+ $params[] = array(':email', $system->cleanvars($_POST['TPL_email']), 'str');
+ $params[] = array(':birthdate', ((empty($TPL_birthdate)) ? 0 : $TPL_birthdate), 'int');
+ $params[] = array(':address', $system->cleanvars($_POST['TPL_address']), 'str');
+ $params[] = array(':city', $system->cleanvars($_POST['TPL_city']), 'str');
+ $params[] = array(':prov', $system->cleanvars($_POST['TPL_prov']), 'str');
+ $params[] = array(':country', $system->cleanvars($_POST['TPL_country']), 'str');
+ $params[] = array(':zip', $system->cleanvars($_POST['TPL_zip']), 'str');
+ $params[] = array(':phone', $system->cleanvars($_POST['TPL_phone']), 'str');
+ $params[] = array(':timezone', $_POST['TPL_timezone'], 'str');
+ $params[] = array(':emailtype', $system->cleanvars($_POST['TPL_emailtype']), 'str');
+ $params[] = array(':nletter', $system->cleanvars($_POST['TPL_nletter']), 'str');
+
+ if (strlen($_POST['TPL_password']) > 0)
+ {
+ // hash the password
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $query .= ", password = :password";
+ $params[] = array(':password', $phpass->HashPassword($_POST['TPL_password']), 'str');
+ }
+
+ $query .= " WHERE id = :user_id";
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+
+ foreach ($gateway_data as $gateway)
+ {
+ if (isset($_POST[$gateway['name']]['address']) && !empty($_POST[$gateway['name']]['address']))
+ {
+ $params = array();
+ $query = "SELECT COUNT(id) as COUNT FROM " . $DBPrefix . "usergateways WHERE gateway_id = :gateway_id AND user_id = :user_id";
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':gateway_id', $gateway['id'], 'int');
+ $db->query($query, $params);
+ $usergateways = $db->result();
+ if ($usergateways['COUNT'] == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "usergateways (gateway_id, user_id, address, password) VALUES (:gateway_id, :user_id, :address, :password)";
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "usergateways SET address = :address, password = :password
WHERE gateway_id = :gateway_id AND user_id = :user_id";
- }
- $params[] = array(':address', ((isset($_POST[$gateway['name']]['address'])) ? $system->cleanvars($_POST[$gateway['name']]['address']) : ''), 'str');
- $params[] = array(':password', ((isset($_POST[$gateway['name']]['password'])) ? $system->cleanvars($_POST[$gateway['name']]['password']) : ''), 'str');
- $db->query($query, $params);
- }
- }
-
- $ERR = $MSG['183'];
- }
- } else {
- $ERR = $ERR_112;
- }
+ }
+ $params[] = array(':address', ((isset($_POST[$gateway['name']]['address'])) ? $system->cleanvars($_POST[$gateway['name']]['address']) : ''), 'str');
+ $params[] = array(':password', ((isset($_POST[$gateway['name']]['password'])) ? $system->cleanvars($_POST[$gateway['name']]['password']) : ''), 'str');
+ $db->query($query, $params);
+ }
+ }
+
+ $ERR = $MSG['183'];
+ }
+ }
+ else
+ {
+ $ERR = $ERR_112;
+ }
}
// Retrieve user's data
@@ -148,14 +184,17 @@ function generateSelect($name, $options, $selectsetting)
$params[] = array(':user_id', $user->user_data['id'], 'int');
$db->query($query, $params);
$USER = $db->result();
-if ($USER['birthdate'] != 0) {
- $TPL_day = substr($USER['birthdate'], 6, 2);
- $TPL_month = substr($USER['birthdate'], 4, 2);
- $TPL_year = substr($USER['birthdate'], 0, 4);
-} else {
- $TPL_day = '';
- $TPL_month = '';
- $TPL_year = '';
+if ($USER['birthdate'] != 0)
+{
+ $TPL_day = substr($USER['birthdate'], 6, 2);
+ $TPL_month = substr($USER['birthdate'], 4, 2);
+ $TPL_year = substr($USER['birthdate'], 0, 4);
+}
+else
+{
+ $TPL_day = '';
+ $TPL_month = '';
+ $TPL_year = '';
}
$query = "SELECT country_id, country FROM " . $DBPrefix . "countries";
@@ -163,12 +202,14 @@ function generateSelect($name, $options, $selectsetting)
$countries = $db->fetchall();
$country_list = '';
-foreach ($countries as $country) {
- $country_list .= ' ' . "\n";
+foreach($countries as $country)
+{
+ $country_list .= ' ' . "\n";
}
$dobmonth = '
@@ -188,9 +229,10 @@ function generateSelect($name, $options, $selectsetting)
';
$dobday = '
';
-for ($i = 1; $i <= 31; $i++) {
- $j = (strlen($i) == 1) ? '0' . $i : $i;
- $dobday .= '' . $j . ' ';
+for ($i = 1; $i <= 31; $i++)
+{
+ $j = (strlen($i) == 1) ? '0' . $i : $i;
+ $dobday .= '' . $j . ' ';
}
$dobday .= ' ';
@@ -200,51 +242,53 @@ function generateSelect($name, $options, $selectsetting)
$db->direct_query($query);
$gateway_data = $db->fetchAll();
-foreach ($gateway_data as $gateway) {
- if ($gateway['gateway_active'] == 1) {
- $template->assign_block_vars('gateways', array(
- 'GATEWAY_ID' => $gateway['id'],
- 'NAME' => $gateway['displayname'],
- 'PLAIN_NAME' => $gateway['name'],
- 'REQUIRED' => ($gateway['gateway_required'] == 1) ? '*' : '',
- 'ADDRESS' => (!is_null($gateway['address'])) ? $gateway['address'] : '',
- 'PASSWORD' => (!is_null($gateway['password'])) ? $gateway['password'] : '',
- 'ADDRESS_NAME' => isset($address_string[$gateway['name']]) ? $address_string[$gateway['name']] : $gateway['name'],
- 'PASSWORD_NAME' => isset($password_string[$gateway['name']]) ? $password_string[$gateway['name']] : '',
- 'ERROR_STRING' => $error_string[$gateway['name']],
-
- 'B_PASSWORD' => isset($password_string[$gateway['name']])
- ));
- }
+foreach ($gateway_data as $gateway)
+{
+ if ($gateway['gateway_active'] == 1)
+ {
+ $template->assign_block_vars('gateways', array(
+ 'GATEWAY_ID' => $gateway['id'],
+ 'NAME' => $gateway['displayname'],
+ 'PLAIN_NAME' => $gateway['name'],
+ 'REQUIRED' => ($gateway['gateway_required'] == 1) ? '*' : '',
+ 'ADDRESS' => (!is_null($gateway['address'])) ? $gateway['address'] : '',
+ 'PASSWORD' => (!is_null($gateway['password'])) ? $gateway['password'] : '',
+ 'ADDRESS_NAME' => isset($address_string[$gateway['name']]) ? $address_string[$gateway['name']] : $gateway['name'],
+ 'PASSWORD_NAME' => isset($password_string[$gateway['name']]) ? $password_string[$gateway['name']] : '',
+ 'ERROR_STRING' => $error_string[$gateway['name']],
+
+ 'B_PASSWORD' => isset($password_string[$gateway['name']])
+ ));
+ }
}
$template->assign_vars(array(
- 'COUNTRYLIST' => $country_list,
- 'NAME' => $USER['name'],
- 'NICK' => $USER['nick'],
- 'EMAIL' => $USER['email'],
- 'YEAR' => $TPL_year,
- 'ADDRESS' => $USER['address'],
- 'CITY' => $USER['city'],
- 'PROV' => $USER['prov'],
- 'ZIP' => $USER['zip'],
- 'PHONE' => $USER['phone'],
- 'DATEFORMAT' => ($system->SETTINGS['datesformat'] == 'USA') ? $dobmonth . ' ' . $dobday : $dobday . ' ' . $dobmonth,
- 'TIMEZONE' => $time_correction,
-
- 'NLETTER1' => ($USER['nletter'] == 1) ? ' checked="checked"' : '',
- 'NLETTER2' => ($USER['nletter'] == 2) ? ' checked="checked"' : '',
- 'EMAILTYPE1' => ($USER['emailtype'] == 'html') ? ' checked="checked"' : '',
- 'EMAILTYPE2' => ($USER['emailtype'] == 'text') ? ' checked="checked"' : '',
-
- 'B_NEWLETTER' => ($system->SETTINGS['newsletter'] == 1)
- ));
+ 'COUNTRYLIST' => $country_list,
+ 'NAME' => $USER['name'],
+ 'NICK' => $USER['nick'],
+ 'EMAIL' => $USER['email'],
+ 'YEAR' => $TPL_year,
+ 'ADDRESS' => $USER['address'],
+ 'CITY' => $USER['city'],
+ 'PROV' => $USER['prov'],
+ 'ZIP' => $USER['zip'],
+ 'PHONE' => $USER['phone'],
+ 'DATEFORMAT' => ($system->SETTINGS['datesformat'] == 'USA') ? $dobmonth . ' ' . $dobday : $dobday . ' ' . $dobmonth,
+ 'TIMEZONE' => $time_correction,
+
+ 'NLETTER1' => ($USER['nletter'] == 1) ? ' checked="checked"' : '',
+ 'NLETTER2' => ($USER['nletter'] == 2) ? ' checked="checked"' : '',
+ 'EMAILTYPE1' => ($USER['emailtype'] == 'html') ? ' checked="checked"' : '',
+ 'EMAILTYPE2' => ($USER['emailtype'] == 'text') ? ' checked="checked"' : '',
+
+ 'B_NEWLETTER' => ($system->SETTINGS['newsletter'] == 1)
+ ));
$TMP_usmenutitle = $MSG['509'];
include 'header.php';
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'edit_data.tpl'
- ));
+ 'body' => 'edit_data.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/email_request.php b/email_request.php
old mode 100644
new mode 100755
index 6ee4467ba..01a47272c
--- a/email_request.php
+++ b/email_request.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'email_request.php?user_id=' . $_REQUEST['user_id'];
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'email_request.php';
+ header('location: user_login.php');
+ exit;
}
$query = "SELECT id, email, nick FROM " . $DBPrefix . "users WHERE id = :user_id";
@@ -38,59 +42,70 @@
$username = $user_info['nick'];
$sent = false;
-if (isset($_POST['action']) && $_POST['action'] == 'proceed') {
- if (empty($_POST['TPL_text'])) {
- $ERR = $ERR_031;
- } elseif ($auction_id < 0 || empty($auction_id)) {
- $ERR = $ERR_622;
- } else {
- $query = "SELECT title FROM " . $DBPrefix . "auctions WHERE id = :auction_id";
- $params = array();
- $params[] = array(':auction_id', $auction_id, 'int');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $ERR = $ERR_622;
- } else {
- $item_title = htmlspecialchars($db->result('title'));
- $from_email = ($system->SETTINGS['users_email'] == 'n') ? $user->user_data['email'] : $system->SETTINGS['adminmail'];
- // Send e-mail message
- $subject = $MSG['335'] . ' ' . $system->SETTINGS['sitename'] . ' ' . $MSG['336'] . ' ' . $item_title;
- $message = $MSG['084'] . ' ' . $MSG['240'] . ': ' . $from_email . "\n\n" . $_POST['TPL_text'];
- $emailer = new email_handler();
- $emailer->email_uid = $user_id;
- $emailer->email_basic($subject, $email, nl2br($message), $user->user_data['name'] . '<' . $from_email . '>');
- // send a copy to their mesasge box
- $message = nl2br($system->cleanvars($message));
- $query = "INSERT INTO " . $DBPrefix . "messages (sentto, sentfrom, message, subject)
- VALUES (:id, :user_id, :message, :subject)";
- $params = array();
- $params[] = array(':id', $user_id, 'int');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':message', $message, 'str');
- $subject = $system->cleanvars(sprintf($MSG['651'], $item_title));
- if (strlen($subject) > 255) {
- $pos = strpos($subject, ' ', 200);
- $subject = substr($subject, 0, $pos) . '...';
- }
- $params[] = array(':subject', $subject, 'str');
- $db->query($query, $params);
- $sent = true;
- }
- }
+if (isset($_POST['action']) && $_POST['action'] == 'proceed')
+{
+ if (empty($_POST['TPL_text']))
+ {
+ $ERR = $ERR_031;
+ }
+ elseif ($auction_id < 0 || empty($auction_id))
+ {
+ $ERR = $ERR_622;
+ }
+ else
+ {
+ $query = "SELECT title FROM " . $DBPrefix . "auctions WHERE id = :auction_id";
+ $params = array();
+ $params[] = array(':auction_id', $auction_id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $ERR = $ERR_622;
+ }
+ else
+ {
+ $item_title = htmlspecialchars($db->result('title'));
+ $from_email = ($system->SETTINGS['users_email'] == 'n') ? $user->user_data['email'] : $system->SETTINGS['adminmail'];
+ // Send e-mail message
+ $subject = $MSG['335'] . ' ' . $system->SETTINGS['sitename'] . ' ' . $MSG['336'] . ' ' . $item_title;
+ $message = $MSG['084'] . ' ' . $MSG['240'] . ': ' . $from_email . "\n\n" . $_POST['TPL_text'];
+ $emailer = new email_handler();
+ $emailer->email_uid = $user_id;
+ $emailer->email_basic($subject, $email, nl2br($message), $user->user_data['name'] . '<' . $from_email . '>');
+ // send a copy to their mesasge box
+ $message = nl2br($system->cleanvars($message));
+ $query = "INSERT INTO " . $DBPrefix . "messages (sentto, sentfrom, sentat, message, subject)
+ VALUES (:id, :user_id, :times, :message, :subject)";
+ $params = array();
+ $params[] = array(':id', $user_id, 'int');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':times', time(), 'int');
+ $params[] = array(':message', $message, 'str');
+ $subject = $system->cleanvars(sprintf($MSG['651'], $item_title));
+ if (strlen($subject) > 255)
+ {
+ $pos = strpos($subject, ' ', 200);
+ $subject = substr($subject, 0, $pos) . '...';
+ }
+ $params[] = array(':subject', $subject, 'str');
+ $db->query($query, $params);
+ $sent = true;
+ }
+ }
}
$template->assign_vars(array(
- 'B_SENT' => $sent,
- 'ERROR' => (isset($TPL_error_text)) ? $TPL_error_text : '',
- 'USERID' => $user_id,
- 'USERNAME' => $username,
- 'AUCTION_ID' => $auction_id,
- 'MSG_TEXT' => (isset($_POST['TPL_text'])) ? $_POST['TPL_text'] : ''
- ));
+ 'B_SENT' => $sent,
+ 'ERROR' => (isset($TPL_error_text)) ? $TPL_error_text : '',
+ 'USERID' => $user_id,
+ 'USERNAME' => $username,
+ 'AUCTION_ID' => $auction_id,
+ 'MSG_TEXT' => (isset($_POST['TPL_text'])) ? $_POST['TPL_text'] : ''
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'email_request.tpl'
- ));
+ 'body' => 'email_request.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/error.php b/error.php
old mode 100644
new mode 100755
index 28b4431bd..47fe1244e
--- a/error.php
+++ b/error.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'ERROR' => print_r($_SESSION['SESSION_ERROR'], true),
- 'DEBUGGING' => false, // set to true when trying to fix the script
- 'ERRORTXT' => $system->SETTINGS['errortext']
- ));
+ 'ERROR' => print_r($_SESSION['SESSION_ERROR'], true),
+ 'DEBUGGING' => false, // set to true when trying to fix the script
+ 'ERRORTXT' => $system->SETTINGS['errortext']
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'error.tpl'
- ));
+ 'body' => 'error.tpl'
+ ));
$template->display('body');
-include 'footer.php';
+include 'footer.php';
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
old mode 100644
new mode 100755
diff --git a/feedback.php b/feedback.php
old mode 100644
new mode 100755
index c336d5d75..8ab0053c4
--- a/feedback.php
+++ b/feedback.php
@@ -1,6 +1,6 @@
0) ? $_SESSION['CURRENT_ITEM'] : 0;
$ws = (isset($_GET['ws'])) ? $_GET['ws'] : 'w';
-if (isset($_POST['addfeedback'])) { // submit the feedback
- if (!$user->checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- header('location: user_login.php');
- exit;
- }
+if (isset($_POST['addfeedback'])) // submit the feedback
+{
+ if (!$user->checkAuth())
+ {
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ header('location: user_login.php');
+ exit;
+ }
- if (((isset($_POST['TPL_password']) && $system->SETTINGS['usersauth'] == 'y') || $system->SETTINGS['usersauth'] == 'n') && isset($_POST['TPL_rate']) && isset($_POST['TPL_feedback']) && !empty($_POST['TPL_feedback'])) {
- $query = "SELECT winner, seller, feedback_win, feedback_sel, paid FROM " . $DBPrefix . "winners
+ if (((isset($_POST['TPL_password']) && $system->SETTINGS['usersauth'] == 'y') || $system->SETTINGS['usersauth'] == 'n') && isset($_POST['TPL_rate']) && isset($_POST['TPL_feedback']) && !empty($_POST['TPL_feedback']))
+ {
+ $query = "SELECT winner, seller, feedback_win, feedback_sel, paid FROM " . $DBPrefix . "winners
WHERE auction = :auc_id
AND winner = :winner_id AND seller = :seller_id
AND ((seller = :user_ids AND feedback_sel = 0)
OR (winner = :user_idw AND feedback_win = 0))";
- $params = array();
- $params[] = array(':auc_id', $auction_id, 'int');
- $params[] = array(':winner_id', $_REQUEST['wid'], 'int');
- $params[] = array(':seller_id', $_REQUEST['sid'], 'int');
- $params[] = array(':user_ids', $user->user_data['id'], 'int');
- $params[] = array(':user_idw', $user->user_data['id'], 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- if ($user->user_data['nick'] != $_POST['TPL_nick_hidden']) {
- $wsell = $db->result();
- // winner/seller check
- $ws = ($user->user_data['id'] == $wsell['winner']) ? 'w' : 's';
- if ((intval($_REQUEST['sid']) == $user->user_data['id'] && $wsell['feedback_sel'] == 1) || (intval($_REQUEST['wid']) == $user->user_data['id'] && $wsell['feedback_win'] == 1)) {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_074;
- }
- //elseif ((intval($_REQUEST['wid']) == $user->user_data['id'] && $wsell['paid'] == 1) || (intval($_REQUEST['sid']) == $user->user_data['id']))
- else {
- // load hashing class to check password
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- if ($system->SETTINGS['usersauth'] == 'n' || $phpass->CheckPassword($_POST['TPL_password'], $user->user_data['password'])) {
- $secTPL_feedback = $system->cleanvars($_POST['TPL_feedback']);
- $uid = ($ws == 'w') ? $_REQUEST['sid'] : $_REQUEST['wid'];
- $query = "UPDATE " . $DBPrefix . "users SET rate_sum = rate_sum + :rate_sum, rate_num = rate_num + 1 WHERE id = :user_id";
- $params = array();
- $params[] = array(':rate_sum', $_POST['TPL_rate'], 'int');
- $params[] = array(':user_id', $uid, 'int');
- $db->query($query, $params);
+ $params = array();
+ $params[] = array(':auc_id', $auction_id, 'int');
+ $params[] = array(':winner_id', $_REQUEST['wid'], 'int');
+ $params[] = array(':seller_id', $_REQUEST['sid'], 'int');
+ $params[] = array(':user_ids', $user->user_data['id'], 'int');
+ $params[] = array(':user_idw', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ if ($user->user_data['nick'] != $_POST['TPL_nick_hidden'])
+ {
+ $wsell = $db->result();
+ // winner/seller check
+ $ws = ($user->user_data['id'] == $wsell['winner']) ? 'w' : 's';
+ if ((intval($_REQUEST['sid']) == $user->user_data['id'] && $wsell['feedback_sel'] == 1) || (intval($_REQUEST['wid']) == $user->user_data['id'] && $wsell['feedback_win'] == 1))
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_074;
+ }
+ //elseif ((intval($_REQUEST['wid']) == $user->user_data['id'] && $wsell['paid'] == 1) || (intval($_REQUEST['sid']) == $user->user_data['id']))
+ else
+ {
+ // load hashing class to check password
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ if ($system->SETTINGS['usersauth'] == 'n' || $phpass->CheckPassword($_POST['TPL_password'], $user->user_data['password']))
+ {
+ $secTPL_feedback = $system->cleanvars($_POST['TPL_feedback']);
+ $uid = ($ws == 'w') ? $_REQUEST['sid'] : $_REQUEST['wid'];
+ $query = "UPDATE " . $DBPrefix . "users SET rate_sum = rate_sum + :rate_sum, rate_num = rate_num + 1 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':rate_sum', $_POST['TPL_rate'], 'int');
+ $params[] = array(':user_id', $uid, 'int');
+ $db->query($query, $params);
- if ($system->SETTINGS['wordsfilter'] == 'y') {
- $secTPL_feedback = $system->filter($secTPL_feedback);
- }
- $query = "INSERT INTO " . $DBPrefix . "feedbacks (rated_user_id, rater_user_nick, feedback, rate, auction_id) VALUES
- (:user_id, :user_nick, :feedback, :rate, :auc_id)";
- $params = array();
- $params[] = array(':user_id', $uid, 'int');
- $params[] = array(':user_nick', $user->user_data['nick'], 'str');
- $params[] = array(':feedback', $secTPL_feedback, 'str');
- $params[] = array(':rate', $_POST['TPL_rate'], 'int');
- $params[] = array(':auc_id', $auction_id, 'int');
- $db->query($query, $params);
- if ($ws == 's') {
- $sqlset = "feedback_sel = 1";
- }
- if ($ws == 'w') {
- $sqlset = "feedback_win = 1";
- }
- $query = "UPDATE " . $DBPrefix . "winners SET $sqlset
+ if ($system->SETTINGS['wordsfilter'] == 'y')
+ {
+ $secTPL_feedback = $system->filter($secTPL_feedback);
+ }
+ $query = "INSERT INTO " . $DBPrefix . "feedbacks (rated_user_id, rater_user_nick, feedback, rate, feedbackdate, auction_id) VALUES
+ (:user_id, :user_nick, :feedback, :rate, :time, :auc_id)";
+ $params = array();
+ $params[] = array(':user_id', $uid, 'int');
+ $params[] = array(':user_nick', $user->user_data['nick'], 'str');
+ $params[] = array(':feedback', $secTPL_feedback, 'str');
+ $params[] = array(':rate', $_POST['TPL_rate'], 'int');
+ $params[] = array(':time', $system->ctime, 'int');
+ $params[] = array(':auc_id', $auction_id, 'int');
+ $db->query($query, $params);
+ if ($ws == 's')
+ {
+ $sqlset = "feedback_sel = 1";
+ }
+ if ($ws == 'w')
+ {
+ $sqlset = "feedback_win = 1";
+ }
+ $query = "UPDATE " . $DBPrefix . "winners SET $sqlset
WHERE auction = :auc_id AND winner = :winner AND seller = :seller";
- $params = array();
- $params[] = array(':auc_id', $auction_id, 'int');
- $params[] = array(':winner', $_REQUEST['wid'], 'int');
- $params[] = array(':seller', $_REQUEST['sid'], 'int');
- $db->query($query, $params);
- header('location: feedback.php?faction=show&id=' . intval($uid));
- exit;
- } else {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_101;
- }
- }
- /*
- else
- {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_705;
- }*/
- } else {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_103;
- }
- } else {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_704;
- }
- } else {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_104;
- }
+ $params = array();
+ $params[] = array(':auc_id', $auction_id, 'int');
+ $params[] = array(':winner', $_REQUEST['wid'], 'int');
+ $params[] = array(':seller', $_REQUEST['sid'], 'int');
+ $db->query($query, $params);
+ header ('location: feedback.php?faction=show&id=' . intval($uid));
+ exit;
+ }
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_101;
+ }
+ }
+ /*
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_705;
+ }*/
+ }
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_103;
+ }
+ }
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_704;
+ }
+ }
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_104;
+ }
}
-if ((isset($_GET['wid']) && isset($_GET['sid'])) || isset($TPL_err)) { // gets user details
- $secid = ($ws == 'w') ? $_REQUEST['sid'] : $_REQUEST['wid'];
- if ($_REQUEST['sid'] == $user->user_data['id']) {
- $them = $_REQUEST['wid'];
- $sbmsg = $MSG['131'];
- } else {
- $them = $_REQUEST['sid'];
- $sbmsg = $MSG['125'];
- }
-
- $query = "SELECT title FROM " . $DBPrefix . "auctions WHERE id = :auc_id LIMIT 1";
- $params = array();
- $params[] = array(':auc_id', $auction_id, 'int');
- $db->query($query, $params);
- $item_title = $db->result('title');
+if ((isset($_GET['wid']) && isset($_GET['sid'])) || isset($TPL_err)) // gets user details
+{
+ $secid = ($ws == 'w') ? $_REQUEST['sid'] : $_REQUEST['wid'];
+ if ($_REQUEST['sid'] == $user->user_data['id'])
+ {
+ $them = $_REQUEST['wid'];
+ $sbmsg = $MSG['131'];
+ }
+ else
+ {
+ $them = $_REQUEST['sid'];
+ $sbmsg = $MSG['125'];
+ }
- $query = "SELECT nick, rate_sum, rate_num FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $secid, 'int');
- $db->query($query, $params);
+ $query = "SELECT title FROM " . $DBPrefix . "auctions WHERE id = :auc_id LIMIT 1";
+ $params = array();
+ $params[] = array(':auc_id', $auction_id, 'int');
+ $db->query($query, $params);
+ $item_title = $db->result('title');
- if ($db->numrows() > 0) {
- $user_data = $db->result();
- $TPL_nick = $user_data['nick'];
- $query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
- $params = array();
- $params[] = array(':feedback', $user_data['rate_sum'], 'int');
- $db->query($query, $params);
- $feedback_icon = $db->result('icon');
+ $query = "SELECT nick, rate_sum, rate_num FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $secid, 'int');
+ $db->query($query, $params);
- $TPL_feedbacks_num = $user_data['rate_num'];
- $TPL_feedbacks_sum = $user_data['rate_sum'];
- } else {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_105;
- }
+ if ($db->numrows() > 0)
+ {
+ $arr = $db->result();
+ $TPL_nick = $arr['nick'];
+ $i = 0;
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $arr['rate_sum'] || $i++ == (count($membertypes) - 1))
+ {
+ $TPL_rate_ratio_value = ' ';
+ break;
+ }
+ }
+ $TPL_feedbacks_num = $arr['rate_num'];
+ $TPL_feedbacks_sum = $arr['rate_sum'];
+ }
+ else
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_105;
+ }
}
-if (isset($_GET['faction']) && $_GET['faction'] == 'show') {
- // determine limits for SQL query
- if (!isset($_GET['id'])) {
- $TPL_err = 1;
- $TPL_errmsg = $ERR_106;
- } else {
- // set page values
- $user_id = intval($_GET['id']);
- $query = "SELECT rate_sum, nick FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user_id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $user_data = $db->result();
- $total = $user_data['rate_sum'];
- $TPL_nick = $user_data['nick'];
- $TPL_feedbacks_num = $total;
- // get number of pages
- if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE'])) {
- $OFFSET = 0;
- $PAGE = 1;
- } else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
- }
- $PAGES = ($total == 0) ? 1 : ceil($total / $system->SETTINGS['perpage']);
+if (isset($_GET['faction']) && $_GET['faction'] == 'show')
+{
+ // determine limits for SQL query
+ if (!isset($_GET['id']))
+ {
+ $TPL_err = 1;
+ $TPL_errmsg = $ERR_106;
+ }
+ else
+ {
+ // set page values
+ $user_id = intval($_GET['id']);
+ $query = "SELECT rate_sum, nick FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user_id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $user_data = $db->result();
+ $total = $user_data['rate_sum'];
+ $TPL_nick = $user_data['nick'];
+ $TPL_feedbacks_num = $total;
+ // get number of pages
+ if (!isset($_GET['PAGE']) || intval($_GET['PAGE']) <= 1 || empty($_GET['PAGE']))
+ {
+ $OFFSET = 0;
+ $PAGE = 1;
+ }
+ else
+ {
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+ }
+ $PAGES = ($total == 0) ? 1 : ceil($total / $system->SETTINGS['perpage']);
- $query = "SELECT feedbacks, icon FROM " . $DBPrefix . "membertypes ORDER BY feedbacks DESC;";
- $db->direct_query($query);
- $membertypes = $db->fetchAll();
-
- $query = "SELECT f.*, a.title, u.id As uId, u.rate_num, u.rate_sum
+ $query = "SELECT f.*, a.title, u.id As uId, u.rate_num, u.rate_sum
FROM " . $DBPrefix . "feedbacks f
LEFT JOIN " . $DBPrefix . "auctions a ON (a.id = f.auction_id)
LEFT JOIN " . $DBPrefix . "users u ON (u.nick = f.rater_user_nick)
WHERE rated_user_id = :user_id
ORDER by feedbackdate DESC LIMIT :OFFSET, :perpage";
- $params = array();
- $params[] = array(':user_id', $user_id, 'int');
- $params[] = array(':OFFSET', $OFFSET, 'int');
- $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
- $db->query($query, $params);
- $i = 0;
- $feed_disp = array();
- while ($arrfeed = $db->fetch()) {
- foreach ($membertypes as $membertype) {
- if ($membertype['feedbacks'] >= $arrfeed['rate_sum']) {
- $feedback_icon = $membertype['icon'];
- break;
- }
- }
- switch ($arrfeed['rate']) {
- case 1: $uimg = $system->SETTINGS['siteurl'] . 'images/positive.png';
- break;
- case - 1: $uimg = $system->SETTINGS['siteurl'] . 'images/negative.png';
- break;
- default:
- case 0: $uimg = $system->SETTINGS['siteurl'] . 'images/neutral.png';
- break;
- }
- $template->assign_block_vars('fbs', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'IMG' => $uimg,
- 'USFLINK' => 'profile.php?user_id=' . $arrfeed['uId'] . '&auction_id=' . $arrfeed['auction_id'],
- 'USERID' => $arrfeed['uId'],
- 'USERNAME' => $arrfeed['rater_user_nick'],
- 'USFEED' => $arrfeed['rate_sum'],
- 'FB_ICON' => $feedback_icon,
- 'FBDATE' => $dt->formatDate($arrfeed['feedbackdate']),
- 'AUCTIONURL' => ($arrfeed['title']) ? '' . htmlspecialchars($arrfeed['title']) . ' ' : $MSG['113'] . $arrfeed['auction_id'],
- 'FEEDBACK' => nl2br($arrfeed['feedback'])
- ));
- $i++;
- }
- }
- }
+ $params = array();
+ $params[] = array(':user_id', $user_id, 'int');
+ $params[] = array(':OFFSET', $OFFSET, 'int');
+ $params[] = array(':perpage', $system->SETTINGS['perpage'], 'int');
+ $db->query($query, $params);
+ $i = 0;
+ $feed_disp = array();
+ while ($arrfeed = $db->fetch())
+ {
+ $j = 0;
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $arrfeed['rate_sum'] || $j++ == (count($membertypes) - 1))
+ {
+ $usicon = ' ';
+ break;
+ }
+ }
+ switch ($arrfeed['rate'])
+ {
+ case 1: $uimg = $system->SETTINGS['siteurl'] . 'images/positive.png';
+ break;
+ case - 1: $uimg = $system->SETTINGS['siteurl'] . 'images/negative.png';
+ break;
+ case 0 : $uimg = $system->SETTINGS['siteurl'] . 'images/neutral.png';
+ break;
+ }
+ $template->assign_block_vars('fbs', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'IMG' => $uimg,
+ 'USFLINK' => 'profile.php?user_id=' . $arrfeed['uId'] . '&auction_id=' . $arrfeed['auction_id'],
+ 'USERID' => $arrfeed['uId'],
+ 'USERNAME' => $arrfeed['rater_user_nick'],
+ 'USFEED' => $arrfeed['rate_sum'],
+ 'USICON' => (isset($usicon)) ? $usicon : '',
+ 'FBDATE' => FormatDate($arrfeed['feedbackdate']),
+ 'AUCTIONURL' => ($arrfeed['title']) ? '' . htmlspecialchars($arrfeed['title']) . ' ' : $MSG['113'] . $arrfeed['auction_id'],
+ 'FEEDBACK' => nl2br($arrfeed['feedback'])
+ ));
+ $i++;
+ }
+ }
+ }
- // get pagenation
- $PREV = intval($PAGE - 1);
- $NEXT = intval($PAGE + 1);
- if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
- }
+ // get pagenation
+ $PREV = intval($PAGE - 1);
+ $NEXT = intval($PAGE + 1);
+ if ($PAGES > 1)
+ {
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
+ }
}
// Calls the appropriate templates/templates
-if ((isset($TPL_err) && !empty($TPL_err)) || !isset($_GET['faction'])) {
- $template->assign_vars(array(
- 'ERROR' => (isset($TPL_errmsg)) ? $TPL_errmsg : '',
- 'USERNICK' => (isset($TPL_nick)) ? $TPL_nick : '',
- 'USERFB' => (isset($TPL_feedbacks_sum)) ? $TPL_feedbacks_sum : '',
- 'USER_FB_ICON' => $feedback_icon,
- 'AUCT_ID' => $auction_id,
- 'AUCT_TITLE' => $item_title,
- 'WID' => $_GET['wid'],
- 'SID' => $_GET['sid'],
- 'WS' => $ws,
- 'FEEDBACK' => (isset($secTPL_feedback)) ? $secTPL_feedback : '',
- 'RATE1' => (!isset($_POST['TPL_rate']) || $_POST['TPL_rate'] == 1) ? ' checked="true"' : '',
- 'RATE2' => (isset($_POST['TPL_rate']) && $_POST['TPL_rate'] == 0) ? ' checked="true"' : '',
- 'RATE3' => (isset($_POST['TPL_rate']) && $_POST['TPL_rate'] == -1) ? ' checked="true"' : '',
- 'SBMSG' => $sbmsg,
- 'THEM' => $them,
+if ((isset($TPL_err) && !empty($TPL_err)) || !isset($_GET['faction']))
+{
+ $template->assign_vars(array(
+ 'ERROR' => (isset($TPL_errmsg)) ? $TPL_errmsg : '',
+ 'USERNICK' => (isset($TPL_nick)) ? $TPL_nick : '',
+ 'USERFB' => (isset($TPL_feedbacks_sum)) ? $TPL_feedbacks_sum : '',
+ 'USERFBIMG' => (isset($TPL_rate_ratio_value)) ? $TPL_rate_ratio_value : '',
+ 'AUCT_ID' => $auction_id,
+ 'AUCT_TITLE' => $item_title,
+ 'WID' => $_GET['wid'],
+ 'SID' => $_GET['sid'],
+ 'WS' => $ws,
+ 'FEEDBACK' => (isset($secTPL_feedback)) ? $secTPL_feedback : '',
+ 'RATE1' => (!isset($_POST['TPL_rate']) || $_POST['TPL_rate'] == 1) ? ' checked="true"' : '',
+ 'RATE2' => (isset($_POST['TPL_rate']) && $_POST['TPL_rate'] == 0) ? ' checked="true"' : '',
+ 'RATE3' => (isset($_POST['TPL_rate']) && $_POST['TPL_rate'] == -1) ? ' checked="true"' : '',
+ 'SBMSG' => $sbmsg,
+ 'THEM' => $them,
- 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
- ));
- include 'header.php';
- $template->set_filenames(array(
- 'body' => 'feedback.tpl'
- ));
- $template->display('body');
- include 'footer.php';
+ 'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y')
+ ));
+ include 'header.php';
+ $template->set_filenames(array(
+ 'body' => 'feedback.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
}
-if (isset($_GET['faction']) && $_GET['faction'] == 'show') {
- $query = "SELECT nick, rate_sum FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $_REQUEST['id'], 'int');
- $db->query($query, $params);
- if (($user_data = $db->result()) == null) {
- header('location: profile?id=' . $_REQUEST['id']);
- exit;
- }
- $username = $user_data['nick'];
- $rate_sum = $user_data['rate_sum'];
- $query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
- $params = array();
- $params[] = array(':feedback', $rate_sum, 'int');
- $db->query($query, $params);
- $feedback_icon = $db->result('icon');
-
- $template->assign_vars(array(
- 'USERNICK' => $username,
- 'USERFB' => $rate_sum,
- 'USER_FB_ICON' => $feedback_icon,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES,
- 'AUCT_ID' => $auction_id,
- 'ID' => $_REQUEST['id']
- ));
- include 'header.php';
- $template->set_filenames(array(
- 'body' => 'show_feedback.tpl'
- ));
- $template->display('body');
- include 'footer.php';
+if (isset($_GET['faction']) && $_GET['faction'] == 'show')
+{
+ $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $_REQUEST['id'], 'int');
+ $db->query($query, $params);
+ if ($arr = $db->fetch())
+ {
+ $TPL_rate_ratio_value = '';
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $arr['rate_sum'] || $i++ == (count($membertypes) - 1))
+ {
+ $TPL_rate_ratio_value = ' ';
+ break;
+ }
+ }
+ }
+ $template->assign_vars(array(
+ 'USERNICK' => (isset($TPL_nick)) ? $TPL_nick : '',
+ 'USERFB' => (isset($TPL_feedbacks_num)) ? $TPL_feedbacks_num : '',
+ 'USERFBIMG' => (isset($TPL_rate_ratio_value)) ? $TPL_rate_ratio_value : '',
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES,
+ 'AUCT_ID' => $auction_id,
+ 'ID' => $_REQUEST['id']
+ ));
+ include 'header.php';
+ $template->set_filenames(array(
+ 'body' => 'show_feedback.tpl'
+ ));
+ $template->display('body');
+ include 'footer.php';
}
diff --git a/fees.php b/fees.php
old mode 100644
new mode 100755
index c94239479..05b3e66df
--- a/fees.php
+++ b/fees.php
@@ -1,6 +1,6 @@
SETTINGS['fees'] == 'n') {
- header('location: index.php');
- exit;
+if ($system->SETTINGS['fees'] == 'n')
+{
+ header('location: index.php');
+ exit;
}
// get fees
@@ -25,100 +26,129 @@
$setup = $buyer_fee = $endauc_fee = false;
$i = 0;
-while ($row = $db->fetch()) {
- if ($row['type'] == 'setup_fee') {
- if ($row['fee_from'] != $row['fee_to']) {
- $setup = true;
- $template->assign_block_vars('setup_fees', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'FROM' => $system->print_money($row['fee_from']),
- 'TO' => $system->print_money($row['fee_to']),
- 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
- ));
- }
- } elseif ($row['type'] == 'buyer_fee') {
- if ($row['fee_from'] != $row['fee_to']) {
- $buyer_fee = true;
- $template->assign_block_vars('buyer_fee', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'FROM' => $system->print_money($row['fee_from']),
- 'TO' => $system->print_money($row['fee_to']),
- 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
- ));
- }
- } elseif ($row['type'] == 'endauc_fee') {
- if ($row['fee_from'] != $row['fee_to']) {
- $endauc_fee = true;
- $template->assign_block_vars('endauc_fee', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'FROM' => $system->print_money($row['fee_from']),
- 'TO' => $system->print_money($row['fee_to']),
- 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
- ));
- }
- } elseif ($row['type'] == 'signup_fee') {
- $template->assign_vars(array(
- 'B_SIGNUP_FEE' => ($row['value'] > 0),
- 'SIGNUP_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'featured_fee') {
- $template->assign_vars(array(
- 'B_HPFEAT_FEE' => ($row['value'] > 0),
- 'HPFEAT_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'bold_fee') {
- $template->assign_vars(array(
- 'B_BOLD_FEE' => ($row['value'] > 0),
- 'BOLD_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'highlighted_fee') {
- $template->assign_vars(array(
- 'B_HL_FEE' => ($row['value'] > 0),
- 'HL_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'reserve_fee') {
- $template->assign_vars(array(
- 'B_RP_FEE' => ($row['value'] > 0),
- 'RP_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'picture_fee') {
- $template->assign_vars(array(
- 'B_PICTURE_FEE' => ($row['value'] > 0),
- 'PICTURE_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'relist_fee') {
- $template->assign_vars(array(
- 'B_RELIST_FEE' => ($row['value'] > 0),
- 'RELIST_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'buynow_fee') {
- $template->assign_vars(array(
- 'B_BUYNOW_FEE' => ($row['value'] > 0),
- 'BUYNOW_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'extracat_fee') {
- $template->assign_vars(array(
- 'B_EXCAT_FEE' => ($row['value'] > 0),
- 'EXCAT_FEE' => $system->print_money($row['value'])
- ));
- } elseif ($row['type'] == 'subtitle_fee') {
- $template->assign_vars(array(
- 'B_SUBTITLE_FEE' => ($row['value'] > 0),
- 'SUBTITLE_FEE' => $system->print_money($row['value'])
- ));
- }
- $i++;
+while ($row = $db->fetch())
+{
+ if ($row['type'] == 'setup_fee')
+ {
+ if ($row['fee_from'] != $row['fee_to'])
+ {
+ $setup = true;
+ $template->assign_block_vars('setup_fees', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'FROM' => $system->print_money($row['fee_from']),
+ 'TO' => $system->print_money($row['fee_to']),
+ 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
+ ));
+ }
+ }
+ elseif ($row['type'] == 'buyer_fee')
+ {
+ if ($row['fee_from'] != $row['fee_to'])
+ {
+ $buyer_fee = true;
+ $template->assign_block_vars('buyer_fee', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'FROM' => $system->print_money($row['fee_from']),
+ 'TO' => $system->print_money($row['fee_to']),
+ 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
+ ));
+ }
+ }
+ elseif ($row['type'] == 'endauc_fee')
+ {
+ if ($row['fee_from'] != $row['fee_to'])
+ {
+ $endauc_fee = true;
+ $template->assign_block_vars('endauc_fee', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'FROM' => $system->print_money($row['fee_from']),
+ 'TO' => $system->print_money($row['fee_to']),
+ 'VALUE' => ($row['fee_type'] == 'flat') ? $system->print_money($row['value']) : $row['value'] . '%'
+ ));
+ }
+ }
+ elseif ($row['type'] == 'signup_fee')
+ {
+ $template->assign_vars(array(
+ 'B_SIGNUP_FEE' => ($row['value'] > 0),
+ 'SIGNUP_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'featured_fee')
+ {
+ $template->assign_vars(array(
+ 'B_HPFEAT_FEE' => ($row['value'] > 0),
+ 'HPFEAT_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'bold_fee')
+ {
+ $template->assign_vars(array(
+ 'B_BOLD_FEE' => ($row['value'] > 0),
+ 'BOLD_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'highlighted_fee')
+ {
+ $template->assign_vars(array(
+ 'B_HL_FEE' => ($row['value'] > 0),
+ 'HL_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'reserve_fee')
+ {
+ $template->assign_vars(array(
+ 'B_RP_FEE' => ($row['value'] > 0),
+ 'RP_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'picture_fee')
+ {
+ $template->assign_vars(array(
+ 'B_PICTURE_FEE' => ($row['value'] > 0),
+ 'PICTURE_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'relist_fee')
+ {
+ $template->assign_vars(array(
+ 'B_RELIST_FEE' => ($row['value'] > 0),
+ 'RELIST_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'buynow_fee')
+ {
+ $template->assign_vars(array(
+ 'B_BUYNOW_FEE' => ($row['value'] > 0),
+ 'BUYNOW_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'extracat_fee')
+ {
+ $template->assign_vars(array(
+ 'B_EXCAT_FEE' => ($row['value'] > 0),
+ 'EXCAT_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ elseif ($row['type'] == 'subtitle_fee')
+ {
+ $template->assign_vars(array(
+ 'B_SUBTITLE_FEE' => ($row['value'] > 0),
+ 'SUBTITLE_FEE' => $system->print_money($row['value'])
+ ));
+ }
+ $i++;
}
$template->assign_vars(array(
- 'B_SETUP_FEE' => $setup,
- 'B_BUYER_FEE' => $buyer_fee,
- 'B_ENDAUC_FEE' => $endauc_fee
- ));
+ 'B_SETUP_FEE' => $setup,
+ 'B_BUYER_FEE' => $buyer_fee,
+ 'B_ENDAUC_FEE' => $endauc_fee
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'fees.tpl'
- ));
+ 'body' => 'fees.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/footer.php b/footer.php
old mode 100644
new mode 100755
index 25f0458b4..d42d545cd
--- a/footer.php
+++ b/footer.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'L_COPY' => empty($system->SETTINGS['copyright']) ? '' : '' . htmlspecialchars($system->SETTINGS['copyright']) . '
',
- 'L_COPY_YEAR' => date("Y"),
+ 'L_COPY' => empty($system->SETTINGS['copyright']) ? '' : '' . htmlspecialchars($system->SETTINGS['copyright']) . '
',
+ 'L_COPY_YEAR' => date("Y"),
- 'B_VIEW_TERMS' => ($system->SETTINGS['terms'] == 'y'),
- 'B_VIEW_PRIVPOL' => ($system->SETTINGS['privacypolicy'] == 'y'),
- 'B_VIEW_ABOUTUS' => ($system->SETTINGS['aboutus'] == 'y'),
- 'B_VIEW_COOKIES' => ($system->SETTINGS['cookiespolicy'] == 'y'),
- 'B_FEES' => ($system->SETTINGS['fees'] == 'y')
- ));
+ 'B_VIEW_TERMS' => ($system->SETTINGS['terms'] == 'y'),
+ 'B_VIEW_PRIVPOL' => ($system->SETTINGS['privacypolicy'] == 'y'),
+ 'B_VIEW_ABOUTUS' => ($system->SETTINGS['aboutus'] == 'y'),
+ 'B_VIEW_COOKIES' => ($system->SETTINGS['cookiespolicy'] == 'y'),
+ 'B_FEES' => ($system->SETTINGS['fees'] == 'y')
+ ));
$template->set_filenames(array(
- 'footer' => 'global_footer.tpl'
- ));
+ 'footer' => 'global_footer.tpl'
+ ));
$template->display('footer');
// if the page has loaded OK you dont need this data anymore :)
-unset($_SESSION['SESSION_ERROR']);
+unset($_SESSION['SESSION_ERROR']);
\ No newline at end of file
diff --git a/forgotpasswd.php b/forgotpasswd.php
old mode 100644
new mode 100755
index f6b0d5875..fbd85cd27
--- a/forgotpasswd.php
+++ b/forgotpasswd.php
@@ -1,6 +1,6 @@
cleanvars($_POST['TPL_username']), 'str');
- $params[] = array(':email', $system->cleanvars($_POST['TPL_email']), 'str');
- $db->query($query, $params);
+if (isset($_POST['action']) && $_POST['action'] == 'ok')
+{
+ if (isset($_POST['TPL_username']) && isset($_POST['TPL_email']))
+ {
+ $query = "SELECT email, id, name FROM " . $DBPrefix . "users WHERE nick = :username AND email = :email LIMIT 1";
+ $params = array();
+ $params[] = array(':username', $system->cleanvars($_POST['TPL_username']), 'str');
+ $params[] = array(':email', $system->cleanvars($_POST['TPL_email']), 'str');
+ $db->query($query, $params);
- if ($db->numrows() > 0) {
- // Generate a new random password and mail it to the user
- $user_data = $db->result();
- $email = $user_data['email'];
- $id = $user_data['id'];
- $name = $user_data['name'];
- $newpass = generatePassword();
- // send message
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'REALNAME' => $name,
- 'NEWPASS' => $newpass,
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
- $emailer->email_uid = $id;
- $emailer->email_sender($email, 'newpasswd.inc.php', $MSG['024']);
- // Update database
- $query = "UPDATE " . $DBPrefix . "users SET password = :password WHERE id = :user_id";
- // hash password
- include PACKAGE_PATH . 'PasswordHash.php';
- $phpass = new PasswordHash(8, false);
- $params = array();
- $params[] = array(':password', $phpass->HashPassword($newpass), 'str');
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- } else {
- $ERR = $ERR_076;
- }
- } else {
- $ERR = $ERR_112;
- }
+ if ($db->numrows() > 0)
+ {
+ // Generate a new random password and mail it to the user
+ $user_data = $db->result();
+ $email = $user_data['email'];
+ $id = $user_data['id'];
+ $name = $user_data['name'];
+ $newpass = generatePassword();
+ // send message
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'REALNAME' => $name,
+ 'NEWPASS' => $newpass,
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
+ $emailer->email_uid = $id;
+ $emailer->email_sender($email, 'newpasswd.inc.php', $MSG['024']);
+ // Update database
+ $query = "UPDATE " . $DBPrefix . "users SET password = :password WHERE id = :user_id";
+ // hash password
+ include PACKAGE_PATH . 'PasswordHash.php';
+ $phpass = new PasswordHash(8, false);
+ $params = array();
+ $params[] = array(':password', $phpass->HashPassword($newpass), 'str');
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $ERR = $ERR_076;
+ }
+ }
+ else
+ {
+ $ERR = $ERR_112;
+ }
}
$template->assign_vars(array(
- 'ERROR' => (isset($ERR)) ? $ERR : '',
- 'USERNAME' => (isset($username)) ? $username : '',
- 'EMAIL' => (isset($email)) ? $email : '',
- 'B_FIRST' => (!isset($_POST['action']) || (isset($_POST['action']) && isset($ERR)))
- ));
+ 'ERROR' => (isset($ERR)) ? $ERR : '',
+ 'USERNAME' => (isset($username)) ? $username : '',
+ 'EMAIL' => (isset($email)) ? $email : '',
+ 'B_FIRST' => (!isset($_POST['action']) || (isset($_POST['action']) && isset($ERR)))
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'forgotpasswd.tpl'
- ));
+ 'body' => 'forgotpasswd.tpl'
+ ));
$template->display('body');
-include 'footer.php';
+include 'footer.php';
\ No newline at end of file
diff --git a/friend.php b/friend.php
old mode 100644
new mode 100755
index 821d4ea78..f966a6259
--- a/friend.php
+++ b/friend.php
@@ -1,6 +1,6 @@
SETTINGS['spam_sendtofriend'] == 2) {
- include PACKAGE_PATH . 'recaptcha/recaptcha.php';
-} elseif ($system->SETTINGS['spam_sendtofriend'] == 1) {
- include PACKAGE_PATH . 'captcha/securimage.php';
+if ($system->SETTINGS['spam_sendtofriend'] == 2)
+{
+ include PACKAGE_PATH . 'recaptcha/recaptcha.php';
+}
+elseif ($system->SETTINGS['spam_sendtofriend'] == 1)
+{
+ include PACKAGE_PATH . 'captcha/securimage.php';
}
-if (isset($_REQUEST['id'])) {
- $_SESSION['CURRENT_ITEM'] = intval($_REQUEST['id']);
+if (isset($_REQUEST['id']))
+{
+ $_SESSION['CURRENT_ITEM'] = intval($_REQUEST['id']);
}
$id = $_SESSION['CURRENT_ITEM'];
@@ -34,86 +38,104 @@
$params = array();
$params[] = array(':auc_id', $id, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- $TPL_item_title = $db->result('title');
-} else {
- $_SESSION['msg_title'] = $ERR_622;
- $_SESSION['msg_body'] = $ERR_623;
- header('location: message.php');
- exit;
+if ($db->numrows() > 0)
+{
+ $TPL_item_title = $db->result('title');
+}
+else
+{
+ $_SESSION['msg_title'] = $ERR_622;
+ $_SESSION['msg_body'] = $ERR_623;
+ header('location: message.php');
+ exit;
}
$spam_html = '';
-if ($system->SETTINGS['spam_sendtofriend'] == 1) {
- $resp = new Securimage();
- $spam_html = $resp->getCaptchaHtml();
+if ($system->SETTINGS['spam_sendtofriend'] == 1)
+{
+ $resp = new Securimage();
+ $spam_html = $resp->getCaptchaHtml();
}
-if (isset($_POST['action']) && $_POST['action'] == 'sendmail') {
- // check errors
- if (empty($_POST['sender_name']) || empty($_POST['sender_email']) || empty($_POST['friend_name']) || empty($_POST['friend_email'])) {
- $TPL_error_text = $ERR_031;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'sendmail')
+{
+ // check errors
+ if (empty($_POST['sender_name']) || empty($_POST['sender_email']) || empty($_POST['friend_name']) || empty($_POST['friend_email']))
+ {
+ $TPL_error_text = $ERR_031;
+ }
- if (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['sender_email']) || !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['friend_email'])) {
- $TPL_error_text = $ERR_008;
- }
+ if (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['sender_email']) || !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $_POST['friend_email']))
+ {
+ $TPL_error_text = $ERR_008;
+ }
- if ($system->SETTINGS['spam_sendtofriend'] == 2) {
- $resp = recaptcha_check_answer($system->SETTINGS['recaptcha_private'], $_POST['g-recaptcha-response']);
- if (!$resp) {
- $TPL_error_text = $MSG['752'];
- }
- } elseif ($system->SETTINGS['spam_sendtofriend'] == 1) {
- if (!$resp->check($_POST['captcha_code'])) {
- $TPL_error_text = $MSG['752'];
- }
- }
+ if ($system->SETTINGS['spam_sendtofriend'] == 2)
+ {
+ $resp = recaptcha_check_answer($system->SETTINGS['recaptcha_private'], $_POST['g-recaptcha-response']);
+ if (!$resp)
+ {
+ $TPL_error_text = $MSG['752'];
+ }
+ }
+ elseif ($system->SETTINGS['spam_sendtofriend'] == 1)
+ {
+ if (!$resp->check($_POST['captcha_code']))
+ {
+ $TPL_error_text = $MSG['752'];
+ }
+ }
- if (!empty($TPL_error_text)) {
- $emailsent = 1;
- } else {
- $emailsent = 0;
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'S_NAME' => $_POST['sender_name'],
- 'S_EMAIL' => $_POST['sender_email'],
- 'S_COMMENT' => $_POST['sender_comment'],
- 'F_NAME' => $_POST['friend_name'],
- 'TITLE' => $TPL_item_title,
- 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id,
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'ADMINEMAIL' => $system->SETTINGS['adminmail']
- ));
- $emailer->email_sender($_POST['friend_email'], 'friendmail.inc.php', $MSG['905']);
- }
+ if (!empty($TPL_error_text))
+ {
+ $emailsent = 1;
+ }
+ else
+ {
+ $emailsent = 0;
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'S_NAME' => $_POST['sender_name'],
+ 'S_EMAIL' => $_POST['sender_email'],
+ 'S_COMMENT' => $_POST['sender_comment'],
+ 'F_NAME' => $_POST['friend_name'],
+ 'TITLE' => $TPL_item_title,
+ 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id,
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ADMINEMAIL' => $system->SETTINGS['adminmail']
+ ));
+ $emailer->email_sender($_POST['friend_email'], 'friendmail.inc.php', $MSG['905']);
+ }
}
-if ($system->SETTINGS['spam_sendtofriend'] == 2) {
- $capcha_text = recaptcha_get_html($system->SETTINGS['recaptcha_public']);
-} elseif ($system->SETTINGS['spam_sendtofriend'] == 1) {
- $capcha_text = $spam_html;
+if ($system->SETTINGS['spam_sendtofriend'] == 2)
+{
+ $capcha_text = recaptcha_get_html($system->SETTINGS['recaptcha_public']);
+}
+elseif ($system->SETTINGS['spam_sendtofriend'] == 1)
+{
+ $capcha_text = $spam_html;
}
$template->assign_vars(array(
- 'ERROR' => $TPL_error_text,
- 'ID' => intval($_REQUEST['id']),
- 'CAPTCHATYPE' => $system->SETTINGS['spam_sendtofriend'],
- 'CAPCHA' => (isset($capcha_text)) ? $capcha_text : '',
- 'TITLE' => $TPL_item_title,
- 'FRIEND_NAME' => (isset($_POST['friend_name'])) ? $system->cleanvars($_POST['friend_name']) : '',
- 'FRIEND_EMAIL' => (isset($_POST['friend_email'])) ? $system->cleanvars($_POST['friend_email']) : '',
- 'YOUR_NAME' => ($user->logged_in) ? $system->cleanvars($user->user_data['name']) : '',
- 'YOUR_EMAIL' => ($user->logged_in) ? $system->cleanvars($user->user_data['email']) : '',
- 'COMMENT' => (isset($_POST['sender_comment'])) ? $system->cleanvars($_POST['sender_comment']) : '',
- 'EMAILSENT' => $emailsent
- ));
+ 'ERROR' => $TPL_error_text,
+ 'ID' => intval($_REQUEST['id']),
+ 'CAPTCHATYPE' => $system->SETTINGS['spam_sendtofriend'],
+ 'CAPCHA' => (isset($capcha_text)) ? $capcha_text : '',
+ 'TITLE' => $TPL_item_title,
+ 'FRIEND_NAME' => (isset($_POST['friend_name'])) ? $system->cleanvars($_POST['friend_name']) : '',
+ 'FRIEND_EMAIL' => (isset($_POST['friend_email'])) ? $system->cleanvars($_POST['friend_email']) : '',
+ 'YOUR_NAME' => ($user->logged_in) ? $system->cleanvars($user->user_data['name']) : '',
+ 'YOUR_EMAIL' => ($user->logged_in) ? $system->cleanvars($user->user_data['email']) : '',
+ 'COMMENT' => (isset($_POST['sender_comment'])) ? $system->cleanvars($_POST['sender_comment']) : '',
+ 'EMAILSENT' => $emailsent
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'friend.tpl'
- ));
+ 'body' => 'friend.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/getthumb.php b/getthumb.php
old mode 100644
new mode 100755
index 848e835a3..a049c07c2
--- a/getthumb.php
+++ b/getthumb.php
@@ -1,6 +1,6 @@
SETTINGS['thumb_show'],
- $system->SETTINGS['thumb_list'],
- 430,
- '' // load default image
+ $system->SETTINGS['thumb_show'],
+ $system->SETTINGS['thumb_list'],
+ '' // load default image
);
$w = (in_array($w, $accepted_widths)) ? $w : '';
function ErrorPNG($err)
{
- header('Content-type: image/png');
- $im = imagecreate(100, 30);
- $bgc = imagecolorallocate($im, 255, 255, 255);
- $tc = imagecolorallocate($im, 0, 0, 0);
- imagefilledrectangle($im, 0, 0, 100, 30, $bgc);
- imagestring($im, 1, 5, 5, $err, $tc);
- imagepng($im);
+ header('Content-type: image/png');
+ $im = imagecreate(100, 30);
+ $bgc = imagecolorallocate($im, 255, 255, 255);
+ $tc = imagecolorallocate($im, 0, 0, 0);
+ imagefilledrectangle($im, 0, 0, 100, 30, $bgc);
+ imagestring($im, 1, 5, 5, $err, $tc);
+ imagepng($im);
}
function load_image($file, $mime, $image_type, $output_type)
{
- header('Content-Type: ' . $mime);
- $funcall = "imagecreatefrom$image_type";
- $image = $funcall($file);
- $funcall = "image$output_type";
- $funcall($image);
- exit;
+ header('Content-Type: ' . $mime);
+ $funcall = "imagecreatefrom$image_type";
+ $image = $funcall($file);
+ $funcall = "image$output_type";
+ $funcall($image);
+ exit;
}
-if (file_exists(UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile))) {
- $img = getimagesize($file_path);
- switch ($img[2]) {
- case IMAGETYPE_GIF:
- if (!(imagetypes() &IMG_GIF)) {
- if (!function_exists('imagecreatefromgif')) {
- $nomanage = true;
- } else {
- $img['mime'] = 'image/png';
- }
- } else {
- $img['mime'] = 'image/gif';
- }
- break;
- case IMAGETYPE_JPEG:
- if (!(imagetypes() &IMG_JPG)) {
- $nomanage = true;
- }
- $img['mime'] = 'image/jpeg';
- break;
- case IMAGETYPE_PNG:
- if (!(imagetypes() &IMG_PNG)) {
- $nomanage = true;
- }
- $img['mime'] = 'image/png';
- break;
- default:
- $nomanage = true;
- break;
- }
- if ($nomanage) {
- ErrorPNG($ERR_710);
- exit;
- }
- header('Content-type: ' . $img['mime']);
- echo file_get_contents(UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile));
-} else {
- if (function_exists('imagetypes')) {
- if (!is_dir(UPLOAD_PATH . 'cache')) {
- mkdir(UPLOAD_PATH . 'cache', 0777);
- }
+// control parameters and file existence
+if (!isset($_GET['fromfile']) || $fromfile == '')
+{
+ ErrorPNG($ERR_716);
+ exit;
+}
+elseif (!file_exists($_GET['fromfile']) && !fopen($_GET['fromfile'], 'r'))
+{
+ ErrorPNG($ERR_716);
+ exit;
+}
+
+if (file_exists(UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile)))
+{
+ $img = getimagesize($fromfile);
+ switch ($img[2])
+ {
+ case IMAGETYPE_GIF:
+ if (!(imagetypes() &IMG_GIF))
+ {
+ if (!function_exists('imagecreatefromgif'))
+ {
+ $nomanage = true;
+ }
+ else
+ {
+ $img['mime'] = 'image/png';
+ }
+ }
+ else
+ {
+ $img['mime'] = 'image/gif';
+ }
+ break;
+ case IMAGETYPE_JPEG:
+ if (!(imagetypes() &IMG_JPG)) $nomanage = true;
+ $img['mime'] = 'image/jpeg';
+ break;
+ case IMAGETYPE_PNG:
+ if (!(imagetypes() &IMG_PNG)) $nomanage = true;
+ $img['mime'] = 'image/png';
+ break;
+ default:
+ $nomanage = true;
+ break;
+ }
+ if ($nomanage)
+ {
+ ErrorPNG($ERR_710);
+ exit;
+ }
+ header('Content-type: ' . $img['mime']);
+ echo file_get_contents(UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile));
+}
+else
+{
+ if (function_exists('imagetypes'))
+ {
+ if (!is_dir(UPLOAD_PATH . 'cache')) mkdir(UPLOAD_PATH . 'cache', 0777);
- $img = @getimagesize($file_path);
- if (is_array($img)) {
- switch ($img[2]) {
- case IMAGETYPE_GIF:
- if (!(imagetypes() &IMG_GIF)) {
- if (!function_exists('imagecreatefromgif')) {
- $nomanage = true;
- } else {
- $output_type = 'png';
- $img['mime'] = 'image/png';
- }
- } else {
- $output_type = 'gif';
- $img['mime'] = 'image/gif';
- }
- $image_type = 'gif';
- break;
- case IMAGETYPE_JPEG:
- if (!(imagetypes() &IMG_JPG)) {
- $nomanage = true;
- }
- $output_type = 'jpeg';
- $img['mime'] = 'image/jpeg';
- $image_type = 'jpeg';
- break;
- case IMAGETYPE_PNG:
- if (!(imagetypes() &IMG_PNG)) {
- $nomanage = true;
- }
- $image_type = 'png';
- $img['mime'] = 'image/png';
- $output_type = 'png';
- break;
- default:
- ErrorPNG($ERR_710);
- exit;
- }
- } else {
- ErrorPNG($ERR_710);
- exit;
- }
- if ($w == '') {
- // just load the image
- load_image($file_path, $img['mime'], $image_type, $output_type);
- } else {
- // check image orientation
- if ($img[0] < $img[1]) {
- $h = $w;
- $ratio = floatval($img[1] / $h);
- $w = ceil($img[0] / $ratio);
- } else {
- $ratio = floatval($img[0] / $w);
- $h = ceil($img[1] / $ratio);
- }
-
- $ou = imagecreatetruecolor($w, $h);
- imagealphablending($ou, false);
- $funcall = "imagecreatefrom$image_type";
- imagecopyresampled($ou, $funcall($file_path), 0, 0, 0, 0, $w, $h, $img[0], $img[1]);
- $funcall = "image$output_type";
- $funcall($ou, UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile));
- header('Content-type: ' . $img['mime']);
- $funcall($ou);
- exit;
- }
- } else {
- ErrorPNG($ERR_710);
- exit;
- }
+ $img = @getimagesize($fromfile);
+ if (is_array($img))
+ {
+ switch ($img[2])
+ {
+ case IMAGETYPE_GIF:
+ if (!(imagetypes() &IMG_GIF))
+ {
+ if (!function_exists('imagecreatefromgif'))
+ {
+ $nomanage = true;
+ }
+ else
+ {
+ $output_type = 'png';
+ $img['mime'] = 'image/png';
+ }
+ }
+ else
+ {
+ $output_type = 'gif';
+ $img['mime'] = 'image/gif';
+ }
+ $image_type = 'gif';
+ break;
+ case IMAGETYPE_JPEG:
+ if (!(imagetypes() &IMG_JPG)) $nomanage = true;
+ $output_type = 'jpeg';
+ $img['mime'] = 'image/jpeg';
+ $image_type = 'jpeg';
+ break;
+ case IMAGETYPE_PNG:
+ if (!(imagetypes() &IMG_PNG)) $nomanage = true;
+ $image_type = 'png';
+ $img['mime'] = 'image/png';
+ $output_type = 'png';
+ break;
+ default :
+ ErrorPNG($ERR_710);
+ exit;
+ }
+ }
+ else
+ {
+ ErrorPNG($ERR_710);
+ exit;
+ }
+ if ($w == '')
+ {
+ // just load the image
+ load_image($fromfile, $img['mime'], $image_type, $output_type);
+ }
+ else
+ {
+ // check image orientation
+ if ($img[0] < $img[1])
+ {
+ $h = $w;
+ $ratio = floatval($img[1] / $h);
+ $w = ceil($img[0] / $ratio);
+ }
+ else
+ {
+ $ratio = floatval($img[0] / $w);
+ $h = ceil($img[1] / $ratio);
+ }
+
+ $ou = imagecreatetruecolor($w, $h);
+ imagealphablending($ou, false);
+ $funcall = "imagecreatefrom$image_type";
+ imagecopyresampled($ou, $funcall($fromfile), 0, 0, 0, 0, $w, $h, $img[0], $img[1]);
+ $funcall = "image$output_type";
+ $funcall($ou, UPLOAD_PATH . 'cache/' . $_w . '-' . md5($fromfile));
+ header('Content-type: ' . $img['mime']);
+ $funcall($ou);
+ exit;
+ }
+ }
+ else
+ {
+ ErrorPNG($ERR_710);
+ exit;
+ }
}
diff --git a/header.php b/header.php
old mode 100644
new mode 100755
index f082ba7af..4c313cd12
--- a/header.php
+++ b/header.php
@@ -1,6 +1,6 @@
SETTINGS['https'] == 'y' && (!isset($_SERVER['HTTPS']) || (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'off'))) {
- header("Location: https://" . $system->SETTINGS['siteurl'] . $_SERVER["REQUEST_URI"]);
+if($system->SETTINGS['https'] == 'y' && $_SERVER['HTTPS'] != "on")
+{
+ $cleaned_url = str_replace(['http://', 'https://'], '', $system->SETTINGS['siteurl']);
+ header("Location: https://" . $cleaned_url . $_SERVER["REQUEST_URI"]);
exit();
}
$template->assign_vars(array(
- 'DOCDIR' => $DOCDIR, // Set document direction
- 'THEME' => $system->SETTINGS['theme'],
- 'PAGE_TITLE' => $system->SETTINGS['sitename'] . $page_title,
- 'CHARSET' => $CHARSET,
- 'DESCRIPTION' => $system->SETTINGS['descriptiontag'],
- 'KEYWORDS' => $system->SETTINGS['keywordstag'],
- 'ACTUALDATE' => $dt->formatDate($dt->currentDatetime(), 'M d, Y H:i:s', false),
- 'LOGO' => $system->SETTINGS['logo'],
- 'BANNER' => ($system->SETTINGS['banners'] == 1) ? view() : '',
- 'HEADERCOUNTER' => $counters,
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'Q' => (isset($q)) ? $q : '',
- 'SELECTION_BOX' => file_get_contents(MAIN_PATH . 'language/' . $language . '/categories_select_box.inc.php'),
- 'YOURUSERNAME' => ($user->logged_in) ? $user->user_data['nick'] : '',
- 'GOOGLEANALYTICS' => $system->SETTINGS['googleanalytics'],
-
- 'B_CAN_SELL' => ($user->permissions['can_sell'] || !$user->logged_in),
- 'B_LOGGED_IN' => $user->logged_in,
- 'B_BOARDS' => ($system->SETTINGS['boards'] == 'y')
- ));
+ 'DOCDIR' => $DOCDIR, // Set document direction
+ 'THEME' => $system->SETTINGS['theme'],
+ 'PAGE_TITLE' => $system->SETTINGS['sitename'] . $page_title,
+ 'CHARSET' => $CHARSET,
+ 'DESCRIPTION' => $system->SETTINGS['descriptiontag'],
+ 'KEYWORDS' => $system->SETTINGS['keywordstag'],
+ 'ACTUALDATE' => ActualDate(),
+ 'LOGO' => $system->SETTINGS['logo'],
+ 'BANNER' => ($system->SETTINGS['banners'] == 1) ? view() : '',
+ 'HEADERCOUNTER' => $counters,
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'Q' => (isset($q)) ? $q : '',
+ 'SELECTION_BOX' => file_get_contents(MAIN_PATH . 'language/' . $language . '/categories_select_box.inc.php'),
+ 'YOURUSERNAME' => ($user->logged_in) ? $user->user_data['nick'] : '',
+ 'GOOGLEANALYTICS' => $system->SETTINGS['googleanalytics'],
+
+ 'B_CAN_SELL' => ($user->can_sell || !$user->logged_in),
+ 'B_LOGGED_IN' => $user->logged_in,
+ 'B_BOARDS' => ($system->SETTINGS['boards'] == 'y')
+ ));
$template->set_filenames(array(
- 'header' => 'global_header.tpl'
- ));
+ 'header' => 'global_header.tpl'
+ ));
$template->display('header');
diff --git a/help.php b/help.php
old mode 100644
new mode 100755
index 3e379d2be..3741acba8
--- a/help.php
+++ b/help.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'DOCDIR' => $DOCDIR, // Set document direction (set in includes/messages.XX.inc.php) ltr/rtl
- 'PAGE_TITLE' => $system->SETTINGS['sitename'] . ' ' . $MSG['5236'],
- 'CHARSET' => $CHARSET,
- 'LOGO' => ($system->SETTINGS['logo']) ? ' ' : " ",
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'THEME' => $system->SETTINGS['theme']
- ));
+ 'DOCDIR' => $DOCDIR, // Set document direction (set in includes/messages.XX.inc.php) ltr/rtl
+ 'PAGE_TITLE' => $system->SETTINGS['sitename'] . ' ' . $MSG['5236'],
+ 'CHARSET' => $CHARSET,
+ 'LOGO' => ($system->SETTINGS['logo']) ? ' ' : " ",
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'THEME' => $system->SETTINGS['theme']
+ ));
- include 'header.php';
+ include 'header.php';
// Retrieve FAQs categories from the database
$query = "SELECT * FROM " . $DBPrefix . "faqscat_translated WHERE lang = :language ORDER BY category ASC";
$params = array();
$params[] = array(':language', $language, 'str');
$db->query($query, $params);
-while ($cat = $db->fetch()) {
- $template->assign_block_vars('cats', array(
- 'CAT' => $cat['category'],
- 'ID' => $cat['id']
- ));
+while ($cat = $db->fetch())
+{
+ $template->assign_block_vars('cats', array(
+ 'CAT' => $cat['category'],
+ 'ID' => $cat['id']
+ ));
}
$template->set_filenames(array(
- 'body' => 'help.tpl'
- ));
+ 'body' => 'help.tpl'
+ ));
$template->display('body');
-include 'footer.php';
+include 'footer.php';
\ No newline at end of file
diff --git a/images/arrow.gif b/images/arrow.gif
old mode 100644
new mode 100755
diff --git a/images/arrow2.gif b/images/arrow2.gif
old mode 100644
new mode 100755
diff --git a/images/arrow_down.gif b/images/arrow_down.gif
old mode 100644
new mode 100755
diff --git a/images/arrow_up.gif b/images/arrow_up.gif
old mode 100644
new mode 100755
diff --git a/images/authnet.gif b/images/authnet.gif
old mode 100644
new mode 100755
diff --git a/images/back_bar2.gif b/images/back_bar2.gif
old mode 100644
new mode 100755
diff --git a/images/ball.gif b/images/ball.gif
old mode 100644
new mode 100755
diff --git a/images/bc_but.gif b/images/bc_but.gif
old mode 100644
new mode 100755
diff --git a/images/bc_foot.gif b/images/bc_foot.gif
old mode 100644
new mode 100755
diff --git a/images/bc_search2.gif b/images/bc_search2.gif
old mode 100644
new mode 100755
diff --git a/images/bk_b_but.gif b/images/bk_b_but.gif
old mode 100644
new mode 100755
diff --git a/images/bk_tit2.gif b/images/bk_tit2.gif
old mode 100644
new mode 100755
diff --git a/images/border-anim-h.gif b/images/border-anim-h.gif
old mode 100644
new mode 100755
diff --git a/images/border-anim-v.gif b/images/border-anim-v.gif
old mode 100644
new mode 100755
diff --git a/images/border-h.gif b/images/border-h.gif
old mode 100644
new mode 100755
diff --git a/images/border-v.gif b/images/border-v.gif
old mode 100644
new mode 100755
diff --git a/images/bullet.gif b/images/bullet.gif
old mode 100644
new mode 100755
diff --git a/images/edititem.gif b/images/edititem.gif
old mode 100644
new mode 100755
diff --git a/images/email_alerts/Active_Acct_Btn.jpg b/images/email_alerts/Active_Acct_Btn.jpg
old mode 100644
new mode 100755
diff --git a/images/email_alerts/Sell_More_Btn.jpg b/images/email_alerts/Sell_More_Btn.jpg
old mode 100644
new mode 100755
diff --git a/images/email_alerts/Take_Me_There.jpg b/images/email_alerts/Take_Me_There.jpg
old mode 100644
new mode 100755
diff --git a/images/email_alerts/Total_Due_Btn.jpg b/images/email_alerts/Total_Due_Btn.jpg
old mode 100644
new mode 100755
diff --git a/images/email_alerts/default_item_img.jpg b/images/email_alerts/default_item_img.jpg
old mode 100644
new mode 100755
diff --git a/images/flags/DE.gif b/images/flags/DE.gif
old mode 100644
new mode 100755
diff --git a/images/flags/DK.gif b/images/flags/DK.gif
old mode 100644
new mode 100755
diff --git a/images/flags/EN.gif b/images/flags/EN.gif
old mode 100644
new mode 100755
diff --git a/images/flags/ES.gif b/images/flags/ES.gif
old mode 100644
new mode 100755
diff --git a/images/flags/FR.gif b/images/flags/FR.gif
old mode 100644
new mode 100755
diff --git a/images/flags/IT.gif b/images/flags/IT.gif
old mode 100644
new mode 100755
diff --git a/images/flags/MO.gif b/images/flags/MO.gif
old mode 100644
new mode 100755
diff --git a/images/flags/NL.gif b/images/flags/NL.gif
old mode 100644
new mode 100755
diff --git a/images/flags/PL.gif b/images/flags/PL.gif
old mode 100644
new mode 100755
index 3d7fca15c..3ae3a06cd
Binary files a/images/flags/PL.gif and b/images/flags/PL.gif differ
diff --git a/images/gallery.gif b/images/gallery.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starB.gif b/images/icons/starB.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starFR.gif b/images/icons/starFR.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starFT.gif b/images/icons/starFT.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starFV.gif b/images/icons/starFV.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starFY.gif b/images/icons/starFY.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starG.gif b/images/icons/starG.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starR.gif b/images/icons/starR.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starT.gif b/images/icons/starT.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starV.gif b/images/icons/starV.gif
old mode 100644
new mode 100755
diff --git a/images/icons/starY.gif b/images/icons/starY.gif
old mode 100644
new mode 100755
diff --git a/images/icons/transparent.gif b/images/icons/transparent.gif
old mode 100644
new mode 100755
diff --git a/images/imgsep.gif b/images/imgsep.gif
old mode 100644
new mode 100755
diff --git a/images/info.gif b/images/info.gif
old mode 100644
new mode 100755
diff --git a/images/lightbox-blank.gif b/images/lightbox-blank.gif
old mode 100644
new mode 100755
diff --git a/images/lightbox-btn-close.gif b/images/lightbox-btn-close.gif
old mode 100644
new mode 100755
diff --git a/images/lightbox-btn-next.gif b/images/lightbox-btn-next.gif
old mode 100644
new mode 100755
diff --git a/images/lightbox-btn-prev.gif b/images/lightbox-btn-prev.gif
old mode 100644
new mode 100755
diff --git a/images/lightbox-ico-loading.gif b/images/lightbox-ico-loading.gif
old mode 100644
new mode 100755
diff --git a/images/linea.gif b/images/linea.gif
old mode 100644
new mode 100755
diff --git a/images/moneybookers.gif b/images/moneybookers.gif
new file mode 100755
index 000000000..a1e020a18
Binary files /dev/null and b/images/moneybookers.gif differ
diff --git a/images/negative.png b/images/negative.png
old mode 100644
new mode 100755
diff --git a/images/neutral.png b/images/neutral.png
old mode 100644
new mode 100755
diff --git a/images/nodelete.gif b/images/nodelete.gif
old mode 100644
new mode 100755
diff --git a/images/paypal.gif b/images/paypal.gif
old mode 100644
new mode 100755
diff --git a/images/picture.gif b/images/picture.gif
old mode 100644
new mode 100755
diff --git a/images/plus.gif b/images/plus.gif
old mode 100644
new mode 100755
diff --git a/images/positive.png b/images/positive.png
old mode 100644
new mode 100755
diff --git a/images/rss.png b/images/rss.png
old mode 100644
new mode 100755
diff --git a/images/selected.gif b/images/selected.gif
old mode 100644
new mode 100755
diff --git a/images/sep_bco.gif b/images/sep_bco.gif
old mode 100644
new mode 100755
diff --git a/images/skrill.png b/images/skrill.png
deleted file mode 100644
index 1168c5d0f..000000000
Binary files a/images/skrill.png and /dev/null differ
diff --git a/images/tit_l.gif b/images/tit_l.gif
old mode 100644
new mode 100755
diff --git a/images/tit_r.gif b/images/tit_r.gif
old mode 100644
new mode 100755
diff --git a/images/toocheckout.gif b/images/toocheckout.gif
old mode 100644
new mode 100755
diff --git a/images/transparent.gif b/images/transparent.gif
old mode 100644
new mode 100755
diff --git a/images/trash.gif b/images/trash.gif
old mode 100644
new mode 100755
diff --git a/images/unselected.gif b/images/unselected.gif
old mode 100644
new mode 100755
diff --git a/images/worldpay.gif b/images/worldpay.gif
old mode 100644
new mode 100755
diff --git a/includes/Date.php b/includes/Date.php
deleted file mode 100644
index 0bebf5670..000000000
--- a/includes/Date.php
+++ /dev/null
@@ -1,131 +0,0 @@
-SETTINGS['timezone'];
- if ($user->logged_in) {
- $timezone = $user->user_data['timezone'];
- }
- $this->timezone = new DateTimeZone($timezone);
- $this->UTCtimezone = new DateTimeZone('UTC');
-
- if ($system->SETTINGS['datesformat'] == 'USA') {
- $this->defaultformat = 'm/d/Y';
- } else {
- $this->defaultformat = 'd/m/Y';
- }
- }
-
- // convert datetime from UTC to users timezone
- public function printDateTz($datetime, $UTC_input = true)
- {
- if ($UTC_input) {
- $UTC_time = new DateTime($datetime, $this->UTCtimezone);
- $UTC_time->setTimezone($this->timezone);
- return $UTC_time->format('Y-m-d H:i');
- } else {
- $tmp = new DateTime($datetime, $this->timezone);
- return $tmp->format('Y-m-d H:i');
- }
- }
-
- public function currentDatetime($UTC = false)
- {
- if ($UTC) {
- $datetime = new DateTime('now', $this->UTCtimezone);
- } else {
- $datetime = new DateTime('now', $this->timezone);
- }
- return $datetime->format('Y-m-d H:i:s');
- }
-
- // convert raw date string into datetime UTC timezone
- public function convertToDatetime($raw_date, $format = false)
- {
- if (!$format) {
- $datetime = DateTime::createFromFormat($this->defaultformat, $raw_date, $this->timezone);
- } else {
- $datetime = new DateTime(strtotime($raw_date), $this->timezone);
- }
- $datetime->setTimezone($this->UTCtimezone);
- return $datetime->format('Y-m-d H:i:s');
- }
-
- public function convertToUTC($raw_date)
- {
- $UTC_time = new DateTime($raw_date, $this->timezone);
- $UTC_time->setTimezone($this->UTCtimezone);
- return $UTC_time->format('Y-m-d H:i:s');
- }
-
- public function formatDate($raw_date, $format = false, $UTC_input = true)
- {
- if ($UTC_input) {
- $datetime = new DateTime($raw_date, $this->UTCtimezone);
- $datetime->setTimezone($this->timezone);
- } else {
- $datetime = new DateTime($raw_date, $this->timezone);
- }
- if (!$format) {
- return $datetime->format($this->defaultformat);
- } else {
- return $datetime->format($format);
- }
- }
-
- public function formatTimeLeft($diff)
- {
- global $MSG;
-
- $timeleft = '';
- if ($diff->y > 0) {
- $timeleft = $diff->y . $MSG['year_s'];
- } elseif ($diff->m > 0) {
- $timeleft = $diff->m . $MSG['month_s'];
- } elseif ($diff->d > 0) {
- $timeleft = $diff->d . $MSG['day_short'] . ' ';
- if ($diff->h > 0) {
- $timeleft .= $diff->h . $MSG['hour_short'] . ' ';
- }
- } else {
- if ($diff->h > 0) {
- $timeleft .= $diff->h . $MSG['hour_short'] . ' ';
- }
- if ($diff->i > 0) {
- $timeleft .= $diff->i . $MSG['minute_short'] . ' ';
- } elseif ($diff->h == 0 && $diff->i == 0 && $diff->s > 0) {
- $timeleft = '<1' . $MSG['minute_short'];
- }
- if ($diff->invert) {
- $timeleft = $MSG['911'];
- }
- }
- if ($diff->y == 0 && $diff->m == 0 && $diff->d == 0 && $diff->h == 0 && $diff->m < 15) {
- $timeleft = '' . $timeleft . ' ';
- }
-
- return $timeleft;
- }
-}
diff --git a/includes/Time.php b/includes/Time.php
new file mode 100755
index 000000000..cc2176a70
--- /dev/null
+++ b/includes/Time.php
@@ -0,0 +1,136 @@
+system = $system;
+ $this->tz_UTC = new DateTimeZone('UTC');
+ if (!empty($timezone))
+ {
+ $this->tz_user = new DateTimeZone($timezone);
+ }
+ else
+ {
+ $this->tz_user = false;
+ }
+ }
+
+ // used to be: dates.inc.php FormatDate($DATE, $spacer = '/', $GMT = true)
+ public function formatTimestamp($timestamp, $format = '', $timezone_ajust = true)
+ {
+ if ($format == '')
+ {
+ $format = ($this->system->SETTINGS['datesformat'] == 'USA') ? 'm/d/Y' : 'd/m/Y';
+ }
+
+ $dt = DateTime::createFromFormat('U', $timestamp, $this->tz_UTC);
+ if ($timezone_ajust && !$this->tz_user)
+ {
+ $dt->setTimezone($this->tz_user);
+ }
+ return $date->format($format);
+ }
+
+ // used to be: dates.inc.php FormatTimeStamp($DATE, $spacer = '-')
+ public function dateToTimestamp($date, $format = '')
+ {
+ if ($format == '')
+ {
+ $format = ($this->system->SETTINGS['datesformat'] == 'USA') ? 'm/d/Y' : 'd/m/Y';
+ }
+ $dt = DateTime::createFromFormat($format, $date, $this->tz_UTC);
+ return $dt->format('U');
+ }
+
+ public function formatTimeLeft($diff)
+ {
+ global $MSG;
+
+ $days_difference = floor($diff / 86400);
+ $difference = $diff % 86400;
+ $hours_difference = floor($difference / 3600);
+ $difference = $difference % 3600;
+ $minutes_difference = floor($difference / 60);
+ $seconds_difference = $difference % 60;
+ $secshow = false;
+ $timeleft = '';
+
+ if ($days_difference > 0)
+ {
+ $timeleft = $days_difference . 'd ';
+ }
+ if ($hours_difference > 0)
+ {
+ $timeleft .= $hours_difference . 'h ';
+ }
+ else
+ {
+ $secshow = true;
+ }
+ if ($diff > 60)
+ {
+ $timeleft .= $minutes_difference . 'm ';
+ }
+ elseif ($diff > 60 && !$seconds)
+ {
+ $timeleft = '<1m';
+ }
+ if ($secshow)
+ {
+ $timeleft .= $seconds_difference . 's ';
+ }
+ if ($diff < 0)
+ {
+ $timeleft = $MSG['911'];
+ }
+ if (($diff * 60) < 15)
+ {
+ $timeleft = '' . $timeleft . ' ';
+ }
+
+ return $timeleft;
+ }
+
+ private function getConvertedDateTimeObject($timestamp, $userTimezone)
+ {
+ # create server and user timezone objects
+ $toZone = new DateTimeZone($userTimezone); // Europe/London, or whatever it happens to be
+
+ $dt = DateTime::createFromFormat('U', $timestamp, $this->tz_UTC);
+ $dt->setTimezone($toZone);
+ return $dt;
+ }
+
+ public function getUserTimestamp($timestamp, $userTimezone)
+ {
+ $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
+ return $dt->getTimestamp();
+ }
+
+ public function getUserOffset($timestamp, $userTimezone)
+ {
+ $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
+ return $dt->getOffset();
+ }
+}
diff --git a/includes/User.php b/includes/User.php
old mode 100644
new mode 100755
index b11d3b8a3..be016df83
--- a/includes/User.php
+++ b/includes/User.php
@@ -1,6 +1,6 @@
false,
- 'can_buy' => false,
- 'no_fees' => false
- ];
- public $logged_in = false;
+ public $user_data = [];
+ public $logged_in = false;
+ public $can_sell = false;
+ public $can_buy = false;
- public function __construct()
- {
- if (!$this->checkLoginSession()) {
- $this->rememberMeLogin();
- }
- $this->userPermissions();
- $this->checkBalance();
- }
-
- private function rememberMeLogin()
- {
- global $db, $_COOKIE, $DBPrefix, $_SESSION;
-
- if (!$this->logged_in && isset($_COOKIE['WEBID_RM_ID'])) {
- $query = "SELECT userid FROM " . $DBPrefix . "rememberme WHERE hashkey = :RM_ID";
- $params = array();
- $params[] = array(':RM_ID', alphanumeric($_COOKIE['WEBID_RM_ID']), 'str');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- // generate a random unguessable token
- $_SESSION['csrftoken'] = md5(uniqid(rand(), true));
- $id = $db->result('userid');
- $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $user_data = $db->result();
- $this->user_data = $user_data;
- $_SESSION['WEBID_LOGGED_IN'] = $id;
- $_SESSION['WEBID_LOGGED_NUMBER'] = strspn($user_data['password'], $user_data['hash']);
- $_SESSION['WEBID_LOGGED_PASS'] = $user_data['password'];
- $this->logged_in = true;
- return true;
- }
- }
- }
- return false;
- }
-
- private function checkLoginSession()
- {
- global $DBPrefix, $_SESSION, $db;
+ function __construct()
+ {
+ if (!$this->checkLoginSession())
+ {
+ $this->rememberMeLogin();
+ }
+ $this->userPermissions();
+ $this->checkBalance();
+ }
+
+ private function rememberMeLogin()
+ {
+ global $db, $_COOKIE, $DBPrefix, $_SESSION;
+
+ if (!$this->logged_in && isset($_COOKIE['WEBID_RM_ID']))
+ {
+ $query = "SELECT userid FROM " . $DBPrefix . "rememberme WHERE hashkey = :RM_ID";
+ $params = array();
+ $params[] = array(':RM_ID', alphanumeric($_COOKIE['WEBID_RM_ID']), 'str');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ // generate a random unguessable token
+ $_SESSION['csrftoken'] = md5(uniqid(rand(), true));
+ $id = $db->result('userid');
+ $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $user_data = $db->result();
+ $this->user_data = $user_data;
+ $_SESSION['WEBID_LOGGED_IN'] = $id;
+ $_SESSION['WEBID_LOGGED_NUMBER'] = strspn($user_data['password'], $user_data['hash']);
+ $_SESSION['WEBID_LOGGED_PASS'] = $user_data['password'];
+ $this->logged_in = true;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private function checkLoginSession()
+ {
+ global $DBPrefix, $_SESSION, $db;
- if (isset($_SESSION['WEBID_LOGGED_NUMBER']) && isset($_SESSION['WEBID_LOGGED_IN']) && isset($_SESSION['WEBID_LOGGED_PASS'])) {
- $query = "SELECT * FROM " . $DBPrefix . "users WHERE password = :pass AND id = :login";
- $params = array();
- $params[] = array(':pass', $_SESSION['WEBID_LOGGED_PASS'], 'str');
- $params[] = array(':login', $_SESSION['WEBID_LOGGED_IN'], 'str');
- $db->query($query, $params);
+ if (isset($_SESSION['WEBID_LOGGED_NUMBER']) && isset($_SESSION['WEBID_LOGGED_IN']) && isset($_SESSION['WEBID_LOGGED_PASS']))
+ {
+ $query = "SELECT * FROM " . $DBPrefix . "users WHERE password = :pass AND id = :login";
+ $params = array();
+ $params[] = array(':pass', $_SESSION['WEBID_LOGGED_PASS'], 'str');
+ $params[] = array(':login', $_SESSION['WEBID_LOGGED_IN'], 'str');
+ $db->query($query, $params);
- if ($db->numrows() > 0) {
- $user_data = $db->result();
-
- if (strspn($user_data['password'], $user_data['hash']) == $_SESSION['WEBID_LOGGED_NUMBER']) {
- $this->user_data = $user_data;
- $this->logged_in = true;
- return true;
- }
- }
- }
- return false;
- }
-
- private function userPermissions()
- {
- global $DBPrefix, $db;
- if ($this->logged_in) {
- if ($this->user_data['suspended'] != 7) {
- // check if user can sell or buy
- if (strlen($this->user_data['groups']) > 0) {
- $query = "SELECT can_sell, can_buy, no_fees FROM " . $DBPrefix . "groups WHERE id IN (" . $this->user_data['groups'] . ") AND (can_sell = 1 OR can_buy = 1 OR no_fees = 1)";
- $db->direct_query($query);
- while ($row = $db->fetch()) {
- if ($row['can_sell'] == 1) {
- $this->permissions['can_sell'] = true;
- }
- if ($row['can_buy'] == 1) {
- $this->permissions['can_buy'] = true;
- }
- if ($row['no_fees'] == 1) {
- $this->permissions['no_fees'] = true;
- }
- }
- }
- }
- }
- }
+ if ($db->numrows() > 0)
+ {
+ $user_data = $db->result();
+
+ if (strspn($user_data['password'], $user_data['hash']) == $_SESSION['WEBID_LOGGED_NUMBER'])
+ {
+ $this->user_data = $user_data;
+ $this->logged_in = true;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private function userPermissions()
+ {
+ global $DBPrefix, $db;
+ if ($this->logged_in)
+ {
+ if ($this->user_data['suspended'] != 7)
+ {
+ // check if user can sell or buy
+ if (strlen($this->user_data['groups']) > 0)
+ {
+ $query = "SELECT can_sell, can_buy FROM " . $DBPrefix . "groups WHERE id IN (" . $this->user_data['groups'] . ") AND (can_sell = 1 OR can_buy = 1)";
+ $db->direct_query($query);
+ while ($row = $db->fetch())
+ {
+ if ($row['can_sell'] == 1)
+ {
+ $this->can_sell = true;
+ }
+ if ($row['can_buy'] == 1)
+ {
+ $this->can_buy = true;
+ }
+ }
+ }
+ }
+ }
+ }
- public function checkAuth()
- {
- if (isset($_SESSION['csrftoken'])) {
- # Token should exist as soon as a user is logged in
- if (1 < count($_POST)) { # More than 2 parameters in a POST (csrftoken + 1 more) => check
- $valid_req = ($_POST['csrftoken'] == $_SESSION['csrftoken']);
- } else {
- $valid_req = true;
- } # Neither GET nor POST params exist => permit
- if (!$valid_req) {
+ public function checkAuth()
+ {
+ if(isset($_SESSION['csrftoken']))
+ {
+ # Token should exist as soon as a user is logged in
+ if(1 < count($_POST)) # More than 2 parameters in a POST (csrftoken + 1 more) => check
+ $valid_req = ($_POST['csrftoken'] == $_SESSION['csrftoken']);
+ else
+ $valid_req = true; # Neither GET nor POST params exist => permit
+ if(!$valid_req)
+ {
global $MSG, $ERR_077;
$_SESSION['msg_title'] = $MSG['936'];
$_SESSION['msg_body'] = $ERR_077;
- header('location: message.php');
- exit; // kill the page
+ header('location: message.php');
+ exit; // kill the page
}
- }
- return $this->logged_in;
- }
+ }
+ return $this->logged_in;
+ }
- public function checkSuspended()
- {
- if (in_array($this->user_data['suspended'], array(5, 6, 7))) {
- header('location: message.php');
- exit;
- }
- }
+ public function checkSuspended()
+ {
+ if (in_array($this->user_data['suspended'], array(5, 6, 7)))
+ {
+ header('location: message.php');
+ exit;
+ }
+ }
- private function checkBalance()
- {
- global $system, $DBPrefix, $MSG, $db;
+ private function checkBalance()
+ {
+ global $system, $DBPrefix, $MSG, $db;
- // check if user needs to be suspended
- if ($system->SETTINGS['fee_type'] == 1 && $this->logged_in && $this->user_data['suspended'] != 7 && $system->SETTINGS['fee_disable_acc'] == 'y') {
- if ($system->SETTINGS['fee_max_debt'] <= (-1 * $this->user_data['balance'])) {
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 7 WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $this->user_data['id'], 'int');
- $db->query($query, $params);
+ // check if user needs to be suspended
+ if ($system->SETTINGS['fee_type'] == 1 && $this->logged_in && $this->user_data['suspended'] != 7 && $system->SETTINGS['fee_disable_acc'] == 'y')
+ {
+ if ($system->SETTINGS['fee_max_debt'] <= (-1 * $this->user_data['balance']))
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 7 WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $this->user_data['id'], 'int');
+ $db->query($query, $params);
- // send email
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
+ // send email
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'NAME' => $this->user_data['name'],
- 'BALANCE' => $system->print_money($this->user_data['balance']),
- 'OUTSTANDING' => $system->SETTINGS['siteurl'] . 'outstanding.php'
- ));
- $emailer->email_uid = $this->user_data['id'];
- $emailer->email_sender($this->user_data['email'], 'suspended_balance.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['753']);
- }
- }
- }
+ 'NAME' => $this->user_data['name'],
+ 'BALANCE' => $system->print_money($this->user_data['balance']),
+ 'OUTSTANDING' => $system->SETTINGS['siteurl'] . 'outstanding.php'
+ ));
+ $emailer->email_uid = $this->user_data['id'];
+ $emailer->email_sender($this->user_data['email'], 'suspended_balance.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['753']);
+ }
+ }
+ }
- public function checkUserValid($id)
- {
- global $system, $MSG, $ERR_025, $DBPrefix, $db;
+ public function checkUserValid($id)
+ {
+ global $system, $MSG, $ERR_025, $DBPrefix, $db;
- $query = "SELECT id FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $_SESSION['msg_title'] = $MSG['415'];
- $_SESSION['msg_body'] = $ERR_025;
- header('location: message.php');
- exit;
- }
- }
+ $query = "SELECT id FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $_SESSION['msg_title'] = $MSG['415'];
+ $_SESSION['msg_body'] = $ERR_025;
+ header('location: message.php');
+ exit;
+ }
+ }
}
diff --git a/includes/auction/Auction.php b/includes/auction/Auction.php
old mode 100644
new mode 100755
index a2aa4520e..e45888911
--- a/includes/auction/Auction.php
+++ b/includes/auction/Auction.php
@@ -1,6 +1,6 @@
false,
- 'subtitle' => false,
- 'description' => true,
- 'shipping_terms' => false
- ];
protected $auction_data;
protected $default_data = [];
- protected $db;
- public function __construct($db)
+ public function __construct()
{
- $this->db = $db;
$this->auction_data = $this->default_data;
}
@@ -59,29 +50,16 @@ protected function setData($data)
}
}
- // run this before buildDataFromPost
- public function buildDataFromSession()
+ public function buildData()
{
- global $_SESSION;
- foreach ($_SESSION['WEBID_SELL_DATA'] as $key => $value)
- {
- $this->auction_data[$key] = $value;
- }
- }
-
- // variables are cleaned on submission
- public function buildDataFromPost($post_data)
- {
- $data = [];
// TODO: this is the old setvars() function end up with a $data array and push it into setData()
- $this->setData($data);
}
public function setSessionData()
{
foreach ($auction_data as $key => $value)
{
- $_SESSION['WEBID_SELL_DATA'][$key] = $value;
+ $_SESSION['SELL_' . $key] = $value;
}
}
@@ -89,89 +67,16 @@ public function clearSessionData()
{
foreach ($auction_data as $key => $value)
{
- if (isset($_SESSION['WEBID_SELL_DATA'][$key]))
+ if (isset($_SESSION['SELL_' . $key]))
{
- unset($_SESSION['WEBID_SELL_DATA'][$key]);
+ unset($_SESSION['SELL_' . $key]);
}
}
}
- // TODO: allow this to take arrays of auction_ids OR a single auction_id
- public function removeAuction($auction_id)
+ public function removeAuction()
{
- $catscontrol = new MPTTcategories();
- $params = array();
- $params[] = array(':auc_id', $auction_id, 'int');
-
- // get auction data
- $query = "SELECT category, num_bids, suspended, closed FROM " . $this->db->DBPrefix . "auctions WHERE id = :auc_id";
- $this->db->query($query, $params);
- $auc_data = $this->db->result();
-
- if ($auc_data['suspended'] == 2)
- {
- $query = "DELETE FROM `" . $this->db->DBPrefix . "auction_moderation` WHERE auction_id = :auc_id";
- $this->db->query($query, $params);
- }
-
- // Delete related values
- $query = "DELETE FROM " . $this->db->DBPrefix . "auctions WHERE id = :auc_id";
- $this->db->query($query, $params);
-
- // delete bids
- $query = "DELETE FROM " . $this->db->DBPrefix . "bids WHERE auction = :auc_id";
- $this->db->query($query, $params);
-
- // Delete proxybids
- $query = "DELETE FROM " . $this->db->DBPrefix . "proxybid WHERE itemid = :auc_id";
- $this->db->query($query, $params);
-
- // Delete file in counters
- $query = "DELETE FROM " . $this->db->DBPrefix . "auccounter WHERE auction_id = :auc_id";
- $this->db->query($query, $params);
-
- if ($auc_data['suspended'] == 0 && $auc_data['closed'] == 0)
- {
- // update main counters
- $query = "UPDATE " . $this->db->DBPrefix . "counters SET auctions = (auctions - 1), bids = (bids - :num_bids)";
- $params = array();
- $params[] = array(':num_bids', $auc_data['num_bids'], 'int');
- $this->db->query($query, $params);
-
- // update recursive categories
- $query = "SELECT left_id, right_id, level FROM " . $this->db->DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $auc_data['category'], 'int');
- $this->db->query($query, $params);
- $parent_node = $this->db->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++)
- {
- $query = "UPDATE " . $this->db->DBPrefix . "categories SET sub_counter = sub_counter - 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $this->db->query($query, $params);
- }
- }
-
- // Delete auctions images
- if (is_dir(UPLOAD_PATH . $auction_id))
- {
- if ($dir = opendir(UPLOAD_PATH . $auction_id))
- {
- while ($file = readdir($dir))
- {
- if ($file != '.' && $file != '..')
- {
- @unlink(UPLOAD_PATH . $auction_id . '/' . $file);
- }
- }
- closedir($dir);
- rmdir(UPLOAD_PATH . $auction_id);
- }
- }
}
public function updateAuction()
@@ -184,37 +89,5 @@ public function saveAuction()
// addauction()
}
- public function getAuction($auction_id, $select = '*')
- {
- $query = "SELECT " . $select . " FROM " . $this->db->DBPrefix . "auctions WHERE id = :auc_id";
- $params = array();
- $params[] = array(':auc_id', $auction_id, 'int');
- $this->db->query($query, $params);
- return $this->db->result();
- }
-
- public function getNextValidBid($current_bid)
- {
- // Get bid increment for current bid and calculate minimum bid
- $query = "SELECT increment FROM " . $this->db->DBPrefix . "increments WHERE
- ((low <= :val0 AND high >= :val1) OR
- (low < :val2 AND high < :val3)) ORDER BY increment DESC";
- $params = array();
- $params[] = array(':val0', $current_bid, 'float');
- $params[] = array(':val1', $current_bid, 'float');
- $params[] = array(':val2', $current_bid, 'float');
- $params[] = array(':val3', $current_bid, 'float');
- $this->db->query($query, $params);
- if ($this->db->numrows() != 0)
- {
- return $this->db->result('increment');
- }
- else
- {
- return 0;
- }
- }
-
- public function addBid();
- public function getBidHistory();
+ public function addBid(); // no contained in base class will be in Auction_BIN or Auction_Dutch or Auction_Bid ...
}
diff --git a/includes/auction/Auction_BIN.php b/includes/auction/Auction_BIN.php
deleted file mode 100644
index b17fc8381..000000000
--- a/includes/auction/Auction_BIN.php
+++ /dev/null
@@ -1,33 +0,0 @@
-DBPrefix . "bids b
- LEFT JOIN " . $db->DBPrefix . "users u ON (u.id = b.bidder)
- WHERE b.auction = :auc_id ORDER BY b.bidwhen DESC";
- $params = array();
- $params[] = array(':auc_id', $auction_data['id'], 'int');
- $db->query($query, $params);
- $history = $db->fetchall();
- return $history;
- }
-}
diff --git a/includes/auction/Auction_Bid.php b/includes/auction/Auction_Bid.php
deleted file mode 100644
index 7e1171f64..000000000
--- a/includes/auction/Auction_Bid.php
+++ /dev/null
@@ -1,33 +0,0 @@
-DBPrefix . "bids b
- LEFT JOIN " . $db->DBPrefix . "users u ON (u.id = b.bidder)
- WHERE b.auction = :auc_id ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";
- $params = array();
- $params[] = array(':auc_id', $auction_data['id'], 'int');
- $db->query($query, $params);
- $history = $db->fetchall();
- return $history;
- }
-}
diff --git a/includes/auction/Auction_Dutch.php b/includes/auction/Auction_Dutch.php
deleted file mode 100644
index 6f0293ed6..000000000
--- a/includes/auction/Auction_Dutch.php
+++ /dev/null
@@ -1,33 +0,0 @@
-DBPrefix . "bids b
- LEFT JOIN " . $db->DBPrefix . "users u ON (u.id = b.bidder)
- WHERE b.auction = :auc_id ORDER BY b.bidwhen DESC";
- $params = array();
- $params[] = array(':auc_id', $auction_data['id'], 'int');
- $db->query($query, $params);
- $history = $db->fetchall();
- return $history;
- }
-}
diff --git a/includes/browseitems.inc.php b/includes/browseitems.inc.php
old mode 100644
new mode 100755
index 341b6def6..c5b153b8a
--- a/includes/browseitems.inc.php
+++ b/includes/browseitems.inc.php
@@ -1,6 +1,6 @@
query($query_feat, $params_feat);
- $k = 0;
- while ($row = $db->fetch()) {
- // get the data we need
- $row = build_items($row);
-
- // time left till the end of this auction
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
-
- $template->assign_block_vars('featured_items', array(
- 'ID' => $row['id'],
- 'IMAGE' => $row['pict_url'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'SUBTITLE' => htmlspecialchars($row['subtitle']),
- 'BUY_NOW' => ($difference->invert == 1) ? '' : $row['buy_now'],
- 'BID' => $row['current_bid'],
- 'BIDFORM' => $system->print_money($row['current_bid']),
- 'CLOSES' => ($difference->format('%d') < 20) ? $dt->formatTimeLeft($difference) : $dt->printDateTz($row['ends']),
- 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']),
-
- 'B_BOLD' => ($row['bold']),
- 'B_HIGHLIGHTED' => ($row['highlighted'])
- ));
- $k++;
- $feat_items = true;
- }
- }
-
- $db->query($query, $params);
- $k = 0;
- while ($row = $db->fetch()) {
- // get the data we need
- $row = build_items($row);
-
- // time left till the end of this auction
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
-
- $template->assign_block_vars('items', array(
- 'ID' => $row['id'],
- 'IMAGE' => $row['pict_url'],
- 'TITLE' => htmlspecialchars($row['title']),
- 'SUBTITLE' => htmlspecialchars($row['subtitle']),
- 'BUY_NOW' => ($difference->invert == 1) ? '' : $row['buy_now'],
- 'BID' => $row['current_bid'],
- 'BIDFORM' => $system->print_money($row['current_bid']),
- 'CLOSES' => ($difference->format('%d') < 20) ? $dt->formatTimeLeft($difference) : $dt->printDateTz($row['ends']),
- 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']),
-
- 'B_BOLD' => ($row['bold']),
- 'B_HIGHLIGHTED' => ($row['highlighted'])
- ));
- $k++;
- }
-
- $extravar = (empty($extravar)) ? '' : '&' . $extravar;
- $PREV = intval($PAGE - 1);
- $NEXT = intval($PAGE + 1);
- if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE+6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
- }
-
- $template->assign_vars(array(
- 'B_FEATURED_ITEMS' => $feat_items,
- 'B_SUBTITLE' => ($system->SETTINGS['subtitle'] == 'y'),
-
- 'NUM_AUCTIONS' => ($total == 0) ? $ERR_114 : $total,
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ global $system, $MSG, $ERR_114, $db;
+ global $template, $PAGES, $PAGE;
+
+ $feat_items = false;
+ if ($query_feat != '')
+ {
+ $db->query($query_feat, $params_feat);
+ $k = 0;
+ while ($row = $db->fetch())
+ {
+ // get the data we need
+ $row = build_items($row);
+
+ // time left till the end of this auction
+ $difference = $row['ends'] - time();
+ $bgcolour = ($k % 2) ? 'bgcolor="#FFFEEE"' : '';
+
+ $template->assign_block_vars('featured_items', array(
+ 'ID' => $row['id'],
+ 'ROWCOLOUR' => ($row['highlighted']) ? 'bgcolor="#fea100"' : $bgcolour,
+ 'IMAGE' => $row['pict_url'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'SUBTITLE' => htmlspecialchars($row['subtitle']),
+ 'BUY_NOW' => ($difference < 0) ? '' : $row['buy_now'],
+ 'BID' => $row['current_bid'],
+ 'BIDFORM' => $system->print_money($row['current_bid']),
+ 'CLOSES' => ($difference < 1728000) ? FormatTimeLeft($difference) : ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']),
+
+ 'B_BOLD' => ($row['bold'])
+ ));
+ $k++;
+ $feat_items = true;
+ }
+ }
+
+ $db->query($query, $params);
+ $k = 0;
+ while ($row = $db->fetch())
+ {
+ // get the data we need
+ $row = build_items($row);
+
+ // time left till the end of this auction
+ $difference = $row['ends'] - time();
+ $bgcolour = ($k % 2) ? 'bgcolor="#FFFEEE"' : '';
+
+ $template->assign_block_vars('items', array(
+ 'ID' => $row['id'],
+ 'ROWCOLOUR' => ($row['highlighted']) ? 'bgcolor="#fea100"' : $bgcolour,
+ 'IMAGE' => $row['pict_url'],
+ 'TITLE' => htmlspecialchars($row['title']),
+ 'SUBTITLE' => htmlspecialchars($row['subtitle']),
+ 'BUY_NOW' => ($difference < 0) ? '' : $row['buy_now'],
+ 'BID' => $row['current_bid'],
+ 'BIDFORM' => $system->print_money($row['current_bid']),
+ 'CLOSES' => ($difference < 1728000) ? FormatTimeLeft($difference) : ArrangeDateNoCorrection($row['ends'] + $system->tdiff),
+ 'NUMBIDS' => sprintf($MSG['950'], $row['num_bids']),
+
+ 'B_BOLD' => ($row['bold'])
+ ));
+ $k++;
+ }
+
+ $extravar = (empty($extravar)) ? '' : '&' . $extravar;
+ $PREV = intval($PAGE - 1);
+ $NEXT = intval($PAGE + 1);
+ if ($PAGES > 1)
+ {
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE+6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
+ }
+
+ $template->assign_vars(array(
+ 'B_FEATURED_ITEMS' => $feat_items,
+ 'B_SUBTITLE' => ($system->SETTINGS['subtitle'] == 'y'),
+
+ 'NUM_AUCTIONS' => ($total == 0) ? $ERR_114 : $total,
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
}
function build_items($row)
{
- global $system;
-
- // image icon
- if (!empty($row['pict_url'])) {
- $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_list'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'];
- } else {
- $row['pict_url'] = get_lang_img('nopicture.gif');
- }
-
- if ($row['current_bid'] == 0) {
- $row['current_bid'] = $row['minimum_bid'];
- }
-
- if ($row['buy_now'] > 0 && $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price']))) {
- $row['buy_now'] = ' ' . $system->print_money($row['buy_now']);
- } elseif ($row['buy_now'] > 0 && $row['bn_only']) {
- $row['current_bid'] = $row['buy_now'];
- $row['buy_now'] = ' ' . $system->print_money($row['buy_now']) . ' ';
- } else {
- $row['buy_now'] = '';
- }
-
- return $row;
+ global $system;
+
+ // image icon
+ if (!empty($row['pict_url']))
+ {
+ $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_list'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url'];
+ }
+ else
+ {
+ $row['pict_url'] = get_lang_img('nopicture.gif');
+ }
+
+ if ($row['current_bid'] == 0)
+ {
+ $row['current_bid'] = $row['minimum_bid'];
+ }
+
+ if ($row['buy_now'] > 0 && $row['bn_only'] == 0 && ($row['num_bids'] == 0 || ($row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])))
+ {
+ $row['buy_now'] = ' ' . $system->print_money($row['buy_now']);
+ }
+ elseif ($row['buy_now'] > 0 && $row['bn_only'])
+ {
+ $row['current_bid'] = $row['buy_now'];
+ $row['buy_now'] = ' ' . $system->print_money($row['buy_now']) . ' ';
+ }
+ else
+ {
+ $row['buy_now'] = '';
+ }
+
+ return $row;
}
diff --git a/includes/calendar.css b/includes/calendar.css
old mode 100644
new mode 100755
diff --git a/includes/calendar.inc.php b/includes/calendar.inc.php
old mode 100644
new mode 100755
index 2c5a1f857..fef112218
--- a/includes/calendar.inc.php
+++ b/includes/calendar.inc.php
@@ -1,6 +1,6 @@
SETTINGS['siteurl'] . "includes/img/";
$cal_invalid_date = "'Invalid date: \"' + s_date[0] + '\".\\nAccepted format is dd-mm-yyyy.'";
-if ($system->SETTINGS['datesformat'] == 'USA') {
- $cal_invalid_date = "'Invalid date: \"' + s_date[0] + '\".\\nAccepted format is mm-dd-yyyy.'";
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $cal_invalid_date = "'Invalid date: \"' + s_date[0] + '\".\\nAccepted format is mm-dd-yyyy.'";
}
-$cal_gener_date = "(d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + \"/\"
- + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + \"/\"
+$cal_gener_date = "(d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + \"-\"
+ + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + \"-\"
+ d_date.getFullYear()";
-if ($system->SETTINGS['datesformat'] == 'USA') {
- $cal_gener_date = "(d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + \"/\"
- + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + \"/\"
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $cal_gener_date = "(d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + \"-\"
+ + (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + \"-\"
+ d_date.getFullYear()";
}
$cal_date_parts = json_encode(array('month' => '$2', 'day' => '$1', 'year' => '$3'));
-if ($system->SETTINGS['datesformat'] == 'USA') {
- $cal_date_parts = json_encode(array('month' => '$1', 'day' => '$2', 'year' => '$3'));
+if ($system->SETTINGS['datesformat'] == 'USA')
+{
+ $cal_date_parts = json_encode(array('month' => '$1', 'day' => '$2', 'year' => '$3'));
}
$cal_conf = "var A_TCALDEF = {
@@ -67,5 +68,5 @@
};";
$template->assign_vars(array(
- 'CAL_CONF' => $cal_conf,
- ));
+ 'CAL_CONF' => $cal_conf,
+ ));
\ No newline at end of file
diff --git a/includes/checks/database.php b/includes/checks/database.php
old mode 100644
new mode 100755
diff --git a/includes/class_MPTTcategories.php b/includes/class_MPTTcategories.php
old mode 100644
new mode 100755
index bb0a3a08b..e5d6f5b43
--- a/includes/class_MPTTcategories.php
+++ b/includes/class_MPTTcategories.php
@@ -1,6 +1,6 @@
query($query, $params);
- if ($db->numrows() != 1) { // Row must exist.
- return false;
- }
- $parent = $db->result();
- } else {
- // Virtual root element as parent.
- $parent = $this->get_virtual_root();
- }
- $children = $this->get_children($parent['left_id'], $parent['right_id'], $parent['level']);
-
- if (count($children) == 0) {
- $child_num = 0;
- }
- if ($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0) {
- $boundry = array('left_id', 'right_id', $parent['left_id']);
- } elseif ($child_num != 0) {
- // Some other child.
- if ($child_num < 0) {
- $child_num = count($children) + $child_num + 1;
- }
- if ($child_num > count($children)) {
- $child_num = count($children);
- }
- $boundry = array('right_id', 'left_id', $children[$child_num - 1]['right_id']);
- } else {
- return false;
- }
-
- // Make a hole for the new element.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + 2 WHERE " . $boundry[0] . " > " . $boundry[2] . " AND " . $boundry[1] . " > " . $boundry[2];
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + 2 WHERE " . $boundry[1] . " > " . $boundry[2];
- $db->direct_query($query);
-
- // Insert the new element.
- $data = array(
- 'left_id' => $boundry[2] + 1,
- 'right_id' => $boundry[2] + 2,
- 'level' => $parent['level'] + 1,
- 'parent_id' => $parent_id
- );
- if ($misc_data && is_array($misc_data)) {
- $data = array_merge($misc_data, $data);
- }
-
- $query = "INSERT INTO " . $DBPrefix . "categories (parent_id, left_id, right_id, level, cat_name, cat_colour, cat_image)
+ // Add an element to the tree as a child of $parent and as $child_num'th child. If $data is not supplied the insert id will be returned.
+ function add($parent_id, $child_num = 0, $misc_data = false)
+ {
+ global $DBPrefix, $db;
+ if(!is_numeric($parent_id) || $parent_id < 0)
+ {
+ return false;
+ }
+ if($parent_id != 0)
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :parent_id";
+ $params = array();
+ $params[] = array(':parent_id', $parent_id, 'int');
+ $db->query($query, $params);
+ if($db->numrows() != 1)
+ { // Row must exist.
+ return false;
+ }
+ $parent = $db->result();
+ }
+ else
+ {
+ // Virtual root element as parent.
+ $parent = $this->get_virtual_root();
+ }
+ $children = $this->get_children($parent['left_id'], $parent['right_id'], $parent['level']);
+
+ if(count($children) == 0)
+ {
+ $child_num = 0;
+ }
+ if($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0)
+ {
+ $boundry = array('left_id', 'right_id', $parent['left_id']);
+ }
+ elseif($child_num != 0)
+ {
+ // Some other child.
+ if($child_num < 0)
+ {
+ $child_num = count($children) + $child_num + 1;
+ }
+ if($child_num > count($children))
+ {
+ $child_num = count($children);
+ }
+ $boundry = array('right_id', 'left_id', $children[$child_num - 1]['right_id']);
+ }
+ else
+ {
+ return false;
+ }
+
+ // Make a hole for the new element.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + 2 WHERE " . $boundry[0] . " > " . $boundry[2] . " AND " . $boundry[1] . " > " . $boundry[2];
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + 2 WHERE " . $boundry[1] . " > " . $boundry[2];
+ $db->direct_query($query);
+
+ // Insert the new element.
+ $data = array(
+ 'left_id' => $boundry[2] + 1,
+ 'right_id' => $boundry[2] + 2,
+ 'level' => $parent['level'] + 1,
+ 'parent_id' => $parent_id
+ );
+ if($misc_data && is_array($misc_data))
+ {
+ $data = array_merge($misc_data, $data);
+ }
+
+ $query = "INSERT INTO " . $DBPrefix . "categories (parent_id, left_id, right_id, level, cat_name, cat_colour, cat_image)
VALUES (:parent, :left, :right, :level, :name, :colour, :image)";
- $params = array();
- $params[] = array(':parent', $data['parent_id'], 'str');
- $params[] = array(':left', $data['left_id'], 'str');
- $params[] = array(':right', $data['right_id'], 'str');
- $params[] = array(':level', $data['level'], 'str');
- $params[] = array(':name', $data['cat_name'], 'str');
- $params[] = array(':colour', $data['cat_colour'], 'str');
- $params[] = array(':image', $data['cat_image'], 'str');
- $db->query($query, $params);
-
- if (!$misc_data) {
- return $db->lastInsertId();
- }
- return true;
- }
-
- // Deletes element $id with or without children. If children should be kept they will become children of $id's parent.
- public function delete($id, $keep_children = false)
- {
- global $system, $DBPrefix, $db;
- if (!is_numeric($id) || $id <= 0 || !is_bool($keep_children)) {
- return false;
- }
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() != 1) { // Row must exist.
- return false;
- }
- $a = $db->result();
-
- if (!$keep_children) {
- // Delete the element with children.
- $query = "DELETE FROM " . $DBPrefix . "categories WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
- $db->direct_query($query);
- // Remove the hole.
- $diff = $a['right_id'] - $a['left_id'] + 1;
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - " . $diff . " WHERE right_id > " . $a['right_id'] . " AND left_id > " . $a['right_id'];
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - " . $diff . " WHERE right_id > " . $a['right_id'];
- $db->direct_query($query);
- // No level cahnges needed.
- } else {
- // Delete ONLY the element.
- $query = "DELETE FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $db->query($query, $params);
- // Fix children.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - 1, right_id = right_id - 1, level = level - 1 WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
- $db->direct_query($query);
- // Remove hole.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - 2 WHERE right_id > " . ($a['right_id'] - 1) . " AND left_id > " . ($a['right_id'] - 1);
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - 2 WHERE right_id > " . ($a['right_id'] - 1);
- $db->direct_query($query);
- }
- }
-
- // Move an element (with children) $id, under element $target_id as the $child_num'th child of that element
- public function move($id, $target_id, $child_num = 0)
- {
- global $system, $DBPrefix, $db;
- if (!is_numeric($id) || !is_numeric($target_id) || !is_numeric($child_num)) {
- return false;
- }
- if ($target_id != 0) {
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id OR cat_id = :target_id";
- // I want the to be returned in order.
- $query .= ' ORDER BY cat_id ' . (($id < $target_id) ? 'ASC' : 'DESC');
-
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $params[] = array(':target_id', $target_id, 'int');
- $db->query($query, $params);
- if ($db->numrows() != 2) { // Both rows must exist.
- return false;
- }
- $data = $db->fetchall();
- $a = $data[0]; // This is being moved.
- $b = $data[1]; // This is the target.
- } else {
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $db->query($query, $params);
-
- if ($db->numrows() != 1) { // Row must exist.
- return false;
- }
- $a = $db->result(); // This is being moved.
-
- // Virtual root element.
- $b = $this->get_virtual_root();
- }
-
- // We need to get the children.
- $children = $this->get_children($b['left_id'], $b['right_id'], $b['level']);
-
- if (count($children) == 0) {
- $child_num = 0;
- }
- if ($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0) {
- // First child.
- $boundry = array('left_id', 'right_id', 'right_id', $b['left_id']);
- } elseif ($child_num != 0) {
- // Some other child.
- if ($child_num < 0) {
- $child_num = count($children) + $child_num + 1;
- }
- if ($child_num > count($children)) {
- $child_num = count($children);
- }
- $boundry = array('right_id', 'left_id', 'right_id', $children[$child_num - 1]['right_id']);
- } else {
- return false;
- }
-
- // Math.
- $diff = $a['right_id'] - $a['left_id'] + 1; // The "size" of the tree.
-
- if ($a['left_id'] < $boundry[3]) {
- $size = $boundry[3] - $diff;
- $dist = $boundry[3] - $diff - $a['left_id'] + 1;
- } else {
- $size = $boundry[3];
- $dist = $boundry[3] - $a['left_id'] + 1;
- }
- // Level math.
- $ldiff = ($a['level'] - $b['level'] - 1) * -1;
- // We have all what we need.
-
- $query = array();
-
- // Give the needed rows negative id's.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id * -1, right_id = right_id * -1 WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
- $db->direct_query($query);
- // Remove the hole.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - " . $diff . " WHERE right_id > " . $a['right_id'] . " AND left_id > " . $a['right_id'];
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - " . $diff . " WHERE right_id > " . $a['right_id'];
- $db->direct_query($query);
- // Add hole
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + " . $diff . " WHERE " . $boundry[0] . " > " . $size . " AND " . $boundry[1] . " > " . $size;
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + " . $diff . " WHERE " . $boundry[2] . " > " . $size;
- $db->direct_query($query);
- // Fill hole & update rows & multiply by -1
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = (left_id - (" . $dist . ")) * -1, right_id = (right_id - (" . $dist . ")) * -1, level = level + (" . $ldiff . ") WHERE left_id < 0";
- $db->direct_query($query);
- return true;
- }
-
- // Copies element $id (with children) to $parent as the $child_mun'th child.
- public function copy($id, $parent, $child_num = 0)
- {
- global $system, $DBPrefix, $db;
- if (!is_numeric($id) || $id < 0 ||!is_numeric($parent) || $parent < 0) {
- return false;
- }
- // Get branch left & right id's.
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $db->query($query, $params);
-
- if ($db->numrows() != 1) { // Row must Exist.
- return false;
- }
- $a = $db->result();
- // Get child data.
- $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
- $db->direct_query($query);
- while ($row = $db->fetch()) {
- $data[] = $row;
- }
-
- if ($parent != 0) {
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :parent_id";
- $params = array();
- $params[] = array(':parent_id', $parent, 'int');
- $db->query($query, $params);
-
- if ($db->numrows() != 1) { // Row must exist.
- return false;
- }
- $b = $db->result();
- } else {
- $b = $this->get_virtual_root();
- }
-
- // Get target's children.
- $children = $this->get_children($b['left_id'], $b['right_id'], $b['level']);
-
- if (count($children) == 0) {
- $child_num = 0;
- }
- if ($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0) {
- // First child.
- $boundry = array('left_id', 'right_id', 'right_id', $b['left_id']);
- } elseif ($child_num != 0) {
- // Some other child.
- if ($child_num < 0) {
- $child_num = count($children) + $child_num + 1;
- }
- if ($child_num > count($children)) {
- $child_num = count($children);
- }
- $boundry = array('right_id', 'left_id', 'right_id', $children[$child_num - 1]['right_id']);
- } else {
- return false;
- }
-
- // Math.
- $diff = $a['right_id'] - $a['left_id'] + 1;
- $dist = $boundry[3] - $a['left_id'] + 1;
- // Level math.
- $ldiff = ($a['level'] - $b['level'] - 1);
-
- // Add hole.
- $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + " . $diff . " WHERE " . $boundry[0] . " > " . $boundry[3] . " AND " . $boundry[1] . " > " . $boundry[3];
- $db->direct_query($query);
- $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + " . $diff . " WHERE " . $boundry[2] . " > " . $boundry[3];
- $db->direct_query($query);
-
- // Now we have to insert all the new elements.
- for ($i = 0, $n = count($data); $i< $n; $i++) {
- // This fields need new values.
- $data[$i]['left_id'] += $dist;
- $data[$i]['right_id'] += $dist;
- $data[$i]['level'] -= $ldiff;
-
- $data[$i] = $this->build_sql($data[$i]);
- $query = "INSERT INTO " . $DBPrefix . "categories SET " . $data[$i];
- $db->direct_query($query);
- }
- return true;
- }
-
- // get a nodes children
- public function get_children($left_id, $right_id, $level)
- {
- global $DBPrefix, $db;
- $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id AND level = :level ORDER BY cat_name";
- $params = array();
- $params[] = array(':left_id', $left_id, 'int');
- $params[] = array(':right_id', $right_id, 'int');
- $params[] = array(':level', ($level + 1), 'int');
- $db->query($query, $params);
- $children = array();
- while ($child = $db->fetch()) {
- $children[] = $child;
- }
-
- return $children;
- }
-
- // return a list of every child node of a given parent node
- public function get_children_list($left_id, $right_id, $return = 'cat_id')
- {
- global $DBPrefix, $db;
-
- if (empty($left_id) || empty($right_id)) {
- return array();
- }
- $query = "SELECT " . $return . " FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id";
- $params = array();
- $params[] = array(':left_id', $left_id, 'int');
- $params[] = array(':right_id', $right_id, 'int');
- $db->query($query, $params);
- $children = array();
- while ($child = $db->fetch()) {
- $children[] = $child;
- }
-
- return $children;
- }
-
- //returns an ordered list of categories
- public function display_tree($left_id, $right_id, $indent = "\t")
- {
- global $DBPrefix, $db;
- // start with an empty $right stack
- $right = array();
- $return = array();
-
- // now, retrieve all descendants of the $root node
- $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id ORDER BY left_id ASC";
- $params = array();
- $params[] = array(':left_id', $left_id, 'int');
- $params[] = array(':right_id', $right_id, 'int');
- $db->query($query, $params);
-
- // display each row
- while ($row = $db->fetch()) {
- // only check stack if there is one
- if (count($right) > 0) {
- // check if we should remove a node from the stack
- while (isset($right[count($right) - 1]) && $right[count($right) - 1] < $row['right_id']) {
- array_pop($right);
- }
- }
- // display indented node title
- $return[$row['cat_id']] = str_repeat($indent, count($right)) . $row['cat_name'];
- // add this node to the stack
- $right[] = $row['right_id'];
- }
- return $return;
- }
-
- // Return the left_id, right_id and level for the virtual root node.
- public function get_virtual_root()
- {
- global $DBPrefix, $db;
- // Virtual root element as parent.
- $query = "SELECT right_id FROM " . $DBPrefix . "categories ORDER BY right_id DESC LIMIT 1";
- $db->direct_query($query);
- $row = $db->result();
- $root = array('left_id' => 1, 'right_id' => $row['right_id'], 'level' => -1);
- return $root;
- }
-
- public function get_bread_crumbs($left_id, $right_id)
- {
- global $DBPrefix, $db;
-
- if (empty($left_id) || empty($right_id)) {
- return array();
- }
- // return an array of all parent nodes
- $query = "SELECT cat_name, cat_id FROM " . $DBPrefix . "categories WHERE left_id <= :left_id AND right_id >= :right_id ORDER BY left_id ASC";
- $params = array();
- $params[] = array(':left_id', $left_id, 'int');
- $params[] = array(':right_id', $right_id, 'int');
- $db->query($query, $params);
- $array = array();
- while ($row = $db->fetch()) {
- $array[] = $row;
- }
- return $array;
- }
-
- // Build INSERT statement
- public function build_sql($data)
- {
- foreach ($data as $k => $v) {
- if (is_numeric($v)) {
- $data[$k] = '`' . $k . '` = ' . $v . '';
- } else {
- $data[$k] = '`' . $k . '` = \'' . $v . '\'';
- }
- }
- return implode(', ', $data);
- }
-
- public function check_category($id)
- {
- global $DBPrefix, $db;
-
- $query = "SELECT cat_id FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id LIMIT 1";
- $params = array();
- $params[] = array(':cat_id', $id, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- return true;
- } else {
- return false;
- }
- }
+ $params = array();
+ $params[] = array(':parent', $data['parent_id'], 'str');
+ $params[] = array(':left', $data['left_id'], 'str');
+ $params[] = array(':right', $data['right_id'], 'str');
+ $params[] = array(':level', $data['level'], 'str');
+ $params[] = array(':name', $data['cat_name'], 'str');
+ $params[] = array(':colour', $data['cat_colour'], 'str');
+ $params[] = array(':image', $data['cat_image'], 'str');
+ $db->query($query, $params);
+
+ if(!$misc_data)
+ {
+ return $db->lastInsertId();
+ }
+ return true;
+ }
+
+ // Deletes element $id with or without children. If children should be kept they will become children of $id's parent.
+ function delete($id, $keep_children = false)
+ {
+ global $system, $DBPrefix, $db;
+ if(!is_numeric($id) || $id <= 0 || !is_bool($keep_children))
+ {
+ return false;
+ }
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $db->query($query, $params);
+ if($db->numrows() != 1)
+ { // Row must exist.
+ return false;
+ }
+ $a = $db->result();
+
+ if(!$keep_children)
+ {
+ // Delete the element with children.
+ $query = "DELETE FROM " . $DBPrefix . "categories WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
+ $db->direct_query($query);
+ // Remove the hole.
+ $diff = $a['right_id'] - $a['left_id'] + 1;
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - " . $diff . " WHERE right_id > " . $a['right_id'] . " AND left_id > " . $a['right_id'];
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - " . $diff . " WHERE right_id > " . $a['right_id'];
+ $db->direct_query($query);
+ // No level cahnges needed.
+ }
+ else
+ {
+ // Delete ONLY the element.
+ $query = "DELETE FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $db->query($query, $params);
+ // Fix children.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - 1, right_id = right_id - 1, level = level - 1 WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
+ $db->direct_query($query);
+ // Remove hole.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - 2 WHERE right_id > " . ($a['right_id'] - 1) . " AND left_id > " . ($a['right_id'] - 1);
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - 2 WHERE right_id > " . ($a['right_id'] - 1);
+ $db->direct_query($query);
+ }
+ }
+
+ // Move an element (with children) $id, under element $target_id as the $child_num'th child of that element
+ function move($id, $target_id, $child_num = 0)
+ {
+ global $system, $DBPrefix, $db;
+ if(!is_numeric($id) || !is_numeric($target_id) || !is_numeric($child_num))
+ {
+ return false;
+ }
+ if($target_id != 0)
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id OR cat_id = :target_id";
+ // I want the to be returned in order.
+ $query .= ' ORDER BY cat_id ' . (($id < $target_id) ? 'ASC' : 'DESC');
+
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $params[] = array(':target_id', $target_id, 'int');
+ $db->query($query, $params);
+ if($db->numrows() != 2)
+ { // Both rows must exist.
+ return false;
+ }
+ $data = $db->fetchall();
+ $a = $data[0]; // This is being moved.
+ $b = $data[1]; // This is the target.
+ }
+ else
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $db->query($query, $params);
+
+ if($db->numrows() != 1)
+ { // Row must exist.
+ return false;
+ }
+ $a = $db->result(); // This is being moved.
+
+ // Virtual root element.
+ $b = $this->get_virtual_root();
+ }
+
+ // We need to get the children.
+ $children = $this->get_children($b['left_id'], $b['right_id'], $b['level']);
+
+ if(count($children) == 0)
+ {
+ $child_num = 0;
+ }
+ if($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0)
+ {
+ // First child.
+ $boundry = array('left_id', 'right_id', 'right_id', $b['left_id']);
+ }
+ elseif($child_num != 0)
+ {
+ // Some other child.
+ if($child_num < 0)
+ {
+ $child_num = count($children) + $child_num + 1;
+ }
+ if($child_num > count($children))
+ {
+ $child_num = count($children);
+ }
+ $boundry = array('right_id', 'left_id', 'right_id', $children[$child_num - 1]['right_id']);
+ }
+ else
+ {
+ return false;
+ }
+
+ // Math.
+ $diff = $a['right_id'] - $a['left_id'] + 1; // The "size" of the tree.
+
+ if($a['left_id'] < $boundry[3])
+ {
+ $size = $boundry[3] - $diff;
+ $dist = $boundry[3] - $diff - $a['left_id'] + 1;
+ }
+ else
+ {
+ $size = $boundry[3];
+ $dist = $boundry[3] - $a['left_id'] + 1;
+ }
+ // Level math.
+ $ldiff = ($a['level'] - $b['level'] - 1) * -1;
+ // We have all what we need.
+
+ $query = array();
+
+ // Give the needed rows negative id's.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id * -1, right_id = right_id * -1 WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
+ $db->direct_query($query);
+ // Remove the hole.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id - " . $diff . " WHERE right_id > " . $a['right_id'] . " AND left_id > " . $a['right_id'];
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id - " . $diff . " WHERE right_id > " . $a['right_id'];
+ $db->direct_query($query);
+ // Add hole
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + " . $diff . " WHERE " . $boundry[0] . " > " . $size . " AND " . $boundry[1] . " > " . $size;
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + " . $diff . " WHERE " . $boundry[2] . " > " . $size;
+ $db->direct_query($query);
+ // Fill hole & update rows & multiply by -1
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = (left_id - (" . $dist . ")) * -1, right_id = (right_id - (" . $dist . ")) * -1, level = level + (" . $ldiff . ") WHERE left_id < 0";
+ $db->direct_query($query);
+ return true;
+ }
+
+ // Copies element $id (with children) to $parent as the $child_mun'th child.
+ function copy($id, $parent, $child_num = 0)
+ {
+ global $system, $DBPrefix, $db;
+ if(!is_numeric($id) || $id < 0 ||!is_numeric($parent) || $parent < 0)
+ {
+ return false;
+ }
+ // Get branch left & right id's.
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $db->query($query, $params);
+
+ if($db->numrows() != 1)
+ { // Row must Exist.
+ return false;
+ }
+ $a = $db->result();
+ // Get child data.
+ $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id >= " . $a['left_id'] . " AND right_id <= " . $a['right_id'];
+ $db->direct_query($query);
+ while($row = $db->fetch())
+ {
+ $data[] = $row;
+ }
+
+ if($parent != 0)
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :parent_id";
+ $params = array();
+ $params[] = array(':parent_id', $parent, 'int');
+ $db->query($query, $params);
+
+ if($db->numrows() != 1)
+ { // Row must exist.
+ return false;
+ }
+ $b = $db->result();
+ }
+ else
+ {
+ $b = $this->get_virtual_root();
+ }
+
+ // Get target's children.
+ $children = $this->get_children($b['left_id'], $b['right_id'], $b['level']);
+
+ if(count($children) == 0)
+ {
+ $child_num = 0;
+ }
+ if($child_num == 0 || (count($children) - $child_num) <= 0 || (count($children) + $child_num + 1) < 0)
+ {
+ // First child.
+ $boundry = array('left_id', 'right_id', 'right_id', $b['left_id']);
+ }
+ elseif($child_num != 0)
+ {
+ // Some other child.
+ if($child_num < 0)
+ {
+ $child_num = count($children) + $child_num + 1;
+ }
+ if($child_num > count($children))
+ {
+ $child_num = count($children);
+ }
+ $boundry = array('right_id', 'left_id', 'right_id', $children[$child_num - 1]['right_id']);
+ }
+ else
+ {
+ return false;
+ }
+
+ // Math.
+ $diff = $a['right_id'] - $a['left_id'] + 1;
+ $dist = $boundry[3] - $a['left_id'] + 1;
+ // Level math.
+ $ldiff = ($a['level'] - $b['level'] - 1);
+
+ // Add hole.
+ $query = "UPDATE " . $DBPrefix . "categories SET left_id = left_id + " . $diff . " WHERE " . $boundry[0] . " > " . $boundry[3] . " AND " . $boundry[1] . " > " . $boundry[3];
+ $db->direct_query($query);
+ $query = "UPDATE " . $DBPrefix . "categories SET right_id = right_id + " . $diff . " WHERE " . $boundry[2] . " > " . $boundry[3];
+ $db->direct_query($query);
+
+ // Now we have to insert all the new elements.
+ for($i = 0, $n = count($data); $i< $n; $i++)
+ {
+ // We need a new key.
+ unset($data[$i][FIELD_KEY]);
+
+ // This fields need new values.
+ $data[$i]['left_id'] += $dist;
+ $data[$i]['right_id'] += $dist;
+ $data[$i]['level'] -= $ldiff;
+
+ $data[$i] = $this->build_sql($data[$i]);
+ $query = "INSERT INTO " . $DBPrefix . "categories SET " . $data[$i];
+ $db->direct_query($query);
+ }
+ return true;
+ }
+
+ // get a nodes children
+ function get_children($left_id, $right_id, $level)
+ {
+ global $DBPrefix, $db;
+ $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id AND level = :level ORDER BY cat_name";
+ $params = array();
+ $params[] = array(':left_id', $left_id, 'int');
+ $params[] = array(':right_id', $right_id, 'int');
+ $params[] = array(':level', ($level + 1), 'int');
+ $db->query($query, $params);
+ $children = array();
+ while($child = $db->fetch())
+ {
+ $children[] = $child;
+ }
+
+ return $children;
+ }
+
+ // return a list of every child node of a given parent node
+ function get_children_list($left_id, $right_id, $return = 'cat_id')
+ {
+ global $DBPrefix, $db;
+
+ if (empty($left_id) || empty($right_id))
+ {
+ return array();
+ }
+ $query = "SELECT " . $return . " FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id";
+ $params = array();
+ $params[] = array(':left_id', $left_id, 'int');
+ $params[] = array(':right_id', $right_id, 'int');
+ $db->query($query, $params);
+ $children = array();
+ while($child = $db->fetch())
+ {
+ $children[] = $child;
+ }
+
+ return $children;
+ }
+
+ //returns an ordered list of categories
+ function display_tree($left_id, $right_id, $indent = "\t")
+ {
+ global $DBPrefix, $db;
+ // start with an empty $right stack
+ $right = array();
+ $return = array();
+
+ // now, retrieve all descendants of the $root node
+ $query = "SELECT * FROM " . $DBPrefix . "categories WHERE left_id > :left_id AND right_id < :right_id ORDER BY left_id ASC";
+ $params = array();
+ $params[] = array(':left_id', $left_id, 'int');
+ $params[] = array(':right_id', $right_id, 'int');
+ $db->query($query, $params);
+
+ // display each row
+ while ($row = $db->fetch())
+ {
+ // only check stack if there is one
+ if (count($right) > 0)
+ {
+ // check if we should remove a node from the stack
+ while (isset($right[count($right) - 1]) && $right[count($right) - 1] < $row['right_id'])
+ {
+ array_pop($right);
+ }
+ }
+ // display indented node title
+ $return[$row['cat_id']] = str_repeat($indent, count($right)) . $row['cat_name'];
+ // add this node to the stack
+ $right[] = $row['right_id'];
+ }
+ return $return;
+ }
+
+ // Return the left_id, right_id and level for the virtual root node.
+ function get_virtual_root()
+ {
+ global $DBPrefix, $db;
+ // Virtual root element as parent.
+ $query = "SELECT right_id FROM " . $DBPrefix . "categories ORDER BY right_id DESC LIMIT 1";
+ $db->direct_query($query);
+ $row = $db->result();
+ $root = array('left_id' => 1, 'right_id' => $row['right_id'], 'level' => -1);
+ return $root;
+ }
+
+ function get_bread_crumbs($left_id, $right_id)
+ {
+ global $DBPrefix, $db;
+
+ if (empty($left_id) || empty($right_id))
+ {
+ return array();
+ }
+ // return an array of all parent nodes
+ $query = "SELECT cat_name, cat_id FROM " . $DBPrefix . "categories WHERE left_id <= :left_id AND right_id >= :right_id ORDER BY left_id ASC";
+ $params = array();
+ $params[] = array(':left_id', $left_id, 'int');
+ $params[] = array(':right_id', $right_id, 'int');
+ $db->query($query, $params);
+ $array = array();
+ while ($row = $db->fetch())
+ {
+ $array[] = $row;
+ }
+ return $array;
+ }
+
+ // Build INSERT statement
+ function build_sql($data)
+ {
+ foreach($data as $k => $v)
+ {
+ if(is_numeric($v))
+ {
+ $data[$k] = '`' . $k . '` = ' . $v . '';
+ }
+ else
+ {
+ $data[$k] = '`' . $k . '` = \'' . $v . '\'';
+ }
+ }
+ return implode(', ', $data);
+ }
+
+ function check_category($id)
+ {
+ global $DBPrefix, $db;
+
+ $query = "SELECT cat_id FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id LIMIT 1";
+ $params = array();
+ $params[] = array(':cat_id', $id, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
}
diff --git a/includes/class_email_handler.php b/includes/class_email_handler.php
old mode 100644
new mode 100755
index 81f5ee653..7a1e9cea4
--- a/includes/class_email_handler.php
+++ b/includes/class_email_handler.php
@@ -1,6 +1,6 @@
from) || empty($this->from)) {
- $this->from = $system->SETTINGS['adminmail'];
- }
-
- $headers[] = 'From: ' . $this->from;
- $headers[] = 'Reply-To: ' . $this->from;
- $headers[] = 'Return-Path: <' . $this->from . '>';
- $headers[] = 'Sender: <' . $system->SETTINGS['adminmail'] . '>';
- $headers[] = 'MIME-Version: 1.0';
- $headers[] = 'Date: ' . date('r');
- //$headers[] = 'Content-Type: text/plain; charset=' . $CHARSET;
- $headers[] = 'Content-Type: text/html; charset=' . $CHARSET;
- $headers[] = 'Content-Transfer-Encoding: 8bit';
-
- $this->headers = implode("\n", $headers);
- }
-
- public function buildmessage($file)
- {
- $buffer = file(MAIN_PATH . 'language/' . $this->getuserlang() . '/emails/' . $this->getusermailtype() . '/' . $file);
- $i = 0;
- $j = 0;
- while ($i < count($buffer)) {
- if (!preg_match('/^#(.)*$/', $buffer[$i])) {
- $skipped_buffer[$j] = $buffer[$i];
- $j++;
- }
- $i++;
- }
- $this->message = implode($skipped_buffer, '');
- $this->message = str_replace("'", "\'", $this->message);
-
- $this->message = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' . ((isset(\$this->vars['\\1'])) ? \$this->vars['\\1'] : '') . '", $this->message);
-
- preg_match_all('##', $this->message, $blocks, PREG_SET_ORDER);
-
- $text_blocks = preg_split('##', $this->message);
-
- $compile_blocks = array();
- for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++) {
- $block_val = &$blocks[$curr_tb];
-
- switch ($block_val[1]) {
- case 'IF':
- $compile_blocks[] = "'; " . $this->compile_tag_if(str_replace("\'", "'", $block_val[2]), false) . " \$this->message .= '";
- break;
-
- case 'ELSE':
- $compile_blocks[] = "'; } else { \$this->message .= '";
- break;
-
- case 'ELSEIF':
- $compile_blocks[] = "'; " . $this->compile_tag_if(str_replace("\'", "'", $block_val[2]), true) . " \$this->message .= '";
- break;
-
- case 'ENDIF':
- $compile_blocks[] = "'; } \$this->message .= '";
- break;
- }
- }
-
- $template_php = '';
- for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++) {
- $trim_check_text = trim($text_blocks[$i]);
- $template_php .= (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
- }
-
- eval("\$this->message = '$template_php';");
- }
-
- public function compile_tag_if($tag_args, $elseif)
- {
- // Tokenize args for 'if' tag.
- preg_match_all('/(?:
+ var $from, $message, $subject, $headers, $email_uid, $userlang, $errors;
+
+ public function __construct()
+ {
+ include_once PACKAGE_PATH . 'PHPMailer/PHPMailerAutoload.php';
+ }
+
+ function build_header()
+ {
+ global $system, $CHARSET;
+
+ $headers = array();
+
+ if (!isset($this->from) || empty($this->from))
+ {
+ $this->from = $system->SETTINGS['adminmail'];
+ }
+
+ $headers[] = 'From: ' . $this->from;
+ $headers[] = 'Reply-To: ' . $this->from;
+ $headers[] = 'Return-Path: <' . $this->from . '>';
+ $headers[] = 'Sender: <' . $system->SETTINGS['adminmail'] . '>';
+ $headers[] = 'MIME-Version: 1.0';
+ $headers[] = 'Date: ' . date('r');
+ //$headers[] = 'Content-Type: text/plain; charset=' . $CHARSET;
+ $headers[] = 'Content-Type: text/html; charset=' . $CHARSET;
+ $headers[] = 'Content-Transfer-Encoding: 8bit';
+
+ $this->headers = implode("\n", $headers);
+ }
+
+ function buildmessage($file)
+ {
+ $buffer = file(MAIN_PATH . 'language/' . $this->getuserlang() . '/emails/' . $this->getusermailtype() . '/' . $file);
+ $i = 0;
+ $j = 0;
+ while ($i < count($buffer))
+ {
+ if (!preg_match('/^#(.)*$/', $buffer[$i]))
+ {
+ $skipped_buffer[$j] = $buffer[$i];
+ $j++;
+ }
+ $i++;
+ }
+ $this->message = implode($skipped_buffer, '');
+ $this->message = str_replace("'", "\'", $this->message);
+
+ $this->message = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "' . ((isset(\$this->vars['\\1'])) ? \$this->vars['\\1'] : '') . '", $this->message);
+
+ preg_match_all('##', $this->message, $blocks, PREG_SET_ORDER);
+
+ $text_blocks = preg_split('##', $this->message);
+
+ $compile_blocks = array();
+ for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++)
+ {
+ $block_val = &$blocks[$curr_tb];
+
+ switch ($block_val[1])
+ {
+ case 'IF':
+ $compile_blocks[] = "'; " . $this->compile_tag_if (str_replace("\'", "'", $block_val[2]), false) . " \$this->message .= '";
+ break;
+
+ case 'ELSE':
+ $compile_blocks[] = "'; } else { \$this->message .= '";
+ break;
+
+ case 'ELSEIF':
+ $compile_blocks[] = "'; " . $this->compile_tag_if (str_replace("\'", "'", $block_val[2]), true) . " \$this->message .= '";
+ break;
+
+ case 'ENDIF':
+ $compile_blocks[] = "'; } \$this->message .= '";
+ break;
+ }
+ }
+
+ $template_php = '';
+ for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++)
+ {
+ $trim_check_text = trim($text_blocks[$i]);
+ $template_php .= (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
+ }
+
+ eval("\$this->message = '$template_php';");
+ }
+
+ function compile_tag_if ($tag_args, $elseif)
+ {
+ // Tokenize args for 'if' tag.
+ preg_match_all('/(?:
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
[(),] |
[^\s(),]+)/x', $tag_args, $match);
- $tokens = $match[0];
- $is_arg_stack = array();
-
- for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) {
- $token = &$tokens[$i];
-
- switch ($token) {
- case '!==':
- case '===':
- case '<<':
- case '>>':
- case '|':
- case '^':
- case '&':
- case '~':
- case ')':
- case ',':
- case '+':
- case '-':
- case '*':
- case '/':
- case '@':
- break;
-
- case '==':
- case 'eq':
- $token = '==';
- break;
-
- case '!=':
- case '<>':
- case 'ne':
- case 'neq':
- $token = '!=';
- break;
-
- case '<':
- case 'lt':
- $token = '<';
- break;
-
- case '<=':
- case 'le':
- case 'lte':
- $token = '<=';
- break;
-
- case '>':
- case 'gt':
- $token = '>';
- break;
-
- case '>=':
- case 'ge':
- case 'gte':
- $token = '>=';
- break;
-
- case '&&':
- case 'and':
- $token = '&&';
- break;
-
- case '||':
- case 'or':
- $token = '||';
- break;
-
- case '!':
- case 'not':
- $token = '!';
- break;
-
- case '%':
- case 'mod':
- $token = '%';
- break;
-
- case '(':
- array_push($is_arg_stack, $i);
- break;
-
- case 'is':
- $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
- $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
-
- $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
-
- array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
-
- $i = $is_arg_start;
-
- // no break
-
- default:
- if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs)) {
- $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->vars[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->vars[\'' . $varrefs[3] . '\']');
- } elseif (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) {
- // Allow checking if loops are set with .loopname
- // It is also possible to check the loop count by doing for example
- $blocks = explode('.', $varrefs[1]);
-
- // If the block is nested, we have a reference that we can grab.
- // If the block is not nested, we just go and grab the block from _tpldata
- if (sizeof($blocks) > 1) {
- $block = array_pop($blocks);
- $namespace = implode('.', $blocks);
- $varref = $this->generate_block_data_ref($namespace, true);
-
- // Add the block reference for the last child.
- $varref .= "['" . $block . "']";
- } else {
- $varref = '$this->_tpldata';
-
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[0] . "']";
- }
- $token = "sizeof($varref)";
- } elseif (!empty($token)) {
- $token = '(' . $token . ')';
- }
-
- break;
- }
- }
-
- // If there are no valid tokens left or only control/compare characters left, we do skip this statement
- if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '') {
- $tokens = array('false');
- }
- return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
- }
-
- public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
- {
- // Get an array of the blocks involved.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
-
- // DEFINE is not an element of any referenced variable, we must use _tpldata to access it
- if ($defop) {
- $varref = '$this->_tpldata[\'DEFINE\']';
- // Build up the string with everything but the last child.
- for ($i = 0; $i < $blockcount; $i++) {
- $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
- }
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[$blockcount] . "']";
- // Add the iterator for the last child if requried.
- if ($include_last_iterator) {
- $varref .= '[$_' . $blocks[$blockcount] . '_i]';
- }
- return $varref;
- } elseif ($include_last_iterator) {
- return '$_'. $blocks[$blockcount] . '_val';
- } else {
- return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
- }
- }
-
- public function assign_vars($vars)
- {
- $this->vars = (empty($this->vars)) ? $vars : $this->vars + $vars;
- }
-
- public function getuserlang()
- {
- global $system, $DBPrefix, $language, $db;
-
- if (isset($this->email_uid) && $this->email_uid > 0) {
- // Retrieve user's prefered language
- $query = "SELECT language FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $this->email_uid, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $USERLANG = $db->result('language');
- if (isset($USERLANG) && !empty($USERLANG)) {
- return $USERLANG;
- }
- }
- } elseif (isset($this->userlang)) {
- $language = $this->userlang;
- }
-
- return $language;
- }
-
- public function getusermailtype()
- {
- global $system, $DBPrefix, $db;
-
- if (isset($this->email_uid) && $this->email_uid > 0) {
- // Retrieve user's prefered language
- $query = "SELECT emailtype FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $this->email_uid, 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $emailtype = $db->result('emailtype');
- if (isset($emailtype) && !empty($emailtype)) {
- return $emailtype;
- }
- }
- }
-
- return 'html';
- }
-
- public function add_error($error)
- {
- array_push($this->errors, $error);
- }
-
- public function sendmail()
- {
- global $CHARSET, $system;
- $this->errors = array();
- // from has not been set send email via admin
- if (!isset($this->from) || empty($this->from)) {
- $this->from = $system->SETTINGS['adminmail'];
- }
-
- // if sending to admin, send to all linked admin emails
- if ($system->SETTINGS['adminmail'] == $this->to) {
- $emails = array_filter(explode(',', $system->SETTINGS['alert_emails']));
-
- if (!empty($emails)) {
- if (!is_array($this->to)) {
- $to_start = $this->to;
- $this->to = array();
- $this->to[] = $to_start;
- }
- foreach ($emails as $email) {
- if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
- $this->to[] = $email;
- }
- }
- }
- }
-
- // deal with sending the emails
- switch ($system->SETTINGS['mail_protocol']) {
- case '5':
- $mail = new PHPMailer(true);
- $mail->isQmail();
- break;
- case '4':
- $mail = new PHPMailer(true);
- $mail->isSendmail();
- break;
- case '3':
- // do not send email
- return 'No email sent. You have selected to disable all emails';
- break;
- case '2':
- $mail = new PHPMailer(true);
- $mail->isSMTP();
- $mail->SMTPDebug = 0;
- $mail->Debugoutput = 'html';
- $mail->Host = $system->SETTINGS['smtp_host'];
- $mail->Port = (integer)$system->SETTINGS['smtp_port'];
- if ($system->SETTINGS['smtp_security'] != 'none') {
- $mail->SMTPSecure = strtolower($system->SETTINGS['smtp_security']);
- }
- if ($system->SETTINGS['smtp_authentication'] == 'y') {
- $mail->SMTPAuth = true;
- $mail->Username = $system->SETTINGS['smtp_username'];
- $mail->Password = $system->SETTINGS['smtp_password'];
- } else {
- $mail->SMTPAuth = false;
- }
- break;
- case '1':
- $mail = new PHPMailer(true);
- $mail->isMail();
- break;
- default: // just use php mail function
- if (is_array($this->to)) {
- for ($i = 0; $i < count($this->to); $i++) {
- if (!empty($system->SETTINGS['mail_parameter'])) {
- $sent = mail($this->to[$i], $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
- } else {
- $sent = mail($this->to[$i], $this->subject, $this->message, $this->headers);
- }
- }
- } else {
- if (!empty($system->SETTINGS['mail_parameter'])) {
- $sent = mail($this->to, $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
- } else {
- $sent = mail($this->to, $this->subject, $this->message, $this->headers);
- }
- }
- if ($sent) {
- return false;
- } else {
- return true;
- }
- break;
- }
-
- if (is_array($this->to)) {
- for ($i = 0; $i < count($this->to); $i++) {
- try {
- $mail->setFrom($this->from, $system->SETTINGS['sitename']);
- $mail->addAddress($this->to[$i]);
- $mail->addReplyTo($this->from, $system->SETTINGS['adminmail']);
- $mail->Subject = $this->subject;
- $mail->msgHTML($this->message);
- //$mail->addAttachment('images/phpmailer_mini.png');
- $mail->CharSet = $CHARSET;
- $mail->send();
- } catch (phpmailerException $e) {
- //trigger_error('---->PHPMailer error: ' . $e->errorMessage());
- $this->add_error($e->errorMessage());
- } catch (Exception $e) {
- //trigger_error('---->PHPMailer error2: ' . $e->getMessage());
- $this->add_error($e->getMessage());
- }
- $mail->clearAddresses();
- }
- } else {
- try {
- $mail->setFrom($this->from, $system->SETTINGS['sitename']);
- if (is_array($this->to)) {
- for ($i = 0; $i < count($this->to); $i++) {
- $mail->addAddress($this->to[$i]);
- }
- } else {
- $mail->addAddress($this->to);
- }
- $mail->addReplyTo($this->from, $system->SETTINGS['adminmail']);
- $mail->Subject = $this->subject;
- $mail->msgHTML($this->message);
- $mail->CharSet = $CHARSET;
- $mail->send();
- } catch (phpmailerException $e) {
- //trigger_error('---->PHPMailer error: ' . $e->errorMessage());
- $this->add_error($e->errorMessage());
- } catch (Exception $e) {
- //trigger_error('---->PHPMailer error: ' . $e->getMessage());
- $this->add_error($e->getMessage());
- }
- }
- return implode(' ', $this->errors);
- }
-
- public function email_basic($subject, $to, $message, $from = '')
- {
- $this->to = $to;
- $this->subject = $subject;
- $this->from = $from;
- $this->message = $message;
- $this->build_header();
- return $this->sendmail();
- }
-
- public function email_sender($to, $file, $subject)
- {
- $this->to = $to;
- $this->subject = $subject;
- $this->build_header();
- $this->buildmessage($file);
- return $this->sendmail();
- }
+ $tokens = $match[0];
+ $is_arg_stack = array();
+
+ for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
+ {
+ $token = &$tokens[$i];
+
+ switch ($token)
+ {
+ case '!==':
+ case '===':
+ case '<<':
+ case '>>':
+ case '|':
+ case '^':
+ case '&':
+ case '~':
+ case ')':
+ case ',':
+ case '+':
+ case '-':
+ case '*':
+ case '/':
+ case '@':
+ break;
+
+ case '==':
+ case 'eq':
+ $token = '==';
+ break;
+
+ case '!=':
+ case '<>':
+ case 'ne':
+ case 'neq':
+ $token = '!=';
+ break;
+
+ case '<':
+ case 'lt':
+ $token = '<';
+ break;
+
+ case '<=':
+ case 'le':
+ case 'lte':
+ $token = '<=';
+ break;
+
+ case '>':
+ case 'gt':
+ $token = '>';
+ break;
+
+ case '>=':
+ case 'ge':
+ case 'gte':
+ $token = '>=';
+ break;
+
+ case '&&':
+ case 'and':
+ $token = '&&';
+ break;
+
+ case '||':
+ case 'or':
+ $token = '||';
+ break;
+
+ case '!':
+ case 'not':
+ $token = '!';
+ break;
+
+ case '%':
+ case 'mod':
+ $token = '%';
+ break;
+
+ case '(':
+ array_push($is_arg_stack, $i);
+ break;
+
+ case 'is':
+ $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
+ $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
+
+ $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
+
+ array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
+
+ $i = $is_arg_start;
+
+ // no break
+
+ default:
+ if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs))
+ {
+ $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->vars[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->vars[\'' . $varrefs[3] . '\']');
+ }
+ elseif (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
+ {
+ // Allow checking if loops are set with .loopname
+ // It is also possible to check the loop count by doing for example
+ $blocks = explode('.', $varrefs[1]);
+
+ // If the block is nested, we have a reference that we can grab.
+ // If the block is not nested, we just go and grab the block from _tpldata
+ if (sizeof($blocks) > 1)
+ {
+ $block = array_pop($blocks);
+ $namespace = implode('.', $blocks);
+ $varref = $this->generate_block_data_ref($namespace, true);
+
+ // Add the block reference for the last child.
+ $varref .= "['" . $block . "']";
+ }
+ else
+ {
+ $varref = '$this->_tpldata';
+
+ // Add the block reference for the last child.
+ $varref .= "['" . $blocks[0] . "']";
+ }
+ $token = "sizeof($varref)";
+ }
+ elseif (!empty($token))
+ {
+ $token = '(' . $token . ')';
+ }
+
+ break;
+ }
+ }
+
+ // If there are no valid tokens left or only control/compare characters left, we do skip this statement
+ if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '')
+ {
+ $tokens = array('false');
+ }
+ return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
+ }
+
+ function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
+ {
+ // Get an array of the blocks involved.
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ // DEFINE is not an element of any referenced variable, we must use _tpldata to access it
+ if ($defop)
+ {
+ $varref = '$this->_tpldata[\'DEFINE\']';
+ // Build up the string with everything but the last child.
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
+ }
+ // Add the block reference for the last child.
+ $varref .= "['" . $blocks[$blockcount] . "']";
+ // Add the iterator for the last child if requried.
+ if ($include_last_iterator)
+ {
+ $varref .= '[$_' . $blocks[$blockcount] . '_i]';
+ }
+ return $varref;
+ }
+ else if ($include_last_iterator)
+ {
+ return '$_'. $blocks[$blockcount] . '_val';
+ }
+ else
+ {
+ return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
+ }
+ }
+
+ function assign_vars($vars)
+ {
+ $this->vars = (empty($this->vars)) ? $vars : $this->vars + $vars;
+ }
+
+ function getuserlang()
+ {
+ global $system, $DBPrefix, $language, $db;
+
+ if (isset($this->email_uid) && $this->email_uid > 0)
+ {
+ // Retrieve user's prefered language
+ $query = "SELECT language FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $this->email_uid, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $USERLANG = $db->result('language');
+ if (isset($USERLANG) && !empty($USERLANG)) return $USERLANG;
+ }
+ }
+ elseif(isset($this->userlang))
+ {
+ $language = $this->userlang;
+ }
+
+ return $language;
+ }
+
+ function getusermailtype()
+ {
+ global $system, $DBPrefix, $db;
+
+ if (isset($this->email_uid) && $this->email_uid > 0)
+ {
+ // Retrieve user's prefered language
+ $query = "SELECT emailtype FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $this->email_uid, 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $emailtype = $db->result('emailtype');
+ if (isset($emailtype) && !empty($emailtype)) return $emailtype;
+ }
+ }
+
+ return 'html';
+ }
+
+ function add_error($error)
+ {
+ array_push($this->errors, $error);
+ }
+
+ function sendmail()
+ {
+ global $CHARSET, $system;
+ $this->errors = array();
+ // from has not been set send email via admin
+ if (!isset($this->from) || empty($this->from))
+ {
+ $this->from = $system->SETTINGS['adminmail'];
+ }
+
+ // if sending to admin, send to all linked admin emails
+ if ($system->SETTINGS['adminmail'] == $this->to)
+ {
+ $emails = array_filter(explode(',', $system->SETTINGS['alert_emails']));
+
+ if (!empty($emails))
+ {
+ if (!is_array($this->to))
+ {
+ $to_start = $this->to;
+ $this->to = array();
+ $this->to[] = $to_start;
+ }
+ foreach ($emails as $email)
+ {
+ if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email))
+ {
+ $this->to[] = $email;
+ }
+ }
+ }
+ }
+
+ // deal with sending the emails
+ switch ($system->SETTINGS['mail_protocol'])
+ {
+ case '5':
+ $mail = new PHPMailer(true);
+ $mail->isQmail();
+ break;
+ case '4':
+ $mail = new PHPMailer(true);
+ $mail->isSendmail();
+ break;
+ case '3':
+ // do not send email
+ return 'No email sent. You have selected to disable all emails';
+ break;
+ case '2':
+ $mail = new PHPMailer(true);
+ $mail->isSMTP();
+ $mail->SMTPDebug = 0;
+ $mail->Debugoutput = 'html';
+ $mail->Host = $system->SETTINGS['smtp_host'];
+ $mail->Port = (integer)$system->SETTINGS['smtp_port'];
+ if ($system->SETTINGS['smtp_security'] != 'none')
+ {
+ $mail->SMTPSecure = strtolower($system->SETTINGS['smtp_security']);
+ }
+ if ($system->SETTINGS['smtp_authentication'] == 'y')
+ {
+ $mail->SMTPAuth = true;
+ $mail->Username = $system->SETTINGS['smtp_username'];
+ $mail->Password = $system->SETTINGS['smtp_password'];
+ }
+ else
+ {
+ $mail->SMTPAuth = false;
+ }
+ break;
+ case '1':
+ $mail = new PHPMailer(true);
+ $mail->isMail();
+ break;
+ default: // just use php mail function
+ if (is_array($this->to))
+ {
+ for ($i = 0; $i < count($this->to); $i++)
+ {
+ if (!empty($system->SETTINGS['mail_parameter']))
+ $sent = mail($this->to[$i], $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
+ else
+ $sent = mail($this->to[$i], $this->subject, $this->message, $this->headers);
+ }
+ }
+ else
+ {
+ if (!empty($system->SETTINGS['mail_parameter']))
+ $sent = mail($this->to, $this->subject, $this->message, $this->headers, $system->SETTINGS['mail_parameter']);
+ else
+ $sent = mail($this->to, $this->subject, $this->message, $this->headers);
+ }
+ if ($sent)
+ return false;
+ else
+ return true;
+ break;
+ }
+
+ if (is_array($this->to))
+ {
+ for ($i = 0; $i < count($this->to); $i++)
+ {
+ try {
+ $mail->setFrom($this->from, $system->SETTINGS['adminmail']);
+ $mail->addAddress($this->to[$i]);
+ $mail->addReplyTo($this->from, $system->SETTINGS['adminmail']);
+ $mail->Subject = $this->subject;
+ $mail->msgHTML($this->message);
+ //$mail->addAttachment('images/phpmailer_mini.png');
+ $mail->CharSet = $CHARSET;
+ $mail->Send();
+ }
+ catch (phpmailerException $e)
+ {
+ trigger_error('---->PHPMailer error: ' . $e->errorMessage());
+ $this->add_error($e->errorMessage());
+ }
+ catch (Exception $e)
+ {
+ trigger_error('---->PHPMailer error2: ' . $e->getMessage());
+ $this->add_error($e->getMessage());
+ }
+ $mail->clearAddresses();
+ }
+ }
+ else
+ {
+ try {
+ $mail->setFrom($this->from, $system->SETTINGS['adminmail']);
+ if (is_array($this->to))
+ {
+ for ($i = 0; $i < count($this->to); $i++)
+ {
+ $mail->addAddress($this->to[$i]);
+ }
+ }
+ else
+ {
+ $mail->addAddress($this->to);
+ }
+ $mail->addReplyTo($this->from, $system->SETTINGS['adminmail']);
+ $mail->Subject = $this->subject;
+ $mail->msgHTML($this->message);
+ $mail->CharSet = $CHARSET;
+ $mail->Send();
+ }
+ catch (phpmailerException $e)
+ {
+ trigger_error('---->PHPMailer error: ' . $e->errorMessage());
+ $this->add_error($e->errorMessage());
+ }
+ catch (Exception $e)
+ {
+ trigger_error('---->PHPMailer error: ' . $e->getMessage());
+ $this->add_error($e->getMessage());
+ }
+ }
+ return implode(' ', $this->errors);
+ }
+
+ function email_basic($subject, $to, $message, $from = '')
+ {
+ $this->to = $to;
+ $this->subject = $subject;
+ $this->from = $from;
+ $this->message = $message;
+ $this->build_header();
+ $this->sendmail();
+ }
+
+ function email_sender($to, $file, $subject)
+ {
+ $this->to = $to;
+ $this->subject = $subject;
+ $this->build_header();
+ $this->buildmessage($file);
+ $this->sendmail();
+ }
}
diff --git a/includes/class_fees.php b/includes/class_fees.php
old mode 100644
new mode 100755
index fea864efd..66bc6ef58
--- a/includes/class_fees.php
+++ b/includes/class_fees.php
@@ -1,6 +1,6 @@
ASCII_RANGE = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $this->system = $system;
- $this->database = $db;
- $this->DBPrefix = $DBPrefix;
- $this->user = $user;
- $this->httpsConnection = $this->system->SETTINGS['https'] == 'y' ? true : false;
- $this->paypalAddress = $this->system->SETTINGS['payment_gateway_sandbox'] == 1 ? 'www.sandbox.paypal.com' : 'www.paypal.com';
- $this->fee_types = $this->get_fee_types();
- }
-
- public function get_fee_types()
- {
- $query = "SELECT type FROM " . $this->DBPrefix . "fees GROUP BY type";
- $this->database->direct_query($query);
- $fee_types = array();
- while ($row = $this->database->result()) {
- $fee_types[] = $row;
- }
- return $fee_types;
- }
-
- public function add_to_account($text, $type, $amount)
- {
- $date_values = date('z|W|m|Y');
- $date_values = explode('|', $date_values);
- $query = "INSERT INTO " . $this->DBPrefix . "accounts (nick, name, text, type, amount, day, week, month, year)
- VALUES (:user_nick, :user_name, :user_text, :user_type, :user_amount, " . $date_values[0] . ", " . $date_values[1] . ", " . $date_values[2] . ", " . $date_values[3] . ")";
- $params = array(
- array(':user_nick', $this->user->user_data['nick'], 'str'),
- array(':user_name', $this->user->user_data['name'], 'str'),
- array(':user_text', $text, 'str'),
- array(':user_type', $type, 'str'),
- array(':user_amount', $amount, 'int')
- );
- $this->database->query($query, $params);
- }
-
- public function hmac($key, $data)
- {
- // RFC 2104 HMAC implementation for php.
- // Creates an md5 HMAC.
- // Eliminates the need to install mhash to compute a HMAC
- // Hacked by Lance Rushing
-
- $b = 64; // byte length for md5
- if (strlen($key) > $b) {
- $key = pack("H*", md5($key));
- }
- $key = str_pad($key, $b, chr(0x00));
- $ipad = str_pad('', $b, chr(0x36));
- $opad = str_pad('', $b, chr(0x5c));
- $k_ipad = $key ^ $ipad ;
- $k_opad = $key ^ $opad;
-
- return md5($k_opad . pack("H*", md5($k_ipad . $data)));
- }
-
- public function paypal_validate()
- {
- // we ensure that the txn_id (transaction ID) contains only ASCII chars...
- $pos = strspn($this->data['txn_id'], $this->ASCII_RANGE);
- $len = strlen($this->data['txn_id']);
-
- if ($pos != $len) {
- return;
- }
-
- //validate payment
- $req = 'cmd=_notify-validate';
-
- foreach ($this->data as $key => $value) {
- // Handle escape characters, which depends on setting of magic quotes
- $value = urlencode($value);
- $req .= '&' . $key . '=' . $value;
- }
-
- // Post back to PayPal system to validate
- $header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
- $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $header .= "Host: " . $this->paypalAddress . "\r\n";
- $header .= "Content-Length: " . strlen($req) . "\r\n";
- $header .= "Connection: close\r\n\r\n";
-
- if ($this->httpsConnection) {
- // connect via SSL
- $fp = fsockopen('ssl://' . $this->paypalAddress, 443, $errno, $errstr, 30);
- } else {
- // connect via HTTP
- $fp = fsockopen($this->paypalAddress, 80, $errno, $errstr, 30);
- }
-
- if (!$fp) {
- $error_output = $errstr . ' (' . $errno . ')';
- } else {
- // Assign posted variables to local variables
- $payment_status = $this->data['payment_status'];
- $payment_amount = floatval($this->data['mc_gross']);
- list($custom_id, $fee_type) = explode('WEBID', $this->data['custom']);
-
- fputs($fp, $header . $req);
-
- while (!feof($fp)) {
- $resl = trim(fgets($fp, 1024));
-
- if (strcmp($resl, 'VERIFIED') == 0) {
- // We can do various checks to make sure nothing is wrong
- // Check that receiver_email is your Primary PayPal email and
- // that txn_id has not been previously processed
- if ($payment_status == 'Completed') {
- // everything seems to be OK
- self::callback_process($custom_id, $fee_type, $payment_amount);
- }
- } elseif (strcmp($resl, 'INVALID') == 0) {
- // payment failed
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
- header('location: '. $redirect_url);
- exit;
- }
- }
- fclose($fp);
- }
- }
-
- public function authnet_validate()
- {
- $payment_amount = floatval($this->data['x_amount']);
- list($custom_id, $fee_type) = explode('WEBID', $this->data['custom']);
- if ($this->data['x_response_code'] == 1) {
- self::callback_process($custom_id, $fee_type, $payment_amount);
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
- } else {
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
- }
-
- header('location: '. $redirect_url);
- exit;
- }
-
- public function worldpay_validate()
- {
- $payment_amount = floatval($this->data['amount']);
-
- list($custom_id, $fee_type) = explode('WEBID', $this->data['cartId']);
-
- if ($this->data['transStatus'] == 'Y') {
- self::callback_process($custom_id, $fee_type, $payment_amount);
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
- } else {
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
- }
-
- header('location: '. $redirect_url);
- exit;
- }
-
- public function skrill_validate()
- {
- $payment_amount = floatval($this->data['amount']);
-
- list($custom_id, $fee_type) = explode('WEBID', $this->data['trans_id']);
-
- if ($this->data['status'] == 2) {
- self::callback_process($custom_id, $fee_type, $payment_amount);
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
- } else {
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
- }
-
- header('location: '. $redirect_url);
- exit;
- }
-
- public function toocheckout_validate()
- {
- $payment_amount = floatval($this->data['total']);
-
- list($custom_id, $fee_type) = explode('WEBID', $this->data['cart_order_id']);
-
- if ($this->data['cart_order_id'] != '' && $this->data['credit_card_processed'] == 'Y') {
- self::callback_process($custom_id, $fee_type, $payment_amount);
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
- } else {
- $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
- }
-
- header('location: '. $redirect_url);
- exit;
- }
-
- private function callback_process($custom_id, $fee_type, $payment_amount)
- {
- switch ($fee_type) {
- case 1: // add to account balance
- $addquery = '';
- if ($this->system->SETTINGS['fee_disable_acc'] == 'y') {
- $query = "SELECT suspended, balance FROM " . $this->DBPrefix . "users WHERE id = :custom_id";
- $params = array(
- array(':custom_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
- $data = $this->database->result();
- // reable user account if it was disabled
- if ($data['suspended'] == 7 && ($data['balance'] + $payment_amount) >= 0) {
- $addquery = ', suspended = 0 ';
- }
- }
- $query = "UPDATE " . $this->DBPrefix . "users SET balance = balance + :payment" . $addquery . " WHERE id = :user_id";
- $params[] = array(':payment', $payment_amount, 'float');
- $params[] = array(':user_id', $custom_id, 'int');
- $this->database->query($query, $params);
- // add invoice
- $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, balance, total, paid) VALUES
- (:user_id, :payment, :extra_payment, 1)";
- $params = array(
- array(':user_id', $custom_id, 'int'),
- array(':payment', $payment_amount, 'float'),
- array(':extra_payment', $payment_amount, 'float')
- );
- $this->database->query($query, $params);
- break;
- case 2: // pay for an item
- $query = "UPDATE " . $this->DBPrefix . "winners SET paid = 1 WHERE id = :custom_id";
- $params = array(
- array(':custom_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
- break;
- case 3: // pay signup fee (live mode)
- $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :custom_id";
- $params = array(
- array(':custom_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
- // add invoice
- $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, signup, total, paid) VALUES
- (:get_id, :payment, :extra_payment, 1)";
- $params = array(
- array(':get_id', $custom_id, 'int'),
- array(':payment', $payment_amount, 'float'),
- array(':extra_payment', $payment_amount, 'float')
- );
- $this->database->query($query, $params);
- break;
- case 4: // pay auction fee (live mode)
- $catscontrol = new MPTTcategories();
-
- $query = "SELECT auc_id FROM " . $this->DBPrefix . "useraccounts WHERE useracc_id = :useracc_id";
- $params = array(
- array(':useracc_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
- $auc_id = $this->database->result('auc_id');
-
- $query = "UPDATE " . $this->DBPrefix . "auctions SET suspended = 0 WHERE id = :auc_id";
- $params = array(
- array(':auc_id', $auc_id, 'int')
- );
- $this->database->query($query, $params);
-
- $query = "UPDATE " . $this->DBPrefix . "useraccounts SET paid = 1 WHERE auc_id = :auc_id AND setup > 0";
- $params = array(
- array(':auc_id', $auc_id, 'int')
- );
- $this->database->query($query, $params);
-
- $query = "UPDATE " . $this->DBPrefix . "counters SET auctions = auctions + 1";
- $this->database->direct_query($query);
-
- $query = "UPDATE " . $this->DBPrefix . "useraccounts SET paid = 1 WHERE useracc_id = :custom_id";
- $params = array(
- array(':custom_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
-
- $query = "SELECT category, title, minimum_bid, pict_url, buy_now, reserve_price, auction_type, ends
+ var $ASCII_RANGE;
+ var $data;
+ var $fee_types;
+ private $system;
+ private $database;
+ private $DBPrefix;
+ private $user;
+ private $paypalAddress = 'www.paypal.com';
+ private $httpsConnection = false;
+
+ function __construct()
+ {
+ global $DBPrefix, $db, $system, $user;
+
+ $this->ASCII_RANGE = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $this->system = $system;
+ $this->database = $db;
+ $this->DBPrefix = $DBPrefix;
+ $this->user = $user;
+ $this->httpsConnection = $this->system->SETTINGS['https'] == 'y' ? true : false;
+ $this->paypalAddress = $this->system->SETTINGS['payment_gateway_sandbox'] == 1 ? 'www.sandbox.paypal.com' : 'www.paypal.com';
+ $this->fee_types = $this->get_fee_types();
+ }
+
+ public function get_fee_types()
+ {
+ $query = "SELECT type FROM " . $this->DBPrefix . "fees GROUP BY type";
+ $this->database->direct_query($query);
+ $fee_types = array();
+ while ($row = $this->database->result())
+ {
+ $fee_types[] = $row;
+ }
+ return $fee_types;
+ }
+
+ public function add_to_account($text, $type, $amount)
+ {
+ $date_values = date('z|W|m|Y');
+ $date_values = explode('|', $date_values);
+ $query = "INSERT INTO " . $this->DBPrefix . "accounts VALUES (NULL, :user_nick, :user_name, :user_text, :user_type, :user_time, :user_amount, " . $date_values[0] . ", " . $date_values[1] . ", " . $date_values[2] . ", " . $date_values[3] . ")";
+ $params = array(
+ array(':user_nick', $this->user->user_data['nick'], 'str'),
+ array(':user_name', $this->user->user_data['name'], 'str'),
+ array(':user_text', $text, 'str'),
+ array(':user_type', $type, 'str'),
+ array(':user_time', time(), 'int'),
+ array(':user_amount', $amount, 'int')
+ );
+ $this->database->query($query, $params);
+ }
+
+ public function hmac($key, $data)
+ {
+ // RFC 2104 HMAC implementation for php.
+ // Creates an md5 HMAC.
+ // Eliminates the need to install mhash to compute a HMAC
+ // Hacked by Lance Rushing
+
+ $b = 64; // byte length for md5
+ if (strlen($key) > $b)
+ {
+ $key = pack("H*", md5($key));
+ }
+ $key = str_pad($key, $b, chr(0x00));
+ $ipad = str_pad('', $b, chr(0x36));
+ $opad = str_pad('', $b, chr(0x5c));
+ $k_ipad = $key ^ $ipad ;
+ $k_opad = $key ^ $opad;
+
+ return md5($k_opad . pack("H*", md5($k_ipad . $data)));
+ }
+
+ public function paypal_validate()
+ {
+ // we ensure that the txn_id (transaction ID) contains only ASCII chars...
+ $pos = strspn($this->data['txn_id'], $this->ASCII_RANGE);
+ $len = strlen($this->data['txn_id']);
+
+ if ($pos != $len)
+ {
+ return;
+ }
+
+ //validate payment
+ $req = 'cmd=_notify-validate';
+
+ foreach ($this->data as $key => $value)
+ {
+ // Handle escape characters, which depends on setting of magic quotes
+ $value = urlencode($value);
+ $req .= '&' . $key . '=' . $value;
+ }
+
+ // Post back to PayPal system to validate
+ $header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
+ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $header .= "Host: " . $this->paypalAddress . "\r\n";
+ $header .= "Content-Length: " . strlen($req) . "\r\n";
+ $header .= "Connection: close\r\n\r\n";
+
+ if ($this->httpsConnection)
+ {
+ // connect via SSL
+ $fp = fsockopen ('ssl://' . $this->paypalAddress, 443, $errno, $errstr, 30);
+ }
+ else
+ {
+ // connect via HTTP
+ $fp = fsockopen ($this->paypalAddress, 80, $errno, $errstr, 30);
+ }
+
+ if (!$fp)
+ {
+ $error_output = $errstr . ' (' . $errno . ')';
+ }
+ else
+ {
+ // Assign posted variables to local variables
+ $payment_status = $this->data['payment_status'];
+ $payment_amount = floatval ($this->data['mc_gross']);
+ list($custom_id, $fee_type) = explode('WEBID', $this->data['custom']);
+
+ fputs ($fp, $header . $req);
+
+ while (!feof($fp))
+ {
+ $resl = trim(fgets ($fp, 1024));
+
+ if (strcmp ($resl, 'VERIFIED') == 0)
+ {
+ // We can do various checks to make sure nothing is wrong
+ // Check that receiver_email is your Primary PayPal email and
+ // that txn_id has not been previously processed
+ if ($payment_status == 'Completed')
+ {
+ // everything seems to be OK
+ self::callback_process($custom_id, $fee_type, $payment_amount);
+ }
+ }
+ else if (strcmp ($resl, 'INVALID') == 0)
+ {
+ // payment failed
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
+ header('location: '. $redirect_url);
+ exit;
+ }
+ }
+ fclose ($fp);
+ }
+ }
+
+ public function authnet_validate()
+ {
+ $payment_amount = floatval ($this->data['x_amount']);
+ list($custom_id, $fee_type) = explode('WEBID', $this->data['custom']);
+ if ($this->data['x_response_code'] == 1)
+ {
+ self::callback_process($custom_id, $fee_type, $payment_amount);
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
+ }
+ else
+ {
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
+ }
+
+ header('location: '. $redirect_url);
+ exit;
+ }
+
+ public function worldpay_validate()
+ {
+ $payment_amount = floatval ($this->data['amount']);
+
+ list($custom_id, $fee_type) = explode('WEBID',$this->data['cartId']);
+
+ if ($this->data['transStatus'] == 'Y')
+ {
+ self::callback_process($custom_id, $fee_type, $payment_amount);
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
+ }
+ else
+ {
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
+ }
+
+ header('location: '. $redirect_url);
+ exit;
+ }
+
+ public function moneybookers_validate() // now called skrill
+ {
+ $payment_amount = floatval ($this->data['amount']);
+
+ list($custom_id, $fee_type) = explode('WEBID',$this->data['trans_id']);
+
+ if ($this->data['status'] == 2)
+ {
+ self::callback_process($custom_id, $fee_type, $payment_amount);
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
+ }
+ else
+ {
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
+ }
+
+ header('location: '. $redirect_url);
+ exit;
+ }
+
+ public function toocheckout_validate()
+ {
+ $payment_amount = floatval ($this->data['total']);
+
+ list($custom_id, $fee_type) = explode('WEBID',$this->data['cart_order_id']);
+
+ if ($this->data['cart_order_id'] != '' && $this->data['credit_card_processed'] == 'Y')
+ {
+ self::callback_process($custom_id, $fee_type, $payment_amount);
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?completed';
+ }
+ else
+ {
+ $redirect_url = $this->system->SETTINGS['siteurl'] . 'validate.php?fail';
+ }
+
+ header('location: '. $redirect_url);
+ exit;
+ }
+
+ private function callback_process($custom_id, $fee_type, $payment_amount, $currency = NULL)
+ {
+ switch ($fee_type)
+ {
+ case 1: // add to account balance
+ $addquery = '';
+ if ($this->system->SETTINGS['fee_disable_acc'] == 'y')
+ {
+ $query = "SELECT suspended, balance FROM " . $this->DBPrefix . "users WHERE id = :custom_id";
+ $params = array(
+ array(':custom_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+ $data = $this->database->result();
+ // reable user account if it was disabled
+ if ($data['suspended'] == 7 && ($data['balance'] + $payment_amount) >= 0)
+ {
+ $addquery = ', suspended = 0 ';
+ }
+ }
+ $query = "UPDATE " . $this->DBPrefix . "users SET balance = balance + :payment" . $addquery . " WHERE id = :user_id";
+ $params[] = array(':payment', $payment_amount, 'float');
+ $params[] = array(':user_id', $custom_id, 'int');
+ $this->database->query($query, $params);
+ // add invoice
+ $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, date, balance, total, paid) VALUES
+ (:user_id, :time_stamp, :payment, :extra_payment, 1)";
+ $params = array(
+ array(':user_id', $custom_id, 'int'),
+ array(':time_stamp', time(), 'int'),
+ array(':payment', $payment_amount, 'float'),
+ array(':extra_payment', $payment_amount, 'float')
+ );
+ $this->database->query($query, $params);
+ break;
+ case 2: // pay for an item
+ $query = "UPDATE " . $this->DBPrefix . "winners SET paid = 1 WHERE id = :custom_id";
+ $params = array(
+ array(':custom_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+ break;
+ case 3: // pay signup fee (live mode)
+ $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :custom_id";
+ $params = array(
+ array(':custom_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+ // add invoice
+ $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, date, signup, total, paid) VALUES
+ (:get_id, :time_stamp, :payment, :extra_payment, 1)";
+ $params = array(
+ array(':get_id', $custom_id, 'int'),
+ array(':time_stamp', time(), 'int'),
+ array(':payment', $payment_amount, 'float'),
+ array(':extra_payment', $payment_amount, 'float')
+ );
+ $this->database->query($query, $params);
+ break;
+ case 4: // pay auction fee (live mode)
+ $catscontrol = new MPTTcategories();
+
+ $query = "SELECT auc_id FROM " . $this->DBPrefix . "useraccounts WHERE useracc_id = :useracc_id";
+ $params = array(
+ array(':useracc_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+ $auc_id = $this->database->result('auc_id');
+
+ $query = "UPDATE " . $this->DBPrefix . "auctions SET suspended = 0 WHERE id = :auc_id";
+ $params = array(
+ array(':auc_id', $auc_id, 'int')
+ );
+ $this->database->query($query, $params);
+
+ $query = "UPDATE " . $this->DBPrefix . "useraccounts SET paid = 1 WHERE auc_id = :auc_id AND setup > 0";
+ $params = array(
+ array(':auc_id', $auc_id, 'int')
+ );
+ $this->database->query($query, $params);
+
+ $query = "UPDATE " . $this->DBPrefix . "counters SET auctions = auctions + 1";
+ $this->database->direct_query($query);
+
+ $query = "UPDATE " . $this->DBPrefix . "useraccounts SET paid = 1 WHERE useracc_id = :custom_id";
+ $params = array(
+ array(':custom_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+
+ $query = "SELECT category, title, minimum_bid, pict_url, buy_now, reserve_price, auction_type, ends
FROM " . $this->DBPrefix . "auctions WHERE id = :auc_id";
- $params = array(
- array(':auc_id', $auc_id, 'int')
- );
- $this->database->query($query, $params);
- $auc_data = $this->database->result();
-
- // auction data
- $auction_id = $auc_id;
- $title = htmlspecialchars($auc_data['title']);
- $atype = $auc_data['auction_type'];
- $pict_url = $auc_data['pict_url'];
- $minimum_bid = $auc_data['minimum_bid'];
- $reserve_price = $auc_data['reserve_price'];
- $buy_now_price = $auc_data['buy_now'];
- $a_ends = $auc_data['ends'];
-
- if ($this->user->user_data['startemailmode'] == 'yes') {
- include INCLUDE_PATH . 'email/auction_confirmation.php';
- }
-
- // update recursive categories
- $query = "SELECT left_id, right_id, level FROM " . $this->DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array(
- array(':cat_id', $auc_data['category'], 'int')
- );
- $this->database->query($query, $params);
- $parent_node = $this->database->result();
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $this->DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
- $params = array(
- array(':cat_id', $crumbs[$i]['cat_id'], 'int')
- );
- $this->database->query($query, $params);
- }
- break;
- case 5: // pay relist fee (live mode)
- $query = "UPDATE " . $this->DBPrefix . "auctions SET suspended = 0 WHERE id = :custom_id";
- $params = array(
- array(':custom_id', $custom_id, 'int')
- );
- $this->database->query($query, $params);
- // add invoice
- $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, relist, total, paid) VALUES
- (:user_id, :auc_id, :relist, :total, 1)";
- $params = array(
- array(':user_id', $custom_id, 'int'),
- array(':auc_id', $custom_id, 'int'),
- array(':relist', $payment_amount, 'float'),
- array(':total', $payment_amount, 'float')
- );
- $this->database->query($query, $params);
- break;
- case 6: // pay buyer fee (live mode)
- $query = "UPDATE " . $this->DBPrefix . "winners SET bf_paid = 1 WHERE bf_paid = 0 AND auction = :auction_id AND winner = :winner_id";
- $params = array(
- array(':auction_id', $custom_id, 'int'),
- array(':winner_id', $this->user->user_data['id'], 'int')
- );
- $this->database->query($query, $params);
-
- $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
- $params = array(
- array(':user_id', $this->user->user_data['id'], 'int')
- );
- $this->database->query($query, $params);
-
- // add invoice
- $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, buyer, total, paid) VALUES
- (:user_id, :auc_id, :buyer, :total, 1)";
- $params = array(
- array(':user_id', $this->user->user_data['id'], 'int'),
- array(':auc_id', $custom_id, 'int'),
- array(':buyer', $payment_amount, 'float'),
- array(':total', $payment_amount, 'float')
- );
- $this->database->query($query, $params);
- break;
- case 7: // pay final value fee (live mode)
- $query = "UPDATE " . $this->DBPrefix . "winners SET ff_paid = 1 WHERE ff_paid = 0 AND auction = :auction_id AND seller = :user_id";
- $params = array(
- array(':auction_id', $custom_id, 'int'),
- array(':user_id', $this->user->user_data['id'], 'int')
- );
- $this->database->query($query, $params);
-
- $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
- $params = array(
- array(':user_id', $this->user->user_data['id'], 'int')
- );
- $this->database->query($query, $params);
-
- // add invoice
- $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, date, finalval, total, paid) VALUES
+ $params = array(
+ array(':auc_id', $auc_id, 'int')
+ );
+ $this->database->query($query, $params);
+ $auc_data = $this->database->result();
+
+ // auction data
+ $auction_id = $auc_id;
+ $title = htmlspecialchars($auc_data['title']);
+ $atype = $auc_data['auction_type'];
+ $pict_url = $auc_data['pict_url'];
+ $minimum_bid = $auc_data['minimum_bid'];
+ $reserve_price = $auc_data['reserve_price'];
+ $buy_now_price = $auc_data['buy_now'];
+ $a_ends = $auc_data['ends'];
+
+ if ($this->user->user_data['startemailmode'] == 'yes')
+ {
+ include INCLUDE_PATH . 'email/auction_confirmation.php';
+ }
+
+ // update recursive categories
+ $query = "SELECT left_id, right_id, level FROM " . $this->DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array(
+ array(':cat_id', $auc_data['category'], 'int')
+ );
+ $this->database->query($query, $params);
+ $parent_node = $this->database->result();
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $this->DBPrefix . "categories SET sub_counter = sub_counter + 1 WHERE cat_id = :cat_id";
+ $params = array(
+ array(':cat_id', $crumbs[$i]['cat_id'], 'int')
+ );
+ $this->database->query($query, $params);
+ }
+ break;
+ case 5: // pay relist fee (live mode)
+ $query = "UPDATE " . $this->DBPrefix . "auctions SET suspended = 0 WHERE id = :custom_id";
+ $params = array(
+ array(':custom_id', $custom_id, 'int')
+ );
+ $this->database->query($query, $params);
+ // add invoice
+ $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, date, relist, total, paid) VALUES
+ (:user_id, :auc_id, :date, :relist, :total, 1)";
+ $params = array(
+ array(':user_id', $custom_id, 'int'),
+ array(':auc_id', $custom_id, 'int'),
+ array(':date', time(), 'int'),
+ array(':relist', $payment_amount, 'float'),
+ array(':total', $payment_amount, 'float')
+ );
+ $this->database->query($query, $params);
+ break;
+ case 6: // pay buyer fee (live mode)
+ $query = "UPDATE " . $this->DBPrefix . "winners SET bf_paid = 1 WHERE bf_paid = 0 AND auction = :auction_id AND winner = :winner_id";
+ $params = array(
+ array(':auction_id', $custom_id, 'int'),
+ array(':winner_id', $this->user->user_data['id'], 'int')
+ );
+ $this->database->query($query, $params);
+
+ $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
+ $params = array(
+ array(':user_id', $this->user->user_data['id'], 'int')
+ );
+ $this->database->query($query, $params);
+
+ // add invoice
+ $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, date, buyer, total, paid) VALUES
+ (:user_id, :auc_id, :time_stamp, :buyer, :total, 1)";
+ $params = array(
+ array(':user_id', $this->user->user_data['id'], 'int'),
+ array(':auc_id', $custom_id, 'int'),
+ array(':time_stamp', time(), 'int'),
+ array(':buyer', $payment_amount, 'float'),
+ array(':total', $payment_amount, 'float')
+ );
+ $this->database->query($query, $params);
+ break;
+ case 7: // pay final value fee (live mode)
+ $query = "UPDATE " . $this->DBPrefix . "winners SET ff_paid = 1 WHERE ff_paid = 0 AND auction = :auction_id AND seller = :user_id";
+ $params = array(
+ array(':auction_id', $custom_id, 'int'),
+ array(':user_id', $this->user->user_data['id'], 'int')
+ );
+ $this->database->query($query, $params);
+
+ $query = "UPDATE " . $this->DBPrefix . "users SET suspended = 0 WHERE id = :user_id";
+ $params = array(
+ array(':user_id', $this->user->user_data['id'], 'int')
+ );
+ $this->database->query($query, $params);
+
+ // add invoice
+ $query = "INSERT INTO " . $this->DBPrefix . "useraccounts (user_id, auc_id, date, finalval, total, paid) VALUES
(:user_id, :auc_id, :time_stamp, :finalval, :total, 1)";
- $params = array(
- array(':user_id', $this->user->user_data['id'], 'int'),
- array(':auc_id', $custom_id, 'int'),
- array(':time_stamp', $this->system->ctime, 'int'),
- array(':finalval', $payment_amount, 'float'),
- array(':total', $payment_amount, 'float')
- );
- $this->database->query($query, $params);
- break;
- }
- }
+ $params = array(
+ array(':user_id', $this->user->user_data['id'], 'int'),
+ array(':auc_id', $custom_id, 'int'),
+ array(':time_stamp', $this->system->ctime, 'int'),
+ array(':finalval', $payment_amount, 'float'),
+ array(':total', $payment_amount, 'float')
+ );
+ $this->database->query($query, $params);
+ break;
+ }
+ }
}
diff --git a/includes/config.inc.php.new b/includes/config.inc.php.new
deleted file mode 100644
index 64e22d7ff..000000000
--- a/includes/config.inc.php.new
+++ /dev/null
@@ -1,8 +0,0 @@
- 'http://paypal.com/',
- 'authnet' => 'http://authorize.net/',
- 'worldpay' => 'http://rbsworldpay.com/',
- 'skrill' => 'http://skrill.com/',
- 'toocheckout' => 'http://2checkout.com/'
- );
+ 'paypal' => 'http://paypal.com/',
+ 'authnet' => 'http://authorize.net/',
+ 'worldpay' => 'http://rbsworldpay.com/',
+ 'moneybookers' => 'http://moneybookers.com/',
+ 'toocheckout' => 'http://2checkout.com/'
+ );
$address_string = array(
- 'paypal' => $MSG['720'],
- 'authnet' => $MSG['773'],
- 'worldpay' => $MSG['824'],
- 'skrill' => $MSG['825'],
- 'toocheckout' => $MSG['826']
- );
+ 'paypal' => $MSG['720'],
+ 'authnet' => $MSG['773'],
+ 'worldpay' => $MSG['824'],
+ 'moneybookers' => $MSG['825'],
+ 'toocheckout' => $MSG['826']
+ );
$password_string = array(
- 'authnet' => $MSG['774']
- );
+ 'authnet' => $MSG['774']
+ );
$error_string = array(
- 'paypal' => $MSG['810'],
- 'authnet' => $MSG['811'],
- 'worldpay' => $MSG['823'],
- 'skrill' => $MSG['822'],
- 'toocheckout' => $MSG['821']
+ 'paypal' => $MSG['810'],
+ 'authnet' => $MSG['811'],
+ 'worldpay' => $MSG['823'],
+ 'moneybookers' => $MSG['822'],
+ 'toocheckout' => $MSG['821']
);
diff --git a/includes/config/timezones.php b/includes/config/timezones.php
old mode 100644
new mode 100755
index 322f4d00e..bd92100ac
--- a/includes/config/timezones.php
+++ b/includes/config/timezones.php
@@ -1,6 +1,6 @@
'(UTC-11:00) Midway Island, Samoa',
- 'Pacific/Honolulu' => '(UTC-10:00) Hawaii-Aleutian',
- 'Pacific/Marquesas' => '(UTC-09:30) Marquesas Islands',
- 'Pacific/Gambier' => '(UTC-09:00) Gambier Islands',
- 'America/Anchorage' => '(UTC-09:00) Alaska',
- 'America/Ensenada' => '(UTC-08:00) Tijuana, Baja California',
- 'Etc/GMT+8' => '(UTC-08:00) Pitcairn Islands',
- 'America/Los_Angeles' => '(UTC-08:00) Pacific Time (US & Canada)',
- 'America/Denver' => '(UTC-07:00) Mountain Time (US & Canada)',
- 'America/Chihuahua' => '(UTC-07:00) Chihuahua, La Paz, Mazatlan',
- 'America/Dawson_Creek' => '(UTC-07:00) Arizona',
- 'America/Belize' => '(UTC-06:00) Saskatchewan, Central America',
- 'America/Cancun' => '(UTC-06:00) Guadalajara, Mexico City, Monterrey',
- 'Chile/EasterIsland' => '(UTC-06:00) Easter Island',
- 'America/Chicago' => '(UTC-06:00) Central Time (US & Canada)',
- 'America/New_York' => '(UTC-05:00) Eastern Time (US & Canada)',
- 'America/Havana' => '(UTC-05:00) Cuba',
- 'America/Bogota' => '(UTC-05:00) Bogota, Lima, Quito, Rio Branco',
- 'America/Caracas' => '(UTC-04:30) Caracas',
- 'America/Santiago' => '(UTC-04:00) Santiago',
- 'America/La_Paz' => '(UTC-04:00) La Paz',
- 'Atlantic/Stanley' => '(UTC-04:00) Falkland Islands',
- 'America/Campo_Grande' => '(UTC-04:00) Brazil',
- 'America/Goose_Bay' => '(UTC-04:00) Atlantic Time (Goose Bay)',
- 'America/Glace_Bay' => '(UTC-04:00) Atlantic Time (Canada)',
- 'America/St_Johns' => '(UTC-03:30) Newfoundland',
- 'America/Araguaina' => '(UTC-03:00) UTC-3',
- 'America/Montevideo' => '(UTC-03:00) Montevideo',
- 'America/Miquelon' => '(UTC-03:00) Miquelon, St. Pierre',
- 'America/Godthab' => '(UTC-03:00) Greenland',
- 'America/Argentina/Buenos_Aires' => '(UTC-03:00) Buenos Aires',
- 'America/Sao_Paulo' => '(UTC-03:00) Brasilia',
- 'America/Noronha' => '(UTC-02:00) Mid-Atlantic',
- 'Atlantic/Cape_Verde' => '(UTC-01:00) Cape Verde Is.',
- 'Atlantic/Azores' => '(UTC-01:00) Azores',
- 'Europe/Dublin' => '(UTC) Irish Standard Time : Dublin',
- 'Europe/Lisbon' => '(UTC) Western European Time : Lisbon',
- 'Europe/London' => '(GMT) Greenwich Mean Time : London, Belfast',
- 'Africa/Abidjan' => '(GMT) Monrovia, Reykjavik',
- 'Europe/Amsterdam' => '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
- 'Europe/Belgrade' => '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague',
- 'Europe/Brussels' => '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris',
- 'Africa/Algiers' => '(UTC+01:00) West Central Africa',
- 'Africa/Windhoek' => '(UTC+01:00) Windhoek',
- 'Asia/Beirut' => '(UTC+02:00) Beirut',
- 'Africa/Cairo' => '(UTC+02:00) Cairo',
- 'Asia/Gaza' => '(UTC+02:00) Gaza',
- 'Africa/Johannesburg' => '(UTC+02:00) Johannesburg, Harare, Pretoria',
- 'Asia/Jerusalem' => '(UTC+02:00) Jerusalem',
- 'Europe/Athens' => '(UTC+02:00) Athens',
- 'Europe/Minsk' => '(UTC+02:00) Minsk',
- 'Asia/Damascus' => '(UTC+02:00) Syria',
- 'Europe/Moscow' => '(UTC+03:00) Moscow, St. Petersburg, Volgograd',
- 'Africa/Addis_Ababa' => '(UTC+03:00) Nairobi',
- 'Asia/Tehran' => '(UTC+03:30) Tehran',
- 'Asia/Dubai' => '(UTC+04:00) Abu Dhabi, Muscat',
- 'Asia/Yerevan' => '(UTC+04:00) Yerevan',
- 'Asia/Kabul' => '(UTC+04:30) Kabul',
- 'Asia/Yekaterinburg' => '(UTC+05:00) Ekaterinburg',
- 'Asia/Tashkent' => '(UTC+05:00) Tashkent',
- 'Asia/Kolkata' => '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi',
- 'Asia/Katmandu' => '(UTC+05:45) Kathmandu',
- 'Asia/Dhaka' => '(UTC+06:00) Astana, Dhaka',
- 'Asia/Novosibirsk' => '(UTC+06:00) Novosibirsk',
- 'Asia/Rangoon' => '(UTC+06:30) Yangon (Rangoon)',
- 'Asia/Bangkok' => '(UTC+07:00) Bangkok, Hanoi, Jakarta',
- 'Asia/Krasnoyarsk' => '(UTC+07:00) Krasnoyarsk',
- 'Asia/Hong_Kong' => '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi',
- 'Asia/Irkutsk' => '(UTC+08:00) Irkutsk, Ulaan Bataar',
- 'Australia/Perth' => '(UTC+08:00) Perth',
- 'Australia/Eucla' => '(UTC+08:45) Eucla',
- 'Asia/Tokyo' => '(UTC+09:00) Osaka, Sapporo, Tokyo',
- 'Asia/Seoul' => '(UTC+09:00) Seoul',
- 'Asia/Yakutsk' => '(UTC+09:00) Yakutsk',
- 'Australia/Adelaide' => '(UTC+09:30) Adelaide',
- 'Australia/Darwin' => '(UTC+09:30) Darwin',
- 'Australia/Sydney' => '(UTC+10:00) Sydney, Canberra, Melbourne, Hobart',
- 'Australia/Brisbane' => '(UTC+10:00) Brisbane',
- 'Asia/Vladivostok' => '(UTC+10:00) Vladivostok',
- 'Australia/Lord_Howe' => '(UTC+10:30) Lord Howe Island',
- 'Etc/GMT-11' => '(UTC+11:00) Solomon Is., New Caledonia',
- 'Asia/Magadan' => '(UTC+11:00) Magadan',
- 'Pacific/Norfolk' => '(UTC+11:30) Norfolk Island',
- 'Asia/Anadyr' => '(UTC+12:00) Anadyr, Kamchatka',
- 'Pacific/Auckland' => '(UTC+12:00) Auckland, Wellington',
- 'Etc/GMT-12' => '(UTC+12:00) Fiji, Kamchatka, Marshall Is.',
- 'Pacific/Chatham' => '(UTC+12:45) Chatham Islands',
- 'Pacific/Tongatapu' => '(UTC+13:00) Nuku Alofa',
- 'Pacific/Kiritimati' => '(UTC+14:00) Kiritimati'
- );
+ 'Pacific/Midway' => '(UTC-11:00) Midway Island, Samoa',
+ 'Pacific/Honolulu' => '(UTC-10:00) Hawaii-Aleutian',
+ 'Pacific/Marquesas' => '(UTC-09:30) Marquesas Islands',
+ 'Pacific/Gambier' => '(UTC-09:00) Gambier Islands',
+ 'America/Anchorage' => '(UTC-09:00) Alaska',
+ 'America/Ensenada' => '(UTC-08:00) Tijuana, Baja California',
+ 'Etc/GMT+8' => '(UTC-08:00) Pitcairn Islands',
+ 'America/Los_Angeles' => '(UTC-08:00) Pacific Time (US & Canada)',
+ 'America/Denver' => '(UTC-07:00) Mountain Time (US & Canada)',
+ 'America/Chihuahua' => '(UTC-07:00) Chihuahua, La Paz, Mazatlan',
+ 'America/Dawson_Creek' => '(UTC-07:00) Arizona',
+ 'America/Belize' => '(UTC-06:00) Saskatchewan, Central America',
+ 'America/Cancun' => '(UTC-06:00) Guadalajara, Mexico City, Monterrey',
+ 'Chile/EasterIsland' => '(UTC-06:00) Easter Island',
+ 'America/Chicago' => '(UTC-06:00) Central Time (US & Canada)',
+ 'America/New_York' => '(UTC-05:00) Eastern Time (US & Canada)',
+ 'America/Havana' => '(UTC-05:00) Cuba',
+ 'America/Bogota' => '(UTC-05:00) Bogota, Lima, Quito, Rio Branco',
+ 'America/Caracas' => '(UTC-04:30) Caracas',
+ 'America/Santiago' => '(UTC-04:00) Santiago',
+ 'America/La_Paz' => '(UTC-04:00) La Paz',
+ 'Atlantic/Stanley' => '(UTC-04:00) Falkland Islands',
+ 'America/Campo_Grande' => '(UTC-04:00) Brazil',
+ 'America/Goose_Bay' => '(UTC-04:00) Atlantic Time (Goose Bay)',
+ 'America/Glace_Bay' => '(UTC-04:00) Atlantic Time (Canada)',
+ 'America/St_Johns' => '(UTC-03:30) Newfoundland',
+ 'America/Araguaina' => '(UTC-03:00) UTC-3',
+ 'America/Montevideo' => '(UTC-03:00) Montevideo',
+ 'America/Miquelon' => '(UTC-03:00) Miquelon, St. Pierre',
+ 'America/Godthab' => '(UTC-03:00) Greenland',
+ 'America/Argentina/Buenos_Aires' => '(UTC-03:00) Buenos Aires',
+ 'America/Sao_Paulo' => '(UTC-03:00) Brasilia',
+ 'America/Noronha' => '(UTC-02:00) Mid-Atlantic',
+ 'Atlantic/Cape_Verde' => '(UTC-01:00) Cape Verde Is.',
+ 'Atlantic/Azores' => '(UTC-01:00) Azores',
+ 'Europe/Dublin' => '(UTC) Irish Standard Time : Dublin',
+ 'Europe/Lisbon' => '(UTC) Western European Time : Lisbon',
+ 'Europe/London' => '(GMT) Greenwich Mean Time : London, Belfast',
+ 'Africa/Abidjan' => '(GMT) Monrovia, Reykjavik',
+ 'Europe/Amsterdam' => '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
+ 'Europe/Belgrade' => '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague',
+ 'Europe/Brussels' => '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris',
+ 'Africa/Algiers' => '(UTC+01:00) West Central Africa',
+ 'Africa/Windhoek' => '(UTC+01:00) Windhoek',
+ 'Asia/Beirut' => '(UTC+02:00) Beirut',
+ 'Africa/Cairo' => '(UTC+02:00) Cairo',
+ 'Asia/Gaza' => '(UTC+02:00) Gaza',
+ 'Africa/Johannesburg' => '(UTC+02:00) Johannesburg, Harare, Pretoria',
+ 'Asia/Jerusalem' => '(UTC+02:00) Jerusalem',
+ 'Europe/Athens' => '(UTC+02:00) Athens',
+ 'Europe/Minsk' => '(UTC+02:00) Minsk',
+ 'Asia/Damascus' => '(UTC+02:00) Syria',
+ 'Europe/Moscow' => '(UTC+03:00) Moscow, St. Petersburg, Volgograd',
+ 'Africa/Addis_Ababa' => '(UTC+03:00) Nairobi',
+ 'Asia/Tehran' => '(UTC+03:30) Tehran',
+ 'Asia/Dubai' => '(UTC+04:00) Abu Dhabi, Muscat',
+ 'Asia/Yerevan' => '(UTC+04:00) Yerevan',
+ 'Asia/Kabul' => '(UTC+04:30) Kabul',
+ 'Asia/Yekaterinburg' => '(UTC+05:00) Ekaterinburg',
+ 'Asia/Tashkent' => '(UTC+05:00) Tashkent',
+ 'Asia/Kolkata' => '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi',
+ 'Asia/Katmandu' => '(UTC+05:45) Kathmandu',
+ 'Asia/Dhaka' => '(UTC+06:00) Astana, Dhaka',
+ 'Asia/Novosibirsk' => '(UTC+06:00) Novosibirsk',
+ 'Asia/Rangoon' => '(UTC+06:30) Yangon (Rangoon)',
+ 'Asia/Bangkok' => '(UTC+07:00) Bangkok, Hanoi, Jakarta',
+ 'Asia/Krasnoyarsk' => '(UTC+07:00) Krasnoyarsk',
+ 'Asia/Hong_Kong' => '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi',
+ 'Asia/Irkutsk' => '(UTC+08:00) Irkutsk, Ulaan Bataar',
+ 'Australia/Perth' => '(UTC+08:00) Perth',
+ 'Australia/Eucla' => '(UTC+08:45) Eucla',
+ 'Asia/Tokyo' => '(UTC+09:00) Osaka, Sapporo, Tokyo',
+ 'Asia/Seoul' => '(UTC+09:00) Seoul',
+ 'Asia/Yakutsk' => '(UTC+09:00) Yakutsk',
+ 'Australia/Adelaide' => '(UTC+09:30) Adelaide',
+ 'Australia/Darwin' => '(UTC+09:30) Darwin',
+ 'Australia/Sydney' => '(UTC+10:00) Sydney, Canberra, Melbourne, Hobart',
+ 'Australia/Brisbane' => '(UTC+10:00) Brisbane',
+ 'Asia/Vladivostok' => '(UTC+10:00) Vladivostok',
+ 'Australia/Lord_Howe' => '(UTC+10:30) Lord Howe Island',
+ 'Etc/GMT-11' => '(UTC+11:00) Solomon Is., New Caledonia',
+ 'Asia/Magadan' => '(UTC+11:00) Magadan',
+ 'Pacific/Norfolk' => '(UTC+11:30) Norfolk Island',
+ 'Asia/Anadyr' => '(UTC+12:00) Anadyr, Kamchatka',
+ 'Pacific/Auckland' => '(UTC+12:00) Auckland, Wellington',
+ 'Etc/GMT-12' => '(UTC+12:00) Fiji, Kamchatka, Marshall Is.',
+ 'Pacific/Chatham' => '(UTC+12:45) Chatham Islands',
+ 'Pacific/Tongatapu' => '(UTC+13:00) Nuku Alofa',
+ 'Pacific/Kiritimati' => '(UTC+14:00) Kiritimati'
+ );
diff --git a/includes/database/Database.php b/includes/database/Database.php
old mode 100644
new mode 100755
index ad15b868f..9c242cf67
--- a/includes/database/Database.php
+++ b/includes/database/Database.php
@@ -1,6 +1,6 @@
error_supress = !(defined('WeBidDebug') && WeBidDebug);
- }
+ // database
+ protected $conn;
+ protected $DBPrefix;
+ protected $CHARSET;
+ protected $lastquery;
+ protected $fetchquery;
+ protected $error;
+ protected $error_supress = false;
+ protected $fetch_methods = [];
- abstract public function connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix, $CHARSET = 'UTF-8');
- abstract public function error_supress($state = true);
- abstract public function direct_query($query);
- abstract public function query($query, $params = array());
- abstract public function fetch($result = null, $method = 'FETCH_ASSOC');
- abstract public function fetchall($result = null, $method = 'FETCH_ASSOC');
- abstract public function result($column = null, $result = null, $method = 'FETCH_ASSOC');
- abstract public function numrows($result = null);
- abstract public function lastInsertId();
- abstract protected function clean_params($query, $params);
- abstract protected function find_key($params, $val);
- abstract protected function build_params($params);
- abstract protected function error_handler($error);
+ abstract public function connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix, $CHARSET = 'UTF-8');
+ abstract public function error_supress($state = true);
+ abstract public function direct_query($query);
+ abstract public function query($query, $params = array());
+ abstract public function fetch($result = NULL, $method = 'FETCH_ASSOC');
+ abstract public function fetchall($result = NULL, $method = 'FETCH_ASSOC');
+ abstract public function result($column = NULL, $result = NULL, $method = 'FETCH_ASSOC');
+ abstract public function numrows($result = NULL);
+ abstract public function lastInsertId();
+ abstract protected function clean_params($query, $params);
+ abstract protected function find_key($params, $val);
+ abstract protected function build_params($params);
+ abstract protected function error_handler($error);
}
+
diff --git a/includes/database/DatabasePDO.php b/includes/database/DatabasePDO.php
old mode 100644
new mode 100755
index 8b2e04373..b29e4328f
--- a/includes/database/DatabasePDO.php
+++ b/includes/database/DatabasePDO.php
@@ -1,6 +1,6 @@
PDO::FETCH_ASSOC,
- 'FETCH_BOTH' => PDO::FETCH_BOTH,
- 'FETCH_NUM' => PDO::FETCH_NUM,
- ];
-
- public function connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix, $CHARSET = 'UTF-8')
- {
- $this->DBPrefix = $DBPrefix;
- $this->CHARSET = $CHARSET;
- try {
- // MySQL with PDO_MYSQL
- $this->conn = new PDO("mysql:host=$DbHost;dbname=$DbDatabase;charset =$CHARSET", $DbUser, $DbPassword);
- // set error reporting up
- $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- // actually use prepared statements
- $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- return true;
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- return false;
- }
- }
-
- public function error_supress($state = true)
- {
- $this->error_supress = $state;
- }
-
- // to run a direct query
- public function direct_query($query)
- {
- try {
- $this->lastquery = $this->conn->query($query);
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- }
- }
-
- // put together the query ready for running
- /*
- $query must be given like SELECT * FROM table WHERE this = :that AND where = :here
- then $params would holds the values for :that and :here, $table would hold the vlue for :table
- $params = array(
- array(':that', 'that value', PDO::PARAM_STR),
- array(':here', 'here value', PDO::PARAM_INT),
- );
- last value can be left blank more info http://php.net/manual/en/pdostatement.bindparam.php
- */
- public function query($query, $params = array())
- {
- try {
- //$query = $this->build_query($query, $table);
- $params = $this->build_params($params);
- $params = $this->clean_params($query, $params);
- $this->lastquery = $this->conn->prepare($query);
- //$this->lastquery->bindParam(':table', $this->DBPrefix . $table, PDO::PARAM_STR); // must always be set
- foreach ($params as $val) {
- $this->lastquery->bindParam($val[0], $val[1], $val[2]);
- }
- $this->lastquery->execute();
- //$this->lastquery->debugDumpParams();
- } catch (PDOException $e) {
- //$this->lastquery->debugDumpParams();
- $this->error_handler($e->getMessage());
- }
-
- //$this->lastquery->rowCount(); // rows affected
- }
-
- // put together the query ready for running
- public function fetch($result = null, $method = 'FETCH_ASSOC')
- {
- try {
- // set fetchquery
- if ($this->fetchquery == null) {
- $this->fetchquery = $this->lastquery;
- }
- if ($result == null) {
- $result = $this->fetchquery;
- }
- $data = $result->fetch($this->fetch_methods[$method]);
- // clear fetch query
- if ($data == false) {
- $this->fetchquery = null;
- }
- return $data;
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- }
- return null;
- }
-
- // put together the query ready for running + get all results
- public function fetchall($result = null, $method = 'FETCH_ASSOC')
- {
- try {
- if ($result == null) {
- $result = $this->lastquery;
- }
- // set fetchquery
- return $result->fetchAll($this->fetch_methods[$method]);
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- }
- }
-
- public function result($column = null, $result = null, $method = 'FETCH_ASSOC')
- {
- if ($result == null) {
- $result = $this->lastquery;
- }
- $data = $result->fetch($this->fetch_methods[$method]);
- if (empty($column) || $column == null) {
- return $data;
- } else {
- if (isset($data[$column])) {
- return $data[$column];
- } else {
- return false;
- }
- }
- }
-
- public function numrows($result = null)
- {
- try {
- if ($result == null) {
- $result = $this->lastquery;
- }
- return $result->rowCount();
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- }
- }
-
- public function lastInsertId()
- {
- try {
- return $this->conn->lastInsertId();
- } catch (PDOException $e) {
- $this->error_handler($e->getMessage());
- }
- }
-
- protected function clean_params($query, $params)
- {
- // find the vars set in the query
- preg_match_all("(:[a-zA-Z0-9_]+)", $query, $set_params);
- $new_params = array();
- foreach ($set_params[0] as $val) {
- $key = $this->find_key($params, $val);
- if (isset($key)) {
- $new_params[] = $params[$key];
- }
- }
- return $new_params;
- }
-
- protected function find_key($params, $val)
- {
- foreach ($params as $k => $v) {
- if ($v[0] == $val) {
- return $k;
- }
- }
- }
-
- protected function build_params($params)
- {
- $PDO_constants = array(
- 'int' => PDO::PARAM_INT,
- 'str' => PDO::PARAM_STR,
- //'bool' => PDO::PARAM_BOOL, doesn't work, php bug
- 'bool' => PDO::PARAM_INT,
- 'float' => PDO::PARAM_STR
- );
- // set PDO values to params
- for ($i = 0; $i < count($params); $i++) {
- // force float
- if ($params[$i][2] == 'float') {
- $params[$i][1] = floatval($params[$i][1]);
- }
- // to fix php bug
- if ($params[$i][2] == 'bool' && $params[$i][1] > 1) {
- $params[$i][1] = 1;
- }
- $params[$i][2] = $PDO_constants[$params[$i][2]];
- }
- return $params;
- }
-
- protected function error_handler($error)
- {
- trigger_error($error, E_USER_WARNING);
- if (!$this->error_supress) {
- debug_print_backtrace();
- }
- }
-
- // close everything down
- public function __destruct()
- {
- // close database connection
- $this->conn = null;
- }
+ protected $fetch_methods = [
+ 'FETCH_ASSOC' => PDO::FETCH_ASSOC,
+ 'FETCH_BOTH' => PDO::FETCH_BOTH,
+ 'FETCH_NUM' => PDO::FETCH_NUM,
+ ];
+
+ public function connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix, $CHARSET = 'UTF-8')
+ {
+ $this->DBPrefix = $DBPrefix;
+ $this->CHARSET = $CHARSET;
+ try {
+ // MySQL with PDO_MYSQL
+ $this->conn = new PDO("mysql:host=$DbHost;dbname=$DbDatabase;charset =$CHARSET", $DbUser, $DbPassword);
+ // set error reporting up
+ $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ // actually use prepared statements
+ $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ return true;
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ return false;
+ }
+ }
+
+ public function error_supress($state = true)
+ {
+ $this->error_supress = $state;
+ }
+
+ // to run a direct query
+ public function direct_query($query)
+ {
+ try {
+ $this->lastquery = $this->conn->query($query);
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ }
+ }
+
+ // put together the quert ready for running
+ /*
+ $query must be given like SELECT * FROM table WHERE this = :that AND where = :here
+ then $params would holds the values for :that and :here, $table would hold the vlue for :table
+ $params = array(
+ array(':that', 'that value', PDO::PARAM_STR),
+ array(':here', 'here value', PDO::PARAM_INT),
+ );
+ last value can be left blank more info http://php.net/manual/en/pdostatement.bindparam.php
+ */
+ public function query($query, $params = array())
+ {
+ try {
+ //$query = $this->build_query($query, $table);
+ $params = $this->build_params($params);
+ $params = $this->clean_params($query, $params);
+ $this->lastquery = $this->conn->prepare($query);
+ //$this->lastquery->bindParam(':table', $this->DBPrefix . $table, PDO::PARAM_STR); // must always be set
+ foreach ($params as $val)
+ {
+ $this->lastquery->bindParam($val[0], $val[1], $val[2]);
+ }
+ $this->lastquery->execute();
+ //$this->lastquery->debugDumpParams();
+ }
+ catch(PDOException $e) {
+ //$this->lastquery->debugDumpParams();
+ $this->error_handler($e->getMessage());
+ }
+
+ //$this->lastquery->rowCount(); // rows affected
+ }
+
+ // put together the quert ready for running
+ public function fetch($result = NULL, $method = 'FETCH_ASSOC')
+ {
+ try {
+ // set fetchquery
+ if ($this->fetchquery == NULL)
+ {
+ $this->fetchquery = $this->lastquery;
+ }
+ if ($result == NULL)
+ {
+ $result = $this->fetchquery;
+ }
+ $data = $result->fetch($this->fetch_methods[$method]);
+ // clear fetch query
+ if ($data == false)
+ {
+ $this->fetchquery = NULL;
+ }
+ return $data;
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ }
+ }
+
+ // put together the quert ready for running + get all results
+ public function fetchall($result = NULL, $method = 'FETCH_ASSOC')
+ {
+ try {
+ if ($result == NULL)
+ {
+ $result = $this->lastquery;
+ }
+ // set fetchquery
+ return $result->fetchAll($this->fetch_methods[$method]);
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ }
+ }
+
+ public function result($column = NULL, $result = NULL, $method = 'FETCH_ASSOC')
+ {
+ if ($result == NULL)
+ {
+ $result = $this->lastquery;
+ }
+ $data = $result->fetch($this->fetch_methods[$method]);
+ if (empty($column) || $column == NULL)
+ {
+ return $data;
+ }
+ else
+ {
+ return $data[$column];
+ }
+ }
+
+ public function numrows($result = NULL)
+ {
+ try {
+ if ($result == NULL)
+ {
+ $result = $this->lastquery;
+ }
+ return $result->rowCount();
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ }
+ }
+
+ public function lastInsertId()
+ {
+ try {
+ return $this->conn->lastInsertId();
+ }
+ catch(PDOException $e) {
+ $this->error_handler($e->getMessage());
+ }
+ }
+
+ protected function clean_params($query, $params)
+ {
+ // find the vars set in the query
+ preg_match_all("(:[a-zA-Z0-9_]+)", $query, $set_params);
+ $new_params = array();
+ foreach ($set_params[0] as $val)
+ {
+ $key = $this->find_key($params, $val);
+ if (isset($key))
+ $new_params[] = $params[$key];
+ }
+ return $new_params;
+ }
+
+ protected function find_key($params, $val)
+ {
+ foreach ($params as $k => $v)
+ {
+ if ($v[0] == $val)
+ return $k;
+ }
+ }
+
+ protected function build_params($params)
+ {
+ $PDO_constants = array(
+ 'int' => PDO::PARAM_INT,
+ 'str' => PDO::PARAM_STR,
+ //'bool' => PDO::PARAM_BOOL, doesn't work, php bug
+ 'bool' => PDO::PARAM_INT,
+ 'float' => PDO::PARAM_STR
+ );
+ // set PDO values to params
+ for ($i = 0; $i < count($params); $i++)
+ {
+ // force float
+ if ($params[$i][2] == 'float')
+ {
+ $params[$i][1] = floatval($params[$i][1]);
+ }
+ // to fix php bug
+ if ($params[$i][2] == 'bool' && $params[$i][1] > 1)
+ {
+ $params[$i][1] = 1;
+ }
+ $params[$i][2] = $PDO_constants[$params[$i][2]];
+ }
+ return $params;
+ }
+
+ protected function error_handler($error)
+ {
+ if (!$this->error_supress)
+ {
+ // TODO: DO SOMETHING
+ $this->error = debug_backtrace();
+ //print_r($this->error);
+ }
+ }
+
+ // close everything down
+ public function __destruct()
+ {
+ // close database connection
+ $this->conn = null;
+ }
}
+
diff --git a/includes/datacheck.inc.php b/includes/datacheck.inc.php
old mode 100644
new mode 100755
index 7fd1a2ab9..a6301ff67
--- a/includes/datacheck.inc.php
+++ b/includes/datacheck.inc.php
@@ -1,6 +1,6 @@
query($query, $params);
- if ($db->numrows() == 0) {
- return '009';
- }
- return '000';
+ /*
+ Checks the first data posted by the user
+ in the registration process
+
+ Return codes: 000 = data ok!
+ 002 = name missing
+ 003 = nick missing
+ 004 = password missing
+ 005 = second password missing
+ 006 = passwords do not match
+ 007 = email address missing
+ 008 = email address not valid
+ 009 = nick already exists
+ 010 = nick too short
+ 011 = password too short
+ */
+ global $name, $nick, $password, $repeat_password, $email, $db;
+ if (!isset($name) || empty($name))
+ {
+ return '002';
+ }
+ if (!isset($nick) || empty($nick))
+ {
+ return '003';
+ }
+ if (!isset($password) || empty($password))
+ {
+ return '004';
+ }
+ if (!isset($repeat_password) || empty($repeat_password))
+ {
+ return '005';
+ }
+ if ($password != $repeat_password)
+ {
+ return '006';
+ }
+ if (!isset($email) || empty($email))
+ {
+ return '007';
+ }
+ if (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i', $email))
+ {
+ return '008';
+ }
+ if (strlen($nick) < 6)
+ {
+ return '010';
+ }
+ if (strlen($password) < 6)
+ {
+ return '011';
+ }
+ $query = "SELECT nick FROM " . $DBPrefix . "users WHERE nick = :user_nick";
+ $params = array();
+ $params[] = array(':user_nick', $nick, 'str');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ return '009';
+ }
+ return '000';
} //CheckFirstRegData()
function CheckSellData()
{
- /*
- return codes:
- 017 = item title missing
- 018 = item description missing
- 019 = minimum bid missing
- 020 = minimum bid not valid
- 021 = reserve price missing
- 022 = reserve price not valid
- 023 = category missing
- 024 = payment method missing
- 025 = payment method missing
- 060 = start time has already happened
- 061 = buy now price inserted is not correct
- 062 = may not set a reserve price in a Dutch Auction
- 063 = may not use custom increments in a Dutch Auction
- 064 = may not use the Buy Now feature in a Dutch Auction
- 600 = wrong auction type
- 601 = wrong quantity of items
- */
-
- global $title, $sdescription, $minimum_bid, $with_reserve, $reserve_price, $buy_now, $buy_now_only, $buy_now_price, $payment, $category;
- global $atype, $iquantity, $increments, $customincrement, $system, $_SESSION, $dt;
- global $payments, $num, $nnum, $a_starts, $a_ends, $start_now, $custom_end, $relist;
- global $additional_shipping_cost, $shipping_cost;
-
- if (empty($title)) {
- return '017';
- }
-
- if (empty($sdescription)) {
- return '018';
- }
-
- if (!$system->CheckMoney($minimum_bid) && $buy_now_only == 0) {
- return '058';
- }
-
- // format the info correctly
- $clean_minimum_bid = $system->input_money($minimum_bid);
- $clean_reserve_price = $system->input_money($reserve_price);
- $clean_buy_now_price = $system->input_money($buy_now_price);
- if ((empty($minimum_bid) || floatval($clean_minimum_bid) <= 0) && (!$buy_now_only)) {
- return '019';
- }
-
- if (empty($reserve_price) && $with_reserve == 'yes' && $buy_now_only == 0) {
- return '021';
- }
-
- if ($increments == 2 && (empty($customincrement) || floatval($system->input_money($customincrement)) == 0)) {
- return '056';
- }
-
- if (!(empty($customincrement) || floatval($system->input_money($customincrement)) == 0) && !$system->CheckMoney($customincrement)) {
- return '057';
- }
-
- if ($with_reserve == 'yes' && !$system->CheckMoney($reserve_price)) {
- return '022';
- }
-
- if ($buy_now_only == 1) {
- $buy_now = 'yes';
- }
-
- if ($buy_now == 'yes' && (!$system->CheckMoney($buy_now_price) || empty($buy_now_price) || floatval($clean_buy_now_price) == 0)) {
- return '061';
- }
-
- if (isset($shipping_cost) && !$system->CheckMoney($shipping_cost)) {
- return '079';
- }
-
- if (isset($additional_shipping_cost) && !$system->CheckMoney($additional_shipping_cost)) {
- return '080';
- }
-
- $numpay = count($payment);
- if ($numpay == 0) {
- return '024';
- } else {
- $payment_ok = 1;
- }
-
- if (!isset($system->SETTINGS['auction_types'][intval($atype)])) {
- return '600';
- }
-
- if (intval($iquantity) < 1) {
- return '601';
- }
-
- if ($atype == 2) {
- if ($with_reserve == 'yes') {
- $with_reserve = 'no';
- $reserve_price = '';
- return '062';
- }
- if ($increments == 2) {
- $increments = 1;
- $customincrement = '';
- return '063';
- }
- if ($buy_now == 'yes') {
- $buy_now = 'no';
- $buy_now_price = '';
- return '064';
- }
- }
-
- if ($with_reserve == 'yes' && $clean_reserve_price <= $clean_minimum_bid) {
- return '5045';
- }
-
- if ($buy_now == 'yes' && $buy_now_only == 0) {
- if (($with_reserve == 'yes' && $clean_buy_now_price <= $clean_reserve_price) || $clean_buy_now_price <= $clean_minimum_bid) {
- return '5046';
- }
- }
-
- if ($system->SETTINGS['autorelist'] == 'y') {
- if (!empty($relist) && !is_numeric($relist)) {
- return '714';
- } elseif ($relist > $system->SETTINGS['autorelist_max'] && !empty($relist)) {
- return '715';
- }
- }
-
- if ($start_now == 0 && $_SESSION['SELL_action'] != 'edit') {
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $start_time = new DateTime($a_starts, $dt->UTCtimezone);
- $difference = $current_time->diff($start_time);
-
- if ($difference->invert == 1) {
- return '060';
- }
- }
-
- if ($custom_end == 1) {
- $start_time = new DateTime($a_starts, $dt->UTCtimezone);
- $end_time = new DateTime($a_ends, $dt->UTCtimezone);
- $difference = $start_time->diff($end_time);
- if ($difference->invert == 1) {
- return '082';
- }
- }
- return '';
+ /*
+ return codes:
+ 017 = item title missing
+ 018 = item description missing
+ 019 = minimum bid missing
+ 020 = minimum bid not valid
+ 021 = reserve price missing
+ 022 = reserve price not valid
+ 023 = category missing
+ 024 = payment method missing
+ 025 = payment method missing
+ 060 = start time has already happened
+ 061 = buy now price inserted is not correct
+ 062 = may not set a reserve price in a Dutch Auction
+ 063 = may not use custom increments in a Dutch Auction
+ 064 = may not use the Buy Now feature in a Dutch Auction
+ 600 = wrong auction type
+ 601 = wrong quantity of items
+ */
+
+ global $title, $sdescription, $minimum_bid, $with_reserve, $reserve_price, $buy_now, $buy_now_only, $buy_now_price, $payment, $category;
+ global $atype, $iquantity, $increments, $customincrement, $system, $_SESSION;
+ global $payments, $num, $nnum, $a_starts, $a_ends, $start_now, $custom_end, $relist;
+ global $additional_shipping_cost, $shipping_cost;
+
+ if (empty($title))
+ {
+ return '017';
+ }
+
+ if (empty($sdescription))
+ {
+ return '018';
+ }
+
+ if (!$system->CheckMoney($minimum_bid) && $buy_now_only == 0)
+ {
+ return '058';
+ }
+
+ // format the info correctly
+ $clean_minimum_bid = $system->input_money($minimum_bid);
+ $clean_reserve_price = $system->input_money($reserve_price);
+ $clean_buy_now_price = $system->input_money($buy_now_price);
+ if ((empty($minimum_bid) || floatval($clean_minimum_bid) <= 0) && (!$buy_now_only))
+ {
+ return '019';
+ }
+
+ if (empty($reserve_price) && $with_reserve == 'yes' && $buy_now_only == 0)
+ {
+ return '021';
+ }
+
+ if ($increments == 2 && (empty($customincrement) || floatval($system->input_money($customincrement)) == 0))
+ {
+ return '056';
+ }
+
+ if (!(empty($customincrement) || floatval($system->input_money($customincrement)) == 0) && !$system->CheckMoney($customincrement))
+ {
+ return '057';
+ }
+
+ if ($with_reserve == 'yes' && !$system->CheckMoney($reserve_price))
+ {
+ return '022';
+ }
+
+ if ($buy_now_only == 1)
+ {
+ $buy_now = 'yes';
+ }
+
+ if ($buy_now == 'yes' && (!$system->CheckMoney($buy_now_price) || empty($buy_now_price) || floatval($clean_buy_now_price) == 0))
+ {
+ return '061';
+ }
+ if (isset($shipping_cost) && !$system->CheckMoney($shipping_cost)) {
+
+ return '079';
+
+ }
+ if (isset($additional_shipping_cost) && !$system->CheckMoney($additional_shipping_cost)) {
+
+
+ return '080';
+
+ }
+
+ $numpay = count($payment);
+ if ($numpay == 0)
+ {
+ return '024';
+ }
+ else
+ {
+ $payment_ok = 1;
+ }
+
+ if (!isset($system->SETTINGS['auction_types'][intval($atype)]))
+ {
+ return '600';
+ }
+
+ if (intval($iquantity) < 1)
+ {
+ return '601';
+ }
+
+ if ($atype == 2)
+ {
+ if ($with_reserve == 'yes')
+ {
+ $with_reserve = 'no';
+ $reserve_price = '';
+ return '062';
+ }
+ if ($increments == 2)
+ {
+ $increments = 1;
+ $customincrement = '';
+ return '063';
+ }
+ if ($buy_now == 'yes')
+ {
+ $buy_now = 'no';
+ $buy_now_price = '';
+ return '064';
+ }
+ }
+
+ if ($with_reserve == 'yes' && $clean_reserve_price <= $clean_minimum_bid)
+ {
+ return '5045';
+ }
+
+ if ($buy_now == 'yes' && $buy_now_only == 0)
+ {
+ if (($with_reserve == 'yes' && $clean_buy_now_price <= $clean_reserve_price) || $clean_buy_now_price <= $clean_minimum_bid)
+ {
+ return '5046';
+ }
+ }
+
+ if ($system->SETTINGS['autorelist'] == 'y')
+ {
+ if (!empty($relist) && !is_numeric($relist))
+ {
+ return '714';
+ }
+ elseif ($relist > $system->SETTINGS['autorelist_max'] && !empty($relist))
+ {
+ return '715';
+ }
+ }
+
+ if (!(strpos($a_starts, '-') === false) && empty($start_now) && $_SESSION['SELL_action'] != 'edit')
+ {
+ $a_starts = _mktime(substr($a_starts, 11, 2),
+ substr($a_starts, 14, 2),
+ substr($a_starts, 17, 2),
+ substr($a_starts, 0, 2),
+ substr($a_starts, 3, 2),
+ substr($a_starts, 6, 4));
+
+ if ($a_starts < $system->ctime)
+ {
+ return '060';
+ }
+ }
+
+ if (!(strpos($a_ends, '-') === false) && $custom_end == 1)
+ {
+ $a_ends = _mktime(substr($a_ends, 11, 2),
+ substr($a_ends, 14, 2),
+ substr($a_ends, 17, 2),
+ substr($a_ends, 0, 2),
+ substr($a_ends, 3, 2),
+ substr($a_ends, 6, 4));
+ if ($a_ends < $a_starts)
+ {
+ return '082';
+ }
+ }
}//--CheckSellData
function CheckBidData()
{
- global $bid, $next_bid, $atype, $qty, $Data, $bidder_id, $system;
-
- if ($Data['suspended'] > 0) {
- return '619';
- }
-
- if ($bidder_id == $Data['user']) {
- return '612';
- }
-
- if ($atype == 1) { //normal auction
- // have to use bccomp to check if bid is less than next_bid
- if (bccomp($bid, $next_bid, $system->SETTINGS['moneydecimals']) == -1) {
- return '607';
- }
- if ($qty > $Data['quantity']) {
- return '608';
- }
- } else { //dutch auction
- // cannot bid below min price
- if (bccomp($bid, $Data['minimum_bid'], $system->SETTINGS['moneydecimals']) == -1) {
- return '607';
- }
- if (($qty == 0) || ($qty > $Data['quantity'])) {
- return '608';
- }
- }
-
- return 0;
+ global $bid, $next_bid, $atype, $qty, $Data, $bidder_id, $system;
+
+ if ($Data['suspended'] > 0)
+ {
+ return '619';
+ }
+
+ if ($bidder_id == $Data['user'])
+ {
+ return '612';
+ }
+
+ if ($atype == 1) //normal auction
+ {
+ // have to use bccomp to check if bid is less than next_bid
+ if (bccomp($bid, $next_bid, $system->SETTINGS['moneydecimals']) == -1)
+ {
+ return '607';
+ }
+ if ($qty > $Data['quantity'])
+ {
+ return '608';
+ }
+ }
+ else //dutch auction
+ {
+ // cannot bid below min price
+ if (bccomp($bid, $Data['minimum_bid'], $system->SETTINGS['moneydecimals']) == -1)
+ {
+ return '607';
+ }
+ if (($qty == 0) || ($qty > $Data['quantity']))
+ {
+ return '608';
+ }
+ }
+
+ return 0;
}
diff --git a/includes/dates.inc.php b/includes/dates.inc.php
new file mode 100755
index 000000000..847d32643
--- /dev/null
+++ b/includes/dates.inc.php
@@ -0,0 +1,146 @@
+tdiff;
+ }
+
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $F_date = date('m' . $spacer . 'd' . $spacer . 'Y', $DATE);
+ }
+ else
+ {
+ $F_date = date('d' . $spacer . 'm' . $spacer . 'Y', $DATE);
+ }
+ return $F_date;
+}
+
+function FormatTimeStamp($DATE, $spacer = '-')
+{
+ global $system;
+
+ $DATE = explode($spacer, $DATE);
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $F_date = mktime(0, 0, 0, $DATE[0], $DATE[1], $DATE[2]);
+ }
+ else
+ {
+ $F_date = mktime(0, 0, 0, $DATE[1], $DATE[0], $DATE[2]);
+ }
+ //echo ArrangeDateNoCorrection($F_date) .' '; // enable to view finalized date
+ return $F_date;
+}
+
+function FormatTimeLeft($diff)
+{
+ global $MSG;
+
+ $days_difference = floor($diff / 86400);
+ $difference = $diff % 86400;
+ $hours_difference = floor($difference / 3600);
+ $difference = $difference % 3600;
+ $minutes_difference = floor($difference / 60);
+ $seconds_difference = $difference % 60;
+ $secshow = false;
+ $timeleft = '';
+
+ if ($days_difference > 0)
+ {
+ $timeleft = $days_difference . 'd ';
+ }
+ if ($hours_difference > 0)
+ {
+ $timeleft .= $hours_difference . 'h ';
+ }
+ else
+ {
+ $secshow = true;
+ }
+ if ($diff > 60)
+ {
+ $timeleft .= $minutes_difference . 'm ';
+ }
+ elseif ($diff > 60 && !$seconds)
+ {
+ $timeleft = '<1m';
+ }
+ if ($secshow)
+ {
+ $timeleft .= $seconds_difference . 's ';
+ }
+ if ($diff < 0)
+ {
+ $timeleft = $MSG['911'];
+ }
+ if (($diff * 60) < 15)
+ {
+ $timeleft = '' . $timeleft . ' ';
+ }
+
+ return $timeleft;
+}
+
+//-- Date and time hanling functions
+function ActualDate()
+{
+ global $system;
+ return date('M d, Y H:i:s', $system->ctime);
+}
+
+function ArrangeDateNoCorrection($DATE)
+{
+ global $MSG, $system;
+ $mth = 'MON_0' . date('m', $DATE);
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ $return = $MSG[$mth] . ' ' . date('d, Y - H:i', $DATE);
+ }
+ else
+ {
+ $return = date('d', $DATE) . ' ' . $MSG[$mth] . ', ' . date('Y - H:i', $DATE);
+ }
+ return $return;
+}
+
diff --git a/includes/diff/diff.php b/includes/diff/diff.php
new file mode 100755
index 000000000..c3f7d579e
--- /dev/null
+++ b/includes/diff/diff.php
@@ -0,0 +1,816 @@
+
+* Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+*
+* @package diff
+* @author Geoffrey T. Dairiki
+*/
+class diff
+{
+ /**
+ * Array of changes.
+ * @var array
+ */
+ var $_edits;
+
+ /**
+ * Computes diffs between sequences of strings.
+ *
+ * @param array $from_lines An array of strings. Typically these are lines from a file.
+ * @param array $to_lines An array of strings.
+ */
+ function diff(&$from_content, &$to_content, $preserve_cr = true)
+ {
+ $diff_engine = new diff_engine();
+ $this->_edits = $diff_engine->diff($from_content, $to_content, $preserve_cr);
+ }
+
+ /**
+ * Returns the array of differences.
+ */
+ function get_diff()
+ {
+ return $this->_edits;
+ }
+
+ /**
+ * returns the number of new (added) lines in a given diff.
+ *
+ * @since Text_Diff 1.1.0
+ *
+ * @return integer The number of new lines
+ */
+ function count_added_lines()
+ {
+ $count = 0;
+
+ foreach ($this->_edits as $edit)
+ {
+ if (is_a($edit, 'diff_op_add') || is_a($edit, 'diff_op_change'))
+ {
+ $count += $edit->nfinal();
+ }
+ }
+ return $count;
+ }
+
+ /**
+ * Returns the number of deleted (removed) lines in a given diff.
+ *
+ * @since Text_Diff 1.1.0
+ *
+ * @return integer The number of deleted lines
+ */
+ function count_deleted_lines()
+ {
+ $count = 0;
+
+ foreach ($this->_edits as $edit)
+ {
+ if (is_a($edit, 'diff_op_delete') || is_a($edit, 'diff_op_change'))
+ {
+ $count += $edit->norig();
+ }
+ }
+ return $count;
+ }
+
+ /**
+ * Computes a reversed diff.
+ *
+ * Example:
+ *
+ * $diff = new diff($lines1, $lines2);
+ * $rev = $diff->reverse();
+ *
+ *
+ * @return diff A Diff object representing the inverse of the original diff.
+ * Note that we purposely don't return a reference here, since
+ * this essentially is a clone() method.
+ */
+ function reverse()
+ {
+ if (version_compare(zend_version(), '2', '>'))
+ {
+ $rev = clone($this);
+ }
+ else
+ {
+ $rev = $this;
+ }
+
+ $rev->_edits = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ $rev->_edits[] = $edit->reverse();
+ }
+
+ return $rev;
+ }
+
+ /**
+ * Checks for an empty diff.
+ *
+ * @return boolean True if two sequences were identical.
+ */
+ function is_empty()
+ {
+ foreach ($this->_edits as $edit)
+ {
+ if (!is_a($edit, 'diff_op_copy'))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Computes the length of the Longest Common Subsequence (LCS).
+ *
+ * This is mostly for diagnostic purposes.
+ *
+ * @return integer The length of the LCS.
+ */
+ function lcs()
+ {
+ $lcs = 0;
+
+ foreach ($this->_edits as $edit)
+ {
+ if (is_a($edit, 'diff_op_copy'))
+ {
+ $lcs += sizeof($edit->orig);
+ }
+ }
+ return $lcs;
+ }
+
+ /**
+ * Gets the original set of lines.
+ *
+ * This reconstructs the $from_lines parameter passed to the constructor.
+ *
+ * @return array The original sequence of strings.
+ */
+ function get_original()
+ {
+ $lines = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->orig)
+ {
+ array_splice($lines, sizeof($lines), 0, $edit->orig);
+ }
+ }
+ return $lines;
+ }
+
+ /**
+ * Gets the final set of lines.
+ *
+ * This reconstructs the $to_lines parameter passed to the constructor.
+ *
+ * @return array The sequence of strings.
+ */
+ function get_final()
+ {
+ $lines = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->final)
+ {
+ array_splice($lines, sizeof($lines), 0, $edit->final);
+ }
+ }
+ return $lines;
+ }
+
+ /**
+ * Removes trailing newlines from a line of text. This is meant to be used with array_walk().
+ *
+ * @param string &$line The line to trim.
+ * @param integer $key The index of the line in the array. Not used.
+ */
+ function trim_newlines(&$line, $key)
+ {
+ $line = str_replace(array("\n", "\r"), '', $line);
+ }
+
+ /**
+ * Checks a diff for validity.
+ *
+ * This is here only for debugging purposes.
+ */
+ function _check($from_lines, $to_lines)
+ {
+ if (serialize($from_lines) != serialize($this->get_original()))
+ {
+ trigger_error("[diff] Reconstructed original doesn't match", E_USER_ERROR);
+ }
+
+ if (serialize($to_lines) != serialize($this->get_final()))
+ {
+ trigger_error("[diff] Reconstructed final doesn't match", E_USER_ERROR);
+ }
+
+ $rev = $this->reverse();
+
+ if (serialize($to_lines) != serialize($rev->get_original()))
+ {
+ trigger_error("[diff] Reversed original doesn't match", E_USER_ERROR);
+ }
+
+ if (serialize($from_lines) != serialize($rev->get_final()))
+ {
+ trigger_error("[diff] Reversed final doesn't match", E_USER_ERROR);
+ }
+
+ $prevtype = null;
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($prevtype == get_class($edit))
+ {
+ trigger_error("[diff] Edit sequence is non-optimal", E_USER_ERROR);
+ }
+ $prevtype = get_class($edit);
+ }
+
+ return true;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*/
+class mapped_diff extends diff
+{
+ /**
+ * Computes a diff between sequences of strings.
+ *
+ * This can be used to compute things like case-insensitve diffs, or diffs
+ * which ignore changes in white-space.
+ *
+ * @param array $from_lines An array of strings.
+ * @param array $to_lines An array of strings.
+ * @param array $mapped_from_lines This array should have the same size number of elements as $from_lines.
+ * The elements in $mapped_from_lines and $mapped_to_lines are what is actually
+ * compared when computing the diff.
+ * @param array $mapped_to_lines This array should have the same number of elements as $to_lines.
+ */
+ function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)
+ {
+ if (sizeof($from_lines) != sizeof($mapped_from_lines) || sizeof($to_lines) != sizeof($mapped_to_lines))
+ {
+ return false;
+ }
+
+ parent::diff($mapped_from_lines, $mapped_to_lines);
+
+ $xi = $yi = 0;
+ for ($i = 0; $i < sizeof($this->_edits); $i++)
+ {
+ $orig = &$this->_edits[$i]->orig;
+ if (is_array($orig))
+ {
+ $orig = array_slice($from_lines, $xi, sizeof($orig));
+ $xi += sizeof($orig);
+ }
+
+ $final = &$this->_edits[$i]->final;
+ if (is_array($final))
+ {
+ $final = array_slice($to_lines, $yi, sizeof($final));
+ $yi += sizeof($final);
+ }
+ }
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff_op
+{
+ var $orig;
+ var $final;
+
+ function &reverse()
+ {
+ trigger_error('[diff] Abstract method', E_USER_ERROR);
+ }
+
+ function norig()
+ {
+ return ($this->orig) ? sizeof($this->orig) : 0;
+ }
+
+ function nfinal()
+ {
+ return ($this->final) ? sizeof($this->final) : 0;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff_op_copy extends diff_op
+{
+ function diff_op_copy($orig, $final = false)
+ {
+ if (!is_array($final))
+ {
+ $final = $orig;
+ }
+ $this->orig = $orig;
+ $this->final = $final;
+ }
+
+ function &reverse()
+ {
+ $reverse = new diff_op_copy($this->final, $this->orig);
+ return $reverse;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff_op_delete extends diff_op
+{
+ function diff_op_delete($lines)
+ {
+ $this->orig = $lines;
+ $this->final = false;
+ }
+
+ function &reverse()
+ {
+ $reverse = new diff_op_add($this->orig);
+ return $reverse;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff_op_add extends diff_op
+{
+ function diff_op_add($lines)
+ {
+ $this->final = $lines;
+ $this->orig = false;
+ }
+
+ function &reverse()
+ {
+ $reverse = new diff_op_delete($this->final);
+ return $reverse;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff_op_change extends diff_op
+{
+ function diff_op_change($orig, $final)
+ {
+ $this->orig = $orig;
+ $this->final = $final;
+ }
+
+ function &reverse()
+ {
+ $reverse = new diff_op_change($this->final, $this->orig);
+ return $reverse;
+ }
+}
+
+
+/**
+* A class for computing three way diffs.
+*
+* @package diff
+* @author Geoffrey T. Dairiki
+*/
+class diff3 extends diff
+{
+ /**
+ * Conflict counter.
+ * @var integer
+ */
+ var $_conflicting_blocks = 0;
+
+ /**
+ * Computes diff between 3 sequences of strings.
+ *
+ * @param array $orig The original lines to use.
+ * @param array $final1 The first version to compare to.
+ * @param array $final2 The second version to compare to.
+ */
+ function diff3(&$orig, &$final1, &$final2)
+ {
+ $diff_engine = new diff_engine();
+
+ $diff_1 = $diff_engine->diff($orig, $final1);
+ $diff_2 = $diff_engine->diff($orig, $final2);
+
+ unset($engine);
+
+ $this->_edits = $this->_diff3($diff_1, $diff_2);
+ }
+
+ /**
+ * Return number of conflicts
+ */
+ function get_num_conflicts()
+ {
+ $conflicts = 0;
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->is_conflict())
+ {
+ $conflicts++;
+ }
+ }
+
+ return $conflicts;
+ }
+
+ /**
+ * Get conflicts content for download. This is generally a merged file, but preserving conflicts and adding explanations to it.
+ * A user could then go through this file, search for the conflicts and changes the code accordingly.
+ *
+ * @param string $label1 the cvs file version/label from the original set of lines
+ * @param string $label2 the cvs file version/label from the new set of lines
+ * @param string $label_sep the explanation between label1 and label2 - more of a helper for the user
+ *
+ * @return mixed the merged output
+ */
+ function get_conflicts_content($label1 = 'CURRENT_FILE', $label2 = 'NEW_FILE', $label_sep = 'DIFF_SEP_EXPLAIN')
+ {
+ global $user;
+
+ $label1 = (!empty($user->lang[$label1])) ? $user->lang[$label1] : $label1;
+ $label2 = (!empty($user->lang[$label2])) ? $user->lang[$label2] : $label2;
+ $label_sep = (!empty($user->lang[$label_sep])) ? $user->lang[$label_sep] : $label_sep;
+
+ $lines = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->is_conflict())
+ {
+ // Start conflict label
+ $label_start = array('<<<<<<< ' . $label1);
+ $label_mid = array('======= ' . $label_sep);
+ $label_end = array('>>>>>>> ' . $label2);
+
+ $lines = array_merge($lines, $label_start, $edit->final1, $label_mid, $edit->final2, $label_end);
+ $this->_conflicting_blocks++;
+ }
+ else
+ {
+ $lines = array_merge($lines, $edit->merged());
+ }
+ }
+
+ return $lines;
+ }
+
+ /**
+ * Return merged output (used by the renderer)
+ *
+ * @return mixed the merged output
+ */
+ function merged_output()
+ {
+ return $this->get_conflicts_content();
+ }
+
+ /**
+ * Merge the output and use the new file code for conflicts
+ */
+ function merged_new_output()
+ {
+ $lines = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->is_conflict())
+ {
+ $lines = array_merge($lines, $edit->final2);
+ }
+ else
+ {
+ $lines = array_merge($lines, $edit->merged());
+ }
+ }
+
+ return $lines;
+ }
+
+ /**
+ * Merge the output and use the original file code for conflicts
+ */
+ function merged_orig_output()
+ {
+ $lines = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->is_conflict())
+ {
+ $lines = array_merge($lines, $edit->final1);
+ }
+ else
+ {
+ $lines = array_merge($lines, $edit->merged());
+ }
+ }
+
+ return $lines;
+ }
+
+ /**
+ * Get conflicting block(s)
+ */
+ function get_conflicts()
+ {
+ $conflicts = array();
+
+ foreach ($this->_edits as $edit)
+ {
+ if ($edit->is_conflict())
+ {
+ $conflicts[] = array($edit->final1, $edit->final2);
+ }
+ }
+
+ return $conflicts;
+ }
+
+ /**
+ * @access private
+ */
+ function _diff3(&$edits1, &$edits2)
+ {
+ $edits = array();
+ $bb = new diff3_block_builder();
+
+ $e1 = current($edits1);
+ $e2 = current($edits2);
+
+ while ($e1 || $e2)
+ {
+ if ($e1 && $e2 && is_a($e1, 'diff_op_copy') && is_a($e2, 'diff_op_copy'))
+ {
+ // We have copy blocks from both diffs. This is the (only) time we want to emit a diff3 copy block.
+ // Flush current diff3 diff block, if any.
+ if ($edit = $bb->finish())
+ {
+ $edits[] = $edit;
+ }
+
+ $ncopy = min($e1->norig(), $e2->norig());
+ $edits[] = new diff3_op_copy(array_slice($e1->orig, 0, $ncopy));
+
+ if ($e1->norig() > $ncopy)
+ {
+ array_splice($e1->orig, 0, $ncopy);
+ array_splice($e1->final, 0, $ncopy);
+ }
+ else
+ {
+ $e1 = next($edits1);
+ }
+
+ if ($e2->norig() > $ncopy)
+ {
+ array_splice($e2->orig, 0, $ncopy);
+ array_splice($e2->final, 0, $ncopy);
+ }
+ else
+ {
+ $e2 = next($edits2);
+ }
+ }
+ else
+ {
+ if ($e1 && $e2)
+ {
+ if ($e1->orig && $e2->orig)
+ {
+ $norig = min($e1->norig(), $e2->norig());
+ $orig = array_splice($e1->orig, 0, $norig);
+ array_splice($e2->orig, 0, $norig);
+ $bb->input($orig);
+ }
+ else
+ {
+ $norig = 0;
+ }
+
+ if (is_a($e1, 'diff_op_copy'))
+ {
+ $bb->out1(array_splice($e1->final, 0, $norig));
+ }
+
+ if (is_a($e2, 'diff_op_copy'))
+ {
+ $bb->out2(array_splice($e2->final, 0, $norig));
+ }
+ }
+
+ if ($e1 && ! $e1->orig)
+ {
+ $bb->out1($e1->final);
+ $e1 = next($edits1);
+ }
+
+ if ($e2 && ! $e2->orig)
+ {
+ $bb->out2($e2->final);
+ $e2 = next($edits2);
+ }
+ }
+ }
+
+ if ($edit = $bb->finish())
+ {
+ $edits[] = $edit;
+ }
+
+ return $edits;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff3_op
+{
+ function diff3_op($orig = false, $final1 = false, $final2 = false)
+ {
+ $this->orig = $orig ? $orig : array();
+ $this->final1 = $final1 ? $final1 : array();
+ $this->final2 = $final2 ? $final2 : array();
+ }
+
+ function merged()
+ {
+ if (!isset($this->_merged))
+ {
+ if ($this->final1 === $this->final2)
+ {
+ $this->_merged = &$this->final1;
+ }
+ else if ($this->final1 === $this->orig)
+ {
+ $this->_merged = &$this->final2;
+ }
+ else if ($this->final2 === $this->orig)
+ {
+ $this->_merged = &$this->final1;
+ }
+ else
+ {
+ $this->_merged = false;
+ }
+ }
+
+ return $this->_merged;
+ }
+
+ function is_conflict()
+ {
+ return ($this->merged() === false) ? true : false;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff3_op_copy extends diff3_op
+{
+ function diff3_op_copy($lines = false)
+ {
+ $this->orig = $lines ? $lines : array();
+ $this->final1 = &$this->orig;
+ $this->final2 = &$this->orig;
+ }
+
+ function merged()
+ {
+ return $this->orig;
+ }
+
+ function is_conflict()
+ {
+ return false;
+ }
+}
+
+/**
+* @package diff
+* @author Geoffrey T. Dairiki
+*
+* @access private
+*/
+class diff3_block_builder
+{
+ function diff3_block_builder()
+ {
+ $this->_init();
+ }
+
+ function input($lines)
+ {
+ if ($lines)
+ {
+ $this->_append($this->orig, $lines);
+ }
+ }
+
+ function out1($lines)
+ {
+ if ($lines)
+ {
+ $this->_append($this->final1, $lines);
+ }
+ }
+
+ function out2($lines)
+ {
+ if ($lines)
+ {
+ $this->_append($this->final2, $lines);
+ }
+ }
+
+ function is_empty()
+ {
+ return !$this->orig && !$this->final1 && !$this->final2;
+ }
+
+ function finish()
+ {
+ if ($this->is_empty())
+ {
+ return false;
+ }
+ else
+ {
+ $edit = new diff3_op($this->orig, $this->final1, $this->final2);
+ $this->_init();
+ return $edit;
+ }
+ }
+
+ function _init()
+ {
+ $this->orig = $this->final1 = $this->final2 = array();
+ }
+
+ function _append(&$array, $lines)
+ {
+ array_splice($array, sizeof($array), 0, $lines);
+ }
+}
\ No newline at end of file
diff --git a/includes/diff/engine.php b/includes/diff/engine.php
new file mode 100755
index 000000000..50c1c685b
--- /dev/null
+++ b/includes/diff/engine.php
@@ -0,0 +1,516 @@
+ 2, and some optimizations) are from
+* Geoffrey T. Dairiki . The original PHP version of this
+* code was written by him, and is used/adapted with his permission.
+*
+* Copyright 2004-2008 The Horde Project (http://www.horde.org/)
+*
+* @author Geoffrey T. Dairiki
+* @package diff
+*
+* @access private
+*/
+class diff_engine
+{
+ function diff(&$from_lines, &$to_lines, $preserve_cr = true)
+ {
+ // Remove empty lines...
+ // If preserve_cr is true, we basically only change \r\n and bare \r to \n to get the same carriage returns for both files
+ // If it is false, we try to only use \n once per line and ommit all empty lines to be able to get a proper data diff
+
+ if (is_array($from_lines))
+ {
+ $from_lines = implode("\n", $from_lines);
+ }
+
+ if (is_array($to_lines))
+ {
+ $to_lines = implode("\n", $to_lines);
+ }
+
+ if ($preserve_cr)
+ {
+ $from_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $from_lines)));
+ $to_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $to_lines)));
+ }
+ else
+ {
+ $from_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $from_lines));
+ $to_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $to_lines));
+ }
+
+ $n_from = sizeof($from_lines);
+ $n_to = sizeof($to_lines);
+
+ $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array();
+ unset($this->seq, $this->in_seq, $this->lcs);
+
+ // Skip leading common lines.
+ for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++)
+ {
+ if ($from_lines[$skip] !== $to_lines[$skip])
+ {
+ break;
+ }
+ $this->xchanged[$skip] = $this->ychanged[$skip] = false;
+ }
+
+ // Skip trailing common lines.
+ $xi = $n_from;
+ $yi = $n_to;
+
+ for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++)
+ {
+ if ($from_lines[$xi] !== $to_lines[$yi])
+ {
+ break;
+ }
+ $this->xchanged[$xi] = $this->ychanged[$yi] = false;
+ }
+
+ // Ignore lines which do not exist in both files.
+ for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
+ {
+ $xhash[$from_lines[$xi]] = 1;
+ }
+
+ for ($yi = $skip; $yi < $n_to - $endskip; $yi++)
+ {
+ $line = $to_lines[$yi];
+
+ if (($this->ychanged[$yi] = empty($xhash[$line])))
+ {
+ continue;
+ }
+ $yhash[$line] = 1;
+ $this->yv[] = $line;
+ $this->yind[] = $yi;
+ }
+
+ for ($xi = $skip; $xi < $n_from - $endskip; $xi++)
+ {
+ $line = $from_lines[$xi];
+
+ if (($this->xchanged[$xi] = empty($yhash[$line])))
+ {
+ continue;
+ }
+ $this->xv[] = $line;
+ $this->xind[] = $xi;
+ }
+
+ // Find the LCS.
+ $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv));
+
+ // Merge edits when possible.
+ $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged);
+ $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
+
+ // Compute the edit operations.
+ $edits = array();
+ $xi = $yi = 0;
+
+ while ($xi < $n_from || $yi < $n_to)
+ {
+ // Skip matching "snake".
+ $copy = array();
+
+ while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi])
+ {
+ $copy[] = $from_lines[$xi++];
+ $yi++;
+ }
+
+ if ($copy)
+ {
+ $edits[] = new diff_op_copy($copy);
+ }
+
+ // Find deletes & adds.
+ $delete = array();
+ while ($xi < $n_from && $this->xchanged[$xi])
+ {
+ $delete[] = $from_lines[$xi++];
+ }
+
+ $add = array();
+ while ($yi < $n_to && $this->ychanged[$yi])
+ {
+ $add[] = $to_lines[$yi++];
+ }
+
+ if ($delete && $add)
+ {
+ $edits[] = new diff_op_change($delete, $add);
+ }
+ else if ($delete)
+ {
+ $edits[] = new diff_op_delete($delete);
+ }
+ else if ($add)
+ {
+ $edits[] = new diff_op_add($add);
+ }
+ }
+
+ return $edits;
+ }
+
+ /**
+ * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF,
+ * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized segments.
+ *
+ * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of
+ * NCHUNKS+1 (X, Y) indexes giving the diving points between sub
+ * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1),
+ * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) ==
+ * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
+ *
+ * This function assumes that the first lines of the specified portions of
+ * the two files do not match, and likewise that the last lines do not
+ * match. The caller must trim matching lines from the beginning and end
+ * of the portions it is going to specify.
+ */
+ function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
+ {
+ $flip = false;
+
+ if ($xlim - $xoff > $ylim - $yoff)
+ {
+ // Things seems faster (I'm not sure I understand why) when the shortest sequence is in X.
+ $flip = true;
+ list($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim);
+ }
+
+ if ($flip)
+ {
+ for ($i = $ylim - 1; $i >= $yoff; $i--)
+ {
+ $ymatches[$this->xv[$i]][] = $i;
+ }
+ }
+ else
+ {
+ for ($i = $ylim - 1; $i >= $yoff; $i--)
+ {
+ $ymatches[$this->yv[$i]][] = $i;
+ }
+ }
+
+ $this->lcs = 0;
+ $this->seq[0]= $yoff - 1;
+ $this->in_seq = array();
+ $ymids[0] = array();
+
+ $numer = $xlim - $xoff + $nchunks - 1;
+ $x = $xoff;
+
+ for ($chunk = 0; $chunk < $nchunks; $chunk++)
+ {
+ if ($chunk > 0)
+ {
+ for ($i = 0; $i <= $this->lcs; $i++)
+ {
+ $ymids[$i][$chunk - 1] = $this->seq[$i];
+ }
+ }
+
+ $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
+
+ for (; $x < $x1; $x++)
+ {
+ $line = $flip ? $this->yv[$x] : $this->xv[$x];
+ if (empty($ymatches[$line]))
+ {
+ continue;
+ }
+ $matches = $ymatches[$line];
+
+ reset($matches);
+ while (list(, $y) = each($matches))
+ {
+ if (empty($this->in_seq[$y]))
+ {
+ $k = $this->_lcs_pos($y);
+ $ymids[$k] = $ymids[$k - 1];
+ break;
+ }
+ }
+
+ // no reset() here
+ while (list(, $y) = each($matches))
+ {
+ if ($y > $this->seq[$k - 1])
+ {
+ // Optimization: this is a common case: next match is just replacing previous match.
+ $this->in_seq[$this->seq[$k]] = false;
+ $this->seq[$k] = $y;
+ $this->in_seq[$y] = 1;
+ }
+ else if (empty($this->in_seq[$y]))
+ {
+ $k = $this->_lcs_pos($y);
+ $ymids[$k] = $ymids[$k - 1];
+ }
+ }
+ }
+ }
+
+ $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
+ $ymid = $ymids[$this->lcs];
+
+ for ($n = 0; $n < $nchunks - 1; $n++)
+ {
+ $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
+ $y1 = $ymid[$n] + 1;
+ $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
+ }
+ $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
+
+ return array($this->lcs, $seps);
+ }
+
+ function _lcs_pos($ypos)
+ {
+ $end = $this->lcs;
+
+ if ($end == 0 || $ypos > $this->seq[$end])
+ {
+ $this->seq[++$this->lcs] = $ypos;
+ $this->in_seq[$ypos] = 1;
+ return $this->lcs;
+ }
+
+ $beg = 1;
+ while ($beg < $end)
+ {
+ $mid = (int)(($beg + $end) / 2);
+ if ($ypos > $this->seq[$mid])
+ {
+ $beg = $mid + 1;
+ }
+ else
+ {
+ $end = $mid;
+ }
+ }
+
+ $this->in_seq[$this->seq[$end]] = false;
+ $this->seq[$end] = $ypos;
+ $this->in_seq[$ypos] = 1;
+
+ return $end;
+ }
+
+ /**
+ * Finds LCS of two sequences.
+ *
+ * The results are recorded in the vectors $this->{x,y}changed[], by
+ * storing a 1 in the element for each line that is an insertion or
+ * deletion (ie. is not in the LCS).
+ *
+ * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1.
+ *
+ * Note that XLIM, YLIM are exclusive bounds. All line numbers are
+ * origin-0 and discarded lines are not counted.
+ */
+ function _compareseq($xoff, $xlim, $yoff, $ylim)
+ {
+ // Slide down the bottom initial diagonal.
+ while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff])
+ {
+ ++$xoff;
+ ++$yoff;
+ }
+
+ // Slide up the top initial diagonal.
+ while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1])
+ {
+ --$xlim;
+ --$ylim;
+ }
+
+ if ($xoff == $xlim || $yoff == $ylim)
+ {
+ $lcs = 0;
+ }
+ else
+ {
+ // This is ad hoc but seems to work well.
+ // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
+ // $nchunks = max(2,min(8,(int)$nchunks));
+ $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
+ list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks);
+ }
+
+ if ($lcs == 0)
+ {
+ // X and Y sequences have no common subsequence: mark all changed.
+ while ($yoff < $ylim)
+ {
+ $this->ychanged[$this->yind[$yoff++]] = 1;
+ }
+
+ while ($xoff < $xlim)
+ {
+ $this->xchanged[$this->xind[$xoff++]] = 1;
+ }
+ }
+ else
+ {
+ // Use the partitions to split this problem into subproblems.
+ reset($seps);
+ $pt1 = $seps[0];
+
+ while ($pt2 = next($seps))
+ {
+ $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
+ $pt1 = $pt2;
+ }
+ }
+ }
+
+ /**
+ * Adjusts inserts/deletes of identical lines to join changes as much as possible.
+ *
+ * We do something when a run of changed lines include a line at one end
+ * and has an excluded, identical line at the other. We are free to
+ * choose which identical line is included. 'compareseq' usually chooses
+ * the one at the beginning, but usually it is cleaner to consider the
+ * following identical line to be the "change".
+ *
+ * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
+ */
+ function _shift_boundaries($lines, &$changed, $other_changed)
+ {
+ $i = 0;
+ $j = 0;
+
+ $len = sizeof($lines);
+ $other_len = sizeof($other_changed);
+
+ while (1)
+ {
+ // Scan forward to find the beginning of another run of
+ // changes. Also keep track of the corresponding point in the other file.
+ //
+ // Throughout this code, $i and $j are adjusted together so that
+ // the first $i elements of $changed and the first $j elements of
+ // $other_changed both contain the same number of zeros (unchanged lines).
+ //
+ // Furthermore, $j is always kept so that $j == $other_len or $other_changed[$j] == false.
+ while ($j < $other_len && $other_changed[$j])
+ {
+ $j++;
+ }
+
+ while ($i < $len && ! $changed[$i])
+ {
+ $i++;
+ $j++;
+
+ while ($j < $other_len && $other_changed[$j])
+ {
+ $j++;
+ }
+ }
+
+ if ($i == $len)
+ {
+ break;
+ }
+
+ $start = $i;
+
+ // Find the end of this run of changes.
+ while (++$i < $len && $changed[$i])
+ {
+ continue;
+ }
+
+ do
+ {
+ // Record the length of this run of changes, so that we can later determine whether the run has grown.
+ $runlength = $i - $start;
+
+ // Move the changed region back, so long as the previous unchanged line matches the last changed one.
+ // This merges with previous changed regions.
+ while ($start > 0 && $lines[$start - 1] == $lines[$i - 1])
+ {
+ $changed[--$start] = 1;
+ $changed[--$i] = false;
+
+ while ($start > 0 && $changed[$start - 1])
+ {
+ $start--;
+ }
+
+ while ($other_changed[--$j])
+ {
+ continue;
+ }
+ }
+
+ // Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the
+ // other file. CORRESPONDING == LEN means no such point has been found.
+ $corresponding = $j < $other_len ? $i : $len;
+
+ // Move the changed region forward, so long as the first changed line matches the following unchanged one.
+ // This merges with following changed regions.
+ // Do this second, so that if there are no merges, the changed region is moved forward as far as possible.
+ while ($i < $len && $lines[$start] == $lines[$i])
+ {
+ $changed[$start++] = false;
+ $changed[$i++] = 1;
+
+ while ($i < $len && $changed[$i])
+ {
+ $i++;
+ }
+
+ $j++;
+ if ($j < $other_len && $other_changed[$j])
+ {
+ $corresponding = $i;
+ while ($j < $other_len && $other_changed[$j])
+ {
+ $j++;
+ }
+ }
+ }
+ }
+ while ($runlength != $i - $start);
+
+ // If possible, move the fully-merged run of changes back to a corresponding run in the other file.
+ while ($corresponding < $i)
+ {
+ $changed[--$start] = 1;
+ $changed[--$i] = 0;
+
+ while ($other_changed[--$j])
+ {
+ continue;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/includes/diff/renderer.php b/includes/diff/renderer.php
new file mode 100755
index 000000000..fbdb13bc0
--- /dev/null
+++ b/includes/diff/renderer.php
@@ -0,0 +1,840 @@
+ $value)
+ {
+ $v = '_' . $param;
+ if (isset($this->$v))
+ {
+ $this->$v = $value;
+ }
+ }
+ }
+
+ /**
+ * Get any renderer parameters.
+ *
+ * @return array All parameters of this renderer object.
+ */
+ function get_params()
+ {
+ $params = array();
+ foreach (get_object_vars($this) as $k => $v)
+ {
+ if ($k[0] == '_')
+ {
+ $params[substr($k, 1)] = $v;
+ }
+ }
+
+ return $params;
+ }
+
+ /**
+ * Renders a diff.
+ *
+ * @param diff &$diff A diff object.
+ *
+ * @return string The formatted output.
+ */
+ function render(&$diff)
+ {
+ $xi = $yi = 1;
+ $block = false;
+ $context = array();
+
+ // Create a new diff object if it is a 3-way diff
+ if (is_a($diff, 'diff3'))
+ {
+ $diff3 = &$diff;
+
+ $diff_1 = $diff3->get_original();
+ $diff_2 = $diff3->merged_output();
+
+ unset($diff3);
+
+ $diff = new diff($diff_1, $diff_2);
+ }
+
+ $nlead = $this->_leading_context_lines;
+ $ntrail = $this->_trailing_context_lines;
+
+ $output = $this->_start_diff();
+ $diffs = $diff->get_diff();
+
+ foreach ($diffs as $i => $edit)
+ {
+ // If these are unchanged (copied) lines, and we want to keep leading or trailing context lines, extract them from the copy block.
+ if (is_a($edit, 'diff_op_copy'))
+ {
+ // Do we have any diff blocks yet?
+ if (is_array($block))
+ {
+ // How many lines to keep as context from the copy block.
+ $keep = ($i == sizeof($diffs) - 1) ? $ntrail : $nlead + $ntrail;
+ if (sizeof($edit->orig) <= $keep)
+ {
+ // We have less lines in the block than we want for context => keep the whole block.
+ $block[] = $edit;
+ }
+ else
+ {
+ if ($ntrail)
+ {
+ // Create a new block with as many lines as we need for the trailing context.
+ $context = array_slice($edit->orig, 0, $ntrail);
+ $block[] = new diff_op_copy($context);
+ }
+
+ $output .= $this->_block($x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block);
+ $block = false;
+ }
+ }
+ // Keep the copy block as the context for the next block.
+ $context = $edit->orig;
+ }
+ else
+ {
+ // Don't we have any diff blocks yet?
+ if (!is_array($block))
+ {
+ // Extract context lines from the preceding copy block.
+ $context = array_slice($context, sizeof($context) - $nlead);
+ $x0 = $xi - sizeof($context);
+ $y0 = $yi - sizeof($context);
+ $block = array();
+
+ if ($context)
+ {
+ $block[] = new diff_op_copy($context);
+ }
+ }
+ $block[] = $edit;
+ }
+
+ $xi += ($edit->orig) ? sizeof($edit->orig) : 0;
+ $yi += ($edit->final) ? sizeof($edit->final) : 0;
+ }
+
+ if (is_array($block))
+ {
+ $output .= $this->_block($x0, $xi - $x0, $y0, $yi - $y0, $block);
+ }
+
+ return $output . $this->_end_diff();
+ }
+
+ function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
+ {
+ $output = $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
+
+ foreach ($edits as $edit)
+ {
+ switch (get_class($edit))
+ {
+ case 'diff_op_copy':
+ $output .= $this->_context($edit->orig);
+ break;
+
+ case 'diff_op_add':
+ $output .= $this->_added($edit->final);
+ break;
+
+ case 'diff_op_delete':
+ $output .= $this->_deleted($edit->orig);
+ break;
+
+ case 'diff_op_change':
+ $output .= $this->_changed($edit->orig, $edit->final);
+ break;
+ }
+ }
+
+ return $output . $this->_end_block();
+ }
+
+ function _start_diff()
+ {
+ return '';
+ }
+
+ function _end_diff()
+ {
+ return '';
+ }
+
+ function _block_header($xbeg, $xlen, $ybeg, $ylen)
+ {
+ if ($xlen > 1)
+ {
+ $xbeg .= ',' . ($xbeg + $xlen - 1);
+ }
+
+ if ($ylen > 1)
+ {
+ $ybeg .= ',' . ($ybeg + $ylen - 1);
+ }
+
+ // this matches the GNU Diff behaviour
+ if ($xlen && !$ylen)
+ {
+ $ybeg--;
+ }
+ else if (!$xlen)
+ {
+ $xbeg--;
+ }
+
+ return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
+ }
+
+ function _start_block($header)
+ {
+ return $header . "\n";
+ }
+
+ function _end_block()
+ {
+ return '';
+ }
+
+ function _lines($lines, $prefix = ' ')
+ {
+ return $prefix . implode("\n$prefix", $lines) . "\n";
+ }
+
+ function _context($lines)
+ {
+ return $this->_lines($lines, ' ');
+ }
+
+ function _added($lines)
+ {
+ return $this->_lines($lines, '> ');
+ }
+
+ function _deleted($lines)
+ {
+ return $this->_lines($lines, '< ');
+ }
+
+ function _changed($orig, $final)
+ {
+ return $this->_deleted($orig) . "---\n" . $this->_added($final);
+ }
+
+ /**
+ * Our function to get the diff
+ */
+ function get_diff_content($diff)
+ {
+ return $this->render($diff);
+ }
+}
+
+/**
+* Renders a unified diff
+* @package diff
+*/
+class diff_renderer_unified extends diff_renderer
+{
+ var $_leading_context_lines = 4;
+ var $_trailing_context_lines = 4;
+
+ /**
+ * Our function to get the diff
+ */
+ function get_diff_content($diff)
+ {
+ return nl2br($this->render($diff));
+ }
+
+ function _block_header($xbeg, $xlen, $ybeg, $ylen)
+ {
+ if ($xlen != 1)
+ {
+ $xbeg .= ',' . $xlen;
+ }
+
+ if ($ylen != 1)
+ {
+ $ybeg .= ',' . $ylen;
+ }
+ return '@@ -' . $xbeg . ' +' . $ybeg . ' @@
';
+ }
+
+ function _context($lines)
+ {
+ return '' . htmlspecialchars($this->_lines($lines, ' ')) . ' ';
+ }
+
+ function _added($lines)
+ {
+ return '' . htmlspecialchars($this->_lines($lines, '+')) . ' ';
+ }
+
+ function _deleted($lines)
+ {
+ return '' . htmlspecialchars($this->_lines($lines, '-')) . ' ';
+ }
+
+ function _changed($orig, $final)
+ {
+ return $this->_deleted($orig) . $this->_added($final);
+ }
+
+ function _start_diff()
+ {
+ $start = '';
+
+ return $start;
+ }
+
+ function _end_diff()
+ {
+ return '
';
+ }
+
+ function _end_block()
+ {
+ return '';
+ }
+}
+
+/**
+* "Inline" diff renderer.
+*
+* This class renders diffs in the Wiki-style "inline" format.
+*
+* @author Ciprian Popovici
+* @package diff
+*/
+class diff_renderer_inline extends diff_renderer
+{
+ var $_leading_context_lines = 10000;
+ var $_trailing_context_lines = 10000;
+
+ // Prefix and suffix for inserted text
+ var $_ins_prefix = '';
+ var $_ins_suffix = ' ';
+
+ // Prefix and suffix for deleted text
+ var $_del_prefix = '';
+ var $_del_suffix = ' ';
+
+ var $_block_head = '';
+
+ // What are we currently splitting on? Used to recurse to show word-level
+ var $_split_level = 'lines';
+
+ /**
+ * Our function to get the diff
+ */
+ function get_diff_content($diff)
+ {
+ return '' . nl2br($this->render($diff)) . ' ';
+ }
+
+ function _start_diff()
+ {
+ return '';
+ }
+
+ function _end_diff()
+ {
+ return '';
+ }
+
+ function _block_header($xbeg, $xlen, $ybeg, $ylen)
+ {
+ return $this->_block_head;
+ }
+
+ function _start_block($header)
+ {
+ return $header;
+ }
+
+ function _lines($lines, $prefix = ' ', $encode = true)
+ {
+ if ($encode)
+ {
+ array_walk($lines, array(&$this, '_encode'));
+ }
+
+ if ($this->_split_level == 'words')
+ {
+ return implode('', $lines);
+ }
+ else
+ {
+ return implode("\n", $lines) . "\n";
+ }
+ }
+
+ function _added($lines)
+ {
+ array_walk($lines, array(&$this, '_encode'));
+ $lines[0] = $this->_ins_prefix . $lines[0];
+ $lines[sizeof($lines) - 1] .= $this->_ins_suffix;
+ return $this->_lines($lines, ' ', false);
+ }
+
+ function _deleted($lines, $words = false)
+ {
+ array_walk($lines, array(&$this, '_encode'));
+ $lines[0] = $this->_del_prefix . $lines[0];
+ $lines[sizeof($lines) - 1] .= $this->_del_suffix;
+ return $this->_lines($lines, ' ', false);
+ }
+
+ function _changed($orig, $final)
+ {
+ // If we've already split on words, don't try to do so again - just display.
+ if ($this->_split_level == 'words')
+ {
+ $prefix = '';
+ while ($orig[0] !== false && $final[0] !== false && substr($orig[0], 0, 1) == ' ' && substr($final[0], 0, 1) == ' ')
+ {
+ $prefix .= substr($orig[0], 0, 1);
+ $orig[0] = substr($orig[0], 1);
+ $final[0] = substr($final[0], 1);
+ }
+
+ return $prefix . $this->_deleted($orig) . $this->_added($final);
+ }
+
+ $text1 = implode("\n", $orig);
+ $text2 = implode("\n", $final);
+
+ // Non-printing newline marker.
+ $nl = "\0";
+
+ // We want to split on word boundaries, but we need to preserve whitespace as well.
+ // Therefore we split on words, but include all blocks of whitespace in the wordlist.
+ $splitted_text_1 = $this->_split_on_words($text1, $nl);
+ $splitted_text_2 = $this->_split_on_words($text2, $nl);
+
+ $diff = new diff($splitted_text_1, $splitted_text_2);
+ unset($splitted_text_1, $splitted_text_2);
+
+ // Get the diff in inline format.
+ $renderer = new diff_renderer_inline(array_merge($this->get_params(), array('split_level' => 'words')));
+
+ // Run the diff and get the output.
+ return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
+ }
+
+ function _split_on_words($string, $newline_escape = "\n")
+ {
+ // Ignore \0; otherwise the while loop will never finish.
+ $string = str_replace("\0", '', $string);
+
+ $words = array();
+ $length = strlen($string);
+ $pos = 0;
+
+ $tab_there = true;
+ while ($pos < $length)
+ {
+ // Check for tabs... do not include them
+ if ($tab_there && substr($string, $pos, 1) === "\t")
+ {
+ $words[] = "\t";
+ $pos++;
+
+ continue;
+ }
+ else
+ {
+ $tab_there = false;
+ }
+
+ // Eat a word with any preceding whitespace.
+ $spaces = strspn(substr($string, $pos), " \n");
+ $nextpos = strcspn(substr($string, $pos + $spaces), " \n");
+ $words[] = str_replace("\n", $newline_escape, substr($string, $pos, $spaces + $nextpos));
+ $pos += $spaces + $nextpos;
+ }
+
+ return $words;
+ }
+
+ function _encode(&$string)
+ {
+ $string = htmlspecialchars($string);
+ }
+}
+
+/**
+* "raw" diff renderer.
+* This class could be used to output a raw unified patch file
+*
+* @package diff
+*/
+class diff_renderer_raw extends diff_renderer
+{
+ var $_leading_context_lines = 4;
+ var $_trailing_context_lines = 4;
+
+ /**
+ * Our function to get the diff
+ */
+ function get_diff_content($diff)
+ {
+ return '';
+ }
+
+ function _block_header($xbeg, $xlen, $ybeg, $ylen)
+ {
+ if ($xlen != 1)
+ {
+ $xbeg .= ',' . $xlen;
+ }
+
+ if ($ylen != 1)
+ {
+ $ybeg .= ',' . $ylen;
+ }
+ return '@@ -' . $xbeg . ' +' . $ybeg . ' @@';
+ }
+
+ function _context($lines)
+ {
+ return $this->_lines($lines, ' ');
+ }
+
+ function _added($lines)
+ {
+ return $this->_lines($lines, '+');
+ }
+
+ function _deleted($lines)
+ {
+ return $this->_lines($lines, '-');
+ }
+
+ function _changed($orig, $final)
+ {
+ return $this->_deleted($orig) . $this->_added($final);
+ }
+}
+
+/**
+* "chora (Horde)" diff renderer - similar style.
+* This renderer class is a modified human_readable function from the Horde Framework.
+*
+* @package diff
+*/
+class diff_renderer_side_by_side extends diff_renderer
+{
+ var $_leading_context_lines = 3;
+ var $_trailing_context_lines = 3;
+
+ var $lines = array();
+
+ // Hold the left and right columns of lines for change blocks.
+ var $cols;
+ var $state;
+
+ var $data = false;
+
+ /**
+ * Our function to get the diff
+ */
+ function get_diff_content($diff)
+ {
+ global $user;
+
+ $output = '';
+ $output .= '
+
+ ' . 'LINE_UNMODIFIED' . '
+ ' . 'LINE_ADDED' . '
+ ' . 'LINE_MODIFIED' . '
+ ' . 'LINE_REMOVED' . '
+
+
+';
+
+ $this->render($diff);
+
+ // Is the diff empty?
+ if (!sizeof($this->lines))
+ {
+ $output .= '' . 'NO_VISIBLE_CHANGES' . ' ';
+ }
+ else
+ {
+ // Iterate through every header block of changes
+ foreach ($this->lines as $header)
+ {
+ $output .= '' . 'LINE' . ' ' . $header['oldline'] . ' ' . 'LINE' . ' ' . $header['newline'] . ' ';
+
+ // Each header block consists of a number of changes (add, remove, change).
+ $current_context = '';
+
+ foreach ($header['contents'] as $change)
+ {
+ if (!empty($current_context) && $change['type'] != 'empty')
+ {
+ $line = $current_context;
+ $current_context = '';
+
+ $output .= '' . ((strlen($line)) ? $line : ' ') . '
+ ' . ((strlen($line)) ? $line : ' ') . ' ';
+ }
+
+ switch ($change['type'])
+ {
+ case 'add':
+ $line = '';
+
+ foreach ($change['lines'] as $_line)
+ {
+ $line .= htmlspecialchars($_line) . ' ';
+ }
+
+ $output .= ' ' . ((strlen($line)) ? $line : ' ') . ' ';
+ break;
+
+ case 'remove':
+ $line = '';
+
+ foreach ($change['lines'] as $_line)
+ {
+ $line .= htmlspecialchars($_line) . ' ';
+ }
+
+ $output .= '' . ((strlen($line)) ? $line : ' ') . ' ';
+ break;
+
+ case 'empty':
+ $current_context .= htmlspecialchars($change['line']) . ' ';
+ break;
+
+ case 'change':
+ // Pop the old/new stacks one by one, until both are empty.
+ $oldsize = sizeof($change['old']);
+ $newsize = sizeof($change['new']);
+ $left = $right = '';
+
+ for ($row = 0, $row_max = max($oldsize, $newsize); $row < $row_max; ++$row)
+ {
+ $left .= isset($change['old'][$row]) ? htmlspecialchars($change['old'][$row]) : '';
+ $left .= ' ';
+ $right .= isset($change['new'][$row]) ? htmlspecialchars($change['new'][$row]) : '';
+ $right .= ' ';
+ }
+
+ $output .= '';
+
+ if (!empty($left))
+ {
+ $output .= '' . $left . ' ';
+ }
+ else if ($row < $oldsize)
+ {
+ $output .= ' ';
+ }
+ else
+ {
+ $output .= ' ';
+ }
+
+ if (!empty($right))
+ {
+ $output .= '' . $right . ' ';
+ }
+ else if ($row < $newsize)
+ {
+ $output .= ' ';
+ }
+ else
+ {
+ $output .= ' ';
+ }
+
+ $output .= ' ';
+ break;
+ }
+ }
+
+ if (!empty($current_context))
+ {
+ $line = $current_context;
+ $current_context = '';
+
+ $output .= '' . ((strlen($line)) ? $line : ' ') . ' ';
+ $output .= '' . ((strlen($line)) ? $line : ' ') . ' ';
+ }
+ }
+ }
+
+ $output .= '
';
+
+ return $output;
+ }
+
+ function _start_diff()
+ {
+ $this->lines = array();
+
+ $this->data = false;
+ $this->cols = array(array(), array());
+ $this->state = 'empty';
+
+ return '';
+ }
+
+ function _end_diff()
+ {
+ // Just flush any remaining entries in the columns stack.
+ switch ($this->state)
+ {
+ case 'add':
+ $this->data['contents'][] = array('type' => 'add', 'lines' => $this->cols[0]);
+ break;
+
+ case 'remove':
+ // We have some removal lines pending in our stack, so flush them.
+ $this->data['contents'][] = array('type' => 'remove', 'lines' => $this->cols[0]);
+ break;
+
+ case 'change':
+ // We have both remove and addition lines, so this is a change block.
+ $this->data['contents'][] = array('type' => 'change', 'old' => $this->cols[0], 'new' => $this->cols[1]);
+ break;
+ }
+
+ if ($this->data !== false)
+ {
+ $this->lines[] = $this->data;
+ }
+
+ return '';
+ }
+
+ function _block_header($xbeg, $xlen, $ybeg, $ylen)
+ {
+ // Push any previous header information to the return stack.
+ if ($this->data !== false)
+ {
+ $this->lines[] = $this->data;
+ }
+
+ $this->data = array('type' => 'header', 'oldline' => $xbeg, 'newline' => $ybeg, 'contents' => array());
+ $this->state = 'dump';
+ }
+
+ function _added($lines)
+ {
+ array_walk($lines, array(&$this, '_perform_add'));
+ }
+
+ function _perform_add($line)
+ {
+ if ($this->state == 'empty')
+ {
+ return '';
+ }
+
+ // This is just an addition line.
+ if ($this->state == 'dump' || $this->state == 'add')
+ {
+ // Start adding to the addition stack.
+ $this->cols[0][] = $line;
+ $this->state = 'add';
+ }
+ else
+ {
+ // This is inside a change block, so start accumulating lines.
+ $this->state = 'change';
+ $this->cols[1][] = $line;
+ }
+ }
+
+ function _deleted($lines)
+ {
+ array_walk($lines, array(&$this, '_perform_delete'));
+ }
+
+ function _perform_delete($line)
+ {
+ // This is a removal line.
+ $this->state = 'remove';
+ $this->cols[0][] = $line;
+ }
+
+ function _context($lines)
+ {
+ array_walk($lines, array(&$this, '_perform_context'));
+ }
+
+ function _perform_context($line)
+ {
+ // An empty block with no action.
+ switch ($this->state)
+ {
+ case 'add':
+ $this->data['contents'][] = array('type' => 'add', 'lines' => $this->cols[0]);
+ break;
+
+ case 'remove':
+ // We have some removal lines pending in our stack, so flush them.
+ $this->data['contents'][] = array('type' => 'remove', 'lines' => $this->cols[0]);
+ break;
+
+ case 'change':
+ // We have both remove and addition lines, so this is a change block.
+ $this->data['contents'][] = array('type' => 'change', 'old' => $this->cols[0], 'new' => $this->cols[1]);
+ break;
+ }
+
+ $this->cols = array(array(), array());
+ $this->data['contents'][] = array('type' => 'empty', 'line' => $line);
+ $this->state = 'dump';
+ }
+
+ function _changed($orig, $final)
+ {
+ return $this->_deleted($orig) . $this->_added($final);
+ }
+
+}
\ No newline at end of file
diff --git a/includes/email/auction_confirmation.php b/includes/email/auction_confirmation.php
old mode 100644
new mode 100755
index 8f0be5880..6fee0253c
--- a/includes/email/auction_confirmation.php
+++ b/includes/email/auction_confirmation.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'A_ID' => $auction_id,
- 'A_TITLE' => $title,
- 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
- 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
- 'A_MINBID' => $system->print_money($minimum_bid, false),
- 'A_RESERVE' => $system->print_money($reserve_price, false),
- 'A_BNPRICE' => $system->print_money($buy_now_price, false),
- 'A_ENDS' => $dt->printDateTz($a_ends),
+ 'A_ID' => $auction_id,
+ 'A_TITLE' => $title,
+ 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
+ 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
+ 'A_MINBID' => $system->print_money($minimum_bid, false),
+ 'A_RESERVE' => $system->print_money($reserve_price, false),
+ 'A_BNPRICE' => $system->print_money($buy_now_price, false),
+ 'A_ENDS' => ArrangeDateNoCorrection($a_ends + $system->tdiff),
- 'C_NAME' => $user->user_data['name']
- ));
+ 'C_NAME' => $user->user_data['name']
+ ));
$emailer->email_uid = $user->user_data['id'];
$subject = $system->SETTINGS['sitename'] . ' ' . $MSG['099'] . ': ' . $title . ' (' . $auction_id . ')';
$emailer->email_sender($user->user_data['email'], 'auctionmail.inc.php', $subject);
diff --git a/includes/email/auction_pending.php b/includes/email/auction_pending.php
old mode 100644
new mode 100755
index 31d0fb434..435970e0f
--- a/includes/email/auction_pending.php
+++ b/includes/email/auction_pending.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'A_ID' => $auction_id,
- 'A_TITLE' => $title,
- 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
- 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
- 'A_MINBID' => $system->print_money($minimum_bid, false),
- 'A_RESERVE' => $system->print_money($reserve_price, false),
- 'A_BNPRICE' => $system->print_money($buy_now_price, false),
- 'A_ENDS' => $dt->printDateTz($a_ends),
- 'PAY_LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=4&auction_id=' . $Auction['id'],
+ 'A_ID' => $auction_id,
+ 'A_TITLE' => $title,
+ 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
+ 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
+ 'A_MINBID' => $system->print_money($minimum_bid, false),
+ 'A_RESERVE' => $system->print_money($reserve_price, false),
+ 'A_BNPRICE' => $system->print_money($buy_now_price, false),
+ 'A_ENDS' => ArrangeDateNoCorrection($a_ends + $system->tdiff),
+ 'PAY_LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=4&auction_id=' . $Auction['id'],
- 'C_NAME' => $user->user_data['name']
- ));
+ 'C_NAME' => $user->user_data['name']
+ ));
$emailer->email_uid = $user->user_data['id'];
$subject = $system->SETTINGS['sitename'] . ' ' . $MSG['769'] . ': ' . $title . ' (' . $auction_id . ')';
$emailer->email_sender($user->user_data['email'], 'auction_pending.php', $subject);
diff --git a/includes/email/auction_pending_moderation.php b/includes/email/auction_pending_moderation.php
old mode 100644
new mode 100755
index 091870ea4..a8116bd3b
--- a/includes/email/auction_pending_moderation.php
+++ b/includes/email/auction_pending_moderation.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'A_ID' => $auction_id,
- 'A_TITLE' => $title,
- 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
- 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
- 'A_MINBID' => $system->print_money($minimum_bid, false),
- 'A_RESERVE' => $system->print_money($reserve_price, false),
- 'A_BNPRICE' => $system->print_money($buy_now_price, false),
- 'A_ENDS' => $dt->printDateTz($a_ends),
+ 'A_ID' => $auction_id,
+ 'A_TITLE' => $title,
+ 'A_TYPE' => ($atype == 1) ? $MSG['642'] : $MSG['641'],
+ 'A_PICURL' => ($pict_url != '') ? UPLOAD_FOLDER . $auction_id . '/' . $pict_url : 'images/email_alerts/default_item_img.jpg',
+ 'A_MINBID' => $system->print_money($minimum_bid, false),
+ 'A_RESERVE' => $system->print_money($reserve_price, false),
+ 'A_BNPRICE' => $system->print_money($buy_now_price, false),
+ 'A_ENDS' => ArrangeDateNoCorrection($a_ends + $system->tdiff),
- 'C_NAME' => $user->user_data['name']
- ));
+ 'C_NAME' => $user->user_data['name']
+ ));
$emailer->email_uid = $user->user_data['id'];
$subject = $system->SETTINGS['sitename'] . ' ' . $MSG['auction_awaiting_approval'] . ': ' . $title . ' (' . $auction_id . ')';
$emailer->email_sender($user->user_data['email'], 'auction_pending_moderation.php', $subject);
diff --git a/includes/email/endauction_cumulative.php b/includes/email/endauction_cumulative.php
old mode 100644
new mode 100755
index 4cd2b1a11..7ecd9d079
--- a/includes/email/endauction_cumulative.php
+++ b/includes/email/endauction_cumulative.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'ADMINMAIL' => $system->SETTINGS['adminmail'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'ADMINMAIL' => $system->SETTINGS['adminmail'],
- 'REPORT' => $report,
- 'REPORT_WINNER' => (isset($report_winner))? $MSG['communative_report_winner_yes'] : $MSG['communative_report_winner_no'],
+ 'REPORT' => $report,
+ 'REPORT_WINNER' => (isset($report_winner))? $MSG['communative_report_winner_yes'] : $MSG['communative_report_winner_no'],
- 'S_NAME' => $row['name']
- ));
+ 'S_NAME' => $row['name']
+ ));
$emailer->email_uid = $row['id'];
$emailer->email_sender($row['email'], 'endauction_cumulative.inc.php', $MSG['25_0199']);
diff --git a/includes/email/endauction_multi_item_win.php b/includes/email/endauction_multi_item_win.php
old mode 100644
new mode 100755
index a67b6c5b1..ac0aee34f
--- a/includes/email/endauction_multi_item_win.php
+++ b/includes/email/endauction_multi_item_win.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'W_NAME' => $Winner['name'],
+ 'W_NAME' => $Winner['name'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_TITLE' => $Auction['title'],
- 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
- 'A_QUANTITY' => $qty,
- 'A_ENDS' => $ends_string,
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_TITLE' => $Auction['title'],
+ 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
+ 'A_QUANTITY' => $qty,
+ 'A_ENDS' => $ends_string,
- 'S_NICK' => $Seller['nick'],
- 'S_EMAIL' => $Seller['email'],
+ 'S_NICK' => $Seller['nick'],
+ 'S_EMAIL' => $Seller['email'],
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
$emailer->email_uid = $Winner['id'];
$emailer->email_sender($Winner['email'], 'endauction_multi_item_win.inc.php', $system->SETTINGS['sitename'] . 'You Won ' . $item_title);
diff --git a/includes/email/endauction_nowinner.php b/includes/email/endauction_nowinner.php
old mode 100644
new mode 100755
index 6c77d59c4..f90993339
--- a/includes/email/endauction_nowinner.php
+++ b/includes/email/endauction_nowinner.php
@@ -1,6 +1,6 @@
query($query, $params);
$emailmode = $db->result('endemailmode');
-if ($emailmode == 'one') {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'S_NAME' => $Seller['name'],
- 'S_NICK' => $Seller['nick'],
- 'S_EMAIL' => $Seller['email'],
- 'A_TITLE' => htmlspecialchars($Auction['title']),
- 'A_ID' => $Auction['id'],
- 'A_END' => $ends_string,
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? $system->SETTINGS['siteurl'] . UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : $system->SETTINGS['siteurl'] . 'images/email_alerts/default_item_img.jpg',
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
- $emailer->email_uid = $Seller['id'];
- $emailer->email_sender($Seller['email'], 'endauction_nowinner.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['112']);
-}
+if ($emailmode == 'one')
+{
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'S_NAME' => $Seller['name'],
+ 'S_NICK' => $Seller['nick'],
+ 'S_EMAIL' => $Seller['email'],
+ 'A_TITLE' => htmlspecialchars($Auction['title']),
+ 'A_ID' => $Auction['id'],
+ 'A_END' => $ends_string,
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? $system->SETTINGS['siteurl'] . UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : $system->SETTINGS['siteurl'] . 'images/email_alerts/default_item_img.jpg',
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
+ $emailer->email_uid = $Seller['id'];
+ $emailer->email_sender($Seller['email'], 'endauction_nowinner.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['112']);
+}
\ No newline at end of file
diff --git a/includes/email/endauction_winner.php b/includes/email/endauction_winner.php
old mode 100644
new mode 100755
index 1ea9a1a24..fbee2add7
--- a/includes/email/endauction_winner.php
+++ b/includes/email/endauction_winner.php
@@ -1,6 +1,6 @@
query($query, $params);
$emailmode = $db->result('endemailmode');
-if ($emailmode == 'one') {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'S_NAME' => $Seller['name'],
+if ($emailmode == 'one')
+{
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'S_NAME' => $Seller['name'],
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
- 'A_TITLE' => $Auction['title'],
- 'A_CURRENTBID' => $system->print_money($Auction['current_bid']),
- 'A_QTY' => $Auction['quantity'],
- 'A_ENDS' => $ends_string,
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
+ 'A_TITLE' => $Auction['title'],
+ 'A_CURRENTBID' => $system->print_money($Auction['current_bid']),
+ 'A_QTY' => $Auction['quantity'],
+ 'A_ENDS' => $ends_string,
- 'B_REPORT' => $report_text,
+ 'B_REPORT' => $report_text,
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
- $emailer->email_uid = $Seller['id'];
- $subject = $system->SETTINGS['sitename'] . ' ' . $MSG['079'] . ' ' . $MSG['907'] . ' ' . htmlspecialchars($Auction['title']);
- $emailer->email_sender($Seller['email'], 'endauction_winner.inc.php', $subject);
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
+ $emailer->email_uid = $Seller['id'];
+ $subject = $system->SETTINGS['sitename'] . ' ' . $MSG['079'] . ' ' . $MSG['907'] . ' ' . htmlspecialchars($Auction['title']);
+ $emailer->email_sender($Seller['email'], 'endauction_winner.inc.php', $subject);
}
diff --git a/includes/email/endauction_youwin.php b/includes/email/endauction_youwin.php
old mode 100644
new mode 100755
index b0ec6ffa5..0eb07df9c
--- a/includes/email/endauction_youwin.php
+++ b/includes/email/endauction_youwin.php
@@ -1,6 +1,6 @@
60) {
- $description = substr(strip_tags($Auction['description']), 0, 50) . '...';
-} else {
- $description = $Auction['description'];
+if(strlen(strip_tags($Auction['description'])) > 60)
+{
+ $description = substr(strip_tags($Auction['description']), 0, 50) . '...';
+}
+else
+{
+ $description = $Auction['description'];
}
$emailer = new email_handler();
$emailer->assign_vars(array(
- 'W_NAME' => $Winner['name'],
- 'W_WANTED' => $Winner['wanted'],
- 'W_GOT' => $Winner['quantity'],
+ 'W_NAME' => $Winner['name'],
+ 'W_WANTED' => $Winner['wanted'],
+ 'W_GOT' => $Winner['quantity'],
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_TITLE' => htmlspecialchars($Auction['title']),
- 'A_DESCRIPTION' => $description,
- 'A_CURRENTBID' => $system->print_money($WINNERS_BID[$Winner['current_bid']]),
- 'A_ENDS' => $ends_string,
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_TITLE' => htmlspecialchars($Auction['title']),
+ 'A_DESCRIPTION' => $description,
+ 'A_CURRENTBID' => $system->print_money($WINNERS_BID[$Winner['current_bid']]),
+ 'A_ENDS' => $ends_string,
- 'S_NICK' => $Seller['nick'],
- 'S_EMAIL' => $Seller['email'],
- 'S_PAYMENT' => $Seller['payment_details'],
+ 'S_NICK' => $Seller['nick'],
+ 'S_EMAIL' => $Seller['email'],
+ 'S_PAYMENT' => $Seller['payment_details'],
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'ADMINEMAIL' => $system->SETTINGS['adminmail']
- ));
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'ADMINEMAIL' => $system->SETTINGS['adminmail']
+ ));
$emailer->email_uid = $Winner['id'];
$emailer->email_sender($Winner['email'], 'endauction_youwin.inc.php', $MSG['909']);
diff --git a/includes/email/endauction_youwin_nodutch.php b/includes/email/endauction_youwin_nodutch.php
old mode 100644
new mode 100755
index 58b4fcafe..c462334ff
--- a/includes/email/endauction_youwin_nodutch.php
+++ b/includes/email/endauction_youwin_nodutch.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'W_NAME' => $Winner['name'],
+ 'W_NAME' => $Winner['name'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_TITLE' => $item_title,
- 'A_CURRENTBID' => $system->print_money($Auction['current_bid']),
- 'A_ENDS' => $ends_string,
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_TITLE' => $item_title,
+ 'A_CURRENTBID' => $system->print_money($Auction['current_bid']),
+ 'A_ENDS' => $ends_string,
- 'S_NICK' => $Seller['nick'],
- 'S_EMAIL' => $Seller['email'],
+ 'S_NICK' => $Seller['nick'],
+ 'S_EMAIL' => $Seller['email'],
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
$emailer->email_uid = $Winner['id'];
$emailer->email_sender($Winner['email'], 'endauction_youwin_nodutch.inc.php', $system->SETTINGS['sitename'] . $MSG['909'] . ': ' . $item_title);
diff --git a/includes/email/outbid.php b/includes/email/outbid.php
old mode 100644
new mode 100755
index 8ac52d0e1..9576f45bf
--- a/includes/email/outbid.php
+++ b/includes/email/outbid.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'C_NAME' => $OldWinner_name,
+ 'C_NAME' => $OldWinner_name,
- 'N_BID' => $new_bid,
+ 'N_BID' => $new_bid,
- 'A_TITLE' => $item_title,
- 'A_ENDS' => $ends_string,
- 'A_PICURL' => ($pict_url_plain != '') ? UPLOAD_FOLDER . $item_id . '/' . $pict_url_plain : 'images/email_alerts/default_item_img.jpg',
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $item_id
- ));
+ 'A_TITLE' => $item_title,
+ 'A_ENDS' => $ends_string,
+ 'A_PICURL' => ($pict_url_plain != '') ? UPLOAD_FOLDER . $item_id . '/' . $pict_url_plain : 'images/email_alerts/default_item_img.jpg',
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $item_id
+ ));
$emailer->email_uid = $OldWinner_id;
$emailer->email_sender($OldWinner_email, 'no_longer_winner.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['906'] . ': ' . $item_title);
diff --git a/includes/email/seller_end_buynowonly.php b/includes/email/seller_end_buynowonly.php
old mode 100644
new mode 100755
index d7d7c32cf..f3d51e590
--- a/includes/email/seller_end_buynowonly.php
+++ b/includes/email/seller_end_buynowonly.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'S_NAME' => $Seller['name'],
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
- 'A_TITLE' => $Auction['title'],
- 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
- 'A_QTY_SOLD' => $qty_sold,
- 'A_QTY_LEFT' => $qty_left,
- 'A_QTY_INITIAL' => $qty_initial,
- 'A_ENDS' => $ends_string,
-
- 'B_REPORT' => $report_text,
-
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
- $emailer->email_uid = $Seller['id'];
- $subject = $system->SETTINGS['sitename'] . ' Your auction ' . $Auction['title'] .' has ended';
- $emailer->email_sender($Seller['email'], 'email_seller_end_buynowonly.inc.php', $subject);
+if ($emailmode == 'one')
+{
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'S_NAME' => $Seller['name'],
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
+ 'A_TITLE' => $Auction['title'],
+ 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
+ 'A_QTY_SOLD' => $qty_sold,
+ 'A_QTY_LEFT' => $qty_left,
+ 'A_QTY_INITIAL' => $qty_initial,
+ 'A_ENDS' => $ends_string,
+
+ 'B_REPORT' => $report_text,
+
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
+ $emailer->email_uid = $Seller['id'];
+ $subject = $system->SETTINGS['sitename'] . ' Your auction ' . $Auction['title'] .' has ended';
+ $emailer->email_sender($Seller['email'], 'email_seller_end_buynowonly.inc.php', $subject);
}
diff --git a/includes/email/seller_partial_winner.php b/includes/email/seller_partial_winner.php
old mode 100644
new mode 100755
index 38683f47c..3e00016cf
--- a/includes/email/seller_partial_winner.php
+++ b/includes/email/seller_partial_winner.php
@@ -1,6 +1,6 @@
' . $Winner['email'] . '';
$report_text .= ' ' .$MSG['30_0086'] . $Winner['address'] . ', ' . $Winner['city'] . ', ' . $Winner['prov'] . ', ' . $Winner['zip'] . ', ' . $Winner['country'];
-if ($emailmode == 'one') {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'S_NAME' => $Seller['name'],
-
- 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
- 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
- 'A_TITLE' => $Auction['title'],
- 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
- 'A_QTY_SOLD' => $qty_sold,
- 'A_QTY_LEFT' => $qty_left,
- 'A_QTY_THIS_SALE' => $qty,
- 'A_ENDS' => $ends_string,
-
- 'B_REPORT' => $report_text,
-
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename']
- ));
- $emailer->email_uid = $Seller['id'];
- $subject = $system->SETTINGS['sitename'] . ' Some items have been sold in ' . $Auction['title'];
- $emailer->email_sender($Seller['email'], 'email_seller_partial_winner.inc.php', $subject);
+if ($emailmode == 'one')
+{
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'S_NAME' => $Seller['name'],
+
+ 'A_URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $Auction['id'],
+ 'A_PICURL' => ($Auction['pict_url'] != '') ? UPLOAD_FOLDER . $Auction['id'] . '/' . $Auction['pict_url'] : 'images/email_alerts/default_item_img.jpg',
+ 'A_TITLE' => $Auction['title'],
+ 'A_CURRENTBID' => $system->print_money($Auction['buy_now']),
+ 'A_QTY_SOLD' => $qty_sold,
+ 'A_QTY_LEFT' => $qty_left,
+ 'A_QTY_THIS_SALE' => $qty,
+ 'A_ENDS' => $ends_string,
+
+ 'B_REPORT' => $report_text,
+
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename']
+ ));
+ $emailer->email_uid = $Seller['id'];
+ $subject = $system->SETTINGS['sitename'] . ' Some items have been sold in ' . $Auction['title'];
+ $emailer->email_sender($Seller['email'], 'email_seller_partial_winner.inc.php', $subject);
}
diff --git a/includes/email/user_approved.php b/includes/email/user_approved.php
old mode 100644
new mode 100755
index b92fdfd5f..5b273cabe
--- a/includes/email/user_approved.php
+++ b/includes/email/user_approved.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'C_NAME' => $USER['name']
- ));
+ 'C_NAME' => $USER['name']
+ ));
$emailer->userlang = $language;
-if (!$system->SETTINGS['email_admin_on_signup']) {
- $email_to = $USER['email'];
-} else {
- $email_to = array($USER['email'], $system->SETTINGS['adminmail']);
+if (!$system->SETTINGS['email_admin_on_signup'])
+{
+ $email_to = $USER['email'];
+}
+else
+{
+ $email_to = array($USER['email'], $system->SETTINGS['adminmail']);
}
$emailer->email_sender($email_to, 'user_approved.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['095']);
diff --git a/includes/email/user_confirmation.php b/includes/email/user_confirmation.php
old mode 100644
new mode 100755
index 7bfed5b00..e86fd6349
--- a/includes/email/user_confirmation.php
+++ b/includes/email/user_confirmation.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'ADMINMAIL' => $system->SETTINGS['adminmail'],
- 'CONFIRMURL' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $TPL_id_hidden . '&hash=' . md5($MD5_PREFIX . $hash),
- 'C_NAME' => $TPL_name_hidden
- ));
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ADMINMAIL' => $system->SETTINGS['adminmail'],
+ 'CONFIRMURL' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $TPL_id_hidden . '&hash=' . md5($MD5_PREFIX . $hash),
+ 'C_NAME' => $TPL_name_hidden
+ ));
$emailer->email_uid = $TPL_id_hidden;
-if (!$system->SETTINGS['email_admin_on_signup']) {
- $email_to = $TPL_email_hidden;
-} else {
- $email_to = array($TPL_email_hidden, $system->SETTINGS['adminmail']);
+if (!$system->SETTINGS['email_admin_on_signup'])
+{
+ $email_to = $TPL_email_hidden;
+}
+else
+{
+ $email_to = array($TPL_email_hidden, $system->SETTINGS['adminmail']);
}
$emailer->email_sender($email_to, 'usermail.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['098']);
diff --git a/includes/email/user_needapproval.php b/includes/email/user_needapproval.php
old mode 100644
new mode 100755
index 272b51891..857d04df3
--- a/includes/email/user_needapproval.php
+++ b/includes/email/user_needapproval.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'C_ID' => addslashes($TPL_id_hidden),
- 'C_NAME' => addslashes($TPL_name_hidden),
- 'C_NICK' => addslashes($TPL_nick_hidden),
- 'C_ADDRESS' => addslashes($_POST['TPL_address']),
- 'C_CITY' => addslashes($_POST['TPL_city']),
- 'C_PROV' => addslashes($_POST['TPL_prov']),
- 'C_ZIP' => addslashes($_POST['TPL_zip']),
- 'C_COUNTRY' => addslashes($_POST['TPL_country']),
- 'C_PHONE' => addslashes($_POST['TPL_phone']),
- 'C_EMAIL' => addslashes($_POST['TPL_email']),
- 'C_PASSWORD' => addslashes($TPL_password_hidden),
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'SITEURL' => $system->SETTINGS['siteurl'],
- 'ADMINEMAIL' => $system->SETTINGS['adminmail'],
- 'CONFIRMATION_PAGE' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $TPL_id_hidden . '&hash=' . md5($MD5_PREFIX . $hash),
- 'LOGO' => $system->SETTINGS['siteurl'] . 'uploaded/logo/' . $system->SETTINGS['logo']
- ));
+ 'C_ID' => addslashes($TPL_id_hidden),
+ 'C_NAME' => addslashes($TPL_name_hidden),
+ 'C_NICK' => addslashes($TPL_nick_hidden),
+ 'C_ADDRESS' => addslashes($_POST['TPL_address']),
+ 'C_CITY' => addslashes($_POST['TPL_city']),
+ 'C_PROV' => addslashes($_POST['TPL_prov']),
+ 'C_ZIP' => addslashes($_POST['TPL_zip']),
+ 'C_COUNTRY' => addslashes($_POST['TPL_country']),
+ 'C_PHONE' => addslashes($_POST['TPL_phone']),
+ 'C_EMAIL' => addslashes($_POST['TPL_email']),
+ 'C_PASSWORD' => addslashes($TPL_password_hidden),
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITEURL' => $system->SETTINGS['siteurl'],
+ 'ADMINEMAIL' => $system->SETTINGS['adminmail'],
+ 'CONFIRMATION_PAGE' => $system->SETTINGS['siteurl'] . 'confirm.php?id=' . $TPL_id_hidden . '&hash=' . md5($MD5_PREFIX . $hash),
+ 'LOGO' => $system->SETTINGS['siteurl'] . 'uploaded/logo/' . $system->SETTINGS['logo']
+ ));
$emailer->email_uid = $TPL_id_hidden;
-if (!$system->SETTINGS['email_admin_on_signup']) {
- $email_to = $TPL_email_hidden;
-} else {
- $email_to = array($TPL_email_hidden, $system->SETTINGS['adminmail']);
+if (!$system->SETTINGS['email_admin_on_signup'])
+{
+ $email_to = $TPL_email_hidden;
+}
+else
+{
+ $email_to = array($TPL_email_hidden, $system->SETTINGS['adminmail']);
}
$emailer->email_sender($email_to, 'user_needapproval.inc.php', $system->SETTINGS['sitename']. ' '.$MSG['098']);
diff --git a/includes/email/user_reactivated.php b/includes/email/user_reactivated.php
old mode 100644
new mode 100755
index 71f0a2ef8..944ba8779
--- a/includes/email/user_reactivated.php
+++ b/includes/email/user_reactivated.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'C_NAME' => $USER['name']
- ));
+ 'C_NAME' => $USER['name']
+ ));
$emailer->userlang = $language;
-$emailer->email_sender(array($USER['email'], $system->SETTINGS['adminmail']), 'user_reactivated.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['095b']);
+$emailer->email_sender(array($USER['email'], $system->SETTINGS['adminmail']), 'user_reactivated.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['095b']);
\ No newline at end of file
diff --git a/includes/email/user_suspended.php b/includes/email/user_suspended.php
old mode 100644
new mode 100755
index 5d47d6397..1b050bb17
--- a/includes/email/user_suspended.php
+++ b/includes/email/user_suspended.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'SITE_URL' => $system->SETTINGS['siteurl'],
- 'SITENAME' => $system->SETTINGS['sitename'],
+ 'SITE_URL' => $system->SETTINGS['siteurl'],
+ 'SITENAME' => $system->SETTINGS['sitename'],
- 'C_NAME' => $USER['name']
- ));
+ 'C_NAME' => $USER['name']
+ ));
$emailer->userlang = $language;
-$emailer->email_sender(array($USER['email'], $system->SETTINGS['adminmail']), 'user_suspended.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['095a']);
+$emailer->email_sender(array($USER['email'], $system->SETTINGS['adminmail']), 'user_suspended.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['095a']);
\ No newline at end of file
diff --git a/includes/errors.inc.php b/includes/errors.inc.php
old mode 100644
new mode 100755
index 30f687319..855bed1c6
--- a/includes/errors.inc.php
+++ b/includes/errors.inc.php
@@ -1,6 +1,6 @@
Fatal error [$errno] $errstr\n";
- $error .= " Fatal error on line $errline in file $errfile";
- $error .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
- $error .= "Aborting...\n";
- break;
-
- case E_WARNING:
- $error = "Warning [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_NOTICE:
- $error = "Notice [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_USER_ERROR:
- $error = "Fatal error trigger [$errno] $errstr\n";
- $error .= " Fatal error on line $errline in file $errfile";
- $error .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
- $error .= "Aborting...\n";
- break;
-
- case E_USER_WARNING:
- $error = "Warning trigger [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_USER_NOTICE:
- $error = "Notice trigger [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_STRICT:
- $error = "Strict notice [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_DEPRECATED:
- $error = "Deprecated notice [$errno] $errstr on $errfile line $errline\n";
- break;
-
- case E_USER_DEPRECATED:
- $error = "Deprecated notice trigger [$errno] $errstr on $errfile line $errline\n";
- break;
-
- default:
- $error = "Unknown error type: [$errno] $errstr on $errfile line $errline\n";
- break;
- }
- if (!isset($_SESSION['SESSION_ERROR']) || !is_array($_SESSION['SESSION_ERROR'])) {
- $_SESSION['SESSION_ERROR'] = array();
- }
- $_SESSION['SESSION_ERROR'][] = $error;
- // log the error
- $system->log('error', $error);
-
- if (WeBidDebug) {
- echo $error;
- }
-
- if ($errno & (E_ERROR|E_USER_ERROR)) {
- exit(1);
- }
- return true;
+ global $system, $_SESSION;
+ switch ($errno)
+ {
+ case E_USER_ERROR:
+ $error = "My ERROR [$errno] $errstr\n";
+ $error .= " Fatal error on line $errline in file $errfile";
+ $error .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
+ $error .= "Aborting...\n";
+ break;
+
+ case E_USER_WARNING:
+ $error = "My WARNING [$errno] $errstr on $errfile line $errline\n";
+ break;
+
+ case E_USER_NOTICE:
+ $error = "My NOTICE [$errno] $errstr on $errfile line $errline\n";
+ break;
+
+ default:
+ $error = "Unknown error type: [$errno] $errstr on $errfile line $errline\n";
+ break;
+ }
+ if (!isset($_SESSION['SESSION_ERROR']) || !is_array($_SESSION['SESSION_ERROR']))
+ {
+ $_SESSION['SESSION_ERROR'] = array();
+ }
+ $_SESSION['SESSION_ERROR'][] = $error;
+ // log the error
+ $system->log('error', $error);
+ if ($errno == E_USER_ERROR)
+ exit(1);
+ return true;
}
diff --git a/includes/functions_admin.php b/includes/functions_admin.php
old mode 100644
new mode 100755
index ef2b11fad..a74339552
--- a/includes/functions_admin.php
+++ b/includes/functions_admin.php
@@ -1,6 +1,6 @@
query($query, $params);
-
- if ($db->numrows() > 0) {
- $user_data = $db->result();
-
- if (strspn($user_data['password'], $user_data['hash']) == $_SESSION['WEBID_ADMIN_NUMBER']) {
- return false;
- }
- }
- }
- return true;
- }
-
- function getAdminNotes()
- {
- global $_SESSION, $DBPrefix, $db;
-
- if (isset($_SESSION['WEBID_ADMIN_NUMBER']) && isset($_SESSION['WEBID_ADMIN_IN']) && isset($_SESSION['WEBID_ADMIN_PASS'])) {
- $query = "SELECT notes FROM " . $DBPrefix . "adminusers WHERE password = '" . $_SESSION['WEBID_ADMIN_PASS'] . "' AND id = " . $_SESSION['WEBID_ADMIN_IN'] . " LIMIT 1";
- $params = array();
- $params[] = array(':admin_pass', $_SESSION['WEBID_ADMIN_PASS'], 'str');
- $params[] = array(':admin_id', $_SESSION['WEBID_ADMIN_IN'], 'int');
- $db->query($query, $params);
-
- if ($db->numrows() > 0) {
- return $db->result('notes');
- }
- }
- return '';
- }
-
- function loadblock($title = '', $description = '', $type = '', $name = '', $default = '', $tagline = array(), $header = false)
- {
- global $template;
-
- $template->assign_block_vars('block', array(
- 'TITLE' => $title,
- 'DESCRIPTION' => (!empty($description)) ? $description . ' ' : '',
- 'TYPE' => $type,
- 'NAME' => $name,
- 'DEFAULT' => ($type == 'text') ? htmlspecialchars($default) : $default,
- 'TAGLINE1' => (isset($tagline[0])) ? $tagline[0] : '',
- 'TAGLINE2' => (isset($tagline[1])) ? $tagline[1] : '',
- 'TAGLINE3' => (isset($tagline[2])) ? $tagline[2] : '',
-
- 'B_HEADER' => $header
- ));
- }
-
- function generateSelect($name = '', $options = array(), $usekey = true)
- {
- global $selectsetting;
-
- $html = '';
- foreach ($options as $option => $value) {
- if (!$usekey) {
- $option = $value;
- }
- if ($selectsetting == $option) {
- $html .= '' . $value . ' ';
- } else {
- $html .= '' . $value . ' ';
- }
- }
- $html .= ' ';
- return $html;
- }
-
- function get_hash()
- {
- $string = '0123456789abcdefghijklmnopqrstuvyxz';
- $hash = '';
- for ($i = 0; $i < 5; $i++) {
- $rand = rand(0, 34 - $i);
- $hash .= $string[$rand];
- $string = str_replace($string[$rand], '', $string);
- }
- return $hash;
- }
-
- function load_file_from_url($url)
- {
- if (in_array ('curl', get_loaded_extensions())) {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $str = curl_exec($curl);
- curl_close($curl);
- return $str;
- } elseif (false !== ($str = @file_get_contents($url))) {
- return $str;
- } elseif (($handle = @fopen($url, 'r')) !== false) {
- $str = fread($handle, 5);
- if (false !== $str) {
- fclose($handle);
- return $str;
- }
- }
- return false;
- }
-
- function resync_category_counters()
- {
- global $db, $system, $DBPrefix;
- // update categories
- $catscontrol = new MPTTcategories();
- $query = "UPDATE " . $DBPrefix . "categories set counter = 0, sub_counter = 0";
- $db->direct_query($query);
-
- $query = "SELECT COUNT(*) AS COUNT, category FROM " . $DBPrefix . "auctions
- WHERE closed = 0 AND starts <= CURRENT_TIMESTAMP AND suspended = 0 GROUP BY category";
- $db->direct_query($query);
-
- $cat_data = $db->fetchall();
- foreach ($cat_data as $row) {
- $row['COUNT'] = $row['COUNT'] * 1; // force it to be a number
- if ($row['COUNT'] > 0 && !empty($row['category'])) { // avoid some errors
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $row['category'], 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + :COUNT WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':COUNT', $row['COUNT'], 'int');
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + :COUNT WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':COUNT', $row['COUNT'], 'int');
- $params[] = array(':cat_id', $row['category'], 'int');
- $db->query($query, $params);
- }
- }
-
- if ($system->SETTINGS['extra_cat'] == 'y') {
- $query = "SELECT COUNT(*) AS COUNT, secondcat FROM " . $DBPrefix . "auctions
- WHERE closed = 0 AND starts <= CURRENT_TIMESTAMP AND suspended = 0 AND secondcat != 0 GROUP BY secondcat";
- $db->direct_query($query);
-
- $cat_data = $db->fetchall();
- foreach ($cat_data as $row) {
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $row['secondcat'], 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + :COUNT WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':COUNT', $row['COUNT'], 'int');
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + :COUNT WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':COUNT', $row['COUNT'], 'int');
- $params[] = array(':cat_id', $row['secondcat'], 'int');
- $db->query($query, $params);
- }
- }
- }
-
- define('AdminFuncCall', 1);
+if (!defined('InWeBid')) exit();
+
+if (!defined('AdminFuncCall'))
+{
+ function checklogin()
+ {
+ global $_SESSION, $DBPrefix, $db;
+
+ if (isset($_SESSION['WEBID_ADMIN_NUMBER']) && isset($_SESSION['WEBID_ADMIN_IN']) && isset($_SESSION['WEBID_ADMIN_PASS']))
+ {
+ $query = "SELECT hash, password FROM " . $DBPrefix . "adminusers WHERE password = '" . $_SESSION['WEBID_ADMIN_PASS'] . "' AND id = " . $_SESSION['WEBID_ADMIN_IN'];
+ $params = array();
+ $params[] = array(':admin_pass', $_SESSION['WEBID_ADMIN_PASS'], 'str');
+ $params[] = array(':admin_id', $_SESSION['WEBID_ADMIN_IN'], 'int');
+ $db->query($query, $params);
+
+ if ($db->numrows() > 0)
+ {
+ $user_data = $db->result();
+
+ if (strspn($user_data['password'], $user_data['hash']) == $_SESSION['WEBID_ADMIN_NUMBER'])
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ function getAdminNotes()
+ {
+ global $_SESSION, $DBPrefix, $db;
+
+ if (isset($_SESSION['WEBID_ADMIN_NUMBER']) && isset($_SESSION['WEBID_ADMIN_IN']) && isset($_SESSION['WEBID_ADMIN_PASS']))
+ {
+ $query = "SELECT notes FROM " . $DBPrefix . "adminusers WHERE password = '" . $_SESSION['WEBID_ADMIN_PASS'] . "' AND id = " . $_SESSION['WEBID_ADMIN_IN'] . " LIMIT 1";
+ $params = array();
+ $params[] = array(':admin_pass', $_SESSION['WEBID_ADMIN_PASS'], 'str');
+ $params[] = array(':admin_id', $_SESSION['WEBID_ADMIN_IN'], 'int');
+ $db->query($query, $params);
+
+ if ($db->numrows() > 0)
+ {
+ return $db->result('notes');
+ }
+ }
+ return '';
+ }
+
+ function loadblock($title = '', $description = '', $type = '', $name = '', $default = '', $tagline = array(), $header = false)
+ {
+ global $template;
+
+ $template->assign_block_vars('block', array(
+ 'TITLE' => $title,
+ 'DESCRIPTION' => (!empty($description)) ? $description . ' ' : '',
+ 'TYPE' => $type,
+ 'NAME' => $name,
+ 'DEFAULT' => $default,
+ 'TAGLINE1' => (isset($tagline[0])) ? $tagline[0] : '',
+ 'TAGLINE2' => (isset($tagline[1])) ? $tagline[1] : '',
+ 'TAGLINE3' => (isset($tagline[2])) ? $tagline[2] : '',
+
+ 'B_HEADER' => $header
+ ));
+ }
+
+ function generateSelect($name = '', $options = array(), $usekey = true)
+ {
+ global $selectsetting;
+
+ $html = '';
+ foreach ($options as $option => $value)
+ {
+ if (!$usekey)
+ {
+ $option = $value;
+ }
+ if ($selectsetting == $option)
+ {
+ $html .= '' . $value . ' ';
+ }
+ else
+ {
+ $html .= '' . $value . ' ';
+ }
+ }
+ $html .= ' ';
+ return $html;
+ }
+
+ function get_hash()
+ {
+ $string = '0123456789abcdefghijklmnopqrstuvyxz';
+ $hash = '';
+ for ($i = 0; $i < 5; $i++)
+ {
+ $rand = rand(0, 34 - $i);
+ $hash .= $string[$rand];
+ $string = str_replace($string[$rand], '', $string);
+ }
+ return $hash;
+ }
+
+ function load_file_from_url($url)
+ {
+ if(false !== ($str = file_get_contents($url)))
+ {
+ return $str;
+ }
+ elseif(($handle = @fopen($url, 'r')) !== false)
+ {
+ $str = fread($handle, 5);
+ if(false !== $str)
+ {
+ fclose($handle);
+ return $str;
+ }
+ }
+ elseif (function_exists('curl_init') && function_exists('curl_setopt')
+ && function_exists('curl_exec') && function_exists('curl_close'))
+ {
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_REFERER, $system->SETTINGS['siteurl']);
+ $str = curl_exec($curl);
+ curl_close($curl);
+ return $str;
+ }
+ return false;
+ }
+
+ function resync_category_counters()
+ {
+ global $db, $system, $DBPrefix;
+ // update categories
+ $catscontrol = new MPTTcategories();
+ $query = "UPDATE " . $DBPrefix . "categories set counter = 0, sub_counter = 0";
+ $db->direct_query($query);
+
+ $query = "SELECT COUNT(*) AS COUNT, category FROM " . $DBPrefix . "auctions
+ WHERE closed = 0 AND starts <= :time AND suspended = 0 GROUP BY category";
+ $params = array();
+ $params[] = array(':time', time(), 'int');
+ $db->query($query, $params);
+
+ $cat_data = $db->fetchall();
+ foreach ($cat_data as $row)
+ {
+ $row['COUNT'] = $row['COUNT'] * 1; // force it to be a number
+ if ($row['COUNT'] > 0 && !empty($row['category'])) // avoid some errors
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $row['category'], 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + :COUNT WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':COUNT', $row['COUNT'], 'int');
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + :COUNT WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':COUNT', $row['COUNT'], 'int');
+ $params[] = array(':cat_id', $row['category'], 'int');
+ $db->query($query, $params);
+ }
+ }
+
+ if ($system->SETTINGS['extra_cat'] == 'y')
+ {
+ $query = "SELECT COUNT(*) AS COUNT, secondcat FROM " . $DBPrefix . "auctions
+ WHERE closed = 0 AND starts <= :time AND suspended = 0 AND secondcat != 0 GROUP BY secondcat";
+ $params = array();
+ $params[] = array(':time', time(), 'int');
+ $db->query($query, $params);
+
+ $cat_data = $db->fetchall();
+ foreach ($cat_data as $row)
+ {
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $row['secondcat'], 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter + :COUNT WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':COUNT', $row['COUNT'], 'int');
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter + :COUNT WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':COUNT', $row['COUNT'], 'int');
+ $params[] = array(':cat_id', $row['secondcat'], 'int');
+ $db->query($query, $params);
+ }
+ }
+ }
+
+ define('AdminFuncCall', 1);
}
diff --git a/includes/functions_ajax.php b/includes/functions_ajax.php
old mode 100644
new mode 100755
index efa1122da..037d83750
--- a/includes/functions_ajax.php
+++ b/includes/functions_ajax.php
@@ -1,6 +1,6 @@
$v) {
- echo '
+ global $_SESSION;
+ foreach ($_SESSION['UPLOADED_PICTURES'] as $k => $v)
+ {
+ echo '
@@ -35,56 +34,64 @@ function getupldtable()
';
- }
+ }
}
// plupload images
function upload_images()
{
- global $user, $MSG, $system;
+ global $user, $MSG, $system;
- if (!$user->logged_in) {
- // imitate code execution
- die(json_encode(array(
- 'OK' => 0,
- 'error' => array(
- 'code' => '202', //random
- 'message' => $MSG['login_required_text']
- )
- )));
- } else {
- require_once PACKAGE_PATH . 'PluploadHandler.php';
- $uploader = new PluploadHandler();
- $uploader->no_cache_headers();
- $uploader->cors_headers();
+ if (!$user->logged_in)
+ {
+ // imitate code execution
+ die(json_encode(array(
+ 'OK' => 0,
+ 'error' => array(
+ 'code' => '202', //random
+ 'message' => $MSG['login_required_text']
+ )
+ )));
+ }
+ else
+ {
+ require_once PACKAGE_PATH . 'PluploadHandler.php';
+ $uploader = new PluploadHandler();
+ $uploader->no_cache_headers();
+ $uploader->cors_headers();
- $targetDir = UPLOAD_PATH . session_id();
+ $targetDir = UPLOAD_PATH . session_id();
- if (!$uploader->handle(array(
- 'target_dir' => $targetDir,
- 'allow_extensions' => 'jpg,jpeg,png,gif'
- ))) {
- die(json_encode(array(
- 'OK' => 0,
- 'error' => array(
- 'code' => $uploader->get_error_code(),
- 'message' => $uploader->get_error_message()
- )
- )));
- } else {
- //upload was good
- $conf = $uploader->get_conf();
- $fileName = $conf['file_name'];
- // resize picture
- $uploader->resizeThumbnailImage($targetDir . '/' . $fileName, $system->SETTINGS['gallery_max_width_height']);
- $final_file_name = strtolower($fileName);
- if (!in_array($final_file_name, $_SESSION['UPLOADED_PICTURES'])) {
- array_push($_SESSION['UPLOADED_PICTURES'], $final_file_name);
- if (count($_SESSION['UPLOADED_PICTURES']) == 1) {
- $_SESSION['SELL_pict_url_temp'] = $_SESSION['SELL_pict_url'] = $final_file_name;
- }
- }
- die(json_encode(array('OK' => 1)));
- }
- }
+ if (!$uploader->handle(array(
+ 'target_dir' => $targetDir,
+ 'allow_extensions' => 'jpg,jpeg,png,gif'
+ )))
+ {
+ die(json_encode(array(
+ 'OK' => 0,
+ 'error' => array(
+ 'code' => $uploader->get_error_code(),
+ 'message' => $uploader->get_error_message()
+ )
+ )));
+ }
+ else
+ {
+ //upload was good
+ $conf = $uploader->get_conf();
+ $fileName = $conf['file_name'];
+ // resize picture
+ $uploader->resizeThumbnailImage($targetDir . '/' . $fileName, $system->SETTINGS['gallery_max_width_height']);
+ if (!in_array($fileName, $_SESSION['UPLOADED_PICTURES']))
+ {
+ $final_file_name = strtolower($fileName);
+ array_push($_SESSION['UPLOADED_PICTURES'], $final_file_name);
+ if (count($_SESSION['UPLOADED_PICTURES']) == 1)
+ {
+ $_SESSION['SELL_pict_url_temp'] = $_SESSION['SELL_pict_url'] = $final_file_name;
+ }
+ }
+ die(json_encode(array('OK' => 1)));
+ }
+ }
}
diff --git a/includes/functions_banners.php b/includes/functions_banners.php
old mode 100644
new mode 100755
index 949b9ce6c..8ea080f28
--- a/includes/functions_banners.php
+++ b/includes/functions_banners.php
@@ -1,6 +1,6 @@
query($query, $params);
- $CKcount = false;
+ $CKcount = false;
- if ($db->numrows() == 0) {
- /*$query = "SELECT b.id FROM " . $DBPrefix . "banners b " . $joinings . "
- WHERE b.views < b.purchased OR b.purchased = 0";*/
- $query = "SELECT b.id, COUNT(k.banner) as Kcount, COUNT(c.banner) as Ccount FROM " . $DBPrefix . "banners b
+ if ($db->numrows() == 0)
+ {
+ /*$query = "SELECT b.id FROM " . $DBPrefix . "banners b " . $joinings . "
+ WHERE b.views < b.purchased OR b.purchased = 0";*/
+ $query = "SELECT b.id, COUNT(k.banner) as Kcount, COUNT(c.banner) as Ccount FROM " . $DBPrefix . "banners b
LEFT JOIN " . $DBPrefix . "bannerscategories c ON (c.banner = b.id)
LEFT JOIN " . $DBPrefix . "bannerskeywords k ON (k.banner = b.id)
WHERE (b.views < b.purchased OR b.purchased = 0)
AND k.keyword IS NULL AND c.category IS NULL
GROUP BY k.banner, c.banner";
- $db->direct_query($query);
- $CKcount = false;
- }
+ $db->direct_query($query);
+ $CKcount = false;
+ }
- // We have at least one banners to show
- while ($row = $db->fetch()) {
- if ($CKcount && $row['Kcount'] == 0 && $row['Ccount'] == 0) {
- $BANNERSARRAY[] = $row;
- } elseif (!$CKcount) {
- $BANNERSARRAY[] = $row;
- }
- }
+ // We have at least one banners to show
+ while ($row = $db->fetch())
+ {
+ if ($CKcount && $row['Kcount'] == 0 && $row['Ccount'] == 0)
+ {
+ $BANNERSARRAY[] = $row;
+ }
+ elseif (!$CKcount)
+ {
+ $BANNERSARRAY[] = $row;
+ }
+ }
- // Display banner
- if (count($BANNERSARRAY) > 0) {
- $RAND_IDX = array_rand($BANNERSARRAY);
- $BANNERTOSHOW = $BANNERSARRAY[$RAND_IDX]['id'];
+ // Display banner
+ if (count($BANNERSARRAY) > 0)
+ {
+ $RAND_IDX = array_rand($BANNERSARRAY);
+ $BANNERTOSHOW = $BANNERSARRAY[$RAND_IDX]['id'];
- $query = "SELECT * FROM " . $DBPrefix . "banners WHERE id = :banner_id";
- $params = array();
- $params[] = array(':banner_id', $BANNERTOSHOW, 'int');
- $db->query($query, $params);
- $THISBANNER = $db->result();
- if ($THISBANNER['type'] == 'swf') {
- $return .= '
+ $query = "SELECT * FROM " . $DBPrefix . "banners WHERE id = :banner_id";
+ $params = array();
+ $params[] = array(':banner_id', $BANNERTOSHOW, 'int');
+ $db->query($query, $params);
+ $THISBANNER = $db->result();
+ if ($THISBANNER['type'] == 'swf')
+ {
+ $return .= '
';
- } else {
- $return .= '
+ }
+ else
+ {
+ $return .= '
';
- }
- if (!empty($THISBANNER['sponsortext'])) {
- $return .= '' . $THISBANNER['sponsortext'] . ' ';
- }
- // Update views
- $query = "UPDATE " . $DBPrefix . "banners set views = views + 1 WHERE id = :banner_id";
- $params = array();
- $params[] = array(':banner_id', $THISBANNER['id'], 'int');
- $db->query($query, $params);
- }
- return $return;
- }
+ }
+ if (!empty($THISBANNER['sponsortext']))
+ {
+ $return .= '' . $THISBANNER['sponsortext'] . ' ';
+ }
+ // Update views
+ $query = "UPDATE " . $DBPrefix . "banners set views = views + 1 WHERE id = :banner_id";
+ $params = array();
+ $params[] = array(':banner_id', $THISBANNER['id'], 'int');
+ $db->query($query, $params);
+ }
+ return $return;
+ }
}
function build_keyword_sql($array)
{
- $query = '(';
- if (is_array($array)) {
- $i = 0;
- foreach ($array as $val) {
- if ($i > 0) {
- $query .= ' OR ';
- }
- $query .= "k.keyword LIKE '%" . $val . "%'";
- $i++;
- }
- } else {
- $query .= "k.keyword LIKE '%" . $array . "%'";
- }
- $query .= ')';
- return $query;
-}
+ $query = '(';
+ if (is_array($array))
+ {
+ $i = 0;
+ foreach($array as $val)
+ {
+ if ($i > 0)
+ $query .= ' OR ';
+ $query .= "k.keyword LIKE '%" . $val . "%'";
+ $i++;
+ }
+ }
+ else
+ {
+ $query .= "k.keyword LIKE '%" . $array . "%'";
+ }
+ $query .= ')';
+ return $query;
+}
\ No newline at end of file
diff --git a/includes/functions_cron.php b/includes/functions_cron.php
old mode 100644
new mode 100755
index 79cc89ce5..3b26671f9
--- a/includes/functions_cron.php
+++ b/includes/functions_cron.php
@@ -1,6 +1,6 @@
log('cron', $str);
- }
+ if (defined('LogCron') && LogCron == true)
+ {
+ $system->log('cron', $str);
+ }
}
function printLogL($str, $level)
{
- for ($i = 1; $i <= $level; ++$i) {
- $str = "\t" . $str;
- }
- printLog($str);
+ for ($i = 1; $i <= $level; ++$i)
+ $str = "\t" . $str;
+ printLog($str);
}
function constructCategories()
{
- global $DBPrefix, $db;
+ global $DBPrefix, $db;
- $query = "SELECT cat_id, parent_id, sub_counter, counter
+ $query = "SELECT cat_id, parent_id, sub_counter, counter
FROM " . $DBPrefix . "categories ORDER BY cat_id";
- $db->direct_query($query);
-
- while ($row = $db->fetch()) {
- $row['updated'] = false;
- $categories[$row['cat_id']] = $row;
- }
- return $categories;
+ $db->direct_query($query);
+
+ while ($row = $db->fetch())
+ {
+ $row['updated'] = false;
+ $categories[$row['cat_id']] = $row;
+ }
+ return $categories;
}
-function sendWatchEmails($id, $title)
+function sendWatchEmails($id)
{
- global $DBPrefix, $system, $db, $MSG;
-
- $query = "SELECT name, email, item_watch, id FROM " . $DBPrefix . "users WHERE item_watch LIKE :item_watch";
- $params = array();
- $params[] = array(':item_watch', '% ' . $id . ' %', 'str');
- $db->query($query, $params);
-
- while ($watchusers = $db->fetch()) {
- $keys = explode(' ', $watchusers['item_watch']);
- // If keyword matches with opened auction title or/and desc send user a mail
- if (in_array($id, $keys)) {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'URL' => $system->SETTINGS['siteurl'] . 'item.php?mode=1&id=' . $id,
- 'TITLE' => htmlspecialchars($title),
- 'NAME' => $watchusers['name']
- ));
- $emailer->email_uid = $watchusers['id'];
- $emailer->email_sender($watchusers['email'], 'auctionend_watchmail.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['471']);
- }
- }
+ global $DBPrefix, $system, $db;
+
+ $query = "SELECT name, email, item_watch, id FROM " . $DBPrefix . "users WHERE item_watch LIKE :item_watch";
+ $params = array();
+ $params[] = array(':item_watch', '% ' . $id . ' %', 'str');
+ $db->query($query, $params);
+
+ while ($watchusers = $db->fetch())
+ {
+ $keys = explode(' ', $watchusers['item_watch']);
+ // If keyword matches with opened auction title or/and desc send user a mail
+ if (in_array($id, $keys))
+ {
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'URL' => $system->SETTINGS['siteurl'] . 'item.php?mode=1&id=' . $id,
+ 'TITLE' => htmlspecialchars($Auction['title']),
+ 'NAME' => $watchusers['name']
+ ));
+ $emailer->email_uid = $watchusers['id'];
+ $emailer->email_sender($watchusers['email'], 'auctionend_watchmail.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['471']);
+ }
+ }
}
function sortFees()
{
- global $DBPrefix, $system, $Winner, $Seller, $Auction, $buyer_emails;
- global $endauc_fee, $buyer_fee, $buyer_fee_type, $bf_paid, $ff_paid, $db;
-
- if ($buyer_fee > 0) {
- // is the winner fee exempt
- $query = "SELECT COUNT(no_fees) As no_fees FROM " . $DBPrefix . "groups WHERE id IN (" . $Winner['groups'] . ") AND no_fees = 1";
- $db->direct_query($query);
- $winner_no_fees = $db->result('no_fees');
-
- if (!$winner_no_fees) {
- if ($system->SETTINGS['fee_type'] == 1) {
- if ($buyer_fee_type == 'flat') {
- $fee_value = $buyer_fee;
- } else {
- $fee_value = ($buyer_fee / 100) * floatval($Auction['current_bid']);
- }
- // add balance & invoice
- $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :buyer_fee WHERE id = :winner_id";
- $params = array();
- $params[] = array(':buyer_fee', $fee_value, 'float');
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $db->query($query, $params);
- $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, buyer, total, paid)
- VALUES (:winner_id, :auc_id, :buyer_fee, :buyer_fee, 1)";
- $params = array();
- $params[] = array(':buyer_fee', $fee_value, 'float');
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- } elseif ($system->SETTINGS['fee_type'] == 2) {
- $bf_paid = 0;
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 6 WHERE id = :winner_id";
- $params = array();
- $params[] = array(':winner_id', $Winner['id'], 'int');
- $db->query($query, $params);
- $buyer_emails[] = array(
- 'name' => $Winner['name'],
- 'email' => $Winner['email'],
- 'uid' => $Winner['id'],
- 'id' => $Auction['id'],
- 'title' => htmlspecialchars($Auction['title'])
- );
- }
- }
- }
-
- $fee_value = 0;
- for ($i = 0; $i < count($endauc_fee); $i++) {
- if ($Auction['current_bid'] >= $endauc_fee[$i]['fee_from'] && $Auction['current_bid'] <= $endauc_fee[$i]['fee_to']) {
- if ($endauc_fee[$i]['fee_type'] == 'flat') {
- $fee_value = $endauc_fee[$i]['value'];
- } else {
- $fee_value = ($endauc_fee[$i]['value'] / 100) * $Auction['current_bid'];
- }
- }
- }
-
- if ($fee_value > 0) {
- // is the seller fee exempt
- $query = "SELECT COUNT(no_fees) As no_fees FROM " . $DBPrefix . "groups WHERE id IN (" . $Seller['groups'] . ") AND no_fees = 1";
- $db->direct_query($query);
- $seller_no_fees = $db->result('no_fees');
-
- if (!$seller_no_fees) {
- // insert final value fees
- if ($system->SETTINGS['fee_type'] == 1) {
- // add balance & invoice
- $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :seller_id";
- $params = array();
- $params[] = array(':fee_value', $fee_value, 'float');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $db->query($query, $params);
- $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, finalval, total, paid)
- VALUES (:seller_id, :auc_id, :fee_value, :fee_value, 1)";
- $params = array();
- $params[] = array(':fee_value', $fee_value, 'float');
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $params[] = array(':auc_id', $Auction['id'], 'int');
- $db->query($query, $params);
- } elseif ($system->SETTINGS['fee_type'] == 2) {
- $ff_paid = 0;
- $query = "UPDATE " . $DBPrefix . "users SET suspended = 5 WHERE id = :seller_id";
- $params = array();
- $params[] = array(':seller_id', $Seller['id'], 'int');
- $db->query($query, $params);
- $seller_emails[] = array(
- 'name' => $Seller['name'],
- 'email' => $Seller['email'],
- 'uid' => $Seller['id'],
- 'id' => $Auction['id'],
- 'title' => htmlspecialchars($Auction['title'])
- );
- }
- }
- }
+ global $DBPrefix, $system, $Winner, $Seller, $Auction, $buyer_emails;
+ global $endauc_fee, $buyer_fee, $buyer_fee_type, $bf_paid, $ff_paid, $NOW, $db;
+
+ if ($system->SETTINGS['fee_type'] == 1 && $buyer_fee > 0)
+ {
+ if ($buyer_fee_type == 'flat')
+ {
+ $fee_value = $buyer_fee;
+ }
+ else
+ {
+ $fee_value = ($buyer_fee / 100) * floatval($Auction['current_bid']);
+ }
+ // add balance & invoice
+ $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :buyer_fee WHERE id = :winner_id";
+ $params = array();
+ $params[] = array(':buyer_fee', $fee_value, 'float');
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $db->query($query, $params);
+ $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, date, buyer, total, paid) VALUES
+ (:winner_id, :auc_id, :time, :buyer_fee, :buyer_fee, 1)";
+ $params = array();
+ $params[] = array(':buyer_fee', $fee_value, 'float');
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $params[] = array(':auc_id', $user_id, 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $db->query($query, $params);
+ }
+ elseif ($system->SETTINGS['fee_type'] == 2)
+ {
+ $bf_paid = 0;
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 6 WHERE id = :winner_id";
+ $params = array();
+ $params[] = array(':winner_id', $Winner['id'], 'int');
+ $db->query($query, $params);
+ $buyer_emails[] = array(
+ 'name' => $Winner['name'],
+ 'email' => $Winner['email'],
+ 'uid' => $Winner['id'],
+ 'id' => $Auction['id'],
+ 'title' => htmlspecialchars($Auction['title'])
+ );
+ }
+
+ $fee_value = 0;
+ for ($i = 0; $i < count($endauc_fee); $i++)
+ {
+ if ($Auction['current_bid'] >= $endauc_fee[$i]['fee_from'] && $Auction['current_bid'] <= $endauc_fee[$i]['fee_to'])
+ {
+ if ($endauc_fee[$i]['fee_type'] == 'flat')
+ {
+ $fee_value = $endauc_fee[$i]['value'];
+ }
+ else
+ {
+ $fee_value = ($endauc_fee[$i]['value'] / 100) * $Auction['current_bid'];
+ }
+ }
+ }
+
+ // insert final value fees
+ if ($system->SETTINGS['fee_type'] == 1 && $fee_value > 0)
+ {
+ // add balance & invoice
+ $query = "UPDATE " . $DBPrefix . "users SET balance = balance - :fee_value WHERE id = :seller_id";
+ $params = array();
+ $params[] = array(':fee_value', $fee_value, 'float');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $db->query($query, $params);
+ $query = "INSERT INTO " . $DBPrefix . "useraccounts (user_id, auc_id, date, finalval, total, paid) VALUES
+ (:seller_id, :auc_id, :time, :fee_value, :fee_value, 1)";
+ $params = array();
+ $params[] = array(':fee_value', $fee_value, 'float');
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $params[] = array(':auc_id', $Auction['id'], 'int');
+ $params[] = array(':time', $NOW, 'int');
+ $db->query($query, $params);
+ }
+ elseif ($system->SETTINGS['fee_type'] == 2)
+ {
+ $ff_paid = 0;
+ $query = "UPDATE " . $DBPrefix . "users SET suspended = 5 WHERE id = :seller_id";
+ $params = array();
+ $params[] = array(':seller_id', $Seller['id'], 'int');
+ $db->query($query, $params);
+ $seller_emails[] = array(
+ 'name' => $Seller['name'],
+ 'email' => $Seller['email'],
+ 'uid' => $Seller['id'],
+ 'id' => $Auction['id'],
+ 'title' => htmlspecialchars($Auction['title'])
+ );
+ }
}
diff --git a/includes/functions_global.php b/includes/functions_global.php
old mode 100644
new mode 100755
index 1e751f8ec..daa848d8c
--- a/includes/functions_global.php
+++ b/includes/functions_global.php
@@ -1,6 +1,6 @@
loadsettings();
- $this->tdiff = $this->getUserOffset(time(), $this->SETTINGS['timezone']);
- $this->ctime = $this->getUserTimestamp(time(), $this->SETTINGS['timezone']) + $this->tdiff;
- // check install directory
- if (is_dir(MAIN_PATH . 'install')) {
- if (!$this->check_maintenance_mode()) { // check maint mode
- echo 'please delete the install directory';
- exit;
- }
- }
-
- // Check ip
- if (!defined('ErrorPage') && !defined('InAdmin')) {
- $query = "SELECT id FROM " . $DBPrefix . "usersips WHERE ip = :user_ip AND action = 'deny'";
- $params = array();
- $params[] = array(':user_ip', $_SERVER['REMOTE_ADDR'], 'str');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $_SESSION['msg_title'] = $MSG['2_0027'];
- $_SESSION['msg_body'] = $MSG['2_0026'];
- header('location: message.php');
- exit;
- }
- }
- }
-
- public function loadsettings()
- {
- global $DBPrefix, $db;
- $query = "SELECT * FROM " . $DBPrefix . "settings";
- $db->direct_query($query);
-
- while ($settingv2 = $db->fetch()) {
- $this->SETTINGS[$settingv2['fieldname']] = $settingv2['value'];
- }
- // check if url needs https
- if ($this->SETTINGS['https'] == 'y') {
- $this->SETTINGS['siteurl'] = (!empty($this->SETTINGS['https_url'])) ? $this->SETTINGS['https_url'] : 'https://' . $this->cleanSiteUrl();
- }
- }
-
- public function cleanSiteUrl()
- {
- return str_replace(['http://', 'https://'], '', $this->SETTINGS['siteurl']);
- }
-
- public function loadAuctionTypes()
- {
- global $MSG, $db, $DBPrefix;
- $query = "SELECT id, language_string FROM " . $DBPrefix . "auction_types";
- $db->direct_query($query);
- $this->SETTINGS['auction_types'] = [];
- while ($row = $db->fetch()) {
- $this->SETTINGS['auction_types'][$row['id']] = $MSG[$row['language_string']];
- }
- }
-
- /*
- accepts either simple or array input
- simple:
- writesetting('setting_name', 'setting_value', 'string');
- array:
- writesetting(array(
- array('some_setting_name', 'some_setting_value', 'string'),
- array('another_setting_name', 'another_setting_value', 'string')
- ));
- */
- public function writesetting($settings, $value = '', $type = 'string')
- {
- global $system, $DBPrefix, $db, $_SESSION;
-
- $modifiedby = $_SESSION['WEBID_ADMIN_IN'];
- $modifieddate = $this->ctime;
-
- if (is_string($settings)) {
- $settings = array(array($settings, $value, $type));
- }
-
- foreach ($settings as $setting) {
- // check arguments are set
- if (!isset($setting[0]) || !isset($setting[1])) {
- continue;
- }
- $setting[2] = (isset($setting[2])) ? $setting[2] : 'string';
-
- $fieldname = $setting[0];
- $value = $setting[1];
- $type = $setting[2];
-
- // TODO: Use the data type to check if the value is valid
- switch ($type) {
- case "string":
- case "str":
- break;
- case "integer":
- case "int":
- $value = intval($value);
- break;
- case "boolean":
- case "bool":
- $value = ($value) ? 1 : 0;
- break;
- case "array":
- $value = serialize($value);
- break;
- default:
- break;
- }
-
- $query = "SELECT * FROM " . $DBPrefix . "settings WHERE fieldname = :fieldname";
- $params = array();
- $params[] = array(':fieldname', $fieldname, 'str');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- $type = $db->result('fieldtype');
- $query = "UPDATE " . $DBPrefix . "settings SET
- fieldtype = :fieldtype,
- value = :value,
- modifieddate = :modifieddate,
- modifiedby = :modifiedby
- WHERE fieldname = :fieldname";
- } else {
- $query = "INSERT INTO " . $DBPrefix . "settings (fieldname, fieldtype, value, modifieddate, modifiedby) VALUES
- (:fieldname, :fieldtype, :value, :modifieddate, :modifiedby)";
- }
- $params = array();
- $params[] = array(':fieldname', $fieldname, 'str');
- $params[] = array(':fieldtype', $type, 'str');
- $params[] = array(':value', $value, 'str');
- $params[] = array(':modifieddate', $modifieddate, 'int');
- $params[] = array(':modifiedby', $modifiedby, 'int');
- $db->query($query, $params);
- $system->SETTINGS[$fieldname] = $value;
- }
- }
-
- /* possible types cron, error, admin, user, mod */
- public function log($type, $message, $user = 0, $action_id = 0)
- {
- global $DBPrefix, $db;
- $query = "INSERT INTO " . $DBPrefix . "logs (type, message, ip, action_id, user_id) VALUES
- (:type, :message, :user_ip, :action_id, :user_id)";
- $params = array();
- $params[] = array(':type', $type, 'str');
- $params[] = array(':message', $message, 'str');
- $params[] = array(':user_ip', $_SERVER['REMOTE_ADDR'], 'str');
- $params[] = array(':action_id', $action_id, 'int');
- $params[] = array(':user_id', $user, 'int');
- $db->query($query, $params);
- }
-
- public function check_maintenance_mode()
- {
- global $user;
-
- if ($this->SETTINGS['maintenance_mode_active']) {
- if ($user->logged_in && ($user->user_data['nick'] == $this->SETTINGS['superuser'] || $user->user_data['id'] == $this->SETTINGS['superuser'])) {
- return false;
- }
- return true;
- }
-
- return false;
- }
-
- public function cleanvars($input, $allow_html = false)
- {
- $config = array('elements' => '-*');
-
- if ($allow_html) {
- $config = array('safe' => 1, 'elements' => 'a, ol, ul, li, u, strong, em, br, p', 'deny_attribute' => '* -href');
- }
-
- return str_replace(array('<', '>', '&'), array('<', '>', '&'), htmLawed($input, $config));
- }
-
- public function filter($txt)
- {
- global $DBPrefix, $db;
- $query = "SELECT * FROM " . $DBPrefix . "filterwords";
- $db->direct_query($query);
- $result = $txt;
- while ($word = $db->fetch()) {
- $result = str_ireplace($word['word'], '', $result);
- }
- return $result;
- }
-
- public function move_file($from, $to, $removeorg = true)
- {
- $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy';
- // error check
- if (!is_file($from)) {
- return false;
- }
- switch ($upload_mode) {
- case 'copy':
- if (@copy($from, $to)) {
- if (!@move_uploaded_file($from, $to)) {
- return false;
- }
- }
- if ($removeorg) {
- @unlink($from);
- }
- break;
-
- case 'move':
- if (!@move_uploaded_file($from, $to)) {
- if (!@copy($from, $to)) {
- return false;
- }
- }
- if ($removeorg) {
- @unlink($from);
- }
- break;
- }
- @chmod($to, 0666);
- return true;
- }
-
- // time zones
- public function getConvertedDateTimeObject($timestamp, $userTimezone)
- {
- # create server and user timezone objects
- $fromZone = new DateTimeZone('UTC'); // UTC
- $toZone = new DateTimeZone($userTimezone); // Europe/London, or whatever it happens to be
-
- $time = date('Y-m-d H:i:s', $timestamp);
- $dt = new DateTime($time, $fromZone);
- $dt->setTimezone($toZone);
- return $dt;
- }
-
- public function getUserTimestamp($timestamp, $userTimezone)
- {
- $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
- return $dt->getTimestamp();
- }
-
- public function getUserOffset($timestamp, $userTimezone)
- {
- $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
- return $dt->getOffset();
- }
-
- //CURRENCY FUNCTIONS
- public function input_money($str)
- {
- if (empty($str)) {
- return 0;
- }
-
- $str = preg_replace("/[^0-9\.\,\-]/", '', $str);
- if ($this->SETTINGS['moneyformat'] == 1) {
- // Drop thousands separator
- $str = str_replace(',', '', $str);
- } elseif ($this->SETTINGS['moneyformat'] == 2) {
- // Drop thousands separator
- $str = str_replace('.', '', $str);
-
- // Change decimals separator
- $str = str_replace(',', '.', $str);
- }
-
- return floatval($str);
- }
-
- public function CheckMoney($amount)
- {
- if ($this->SETTINGS['moneyformat'] == 1) {
- if (!preg_match('#^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(\.[0-9]{0,3})?$#', $amount)) {
- return false;
- }
- } else {
- if (!preg_match('#^([0-9]+|[0-9]{1,3}(\.[0-9]{3})*)(,[0-9]{0,3})?$#', $amount)) {
- return false;
- }
- }
- return true;
- }
-
- public function print_money($str, $from_database = true, $bold = true)
- {
- $str = $this->print_money_nosymbol($str, $from_database);
- $currency = $this->SETTINGS['currency'];
-
- if ($bold) {
- $str = '' . $str . ' ';
- }
-
- if ($this->SETTINGS['moneysymbol'] == 2) { // Symbol on the right
- return $str . ' ' . $currency;
- } else { // Symbol on the left
- return $currency . ' ' . $str;
- }
- }
-
- public function print_money_nosymbol($str, $from_database = true)
- {
- $a = ($this->SETTINGS['moneyformat'] == 1) ? '.' : ',';
- $b = ($this->SETTINGS['moneyformat'] == 1) ? ',' : '.';
- if (!$from_database) {
- $str = $this->input_money($str);
- }
-
- return number_format(floatval($str), $this->SETTINGS['moneydecimals'], $a, $b);
- }
+ var $SETTINGS, $ctime, $tdiff;
+
+ function __construct()
+ {
+ global $DBPrefix, $db;
+
+ // Load settings
+ $this->loadsettings();
+ $this->tdiff = $this->getUserOffset(time(), $this->SETTINGS['timezone']);
+ $this->ctime = $this->getUserTimestamp(time(), $this->SETTINGS['timezone']) + $this->tdiff;
+ // check install directory
+ if (is_dir(MAIN_PATH . 'install'))
+ {
+ if (!$this->check_maintainance_mode()) // check maint mode
+ {
+ echo 'please delete the install directory';
+ exit;
+ }
+ }
+
+ // Check ip
+ if (!defined('ErrorPage') && !defined('InAdmin'))
+ {
+ $query = "SELECT id FROM " . $DBPrefix . "usersips WHERE ip = :user_ip AND action = 'deny'";
+ $params = array();
+ $params[] = array(':user_ip', $_SERVER['REMOTE_ADDR'], 'str');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $_SESSION['msg_title'] = $MSG['2_0027'];
+ $_SESSION['msg_body'] = $MSG['2_0026'];
+ header('location: message.php');
+ exit;
+ }
+ }
+ }
+
+ function loadsettings()
+ {
+ global $DBPrefix, $db;
+ $query = "SELECT * FROM " . $DBPrefix . "settings";
+ $db->direct_query($query);
+
+ while ($settingv2 = $db->fetch())
+ {
+ $this->SETTINGS[$settingv2['fieldname']] = $settingv2['value'];
+ }
+ // check if url needs https
+ if ($this->SETTINGS['https'] == 'y')
+ {
+ $this->SETTINGS['siteurl'] = (!empty($this->SETTINGS['https_url'])) ? $this->SETTINGS['https_url'] : str_replace('http://', 'https://', $this->SETTINGS['siteurl']);
+ }
+ }
+
+ public function loadAuctionTypes()
+ {
+ global $MSG, $db, $DBPrefix;
+ $query = "SELECT id, language_string FROM " . $DBPrefix . "auction_types";
+ $db->direct_query($query);
+ $this->SETTINGS['auction_types'] = [];
+ while ($row = $db->fetch())
+ {
+ $this->SETTINGS['auction_types'][$row['id']] = $MSG[$row['language_string']];
+ }
+ }
+
+ /*
+ accepts either simple or array input
+ simple:
+ writesetting('setting_name', 'setting_value', 'string');
+ array:
+ writesetting(array(
+ array('some_setting_name', 'some_setting_value', 'string'),
+ array('another_setting_name', 'another_setting_value', 'string')
+ ));
+ */
+ function writesetting($settings, $value = '', $type = 'string')
+ {
+ global $system, $DBPrefix, $db, $_SESSION;
+
+ $modifiedby = $_SESSION['WEBID_ADMIN_IN'];
+ $modifieddate = $this->ctime;
+
+ if (is_string($settings))
+ {
+ $settings = array(array($settings, $value, $type));
+ }
+
+ foreach ($settings as $setting)
+ {
+ // check arguments are set
+ if (!isset($setting[0]) || !isset($setting[1]))
+ {
+ continue;
+ }
+ $setting[2] = (isset($setting[2])) ? $setting[2] : 'string';
+
+ $fieldname = $setting[0];
+ $value = $setting[1];
+ $type = $setting[2];
+
+ // TODO: Use the data type to check if the value is valid
+ switch($type)
+ {
+ case "string":
+ case "str":
+ break;
+ case "integer":
+ case "int":
+ $value = intval($value);
+ break;
+ case "boolean":
+ case "bool":
+ $value = ($value) ? 1 : 0;
+ break;
+ case "array":
+ $value = serialize($value);
+ break;
+ default:
+ break;
+ }
+
+ $query = "SELECT * FROM " . $DBPrefix . "settings WHERE fieldname = :fieldname";
+ $params = array();
+ $params[] = array(':fieldname', $fieldname, 'str');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ $type = $db->result('fieldtype');
+ $query = "UPDATE " . $DBPrefix . "settings SET
+ fieldtype = :fieldtype,
+ value = :value,
+ modifieddate = :modifieddate,
+ modifiedby = :modifiedby
+ WHERE fieldname = :fieldname";
+ }
+ else
+ {
+ $query = "INSERT INTO " . $DBPrefix . "settings (fieldname, fieldtype, value, modifieddate, modifiedby) VALUES
+ (:fieldname, :fieldtype, :value, :modifieddate, :modifiedby)";
+ }
+ $params = array();
+ $params[] = array(':fieldname', $fieldname, 'str');
+ $params[] = array(':fieldtype', $type, 'str');
+ $params[] = array(':value', $value, 'str');
+ $params[] = array(':modifieddate', $modifieddate, 'int');
+ $params[] = array(':modifiedby', $modifiedby, 'int');
+ $db->query($query, $params);
+ $system->SETTINGS[$fieldname] = $value;
+ }
+ }
+
+ /* possible types cron, error, admin, user, mod */
+ function log($type, $message, $user = 0, $action_id = 0)
+ {
+ global $DBPrefix, $db;
+ $query = "INSERT INTO " . $DBPrefix . "logs (type, message, ip, action_id, user_id, timestamp) VALUES
+ (:type, :message, :user_ip, :action_id, :user_id, :time)";
+ $params = array();
+ $params[] = array(':type', $type, 'str');
+ $params[] = array(':message', $message, 'str');
+ $params[] = array(':user_ip', $_SERVER['REMOTE_ADDR'], 'str');
+ $params[] = array(':action_id', $action_id, 'int');
+ $params[] = array(':user_id', $user, 'int');
+ $params[] = array(':time', time(), 'int');
+ $db->query($query, $params);
+ }
+
+ function check_maintainance_mode()
+ {
+ global $user;
+
+ if ($this->SETTINGS['maintainance_mode_active'])
+ {
+ if ($user->logged_in && ($user->user_data['nick'] == $this->SETTINGS['superuser'] || $user->user_data['id'] == $this->SETTINGS['superuser']))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ function cleanvars($input, $allow_html = false)
+ {
+ $config = array('elements' => '-*');
+
+ if ($allow_html)
+ {
+ $config = array('safe' => 1, 'elements' => 'a, ol, ul, li, u, strong, em, br, p', 'deny_attribute' => '* -href');
+ }
+
+ return str_replace(array('<', '>', '&'), array('<', '>', '&'), htmLawed($input, $config));
+ }
+
+ function filter($txt)
+ {
+ global $DBPrefix, $db;
+ $query = "SELECT * FROM " . $DBPrefix . "filterwords";
+ $db->direct_query($query);
+ while ($word = $db->fetch())
+ {
+ $txt = preg_replace('(' . $word['word'] . ')', '', $txt); //best to use str_ireplace but not avalible for PHP4
+ }
+ return $txt;
+ }
+
+ function move_file($from, $to, $removeorg = true)
+ {
+ $upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') ? 'move' : 'copy';
+ // error check
+ if (!is_file($from))
+ {
+ return false;
+ }
+ switch ($upload_mode)
+ {
+ case 'copy':
+ if (@copy($from, $to))
+ {
+ if (!@move_uploaded_file($from, $to))
+ {
+ return false;
+ }
+ }
+ if ($removeorg)
+ @unlink($from);
+ break;
+
+ case 'move':
+ if (!@move_uploaded_file($from, $to))
+ {
+ if (!@copy($from, $to))
+ {
+ return false;
+ }
+ }
+ if ($removeorg)
+ @unlink($from);
+ break;
+ }
+ @chmod($to, 0666);
+ return true;
+ }
+
+ // time zones
+ function getConvertedDateTimeObject($timestamp, $userTimezone)
+ {
+ # create server and user timezone objects
+ $fromZone = new DateTimeZone('UTC'); // UTC
+ $toZone = new DateTimeZone($userTimezone); // Europe/London, or whatever it happens to be
+
+ $time = date('Y-m-d H:i:s', $timestamp);
+ $dt = new DateTime($time, $fromZone);
+ $dt->setTimezone($toZone);
+ return $dt;
+ }
+
+ function getUserTimestamp($timestamp, $userTimezone)
+ {
+ $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
+ return $dt->getTimestamp();
+ }
+
+ function getUserOffset($timestamp, $userTimezone)
+ {
+ $dt = $this->getConvertedDateTimeObject($timestamp, $userTimezone);
+ return $dt->getOffset();
+ }
+
+ //CURRENCY FUNCTIONS
+ function input_money($str)
+ {
+ if (empty($str))
+ return 0;
+
+ $str = preg_replace("/[^0-9\.\,\-]/", '', $str);
+ if ($this->SETTINGS['moneyformat'] == 1)
+ {
+ // Drop thousands separator
+ $str = str_replace(',', '', $str);
+ }
+ elseif ($this->SETTINGS['moneyformat'] == 2)
+ {
+ // Drop thousands separator
+ $str = str_replace('.', '', $str);
+
+ // Change decimals separator
+ $str = str_replace(',', '.', $str);
+ }
+
+ return floatval($str);
+ }
+
+ function CheckMoney($amount)
+ {
+ if ($this->SETTINGS['moneyformat'] == 1)
+ {
+ if (!preg_match('#^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(\.[0-9]{0,3})?$#', $amount))
+ return false;
+ }
+ else
+ {
+ if (!preg_match('#^([0-9]+|[0-9]{1,3}(\.[0-9]{3})*)(,[0-9]{0,3})?$#', $amount))
+ return false;
+ }
+ return true;
+ }
+
+ function print_money($str, $from_database = true, $bold = true)
+ {
+ $str = $this->print_money_nosymbol($str, $from_database);
+ $currency = $this->SETTINGS['currency'];
+
+ if ($bold)
+ {
+ $str = '' . $str . ' ';
+ }
+
+ if ($this->SETTINGS['moneysymbol'] == 2) // Symbol on the right
+ {
+ return $str . ' ' . $currency;
+ }
+ elseif ($this->SETTINGS['moneysymbol'] == 1) // Symbol on the left
+ {
+ return $currency . ' ' . $str;
+ }
+ }
+
+ function print_money_nosymbol($str, $from_database = true)
+ {
+ $a = ($this->SETTINGS['moneyformat'] == 1) ? '.' : ',';
+ $b = ($this->SETTINGS['moneyformat'] == 1) ? ',' : '.';
+ if (!$from_database)
+ {
+ $str = $this->input_money($str);
+ }
+
+ return number_format(floatval($str), $this->SETTINGS['moneydecimals'], $a, $b);
+ }
}
// global functions
function _mktime($hr, $min, $sec, $mon, $day, $year)
{
- global $system;
- if ($system->SETTINGS['datesformat'] != 'USA') {
- $mon_ = $mon;
- $mon = $day;
- $day = $mon_;
- }
-
- return mktime($hr, $min, $sec, $mon, $day, $year);
+ global $system;
+ if ($system->SETTINGS['datesformat'] != 'USA')
+ {
+ $mon_ = $mon;
+ $mon = $day;
+ $day = $mon_;
+ }
+
+ return mktime($hr, $min, $sec, $mon, $day, $year);
}
function load_counters()
{
- global $system, $DBPrefix, $MSG, $_COOKIE, $user, $db;
- $query = "SELECT * FROM " . $DBPrefix . "counters";
- $db->direct_query($query);
- $counter_data = $db->result();
- $counters = '';
-
- if ($system->SETTINGS['counter_auctions'] == 'y') {
- $counters .= '' . $counter_data['auctions'] . ' ' . strtoupper($MSG['232']) . '| ';
- }
- if ($system->SETTINGS['counter_users'] == 'y') {
- $counters .= '' . $counter_data['users'] . ' ' . strtoupper($MSG['231']) . ' | ';
- }
- if ($system->SETTINGS['counter_online'] == 'y') {
- if (!$user->logged_in) {
- if (!isset($_COOKIE['WEBID_ONLINE'])) {
- $s = md5(rand(0, 99) . session_id());
- setcookie('WEBID_ONLINE', $s, time() + 900);
- } else {
- $s = alphanumeric($_COOKIE['WEBID_ONLINE']);
- setcookie('WEBID_ONLINE', $s, time() + 900);
- }
- } else {
- $s = 'uId-' . $user->user_data['id'];
- }
- $query = "SELECT ID FROM " . $DBPrefix . "online WHERE SESSION = :user";
- $params = array();
- $params[] = array(':user', $s, 'str');
- $db->query($query, $params);
-
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "online (SESSION) VALUES (:user)";
- $params = array();
- $params[] = array(':user', $s, 'str');
- $db->query($query, $params);
- } else {
- $oID = $db->result('ID');
- $query = "UPDATE " . $DBPrefix . "online SET time = CURRENT_TIMESTAMP WHERE ID = :online_id";
- $params = array();
- $params[] = array(':online_id', $oID, 'int');
- $db->query($query, $params);
- }
- $query = "DELETE from " . $DBPrefix . "online WHERE time <= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 15 MINUTE)";
- $db->direct_query($query);
-
- $query = "SELECT id FROM " . $DBPrefix . "online";
- $db->direct_query($query);
-
- $count15min = $db->numrows();
-
- $counters .= '' . $count15min . ' ' . $MSG['2__0064'] . ' | ';
- }
-
- // Display current Date/Time
- $mth = 'MON_0' . date('m', $system->ctime);
- $date = $MSG[$mth] . date(' j, Y', $system->ctime);
- $counters .= $date . ' ' . date('H:i:s', $system->ctime) . ' ';
- return $counters;
+ global $system, $DBPrefix, $MSG, $_COOKIE, $user, $db;
+ $query = "SELECT * FROM " . $DBPrefix . "counters";
+ $db->direct_query($query);
+ $counter_data = $db->result();
+ $counters = '';
+
+ if ($system->SETTINGS['counter_auctions'] == 'y')
+ $counters .= '' . $counter_data['auctions'] . ' ' . strtoupper($MSG['232']) . '| ';
+ if ($system->SETTINGS['counter_users'] == 'y')
+ $counters .= '' . $counter_data['users'] . ' ' . strtoupper($MSG['231']) . ' | ';
+ if ($system->SETTINGS['counter_online'] == 'y')
+ {
+ if (!$user->logged_in)
+ {
+ if (!isset($_COOKIE['WEBID_ONLINE']))
+ {
+ $s = md5(rand(0, 99) . session_id());
+ setcookie('WEBID_ONLINE', $s, time() + 900);
+ }
+ else
+ {
+ $s = alphanumeric($_COOKIE['WEBID_ONLINE']);
+ setcookie('WEBID_ONLINE', $s, time() + 900);
+ }
+ }
+ else
+ {
+ $s = 'uId-' . $user->user_data['id'];
+ }
+ $uxtime = time();
+ $query = "SELECT ID FROM " . $DBPrefix . "online WHERE SESSION = :user";
+ $params = array();
+ $params[] = array(':user', $s, 'str');
+ $db->query($query, $params);
+
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "online (SESSION, time) VALUES (:user, :timer)";
+ $params = array();
+ $params[] = array(':user', $s, 'str');
+ $params[] = array(':timer', $uxtime, 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $oID = $db->result('ID');
+ $query = "UPDATE " . $DBPrefix . "online SET time = :timer WHERE ID = :online_id";
+ $params = array();
+ $params[] = array(':timer', $uxtime, 'int');
+ $params[] = array(':online_id', $oID, 'int');
+ $db->query($query, $params);
+ }
+ $deltime = $uxtime - 900;
+ $query = "DELETE from " . $DBPrefix . "online WHERE time <= :timer";
+ $params = array();
+ $params[] = array(':timer', $deltime, 'int');
+ $db->query($query, $params);
+
+ $query = "SELECT id FROM " . $DBPrefix . "online";
+ $db->direct_query($query);
+
+ $count15min = $db->numrows();
+
+ $counters .= '' . $count15min . ' ' . $MSG['2__0064'] . ' | ';
+ }
+
+ // Display current Date/Time
+ $mth = 'MON_0' . date('m', $system->ctime);
+ $date = $MSG[$mth] . date(' j, Y', $system->ctime);
+ $counters .= $date . ' ' . date('H:i:s', $system->ctime) . ' ';
+ return $counters;
}
function _in_array($needle, $haystack)
{
- $needle = "$needle"; //important turns integers into strings
- foreach ($haystack as $val) {
- if ($val == $needle) {
- return true;
- }
- }
- return false;
+ $needle = "$needle"; //important turns integers into strings
+ foreach ($haystack as $val)
+ {
+ if ($val == $needle)
+ return true;
+ }
+ return false;
}
// strip none alpha-numeric characters
function alphanumeric($str)
{
- $str = preg_replace("/[^a-zA-Z0-9\s]/", '', $str);
- return $str;
+ $str = preg_replace("/[^a-zA-Z0-9\s]/", '', $str);
+ return $str;
}
// $auction_data sould come straight from the database
function calculate_shipping_data($auction_data, $bought_quantity = 0, $total = true)
{
- if ($bought_quantity == 0) {
- $quantity = $auction_data['quantity'];
- } else {
- $quantity = $bought_quantity;
- }
-
- $shipping_cost = ($auction_data['shipping'] == 1) ? $auction_data['shipping_cost'] : 0;
- $additional_shipping_cost = $auction_data['additional_shipping_cost'] * ($quantity - 1);
-
- if ($total) {
- return ($shipping_cost + $additional_shipping_cost);
- } else {
- $shipping_data = array();
- $shipping_data['shipping_cost'] = $shipping_cost;
- $shipping_data['additional_shipping_cost'] = $additional_shipping_cost;
- $shipping_data['shipping_total'] = ($shipping_cost + $additional_shipping_cost);
- return $shipping_data;
- }
+ if ($bought_quantity == 0)
+ {
+ $quantity = $auction_data['quantity'];
+ }
+ else
+ {
+ $quantity = $bought_quantity;
+ }
+
+ $shipping_cost = ($auction_data['shipping'] == 1) ? $auction_data['shipping_cost'] : 0;
+ $additional_shipping_cost = $auction_data['additional_shipping_cost'] * ($quantity - 1);
+
+ if ($total)
+ {
+ return ($shipping_cost + $additional_shipping_cost);
+ }
+ else
+ {
+ $shipping_data = array();
+ $shipping_data['shipping_cost'] = $shipping_cost;
+ $shipping_data['additional_shipping_cost'] = $additional_shipping_cost;
+ $shipping_data['shipping_total'] = ($shipping_cost + $additional_shipping_cost);
+ return $shipping_data;
+ }
}
// TODO: this is a stupid way of doing things these need to be changed to bools
function ynbool($str)
{
- $str = preg_replace("/[^yn]/", '', $str);
- return $str;
+ $str = preg_replace("/[^yn]/", '', $str);
+ return $str;
}
// filters date format and date. Changes dd.mm.yyyy or dd/mm/yyyy to dd-mm-yyyy and validates date.
// Throws $ERR_700 if $dt is not a valid date or not 0. Returns valid and formatted date or 0.
function filter_date($dt, $separator = "-")
{
- global $system, $ERR, $ERR_700;
-
- if ($dt != 0) {
- $dt = preg_replace("([.]+)", $separator, $dt);
- $date = str_replace("/", $separator, $dt);
- if ($system->SETTINGS['datesformat'] == 'USA') {
- list($m, $d, $y) = array_pad(explode($separator, $date, 3), 3, 0);
- } else {
- list($d, $m, $y) = array_pad(explode($separator, $date, 3), 3, 0);
- }
- if (ctype_digit("$m$d$y") && checkdate($m, $d, $y)) {
- return $date;
- }
- $ERR = $ERR_700;
- }
- return 0;
+ global $system, $ERR, $ERR_700;
+
+ if ($dt != 0)
+ {
+ $dt = preg_replace("([.]+)", $separator, $dt);
+ $date = str_replace("/", $separator, $dt);
+ if ($system->SETTINGS['datesformat'] == 'USA')
+ {
+ list($m, $d, $y) = array_pad(explode($separator, $date, 3), 3, 0);
+ }
+ else
+ {
+ list($d, $m, $y) = array_pad(explode($separator, $date, 3), 3, 0);
+ }
+ if (ctype_digit("$m$d$y") && checkdate($m, $d, $y))
+ {
+ return $date;
+ }
+ $ERR = $ERR_700;
+ }
+ return 0;
}
function build_url($string)
{
- // TODO: make sure this works
- // clean it
- $string = preg_replace('/[^A-Za-z0-9=&]+/', '-', $string);
- // sprint the url into _GET elements
- $parts = explode('&', $string);
- $slug = '';
- foreach ($parts as $part) {
- // splits this=that
- $elements = explode('=', $part);
- $slug .= $elements[0];
- $slug .= '/';
- $slug .= $elements[1];
- $slug .= '/';
- }
-
- $slug = strtolower($slug);
- return $slug;
+ // TODO: make sure this works
+ // clean it
+ $string = preg_replace('/[^A-Za-z0-9=&]+/', '-', $string);
+ // sprint the url into _GET elements
+ $parts = explode('&', $string);
+ $slug = '';
+ foreach ($parts as $part)
+ {
+ // splits this=that
+ $elements = explode('=', $part);
+ $slug .= $elements[0];
+ $slug .= '/';
+ $slug .= $elements[1];
+ $slug .= '/';
+ }
+
+ $slug = strtolower ($slug);
+ return $slug;
}
diff --git a/includes/functions_invoices.php b/includes/functions_invoices.php
old mode 100644
new mode 100755
index 626e14c02..e8c3677d4
--- a/includes/functions_invoices.php
+++ b/includes/functions_invoices.php
@@ -1,6 +1,6 @@
query($query, $params);
- $result = $db->result();
- $address_data = array(
- 'nick' => $result['nick'],
- 'country' => $result['country'],
- );
- return $address_data;
+ global $DBPrefix, $db;
+
+ $query = "SELECT nick, country FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user_id, 'int');
+ $db->query($query, $params);
+ $result = $db->result();
+ $address_data = array(
+ 'nick' => $result['nick'],
+ 'country' => $result['country'],
+ );
+ return $address_data;
}
function getAddressWinner($user_id)
{
- global $DBPrefix, $db;
-
- $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user_id, 'int');
- $db->query($query, $params);
- $result = $db->result();
- $address_data = array(
- //'user_id' => $result['id'],
- 'nick' => $result['nick'],
- 'name' => $result['name'],
- 'company' => (isset($result['company'])) ? $result['company'] : '',
- 'address' => $result['address'],
- 'city' => $result['city'],
- 'prov' => $result['prov'],
- 'zip' => $result['zip'],
- 'country' => $result['country'],
- //'email' => $result['email'],
- );
- return $address_data;
+ global $DBPrefix, $db;
+
+ $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user_id, 'int');
+ $db->query($query, $params);
+ $result = $db->result();
+ $address_data = array(
+ //'user_id' => $result['id'],
+ 'nick' => $result['nick'],
+ 'name' => $result['name'],
+ 'company' => (isset($result['company'])) ? $result['company'] : '',
+ 'address' => $result['address'],
+ 'city' => $result['city'],
+ 'prov' => $result['prov'],
+ 'zip' => $result['zip'],
+ 'country' => $result['country'],
+ //'email' => $result['email'],
+ );
+ return $address_data;
}
function getTax($is_auction, $buyer_from, $seller_from = '')
{
- global $DBPrefix, $db;
-
- // build the query
- $query = "SELECT tax_rate FROM " . $DBPrefix . "tax WHERE countries_buyer LIKE '" . $buyer_from . "'";
- $query .= ($is_auction) ? " AND fee_tax = 0" : " AND fee_tax = 1";
- $query .= (!empty($seller_from)) ? " AND countries_seller LIKE '" . $seller_from . "'" : '';
- $db->direct_query($query);
-
- if ($db->numrows() == 0) {
- $tax_rate = 0;
- } else {
- $tax_rate = $db->result('tax_rate');
- }
-
- return $tax_rate;
+ global $DBPrefix, $db;
+
+ // build the query
+ $query = "SELECT tax_rate FROM " . $DBPrefix . "tax WHERE countries_buyer LIKE '" . $buyer_from . "'";
+ $query .= ($is_auction) ? " AND fee_tax = 0" : " AND fee_tax = 1";
+ $query .= (!empty($seller_from)) ? " AND countries_seller LIKE '" . $seller_from . "'" : '';
+ $db->direct_query($query);
+
+ if ($db->numrows() == 0)
+ {
+ $tax_rate = 0;
+ }
+ else
+ {
+ $tax_rate = $db->result('tax_rate');
+ }
+
+ return $tax_rate;
}
function setfeetemplate($data)
{
- global $template, $system, $MSG;
-
- $feenames = array(
- 'signup' => $MSG['430'],
- 'buyer' => $MSG['775'],
- 'setup' => $MSG['432'],
- 'featured' => $MSG['433'],
- 'bold' => $MSG['439'],
- 'highlighted' => $MSG['434'],
- 'subtitle' => $MSG['803'],
- 'extracat' => $MSG['804'],
- 'reserve' => $MSG['440'],
- 'picture' => $MSG['435'],
- 'relist' => $MSG['437'],
- 'buynow' => $MSG['436'],
- 'finalval' => $MSG['791'],
- 'balance' => $MSG['935']
- );
- $total = 0;
- $total_exculding = 0;
- foreach ($data as $k => $v) {
- if (isset($feenames[$k])) {
- if ($v > 0) {
- $excluding = vatexcluding($v);
- $total += $v;
- $total_exculding += $excluding;
- $template->assign_block_vars('fees', array(
- 'FEE' => $feenames[$k],
- 'UNIT_PRICE' => $system->print_money($excluding),
- 'UNIT_PRICE_WITH_TAX' => $system->print_money($v),
- 'TOTAL' => $system->print_money($total_exculding),
- 'TOTAL_WITH_TAX' => $system->print_money($total)
- ));
- }
- }
- }
- return array($total, $total_exculding);
+ global $template, $system, $MSG;
+
+ $feenames = array(
+ 'signup' => $MSG['430'],
+ 'buyer' => $MSG['775'],
+ 'setup' => $MSG['432'],
+ 'featured' => $MSG['433'],
+ 'bold' => $MSG['439'],
+ 'highlighted' => $MSG['434'],
+ 'subtitle' => $MSG['803'],
+ 'extracat' => $MSG['804'],
+ 'reserve' => $MSG['440'],
+ 'picture' => $MSG['435'],
+ 'relist' => $MSG['437'],
+ 'buynow' => $MSG['436'],
+ 'finalval' => $MSG['791'],
+ 'balance' => $MSG['935']
+ );
+ $total = 0;
+ $total_exculding = 0;
+ foreach ($data as $k => $v)
+ {
+ if (isset($feenames[$k]))
+ {
+ if ($v > 0)
+ {
+ $excluding = vatexcluding($v);
+ $total += $v;
+ $total_exculding += $excluding;
+ $template->assign_block_vars('fees', array(
+ 'FEE' => $feenames[$k],
+ 'UNIT_PRICE' => $system->print_money($excluding),
+ 'UNIT_PRICE_WITH_TAX' => $system->print_money($v),
+ 'TOTAL' => $system->print_money($total_exculding),
+ 'TOTAL_WITH_TAX' => $system->print_money($total)
+ ));
+ }
+ }
+ }
+ return array($total, $total_exculding);
}
// add vat
function vat($price)
{
- global $system, $vat;
- $price_with_vat = $price + ($vat * ($price / 100));
- $price_with_vat = round($price_with_vat, $system->SETTINGS['moneydecimals']);
- return $price_with_vat;
+ global $system, $vat;
+ $price_with_vat = $price + ($vat * ($price / 100));
+ $price_with_vat = round($price_with_vat, $system->SETTINGS['moneydecimals']);
+ return $price_with_vat;
}
// remove vat
function vatexcluding($gross)
{
- global $system, $vat;
- $multiplier = ($vat + 100) / 100;
- $net = $gross / $multiplier;
- return number_format($net, $system->SETTINGS['moneydecimals']);
+ global $system, $vat;
+ $multiplier = ($vat + 100) / 100;
+ $net = $gross / $multiplier;
+ return number_format($net, $system->SETTINGS['moneydecimals']);
}
function invalidinvoice($packingslip = false)
{
- global $template, $system;
-
- $template->assign_vars(array(
- 'LOGO' => $system->SETTINGS['siteurl'] . 'uploaded/logo/' . $system->SETTINGS['logo'],
- 'LANGUAGE' => $language,
- 'SALE_ID' => 0,
- 'B_INVOICE' => false
- ));
-
- $file = ($packingslip) ? 'order_packingslip.tpl' : 'order_invoice.tpl';
-
- $template->set_filenames(array(
- 'body' => $file
- ));
- $template->display('body');
- exit;
+ global $template, $system;
+
+ $template->assign_vars(array(
+ 'LOGO' => $system->SETTINGS['siteurl'] . 'uploaded/logo/' . $system->SETTINGS['logo'],
+ 'LANGUAGE' => $language,
+ 'SALE_ID' => 0,
+ 'B_INVOICE' => false
+ ));
+
+ $file = ($packingslip) ? 'order_packingslip.tpl' : 'order_invoice.tpl';
+
+ $template->set_filenames(array(
+ 'body' => $file
+ ));
+ $template->display('body');
+ exit;
}
diff --git a/includes/functions_rebuild.php b/includes/functions_rebuild.php
new file mode 100755
index 000000000..1e9d8e07f
--- /dev/null
+++ b/includes/functions_rebuild.php
@@ -0,0 +1,64 @@
+direct_query($query);
+ $num_rows = $db->numrows();
+
+ $i = 0;
+ $output = 'fetch())
+ {
+ $output .= '\'' . $row[$array_key] . '\' => array(' . "\n\t";
+ $field_count = count($field_name);
+ $j = 0;
+ foreach ($field_name as $field)
+ {
+ $output .= '\'' . $field . '\' => \'' . $row[$field] . '\'';
+ $j++;
+ if ($j < $field_count)
+ $output .= ', ';
+ else
+ $output .= "\n" . ')';
+ }
+ $i++;
+ if ($i < $num_rows)
+ $output .= ',' . "\n";
+ else
+ $output .= "\n";
+ }
+
+ $output .= ');' . "\n" . '?>';
+
+ $handle = fopen($output_filename, 'w');
+ fputs($handle, $output);
+ fclose($handle);
+}
\ No newline at end of file
diff --git a/includes/functions_sell.php b/includes/functions_sell.php
old mode 100644
new mode 100755
index 327dcc770..df7e48990
--- a/includes/functions_sell.php
+++ b/includes/functions_sell.php
@@ -1,6 +1,6 @@
SETTINGS['moneyformat'] == 1) ? 0.99 : '0,99';
- $minimum_bid = (empty($minimum_bid)) ? $default_minbid : $minimum_bid;
- $shipping_cost = (isset($_POST['shipping_cost'])) ? $_POST['shipping_cost'] : $_SESSION['SELL_shipping_cost'];
- $shipping_cost = (empty($shipping_cost)) ? 0 : $shipping_cost;
- $additional_shipping_cost = (isset($_POST['additional_shipping_cost'])) ? $_POST['additional_shipping_cost'] : $_SESSION['SELL_additional_shipping_cost'];
- $additional_shipping_cost = (empty($additional_shipping_cost)) ? 0 : $additional_shipping_cost;
- $imgtype = (isset($_POST['imgtype'])) ? $_POST['imgtype'] : $_SESSION['SELL_file_uploaded'];
- $title = (isset($_POST['title'])) ? $system->cleanvars($_POST['title']) : $_SESSION['SELL_title'];
- $subtitle = (isset($_POST['subtitle'])) ? $system->cleanvars($_POST['subtitle']) : $_SESSION['SELL_subtitle'];
- $sdescription = (isset($_POST['sdescription'])) ? $system->cleanvars($_POST['sdescription'], true) : $_SESSION['SELL_description'];
- $pict_url = (isset($_POST['pict_url'])) ? $_POST['pict_url'] : $_SESSION['SELL_pict_url'];
- $atype = (isset($_POST['atype'])) ? $_POST['atype'] : $_SESSION['SELL_atype'];
- $iquantity = (int)(isset($_POST['iquantity'])) ? $_POST['iquantity'] : $_SESSION['SELL_iquantity'];
- $iquantity = (empty($iquantity)) ? 1 : round($iquantity);
- $buy_now = (isset($_POST['buy_now'])) ? $_POST['buy_now'] : $_SESSION['SELL_with_buy_now'];
- $buy_now_price = (isset($_POST['buy_now_price'])) ? $_POST['buy_now_price'] : $_SESSION['SELL_buy_now_price'];
- $relist = (isset($_POST['autorelist'])) ? $_POST['autorelist'] : $_SESSION['SELL_relist'];
- $increments = (isset($_POST['increments'])) ? $_POST['increments'] : $_SESSION['SELL_increments'];
- $customincrement = (isset($_POST['customincrement'])) ? $_POST['customincrement'] : $_SESSION['SELL_customincrement'];
- $shipping = (isset($_POST['shipping'])) ? $_POST['shipping'] : $_SESSION['SELL_shipping'];
- $shipping_terms = (isset($_POST['shipping_terms'])) ? $system->cleanvars($_POST['shipping_terms']) : $_SESSION['SELL_shipping_terms'];
- $payment = (isset($_POST['payment'])) ? $_POST['payment'] : $_SESSION['SELL_payment'];
- $payment = (is_array($payment)) ? $payment : array();
- $sellcat1 = $_SESSION['SELL_sellcat1'];
- $_SESSION['SELL_sellcat2'] = (isset($_SESSION['SELL_sellcat2'])) ? $_SESSION['SELL_sellcat2'] : 0;
- $sellcat2 = $_SESSION['SELL_sellcat2'];
- $caneditstartdate = $_SESSION['SELL_caneditstartdate'];
- $buy_now_only = (isset($_POST['buy_now_only'])) ? $_POST['buy_now_only'] : $_SESSION['SELL_buy_now_only'];
- $buy_now_only = (empty($buy_now_only)) ? 0 : $buy_now_only;
-
- $a_starts = (isset($_POST['a_starts'])) ? $dt->convertToDatetime($_POST['a_starts']) : $_SESSION['SELL_starts'];
- $duration = (isset($_POST['duration'])) ? $_POST['duration'] : $_SESSION['SELL_duration'];
- $a_ends = (isset($_POST['a_ends'])) ? $dt->convertToDatetime($_POST['a_ends']) : $_SESSION['SELL_ends'];
-
- // deal with checkboxes
- if (isset($_POST['action']) && $_POST['action'] == 3) {
- $is_bold = (isset($_POST['is_bold'])) ? 1 : 0;
- $is_featured = (isset($_POST['is_featured'])) ? 1 : 0;
- $is_highlighted = (isset($_POST['is_highlighted'])) ? 1 : 0;
- $international = (isset($_POST['international'])) ? 1 : 0;
- $start_now = (isset($_POST['start_now'])) ? 1 : 0;
- $custom_end = (isset($_POST['custom_end'])) ? 1 : 0;
- // ignore duration for custom end date
- $duration = ($custom_end == 1) ? 0 : $duration;
- } else {
- $is_bold = $_SESSION['SELL_is_bold'];
- $is_featured = $_SESSION['SELL_is_featured'];
- $is_highlighted = $_SESSION['SELL_is_highlighted'];
- $international = $_SESSION['SELL_international'];
- $start_now = $_SESSION['SELL_start_now'];
- $custom_end = $_SESSION['SELL_custom_end'];
- }
-
- $is_taxed = (isset($_POST['is_taxed'])) ? $_POST['is_taxed'] : $_SESSION['SELL_is_taxed'];
- $tax_included = (isset($_POST['tax_included'])) ? $_POST['tax_included'] : $_SESSION['SELL_tax_included'];
- if (isset($_POST['action']) && $_POST['action'] == 2) {
- $is_bold = (isset($_POST['is_bold'])) ? 1 : 0;
- $is_featured = (isset($_POST['is_featured'])) ? 1 : 0;
- $is_highlighted = (isset($_POST['is_highlighted'])) ? 1 : 0;
- $is_taxed = (isset($_POST['is_taxed'])) ? 1 : 0;
- $tax_included = (isset($_POST['tax_included'])) ? 1 : 0;
- $payment = (isset($_POST['payment'])) ? $payment : array();
- }
+ global $with_reserve, $reserve_price, $minimum_bid, $pict_url, $imgtype, $title, $subtitle, $sdescription, $atype, $iquantity, $buy_now, $buy_now_price, $is_taxed, $tax_included, $additional_shipping_cost;
+ global $duration, $relist, $increments, $customincrement, $shipping, $shipping_terms, $payment, $international, $sellcat1, $sellcat2, $buy_now_only, $a_starts, $shipping_cost, $is_bold, $is_highlighted, $is_featured, $start_now;
+ global $_POST, $_SESSION, $system, $custom_end, $a_ends, $custom_end, $caneditstartdate;
+
+ $with_reserve = (isset($_POST['with_reserve'])) ? $_POST['with_reserve'] : $_SESSION['SELL_with_reserve'];
+ $reserve_price = (isset($_POST['reserve_price'])) ? $_POST['reserve_price'] : $_SESSION['SELL_reserve_price'];
+ $minimum_bid = (isset($_POST['minimum_bid'])) ? $_POST['minimum_bid'] : $_SESSION['SELL_minimum_bid'];
+ $default_minbid = ($system->SETTINGS['moneyformat'] == 1) ? 0.99 : '0,99';
+ $minimum_bid = (empty($minimum_bid)) ? $default_minbid : $minimum_bid;
+ $shipping_cost = (isset($_POST['shipping_cost'])) ? $_POST['shipping_cost'] : $_SESSION['SELL_shipping_cost'];
+ $shipping_cost = (empty($shipping_cost)) ? 0 : $shipping_cost;
+ $additional_shipping_cost = (isset($_POST['additional_shipping_cost'])) ? $_POST['additional_shipping_cost'] : $_SESSION['SELL_additional_shipping_cost'];
+ $additional_shipping_cost = (empty($additional_shipping_cost)) ? 0 : $additional_shipping_cost;
+ $imgtype = (isset($_POST['imgtype'])) ? $_POST['imgtype'] : $_SESSION['SELL_file_uploaded'];
+ $title = (isset($_POST['title'])) ? $system->cleanvars($_POST['title']) : $_SESSION['SELL_title'];
+ $subtitle = (isset($_POST['subtitle'])) ? $system->cleanvars($_POST['subtitle']) : $_SESSION['SELL_subtitle'];
+ $sdescription = (isset($_POST['sdescription'])) ? $system->cleanvars($_POST['sdescription'], true) : $_SESSION['SELL_description'];
+ $pict_url = (isset($_POST['pict_url'])) ? $_POST['pict_url'] : $_SESSION['SELL_pict_url'];
+ $atype = (isset($_POST['atype'])) ? $_POST['atype'] : $_SESSION['SELL_atype'];
+ $iquantity = (int)(isset($_POST['iquantity'])) ? $_POST['iquantity'] : $_SESSION['SELL_iquantity'];
+ $iquantity = (empty($iquantity)) ? 1 : round($iquantity);
+ $buy_now = (isset($_POST['buy_now'])) ? $_POST['buy_now'] : $_SESSION['SELL_with_buy_now'];
+ $buy_now_price = (isset($_POST['buy_now_price'])) ? $_POST['buy_now_price'] : $_SESSION['SELL_buy_now_price'];
+ $relist = (isset($_POST['autorelist'])) ? $_POST['autorelist'] : $_SESSION['SELL_relist'];
+ $increments = (isset($_POST['increments'])) ? $_POST['increments'] : $_SESSION['SELL_increments'];
+ $customincrement = (isset($_POST['customincrement'])) ? $_POST['customincrement'] : $_SESSION['SELL_customincrement'];
+ $shipping = (isset($_POST['shipping'])) ? $_POST['shipping'] : $_SESSION['SELL_shipping'];
+ $shipping_terms = (isset($_POST['shipping_terms'])) ? $system->cleanvars($_POST['shipping_terms']) : $_SESSION['SELL_shipping_terms'];
+ $payment = (isset($_POST['payment'])) ? $_POST['payment'] : $_SESSION['SELL_payment'];
+ $payment = (is_array($payment)) ? $payment : array();
+ $sellcat1 = $_SESSION['SELL_sellcat1'];
+ $_SESSION['SELL_sellcat2'] = (isset($_SESSION['SELL_sellcat2'])) ? $_SESSION['SELL_sellcat2'] : 0;
+ $sellcat2 = $_SESSION['SELL_sellcat2'];
+ $caneditstartdate = $_SESSION['SELL_caneditstartdate'];
+ $buy_now_only = (isset($_POST['buy_now_only'])) ? $_POST['buy_now_only'] : $_SESSION['SELL_buy_now_only'];
+ $buy_now_only = (empty($buy_now_only)) ? 0 : $buy_now_only;
+
+ $a_starts = (isset($_POST['a_starts'])) ? $_POST['a_starts'] : $_SESSION['SELL_starts'];
+ $duration = (isset($_POST['duration'])) ? $_POST['duration'] : $_SESSION['SELL_duration'];
+ $a_ends = (isset($_POST['a_ends'])) ? $_POST['a_ends'] : $_SESSION['SELL_ends'];
+
+ // deal with checkboxes
+ if (isset($_POST['action']) && $_POST['action'] == 3)
+ {
+ $is_bold = (isset($_POST['is_bold'])) ? 1 : 0;
+ $is_featured = (isset($_POST['is_featured'])) ? 1 : 0;
+ $is_highlighted = (isset($_POST['is_highlighted'])) ? 1 : 0;
+ $international = (isset($_POST['international'])) ? 1 : 0;
+ $start_now = (isset($_POST['start_now'])) ? 1 : 0;
+ $custom_end = (isset($_POST['custom_end'])) ? 1 : 0;
+ // ignore duration for custom end date
+ $duration = ($custom_end == 1) ? 0 : $duration;
+ }
+ else
+ {
+ $is_bold = $_SESSION['SELL_is_bold'];
+ $is_featured = $_SESSION['SELL_is_featured'];
+ $is_highlighted = $_SESSION['SELL_is_highlighted'];
+ $international = $_SESSION['SELL_international'];
+ $start_now = $_SESSION['SELL_start_now'];
+ $custom_end = $_SESSION['SELL_custom_end'];
+ }
+
+ $is_taxed = (isset($_POST['is_taxed'])) ? $_POST['is_taxed'] : $_SESSION['SELL_is_taxed'];
+ $tax_included = (isset($_POST['tax_included'])) ? $_POST['tax_included'] : $_SESSION['SELL_tax_included'];
+ if (isset($_POST['action']) && $_POST['action'] == 2)
+ {
+ $is_bold = (isset($_POST['is_bold'])) ? 1 : 0;
+ $is_featured = (isset($_POST['is_featured'])) ? 1 : 0;
+ $is_highlighted = (isset($_POST['is_highlighted'])) ? 1 : 0;
+ $is_taxed = (isset($_POST['is_taxed'])) ? 1 : 0;
+ $tax_included = (isset($_POST['tax_included'])) ? 1 : 0;
+ $payment = (isset($_POST['payment'])) ? $payment : array();
+ }
}
function makesessions()
{
- global $with_reserve, $reserve_price, $minimum_bid, $pict_url, $imgtype, $title, $subtitle, $sdescription, $pict_url, $atype, $iquantity, $buy_now, $buy_now_price, $is_taxed, $tax_included, $additional_shipping_cost;
- global $duration, $relist, $increments, $customincrement, $shipping, $shipping_terms, $payment, $international, $sendemail, $buy_now_only, $a_starts, $shipping_cost, $is_bold, $is_highlighted, $is_featured, $start_now, $_SESSION;
- global $a_ends, $custom_end, $caneditstartdate;
-
- $_SESSION['SELL_with_reserve'] = $with_reserve;
- $_SESSION['SELL_reserve_price'] = $reserve_price;
- $_SESSION['SELL_minimum_bid'] = $minimum_bid;
- $_SESSION['SELL_shipping_cost'] = $shipping_cost;
- $_SESSION['SELL_additional_shipping_cost'] = $additional_shipping_cost;
- $_SESSION['SELL_file_uploaded'] = $imgtype;
- $_SESSION['SELL_title'] = $title;
- $_SESSION['SELL_subtitle'] = $subtitle;
- $_SESSION['SELL_description'] = $sdescription;
- $_SESSION['SELL_pict_url'] = $pict_url;
- $_SESSION['SELL_atype'] = $atype;
- $_SESSION['SELL_iquantity'] = $iquantity;
- $_SESSION['SELL_with_buy_now'] = $buy_now;
- $_SESSION['SELL_buy_now_price'] = $buy_now_price;
- $_SESSION['SELL_duration'] = $duration;
- $_SESSION['SELL_relist'] = $relist;
- $_SESSION['SELL_increments'] = $increments;
- $_SESSION['SELL_customincrement'] = $customincrement;
- $_SESSION['SELL_shipping'] = $shipping;
- $_SESSION['SELL_shipping_terms'] = $shipping_terms;
- $_SESSION['SELL_payment'] = $payment;
- $_SESSION['SELL_international'] = $international;
- $_SESSION['SELL_buy_now_only'] = $buy_now_only;
- $_SESSION['SELL_starts'] = $a_starts;
- $_SESSION['SELL_ends'] = $a_ends;
- $_SESSION['SELL_custom_end'] = $custom_end;
- $_SESSION['SELL_is_bold'] = $is_bold;
- $_SESSION['SELL_is_highlighted'] = $is_highlighted;
- $_SESSION['SELL_is_featured'] = $is_featured;
- $_SESSION['SELL_start_now'] = $start_now;
- $_SESSION['SELL_is_taxed'] = $is_taxed;
- $_SESSION['SELL_tax_included'] = $tax_included;
- $_SESSION['SELL_caneditstartdate'] = $caneditstartdate;
+ global $with_reserve, $reserve_price, $minimum_bid, $pict_url, $imgtype, $title, $subtitle, $sdescription, $pict_url, $atype, $iquantity, $buy_now, $buy_now_price, $is_taxed, $tax_included, $additional_shipping_cost;
+ global $duration, $relist, $increments, $customincrement, $shipping, $shipping_terms, $payment, $international, $sendemail, $buy_now_only, $a_starts, $shipping_cost, $is_bold, $is_highlighted, $is_featured, $start_now, $_SESSION;
+ global $a_ends, $custom_end, $caneditstartdate;
+
+ $_SESSION['SELL_with_reserve'] = $with_reserve;
+ $_SESSION['SELL_reserve_price'] = $reserve_price;
+ $_SESSION['SELL_minimum_bid'] = $minimum_bid;
+ $_SESSION['SELL_shipping_cost'] = $shipping_cost;
+ $_SESSION['SELL_additional_shipping_cost'] = $additional_shipping_cost;
+ $_SESSION['SELL_file_uploaded'] = $imgtype;
+ $_SESSION['SELL_title'] = $title;
+ $_SESSION['SELL_subtitle'] = $subtitle;
+ $_SESSION['SELL_description'] = $sdescription;
+ $_SESSION['SELL_pict_url'] = $pict_url;
+ $_SESSION['SELL_atype'] = $atype;
+ $_SESSION['SELL_iquantity'] = $iquantity;
+ $_SESSION['SELL_with_buy_now'] = $buy_now;
+ $_SESSION['SELL_buy_now_price'] = $buy_now_price;
+ $_SESSION['SELL_duration'] = $duration;
+ $_SESSION['SELL_relist'] = $relist;
+ $_SESSION['SELL_increments'] = $increments;
+ $_SESSION['SELL_customincrement'] = $customincrement;
+ $_SESSION['SELL_shipping'] = $shipping;
+ $_SESSION['SELL_shipping_terms'] = $shipping_terms;
+ $_SESSION['SELL_payment'] = $payment;
+ $_SESSION['SELL_international'] = $international;
+ $_SESSION['SELL_buy_now_only'] = $buy_now_only;
+ $_SESSION['SELL_starts'] = $a_starts;
+ $_SESSION['SELL_ends'] = $a_ends;
+ $_SESSION['SELL_custom_end'] = $custom_end;
+ $_SESSION['SELL_is_bold'] = $is_bold;
+ $_SESSION['SELL_is_highlighted'] = $is_highlighted;
+ $_SESSION['SELL_is_featured'] = $is_featured;
+ $_SESSION['SELL_start_now'] = $start_now;
+ $_SESSION['SELL_is_taxed'] = $is_taxed;
+ $_SESSION['SELL_tax_included'] = $tax_included;
+ $_SESSION['SELL_caneditstartdate'] = $caneditstartdate;
}
function unsetsessions()
{
- global $_SESSION, $system;
-
- $_SESSION['SELL_with_reserve'] = '';
- $_SESSION['SELL_reserve_price'] = '';
- $_SESSION['SELL_minimum_bid'] = ($system->SETTINGS['moneyformat'] == 1) ? 0.99 : '0,99';
- $_SESSION['SELL_shipping_cost'] = 0;
- $_SESSION['SELL_additional_shipping_cost'] = 0;
- $_SESSION['SELL_file_uploaded'] = false;
- $_SESSION['SELL_title'] = '';
- $_SESSION['SELL_subtitle'] = '';
- $_SESSION['SELL_description'] = '';
- $_SESSION['SELL_pict_url'] = '';
- $_SESSION['SELL_pict_url_temp'] = '';
- $_SESSION['SELL_atype'] = '';
- $_SESSION['SELL_iquantity'] = '';
- $_SESSION['SELL_with_buy_now'] = '';
- $_SESSION['SELL_buy_now_price'] = '';
- $_SESSION['SELL_duration'] = '';
- $_SESSION['SELL_relist'] = '';
- $_SESSION['SELL_increments'] = '';
- $_SESSION['SELL_customincrement'] = 0;
- $_SESSION['SELL_shipping'] = 1;
- $_SESSION['SELL_shipping_terms'] = '';
- $_SESSION['SELL_payment'] = array();
- $_SESSION['SELL_international'] = false;
- $_SESSION['SELL_sendemail'] = '';
- $_SESSION['SELL_starts'] = '';
- $_SESSION['SELL_ends'] = '';
- $_SESSION['SELL_custom_end'] = 0;
- $_SESSION['SELL_action'] = '';
- $_SESSION['SELL_is_bold'] = 0;
- $_SESSION['SELL_is_highlighted'] = 0;
- $_SESSION['SELL_is_featured'] = 0;
- $_SESSION['SELL_start_now'] = '';
- $_SESSION['SELL_is_taxed'] = 0;
- $_SESSION['SELL_tax_included'] = 0;
- $_SESSION['SELL_caneditstartdate'] = true;
+ global $_SESSION, $system;
+
+ $_SESSION['SELL_with_reserve'] = '';
+ $_SESSION['SELL_reserve_price'] = '';
+ $_SESSION['SELL_minimum_bid'] = ($system->SETTINGS['moneyformat'] == 1) ? 0.99 : '0,99';
+ $_SESSION['SELL_shipping_cost'] = 0;
+ $_SESSION['SELL_additional_shipping_cost'] = 0;
+ $_SESSION['SELL_file_uploaded'] = false;
+ $_SESSION['SELL_title'] = '';
+ $_SESSION['SELL_subtitle'] = '';
+ $_SESSION['SELL_description'] = '';
+ $_SESSION['SELL_pict_url'] = '';
+ $_SESSION['SELL_pict_url_temp'] = '';
+ $_SESSION['SELL_atype'] = '';
+ $_SESSION['SELL_iquantity'] = '';
+ $_SESSION['SELL_with_buy_now'] = '';
+ $_SESSION['SELL_buy_now_price'] = '';
+ $_SESSION['SELL_duration'] = '';
+ $_SESSION['SELL_relist'] = '';
+ $_SESSION['SELL_increments'] = '';
+ $_SESSION['SELL_customincrement'] = 0;
+ $_SESSION['SELL_shipping'] = 1;
+ $_SESSION['SELL_shipping_terms'] = '';
+ $_SESSION['SELL_payment'] = array();
+ $_SESSION['SELL_international'] = false;
+ $_SESSION['SELL_sendemail'] = '';
+ $_SESSION['SELL_starts'] = '';
+ $_SESSION['SELL_ends'] = '';
+ $_SESSION['SELL_custom_end'] = 0;
+ $_SESSION['SELL_action'] = '';
+ $_SESSION['SELL_is_bold'] = 0;
+ $_SESSION['SELL_is_highlighted'] = 0;
+ $_SESSION['SELL_is_featured'] = 0;
+ $_SESSION['SELL_start_now'] = '';
+ $_SESSION['SELL_is_taxed'] = 0;
+ $_SESSION['SELL_tax_included'] = 0;
+ $_SESSION['SELL_caneditstartdate'] = true;
}
function updateauction()
{
- global $_SESSION, $DBPrefix, $dt, $a_starts, $a_ends, $payment_text, $system, $fee, $db, $caneditstartdate;
+ global $_SESSION, $DBPrefix, $a_starts, $a_ends, $payment_text, $system, $fee, $db, $caneditstartdate;
- $query =
- "UPDATE " . $DBPrefix . "auctions SET
+ $query =
+ "UPDATE " . $DBPrefix . "auctions SET
title = :title,
subtitle = :subtitle,
description = :description,
@@ -220,365 +225,404 @@ function updateauction()
featured = :featured,
tax = :tax,
taxinc = :taxinc,
- current_fee = current_fee + :fee";
- $params = array();
- $params[] = array(':title', $_SESSION['SELL_title'], 'str');
- $params[] = array(':subtitle', $_SESSION['SELL_subtitle'], 'str');
- $params[] = array(':description', $_SESSION['SELL_description'], 'str');
- $params[] = array(':pict_url', $_SESSION['SELL_pict_url'], 'str');
- $params[] = array(':catone', $_SESSION['SELL_sellcat1'], 'int');
- $params[] = array(':cattwo', $_SESSION['SELL_sellcat2'], 'int');
- $params[] = array(':min_bid', $system->input_money(($_SESSION['SELL_buy_now_only'] == 0) ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']), 'float');
- $params[] = array(':shipping_cost', $system->input_money($_SESSION['SELL_shipping_cost']), 'float');
- $params[] = array(':additional_shipping_cost', $system->input_money($_SESSION['SELL_additional_shipping_cost']), 'float');
- $params[] = array(':reserve_price', $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0), 'float');
- $params[] = array(':buy_now', $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0), 'float');
- $params[] = array(':bn_only', $_SESSION['SELL_buy_now_only'], 'bool');
- $params[] = array(':auction_type', $_SESSION['SELL_atype'], 'int');
- $params[] = array(':duration', $_SESSION['SELL_duration'], 'int');
- $params[] = array(':increment', $system->input_money($_SESSION['SELL_customincrement']), 'float');
- $params[] = array(':shipping', $_SESSION['SELL_shipping'], 'int');
- $params[] = array(':payment', $payment_text, 'str');
- $params[] = array(':international', $_SESSION['SELL_international'], 'bool');
- $params[] = array(':ends', $dt->convertToUTC($a_ends), 'str');
- $params[] = array(':photo_uploaded', $_SESSION['SELL_file_uploaded'], 'bool');
- $params[] = array(':initial_quantity', $_SESSION['SELL_iquantity'], 'int');
- $params[] = array(':quantity', $_SESSION['SELL_iquantity'], 'int');
- $params[] = array(':relist', $_SESSION['SELL_relist'], 'int');
- $params[] = array(':shipping_terms', $_SESSION['SELL_shipping_terms'], 'str');
- $params[] = array(':bold', $_SESSION['SELL_is_bold'], 'bool');
- $params[] = array(':highlighted', $_SESSION['SELL_is_highlighted'], 'bool');
- $params[] = array(':featured', $_SESSION['SELL_is_featured'], 'bool');
- $params[] = array(':tax', $_SESSION['SELL_is_taxed'], 'bool');
- $params[] = array(':taxinc', $_SESSION['SELL_tax_included'], 'bool');
- $params[] = array(':fee', $fee, 'float');
- $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
- if ($caneditstartdate) {
- $query .= ", starts = :starts";
- $params[] = array(':starts', $dt->convertToUTC($a_starts), 'str');
- }
- $query .= ' WHERE id = :auction_id';
- $db->query($query, $params);
+ current_fee = current_fee + :fee
+ WHERE id = :auction_id";
+ $params = array();
+ $params[] = array(':title', $_SESSION['SELL_title'], 'str');
+ $params[] = array(':subtitle', $_SESSION['SELL_subtitle'], 'str');
+ $params[] = array(':description', $_SESSION['SELL_description'], 'str');
+ $params[] = array(':pict_url', $_SESSION['SELL_pict_url'], 'str');
+ $params[] = array(':catone', $_SESSION['SELL_sellcat1'], 'int');
+ $params[] = array(':cattwo', $_SESSION['SELL_sellcat2'], 'int');
+ $params[] = array(':min_bid', $system->input_money(($_SESSION['SELL_buy_now_only'] == 0) ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']), 'float');
+ $params[] = array(':shipping_cost', $system->input_money($_SESSION['SELL_shipping_cost']), 'float');
+ $params[] = array(':additional_shipping_cost', $system->input_money($_SESSION['SELL_additional_shipping_cost']), 'float');
+ $params[] = array(':reserve_price', $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0), 'float');
+ $params[] = array(':buy_now', $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0), 'float');
+ $params[] = array(':bn_only', $_SESSION['SELL_buy_now_only'], 'bool');
+ $params[] = array(':auction_type', $_SESSION['SELL_atype'], 'int');
+ $params[] = array(':duration', $_SESSION['SELL_duration'], 'int');
+ $params[] = array(':increment', $system->input_money($_SESSION['SELL_customincrement']), 'float');
+ $params[] = array(':shipping', $_SESSION['SELL_shipping'], 'int');
+ $params[] = array(':payment', $payment_text, 'str');
+ $params[] = array(':international', $_SESSION['SELL_international'], 'bool');
+ $params[] = array(':ends', $a_ends, 'int');
+ $params[] = array(':photo_uploaded', $_SESSION['SELL_file_uploaded'], 'bool');
+ $params[] = array(':initial_quantity', $_SESSION['SELL_iquantity'], 'int');
+ $params[] = array(':quantity', $_SESSION['SELL_iquantity'], 'int');
+ $params[] = array(':relist', $_SESSION['SELL_relist'], 'int');
+ $params[] = array(':shipping_terms', $_SESSION['SELL_shipping_terms'], 'str');
+ $params[] = array(':bold', $_SESSION['SELL_is_bold'], 'bool');
+ $params[] = array(':highlighted', $_SESSION['SELL_is_highlighted'], 'bool');
+ $params[] = array(':featured', $_SESSION['SELL_is_featured'], 'bool');
+ $params[] = array(':tax', $_SESSION['SELL_is_taxed'], 'bool');
+ $params[] = array(':taxinc', $_SESSION['SELL_tax_included'], 'bool');
+ $params[] = array(':fee', $fee, 'float');
+ $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
+ if ($caneditstartdate)
+ {
+ $query .= ", starts = :starts";
+ $params[] = array(':starts', $a_starts, 'int');
+ }
+ $db->query($query, $params);
}
function addauction()
{
- global $DBPrefix, $_SESSION, $user, $a_starts, $a_ends, $payment_text, $system, $fee, $db, $dt;
+ global $DBPrefix, $_SESSION, $user, $a_starts, $a_ends, $payment_text, $system, $fee, $db;
- $query = "INSERT INTO " . $DBPrefix . "auctions (user,title,subtitle,starts,description,pict_url,category,secondcat,minimum_bid,shipping_cost,additional_shipping_cost,reserve_price,buy_now,auction_type,duration,increment,shipping,payment,international,ends,photo_uploaded,initial_quantity,quantity,relist,shipping_terms,bn_only,bold,highlighted,featured,current_fee,tax,taxinc) VALUES
+ $query = "INSERT INTO " . $DBPrefix . "auctions (user,title,subtitle,starts,description,pict_url,category,secondcat,minimum_bid,shipping_cost,additional_shipping_cost,reserve_price,buy_now,auction_type,duration,increment,shipping,payment,international,ends,photo_uploaded,initial_quantity,quantity,relist,shipping_terms,bn_only,bold,highlighted,featured,current_fee,tax,taxinc) VALUES
(:user_id, :title, :subtitle, :starts, :description, :pict_url, :catone, :cattwo, :min_bid, :shipping_cost, :additional_shipping_cost, :reserve_price, :buy_now, :auction_type, :duration, :increment, :shipping, :payment, :international, :ends, :photo_uploaded, :initial_quantity, :quantity, :relist, :shipping_terms, :bn_only, :bold, :highlighted, :featured, :fee, :tax, :taxinc)";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':title', $_SESSION['SELL_title'], 'str');
- $params[] = array(':subtitle', $_SESSION['SELL_subtitle'], 'str');
- $params[] = array(':starts', $dt->convertToUTC($a_starts), 'str');
- $params[] = array(':description', $_SESSION['SELL_description'], 'str');
- $params[] = array(':pict_url', $_SESSION['SELL_pict_url'], 'str');
- $params[] = array(':catone', $_SESSION['SELL_sellcat1'], 'int');
- $params[] = array(':cattwo', $_SESSION['SELL_sellcat2'], 'int');
- $params[] = array(':min_bid', $system->input_money(($_SESSION['SELL_buy_now_only'] == 0) ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']), 'float');
- $params[] = array(':shipping_cost', $system->input_money($_SESSION['SELL_shipping_cost']), 'float');
- $params[] = array(':additional_shipping_cost', $system->input_money($_SESSION['SELL_additional_shipping_cost']), 'float');
- $params[] = array(':reserve_price', $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0), 'float');
- $params[] = array(':buy_now', $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0), 'float');
- $params[] = array(':auction_type', $_SESSION['SELL_atype'], 'int');
- $params[] = array(':duration', $_SESSION['SELL_duration'], 'int');
- $params[] = array(':increment', $system->input_money($_SESSION['SELL_customincrement']), 'float');
- $params[] = array(':shipping', $_SESSION['SELL_shipping'], 'int');
- $params[] = array(':payment', $payment_text, 'str');
- $params[] = array(':international', $_SESSION['SELL_international'], 'bool');
- $params[] = array(':ends', $dt->convertToUTC($a_ends), 'str');
- $params[] = array(':photo_uploaded', $_SESSION['SELL_file_uploaded'], 'bool');
- $params[] = array(':initial_quantity', $_SESSION['SELL_iquantity'], 'int');
- $params[] = array(':quantity', $_SESSION['SELL_iquantity'], 'int');
- $params[] = array(':relist', $_SESSION['SELL_relist'], 'int');
- $params[] = array(':shipping_terms', $_SESSION['SELL_shipping_terms'], 'str');
- $params[] = array(':bn_only', $_SESSION['SELL_buy_now_only'], 'bool');
- $params[] = array(':bold', $_SESSION['SELL_is_bold'], 'bool');
- $params[] = array(':highlighted', $_SESSION['SELL_is_highlighted'], 'bool');
- $params[] = array(':featured', $_SESSION['SELL_is_featured'], 'bool');
- $params[] = array(':fee', $fee, 'float');
- $params[] = array(':tax', $_SESSION['SELL_is_taxed'], 'bool');
- $params[] = array(':taxinc', $_SESSION['SELL_tax_included'], 'bool');
- $db->query($query, $params);
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $params[] = array(':title', $_SESSION['SELL_title'], 'str');
+ $params[] = array(':subtitle', $_SESSION['SELL_subtitle'], 'str');
+ $params[] = array(':starts', $a_starts, 'int');
+ $params[] = array(':description', $_SESSION['SELL_description'], 'str');
+ $params[] = array(':pict_url', $_SESSION['SELL_pict_url'], 'str');
+ $params[] = array(':catone', $_SESSION['SELL_sellcat1'], 'int');
+ $params[] = array(':cattwo', $_SESSION['SELL_sellcat2'], 'int');
+ $params[] = array(':min_bid', $system->input_money(($_SESSION['SELL_buy_now_only'] == 0) ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']), 'float');
+ $params[] = array(':shipping_cost', $system->input_money($_SESSION['SELL_shipping_cost']), 'float');
+ $params[] = array(':additional_shipping_cost', $system->input_money($_SESSION['SELL_additional_shipping_cost']), 'float');
+ $params[] = array(':reserve_price', $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0), 'float');
+ $params[] = array(':buy_now', $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0), 'float');
+ $params[] = array(':auction_type', $_SESSION['SELL_atype'], 'int');
+ $params[] = array(':duration', $_SESSION['SELL_duration'], 'int');
+ $params[] = array(':increment', $system->input_money($_SESSION['SELL_customincrement']), 'float');
+ $params[] = array(':shipping', $_SESSION['SELL_shipping'], 'int');
+ $params[] = array(':payment', $payment_text, 'str');
+ $params[] = array(':international', $_SESSION['SELL_international'], 'bool');
+ $params[] = array(':ends', $a_ends, 'int');
+ $params[] = array(':photo_uploaded', $_SESSION['SELL_file_uploaded'], 'bool');
+ $params[] = array(':initial_quantity', $_SESSION['SELL_iquantity'], 'int');
+ $params[] = array(':quantity', $_SESSION['SELL_iquantity'], 'int');
+ $params[] = array(':relist', $_SESSION['SELL_relist'], 'int');
+ $params[] = array(':shipping_terms', $_SESSION['SELL_shipping_terms'], 'str');
+ $params[] = array(':bn_only', $_SESSION['SELL_buy_now_only'], 'bool');
+ $params[] = array(':bold', $_SESSION['SELL_is_bold'], 'bool');
+ $params[] = array(':highlighted', $_SESSION['SELL_is_highlighted'], 'bool');
+ $params[] = array(':featured', $_SESSION['SELL_is_featured'], 'bool');
+ $params[] = array(':fee', $fee, 'float');
+ $params[] = array(':tax', $_SESSION['SELL_is_taxed'], 'bool');
+ $params[] = array(':taxinc', $_SESSION['SELL_tax_included'], 'bool');
+ $db->query($query, $params);
}
function addoutstanding()
{
- global $DBPrefix, $fee_data, $user, $system, $fee, $_SESSION, $db;
-
- $fee_data['total'] = $fee;
-
- if ($_SESSION['SELL_action'] == 'edit') {
- // set defaults
- $fee_colomns = array(
- 'setup',
- 'featured',
- 'bold',
- 'highlighted',
- 'subtitle',
- 'relist',
- 'reserve',
- 'buynow',
- 'picture',
- 'extracat',
- 'total'
- );
-
- $query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE auc_id = :auction_id AND user_id = :user_id";
- $params = array();
- $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- // build an array full of everything the user has been charged for the auction do far
- while ($past_fee_data = $db->fetch()) {
- foreach ($fee_colomns as $fee) {
- $fee_string = ($fee == 'total') ? '' : '_fee';
- $fee_data[$fee . $fee_string] = bcsub($fee_data[$fee . $fee_string],
- $past_fee_data[$fee], $system->SETTINGS['moneydecimals']);
- if ($fee_data[$fee . $fee_string] < 0) {
- $fee_data[$fee . $fee_string] = 0;
- }
- }
- }
-
- }
-
- $query = "INSERT INTO " . $DBPrefix . "useraccounts (auc_id,user_id,setup,featured,bold,highlighted,subtitle,relist,reserve,buynow,picture,extracat,total,paid) VALUES
- (:auction_id, :user_id, :setup_fee, :featured_fee, :bold_fee, :highlighted_fee, :subtitle_fee, :relist_fee, :reserve_fee, :buynow_fee, :picture_fee, :extracat_fee, :fee, 0)";
-
- $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
- $params[] = array(':setup_fee', $fee_data['setup_fee'], 'float');
- $params[] = array(':featured_fee', $fee_data['featured_fee'], 'float');
- $params[] = array(':bold_fee', $fee_data['bold_fee'], 'float');
- $params[] = array(':highlighted_fee', $fee_data['highlighted_fee'], 'float');
- $params[] = array(':subtitle_fee', $fee_data['subtitle_fee'], 'float');
- $params[] = array(':relist_fee', $fee_data['relist_fee'], 'float');
- $params[] = array(':reserve_fee', $fee_data['reserve_fee'], 'float');
- $params[] = array(':buynow_fee', $fee_data['buynow_fee'], 'float');
- $params[] = array(':picture_fee', $fee_data['picture_fee'], 'float');
- $params[] = array(':extracat_fee', $fee_data['extracat_fee'], 'float');
- $params[] = array(':fee', $fee_data['total'], 'float');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
-
- // reset fee value
- $fee = $fee_data['total'];
+ global $DBPrefix, $fee_data, $user, $system, $fee, $_SESSION, $db;
+
+ $query = "INSERT INTO " . $DBPrefix . "useraccounts (auc_id,user_id,date,setup,featured,bold,highlighted,subtitle,relist,reserve,buynow,picture,extracat,total,paid) VALUES
+ (:auction_id, :user_id, :time, :setup_fee, :featured_fee, :bold_fee, :highlighted_fee, :subtitle_fee, :relist_fee, :reserve_fee, :buynow_fee, :picture_fee, :extracat_fee, :fee, 0)";
+
+ $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
+ $params[] = array(':time', time(), 'int');
+ $params[] = array(':setup_fee', $fee_data['setup_fee'], 'float');
+ $params[] = array(':featured_fee', $fee_data['featured_fee'], 'float');
+ $params[] = array(':bold_fee', $fee_data['bold_fee'], 'float');
+ $params[] = array(':highlighted_fee', $fee_data['highlighted_fee'], 'float');
+ $params[] = array(':subtitle_fee', $fee_data['subtitle_fee'], 'float');
+ $params[] = array(':relist_fee', $fee_data['relist_fee'], 'float');
+ $params[] = array(':reserve_fee', $fee_data['reserve_fee'], 'float');
+ $params[] = array(':buynow_fee', $fee_data['buynow_fee'], 'float');
+ $params[] = array(':picture_fee', $fee_data['picture_fee'], 'float');
+ $params[] = array(':extracat_fee', $fee_data['extracat_fee'], 'float');
+ $params[] = array(':fee', $fee, 'float');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
}
function remove_bids($auction_id)
{
- global $DBPrefix, $db;
- $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auction_id";
- $params = array();
- $params[] = array(':auction_id', $auction_id, 'int');
- $db->query($query, $params);
+ global $DBPrefix, $db;
+ $query = "DELETE FROM " . $DBPrefix . "bids WHERE auction = :auction_id";
+ $params = array();
+ $params[] = array(':auction_id', $auction_id, 'int');
+ $db->query($query, $params);
}
function get_fee($minimum_bid, $just_fee = true)
{
- global $system, $DBPrefix, $buy_now_price, $reserve_price, $is_bold, $is_highlighted, $is_featured, $_SESSION, $subtitle, $sellcat2, $relist, $db;
-
- $query = "SELECT * FROM " . $DBPrefix . "fees ORDER BY type, fee_from ASC";
- $db->direct_query($query);
-
- $fee_value = 0;
- // set defaults
- $fee_data = array(
- 'setup_fee' => 0,
- 'featured_fee' => 0,
- 'bold_fee' => 0,
- 'highlighted_fee' => 0,
- 'subtitle_fee' => 0,
- 'relist_fee' => 0,
- 'reserve_fee' => 0,
- 'buynow_fee' => 0,
- 'picture_fee' => 0,
- 'extracat_fee' => 0
- );
- while ($row = $db->fetch()) {
- if ($minimum_bid >= $row['fee_from'] && $minimum_bid <= $row['fee_to'] && $row['type'] == 'setup_fee') {
- if ($row['fee_type'] == 'flat') {
- $fee_data['setup_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- } else {
- $tmp = bcdiv($row['value'], '100', $system->SETTINGS['moneydecimals']);
- $tmp = bcmul($tmp, $minimum_bid, $system->SETTINGS['moneydecimals']);
- $fee_data['setup_fee'] = $tmp;
- $fee_value = bcadd($fee_value, $tmp, $system->SETTINGS['moneydecimals']);
- }
- }
- if ($row['type'] == 'buynow_fee' && $buy_now_price > 0) {
- $fee_data['buynow_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'reserve_fee' && $reserve_price > 0) {
- $fee_data['reserve_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'bold_fee' && $is_bold) {
- $fee_data['bold_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'highlighted_fee' && $is_highlighted) {
- $fee_data['highlighted_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'featured_fee' && $is_featured) {
- $fee_data['featured_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'picture_fee' && count($_SESSION['UPLOADED_PICTURES']) > 0) {
- $tmp = bcmul(count($_SESSION['UPLOADED_PICTURES']), $row['value'], $system->SETTINGS['moneydecimals']);
- $fee_data['picture_fee'] = $tmp;
- $fee_value = bcadd($fee_value, $tmp, $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'subtitle_fee' && !empty($subtitle)) {
- $fee_data['subtitle_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'extracat_fee' && $sellcat2 > 0) {
- $fee_data['extracat_fee'] = $row['value'];
- $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
- }
- if ($row['type'] == 'relist_fee' && $relist > 0) {
- $fee_data['relist_fee'] = ($row['value'] * $relist);
- $fee_value = bcadd($fee_value, ($row['value'] * $relist), $system->SETTINGS['moneydecimals']);
- }
- }
-
- if ($just_fee) {
- $return = $fee_value;
- } else {
- $return = array($fee_value, $fee_data);
- }
-
- return $return;
+ global $system, $DBPrefix, $buy_now_price, $reserve_price, $is_bold, $is_highlighted, $is_featured, $_SESSION, $subtitle, $sellcat2, $relist, $db;
+
+ $query = "SELECT * FROM " . $DBPrefix . "fees ORDER BY type, fee_from ASC";
+ $db->direct_query($query);
+
+ $fee_value = 0;
+ // set defaults
+ $fee_data = array(
+ 'setup_fee' => 0,
+ 'featured_fee' => 0,
+ 'bold_fee' => 0,
+ 'highlighted_fee' => 0,
+ 'subtitle_fee' => 0,
+ 'relist_fee' => 0,
+ 'reserve_fee' => 0,
+ 'buynow_fee' => 0,
+ 'picture_fee' => 0,
+ 'extracat_fee' => 0
+ );
+ while ($row = $db->fetch())
+ {
+ if ($minimum_bid >= $row['fee_from'] && $minimum_bid <= $row['fee_to'] && $row['type'] == 'setup')
+ {
+ if ($row['fee_type'] == 'flat')
+ {
+ $fee_data['setup_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ else
+ {
+ $tmp = bcdiv($row['value'], '100', $system->SETTINGS['moneydecimals']);
+ $tmp = bcmul($tmp, $minimum_bid, $system->SETTINGS['moneydecimals']);
+ $fee_data['setup_fee'] = $tmp;
+ $fee_value = bcadd($fee_value, $tmp, $system->SETTINGS['moneydecimals']);
+ }
+ }
+ if ($row['type'] == 'buynow_fee' && $buy_now_price > 0)
+ {
+ $fee_data['buynow_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'reserve_fee' && $reserve_price > 0)
+ {
+ $fee_data['reserve_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'bold_fee' && $is_bold)
+ {
+ $fee_data['bold_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'highlighted_fee' && $is_highlighted)
+ {
+ $fee_data['highlighted_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'featured_fee' && $is_featured)
+ {
+ $fee_data['featured_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'picture_fee' && count($_SESSION['UPLOADED_PICTURES']) > 0)
+ {
+ $tmp = bcmul(count($_SESSION['UPLOADED_PICTURES']), $row['value'], $system->SETTINGS['moneydecimals']);
+ $fee_data['picture_fee'] = $tmp;
+ $fee_value = bcadd($fee_value, $tmp, $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'subtitle_fee' && !empty($subtitle))
+ {
+ $fee_data['subtitle_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'extracat_fee' && $sellcat2 > 0)
+ {
+ $fee_data['extracat_fee'] = $row['value'];
+ $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']);
+ }
+ if ($row['type'] == 'relist_fee' && $relist > 0)
+ {
+ $fee_data['relist_fee'] = ($row['value'] * $relist);
+ $fee_value = bcadd($fee_value, ($row['value'] * $relist), $system->SETTINGS['moneydecimals']);
+ }
+ }
+
+ if ($_SESSION['SELL_action'] == 'edit')
+ {
+ global $user;
+
+ $query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE auc_id = :auction_id AND user_id = :user_id";
+ $params = array();
+ $params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ // build an array full of everything the user has been charged for the auction do far
+ // set defaults
+ $past_fees = array(
+ 'setup' => 0,
+ 'bold' => 0,
+ 'highlighted' => 0,
+ 'subtitle' => 0,
+ 'relist' => 0,
+ 'reserve' => 0,
+ 'buynow' => 0,
+ 'picture' => 0,
+ 'extracat' => 0
+ );
+ while ($row = $db->fetch())
+ {
+ foreach ($row as $fee => $value)
+ {
+ if (isset($past_fees[$fee]))
+ {
+ $past_fees[$fee] += $value;
+ }
+ }
+ }
+
+ $diff = 0;
+ foreach ($past_fees as $fee => $value)
+ {
+ if ($value > 0)
+ {
+ $diff = bcadd($diff, $fee_data[$fee . '_fee'], $system->SETTINGS['moneydecimals']);
+ $fee_data[$fee . '_fee'] = 0;
+ }
+ }
+
+ $fee_value = bcsub($fee_value, $diff, $system->SETTINGS['moneydecimals']);
+ if ($fee_value < 0)
+ {
+ $fee_value = 0;
+ }
+ }
+
+ if ($just_fee)
+ {
+ $return = $fee_value;
+ }
+ else
+ {
+ $return = array($fee_value, $fee_data);
+ }
+
+ return $return;
}
function update_cat_counters($add, $category, $second_category = 0)
{
- global $_SESSION, $DBPrefix, $system, $catscontrol, $db;
-
- $addsub = ($add) ? '+' : '-';
- // change category counter
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter " . $addsub . " 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $category, 'int');
- $db->query($query, $params);
- // get the category crumbs
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $category, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
- $category_crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- if ($second_category > 0) {
- // change secondary category counter
- $query = "UPDATE " . $DBPrefix . "categories SET counter = counter " . $addsub . " 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $second_category, 'int');
- $db->query($query, $params);
- // get the second category crumbs
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $second_category, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
- $second_category_crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-
- // merge the arrays
- $crumbs = $category_crumbs + $second_category_crumbs;
- } else {
- $crumbs = $category_crumbs;
- }
-
- for ($i = 0; $i < count($crumbs); $i++) {
- $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter " . $addsub . " 1 WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
- $db->query($query, $params);
- }
+ global $_SESSION, $DBPrefix, $system, $catscontrol, $db;
+
+ $addsub = ($add) ? '+' : '-';
+ // change category counter
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter " . $addsub . " 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $category, 'int');
+ $db->query($query, $params);
+ // get the category crumbs
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $category, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+ $category_crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ if ($second_category > 0)
+ {
+ // change secondary category counter
+ $query = "UPDATE " . $DBPrefix . "categories SET counter = counter " . $addsub . " 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $second_category, 'int');
+ $db->query($query, $params);
+ // get the second category crumbs
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $second_category, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+ $second_category_crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+
+ // merge the arrays
+ $crumbs = $category_crumbs + $second_category_crumbs;
+ }
+ else
+ {
+ $crumbs = $category_crumbs;
+ }
+
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ $query = "UPDATE " . $DBPrefix . "categories SET sub_counter = sub_counter " . $addsub . " 1 WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $crumbs[$i]['cat_id'], 'int');
+ $db->query($query, $params);
+ }
}
function get_category_string($sellcat)
{
- global $DBPrefix, $system, $catscontrol, $category_names, $db;
-
- if (empty($sellcat) || !isset($sellcat)) {
- return '';
- }
-
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
- $params = array();
- $params[] = array(':cat_id', $sellcat, 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $TPL_categories_list = '';
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] > 0) {
- if ($i > 0) {
- $TPL_categories_list .= ' > ';
- }
- $TPL_categories_list .= $category_names[$crumbs[$i]['cat_id']];
- }
- }
- return $TPL_categories_list;
+ global $DBPrefix, $system, $catscontrol, $category_names, $db;
+
+ if (empty($sellcat) || !isset($sellcat))
+ return '';
+
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :cat_id";
+ $params = array();
+ $params[] = array(':cat_id', $sellcat, 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $TPL_categories_list = '';
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] > 0)
+ {
+ if ($i > 0)
+ {
+ $TPL_categories_list .= ' > ';
+ }
+ $TPL_categories_list .= $category_names[$crumbs[$i]['cat_id']];
+ }
+ }
+ return $TPL_categories_list;
}
-// TODO: this should be used when a user lists an item and selects gateways
function check_gateway($gateway)
{
- global $user, $db;
- $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "usergateways
- WHERE user_id = :user_id
- AND gateway_id = (SELECT id FROM " . $DBPrefix . "payment_options WHERE is_gateway = 1 && name = :gateway_name)";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $params[] = array(':gateway_name', $gateway, 'str');
- $db->query($query, $params);
- if ($db->result('COUNT') > 0) {
- return true;
- }
- return false;
+ global $user;
+ if ($gateway == 'paypal' && !empty($user->user_data['paypal_email']))
+ return true;
+ if ($gateway == 'authnet' && !empty($user->user_data['authnet_id']) && !empty($user->user_data['authnet_pass']))
+ return true;
+ if ($gateway == 'worldpay' && !empty($user->user_data['worldpay_id']))
+ return true;
+ if ($gateway == 'moneybookers' && !empty($user->user_data['moneybookers_email']))
+ return true;
+ if ($gateway == 'toocheckout' && !empty($user->user_data['toocheckout_id']))
+ return true;
+ return false;
}
function alert_auction_watchers($id, $title, $description)
{
- global $user, $DBPrefix, $db;
-
- // Send notification if users keyword matches (Auction Watch)
- $query = "SELECT auc_watch, email, nick, name, id FROM " . $DBPrefix . "users WHERE auc_watch != '' AND id != :user_id";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $sent_to = array();
- while ($row = $db->fetch()) {
- $w_title = explode(' ', strtolower($title));
- $w_descr = explode(' ', strtolower(str_replace(array(' ', "\n"), '', strip_tags($description))));
- $w_nick = strtolower($user->user_data['nick']);
- $key = explode(' ', $row['auc_watch']);
- if (is_array($key) && count($key) > 0) {
- foreach ($key as $k => $v) {
- $v = trim(strtolower($v));
- if ((in_array($v, $w_title) || in_array($v, $w_descr) || $v == $w_nick) && !in_array($row['id'], $sent_to)) {
- $emailer = new email_handler();
- $emailer->assign_vars(array(
- 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id,
- 'SITENAME' => $system->SETTINGS['sitename'],
- 'TITLE' => $title,
- 'REALNAME' => $row['name'],
- 'KWORD' => $row['auc_watch']
- ));
- $emailer->email_uid = $row['id'];
- $emailer->email_sender($row['email'], 'auction_watchmail.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['471']);
- $sent_to[] = $row['id'];
- }
- }
- }
- }
+ global $user, $DBPrefix, $db;
+
+ // Send notification if users keyword matches (Auction Watch)
+ $query = "SELECT auc_watch, email, nick, name, id FROM " . $DBPrefix . "users WHERE auc_watch != '' AND id != :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $sent_to = array();
+ while ($row = $db->fetch())
+ {
+ $w_title = explode(' ', strtolower($title));
+ $w_descr = explode(' ', strtolower(str_replace(array(' ', "\n"), '', strip_tags($description))));
+ $w_nick = strtolower($user->user_data['nick']);
+ $key = explode(' ', $row['auc_watch']);
+ if (is_array($key) && count($key) > 0)
+ {
+ foreach ($key as $k => $v)
+ {
+ $v = trim(strtolower($v));
+ if ((in_array($v, $w_title) || in_array($v, $w_descr) || $v == $w_nick) && !in_array($row['id'], $sent_to))
+ {
+ $emailer = new email_handler();
+ $emailer->assign_vars(array(
+ 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $id,
+ 'SITENAME' => $system->SETTINGS['sitename'],
+ 'TITLE' => $title,
+ 'REALNAME' => $row['name'],
+ 'KWORD' => $row['auc_watch']
+ ));
+ $emailer->email_uid = $row['id'];
+ $emailer->email_sender($row['email'], 'auction_watchmail.inc.php', $system->SETTINGS['sitename'] . ' ' . $MSG['471']);
+ $sent_to[] = $row['id'];
+ }
+ }
+ }
+ }
}
+
diff --git a/includes/img/cal.gif b/includes/img/cal.gif
old mode 100644
new mode 100755
diff --git a/includes/img/next_mon.gif b/includes/img/next_mon.gif
old mode 100644
new mode 100755
diff --git a/includes/img/next_year.gif b/includes/img/next_year.gif
old mode 100644
new mode 100755
diff --git a/includes/img/no_cal.gif b/includes/img/no_cal.gif
old mode 100644
new mode 100755
diff --git a/includes/img/pixel.gif b/includes/img/pixel.gif
old mode 100644
new mode 100755
diff --git a/includes/img/prev_mon.gif b/includes/img/prev_mon.gif
old mode 100644
new mode 100755
diff --git a/includes/img/prev_year.gif b/includes/img/prev_year.gif
old mode 100644
new mode 100755
diff --git a/includes/img/shade_bl.png b/includes/img/shade_bl.png
old mode 100644
new mode 100755
diff --git a/includes/img/shade_bm.png b/includes/img/shade_bm.png
old mode 100644
new mode 100755
diff --git a/includes/img/shade_br.png b/includes/img/shade_br.png
old mode 100644
new mode 100755
diff --git a/includes/img/shade_mr.png b/includes/img/shade_mr.png
old mode 100644
new mode 100755
diff --git a/includes/img/shade_tr.png b/includes/img/shade_tr.png
old mode 100644
new mode 100755
diff --git a/includes/index.php b/includes/index.php
old mode 100644
new mode 100755
diff --git a/includes/maintenance.php b/includes/maintainance.php
old mode 100644
new mode 100755
similarity index 69%
rename from includes/maintenance.php
rename to includes/maintainance.php
index ce6bf3574..59a8d4cd9
--- a/includes/maintenance.php
+++ b/includes/maintainance.php
@@ -1,6 +1,6 @@
check_maintenance_mode()) {
- echo $system->SETTINGS['maintenance_text'];
- exit;
- }
-}
+if (basename($_SERVER['PHP_SELF']) != 'user_login.php')
+{
+ // Check if we are in Maintainance mode
+ // And if the logged in user is the superuser
+ if ($system->check_maintainance_mode())
+ {
+ echo $system->SETTINGS['maintainance_text'];
+ exit;
+ }
+}
\ No newline at end of file
diff --git a/includes/membertypes.inc.php b/includes/membertypes.inc.php
new file mode 100755
index 000000000..0408ac62f
--- /dev/null
+++ b/includes/membertypes.inc.php
@@ -0,0 +1,36 @@
+ array(
+ 'id' => '24', 'feedbacks' => '9', 'icon' => 'transparent.gif'
+ ),
+'49' => array(
+ 'id' => '14', 'feedbacks' => '49', 'icon' => 'starY.gif'
+ ),
+'50' => array(
+ 'id' => '26', 'feedbacks' => '50', 'icon' => 'starFR.gif'
+ ),
+'99' => array(
+ 'id' => '15', 'feedbacks' => '99', 'icon' => 'starB.gif'
+ ),
+'999' => array(
+ 'id' => '16', 'feedbacks' => '999', 'icon' => 'starT.gif'
+ ),
+'4999' => array(
+ 'id' => '17', 'feedbacks' => '4999', 'icon' => 'starR.gif'
+ ),
+'9999' => array(
+ 'id' => '23', 'feedbacks' => '9999', 'icon' => 'starG.gif'
+ ),
+'24999' => array(
+ 'id' => '19', 'feedbacks' => '24999', 'icon' => 'starFY.gif'
+ ),
+'49999' => array(
+ 'id' => '20', 'feedbacks' => '49999', 'icon' => 'starFT.gif'
+ ),
+'99999' => array(
+ 'id' => '22', 'feedbacks' => '99999', 'icon' => 'starFR.gif'
+ ),
+'999999' => array(
+ 'id' => '21', 'feedbacks' => '999999', 'icon' => 'starFV.gif'
+ )
+);
\ No newline at end of file
diff --git a/includes/messages.inc.php b/includes/messages.inc.php
old mode 100644
new mode 100755
index e8a564b49..e0c5699ef
--- a/includes/messages.inc.php
+++ b/includes/messages.inc.php
@@ -1,6 +1,6 @@
logged_in) {
- $query = "UPDATE " . $DBPrefix . "users SET language = :language WHERE id = :user_id";
- $params = array();
- $params[] = array(':language', $language, 'str');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- } else {
- // Set language cookie
- setcookie('USERLANGUAGE', $language, time() + 31536000, '/');
- }
- }
-} elseif ($user->logged_in) {
- $language = $user->user_data['language'];
-} elseif (isset($_COOKIE['USERLANGUAGE'])) {
- $language = preg_replace("/[^a-zA-Z_]/", '', $_COOKIE['USERLANGUAGE']);
- if (!isValidLanguage($language)) {
- setcookie('USERLANGUAGE', $system->SETTINGS['defaultlanguage'], time() + 31536000, '/');
- }
+if (isset($_GET['lan']) && !empty($_GET['lan']))
+{
+ $language = preg_replace("/[^a-zA-Z_]/", '', $_GET['lan']);
+ if ($user->logged_in)
+ {
+ $query = "UPDATE " . $DBPrefix . "users SET language = :language WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':language', $language, 'str');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ }
+ else
+ {
+ // Set language cookie
+ setcookie('USERLANGUAGE', $language, time() + 31536000, '/');
+ }
+}
+elseif ($user->logged_in)
+{
+ $language = $user->user_data['language'];
+}
+elseif (isset($_COOKIE['USERLANGUAGE']))
+{
+ $language = preg_replace("/[^a-zA-Z_]/", '', $_COOKIE['USERLANGUAGE']);
}
-if (!isset($language) || empty($language)) {
- $language = $system->SETTINGS['defaultlanguage'];
+if (!isset($language) || empty($language))
+{
+ $language = $system->SETTINGS['defaultlanguage'];
}
include MAIN_PATH . 'language/' . $language . '/messages.inc.php';
-if (defined('InAdmin')) {
- include MAIN_PATH . 'language/' . $language . '/admin.inc.php';
+
+//find installed languages
+$LANGUAGES = array();
+if ($handle = opendir(MAIN_PATH . 'language'))
+{
+ while (false !== ($file = readdir($handle)))
+ {
+ if ('.' != $file && '..' != $file)
+ {
+ if (preg_match('/^([a-zA-Z_]{2,})$/i', $file))
+ {
+ $LANGUAGES[$file] = $file;
+ }
+ }
+ }
}
+closedir($handle);
-function isValidLanguage(&$language)
+// check language exists
+if (!in_array($language, $LANGUAGES))
{
- global $LANGUAGES, $system;
- // check language exists
- if (!in_array($language, $LANGUAGES)) {
- $language = $system->SETTINGS['defaultlanguage'];
- return false;
- }
- return true;
+ $language = $system->SETTINGS['defaultlanguage'];
}
function get_lang_img($string)
{
- global $system, $language;
- return $system->SETTINGS['siteurl'] . 'language/' . $language . '/images/' . $string;
+ global $system, $language;
+ return $system->SETTINGS['siteurl'] . 'language/' . $language . '/images/' . $string;
}
diff --git a/includes/packages/PHPMailer/PHPMailerAutoload.php b/includes/packages/PHPMailer/PHPMailerAutoload.php
old mode 100644
new mode 100755
index eaa2e3034..914171ba4
--- a/includes/packages/PHPMailer/PHPMailerAutoload.php
+++ b/includes/packages/PHPMailer/PHPMailerAutoload.php
@@ -46,4 +46,4 @@ function __autoload($classname)
{
PHPMailerAutoload($classname);
}
-}
+}
\ No newline at end of file
diff --git a/includes/packages/PHPMailer/class.phpmailer.php b/includes/packages/PHPMailer/class.phpmailer.php
old mode 100644
new mode 100755
index acc006d6b..ed7467113
--- a/includes/packages/PHPMailer/class.phpmailer.php
+++ b/includes/packages/PHPMailer/class.phpmailer.php
@@ -31,7 +31,7 @@ class PHPMailer
* The PHPMailer Version number.
* @var string
*/
- public $Version = '5.2.24';
+ public $Version = '5.2.13';
/**
* Email priority.
@@ -184,7 +184,7 @@ class PHPMailer
public $PluginDir = '';
/**
- * The email address that a reading confirmation should be sent to, also known as read receipt.
+ * The email address that a reading confirmation should be sent to.
* @var string
*/
public $ConfirmReadingTo = '';
@@ -201,9 +201,6 @@ class PHPMailer
/**
* An ID to be used in the Message-ID header.
* If empty, a unique id will be generated.
- * You can set your own, but it must be in the format "",
- * as defined in RFC5322 section 3.6.4 or it will be ignored.
- * @see https://tools.ietf.org/html/rfc5322#section-3.6.4
* @var string
*/
public $MessageID = '';
@@ -288,7 +285,7 @@ class PHPMailer
/**
* SMTP auth type.
- * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
+ * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
* @var string
*/
public $AuthType = '';
@@ -355,7 +352,6 @@ class PHPMailer
/**
* Whether to split multiple to addresses into multiple messages
* or send them all in one message.
- * Only supported in `mail` and `sendmail` transports, not in SMTP.
* @var boolean
*/
public $SingleTo = false;
@@ -398,7 +394,7 @@ class PHPMailer
/**
* DKIM Identity.
- * Usually the email address used as the source of the email.
+ * Usually the email address used as the source of the email
* @var string
*/
public $DKIM_identity = '';
@@ -423,13 +419,6 @@ class PHPMailer
*/
public $DKIM_private = '';
- /**
- * DKIM private key string.
- * If set, takes precedence over `$DKIM_private`.
- * @var string
- */
- public $DKIM_private_string = '';
-
/**
* Callback Action function name.
*
@@ -440,9 +429,9 @@ class PHPMailer
*
* Parameters:
* boolean $result result of the send action
- * array $to email addresses of the recipients
- * array $cc cc email addresses
- * array $bcc bcc email addresses
+ * string $to email address of the recipient
+ * string $cc cc email addresses
+ * string $bcc bcc email addresses
* string $subject the subject
* string $body the email body
* string $from email address of sender
@@ -458,13 +447,15 @@ class PHPMailer
public $XMailer = '';
/**
- * Which validator to use by default when validating email addresses.
- * May be a callable to inject your own validator, but there are several built-in validators.
- * @see PHPMailer::validateAddress()
- * @var string|callable
- * @static
+ * Only For XOAUTH - Google
+ * Options: An empty string for PHPMailer default, Enter the email used to get access token
+ * @var string
*/
- public static $validator = 'auto';
+// public $UserEmail = '';
+// public $RefreshToken = '';
+// public $ClientId = '';
+// public $ClientSecret = '';
+
/**
* An instance of the SMTP sender class.
@@ -474,21 +465,21 @@ class PHPMailer
protected $smtp = null;
/**
- * The array of 'to' names and addresses.
+ * The array of 'to' addresses.
* @var array
* @access protected
*/
protected $to = array();
/**
- * The array of 'cc' names and addresses.
+ * The array of 'cc' addresses.
* @var array
* @access protected
*/
protected $cc = array();
/**
- * The array of 'bcc' names and addresses.
+ * The array of 'bcc' addresses.
* @var array
* @access protected
*/
@@ -506,32 +497,9 @@ class PHPMailer
* Includes all of $to, $cc, $bcc
* @var array
* @access protected
- * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
*/
protected $all_recipients = array();
- /**
- * An array of names and addresses queued for validation.
- * In send(), valid and non duplicate entries are moved to $all_recipients
- * and one of $to, $cc, or $bcc.
- * This array is used only for addresses with IDN.
- * @var array
- * @access protected
- * @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
- * @see PHPMailer::$all_recipients
- */
- protected $RecipientsQueue = array();
-
- /**
- * An array of reply-to names and addresses queued for validation.
- * In send(), valid and non duplicate entries are moved to $ReplyTo.
- * This array is used only for addresses with IDN.
- * @var array
- * @access protected
- * @see PHPMailer::$ReplyTo
- */
- protected $ReplyToQueue = array();
-
/**
* The array of attachments.
* @var array
@@ -654,11 +622,9 @@ class PHPMailer
* Constructor.
* @param boolean $exceptions Should we throw external exceptions?
*/
- public function __construct($exceptions = null)
+ public function __construct($exceptions = false)
{
- if ($exceptions !== null) {
- $this->exceptions = (boolean)$exceptions;
- }
+ $this->exceptions = (boolean)$exceptions;
}
/**
@@ -667,7 +633,9 @@ public function __construct($exceptions = null)
public function __destruct()
{
//Close any open SMTP connection nicely
- $this->smtpClose();
+ if ($this->Mailer == 'smtp') {
+ $this->smtpClose();
+ }
}
/**
@@ -691,16 +659,14 @@ private function mailPassthru($to, $subject, $body, $header, $params)
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
-
- //Can't use additional_parameters in safe_mode, calling mail() with null params breaks
- //@link http://php.net/manual/en/function.mail.php
- if (ini_get('safe_mode') or !$this->UseSendmailOptions or is_null($params)) {
+ if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
$result = @mail($to, $subject, $body, $header);
} else {
$result = @mail($to, $subject, $body, $header, $params);
}
return $result;
}
+
/**
* Output debugging info via user-defined method.
* Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
@@ -735,7 +701,7 @@ protected function edebug($str)
case 'echo':
default:
//Normalize line breaks
- $str = preg_replace('/\r\n?/ms', "\n", $str);
+ $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
"\n",
"\n \t ",
@@ -810,101 +776,55 @@ public function isQmail()
/**
* Add a "To" address.
- * @param string $address The email address to send to
+ * @param string $address
* @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
+ * @return boolean true on success, false if address already used
*/
public function addAddress($address, $name = '')
{
- return $this->addOrEnqueueAnAddress('to', $address, $name);
+ return $this->addAnAddress('to', $address, $name);
}
/**
* Add a "CC" address.
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
- * @param string $address The email address to send to
+ * @param string $address
* @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
+ * @return boolean true on success, false if address already used
*/
public function addCC($address, $name = '')
{
- return $this->addOrEnqueueAnAddress('cc', $address, $name);
+ return $this->addAnAddress('cc', $address, $name);
}
/**
* Add a "BCC" address.
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
- * @param string $address The email address to send to
+ * @param string $address
* @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
+ * @return boolean true on success, false if address already used
*/
public function addBCC($address, $name = '')
{
- return $this->addOrEnqueueAnAddress('bcc', $address, $name);
+ return $this->addAnAddress('bcc', $address, $name);
}
/**
- * Add a "Reply-To" address.
- * @param string $address The email address to reply to
+ * Add a "Reply-to" address.
+ * @param string $address
* @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
+ * @return boolean
*/
public function addReplyTo($address, $name = '')
{
- return $this->addOrEnqueueAnAddress('Reply-To', $address, $name);
- }
-
- /**
- * Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer
- * can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still
- * be modified after calling this function), addition of such addresses is delayed until send().
- * Addresses that have been added already return false, but do not throw exceptions.
- * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
- * @param string $address The email address to send, resp. to reply to
- * @param string $name
- * @throws phpmailerException
- * @return boolean true on success, false if address already used or invalid in some way
- * @access protected
- */
- protected function addOrEnqueueAnAddress($kind, $address, $name)
- {
- $address = trim($address);
- $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
- if (($pos = strrpos($address, '@')) === false) {
- // At-sign is misssing.
- $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
- $this->setError($error_message);
- $this->edebug($error_message);
- if ($this->exceptions) {
- throw new phpmailerException($error_message);
- }
- return false;
- }
- $params = array($kind, $address, $name);
- // Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
- if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) {
- if ($kind != 'Reply-To') {
- if (!array_key_exists($address, $this->RecipientsQueue)) {
- $this->RecipientsQueue[$address] = $params;
- return true;
- }
- } else {
- if (!array_key_exists($address, $this->ReplyToQueue)) {
- $this->ReplyToQueue[$address] = $params;
- return true;
- }
- }
- return false;
- }
- // Immediately add standard addresses without IDN.
- return call_user_func_array(array($this, 'addAnAddress'), $params);
+ return $this->addAnAddress('Reply-To', $address, $name);
}
/**
- * Add an address to one of the recipient arrays or to the ReplyTo array.
- * Addresses that have been added already return false, but do not throw exceptions.
- * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
- * @param string $address The email address to send, resp. to reply to
+ * Add an address to one of the recipient arrays.
+ * Addresses that have been added already return false, but do not throw exceptions
+ * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
+ * @param string $address The email address to send to
* @param string $name
* @throws phpmailerException
* @return boolean true on success, false if address already used or invalid in some way
@@ -912,26 +832,26 @@ protected function addOrEnqueueAnAddress($kind, $address, $name)
*/
protected function addAnAddress($kind, $address, $name = '')
{
- if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
- $error_message = $this->lang('Invalid recipient kind: ') . $kind;
- $this->setError($error_message);
- $this->edebug($error_message);
+ if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
+ $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
+ $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new phpmailerException('Invalid recipient array: ' . $kind);
}
return false;
}
+ $address = trim($address);
+ $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (!$this->validateAddress($address)) {
- $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
- $this->setError($error_message);
- $this->edebug($error_message);
+ $this->setError($this->lang('invalid_address') . ': ' . $address);
+ $this->edebug($this->lang('invalid_address') . ': ' . $address);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
}
return false;
}
if ($kind != 'Reply-To') {
- if (!array_key_exists(strtolower($address), $this->all_recipients)) {
+ if (!isset($this->all_recipients[strtolower($address)])) {
array_push($this->$kind, array($address, $name));
$this->all_recipients[strtolower($address)] = true;
return true;
@@ -1012,15 +932,11 @@ public function setFrom($address, $name = '', $auto = true)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
- // Don't validate now addresses with IDN. Will be done in send().
- if (($pos = strrpos($address, '@')) === false or
- (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
- !$this->validateAddress($address)) {
- $error_message = $this->lang('invalid_address') . " (setFrom) $address";
- $this->setError($error_message);
- $this->edebug($error_message);
+ if (!$this->validateAddress($address)) {
+ $this->setError($this->lang('invalid_address') . ': ' . $address);
+ $this->edebug($this->lang('invalid_address') . ': ' . $address);
if ($this->exceptions) {
- throw new phpmailerException($error_message);
+ throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
}
return false;
}
@@ -1049,34 +965,19 @@ public function getLastMessageID()
/**
* Check that a string looks like an email address.
* @param string $address The email address to check
- * @param string|callable $patternselect A selector for the validation pattern to use :
- * * `auto` Pick best pattern automatically;
+ * @param string $patternselect A selector for the validation pattern to use :
+ * * `auto` Pick strictest one automatically;
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
* * `pcre` Use old PCRE implementation;
- * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
+ * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
* * `noregex` Don't use a regex: super fast, really dumb.
- * Alternatively you may pass in a callable to inject your own validator, for example:
- * PHPMailer::validateAddress('user@example.com', function($address) {
- * return (strpos($address, '@') !== false);
- * });
- * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
* @return boolean
* @static
* @access public
*/
- public static function validateAddress($address, $patternselect = null)
+ public static function validateAddress($address, $patternselect = 'auto')
{
- if (is_null($patternselect)) {
- $patternselect = self::$validator;
- }
- if (is_callable($patternselect)) {
- return call_user_func($patternselect, $address);
- }
- //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321
- if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) {
- return false;
- }
if (!$patternselect or $patternselect == 'auto') {
//Check this constant first so it works when extension_loaded() is disabled by safe mode
//Constant was added in PHP 5.2.4
@@ -1156,48 +1057,6 @@ public static function validateAddress($address, $patternselect = null)
}
}
- /**
- * Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
- * "intl" and "mbstring" PHP extensions.
- * @return bool "true" if required functions for IDN support are present
- */
- public function idnSupported()
- {
- // @TODO: Write our own "idn_to_ascii" function for PHP <= 5.2.
- return function_exists('idn_to_ascii') and function_exists('mb_convert_encoding');
- }
-
- /**
- * Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
- * Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet.
- * This function silently returns unmodified address if:
- * - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form)
- * - Conversion to punycode is impossible (e.g. required PHP functions are not available)
- * or fails for any reason (e.g. domain has characters not allowed in an IDN)
- * @see PHPMailer::$CharSet
- * @param string $address The email address to convert
- * @return string The encoded address in ASCII form
- */
- public function punyencodeAddress($address)
- {
- // Verify we have required functions, CharSet, and at-sign.
- if ($this->idnSupported() and
- !empty($this->CharSet) and
- ($pos = strrpos($address, '@')) !== false) {
- $domain = substr($address, ++$pos);
- // Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
- if ($this->has8bitChars($domain) and @mb_check_encoding($domain, $this->CharSet)) {
- $domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet);
- if (($punycode = defined('INTL_IDNA_VARIANT_UTS46') ?
- idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) :
- idn_to_ascii($domain)) !== false) {
- return substr($address, 0, $pos) . $punycode;
- }
- }
- }
- return $address;
- }
-
/**
* Create a message and send it.
* Uses the sending method specified by $Mailer.
@@ -1229,41 +1088,17 @@ public function send()
public function preSend()
{
try {
- $this->error_count = 0; // Reset errors
$this->mailHeader = '';
-
- // Dequeue recipient and Reply-To addresses with IDN
- foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
- $params[1] = $this->punyencodeAddress($params[1]);
- call_user_func_array(array($this, 'addAnAddress'), $params);
- }
if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
}
- // Validate From, Sender, and ConfirmReadingTo addresses
- foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
- $this->$address_kind = trim($this->$address_kind);
- if (empty($this->$address_kind)) {
- continue;
- }
- $this->$address_kind = $this->punyencodeAddress($this->$address_kind);
- if (!$this->validateAddress($this->$address_kind)) {
- $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
- $this->setError($error_message);
- $this->edebug($error_message);
- if ($this->exceptions) {
- throw new phpmailerException($error_message);
- }
- return false;
- }
- }
-
// Set whether the message is multipart/alternative
- if ($this->alternativeExists()) {
+ if (!empty($this->AltBody)) {
$this->ContentType = 'multipart/alternative';
}
+ $this->error_count = 0; // Reset errors
$this->setMessageType();
// Refuse to send an empty message unless we are specifically allowing it
if (!$this->AllowEmpty and empty($this->Body)) {
@@ -1294,11 +1129,9 @@ public function preSend()
// Sign with DKIM if enabled
if (!empty($this->DKIM_domain)
+ && !empty($this->DKIM_private)
&& !empty($this->DKIM_selector)
- && (!empty($this->DKIM_private_string)
- || (!empty($this->DKIM_private) && file_exists($this->DKIM_private))
- )
- ) {
+ && file_exists($this->DKIM_private)) {
$header_dkim = $this->DKIM_Add(
$this->MIMEHeader . $this->mailHeader,
$this->encodeHeader($this->secureHeader($this->Subject)),
@@ -1364,24 +1197,19 @@ public function postSend()
*/
protected function sendmailSend($header, $body)
{
- // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
- if (!empty($this->Sender) and self::isShellSafe($this->Sender)) {
+ if ($this->Sender != '') {
if ($this->Mailer == 'qmail') {
- $sendmailFmt = '%s -f%s';
+ $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
} else {
- $sendmailFmt = '%s -oi -f%s -t';
+ $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
}
} else {
if ($this->Mailer == 'qmail') {
- $sendmailFmt = '%s';
+ $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
} else {
- $sendmailFmt = '%s -oi -t';
+ $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
}
}
-
- // TODO: If possible, this should be changed to escapeshellarg. Needs thorough testing.
- $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
-
if ($this->SingleTo) {
foreach ($this->SingleToArray as $toAddr) {
if (!@$mail = popen($sendmail, 'w')) {
@@ -1411,15 +1239,7 @@ protected function sendmailSend($header, $body)
fputs($mail, $header);
fputs($mail, $body);
$result = pclose($mail);
- $this->doCallback(
- ($result == 0),
- $this->to,
- $this->cc,
- $this->bcc,
- $this->Subject,
- $body,
- $this->From
- );
+ $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
if ($result != 0) {
throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
}
@@ -1427,40 +1247,6 @@ protected function sendmailSend($header, $body)
return true;
}
- /**
- * Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
- *
- * Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
- * @param string $string The string to be validated
- * @see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
- * @access protected
- * @return boolean
- */
- protected static function isShellSafe($string)
- {
- // Future-proof
- if (escapeshellcmd($string) !== $string
- or !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))
- ) {
- return false;
- }
-
- $length = strlen($string);
-
- for ($i = 0; $i < $length; $i++) {
- $c = $string[$i];
-
- // All other characters have a special meaning in at least one common shell, including = and +.
- // Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
- // Note that this does permit non-Latin alphanumeric characters based on the current locale.
- if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
- return false;
- }
- }
-
- return true;
- }
-
/**
* Send mail using the PHP mail() function.
* @param string $header The message headers
@@ -1478,20 +1264,17 @@ protected function mailSend($header, $body)
}
$to = implode(', ', $toArr);
- $params = null;
- //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
- if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
- // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
- if (self::isShellSafe($this->Sender)) {
- $params = sprintf('-f%s', $this->Sender);
- }
+ if (empty($this->Sender)) {
+ $params = ' ';
+ } else {
+ $params = sprintf('-f%s', $this->Sender);
}
- if (!empty($this->Sender) and !ini_get('safe_mode') and $this->validateAddress($this->Sender)) {
+ if ($this->Sender != '' and !ini_get('safe_mode')) {
$old_from = ini_get('sendmail_from');
ini_set('sendmail_from', $this->Sender);
}
$result = false;
- if ($this->SingleTo and count($toArr) > 1) {
+ if ($this->SingleTo && count($toArr) > 1) {
foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
$this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
@@ -1540,10 +1323,10 @@ protected function smtpSend($header, $body)
if (!$this->smtpConnect($this->SMTPOptions)) {
throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
}
- if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
- $smtp_from = $this->Sender;
- } else {
+ if ('' == $this->Sender) {
$smtp_from = $this->From;
+ } else {
+ $smtp_from = $this->Sender;
}
if (!$this->smtp->mail($smtp_from)) {
$this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
@@ -1597,17 +1380,12 @@ protected function smtpSend($header, $body)
* @throws phpmailerException
* @return boolean
*/
- public function smtpConnect($options = null)
+ public function smtpConnect($options = array())
{
if (is_null($this->smtp)) {
$this->smtp = $this->getSMTPInstance();
}
- //If no options are provided, use whatever is set in the instance
- if (is_null($options)) {
- $options = $this->SMTPOptions;
- }
-
// Already connected?
if ($this->smtp->connected()) {
return true;
@@ -1622,13 +1400,8 @@ public function smtpConnect($options = null)
foreach ($hosts as $hostentry) {
$hostinfo = array();
- if (!preg_match(
- '/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*|\[[a-fA-F0-9:]+\]):?([0-9]*)$/',
- trim($hostentry),
- $hostinfo
- )) {
+ if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
// Not a valid host entry
- $this->edebug('Ignoring invalid host: ' . $hostentry);
continue;
}
// $hostinfo[2]: optional ssl or tls prefix
@@ -1682,7 +1455,7 @@ public function smtpConnect($options = null)
if (!$this->smtp->startTLS()) {
throw new phpmailerException($this->lang('connect_host'));
}
- // We must resend EHLO after TLS negotiation
+ // We must resend HELO after tls negotiation
$this->smtp->hello($hello);
}
if ($this->SMTPAuth) {
@@ -1721,7 +1494,7 @@ public function smtpConnect($options = null)
*/
public function smtpClose()
{
- if (is_a($this->smtp, 'SMTP')) {
+ if ($this->smtp !== null) {
if ($this->smtp->connected()) {
$this->smtp->quit();
$this->smtp->close();
@@ -1740,20 +1513,6 @@ public function smtpClose()
*/
public function setLanguage($langcode = 'en', $lang_path = '')
{
- // Backwards compatibility for renamed language codes
- $renamed_langcodes = array(
- 'br' => 'pt_br',
- 'cz' => 'cs',
- 'dk' => 'da',
- 'no' => 'nb',
- 'se' => 'sv',
- 'sr' => 'rs'
- );
-
- if (isset($renamed_langcodes[$langcode])) {
- $langcode = $renamed_langcodes[$langcode];
- }
-
// Define full set of translatable strings in English
$PHPMAILER_LANG = array(
'authenticate' => 'SMTP Error: Could not authenticate.',
@@ -1766,7 +1525,7 @@ public function setLanguage($langcode = 'en', $lang_path = '')
'file_open' => 'File Error: Could not open file: ',
'from_failed' => 'The following From address failed: ',
'instantiate' => 'Could not instantiate mail function.',
- 'invalid_address' => 'Invalid address: ',
+ 'invalid_address' => 'Invalid address',
'mailer_not_supported' => ' mailer is not supported.',
'provide_address' => 'You must provide at least one recipient email address.',
'recipients_failed' => 'SMTP Error: The following recipients failed: ',
@@ -1780,10 +1539,6 @@ public function setLanguage($langcode = 'en', $lang_path = '')
// Calculate an absolute path so it can work if CWD is not here
$lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
}
- //Validate $langcode
- if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
- $langcode = 'en';
- }
$foundlang = true;
$lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
// There is no English translation file
@@ -2030,7 +1785,11 @@ public function createHeader()
{
$result = '';
- $result .= $this->headerLine('Date', $this->MessageDate == '' ? self::rfcDate() : $this->MessageDate);
+ if ($this->MessageDate == '') {
+ $this->MessageDate = self::rfcDate();
+ }
+ $result .= $this->headerLine('Date', $this->MessageDate);
+
// To be created automatically by mail()
if ($this->SingleTo) {
@@ -2074,9 +1833,7 @@ public function createHeader()
$result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
}
- // Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
- // https://tools.ietf.org/html/rfc5322#section-3.6.4
- if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) {
+ if ($this->MessageID != '') {
$this->lastMessageID = $this->MessageID;
} else {
$this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
@@ -2098,7 +1855,7 @@ public function createHeader()
}
if ($this->ConfirmReadingTo != '') {
- $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
+ $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
}
// Add custom headers
@@ -2178,15 +1935,7 @@ public function getMailMIME()
*/
public function getSentMIMEMessage()
{
- return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
- }
-
- /**
- * Create unique ID
- * @return string
- */
- protected function generateId() {
- return md5(uniqid(time()));
+ return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
}
/**
@@ -2200,7 +1949,7 @@ public function createBody()
{
$body = '';
//Create unique IDs and preset boundaries
- $this->uniqueid = $this->generateId();
+ $this->uniqueid = md5(uniqid(time()));
$this->boundary[1] = 'b1_' . $this->uniqueid;
$this->boundary[2] = 'b2_' . $this->uniqueid;
$this->boundary[3] = 'b3_' . $this->uniqueid;
@@ -2216,12 +1965,12 @@ public function createBody()
//Can we do a 7-bit downgrade?
if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
$bodyEncoding = '7bit';
- //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
$bodyCharSet = 'us-ascii';
}
//If lines are too long, and we're not already using an encoding that will shorten them,
- //change to quoted-printable transfer encoding for the body part only
+ //change to quoted-printable transfer encoding
if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
+ $this->Encoding = 'quoted-printable';
$bodyEncoding = 'quoted-printable';
}
@@ -2230,12 +1979,10 @@ public function createBody()
//Can we do a 7-bit downgrade?
if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
$altBodyEncoding = '7bit';
- //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
$altBodyCharSet = 'us-ascii';
}
- //If lines are too long, and we're not already using an encoding that will shorten them,
- //change to quoted-printable transfer encoding for the alt body part only
- if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
+ //If lines are too long, change to quoted-printable transfer encoding
+ if (self::hasLineLongerThanMax($this->AltBody)) {
$altBodyEncoding = 'quoted-printable';
}
//Use this as a preamble in all multipart message types
@@ -2338,10 +2085,8 @@ public function createBody()
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
default:
- // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types
- //Reset the `Encoding` property in case we changed it for line length reasons
- $this->Encoding = $bodyEncoding;
- $body .= $this->encodeString($this->Body, $this->Encoding);
+ // catch case 'plain' and case ''
+ $body .= $this->encodeString($this->Body, $bodyEncoding);
break;
}
@@ -2447,7 +2192,8 @@ protected function endBoundary($boundary)
/**
* Set the message type.
- * PHPMailer only supports some preset message types, not arbitrary MIME structures.
+ * PHPMailer only supports some preset message types,
+ * not arbitrary MIME structures.
* @access protected
* @return void
*/
@@ -2465,7 +2211,6 @@ protected function setMessageType()
}
$this->message_type = implode('_', $type);
if ($this->message_type == '') {
- //The 'plain' message_type refers to the message having a single body element, not that it is plain-text
$this->message_type = 'plain';
}
}
@@ -2495,7 +2240,6 @@ public function textLine($value)
/**
* Add an attachment from a path on the filesystem.
- * Never use a user-supplied path to a file!
* Returns false if the file could not be found or read.
* @param string $path Path to the attachment.
* @param string $name Overrides the attachment name.
@@ -2592,7 +2336,7 @@ protected function attachAll($disposition_type, $boundary)
$type = $attachment[4];
$disposition = $attachment[6];
$cid = $attachment[7];
- if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) {
+ if ($disposition == 'inline' && isset($cidUniq[$cid])) {
continue;
}
$cidUniq[$cid] = true;
@@ -2683,6 +2427,7 @@ protected function attachAll($disposition_type, $boundary)
* @param string $path The full path to the file
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
* @throws phpmailerException
+ * @see EncodeFile(encodeFile
* @access protected
* @return string
*/
@@ -2979,6 +2724,7 @@ public function encodeQ($str, $position = 'text')
return str_replace(' ', '_', $encoded);
}
+
/**
* Add a string or binary attachment (non-filesystem).
* This method can be used to attach ascii or binary data,
@@ -3021,7 +2767,6 @@ public function addStringAttachment(
* displayed inline with the message, not just attached for download.
* This is used in HTML messages that embed the images
* the HTML refers to using the $cid value.
- * Never use a user-supplied path to a file!
* @param string $path Path to the attachment.
* @param string $cid Content ID of the attachment; Use this to reference
* the content when using an embedded image in HTML.
@@ -3141,22 +2886,6 @@ public function alternativeExists()
return !empty($this->AltBody);
}
- /**
- * Clear queued addresses of given kind.
- * @access protected
- * @param string $kind 'to', 'cc', or 'bcc'
- * @return void
- */
- public function clearQueuedAddresses($kind)
- {
- $RecipientsQueue = $this->RecipientsQueue;
- foreach ($RecipientsQueue as $address => $params) {
- if ($params[0] == $kind) {
- unset($this->RecipientsQueue[$address]);
- }
- }
- }
-
/**
* Clear all To recipients.
* @return void
@@ -3167,7 +2896,6 @@ public function clearAddresses()
unset($this->all_recipients[strtolower($to[0])]);
}
$this->to = array();
- $this->clearQueuedAddresses('to');
}
/**
@@ -3180,7 +2908,6 @@ public function clearCCs()
unset($this->all_recipients[strtolower($cc[0])]);
}
$this->cc = array();
- $this->clearQueuedAddresses('cc');
}
/**
@@ -3193,7 +2920,6 @@ public function clearBCCs()
unset($this->all_recipients[strtolower($bcc[0])]);
}
$this->bcc = array();
- $this->clearQueuedAddresses('bcc');
}
/**
@@ -3203,7 +2929,6 @@ public function clearBCCs()
public function clearReplyTos()
{
$this->ReplyTo = array();
- $this->ReplyToQueue = array();
}
/**
@@ -3216,7 +2941,6 @@ public function clearAllRecipients()
$this->cc = array();
$this->bcc = array();
$this->all_recipients = array();
- $this->RecipientsQueue = array();
}
/**
@@ -3373,7 +3097,8 @@ public function addCustomHeader($name, $value = null)
}
/**
- * Returns all custom headers.
+ * Returns all custom headers
+ *
* @return array
*/
public function getCustomHeaders()
@@ -3382,29 +3107,21 @@ public function getCustomHeaders()
}
/**
- * Create a message body from an HTML string.
- * Automatically inlines images and creates a plain-text version by converting the HTML,
- * overwriting any existing values in Body and AltBody.
- * Do not source $message content from user input!
- * $basedir is prepended when handling relative URLs, e.g. and must not be empty
- * will look for an image file in $basedir/images/a.png and convert it to inline.
- * If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email)
- * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly.
+ * Create a message from an HTML string.
+ * Automatically makes modifications for inline images and backgrounds
+ * and creates a plain-text version by converting the HTML.
+ * Overwrites any existing values in $this->Body and $this->AltBody
* @access public
* @param string $message HTML message string
- * @param string $basedir Absolute path to a base directory to prepend to relative paths to images
+ * @param string $basedir baseline directory for path
* @param boolean|callable $advanced Whether to use the internal HTML to text converter
- * or your own custom converter @see PHPMailer::html2text()
- * @return string $message The transformed message Body
+ * or your own custom converter @see html2text()
+ * @return string $message
*/
public function msgHTML($message, $basedir = '', $advanced = false)
{
preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
- if (array_key_exists(2, $images)) {
- if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
- // Ensure $basedir has a trailing /
- $basedir .= '/';
- }
+ if (isset($images[2])) {
foreach ($images[2] as $imgindex => $url) {
// Convert data URIs into embedded images
if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
@@ -3422,24 +3139,18 @@ public function msgHTML($message, $basedir = '', $advanced = false)
$message
);
}
- continue;
- }
- if (
- // Only process relative URLs if a basedir is provided (i.e. no absolute local paths)
- !empty($basedir)
- // Ignore URLs containing parent dir traversal (..)
- && (strpos($url, '..') === false)
- // Do not change urls that are already inline images
- && substr($url, 0, 4) !== 'cid:'
- // Do not change absolute URLs, including anonymous protocol
- && !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
- ) {
+ } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[A-z]+://#', $url)) {
+ // Do not change urls for absolute images (thanks to corvuscorax)
+ // Do not change urls that are already inline images
$filename = basename($url);
$directory = dirname($url);
if ($directory == '.') {
$directory = '';
}
$cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
+ if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
+ $basedir .= '/';
+ }
if (strlen($directory) > 1 && substr($directory, -1) != '/') {
$directory .= '/';
}
@@ -3464,7 +3175,7 @@ public function msgHTML($message, $basedir = '', $advanced = false)
// Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
$this->Body = $this->normalizeBreaks($message);
$this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
- if (!$this->alternativeExists()) {
+ if (empty($this->AltBody)) {
$this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
self::CRLF . self::CRLF;
}
@@ -3475,7 +3186,7 @@ public function msgHTML($message, $basedir = '', $advanced = false)
* Convert an HTML string into plain text.
* This is used by msgHTML().
* Note - older versions of this function used a bundled advanced converter
- * which was been removed for license reasons in #232.
+ * which was been removed for license reasons in #232
* Example usage:
*
* // Use default conversion
@@ -3734,6 +3445,7 @@ public static function normalizeBreaks($text, $breaktype = "\r\n")
return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
}
+
/**
* Set the public and private key files and password for S/MIME signing.
* @access public
@@ -3775,7 +3487,7 @@ public function DKIM_QP($txt)
* @access public
* @param string $signHeader
* @throws phpmailerException
- * @return string The DKIM signature value
+ * @return string
*/
public function DKIM_Sign($signHeader)
{
@@ -3785,35 +3497,15 @@ public function DKIM_Sign($signHeader)
}
return '';
}
- $privKeyStr = !empty($this->DKIM_private_string) ? $this->DKIM_private_string : file_get_contents($this->DKIM_private);
- if ('' != $this->DKIM_passphrase) {
+ $privKeyStr = file_get_contents($this->DKIM_private);
+ if ($this->DKIM_passphrase != '') {
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
} else {
- $privKey = openssl_pkey_get_private($privKeyStr);
+ $privKey = $privKeyStr;
}
- //Workaround for missing digest algorithms in old PHP & OpenSSL versions
- //@link http://stackoverflow.com/a/11117338/333340
- if (version_compare(PHP_VERSION, '5.3.0') >= 0 and
- in_array('sha256WithRSAEncryption', openssl_get_md_methods(true))) {
- if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
- openssl_pkey_free($privKey);
- return base64_encode($signature);
- }
- } else {
- $pinfo = openssl_pkey_get_details($privKey);
- $hash = hash('sha256', $signHeader);
- //'Magic' constant for SHA256 from RFC3447
- //@link https://tools.ietf.org/html/rfc3447#page-43
- $t = '3031300d060960864801650304020105000420' . $hash;
- $pslen = $pinfo['bits'] / 8 - (strlen($t) / 2 + 3);
- $eb = pack('H*', '0001' . str_repeat('FF', $pslen) . '00' . $t);
-
- if (openssl_private_encrypt($eb, $signature, $privKey, OPENSSL_NO_PADDING)) {
- openssl_pkey_free($privKey);
- return base64_encode($signature);
- }
+ if (openssl_sign($signHeader, $signature, $privKey)) {
+ return base64_encode($signature);
}
- openssl_pkey_free($privKey);
return '';
}
@@ -3830,7 +3522,7 @@ public function DKIM_HeaderC($signHeader)
foreach ($lines as $key => $line) {
list($heading, $value) = explode(':', $line, 2);
$heading = strtolower($heading);
- $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces
+ $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
$lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
}
$signHeader = implode("\r\n", $lines);
@@ -3868,7 +3560,7 @@ public function DKIM_BodyC($body)
*/
public function DKIM_Add($headers_line, $subject, $body)
{
- $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms
+ $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
$DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
$DKIMquery = 'dns/txt'; // Query method
$DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
@@ -3876,7 +3568,6 @@ public function DKIM_Add($headers_line, $subject, $body)
$headers = explode($this->LE, $headers_line);
$from_header = '';
$to_header = '';
- $date_header = '';
$current = '';
foreach ($headers as $header) {
if (strpos($header, 'From:') === 0) {
@@ -3885,9 +3576,6 @@ public function DKIM_Add($headers_line, $subject, $body)
} elseif (strpos($header, 'To:') === 0) {
$to_header = $header;
$current = 'to_header';
- } elseif (strpos($header, 'Date:') === 0) {
- $date_header = $header;
- $current = 'date_header';
} else {
if (!empty($$current) && strpos($header, ' =?') === 0) {
$$current .= $header;
@@ -3898,7 +3586,6 @@ public function DKIM_Add($headers_line, $subject, $body)
}
$from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
$to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
- $date = str_replace('|', '=7C', $this->DKIM_QP($date_header));
$subject = str_replace(
'|',
'=7C',
@@ -3906,7 +3593,7 @@ public function DKIM_Add($headers_line, $subject, $body)
); // Copied header fields (dkim-quoted-printable)
$body = $this->DKIM_BodyC($body);
$DKIMlen = strlen($body); // Length of body
- $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body
+ $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
if ('' == $this->DKIM_identity) {
$ident = '';
} else {
@@ -3919,18 +3606,16 @@ public function DKIM_Add($headers_line, $subject, $body)
$this->DKIM_selector .
";\r\n" .
"\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
- "\th=From:To:Date:Subject;\r\n" .
+ "\th=From:To:Subject;\r\n" .
"\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
"\tz=$from\r\n" .
"\t|$to\r\n" .
- "\t|$date\r\n" .
"\t|$subject;\r\n" .
"\tbh=" . $DKIMb64 . ";\r\n" .
"\tb=";
$toSign = $this->DKIM_HeaderC(
$from_header . "\r\n" .
$to_header . "\r\n" .
- $date_header . "\r\n" .
$subject_header . "\r\n" .
$dkimhdrs
);
@@ -3952,7 +3637,6 @@ public static function hasLineLongerThanMax($str)
/**
* Allows for public read access to 'to' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
* @access public
* @return array
*/
@@ -3963,7 +3647,6 @@ public function getToAddresses()
/**
* Allows for public read access to 'cc' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
* @access public
* @return array
*/
@@ -3974,7 +3657,6 @@ public function getCcAddresses()
/**
* Allows for public read access to 'bcc' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
* @access public
* @return array
*/
@@ -3985,7 +3667,6 @@ public function getBccAddresses()
/**
* Allows for public read access to 'ReplyTo' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
* @access public
* @return array
*/
@@ -3996,7 +3677,6 @@ public function getReplyToAddresses()
/**
* Allows for public read access to 'all_recipients' property.
- * @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
* @access public
* @return array
*/
@@ -4036,7 +3716,7 @@ class phpmailerException extends Exception
*/
public function errorMessage()
{
- $errorMsg = '' . htmlspecialchars($this->getMessage()) . " \n";
+ $errorMsg = '' . $this->getMessage() . " \n";
return $errorMsg;
}
}
diff --git a/includes/packages/PHPMailer/class.pop3.php b/includes/packages/PHPMailer/class.pop3.php
old mode 100644
new mode 100755
index c464f90c6..3b9737951
--- a/includes/packages/PHPMailer/class.pop3.php
+++ b/includes/packages/PHPMailer/class.pop3.php
@@ -34,7 +34,7 @@ class POP3
* @var string
* @access public
*/
- public $Version = '5.2.23';
+ public $Version = '5.2.13';
/**
* Default POP3 port number.
diff --git a/includes/packages/PHPMailer/class.smtp.php b/includes/packages/PHPMailer/class.smtp.php
old mode 100644
new mode 100755
index 0ab69ede0..950b002c8
--- a/includes/packages/PHPMailer/class.smtp.php
+++ b/includes/packages/PHPMailer/class.smtp.php
@@ -30,7 +30,7 @@ class SMTP
* The PHPMailer SMTP version number.
* @var string
*/
- const VERSION = '5.2.23';
+ const VERSION = '5.2.13';
/**
* SMTP line break constant.
@@ -81,7 +81,7 @@ class SMTP
* @deprecated Use the `VERSION` constant instead
* @see SMTP::VERSION
*/
- public $Version = '5.2.23';
+ public $Version = '5.2.13';
/**
* SMTP server port number.
@@ -150,17 +150,6 @@ class SMTP
*/
public $Timelimit = 300;
- /**
- * @var array patterns to extract smtp transaction id from smtp reply
- * Only first capture group will be use, use non-capturing group to deal with it
- * Extend this class to override this property to fulfil your needs.
- */
- protected $smtp_transaction_id_patterns = array(
- 'exim' => '/[0-9]{3} OK id=(.*)/',
- 'sendmail' => '/[0-9]{3} 2.0.0 (.*) Message/',
- 'postfix' => '/[0-9]{3} 2.0.0 Ok: queued as (.*)/'
- );
-
/**
* The socket for the server connection.
* @var resource
@@ -217,7 +206,7 @@ protected function edebug($str, $level = 0)
}
//Avoid clash with built-in function names
if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
- call_user_func($this->Debugoutput, $str, $level);
+ call_user_func($this->Debugoutput, $str, $this->do_debug);
return;
}
switch ($this->Debugoutput) {
@@ -227,11 +216,12 @@ protected function edebug($str, $level = 0)
break;
case 'html':
//Cleans up output a bit for a better looking, HTML-safe output
- echo gmdate('Y-m-d H:i:s') . ' ' . htmlentities(
+ echo htmlentities(
preg_replace('/[\r\n]+/', '', $str),
ENT_QUOTES,
'UTF-8'
- ) . " \n";
+ )
+ . " \n";
break;
case 'echo':
default:
@@ -241,7 +231,7 @@ protected function edebug($str, $level = 0)
"\n",
"\n \t ",
trim($str)
- ) . "\n";
+ )."\n";
}
}
@@ -275,16 +265,15 @@ public function connect($host, $port = null, $timeout = 30, $options = array())
}
// Connect to the SMTP server
$this->edebug(
- "Connection: opening to $host:$port, timeout=$timeout, options=" .
- var_export($options, true),
+ "Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true),
self::DEBUG_CONNECTION
);
$errno = 0;
$errstr = '';
if ($streamok) {
$socket_context = stream_context_create($options);
- set_error_handler(array($this, 'errorHandler'));
- $this->smtp_conn = stream_socket_client(
+ //Suppress errors; connection failures are handled at a higher level
+ $this->smtp_conn = @stream_socket_client(
$host . ":" . $port,
$errno,
$errstr,
@@ -292,14 +281,12 @@ public function connect($host, $port = null, $timeout = 30, $options = array())
STREAM_CLIENT_CONNECT,
$socket_context
);
- restore_error_handler();
} else {
//Fall back to fsockopen which should work in more places, but is missing some features
$this->edebug(
"Connection: stream_socket_client not available, falling back to fsockopen",
self::DEBUG_CONNECTION
);
- set_error_handler(array($this, 'errorHandler'));
$this->smtp_conn = fsockopen(
$host,
$port,
@@ -307,7 +294,6 @@ public function connect($host, $port = null, $timeout = 30, $options = array())
$errstr,
$timeout
);
- restore_error_handler();
}
// Verify we connected properly
if (!is_resource($this->smtp_conn)) {
@@ -350,26 +336,15 @@ public function startTLS()
if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
return false;
}
-
- //Allow the best TLS version(s) we can
- $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
-
- //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT
- //so add them back in manually if we can
- if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
- $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
- $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
- }
-
// Begin encrypted connection
- set_error_handler(array($this, 'errorHandler'));
- $crypto_ok = stream_socket_enable_crypto(
+ if (!stream_socket_enable_crypto(
$this->smtp_conn,
true,
- $crypto_method
- );
- restore_error_handler();
- return $crypto_ok;
+ STREAM_CRYPTO_METHOD_TLS_CLIENT
+ )) {
+ return false;
+ }
+ return true;
}
/**
@@ -381,7 +356,7 @@ public function startTLS()
* @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
* @param string $realm The auth realm for NTLM
* @param string $workstation The auth workstation for NTLM
- * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
+ * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
* @return bool True if successfully authenticated.* @access public
*/
public function authenticate(
@@ -398,7 +373,8 @@ public function authenticate(
}
if (array_key_exists('EHLO', $this->server_caps)) {
- // SMTP extensions are available; try to find a proper authentication method
+ // SMTP extensions are available. Let's try to find a proper authentication method
+
if (!array_key_exists('AUTH', $this->server_caps)) {
$this->setError('Authentication is not allowed at this stage');
// 'at this stage' means that auth may be allowed after the stage changes
@@ -413,7 +389,7 @@ public function authenticate(
);
if (empty($authtype)) {
- foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) {
+ foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2') as $method) {
if (in_array($method, $this->server_caps['AUTH'])) {
$authtype = $method;
break;
@@ -423,7 +399,7 @@ public function authenticate(
$this->setError('No supported authentication methods found');
return false;
}
- self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
+ self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
}
if (!in_array($authtype, $this->server_caps['AUTH'])) {
@@ -487,7 +463,7 @@ public function authenticate(
$temp = new stdClass;
$ntlm_client = new ntlm_sasl_client_class;
//Check that functions are available
- if (!$ntlm_client->initialize($temp)) {
+ if (!$ntlm_client->Initialize($temp)) {
$this->setError($temp->error);
$this->edebug(
'You need to enable some modules in your php.ini file: '
@@ -497,7 +473,7 @@ public function authenticate(
return false;
}
//msg1
- $msg1 = $ntlm_client->typeMsg1($realm, $workstation); //msg1
+ $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
if (!$this->sendCommand(
'AUTH NTLM',
@@ -516,7 +492,7 @@ public function authenticate(
$password
);
//msg3
- $msg3 = $ntlm_client->typeMsg3(
+ $msg3 = $ntlm_client->TypeMsg3(
$ntlm_res,
$username,
$realm,
@@ -549,7 +525,7 @@ public function authenticate(
* Works like hash_hmac('md5', $data, $key)
* in case that function is not available
* @param string $data The data to hash
- * @param string $key The key to hash with
+ * @param string $key The key to hash with
* @access protected
* @return string
*/
@@ -760,7 +736,7 @@ protected function sendHello($hello, $host)
protected function parseHelloFields($type)
{
$this->server_caps = array();
- $lines = explode("\n", $this->helo_rply);
+ $lines = explode("\n", $this->last_reply);
foreach ($lines as $n => $s) {
//First 4 chars contain response code followed by - or space
@@ -838,15 +814,15 @@ public function quit($close_on_error = true)
* Sets the TO argument to $toaddr.
* Returns true if the recipient was accepted false if it was rejected.
* Implements from rfc 821: RCPT TO:
- * @param string $address The address the message is being sent to
+ * @param string $toaddr The address the message is being sent to
* @access public
* @return boolean
*/
- public function recipient($address)
+ public function recipient($toaddr)
{
return $this->sendCommand(
'RCPT TO',
- 'RCPT TO:<' . $address . '>',
+ 'RCPT TO:<' . $toaddr . '>',
array(250, 251)
);
}
@@ -865,9 +841,9 @@ public function reset()
/**
* Send a command to an SMTP server and check its return code.
- * @param string $command The command name - not sent to the server
+ * @param string $command The command name - not sent to the server
* @param string $commandstring The actual command to send
- * @param integer|array $expect One or more expected integer success codes
+ * @param integer|array $expect One or more expected integer success codes
* @access protected
* @return boolean True on success.
*/
@@ -877,11 +853,6 @@ protected function sendCommand($command, $commandstring, $expect)
$this->setError("Called $command without being connected");
return false;
}
- //Reject line breaks in all commands
- if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
- $this->setError("Command '$command' contained line breaks");
- return false;
- }
$this->client_send($commandstring . self::CRLF);
$this->last_reply = $this->get_lines();
@@ -892,8 +863,7 @@ protected function sendCommand($command, $commandstring, $expect)
$code_ex = (count($matches) > 2 ? $matches[2] : null);
// Cut off error code from each response line
$detail = preg_replace(
- "/{$code}[ -]" .
- ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . "/m",
+ "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
'',
$this->last_reply
);
@@ -989,10 +959,7 @@ public function turn()
public function client_send($data)
{
$this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
- set_error_handler(array($this, 'errorHandler'));
- $result = fwrite($this->smtp_conn, $data);
- restore_error_handler();
- return $result;
+ return fwrite($this->smtp_conn, $data);
}
/**
@@ -1092,10 +1059,8 @@ protected function get_lines()
$this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
$this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
$data .= $str;
- // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
- // or 4th character is a space, we are done reading, break the loop,
- // string array access is a micro-optimisation over strlen
- if (!isset($str[3]) or (isset($str[3]) and $str[3] == ' ')) {
+ // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
+ if ((isset($str[3]) and $str[3] == ' ')) {
break;
}
// Timed-out? Log and break
@@ -1110,7 +1075,7 @@ protected function get_lines()
// Now check if reads took too long
if ($endtime and time() > $endtime) {
$this->edebug(
- 'SMTP -> get_lines(): timelimit reached (' .
+ 'SMTP -> get_lines(): timelimit reached ('.
$this->Timelimit . ' sec)',
self::DEBUG_LOWLEVEL
);
@@ -1208,49 +1173,4 @@ public function getTimeout()
{
return $this->Timeout;
}
-
- /**
- * Reports an error number and string.
- * @param integer $errno The error number returned by PHP.
- * @param string $errmsg The error message returned by PHP.
- * @param string $errfile The file the error occurred in
- * @param integer $errline The line number the error occurred on
- */
- protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0)
- {
- $notice = 'Connection failed.';
- $this->setError(
- $notice,
- $errno,
- $errmsg
- );
- $this->edebug(
- $notice . ' Error #' . $errno . ': ' . $errmsg . " [$errfile line $errline]",
- self::DEBUG_CONNECTION
- );
- }
-
- /**
- * Will return the ID of the last smtp transaction based on a list of patterns provided
- * in SMTP::$smtp_transaction_id_patterns.
- * If no reply has been received yet, it will return null.
- * If no pattern has been matched, it will return false.
- * @return bool|null|string
- */
- public function getLastTransactionID()
- {
- $reply = $this->getLastReply();
-
- if (empty($reply)) {
- return null;
- }
-
- foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
- if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
- return $matches[1];
- }
- }
-
- return false;
- }
}
diff --git a/includes/packages/PasswordHash.php b/includes/packages/PasswordHash.php
old mode 100644
new mode 100755
diff --git a/includes/packages/PluploadHandler.php b/includes/packages/PluploadHandler.php
old mode 100644
new mode 100755
index dde076204..2fc5a4fef
--- a/includes/packages/PluploadHandler.php
+++ b/includes/packages/PluploadHandler.php
@@ -330,7 +330,7 @@ private static function cleanup()
* operating systems and special characters requiring special escaping
* to manipulate at the command line. Replaces spaces and consecutive
* dashes with a single dash. Trim period, dash and underscore from beginning
- * and end of filename. Converts upper case characters to lower case.
+ * and end of filename.
*
* @author WordPress
*
@@ -343,7 +343,6 @@ private static function sanitize_file_name($filename)
$filename = str_replace($special_chars, '', $filename);
$filename = preg_replace('/[\s-]+/', '-', $filename);
$filename = trim($filename, '.-_');
- $filename = strtolower($filename);
return $filename;
}
diff --git a/includes/packages/captcha/AHGBold.ttf b/includes/packages/captcha/AHGBold.ttf
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/LICENSE.txt b/includes/packages/captcha/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/README.FONT.txt b/includes/packages/captcha/README.FONT.txt
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/README.md b/includes/packages/captcha/README.md
old mode 100644
new mode 100755
index dd958bf0e..26f6c6723
--- a/includes/packages/captcha/README.md
+++ b/includes/packages/captcha/README.md
@@ -4,7 +4,7 @@
## Version:
-**3.6.4**
+**3.6.2**
## Author:
@@ -73,11 +73,6 @@ It also creates audible codes which are played for visually impared users.
## UPGRADE NOTICE:
-**3.6.3 and below:**
-Securimage 3.6.4 fixed a XSS vulnerability in example_form.ajax.php. It is
-recommended to upgrade to the latest version or delete example_form.ajax.php
-from the securimage directory on your website.
-
**3.6.2 and above:**
If you are upgrading to 3.6.2 or greater *AND* are using database storage,
@@ -93,7 +88,7 @@ with the one from this release.
## Copyright:
Script
- Copyright (c) 2016 Drew Phillips
+ Copyright (c) 2015 Drew Phillips
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/includes/packages/captcha/README.txt b/includes/packages/captcha/README.txt
old mode 100644
new mode 100755
index 0129e1635..8e1a2a9fd
--- a/includes/packages/captcha/README.txt
+++ b/includes/packages/captcha/README.txt
@@ -4,7 +4,7 @@ NAME:
VERSION:
- 3.6.4
+ 3.6.2
AUTHOR:
@@ -71,10 +71,6 @@ DESCRIPTION:
It also creates audible codes which are played for visually impared users.
UPGRADE NOTICE:
- 3.6.3 and below:
- Securimage 3.6.4 fixed a XSS vulnerability in example_form.ajax.php. It is
- recommended to upgrade to the latest version or delete example_form.ajax.php
- from the securimage directory on your website.
3.6.2 and above:
If you are upgrading to 3.6.2 or greater AND are using database storage,
@@ -90,7 +86,7 @@ UPGRADE NOTICE:
COPYRIGHT:
- Copyright (c) 2016 Drew Phillips
+ Copyright (c) 2015 Drew Phillips
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/includes/packages/captcha/WavFile.php b/includes/packages/captcha/WavFile.php
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/.htaccess b/includes/packages/captcha/audio/.htaccess
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/0.wav b/includes/packages/captcha/audio/en/0.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/1.wav b/includes/packages/captcha/audio/en/1.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/10.wav b/includes/packages/captcha/audio/en/10.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/11.wav b/includes/packages/captcha/audio/en/11.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/12.wav b/includes/packages/captcha/audio/en/12.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/13.wav b/includes/packages/captcha/audio/en/13.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/14.wav b/includes/packages/captcha/audio/en/14.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/15.wav b/includes/packages/captcha/audio/en/15.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/16.wav b/includes/packages/captcha/audio/en/16.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/17.wav b/includes/packages/captcha/audio/en/17.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/18.wav b/includes/packages/captcha/audio/en/18.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/19.wav b/includes/packages/captcha/audio/en/19.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/2.wav b/includes/packages/captcha/audio/en/2.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/20.wav b/includes/packages/captcha/audio/en/20.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/3.wav b/includes/packages/captcha/audio/en/3.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/4.wav b/includes/packages/captcha/audio/en/4.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/5.wav b/includes/packages/captcha/audio/en/5.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/6.wav b/includes/packages/captcha/audio/en/6.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/7.wav b/includes/packages/captcha/audio/en/7.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/8.wav b/includes/packages/captcha/audio/en/8.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/9.wav b/includes/packages/captcha/audio/en/9.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/A.wav b/includes/packages/captcha/audio/en/A.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/B.wav b/includes/packages/captcha/audio/en/B.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/C.wav b/includes/packages/captcha/audio/en/C.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/D.wav b/includes/packages/captcha/audio/en/D.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/E.wav b/includes/packages/captcha/audio/en/E.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/F.wav b/includes/packages/captcha/audio/en/F.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/G.wav b/includes/packages/captcha/audio/en/G.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/H.wav b/includes/packages/captcha/audio/en/H.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/I.wav b/includes/packages/captcha/audio/en/I.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/J.wav b/includes/packages/captcha/audio/en/J.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/K.wav b/includes/packages/captcha/audio/en/K.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/L.wav b/includes/packages/captcha/audio/en/L.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/M.wav b/includes/packages/captcha/audio/en/M.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/MINUS.wav b/includes/packages/captcha/audio/en/MINUS.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/N.wav b/includes/packages/captcha/audio/en/N.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/O.wav b/includes/packages/captcha/audio/en/O.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/P.wav b/includes/packages/captcha/audio/en/P.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/PLUS.wav b/includes/packages/captcha/audio/en/PLUS.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/Q.wav b/includes/packages/captcha/audio/en/Q.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/R.wav b/includes/packages/captcha/audio/en/R.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/S.wav b/includes/packages/captcha/audio/en/S.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/T.wav b/includes/packages/captcha/audio/en/T.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/TIMES.wav b/includes/packages/captcha/audio/en/TIMES.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/U.wav b/includes/packages/captcha/audio/en/U.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/V.wav b/includes/packages/captcha/audio/en/V.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/W.wav b/includes/packages/captcha/audio/en/W.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/X.wav b/includes/packages/captcha/audio/en/X.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/Y.wav b/includes/packages/captcha/audio/en/Y.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/Z.wav b/includes/packages/captcha/audio/en/Z.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/en/error.wav b/includes/packages/captcha/audio/en/error.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/noise/check-point-1.wav b/includes/packages/captcha/audio/noise/check-point-1.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/noise/crowd-talking-1.wav b/includes/packages/captcha/audio/noise/crowd-talking-1.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/noise/crowd-talking-6.wav b/includes/packages/captcha/audio/noise/crowd-talking-6.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/noise/crowd-talking-7.wav b/includes/packages/captcha/audio/noise/crowd-talking-7.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/audio/noise/kids-playing-1.wav b/includes/packages/captcha/audio/noise/kids-playing-1.wav
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/backgrounds/bg3.jpg b/includes/packages/captcha/backgrounds/bg3.jpg
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/backgrounds/bg4.jpg b/includes/packages/captcha/backgrounds/bg4.jpg
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/backgrounds/bg5.jpg b/includes/packages/captcha/backgrounds/bg5.jpg
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/backgrounds/bg6.png b/includes/packages/captcha/backgrounds/bg6.png
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/captcha.html b/includes/packages/captcha/captcha.html
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/database/.htaccess b/includes/packages/captcha/database/.htaccess
deleted file mode 100644
index 8d2f25636..000000000
--- a/includes/packages/captcha/database/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-deny from all
diff --git a/includes/packages/captcha/database/index.html b/includes/packages/captcha/database/index.html
deleted file mode 100644
index 8d1c8b69c..000000000
--- a/includes/packages/captcha/database/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/includes/packages/captcha/database/securimage.sq3 b/includes/packages/captcha/database/securimage.sq3
deleted file mode 100644
index a3fcbd74a..000000000
Binary files a/includes/packages/captcha/database/securimage.sq3 and /dev/null differ
diff --git a/includes/packages/captcha/images/audio_icon.png b/includes/packages/captcha/images/audio_icon.png
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/images/loading.png b/includes/packages/captcha/images/loading.png
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/images/refresh.png b/includes/packages/captcha/images/refresh.png
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/securimage.css b/includes/packages/captcha/securimage.css
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/securimage.js b/includes/packages/captcha/securimage.js
old mode 100644
new mode 100755
index 4b7e98ef1..9a2334172
--- a/includes/packages/captcha/securimage.js
+++ b/includes/packages/captcha/securimage.js
@@ -195,7 +195,6 @@ SecurimageAudio.prototype.replaceElements = function() {
var newAudioEl = document.createElement('audio');
newAudioEl.setAttribute('style', 'display: none;');
newAudioEl.setAttribute('preload', 'false');
- newAudioEl.setAttribute('id', this.audioElement.id);
for (var c = 0; c < this.audioElement.children.length; ++c) {
if (this.audioElement.children[c].tagName.toLowerCase() != 'source') continue;
diff --git a/includes/packages/captcha/securimage.php b/includes/packages/captcha/securimage.php
old mode 100644
new mode 100755
index 92723c249..af1c90825
--- a/includes/packages/captcha/securimage.php
+++ b/includes/packages/captcha/securimage.php
@@ -6,7 +6,7 @@
* Project: Securimage: A PHP class dealing with CAPTCHA images, audio, and validation
* File: securimage.php
*
- * Copyright (c) 2016, Drew Phillips
+ * Copyright (c) 2015, Drew Phillips
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -39,9 +39,9 @@
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
- * @copyright 2016 Drew Phillips
+ * @copyright 2015 Drew Phillips
* @author Drew Phillips
- * @version 3.6.4 (Mar 3, 2016)
+ * @version 3.6.2 (Oct 13, 2015)
* @package Securimage
*
*/
@@ -49,15 +49,6 @@
/**
ChangeLog
- 3.6.4
- - Fix XSS vulnerability in example_form.ajax.php (Discovered by RedTeam. advisory rt-sa-2016-002)
- - Update example_form.ajax.php to use Securimage::getCaptchaHtml()
-
- 3.6.3
- - Add support for multibyte wordlist files
- - Fix code generation issues with UTF-8 charsets
- - Add parameter to getCaptchaHtml() method to control display components of captcha HTML
- - Fix database audio storage issue with multiple namespaces
3.6.2
- Support HTTP range requests with audio playback (iOS requirement)
@@ -278,48 +269,6 @@ class Securimage
*/
const SI_DRIVER_SQLITE3 = 'sqlite';
- /**
- * getCaptchaHtml() display constant for HTML Captcha Image
- *
- * @var integer
- */
- const HTML_IMG = 1;
-
- /**
- * getCaptchaHtml() display constant for HTML5 Audio code
- *
- * @var integer
- */
- const HTML_AUDIO = 2;
-
- /**
- * getCaptchaHtml() display constant for Captcha Input text box
- *
- * @var integer
- */
- const HTML_INPUT = 4;
-
- /**
- * getCaptchaHtml() display constant for Captcha Text HTML label
- *
- * @var integer
- */
- const HTML_INPUT_LABEL = 8;
-
- /**
- * getCaptchaHtml() display constant for HTML Refresh button
- *
- * @var integer
- */
- const HTML_ICON_REFRESH = 16;
-
- /**
- * getCaptchaHtml() display constant for all HTML elements (default)
- *
- * @var integer
- */
- const HTML_ALL = 0xffffffff;
-
/*%*********************************************************************%*/
// Properties
@@ -642,17 +591,6 @@ class Securimage
*/
public $wordlist_file;
- /**
- * Character encoding of the wordlist file.
- * Requires PHP Multibyte String (mbstring) support.
- * Allows word list to contain characters other than US-ASCII (requires compatible TTF font).
- *
- * @var string The character encoding (e.g. UTF-8, UTF-7, EUC-JP, GB2312)
- * @see http://php.net/manual/en/mbstring.supported-encodings.php
- * @since 3.6.3
- */
- public $wordlist_file_encoding = null;
-
/**
* The directory to scan for background images, if set a random background
* will be chosen from this folder
@@ -1246,11 +1184,10 @@ public function check($code)
* The optional captcha namespace to use for showing the image and playing back the audio. Namespaces are for using multiple captchas on the same page.
*
* @param array $options Array of options for modifying the HTML code.
- * @param int $parts Securiage::HTML_* constant controlling what component of the captcha HTML to display
*
* @return string The generated HTML code for displaying the captcha
*/
- public static function getCaptchaHtml($options = array(), $parts = Securimage::HTML_ALL)
+ public static function getCaptchaHtml($options = array())
{
static $javascript_init = false;
@@ -1315,51 +1252,49 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$image_attr .= sprintf('%s="%s" ', $name, htmlspecialchars($val));
}
- $swf_path = $securimage_path . '/securimage_play.swf';
- $play_path = $securimage_path . '/securimage_play.php?';
- $icon_path = $securimage_path . '/images/audio_icon.png';
- $load_path = $securimage_path . '/images/loading.png';
- $js_path = $securimage_path . '/securimage.js';
+ $audio_obj = null;
- if (!empty($audio_icon_url)) {
- $icon_path = $audio_icon_url;
- }
+ $html = sprintf(' ', $image_attr);
- if (!empty($loading_icon_url)) {
- $load_path = $loading_icon_url;
- }
+ if ($show_audio_btn) {
+ $swf_path = $securimage_path . '/securimage_play.swf';
+ $play_path = $securimage_path . '/securimage_play.php?';
+ $icon_path = $securimage_path . '/images/audio_icon.png';
+ $load_path = $securimage_path . '/images/loading.png';
+ $js_path = $securimage_path . '/securimage.js';
+ $audio_obj = $image_id . '_audioObj';
- if (!empty($audio_play_url)) {
- if (parse_url($audio_play_url, PHP_URL_QUERY)) {
- $play_path = "{$audio_play_url}&";
- } else {
- $play_path = "{$audio_play_url}?";
+ if (!empty($audio_icon_url)) {
+ $icon_path = $audio_icon_url;
}
- }
- if (!empty($namespace)) {
- $play_path .= sprintf('namespace=%s&', $namespace);
- }
+ if (!empty($loading_icon_url)) {
+ $load_path = $loading_icon_url;
+ }
- if (!empty($audio_swf_url)) {
- $swf_path = $audio_swf_url;
- }
+ if (!empty($audio_play_url)) {
+ if (parse_url($audio_play_url, PHP_URL_QUERY)) {
+ $play_path = "{$audio_play_url}&";
+ } else {
+ $play_path = "{$audio_play_url}?";
+ }
+ }
- $audio_obj = $image_id . '_audioObj';
- $html = '';
+ if (!empty($namespace)) {
+ $play_path .= sprintf('namespace=%s&', $namespace);
+ }
- if ( ($parts & Securimage::HTML_IMG) > 0) {
- $html .= sprintf(' ', $image_attr);
- }
+ if (!empty($audio_swf_url)) {
+ $swf_path = $audio_swf_url;
+ }
- if ( ($parts & Securimage::HTML_AUDIO) > 0 && $show_audio_btn) {
// html5 audio
$html .= sprintf('', $image_id) . "\n" .
sprintf('
', $image_id) . "\n";
// check for existence and executability of LAME binary
// prefer mp3 over wav by sourcing it first, if available
- if (is_executable(Securimage::$lame_binary_path)) {
+ if (@is_executable(Securimage::$lame_binary_path)) {
$html .= sprintf('', $image_id, $play_path, uniqid()) . "\n";
}
@@ -1398,18 +1333,9 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
sprintf(' ', $icon_size, $icon_size, htmlspecialchars($load_path)) . "\n" .
"\nEnable Javascript for audio controls \n" .
" \n";
-
- // html5 javascript
- if (!$javascript_init) {
- $html .= sprintf('', $js_path) . "\n";
- $javascript_init = true;
- }
- $html .= '\n";
}
- if ( ($parts & Securimage::HTML_ICON_REFRESH) > 0 && $show_refresh_btn) {
+ if ($show_refresh_btn) {
$icon_path = $securimage_path . '/images/refresh.png';
if ($refresh_icon_url) {
$icon_path = $refresh_icon_url;
@@ -1419,41 +1345,48 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$html .= sprintf('%s ',
htmlspecialchars($refresh_title),
- ($audio_obj) ? "if (typeof window.{$audio_obj} !== 'undefined') {$audio_obj}.refresh(); " : '',
+ ($audio_obj) ? "{$audio_obj}.refresh(); " : '',
$image_id,
$show_path,
$img_tag
);
}
- if ($parts == Securimage::HTML_ALL) {
- $html .= '
';
+ if ($show_audio_btn) {
+ // html5 javascript
+ if (!$javascript_init) {
+ $html .= sprintf('', $js_path) . "\n";
+ $javascript_init = true;
+ }
+ $html .= '\n";
}
- if ( ($parts & Securimage::HTML_INPUT_LABEL) > 0 && $show_input) {
- $html .= sprintf('%s ',
- htmlspecialchars($input_id),
- htmlspecialchars($input_text));
+ $html .= '
';
- if (!empty($error_html)) {
- $html .= $error_html;
- }
- }
+ $html .= sprintf('%s ',
+ htmlspecialchars($input_id),
+ htmlspecialchars($input_text));
- if ( ($parts & Securimage::HTML_INPUT) > 0 && $show_input) {
- $input_attr = '';
- if (!is_array($input_attrs)) $input_attrs = array();
- $input_attrs['type'] = 'text';
- $input_attrs['name'] = $input_name;
- $input_attrs['id'] = $input_id;
+ if (!empty($error_html)) {
+ $html .= $error_html;
+ }
- foreach($input_attrs as $name => $val) {
- $input_attr .= sprintf('%s="%s" ', $name, htmlspecialchars($val));
- }
+ $input_attr = '';
+ if (!is_array($input_attrs)) $input_attrs = array();
+ $input_attrs['type'] = 'text';
+ $input_attrs['name'] = $input_name;
+ $input_attrs['id'] = $input_id;
- $html .= sprintf(' ', $input_attr);
+ foreach($input_attrs as $name => $val) {
+ $input_attr .= sprintf('%s="%s" ', $name, htmlspecialchars($val));
}
+ $html .= sprintf(' ', $input_attr);
+
+ $html = '' . $html . '
';
+
return $html;
}
@@ -2221,31 +2154,6 @@ protected function getAudibleCode()
*/
protected function readCodeFromFile($numWords = 1)
{
- $strpos_func = 'strpos';
- $strlen_func = 'strlen';
- $substr_func = 'substr';
- $strtolower_func = 'strtolower';
- $mb_support = false;
-
- if (!empty($this->wordlist_file_encoding)) {
- if (!extension_loaded('mbstring')) {
- trigger_error("wordlist_file_encoding option set, but PHP does not have mbstring support", E_USER_WARNING);
- return false;
- }
-
- // emits PHP warning if not supported
- $mb_support = mb_internal_encoding($this->wordlist_file_encoding);
-
- if (!$mb_support) {
- return false;
- }
-
- $strpos_func = 'mb_strpos';
- $strlen_func = 'mb_strlen';
- $substr_func = 'mb_substr';
- $strtolower_func = 'mb_strtolower';
- }
-
$fp = fopen($this->wordlist_file, 'rb');
if (!$fp) return false;
@@ -2257,32 +2165,21 @@ protected function readCodeFromFile($numWords = 1)
$words = array();
$i = 0;
do {
- fseek($fp, mt_rand(0, $fsize - 128), SEEK_SET); // seek to a random position of file from 0 to filesize-128
- $data = fread($fp, 128); // read a chunk from our random position
-
- if ($mb_support !== false) {
- $data = mb_ereg_replace("\r?\n", "\n", $data);
- } else {
- $data = preg_replace("/\r?\n/", "\n", $data);
- }
+ fseek($fp, mt_rand(0, $fsize - 64), SEEK_SET); // seek to a random position of file from 0 to filesize-64
+ $data = fread($fp, 64); // read a chunk from our random position
+ $data = preg_replace("/\r?\n/", "\n", $data);
- $start = @$strpos_func($data, "\n", mt_rand(0, 56)) + 1; // random start position
- $end = @$strpos_func($data, "\n", $start); // find end of word
+ $start = @strpos($data, "\n", mt_rand(0, 56)) + 1; // random start position
+ $end = @strpos($data, "\n", $start); // find end of word
if ($start === false) {
// picked start position at end of file
continue;
} else if ($end === false) {
- $end = $strlen_func($data);
- }
-
- $word = $strtolower_func($substr_func($data, $start, $end - $start)); // return a line of the file
-
- if ($mb_support) {
- // convert to UTF-8 for imagettftext
- $word = mb_convert_encoding($word, 'UTF-8', $this->wordlist_file_encoding);
+ $end = strlen($data);
}
+ $word = strtolower(substr($data, $start, $end - $start)); // return a line of the file
$words[] = $word;
} while (++$i < $numWords);
@@ -2306,7 +2203,7 @@ protected function generateCode()
$code = '';
if (function_exists('mb_strlen')) {
- for($i = 1, $cslen = mb_strlen($this->charset, 'UTF-8'); $i <= $this->code_length; ++$i) {
+ for($i = 1, $cslen = mb_strlen($this->charset); $i <= $this->code_length; ++$i) {
$code .= mb_substr($this->charset, mt_rand(0, $cslen - 1), 1, 'UTF-8');
}
} else {
@@ -2507,17 +2404,15 @@ protected function saveAudioToDatabase($data)
if ($this->use_database && $this->pdo_conn) {
$id = $this->getCaptchaId(false);
$ip = $_SERVER['REMOTE_ADDR'];
- $ns = $this->namespace;
if (empty($id)) {
$id = $ip;
}
- $query = "UPDATE {$this->database_table} SET audio_data = :audioData WHERE id = :id AND namespace = :namespace";
+ $query = "UPDATE {$this->database_table} SET audio_data = :audioData WHERE id = :id";
$stmt = $this->pdo_conn->prepare($query);
$stmt->bindParam(':audioData', $data, PDO::PARAM_LOB);
$stmt->bindParam(':id', $id);
- $stmt->bindParam(':namespace', $ns);
$success = $stmt->execute();
}
diff --git a/includes/packages/captcha/securimage_play.php b/includes/packages/captcha/securimage_play.php
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/securimage_play.swf b/includes/packages/captcha/securimage_play.swf
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/securimage_show.php b/includes/packages/captcha/securimage_show.php
old mode 100644
new mode 100755
diff --git a/includes/packages/captcha/words/words.txt b/includes/packages/captcha/words/words.txt
old mode 100644
new mode 100755
diff --git a/includes/packages/htmLawed.php b/includes/packages/htmLawed.php
old mode 100644
new mode 100755
index d7ff1744a..8a600091d
--- a/includes/packages/htmLawed.php
+++ b/includes/packages/htmLawed.php
@@ -1,720 +1,729 @@
-1, 'abbr'=>1, 'acronym'=>1, 'address'=>1, 'applet'=>1, 'area'=>1, 'article'=>1, 'aside'=>1, 'audio'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'blockquote'=>1, 'br'=>1, 'button'=>1, 'canvas'=>1, 'caption'=>1, 'center'=>1, 'cite'=>1, 'code'=>1, 'col'=>1, 'colgroup'=>1, 'command'=>1, 'data'=>1, 'datalist'=>1, 'dd'=>1, 'del'=>1, 'details'=>1, 'dfn'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'dt'=>1, 'em'=>1, 'embed'=>1, 'fieldset'=>1, 'figcaption'=>1, 'figure'=>1, 'font'=>1, 'footer'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hgroup'=>1, 'hr'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'isindex'=>1, 'kbd'=>1, 'keygen'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'link'=>1, 'main'=>1, 'map'=>1, 'mark'=>1, 'menu'=>1, 'meta'=>1, 'meter'=>1, 'nav'=>1, 'noscript'=>1, 'object'=>1, 'ol'=>1, 'optgroup'=>1, 'option'=>1, 'output'=>1, 'p'=>1, 'param'=>1, 'pre'=>1, 'progress'=>1, 'q'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'script'=>1, 'section'=>1, 'select'=>1, 'small'=>1, 'source'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'style'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'table'=>1, 'tbody'=>1, 'td'=>1, 'textarea'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'time'=>1, 'tr'=>1, 'track'=>1, 'tt'=>1, 'u'=>1, 'ul'=>1, 'var'=>1, 'video'=>1, 'wbr'=>1); // 118 incl. deprecated & some Ruby
+function htmLawed($t, $C=1, $S=array()){
+$C = is_array($C) ? $C : array();
+if(!empty($C['valid_xhtml'])){
+ $C['elements'] = empty($C['elements']) ? '*-center-dir-font-isindex-menu-s-strike-u' : $C['elements'];
+ $C['make_tag_strict'] = isset($C['make_tag_strict']) ? $C['make_tag_strict'] : 2;
+ $C['xml:lang'] = isset($C['xml:lang']) ? $C['xml:lang'] : 2;
+}
+// config eles
+$e = array('a'=>1, 'abbr'=>1, 'acronym'=>1, 'address'=>1, 'applet'=>1, 'area'=>1, 'b'=>1, 'bdo'=>1, 'big'=>1, 'blockquote'=>1, 'br'=>1, 'button'=>1, 'caption'=>1, 'center'=>1, 'cite'=>1, 'code'=>1, 'col'=>1, 'colgroup'=>1, 'dd'=>1, 'del'=>1, 'dfn'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'dt'=>1, 'em'=>1, 'embed'=>1, 'fieldset'=>1, 'font'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'isindex'=>1, 'kbd'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'map'=>1, 'menu'=>1, 'noscript'=>1, 'object'=>1, 'ol'=>1, 'optgroup'=>1, 'option'=>1, 'p'=>1, 'param'=>1, 'pre'=>1, 'q'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'script'=>1, 'select'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'sup'=>1, 'table'=>1, 'tbody'=>1, 'td'=>1, 'textarea'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1, 'tt'=>1, 'u'=>1, 'ul'=>1, 'var'=>1); // 86/deprecated+embed+ruby
+if(!empty($C['safe'])){
+ unset($e['applet'], $e['embed'], $e['iframe'], $e['object'], $e['script']);
+}
+$x = !empty($C['elements']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['elements']) : '*';
+if($x == '-*'){$e = array();}
+elseif(strpos($x, '*') === false){$e = array_flip(explode(',', $x));}
+else{
+ if(isset($x[1])){
+ preg_match_all('`(?:^|-|\+)[^\-+]+?(?=-|\+|$)`', $x, $m, PREG_SET_ORDER);
+ for($i=count($m); --$i>=0;){$m[$i] = $m[$i][0];}
+ foreach($m as $v){
+ if($v[0] == '+'){$e[substr($v, 1)] = 1;}
+ if($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'. $v, $m)){unset($e[$v]);}
+ }
+ }
+}
+$C['elements'] =& $e;
+// config attrs
+$x = !empty($C['deny_attribute']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['deny_attribute']) : '';
+$x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x. (!empty($C['safe']) ? ',on*' : '')));
+if(isset($x['on*'])){
+ unset($x['on*']);
+ $x += array('onblur'=>1, 'onchange'=>1, 'onclick'=>1, 'ondblclick'=>1, 'onfocus'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onmousedown'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onreset'=>1, 'onselect'=>1, 'onsubmit'=>1);
+}
+$C['deny_attribute'] = $x;
+// config URL
+$x = (isset($C['schemes'][2]) && strpos($C['schemes'], ':')) ? strtolower($C['schemes']) : 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https';
+$C['schemes'] = array();
+foreach(explode(';', str_replace(array(' ', "\t", "\r", "\n"), '', $x)) as $v){
+ $x = $x2 = null; list($x, $x2) = explode(':', $v, 2);
+ if($x2){$C['schemes'][$x] = array_flip(explode(',', $x2));}
+}
+if(!isset($C['schemes']['*'])){$C['schemes']['*'] = array('file'=>1, 'http'=>1, 'https'=>1,);}
+if(!empty($C['safe']) && empty($C['schemes']['style'])){$C['schemes']['style'] = array('!'=>1);}
+$C['abs_url'] = isset($C['abs_url']) ? $C['abs_url'] : 0;
+if(!isset($C['base_url']) or !preg_match('`^[a-zA-Z\d.+\-]+://[^/]+/(.+?/)?$`', $C['base_url'])){
+ $C['base_url'] = $C['abs_url'] = 0;
+}
+// config rest
+$C['and_mark'] = empty($C['and_mark']) ? 0 : 1;
+$C['anti_link_spam'] = (isset($C['anti_link_spam']) && is_array($C['anti_link_spam']) && count($C['anti_link_spam']) == 2 && (empty($C['anti_link_spam'][0]) or hl_regex($C['anti_link_spam'][0])) && (empty($C['anti_link_spam'][1]) or hl_regex($C['anti_link_spam'][1]))) ? $C['anti_link_spam'] : 0;
+$C['anti_mail_spam'] = isset($C['anti_mail_spam']) ? $C['anti_mail_spam'] : 0;
+$C['balance'] = isset($C['balance']) ? (bool)$C['balance'] : 1;
+$C['cdata'] = isset($C['cdata']) ? $C['cdata'] : (empty($C['safe']) ? 3 : 0);
+$C['clean_ms_char'] = empty($C['clean_ms_char']) ? 0 : $C['clean_ms_char'];
+$C['comment'] = isset($C['comment']) ? $C['comment'] : (empty($C['safe']) ? 3 : 0);
+$C['css_expression'] = empty($C['css_expression']) ? 0 : 1;
+$C['direct_list_nest'] = empty($C['direct_list_nest']) ? 0 : 1;
+$C['hexdec_entity'] = isset($C['hexdec_entity']) ? $C['hexdec_entity'] : 1;
+$C['hook'] = (!empty($C['hook']) && function_exists($C['hook'])) ? $C['hook'] : 0;
+$C['hook_tag'] = (!empty($C['hook_tag']) && function_exists($C['hook_tag'])) ? $C['hook_tag'] : 0;
+$C['keep_bad'] = isset($C['keep_bad']) ? $C['keep_bad'] : 6;
+$C['lc_std_val'] = isset($C['lc_std_val']) ? (bool)$C['lc_std_val'] : 1;
+$C['make_tag_strict'] = isset($C['make_tag_strict']) ? $C['make_tag_strict'] : 1;
+$C['named_entity'] = isset($C['named_entity']) ? (bool)$C['named_entity'] : 1;
+$C['no_deprecated_attr'] = isset($C['no_deprecated_attr']) ? $C['no_deprecated_attr'] : 1;
+$C['parent'] = isset($C['parent'][0]) ? strtolower($C['parent']) : 'body';
+$C['show_setting'] = !empty($C['show_setting']) ? $C['show_setting'] : 0;
+$C['style_pass'] = empty($C['style_pass']) ? 0 : 1;
+$C['tidy'] = empty($C['tidy']) ? 0 : $C['tidy'];
+$C['unique_ids'] = isset($C['unique_ids']) ? $C['unique_ids'] : 1;
+$C['xml:lang'] = isset($C['xml:lang']) ? $C['xml:lang'] : 0;
-if(!empty($C['safe'])){
- unset($e['applet'], $e['audio'], $e['canvas'], $e['embed'], $e['iframe'], $e['object'], $e['script'], $e['video']);
-}
-$x = !empty($C['elements']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['elements']) : '*';
-if($x == '-*'){$e = array();}
-elseif(strpos($x, '*') === false){$e = array_flip(explode(',', $x));}
-else{
- if(isset($x[1])){
- preg_match_all('`(?:^|-|\+)[^\-+]+?(?=-|\+|$)`', $x, $m, PREG_SET_ORDER);
- for($i=count($m); --$i>=0;){$m[$i] = $m[$i][0];}
- foreach($m as $v){
- if($v[0] == '+'){$e[substr($v, 1)] = 1;}
- if($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'. $v, $m)){unset($e[$v]);}
- }
- }
-}
-$C['elements'] =& $e;
-// config attrs
-$x = !empty($C['deny_attribute']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['deny_attribute']) : '';
-$x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x. (!empty($C['safe']) ? ',on*' : '')));
-if(isset($x['on*'])){
- unset($x['on*']);
- $x += array('onabort'=>1, 'onblur'=>1, 'oncanplay'=>1, 'oncanplaythrough'=>1, 'onchange'=>1, 'onclick'=>1, 'oncontextmenu'=>1, 'oncuechange'=>1, 'ondblclick'=>1, 'ondrag'=>1, 'ondragend'=>1, 'ondragenter'=>1, 'ondragleave'=>1, 'ondragover'=>1, 'ondragstart'=>1, 'ondrop'=>1, 'ondurationchange'=>1, 'onemptied'=>1, 'onended'=>1, 'onerror'=>1, 'onfocus'=>1, 'oninput'=>1, 'oninvalid'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onload'=>1, 'onloadeddata'=>1, 'onloadedmetadata'=>1, 'onloadstart'=>1, 'onmousedown'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onmousewheel'=>1, 'onpause'=>1, 'onplay'=>1, 'onplaying'=>1, 'onprogress'=>1, 'onratechange'=>1, 'onreadystatechange'=>1, 'onreset'=>1, 'onscroll'=>1, 'onseeked'=>1, 'onseeking'=>1, 'onselect'=>1, 'onshow'=>1, 'onstalled'=>1, 'onsubmit'=>1, 'onsuspend'=>1, 'ontimeupdate'=>1, 'onvolumechange'=>1, 'onwaiting'=>1);
-}
-$C['deny_attribute'] = $x;
-// config URL
-$x = (isset($C['schemes'][2]) && strpos($C['schemes'], ':')) ? strtolower($C['schemes']) : 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https';
-$C['schemes'] = array();
-foreach(explode(';', str_replace(array(' ', "\t", "\r", "\n"), '', $x)) as $v){
- $x = $x2 = null; list($x, $x2) = explode(':', $v, 2);
- if($x2){$C['schemes'][$x] = array_flip(explode(',', $x2));}
-}
-if(!isset($C['schemes']['*'])){$C['schemes']['*'] = array('file'=>1, 'http'=>1, 'https'=>1,);}
-if(!empty($C['safe']) && empty($C['schemes']['style'])){$C['schemes']['style'] = array('!'=>1);}
-$C['abs_url'] = isset($C['abs_url']) ? $C['abs_url'] : 0;
-if(!isset($C['base_url']) or !preg_match('`^[a-zA-Z\d.+\-]+://[^/]+/(.+?/)?$`', $C['base_url'])){
- $C['base_url'] = $C['abs_url'] = 0;
-}
-// config rest
-$C['and_mark'] = empty($C['and_mark']) ? 0 : 1;
-$C['anti_link_spam'] = (isset($C['anti_link_spam']) && is_array($C['anti_link_spam']) && count($C['anti_link_spam']) == 2 && (empty($C['anti_link_spam'][0]) or hl_regex($C['anti_link_spam'][0])) && (empty($C['anti_link_spam'][1]) or hl_regex($C['anti_link_spam'][1]))) ? $C['anti_link_spam'] : 0;
-$C['anti_mail_spam'] = isset($C['anti_mail_spam']) ? $C['anti_mail_spam'] : 0;
-$C['balance'] = isset($C['balance']) ? (bool)$C['balance'] : 1;
-$C['cdata'] = isset($C['cdata']) ? $C['cdata'] : (empty($C['safe']) ? 3 : 0);
-$C['clean_ms_char'] = empty($C['clean_ms_char']) ? 0 : $C['clean_ms_char'];
-$C['comment'] = isset($C['comment']) ? $C['comment'] : (empty($C['safe']) ? 3 : 0);
-$C['css_expression'] = empty($C['css_expression']) ? 0 : 1;
-$C['direct_list_nest'] = empty($C['direct_list_nest']) ? 0 : 1;
-$C['hexdec_entity'] = isset($C['hexdec_entity']) ? $C['hexdec_entity'] : 1;
-$C['hook'] = (!empty($C['hook']) && function_exists($C['hook'])) ? $C['hook'] : 0;
-$C['hook_tag'] = (!empty($C['hook_tag']) && function_exists($C['hook_tag'])) ? $C['hook_tag'] : 0;
-$C['keep_bad'] = isset($C['keep_bad']) ? $C['keep_bad'] : 6;
-$C['lc_std_val'] = isset($C['lc_std_val']) ? (bool)$C['lc_std_val'] : 1;
-$C['make_tag_strict'] = isset($C['make_tag_strict']) ? $C['make_tag_strict'] : 1;
-$C['named_entity'] = isset($C['named_entity']) ? (bool)$C['named_entity'] : 1;
-$C['no_deprecated_attr'] = isset($C['no_deprecated_attr']) ? $C['no_deprecated_attr'] : 1;
-$C['parent'] = isset($C['parent'][0]) ? strtolower($C['parent']) : 'body';
-$C['show_setting'] = !empty($C['show_setting']) ? $C['show_setting'] : 0;
-$C['style_pass'] = empty($C['style_pass']) ? 0 : 1;
-$C['tidy'] = empty($C['tidy']) ? 0 : $C['tidy'];
-$C['unique_ids'] = isset($C['unique_ids']) && (!preg_match('`\W`', $C['unique_ids'])) ? $C['unique_ids'] : 1;
-$C['xml:lang'] = isset($C['xml:lang']) ? $C['xml:lang'] : 0;
+if(isset($GLOBALS['C'])){$reC = $GLOBALS['C'];}
+$GLOBALS['C'] = $C;
+$S = is_array($S) ? $S : hl_spec($S);
+if(isset($GLOBALS['S'])){$reS = $GLOBALS['S'];}
+$GLOBALS['S'] = $S;
-if(isset($GLOBALS['C'])){$reC = $GLOBALS['C'];}
-$GLOBALS['C'] = $C;
-$S = is_array($S) ? $S : hl_spec($S);
-if(isset($GLOBALS['S'])){$reS = $GLOBALS['S'];}
-$GLOBALS['S'] = $S;
+$t = preg_replace('`[\x00-\x08\x0b-\x0c\x0e-\x1f]`', '', $t);
+if($C['clean_ms_char']){
+ $x = array("\x7f"=>'', "\x80"=>'€', "\x81"=>'', "\x83"=>'ƒ', "\x85"=>'…', "\x86"=>'†', "\x87"=>'‡', "\x88"=>'ˆ', "\x89"=>'‰', "\x8a"=>'Š', "\x8b"=>'‹', "\x8c"=>'Œ', "\x8d"=>'', "\x8e"=>'Ž', "\x8f"=>'', "\x90"=>'', "\x95"=>'•', "\x96"=>'–', "\x97"=>'—', "\x98"=>'˜', "\x99"=>'™', "\x9a"=>'š', "\x9b"=>'›', "\x9c"=>'œ', "\x9d"=>'', "\x9e"=>'ž', "\x9f"=>'Ÿ');
+ $x = $x + ($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"'));
+ $t = strtr($t, $x);
+}
+if($C['cdata'] or $C['comment']){$t = preg_replace_callback('``sm', 'hl_cmtcd', $t);}
+$t = preg_replace_callback('`&([A-Za-z][A-Za-z0-9]{1,30}|#(?:[0-9]{1,8}|[Xx][0-9A-Fa-f]{1,7}));`', 'hl_ent', str_replace('&', '&', $t));
+if($C['unique_ids'] && !isset($GLOBALS['hl_Ids'])){$GLOBALS['hl_Ids'] = array();}
+if($C['hook']){$t = $C['hook']($t, $C, $S);}
+if($C['show_setting'] && preg_match('`^[a-z][a-z0-9_]*$`i', $C['show_setting'])){
+ $GLOBALS[$C['show_setting']] = array('config'=>$C, 'spec'=>$S, 'time'=>microtime());
+}
+// main
+$t = preg_replace_callback('`<(?:(?:\s|$)|(?:[^>]*(?:>|$)))|>`m', 'hl_tag', $t);
+$t = $C['balance'] ? hl_bal($t, $C['keep_bad'], $C['parent']) : $t;
+$t = (($C['cdata'] or $C['comment']) && strpos($t, "\x01") !== false) ? str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05"), array('', '', '&', '<', '>'), $t) : $t;
+$t = $C['tidy'] ? hl_tidy($t, $C['tidy'], $C['parent']) : $t;
+unset($C, $e);
+if(isset($reC)){$GLOBALS['C'] = $reC;}
+if(isset($reS)){$GLOBALS['S'] = $reS;}
+return $t;
+// eof
+}
-$t = preg_replace('`[\x00-\x08\x0b-\x0c\x0e-\x1f]`', '', $t);
-if($C['clean_ms_char']){
- $x = array("\x7f"=>'', "\x80"=>'€', "\x81"=>'', "\x83"=>'ƒ', "\x85"=>'…', "\x86"=>'†', "\x87"=>'‡', "\x88"=>'ˆ', "\x89"=>'‰', "\x8a"=>'Š', "\x8b"=>'‹', "\x8c"=>'Œ', "\x8d"=>'', "\x8e"=>'Ž', "\x8f"=>'', "\x90"=>'', "\x95"=>'•', "\x96"=>'–', "\x97"=>'—', "\x98"=>'˜', "\x99"=>'™', "\x9a"=>'š', "\x9b"=>'›', "\x9c"=>'œ', "\x9d"=>'', "\x9e"=>'ž', "\x9f"=>'Ÿ');
- $x = $x + ($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"'));
- $t = strtr($t, $x);
-}
-if($C['cdata'] or $C['comment']){$t = preg_replace_callback('``sm', 'hl_cmtcd', $t);}
-$t = preg_replace_callback('`&([a-zA-Z][a-zA-Z0-9]{1,30}|#(?:[0-9]{1,8}|[Xx][0-9A-Fa-f]{1,7}));`', 'hl_ent', str_replace('&', '&', $t));
-if($C['unique_ids'] && !isset($GLOBALS['hl_Ids'])){$GLOBALS['hl_Ids'] = array();}
-if($C['hook']){$t = $C['hook']($t, $C, $S);}
-if($C['show_setting'] && preg_match('`^[a-z][a-z0-9_]*$`i', $C['show_setting'])){
- $GLOBALS[$C['show_setting']] = array('config'=>$C, 'spec'=>$S, 'time'=>microtime());
-}
-// main
-$t = preg_replace_callback('`<(?:(?:\s|$)|(?:[^>]*(?:>|$)))|>`m', 'hl_tag', $t);
-$t = $C['balance'] ? hl_bal($t, $C['keep_bad'], $C['parent']) : $t;
-$t = (($C['cdata'] or $C['comment']) && strpos($t, "\x01") !== false) ? str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05"), array('', '', '&', '<', '>'), $t) : $t;
-$t = $C['tidy'] ? hl_tidy($t, $C['tidy'], $C['parent']) : $t;
-unset($C, $e);
-if(isset($reC)){$GLOBALS['C'] = $reC;}
-if(isset($reS)){$GLOBALS['S'] = $reS;}
-return $t;
-// eof
-}
+function hl_attrval($a, $t, $p){
+// check attr val against $S
+static $ma = array('accesskey', 'class', 'rel');
+$s = in_array($a, $ma) ? ' ' : '';
+$r = array();
+$t = !empty($s) ? explode($s, $t) : array($t);
+foreach($t as $tk=>$tv){
+ $o = 1; $l = strlen($tv);
+ foreach($p as $k=>$v){
+ switch($k){
+ case 'maxlen': if($l > $v){$o = 0;}
+ break; case 'minlen': if($l < $v){$o = 0;}
+ break; case 'maxval': if((float)($tv) > $v){$o = 0;}
+ break; case 'minval': if((float)($tv) < $v){$o = 0;}
+ break; case 'match': if(!preg_match($v, $tv)){$o = 0;}
+ break; case 'nomatch': if(preg_match($v, $tv)){$o = 0;}
+ break; case 'oneof':
+ $m = 0;
+ foreach(explode('|', $v) as $n){if($tv == $n){$m = 1; break;}}
+ $o = $m;
+ break; case 'noneof':
+ $m = 1;
+ foreach(explode('|', $v) as $n){if($tv == $n){$m = 0; break;}}
+ $o = $m;
+ break; default:
+ break;
+ }
+ if(!$o){break;}
+ }
+ if($o){$r[] = $tv;}
+}
+$r = implode($s, $r);
+return (isset($r[0]) ? $r : (isset($p['default']) ? $p['default'] : 0));
+// eof
+}
-function hl_attrval($a, $t, $p){
-// check attr val against $S
-static $ma = array('accesskey', 'class', 'rel');
-$s = in_array($a, $ma) ? ' ' : ($s == 'srcset' ? ',': '');
-$r = array();
-$t = !empty($s) ? explode($s, $t) : array($t);
-foreach($t as $tk=>$tv){
- $o = 1; $tv = trim($tv); $l = strlen($tv);
- foreach($p as $k=>$v){
- if(!$l){continue;}
- switch($k){
- case 'maxlen': if($l > $v){$o = 0;}
- break; case 'minlen': if($l < $v){$o = 0;}
- break; case 'maxval': if((float)($tv) > $v){$o = 0;}
- break; case 'minval': if((float)($tv) < $v){$o = 0;}
- break; case 'match': if(!preg_match($v, $tv)){$o = 0;}
- break; case 'nomatch': if(preg_match($v, $tv)){$o = 0;}
- break; case 'oneof':
- $m = 0;
- foreach(explode('|', $v) as $n){if($tv == $n){$m = 1; break;}}
- $o = $m;
- break; case 'noneof':
- $m = 1;
- foreach(explode('|', $v) as $n){if($tv == $n){$m = 0; break;}}
- $o = $m;
- break; default:
- break;
- }
- if(!$o){break;}
- }
- if($o){$r[] = $tv;}
-}
-if($s == ','){$s = ', ';}
-$r = implode($s, $r);
-return (isset($r[0]) ? $r : (isset($p['default']) ? $p['default'] : 0));
-// eof
-}
+function hl_bal($t, $do=1, $in='div'){
+// balance tags
+// by content
+$cB = array('blockquote'=>1, 'form'=>1, 'map'=>1, 'noscript'=>1); // Block
+$cE = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1); // Empty
+$cF = array('button'=>1, 'del'=>1, 'div'=>1, 'dd'=>1, 'fieldset'=>1, 'iframe'=>1, 'ins'=>1, 'li'=>1, 'noscript'=>1, 'object'=>1, 'td'=>1, 'th'=>1); // Flow; later context-wise dynamic move of ins & del to $cI
+$cI = array('a'=>1, 'abbr'=>1, 'acronym'=>1, 'address'=>1, 'b'=>1, 'bdo'=>1, 'big'=>1, 'caption'=>1, 'cite'=>1, 'code'=>1, 'dfn'=>1, 'dt'=>1, 'em'=>1, 'font'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'i'=>1, 'kbd'=>1, 'label'=>1, 'legend'=>1, 'p'=>1, 'pre'=>1, 'q'=>1, 'rb'=>1, 'rt'=>1, 's'=>1, 'samp'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'sup'=>1, 'tt'=>1, 'u'=>1, 'var'=>1); // Inline
+$cN = array('a'=>array('a'=>1), 'button'=>array('a'=>1, 'button'=>1, 'fieldset'=>1, 'form'=>1, 'iframe'=>1, 'input'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'fieldset'=>array('fieldset'=>1), 'form'=>array('form'=>1), 'label'=>array('label'=>1), 'noscript'=>array('script'=>1), 'pre'=>array('big'=>1, 'font'=>1, 'img'=>1, 'object'=>1, 'script'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1), 'rb'=>array('ruby'=>1), 'rt'=>array('ruby'=>1)); // Illegal
+$cN2 = array_keys($cN);
+$cR = array('blockquote'=>1, 'dir'=>1, 'dl'=>1, 'form'=>1, 'map'=>1, 'menu'=>1, 'noscript'=>1, 'ol'=>1, 'optgroup'=>1, 'rbc'=>1, 'rtc'=>1, 'ruby'=>1, 'select'=>1, 'table'=>1, 'tbody'=>1, 'tfoot'=>1, 'thead'=>1, 'tr'=>1, 'ul'=>1);
+$cS = array('colgroup'=>array('col'=>1), 'dir'=>array('li'=>1), 'dl'=>array('dd'=>1, 'dt'=>1), 'menu'=>array('li'=>1), 'ol'=>array('li'=>1), 'optgroup'=>array('option'=>1), 'option'=>array('#pcdata'=>1), 'rbc'=>array('rb'=>1), 'rp'=>array('#pcdata'=>1), 'rtc'=>array('rt'=>1), 'ruby'=>array('rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1), 'select'=>array('optgroup'=>1, 'option'=>1), 'script'=>array('#pcdata'=>1), 'table'=>array('caption'=>1, 'col'=>1, 'colgroup'=>1, 'tfoot'=>1, 'tbody'=>1, 'tr'=>1, 'thead'=>1), 'tbody'=>array('tr'=>1), 'tfoot'=>array('tr'=>1), 'textarea'=>array('#pcdata'=>1), 'thead'=>array('tr'=>1), 'tr'=>array('td'=>1, 'th'=>1), 'ul'=>array('li'=>1)); // Specific - immediate parent-child
+if($GLOBALS['C']['direct_list_nest']){$cS['ol'] = $cS['ul'] += array('ol'=>1, 'ul'=>1);}
+$cO = array('address'=>array('p'=>1), 'applet'=>array('param'=>1), 'blockquote'=>array('script'=>1), 'fieldset'=>array('legend'=>1, '#pcdata'=>1), 'form'=>array('script'=>1), 'map'=>array('area'=>1), 'object'=>array('param'=>1, 'embed'=>1)); // Other
+$cT = array('colgroup'=>1, 'dd'=>1, 'dt'=>1, 'li'=>1, 'option'=>1, 'p'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1); // Omitable closing
+// block/inline type; ins & del both type; #pcdata: text
+$eB = array('address'=>1, 'blockquote'=>1, 'center'=>1, 'del'=>1, 'dir'=>1, 'dl'=>1, 'div'=>1, 'fieldset'=>1, 'form'=>1, 'ins'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'isindex'=>1, 'menu'=>1, 'noscript'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'table'=>1, 'ul'=>1);
+$eI = array('#pcdata'=>1, 'a'=>1, 'abbr'=>1, 'acronym'=>1, 'applet'=>1, 'b'=>1, 'bdo'=>1, 'big'=>1, 'br'=>1, 'button'=>1, 'cite'=>1, 'code'=>1, 'del'=>1, 'dfn'=>1, 'em'=>1, 'embed'=>1, 'font'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'kbd'=>1, 'label'=>1, 'map'=>1, 'object'=>1, 'q'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'select'=>1, 'script'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1, 'tt'=>1, 'u'=>1, 'var'=>1);
+$eN = array('a'=>1, 'big'=>1, 'button'=>1, 'fieldset'=>1, 'font'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'label'=>1, 'object'=>1, 'ruby'=>1, 'script'=>1, 'select'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1); // Exclude from specific ele; $cN values
+$eO = array('area'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'dd'=>1, 'dt'=>1, 'legend'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'script'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'thead'=>1, 'th'=>1, 'tr'=>1); // Missing in $eB & $eI
+$eF = $eB + $eI;
-function hl_bal($t, $do=1, $in='div'){
-// balance tags
-// by content
-$cB = array('blockquote'=>1, 'form'=>1, 'map'=>1, 'noscript'=>1); // Block
-$cE = array('area'=>1, 'br'=>1, 'col'=>1, 'command'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'keygen'=>1, 'link'=>1, 'meta'=>1, 'param'=>1, 'source'=>1, 'track'=>1, 'wbr'=>1); // Empty
-$cF = array('a'=>1, 'article'=>1, 'aside'=>1, 'audio'=>1, 'button'=>1, 'canvas'=>1, 'del'=>1, 'details'=>1, 'div'=>1, 'dd'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'header'=>1, 'iframe'=>1, 'ins'=>1, 'li'=>1, 'main'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'object'=>1, 'section'=>1, 'style'=>1, 'td'=>1, 'th'=>1, 'video'=>1); // Flow; later context-wise dynamic move of ins & del to $cI
-$cI = array('abbr'=>1, 'acronym'=>1, 'address'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'caption'=>1, 'cite'=>1, 'code'=>1, 'data'=>1, 'datalist'=>1, 'dfn'=>1, 'dt'=>1, 'em'=>1, 'figcaption'=>1, 'font'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hgroup'=>1, 'i'=>1, 'kbd'=>1, 'label'=>1, 'legend'=>1, 'mark'=>1, 'meter'=>1, 'output'=>1, 'p'=>1, 'pre'=>1, 'progress'=>1, 'q'=>1, 'rb'=>1, 'rt'=>1, 's'=>1, 'samp'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'time'=>1, 'tt'=>1, 'u'=>1, 'var'=>1); // Inline
-$cN = array('a'=>array('a'=>1, 'address'=>1, 'button'=>1, 'details'=>1, 'embed'=>1, 'keygen'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'address'=>array('address'=>1, 'article'=>1, 'aside'=>1, 'header'=>1, 'keygen'=>1, 'footer'=>1, 'nav'=>1, 'section'=>1), 'button'=>array('a'=>1, 'address'=>1, 'button'=>1, 'details'=>1, 'embed'=>1, 'fieldset'=>1, 'form'=>1, 'iframe'=>1, 'input'=>1, 'keygen'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'fieldset'=>array('fieldset'=>1), 'footer'=>array('header'=>1, 'footer'=>1), 'form'=>array('form'=>1), 'header'=>array('header'=>1, 'footer'=>1), 'label'=>array('label'=>1), 'main'=>array('main'=>1), 'meter'=>array('meter'=>1), 'noscript'=>array('script'=>1), 'pre'=>array('big'=>1, 'font'=>1, 'img'=>1, 'object'=>1, 'script'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1), 'progress'=>array('progress'=>1), 'rb'=>array('ruby'=>1), 'rt'=>array('ruby'=>1), 'time'=>array('time'=>1), ); // Illegal
-$cN2 = array_keys($cN);
-$cS = array('colgroup'=>array('col'=>1), 'datalist'=>array('option'=>1), 'dir'=>array('li'=>1), 'dl'=>array('dd'=>1, 'dt'=>1), 'hgroup'=>array('h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1), 'menu'=>array('li'=>1), 'ol'=>array('li'=>1), 'optgroup'=>array('option'=>1), 'option'=>array('#pcdata'=>1), 'rbc'=>array('rb'=>1), 'rp'=>array('#pcdata'=>1), 'rtc'=>array('rt'=>1), 'ruby'=>array('rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1), 'select'=>array('optgroup'=>1, 'option'=>1), 'script'=>array('#pcdata'=>1), 'table'=>array('caption'=>1, 'col'=>1, 'colgroup'=>1, 'tfoot'=>1, 'tbody'=>1, 'tr'=>1, 'thead'=>1), 'tbody'=>array('tr'=>1), 'tfoot'=>array('tr'=>1), 'textarea'=>array('#pcdata'=>1), 'thead'=>array('tr'=>1), 'tr'=>array('td'=>1, 'th'=>1), 'ul'=>array('li'=>1)); // Specific - immediate parent-child
-if($GLOBALS['C']['direct_list_nest']){$cS['ol'] = $cS['ul'] = $cS['menu'] += array('menu'=>1, 'ol'=>1, 'ul'=>1);}
-$cO = array('address'=>array('p'=>1), 'applet'=>array('param'=>1), 'audio'=>array('source'=>1, 'track'=>1), 'blockquote'=>array('script'=>1), 'details'=>array('summary'=>1), 'fieldset'=>array('legend'=>1, '#pcdata'=>1), 'figure'=>array('figcaption'=>1),'form'=>array('script'=>1), 'map'=>array('area'=>1), 'object'=>array('param'=>1, 'embed'=>1), 'video'=>array('source'=>1, 'track'=>1)); // Other
-$cT = array('colgroup'=>1, 'dd'=>1, 'dt'=>1, 'li'=>1, 'option'=>1, 'p'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1); // Omitable closing
-// block/inline type; a/ins/del both type; #pcdata: text
-$eB = array('a'=>1, 'address'=>1, 'article'=>1, 'aside'=>1, 'blockquote'=>1, 'center'=>1, 'del'=>1, 'details'=>1, 'dir'=>1, 'dl'=>1, 'div'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'form'=>1, 'ins'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hr'=>1, 'isindex'=>1, 'main'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'section'=>1, 'style'=>1, 'table'=>1, 'ul'=>1);
-$eI = array('#pcdata'=>1, 'a'=>1, 'abbr'=>1, 'acronym'=>1, 'applet'=>1, 'audio'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'br'=>1, 'button'=>1, 'canvas'=>1, 'cite'=>1, 'code'=>1, 'command'=>1, 'data'=>1, 'datalist'=>1, 'del'=>1, 'dfn'=>1, 'em'=>1, 'embed'=>1, 'figcaption'=>1, 'font'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'kbd'=>1, 'label'=>1, 'link'=>1, 'map'=>1, 'mark'=>1, 'meta'=>1, 'meter'=>1, 'object'=>1, 'output'=>1, 'progress'=>1, 'q'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'select'=>1, 'script'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'textarea'=>1, 'time'=>1, 'tt'=>1, 'u'=>1, 'var'=>1, 'video'=>1, 'wbr'=>1);
-$eN = array('a'=>1, 'address'=>1, 'article'=>1, 'aside'=>1, 'big'=>1, 'button'=>1, 'details'=>1, 'embed'=>1, 'fieldset'=>1, 'font'=>1, 'footer'=>1, 'form'=>1, 'header'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'keygen'=>1, 'label'=>1, 'meter'=>1, 'nav'=>1, 'object'=>1, 'progress'=>1, 'ruby'=>1, 'script'=>1, 'select'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1, 'time'=>1); // Exclude from specific ele; $cN values
-$eO = array('area'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'command'=>1, 'dd'=>1, 'dt'=>1, 'hgroup'=>1, 'keygen'=>1, 'legend'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'script'=>1, 'source'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'thead'=>1, 'th'=>1, 'tr'=>1, 'track'=>1); // Missing in $eB & $eI
-$eF = $eB + $eI;
+// $in sets allowed child
+$in = ((isset($eF[$in]) && $in != '#pcdata') or isset($eO[$in])) ? $in : 'div';
+if(isset($cE[$in])){
+ return (!$do ? '' : str_replace(array('<', '>'), array('<', '>'), $t));
+}
+if(isset($cS[$in])){$inOk = $cS[$in];}
+elseif(isset($cI[$in])){$inOk = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
+elseif(isset($cF[$in])){$inOk = $eF; unset($cI['del'], $cI['ins']);}
+elseif(isset($cB[$in])){$inOk = $eB; unset($cI['del'], $cI['ins']);}
+if(isset($cO[$in])){$inOk = $inOk + $cO[$in];}
+if(isset($cN[$in])){$inOk = array_diff_assoc($inOk, $cN[$in]);}
-// $in sets allowed child
-$in = ((isset($eF[$in]) && $in != '#pcdata') or isset($eO[$in])) ? $in : 'div';
-if(isset($cE[$in])){
- return (!$do ? '' : str_replace(array('<', '>'), array('<', '>'), $t));
-}
-if(isset($cS[$in])){$inOk = $cS[$in];}
-elseif(isset($cI[$in])){$inOk = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
-elseif(isset($cF[$in])){$inOk = $eF; unset($cI['del'], $cI['ins']);}
-elseif(isset($cB[$in])){$inOk = $eB; unset($cI['del'], $cI['ins']);}
-if(isset($cO[$in])){$inOk = $inOk + $cO[$in];}
-if(isset($cN[$in])){$inOk = array_diff_assoc($inOk, $cN[$in]);}
+$t = explode('<', $t);
+$ok = $q = array(); // $q seq list of open non-empty ele
+ob_start();
-$t = explode('<', $t);
-$ok = $q = array(); // $q seq list of open non-empty ele
-ob_start();
+for($i=-1, $ci=count($t); ++$i<$ci;){
+ // allowed $ok in parent $p
+ if($ql = count($q)){
+ $p = array_pop($q);
+ $q[] = $p;
+ if(isset($cS[$p])){$ok = $cS[$p];}
+ elseif(isset($cI[$p])){$ok = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
+ elseif(isset($cF[$p])){$ok = $eF; unset($cI['del'], $cI['ins']);}
+ elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
+ if(isset($cO[$p])){$ok = $ok + $cO[$p];}
+ if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
+ }else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
+ // bad tags, & ele content
+ if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
+ echo '<', $s, $e, $a, '>';
+ }
+ if(isset($x[0])){
+ if(strlen(trim($x)) && (($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql))){
+ echo '', $x, '
';
+ }
+ elseif($do < 3 or isset($ok['#pcdata'])){echo $x;}
+ elseif(strpos($x, "\x02\x04")){
+ foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
+ echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
+ }
+ }elseif($do > 4){echo preg_replace('`\S`', '', $x);}
+ }
+ // get markup
+ if(!preg_match('`^(/?)([a-z1-6]+)([^>]*)>(.*)`sm', $t[$i], $r)){$x = $t[$i]; continue;}
+ $s = null; $e = null; $a = null; $x = null; list($all, $s, $e, $a, $x) = $r;
+ // close tag
+ if($s){
+ if(isset($cE[$e]) or !in_array($e, $q)){continue;} // Empty/unopen
+ if($p == $e){array_pop($q); echo '', $e, '>'; unset($e); continue;} // Last open
+ $add = ''; // Nesting - close open tags that need to be
+ for($j=-1, $cj=count($q); ++$j<$cj;){
+ if(($d = array_pop($q)) == $e){break;}
+ else{$add .= "{$d}>";}
+ }
+ echo $add, '', $e, '>'; unset($e); continue;
+ }
+ // open tag
+ // $cB ele needs $eB ele as child
+ if(isset($cB[$e]) && strlen(trim($x))){
+ $t[$i] = "{$e}{$a}>";
+ array_splice($t, $i+1, 0, 'div>'. $x); unset($e, $x); ++$ci; --$i; continue;
+ }
+ if((($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql)) && !isset($eB[$e]) && !isset($ok[$e])){
+ array_splice($t, $i, 0, 'div>'); unset($e, $x); ++$ci; --$i; continue;
+ }
+ // if no open ele, $in = parent; mostly immediate parent-child relation should hold
+ if(!$ql or !isset($eN[$e]) or !array_intersect($q, $cN2)){
+ if(!isset($ok[$e])){
+ if($ql && isset($cT[$p])){echo '', array_pop($q), '>'; unset($e, $x); --$i;}
+ continue;
+ }
+ if(!isset($cE[$e])){$q[] = $e;}
+ echo '<', $e, $a, '>'; unset($e); continue;
+ }
+ // specific parent-child
+ if(isset($cS[$p][$e])){
+ if(!isset($cE[$e])){$q[] = $e;}
+ echo '<', $e, $a, '>'; unset($e); continue;
+ }
+ // nesting
+ $add = '';
+ $q2 = array();
+ for($k=-1, $kc=count($q); ++$k<$kc;){
+ $d = $q[$k];
+ $ok2 = array();
+ if(isset($cS[$d])){$q2[] = $d; continue;}
+ $ok2 = isset($cI[$d]) ? $eI : $eF;
+ if(isset($cO[$d])){$ok2 = $ok2 + $cO[$d];}
+ if(isset($cN[$d])){$ok2 = array_diff_assoc($ok2, $cN[$d]);}
+ if(!isset($ok2[$e])){
+ if(!$k && !isset($inOk[$e])){continue 2;}
+ $add = "{$d}>";
+ for(;++$k<$kc;){$add = "{$q[$k]}>{$add}";}
+ break;
+ }
+ else{$q2[] = $d;}
+ }
+ $q = $q2;
+ if(!isset($cE[$e])){$q[] = $e;}
+ echo $add, '<', $e, $a, '>'; unset($e); continue;
+}
-for($i=-1, $ci=count($t); ++$i<$ci;){
- // allowed $ok in parent $p
- if($ql = count($q)){
- $p = array_pop($q);
- $q[] = $p;
- if(isset($cS[$p])){$ok = $cS[$p];}
- elseif(isset($cI[$p])){$ok = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
- elseif(isset($cF[$p])){$ok = $eF; unset($cI['del'], $cI['ins']);}
- elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
- if(isset($cO[$p])){$ok = $ok + $cO[$p];}
- if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
- }else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
- // bad tags, & ele content
- if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
- echo '<', $s, $e, $a, '>';
- }
- if(isset($x[0])){
- if(strlen(trim($x)) && (($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql))){
- echo '', $x, '
';
- }
- elseif($do < 3 or isset($ok['#pcdata'])){echo $x;}
- elseif(strpos($x, "\x02\x04")){
- foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
- echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
- }
- }elseif($do > 4){echo preg_replace('`\S`', '', $x);}
- }
- // get markup
- if(!preg_match('`^(/?)([a-z1-6]+)([^>]*)>(.*)`sm', $t[$i], $r)){$x = $t[$i]; continue;}
- $s = null; $e = null; $a = null; $x = null; list($all, $s, $e, $a, $x) = $r;
- // close tag
- if($s){
- if(isset($cE[$e]) or !in_array($e, $q)){continue;} // Empty/unopen
- if($p == $e){array_pop($q); echo '', $e, '>'; unset($e); continue;} // Last open
- $add = ''; // Nesting - close open tags that need to be
- for($j=-1, $cj=count($q); ++$j<$cj;){
- if(($d = array_pop($q)) == $e){break;}
- else{$add .= "{$d}>";}
- }
- echo $add, '', $e, '>'; unset($e); continue;
- }
- // open tag
- // $cB ele needs $eB ele as child
- if(isset($cB[$e]) && strlen(trim($x))){
- $t[$i] = "{$e}{$a}>";
- array_splice($t, $i+1, 0, 'div>'. $x); unset($e, $x); ++$ci; --$i; continue;
- }
- if((($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql)) && !isset($eB[$e]) && !isset($ok[$e])){
- array_splice($t, $i, 0, 'div>'); unset($e, $x); ++$ci; --$i; continue;
- }
- // if no open ele, $in = parent; mostly immediate parent-child relation should hold
- if(!$ql or !isset($eN[$e]) or !array_intersect($q, $cN2)){
- if(!isset($ok[$e])){
- if($ql && isset($cT[$p])){echo '', array_pop($q), '>'; unset($e, $x); --$i;}
- continue;
- }
- if(!isset($cE[$e])){$q[] = $e;}
- echo '<', $e, $a, '>'; unset($e); continue;
- }
- // specific parent-child
- if(isset($cS[$p][$e])){
- if(!isset($cE[$e])){$q[] = $e;}
- echo '<', $e, $a, '>'; unset($e); continue;
- }
- // nesting
- $add = '';
- $q2 = array();
- for($k=-1, $kc=count($q); ++$k<$kc;){
- $d = $q[$k];
- $ok2 = array();
- if(isset($cS[$d])){$q2[] = $d; continue;}
- $ok2 = isset($cI[$d]) ? $eI : $eF;
- if(isset($cO[$d])){$ok2 = $ok2 + $cO[$d];}
- if(isset($cN[$d])){$ok2 = array_diff_assoc($ok2, $cN[$d]);}
- if(!isset($ok2[$e])){
- if(!$k && !isset($inOk[$e])){continue 2;}
- $add = "{$d}>";
- for(;++$k<$kc;){$add = "{$q[$k]}>{$add}";}
- break;
- }
- else{$q2[] = $d;}
- }
- $q = $q2;
- if(!isset($cE[$e])){$q[] = $e;}
- echo $add, '<', $e, $a, '>'; unset($e); continue;
-}
+// end
+if($ql = count($q)){
+ $p = array_pop($q);
+ $q[] = $p;
+ if(isset($cS[$p])){$ok = $cS[$p];}
+ elseif(isset($cI[$p])){$ok = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
+ elseif(isset($cF[$p])){$ok = $eF; unset($cI['del'], $cI['ins']);}
+ elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
+ if(isset($cO[$p])){$ok = $ok + $cO[$p];}
+ if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
+}else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
+if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
+ echo '<', $s, $e, $a, '>';
+}
+if(isset($x[0])){
+ if(strlen(trim($x)) && (($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql))){
+ echo '', $x, '
';
+ }
+ elseif($do < 3 or isset($ok['#pcdata'])){echo $x;}
+ elseif(strpos($x, "\x02\x04")){
+ foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
+ echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
+ }
+ }elseif($do > 4){echo preg_replace('`\S`', '', $x);}
+}
+while(!empty($q) && ($e = array_pop($q))){echo '', $e, '>';}
+$o = ob_get_contents();
+ob_end_clean();
+return $o;
+// eof
+}
-// end
-if($ql = count($q)){
- $p = array_pop($q);
- $q[] = $p;
- if(isset($cS[$p])){$ok = $cS[$p];}
- elseif(isset($cI[$p])){$ok = $eI; $cI['del'] = 1; $cI['ins'] = 1;}
- elseif(isset($cF[$p])){$ok = $eF; unset($cI['del'], $cI['ins']);}
- elseif(isset($cB[$p])){$ok = $eB; unset($cI['del'], $cI['ins']);}
- if(isset($cO[$p])){$ok = $ok + $cO[$p];}
- if(isset($cN[$p])){$ok = array_diff_assoc($ok, $cN[$p]);}
-}else{$ok = $inOk; unset($cI['del'], $cI['ins']);}
-if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
- echo '<', $s, $e, $a, '>';
-}
-if(isset($x[0])){
- if(strlen(trim($x)) && (($ql && isset($cB[$p])) or (isset($cB[$in]) && !$ql))){
- echo '', $x, '
';
- }
- elseif($do < 3 or isset($ok['#pcdata'])){echo $x;}
- elseif(strpos($x, "\x02\x04")){
- foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){
- echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : ''));
- }
- }elseif($do > 4){echo preg_replace('`\S`', '', $x);}
-}
-while(!empty($q) && ($e = array_pop($q))){echo '', $e, '>';}
-$o = ob_get_contents();
-ob_end_clean();
-return $o;
-// eof
-}
+function hl_cmtcd($t){
+// comment/CDATA sec handler
+$t = $t[0];
+global $C;
+if(!($v = $C[$n = $t[3] == '-' ? 'comment' : 'cdata'])){return $t;}
+if($v == 1){return '';}
+if($n == 'comment'){
+ if(substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' '){$t .= ' ';}
+}
+else{$t = substr($t, 1, -1);}
+$t = $v == 2 ? str_replace(array('&', '<', '>'), array('&', '<', '>'), $t) : $t;
+return str_replace(array('&', '<', '>'), array("\x03", "\x04", "\x05"), ($n == 'comment' ? "\x01\x02\x04!--$t--\x05\x02\x01" : "\x01\x01\x04$t\x05\x01\x01"));
+// eof
+}
-function hl_cmtcd($t){
-// comment/CDATA sec handler
-$t = $t[0];
-global $C;
-if(!($v = $C[$n = $t[3] == '-' ? 'comment' : 'cdata'])){return $t;}
-if($v == 1){return '';}
-if($n == 'comment'){
- if(substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' '){$t .= ' ';}
-}
-else{$t = substr($t, 1, -1);}
-$t = $v == 2 ? str_replace(array('&', '<', '>'), array('&', '<', '>'), $t) : $t;
-return str_replace(array('&', '<', '>'), array("\x03", "\x04", "\x05"), ($n == 'comment' ? "\x01\x02\x04!--$t--\x05\x02\x01" : "\x01\x01\x04$t\x05\x01\x01"));
-// eof
-}
+function hl_ent($t){
+// entitity handler
+global $C;
+$t = $t[1];
+static $U = array('quot'=>1,'amp'=>1,'lt'=>1,'gt'=>1);
+static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255');
+if($t[0] != '#'){
+ return ($C['and_mark'] ? "\x06" : '&'). (isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'. ($C['hexdec_entity'] > 1 ? 'x'. dechex($N[$t]) : $N[$t]) : $t) : 'amp;'. $t)). ';';
+}
+if(($n = ctype_digit($t = substr($t, 1)) ? intval($t) : hexdec(substr($t, 1))) < 9 or ($n > 13 && $n < 32) or $n == 11 or $n == 12 or ($n > 126 && $n < 160 && $n != 133) or ($n > 55295 && ($n < 57344 or ($n > 64975 && $n < 64992) or $n == 65534 or $n == 65535 or $n > 1114111))){
+ return ($C['and_mark'] ? "\x06" : '&'). "amp;#{$t};";
+}
+return ($C['and_mark'] ? "\x06" : '&'). '#'. (((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'. dechex($n)). ';';
+// eof
+}
-function hl_ent($t){
-// entitity handler
-global $C;
-$t = $t[1];
-static $U = array('quot'=>1,'amp'=>1,'lt'=>1,'gt'=>1);
-static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255');
-if($t[0] != '#'){
- return ($C['and_mark'] ? "\x06" : '&'). (isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'. ($C['hexdec_entity'] > 1 ? 'x'. dechex($N[$t]) : $N[$t]) : $t) : 'amp;'. $t)). ';';
-}
-if(($n = ctype_digit($t = substr($t, 1)) ? intval($t) : hexdec(substr($t, 1))) < 9 or ($n > 13 && $n < 32) or $n == 11 or $n == 12 or ($n > 126 && $n < 160 && $n != 133) or ($n > 55295 && ($n < 57344 or ($n > 64975 && $n < 64992) or $n == 65534 or $n == 65535 or $n > 1114111))){
- return ($C['and_mark'] ? "\x06" : '&'). "amp;#{$t};";
-}
-return ($C['and_mark'] ? "\x06" : '&'). '#'. (((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'. dechex($n)). ';';
-// eof
-}
+function hl_prot($p, $c=null){
+// check URL scheme
+global $C;
+$b = $a = '';
+if($c == null){$c = 'style'; $b = $p[1]; $a = $p[3]; $p = trim($p[2]);}
+$c = isset($C['schemes'][$c]) ? $C['schemes'][$c] : $C['schemes']['*'];
+static $d = 'denied:';
+if(isset($c['!']) && substr($p, 0, 7) != $d){$p = "$d$p";}
+if(isset($c['*']) or !strcspn($p, '#?;') or (substr($p, 0, 7) == $d)){return "{$b}{$p}{$a}";} // All ok, frag, query, param
+if(preg_match('`^([^:?[@!$()*,=/\'\]]+?)(:|(58|x3a);|%3a|\\\\0{0,4}3a).`i', $p, $m) && !isset($c[strtolower($m[1])])){ // Denied prot
+ return "{$b}{$d}{$p}{$a}";
+}
+if($C['abs_url']){
+ if($C['abs_url'] == -1 && strpos($p, $C['base_url']) === 0){ // Make url rel
+ $p = substr($p, strlen($C['base_url']));
+ }elseif(empty($m[1])){ // Make URL abs
+ if(substr($p, 0, 2) == '//'){$p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1). $p;}
+ elseif($p[0] == '/'){$p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']). $p;}
+ elseif(strcspn($p, './')){$p = $C['base_url']. $p;}
+ else{
+ preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m);
+ $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p);
+ while(preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)){
+ $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p);
+ }
+ $p = $m[1]. $p;
+ }
+ }
+}
+return "{$b}{$p}{$a}";
+// eof
+}
-function hl_prot($p, $c=null){
-// check URL scheme
-global $C;
-$b = $a = '';
-if($c == null){$c = 'style'; $b = $p[1]; $a = $p[3]; $p = trim($p[2]);}
-$c = isset($C['schemes'][$c]) ? $C['schemes'][$c] : $C['schemes']['*'];
-static $d = 'denied:';
-if(isset($c['!']) && substr($p, 0, 7) != $d){$p = "$d$p";}
-if(isset($c['*']) or !strcspn($p, '#?;') or (substr($p, 0, 7) == $d)){return "{$b}{$p}{$a}";} // All ok, frag, query, param
-if(preg_match('`^([^:?[@!$()*,=/\'\]]+?)(:|(58|x3a);|%3a|\\\\0{0,4}3a).`i', $p, $m) && !isset($c[strtolower($m[1])])){ // Denied prot
- return "{$b}{$d}{$p}{$a}";
-}
-if($C['abs_url']){
- if($C['abs_url'] == -1 && strpos($p, $C['base_url']) === 0){ // Make url rel
- $p = substr($p, strlen($C['base_url']));
- }elseif(empty($m[1])){ // Make URL abs
- if(substr($p, 0, 2) == '//'){$p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1). $p;}
- elseif($p[0] == '/'){$p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']). $p;}
- elseif(strcspn($p, './')){$p = $C['base_url']. $p;}
- else{
- preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m);
- $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p);
- while(preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)){
- $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p);
- }
- $p = $m[1]. $p;
- }
- }
-}
-return "{$b}{$p}{$a}";
-// eof
-}
+function hl_regex($p){
+// ?regex
+if(empty($p)){return 0;}
+if($t = ini_get('track_errors')){$o = isset($php_errormsg) ? $php_errormsg : null;}
+else{ini_set('track_errors', 1);}
+unset($php_errormsg);
+if(($d = ini_get('display_errors'))){ini_set('display_errors', 0);}
+preg_match($p, '');
+if($d){ini_set('display_errors', 1);}
+$r = isset($php_errormsg) ? 0 : 1;
+if($t){$php_errormsg = isset($o) ? $o : null;}
+else{ini_set('track_errors', 0);}
+return $r;
+// eof
+}
-function hl_regex($p){
-// ?regex
-if(empty($p)){return 0;}
-if($t = ini_get('track_errors')){$o = isset($php_errormsg) ? $php_errormsg : null;}
-else{ini_set('track_errors', 1);}
-unset($php_errormsg);
-if(($d = ini_get('display_errors'))){ini_set('display_errors', 0);}
-preg_match($p, '');
-if($d){ini_set('display_errors', 1);}
-$r = isset($php_errormsg) ? 0 : 1;
-if($t){$php_errormsg = isset($o) ? $o : null;}
-else{ini_set('track_errors', 0);}
-return $r;
-// eof
-}
-
-function hl_spec($t){
-// final $spec
-$s = array();
+function hl_spec($t){
+// final $spec
+$s = array();
$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', create_function('$m', 'return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), $m[0]), 1, -1);'), trim($t)));
-for($i = count(($t = explode(';', $t))); --$i>=0;){
- $w = $t[$i];
- if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;}
- $y = $n = array();
- foreach(explode(',', $a) as $v){
- if(!preg_match('`^([a-z:\-\*]+)(?:\((.*?)\))?`i', $v, $m)){continue;}
- if(($x = strtolower($m[1])) == '-*'){$n['*'] = 1; continue;}
- if($x[0] == '-'){$n[substr($x, 1)] = 1; continue;}
- if(!isset($m[2])){$y[$x] = 1; continue;}
- foreach(explode('/', $m[2]) as $m){
- if(empty($m) or ($p = strpos($m, '=')) == 0 or $p < 5){$y[$x] = 1; continue;}
- $y[$x][strtolower(substr($m, 0, $p))] = str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08"), array(";", "|", "~", " ", ",", "/", "(", ")"), substr($m, $p+1));
- }
- if(isset($y[$x]['match']) && !hl_regex($y[$x]['match'])){unset($y[$x]['match']);}
- if(isset($y[$x]['nomatch']) && !hl_regex($y[$x]['nomatch'])){unset($y[$x]['nomatch']);}
- }
- if(!count($y) && !count($n)){continue;}
- foreach(explode(',', substr($w, 0, $e)) as $v){
- if(!strlen(($v = strtolower($v)))){continue;}
- if(count($y)){$s[$v] = $y;}
- if(count($n)){$s[$v]['n'] = $n;}
- }
-}
-return $s;
-// eof
-}
-
-function hl_tag($t){
-// tag/attribute handler
-global $C;
-$t = $t[0];
-// invalid < >
-if($t == '< '){return '< ';}
-if($t == '>'){return '>';}
-if(!preg_match('`^<(/?)([a-zA-Z][a-zA-Z1-6]*)([^>]*?)\s?>$`m', $t, $m)){
- return str_replace(array('<', '>'), array('<', '>'), $t);
-}elseif(!isset($C['elements'][($e = strtolower($m[2]))])){
- return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : '');
-}
-// attr string
-$a = str_replace(array("\n", "\r", "\t"), ' ', trim($m[3]));
-// tag transform
-static $eD = array('acronym'=>1, 'applet'=>1, 'big'=>1, 'center'=>1, 'dir'=>1, 'font'=>1, 'isindex'=>1, 's'=>1, 'strike'=>1, 'tt'=>1); // Deprecated
-if($C['make_tag_strict'] && isset($eD[$e])){
- $trt = hl_tag2($e, $a, $C['make_tag_strict']);
- if(!$e){return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : '');}
-}
-// close tag
-static $eE = array('area'=>1, 'br'=>1, 'col'=>1, 'command'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'keygen'=>1, 'link'=>1, 'meta'=>1, 'param'=>1, 'source'=>1, 'track'=>1, 'wbr'=>1); // Empty ele
-if(!empty($m[1])){
- return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "$e>" : $C['hook_tag']($e)) : (($C['keep_bad'])%2 ? str_replace(array('<', '>'), array('<', '>'), $t) : ''));
-}
+for($i = count(($t = explode(';', $t))); --$i>=0;){
+ $w = $t[$i];
+ if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;}
+ $y = $n = array();
+ foreach(explode(',', $a) as $v){
+ if(!preg_match('`^([a-z:\-\*]+)(?:\((.*?)\))?`i', $v, $m)){continue;}
+ if(($x = strtolower($m[1])) == '-*'){$n['*'] = 1; continue;}
+ if($x[0] == '-'){$n[substr($x, 1)] = 1; continue;}
+ if(!isset($m[2])){$y[$x] = 1; continue;}
+ foreach(explode('/', $m[2]) as $m){
+ if(empty($m) or ($p = strpos($m, '=')) == 0 or $p < 5){$y[$x] = 1; continue;}
+ $y[$x][strtolower(substr($m, 0, $p))] = str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08"), array(";", "|", "~", " ", ",", "/", "(", ")"), substr($m, $p+1));
+ }
+ if(isset($y[$x]['match']) && !hl_regex($y[$x]['match'])){unset($y[$x]['match']);}
+ if(isset($y[$x]['nomatch']) && !hl_regex($y[$x]['nomatch'])){unset($y[$x]['nomatch']);}
+ }
+ if(!count($y) && !count($n)){continue;}
+ foreach(explode(',', substr($w, 0, $e)) as $v){
+ if(!strlen(($v = strtolower($v)))){continue;}
+ if(count($y)){$s[$v] = $y;}
+ if(count($n)){$s[$v]['n'] = $n;}
+ }
+}
+return $s;
+// eof
+}
-// open tag & attr
-static $aN = array('abbr'=>array('td'=>1, 'th'=>1), 'accept'=>array('form'=>1, 'input'=>1), 'accept-charset'=>array('form'=>1), 'action'=>array('form'=>1), 'align'=>array('applet'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'div'=>1, 'embed'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'object'=>1, 'p'=>1, 'table'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'allowfullscreen'=>array('iframe'=>1), 'alt'=>array('applet'=>1, 'area'=>1, 'img'=>1, 'input'=>1), 'archive'=>array('applet'=>1, 'object'=>1), 'async'=>array('script'=>1), 'autocomplete'=>array('form'=>1, 'input'=>1), 'autofocus'=>array('button'=>1, 'input'=>1, 'keygen'=>1, 'select'=>1, 'textarea'=>1), 'autoplay'=>array('audio'=>1, 'video'=>1), 'axis'=>array('td'=>1, 'th'=>1), 'bgcolor'=>array('embed'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1), 'border'=>array('img'=>1, 'object'=>1, 'table'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'cellpadding'=>array('table'=>1), 'cellspacing'=>array('table'=>1), 'challenge'=>array('keygen'=>1), 'char'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charoff'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charset'=>array('a'=>1, 'script'=>1), 'checked'=>array('command'=>1, 'input'=>1), 'cite'=>array('blockquote'=>1, 'del'=>1, 'ins'=>1, 'q'=>1), 'classid'=>array('object'=>1), 'clear'=>array('br'=>1), 'code'=>array('applet'=>1), 'codebase'=>array('applet'=>1, 'object'=>1), 'codetype'=>array('object'=>1), 'color'=>array('font'=>1), 'cols'=>array('textarea'=>1), 'colspan'=>array('td'=>1, 'th'=>1), 'compact'=>array('dir'=>1, 'dl'=>1, 'menu'=>1, 'ol'=>1, 'ul'=>1), 'content'=>array('meta'=>1), 'controls'=>array('audio'=>1, 'video'=>1), 'coords'=>array('a'=>1, 'area'=>1), 'crossorigin'=>array('img'=>1), 'data'=>array('object'=>1), 'datetime'=>array('del'=>1, 'ins'=>1, 'time'=>1), 'declare'=>array('object'=>1), 'default'=>array('track'=>1), 'defer'=>array('script'=>1), 'dirname'=>array('input'=>1, 'textarea'=>1), 'disabled'=>array('button'=>1, 'command'=>1, 'fieldset'=>1, 'input'=>1, 'keygen'=>1, 'optgroup'=>1, 'option'=>1, 'select'=>1, 'textarea'=>1), 'download'=>array('a'=>1), 'enctype'=>array('form'=>1), 'face'=>array('font'=>1), 'flashvars'=>array('embed'=>1), 'for'=>array('label'=>1, 'output'=>1), 'form'=>array('button'=>1, 'fieldset'=>1, 'input'=>1, 'keygen'=>1, 'label'=>1, 'object'=>1, 'output'=>1, 'select'=>1, 'textarea'=>1), 'formaction'=>array('button'=>1, 'input'=>1), 'formenctype'=>array('button'=>1, 'input'=>1), 'formmethod'=>array('button'=>1, 'input'=>1), 'formnovalidate'=>array('button'=>1, 'input'=>1), 'formtarget'=>array('button'=>1, 'input'=>1), 'frame'=>array('table'=>1), 'frameborder'=>array('iframe'=>1), 'headers'=>array('td'=>1, 'th'=>1), 'height'=>array('applet'=>1, 'canvas'=>1, 'embed'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'td'=>1, 'th'=>1, 'video'=>1), 'high'=>array('meter'=>1), 'href'=>array('a'=>1, 'area'=>1, 'link'=>1), 'hreflang'=>array('a'=>1, 'area'=>1, 'link'=>1), 'hspace'=>array('applet'=>1, 'embed'=>1, 'img'=>1, 'object'=>1), 'icon'=>array('command'=>1), 'ismap'=>array('img'=>1, 'input'=>1), 'keyparams'=>array('keygen'=>1), 'keytype'=>array('keygen'=>1), 'kind'=>array('track'=>1), 'label'=>array('command'=>1, 'menu'=>1, 'option'=>1, 'optgroup'=>1, 'track'=>1), 'language'=>array('script'=>1), 'list'=>array('input'=>1), 'longdesc'=>array('img'=>1, 'iframe'=>1), 'loop'=>array('audio'=>1, 'video'=>1), 'low'=>array('meter'=>1), 'marginheight'=>array('iframe'=>1), 'marginwidth'=>array('iframe'=>1), 'max'=>array('input'=>1, 'meter'=>1, 'progress'=>1), 'maxlength'=>array('input'=>1, 'textarea'=>1), 'media'=>array('a'=>1, 'area'=>1, 'link'=>1, 'source'=>1, 'style'=>1), 'mediagroup'=>array('audio'=>1, 'video'=>1), 'method'=>array('form'=>1), 'min'=>array('input'=>1, 'meter'=>1), 'model'=>array('embed'=>1), 'multiple'=>array('input'=>1, 'select'=>1), 'muted'=>array('audio'=>1, 'video'=>1), 'name'=>array('a'=>1, 'applet'=>1, 'button'=>1, 'embed'=>1, 'fieldset'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'keygen'=>1, 'map'=>1, 'object'=>1, 'output'=>1, 'param'=>1, 'select'=>1, 'textarea'=>1), 'nohref'=>array('area'=>1), 'noshade'=>array('hr'=>1), 'novalidate'=>array('form'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'object'=>array('applet'=>1), 'open'=>array('details'=>1), 'optimum'=>array('meter'=>1), 'pattern'=>array('input'=>1), 'ping'=>array('a'=>1, 'area'=>1), 'placeholder'=>array('input'=>1, 'textarea'=>1), 'pluginspage'=>array('embed'=>1), 'pluginurl'=>array('embed'=>1), 'poster'=>array('video'=>1), 'pqg'=>array('keygen'=>1), 'preload'=>array('audio'=>1, 'video'=>1), 'prompt'=>array('isindex'=>1), 'pubdate'=>array('time'=>1), 'radiogroup'=>array('command'=>1), 'readonly'=>array('input'=>1, 'textarea'=>1), 'rel'=>array('a'=>1, 'area'=>1, 'link'=>1), 'required'=>array('input'=>1, 'select'=>1, 'textarea'=>1), 'rev'=>array('a'=>1), 'reversed'=>array('ol'=>1), 'rows'=>array('textarea'=>1), 'rowspan'=>array('td'=>1, 'th'=>1), 'rules'=>array('table'=>1), 'sandbox'=>array('iframe'=>1), 'scope'=>array('td'=>1, 'th'=>1), 'scoped'=>array('style'=>1), 'scrolling'=>array('iframe'=>1), 'seamless'=>array('iframe'=>1), 'selected'=>array('option'=>1), 'shape'=>array('a'=>1, 'area'=>1), 'size'=>array('font'=>1, 'hr'=>1, 'input'=>1, 'select'=>1), 'sizes'=>array('link'=>1), 'span'=>array('col'=>1, 'colgroup'=>1), 'src'=>array('audio'=>1, 'embed'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'script'=>1, 'source'=>1, 'track'=>1, 'video'=>1), 'srcdoc'=>array('iframe'=>1), 'srclang'=>array('track'=>1), 'srcset'=>array('img'=>1), 'standby'=>array('object'=>1), 'start'=>array('ol'=>1), 'step'=>array('input'=>1), 'summary'=>array('table'=>1), 'target'=>array('a'=>1, 'area'=>1, 'form'=>1), 'type'=>array('a'=>1, 'area'=>1, 'button'=>1, 'command'=>1, 'embed'=>1, 'input'=>1, 'li'=>1, 'link'=>1, 'menu'=>1, 'object'=>1, 'ol'=>1, 'param'=>1, 'script'=>1, 'source'=>1, 'style'=>1, 'ul'=>1), 'typemustmatch'=>array('object'=>1), 'usemap'=>array('img'=>1, 'input'=>1, 'object'=>1), 'valign'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'value'=>array('button'=>1, 'data'=>1, 'input'=>1, 'li'=>1, 'meter'=>1, 'option'=>1, 'param'=>1, 'progress'=>1), 'valuetype'=>array('param'=>1), 'vspace'=>array('applet'=>1, 'embed'=>1, 'img'=>1, 'object'=>1), 'width'=>array('applet'=>1, 'canvas'=>1, 'col'=>1, 'colgroup'=>1, 'embed'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'pre'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'video'=>1), 'wmode'=>array('embed'=>1), 'wrap'=>array('textarea'=>1)); // Ele-specific
-static $aNE = array('allowfullscreen'=>1, 'checkbox'=>1, 'checked'=>1, 'command'=>1, 'compact'=>1, 'declare'=>1, 'defer'=>1, 'default'=>1, 'disabled'=>1, 'hidden'=>1, 'inert'=>1, 'ismap'=>1, 'itemscope'=>1, 'multiple'=>1, 'nohref'=>1, 'noresize'=>1, 'noshade'=>1, 'nowrap'=>1, 'open'=>1, 'radio'=>1, 'readonly'=>1, 'required'=>1, 'reversed'=>1, 'selected'=>1); // Empty
-static $aNP = array('action'=>1, 'cite'=>1, 'classid'=>1, 'codebase'=>1, 'data'=>1, 'href'=>1, 'itemtype'=>1, 'longdesc'=>1, 'model'=>1, 'pluginspage'=>1, 'pluginurl'=>1, 'src'=>1, 'srcset'=>1, 'usemap'=>1); // Need scheme check; excludes style, on*
-static $aNU = array('accesskey'=>1, 'aria-activedescendant'=>1, 'aria-atomic'=>1, 'aria-autocomplete'=>1, 'aria-busy'=>1, 'aria-checked'=>1, 'aria-controls'=>1, 'aria-describedby'=>1, 'aria-disabled'=>1, 'aria-dropeffect'=>1, 'aria-expanded'=>1, 'aria-flowto'=>1, 'aria-grabbed'=>1, 'aria-haspopup'=>1, 'aria-hidden'=>1, 'aria-invalid'=>1, 'aria-label'=>1, 'aria-labelledby'=>1, 'aria-level'=>1, 'aria-live'=>1, 'aria-multiline'=>1, 'aria-multiselectable'=>1, 'aria-orientation'=>1, 'aria-owns'=>1, 'aria-posinset'=>1, 'aria-pressed'=>1, 'aria-readonly'=>1, 'aria-relevant'=>1, 'aria-required'=>1, 'aria-selected'=>1, 'aria-setsize'=>1, 'aria-sort'=>1, 'aria-valuemax'=>1, 'aria-valuemin'=>1, 'aria-valuenow'=>1, 'aria-valuetext'=>1, 'class'=>1, 'contenteditable'=>1, 'contextmenu'=>1, 'dir'=>1, 'draggable'=>1, 'dropzone'=>1, 'hidden'=>1, 'id'=>1, 'inert'=>1, 'itemid'=>1, 'itemprop'=>1, 'itemref'=>1, 'itemscope'=>1, 'itemtype'=>1, 'lang'=>1, 'onabort'=>1, 'onabort'=>1, 'onautocomplete'=>1, 'onautocompleteerror'=>1, 'onblur'=>1, 'oncancel'=>1, 'oncanplay'=>1, 'oncanplaythrough'=>1, 'onchange'=>1, 'onclick'=>1, 'onclose'=>1, 'oncontextmenu'=>1, 'oncuechange'=>1, 'ondblclick'=>1, 'ondrag'=>1, 'ondragend'=>1, 'ondragenter'=>1, 'ondragexit'=>1, 'ondragleave'=>1, 'ondragover'=>1, 'ondragstart'=>1, 'ondrop'=>1, 'ondurationchange'=>1, 'onemptied'=>1, 'onended'=>1, 'onerror'=>1, 'onfocus'=>1, 'oninput'=>1, 'oninvalid'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onload'=>1, 'onloadeddata'=>1, 'onloadedmetadata'=>1, 'onloadstart'=>1, 'onmousedown'=>1, 'onmouseenter'=>1, 'onmouseleave'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onmousewheel'=>1, 'onpause'=>1, 'onplay'=>1, 'onplaying'=>1, 'onprogress'=>1, 'onratechange'=>1, 'onreset'=>1, 'onresize'=>1, 'onscroll'=>1, 'onseeked'=>1, 'onseeking'=>1, 'onselect'=>1, 'onshow'=>1, 'onsort'=>1, 'onstalled'=>1, 'onsubmit'=>1, 'onsuspend'=>1, 'ontimeupdate'=>1, 'ontoggle'=>1, 'onvolumechange'=>1, 'onwaiting'=>1, 'onwheel'=>1, 'role'=>1, 'spellcheck'=>1, 'style'=>1, 'tabindex'=>1, 'title'=>1, 'translate'=>1, 'xmlns'=>1, 'xml:base'=>1, 'xml:lang'=>1, 'xml:space'=>1); // Univ
+function hl_tag($t){
+// tag/attribute handler
+global $C;
+$t = $t[0];
+// invalid < >
+if($t == '< '){return '< ';}
+if($t == '>'){return '>';}
+if(!preg_match('`^<(/?)([a-zA-Z][a-zA-Z1-6]*)([^>]*?)\s?>$`m', $t, $m)){
+ return str_replace(array('<', '>'), array('<', '>'), $t);
+}elseif(!isset($C['elements'][($e = strtolower($m[2]))])){
+ return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : '');
+}
+// attr string
+$a = str_replace(array("\n", "\r", "\t"), ' ', trim($m[3]));
+// tag transform
+static $eD = array('applet'=>1, 'center'=>1, 'dir'=>1, 'embed'=>1, 'font'=>1, 'isindex'=>1, 'menu'=>1, 's'=>1, 'strike'=>1, 'u'=>1); // Deprecated
+if($C['make_tag_strict'] && isset($eD[$e])){
+ $trt = hl_tag2($e, $a, $C['make_tag_strict']);
+ if(!$e){return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : '');}
+}
+// close tag
+static $eE = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1); // Empty ele
+if(!empty($m[1])){
+ return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "$e>" : $C['hook_tag']($e)) : (($C['keep_bad'])%2 ? str_replace(array('<', '>'), array('<', '>'), $t) : ''));
+}
+// open tag & attr
+static $aN = array('abbr'=>array('td'=>1, 'th'=>1), 'accept-charset'=>array('form'=>1), 'accept'=>array('form'=>1, 'input'=>1), 'accesskey'=>array('a'=>1, 'area'=>1, 'button'=>1, 'input'=>1, 'label'=>1, 'legend'=>1, 'textarea'=>1), 'action'=>array('form'=>1), 'align'=>array('caption'=>1, 'embed'=>1, 'applet'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'legend'=>1, 'table'=>1, 'hr'=>1, 'div'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'p'=>1, 'col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'allowfullscreen'=>array('iframe'=>1), 'alt'=>array('applet'=>1, 'area'=>1, 'img'=>1, 'input'=>1), 'archive'=>array('applet'=>1, 'object'=>1), 'axis'=>array('td'=>1, 'th'=>1), 'bgcolor'=>array('embed'=>1, 'table'=>1, 'tr'=>1, 'td'=>1, 'th'=>1), 'border'=>array('table'=>1, 'img'=>1, 'object'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'cellpadding'=>array('table'=>1), 'cellspacing'=>array('table'=>1), 'char'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charoff'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charset'=>array('a'=>1, 'script'=>1), 'checked'=>array('input'=>1), 'cite'=>array('blockquote'=>1, 'q'=>1, 'del'=>1, 'ins'=>1), 'classid'=>array('object'=>1), 'clear'=>array('br'=>1), 'code'=>array('applet'=>1), 'codebase'=>array('object'=>1, 'applet'=>1), 'codetype'=>array('object'=>1), 'color'=>array('font'=>1), 'cols'=>array('textarea'=>1), 'colspan'=>array('td'=>1, 'th'=>1), 'compact'=>array('dir'=>1, 'dl'=>1, 'menu'=>1, 'ol'=>1, 'ul'=>1), 'coords'=>array('area'=>1, 'a'=>1), 'data'=>array('object'=>1), 'datetime'=>array('del'=>1, 'ins'=>1), 'declare'=>array('object'=>1), 'defer'=>array('script'=>1), 'dir'=>array('bdo'=>1), 'disabled'=>array('button'=>1, 'input'=>1, 'optgroup'=>1, 'option'=>1, 'select'=>1, 'textarea'=>1), 'enctype'=>array('form'=>1), 'face'=>array('font'=>1), 'flashvars'=>array('embed'=>1), 'for'=>array('label'=>1), 'frame'=>array('table'=>1), 'frameborder'=>array('iframe'=>1), 'headers'=>array('td'=>1, 'th'=>1), 'height'=>array('embed'=>1, 'iframe'=>1, 'td'=>1, 'th'=>1, 'img'=>1, 'object'=>1, 'applet'=>1), 'href'=>array('a'=>1, 'area'=>1), 'hreflang'=>array('a'=>1), 'hspace'=>array('applet'=>1, 'img'=>1, 'object'=>1), 'ismap'=>array('img'=>1, 'input'=>1), 'label'=>array('option'=>1, 'optgroup'=>1), 'language'=>array('script'=>1), 'longdesc'=>array('img'=>1, 'iframe'=>1), 'marginheight'=>array('iframe'=>1), 'marginwidth'=>array('iframe'=>1), 'maxlength'=>array('input'=>1), 'method'=>array('form'=>1), 'model'=>array('embed'=>1), 'multiple'=>array('select'=>1), 'name'=>array('button'=>1, 'embed'=>1, 'textarea'=>1, 'applet'=>1, 'select'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'a'=>1, 'input'=>1, 'object'=>1, 'map'=>1, 'param'=>1), 'nohref'=>array('area'=>1), 'noshade'=>array('hr'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'object'=>array('applet'=>1), 'onblur'=>array('a'=>1, 'area'=>1, 'button'=>1, 'input'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'onchange'=>array('input'=>1, 'select'=>1, 'textarea'=>1), 'onfocus'=>array('a'=>1, 'area'=>1, 'button'=>1, 'input'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'onreset'=>array('form'=>1), 'onselect'=>array('input'=>1, 'textarea'=>1), 'onsubmit'=>array('form'=>1), 'pluginspage'=>array('embed'=>1), 'pluginurl'=>array('embed'=>1), 'prompt'=>array('isindex'=>1), 'readonly'=>array('textarea'=>1, 'input'=>1), 'rel'=>array('a'=>1), 'rev'=>array('a'=>1), 'rows'=>array('textarea'=>1), 'rowspan'=>array('td'=>1, 'th'=>1), 'rules'=>array('table'=>1), 'scope'=>array('td'=>1, 'th'=>1), 'scrolling'=>array('iframe'=>1), 'selected'=>array('option'=>1), 'shape'=>array('area'=>1, 'a'=>1), 'size'=>array('hr'=>1, 'font'=>1, 'input'=>1, 'select'=>1), 'span'=>array('col'=>1, 'colgroup'=>1), 'src'=>array('embed'=>1, 'script'=>1, 'input'=>1, 'iframe'=>1, 'img'=>1), 'standby'=>array('object'=>1), 'start'=>array('ol'=>1), 'summary'=>array('table'=>1), 'tabindex'=>array('a'=>1, 'area'=>1, 'button'=>1, 'input'=>1, 'object'=>1, 'select'=>1, 'textarea'=>1), 'target'=>array('a'=>1, 'area'=>1, 'form'=>1), 'type'=>array('a'=>1, 'embed'=>1, 'object'=>1, 'param'=>1, 'script'=>1, 'input'=>1, 'li'=>1, 'ol'=>1, 'ul'=>1, 'button'=>1), 'usemap'=>array('img'=>1, 'input'=>1, 'object'=>1), 'valign'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'value'=>array('input'=>1, 'option'=>1, 'param'=>1, 'button'=>1, 'li'=>1), 'valuetype'=>array('param'=>1), 'vspace'=>array('applet'=>1, 'img'=>1, 'object'=>1), 'width'=>array('embed'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'object'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'applet'=>1, 'col'=>1, 'colgroup'=>1, 'pre'=>1), 'wmode'=>array('embed'=>1), 'xml:space'=>array('pre'=>1, 'script'=>1, 'style'=>1)); // Ele-specific
+static $aNE = array('allowfullscreen'=>1, 'checked'=>1, 'compact'=>1, 'declare'=>1, 'defer'=>1, 'disabled'=>1, 'ismap'=>1, 'multiple'=>1, 'nohref'=>1, 'noresize'=>1, 'noshade'=>1, 'nowrap'=>1, 'readonly'=>1, 'selected'=>1); // Empty
+static $aNP = array('action'=>1, 'cite'=>1, 'classid'=>1, 'codebase'=>1, 'data'=>1, 'href'=>1, 'longdesc'=>1, 'model'=>1, 'pluginspage'=>1, 'pluginurl'=>1, 'usemap'=>1); // Need scheme check; excludes style, on* & src
+static $aNU = array('class'=>array('param'=>1, 'script'=>1), 'dir'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'iframe'=>1, 'param'=>1, 'script'=>1), 'id'=>array('script'=>1), 'lang'=>array('applet'=>1, 'br'=>1, 'iframe'=>1, 'param'=>1, 'script'=>1), 'xml:lang'=>array('applet'=>1, 'br'=>1, 'iframe'=>1, 'param'=>1, 'script'=>1), 'onclick'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'ondblclick'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onkeydown'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onkeypress'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onkeyup'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onmousedown'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onmousemove'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onmouseout'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onmouseover'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'onmouseup'=>array('applet'=>1, 'bdo'=>1, 'br'=>1, 'font'=>1, 'iframe'=>1, 'isindex'=>1, 'param'=>1, 'script'=>1), 'style'=>array('param'=>1, 'script'=>1), 'title'=>array('param'=>1, 'script'=>1)); // Univ & exceptions
-if($C['lc_std_val']){
- // predef attr vals for $eAL & $aNE ele
- static $aNL = array('all'=>1, 'auto'=>1, 'baseline'=>1, 'bottom'=>1, 'button'=>1, 'captions'=>1, 'center'=>1, 'chapters'=>1, 'char'=>1, 'checkbox'=>1, 'circle'=>1, 'col'=>1, 'colgroup'=>1, 'color'=>1, 'cols'=>1, 'data'=>1, 'date'=>1, 'datetime'=>1, 'datetime-local'=>1, 'default'=>1, 'descriptions'=>1, 'email'=>1, 'file'=>1, 'get'=>1, 'groups'=>1, 'hidden'=>1, 'image'=>1, 'justify'=>1, 'left'=>1, 'ltr'=>1, 'metadata'=>1, 'middle'=>1, 'month'=>1, 'none'=>1, 'number'=>1, 'object'=>1, 'password'=>1, 'poly'=>1, 'post'=>1, 'preserve'=>1, 'radio'=>1, 'range'=>1, 'rect'=>1, 'ref'=>1, 'reset'=>1, 'right'=>1, 'row'=>1, 'rowgroup'=>1, 'rows'=>1, 'rtl'=>1, 'search'=>1, 'submit'=>1, 'subtitles'=>1, 'tel'=>1, 'text'=>1, 'time'=>1, 'top'=>1, 'url'=>1, 'week'=>1);
- static $eAL = array('a'=>1, 'area'=>1, 'bdo'=>1, 'button'=>1, 'col'=>1, 'fieldset'=>1, 'form'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'ol'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'script'=>1, 'select'=>1, 'table'=>1, 'td'=>1, 'textarea'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1, 'track'=>1, 'xml:space'=>1);
- $lcase = isset($eAL[$e]) ? 1 : 0;
-}
+if($C['lc_std_val']){
+ // predef attr vals for $eAL & $aNE ele
+ static $aNL = array('all'=>1, 'baseline'=>1, 'bottom'=>1, 'button'=>1, 'center'=>1, 'char'=>1, 'checkbox'=>1, 'circle'=>1, 'col'=>1, 'colgroup'=>1, 'cols'=>1, 'data'=>1, 'default'=>1, 'file'=>1, 'get'=>1, 'groups'=>1, 'hidden'=>1, 'image'=>1, 'justify'=>1, 'left'=>1, 'ltr'=>1, 'middle'=>1, 'none'=>1, 'object'=>1, 'password'=>1, 'poly'=>1, 'post'=>1, 'preserve'=>1, 'radio'=>1, 'rect'=>1, 'ref'=>1, 'reset'=>1, 'right'=>1, 'row'=>1, 'rowgroup'=>1, 'rows'=>1, 'rtl'=>1, 'submit'=>1, 'text'=>1, 'top'=>1);
+ static $eAL = array('a'=>1, 'area'=>1, 'bdo'=>1, 'button'=>1, 'col'=>1, 'form'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'script'=>1, 'select'=>1, 'table'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1, 'xml:space'=>1);
+ $lcase = isset($eAL[$e]) ? 1 : 0;
+}
-$depTr = 0;
-if($C['no_deprecated_attr']){
- // dep attr:applicable ele
- static $aND = array('align'=>array('caption'=>1, 'div'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'object'=>1, 'p'=>1, 'table'=>1), 'bgcolor'=>array('table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1), 'border'=>array('object'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'cellspacing'=>array('table'=>1), 'clear'=>array('br'=>1), 'compact'=>array('dl'=>1, 'ol'=>1, 'ul'=>1), 'height'=>array('td'=>1, 'th'=>1), 'hspace'=>array('img'=>1, 'object'=>1), 'language'=>array('script'=>1), 'name'=>array('a'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'map'=>1), 'noshade'=>array('hr'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'size'=>array('hr'=>1), 'vspace'=>array('img'=>1, 'object'=>1), 'width'=>array('hr'=>1, 'pre'=>1, 'table'=>1, 'td'=>1, 'th'=>1));
- static $eAD = array('a'=>1, 'br'=>1, 'caption'=>1, 'div'=>1, 'dl'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'map'=>1, 'object'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'script'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1, 'ul'=>1);
- $depTr = isset($eAD[$e]) ? 1 : 0;
-}
+$depTr = 0;
+if($C['no_deprecated_attr']){
+ // dep attr:applicable ele
+ static $aND = array('align'=>array('caption'=>1, 'div'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'object'=>1, 'p'=>1, 'table'=>1), 'bgcolor'=>array('table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1), 'border'=>array('img'=>1, 'object'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'clear'=>array('br'=>1), 'compact'=>array('dl'=>1, 'ol'=>1, 'ul'=>1), 'height'=>array('td'=>1, 'th'=>1), 'hspace'=>array('img'=>1, 'object'=>1), 'language'=>array('script'=>1), 'name'=>array('a'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'map'=>1), 'noshade'=>array('hr'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'size'=>array('hr'=>1), 'start'=>array('ol'=>1), 'type'=>array('li'=>1, 'ol'=>1, 'ul'=>1), 'value'=>array('li'=>1), 'vspace'=>array('img'=>1, 'object'=>1), 'width'=>array('hr'=>1, 'pre'=>1, 'td'=>1, 'th'=>1));
+ static $eAD = array('a'=>1, 'br'=>1, 'caption'=>1, 'div'=>1, 'dl'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'li'=>1, 'map'=>1, 'object'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'script'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1, 'ul'=>1);
+ $depTr = isset($eAD[$e]) ? 1 : 0;
+}
-// attr name-vals
-if(strpos($a, "\x01") !== false){$a = preg_replace('`\x01[^\x01]*\x01`', '', $a);} // No comment/CDATA sec
-$mode = 0; $a = trim($a, ' /'); $aA = array();
-while(strlen($a)){
- $w = 0;
- switch($mode){
- case 0: // Name
- if(preg_match('`^[a-zA-Z][^\s=]+`', $a, $m)){
- $nm = strtolower($m[0]);
- $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0])));
- }
- break; case 1:
- if($a[0] == '='){ // =
- $w = 1; $mode = 2; $a = ltrim($a, '= ');
- }else{ // No val
- $w = 1; $mode = 0; $a = ltrim($a);
- $aA[$nm] = '';
- }
- break; case 2: // Val
- if(preg_match('`^((?:"[^"]*")|(?:\'[^\']*\')|(?:\s*[^\s"\']+))(.*)`', $a, $m)){
- $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0;
- $aA[$nm] = trim(str_replace('<', '<', ($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m));
- }
- break;
- }
- if($w == 0){ // Parse errs, deal with space, " & '
- $a = preg_replace('`^(?:"[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*`', '', $a);
- $mode = 0;
- }
-}
-if($mode == 1){$aA[$nm] = '';}
+// attr name-vals
+if(strpos($a, "\x01") !== false){$a = preg_replace('`\x01[^\x01]*\x01`', '', $a);} // No comment/CDATA sec
+$mode = 0; $a = trim($a, ' /'); $aA = array();
+while(strlen($a)){
+ $w = 0;
+ switch($mode){
+ case 0: // Name
+ if(preg_match('`^[a-zA-Z][\-a-zA-Z:]+`', $a, $m)){
+ $nm = strtolower($m[0]);
+ $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0])));
+ }
+ break; case 1:
+ if($a[0] == '='){ // =
+ $w = 1; $mode = 2; $a = ltrim($a, '= ');
+ }else{ // No val
+ $w = 1; $mode = 0; $a = ltrim($a);
+ $aA[$nm] = '';
+ }
+ break; case 2: // Val
+ if(preg_match('`^((?:"[^"]*")|(?:\'[^\']*\')|(?:\s*[^\s"\']+))(.*)`', $a, $m)){
+ $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0;
+ $aA[$nm] = trim(str_replace('<', '<', ($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m));
+ }
+ break;
+ }
+ if($w == 0){ // Parse errs, deal with space, " & '
+ $a = preg_replace('`^(?:"[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*`', '', $a);
+ $mode = 0;
+ }
+}
+if($mode == 1){$aA[$nm] = '';}
-// clean attrs
-global $S;
-$rl = isset($S[$e]) ? $S[$e] : array();
-$a = array(); $nfr = 0;
-foreach($aA as $k=>$v){
- if(((isset($C['deny_attribute']['*']) ? isset($C['deny_attribute'][$k]) : !isset($C['deny_attribute'][$k])) && (isset($aN[$k][$e]) or isset($aNU[$k]) or preg_match('`data-((?!xml)[^:]+$)`', $k)) && !isset($rl['n'][$k]) && !isset($rl['n']['*'])) or isset($rl[$k])){
- if(isset($aNE[$k])){$v = $k;}
- elseif(!empty($lcase) && (($e != 'button' or $e != 'input') or $k == 'type')){ // Rather loose but ?not cause issues
- $v = (isset($aNL[($v2 = strtolower($v))])) ? $v2 : $v;
- }
- if($k == 'style' && !$C['style_pass']){
- if(false !== strpos($v, '')){
- static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\');
- $v = strtr($v, $sC);
- }
- $v = preg_replace_callback('`(url(?:\()(?: )*(?:\'|"|&(?:quot|apos);)?)(.+?)((?:\'|"|&(?:quot|apos);)?(?: )*(?:\)))`iS', 'hl_prot', $v);
- $v = !$C['css_expression'] ? preg_replace('`expression`i', ' ', preg_replace('`\\\\\S|(/|(%2f))(\*|(%2a))`i', ' ', $v)) : $v;
- }elseif(isset($aNP[$k]) or $k[0] == 'o'){
- $v = str_replace("", ' ', (strpos($v, '&') !== false ? str_replace(array('', '', ''), ' ', $v) : $v)); # double-quoted char is soft-hyphen; appears here as "" or hyphen or something else depending on viewing software
- if($k == 'srcset'){
- $v2 = '';
- foreach(explode(',', $v) as $k1=>$v1){
- $v1 = explode(' ', ltrim($v1), 2);
- $k1 = isset($v1[1]) ? trim($v1[1]) : '';
- $v1 = trim($v1[0]);
- if(isset($v1[0])){$v2 .= hl_prot($v1, $k). (empty($k1) ? '' : ' '. $k1). ', ';}
- }
- $v = trim($v2, ', ');
- }
- else{$v = hl_prot($v, $k);}
- if($k == 'href'){ // X-spam
- if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){
- $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v);
- }elseif($C['anti_link_spam']){
- $r1 = $C['anti_link_spam'][1];
- if(!empty($r1) && preg_match($r1, $v)){continue;}
- $r0 = $C['anti_link_spam'][0];
- if(!empty($r0) && preg_match($r0, $v)){
- if(isset($a['rel'])){
- if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';}
- }elseif(isset($aA['rel'])){
- if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;}
- }else{$a['rel'] = 'nofollow';}
- }
- }
- }
- }
- if(isset($rl[$k]) && is_array($rl[$k]) && ($v = hl_attrval($k, $v, $rl[$k])) === 0){continue;}
- $a[$k] = str_replace('"', '"', $v);
- }
-}
-if($nfr){$a['rel'] = isset($a['rel']) ? $a['rel']. ' nofollow' : 'nofollow';}
+// clean attrs
+global $S;
+$rl = isset($S[$e]) ? $S[$e] : array();
+$a = array(); $nfr = 0;
+foreach($aA as $k=>$v){
+ if(((isset($C['deny_attribute']['*']) ? isset($C['deny_attribute'][$k]) : !isset($C['deny_attribute'][$k])) && (isset($aN[$k][$e]) or (isset($aNU[$k]) && !isset($aNU[$k][$e]))) && !isset($rl['n'][$k]) && !isset($rl['n']['*'])) or isset($rl[$k])){
+ if(isset($aNE[$k])){$v = $k;}
+ elseif(!empty($lcase) && (($e != 'button' or $e != 'input') or $k == 'type')){ // Rather loose but ?not cause issues
+ $v = (isset($aNL[($v2 = strtolower($v))])) ? $v2 : $v;
+ }
+ if($k == 'style' && !$C['style_pass']){
+ if(false !== strpos($v, '')){
+ static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\');
+ $v = strtr($v, $sC);
+ }
+ $v = preg_replace_callback('`(url(?:\()(?: )*(?:\'|"|&(?:quot|apos);)?)(.+?)((?:\'|"|&(?:quot|apos);)?(?: )*(?:\)))`iS', 'hl_prot', $v);
+ $v = !$C['css_expression'] ? preg_replace('`expression`i', ' ', preg_replace('`\\\\\S|(/|(%2f))(\*|(%2a))`i', ' ', $v)) : $v;
+ }elseif(isset($aNP[$k]) or strpos($k, 'src') !== false or $k[0] == 'o'){
+ $v = str_replace("", ' ', (strpos($v, '&') !== false ? str_replace(array('', '', ''), ' ', $v) : $v)); # double-quoted char is soft-hyphen; appears here as "" or hyphen or something else depending on viewing software
+ $v = hl_prot($v, $k);
+ if($k == 'href'){ // X-spam
+ if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){
+ $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v);
+ }elseif($C['anti_link_spam']){
+ $r1 = $C['anti_link_spam'][1];
+ if(!empty($r1) && preg_match($r1, $v)){continue;}
+ $r0 = $C['anti_link_spam'][0];
+ if(!empty($r0) && preg_match($r0, $v)){
+ if(isset($a['rel'])){
+ if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';}
+ }elseif(isset($aA['rel'])){
+ if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;}
+ }else{$a['rel'] = 'nofollow';}
+ }
+ }
+ }
+ }
+ if(isset($rl[$k]) && is_array($rl[$k]) && ($v = hl_attrval($k, $v, $rl[$k])) === 0){continue;}
+ $a[$k] = str_replace('"', '"', $v);
+ }
+}
+if($nfr){$a['rel'] = isset($a['rel']) ? $a['rel']. ' nofollow' : 'nofollow';}
-// rqd attr
-static $eAR = array('area'=>array('alt'=>'area'), 'bdo'=>array('dir'=>'ltr'), 'command'=>array('label'=>''), 'form'=>array('action'=>''), 'img'=>array('src'=>'', 'alt'=>'image'), 'map'=>array('name'=>''), 'optgroup'=>array('label'=>''), 'param'=>array('name'=>''), 'style'=>array('scoped'=>''), 'textarea'=>array('rows'=>'10', 'cols'=>'50'));
-if(isset($eAR[$e])){
- foreach($eAR[$e] as $k=>$v){
- if(!isset($a[$k])){$a[$k] = isset($v[0]) ? $v : $k;}
- }
-}
+// rqd attr
+static $eAR = array('area'=>array('alt'=>'area'), 'bdo'=>array('dir'=>'ltr'), 'form'=>array('action'=>''), 'img'=>array('src'=>'', 'alt'=>'image'), 'map'=>array('name'=>''), 'optgroup'=>array('label'=>''), 'param'=>array('name'=>''), 'script'=>array('type'=>'text/javascript'), 'textarea'=>array('rows'=>'10', 'cols'=>'50'));
+if(isset($eAR[$e])){
+ foreach($eAR[$e] as $k=>$v){
+ if(!isset($a[$k])){$a[$k] = isset($v[0]) ? $v : $k;}
+ }
+}
-// depr attrs
-if($depTr){
- $c = array();
- foreach($a as $k=>$v){
- if($k == 'style' or !isset($aND[$k][$e])){continue;}
- if($k == 'align'){
- unset($a['align']);
- if($e == 'img' && ($v == 'left' or $v == 'right')){$c[] = 'float: '. $v;}
- elseif(($e == 'div' or $e == 'table') && $v == 'center'){$c[] = 'margin: auto';}
- else{$c[] = 'text-align: '. $v;}
- }elseif($k == 'bgcolor'){
- unset($a['bgcolor']);
- $c[] = 'background-color: '. $v;
- }elseif($k == 'border'){
- unset($a['border']); $c[] = "border: {$v}px";
- }elseif($k == 'bordercolor'){
- unset($a['bordercolor']); $c[] = 'border-color: '. $v;
- }elseif($k == 'cellspacing'){
- unset($a['cellspacing']); $c[] = "border-spacing: {$v}px";
- }elseif($k == 'clear'){
- unset($a['clear']); $c[] = 'clear: '. ($v != 'all' ? $v : 'both');
- }elseif($k == 'compact'){
- unset($a['compact']); $c[] = 'font-size: 85%';
- }elseif($k == 'height' or $k == 'width'){
- unset($a[$k]); $c[] = $k. ': '. ($v[0] != '*' ? $v. (ctype_digit($v) ? 'px' : '') : 'auto');
- }elseif($k == 'hspace'){
- unset($a['hspace']); $c[] = "margin-left: {$v}px; margin-right: {$v}px";
- }elseif($k == 'language' && !isset($a['type'])){
- unset($a['language']);
- $a['type'] = 'text/'. strtolower($v);
- }elseif($k == 'name'){
- if($C['no_deprecated_attr'] == 2 or ($e != 'a' && $e != 'map')){unset($a['name']);}
- if(!isset($a['id']) && !preg_match('`\W`', $v)){$a['id'] = $v;}
- }elseif($k == 'noshade'){
- unset($a['noshade']); $c[] = 'border-style: none; border: 0; background-color: gray; color: gray';
- }elseif($k == 'nowrap'){
- unset($a['nowrap']); $c[] = 'white-space: nowrap';
- }elseif($k == 'size'){
- unset($a['size']); $c[] = 'size: '. $v. 'px';
- }elseif($k == 'vspace'){
- unset($a['vspace']); $c[] = "margin-top: {$v}px; margin-bottom: {$v}px";
- }
- }
- if(count($c)){
- $c = implode('; ', $c);
- $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $c. ';': $c. ';';
- }
-}
-// unique ID
-if($C['unique_ids'] && isset($a['id'])){
- if(preg_match('`\s`', ($id = $a['id'])) or (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)){unset($a['id']);
- }else{
- while(isset($GLOBALS['hl_Ids'][$id])){$id = $C['unique_ids']. $id;}
- $GLOBALS['hl_Ids'][($a['id'] = $id)] = 1;
- }
-}
-// xml:lang
-if($C['xml:lang'] && isset($a['lang'])){
- $a['xml:lang'] = isset($a['xml:lang']) ? $a['xml:lang'] : $a['lang'];
- if($C['xml:lang'] == 2){unset($a['lang']);}
-}
-// for transformed tag
-if(!empty($trt)){
- $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $trt : $trt;
-}
-// return with empty ele /
-if(empty($C['hook_tag'])){
- $aA = '';
- foreach($a as $k=>$v){$aA .= " {$k}=\"{$v}\"";}
- return "<{$e}{$aA}". (isset($eE[$e]) ? ' /' : ''). '>';
-}
-else{return $C['hook_tag']($e, $a);}
-// eof
-}
+// depr attrs
+if($depTr){
+ $c = array();
+ foreach($a as $k=>$v){
+ if($k == 'style' or !isset($aND[$k][$e])){continue;}
+ if($k == 'align'){
+ unset($a['align']);
+ if($e == 'img' && ($v == 'left' or $v == 'right')){$c[] = 'float: '. $v;}
+ elseif(($e == 'div' or $e == 'table') && $v == 'center'){$c[] = 'margin: auto';}
+ else{$c[] = 'text-align: '. $v;}
+ }elseif($k == 'bgcolor'){
+ unset($a['bgcolor']);
+ $c[] = 'background-color: '. $v;
+ }elseif($k == 'border'){
+ unset($a['border']); $c[] = "border: {$v}px";
+ }elseif($k == 'bordercolor'){
+ unset($a['bordercolor']); $c[] = 'border-color: '. $v;
+ }elseif($k == 'clear'){
+ unset($a['clear']); $c[] = 'clear: '. ($v != 'all' ? $v : 'both');
+ }elseif($k == 'compact'){
+ unset($a['compact']); $c[] = 'font-size: 85%';
+ }elseif($k == 'height' or $k == 'width'){
+ unset($a[$k]); $c[] = $k. ': '. ($v[0] != '*' ? $v. (ctype_digit($v) ? 'px' : '') : 'auto');
+ }elseif($k == 'hspace'){
+ unset($a['hspace']); $c[] = "margin-left: {$v}px; margin-right: {$v}px";
+ }elseif($k == 'language' && !isset($a['type'])){
+ unset($a['language']);
+ $a['type'] = 'text/'. strtolower($v);
+ }elseif($k == 'name'){
+ if($C['no_deprecated_attr'] == 2 or ($e != 'a' && $e != 'map')){unset($a['name']);}
+ if(!isset($a['id']) && preg_match('`[a-zA-Z][a-zA-Z\d.:_\-]*`', $v)){$a['id'] = $v;}
+ }elseif($k == 'noshade'){
+ unset($a['noshade']); $c[] = 'border-style: none; border: 0; background-color: gray; color: gray';
+ }elseif($k == 'nowrap'){
+ unset($a['nowrap']); $c[] = 'white-space: nowrap';
+ }elseif($k == 'size'){
+ unset($a['size']); $c[] = 'size: '. $v. 'px';
+ }elseif($k == 'start' or $k == 'value'){
+ unset($a[$k]);
+ }elseif($k == 'type'){
+ unset($a['type']);
+ static $ol_type = array('i'=>'lower-roman', 'I'=>'upper-roman', 'a'=>'lower-latin', 'A'=>'upper-latin', '1'=>'decimal');
+ $c[] = 'list-style-type: '. (isset($ol_type[$v]) ? $ol_type[$v] : 'decimal');
+ }elseif($k == 'vspace'){
+ unset($a['vspace']); $c[] = "margin-top: {$v}px; margin-bottom: {$v}px";
+ }
+ }
+ if(count($c)){
+ $c = implode('; ', $c);
+ $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $c. ';': $c. ';';
+ }
+}
+// unique ID
+if($C['unique_ids'] && isset($a['id'])){
+ if(!preg_match('`^[A-Za-z][A-Za-z0-9_\-.:]*$`', ($id = $a['id'])) or (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)){unset($a['id']);
+ }else{
+ while(isset($GLOBALS['hl_Ids'][$id])){$id = $C['unique_ids']. $id;}
+ $GLOBALS['hl_Ids'][($a['id'] = $id)] = 1;
+ }
+}
+// xml:lang
+if($C['xml:lang'] && isset($a['lang'])){
+ $a['xml:lang'] = isset($a['xml:lang']) ? $a['xml:lang'] : $a['lang'];
+ if($C['xml:lang'] == 2){unset($a['lang']);}
+}
+// for transformed tag
+if(!empty($trt)){
+ $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $trt : $trt;
+}
+// return with empty ele /
+if(empty($C['hook_tag'])){
+ $aA = '';
+ foreach($a as $k=>$v){$aA .= " {$k}=\"{$v}\"";}
+ return "<{$e}{$aA}". (isset($eE[$e]) ? ' /' : ''). '>';
+}
+else{return $C['hook_tag']($e, $a);}
+// eof
+}
-function hl_tag2(&$e, &$a, $t=1){
-// transform tag
-if($e == 'big'){$e = 'span'; return 'font-size: larger;';}
-if($e == 's' or $e == 'strike'){$e = 'span'; return 'text-decoration: line-through;';}
-if($e == 'tt'){$e = 'code'; return '';}
-if($e == 'center'){$e = 'div'; return 'text-align: center;';}
-static $fs = array('0'=>'xx-small', '1'=>'xx-small', '2'=>'small', '3'=>'medium', '4'=>'large', '5'=>'x-large', '6'=>'xx-large', '7'=>'300%', '-1'=>'smaller', '-2'=>'60%', '+1'=>'larger', '+2'=>'150%', '+3'=>'200%', '+4'=>'300%');
-if($e == 'font'){
- $a2 = '';
- while(preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $a, $m)){
- $a = str_replace($m[0], ' ', $a);
- $a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace('"', '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? ($a2 .= ' font-size: '. str_replace('"', '\'', $fs[$m]). ';') : '');
- }
- while(preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $a, $m) or preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $a, $m)){
- $a = str_replace($m[0], ' ', $a);
- $a2 .= ' font-family: '. str_replace('"', '\'', trim($m[3])). ';';
- }
- $e = 'span'; return ltrim(str_replace('<', '', $a2));
-}
-if($e == 'acronym'){$e = 'abbr'; return '';}
-if($e == 'dir'){$e = 'ul'; return '';}
-if($t == 2){$e = 0; return 0;}
-return '';
-// eof
-}
+function hl_tag2(&$e, &$a, $t=1){
+// transform tag
+if($e == 'center'){$e = 'div'; return 'text-align: center;';}
+if($e == 'dir' or $e == 'menu'){$e = 'ul'; return '';}
+if($e == 's' or $e == 'strike'){$e = 'span'; return 'text-decoration: line-through;';}
+if($e == 'u'){$e = 'span'; return 'text-decoration: underline;';}
+static $fs = array('0'=>'xx-small', '1'=>'xx-small', '2'=>'small', '3'=>'medium', '4'=>'large', '5'=>'x-large', '6'=>'xx-large', '7'=>'300%', '-1'=>'smaller', '-2'=>'60%', '+1'=>'larger', '+2'=>'150%', '+3'=>'200%', '+4'=>'300%');
+if($e == 'font'){
+ $a2 = '';
+ while(preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $a, $m)){
+ $a = str_replace($m[0], ' ', $a);
+ $a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace('"', '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? ($a2 .= ' font-size: '. str_replace('"', '\'', $fs[$m]). ';') : '');
+ }
+ while(preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $a, $m) or preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $a, $m)){
+ $a = str_replace($m[0], ' ', $a);
+ $a2 .= ' font-family: '. str_replace('"', '\'', trim($m[3])). ';';
+ }
+ $e = 'span'; return ltrim(str_replace('<', '', $a2));
+}
+if($t == 2){$e = 0; return 0;}
+return '';
+// eof
+}
-function hl_tidy($t, $w, $p){
-// Tidy/compact HTM
-if(strpos(' pre,script,textarea', "$p,")){return $t;}
-$t = preg_replace(array('`(<\w[^>]*(?)\s+`', '`\s+`', '`(<\w[^>]*(?) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)(\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t));
-if(($w = strtolower($w)) == -1){
- return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
-}
-$s = strpos(" $w", 't') ? "\t" : ' ';
-$s = preg_match('`\d`', $w, $m) ? str_repeat($s, $m[0]) : str_repeat($s, ($s == "\t" ? 1 : 2));
-$N = preg_match('`[ts]([1-9])`', $w, $m) ? $m[1] : 0;
-$a = array('br'=>1);
-$b = array('button'=>1, 'command'=>1, 'input'=>1, 'option'=>1, 'param'=>1, 'track'=>1);
-$c = array('audio'=>1, 'canvas'=>1, 'caption'=>1, 'dd'=>1, 'dt'=>1, 'figcaption'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'isindex'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'object'=>1, 'p'=>1, 'pre'=>1, 'style'=>1, 'summary'=>1, 'td'=>1, 'textarea'=>1, 'th'=>1, 'video'=>1);
-$d = array('address'=>1, 'article'=>1, 'aside'=>1, 'blockquote'=>1, 'center'=>1, 'colgroup'=>1, 'datalist'=>1, 'details'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'form'=>1, 'header'=>1, 'hgroup'=>1, 'hr'=>1, 'iframe'=>1, 'main'=>1, 'map'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'ol'=>1, 'optgroup'=>1, 'rbc'=>1, 'rtc'=>1, 'ruby'=>1, 'script'=>1, 'section'=>1, 'select'=>1, 'table'=>1, 'tbody'=>1, 'tfoot'=>1, 'thead'=>1, 'tr'=>1, 'ul'=>1);
-$T = explode('<', $t);
-$X = 1;
-while($X){
- $n = $N;
- $t = $T;
- ob_start();
- if(isset($d[$p])){echo str_repeat($s, ++$n);}
- echo ltrim(array_shift($t));
- for($i=-1, $j=count($t); ++$i<$j;){
- $r = ''; list($e, $r) = explode('>', $t[$i]);
- $x = $e[0] == '/' ? 0 : (substr($e, -1) == '/' ? 1 : ($e[0] != '!' ? 2 : -1));
- $y = !$x ? ltrim($e, '/') : ($x > 0 ? substr($e, 0, strcspn($e, ' ')) : 0);
+function hl_tidy($t, $w, $p){
+// Tidy/compact HTM
+if(strpos(' pre,script,textarea', "$p,")){return $t;}
+$t = preg_replace('`\s+`', ' ', preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)(\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t));
+if(($w = strtolower($w)) == -1){
+ return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
+}
+$s = strpos(" $w", 't') ? "\t" : ' ';
+$s = preg_match('`\d`', $w, $m) ? str_repeat($s, $m[0]) : str_repeat($s, ($s == "\t" ? 1 : 2));
+$N = preg_match('`[ts]([1-9])`', $w, $m) ? $m[1] : 0;
+$a = array('br'=>1);
+$b = array('button'=>1, 'input'=>1, 'option'=>1, 'param'=>1);
+$c = array('caption'=>1, 'dd'=>1, 'dt'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'isindex'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'object'=>1, 'p'=>1, 'pre'=>1, 'td'=>1, 'textarea'=>1, 'th'=>1);
+$d = array('address'=>1, 'blockquote'=>1, 'center'=>1, 'colgroup'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'fieldset'=>1, 'form'=>1, 'hr'=>1, 'iframe'=>1, 'map'=>1, 'menu'=>1, 'noscript'=>1, 'ol'=>1, 'optgroup'=>1, 'rbc'=>1, 'rtc'=>1, 'ruby'=>1, 'script'=>1, 'select'=>1, 'table'=>1, 'tbody'=>1, 'tfoot'=>1, 'thead'=>1, 'tr'=>1, 'ul'=>1);
+$T = explode('<', $t);
+$X = 1;
+while($X){
+ $n = $N;
+ $t = $T;
+ ob_start();
+ if(isset($d[$p])){echo str_repeat($s, ++$n);}
+ echo ltrim(array_shift($t));
+ for($i=-1, $j=count($t); ++$i<$j;){
+ $r = ''; list($e, $r) = explode('>', $t[$i]);
+ $x = $e[0] == '/' ? 0 : (substr($e, -1) == '/' ? 1 : ($e[0] != '!' ? 2 : -1));
+ $y = !$x ? ltrim($e, '/') : ($x > 0 ? substr($e, 0, strcspn($e, ' ')) : 0);
$e = "<$e>";
- if(isset($d[$y])){
- if(!$x){
- if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);}
- else{++$N; ob_end_clean(); continue 2;}
- }
- else{echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n));}
- echo $r; continue;
- }
- $f = "\n". str_repeat($s, $n);
- if(isset($c[$y])){
- if(!$x){echo $e, $f, $r;}
- else{echo $f, $e, $r;}
- }elseif(isset($b[$y])){echo $f, $e, $r;
- }elseif(isset($a[$y])){echo $e, $f, $r;
- }elseif(!$y){echo $f, $e, $f, $r;
- }else{echo $e, $r;}
- }
- $X = 0;
-}
-$t = str_replace(array("\n ", " \n"), "\n", preg_replace('`[\n]\s*?[\n]+`', "\n", ob_get_contents()));
-ob_end_clean();
-if(($l = strpos(" $w", 'r') ? (strpos(" $w", 'n') ? "\r\n" : "\r") : 0)){
- $t = str_replace("\n", $l, $t);
-}
-return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
-// eof
-}
+ if(isset($d[$y])){
+ if(!$x){
+ if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);}
+ else{++$N; ob_end_clean(); continue 2;}
+ }
+ else{echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n));}
+ echo $r; continue;
+ }
+ $f = "\n". str_repeat($s, $n);
+ if(isset($c[$y])){
+ if(!$x){echo $e, $f, $r;}
+ else{echo $f, $e, $r;}
+ }elseif(isset($b[$y])){echo $f, $e, $r;
+ }elseif(isset($a[$y])){echo $e, $f, $r;
+ }elseif(!$y){echo $f, $e, $f, $r;
+ }else{echo $e, $r;}
+ }
+ $X = 0;
+}
+$t = str_replace(array("\n ", " \n"), "\n", preg_replace('`[\n]\s*?[\n]+`', "\n", ob_get_contents()));
+ob_end_clean();
+if(($l = strpos(" $w", 'r') ? (strpos(" $w", 'n') ? "\r\n" : "\r") : 0)){
+ $t = str_replace("\n", $l, $t);
+}
+return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
+// eof
+}
+
+function hl_version(){
+// rel
+return '1.1.22';
+// eof
+}
+
+function kses($t, $h, $p=array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto')){
+// kses compat
+foreach($h as $k=>$v){
+ $h[$k]['n']['*'] = 1;
+}
+$C['cdata'] = $C['comment'] = $C['make_tag_strict'] = $C['no_deprecated_attr'] = $C['unique_ids'] = 0;
+$C['keep_bad'] = 1;
+$C['elements'] = count($h) ? strtolower(implode(',', array_keys($h))) : '-*';
+$C['hook'] = 'kses_hook';
+$C['schemes'] = '*:'. implode(',', $p);
+return htmLawed($t, $C, $h);
+// eof
+}
-function hl_version(){
-// rel
-return '1.2.beta.11';
-// eof
-}
\ No newline at end of file
+function kses_hook($t, &$C, &$S){
+// kses compat
+return $t;
+// eof
+}
diff --git a/includes/packages/recaptcha/ReCaptcha/ReCaptcha.php b/includes/packages/recaptcha/ReCaptcha/ReCaptcha.php
old mode 100644
new mode 100755
index c157dc9a3..e2f7c347e
--- a/includes/packages/recaptcha/ReCaptcha/ReCaptcha.php
+++ b/includes/packages/recaptcha/ReCaptcha/ReCaptcha.php
@@ -39,12 +39,12 @@ class ReCaptcha
/**
* Shared secret for the site.
- * @var string
+ * @var type string
*/
private $secret;
/**
- * Method used to communicate with service. Defaults to POST request.
+ * Method used to communicate with service. Defaults to POST request.
* @var RequestMethod
*/
private $requestMethod;
@@ -54,7 +54,6 @@ class ReCaptcha
*
* @param string $secret shared secret between site and reCAPTCHA server.
* @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
- * @throws \RuntimeException if $secret is invalid
*/
public function __construct($secret, RequestMethod $requestMethod = null)
{
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod.php
old mode 100644
new mode 100755
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod/Curl.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod/Curl.php
old mode 100644
new mode 100755
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod/CurlPost.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod/CurlPost.php
old mode 100644
new mode 100755
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod/Post.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod/Post.php
old mode 100644
new mode 100755
index 01ab33b2d..7770d9081
--- a/includes/packages/recaptcha/ReCaptcha/RequestMethod/Post.php
+++ b/includes/packages/recaptcha/ReCaptcha/RequestMethod/Post.php
@@ -58,7 +58,7 @@ public function submit(RequestParameters $params)
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => $params->toQueryString(),
- // Force the peer to validate (not needed in 5.6.0+, but still works)
+ // Force the peer to validate (not needed in 5.6.0+, but still works
'verify_peer' => true,
// Force the peer validation to use www.google.com
$peer_key => 'www.google.com',
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod/Socket.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod/Socket.php
old mode 100644
new mode 100755
index f51f1239a..d3c87922d
--- a/includes/packages/recaptcha/ReCaptcha/RequestMethod/Socket.php
+++ b/includes/packages/recaptcha/ReCaptcha/RequestMethod/Socket.php
@@ -51,8 +51,9 @@ public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $ti
if ($this->handle != false && $errno === 0 && $errstr === '') {
return $this->handle;
+ } else {
+ return false;
}
- return false;
}
/**
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestMethod/SocketPost.php b/includes/packages/recaptcha/ReCaptcha/RequestMethod/SocketPost.php
old mode 100644
new mode 100755
diff --git a/includes/packages/recaptcha/ReCaptcha/RequestParameters.php b/includes/packages/recaptcha/ReCaptcha/RequestParameters.php
old mode 100644
new mode 100755
diff --git a/includes/packages/recaptcha/ReCaptcha/Response.php b/includes/packages/recaptcha/ReCaptcha/Response.php
old mode 100644
new mode 100755
index 111df978a..d2d8a8bf7
--- a/includes/packages/recaptcha/ReCaptcha/Response.php
+++ b/includes/packages/recaptcha/ReCaptcha/Response.php
@@ -32,7 +32,7 @@
class Response
{
/**
- * Success or failure.
+ * Succes or failure.
* @var boolean
*/
private $success = false;
diff --git a/includes/packages/recaptcha/autoload.php b/includes/packages/recaptcha/autoload.php
old mode 100644
new mode 100755
index 5a7ee94c3..a53cbd78b
--- a/includes/packages/recaptcha/autoload.php
+++ b/includes/packages/recaptcha/autoload.php
@@ -1,6 +1,6 @@
direct_query($query);
$STATSSETTINGS = $db->result();
-$THISDAY = date('d');
-$THISMONTH = date('m');
-$THISYEAR = date('Y');
+$THISDAY = date('d');
+$THISMONTH = date('m');
+$THISYEAR = date('Y');
-if ($STATSSETTINGS['activate'] == 'y') {
- // Users accesses
- if ($STATSSETTINGS['accesses'] == 'y') {
- // check cookies and session vars
- if (isset($_SESSION['USER_STATS_SESSION'])) {
- $UPDATESESSION = false;
- } else {
- $USER_STATS_SESSION = time();
- $_SESSION['USER_STATS_SESSION'] = $USER_STATS_SESSION;
- $UPDATESESSION = true;
- }
+if ($STATSSETTINGS['activate'] == 'y')
+{
+ // Users accesses
+ if ($STATSSETTINGS['accesses'] == 'y')
+ {
+ // check cookies and session vars
+ if (isset($_SESSION['USER_STATS_SESSION']))
+ {
+ $UPDATESESSION = FALSE;
+ }
+ else
+ {
+ $USER_STATS_SESSION = time();
+ $_SESSION['USER_STATS_SESSION'] = $USER_STATS_SESSION;
+ $UPDATESESSION = TRUE;
+ }
- // check cookies and session vars
- $Cookie = 'uniqueuser';
- if (isset($_COOKIE[$Cookie])) {
- $UPDATECOOKIE = false;
- } else {
- // Get left seconds to the end of the month
- $exp = GetLeftSeconds();
- setcookie($Cookie, time(), time() + $exp);
- $UPDATECOOKIE = true;
- }
+ // check cookies and session vars
+ $Cookie = 'uniqueuser';
+ if (isset($_COOKIE[$Cookie]))
+ {
+ $UPDATECOOKIE = FALSE;
+ }
+ else
+ {
+ // Get left seconds to the end of the month
+ $exp = GetLeftSeconds();
+ setcookie($Cookie, time(), time() + $exp);
+ $UPDATECOOKIE = TRUE;
+ }
- $query = "SELECT day, month FROM " . $DBPrefix . "currentaccesses WHERE day = :day AND month = :month";
- $params = array();
- $params[] = array(':day', $THISDAY, 'int');
- $params[] = array(':month', $THISMONTH, 'str');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "currentaccesses VALUES (:day, :month, :year, 0, 0, 0)";
- $params = array();
- $params[] = array(':day', $THISDAY, 'int');
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $db->query($query, $params);
- }
+ $query = "SELECT day, month FROM " . $DBPrefix . "currentaccesses WHERE day = :day AND month = :month";
+ $params = array();
+ $params[] = array(':day', $THISDAY, 'int');
+ $params[] = array(':month', $THISMONTH, 'str');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "currentaccesses VALUES (:day, :month, :year, 0, 0, 0)";
+ $params = array();
+ $params[] = array(':day', $THISDAY, 'int');
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $db->query($query, $params);
+ }
- $query = "UPDATE " . $DBPrefix . "currentaccesses SET pageviews = pageviews + 1";
- if ($UPDATESESSION) {
- $query .= ", usersessions = usersessions + 1";
- }
- if ($UPDATECOOKIE) {
- $query .= ", uniquevisitors = uniquevisitors + 1";
- }
- $query .= " WHERE day = :day AND month = :month AND year = :year";
- $params = array();
- $params[] = array(':day', $THISDAY, 'int');
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $db->query($query, $params);
- // End users accesses
- }
+ $query = "UPDATE " . $DBPrefix . "currentaccesses SET pageviews = pageviews + 1";
+ if ($UPDATESESSION)
+ {
+ $query .= ", usersessions = usersessions + 1";
+ }
+ if ($UPDATECOOKIE)
+ {
+ $query .= ", uniquevisitors = uniquevisitors + 1";
+ }
+ $query .= " WHERE day = :day AND month = :month AND year = :year";
+ $params = array();
+ $params[] = array(':day', $THISDAY, 'int');
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $db->query($query, $params);
+ // End users accesses
+ }
- // Get user's agent and platform
- $browser_info = browser_detection('full');
- $browser_info[] = browser_detection('moz_version');
- //var_dump($browser_info);
+ // Get user's agent and platform
+ $browser_info = browser_detection('full');
+ $browser_info[] = browser_detection('moz_version');
+ //var_dump($browser_info);
- $os = '';
- switch ($browser_info[5]) {
- case 'win':
- $os .= 'Windows ';
- break;
- case 'nt':
- $os .= 'Windows NT ';
- break;
- case 'lin':
- $os .= 'Linux ';
- break;
- case 'mac':
- $os .= 'Mac ';
- break;
- case 'unix':
- $os .= 'Unix Version: ';
- break;
- default:
- $os .= $browser_info[5];
- }
+ $os = '';
+ switch ($browser_info[5])
+ {
+ case 'win':
+ $os .= 'Windows ';
+ break;
+ case 'nt':
+ $os .= 'Windows NT ';
+ break;
+ case 'lin':
+ $os .= 'Linux ';
+ break;
+ case 'mac':
+ $os .= 'Mac ';
+ break;
+ case 'unix':
+ $os .= 'Unix Version: ';
+ break;
+ default:
+ $os .= $browser_info[5];
+ }
- if ($browser_info[5] == 'nt') {
- if ($browser_info[6] == 5) {
- $os .= '5.0 (Windows 2000)';
- } elseif ($browser_info[6] == 5.1) {
- $os .= '5.1 (Windows XP or Windows Server 2003)';
- } elseif ($browser_info[6] == 5.2) {
- $os .= '5.2 (Windows XP Professional x64 or Windows Server 2003 R2)';
- } elseif ($browser_info[6] == 6.0) {
- $os .= '6.0 (Windows Vista or Windows Server 2008 R2)';
- } elseif ($browser_info[6] == 6.1) {
- $os .= '6.1 (Windows 7 or Windows Server 2008 R2)';
- } elseif ($browser_info[6] == 6.2) {
- $os .= '6.2 (Windows 8 or Windows Server 2012)';
- } elseif ($browser_info[6] == 6.3) {
- $os .= '6.3 (Windows 8.1 or Windows Server 2012 R2)';
- } elseif ($browser_info[6] == 10.0) {
- $os .= '10.0 (Windows 10)';
- } elseif ($browser_info[6] == '') {
- $os .= ' (Unknown Windows)';
- }
- } elseif (($browser_info[5] == 'mac') && ($browser_info[6] >= 10)) {
- $os .= 'OS X';
- } elseif ($browser_info[5] == 'lin') {
- $os .= ($browser_info[6] != '') ? 'Distro: ' . ucfirst($browser_info[6]) : 'Smart Move!!!';
- } elseif ($browser_info[6] == '') {
- $os .= ' (version unknown)';
- } else {
- $os .= strtoupper($browser_info[6]);
- }
- $os = substr($os, 0, 50);
+ if ($browser_info[5] == 'nt')
+ {
+ if ($browser_info[6] == 5)
+ {
+ $os .= '5.0 (Windows 2000)';
+ }
+ elseif ($browser_info[6] == 5.1)
+ {
+ $os .= '5.1 (Windows XP or Windows Server 2003)';
+ }
+ elseif ($browser_info[6] == 5.2)
+ {
+ $os .= '5.2 (Windows XP Professional x64 or Windows Server 2003 R2)';
+ }
+ elseif ($browser_info[6] == 6.0)
+ {
+ $os .= '6.0 (Windows Vista or Windows Server 2008 R2)';
+ }
+ elseif ($browser_info[6] == 6.1)
+ {
+ $os .= '6.1 (Windows 7 or Windows Server 2008 R2)';
+ }
+ elseif ($browser_info[6] == 6.2)
+ {
+ $os .= '6.2 (Windows 8 or Windows Server 2012)';
+ }
+ elseif ($browser_info[6] == 6.3)
+ {
+ $os .= '6.3 (Windows 8.1 or Windows Server 2012 R2)';
+ }
+ elseif ($browser_info[6] == 10.0)
+ {
+ $os .= '10.0 (Windows 10)';
+ }
+ elseif ($browser_info[6] == '')
+ {
+ $os .= ' (Unknown Windows)';
+ }
+ }
+ elseif (($browser_info[5] == 'mac') && ($browser_info[6] >= 10))
+ {
+ $os .= 'OS X';
+ }
+ elseif ($browser_info[5] == 'lin')
+ {
+ $os .= ( $browser_info[6] != '' ) ? 'Distro: ' . ucfirst ($browser_info[6] ) : 'Smart Move!!!';
+ }
+ elseif ($browser_info[6] == '')
+ {
+ $os .= ' (version unknown)';
+ }
+ else
+ {
+ $os .= strtoupper( $browser_info[6] );
+ }
- $browser = '';
- if ($browser_info[0] == 'moz') {
- $a_temp = $browser_info[count($browser_info) - 1]; // use the last item in array, the moz array
- $browser .= ($a_temp[0] != 'mozilla') ? 'Mozilla/ ' . ucfirst($a_temp[0]) . ' ' : ucfirst($a_temp[0]) . ' ';
- $browser .= $a_temp[1];
- /* not really needed in this much detail
- $browser .= 'ProductSub: ';
- $browser .= ($a_temp[4] != '') ? $a_temp[4] . ' ' : 'Not Available ';
- $browser .= ($a_temp[0] != 'galeon') ? 'Engine: Gecko RV: ' . $a_temp[3] : ''; */
- } elseif ($browser_info[0] == 'ns') {
- $browser .= 'Netscape ' . $browser_info[1];
- } elseif ($browser_info[0] == 'webkit') {
- $browser .= 'User Agent: ';
- $browser .= ucwords($browser_info[7]);
- $browser .= ' Engine: AppleWebKit ';
- $browser .= ($browser_info[1]) ? $browser_info[1] : 'Not Available';
- } else {
- $browser .= ($browser_info[0] == 'ie') ? strtoupper($browser_info[7]) : ucwords($browser_info[7]);
- $browser .= ' ' . $browser_info[1];
- }
+ $browser = '';
+ if ($browser_info[0] == 'moz')
+ {
+ $a_temp = $browser_info[count($browser_info) - 1]; // use the last item in array, the moz array
+ $browser .= ($a_temp[0] != 'mozilla') ? 'Mozilla/ ' . ucfirst($a_temp[0]) . ' ' : ucfirst($a_temp[0]) . ' ';
+ $browser .= $a_temp[1];
+ /* not really needed in this much detail
+ $browser .= 'ProductSub: ';
+ $browser .= ($a_temp[4] != '') ? $a_temp[4] . ' ' : 'Not Available ';
+ $browser .= ($a_temp[0] != 'galeon') ? 'Engine: Gecko RV: ' . $a_temp[3] : ''; */
+ }
+ elseif ($browser_info[0] == 'ns')
+ {
+ $browser .= 'Netscape ' . $browser_info[1];
+ }
+ elseif ($browser_info[0] == 'webkit')
+ {
+ $browser .= 'User Agent: ';
+ $browser .= ucwords($browser_info[7]);
+ $browser .= ' Engine: AppleWebKit ';
+ $browser .= ($browser_info[1]) ? $browser_info[1] : 'Not Available';
+ }
+ else
+ {
+ $browser .= ($browser_info[0] == 'ie') ? strtoupper($browser_info[7]) : ucwords($browser_info[7]);
+ $browser .= ' ' . $browser_info[1];
+ }
- if ($STATSSETTINGS['browsers'] == 'y' && !(isset($browser_info[8]) && $browser_info[8] == 'bot')) {
- // Update the browser stats
- $query = "SELECT month FROM " . $DBPrefix . "currentbrowsers WHERE month = :month AND year = :year AND browser = :browser";
- $params = array();
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $params[] = array(':browser', $browser, 'str');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "currentbrowsers VALUES (:month, :year, :browser, 1)";
- $params = array();
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $params[] = array(':browser', $browser, 'str');
- $db->query($query, $params);
- } else {
- $query = "UPDATE " . $DBPrefix . "currentbrowsers SET
+ if ($STATSSETTINGS['browsers'] == 'y' && !(isset($browser_info[8]) && $browser_info[8] == 'bot'))
+ {
+ // Update the browser stats
+ $query = "SELECT month FROM " . $DBPrefix . "currentbrowsers WHERE month = :month AND year = :year AND browser = :browser";
+ $params = array();
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $params[] = array(':browser', $browser, 'str');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "currentbrowsers VALUES (:month, :year, :browser, 1)";
+ $params = array();
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $params[] = array(':browser', $browser, 'str');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "currentbrowsers SET
counter = counter + 1
WHERE browser = :browser AND month = :month AND year = :year";
- $params = array();
- $params[] = array(':browser', $browser, 'str');
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $db->query($query, $params);
- }
+ $params = array();
+ $params[] = array(':browser', $browser, 'str');
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $db->query($query, $params);
+ }
- // Update the platfom stats
- $query = "SELECT month FROM " . $DBPrefix . "currentplatforms WHERE month = :month AND year = :year AND platform = :OS";
- $params = array();
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $params[] = array(':OS', $os, 'str');
- $db->query($query, $params);
- if ($db->numrows() == 0) {
- $query = "INSERT INTO " . $DBPrefix . "currentplatforms VALUES (:month, :year, :OS, 1)";
- $params = array();
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $params[] = array(':OS', $os, 'str');
- $db->query($query, $params);
- } else {
- $query = "UPDATE " . $DBPrefix . "currentplatforms
+ // Update the platfom stats
+ $query = "SELECT month FROM " . $DBPrefix . "currentplatforms WHERE month = :month AND year = :year AND platform = :OS";
+ $params = array();
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $params[] = array(':OS', $os, 'str');
+ $db->query($query, $params);
+ if ($db->numrows() == 0)
+ {
+ $query = "INSERT INTO " . $DBPrefix . "currentplatforms VALUES (:month, :year, :OS, 1)";
+ $params = array();
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $params[] = array(':OS', $os, 'str');
+ $db->query($query, $params);
+ }
+ else
+ {
+ $query = "UPDATE " . $DBPrefix . "currentplatforms
SET counter = counter + 1
WHERE platform = :OS AND month = :month AND year = :year";
- $params = array();
- $params[] = array(':OS', $os, 'str');
- $params[] = array(':month', $THISMONTH, 'str');
- $params[] = array(':year', $THISYEAR, 'int');
- $db->query($query, $params);
- }
- }
+ $params = array();
+ $params[] = array(':OS', $os, 'str');
+ $params[] = array(':month', $THISMONTH, 'str');
+ $params[] = array(':year', $THISYEAR, 'int');
+ $db->query($query, $params);
+ }
+ }
}
diff --git a/includes/template/Template.php b/includes/template/Template.php
old mode 100644
new mode 100755
index 57df7d83e..7504f517d
--- a/includes/template/Template.php
+++ b/includes/template/Template.php
@@ -11,8 +11,9 @@
/**
* @ignore
*/
-if (!defined('InWeBid')) {
- exit;
+if (!defined('InWeBid'))
+{
+ exit;
}
/**
@@ -21,395 +22,438 @@
*/
class Template
{
- /** variable that holds all the data we'll be substituting into
- * the compiled templates. Takes form:
- * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
- * if it's a root-level variable, it'll be like this:
- * --> $this->_tpldata[.][0][varname] == value
- */
- public $_tpldata = array('.' => array(0 => array()));
- public $_rootref;
-
- // Root dir and hash of filenames for each template handle.
- public $root = '';
- public $cachepath = '';
- public $files = array();
- public $filename = array();
- public $files_inherit = array();
- public $files_template = array();
- public $inherit_root = '';
- public $InAdmin = false;
-
- // this will hash handle names to the compiled/uncompiled code for that handle.
- public $compiled_code = array();
-
- /**
- * Set template location
- * @access public
- */
- public function set_template()
- {
- global $system;
-
- $theme = (!defined('InAdmin')) ? $system->SETTINGS['theme'] : $system->SETTINGS['admin_theme'];
-
- if (file_exists(MAIN_PATH . 'themes/' . $theme)) {
- $this->root = MAIN_PATH . 'themes/' . $theme;
- $this->cachepath = MAIN_PATH . 'cache/tpl_' . str_replace('_', '-', $theme) . '_';
- $this->default_root = MAIN_PATH . 'themes/default';
- $this->default_cachepath = MAIN_PATH . 'cache/tpl_default' . '_';
- } else {
- trigger_error('Template path could not be found: themes/' . $theme, E_USER_ERROR);
- }
-
- $this->_rootref = &$this->_tpldata['.'][0];
-
- return true;
- }
-
- /**
- * Set custom template location (able to use directory outside of phpBB)
- * @access public
- */
- public function set_custom_template($template_path, $template_name)
- {
- $this->root = $template_path;
- $this->cachepath = MAIN_PATH . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
-
- return true;
- }
-
- /**
- * Sets the template filenames for handles. $filename_array
- * should be a hash of handle => filename pairs.
- * @access public
- */
- public function set_filenames($filename_array)
- {
- if (!is_array($filename_array)) {
- return false;
- }
- foreach ($filename_array as $handle => $filename) {
- if (empty($filename)) {
- trigger_error("template->set_filenames: Empty filename specified for $handle", E_USER_ERROR);
- }
-
- $this->filename[$handle] = $filename;
- $this->files[$handle] = $this->root . '/' . $filename;
- }
-
- return true;
- }
-
- /**
- * Destroy template data set
- * @access public
- */
- public function destroy()
- {
- $this->_tpldata = array('.' => array(0 => array()));
- }
-
- /**
- * Reset/empty complete block
- * @access public
- */
- public function destroy_block_vars($blockname)
- {
- if (strpos($blockname, '.') !== false) {
- // Nested block.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
-
- $str = &$this->_tpldata;
- for ($i = 0; $i < $blockcount; $i++) {
- $str = &$str[$blocks[$i]];
- $str = &$str[sizeof($str) - 1];
- }
-
- unset($str[$blocks[$blockcount]]);
- } else {
- // Top-level block.
- unset($this->_tpldata[$blockname]);
- }
-
- return true;
- }
-
- /**
- * Display handle
- * @access public
- */
- public function display($handle, $include_once = true)
- {
- global $MSG;
- if ($filename = $this->_tpl_load($handle)) {
- ($include_once) ? include_once($filename) : include($filename);
- } else {
- eval(' ?>' . $this->compiled_code[$handle] . 'display($handle, $include_once);
- $contents = ob_get_clean();
-
- if ($return_content) {
- return $contents;
- }
-
- $this->assign_var($template_var, $contents);
-
- return true;
- }
-
- /**
- * Load a compiled template if possible, if not, recompile it
- * @access private
- */
- public function _tpl_load(&$handle)
- {
- global $system;
-
- $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.php';
- $this->files_template[$handle] = $system->SETTINGS['theme'];
-
- $recompile = false;
- if (!file_exists($filename) || @filesize($filename) === 0 || $system->SETTINGS['cache_theme'] == 'n') {
- $recompile = true;
- }
-
- // Recompile page if the original template is newer, otherwise load the compiled version
- if (!$recompile) {
- return $filename;
- }
-
- if (!class_exists('TemplateCompile')) {
- include(INCLUDE_PATH . 'template/TemplateCompile.php');
- }
- $compile = new TemplateCompile($this);
-
- // If we don't have a file assigned to this handle, die.
- if (!isset($this->files[$handle])) {
- trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR);
- }
-
- $compile->_tpl_load_file($handle);
- return false;
- }
-
- /**
- * Assign key variable pairs from an array
- * @access public
- */
- public function assign_vars($vararray)
- {
- foreach ($vararray as $key => $val) {
- $this->_rootref[$key] = $val;
- }
- global $_SESSION;
- if (isset($_SESSION['csrftoken'])) {
- $this->_rootref['_CSRFTOKEN'] = $_SESSION['csrftoken'];
- $this->_rootref['_CSRFFORM'] = ' ';
- }
-
- return true;
- }
-
- /**
- * Assign a single variable to a single key
- * @access public
- */
- public function assign_var($varname, $varval)
- {
- $this->_rootref[$varname] = $varval;
-
- return true;
- }
-
- /**
- * Assign key variable pairs from an array to a specified block
- * @access public
- */
- public function assign_block_vars($blockname, $vararray)
- {
- if (strpos($blockname, '.') !== false) {
- // Nested block.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
-
- $str = &$this->_tpldata;
- for ($i = 0; $i < $blockcount; $i++) {
- $str = &$str[$blocks[$i]];
- $str = &$str[sizeof($str) - 1];
- }
-
- $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
-
- // Assign S_FIRST_ROW
- if (!$s_row_count) {
- $vararray['S_FIRST_ROW'] = true;
- }
-
- // Now the tricky part, we always assign S_LAST_ROW and remove the entry before
- // This is much more clever than going through the complete template data on display (phew)
- $vararray['S_LAST_ROW'] = true;
- if ($s_row_count > 0) {
- unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']);
- }
-
- // Now we add the block that we're actually assigning to.
- // We're adding a new iteration to this block with the given
- // variable assignments.
- $str[$blocks[$blockcount]][] = $vararray;
- } else {
- // Top-level block.
- $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
-
- // Assign S_FIRST_ROW
- if (!$s_row_count) {
- $vararray['S_FIRST_ROW'] = true;
- }
-
- // We always assign S_LAST_ROW and remove the entry before
- $vararray['S_LAST_ROW'] = true;
- if ($s_row_count > 0) {
- unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
- }
-
- // Add a new iteration to this block with the variable assignments we were given.
- $this->_tpldata[$blockname][] = $vararray;
- }
-
- return true;
- }
-
- /**
- * Change already assigned key variable pair (one-dimensional - single loop entry)
- *
- * An example of how to use this function:
- * {@example alter_block_array.php}
- *
- * @param string $blockname the blockname, for example 'loop'
- * @param array $vararray the var array to insert/add or merge
- * @param mixed $key Key to search for
- *
- * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
- *
- * int: Position [the position to change or insert at directly given]
- *
- * If key is false the position is set to 0
- * If key is true the position is set to the last entry
- *
- * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
- *
- * If insert, the vararray is inserted at the given position (position counting from zero).
- * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
- *
- * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
- * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
- *
- * @return bool false on error, true on success
- * @access public
- */
- public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
- {
- if (strpos($blockname, '.') !== false) {
- // Nested blocks are not supported
- return false;
- }
-
- // Change key to zero (change first position) if false and to last position if true
- if ($key === false || $key === true) {
- $key = ($key === false) ? 0 : sizeof($this->_tpldata[$blockname]);
- }
-
- // Get correct position if array given
- if (is_array($key)) {
- // Search array to get correct position
- list($search_key, $search_value) = @each($key);
-
- $key = null;
- foreach ($this->_tpldata[$blockname] as $i => $val_ary) {
- if ($val_ary[$search_key] === $search_value) {
- $key = $i;
- break;
- }
- }
-
- // key/value pair not found
- if ($key === null) {
- return false;
- }
- }
-
- // Insert Block
- if ($mode == 'insert') {
- // Make sure we are not exceeding the last iteration
- if ($key >= sizeof($this->_tpldata[$blockname])) {
- $key = sizeof($this->_tpldata[$blockname]);
- unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
- $vararray['S_LAST_ROW'] = true;
- } elseif ($key === 0) {
- unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
- $vararray['S_FIRST_ROW'] = true;
- }
-
- // Re-position template blocks
- for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) {
- $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
- $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
- }
-
- // Insert vararray at given position
- $vararray['S_ROW_COUNT'] = $key;
- $this->_tpldata[$blockname][$key] = $vararray;
-
- return true;
- }
-
- // Which block to change?
- if ($mode == 'change') {
- if ($key == sizeof($this->_tpldata[$blockname])) {
- $key--;
- }
-
- $this->_tpldata[$blockname][$key] = array_merge($this->_tpldata[$blockname][$key], $vararray);
- return true;
- }
-
- return false;
- }
-
- /**
- * Include a separate template
- * @access private
- */
- public function _tpl_include($filename, $include = true)
- {
- global $MSG;
- $handle = $filename;
- $this->filename[$handle] = $filename;
- $this->files[$handle] = $this->root . '/' . $filename;
-
- $filename = $this->_tpl_load($handle);
-
- if ($include) {
- if ($filename) {
- include($filename);
- return;
- }
- eval(' ?>' . $this->compiled_code[$handle] . ' $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
+ * if it's a root-level variable, it'll be like this:
+ * --> $this->_tpldata[.][0][varname] == value
+ */
+ var $_tpldata = array('.' => array(0 => array()));
+ var $_rootref;
+
+ // Root dir and hash of filenames for each template handle.
+ var $root = '';
+ var $cachepath = '';
+ var $files = array();
+ var $filename = array();
+ var $files_inherit = array();
+ var $files_template = array();
+ var $inherit_root = '';
+ var $InAdmin = false;
+
+ // this will hash handle names to the compiled/uncompiled code for that handle.
+ var $compiled_code = array();
+
+ /**
+ * Set template location
+ * @access public
+ */
+ function set_template()
+ {
+ global $system;
+
+ $theme = (!defined('InAdmin')) ? $system->SETTINGS['theme'] : $system->SETTINGS['admin_theme'];
+
+ if (file_exists(MAIN_PATH . 'themes/' . $theme))
+ {
+ $this->root = MAIN_PATH . 'themes/' . $theme;
+ $this->cachepath = MAIN_PATH . 'cache/tpl_' . str_replace('_', '-', $theme) . '_';
+ $this->default_root = MAIN_PATH . 'themes/default';
+ $this->default_cachepath = MAIN_PATH . 'cache/tpl_default' . '_';
+ }
+ else
+ {
+ trigger_error('Template path could not be found: themes/' . $theme, E_USER_ERROR);
+ }
+
+ $this->_rootref = &$this->_tpldata['.'][0];
+
+ return true;
+ }
+
+ /**
+ * Set custom template location (able to use directory outside of phpBB)
+ * @access public
+ */
+ function set_custom_template($template_path, $template_name)
+ {
+ $this->root = $template_path;
+ $this->cachepath = MAIN_PATH . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
+
+ return true;
+ }
+
+ /**
+ * Sets the template filenames for handles. $filename_array
+ * should be a hash of handle => filename pairs.
+ * @access public
+ */
+ function set_filenames($filename_array)
+ {
+ if (!is_array($filename_array))
+ {
+ return false;
+ }
+ foreach ($filename_array as $handle => $filename)
+ {
+ if (empty($filename))
+ {
+ trigger_error("template->set_filenames: Empty filename specified for $handle", E_USER_ERROR);
+ }
+
+ $this->filename[$handle] = $filename;
+ $this->files[$handle] = $this->root . '/' . $filename;
+ }
+
+ return true;
+ }
+
+ /**
+ * Destroy template data set
+ * @access public
+ */
+ function destroy()
+ {
+ $this->_tpldata = array('.' => array(0 => array()));
+ }
+
+ /**
+ * Reset/empty complete block
+ * @access public
+ */
+ function destroy_block_vars($blockname)
+ {
+ if (strpos($blockname, '.') !== false)
+ {
+ // Nested block.
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ $str = &$this->_tpldata;
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ $str = &$str[$blocks[$i]];
+ $str = &$str[sizeof($str) - 1];
+ }
+
+ unset($str[$blocks[$blockcount]]);
+ }
+ else
+ {
+ // Top-level block.
+ unset($this->_tpldata[$blockname]);
+ }
+
+ return true;
+ }
+
+ /**
+ * Display handle
+ * @access public
+ */
+ function display($handle, $include_once = true)
+ {
+ global $MSG;
+ if ($filename = $this->_tpl_load($handle))
+ {
+ ($include_once) ? include_once($filename) : include($filename);
+ }
+ else
+ {
+ eval(' ?>' . $this->compiled_code[$handle] . 'display($handle, $include_once);
+ $contents = ob_get_clean();
+
+ if ($return_content)
+ {
+ return $contents;
+ }
+
+ $this->assign_var($template_var, $contents);
+
+ return true;
+ }
+
+ /**
+ * Load a compiled template if possible, if not, recompile it
+ * @access private
+ */
+ function _tpl_load(&$handle)
+ {
+ global $system;
+
+ $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.php';
+ $this->files_template[$handle] = $system->SETTINGS['theme'];
+
+ $recompile = false;
+ if (!file_exists($filename) || @filesize($filename) === 0 || $system->SETTINGS['cache_theme'] == 'n')
+ {
+ $recompile = true;
+ }
+
+ // Recompile page if the original template is newer, otherwise load the compiled version
+ if (!$recompile)
+ {
+ return $filename;
+ }
+
+ if (!class_exists('TemplateCompile'))
+ {
+ include(INCLUDE_PATH . 'template/TemplateCompile.php');
+ }
+ $compile = new TemplateCompile($this);
+
+ // If we don't have a file assigned to this handle, die.
+ if (!isset($this->files[$handle]))
+ {
+ trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR);
+ }
+
+ $compile->_tpl_load_file($handle);
+ return false;
+ }
+
+ /**
+ * Assign key variable pairs from an array
+ * @access public
+ */
+ function assign_vars($vararray)
+ {
+ foreach ($vararray as $key => $val)
+ {
+ $this->_rootref[$key] = $val;
+ }
+ global $_SESSION;
+ if(isset($_SESSION['csrftoken']))
+ {
+ $this->_rootref['_CSRFTOKEN'] = $_SESSION['csrftoken'];
+ $this->_rootref['_CSRFFORM'] = ' ';
+ }
+
+ return true;
+ }
+
+ /**
+ * Assign a single variable to a single key
+ * @access public
+ */
+ function assign_var($varname, $varval)
+ {
+ $this->_rootref[$varname] = $varval;
+
+ return true;
+ }
+
+ /**
+ * Assign key variable pairs from an array to a specified block
+ * @access public
+ */
+ function assign_block_vars($blockname, $vararray)
+ {
+ if (strpos($blockname, '.') !== false)
+ {
+ // Nested block.
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ $str = &$this->_tpldata;
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ $str = &$str[$blocks[$i]];
+ $str = &$str[sizeof($str) - 1];
+ }
+
+ $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
+ $vararray['S_ROW_COUNT'] = $s_row_count;
+
+ // Assign S_FIRST_ROW
+ if (!$s_row_count)
+ {
+ $vararray['S_FIRST_ROW'] = true;
+ }
+
+ // Now the tricky part, we always assign S_LAST_ROW and remove the entry before
+ // This is much more clever than going through the complete template data on display (phew)
+ $vararray['S_LAST_ROW'] = true;
+ if ($s_row_count > 0)
+ {
+ unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']);
+ }
+
+ // Now we add the block that we're actually assigning to.
+ // We're adding a new iteration to this block with the given
+ // variable assignments.
+ $str[$blocks[$blockcount]][] = $vararray;
+ }
+ else
+ {
+ // Top-level block.
+ $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
+ $vararray['S_ROW_COUNT'] = $s_row_count;
+
+ // Assign S_FIRST_ROW
+ if (!$s_row_count)
+ {
+ $vararray['S_FIRST_ROW'] = true;
+ }
+
+ // We always assign S_LAST_ROW and remove the entry before
+ $vararray['S_LAST_ROW'] = true;
+ if ($s_row_count > 0)
+ {
+ unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
+ }
+
+ // Add a new iteration to this block with the variable assignments we were given.
+ $this->_tpldata[$blockname][] = $vararray;
+ }
+
+ return true;
+ }
+
+ /**
+ * Change already assigned key variable pair (one-dimensional - single loop entry)
+ *
+ * An example of how to use this function:
+ * {@example alter_block_array.php}
+ *
+ * @param string $blockname the blockname, for example 'loop'
+ * @param array $vararray the var array to insert/add or merge
+ * @param mixed $key Key to search for
+ *
+ * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
+ *
+ * int: Position [the position to change or insert at directly given]
+ *
+ * If key is false the position is set to 0
+ * If key is true the position is set to the last entry
+ *
+ * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
+ *
+ * If insert, the vararray is inserted at the given position (position counting from zero).
+ * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
+ *
+ * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
+ * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
+ *
+ * @return bool false on error, true on success
+ * @access public
+ */
+ function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
+ {
+ if (strpos($blockname, '.') !== false)
+ {
+ // Nested blocks are not supported
+ return false;
+ }
+
+ // Change key to zero (change first position) if false and to last position if true
+ if ($key === false || $key === true)
+ {
+ $key = ($key === false) ? 0 : sizeof($this->_tpldata[$blockname]);
+ }
+
+ // Get correct position if array given
+ if (is_array($key))
+ {
+ // Search array to get correct position
+ list($search_key, $search_value) = @each($key);
+
+ $key = NULL;
+ foreach ($this->_tpldata[$blockname] as $i => $val_ary)
+ {
+ if ($val_ary[$search_key] === $search_value)
+ {
+ $key = $i;
+ break;
+ }
+ }
+
+ // key/value pair not found
+ if ($key === NULL)
+ {
+ return false;
+ }
+ }
+
+ // Insert Block
+ if ($mode == 'insert')
+ {
+ // Make sure we are not exceeding the last iteration
+ if ($key >= sizeof($this->_tpldata[$blockname]))
+ {
+ $key = sizeof($this->_tpldata[$blockname]);
+ unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
+ $vararray['S_LAST_ROW'] = true;
+ }
+ else if ($key === 0)
+ {
+ unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
+ $vararray['S_FIRST_ROW'] = true;
+ }
+
+ // Re-position template blocks
+ for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
+ {
+ $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
+ $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
+ }
+
+ // Insert vararray at given position
+ $vararray['S_ROW_COUNT'] = $key;
+ $this->_tpldata[$blockname][$key] = $vararray;
+
+ return true;
+ }
+
+ // Which block to change?
+ if ($mode == 'change')
+ {
+ if ($key == sizeof($this->_tpldata[$blockname]))
+ {
+ $key--;
+ }
+
+ $this->_tpldata[$blockname][$key] = array_merge($this->_tpldata[$blockname][$key], $vararray);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Include a separate template
+ * @access private
+ */
+ function _tpl_include($filename, $include = true)
+ {
+ global $MSG;
+ $handle = $filename;
+ $this->filename[$handle] = $filename;
+ $this->files[$handle] = $this->root . '/' . $filename;
+
+ $filename = $this->_tpl_load($handle);
+
+ if ($include)
+ {
+ if ($filename)
+ {
+ include($filename);
+ return;
+ }
+ eval(' ?>' . $this->compiled_code[$handle] . 'template = &$template;
- }
-
- /**
- * Load template source from file
- * @access private
- */
- public function _tpl_load_file($handle)
- {
- global $_SESSION;
-
- // Try and open template for read
- if (!file_exists($this->template->files[$handle])) {
- trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
- }
-
- $this->template->compiled_code[$handle] = $this->compile(trim(@file_get_contents($this->template->files[$handle])));
-
- // Actually compile the code now.
- $this->compile_write($handle, $this->template->compiled_code[$handle]);
- }
-
- /**
- * Remove any PHP tags that do not belong, these regular expressions are derived from
- * the ones that exist in zend_language_scanner.l
- * @access private
- */
- public function remove_php_tags(&$code)
- {
- // This matches the information gathered from the internal PHP lexer
- $match = array(
- '#<([\?%])=?.*?\1>#s',
- '##s',
- '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s'
- );
-
- $code = preg_replace($match, '', $code);
- }
-
- /**
- * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
- * @access private
- */
- public function compile($code, $no_echo = false, $echo_var = '')
- {
- if ($echo_var) {
- global $$echo_var;
- }
-
- // Remove any "loose" php ... we want to give admins the ability
- // to switch on/off PHP for a given template. Allowing unchecked
- // php is a no-no. There is a potential issue here in that non-php
- // content may be removed ... however designers should use entities
- // if they wish to display < and >
- $this->remove_php_tags($code);
-
- // Pull out all block/statement level elements and separate plain text
- preg_match_all('#(.*?)#s', $code, $matches);
- $php_blocks = $matches[1];
- $code = preg_replace('#.*?#s', '', $code);
-
- preg_match_all('##', $code, $matches);
- $include_blocks = $matches[1];
- $code = preg_replace('##', '', $code);
-
- preg_match_all('##', $code, $matches);
- $includephp_blocks = $matches[1];
- $code = preg_replace('##', '', $code);
-
- preg_match_all('##', $code, $blocks, PREG_SET_ORDER);
-
- $text_blocks = preg_split('##', $code);
-
- for ($i = 0, $j = sizeof($text_blocks); $i < $j; $i++) {
- $this->compile_var_tags($text_blocks[$i]);
- }
- $compile_blocks = array();
-
- for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++) {
- $block_val = &$blocks[$curr_tb];
-
- switch ($block_val[1]) {
- case 'BEGIN':
- $this->block_else_level[] = false;
- $compile_blocks[] = 'compile_tag_block($block_val[2]) . ' ?>';
- break;
-
- case 'BEGINELSE':
- $this->block_else_level[sizeof($this->block_else_level) - 1] = true;
- $compile_blocks[] = '';
- break;
-
- case 'END':
- array_pop($this->block_names);
- $compile_blocks[] = 'block_else_level)) ? '}' : '}}') . ' ?>';
- break;
-
- case 'IF':
- $compile_blocks[] = 'compile_tag_if($block_val[2], false) . ' ?>';
- break;
-
- case 'ELSE':
- $compile_blocks[] = '';
- break;
-
- case 'ELSEIF':
- $compile_blocks[] = 'compile_tag_if($block_val[2], true) . ' ?>';
- break;
-
- case 'ENDIF':
- $compile_blocks[] = '';
- break;
-
- case 'DEFINE':
- $compile_blocks[] = 'compile_tag_define($block_val[2], true) . ' ?>';
- break;
-
- case 'UNDEFINE':
- $compile_blocks[] = 'compile_tag_define($block_val[2], false) . ' ?>';
- break;
-
- case 'INCLUDE':
- $temp = array_shift($include_blocks);
- $compile_blocks[] = 'compile_tag_include($temp) . ' ?>';
- // dont check variable file includes
- if (!preg_match('#\{([a-z0-9_-]+)\}#is', $temp)) {
- $this->template->_tpl_include($temp, false);
- }
- break;
-
- case 'INCLUDEPHP':
- $compile_blocks[] = 'compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>';
- break;
-
- case 'PHP':
- $compile_blocks[] = '';
- break;
-
- default:
- $this->compile_var_tags($block_val[0]);
- $trim_check = trim($block_val[0]);
- $compile_blocks[] = (!$no_echo) ? ((!empty($trim_check)) ? $block_val[0] : '') : ((!empty($trim_check)) ? $block_val[0] : '');
- break;
- }
- }
-
- $template_php = '';
- for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++) {
- $trim_check_text = trim($text_blocks[$i]);
- $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
- }
-
- // There will be a number of occasions where we switch into and out of
- // PHP mode instantaneously. Rather than "burden" the parser with this
- // we'll strip out such occurences, minimising such switching
- $template_php = str_replace(' ?>generate_block_varref($namespace, $varname, true, $var_val[2]);
-
- $text_blocks = str_replace($var_val[0], $new, $text_blocks);
- }
-
- // check for language stings
- if (strpos($text_blocks, '{L_') !== false) {
- $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$MSG['\\1'])) ? \$MSG['\\1'] : '{ L_\\1 }')); ?>", $text_blocks);
- }
-
- // check for url stings
- if (strpos($text_blocks, '{URL_') !== false) {
- $text_blocks = preg_replace('#\{URL_([a-z0-9\-_=&]*)\}#is', "_rootref['URL_\\1'])) ? \$this->_rootref['URL_\\1'] : build_url(\\1)); ?>", $text_blocks);
- }
-
-
- // Handle remaining varrefs dont use htmlentities
- $text_blocks = preg_replace('#\{([a-z0-9_-]+)\|e\}#is', "_rootref['\\1'])) ? htmlentities(\$this->_rootref['\\1']) : ''; ?>", $text_blocks);
- $text_blocks = preg_replace('#\{([a-z0-9_-]+)\(([a-z0-9]+)\)\|e\}#is', "_rootref['\\1'][\\2])) ? htmlentities(\$this->_rootref['\\1'][\\2]) : ''; ?>", $text_blocks);
- $text_blocks = preg_replace('#\{\$([a-z0-9_-]+)\|e\}#is', "_tpldata['DEFINE']['.']['\\1'])) ? htmlentities(\$this->_tpldata['DEFINE']['.']['\\1']) : ''; ?>", $text_blocks);
-
- // Handle remaining varrefs do use htmlentities
- $text_blocks = preg_replace('#\{([a-z0-9_-]+)\}#is', "_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks);
- $text_blocks = preg_replace('#\{([a-z0-9_-]+)\(([a-z0-9]+)\)\}#is', "_rootref['\\1'][\\2])) ? \$this->_rootref['\\1'][\\2] : ''; ?>", $text_blocks);
- $text_blocks = preg_replace('#\{\$([a-z0-9_-]+)\}#is', "_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
-
- return;
- }
-
- /**
- * Compile blocks
- * @access private
- */
- public function compile_tag_block($tag_args)
- {
- $no_nesting = false;
-
- // Is the designer wanting to call another loop in a loop?
- if (strpos($tag_args, '!') === 0) {
- // Count the number if ! occurrences (not allowed in vars)
- $no_nesting = substr_count($tag_args, '!');
- $tag_args = substr($tag_args, $no_nesting);
- }
-
- // Allow for control of looping (indexes start from zero):
- // foo(2) : Will start the loop on the 3rd entry
- // foo(-2) : Will start the loop two entries from the end
- // foo(3,4) : Will start the loop on the fourth entry and end it on the fifth
- // foo(3,-4) : Will start the loop on the fourth entry and end it four from last
- if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match)) {
- $tag_args = $match[1];
-
- if ($match[2] < 0) {
- $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
- } else {
- $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
- }
-
- if (strlen($match[3]) < 1 || $match[3] == -1) {
- $loop_end = '$_' . $tag_args . '_count';
- } elseif ($match[3] >= 0) {
- $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
- } else { //if ($match[3] < -1)
- $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
- }
- } else {
- $loop_start = 0;
- $loop_end = '$_' . $tag_args . '_count';
- }
-
- $tag_template_php = '';
- array_push($this->block_names, $tag_args);
-
- if ($no_nesting !== false) {
- // We need to implode $no_nesting times from the end...
- $block = array_slice($this->block_names, -$no_nesting);
- } else {
- $block = $this->block_names;
- }
-
- if (sizeof($block) < 2) {
- // Block is not nested.
- $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
- $varref = "\$this->_tpldata['$tag_args']";
- } else {
- // This block is nested.
- // Generate a namespace string for this block.
- $namespace = implode('.', $block);
-
- // Get a reference to the data array for this block that depends on the
- // current indices of all parent blocks.
- $varref = $this->generate_block_data_ref($namespace, false);
-
- // Create the for loop code to iterate over this block.
- $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
- }
-
- $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
-
- /**
- * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
- *
- * if (!$offset)
- * {
- * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
- * }
- *
- */
-
- $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
- $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
-
- return $tag_template_php;
- }
-
- /**
- * Compile IF tags - much of this is from Smarty with
- * some adaptions for our block level methods
- * @access private
- */
- public function compile_tag_if($tag_args, $elseif)
- {
- // Tokenize args for 'if' tag.
- preg_match_all('/(?:
+ var $template;
+
+ // Various storage arrays
+ var $block_names = array();
+ var $block_else_level = array();
+
+ /**
+ * constuctor
+ */
+ function __construct(&$template)
+ {
+ $this->template = &$template;
+ }
+
+ /**
+ * Load template source from file
+ * @access private
+ */
+ function _tpl_load_file($handle, $store_in_db = false)
+ {
+ global $_SESSION;
+
+ // Try and open template for read
+ if (!file_exists($this->template->files[$handle]))
+ {
+ trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
+ }
+
+ $this->template->compiled_code[$handle] = $this->compile(trim(@file_get_contents($this->template->files[$handle])));
+
+ // Actually compile the code now.
+ $this->compile_write($handle, $this->template->compiled_code[$handle]);
+ }
+
+ /**
+ * Remove any PHP tags that do not belong, these regular expressions are derived from
+ * the ones that exist in zend_language_scanner.l
+ * @access private
+ */
+ function remove_php_tags(&$code)
+ {
+ // This matches the information gathered from the internal PHP lexer
+ $match = array(
+ '#<([\?%])=?.*?\1>#s',
+ '##s',
+ '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s'
+ );
+
+ $code = preg_replace($match, '', $code);
+ }
+
+ /**
+ * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
+ * @access private
+ */
+ function compile($code, $no_echo = false, $echo_var = '')
+ {
+ if ($echo_var)
+ {
+ global $$echo_var;
+ }
+
+ // Remove any "loose" php ... we want to give admins the ability
+ // to switch on/off PHP for a given template. Allowing unchecked
+ // php is a no-no. There is a potential issue here in that non-php
+ // content may be removed ... however designers should use entities
+ // if they wish to display < and >
+ $this->remove_php_tags($code);
+
+ // Pull out all block/statement level elements and separate plain text
+ preg_match_all('#(.*?)#s', $code, $matches);
+ $php_blocks = $matches[1];
+ $code = preg_replace('#.*?#s', '', $code);
+
+ preg_match_all('##', $code, $matches);
+ $include_blocks = $matches[1];
+ $code = preg_replace('##', '', $code);
+
+ preg_match_all('##', $code, $matches);
+ $includephp_blocks = $matches[1];
+ $code = preg_replace('##', '', $code);
+
+ preg_match_all('##', $code, $blocks, PREG_SET_ORDER);
+
+ $text_blocks = preg_split('##', $code);
+
+ for ($i = 0, $j = sizeof($text_blocks); $i < $j; $i++)
+ {
+ $this->compile_var_tags($text_blocks[$i]);
+ }
+ $compile_blocks = array();
+
+ for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++)
+ {
+ $block_val = &$blocks[$curr_tb];
+
+ switch ($block_val[1])
+ {
+ case 'BEGIN':
+ $this->block_else_level[] = false;
+ $compile_blocks[] = 'compile_tag_block($block_val[2]) . ' ?>';
+ break;
+
+ case 'BEGINELSE':
+ $this->block_else_level[sizeof($this->block_else_level) - 1] = true;
+ $compile_blocks[] = '';
+ break;
+
+ case 'END':
+ array_pop($this->block_names);
+ $compile_blocks[] = 'block_else_level)) ? '}' : '}}') . ' ?>';
+ break;
+
+ case 'IF':
+ $compile_blocks[] = 'compile_tag_if ($block_val[2], false) . ' ?>';
+ break;
+
+ case 'ELSE':
+ $compile_blocks[] = '';
+ break;
+
+ case 'ELSEIF':
+ $compile_blocks[] = 'compile_tag_if ($block_val[2], true) . ' ?>';
+ break;
+
+ case 'ENDIF':
+ $compile_blocks[] = '';
+ break;
+
+ case 'DEFINE':
+ $compile_blocks[] = 'compile_tag_define($block_val[2], true) . ' ?>';
+ break;
+
+ case 'UNDEFINE':
+ $compile_blocks[] = 'compile_tag_define($block_val[2], false) . ' ?>';
+ break;
+
+ case 'INCLUDE':
+ $temp = array_shift($include_blocks);
+ $compile_blocks[] = 'compile_tag_include($temp) . ' ?>';
+ // dont check variable file includes
+ if (!preg_match('#\{([a-z0-9_-]+)\}#is', $temp))
+ {
+ $this->template->_tpl_include($temp, false);
+ }
+ break;
+
+ case 'INCLUDEPHP':
+ $compile_blocks[] = 'compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>';
+ break;
+
+ case 'PHP':
+ $compile_blocks[] = '';
+ break;
+
+ default:
+ $this->compile_var_tags($block_val[0]);
+ $trim_check = trim($block_val[0]);
+ $compile_blocks[] = (!$no_echo) ? ((!empty($trim_check)) ? $block_val[0] : '') : ((!empty($trim_check)) ? $block_val[0] : '');
+ break;
+ }
+ }
+
+ $template_php = '';
+ for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++)
+ {
+ $trim_check_text = trim($text_blocks[$i]);
+ $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
+ }
+
+ // There will be a number of occasions where we switch into and out of
+ // PHP mode instantaneously. Rather than "burden" the parser with this
+ // we'll strip out such occurences, minimising such switching
+ $template_php = str_replace(' ?>generate_block_varref($namespace, $varname, true, $var_val[2]);
+
+ $text_blocks = str_replace($var_val[0], $new, $text_blocks);
+ }
+
+ // check for language stings
+ if (strpos($text_blocks, '{L_') !== false)
+ {
+ $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*)\}#is', "_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$MSG['\\1'])) ? \$MSG['\\1'] : '{ L_\\1 }')); ?>", $text_blocks);
+ }
+
+ // check for url stings
+ if (strpos($text_blocks, '{URL_') !== false)
+ {
+ $text_blocks = preg_replace('#\{URL_([a-z0-9\-_=&]*)\}#is', "_rootref['URL_\\1'])) ? \$this->_rootref['URL_\\1'] : build_url(\\1)); ?>", $text_blocks);
+ }
+
+
+ // Handle remaining varrefs dont use htmlentities
+ $text_blocks = preg_replace('#\{([a-z0-9_-]+)\|e\}#is', "_rootref['\\1'])) ? htmlentities(\$this->_rootref['\\1']) : ''; ?>", $text_blocks);
+ $text_blocks = preg_replace('#\{([a-z0-9_-]+)\(([a-z0-9]+)\)\|e\}#is', "_rootref['\\1'][\\2])) ? htmlentities(\$this->_rootref['\\1'][\\2]) : ''; ?>", $text_blocks);
+ $text_blocks = preg_replace('#\{\$([a-z0-9_-]+)\|e\}#is', "_tpldata['DEFINE']['.']['\\1'])) ? htmlentities(\$this->_tpldata['DEFINE']['.']['\\1']) : ''; ?>", $text_blocks);
+
+ // Handle remaining varrefs do use htmlentities
+ $text_blocks = preg_replace('#\{([a-z0-9_-]+)\}#is', "_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks);
+ $text_blocks = preg_replace('#\{([a-z0-9_-]+)\(([a-z0-9]+)\)\}#is', "_rootref['\\1'][\\2])) ? \$this->_rootref['\\1'][\\2] : ''; ?>", $text_blocks);
+ $text_blocks = preg_replace('#\{\$([a-z0-9_-]+)\}#is', "_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
+
+ return;
+ }
+
+ /**
+ * Compile blocks
+ * @access private
+ */
+ function compile_tag_block($tag_args)
+ {
+ $no_nesting = false;
+
+ // Is the designer wanting to call another loop in a loop?
+ if (strpos($tag_args, '!') === 0)
+ {
+ // Count the number if ! occurrences (not allowed in vars)
+ $no_nesting = substr_count($tag_args, '!');
+ $tag_args = substr($tag_args, $no_nesting);
+ }
+
+ // Allow for control of looping (indexes start from zero):
+ // foo(2) : Will start the loop on the 3rd entry
+ // foo(-2) : Will start the loop two entries from the end
+ // foo(3,4) : Will start the loop on the fourth entry and end it on the fifth
+ // foo(3,-4) : Will start the loop on the fourth entry and end it four from last
+ if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match))
+ {
+ $tag_args = $match[1];
+
+ if ($match[2] < 0)
+ {
+ $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
+ }
+ else
+ {
+ $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
+ }
+
+ if (strlen($match[3]) < 1 || $match[3] == -1)
+ {
+ $loop_end = '$_' . $tag_args . '_count';
+ }
+ else if ($match[3] >= 0)
+ {
+ $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
+ }
+ else //if ($match[3] < -1)
+ {
+ $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
+ }
+ }
+ else
+ {
+ $loop_start = 0;
+ $loop_end = '$_' . $tag_args . '_count';
+ }
+
+ $tag_template_php = '';
+ array_push($this->block_names, $tag_args);
+
+ if ($no_nesting !== false)
+ {
+ // We need to implode $no_nesting times from the end...
+ $block = array_slice($this->block_names, -$no_nesting);
+ }
+ else
+ {
+ $block = $this->block_names;
+ }
+
+ if (sizeof($block) < 2)
+ {
+ // Block is not nested.
+ $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
+ $varref = "\$this->_tpldata['$tag_args']";
+ }
+ else
+ {
+ // This block is nested.
+ // Generate a namespace string for this block.
+ $namespace = implode('.', $block);
+
+ // Get a reference to the data array for this block that depends on the
+ // current indices of all parent blocks.
+ $varref = $this->generate_block_data_ref($namespace, false);
+
+ // Create the for loop code to iterate over this block.
+ $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
+ }
+
+ $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
+
+ /**
+ * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
+ *
+ * if (!$offset)
+ * {
+ * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
+ * }
+ *
+ */
+
+ $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
+ $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
+
+ return $tag_template_php;
+ }
+
+ /**
+ * Compile IF tags - much of this is from Smarty with
+ * some adaptions for our block level methods
+ * @access private
+ */
+ function compile_tag_if ($tag_args, $elseif)
+ {
+ // Tokenize args for 'if' tag.
+ preg_match_all('/(?:
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
[(),] |
[^\s(),]+)/x', $tag_args, $match);
- $tokens = $match[0];
- $is_arg_stack = array();
-
- for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) {
- $token = &$tokens[$i];
-
- switch ($token) {
- case '!==':
- case '===':
- case '<<':
- case '>>':
- case '|':
- case '^':
- case '&':
- case '~':
- case ')':
- case ',':
- case '+':
- case '-':
- case '*':
- case '/':
- case '@':
- break;
-
- case '==':
- case 'eq':
- $token = '==';
- break;
-
- case '!=':
- case '<>':
- case 'ne':
- case 'neq':
- $token = '!=';
- break;
-
- case '<':
- case 'lt':
- $token = '<';
- break;
-
- case '<=':
- case 'le':
- case 'lte':
- $token = '<=';
- break;
-
- case '>':
- case 'gt':
- $token = '>';
- break;
-
- case '>=':
- case 'ge':
- case 'gte':
- $token = '>=';
- break;
-
- case '&&':
- case 'and':
- $token = '&&';
- break;
-
- case '||':
- case 'or':
- $token = '||';
- break;
-
- case '!':
- case 'not':
- $token = '!';
- break;
-
- case '%':
- case 'mod':
- $token = '%';
- break;
-
- case 'NULL':
- case 'null':
- $token = 'NULL';
- break;
-
- case '(':
- array_push($is_arg_stack, $i);
- break;
-
- case 'is':
- $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
- $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
-
- $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
-
- array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
-
- $i = $is_arg_start;
-
- // no break
-
- default:
- if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs)) {
- $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
- // check if array variable
- /* attempt to get array ifs to work
- if (isset($tokens[$i + 3]) && $tokens[$i + 1] == '(' && $tokens[$i + 3] == ')')
- {
- $token .= "['" . $tokens[$i + 2] . "']";
- $i = $i + 3;
- }
- */
- } elseif (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) {
- // Allow checking if loops are set with .loopname
- // It is also possible to check the loop count by doing for example
- $blocks = explode('.', $varrefs[1]);
-
- // If the block is nested, we have a reference that we can grab.
- // If the block is not nested, we just go and grab the block from _tpldata
- if (sizeof($blocks) > 1) {
- $block = array_pop($blocks);
- $namespace = implode('.', $blocks);
- $varref = $this->generate_block_data_ref($namespace, true);
-
- // Add the block reference for the last child.
- $varref .= "['" . $block . "']";
- } else {
- $varref = '$this->_tpldata';
-
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[0] . "']";
- }
-
- $token = "sizeof($varref)";
- } elseif (!empty($token)) {
- $token = '(' . $token . ')';
- }
-
- break;
- }
- }
-
- // If there are no valid tokens left or only control/compare characters left, we do skip this statement
- if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '') {
- $tokens = array('false');
- }
- return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
- }
-
- /**
- * Compile DEFINE tags
- * @access private
- */
- public function compile_tag_define($tag_args, $op)
- {
- preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
-
- if (empty($match[2]) || (!isset($match[4]) && $op)) {
- return '';
- }
-
- if (!$op) {
- return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
- }
-
- // Are we a string?
- if ($match[3] && $match[5]) {
- $match[4] = str_replace(array('\\\'', '\\\\', '\''), array('\'', '\\', '\\\''), $match[4]);
-
- // Compile reference, we allow template variables in defines...
- $match[4] = $this->compile($match[4]);
-
- // Now replace the php code
- $match[4] = "'" . str_replace(array(''), array("' . ", " . '"), $match[4]) . "'";
- } else {
- preg_match('#true|false|\.#i', $match[4], $type);
-
- switch (strtolower($type[0])) {
- case 'true':
- case 'false':
- $match[4] = strtoupper($match[4]);
- break;
-
- case '.':
- $match[4] = floatval($match[4]);
- break;
-
- default:
- $match[4] = intval($match[4]);
- break;
- }
- }
-
- return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
- }
-
- /**
- * Compile INCLUDE tag
- * @access private
- */
- public function compile_tag_include($tag_args)
- {
- // add variables
- preg_match_all('#\{([a-z0-9_-]+)\}#is', $tag_args, $matches);
- if (count($matches[0]) > 0) {
- for ($i = 0, $count = count($matches[1]); $i < $count; $i++) {
- $tag_args = str_replace($matches[0][$i], "' . ((isset(\$this->_rootref['" . $matches[1][$i] . "'])) ? \$this->_rootref['" . $matches[1][$i] . "'] : '') . '", $tag_args);
- }
- }
- return "\$this->_tpl_include('$tag_args');";
- }
-
- /**
- * Compile INCLUDE_PHP tag
- * @access private
- */
- public function compile_tag_include_php($tag_args)
- {
- return "include('" . $tag_args . "');";
- }
-
- /**
- * parse expression
- * This is from Smarty
- * @access private
- */
- public function _parse_is_expr($is_arg, $tokens)
- {
- $expr_end = 0;
- $negate_expr = false;
-
- if (($first_token = array_shift($tokens)) == 'not') {
- $negate_expr = true;
- $expr_type = array_shift($tokens);
- } else {
- $expr_type = $first_token;
- }
-
- switch ($expr_type) {
- case 'even':
- if (@$tokens[$expr_end] == 'by') {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
- } else {
- $expr = "!($is_arg & 1)";
- }
- break;
-
- case 'odd':
- if (@$tokens[$expr_end] == 'by') {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "(($is_arg / $expr_arg) % $expr_arg)";
- } else {
- $expr = "($is_arg & 1)";
- }
- break;
-
- case 'div':
- if (@$tokens[$expr_end] == 'by') {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "!($is_arg % $expr_arg)";
- }
- break;
- }
-
- if ($negate_expr) {
- $expr = "!($expr)";
- }
-
- array_splice($tokens, 0, $expr_end, $expr);
-
- return $tokens;
- }
-
- /**
- * Generates a reference to the given variable inside the given (possibly nested)
- * block namespace. This is a string of the form:
- * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
- * It's ready to be inserted into an "echo" line in one of the templates.
- * NOTE: expects a trailing "." on the namespace.
- * @access private
- */
- public function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
- {
- // Strip the trailing period.
- $namespace = substr($namespace, 0, -1);
-
- // Get a reference to the data block for this namespace.
- $varref = $this->generate_block_data_ref($namespace, true, $defop);
- // Prepend the necessary code to stick this in an echo line.
-
- // Append the variable reference.
- $varref .= "['$varname']";
- $varref = ($echo) ? "" : ((isset($varref)) ? $varref : '');
-
- return $varref;
- }
-
- /**
- * Generates a reference to the array of data values for the given
- * (possibly nested) block namespace. This is a string of the form:
- * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
- *
- * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
- * NOTE: does not expect a trailing "." on the blockname.
- * @access private
- */
- public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
- {
- // Get an array of the blocks involved.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
-
- // DEFINE is not an element of any referenced variable, we must use _tpldata to access it
- if ($defop) {
- $varref = '$this->_tpldata[\'DEFINE\']';
- // Build up the string with everything but the last child.
- for ($i = 0; $i < $blockcount; $i++) {
- $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
- }
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[$blockcount] . "']";
- // Add the iterator for the last child if requried.
- if ($include_last_iterator) {
- $varref .= '[$_' . $blocks[$blockcount] . '_i]';
- }
- return $varref;
- } elseif ($include_last_iterator) {
- return '$_'. $blocks[$blockcount] . '_val';
- } else {
- return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
- }
- }
-
- /**
- * Write compiled file to cache directory
- * @access private
- */
- public function compile_write($handle, $data)
- {
- $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.php';
-
- if ($fp = @fopen($filename, 'wb')) {
- @flock($fp, LOCK_EX);
- @fwrite($fp, $data);
- @flock($fp, LOCK_UN);
- @fclose($fp);
- }
-
- return;
- }
+ $tokens = $match[0];
+ $is_arg_stack = array();
+
+ for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
+ {
+ $token = &$tokens[$i];
+
+ switch ($token)
+ {
+ case '!==':
+ case '===':
+ case '<<':
+ case '>>':
+ case '|':
+ case '^':
+ case '&':
+ case '~':
+ case ')':
+ case ',':
+ case '+':
+ case '-':
+ case '*':
+ case '/':
+ case '@':
+ break;
+
+ case '==':
+ case 'eq':
+ $token = '==';
+ break;
+
+ case '!=':
+ case '<>':
+ case 'ne':
+ case 'neq':
+ $token = '!=';
+ break;
+
+ case '<':
+ case 'lt':
+ $token = '<';
+ break;
+
+ case '<=':
+ case 'le':
+ case 'lte':
+ $token = '<=';
+ break;
+
+ case '>':
+ case 'gt':
+ $token = '>';
+ break;
+
+ case '>=':
+ case 'ge':
+ case 'gte':
+ $token = '>=';
+ break;
+
+ case '&&':
+ case 'and':
+ $token = '&&';
+ break;
+
+ case '||':
+ case 'or':
+ $token = '||';
+ break;
+
+ case '!':
+ case 'not':
+ $token = '!';
+ break;
+
+ case '%':
+ case 'mod':
+ $token = '%';
+ break;
+
+ case 'NULL':
+ case 'null':
+ $token = 'NULL';
+ break;
+
+ case '(':
+ array_push($is_arg_stack, $i);
+ break;
+
+ case 'is':
+ $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
+ $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
+
+ $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
+
+ array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
+
+ $i = $is_arg_start;
+
+ // no break
+
+ default:
+ if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs))
+ {
+ $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
+ // check if array variable
+ /* attempt to get array ifs to work
+ if (isset($tokens[$i + 3]) && $tokens[$i + 1] == '(' && $tokens[$i + 3] == ')')
+ {
+ $token .= "['" . $tokens[$i + 2] . "']";
+ $i = $i + 3;
+ }
+ */
+ }
+ else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
+ {
+ // Allow checking if loops are set with .loopname
+ // It is also possible to check the loop count by doing for example
+ $blocks = explode('.', $varrefs[1]);
+
+ // If the block is nested, we have a reference that we can grab.
+ // If the block is not nested, we just go and grab the block from _tpldata
+ if (sizeof($blocks) > 1)
+ {
+ $block = array_pop($blocks);
+ $namespace = implode('.', $blocks);
+ $varref = $this->generate_block_data_ref($namespace, true);
+
+ // Add the block reference for the last child.
+ $varref .= "['" . $block . "']";
+ }
+ else
+ {
+ $varref = '$this->_tpldata';
+
+ // Add the block reference for the last child.
+ $varref .= "['" . $blocks[0] . "']";
+ }
+
+ $token = "sizeof($varref)";
+ }
+ else if (!empty($token))
+ {
+ $token = '(' . $token . ')';
+ }
+
+ break;
+ }
+ }
+
+ // If there are no valid tokens left or only control/compare characters left, we do skip this statement
+ if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '')
+ {
+ $tokens = array('false');
+ }
+ return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
+ }
+
+ /**
+ * Compile DEFINE tags
+ * @access private
+ */
+ function compile_tag_define($tag_args, $op)
+ {
+ preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
+
+ if (empty($match[2]) || (!isset($match[4]) && $op))
+ {
+ return '';
+ }
+
+ if (!$op)
+ {
+ return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
+ }
+
+ // Are we a string?
+ if ($match[3] && $match[5])
+ {
+ $match[4] = str_replace(array('\\\'', '\\\\', '\''), array('\'', '\\', '\\\''), $match[4]);
+
+ // Compile reference, we allow template variables in defines...
+ $match[4] = $this->compile($match[4]);
+
+ // Now replace the php code
+ $match[4] = "'" . str_replace(array(''), array("' . ", " . '"), $match[4]) . "'";
+ }
+ else
+ {
+ preg_match('#true|false|\.#i', $match[4], $type);
+
+ switch (strtolower($type[0]))
+ {
+ case 'true':
+ case 'false':
+ $match[4] = strtoupper($match[4]);
+ break;
+
+ case '.':
+ $match[4] = floatval($match[4]);
+ break;
+
+ default:
+ $match[4] = intval($match[4]);
+ break;
+ }
+ }
+
+ return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
+ }
+
+ /**
+ * Compile INCLUDE tag
+ * @access private
+ */
+ function compile_tag_include($tag_args)
+ {
+ // add variables
+ preg_match_all('#\{([a-z0-9_-]+)\}#is', $tag_args, $matches);
+ if (count($matches[0]) > 0)
+ {
+ for ($i = 0, $count = count($matches[1]); $i < $count; $i++)
+ {
+ $tag_args = str_replace($matches[0][$i], "' . ((isset(\$this->_rootref['" . $matches[1][$i] . "'])) ? \$this->_rootref['" . $matches[1][$i] . "'] : '') . '", $tag_args);
+ }
+ }
+ return "\$this->_tpl_include('$tag_args');";
+ }
+
+ /**
+ * Compile INCLUDE_PHP tag
+ * @access private
+ */
+ function compile_tag_include_php($tag_args)
+ {
+ return "include('" . $tag_args . "');";
+ }
+
+ /**
+ * parse expression
+ * This is from Smarty
+ * @access private
+ */
+ function _parse_is_expr($is_arg, $tokens)
+ {
+ $expr_end = 0;
+ $negate_expr = false;
+
+ if (($first_token = array_shift($tokens)) == 'not')
+ {
+ $negate_expr = true;
+ $expr_type = array_shift($tokens);
+ }
+ else
+ {
+ $expr_type = $first_token;
+ }
+
+ switch ($expr_type)
+ {
+ case 'even':
+ if (@$tokens[$expr_end] == 'by')
+ {
+ $expr_end++;
+ $expr_arg = $tokens[$expr_end++];
+ $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
+ }
+ else
+ {
+ $expr = "!($is_arg & 1)";
+ }
+ break;
+
+ case 'odd':
+ if (@$tokens[$expr_end] == 'by')
+ {
+ $expr_end++;
+ $expr_arg = $tokens[$expr_end++];
+ $expr = "(($is_arg / $expr_arg) % $expr_arg)";
+ }
+ else
+ {
+ $expr = "($is_arg & 1)";
+ }
+ break;
+
+ case 'div':
+ if (@$tokens[$expr_end] == 'by')
+ {
+ $expr_end++;
+ $expr_arg = $tokens[$expr_end++];
+ $expr = "!($is_arg % $expr_arg)";
+ }
+ break;
+ }
+
+ if ($negate_expr)
+ {
+ $expr = "!($expr)";
+ }
+
+ array_splice($tokens, 0, $expr_end, $expr);
+
+ return $tokens;
+ }
+
+ /**
+ * Generates a reference to the given variable inside the given (possibly nested)
+ * block namespace. This is a string of the form:
+ * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
+ * It's ready to be inserted into an "echo" line in one of the templates.
+ * NOTE: expects a trailing "." on the namespace.
+ * @access private
+ */
+ function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
+ {
+ // Strip the trailing period.
+ $namespace = substr($namespace, 0, -1);
+
+ // Get a reference to the data block for this namespace.
+ $varref = $this->generate_block_data_ref($namespace, true, $defop);
+ // Prepend the necessary code to stick this in an echo line.
+
+ // Append the variable reference.
+ $varref .= "['$varname']";
+ $varref = ($echo) ? "" : ((isset($varref)) ? $varref : '');
+
+ return $varref;
+ }
+
+ /**
+ * Generates a reference to the array of data values for the given
+ * (possibly nested) block namespace. This is a string of the form:
+ * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
+ *
+ * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
+ * NOTE: does not expect a trailing "." on the blockname.
+ * @access private
+ */
+ function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
+ {
+ // Get an array of the blocks involved.
+ $blocks = explode('.', $blockname);
+ $blockcount = sizeof($blocks) - 1;
+
+ // DEFINE is not an element of any referenced variable, we must use _tpldata to access it
+ if ($defop)
+ {
+ $varref = '$this->_tpldata[\'DEFINE\']';
+ // Build up the string with everything but the last child.
+ for ($i = 0; $i < $blockcount; $i++)
+ {
+ $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
+ }
+ // Add the block reference for the last child.
+ $varref .= "['" . $blocks[$blockcount] . "']";
+ // Add the iterator for the last child if requried.
+ if ($include_last_iterator)
+ {
+ $varref .= '[$_' . $blocks[$blockcount] . '_i]';
+ }
+ return $varref;
+ }
+ else if ($include_last_iterator)
+ {
+ return '$_'. $blocks[$blockcount] . '_val';
+ }
+ else
+ {
+ return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
+ }
+ }
+
+ /**
+ * Write compiled file to cache directory
+ * @access private
+ */
+ function compile_write($handle, $data)
+ {
+ $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.php';
+
+ if ($fp = @fopen($filename, 'wb'))
+ {
+ @flock($fp, LOCK_EX);
+ @fwrite ($fp, $data);
+ @flock($fp, LOCK_UN);
+ @fclose($fp);
+ }
+
+ return;
+ }
}
diff --git a/includes/user_cp.php b/includes/user_cp.php
old mode 100644
new mode 100755
index 3183739bd..af2f123ce
--- a/includes/user_cp.php
+++ b/includes/user_cp.php
@@ -1,6 +1,6 @@
assign_vars(array(
- 'B_ISERROR' => (!empty($ERR)),
- 'B_MENUTITLE' => (!empty($TMP_usmenutitle)),
- 'UCP_ERROR' => (isset($ERR)) ? $ERR : '',
- 'UCP_TITLE' => (isset($TMP_usmenutitle)) ? $TMP_usmenutitle : ''
-));
+ 'B_ISERROR' => (!empty($ERR)),
+ 'B_MENUTITLE' => (!empty($TMP_usmenutitle)),
+ 'UCP_ERROR' => (isset($ERR)) ? $ERR : '',
+ 'UCP_TITLE' => (isset($TMP_usmenutitle)) ? $TMP_usmenutitle : ''
+));
\ No newline at end of file
diff --git a/index.php b/index.php
old mode 100644
new mode 100755
index 994f00ced..26bc1b023
--- a/index.php
+++ b/index.php
@@ -1,7 +1,7 @@
SETTINGS['cron'] == 2) {
include_once 'cron.php';
}
-function ShowFlags()
-{
+
+
+function ShowFlags() {
global $system, $LANGUAGES;
$counter = 0;
$flags = '';
@@ -30,7 +31,15 @@ function ShowFlags()
$flags .= ' ';
$counter = 0;
}
- $flags .= ' ';
+ $flags .= '
+
+
+ ';
$counter++;
}
return $flags;
@@ -49,9 +58,9 @@ function ShowFlags()
$parent_id = $db->result('cat_id');
$query = "SELECT * FROM " . $DBPrefix . "categories
- WHERE parent_id = :parent_id
- " . $catsorting . "
- LIMIT :limit";
+WHERE parent_id = :parent_id
+" . $catsorting . "
+LIMIT :limit";
$params = array();
$params[] = array(':parent_id', $parent_id, 'int');
$params[] = array(':limit', $system->SETTINGS['catstoshow'], 'int');
@@ -70,127 +79,125 @@ function ShowFlags()
foreach ($cat_strings as $cat_id => $category_name) {
$row = $categories[$cat_id];
$template->assign_block_vars('cat_list', array(
- 'CATAUCNUM' => ($row['sub_counter'] != 0) ? $row['sub_counter'] : '',
- 'ID' => $row['cat_id'],
- 'IMAGE' => (!empty($row['cat_image'])) ? ' ' : '',
- 'COLOUR' => (empty($row['cat_colour'])) ? '#FFFFFF' : $row['cat_colour'],
- 'NAME' => $category_names[$row['cat_id']]
- ));
+ 'CATAUCNUM' => ($row['sub_counter'] != 0) ? $row['sub_counter'] : '',
+ 'ID' => $row['cat_id'],
+ 'IMAGE' => (!empty($row['cat_image'])) ? ' ' : '',
+ 'COLOUR' => (empty($row['cat_colour'])) ? '#FFFFFF' : $row['cat_colour'],
+ 'NAME' => $category_names[$row['cat_id']]
+ ));
}
-// get featured items
-$query = "SELECT id, title, current_bid, pict_url, ends, num_bids, minimum_bid, bn_only, buy_now
- FROM " . $DBPrefix . "auctions
- WHERE closed = 0 AND suspended = 0 AND starts <= CURRENT_TIMESTAMP
- AND featured = 1
- ORDER BY RAND() DESC LIMIT :limit";
-$params = array();
-$params[] = array(':limit', $system->SETTINGS['homefeaturednumber'], 'int');
-$db->query($query, $params);
+/**
+ * get featured items
+ */
$i = 0;
-while ($row = $db->fetch()) {
- if (strtotime($row['ends']) - time() > 0) {
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
- $ends_string = $dt->formatTimeLeft($difference);
+
+while ($row = Auctions::homeAuctions(1, $now, $system->SETTINGS['homefeaturednumber'])) {
+ $ends = $row['ends'];
+ $difference = $ends - $now;
+ if ($difference > 0) {
+ $ends_string = FormatTimeLeft($difference);
} else {
$ends_string = $MSG['911'];
}
$high_bid = ($row['num_bids'] == 0) ? $row['minimum_bid'] : $row['current_bid'];
$high_bid = ($row['bn_only']) ? $row['buy_now'] : $high_bid;
$template->assign_block_vars('featured', array(
- 'ENDS' => $ends_string,
- 'ID' => $row['id'],
- 'BID' => $system->print_money($high_bid),
- 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'] : '',
- 'TITLE' => htmlspecialchars($row['title'])
- ));
+ 'ENDS' => $ends_string,
+ 'ID' => $row['id'],
+ 'BID' => $system->print_money($high_bid),
+ 'IMAGE' => loadImg($row['pict_url'], $row['id']),
+ 'TITLE' => htmlspecialchars($row['title'])
+ ));
$i++;
}
-
$featured_items = ($i > 0) ? true : false;
-// get last created auctions
-$query = "SELECT id, title, starts from " . $DBPrefix . "auctions
- WHERE closed = 0 AND suspended = 0
- AND starts <= CURRENT_TIMESTAMP
- ORDER BY starts DESC
- LIMIT :limit";
-$params = array();
-$params[] = array(':limit', $system->SETTINGS['lastitemsnumber'], 'int');
-$db->query($query, $params);
+function loadImg(string $pict_url = '', int $id) {
+ $string = 'images/email_alerts/default_item_img.jpg';
+ if (!empty($pict_url)) {
+ $string = 'getthumb.php?w='.$system->SETTINGS['thumb_show'].'&fromfile='.UPLOAD_FOLDER.$id.'/'.$pict_url;
+ }
+ return $string;
+}
+
+
+/**
+ * get last created auctions
+ */
$i = 0;
-while ($row = $db->fetch()) {
+
+while ($row = Auctions::homeAuctions(2, $now, $system->SETTINGS['lastitemsnumber'])) {
$template->assign_block_vars('auc_last', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'DATE' => $dt->printDateTz($row['starts']),
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title'])
- ));
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'DATE' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title'])
+ ));
+ $difference = $row['ends'] - time();
+ if ($difference > 0) {
+ $ends_string = FormatTimeLeft($difference);
+ } else {
+ $ends_string = $MSG['911'];
+ }
+ $template->assign_block_vars('end_soon', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'DATE' => $ends_string,
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title'])
+ ));
$i++;
}
-
$auc_last = ($i > 0) ? true : false;
-// get ending soon auctions
-$query = "SELECT ends, id, title FROM " . $DBPrefix . "auctions
- WHERE closed = 0 AND suspended = 0 AND starts <= CURRENT_TIMESTAMP
- ORDER BY ends LIMIT :limit";
-$params = array();
-$params[] = array(':limit', $system->SETTINGS['endingsoonnumber'], 'int');
-$db->query($query, $params);
+
+/**
+ * get ending soon auctions
+ */
$i = 0;
-while ($row = $db->fetch()) {
- if (strtotime($row['ends']) - time() > 0) {
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
- $ends_string = $dt->formatTimeLeft($difference);
+
+while ($row = Auctions::homeAuctions(3, $now, $system->SETTINGS['endingsoonnumber'])) {
+ $difference = $row['ends'] - time();
+ if ($difference > 0) {
+ $ends_string = FormatTimeLeft($difference);
} else {
$ends_string = $MSG['911'];
}
$template->assign_block_vars('end_soon', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'DATE' => $ends_string,
- 'ID' => $row['id'],
- 'TITLE' => htmlspecialchars($row['title'])
- ));
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'DATE' => $ends_string,
+ 'ID' => $row['id'],
+ 'TITLE' => htmlspecialchars($row['title'])
+ ));
$i++;
}
-
$end_soon = ($i > 0) ? true : false;
-// get hot items
-$query = "SELECT a.id, a.title, a.current_bid, a.pict_url, a.ends, a.num_bids, a.minimum_bid
- FROM " . $DBPrefix . "auctions a
- LEFT JOIN " . $DBPrefix . "auccounter c ON (a.id = c.auction_id)
- WHERE closed = 0 AND suspended = 0 AND starts <= CURRENT_TIMESTAMP
- ORDER BY c.counter DESC LIMIT :limit";
-$params = array();
-$params[] = array(':limit', $system->SETTINGS['hotitemsnumber'], 'int');
-$db->query($query, $params);
+
+/**
+ * get hot items
+ */
$i = 0;
-while ($row = $db->fetch()) {
+
+while ($row = Auctions::hotItem($now, $system->SETTINGS['hotitemsnumber'])) {
$i++;
- if (strtotime($row['ends']) - time() > 0) {
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($row['ends'], $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
- $ends_string = $dt->formatTimeLeft($difference);
+ $ends = $row['ends'];
+ $difference = $ends - $now;
+ if ($difference > 0) {
+ $ends_string = FormatTimeLeft($difference);
} else {
$ends_string = $MSG['911'];
}
$high_bid = ($row['num_bids'] == 0) ? $row['minimum_bid'] : $row['current_bid'];
$template->assign_block_vars('hotitems', array(
- 'ENDS' => $ends_string,
- 'ID' => $row['id'],
- 'BID' => $system->print_money($high_bid),
- 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'] : '',
- 'TITLE' => htmlspecialchars($row['title'])
- ));
+ 'ENDS' => $ends_string,
+ 'ID' => $row['id'],
+ 'BID' => $system->print_money($high_bid),
+ 'IMAGE' => loadImg($row['pict_url'], $row['id']),
+ 'TITLE' => htmlspecialchars($row['title'])
+ ));
}
$hot_items = ($i > 0) ? true : false;
@@ -201,50 +208,51 @@ function ShowFlags()
$db->query($query, $params);
$i = 0;
-while ($faqscat = $db->fetch()) {
- $template->assign_block_vars('helpbox', array(
- 'ID' => $faqscat['id'],
- 'TITLE' => $faqscat['category']
- ));
- $i++;
+while ($faqscat = $db->fetch())
+{
+$template->assign_block_vars('helpbox', array(
+'ID' => $faqscat['id'],
+'TITLE' => $faqscat['category']
+));
+$i++;
}
$helpbox = ($i > 0) ? true : false;
// Build news list
if ($system->SETTINGS['newsbox'] == 1) {
$query = "SELECT n.title As t, n.new_date, t.* FROM " . $DBPrefix . "news n
- LEFT JOIN " . $DBPrefix . "news_translated t ON (t.id = n.id)
- WHERE t.lang = :language AND n.suspended = 0
- ORDER BY new_date DESC, id DESC LIMIT :limit";
+ LEFT JOIN " . $DBPrefix . "news_translated t ON (t.id = n.id)
+ WHERE t.lang = :language AND n.suspended = 0
+ ORDER BY new_date DESC, id DESC LIMIT :limit";
$params = array();
$params[] = array(':language', $language, 'str');
$params[] = array(':limit', $system->SETTINGS['newstoshow'], 'int');
$db->query($query, $params);
while ($new = $db->fetch()) {
$template->assign_block_vars('newsbox', array(
- 'ID' => $new['id'],
- 'DATE' => $dt->formatDate($new['new_date']),
- 'TITLE' => (!empty($new['title'])) ? htmlspecialchars($new['title']) : htmlspecialchars($new['t'])
- ));
+ 'ID' => $new['id'],
+ 'DATE' => FormatDate($new['new_date']),
+ 'TITLE' => (!empty($new['title'])) ? htmlspecialchars($new['title']) : htmlspecialchars($new['t'])
+ ));
}
}
$template->assign_vars(array(
- 'FLAGS' => ShowFlags(),
- 'B_FEATURED_ITEMS' => $featured_items,
- 'B_AUC_LAST' => $auc_last,
- 'B_HOT_ITEMS' => $hot_items,
- 'B_AUC_ENDSOON' => $end_soon,
- 'B_HELPBOX' => ($helpbox && $system->SETTINGS['helpbox'] == 1),
- 'B_MULT_LANGS' => (count($LANGUAGES) > 1),
- 'B_LOGIN_BOX' => ($system->SETTINGS['loginbox'] == 1),
- 'B_NEWS_BOX' => ($system->SETTINGS['newsbox'] == 1)
- ));
+ 'FLAGS' => ShowFlags(),
+ 'B_FEATURED_ITEMS' => $featured_items,
+ 'B_AUC_LAST' => $auc_last,
+ 'B_HOT_ITEMS' => $hot_items,
+ 'B_AUC_ENDSOON' => $end_soon,
+ 'B_HELPBOX' => ($helpbox && $system->SETTINGS['helpbox'] == 1),
+ 'B_MULT_LANGS' => (count($LANGUAGES) > 1),
+ 'B_LOGIN_BOX' => ($system->SETTINGS['loginbox'] == 1),
+ 'B_NEWS_BOX' => ($system->SETTINGS['newsbox'] == 1)
+));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'home.tpl'
- ));
+ 'body' => 'home.tpl'
+));
$template->display('body');
include 'footer.php';
diff --git a/install/functions.php b/install/functions.php
deleted file mode 100644
index c0c89d089..000000000
--- a/install/functions.php
+++ /dev/null
@@ -1,435 +0,0 @@
-WeBid Updater, v' . $_SESSION['oldversion'] . ' to v' . $package_version . '';
- } else {
- return 'WeBid Installer v' . $package_version . ' ';
- }
-}
-
-function check_version()
-{
- global $DBPrefix, $settings_version, $db;
-
- // check if using an old version
- if (!isset($settings_version) || empty($settings_version)) {
- if (is_file('../includes/version.txt')) {
- // using a very, very old version
- $version = file_get_contents('../includes/version.txt') or die('error');
- $query = "ALTER TABLE `" . $DBPrefix . "settings` ADD `version` varchar(10) NOT NULL default '" . $version . "'";
- @$db->direct_query($query);
- return $version;
- }
- }
-
- return $settings_version;
-}
-
-function check_installation()
-{
- global $DBPrefix, $settings_version, $db;
-
- if (is_file('../includes/config.inc.php')) {
- include '../includes/config.inc.php';
- $DBPrefix = (isset($DBPrefix)) ? $DBPrefix : '';
- $db->error_supress(true); // we dont want errors returned for now
- if ($db->connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix)) {
- // old method
- $query = "SHOW COLUMNS FROM `" . $DBPrefix . "settings` WHERE `Field` = 'fieldname' OR `Field` = 'version'";
- $db->query($query);
- $settingkeys = $db->fetchall();
- if (count($settingkeys) > 0) {
- if ($settingkeys[0]['Field'] == 'fieldname') {
- $query = "SELECT value FROM `" . $DBPrefix . "settings` WHERE fieldname = 'version'";
- $db->direct_query($query);
- $settings_version = $db->result('value');
- } else {
- $query = "SELECT version FROM `" . $DBPrefix . "settings` LIMIT 1";
- $db->direct_query($query);
- $settings_version = $db->result('version');
- }
- return true;
- }
- }
- }
- return false;
-}
-
-function package_version()
-{
- $string = file_get_contents('thisversion.txt') or die('error');
- return trim($string);
-}
-
-function show_config_table($fresh = true)
-{
- $data = '';
-
- return $data;
-}
-
-function search_cats()
-{
- global $catscontrol;
-
- $catstr = '';
- $root = $catscontrol->get_virtual_root();
- $tree = $catscontrol->display_tree($root['left_id'], $root['right_id'], '|___');
- foreach ($tree as $k => $v) {
- $catstr .= ",\n" . $k . " => '" . $v . "'";
- }
- return $catstr;
-}
-
-function rebuild_cat_file()
-{
- global $system, $DBPrefix, $db;
- $query = "SELECT cat_id, cat_name, parent_id FROM " . $DBPrefix . "categories ORDER BY cat_name";
- $db->direct_query($query);
- $cats = array();
- while ($catarr = $db->fetch()) {
- $cats[$catarr['cat_id']] = $catarr['cat_name'];
- $allcats[] = $catarr;
- }
-
- $output = " $v) {
- $output .= "$k => '$v'";
- $i++;
- if ($i < $num_rows) {
- $output .= ",\n";
- } else {
- $output .= "\n";
- }
- }
-
- $output .= ");\n\n";
-
- $output .= "$" . "category_plain = array(\n0 => ''";
-
- $output .= search_cats();
-
- $output .= ");\n?>";
-
- $handle = fopen(MAIN_PATH . 'language/' . $system->SETTINGS['defaultlanguage'] . '/categories.inc.php', 'w');
- fputs($handle, $output);
-}
-
-function rrmdir($dir)
-{
- if (is_dir($dir)) {
- $objects = scandir($dir);
- foreach ($objects as $object) {
- if ($object != "." && $object != "..") {
- if (is_dir($dir."/".$object)) {
- rrmdir($dir."/".$object);
- } else {
- unlink($dir."/".$object);
- }
- }
- }
- rmdir($dir);
- }
-}
-
-function rmf($f)
-{
- if (file_exists($f)) {
- unlink($f);
- }
-}
diff --git a/install/install.php b/install/install.php
deleted file mode 100644
index a0625bb45..000000000
--- a/install/install.php
+++ /dev/null
@@ -1,145 +0,0 @@
-connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix);
- $from = (isset($_GET['from'])) ? $_GET['from'] : 0;
- $fourth = floor($queries/4);
- $to = (($queries - $from) > 50) ? $from + 50 : $queries;
-
- // if this is a silent install, run all the queries in one go
- if ($silent) {
- $to = $queries;
- } else {
- echo 'Writing to database: ' . floor($to / $queries * 100) . '% Complete ';
- flush();
- }
-
- for ($i = $from; $i < $to; $i++) {
- $db->direct_query($query[$i]);
- }
-
- if (!$silent) {
- if ($i < $queries) {
- echo '';
- } else {
- echo 'Installation complete.
- What do I do now?
-
- Your WeBid password salt: ' . $_SESSION['hash'] . ' You should make note of this random code, it is used to secure your users passwords. It is stored in your config file if you accidently delete this file and don\'t have this code all your users will have to reset their passwords
- Remove the install folder from your server. You will not be able to use WeBid until you do this.
- Finally set-up your admin account here
- And don\'t forget to check out our support forum
- ';
- }
- } else {
- echo 'DONE';
- }
- break;
- case 1:
- $connection_parameters = array('DBHost', 'DBUser', 'DBName');
- $invalid_parameters = false;
- foreach ($connection_parameters as $parameter_name) {
- if (!isset($_POST[$parameter_name]) || empty($_POST[$parameter_name])) {
- $invalid_parameters = true;
- }
- }
-
- if (!$db->connect($_POST['DBHost'], $_POST['DBUser'], $_POST['DBPass'], $_POST['DBName'], $_POST['DBPrefix'])) {
- $invalid_parameters = true;
- }
-
- if ($invalid_parameters) {
- die('Couldn\'t connect to the database.
- What do I do now?
- Please return to step 1 and verify that...
-
- \'Database Host\' is correct.
- \'Database Username\' is correct and that the specified user can access the database.
- \'Database Password\' is correct.
- \'Database Name\' is correct and the specified database exists.
- ');
- }
-
- $cats = (isset($_POST['importcats'])) ? 1 : 0;
-
- if (!$silent) {
- echo 'Step 1: Writing config file...
';
- }
-
- $path = str_replace('\\', '\\\\', $_POST['mainpath']);
- $hash = md5(microtime() . rand(0, 50));
- $_SESSION['hash'] = $hash;
- // generate config file
- $content = '';
- $output = makeconfigfile($content, $path);
-
- if (!$silent) {
- if ($output) {
- $check = check_installation();
- if ($check) {
- echo 'You appear to already have an installation on WeBid running would you like to do a upgrade instead?
';
- }
- echo 'Complete, now to step 2
';
- } else {
- echo 'WeBid could not automatically create the config file, please could you enter the following into config.inc.php (this file is located in the includes directory)
';
- echo '
';
- echo 'Once you\'ve done this, you can continue to step 2
';
- }
- } else {
- echo 'OK';
- }
- break;
- default:
- $check = check_installation();
- if ($check) {
- echo 'You appear to already have an installation on WeBid running would you like to do a upgrade instead?
';
- }
- echo show_config_table(true);
- break;
-}
diff --git a/install/scripts/1.2.2.php b/install/scripts/1.2.2.php
deleted file mode 100644
index 6656f2b0c..000000000
--- a/install/scripts/1.2.2.php
+++ /dev/null
@@ -1,179 +0,0 @@
-direct_query($query);
-$query = "CREATE TABLE `" . $DBPrefix . "temp_install` (
- `id` int(11) NOT NULL auto_increment,
- `table` varchar(20) NOT NULL,
- `table_colomn` varchar(20) NOT NULL,
- `table_id` int(11) NOT NULL,
- `old_value` varchar(255) NOT NULL,
- `new_value` datetime default CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`)
-);";
-$db->direct_query($query);
-
-// adminusers.created date('Ymd')
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "adminusers', 'created', id, created, STR_TO_DATE(created, '%Y%m%d') FROM `" . $DBPrefix . "adminusers`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "adminusers` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "adminusers' AND table_colomn = 'created') src SET dest.created = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "adminusers` MODIFY `created` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// adminusers.lastlogin time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "adminusers', 'lastlogin', id, lastlogin, FROM_UNIXTIME(lastlogin) FROM `" . $DBPrefix . "adminusers`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "adminusers` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "adminusers' AND table_colomn = 'lastlogin') src SET dest.lastlogin = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "adminusers` MODIFY `lastlogin` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// accounts.paid_date time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "accounts', 'paid_date', id, paid_date, FROM_UNIXTIME(paid_date) FROM `" . $DBPrefix . "accounts`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "accounts` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "accounts' AND table_colomn = 'paid_date') src SET dest.paid_date = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "accounts` MODIFY `paid_date` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// auctions.starts time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "auctions', 'starts', id, starts, FROM_UNIXTIME(starts) FROM `" . $DBPrefix . "auctions`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "auctions` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "auctions' AND table_colomn = 'starts') src SET dest.starts = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "auctions` MODIFY `starts` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// auctions.ends time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "auctions', 'ends', id, ends, FROM_UNIXTIME(ends) FROM `" . $DBPrefix . "auctions`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "auctions` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "auctions' AND table_colomn = 'ends') src SET dest.ends = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "auctions` MODIFY `ends` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// bids.bidwhen time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "bids', 'bidwhen', id, bidwhen, FROM_UNIXTIME(bidwhen) FROM `" . $DBPrefix . "bids`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "bids` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "bids' AND table_colomn = 'bidwhen') src SET dest.bidwhen = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "bids` MODIFY `bidwhen` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// comm_messages.msgdate time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "comm_messages', 'msgdate', id, msgdate, FROM_UNIXTIME(msgdate) FROM `" . $DBPrefix . "comm_messages`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "comm_messages` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "comm_messages' AND table_colomn = 'msgdate') src SET dest.msgdate = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "comm_messages` MODIFY `msgdate` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// community.lastmessage time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "community', 'lastmessage', id, lastmessage, FROM_UNIXTIME(lastmessage) FROM `" . $DBPrefix . "community`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "community` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "community' AND table_colomn = 'lastmessage') src SET dest.lastmessage = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "community` MODIFY `lastmessage` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// feedbacks.feedbackdate time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "feedbacks', 'feedbackdate', id, feedbackdate, FROM_UNIXTIME(feedbackdate) FROM `" . $DBPrefix . "feedbacks`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "feedbacks` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "feedbacks' AND table_colomn = 'feedbackdate') src SET dest.feedbackdate = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "feedbacks` MODIFY `feedbackdate` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// logs.timestamp time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "logs', 'timestamp', id, timestamp, FROM_UNIXTIME(timestamp) FROM `" . $DBPrefix . "logs`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "logs` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "logs' AND table_colomn = 'timestamp') src SET dest.timestamp = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "logs` MODIFY `timestamp` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// messages.sentat time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "messages', 'sentat', id, sentat, FROM_UNIXTIME(sentat) FROM `" . $DBPrefix . "messages`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "messages` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "messages' AND table_colomn = 'sentat') src SET dest.sentat = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "messages` MODIFY `sentat` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// news.new_date time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "news', 'new_date', id, new_date, FROM_UNIXTIME(new_date) FROM `" . $DBPrefix . "news`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "news` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "news' AND table_colomn = 'new_date') src SET dest.new_date = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "news` MODIFY `new_date` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// online.time time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "online', 'time', id, time, FROM_UNIXTIME(time) FROM `" . $DBPrefix . "online`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "online` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "online' AND table_colomn = 'time') src SET dest.time = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "online` MODIFY `time` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// pendingnotif.thisdate gmdate('Ymd')
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "pendingnotif', 'thisdate', id, thisdate, STR_TO_DATE(thisdate, '%Y%m%d') FROM `" . $DBPrefix . "pendingnotif`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "pendingnotif` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "pendingnotif' AND table_colomn = 'thisdate') src SET dest.thisdate = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "pendingnotif` MODIFY `thisdate` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// users.reg_date time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "users', 'reg_date', id, reg_date, FROM_UNIXTIME(reg_date) FROM `" . $DBPrefix . "users`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "users` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "users' AND table_colomn = 'reg_date') src SET dest.reg_date = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "users` MODIFY `reg_date` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// users.lastlogin date("Y-m-d H:i:s")
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "users', 'lastlogin', id, lastlogin, STR_TO_DATE(lastlogin, '%Y-%m-%d %H:%i:%s') FROM `" . $DBPrefix . "users`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "users` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "users' AND table_colomn = 'lastlogin') src SET dest.lastlogin = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "users` MODIFY `lastlogin` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// useraccounts.date time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "useraccounts', 'date', id, `date`, FROM_UNIXTIME(`date`) FROM `" . $DBPrefix . "useraccounts`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "useraccounts` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "useraccounts' AND table_colomn = 'date') src SET dest.`date` = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "useraccounts` MODIFY `date` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-// winners.closingdate time()
-$query = "INSERT INTO `" . $DBPrefix . "temp_install` (`table`, `table_colomn`, `table_id`, `old_value`, `new_value`)
- VALUES (SELECT '" . $DBPrefix . "winners', 'closingdate', id, closingdate, FROM_UNIXTIME(closingdate) FROM `" . $DBPrefix . "winners`);";
-$db->direct_query($query);
-$query = "UPDATE `" . $DBPrefix . "winners` dest, (SELECT * FROM `" . $DBPrefix . "temp_install` WHERE table = '" . $DBPrefix . "winners' AND table_colomn = 'closingdate') src SET dest.closingdate = src.new_value where dest.id = src.table_id;";
-$db->direct_query($query);
-$query = "ALTER TABLE `" . $DBPrefix . "winners` MODIFY `closingdate` datetime default CURRENT_TIMESTAMP;";
-$db->direct_query($query);
-
-$query = "DROP TABLE IF EXISTS `" . $DBPrefix . "temp_install`;";
-$db->direct_query($query);
-
-// remove unused files and folders from previous versions
-rmf('../includes/functions_rebuild.php');
-rmf('../includes/membertypes.inc.php');
diff --git a/install/sql/updatedump.inc.php b/install/sql/updatedump.inc.php
deleted file mode 100644
index d5715ace1..000000000
--- a/install/sql/updatedump.inc.php
+++ /dev/null
@@ -1,524 +0,0 @@
-Under maintenance!!!!!!! ', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('prune_unactivated_users', 'bool', '1', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('prune_unactivated_users_days', 'int', '30', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('shipping', 'bool', 'y', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('superuser', 'string', 'renlok', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('googleanalytics', 'string', '', UNIX_TIMESTAMP(), 1);";
- $query[] = "INSERT INTO `" . $DBPrefix . "settings` VALUES ('use_moderation', 'bool', '0', UNIX_TIMESTAMP(), 1);";
- $query[] = "UPDATE `" . $DBPrefix . "settings` SET `value` = \"0-mail.com\n027168.com\n0815.ru\n0815.ry\n0815.su\n0845.ru\n0clickemail.com\n0wnd.net\n0wnd.org\n0x207.info\n1-8.biz\n100likers.com\n10mail.com\n10mail.org\n10minut.com.pl\n10minutemail.cf\n10minutemail.co.uk\n10minutemail.co.za\n10minutemail.com\n10minutemail.de\n10minutemail.ga\n10minutemail.gq\n10minutemail.ml\n10minutemail.net\n10minutesmail.com\n10x9.com\n123-m.com\n12houremail.com\n12minutemail.com\n12minutemail.net\n140unichars.com\n147.cl\n14n.co.uk\n1ce.us\n1chuan.com\n1fsdfdsfsdf.tk\n1mail.ml\n1pad.de\n1st-forms.com\n1to1mail.org\n1zhuan.com\n20email.eu\n20email.it\n20mail.in\n20mail.it\n20minutemail.com\n2120001.net\n21cn.com\n24hourmail.com\n24hourmail.net\n2fdgdfgdfgdf.tk\n2prong.com\n30minutemail.com\n33mail.com\n36ru.com\n3d-painting.com\n3l6.com\n3mail.ga\n3trtretgfrfe.tk\n4-n.us\n418.dk\n4gfdsgfdgfd.tk\n4mail.cf\n4mail.ga\n4warding.com\n4warding.net\n4warding.org\n5ghgfhfghfgh.tk\n5gramos.com\n5mail.cf\n5mail.ga\n5oz.ru\n5x25.com\n60minutemail.com\n672643.net\n675hosting.com\n675hosting.net\n675hosting.org\n6hjgjhgkilkj.tk\n6ip.us\n6mail.cf\n6mail.ga\n6mail.ml\n6paq.com\n6url.com\n75hosting.com\n75hosting.net\n75hosting.org\n7days-printing.com\n7mail.ga\n7mail.ml\n7tags.com\n80665.com\n8127ep.com\n8mail.cf\n8mail.ga\n8mail.ml\n99experts.com\n9mail.cf\n9ox.net\na-bc.net\na.asu.mx\na.betr.co\na.mailcker.com\na.vztc.com\na45.in\nabakiss.com\nabcmail.email\nabusemail.de\nabyssmail.com\nac20mail.in\nacademiccommunity.com\nacentri.com\nadd3000.pp.ua\nadobeccepdm.com\nadpugh.org\nadsd.org\nadvantimo.com\nadwaterandstir.com\naegia.net\naegiscorp.net\naeonpsi.com\nafrobacon.com\nag.us.to\nagedmail.com\nagtx.net\nahk.jp\najaxapp.net\nakapost.com\nakerd.com\nal-qaeda.us\naligamel.com\nalisongamel.com\nalivance.com\nalldirectbuy.com\nallen.nom.za\nallthegoodnamesaretaken.org\nalph.wtf\nama-trade.de\nama-trans.de\namail.com\namail4.me\namazon-aws.org\namelabs.com\namilegit.com\namiri.net\namiriindustries.com\nampsylike.com\nan.id.au\nanappfor.com\nanappthat.com\nandthen.us\nanimesos.com\nano-mail.net\nanon-mail.de\nanonbox.net\nanonmails.de\nanonymail.dk\nanonymbox.com\nanonymized.org\nanonymousness.com\nansibleemail.com\nanthony-junkmail.com\nantireg.com\nantireg.ru\nantispam.de\nantispam24.de\nantispammail.de\napfelkorps.de\naphlog.com\nappc.se\nappinventor.nl\nappixie.com\narmyspy.com\naron.us\narroisijewellery.com\nartman-conception.com\narvato-community.de\naschenbrandt.net\nasdasd.nl\nasdasd.ru\nashleyandrew.com\nass.pp.ua\nastroempires.info\nat0mik.org\natvclub.msk.ru\naugmentationtechnology.com\nauti.st\nautorobotica.com\nautotwollow.com\naver.com\naxiz.org\nazcomputerworks.com\nazmeil.tk\nb.kyal.pl\nb1of96u.com\nb2cmail.de\nbadgerland.eu\nbadoop.com\nbarryogorman.com\nbasscode.org\nbauwerke-online.com\nbaxomale.ht.cx\nbazaaboom.com\nbcast.ws\nbccto.me\nbearsarefuzzy.com\nbeddly.com\nbeefmilk.com\nbelljonestax.com\nbenipaula.org\nbestchoiceusedcar.com\nbidourlnks.com\nbig1.us\nbigprofessor.so\nbigstring.com\nbigwhoop.co.za\nbinkmail.com\nbio-muesli.info\nbio-muesli.net\nblackmarket.to\nbladesmail.net\nblip.ch\nblogmyway.org\nbluedumpling.info\nbluewerks.com\nbobmail.info\nbobmurchison.com\nbodhi.lawlita.com\nbofthew.com\nbonobo.email\nbookthemmore.com\nbootybay.de\nborged.com\nborged.net\nborged.org\nboun.cr\nbouncr.com\nboxformail.in\nboximail.com\nboxtemp.com.br\nbr.mintemail.com\nbrandallday.net\nbreakthru.com\nbrefmail.com\nbrennendesreich.de\nbriggsmarcus.com\nbroadbandninja.com\nbsnow.net\nbspamfree.org\nbspooky.com\nbst-72.com\nbtb-notes.com\nbtc.email\nbu.mintemail.com\nbuffemail.com\nbugmenever.com\nbugmenot.com\nbulrushpress.com\nbum.net\nbumpymail.com\nbunchofidiots.com\nbund.us\nbundes-li.ga\nbunsenhoneydew.com\nburnthespam.info\nburstmail.info\nbusinessbackend.com\nbusinesssuccessislifesuccess.com\nbuspad.org\nbuymoreplays.com\nbuyordie.info\nbuyusedlibrarybooks.org\nbyebyemail.com\nbyespm.com\nbyom.de\nc.lain.ch\nc2.hu\nc51vsgq.com\ncachedot.net\ncaliforniafitnessdeals.com\ncam4you.cc\ncard.zp.ua\ncasualdx.com\ncbair.com\ncc.liamria\nce.mintemail.com\ncek.pm\ncellurl.com\ncentermail.com\ncentermail.net\nchacuo.net\nchammy.info\ncheatmail.de\nchielo.com\nchildsavetrust.org\nchilkat.com\nchithinh.com\nchogmail.com\nchoicemail1.com\nchong-mail.com\nchong-mail.net\nchong-mail.org\nchumpstakingdumps.com\ncigar-auctions.com\nckiso.com\ncl-cl.org\ncl0ne.net\nclandest.in\nclipmail.eu\nclixser.com\nclrmail.com\ncmail.com\ncmail.net\ncmail.org\ncnamed.com\ncnmsg.net\ncnsds.de\ncodeandscotch.com\ncodivide.com\ncoieo.com\ncoldemail.info\ncompareshippingrates.org\ncompletegolfswing.com\ncomwest.de\nconsumerriot.com\ncool.fr.nf\ncoolandwacky.us\ncoolimpool.org\ncorreo.blogos.net\ncosmorph.com\ncourriel.fr.nf\ncourrieltemporaire.com\ncrankhole.com\ncrapmail.org\ncrastination.de\ncrazespaces.pw\ncrazymailing.com\ncrossroadsmail.com\ncszbl.com\ncubiclink.com\ncurryworld.de\ncust.in\ncuvox.de\ncx.de-a.org\nd.cane.pw\nd.dialogus.com\nd3p.dk\ndacoolest.com\ndaemsteam.com\ndaintly.com\ndammexe.net\ndandikmail.com\ndarkharvestfilms.com\ndaryxfox.net\ndash-pads.com\ndataarca.com\ndatafilehost\ndatarca.com\ndatazo.ca\ndavidkoh.net\ndavidlcreative.com\ndayrep.com\ndbunker.com\ndcemail.com\ndeadaddress.com\ndeadchildren.org\ndeadfake.cf\ndeadfake.ga\ndeadfake.ml\ndeadfake.tk\ndeadspam.com\ndeagot.com\ndealja.com\ndealrek.com\ndeekayen.us\ndefomail.com\ndegradedfun.net\ndelayload.com\ndelayload.net\ndelikkt.de\nder-kombi.de\nderkombi.de\nderluxuswagen.de\ndespam.it\ndespammed.com\ndevnullmail.com\ndharmatel.net\ndiapaulpainting.com\ndigitalmariachis.com\ndigitalsanctuary.com\ndildosfromspace.com\ndingbone.com\ndiscard.cf\ndiscard.email\ndiscard.ga\ndiscard.gq\ndiscard.ml\ndiscard.tk\ndiscardmail.com\ndiscardmail.de\ndispo.in\ndispomail.eu\ndisposable-email.ml\ndisposable.cf\ndisposable.ga\ndisposable.ml\ndisposableaddress.com\ndisposableemailaddresses.com\ndisposableemailaddresses.emailmiser.com\ndisposableinbox.com\ndispose.it\ndisposeamail.com\ndisposemail.com\ndispostable.com\ndivermail.com\ndivismail.ru\ndlemail.ru\ndm.w3internet.co.uk\ndm.w3internet.co.ukexample.com\ndodgeit.com\ndodgemail.de\ndodgit.com\ndodgit.org\ndodsi.com\ndoiea.com\ndolphinnet.net\ndomforfb1.tk\ndomforfb18.tk\ndomforfb19.tk\ndomforfb2.tk\ndomforfb23.tk\ndomforfb27.tk\ndomforfb29.tk\ndomforfb3.tk\ndomforfb4.tk\ndomforfb5.tk\ndomforfb6.tk\ndomforfb7.tk\ndomforfb8.tk\ndomforfb9.tk\ndomozmail.com\ndonemail.ru\ndontreg.com\ndontsendmespam.de\ndoquier.tk\ndotman.de\ndotmsg.com\ndotslashrage.com\ndouchelounge.com\ndozvon-spb.ru\ndr.vankin.de\ndrdrb.com\ndrdrb.net\ndrivetagdev.com\ndroolingfanboy.de\ndropcake.de\ndroplar.com\ndropmail.me\ndspwebservices.com\nduam.net\ndudmail.com\ndukedish.com\ndump-email.info\ndumpandjunk.com\ndumpmail.de\ndumpyemail.com\ndurandinterstellar.com\nduskmail.com\ndw.now.im\ndx.abuser.eu\ndx.allowed.org\ndx.awiki.org\ndx.ez.lv\ndx.sly.io\ndx.soon.it\ndx.z86.ru\ndyceroprojects.com\ndz17.net\ne-mail.com\ne-mail.org\ne.brasx.org\ne.coza.ro\ne.ezfill.com\ne.hecat.es\ne.hpc.tw\ne.incq.com\ne.lee.mx\ne.ohi.tw\ne.runi.ca\ne.sino.tw\ne.spr.io\ne.ubm.md\ne3z.de\ne4ward.com\neasy-trash-mail.com\neasytrashmail.com\nebeschlussbuch.de\nebs.com.ar\necallheandi.com\nedinburgh-airporthotels.com\nedv.to\nee1.pl\nee2.pl\neelmail.com\neinmalmail.de\neinrot.com\neinrot.de\neintagsmail.de\nelearningjournal.org\nelectro.mn\nelitevipatlantamodels.com\nemail-fake.cf\nemail-fake.ga\nemail-fake.gq\nemail-fake.ml\nemail-fake.tk\nemail-jetable.fr\nemail.cbes.net\nemail.net\nemail60.com\nemailage.cf\nemailage.ga\nemailage.gq\nemailage.ml\nemailage.tk\nemaildienst.de\nemailgo.de\nemailias.com\nemailigo.de\nemailinfive.com\nemailisvalid.com\nemaillime.com\nemailmiser.com\nemailproxsy.com\nemailresort.com\nemails.ga\nemailsensei.com\nemailsingularity.net\nemailspam.cf\nemailspam.ga\nemailspam.gq\nemailspam.ml\nemailspam.tk\nemailtemporanea.com\nemailtemporanea.net\nemailtemporar.ro\nemailtemporario.com.br\nemailthe.net\nemailtmp.com\nemailto.de\nemailwarden.com\nemailx.at.hm\nemailxfer.com\nemailz.cf\nemailz.ga\nemailz.gq\nemailz.ml\nemeil.in\nemeil.ir\nemil.com\nemkei.cf\nemkei.ga\nemkei.gq\nemkei.ml\nemkei.tk\neml.pp.ua\nemz.net\nenterto.com\nephemail.net\nephemeral.email\ner.fir.hk\ner.moot.es\nericjohnson.ml\nero-tube.org\nesc.la\nescapehatchapp.com\nesemay.com\nesgeneri.com\nesprity.com\nest.une.victime.ninja\netranquil.com\netranquil.net\netranquil.org\nevanfox.info\nevopo.com\nexample.com\nexitstageleft.net\nexplodemail.com\nexpress.net.ua\nextremail.ru\neyepaste.com\nezstest.com\nf.fuirio.com\nf.fxnxs.com\nf.hmh.ro\nf4k.es\nfacebook-email.cf\nfacebook-email.ga\nfacebook-email.ml\nfacebookmail.gq\nfacebookmail.ml\nfadingemail.com\nfag.wf\nfailbone.com\nfaithkills.com\nfake-email.pp.ua\nfake-mail.cf\nfake-mail.ga\nfake-mail.ml\nfakedemail.com\nfakeinbox.cf\nfakeinbox.com\nfakeinbox.ga\nfakeinbox.ml\nfakeinbox.tk\nfakeinformation.com\nfakemail.fr\nfakemailgenerator.com\nfakemailz.com\nfammix.com\nfangoh.com\nfansworldwide.de\nfantasymail.de\nfarrse.co.uk\nfastacura.com\nfastchevy.com\nfastchrysler.com\nfasternet.biz\nfastkawasaki.com\nfastmazda.com\nfastmitsubishi.com\nfastnissan.com\nfastsubaru.com\nfastsuzuki.com\nfasttoyota.com\nfastyamaha.com\nfatflap.com\nfdfdsfds.com\nfer-gabon.org\nfettometern.com\nfictionsite.com\nfightallspam.com\nfigjs.com\nfigshot.com\nfiifke.de\nfilbert4u.com\nfilberts4u.com\nfilm-blog.biz\nfilzmail.com\nfivemail.de\nfixmail.tk\nfizmail.com\nfleckens.hu\nflemail.ru\nflowu.com\nflurred.com\nfly-ts.de\nflyinggeek.net\nflyspam.com\nfoobarbot.net\nfootard.com\nforecastertests.com\nforgetmail.com\nfornow.eu\nforspam.net\nfoxja.com\nfoxtrotter.info\nfr.ipsur.org\nfr33mail.info\nfrapmail.com\nfree-email.cf\nfree-email.ga\nfreebabysittercam.com\nfreeblackbootytube.com\nfreecat.net\nfreedompop.us\nfreefattymovies.com\nfreeletter.me\nfreemail.hu\nfreemail.ms\nfreemails.cf\nfreemails.ga\nfreemails.ml\nfreeplumpervideos.com\nfreeschoolgirlvids.com\nfreesistercam.com\nfreeteenbums.com\nfreundin.ru\nfriendlymail.co.uk\nfront14.org\nfuckedupload.com\nfuckingduh.com\nfudgerub.com\nfunnycodesnippets.com\nfurzauflunge.de\nfux0ringduh.com\nfw.moza.pl\nfyii.de\ng.airsi.de\ng.asu.su\ng.garizo.com\ng.hmail.us\ng.rbb.org\ng.tefl.ro\ng.tiv.cc\ng.vda.ro\ng4hdrop.us\ngalaxy.tv\ngamegregious.com\ngarbagecollector.org\ngarbagemail.org\ngardenscape.ca\ngarliclife.com\ngarrifulio.mailexpire.com\ngarrymccooey.com\ngav0.com\ngawab.com\ngehensiemirnichtaufdensack.de\ngeldwaschmaschine.de\ngelitik.in\ngenderfuck.net\ngeschent.biz\nget-mail.cf\nget-mail.ga\nget-mail.ml\nget-mail.tk\nget.pp.ua\nget1mail.com\nget2mail.fr\ngetairmail.cf\ngetairmail.com\ngetairmail.ga\ngetairmail.gq\ngetairmail.ml\ngetairmail.tk\ngetmails.eu\ngetonemail.com\ngetonemail.net\ngg.nh3.ro\nghosttexter.de\ngiaiphapmuasam.com\ngiantmail.de\nginzi.be\nginzi.co.uk\nginzi.es\nginzi.net\nginzy.co.uk\nginzy.eu\ngirlsindetention.com\ngirlsundertheinfluence.com\ngishpuppy.com\nglitch.sx\nglobaltouron.com\nglucosegrin.com\ngmal.com\ngmial.com\ngmx.us\ngnctr-calgary.com\ngo.arduino.hk\ngo.cdpa.cc\ngo.irc.so\ngo.jmail.ro\ngo.jwork.ru\ngoemailgo.com\ngomail.in\ngorillaswithdirtyarmpits.com\ngothere.biz\ngotmail.com\ngotmail.net\ngotmail.org\ngotti.otherinbox.com\ngowikibooks.com\ngowikicampus.com\ngowikicars.com\ngowikifilms.com\ngowikigames.com\ngowikimusic.com\ngowikinetwork.com\ngowikitravel.com\ngowikitv.com\ngrandmamail.com\ngrandmasmail.com\ngreat-host.in\ngreensloth.com\ngreggamel.com\ngreggamel.net\ngregorsky.zone\ngregorygamel.com\ngregorygamel.net\ngrr.la\ngs-arc.org\ngsredcross.org\ngsrv.co.uk\ngudanglowongan.com\nguerillamail.biz\nguerillamail.com\nguerillamail.de\nguerillamail.info\nguerillamail.net\nguerillamail.org\nguerillamailblock.com\nguerrillamail.biz\nguerrillamail.com\nguerrillamail.de\nguerrillamail.info\nguerrillamail.net\nguerrillamail.org\nguerrillamailblock.com\ngustr.com\ngynzi.co.uk\ngynzi.es\ngynzy.at\ngynzy.es\ngynzy.eu\ngynzy.gr\ngynzy.info\ngynzy.lt\ngynzy.mobi\ngynzy.pl\ngynzy.ro\ngynzy.sk\nh.mintemail.com\nh8s.org\nhabitue.net\nhacccc.com\nhackthatbit.ch\nhahawrong.com\nhaltospam.com\nharakirimail.com\nhartbot.de\nhat-geld.de\nhatespam.org\nhawrong.com\nhazelnut4u.com\nhazelnuts4u.com\nhazmatshipping.org\nheathenhammer.com\nheathenhero.com\nhellodream.mobi\nhelloricky.com\nhelpinghandtaxcenter.org\nherp.in\nherpderp.nl\nhiddentragedy.com\nhidemail.de\nhidzz.com\nhighbros.org\nhmamail.com\nhoanggiaanh.com\nhochsitze.com\nhopemail.biz\nhot-mail.cf\nhot-mail.ga\nhot-mail.gq\nhot-mail.ml\nhot-mail.tk\nhotmai.com\nhotmial.com\nhotpop.com\nhq.okzk.com\nhulapla.de\nhumaility.com\nhumn.ws.gy\nhungpackage.com\nhush.ai\nhush.com\nhushmail.com\nhushmail.me\nhuskion.net\nhvastudiesucces.nl\nhwsye.net\nibnuh.bz\nicantbelieveineedtoexplainthisshit.com\nicx.in\nieatspam.eu\nieatspam.info\nieh-mail.de\nignoremail.com\nihateyoualot.info\niheartspam.org\nikbenspamvrij.nl\nillistnoise.com\nilovespam.com\nimails.info\nimgof.com\nimgv.de\nimstations.com\ninbax.tk\ninbound.plus\ninbox.si\ninbox2.info\ninboxalias.com\ninboxclean.com\ninboxclean.org\ninboxdesign.me\ninboxed.im\ninboxed.pw\ninboxproxy.com\ninboxstore.me\ninclusiveprogress.com\nincognitomail.com\nincognitomail.net\nincognitomail.org\nindieclad.com\nindirect.ws\nineec.net\ninfocom.zp.ua\ninoutmail.de\ninoutmail.eu\ninoutmail.info\ninoutmail.net\ninsanumingeniumhomebrew.com\ninsorg-mail.info\ninstant-mail.de\ninstantemailaddress.com\ninternetoftags.com\ninterstats.org\nintersteller.com\niozak.com\nip.nm7.cc\nip4.pp.ua\nip6.li\nip6.pp.ua\nipoo.org\nirish2me.com\niroid.com\nironiebehindert.de\nirssi.tv\nis.af\nisukrainestillacountry.com\nit7.ovh\nitunesgiftcodegenerator.com\niwi.net\nj-p.us\nj.svxr.org\njafps.com\njdmadventures.com\njellyrolls.com\njetable.com\njetable.fr.nf\njetable.net\njetable.org\njetable.pp.ua\njnxjn.com\njobbikszimpatizans.hu\njobposts.net\njobs-to-be-done.net\njoelpet.com\njoetestalot.com\njopho.com\njourrapide.com\njp.ftp.sh\njsrsolutions.com\njungkamushukum.com\njunk.to\njunk1e.com\njunkmail.ga\njunkmail.gq\nk.aelo.es\nk.avls.pt\nk.bgx.ro\nk.cylab.org\nk.kaovo.com\nk.kon42.com\nk.vesa.pw\nkakadua.net\nkalapi.org\nkamsg.com\nkariplan.com\nkartvelo.com\nkasmail.com\nkaspop.com\nkcrw.de\nkeepmymail.com\nkeinhirn.de\nkeipino.de\nkemptvillebaseball.com\nkennedy808.com\nkillmail.com\nkillmail.net\nkimsdisk.com\nkingsq.ga\nkiois.com\nkir.ch.tc\nkismail.ru\nkisstwink.com\nkitnastar.com\nklassmaster.com\nklassmaster.net\nkloap.com\nkludgemush.com\nklzlk.com\nkmhow.com\nkommunity.biz\nkook.ml\nkopagas.com\nkopaka.net\nkosmetik-obatkuat.com\nkostenlosemailadresse.de\nkoszmail.pl\nkrypton.tk\nkuhrap.com\nkulturbetrieb.info\nkurzepost.de\nkwift.net\nkwilco.net\nl-c-a.us\nl.logular.com\nl33r.eu\nlabetteraverouge.at\nlackmail.net\nlags.us\nlakelivingstonrealestate.com\nlandmail.co\nlaoeq.com\nlastmail.co\nlastmail.com\nlavabit.com\nlawlita.com\nlazyinbox.com\nleeching.net\nlellno.gq\nletmeinonthis.com\nletthemeatspam.com\nlez.se\nlhsdv.com\nliamcyrus.com\nlifebyfood.com\nlifetotech.com\nligsb.com\nlilo.me\nlindenbaumjapan.com\nlink2mail.net\nlinuxmail.so\nlitedrop.com\nlkgn.se\nllogin.ru\nloadby.us\nlocomodev.net\nlogin-email.cf\nlogin-email.ga\nlogin-email.ml\nlogin-email.tk\nloh.pp.ua\nloin.in\nlol.meepsheep.eu\nlol.ovpn.to\nlolfreak.net\nlolmail.biz\nlookugly.com\nlopl.co.cc\nlortemail.dk\nlosemymail.com\nlovemeleaveme.com\nlpfmgmtltd.com\nlr7.us\nlr78.com\nlroid.com\nlru.me\nluckymail.org\nlukecarriere.com\nlukemail.info\nlukop.dk\nluv2.us\nlyfestylecreditsolutions.com\nm.ddcrew.com\nm21.cc\nm4ilweb.info\nma1l.bij.pl\nmaboard.com\nmac.hush.com\nmacromaid.com\nmagamail.com\nmagicbox.ro\nmaidlow.info\nmail-filter.com\nmail-owl.com\nmail-temporaire.com\nmail-temporaire.fr\nmail.bccto.me\nmail.by\nmail.mezimages.net\nmail.zp.ua\nmail114.net\nmail1a.de\nmail21.cc\nmail2rss.org\nmail2world.com\nmail333.com\nmail4trash.com\nmail666.ru\nmail707.com\nmail72.com\nmailback.com\nmailbidon.com\nmailbiz.biz\nmailblocks.com\nmailbucket.org\nmailcat.biz\nmailcatch.com\nmailchop.com\nmailde.de\nmailde.info\nmaildrop.cc\nmaildrop.cf\nmaildrop.ga\nmaildrop.gq\nmaildrop.ml\nmaildu.de\nmaildx.com\nmaileater.com\nmailed.in\nmailed.ro\nmaileimer.de\nmailexpire.com\nmailfa.tk\nmailforspam.com\nmailfree.ga\nmailfree.gq\nmailfree.ml\nmailfreeonline.com\nmailfs.com\nmailguard.me\nmailhazard.com\nmailhazard.us\nmailhz.me\nmailimate.com\nmailin8r.com\nmailinatar.com\nmailinater.com\nmailinator.co.uk\nmailinator.com\nmailinator.gq\nmailinator.info\nmailinator.net\nmailinator.org\nmailinator.us\nmailinator2.com\nmailincubator.com\nmailismagic.com\nmailita.tk\nmailjunk.cf\nmailjunk.ga\nmailjunk.gq\nmailjunk.ml\nmailjunk.tk\nmailmate.com\nmailme.gq\nmailme.ir\nmailme.lv\nmailme24.com\nmailmetrash.com\nmailmoat.com\nmailms.com\nmailnator.com\nmailnesia.com\nmailnull.com\nmailonaut.com\nmailorc.com\nmailorg.org\nmailpick.biz\nmailproxsy.com\nmailquack.com\nmailrock.biz\nmailsac.com\nmailscrap.com\nmailseal.de\nmailshell.com\nmailsiphon.com\nmailslapping.com\nmailslite.com\nmailtemp.info\nmailtemporaire.com\nmailtemporaire.fr\nmailtome.de\nmailtothis.com\nmailtrash.net\nmailtv.net\nmailtv.tv\nmailzi.ru\nmailzilla.com\nmailzilla.org\nmailzilla.orgmbx.cc\nmakemetheking.com\nmalahov.de\nmalayalamdtp.com\nmanifestgenerator.com\nmansiondev.com\nmanybrain.com\nmarkmurfin.com\nmbx.cc\nmcache.net\nmciek.com\nmega.zik.dj\nmeinspamschutz.de\nmeltmail.com\nmessagebeamer.de\nmesswiththebestdielikethe.rest\nmezimages.net\nmfsa.ru\nmiaferrari.com\nmidcoastcustoms.com\nmidcoastcustoms.net\nmidcoastsolutions.com\nmidcoastsolutions.net\nmidlertidig.com\nmidlertidig.net\nmidlertidig.org\nmierdamail.com\nmigmail.net\nmigmail.pl\nmigumail.com\nmijnhva.nl\nmildin.org.ua\nministry-of-silly-walks.de\nmintemail.com\nmisterpinball.de\nmjukglass.nu\nmkpfilm.com\nml8.ca\nmoakt.com\nmobi.web.id\nmobileninja.co.uk\nmoburl.com\nmockmyid.com\nmohmal.com\nmomentics.ru\nmoncourrier.fr.nf\nmonemail.fr.nf\nmoneypipe.net\nmonmail.fr.nf\nmonumentmail.com\nmoonwake.com\nmor19.uu.gl\nmoreawesomethanyou.com\nmoreorcs.com\nmotique.de\nmountainregionallibrary.net\nmox.pp.ua\nms9.mailslite.com\nmsa.minsmail.com\nmsb.minsmail.com\nmsgos.com\nmspeciosa.com\nmswork.ru\nmsxd.com\nmt2009.com\nmt2014.com\nmt2015.com\nmtmdev.com\nmuathegame.com\nmuchomail.com\nmucincanon.com\nmutant.me\nmwarner.org\nmx0.wwwnew.eu\nmxfuel.com\nmy.efxs.ca\nmy10minutemail.com\nmybitti.de\nmycard.net.ua\nmycleaninbox.net\nmycorneroftheinter.net\nmydemo.equipment\nmyecho.es\nmyemailboxy.com\nmykickassideas.com\nmymail-in.net\nmymailoasis.com\nmynetstore.de\nmyopang.com\nmypacks.net\nmypartyclip.de\nmyphantomemail.com\nmysamp.de\nmyspaceinc.com\nmyspaceinc.net\nmyspaceinc.org\nmyspacepimpedup.com\nmyspamless.com\nmytemp.email\nmytempemail.com\nmytempmail.com\nmytrashmail.com\nmywarnernet.net\nmyzx.com\nn.rabin.ca\nn1nja.org\nnabuma.com\nnakedtruth.biz\nnanonym.ch\nnationalgardeningclub.com\nnaver.com\nnegated.com\nneomailbox.com\nnepwk.com\nnervmich.net\nnervtmich.net\nnetmails.com\nnetmails.net\nnetricity.nl\nnetris.net\nnetviewer-france.com\nnetzidiot.de\nnevermail.de\nnew.apps.dj\nnextstopvalhalla.com\nnfast.net\nnguyenusedcars.com\nnice-4u.com\nnicknassar.com\nnincsmail.hu\nniwl.net\nnmail.cf\nnnh.com\nnnot.net\nno-spam.ws\nno-ux.com\nnoblepioneer.com\nnobugmail.com\nnobulk.com\nnobuma.com\nnoclickemail.com\nnodezine.com\nnogmailspam.info\nnokiamail.com\nnomail.pw\nnomail.xl.cx\nnomail2me.com\nnomorespamemails.com\nnonspam.eu\nnonspammer.de\nnoref.in\nnorseforce.com\nnospam.wins.com.br\nnospam.ze.tc\nnospam4.us\nnospamfor.us\nnospamthanks.info\nnothingtoseehere.ca\nnotmailinator.com\nnotrnailinator.com\nnotsharingmy.info\nnowhere.org\nnowmymail.com\nntlhelp.net\nnubescontrol.com\nnullbox.info\nnurfuerspam.de\nnus.edu.sg\nnuts2trade.com\nnwldx.com\nny7.me\no.cavi.mx\no.civx.org\no.cnew.ir\no.jpco.org\no.mm5.se\no.opp24.com\no.rma.ec\no.sin.cl\no.yedi.org\no2stk.org\no7i.net\nobfusko.com\nobjectmail.com\nobobbo.com\nobxpestcontrol.com\nodaymail.com\nodnorazovoe.ru\noerpub.org\noffshore-proxies.net\nohaaa.de\nokclprojects.com\nokrent.us\nolypmall.ru\nomail.pro\nomnievents.org\none-time.email\noneoffemail.com\noneoffmail.com\nonewaymail.com\nonlatedotcom.info\nonline.ms\nonlineidea.info\nonqin.com\nontyne.biz\noolus.com\noopi.org\nopayq.com\nordinaryamerican.net\noshietechan.link\notherinbox.com\nourklips.com\nourpreviewdomain.com\noutlawspam.com\novpn.to\nowlpic.com\nownsyou.de\noxopoha.com\np.mm.my\npa9e.com\npagamenti.tk\npancakemail.com\npaplease.com\npastebitch.com\npcusers.otherinbox.com\npenisgoes.in\npepbot.com\npeterdethier.com\npetrzilka.net\npfui.ru\nphotomark.net\nphpbb.uu.gl\npi.vu\npimpedupmyspace.com\npinehill-seattle.org\npingir.com\npisls.com\npjjkp.com\nplexolan.de\nplhk.ru\nplw.me\npo.bot.nu\npoczta.onet.pl\npoh.pp.ua\npojok.ml\npokiemobile.com\npolitikerclub.de\npooae.com\npoofy.org\npookmail.com\npoopiebutt.club\npopesodomy.com\npopgx.com\npostacin.com\npostonline.me\npoutineyourface.com\npowered.name\npowlearn.com\npp.ua\nprimabananen.net\nprivacy.net\nprivatdemail.net\nprivy-mail.com\nprivy-mail.de\nprivymail.de\npro-tag.org\nprocrackers.com\nprojectcl.com\npropscore.com\nproxymail.eu\nproxyparking.com\nprtnx.com\nprtz.eu\npub.ftpinc.ca\npunkass.com\npuk.us.to\npurcell.email\npurelogistics.org\nput2.net\nputthisinyourspamdatabase.com\npwrby.com\npx.dhm.ro\nq.awatum.de\nq.tic.ec\nqasti.com\nqipmail.net\nqisdo.com\nqisoa.com\nqoika.com\nqs.dp76.com\nqs.grish.de\nquadrafit.com\nquickinbox.com\nquickmail.nl\nqvy.me\nqwickmail.com\nr.ctos.ch\nr4nd0m.de\nradiku.ye.vc\nraetp9.com\nraketenmann.de\nrancidhome.net\nrandomail.net\nraqid.com\nrax.la\nraxtest.com\nrcpt.at\nrcs.gaggle.net\nreallymymail.com\nrealtyalerts.ca\nreceiveee.chickenkiller.com\nreceiveee.com\nrecipeforfailure.com\nrecode.me\nreconmail.com\nrecyclemail.dk\nredfeathercrow.com\nregbypass.com\nregbypass.comsafe-mail.net\nrejectmail.com\nreliable-mail.com\nremail.cf\nremail.ga\nremarkable.rocks\nremote.li\nreptilegenetics.com\nrevolvingdoorhoax.org\nrhyta.com\nriddermark.de\nrisingsuntouch.com\nrk9.chickenkiller.com\nrklips.com\nrmqkr.net\nrnailinator.com\nrobertspcrepair.com\nronnierage.net\nrotaniliam.com\nrowe-solutions.com\nroyal.net\nroyaldoodles.org\nrppkn.com\nrr.ige.es\nrtrtr.com\nruffrey.com\nrumgel.com\nrustydoor.com\nrx.dred.ru\nrx.qc.to\ns.sast.ro\ns.scay.net\ns0ny.net\ns33db0x.com\nsabrestlouis.com\nsackboii.com\nsafe-mail.net\nsafersignup.de\nsafetymail.info\nsafetypost.de\nsaharanightstempe.com\nsamsclass.info\nsandelf.de\nsandwhichvideo.com\nsanfinder.com\nsanim.net\nsanstr.com\nsatukosong.com\nsausen.com\nsaynotospams.com\nscatmail.com\nschachrol.com\nschafmail.de\nschmeissweg.tk\nschrott-email.de\nsd3.in\nsecmail.pw\nsecretemail.de\nsecure-mail.biz\nsecure-mail.cc\nsecured-link.net\nsecurehost.com.es\nseekapps.com\nsejaa.lv\nselfdestructingmail.com\nselfdestructingmail.org\nsendfree.org\nsendingspecialflyers.com\nsendspamhere.com\nsenseless-entertainment.com\nserver.ms\nservices391.com\nsexforswingers.com\nsexical.com\nsharedmailbox.org\nsharklasers.com\nshhmail.com\nshhuut.org\nshieldedmail.com\nshieldemail.com\nshiftmail.com\nshipfromto.com\nshiphazmat.org\nshipping-regulations.com\nshippingterms.org\nshitmail.de\nshitmail.me\nshitmail.org\nshitware.nl\nshmeriously.com\nshortmail.net\nshotmail.ru\nshowslow.de\nshrib.com\nshut.name\nshut.ws\nsibmail.com\nsify.com\nsimpleitsecurity.info\nsinfiltro.cl\nsinglespride.com\nsinnlos-mail.de\nsiteposter.net\nsizzlemctwizzle.com\nskeefmail.com\nskkk.edu.my\nsky-inbox.com\nsky-ts.de\nslapsfromlastnight.com\nslaskpost.se\nslave-auctions.net\nslopsbox.com\nslothmail.net\nslushmail.com\nsmapfree24.com\nsmapfree24.de\nsmapfree24.eu\nsmapfree24.info\nsmapfree24.org\nsmashmail.de\nsmellfear.com\nsmellrear.com\nsmtp99.com\nsmwg.info\nsnakemail.com\nsneakemail.com\nsneakmail.de\nsnkmail.com\nsocialfurry.org\nsofimail.com\nsofort-mail.de\nsofortmail.de\nsoftpls.asia\nsogetthis.com\nsohu.com\nsoisz.com\nsolvemail.info\nsolventtrap.wiki\nsoodmail.com\nsoodomail.com\nsoodonims.com\nspam-be-gone.com\nspam.la\nspam.org.es\nspam.su\nspam4.me\nspamail.de\nspamarrest.com\nspamavert.com\nspambob.com\nspambob.net\nspambob.org\nspambog.com\nspambog.de\nspambog.net\nspambog.ru\nspambooger.com\nspambox.info\nspambox.irishspringrealty.com\nspambox.org\nspambox.us\nspamcero.com\nspamcon.org\nspamcorptastic.com\nspamcowboy.com\nspamcowboy.net\nspamcowboy.org\nspamday.com\nspamdecoy.net\nspamex.com\nspamfighter.cf\nspamfighter.ga\nspamfighter.gq\nspamfighter.ml\nspamfighter.tk\nspamfree.eu\nspamfree24.com\nspamfree24.de\nspamfree24.eu\nspamfree24.info\nspamfree24.net\nspamfree24.org\nspamgoes.in\nspamherelots.com\nspamhereplease.com\nspamhole.com\nspamify.com\nspaminator.de\nspamkill.info\nspaml.com\nspaml.de\nspamlot.net\nspammotel.com\nspamobox.com\nspamoff.de\nspamsalad.in\nspamslicer.com\nspamspot.com\nspamstack.net\nspamthis.co.uk\nspamthisplease.com\nspamtrail.com\nspamtroll.net\nspeed.1s.fr\nspeedgaus.net\nspikio.com\nspoofmail.de\nspritzzone.de\nspybox.de\nsquizzy.de\nsr.ro.lt\nsry.li\nss.hi5.si\nss.icx.ro\nss.undo.it\nssoia.com\nstanfordujjain.com\nstarlight-breaker.net\nstartfu.com\nstartkeys.com\nstatdvr.com\nstathost.net\nstatiix.com\nsteambot.net\nstinkefinger.net\nstop-my-spam.cf\nstop-my-spam.com\nstop-my-spam.ga\nstop-my-spam.ml\nstop-my-spam.pp.ua\nstop-my-spam.tk\nstreetwisemail.com\nstuffmail.de\nstumpfwerk.com\nsub.internetoftags.com\nsuburbanthug.com\nsuckmyd.com\nsudolife.me\nsudolife.net\nsudomail.biz\nsudomail.com\nsudomail.net\nsudoverse.com\nsudoverse.net\nsudoweb.net\nsudoworld.com\nsudoworld.net\nsuioe.com\nsuper-auswahl.de\nsupergreatmail.com\nsupermailer.jp\nsuperplatyna.com\nsuperrito.com\nsuperstachel.de\nsuremail.info\nsvk.jp\nsweetxxx.de\nswift10minutemail.com\nsylvannet.com\nt.psh.me\ntafmail.com\ntafoi.gr\ntagmymedia.com\ntagyourself.com\ntalkinator.com\ntanukis.org\ntapchicuoihoi.com\ntb-on-line.net\nte.adiq.eu\ntechemail.com\ntechgroup.me\nteewars.org\ntelecomix.pl\nteleworm.com\nteleworm.us\ntemp-mail.com\ntemp-mail.de\ntemp-mail.org\ntemp-mail.ru\ntemp.bartdevos.be\ntemp.emeraldwebmail.com\ntemp.headstrong.de\ntempail.com\ntempalias.com\ntempe-mail.com\ntempemail.biz\ntempemail.co.za\ntempemail.com\ntempemail.net\ntempinbox.co.uk\ntempinbox.com\ntempmail.co\ntempmail.eu\ntempmail.it\ntempmail2.com\ntempmaildemo.com\ntempmailer.com\ntempmailer.de\ntempomail.fr\ntemporarily.de\ntemporarioemail.com.br\ntemporaryemail.net\ntemporaryemail.us\ntemporaryforwarding.com\ntemporaryinbox.com\ntemporarymailaddress.com\ntempsky.com\ntempthe.net\ntempymail.com\ntestudine.com\nth.edgex.ru\nthanksnospam.info\nthankyou2010.com\nthc.st\ntheaviors.com\nthebearshark.com\nthecloudindex.com\nthediamants.org\nthelimestones.com\nthembones.com.au\nthemostemail.com\nthereddoors.online\nthescrappermovie.com\ntheteastory.info\nthietbivanphong.asia\nthisisnotmyrealemail.com\nthismail.net\nthisurl.website\nthnikka.com\nthraml.com\nthrma.com\nthroam.com\nthrott.com\nthrowawayemailaddress.com\nthrowawaymail.com\nthunkinator.org\nthxmate.com\ntilien.com\ntimgiarevn.com\ntimkassouf.com\ntinyurl24.com\ntittbit.in\ntizi.com\ntlpn.org\ntm.tosunkaya.com\ntmail.ws\ntmailinator.com\ntmpjr.me\ntoddsbighug.com\ntoiea.com\ntokem.co\ntokenmail.de\ntonymanso.com\ntoomail.biz\ntop101.de\ntop1mail.ru\ntop1post.ru\ntopofertasdehoy.com\ntopranklist.de\ntoprumours.com\ntormail.org\ntoss.pw\ntotalvista.com\ntotesmail.com\ntp-qa-mail.com\ntradermail.info\ntranceversal.com\ntrash-amil.com\ntrash-mail.at\ntrash-mail.cf\ntrash-mail.com\ntrash-mail.de\ntrash-mail.ga\ntrash-mail.gq\ntrash-mail.ml\ntrash-mail.tk\ntrash2009.com\ntrash2010.com\ntrash2011.com\ntrashcanmail.com\ntrashdevil.com\ntrashdevil.de\ntrashemail.de\ntrashinbox.com\ntrashmail.at\ntrashmail.com\ntrashmail.de\ntrashmail.me\ntrashmail.net\ntrashmail.org\ntrashmail.ws\ntrashmailer.com\ntrashymail.com\ntrashymail.net\ntrasz.com\ntrayna.com\ntrbvm.com\ntrbvn.com\ntrbvo.com\ntrialmail.de\ntrickmail.net\ntrillianpro.com\ntrollproject.com\ntropicalbass.info\ntrungtamtoeic.com\ntryalert.com\nttszuo.xyz\ntualias.com\nturoid.com\nturual.com\ntwinmail.de\ntwoweirdtricks.com\ntxtadvertise.com\nty.ceed.se\ntyldd.com\nu.42o.org\nu.duk33.com\nu.hs.vc\nu.jdz.ro\nu.mji.ro\nu.qibl.at\nu.oroki.de\nu.ozyl.de\nu.rvb.ro\nu.thex.ro\nu.tkitc.de\nu.wef.gr\nubismail.net\nufacturing.com\nuggsrock.com\nuguuchantele.com\nuhhu.ru\numail.net\nunimark.org\nunit7lahaina.com\nunmail.ru\nupliftnow.com\nuplipht.com\nuploadnolimit.com\nurfunktion.se\nuroid.com\nus.af\nusername.e4ward.com\nutiket.us\nuwork4.us\nux.dob.jp\nux.uk.to\nuyhip.com\nvaati.org\nvalemail.net\nvalhalladev.com\nvenompen.com\nverdejo.com\nveryday.ch\nveryday.eu\nveryday.info\nveryrealemail.com\nvfemail.net\nvg.dab.ro\nvictoriantwins.com\nvidchart.com\nviditag.com\nviewcastmedia.com\nviewcastmedia.net\nviewcastmedia.org\nvikingsonly.com\nvinernet.com\nvipmail.name\nvipmail.pw\nvipxm.net\nviralplays.com\nvixletdev.com\nvkcode.ru\nvmailing.info\nvmani.com\nvmpanda.com\nvo.yoo.ro\nvoidbay.com\nvomoto.com\nvorga.org\nvotiputox.org\nvoxelcore.com\nvp.ycare.de\nvpn.st\nvsimcard.com\nvubby.com\nvztc.com\nwakingupesther.com\nwalala.org\nwalkmail.net\nwalkmail.ru\nwasteland.rfc822.org\nwatch-harry-potter.com\nwatchever.biz\nwatchfull.net\nwatchironman3onlinefreefullmovie.com\nwbml.net\nwe.geteit.com\nwe.ldop.com\nwe.ldtp.com\nwe.qq.my\nwe.vrmtr.com\nwe.wallm.com\nweb-mail.pp.ua\nwebemail.me\nwebm4il.info\nwebtrip.ch\nwebuser.in\nwee.my\nwefjo.grn.cc\nweg-werf-email.de\nwegwerf-email-addressen.de\nwegwerf-email-adressen.de\nwegwerf-email.de\nwegwerf-email.net\nwegwerf-emails.de\nwegwerfadresse.de\nwegwerfemail.com\nwegwerfemail.de\nwegwerfemail.net\nwegwerfemail.org\nwegwerfemailadresse.com\nwegwerfmail.de\nwegwerfmail.info\nwegwerfmail.net\nwegwerfmail.org\nwegwerpmailadres.nl\nwegwrfmail.de\nwegwrfmail.net\nwegwrfmail.org\nwelikecookies.com\nwetrainbayarea.com\nwetrainbayarea.org\nwg0.com\nwh4f.org\nwhatiaas.com\nwhatifanalytics.com\nwhatpaas.com\nwhatsaas.com\nwhiffles.org\nwhopy.com\nwhtjddn.33mail.com\nwhyspam.me\nwibblesmith.com\nwickmail.net\nwidget.gg\nwilemail.com\nwillhackforfood.biz\nwillselfdestruct.com\nwimsg.com\nwinemaven.info\nwmail.cf\nwolfsmail.tk\nwollan.info\nworldspace.link\nwovz.cu.cc\nwr.moeri.org\nwralawfirm.com\nwriteme.us\nwronghead.com\nws.yodx.ro\nwuzup.net\nwuzupmail.net\nwww.bccto.me\nwww.e4ward.com\nwww.gishpuppy.com\nwww.mailinator.com\nwwwnew.eu\nx.ip6.li\nx1x.spb.ru\nx24.com\nxagloo.co\nxagloo.com\nxcompress.com\nxcpy.com\nxemaps.com\nxents.com\nxing886.uu.gl\nxjoi.com\nxmail.com\nxmaily.com\nxn--9kq967o.com\nxoxox.cc\nxrho.com\nxwaretech.com\nxwaretech.info\nxwaretech.net\nxww.ro\nxyzfree.net\ny.bcb.ro\ny.epb.ro\ny.gzb.ro\ny.tyhe.ro\nyanet.me\nyapped.net\nyaqp.com\nye.nonze.ro\nyep.it\nyert.ye.vc\nyhg.biz\nynmrealty.com\nyogamaven.com\nyomail.info\nyopmail.com\nyopmail.fr\nyopmail.gq\nyopmail.net\nyopmail.pp.ua\nyou-spam.com\nyougotgoated.com\nyoumail.ga\nyoumailr.com\nyouneedmore.info\nyourdomain.com\nyourewronghereswhy.com\nyourlms.biz\nypmail.webarnak.fr.eu.org\nyspend.com\nyugasandrika.com\nyui.it\nyuurok.com\nyxzx.net\nz1p.biz\nza.com\nze.gally.jp\nzebins.com\nzebins.eu\nzehnminuten.de\nzehnminutenmail.de\nzepp.dk\nzetmail.com\nzippymail.info\nzipsendtest.com\nzoaxe.com\nzoemail.com\nzoemail.net\nzoemail.org\nzoetropes.org\nzombie-hive.com\nzomg.info\nzumpul.com\nzxcv.com\nzxcvbnm.com\nzzz.com\" WHERE `fieldname` = 'spam_blocked_email_domains';";
- $new_version = '1.2.1';
-}
-
-if ($installed_version == '1.2.1') {
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `paypal_email`;";
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `authnet_id`;";
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `authnet_pass`;";
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `worldpay_id`;";
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `moneybookers_email`;";
- $query[] = "ALTER TABLE `" . $DBPrefix . "users` DROP COLUMN `toocheckout_id`;";
- $query[] = "INSERT INTO `" . $DBPrefix . "rates` VALUES (57, 'Serbia', 'Serbia Dinars', 'RSD');";
- $query[] = "ALTER TABLE `" . $DBPrefix . "usersips` MODIFY `type` varchar(255) default 'register';";
- $query[] = "ALTER TABLE `" . $DBPrefix . "groups` ADD `no_fees` tinyint(1) NOT NULL default '0' AFTER `can_buy`;";
- $query[] = "UPDATE `" . $DBPrefix . "settings` SET fieldname = 'maintenance_mode_active' WHERE fieldname = 'maintainance_mode_active';";
- $query[] = "UPDATE `" . $DBPrefix . "settings` SET fieldname = 'maintenance_text' WHERE fieldname = 'maintainance_text';";
- $query[] = "UPDATE `" . $DBPrefix . "payment_options` SET name = 'skrill', displayname = 'Skrill' WHERE name = 'moneybookers'";
- $new_version = '1.2.2';
-}
diff --git a/install/thisversion.txt b/install/thisversion.txt
deleted file mode 100644
index 18c765f7f..000000000
--- a/install/thisversion.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.2.2.2
diff --git a/install/update.php b/install/update.php
deleted file mode 100644
index a8b298e01..000000000
--- a/install/update.php
+++ /dev/null
@@ -1,94 +0,0 @@
-It seems you don\'t currently have a version of WeBid installed we recommend you do a fresh install ';
- } else {
- echo 'Now to step 1
';
- }
- }
-}
-if ($step == 1) {
- $check = check_installation();
- $package_version = package_version();
- $installed_version = check_version();
- echo print_header(true);
- if (!$check) {
- echo 'It seems you don\'t currently have a version of WeBid installed we recommend you do a fresh install
';
- exit;
- }
- include 'sql/updatedump.inc.php';
- echo 'Upgrading to v' . $new_version . ' from ' . $installed_version . '
';
- $queries = count($query);
- $from = (isset($_GET['from'])) ? $_GET['from'] : 0;
- if ($queries > 0 && $from < $queries) {
- $next = $from + 25;
- $to = ($next > $queries) ? $queries : $next;
- echo 'Writing to database: ' . floor($to / $queries * 100) . '% Complete ';
- for ($i = $from; $i < $to; $i++) {
- $db->direct_query($query[$i]);
- }
- if ($next < $queries) {
- echo '';
- exit;
- }
- }
- if (file_exists('scripts/' . $new_version . '.php')) {
- echo 'Running database update script ';
- include 'scripts/' . $new_version . '.php';
- echo 'Update script complete ';
- }
- // update database version
- $db->direct_query("UPDATE `" . $DBPrefix . "settings` SET `value` = '" . $new_version . "' WHERE fieldname = 'version';");
- if ($new_version == $package_version) {
- echo 'Update almost complete, remove the install folder from your server to complete the upgrade
';
- } else {
- echo '';
- echo 'Javascript is disabled please refresh the page ';
- }
-}
diff --git a/invoices.php b/invoices.php
old mode 100644
new mode 100755
index 60401fd28..00f94f884
--- a/invoices.php
+++ b/invoices.php
@@ -1,6 +1,6 @@
checkAuth()) {
- $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
- $_SESSION['REDIRECT_AFTER_LOGIN'] = 'invoices.php';
- header('location: user_login.php');
- exit;
+if (!$user->checkAuth())
+{
+ $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
+ $_SESSION['REDIRECT_AFTER_LOGIN'] = 'invoices.php';
+ header('location: user_login.php');
+ exit;
}
-if (!isset($_GET['PAGE']) || $_GET['PAGE'] == 1) {
- $OFFSET = 0;
- $PAGE = 1;
-} else {
- $PAGE = intval($_GET['PAGE']);
- $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
+if (!isset($_GET['PAGE']) || $_GET['PAGE'] == 1)
+{
+ $OFFSET = 0;
+ $PAGE = 1;
+}
+else
+{
+ $PAGE = intval($_GET['PAGE']);
+ $OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage'];
}
// count the pages
$query = "SELECT COUNT(useracc_id) As COUNT FROM " . $DBPrefix . "useraccounts
WHERE user_id = :user_id AND total > 0";
$params = array(
- array(':user_id', $user->user_data['id'], 'int'),
+ array(':user_id', $user->user_data['id'], 'int'),
);
$db->query($query, $params);
$TOTALINVOICES = $db->result('COUNT');
@@ -46,122 +50,143 @@
WHERE ua.user_id = :user_id AND ua.total > 0
LIMIT :OFFSET, :perpage";
$params = array(
- array(':user_id', $user->user_data['id'], 'int'),
- array(':OFFSET', $OFFSET, 'int'),
- array(':perpage', $system->SETTINGS['perpage'], 'int'),
+ array(':user_id', $user->user_data['id'], 'int'),
+ array(':OFFSET', $OFFSET, 'int'),
+ array(':perpage', $system->SETTINGS['perpage'], 'int'),
);
$db->query($query, $params);
-while ($row = $db->fetch()) {
- // build invoice info
- $info = '';
- $auc_id = false;
- if ($row['setup'] != 0) {
- $info .= $MSG['432'] . ' ' . $system->print_money($row['setup']) . ' ';
- $auc_id = true;
- }
- if ($row['featured'] != 0) {
- $info .= $MSG['433'] . ' ' . $system->print_money($row['featured']) . ' ';
- $auc_id = true;
- }
- if ($row['bold'] != 0) {
- $info .= $MSG['439'] . ' ' . $system->print_money($row['bold']) . ' ';
- $auc_id = true;
- }
- if ($row['highlighted'] != 0) {
- $info .= $MSG['434'] . ' ' . $system->print_money($row['highlighted']) . ' ';
- $auc_id = true;
- }
- if ($row['subtitle'] != 0) {
- $info .= $MSG['803'] . ' ' . $system->print_money($row['subtitle']) . ' ';
- $auc_id = true;
- }
- if ($row['relist'] != 0) {
- $info .= $MSG['437'] . ' ' . $system->print_money($row['relist']) . ' ';
- $auc_id = true;
- }
- if ($row['reserve'] != 0) {
- $info .= $MSG['440'] . ' ' . $system->print_money($row['reserve']) . ' ';
- $auc_id = true;
- }
- if ($row['buynow'] != 0) {
- $info .= $MSG['436'] . ' ' . $system->print_money($row['buynow']) . ' ';
- $auc_id = true;
- }
- if ($row['picture'] != 0) {
- $info .= $MSG['435'] . ' ' . $system->print_money($row['picture']) . ' ';
- $auc_id = true;
- }
- if ($row['extracat'] != 0) {
- $info .= $MSG['804'] . ' ' . $system->print_money($row['extracat']) . ' ';
- $auc_id = true;
- }
- if ($row['signup'] != 0) {
- $info .= $MSG['768'] . ' ' . $system->print_money($row['signup']) . ' ';
- }
- if ($row['buyer'] != 0) {
- $info .= $MSG['775'] . ' ' . $system->print_money($row['buyer']) . ' ';
- $auc_id = true;
- }
- if ($row['finalval'] != 0) {
- $info .= $MSG['791'] . ' ' . $system->print_money($row['finalval']) . ' ';
- $auc_id = true;
- }
- if ($row['balance'] != 0) {
- $info .= $MSG['935'] . ' ' . $system->print_money($row['balance']) . ' ';
- }
+while ($row = $db->fetch())
+{
+ $DATE = $row['date'] + $system->tdiff;
+
+ // build invoice info
+ $info = '';
+ $auc_id = false;
+ if ($row['setup'] != 0)
+ {
+ $info .= $MSG['432'] . ' ' . $system->print_money($row['setup']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['featured'] != 0)
+ {
+ $info .= $MSG['433'] . ' ' . $system->print_money($row['featured']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['bold'] != 0)
+ {
+ $info .= $MSG['439'] . ' ' . $system->print_money($row['bold']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['highlighted'] != 0)
+ {
+ $info .= $MSG['434'] . ' ' . $system->print_money($row['highlighted']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['subtitle'] != 0)
+ {
+ $info .= $MSG['803'] . ' ' . $system->print_money($row['subtitle']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['relist'] != 0)
+ {
+ $info .= $MSG['437'] . ' ' . $system->print_money($row['relist']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['reserve'] != 0)
+ {
+ $info .= $MSG['440'] . ' ' . $system->print_money($row['reserve']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['buynow'] != 0)
+ {
+ $info .= $MSG['436'] . ' ' . $system->print_money($row['buynow']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['picture'] != 0)
+ {
+ $info .= $MSG['435'] . ' ' . $system->print_money($row['picture']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['extracat'] != 0)
+ {
+ $info .= $MSG['804'] . ' ' . $system->print_money($row['extracat']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['signup'] != 0)
+ {
+ $info .= $MSG['768'] . ' ' . $system->print_money($row['signup']) . ' ';
+ }
+ if ($row['buyer'] != 0)
+ {
+ $info .= $MSG['775'] . ' ' . $system->print_money($row['buyer']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['finalval'] != 0)
+ {
+ $info .= $MSG['791'] . ' ' . $system->print_money($row['finalval']) . ' ';
+ $auc_id = true;
+ }
+ if ($row['balance'] != 0)
+ {
+ $info .= $MSG['935'] . ' ' . $system->print_money($row['balance']) . ' ';
+ }
- if ($auc_id) {
- if (empty($row['title'])) {
- $info = '' . $MSG['1034'] . ': ' . $row['auc_id'] . ' ' . $info;
- } else {
- $info = '' . $row['title'] . ' ' . $info;
- }
- }
+ if ($auc_id)
+ {
+ if (empty($row['title']))
+ {
+ $info = '' . $MSG['1034'] . ': ' . $row['auc_id'] . ' ' . $info;
+ }
+ else
+ {
+ $info = '' . $row['title'] . ' ' . $info;
+ }
+ }
- $template->assign_block_vars('topay', array(
- 'INVOICE' => $row['useracc_id'],
- 'AUC_ID' => $row['auc_id'],
- 'DATE' => $dt->formatDate($row['date']),
- 'INFO' => $info,
- 'TOTAL' => $system->print_money($row['total']),
- 'PAID' => ($row['paid'] == 1), // true if paid
- 'PDF' => $system->SETTINGS['siteurl'] . 'item_invoice.php?id=' . $row['auc_id']
- ));
+ $template->assign_block_vars('topay', array(
+ 'INVOICE' => $row['useracc_id'],
+ 'AUC_ID' => $row['auc_id'],
+ 'DATE' => ArrangeDateNoCorrection($DATE),
+ 'INFO' => $info,
+ 'TOTAL' => $system->print_money($row['total']),
+ 'PAID' => ($row['paid'] == 1), // true if paid
+ 'PDF' => $system->SETTINGS['siteurl'] . 'item_invoice.php?id=' . $row['auc_id']
+ ));
}
// get pagenation
$PREV = intval($PAGE - 1);
$NEXT = intval($PAGE + 1);
-if ($PAGES > 1) {
- $LOW = $PAGE - 5;
- if ($LOW <= 0) {
- $LOW = 1;
- }
- $COUNTER = $LOW;
- while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6)) {
- $template->assign_block_vars('pages', array(
- 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
- ));
- $COUNTER++;
- }
+if ($PAGES > 1)
+{
+ $LOW = $PAGE - 5;
+ if ($LOW <= 0) $LOW = 1;
+ $COUNTER = $LOW;
+ while ($COUNTER <= $PAGES && $COUNTER < ($PAGE + 6))
+ {
+ $template->assign_block_vars('pages', array(
+ 'PAGE' => ($PAGE == $COUNTER) ? '' . $COUNTER . ' ' : '' . $COUNTER . ' '
+ ));
+ $COUNTER++;
+ }
}
$_SESSION['INVOICE_RETURN'] = 'invoices.php';
$template->assign_vars(array(
- 'CURRENCY' => $system->SETTINGS['currency'],
+ 'CURRENCY' => $system->SETTINGS['currency'],
- 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
- 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
- 'PAGE' => $PAGE,
- 'PAGES' => $PAGES
- ));
+ 'PREV' => ($PAGES > 1 && $PAGE > 1) ? '' . $MSG['5119'] . ' ' : '',
+ 'NEXT' => ($PAGE < $PAGES) ? '' . $MSG['5120'] . ' ' : '',
+ 'PAGE' => $PAGE,
+ 'PAGES' => $PAGES
+ ));
include 'header.php';
$TMP_usmenutitle = $MSG['1059'];
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'invoices.tpl'
- ));
+ 'body' => 'invoices.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/item.php b/item.php
old mode 100644
new mode 100755
index b0b768ec5..b8df0a7f9
--- a/item.php
+++ b/item.php
@@ -1,6 +1,6 @@
query($query, $params);
-if ($db->numrows() == 0) {
- $_SESSION['msg_title'] = $ERR_622;
- $_SESSION['msg_body'] = $ERR_623;
- header('location: message.php');
- exit;
+if ($db->numrows() == 0)
+{
+ $_SESSION['msg_title'] = $ERR_622;
+ $_SESSION['msg_body'] = $ERR_623;
+ header('location: message.php');
+ exit;
}
$auction_data = $db->result();
$category = $auction_data['category'];
@@ -49,127 +51,105 @@
$minimum_bid = $auction_data['minimum_bid'];
$high_bid = $auction_data['current_bid'];
$customincrement = $auction_data['increment'];
-$seller_reg = $dt->formatDate($auction_data['reg_date']);
+$seller_reg = FormatDate($auction_data['reg_date'], '/', false);
// sort out counter
-if (!isset($auction_data['counter'])) {
- $query = "INSERT INTO `" . $DBPrefix . "auccounter` (`auction_id`, `counter`) VALUES (:counter, 1)";
- $params = array();
- $params[] = array(':counter', $id, 'int');
- $db->query($query, $params);
- $auction_data['counter'] = 1;
-} else {
- if (!isset($_SESSION['WEBID_VIEWED_AUCTIONS'])) {
- $_SESSION['WEBID_VIEWED_AUCTIONS'] = array();
- }
- if (!in_array($id, $_SESSION['WEBID_VIEWED_AUCTIONS'])) {
- $query = "UPDATE " . $DBPrefix . "auccounter set counter = counter + 1 WHERE auction_id = :auction_id";
- $params = array();
- $params[] = array(':auction_id', $id, 'int');
- $db->query($query, $params);
- $_SESSION['WEBID_VIEWED_AUCTIONS'][] = $id;
- }
+if (empty($auction_data['counter']))
+{
+ $query = "INSERT INTO `" . $DBPrefix . "auccounter` (`auction_id`, `counter`) VALUES (:counter, 1)";
+ $params = array();
+ $params[] = array(':counter', $id, 'int');
+ $db->query($query, $params);
+ $auction_data['counter'] = 1;
+}
+else
+{
+ if (!isset($_SESSION['WEBID_VIEWED_AUCTIONS']))
+ {
+ $_SESSION['WEBID_VIEWED_AUCTIONS'] = array();
+ }
+ if (!in_array($id, $_SESSION['WEBID_VIEWED_AUCTIONS']))
+ {
+ $query = "UPDATE " . $DBPrefix . "auccounter set counter = counter + 1 WHERE auction_id = :auction_id";
+ $params = array();
+ $params[] = array(':auction_id', $id, 'int');
+ $db->query($query, $params);
+ $_SESSION['WEBID_VIEWED_AUCTIONS'][] = $id;
+ }
}
// get watch item data
-if ($user->logged_in) {
- // Check if this item is not already added
- $query = "SELECT item_watch FROM " . $DBPrefix . "users WHERE id = :user_id";
- $params = array();
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $watcheditems = trim($db->result('item_watch'));
- $auc_ids = explode(' ', $watcheditems);
-
- if (in_array($id, $auc_ids)) {
- $watch_var = 'delete';
- $watch_string = $MSG['5202_0'];
- } else {
- $watch_var = 'add';
- $watch_string = $MSG['5202'];
- }
-} else {
- $watch_var = '';
- $watch_string = '';
+if ($user->logged_in)
+{
+ // Check if this item is not already added
+ $query = "SELECT item_watch FROM " . $DBPrefix . "users WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $watcheditems = trim($db->result('item_watch'));
+ $auc_ids = explode(' ', $watcheditems);
+
+ if (in_array($id, $auc_ids))
+ {
+ $watch_var = 'delete';
+ $watch_string = $MSG['5202_0'];
+ }
+ else
+ {
+ $watch_var = 'add';
+ $watch_string = $MSG['5202'];
+ }
+}
+else
+{
+ $watch_var = '';
+ $watch_string = '';
}
// get ending time
+$difference = $ends - time();
$showendtime = false;
$has_ended = false;
-$difference = null;
-if (strtotime($start) > time()) {
- $ending_time = '' . $MSG['668'] . ' ';
-} elseif (strtotime($ends) - time() > 0) {
- $current_time = new DateTime('now', $dt->UTCtimezone);
- $end_time = new DateTime($ends, $dt->UTCtimezone);
- $difference = $current_time->diff($end_time);
- $ending_time = '';
- $date_elements = 0;
- //Display Years
- if ($difference->y > 0){
- $timemsg = ($difference->y == 1) ? $MSG['count_year'] : $MSG['count_years'];
- $ending_time .= $difference->y . $timemsg;
- $date_elements++;
- }
- //Display Months
- if ($difference->m > 0) {
- $timemsg = ($difference->m == 1) ? $MSG['count_month'] : $MSG['count_months'];
- if ($difference->y > 0) {
- $comma = ", ";
- } else {
- $comma = null;
- }
- $ending_time .= $comma . $difference->m . $timemsg;
- $date_elements++;
- }
- //Display Days
- if ($difference->d > 0) {
- $timemsg = ($difference->d == 1) ? $MSG['count_day'] : $MSG['count_days'];
- if ($difference->y > 0 || $difference->m > 0) {
- $comma = ", ";
- } else {
- $comma = null;
- }
- $ending_time .= $comma . $difference->d . $timemsg;
- $date_elements++;
- }
- //Display Hours
- if ($difference->h > 0 && $date_elements < 3) {
- $timemsg = ($difference->h == 1) ? $MSG['count_hour'] : $MSG['count_hours'];
- if ($difference->y > 0 || $difference->m > 0 || $difference->d > 0) {
- $comma = ", ";
-
- } else {
- $comma = null;
- }
- $ending_time .= $comma . $difference->h . $timemsg ;
- $date_elements++;
- }
- //Display Minutes
- if ($difference->i > 0 && $date_elements < 3) {
- $timemsg = ($difference->i == 1) ? $MSG['count_minute'] : $MSG['count_minutes'];
- if ($difference->y > 0 || $difference->m > 0 || $difference->d > 0 || $difference->h > 0) {
- $comma = ", ";
- } else {
- $comma = null;
- }
- $ending_time .= $comma . $difference->i . $timemsg;
- $date_elements++;
- }
- //Display Seconds
- if ($difference->s > 0 && $date_elements < 3) {
- $timemsg = ($difference->s == 1) ? $MSG['count_second'] : $MSG['count_seconds'];
- if ($difference->y > 0 || $difference->m > 0 || $difference->d > 0 || $difference->h > 0 || $difference->i > 0) {
- $comma = ", ";
- } else {
- $comma = null;
- }
- $ending_time .= $comma . $difference->s . $timemsg;
- }
- $showendtime = true;
-} else {
- $ending_time = '' . $MSG['911'] . ' ';
- $has_ended = true;
+if ($start > time())
+{
+ $ending_time = '' . $MSG['668'] . ' ';
+}
+elseif ($difference > 0)
+{
+ $ending_time = '';
+ $d = 0;
+ $days_difference = floor($difference / 86400);
+ if ($days_difference > 0)
+ {
+ $daymsg = ($days_difference == 1) ? $MSG['126b'] : $MSG['126'];
+ $ending_time .= $days_difference . ' ' . $daymsg . ' ';
+ $d++;
+ }
+ $difference = $difference % 86400;
+ $hours_difference = floor($difference / 3600);
+ if ($hours_difference > 0)
+ {
+ $ending_time .= $hours_difference . $MSG['25_0037'] . ' ';
+ $d++;
+ }
+ $difference = $difference % 3600;
+ $minutes_difference = floor($difference / 60);
+ $seconds_difference = $difference % 60;
+ if ($minutes_difference > 0 && $d < 2)
+ {
+ $ending_time .= $minutes_difference . $MSG['25_0032'] . ' ';
+ $d++;
+ }
+ if ($seconds_difference > 0 && $d < 2)
+ {
+ $ending_time .= $seconds_difference . $MSG['25_0033'];
+ }
+ $showendtime = true;
+}
+else
+{
+ $ending_time = '' . $MSG['911'] . ' ';
+ $has_ended = true;
}
// build bread crumbs
@@ -181,43 +161,45 @@
$cat_value = '';
$crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
-for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] > 0) {
- if ($i > 0) {
- $cat_value .= ' > ';
- }
- $cat_value .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
- }
+for ($i = 0; $i < count($crumbs); $i++)
+{
+ if ($crumbs[$i]['cat_id'] > 0)
+ {
+ if ($i > 0)
+ {
+ $cat_value .= ' > ';
+ }
+ $cat_value .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
+ }
}
$secondcat_value = '';
-if ($system->SETTINGS['extra_cat'] == 'y' && intval($auction_data['secondcat']) > 0) {
- $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :sec_cat_id";
- $params = array();
- $params[] = array(':sec_cat_id', $auction_data['secondcat'], 'int');
- $db->query($query, $params);
- $parent_node = $db->result();
-
- $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
- for ($i = 0; $i < count($crumbs); $i++) {
- if ($crumbs[$i]['cat_id'] > 0) {
- if ($i > 0) {
- $secondcat_value .= ' > ';
- }
- $secondcat_value .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
- }
- }
+if ($system->SETTINGS['extra_cat'] == 'y' && intval($auction_data['secondcat']) > 0)
+{
+ $query = "SELECT left_id, right_id, level FROM " . $DBPrefix . "categories WHERE cat_id = :sec_cat_id";
+ $params = array();
+ $params[] = array(':sec_cat_id', $auction_data['secondcat'], 'int');
+ $db->query($query, $params);
+ $parent_node = $db->result();
+
+ $crumbs = $catscontrol->get_bread_crumbs($parent_node['left_id'], $parent_node['right_id']);
+ for ($i = 0; $i < count($crumbs); $i++)
+ {
+ if ($crumbs[$i]['cat_id'] > 0)
+ {
+ if ($i > 0)
+ {
+ $secondcat_value .= ' > ';
+ }
+ $secondcat_value .= '' . $category_names[$crumbs[$i]['cat_id']] . ' ';
+ }
+ }
}
// history
$query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b
- LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
- WHERE b.auction = :auc_id";
-if ($auction_data['bn_only'] || $auction_type == 2) {
- $query .= " ORDER BY b.bidwhen DESC";
-} else {
- $query .= " ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";
-}
+LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
+WHERE b.auction = :auc_id ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";
$params = array();
$params[] = array(':auc_id', $id, 'int');
$db->query($query, $params);
@@ -225,86 +207,109 @@
$i = 0;
$left = $auction_data['quantity'];
$hbidder_data = array();
-foreach ($db->fetchall() as $bidrec) {
- if (!isset($bidderarray[$bidrec['nick']])) {
- if ($system->SETTINGS['buyerprivacy'] == 'y' && (!$user->logged_in || ($user->user_data['id'] != $auction_data['user'] && $user->user_data['id'] != $bidrec['bidder']))) {
- $bidderarray[$bidrec['nick']] = $MSG['176'] . ' ' . $bidderarraynum;
- $bidderarraynum++;
- } else {
- $bidderarray[$bidrec['nick']] = $bidrec['nick'];
- }
- }
- if ($left > 0 && !in_array($bidrec['bidder'], $hbidder_data)) { //store highest bidder details
- $hbidder_data[] = $bidrec['bidder'];
- $fb_pos = $fb_neg = 0;
- // get seller feebacks
- $query = "SELECT rate FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = :rate_users_id";
- $params = array();
- $params[] = array(':rate_users_id', $bidrec['bidder'], 'int');
- $db->query($query, $params);
- // count numbers
- $fb_pos = $fb_neg = 0;
- while ($fb_arr = $db->fetch()) {
- if ($fb_arr['rate'] == 1) {
- $fb_pos++;
- } elseif ($fb_arr['rate'] == - 1) {
- $fb_neg++;
- }
- }
-
- $total_rate = $fb_pos - $fb_neg;
- $query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
- $params = array();
- $params[] = array(':feedback', $bidrec['rate_sum'], 'int');
- $db->query($query, $params);
- $feedback_icon = $db->result('icon');
- $template->assign_block_vars('high_bidders', array(
- 'BUYER_ID' => $bidrec['bidder'],
- 'BUYER_NAME' => $bidderarray[$bidrec['nick']],
- 'BUYER_FB' => $bidrec['rate_sum'],
- 'BUYER_FB_ICON' => $feedback_icon
- ));
- }
- $template->assign_block_vars('bidhistory', array(
- 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
- 'ID' => $bidrec['bidder'],
- 'NAME' => $bidderarray[$bidrec['nick']],
- 'BID' => $system->print_money($bidrec['bid']),
- 'WHEN' => $dt->formatDate($bidrec['bidwhen'], 'd F Y - H:i:s'),
- 'QTY' => $bidrec['quantity']
- ));
- $left -= $bidrec['quantity'];
- $i++;
+foreach ($db->fetchall() as $bidrec)
+{
+ if (!isset($bidderarray[$bidrec['nick']]))
+ {
+ if ($system->SETTINGS['buyerprivacy'] == 'y' && (!$user->logged_in || ($user->user_data['id'] != $auction_data['user'] && $user->user_data['id'] != $bidrec['bidder'])))
+ {
+ $bidderarray[$bidrec['nick']] = $MSG['176'] . ' ' . $bidderarraynum;
+ $bidderarraynum++;
+ }
+ else
+ {
+ $bidderarray[$bidrec['nick']] = $bidrec['nick'];
+ }
+ }
+ if ($left > 0 && !in_array($bidrec['bidder'], $hbidder_data)) //store highest bidder details
+ {
+ $hbidder_data[] = $bidrec['bidder'];
+ $fb_pos = $fb_neg = 0;
+ // get seller feebacks
+ $query = "SELECT rate FROM " . $DBPrefix . "feedbacks WHERE rated_user_id = :rate_users_id";
+ $params = array();
+ $params[] = array(':rate_users_id', $bidrec['bidder'], 'int');
+ $db->query($query, $params);
+ // count numbers
+ $fb_pos = $fb_neg = 0;
+ while ($fb_arr = $db->fetch())
+ {
+ if ($fb_arr['rate'] == 1)
+ {
+ $fb_pos++;
+ }
+ elseif ($fb_arr['rate'] == - 1)
+ {
+ $fb_neg++;
+ }
+ }
+
+ $total_rate = $fb_pos - $fb_neg;
+
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $total_rate || $i++ == (count($membertypes) - 1))
+ {
+ $buyer_rate_icon = $l['icon'];
+ break;
+ }
+ }
+ $template->assign_block_vars('high_bidders', array(
+ 'BUYER_ID' => $bidrec['bidder'],
+ 'BUYER_NAME' => $bidderarray[$bidrec['nick']],
+ 'BUYER_FB' => $bidrec['rate_sum'],
+ 'BUYER_FB_ICON' => (!empty($buyer_rate_icon) && $buyer_rate_icon != 'transparent.gif') ? ' ' : ''
+ ));
+ }
+ $template->assign_block_vars('bidhistory', array(
+ 'BGCOLOUR' => (!($i % 2)) ? '' : 'class="alt-row"',
+ 'ID' => $bidrec['bidder'],
+ 'NAME' => $bidderarray[$bidrec['nick']],
+ 'BID' => $system->print_money($bidrec['bid']),
+ 'WHEN' => ArrangeDateNoCorrection($bidrec['bidwhen'] + $system->tdiff) . ':' . date('s', $bidrec['bidwhen']),
+ 'QTY' => $bidrec['quantity']
+ ));
+ $left -= $bidrec['quantity'];
+ $i++;
}
$userbid = false;
-if ($user->logged_in && $num_bids > 0) {
- // check if youve bid on this before
- $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :auction AND bidder = :bidder LIMIT 1";
- $params = array();
- $params[] = array(':auction', $id, 'int');
- $params[] = array(':bidder', $user->user_data['id'], 'int');
- $db->query($query, $params);
- if ($db->numrows() > 0) {
- if (in_array($user->user_data['id'], $hbidder_data)) {
- $yourbidmsg = $MSG['25_0088'];
- $yourbidclass = 'yourbidwin';
- $difference = $current_time->diff($end_time);
- if ($difference->invert && $auction_data['reserve_price'] > 0 && $auction_data['current_bid'] < $auction_data['reserve_price']) {
- $yourbidmsg = $MSG['514'];
- $yourbidclass = 'yourbidloss';
- } elseif ($difference->invert || $auction_data['bn_only']) {
- $yourbidmsg = $MSG['25_0089'];
- }
- } elseif ($auction_data['bn_only']) {
- $yourbidmsg = $MSG['25_0089'];
- $yourbidclass = 'yourbidwin';
- } else {
- $yourbidmsg = $MSG['25_0087'];
- $yourbidclass = 'yourbidloss';
- }
- $userbid = true;
- }
+if ($user->logged_in && $num_bids > 0)
+{
+ // check if youve bid on this before
+ $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :auction AND bidder = :bidder LIMIT 1";
+ $params = array();
+ $params[] = array(':auction', $id, 'int');
+ $params[] = array(':bidder', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ if ($db->numrows() > 0)
+ {
+ if (in_array($user->user_data['id'], $hbidder_data))
+ {
+ $yourbidmsg = $MSG['25_0088'];
+ $yourbidclass = 'yourbidwin';
+ if ($difference <= 0 && $auction_data['reserve_price'] > 0 && $auction_data['current_bid'] < $auction_data['reserve_price'])
+ {
+ $yourbidmsg = $MSG['514'];
+ $yourbidclass = 'yourbidloss';
+ }
+ elseif ($difference <= 0 || $auction_data['bn_only'])
+ {
+ $yourbidmsg = $MSG['25_0089'];
+ }
+ }
+ elseif ($auction_data['bn_only'])
+ {
+ $yourbidmsg = $MSG['25_0089'];
+ $yourbidclass = 'yourbidwin';
+ }
+ else
+ {
+ $yourbidmsg = $MSG['25_0087'];
+ $yourbidclass = 'yourbidloss';
+ }
+ $userbid = true;
+ }
}
// sort out user questions
@@ -313,68 +318,85 @@
$params[] = array(':question_id', $id, 'int');
$db->query($query, $params);
$num_questions = $db->numrows();
-foreach ($db->fetchall() as $row) {
- $template->assign_block_vars('questions', array()); // just need to create the block
- $query = "SELECT sentfrom, message FROM " . $DBPrefix . "messages WHERE question = :id AND reply_of = :reply_of OR id = :message_id ORDER BY sentat ASC";
- $params = array();
- $params[] = array(':id', $id, 'int');
- $params[] = array(':reply_of', $row['id'], 'int');
- $params[] = array(':message_id', $row['id'], 'int');
- $db->query($query, $params);
- while ($row_ = $db->fetch()) {
- $template->assign_block_vars('questions.conv', array(
- 'MESSAGE' => $row_['message'],
- 'BY_WHO' => ($user_id == $row_['sentfrom']) ? $MSG['125'] : $MSG['555']
- ));
- }
+foreach ($db->fetchall() as $row)
+{
+ $template->assign_block_vars('questions', array()); // just need to create the block
+ $query = "SELECT sentfrom, message FROM " . $DBPrefix . "messages WHERE question = :id AND reply_of = :reply_of OR id = :message_id ORDER BY sentat ASC";
+ $params = array();
+ $params[] = array(':id', $id, 'int');
+ $params[] = array(':reply_of', $row['id'], 'int');
+ $params[] = array(':message_id', $row['id'], 'int');
+ $db->query($query, $params);
+ while ($row_ = $db->fetch())
+ {
+ $template->assign_block_vars('questions.conv', array(
+ 'MESSAGE' => $row_['message'],
+ 'BY_WHO' => ($user_id == $row_['sentfrom']) ? $MSG['125'] : $MSG['555']
+ ));
+ }
}
$high_bid = ($num_bids == 0) ? $minimum_bid : $high_bid;
-if ($customincrement == 0) {
- // Get bid increment for current bid and calculate minimum bid
- $query = "SELECT increment FROM " . $DBPrefix . "increments WHERE
- ((low <= :val0 AND high >= :val1) OR
- (low < :val2 AND high < :val3)) ORDER BY increment DESC";
- $params = array();
- $params[] = array(':val0', $high_bid, 'float');
- $params[] = array(':val1', $high_bid, 'float');
- $params[] = array(':val2', $high_bid, 'float');
- $params[] = array(':val3', $high_bid, 'float');
- $db->query($query, $params);
- if ($db->numrows() != 0) {
- $increment = $db->result('increment');
- }
-} else {
- $increment = $customincrement;
+if ($customincrement == 0)
+{
+ // Get bid increment for current bid and calculate minimum bid
+ $query = "SELECT increment FROM " . $DBPrefix . "increments WHERE
+ ((low <= :val0 AND high >= :val1) OR
+ (low < :val2 AND high < :val3)) ORDER BY increment DESC";
+ $params = array();
+ $params[] = array(':val0', $high_bid, 'float');
+ $params[] = array(':val1', $high_bid, 'float');
+ $params[] = array(':val2', $high_bid, 'float');
+ $params[] = array(':val3', $high_bid, 'float');
+ $db->query($query, $params);
+ if ($db->numrows() != 0)
+ {
+ $increment = $db->result('increment');
+ }
+}
+else
+{
+ $increment = $customincrement;
}
-if ($auction_type == 2) {
- $increment = 0;
+if ($auction_type == 2)
+{
+ $increment = 0;
}
-if ($customincrement > 0) {
- $increment = $customincrement;
+if ($customincrement > 0)
+{
+ $increment = $customincrement;
}
-if ($num_bids == 0 || $auction_type == 2) {
- $next_bidp = $minimum_bid;
-} else {
- $next_bidp = $high_bid + $increment;
+if ($num_bids == 0 || $auction_type == 2)
+{
+ $next_bidp = $minimum_bid;
+}
+else
+{
+ $next_bidp = $high_bid + $increment;
}
$view_history = '';
-if ($num_bids > 0 && !isset($_GET['history'])) {
- $view_history = '(' . $MSG['105'] . ' )';
-} elseif (isset($_GET['history'])) {
- $view_history = '(' . $MSG['507'] . ' )';
+if ($num_bids > 0 && !isset($_GET['history']))
+{
+ $view_history = '(' . $MSG['105'] . ' )';
+}
+elseif (isset($_GET['history']))
+{
+ $view_history = '(' . $MSG['507'] . ' )';
}
$min_bid = $system->print_money($minimum_bid);
$high_bid = $system->print_money($high_bid);
-if ($difference != null && !$difference->invert) {
- $next_bid = $system->print_money($next_bidp);
-} else {
- $next_bid = '--';
+if ($difference > 0)
+{
+ $next_bid = $system->print_money($next_bidp);
+}
+else
+{
+ $next_bid = '--';
}
// get seller feebacks
@@ -385,48 +407,66 @@
$num_feedbacks = $db->numrows();
// count numbers
$fb_pos = $fb_neg = 0;
-while ($fb_arr = $db->fetch()) {
- if ($fb_arr['rate'] == 1) {
- $fb_pos++;
- } elseif ($fb_arr['rate'] == - 1) {
- $fb_neg++;
- }
+while ($fb_arr = $db->fetch())
+{
+ if ($fb_arr['rate'] == 1)
+ {
+ $fb_pos++;
+ }
+ elseif ($fb_arr['rate'] == - 1)
+ {
+ $fb_neg++;
+ }
}
$total_rate = $fb_pos - $fb_neg;
-$query = "SELECT icon FROM " . $DBPrefix . "membertypes WHERE feedbacks <= :feedback ORDER BY feedbacks DESC LIMIT 1;";
-$params = array();
-$params[] = array(':feedback', $total_rate, 'int');
-$db->query($query, $params);
-$seller_feedback_icon = $db->result('icon');
+if ($total_rate > 0)
+{
+ $i = 0;
+ foreach ($membertypes as $k => $l)
+ {
+ if ($k >= $total_rate || $i++ == (count($membertypes) - 1))
+ {
+ $seller_rate_icon = $l['icon'];
+ break;
+ }
+ }
+}
// Pictures Gellery
$K = 0;
$UPLOADED_PICTURES = array();
-if (is_dir(UPLOAD_PATH . $id)) {
- $dir = opendir(UPLOAD_FOLDER . $id);
- if ($dir) {
- while ($file = @readdir($dir)) {
- if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) {
- $UPLOADED_PICTURES[$K] = $file;
- $K++;
- }
- }
- closedir($dir);
- }
- $GALLERY_DIR = $id;
-
- if (is_array($UPLOADED_PICTURES)) {
- foreach ($UPLOADED_PICTURES as $k => $v) {
- $TMP = @getimagesize(UPLOAD_FOLDER . $id . '/' . $v);
- if ($TMP[2] >= 1 && $TMP[2] <= 3) {
- $template->assign_block_vars('gallery', array(
- 'V' => $v
- ));
- }
- }
- }
+if (is_dir(UPLOAD_PATH . $id))
+{
+ $dir = opendir(UPLOAD_FOLDER . $id);
+ if ($dir)
+ {
+ while ($file = @readdir($dir))
+ {
+ if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false)
+ {
+ $UPLOADED_PICTURES[$K] = $file;
+ $K++;
+ }
+ }
+ closedir($dir);
+ }
+ $GALLERY_DIR = $id;
+
+ if (is_array($UPLOADED_PICTURES))
+ {
+ foreach ($UPLOADED_PICTURES as $k => $v)
+ {
+ $TMP = @getimagesize(UPLOAD_FOLDER . $id . '/' . $v);
+ if ($TMP[2] >= 1 && $TMP[2] <= 3)
+ {
+ $template->assign_block_vars('gallery', array(
+ 'V' => $v
+ ));
+ }
+ }
+ }
}
// payment methods
@@ -435,17 +475,23 @@
$query = "SELECT gateway_active, is_gateway, name, displayname FROM " . $DBPrefix . "payment_options";
$db->direct_query($query);
$p_first = true;
-while ($payment_method = $db->fetch()) {
- if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0) {
- if (in_array($payment_method['name'], $payment)) {
- if (!$p_first) {
- $payment_methods .= ', ';
- } else {
- $p_first = false;
- }
- $payment_methods .= $payment_method['displayname'];
- }
- }
+while ($payment_method = $db->fetch())
+{
+ if ($payment_method['gateway_active'] == 1 || $payment_method['is_gateway'] == 0)
+ {
+ if (in_array($payment_method['name'], $payment))
+ {
+ if (!$p_first)
+ {
+ $payment_methods .= ', ';
+ }
+ else
+ {
+ $p_first = false;
+ }
+ $payment_methods .= $payment_method['displayname'];
+ }
+ }
}
$bn_link = (!$has_ended) ? ' ' : '';
@@ -453,95 +499,94 @@
$page_title = htmlspecialchars($auction_data['title']);
$shipping = '';
-if ($auction_data['shipping'] == 1) {
- $shipping = $MSG['031'];
-} elseif ($auction_data['shipping'] == 2) {
- $shipping = $MSG['032'];
-} elseif ($auction_data['shipping'] == 3) {
- $shipping = $MSG['867'];
-}
+if ($auction_data['shipping'] == 1)
+ $shipping = $MSG['031'];
+elseif ($auction_data['shipping'] == 2)
+ $shipping = $MSG['032'];
+elseif ($auction_data['shipping'] == 3)
+ $shipping = $MSG['867'];
$template->assign_vars(array(
- 'ID' => $auction_data['id'],
- 'TITLE' => htmlspecialchars($auction_data['title']),
- 'SUBTITLE' => htmlspecialchars($auction_data['subtitle']),
- 'AUCTION_DESCRIPTION' => $auction_data['description'],
- 'PIC_URL' => $auction_data['pict_url'],
- 'SHIPPING_COST' => ($auction_data['shipping_cost'] > 0) ? $system->print_money($auction_data['shipping_cost']) : $MSG['1152'],
- 'ADDITIONAL_SHIPPING_COST' => $system->print_money($auction_data['additional_shipping_cost']),
- 'COUNTRY' => $auction_data['country'],
- 'CITY' => $auction_data['city'],
- 'ZIP' => $auction_data['zip'],
- 'QTY' => $auction_data['quantity'],
- 'ENDS' => $ending_time,
- 'ENDS_IN' => (strtotime($ends) - time()),
- 'STARTTIME' => $dt->printDateTz($start),
- 'ENDTIME' => $dt->printDateTz($ends),
- 'BUYNOW1' => $auction_data['buy_now'],
- 'BUYNOW2' => ($auction_data['buy_now'] > 0) ? $system->print_money($auction_data['buy_now']) . $bn_link : $system->print_money($auction_data['buy_now']),
- 'NUMBIDS' => $num_bids,
- 'MINBID' => $min_bid,
- 'MAXBID' => $high_bid,
- 'NEXTBID' => $next_bid,
- 'INTERNATIONAL' => ($auction_data['international']) ? $MSG['033'] : $MSG['043'],
- 'SHIPPING' => $shipping,
- 'SHIPPINGTERMS' => nl2br(htmlspecialchars($auction_data['shipping_terms'])),
- 'PAYMENTS' => $payment_methods,
- 'AUCTION_VIEWS' => $auction_data['counter'],
- 'AUCTION_TYPE' => ($auction_data['bn_only'] == 0) ? $system->SETTINGS['auction_types'][$auction_type] : $MSG['933'],
- 'ATYPE' => $auction_type,
- 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
- 'VIEW_HISTORY1' => (empty($view_history)) ? '' : $view_history . ' | ',
- 'VIEW_HISTORY2' => $view_history,
- 'TOPCATSPATH' => ($system->SETTINGS['extra_cat'] == 'y' && isset($_SESSION['browse_id']) && $_SESSION['browse_id'] == $auction_data['secondcat']) ? $secondcat_value : $cat_value,
- 'CATSPATH' => $cat_value,
- 'SECCATSPATH' => $secondcat_value,
- 'CAT_ID' => $auction_data['category'],
- 'UPLOADEDPATH' => UPLOAD_FOLDER,
- 'BNIMG' => get_lang_img('buy_it_now.gif'),
-
- 'SELLER_REG' => $seller_reg,
- 'SELLER_ID' => $auction_data['user'],
- 'SELLER_NICK' => $auction_data['nick'],
- 'SELLER_TOTALFB' => $total_rate,
- 'SELLER_FB_ICON' => $seller_feedback_icon,
- 'SELLER_NUMFB' => $num_feedbacks,
- 'SELLER_FBPOS' => ($num_feedbacks > 0) ? '(' . ceil($fb_pos * 100 / $num_feedbacks) . '%)' : $MSG['000'],
- 'SELLER_FBNEG' => ($fb_neg > 0 && $total_rate != 0) ? $MSG['5507'] . ' (' . ceil($fb_neg * 100 / $total_rate) . '%)' : '0',
-
- 'WATCH_VAR' => $watch_var,
- 'WATCH_STRING' => $watch_string,
-
- 'YOURBIDMSG' => (isset($yourbidmsg)) ? $yourbidmsg : '',
- 'YOURBIDCLASS' => (isset($yourbidclass)) ? $yourbidclass : '',
-
- 'B_HASENDED' => $has_ended,
- 'B_CANEDIT' => ($user->logged_in && $user->user_data['id'] == $auction_data['user'] && $num_bids == 0 && !($difference == null || $difference->invert)),
- 'B_CANCONTACTSELLER' => (($system->SETTINGS['contactseller'] == 'always' || ($system->SETTINGS['contactseller'] == 'logged' && $user->logged_in)) && (!$user->logged_in || $user->user_data['id'] != $auction_data['user'])),
- 'B_HASIMAGE' => (!empty($auction_data['pict_url'])),
- 'B_NOTBNONLY' => ($auction_data['bn_only'] == 0),
- 'B_HASRESERVE' => ($auction_data['reserve_price'] > 0 && $auction_data['reserve_price'] > $auction_data['current_bid']),
- 'B_BNENABLED' => ($system->SETTINGS['buy_now'] == 2),
- 'B_HASGALELRY' => (count($UPLOADED_PICTURES) > 0),
- 'B_SHOWHISTORY' => (isset($_GET['history']) && $num_bids > 0),
- 'B_BUY_NOW' => ($auction_data['buy_now'] > 0 && ($auction_data['bn_only'] || $auction_data['bn_only'] == 0 && ($auction_data['num_bids'] == 0 || ($auction_data['reserve_price'] > 0 && $auction_data['current_bid'] < $auction_data['reserve_price'])))),
- 'B_BUY_NOW_ONLY' => ($auction_data['bn_only']),
- 'B_ADDITIONAL_SHIPPING_COST' => ($auction_data['auction_type'] == '2'),
- 'B_USERBID' => $userbid,
- 'B_BIDDERPRIV' => ($system->SETTINGS['buyerprivacy'] == 'y' && (!$user->logged_in || ($user->logged_in && $user->user_data['id'] != $auction_data['user']))),
- 'B_HASBUYER' => (count($hbidder_data) > 0),
- 'B_COUNTDOWN' => ($system->SETTINGS['hours_countdown'] > ((strtotime($ends) - time()) / 3600)),
- 'B_HAS_QUESTIONS' => ($num_questions > 0),
- 'B_CAN_BUY' => ($user->permissions['can_buy'] || (!$user->logged_in && $system->SETTINGS['bidding_visable_to_guest'])) && !(strtotime($start) > time()),
- 'B_SHIPPING' => ($system->SETTINGS['shipping'] == 'y'),
- 'B_SHOWENDTIME' => $showendtime,
- 'B_SHOW_ADDITIONAL_SHIPPING_COST' => ($auction_data['additional_shipping_cost'] > 0)
- ));
+ 'ID' => $auction_data['id'],
+ 'TITLE' => htmlspecialchars($auction_data['title']),
+ 'SUBTITLE' => htmlspecialchars($auction_data['subtitle']),
+ 'AUCTION_DESCRIPTION' => $auction_data['description'],
+ 'PIC_URL' => UPLOAD_FOLDER . $id . '/' . $auction_data['pict_url'],
+ 'SHIPPING_COST' => ($auction_data['shipping_cost'] > 0) ? $system->print_money($auction_data['shipping_cost']) : $MSG['1152'],
+ 'ADDITIONAL_SHIPPING_COST' => $system->print_money($auction_data['additional_shipping_cost']),
+ 'COUNTRY' => $auction_data['country'],
+ 'CITY' => $auction_data['city'],
+ 'ZIP' => $auction_data['zip'],
+ 'QTY' => $auction_data['quantity'],
+ 'ENDS' => $ending_time,
+ 'ENDS_IN' => ($ends - time()),
+ 'STARTTIME' => ArrangeDateNoCorrection($start + $system->tdiff),
+ 'ENDTIME' => ArrangeDateNoCorrection($ends + $system->tdiff),
+ 'BUYNOW1' => $auction_data['buy_now'],
+ 'BUYNOW2' => ($auction_data['buy_now'] > 0) ? $system->print_money($auction_data['buy_now']) . $bn_link : $system->print_money($auction_data['buy_now']),
+ 'NUMBIDS' => $num_bids,
+ 'MINBID' => $min_bid,
+ 'MAXBID' => $high_bid,
+ 'NEXTBID' => $next_bid,
+ 'INTERNATIONAL' => ($auction_data['international']) ? $MSG['033'] : $MSG['043'],
+ 'SHIPPING' => $shipping,
+ 'SHIPPINGTERMS' => nl2br(htmlspecialchars($auction_data['shipping_terms'])),
+ 'PAYMENTS' => $payment_methods,
+ 'AUCTION_VIEWS' => $auction_data['counter'],
+ 'AUCTION_TYPE' => ($auction_data['bn_only'] == 0) ? $system->SETTINGS['auction_types'][$auction_type] : $MSG['933'],
+ 'ATYPE' => $auction_type,
+ 'THUMBWIDTH' => $system->SETTINGS['thumb_show'],
+ 'VIEW_HISTORY1' => (empty($view_history)) ? '' : $view_history . ' | ',
+ 'VIEW_HISTORY2' => $view_history,
+ 'TOPCATSPATH' => ($system->SETTINGS['extra_cat'] == 'y' && isset($_SESSION['browse_id']) && $_SESSION['browse_id'] == $auction_data['secondcat']) ? $secondcat_value : $cat_value,
+ 'CATSPATH' => $cat_value,
+ 'SECCATSPATH' => $secondcat_value,
+ 'CAT_ID' => $auction_data['category'],
+ 'UPLOADEDPATH' => UPLOAD_FOLDER,
+ 'BNIMG' => get_lang_img('buy_it_now.gif'),
+
+ 'SELLER_REG' => $seller_reg,
+ 'SELLER_ID' => $auction_data['user'],
+ 'SELLER_NICK' => $auction_data['nick'],
+ 'SELLER_TOTALFB' => $total_rate,
+ 'SELLER_FBICON' => (!empty($seller_rate_icon) && $seller_rate_icon != 'transparent.gif') ? ' ' : '',
+ 'SELLER_NUMFB' => $num_feedbacks,
+ 'SELLER_FBPOS' => ($num_feedbacks > 0) ? '(' . ceil($fb_pos * 100 / $num_feedbacks) . '%)' : $MSG['000'],
+ 'SELLER_FBNEG' => ($fb_neg > 0) ? $MSG['5507'] . ' (' . ceil($fb_neg * 100 / $total_rate) . '%)' : '0',
+
+ 'WATCH_VAR' => $watch_var,
+ 'WATCH_STRING' => $watch_string,
+
+ 'YOURBIDMSG' => (isset($yourbidmsg)) ? $yourbidmsg : '',
+ 'YOURBIDCLASS' => (isset($yourbidclass)) ? $yourbidclass : '',
+
+ 'B_HASENDED' => $has_ended,
+ 'B_CANEDIT' => ($user->logged_in && $user->user_data['id'] == $auction_data['user'] && $num_bids == 0 && $difference > 0),
+ 'B_CANCONTACTSELLER' => (($system->SETTINGS['contactseller'] == 'always' || ($system->SETTINGS['contactseller'] == 'logged' && $user->logged_in)) && (!$user->logged_in || $user->user_data['id'] != $auction_data['user'])),
+ 'B_HASIMAGE' => (!empty($auction_data['pict_url'])),
+ 'B_NOTBNONLY' => ($auction_data['bn_only'] == 0),
+ 'B_HASRESERVE' => ($auction_data['reserve_price'] > 0 && $auction_data['reserve_price'] > $auction_data['current_bid']),
+ 'B_BNENABLED' => ($system->SETTINGS['buy_now'] == 2),
+ 'B_HASGALELRY' => (count($UPLOADED_PICTURES) > 0),
+ 'B_SHOWHISTORY' => (isset($_GET['history']) && $num_bids > 0),
+ 'B_BUY_NOW' => ($auction_data['buy_now'] > 0 && ($auction_data['bn_only'] || $auction_data['bn_only'] == 0 && ($auction_data['num_bids'] == 0 || ($auction_data['reserve_price'] > 0 && $auction_data['current_bid'] < $auction_data['reserve_price'])))),
+ 'B_BUY_NOW_ONLY' => ($auction_data['bn_only']),
+ 'B_ADDITIONAL_SHIPPING_COST' => ($auction_data['auction_type'] == '2'),
+ 'B_USERBID' => $userbid,
+ 'B_BIDDERPRIV' => ($system->SETTINGS['buyerprivacy'] == 'y' && (!$user->logged_in || ($user->logged_in && $user->user_data['id'] != $auction_data['user']))),
+ 'B_HASBUYER' => (count($hbidder_data) > 0),
+ 'B_COUNTDOWN' => ($system->SETTINGS['hours_countdown'] > (($ends - time()) / 3600)),
+ 'B_HAS_QUESTIONS' => ($num_questions > 0),
+ 'B_CAN_BUY' => ($user->can_buy || (!$user->logged_in && $system->SETTINGS['bidding_visable_to_guest'])) && !($start > time()),
+ 'B_SHIPPING' => ($system->SETTINGS['shipping'] == 'y'),
+ 'B_SHOWENDTIME' => $showendtime,
+ 'B_SHOW_ADDITIONAL_SHIPPING_COST' => ($auction_data['additional_shipping_cost'] > 0)
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'item.tpl'
- ));
+ 'body' => 'item.tpl'
+ ));
$template->display('body');
include 'footer.php';
unset($_SESSION['browse_id']);
diff --git a/item_report.php b/item_report.php
old mode 100644
new mode 100755
index 36cf5b3cd..c68ef6bec
--- a/item_report.php
+++ b/item_report.php
@@ -1,6 +1,6 @@
checkAuth()) {
- header("location: user_login.php");
- exit;
+if (!$user->checkAuth())
+{
+ header("location: user_login.php");
+ exit;
}
// check recaptcha is enabled
-if ($system->SETTINGS['spam_reportitem'] == 2) {
- include PACKAGE_PATH . 'recaptcha/recaptcha.php';
-} elseif ($system->SETTINGS['spam_reportitem'] == 1) {
- include PACKAGE_PATH . 'captcha/securimage.php';
+if ($system->SETTINGS['spam_reportitem'] == 2)
+{
+ include PACKAGE_PATH . 'recaptcha/recaptcha.php';
+}
+elseif ($system->SETTINGS['spam_reportitem'] == 1)
+{
+ include PACKAGE_PATH . 'captcha/securimage.php';
}
-if (isset($_REQUEST['id'])) {
- $_SESSION['CURRENT_ITEM'] = intval($_REQUEST['id']);
+if (isset($_REQUEST['id']))
+{
+ $_SESSION['CURRENT_ITEM'] = intval($_REQUEST['id']);
}
$id = $_SESSION['CURRENT_ITEM'];
@@ -40,74 +45,91 @@
$params = array();
$params[] = array(':auc_id', $id, 'int');
$db->query($query, $params);
-if ($db->numrows() > 0) {
- $TPL_item_title = $db->result('title');
-} else {
- $_SESSION['msg_title'] = $ERR_622;
- $_SESSION['msg_body'] = $ERR_623;
- header('location: message.php');
- exit;
+if ($db->numrows() > 0)
+{
+ $TPL_item_title = $db->result('title');
+}
+else
+{
+ $_SESSION['msg_title'] = $ERR_622;
+ $_SESSION['msg_body'] = $ERR_623;
+ header('location: message.php');
+ exit;
}
$spam_html = '';
-if ($system->SETTINGS['spam_reportitem'] == 1) {
- $resp = new Securimage();
- $spam_html = $resp->getCaptchaHtml();
+if ($system->SETTINGS['spam_reportitem'] == 1)
+{
+ $resp = new Securimage();
+ $spam_html = $resp->getCaptchaHtml();
}
-if (isset($_POST['action']) && $_POST['action'] == 'reportitem') {
- // check errors
- if (empty($_POST['reason']) || (isset($_POST['reason']) && $_POST['reason'] == '0')) {
- $TPL_error_text = $ERR_INVALID_REPORT_REASON;
- }
+if (isset($_POST['action']) && $_POST['action'] == 'reportitem')
+{
+ // check errors
+ if (empty($_POST['reason']) || (isset($_POST['reason']) && $_POST['reason'] == '0'))
+ {
+ $TPL_error_text = $ERR_INVALID_REPORT_REASON;
+ }
- $auction_id = intval($_POST['id']);
+ $auction_id = intval($_POST['id']);
- if ($system->SETTINGS['spam_reportitem'] == 2) {
- $resp = recaptcha_check_answer($system->SETTINGS['recaptcha_private'], $_POST['g-recaptcha-response']);
- if (!$resp) {
- $TPL_error_text = $MSG['752'];
- }
- } elseif ($system->SETTINGS['spam_reportitem'] == 1) {
- if (!$resp->check($_POST['captcha_code'])) {
- $TPL_error_text = $MSG['752'];
- }
- }
+ if ($system->SETTINGS['spam_reportitem'] == 2)
+ {
+ $resp = recaptcha_check_answer($system->SETTINGS['recaptcha_private'], $_POST['g-recaptcha-response']);
+ if (!$resp)
+ {
+ $TPL_error_text = $MSG['752'];
+ }
+ }
+ elseif ($system->SETTINGS['spam_reportitem'] == 1)
+ {
+ if (!$resp->check($_POST['captcha_code']))
+ {
+ $TPL_error_text = $MSG['752'];
+ }
+ }
- $query = "INSERT INTO " . $DBPrefix . "reportedauctions
+ $query = "INSERT INTO " . $DBPrefix . "reportedauctions
(auction_id, reason, user_id)
VALUES
(:auction_id, :reason, :user_id);";
- $params = array();
- $params[] = array(':auction_id', $auction_id, 'int');
- $params[] = array(':reason', $_POST['reason'], 'str');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- if (!empty($TPL_error_text)) {
- $itemreported = 1;
- } else {
- $itemreported = 0;
- }
+ $params = array();
+ $params[] = array(':auction_id', $auction_id, 'int');
+ $params[] = array(':reason', $_POST['reason'], 'str');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ if (!empty($TPL_error_text))
+ {
+ $itemreported = 1;
+ }
+ else
+ {
+ $itemreported = 0;
+ }
}
-if ($system->SETTINGS['spam_reportitem'] == 2) {
- $capcha_text = recaptcha_get_html($system->SETTINGS['recaptcha_public']);
-} elseif ($system->SETTINGS['spam_reportitem'] == 1) {
- $capcha_text = $spam_html;
+if ($system->SETTINGS['spam_reportitem'] == 2)
+{
+ $capcha_text = recaptcha_get_html($system->SETTINGS['recaptcha_public']);
+}
+elseif ($system->SETTINGS['spam_reportitem'] == 1)
+{
+ $capcha_text = $spam_html;
}
$template->assign_vars(array(
- 'ERROR' => $TPL_error_text,
- 'ID' => intval($_REQUEST['id']),
- 'CAPTCHATYPE' => $system->SETTINGS['spam_reportitem'],
- 'CAPCHA' => (isset($capcha_text)) ? $capcha_text : '',
- 'TITLE' => $TPL_item_title,
- 'ITEMREPORTED' => $itemreported
- ));
+ 'ERROR' => $TPL_error_text,
+ 'ID' => intval($_REQUEST['id']),
+ 'CAPTCHATYPE' => $system->SETTINGS['spam_reportitem'],
+ 'CAPCHA' => (isset($capcha_text)) ? $capcha_text : '',
+ 'TITLE' => $TPL_item_title,
+ 'ITEMREPORTED' => $itemreported
+ ));
include 'header.php';
$template->set_filenames(array(
- 'body' => 'item_report.tpl'
- ));
+ 'body' => 'item_report.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/item_watch.php b/item_watch.php
old mode 100644
new mode 100755
index be7b50628..afddc3fdc
--- a/item_watch.php
+++ b/item_watch.php
@@ -1,6 +1,6 @@
checkAuth()) {
- header("location: user_login.php");
- exit;
+if (!$user->checkAuth())
+{
+ header("location: user_login.php");
+ exit;
}
-$user_message = '';
-
// Auction id is present, now update table
-if (isset($_GET['add']) && !empty($_GET['add'])) {
- $add_id = intval($_GET['add']);
- // Check if this item is not already added
- $items = trim($user->user_data['item_watch']);
- $arr_items = explode(' ', $items);
+if (isset($_GET['add']) && !empty($_GET['add']))
+{
+ $add_id = intval($_GET['add']);
+ // Check if this item is not already added
+ $items = trim($user->user_data['item_watch']);
+ $match = strstr($items, strval($add_id));
- if (!in_array($add_id, $arr_items)) {
- $item_watch = trim($items . ' ' . $add_id);
- $item_watch_new = trim($item_watch);
- $query = "UPDATE " . $DBPrefix . "users SET item_watch = :item_watch_new WHERE id = :user_id";
- $params = array();
- $params[] = array(':item_watch_new', $system->cleanvars($item_watch_new), 'str');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $user->user_data['item_watch'] = $item_watch_new;
- $user_message .= $MSG['item_watch_item_added'];
- } else {
- $user_message .= $MSG['item_watch_not_added'];
- }
+ if (!$match)
+ {
+ $item_watch = trim($items . ' ' . $add_id);
+ $item_watch_new = trim($item_watch);
+ $query = "UPDATE " . $DBPrefix . "users SET item_watch = :item_watch_new WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':item_watch_new', $system->cleanvars($item_watch_new), 'str');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $user->user_data['item_watch'] = $item_watch_new;
+ }
}
// Delete item form item watch
-if (isset($_GET['delete']) && !empty($_GET['delete'])) {
- $item_to_delete = $_GET['delete'];
- $currently_watched_items = explode(' ', trim($user->user_data['item_watch']));
-
- $items_to_watch = array();
+if (isset($_GET['delete']) && !empty($_GET['delete']))
+{
+ $item_to_delete = $_GET['delete'];
+ $currently_watched_items = explode(' ', trim($user->user_data['item_watch']));
+
+ $items_to_watch = array();
- for ($j = 0; $j < count($currently_watched_items); $j++) {
- if ($currently_watched_items[$j] != $item_to_delete) {
- array_push($items_to_watch, $currently_watched_items[$j]);
- }
- }
+ for ($j = 0; $j < count($currently_watched_items); $j++)
+ {
+ if ($currently_watched_items[$j] != $item_to_delete)
+ {
+ array_push($items_to_watch, $currently_watched_items[$j]);
+ }
+ }
- $query = "UPDATE " . $DBPrefix . "users SET item_watch = :item_watch WHERE id = :user_id";
- $params = array();
- $params[] = array(':item_watch', implode(' ', $items_to_watch), 'str');
- $params[] = array(':user_id', $user->user_data['id'], 'int');
- $db->query($query, $params);
- $user->user_data['item_watch'] = implode(' ', $items_to_watch);
- $user_message .= $MSG['item_watch_item_removed'];
+ $query = "UPDATE " . $DBPrefix . "users SET item_watch = :item_watch WHERE id = :user_id";
+ $params = array();
+ $params[] = array(':item_watch', implode(' ', $items_to_watch), 'str');
+ $params[] = array(':user_id', $user->user_data['id'], 'int');
+ $db->query($query, $params);
+ $user->user_data['item_watch'] = implode(' ', $items_to_watch);
}
// Show results
$items = trim($user->user_data['item_watch']);
-if ($items != '' && $items != null) {
- $itemids = str_replace(' ', ',', $items);
- $query = "SELECT * FROM " . $DBPrefix . "auctions WHERE id IN (" . $itemids . ")";
- $db->direct_query($query);
- $total = $db->numrows();
- browseItems($query, null, '', '', $total, 'item_watch.php');
+if ($items != '' && $items != null)
+{
+ $itemids = str_replace(' ', ',', $items);
+ $query = "SELECT * FROM " . $DBPrefix . "auctions WHERE id IN (" . $itemids . ")";
+ $db->direct_query($query);
+ $total = $db->numrows();
+ browseItems($query, null, '', '', $total, 'item_watch.php');
}
-$template->assign_vars(array(
- 'USER_MESSAGE' => $user_message
- ));
-
include 'header.php';
$TMP_usmenutitle = $MSG['472'];
include INCLUDE_PATH . 'user_cp.php';
$template->set_filenames(array(
- 'body' => 'item_watch.tpl'
- ));
+ 'body' => 'item_watch.tpl'
+ ));
$template->display('body');
include 'footer.php';
diff --git a/js/calendar.js b/js/calendar.js
old mode 100644
new mode 100755
index 5b066cc66..358fb645e
--- a/js/calendar.js
+++ b/js/calendar.js
@@ -7,7 +7,7 @@ function f_tcalParseDate (s_date) {
s_date = s_date.split(' ');
this.s_time = s_date[1];
- var re_date = /^\s*(\d{1,2})\/(\d{1,2})\/(\d{2,4})\s*$/;
+ var re_date = /^\s*(\d{1,2})\-(\d{1,2})\-(\d{2,4})\s*$/;
if (!re_date.exec(s_date[0]))
return alert (this.a_tpl.invaliddate(s_date))
@@ -333,4 +333,4 @@ var b_mac = s_userAgent.indexOf('mac') != -1,
b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
var b_ieFix = b_ie5 || b_ie6,
b_ieMac = b_mac && b_ie5,
- b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
+ b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
\ No newline at end of file
diff --git a/js/ckeditor/.htaccess b/js/ckeditor/.htaccess
old mode 100644
new mode 100755
diff --git a/js/ckeditor/CHANGES.md b/js/ckeditor/CHANGES.md
old mode 100644
new mode 100755
index d291c8d58..db594dc6b
--- a/js/ckeditor/CHANGES.md
+++ b/js/ckeditor/CHANGES.md
@@ -1,169 +1,11 @@
CKEditor 4 Changelog
====================
-## CKEditor 4.5.11
-
-**Security Updates:**
-
-* [Severity: minor] Fixed the target="_blank" vulnerability reported by James Gaskell.
-
- Issue summary: If a victim had access to a spoofed version of ckeditor.com via HTTP (e.g. due to DNS spoofing, using a hacked public network or mailicious hotspot), then when using a link to the ckeditor.com website it was possible for the attacker to change the current URL of the opening page, even if the opening page was protected with SSL.
-
- An upgrade is recommended.
-
-New Features:
-
-* [#14747](http://dev.ckeditor.com/ticket/14747): The [Enhanced Image](http://ckeditor.com/addon/image2) caption now supports the link `target` attribute.
-* [#7154](http://dev.ckeditor.com/ticket/7154): Added support for the "Display Text" field to the [Link](http://ckeditor.com/addon/link) dialog. Thanks to [Ryan Guill](https://github.com/ryanguill)!
-
-Fixed Issues:
-
-* [#13362](http://dev.ckeditor.com/ticket/13362): [Blink, WebKit] Fixed: Active widget element is not cached when it is losing focus and it is inside an editable element.
-* [#13755](http://dev.ckeditor.com/ticket/13755): [Edge] Fixed: Pasting images does not work.
-* [#13548](http://dev.ckeditor.com/ticket/13548): [IE] Fixed: Clicking the [elements path](http://ckeditor.com/addon/elementspath) disables Cut and Copy icons.
-* [#13812](http://dev.ckeditor.com/ticket/13812): Fixed: When aborting file upload the placeholder for image is left.
-* [#14659](http://dev.ckeditor.com/ticket/14659): [Blink] Fixed: Content scrolled to the top after closing the dialog in a [``-based editor](http://ckeditor.com/addon/divarea).
-* [#14825](http://dev.ckeditor.com/ticket/14825): [Edge] Fixed: Focusing the editor causes unwanted scrolling due to dropped support for the `setActive` method.
-
-## CKEditor 4.5.10
-
-Fixed Issues:
-
-* [#10750](http://dev.ckeditor.com/ticket/10750): Fixed: The editor does not escape the `font-style` family property correctly, removing quotes and whitespace from font names.
-* [#14413](http://dev.ckeditor.com/ticket/14413): Fixed: The [Auto Grow](http://ckeditor.com/addon/autogrow) plugin with the [`config.autoGrow_onStartup`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoGrow_onStartup) option set to `true` does not work properly for an editor that is not visible.
-* [#14451](http://dev.ckeditor.com/ticket/14451): Fixed: Numeric element ID not escaped properly. Thanks to [Jakub Chalupa](https://github.com/chaluja7)!
-* [#14590](http://dev.ckeditor.com/ticket/14590): Fixed: Additional line break appearing after inline elements when switching modes. Thanks to [dpidcock](https://github.com/dpidcock)!
-* [#14539](https://dev.ckeditor.com/ticket/14539): Fixed: JAWS reads "selected Blank" instead of "selected
" when selecting a widget.
-* [#14701](http://dev.ckeditor.com/ticket/14701): Fixed: More precise labels for [Enhanced Image](http://ckeditor.com/addon/image2) and [Placeholder](http://ckeditor.com/addon/placeholder) widgets.
-* [#14667](http://dev.ckeditor.com/ticket/14667): [IE] Fixed: Removing background color from selected text removes background color from the whole paragraph.
-* [#14252](http://dev.ckeditor.com/ticket/14252): [IE] Fixed: Styles drop-down list does not always reflect the current style of the text line.
-* [#14275](http://dev.ckeditor.com/ticket/14275): [IE9+] Fixed: `onerror` and `onload` events are not used in browsers it could have been used when loading scripts dynamically.
-
-## CKEditor 4.5.9
-
-Fixed Issues:
-
-* [#10685](http://dev.ckeditor.com/ticket/10685): Fixed: Unreadable toolbar icons after updating to the new editor version. Fixed with [6876179](https://github.com/ckeditor/ckeditor-dev/commit/6876179db4ee97e786b07b8fd72e6b4120732185) in [ckeditor-dev](https://github.com/ckeditor/ckeditor-dev) and [6c9189f4](https://github.com/ckeditor/ckeditor-presets/commit/6c9189f46392d2c126854fe8889b820b8c76d291) in [ckeditor-presets](https://github.com/ckeditor/ckeditor-presets).
-* [#14573](https://dev.ckeditor.com/ticket/14573): Fixed: Missing [Widget](http://ckeditor.com/addon/widget) drag handler CSS when there are multiple editor instances.
-* [#14620](https://dev.ckeditor.com/ticket/14620): Fixed: Setting both the `min-height` style for the `` element and the `height` style for the `` element breaks the [Auto Grow](http://ckeditor.com/addon/autogrow) plugin.
-* [#14538](http://dev.ckeditor.com/ticket/14538): Fixed: Keyboard focus goes into an embedded `
-
+
\ No newline at end of file
diff --git a/themes/adminClassic/addnew.tpl b/themes/adminClassic/addnew.tpl
old mode 100644
new mode 100755
index 046b3d956..fbdc7bd9a
--- a/themes/adminClassic/addnew.tpl
+++ b/themes/adminClassic/addnew.tpl
@@ -35,8 +35,8 @@
{L_521}
- checked="checked"> {L_yes}
- checked="checked"> {L_no}
+ checked="checked"> {L_030}
+ checked="checked"> {L_029}
diff --git a/themes/adminClassic/adminpages.tpl b/themes/adminClassic/adminpages.tpl
old mode 100644
new mode 100755
diff --git a/themes/adminClassic/adminusers.tpl b/themes/adminClassic/adminusers.tpl
old mode 100644
new mode 100755
index 81db2576c..2bbfa4bb6
--- a/themes/adminClassic/adminusers.tpl
+++ b/themes/adminClassic/adminusers.tpl
@@ -7,17 +7,17 @@