./inc/extensions-functions.php:434:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
./inc/extensions-functions.php:564: // @TODO Extension is loaded, what next?
./inc/functions.php:110: // @TODO Extension 'msg' does not exist
-./inc/functions.php:1501: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1589: // @TODO Are these convertions still required?
-./inc/functions.php:1607:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1509: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1597: // @TODO Are these convertions still required?
+./inc/functions.php:1615:// @TODO Rewrite this function to use readFromFile() and writeToFile()
./inc/functions.php:179:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2265: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2273: // @TODO This is still very static, rewrite it somehow
./inc/gen_sql_patches.php:94:// @TODO Rewrite this to a filter
./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
-./inc/language/de.php:1089:// @TODO Rewrite these two constants
-./inc/language/de.php:1104:// @TODO Rewrite these three constants
+./inc/language/de.php:1090:// @TODO Rewrite these two constants
+./inc/language/de.php:1105:// @TODO Rewrite these three constants
./inc/language/de.php:286: // @TODO Following two are unused?
./inc/language/de.php:789:// @TODO Are these constants longer used?
./inc/language-functions.php:241: // @TODO These are all valid languages, again hard-coded
// Init exclusion list
// @TODO Rewrite these if() blocks to a filter
$EXCLUDE_LIST = '';
- if (isValidUserId(getConfig('def_refid'))) $EXCLUDE_LIST .= ' AND `userid` != {?def_refid?}';
+ if (isValidUserId(getDefRefid())) $EXCLUDE_LIST .= ' AND `userid` != {?def_refid?}';
// Check for more extensions
if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND `userid` != {?beg_userid?}';
if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND `userid` != {?bonus_userid?}';
// Build key string
$keys = getConfig('SITE_KEY') . getEncryptSeperator() . getConfig('DATE_KEY');
- if (isConfigEntrySet('secret_key')) $keys .= getEncryptSeperator().getSecretKey();
- if (isConfigEntrySet('file_hash')) $keys .= getEncryptSeperator().getFileHash();
+ if (isConfigEntrySet('secret_key')) {
+ $keys .= getEncryptSeperator().getSecretKey();
+ } // END - if
+ if (isConfigEntrySet('file_hash')) {
+ $keys .= getEncryptSeperator().getFileHash();
+ } // END - if
$keys .= getEncryptSeperator() . getDateFromPatchTime();
- if (isConfigEntrySet('master_salt')) $keys .= getEncryptSeperator().getMasterSalt();
+ if (isConfigEntrySet('master_salt')) {
+ $keys .= getEncryptSeperator().getMasterSalt();
+ } // END - if
// Build string from misc data
$data = $code . getEncryptSeperator() . $userid . getEncryptSeperator() . $DATA;
// Add more additional data
- if (isSessionVariableSet('u_hash')) $data .= getEncryptSeperator() . getSession('u_hash');
+ if (isSessionVariableSet('u_hash')) {
+ $data .= getEncryptSeperator() . getSession('u_hash');
+ } // END - if
// Add referal id, language, theme and userid
$data .= getEncryptSeperator() . determineReferalId();
// First we need to setup randomized numbers from 0 to 31
for ($idx = 0; $idx < $len; $idx++) {
// Generate number
- $rand = mt_rand(0, ($len -1));
+ $rand = mt_rand(0, ($len - 1));
// Check for it by creating more numbers
while (array_key_exists($rand, $scrambleNumbers)) {
- $rand = mt_rand(0, ($len -1));
+ $rand = mt_rand(0, ($len - 1));
} // END - while
// Add number
// Check if refid is set
if ((isset($GLOBALS['refid'])) && ($GLOBALS['refid'] > 0)) {
// This is fine...
- } elseif ((isGetRequestParameterSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
- // The variable user comes from the click-counter script click.php and we only accept this here
- $GLOBALS['refid'] = bigintval(getRequestParameter('user'));
} elseif (isPostRequestParameterSet('refid')) {
- // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
+ // Get referal id from POST element refid
$GLOBALS['refid'] = secureString(postRequestParameter('refid'));
} elseif (isGetRequestParameterSet('refid')) {
- // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
+ // Get referal id from GET parameter refid
$GLOBALS['refid'] = secureString(getRequestParameter('refid'));
} elseif (isGetRequestParameterSet('ref')) {
// Set refid=ref (the referal link uses such variable)
$GLOBALS['refid'] = secureString(getRequestParameter('ref'));
+ } elseif ((isGetRequestParameterSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
+ // The variable user comes from click.php
+ $GLOBALS['refid'] = bigintval(getRequestParameter('user'));
} elseif ((isSessionVariableSet('refid')) && (isValidUserId(getSession('refid')))) {
// Set session refid als global
$GLOBALS['refid'] = bigintval(getSession('refid'));
- } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (isRandomReferalIdEnabled())) {
+ } elseif (isRandomReferalIdEnabled()) {
// Select a random user which has confirmed enougth mails
$GLOBALS['refid'] = determineRandomReferalId();
- } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getConfig('def_refid')))) {
+ } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid()))) {
// Set default refid as refid in URL
- $GLOBALS['refid'] = getConfig('def_refid');
+ $GLOBALS['refid'] = getDefRefid();
} else {
// No default id when sql_patches is not installed or none set
$GLOBALS['refid'] = null;
}
// Set cookie when default refid > 0
- if (!isSessionVariableSet('refid') || (isValidUserId($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
+ if (!isSessionVariableSet('refid') || (isValidUserId($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (isValidUserId(getDefRefid())))) {
// Default is not found
$found = false;
if ((isExtensionActive('nickname')) && (isNicknameUsed($GLOBALS['refid']))) {
// Nickname in URL, so load the id
$found = fetchUserData($GLOBALS['refid'], 'nickname');
- } elseif ($GLOBALS['refid'] > 0) {
+ } elseif (isValidUserId($GLOBALS['refid'])) {
// Direct userid entered
$found = fetchUserData($GLOBALS['refid']);
}
// Is the record valid?
- if ((($found === false) || (!isUserDataValid())) && (isConfigEntrySet('def_refid'))) {
+ if ((($found === false) || (!isUserDataValid())) && (isExtensionInstalledAndNewer('sql_patches', '0.1.2'))) {
// No, then reset referal id
- $GLOBALS['refid'] = getConfig('def_refid');
+ $GLOBALS['refid'] = getDefRefid();
} // END - if
// Set cookie
'EMAIL_DETAILS' => "Email-Details",
'EMAIL_DETAILS_LINK' => "Details anzeigen",
'ADMIN_CONFIG_REFID_TITLE' => "Einstellungen zum Referal-Link",
- 'ADMIN_RANDOM_ZERO_REFID' => "Soll per Zufall ein Mitglied nach folgenden Kriterien ausgewählt werden, wenn keine Standart-Refid eingestellt ist?",
- 'ADMIN_RAND_REFID_ENABLED' => "Mitglieder per Zufall wählen",
- 'ADMIN_RAND_REFID_DISABLED' => "Referal-Id 0 verwenden",
+ 'ADMIN_RANDOM_ZERO_REFID' => "Soll per Zufall ein Mitglied werden oder soll die oben eingestellte Standart-Refid verwendet werden?",
+ 'ADMIN_RANDOM_REFID_ENABLED' => "Mitglieder per Zufall wählen",
+ 'ADMIN_RANDOM_REFID_DISABLED' => "Voreingestellte Referal-Id setzen",
+ 'ADMIN_CONFIG_RANDOM_REFID_TITLE' => "Kriterien wonach ein Mitglied als Zufallsreferal ausgewählt wird:",
'ADMIN_RANDOM_MIN_CONFIRMED' => "Wie viele bestätigte Mails muss ein Mitglied mindestens haben, um per Zufall ausgewählt zu werden?",
'EMAILS_RECEIVED' => "Emails empfangen",
'MAILS_CONFIRMED' => "Emails bestätigt",
// Check for more extensions
// @TODO These can be rewritten to filter
- if (getConfig('def_refid') > 0) $EXCLUDE_LIST .= ' AND d.`userid` != {?def_refid?}';
+ if (isValidUserId(getDefRefid())) $EXCLUDE_LIST .= ' AND d.`userid` != {?def_refid?}';
if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.`userid` != {?beg_userid?}';
if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.`userid` != {?bonus_userid?}';
if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.`userid` != {?doubler_userid?}';
// Use that userid as new referal id
list($refid) = SQL_FETCHROW($result);
- // Reset this user's counter
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0 WHERE `userid`=%s LIMIT 1",
+ // Reset all users, this makes this random referal id more challenging
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0",
array($refid), __FUNCTION__, __LINE__);
} // END - if
adminSaveSettingsFromPostData();
} else {
// Prepare member selection
- $content['form_selection'] = addMemberSelectionBox(getConfig('def_refid'), false, true, true, 'def_refid');
+ $content['form_selection'] = addMemberSelectionBox(getDefRefid(), false, true, true, 'def_refid');
// Prepare contants for the template
foreach (array('refid_target_index','refid_target_register','select_user_zero_refid_y','select_user_zero_refid_n') as $entry) {
// Exclude default referal id if set
// @TODO Rewrite those lines to filter
$EXCLUDE_LIST = '';
-if (getConfig('def_refid') > 0) $EXCLUDE_LIST .= ' AND d.userid != {?def_refid?}';
+if (isValidUserId(getDefRefid())) $EXCLUDE_LIST .= ' AND d.userid != {?def_refid?}';
if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND d.userid != {?beg_userid?}';
if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND d.userid != {?bonus_userid?}';
if (isExtensionActive('doubler')) $EXCLUDE_LIST .= ' AND d.userid != {?doubler_userid?}';
-if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $EXCLUDE_LIST .= " AND d.holiday_active='N'";
+if (isExtensionInstalledAndNewer('holiday', '0.1.3')) $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
// Check for all accounts
$result = SQL_QUERY("SELECT
- d.userid, d.gender, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified
+ d.`userid`, d.`gender`, d.`surname`, d.`family`, d.`email`, d.`joined`, d.`last_online`, d.`ap_notified`
FROM
`{?_MYSQL_PREFIX?}_user_data` AS d
WHERE
d.`status`='CONFIRMED' AND
- d.joined < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- d.last_online < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- d.ap_notified < (UNIX_TIMESTAMP() - {?ap_inactive_since?})
+ d.`joined` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
+ d.`last_online` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
+ d.`ap_notified` < (UNIX_TIMESTAMP() - {?ap_inactive_since?})
".$EXCLUDE_LIST."
ORDER BY
- d.userid ASC", __FILE__, __LINE__);
+ d.`userid` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Ok, we have found some inactive accounts
'email' => '<a href="' . generateEmailLink($content['email'], 'user_data') . '">' . $content['email'] . '</a>',
'joined' => generateDateTime($content['joined'], 2),
'last_online' => generateDateTime($content['last_online'], 2),
- 'notified' => generateDateTime($content['ap_notified'], 2),
+ 'ap_notified' => generateDateTime($content['ap_notified'], 2),
);
// Load row template
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__])) {
// Determine it
- $GLOBALS[__FUNCTION__] = (getConfig('select_user_zero_refid') == 'Y');
+ $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y'));
} // END - if
// Return cache
return $GLOBALS[__FUNCTION__];
}
+// "Getter" for default referal id
+function getDefRefid () {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('def_refid');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// "Getter" for path
function getPath () {
// Do we have cache?
// Is an active-rallye running and this is not a notification mail?
if ((isBonusRallyeActive()) && ($notify != 'Y')) {
// Shall I exclude the webmaster's own userid from the active-rallye?
- if ((((getBonusUserId() == $userId) && (getConfig('bonus_include_own') == 'Y')) || (getBonusUserId() != $userId)) && (getConfig('def_refid') != $userId)) {
+ if ((((getBonusUserId() == $userId) && (getConfig('bonus_include_own') == 'Y')) || (getBonusUserId() != $userId)) && (getDefRefid() != $userId)) {
// Add points and remember ranking are done in this function....
addTurboBonus($urlId, $userId, $type);
// Do we have an entry?
if (!isUserDataValid()) {
// No entry, so no referal id
- $GLOBALS['refid'] = getConfig('def_refid');
+ $GLOBALS['refid'] = getDefRefid();
} // END - if
}
} // END - if
<td class="bottom" align="right">{--ADMIN_ORDER_SELECTION_MODE--}:</td>
<td class="bottom" align="center">
<select name="order_mode" class="form_select" size="1">
- <option value="ASC"$content[order_mode_asc]">{--SORT_ASCENDING--}</option>
- <option value="DESC"$content[order_mode_desc]">{--SORT_DESCENDING--}</option>
+ <option value="ASC"$content[order_mode_asc]>{--SORT_ASCENDING--}</option>
+ <option value="DESC"$content[order_mode_desc]>{--SORT_DESCENDING--}</option>
</select>
</td>
</tr>
</tr>
<tr>
- <td class="bottom" align="right" width="200" style="padding-right:5px">{--ADMIN_SELECT_REFID_TARGRT--}:</td>
- <td class="bottom" align="center">
+ <td align="right" width="200" style="padding-right:5px">{--ADMIN_SELECT_REFID_TARGRT--}:</td>
+ <td align="center">
<select name="refid_target" size="1" class="form_select">
- <option value="register"$content[refid_target_register]">{--ADMIN_REFERAL_TARGET_REGISTER--}</option>
- <option value="index"$content[refid_target_index]">{--ADMIN_REFERAL_TARGET_INDEX--}</option>
+ <option value="register"$content[refid_target_register]>{--ADMIN_REFERAL_TARGET_REGISTER--}</option>
+ <option value="index"$content[refid_target_index]>{--ADMIN_REFERAL_TARGET_INDEX--}</option>
</select>
</td>
</tr>
<tr>
- <td align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_ZERO_REFID--}</td>
- <td align="center">
+ <td class="bottom" align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_ZERO_REFID--}</td>
+ <td class="bottom" align="center">
<select name="select_user_zero_refid" size="1" class="form_select">
- <option value="Y"$content[select_user_zero_refid_y]">{--ADMIN_RAND_REFID_ENABLED--}</option>
- <option value="N"$content[select_user_zero_refid_n]">{--ADMIN_RAND_REFID_DISABLED--}</option>
+ <option value="Y"$content[select_user_zero_refid_y]>{--ADMIN_RANDOM_REFID_ENABLED--}</option>
+ <option value="N"$content[select_user_zero_refid_n]>{--ADMIN_RANDOM_REFID_DISABLED--}</option>
</select>
</td>
</tr>
+ <tr>
+ <td class="table_header bottom" colspan="2" align="center">
+ <strong>{--ADMIN_CONFIG_RANDOM_REFID_TITLE--}</strong>
+ </td>
+ </tr>
+
<tr>
<td class="bottom" align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_MIN_CONFIRMED--}</td>
<td class="bottom" align="center">
<td width="195" align="right" height="21">{--GENDER--}:</td>
<td width="195">
<select name="gender" class="form_select" size="1">
- <option value="M"$content[gender_m]">{--GENDER_M--}</option>
- <option value="F"$content[gender_f]">{--GENDER_F--}</option>
- <option value="C"$content[gender_c]">{--GENDER_C--}</option>
+ <option value="M"$content[gender_m]>{--GENDER_M--}</option>
+ <option value="F"$content[gender_f]>{--GENDER_F--}</option>
+ <option value="C"$content[gender_c]>{--GENDER_C--}</option>
</select>
</td>
</tr>
<td align="center" class="{%template,ColorSwitch%} bottom right">$content[email]</td>
<td align="center" class="{%template,ColorSwitch%} bottom right">$content[joined]</td>
<td align="center" class="{%template,ColorSwitch%} bottom right">$content[last_online]</td>
- <td align="center" class="{%template,ColorSwitch%} bottom">$content[notified]</td>
+ <td align="center" class="{%template,ColorSwitch%} bottom">$content[ap_notified]</td>
</tr>