X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fmodules%2Fadmin%2Fwhat-list_links.php;h=fcf1a4ec92d875eaf6fd8c379b5a5ddfb80fdc3e;hb=4e828541f3977c085ef54d3490b3e0069eb09a06;hp=ba73c7223664198edd7d163db214250e47989b44;hpb=a1ef1533f17e1ca5db81a9912632491e72626694;p=mailer.git
diff --git a/inc/modules/admin/what-list_links.php b/inc/modules/admin/what-list_links.php
index ba73c72236..fcf1a4ec92 100644
--- a/inc/modules/admin/what-list_links.php
+++ b/inc/modules/admin/what-list_links.php
@@ -32,23 +32,23 @@
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
} elseif (!EXT_IS_ACTIVE("mailid")) {
- ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid"));
+ addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "mailid");
return;
}
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
if (empty($_GET['del'])) $_GET['del'] = "";
if (!empty($_GET['u_id'])) {
// Check if the user already exists
- $result = SQL_QUERY_ESC("SELECT surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
// Is there an entry?
if (SQL_NUMROWS($result) == 1) {
@@ -59,12 +59,12 @@ if (!empty($_GET['u_id'])) {
// Grab user's all unconfirmed mails
if (EXT_IS_ACTIVE("bonus")) {
// Load bonus ID
- $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s ORDER BY id",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
+ array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
} else {
// Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)
- $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s ORDER BY id",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
+ array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
}
// Get number of rows from the query
@@ -74,35 +74,45 @@ if (!empty($_GET['u_id'])) {
// Some unconfirmed mails left
if ($_GET['del'] == "all") {
// Delete all unconfirmed mails by this user
- $result_del = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s LIMIT %s",
- array(bigintval($_GET['u_id']), $nums), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s LIMIT %s",
+ array(bigintval($_GET['u_id']), $nums), __FILE__, __LINE__);
// Prepare mail and send it away
$msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval($_GET['u_id']));
- SEND_EMAIL($email, ADMIN_DEL_LINK_SUBJ, $msg);
+ SEND_EMAIL($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $msg);
// Display message
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LINKS_DELETED);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_LINKS_DELETED'));
} else {
// List all unconfirmed mails
$SW = 2; $OUT = "";
while (list($id, $id2, $type) = SQL_FETCHROW($result)) {
- // Load data from stats table...
+ // Initializes some variables
$cat = "";
+ $DATA = "";
+ $PROBLEM = GENERAL_MAIL_PROBLEM;
+ $result_data = false; // Closes Bug #58
+
+ // Load data from stats table...
switch ($type)
{
case "NORMAL":
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
- $type = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM;
- $LINK = "".$id."";
+ $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE id=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ $type = "mailid"; $DATA = $id; $PROBLEM = getMessage('NORMAL_MAIL_PROBLEM');
+ $LINK = "".$id."";
break;
case "BONUS":
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
- array(bigintval($id2)), __FILE__, __LINE__);
- $type = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM;
- $LINK = "".$id2."";
+ $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
+ array(bigintval($id2)), __FILE__, __LINE__);
+ $type = "bonusid"; $DATA = $id2; $PROBLEM = getMessage('BONUS_MAIL_PROBLEM');
+ $LINK = "".$id2."";
+ break;
+
+ default: // Problem in application detected!
+ // Log the error
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid email type %s detected.", $type));
break;
}
@@ -110,7 +120,7 @@ if (!empty($_GET['u_id'])) {
// Mail was found!
list($subject, $timestamp, $cat) = SQL_FETCHROW($result_data);
SQL_FREERESULT($result_data);
- if (empty($subject)) $subject = DEFAULT_SUBJECT_LINE;
+ if (empty($subject)) $subject = getMessage('DEFAULT_SUBJECT_LINE');
// Prepare data for the row template
$content = array(
@@ -142,10 +152,10 @@ if (!empty($_GET['u_id'])) {
// Remember list in constant for the template
define('__SNAME_VALUE', $sname);
define('__FNAME_VALUE', $fname);
- define('__EMAIL_VALUE', "".$email."");
+ define('__EMAIL_VALUE', "".$email."");
define('__EMAIL_LIST' , $OUT);
define('__NUMS_VALUE' , $nums);
- define('__UID_VALUE' , $_GET['u_id']);
+ define('__UID' , bigintval($_GET['u_id']));
// Load final template
LOAD_TEMPLATE("admin_list_links");