$points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
// So let's continue with probing his points amount
- if (($points - getConfig('doubler_left') - $_POST['points'] * getConfig('doubler_charge')) >= 0)
- {
+ if (($points - getConfig('doubler_left') - $_POST['points'] * getConfig('doubler_charge')) >= 0)
// Enough points are left so let's continue with the doubling process
// Create doubling "account" width *DOUBLED* points
SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".GET_REMOTE_ADDR()."', UNIX_TIMESTAMP(), 'N','N')",
// Add points to "total payed" including charge
$points = $_POST['points'] - $_POST['points'] * getConfig('doubler_charge');
UPDATE_CONFIG("doubler_points", $points, "+");
- getConfig('doubler_points') += $points;
+ incrementConfigEntry('doubler_points', $points);
// Add second line for the referal but only when uid != refid
if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid)) {
// Okay add a refid line and apply refid percents
- SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid,refid,points,remote_ip,timemark,completed,is_ref) VALUES ('%s',0,'%s','".GET_REMOTE_ADDR()."',UNIX_TIMESTAMP(),'N','Y')",
- array(bigintval($GLOBALS['refid']), bigintval($_POST['points'] * 2 * getConfig('doubler_ref'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_doubler (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".GET_REMOTE_ADDR()."',UNIX_TIMESTAMP(),'N','Y')",
+ array(
+ bigintval($GLOBALS['refid']),
+ bigintval($_POST['points'] * 2 * getConfig('doubler_ref'))
+ ), __FILE__, __LINE__);
- // And that's why we dont't want to you more than one referal level of doubler-points. ^^^
+ // And that's why we don't want to you more than one referal level of doubler-points. ^^^
} // END - if
// Update usage counter
define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "708");
+define('CURR_SVN_REVISION', "709");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// Return float
return $float;
}
+
// Handle menu-depending failed logins and return the rendered content
function HANDLE_LOGIN_FAILTURES ($accessLevel) {
// Default output is empty ;-)
// Return rendered content
return $OUT;
}
+
// Rebuild cache
function REBUILD_CACHE ($cache, $inc="") {
global $cacheInstance, $CSS;
} // END - if
} // END - if
}
+
// Purge admin menu cache
function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
global $cacheInstance;
}
// Experiemental feature!
- trigger_error("You have to delete the admin_*.cache files by yourself at this point.");
+ trigger_error("<strong>Experimental feature:</strong> You have to delete the admin_*.cache files by yourself at this point.");
}
+
// Translates the "pool type" into human-readable
function TRANSLATE_POOL_TYPE ($type) {
// Default type is unknown
// Return "translation"
return $translated;
}
+
// "Getter" for remote IP number
function GET_REMOTE_ADDR () {
// Get remote ip from environment
return $id;
}
-// Increment or init with 1 the given config entry
-function incrementConfigEntry ($configEntry) {
+// Increment or init with given value or 1 as default the given config entry
+function incrementConfigEntry ($configEntry, $value=1) {
global $_CONFIG;
// Increment it if set or init it with 1
- if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; }
+ if (getConfig($configEntry) > 0) {
+ $_CONFIG[$configEntry] += $value;
+ } else {
+ $_CONFIG[$configEntry] = $value;
+ }
}
//////////////////////////////////////////////////
define('ADMIN_DEL_COMPLETED', "Account wurde gelöscht! Die {!POINTS!} werden immer in den Jackpot transferiert!");
define('NORMAL_MAIL_PROBLEM', "Mail vom Mitgliedern bereits gelöscht");
define('BONUS_MAIL_PROBLEM', "Bonus-Mail bereits gelöscht");
+define('GENERAL_MAIL_PROBLEM', "BUG! BUG! Bitte reporten auf <a href=\"http://bugs.mxchange.org/\" target=\"_blank\" title=\"Link zum MXChange Bug-Tracker\">bugs.mxchange.org</a>.");
define('MEMBER_BACK_JACKPOT', "{!POINTS!}-Rueckgutschrift");
define('ADMIN_BACK_JACKPOT', "{!POINTS!}-Aufbuchung fuer Jackpot");
define('MEDIA_DATA', "Mediendaten");
define('WE_HAVE', "Wir haben");
define('MEMBER_TEST_URL', "Zur beworbenen Seite");
define('ADMIN_LOGS_DIR_404_1', "Das Verzeichnis mit den Zugriffslogbüchern konnte nicht gefunden werden! (<strong>");
-define('ADMIN_LOGS_DIR_404_2', "</strong>)");
+define('ADMIN_LOGS_DIR_404_2', "</strong>) Vermutlich unterstützt Ihr Server dieses nicht.");
define('ADMIN_USAGE_DIR_404_1', "Das Verzeichnis mit den Webalizer-Statistiken konnte nicht gefunden werden! (<strong>");
-define('ADMIN_USAGE_DIR_404_2', "</strong>)");
+define('ADMIN_USAGE_DIR_404_2', "</strong>) Vermutlich unterstützt Ihr Server dieses nicht.");
define('ADMIN_ENTER_REDIRECT_URL', "URL eingeben, wenn abgelehnt werden soll");
+define('MEMBER_NO_REFBANNER_FOUND', "Es sind noch keine Werbebanner eingerichtet worden. Bitte verwende solange deinen Referal-Link.");
define('ADMIN_ID_404_1', "ID <strong>");
define('ADMIN_ID_404_2', "</strong> nicht gefunden!");
define('ADMIN_ASSIGNED_ADMIN', "Zugewiesener Admin-Login");
define('FILTER_FAILED_NOT_REMOVED', "Die Filterfunktion <u>%s</u> konnte nicht aus der Filterkette <u>%s</u> entfernt werden, da sie nicht existiert.");
define('FILTER_FLUSH_FAILED_NO_DATABASE', "Kann die Filterketten nicht speichern. Datenbank fehlt!");
+// Status changes
+define('ADMIN_STATUS_CHANGED_1', "Es wurden <u>");
+define('ADMIN_STATUS_CHANGED_2', "</u> von <u>");
+define('ADMIN_STATUS_CHANGED_3', "</u> Einträgen geändert.");
+
//
?>
require($INC);
}
-//
-function DOUBLER_GENERATE_TABLE($uid="0", $done='N', $ref='N', $sort="ASC") {
+// Generates a HTML table baded on given data
+// @TODO Lame description!
+function DOUBLER_GENERATE_TABLE ($uid="0", $done='N', $ref='N', $sort="ASC") {
global $_CONFIG;
if (empty($cnt)) $cnt = 0;
$ADD = ""; $DT_MODE = 0;
// Return array
return $prices;
}
+
//
-function RALLYE_LOAD_USERS_ARRAY($rallye)
-{
+function RALLYE_LOAD_USERS_ARRAY ($rallye) {
global $_CONFIG;
// Fix zero points to 0.00000
// Load users uid old points earned
$result_user = SQL_QUERY_ESC("SELECT userid, refs, curr_points FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%s ORDER BY userid",
- array(bigintval($rallye)), __FILE__, __LINE__);
- while(list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user))
- {
+ array(bigintval($rallye)), __FILE__, __LINE__);
+ while (list($uid, $refs, $cpoints) = SQL_FETCHROW($result_user)) {
// Load current ref count
$cnt = RALLYE_GET_REFCOUNT($uid, $refs);
$prices = RALLYE_LOAD_PRICES_ARRAY($rallye);
// Merge users into prices
- foreach ($prices['level'] as $k => $lvl)
- {
- $prices['uid'][$k] = $users['uid'][$k];
- if (empty($prices['uid'][$k])) $prices['uid'][$k] = "---";
- $prices['ref'][$k] = $users['ref'][$k];
- if (empty($prices['ref'][$k])) $prices['ref'][$k] = "---";
- $prices['cpoints'][$k] = $users['cpoints'][$k];
- }
+ foreach ($prices['level'] as $k => $lvl) {
+ // We only need to check one element in $users, see above while() block
+ if (isset($users['uid'][$k])) {
+ $prices['uid'][$k] = $users['uid'][$k];
+ if (empty($prices['uid'][$k])) $prices['uid'][$k] = "---";
+ $prices['ref'][$k] = $users['ref'][$k];
+ if (empty($prices['ref'][$k])) $prices['ref'][$k] = "---";
+ $prices['cpoints'][$k] = $users['cpoints'][$k];
+ } // END - if
+ } // END - foreach
// Return completed array
return $prices;
}
+
//
-function RALLYE_LIST_WINNERS($rallye,$default=0)
-{
+function RALLYE_LIST_WINNERS ($rallye, $default=0) {
// First check how many prices are set
$result_prices = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_prices WHERE rallye_id=%s ORDER BY price_level",
array(bigintval($rallye)), __FILE__, __LINE__);
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
// Then abort here
- return "0.0";
+ return "!.!";
} // END - if
// Default version "number"
- $cver = "-.-";
+ $cver = "?.?";
// Is the cache entry there?
if (isset($cacheArray['themes']['theme_ver'][$name])) {
return $JOBS_DONE;
}
-//
-function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
+// Outputs selected tasks
+function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
global $_CONFIG, $NOTES;
- if ((isset($_POST['assign'])) && (count($_POST['task']) > 0)) {
+ if ((isset($POST['assign'])) && (count($POST['task']) > 0)) {
// Assign / do tasks
$OUT = ""; $SW = 2;
- foreach ($_POST['task'] as $id => $sel) {
+ foreach ($POST['task'] as $id => $sel) {
$result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')) LIMIT 1",
array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
if (SQL_NUMROWS($result_task) == 1) {
// Close task but not already closes or deleted or update tasks
if (($status != "CLOSED") && ($status != "DELETED") && ($type != "EXTENSION_UPDATE")) {
+ // Solve the task
RUN_FILTER('solve_task', $tid);
} // END - if
}
break;
- case "EXTENSION_UPDATE":
+ case "EXTENSION_UPDATE": // Extension update
// Extension updates are installed automatically
$OUT .= "<FONT class=\"admin_failed medium\">".ADMIN_EXTENSION_UPDATED."</FONT>\n";
if (EXT_IS_ACTIVE("payout")) {
// Extension is installed so let him send a notification to the user
$result_pay = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_payouts WHERE userid=%s AND payout_timestamp=%s LIMIT 1",
- array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
+ array(bigintval($uid), bigintval($created)), __FILE__, __LINE__);
list($pid) = SQL_FETCHROW($result_pay);
SQL_FREERESULT($result_pay);
// Load final template
LOAD_TEMPLATE("admin_overview_list");
} else {
- if ((isset($_POST['task'])) && ((sizeof($_POST['task']) > 0) || ($_POST['task'][0] == "1"))) {
+ if ((isset($POST['task'])) && ((sizeof($POST['task']) > 0) || ($POST['task'][0] == "1"))) {
// Only unassign / delete tasks when there are selected tasks posted
- if (!empty($_POST['unassign'])) {
+ if (!empty($POST['unassign'])) {
// Unassign from tasks
- foreach ($_POST['task'] as $id => $sel) {
+ foreach ($POST['task'] as $id => $sel) {
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE id=%s AND assigned_admin=%s LIMIT 1",
array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
}
- } elseif (isset($_POST['del'])) {
+ } elseif (isset($POST['del'])) {
// Delete tasks
- foreach ($_POST['task'] as $id => $sel) {
+ foreach ($POST['task'] as $id => $sel) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND assigned_admin IN (%s,0) LIMIT 1",
array(bigintval($id), GET_CURRENT_ADMIN_ID()), __FILE__, __LINE__);
}
}
$content = array(
'sw' => $SW,
+ 'id' => $id,
'tpl' => $templ,
'alnk' => $admin_link
);
if (!empty($_POST['rate'])) $_POST['rate'] = REVERT_COMMA($_POST['rate']);
-if ((isset($_POST['add'])) && (!empty($_POST['title'])) && ($_POST['rate'] > 0))
-{
+if ((isset($_POST['add'])) && (!empty($_POST['title'])) && ($_POST['rate'] > 0)) {
// Add new payout type
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_payout_types WHERE type='%s' LIMIT 1",
- array($_POST['title']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0)
- {
+ array($_POST['title']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 0) {
// Add now
SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_payout_types
(type, rate, min_points, from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url)
$_POST['ytrans'],
$_POST['allow_url'],
), __FILE__, __LINE__);
- $msg = "<FONT class=\"admin_done\">".ADMIN_PAYOUT_TYPE_ADDED."</FONT>";
- }
- else
- {
+ $msg = "<div class=\"admin_done\">".ADMIN_PAYOUT_TYPE_ADDED."</div>";
+ } else {
// Free memory
SQL_FREERESULT($result);
// Does already exist
- $msg = "<FONT class=\"admin_failed\">".ADMIN_PAYOUT_TYPE_ALREADY."</FONT>";
+ $msg = "<div class=\"admin_failed\">".ADMIN_PAYOUT_TYPE_ALREADY."</div>";
}
}
$result_mem = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_user_payouts WHERE status='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__);
$display = true;
-if ((isset($_POST['edit'])) && (SELECTION_COUNT($_POST['sel']) > 0))
-{
+if ((isset($_POST['edit'])) && (SELECTION_COUNT($_POST['sel']) > 0)) {
// Edit payout types
- if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok"))
- {
+ if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok")) {
// Edit entries
- foreach ($_POST['sel'] as $id => $sel)
- {
+ foreach ($_POST['sel'] as $id => $sel) {
// Secure ID
$id = bigintval($id);
// Edit only if something is entered
- if ((!empty($_POST['title'][$id])) && ($_POST['rate'][$id] > 0))
- {
+ if ((!empty($_POST['title'][$id])) && ($_POST['rate'][$id] > 0)) {
// Update entry
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_payout_types SET
type='%s',
}
}
$msg = ADMIN_PAYOUT_ENTRIES_CHANGED;
- }
- else
- {
+ } else {
$display = false; //Suppress any other outputs
$SW = 2; $OUT = "";
- foreach ($_POST['sel'] as $id => $sel)
- {
+ foreach ($_POST['sel'] as $id => $sel) {
// Load data
$result = SQL_QUERY_ESC("SELECT type, rate, min_points, allow_url FROM "._MYSQL_PREFIX."_payout_types WHERE id=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
// Load main template
LOAD_TEMPLATE("admin_config_payouts_edit");
}
-}
- elseif ((isset($_POST['del'])) && (SELECTION_COUNT($_POST['sel']) > 0))
-{
+} elseif ((isset($_POST['del'])) && (SELECTION_COUNT($_POST['sel']) > 0)) {
// Delete payout types
- if ($_GET['ok'] == "ok")
- {
+ if ((isset($_GET['ok'])) && ($_GET['ok'] == "ok")) {
// Delete entries
- foreach ($_POST['sel'] as $id => $sel)
- {
+ foreach ($_POST['sel'] as $id => $sel) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_payout_types WHERE id=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
}
$msg = ADMIN_PAYOUT_ENTRIES_DELETED;
- }
- else
- {
+ } else {
$display = false; //Suppress any other outputs
$SW = 2; $OUT = "";
- foreach ($_POST['sel'] as $id => $sel)
- {
+ foreach ($_POST['sel'] as $id => $sel) {
// Secure ID number
$id = bigintval($id);
}
}
-if (!empty($msg))
-{
+if (!empty($msg)) {
// Output message
LOAD_TEMPLATE("admin_settings_saved", false, $msg);
}
// Payout types
$result_type = SQL_QUERY("SELECT id, type, rate, min_points, from_account FROM "._MYSQL_PREFIX."_payout_types ORDER BY type", __FILE__, __LINE__);
-if ((SQL_NUMROWS($result_type) > 0) && ($display))
-{
+if ((SQL_NUMROWS($result_type) > 0) && ($display)) {
// List all payout types
$SW = 2; $OUT = "";
- while (list($id, $type, $rate, $mpoi, $from) = SQL_FETCHROW($result_type))
- {
+ while (list($id, $type, $rate, $mpoi, $from) = SQL_FETCHROW($result_type)) {
// Prepare data for the row template
$content = array(
'sw' => $SW,
}
// Does your members request payouts?
-if ((SQL_NUMROWS($result_mem) > 0) && ($display))
-{
+if ((SQL_NUMROWS($result_mem) > 0) && ($display)) {
// Members has requested payouts
SQL_FREERESULT($result_mem);
OUTPUT_HTML("<P><A href=\"".URL."/modules.php?module=admin&what=list_payouts\">".ADMIN_PAYOUT_LIST_REQUESTS."</A></P>");
-}
- elseif ($display)
-{
+} elseif ($display) {
// No member requests so far
OUTPUT_HTML("<P><STRONG>".ADMIN_PAYOUT_NO_MEMBER_REQUESTS."</STRONG></P>");
}
+
// Add new paypout type
if ($display) LOAD_TEMPLATE("admin_payout_add_new");
// Load template
LOAD_TEMPLATE("admin_config_point_settings");
} elseif ($_GET['sub'] == "ref") {
- if ((isset($_POST['del'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
+ if ((isset($_POST['del'])) && (isset($_POST['sel'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
// Delete entries
$SW = 2; $OUT = "";
foreach ($_POST['sel'] as $id => $value) {
// Load main template
LOAD_TEMPLATE("admin_points_del");
- } elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
+ } elseif ((isset($_POST['edit'])) && (isset($_POST['sel'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
// Edit entries
$SW = 2; $OUT = "";
foreach ($_POST['sel'] as $id => $value) {
ADD_DESCR("admin", __FILE__);
// Check if the admin has entered title and what-php file name...
-if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok'])))
-{
+if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok'])) {
unset($_POST['ok']);
}
-if (!isset($_POST['ok']))
-{
+if (!isset($_POST['ok'])) {
// Create arrays
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
$result = SQL_QUERY("SELECT action, title, sort FROM `"._MYSQL_PREFIX."_guest_menu` WHERE (what='' OR what IS NULL) ORDER BY sort", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ if (SQL_NUMROWS($result) > 0) {
// Read menu structure
- while (list($act, $title, $sort) = SQL_FETCHROW($result))
- {
+ while (list($act, $title, $sort) = SQL_FETCHROW($result)) {
// Menu actions
$menus[] = $act;
// Remove double eintries
$prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
- foreach ($menus as $key => $value)
- {
- if ($value == $prev)
- {
+ foreach ($menus as $key => $value) {
+ if ($value == $prev) {
unset($dmy[$key]);
unset($dmy2[$key]);
unset($dmy3[$key]);
- }
- else
- {
+ } else {
$prev = $value;
}
}
+
$menus = $dmy; $titles = $dmy2; $below = $dmy3;
+
// Load sub menus :)
- foreach ($menus as $key_main => $value_main)
- {
+ foreach ($menus as $key_main => $value_main) {
$result = SQL_QUERY_ESC("SELECT what, title, sort
FROM "._MYSQL_PREFIX."_guest_menu
WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort",
- array(bigintval($value_main)), __FILE__, __LINE__);
+ array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0)
{
// Initialize arrays
ADD_DESCR("admin", __FILE__);
// Add new code?
-if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr'])))
-{
+if ((isset($_POST['add'])) && (!empty($_POST['code'])) && (!empty($_POST['descr']))) {
// Check if country code does already exist
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_countries WHERE code='%s' LIMIT 1",
array(strtoupper($_POST['code'])), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0)
- {
+ if (SQL_NUMROWS($result) == 0) {
// Save entry
SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_countries (code, descr, is_active) VALUES ('%s','%s','%s')",
array(strtoupper(substr($_POST['code'], 0, 2)), $_POST['descr'], $_POST['is_active']), __FILE__, __LINE__);
// Country added
$MSG = ADMIN_COUNTRY_ADDED_1.strtoupper($_POST['descr']).ADMIN_COUNTRY_ADDED_2;
- }
- else
- {
+ } else {
// Free memory
SQL_FREERESULT($result);
// Display message
LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
OUTPUT_HTML("<br />");
-}
-// Change status?
- elseif ((isset($_POST['change'])) && (!empty($_POST['id'])))
-{
+} elseif ((isset($_POST['change'])) && (!empty($_POST['id']))) {
// Change all status
ADMIN_CHANGE_ACTIVATION_STATUS($_POST['id'], "countries", "is_active");
-}
-// Edit / delete entries?
- elseif (((isset($_POST['edit'])) || (isset($_POST['delete']))) && (!empty($_POST['id'])))
-{
- if (count($_POST['id']) > 0)
- {
- if (isset($_POST['edit']))
- {
+} elseif (((isset($_POST['edit'])) || (isset($_POST['delete']))) && (!empty($_POST['id']))) {
+ if (count($_POST['id']) > 0) {
+ if (isset($_POST['edit'])) {
// Edit template
$row = "admin_list_country_edit_row";
$post = "modify";
$submit = ADMIN_COUNTRY_EDIT_NOW;
$title = ADMIN_COUNTRY_EDIT_TITLE;
$reset = "<INPUT type=\"reset\" class=\"admin_reset\" value=\"".UNDO_SELECTIONS."\"> *\n";
- }
- else
- {
+ } else {
// Delete template
$row = "admin_list_country_del_row";
$post = "remove";
// Edit all selected country codes
$OUT = ""; $SW = 2;
- foreach ($_POST['id'] as $id => $status)
- {
+ foreach ($_POST['id'] as $id => $status) {
// Load data from DB
$result = SQL_QUERY_ESC("SELECT code, descr FROM "._MYSQL_PREFIX."_countries WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array(bigintval($id)), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Load data
list($code, $descr) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
'descr' => $descr,
'sw' => $SW,
);
- if ($post == "modify")
- {
+
+ if ($post == "modify") {
// Generate default selection in edit-mode
$content['status'] = ADD_OPTION_LINES("/ARRAY/", array("Y","N"), array(YES, NO ), $status);
- }
- else
- {
+ } else {
// Only display status when in delete-mode
$content['status'] = TRANSLATE_YESNO($status);
}
+
+ // Insert row template and switch color
$OUT .= LOAD_TEMPLATE($row, true, $content);
$SW = 3 - $SW;
}
// Load main template
LOAD_TEMPLATE("admin_list_country_form");
}
-}
- else
-{
+} else {
// Shall we modify / remove entries now?
$MSG = ""; $SQLs = array();
- if ((isset($_POST['modify'])) && (!empty($_POST['id'])))
- {
+ if ((isset($_POST['modify'])) && (!empty($_POST['id']))) {
// Modify
- foreach ($_POST['id'] as $id => $sel)
- {
+ foreach ($_POST['id'] as $id => $sel) {
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_countries SET code='".$_POST['code'][$id]."', descr='".$_POST['descr'][$id]."', is_active='".$_POST['is_active'][$id]."' WHERE id='".$id."' LIMIT 1";
}
// Create message
$MSG = ADMIN_COUNTRIES_MODIFIED;
- }
- elseif ((isset($_POST['remove'])) && (!empty($_POST['id'])))
- {
+ } elseif ((isset($_POST['remove'])) && (!empty($_POST['id']))) {
// Remove
- $IDs = implode(", ", bigintval($_POST['id']));
+ $IDs = implode(", ", $_POST['id']);
$SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_countries WHERE id IN (".$IDs.") LIMIT ".count($_POST['id'])."";
// Create message
$MSG = ADMIN_COUNTRIES_REMOVED;
}
- if ((!empty($MSG)) && (count($SQLs) > 0))
- {
+ if ((!empty($MSG)) && (count($SQLs) > 0)) {
// Run SQL commands
- foreach ($SQLs as $sql)
- {
+ foreach ($SQLs as $sql) {
$result = SQL_QUERY($sql, __FILE__, __LINE__);
}
// Load currenty setup country codes to list
$result = SQL_QUERY("SELECT id, code, descr, is_active FROM "._MYSQL_PREFIX."_countries ORDER BY code", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ if (SQL_NUMROWS($result) > 0) {
// List all countries
$OUT = ""; $SW = 2;
- while(list($id, $code, $descr, $active) = SQL_FETCHROW($result))
- {
+ while(list($id, $code, $descr, $active) = SQL_FETCHROW($result)) {
// Prepare array for the template
$content = array(
'id' => $id,
// Free memory
SQL_FREERESULT($result);
- }
- else
- {
+ } else {
// No code setup so far (not possible by this software! 'DE' for 'Deutschland' is default
$OUT = LOAD_TEMPLATE("admin_list_country_no_row", true);
}
// 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__);
+ array(bigintval($id)), __FILE__, __LINE__);
$type = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM;
$LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&mailid=".$id."\" target=\"_blank\">".$id."</A>";
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__);
+ array(bigintval($id2)), __FILE__, __LINE__);
$type = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM;
$LINK = "<A href=\"".URL."/mailid.php?uid=".$_GET['u_id']."&bonusid=".$id2."\" target=\"_blank\">".$id2."</A>";
break;
+
+ default: // Problem in application detected!
+ // Log the error
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid email type %s detected.", $type));
+ break;
}
if (SQL_NUMROWS($result_data) == 1) {
}
@closedir($handle);
OUTPUT_HTML("</OL>");
- }
- else
- {
+ } else {
// logs directory does not exist
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LOGS_DIR_404_1.LOGS_BASE.ADMIN_LOGS_DIR_404_2);
}
$response = GET_URL("check-themes.php");
// Are theme_check found?
-if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
-{
+if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
// Ok, mark found and create the array
$THEMES = array(
'fname' => array(), // File names
$cver = THEME_GET_VERSION($name);
// Is the extension already installed or not?
- if (((SQL_NUMROWS($result) == 0) && (!FILE_READABLE($file))) || ($ver != $cver)) {
+ if (($ver != $cver) && ($cver != "?") && ($cver != "!")) {
// No, it isn't. So let's add this one!
$THEMES['fname'][] = $name;
$THEMES['fsize'][] = $response[$idx + 1];
$THEMES['ver'][] = $ver;
$THEMES['cver'][] = $cver;
+ // Extract language strings from reponse
$LANG_DUMMY = explode("[nl]", $response[$idx + 4]);
$LANG = array();
$INFO = ADMIN_EXT_NO_INFO_FOUND;
// Shall I add a counrty selection box or the old input box?
if (EXT_IS_ACTIVE("country")) {
// New variant, good!
- $OUT = "<SELECT name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
+ $OUT = "<select name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
$whereStatement = "WHERE is_active='Y'";
if (IS_ADMIN()) $whereStatement = "";
$OUT .= ADD_OPTION_LINES("countries", "id", "descr", $_POST['country_code'], "code", $whereStatement);
- $OUT .= "</SELECT>";
+ $OUT .= "</select>";
define('__COUNTRY_CONTENT', $OUT);
} else {
// Old out-dated variant
}
// Usage counter
-define('__DOUBLER_COUNTER', getConfig('doubler_counter'));
+define('__DOUBLER_COUNTER', TRANSLATE_COMMA(getConfig('doubler_counter')));
// Which mail-send-mode did the admin setup?
-switch (getConfig('doubler_send_mode'))
-{
+switch (getConfig('doubler_send_mode')) {
case "DIRECT":
define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT);
break;
define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
// Points left to double
-define('__LEFT_VALUE', DOUBLER_GET_TOTAL_POINTS_LEFT());
+define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
// Load template
LOAD_TEMPLATE("member_doubler");
// Load current referal clicks
$result = SQL_QUERY_ESC("SELECT ref_clicks FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-
+ array($GLOBALS['userid']), __FILE__, __LINE__);
list($c) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
<STRONG><A href=\"".URL."/ref.php?refid=".$GLOBALS['userid']."\" target=\"_blank\">".URL."/ref.php?ref=".$GLOBALS['userid']."</A></STRONG><br />
<br />");
-if (EXT_IS_ACTIVE("nickname"))
-{
+if (EXT_IS_ACTIVE("nickname")) {
// Add nickname link when nickname is entered
$nick = NICKNAME_GET_NICK($GLOBALS['userid']);
- if (!empty($nick))
- {
+ if (!empty($nick)) {
// Display nickname link
OUTPUT_HTML(NICKNAME_YOUR_REFLINK.":<br />
<STRONG><A href=\"".URL."/ref.php?ref=".$nick."\" target=\"_blank\">".URL."/ref.php?ref=".$nick."</A></STRONG><br />
<br />");
- }
- else
- {
+ } else {
// Display link to nickname form
OUTPUT_HTML("<STRONG class=\"guest_note\">".NO_NICKNAME_SET."</STRONG><br />
<A class=\"tiny\" href=\"".URL."/modules.php?module=login&what=nickname\">".PLEASE_CLICK_NICKNAME_FORM."</A>");
if (IS_ADMIN()) $whereStatement = "";
$result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM "._MYSQL_PREFIX."_refbanner", __FILE__, __LINE__);
-if (SQL_NUMROWS($result) > 0)
-{
+if (SQL_NUMROWS($result) > 0) {
// List available ref banners
$SW = 2; $OUT = "";
- while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result))
- {
+ while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result)) {
$test = str_replace(URL, PATH, $url); $size = 0;
- if ($test == $url)
- {
+ if ($test == $url) {
// Download banner (I hope you keep the banner on same server???)
$fp = GET_URL($url); $file = "";
- if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0))
- {
+ if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) {
// Loads only found banner, when there is a 404 error this foreach() command
// will cause an "Invalid argument supplied for foreach()" error
- foreach ($fp as $f)
- {
+ foreach ($fp as $f) {
$file .= $f;
}
}
// Load final template
LOAD_TEMPLATE("member_reflinks_table", false, $GLOBALS['userid']);
+} else {
+ // No refbanner found!
+ LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_NO_REFBANNER_FOUND);
}
// Free result
return $ret;
}
//
-function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") {
+function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where="") {
$ret = "";
if ($table == "/ARRAY/") {
// Selection from array
$ORDER = $name.$SPEC;
if ($table == "country") $ORDER = $special;
$result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM "._MYSQL_PREFIX."_%s ".$where." ORDER BY %s",
- array($id, $ORDER, $table, $name), __FILE__, __LINE__);
+ array($id, $ORDER, $table, $name), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
while (list($value, $title, $add) = SQL_FETCHROW($result)) {