}
// Output verbose SQL table for extension
-function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "100%") {
+function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = "", $dashed = "", $switch = false, $width = "100%") {
global $SQLs;
+ // Empty title?
+ if (empty($title)) {
+ // Then fix it to default
+ $title = getMessage('ADMIN_SQLS_EXECUTED_ON_REMOVAL');
+ } // END - if
+
// Are there some queries in $queries?
if (count($queries) > 0) {
// Then use them instead!
// Add points to user or begging rallye account
function BEG_ADD_POINTS ($uid, $points) {
- global $_CONFIG;
-
// Set mode depending on how many mails the member has to confirm
$locked = false;
if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != "Y")) $locked = true;
}
// This function must be run *BEFORE* a link is removed from table 'mxchange_user_links' !
-function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) {
- global $_CONFIG;
-
+function BONUS_ADD_TURBO_POINTS ($mid, $uid, $type) {
// Shall we add bonus points?
if (getConfig('bonus_active') != "Y") return false;
}
//
function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) {
- global $_CONFIG;
$self = false; $OUT = "";
// How many ranks do we have?
}
//
function BONUS_POINTS_HANDLER ($MODE) {
- global $_CONFIG;
-
// Shall we add bonus points?
if (getConfig('bonus_active') != "Y") return;
break;
}
}
-//
-function BONUS_PURGE_EXPIRED_TURBO_BONUS()
-{
- global $_CONFIG;
+//
+function BONUS_PURGE_EXPIRED_TURBO_BONUS() {
// Remove entries
$result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE timemark < (UNIX_TIMESTAMP() - ".getConfig('bonus_timeout').")", __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() > 0) {
// Generates a HTML table based 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;
if ($uid > 0) {
// Load entries only from a single user
$ADD = " AND userid='".bigintval($uid)."'";
$MODE = "member"; $COLS = "4"; $DT_MODE = "2";
- $NOT_FOUND = DOUBLER_MEMBER_NO_ENTRIES_FOUND;
+ $NOT_FOUND = getMessage('DOUBLER_MEMBER_NO_ENTRIES_FOUND');
} else {
// Guest mode!
$MODE = "guest"; $COLS = "3"; $DT_MODE = "3";
- $NOT_FOUND = DOUBLER_GUEST_NO_ENTRIES_FOUND;
+ $NOT_FOUND = getMessage('DOUBLER_GUEST_NO_ENTRIES_FOUND');
}
if (($done == "Y") && ($sort == "ASC")) {
}
// Execute the withdraw of a sponsor only!
function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) {
- global $_CONFIG;
-
// Is the sponsor extension installed?
if (!EXT_IS_ACTIVE("sponsor")) {
// No, abort here
$api = new PrimeraApi($primusNick, $userMd5);
// Prepare purpose
- $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_WITHDRAW, get_session('sponsorid')))."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), get_session('sponsorid')))."\";";
eval($eval);
// Pay the Primera
}
// Execute the payout
function PRIMERA_EXECUTE_PAYOUT ($primusNick, $userMd5, $amount) {
- global $_CONFIG;
-
// Get new instance
$api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5'));
// Prepare purpose
- $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), $GLOBALS['userid']))."\";";
eval($eval);
// Pay the Primera
//
function RALLYE_LOAD_USERS_ARRAY ($rallye) {
- global $_CONFIG;
-
// Fix zero points to 0.00000
if (getConfig('ref_payout') == "0") setConfigEntry('ref_payout', "0.00000");
SQL_FREERESULT($result);
}
//
-function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false)
-{
- global $_POST, $_CONFIG;
+function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false) {
$OUT = "";
// Guests are mostly not interested in how many members has
// Admins are allowed to see every category...
if (IS_ADMIN()) $AND = "";
$result = SQL_QUERY("SELECT id, cat, visible FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort`", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ if (SQL_NUMROWS($result) > 0) {
// List alle visible modules (or all to the admin)
$SW = 2;
$OUT .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
- while (list($id, $cat, $visible) = SQL_FETCHROW($result))
- {
+ while (list($id, $cat, $visible) = SQL_FETCHROW($result)) {
if (empty($_POST['cat'][$id])) $_POST['cat'][$id] = "";
// Prepare array for the template
$content = array(
// Free memory
SQL_FREERESULT($result);
- }
- else
- {
+ } else {
// No categories setted up so far...
- $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, NO_CATEGORIES_VISIBLE);
+ $OUT .= LOAD_TEMPLATE("admin_settings_saved", true, getMessage('NO_CATEGORIES_VISIBLE'));
}
- if ($return)
- {
+ if ($return) {
// Return generated HTML code
return $OUT;
- }
- else
- {
+ } else {
// Output directly (default)
OUTPUT_HTML($OUT);
}
//
function REWRITE_LINKS ($HTML) {
- global $_CONFIG;
-
// Skip rewriting for the admin area (which search engine may enter here???)
if (ereg($GLOBALS['module'], getConfig('rewrite_skip'))) return $HTML;
//
function GENERATE_SPONSOR_CONTENT($what)
{
- global $_CONFIG;
$OUT = "";
$INC = sprintf("inc/modules/sponsor/%s.php", $what);
if (FILE_READABLE($INC)) {
switch ($GLOBALS['what'])
{
case "account": // Change account data
- if ($EMAIL) {
- $MSG = SPONSOR_ACCOUNT_EMAIL_CHANGED;
+ if ($EMAIL === true) {
+ $MSG = getMessage('SPONSOR_ACCOUNT_EMAIL_CHANGED');
$templ = "admin_sponsor_change_email";
- $subj = ADMIN_SPONSOR_ACC_EMAIL_SUBJ;
- }
- else
- {
- $MSG = SPONSOR_ACCOUNT_DATA_SAVED;
+ $subj = getMessage('ADMIN_SPONSOR_ACC_EMAIL_SUBJ');
+ } else {
+ $MSG = getMessage('SPONSOR_ACCOUNT_DATA_SAVED');
$templ = "admin_sponsor_change_data";
- $subj = ADMIN_SPONSOR_ACC_DATA_SUBJ;
+ $subj = getMessage('ADMIN_SPONSOR_ACC_DATA_SUBJ');
}
break;
$content['interval'] = CREATE_FANCY_TIME($content['warning_interval']);
// Set message template and subject for admin
- $MSG = SPONSOR_SETTINGS_SAVED;
+ $MSG = getMessage('SPONSOR_SETTINGS_SAVED');
$templ = "admin_sponsor_settings";
- $subj = ADMIN_SPONSOR_SETTINGS_SUBJ;
+ $subj = getMessage('ADMIN_SPONSOR_SETTINGS_SUBJ');
break;
default: // Unknown sponsor what value!
break;
}
- if (SQL_AFFECTEDROWS() == 1)
- {
- if (!empty($templ) && !empty($subj))
- {
+ if (SQL_AFFECTEDROWS() == 1) {
+ if (!empty($templ) && !empty($subj)) {
// Run SQL command and check for success
$result = SQL_QUERY_ESC($SQL, $DATA, __FILE__, __LINE__);
SEND_ADMIN_NOTIFICATION($subj, $templ, $content);
// Shall we send mail to the sponsor's new email address?
- if ($content['receive_warnings'] == "Y")
- {
+ if ($content['receive_warnings'] == "Y") {
// Okay send email with confirmation link to new address and with no confirmation link
// to the old address
{
case "account": // Change account data
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_change_data", $content);
- SEND_EMAIL($content['email'], SPONSOR_ACC_DATA_SUBJ, $email_msg);
+ SEND_EMAIL($content['email'], getMessage('SPONSOR_ACC_DATA_SUBJ'), $email_msg);
- if ($EMAIL)
- {
+ if ($EMAIL === true) {
// Add hash code to content array
$content['hash'] = $HASH;
// Second mail goes to the new address
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_change_email", $content);
- SEND_EMAIL($content['email'], SPONSOR_ACC_EMAIL_SUBJ, $email_msg);
+ SEND_EMAIL($content['email'], getMessage('SPONSOR_ACC_EMAIL_SUBJ'), $email_msg);
}
break;
case "settings": // Change settings
// Send email
$email_msg = LOAD_EMAIL_TEMPLATE("sponsor_settings", $content);
- SEND_EMAIL($content['email'], SPONSOR_SETTINGS_SUBJ, $email_msg);
+ SEND_EMAIL($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
break;
}
}
// Return final message
return $MSG;
}
+
//
?>
//
// Member has added an URL
function SURFBAR_MEMBER_ADD_URL ($url, $limit) {
- global $_CONFIG;
-
// Do some pre-checks
if (!IS_MEMBER()) {
// Not a member
} // END - foreach
} // END - if
}
+
// Alert users which have URLs booked and are low on points amount
function SURFBAR_HANDLE_LOW_POINTS () {
- global $_CONFIG;
-
// Get all userids
$UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS(getConfig('surfbar_warn_low_points'));
} // END - if
} // END - foreach
}
+
//
// -----------------------------------------------------------------------------
// Generic functions
// -----------------------------------------------------------------------------
//
+
// Looks up by an URL
function SURFBAR_LOOKUP_BY_URL ($url, $uid) {
// Now lookup that given URL by itself
// Was it found?
return (count($urlArray) > 0);
}
+
// Load URL data by given search term and column
function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add="") {
global $lastUrlData;
// Return the result
return $lastUrlData;
}
+
// Registers an URL with the surfbar. You should have called SURFBAR_LOOKUP_BY_URL() first!
function SURFBAR_REGISTER_URL ($url, $uid, $status="PENDING", $addMode="reg", $extraFields = array()) {
- global $_CONFIG;
-
// Make sure by the user registered URLs are always pending
if ($addMode == "reg") $status = "PENDING";
// Return the insert id
return $content['insert_id'];
}
+
// Inserts an url by given data array and return the insert id
function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
// Get userid
// Return insert id
return SQL_INSERTID();
}
+
// Notify admin(s) with a selected message and content
function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
// Prepare template name
$templateName = sprintf("admin_surfbar_%s", $messageType);
- // Set default subject if following eval() wents wrong
- $subject = ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT;
-
- // Create constant name
- $constantName = sprintf("ADMIN_SURFBAR_NOTIFY_%s_SUBJECT",
+ // Prepare subject
+ $subject = getMessage(sprintf("ADMIN_SURFBAR_NOTIFY_%s_SUBJECT",
strtoupper($messageType)
- );
+ ));
- // Prepare subject
- if (defined($constantName)) {
- $subject = constant($constantName);
- } else {
- addFatalMessage(getMessage('ADMIN_SURFBAR_NOTIFY_SUBJECT_404'), $constantName);
- }
+ // Is the subject line there?
+ if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+ // Set default subject if following eval() wents wrong
+ $subject = getMessage('ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
+ } // END - if
// Translate some data if present
if (isset($content['status'])) $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
// Send the notification out
return SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
}
+
// Notify the user about the performed action
function SURFBAR_NOTIFY_USER ($messageType, $content) {
// Skip notification if userid is zero
// Prepare template name
$templateName = sprintf("member_surfbar_%s", $messageType);
- // Set default subject if following eval() wents wrong
- $subject = MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT;
-
- // Create constant name
- $constantName = sprintf("MEMBER_SURFBAR_NOTIFY_%s_SUBJECT",
+ // Prepare subject
+ $subject = getMessage(sprintf("MEMBER_SURFBAR_NOTIFY_%s_SUBJECT",
strtoupper($messageType)
- );
+ ));
- // Prepare subject
- if (defined($constantName)) {
- $subject = constant($constantName);
- } else {
- addFatalMessage(getMessage('MEMBER_SURFBAR_NOTIFY_SUBJECT_404'), $constantName);
- }
+ // Is the subject line there?
+ if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+ // Set default subject if following eval() wents wrong
+ $subject = getMessage('MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
+ } // END - if
// Translate some data if present
if (isset($content['status'])) $content['status'] = SURFBAR_TRANSLATE_STATUS($content['status']);
}
// Determine reward
function SURFBAR_DETERMINE_REWARD ($onlyMin=false) {
- global $_CONFIG;
-
// Static values are default
$reward = getConfig('surfbar_static_reward');
}
// Determine costs
function SURFBAR_DETERMINE_COSTS ($onlyMin=false) {
- global $_CONFIG;
-
// Static costs is default
$costs = getConfig('surfbar_static_costs');
// Check if the "reload lock" of the current user is full, call this function
// before you call SURFBAR_CHECK_RELOAD_LOCK().
function SURFBAR_CHECK_RELOAD_FULL() {
- global $SURFBAR_CACHE, $_CONFIG;
+ global $SURFBAR_CACHE;
// Default is full!
$isFull = true;
}
// Check wether the user is allowed to book more URLs
function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
- global $_CONFIG;
-
// Is this admin and userid is zero or does the user has some URLs left to book?
return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, "", array("REJECTED")) < getConfig('surfbar_max_order')));
}
// Get total amount of URLs of given status for current user
function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") {
- global $_CONFIG;
-
// Is the user 0 and user is logged in?
if (($uid == 0) && (IS_MEMBER())) {
// Then use this userid
}
// Generate a validation code for the given id number
function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
- global $_CONFIG, $SURFBAR_CACHE;
+ global $SURFBAR_CACHE;
// @TODO Invalid salt should be refused
$SURFBAR_CACHE['salt'] = "INVALID";
}
// Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
function SURFBAR_PAY_POINTS () {
- global $_CONFIG;
-
// Remove it from the URL owner
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS()."", false);
if (SURFBAR_GET_USERID() > 0) {
}
// Updates the statistics of current URL/userid
function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
- global $_CONFIG;
-
// Init add
$ADD = "";
}
// Determine how many users are Online in surfbar
function SURFBAR_DETERMINE_TOTAL_ONLINE () {
- global $_CONFIG;
-
// Count all users in surfbar modue and return the value
$result = SQL_QUERY_ESC("SELECT id
FROM `{!_MYSQL_PREFIX!}_surfbar_stats`
}
// Changes the status of an URL from given to other
function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) {
- global $_CONFIG;
-
// Make new status always lower-case
$newStatus = strtolower($newStatus);
}
// Calculate minimum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
- global $_CONFIG;
-
// Addon is zero by default
$addon = 0;
}
// Calculate maximum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
- global $_CONFIG;
-
// Addon is zero by default
$addon = 0;
}
// Calculate dynamic lock
function SURFBAR_CALCULATE_DYNAMIC_LOCK () {
- global $_CONFIG;
-
// Default lock is 30 seconds
$addon = 30;
}
// "Getter" for maximum random number
function SURFBAR_GET_MAX_RANDOM ($UIDs, $ADD) {
- global $_CONFIG;
// Count max availabe entries
$result = SQL_QUERY("SELECT sbu.id AS cnt
FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS sbu
// Determine next id for surfbar or get data for given id, always call this before you call other
// getters below this function!!!
function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) {
- global $SURFBAR_CACHE, $_CONFIG;
+ global $SURFBAR_CACHE;
// Default is no id and no random number
$nextId = 0;
//
// @TODO Move all extension-dependent queries into filters
function OUTPUT_ADVANCED_OVERVIEW (&$result_main) {
- global $_CONFIG;
-
// Init variables/arrays
$EXTRAS = "";
$OUT = "";
// Add links for selecting some users
function alpha ($sortby, $colspan, $return=false) {
- global $_CONFIG;
if (empty($_GET['offset'])) $_GET['offset'] = 0;
$ADD = "&page=".SQL_ESCAPE($_GET['page'])."&offset=".SQL_ESCAPE($_GET['offset']);
if (!empty($_GET['mode'])) $ADD .= "&mode=".SQL_ESCAPE($_GET['mode']);
// Selects a random user id as the new referal id if they have at least X confirmed mails in this run
function SELECT_RANDOM_REFID () {
- global $_CONFIG;
-
// Default is zero refid
$refid = 0;
// Payout this amount
function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) {
- global $_CONFIG;
-
// Default is failed attempt
$result = false;
// Prepare the purpose
- $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";";
+ $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), $GLOBALS['userid']))."\";";
eval($eval);
// Prepare the request data
// Save settings to the database
function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="config=0", $translateComma=array(), $alwaysAdd=false) {
- global $_CONFIG, $cacheArray, $cacheInstance;
+ global $cacheArray, $cacheInstance;
// Prepare all arrays, variables
$DATA = array();
}
// Update current configuration
- $_CONFIG[$id] = $val;
+ setConfigEntry($id, $val);
} // END - if
} // END - if
} // END - foreach
}
function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
- global $cacheArray, $_CONFIG;
+ global $cacheArray;
// First check for solved and not assigned tasks and assign them to current admin
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'",
// Outputs selected tasks
function OUTPUT_SELECTED_TASKS ($POST, $result_tasks) {
- global $_CONFIG, $NOTES;
+ global $NOTES;
if ((isset($POST['assign'])) && (count($POST['task']) > 0)) {
// Assign / do tasks
$OUT = ""; $SW = 2;
if (isset($_POST['ok'])) {
// First merge temporarily the new API data into the current config
+ global $_CONFIG;
$_CONFIG = merge_array($_CONFIG, $_POST);
// Is the password set?
if (isset($_POST['ok'])) {
// First merge temporarily the new API data into the current config
+ global $_CONFIG;
$_CONFIG = merge_array($_CONFIG, $_POST);
// Let's test the API first (hold your horses here, cowboy! Thank you. :) )
// Add description as navigation point
ADD_DESCR("guest", __FILE__);
-global $_CONFIG, $DATA;
+global $DATA;
// Initialize variables
$FAILED = false; $SHORT_PASS = false; $cats = 0; $IP_TIMEOUT = false;