./beg.php:171: // @TODO Opps, what is missing here???
./birthday_confirm.php:93: // @TODO Try to rewrite the following unset()
./inc/cache/config-local.php:124:// @TODO Rewrite the following three constants, somehow...
-./inc/classes/cachesystem.class.php:504: // @TODO Add support for more types which break in last else-block
+./inc/classes/cachesystem.class.php:505: // @TODO Add support for more types which break in last else-block
./inc/config-functions.php:136: // @TODO Make this all better... :-/
./inc/daily/daily_beg.php:52:// @TODO This should be converted in a daily beg rallye
./inc/daily/daily_birthday.php:95: // @TODO 4 is hard-coded here, should we move it out in config?
./inc/extensions/ext-network.php:38: * @TODO Yoo!Media: What is LayerAd compared to Layer click? *
./inc/extensions/ext-network.php:93: // @TODO network_type_handle is an internal name and needs documentation
./inc/extensions/ext-newsletter.php:218: // @TODO Move these into configuration
-./inc/extensions/ext-order.php:351: // @TODO This should be moved out to inc/daily/
+./inc/extensions/ext-order.php:356: // @TODO This should be moved out to inc/daily/
./inc/extensions/ext-rallye.php:329: // @TODO Move this code into a hook
./inc/extensions/ext-rallye.php:92: // @TODO Fix config_rallye_prices to list_rallye_prices
./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table?
./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y');
./inc/extensions-functions.php:155: // @TODO Do we still need this? setExtensionUpdateNotes('');
-./inc/extensions-functions.php:1939:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
+./inc/extensions-functions.php:1931:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
-./inc/extensions-functions.php:554: // @TODO Extension is loaded, what next?
+./inc/extensions-functions.php:559: // @TODO Extension is loaded, what next?
./inc/filter/bonus_filter.php:56: // @TODO This query isn't right, it will only update if the user was for a longer time away!
./inc/filter/cache_filter.php:92: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
./inc/functions.php:1223: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id
./inc/modules/admin/what-edit_user.php:18: * @TODO Add support for ext-country *
./inc/modules/admin/what-email_stats.php:46:// @TODO Unused at the moment
-./inc/modules/admin/what-extensions.php:364: // @TODO Rewrite this to a filter
+./inc/modules/admin/what-extensions.php:371: // @TODO Rewrite this to a filter
./inc/modules/admin/what-guest_add.php:129: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-guest_add.php:67: // @TODO Cant this be rewritten?
./inc/modules/admin/what-guest_add.php:80: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-list_cats.php:69: // @TODO Rewrite this to countSum.....() function
./inc/modules/admin/what-list_links.php:55: // @TODO Try to rewrite this to a filter
./inc/modules/admin/what-list_links.php:85: // @TODO Find a way to rewrite this. See some lines above for different queries
-./inc/modules/admin/what-list_links.php:94: // @TODO Rewrite this to includes/filter
+./inc/modules/admin/what-list_links.php:93: // @TODO Rewrite this to includes/filter
./inc/modules/admin/what-list_refs.php:107: // @TODO Try to rewrite some to EL
./inc/modules/admin/what-list_unconfirmed.php:107: // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
./inc/modules/admin/what-list_unconfirmed.php:84: // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
./inc/mysql-manager.php:1479: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
./inc/mysql-manager.php:1567: // @TODO Rewrite these lines to a filter
./inc/mysql-manager.php:1591: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1965: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:2009:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1959: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:2003:// @TODO Fix inconsistency between last_module and getWhat()
./inc/mysql-manager.php:368: // @TODO Try to rewrite this to one or more functions
./inc/mysql-manager.php:44:// @TODO Can we cache this?
./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter
} // END - if
// Remove cache file from system
+ //* DEBUG: */ debug_report_bug(__METHOD__, __LINE__, 'About to remove ' . basename($this->fqfn) . '!');
removeFile($this->fqfn);
// Reset read status
$new = strtolower($new);
} // END - if
- /// ... and write it to the new config
+ // ... and write it to the new config
//* DEBUG: */ debugOutput('function=' . $function . ',new=' . $new . ',comment=' . $comment);
changeDataInInclude(getCachePath() . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0);
//* DEBUG: */ debugOutput('CHANGED!');
$tableName = str_replace('`', '', $tableArray[2]);
// Debug log
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
// Shall we add/drop?
if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false) || (strpos($sql, 'CHANGE') !== false)) && ($noIndex === true)) {
// Skip this query silently because InnoDB does not understand fulltext indexes
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : isSqlTableColumnFound($columnName)), $F, $L));
} elseif ($noIndex === false) {
- // And column name as well
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
+ // And column name as well without backticks
$keyName = str_replace('`', '', $tableArray[5]);
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyName=' . $keyName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
// Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above
- if (in_array(strtoupper($keyName), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) {
+ if (in_array(strtoupper($tableArray[4]), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) {
// Init loop
- $begin = 1; $keyName = ',';
+ $begin = 1;
+ $keyName = ',';
while (strpos($keyName, ',') !== false) {
// Use last
$keyName = str_replace('`', '', $tableArray[count($tableArray) - $begin]);
} // END - if
// Shall we run it?
- if (!isSqlTableIndexAdded($tableName, $tableArray[3], $keyName)) {
- // Send it to the SQL_QUERY() function
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ', tableArray[3]=' . $tableArray[3] . ',keyName=' . $keyName);
+ if ((!isSqlTableIndexAdded($tableName, $tableArray[3], $keyName)) && ($tableArray[3] == 'ADD')) {
+ // Send it to the SQL_QUERY() function to add it
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
+ $result = SQL_QUERY($sql, $F, $L, $enableCodes);
+ } elseif ((isSqlTableIndexAdded($tableName, $tableArray[3], $keyName)) && ($tableArray[3] == 'DROP')) {
+ // Send it to the SQL_QUERY() function to drop it
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
$result = SQL_QUERY($sql, $F, $L, $enableCodes);
} else {
// Not executed
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
}
} else {
// Other ALTER TABLE query
return true;
}
-// Registeres an extension and possible update depencies
+// Registers an extension and possible update dependencies
function registerExtension ($ext_name, $taskId, $dry_run = false) {
// Set current extension name
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',task_id=' . $taskId . ',dry_run=' . intval($dry_run) . ' - ENTERED!');
// Check wether the given extension is installed
function isExtensionInstalled ($ext_name) {
// We don't like empty extension names here
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - ENTERED!');
if (empty($ext_name)) {
// Please fix them all
debug_report_bug(__FUNCTION__, __LINE__, 'ext_name is empty.');
// Check if there is a cache entry
if (isset($GLOBALS['ext_is_installed'][$ext_name])) {
// Use cache built from below queries
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - CACHE!');
$isInstalled = $GLOBALS['ext_is_installed'][$ext_name];
} elseif (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) {
// Found!
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - FOUND!');
$isInstalled = true;
// Count cache hits
incrementStatsEntry('cache_hits');
} elseif ((isInstallationPhase())) {
// Extensions are all inactive/not installed during installation
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ' - installion phase');
} else {
// Look in database
$ext_id = getExtensionId($ext_name);
- // Log debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Extension ' . $ext_name . ' has ext_id=' . $ext_id);
-
// Do we have a record?
$isInstalled = ($ext_id > 0);
+ // Log debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_id=' . $ext_id . ',isInstalled=' . intval($isInstalled));
+
// Is it installed, then cache the entry
if ($isInstalled === true) {
// Dummy call (get is okay here)
}
// Return status
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',isInstalled=' . intval($isInstalled) . ' - EXIT!');
return $isInstalled;
}
if (SQL_NUMROWS($result) == 1) {
// Load entry
$data = SQL_FETCHARRAY($result);
+
+ // Set cache
+ $GLOBALS['cache_array']['extension']['ext_version'][$ext_name] = $data['ext_version'];
} elseif (isDebugModeEnabled()) {
- // Not found, please report all
- debug_report_bug(__FUNCTION__, __LINE__, sprintf(": Cannot find extension %s in database!", $ext_name));
+ // Not found, may happen while an extension is uninstalled
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot find extension %s in database!", $ext_name));
}
// Free result
SQL_FREERESULT($result);
-
- // Set cache
- $GLOBALS['cache_array']['extension']['ext_version'][$ext_name] = $data['ext_version'];
}
// Extension version should not be invalid
incrementStatsEntry('cache_hits');
} else {
// Load from database
- $result = SQL_QUERY_ESC("SELECT `id` AS ext_id FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` AS `ext_id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
// Is the entry there?
// Is it not yet added?
if ((isset($updateDepends, $GLOBALS['ext_running_updates'][getCurrentExtensionName()])) && (in_array($updateDepends, getExtensionUpdatesRunning()))) {
/*
- * Double-adding isn't fine, too. This may mean that
- * addExtensionDependency() was called outside the switch() command in
- * the extension's file which requires fixing.
+ * Double-adding happens when the extension and an update of the same
+ * extension requires the same other extension again.
*/
- debug_report_bug(__FUNCTION__, __LINE__, 'updateDepends=' . $updateDepends . ',extensionMode=' . getExtensionMode() . ',currentExtension=' . getCurrentExtensionName() . ' - CALLED TWICE!');
+ logDebugMessage(__FUNCTION__, __LINE__, 'updateDepends=' . $updateDepends . ',extensionMode=' . getExtensionMode() . ',currentExtension=' . getCurrentExtensionName() . ' - called twice.');
+ return;
} // END - if
// Add it to the list of extension update depencies map
} // END - if
}
} // END - foreach
+
+ // Remove from other caches as well
+ unset($GLOBALS['ext_is_installed'][$ext_name]);
+ unset($GLOBALS['loaded_extension'][$ext_name]);
}
// "Getter" for 'extension has a CSS file' (with same name, of course)
function getExtensionHasCss () {
- // Default is no CSS
- $hasCss = 'N';
-
- // Construct FQFN for check
- $FQFN = sprintf("%stheme/%s/css/%s.css",
- getPath(),
- getCurrentTheme(),
- getCurrentExtensionName()
- );
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][getCurrentExtensionName()][getCurrentTheme()])) {
+ // Construct FQFN for check
+ $FQFN = sprintf("%stheme/%s/css/%s.css",
+ getPath(),
+ getCurrentTheme(),
+ getCurrentExtensionName()
+ );
- // Is it there?
- if (isFileReadable($FQFN)) {
- // Readable, so it is there...
- $hasCss = 'Y';
+ // Is it there?
+ $GLOBALS[__FUNCTION__][getCurrentExtensionName()][getCurrentTheme()] = convertBooleanToYesNo(isFileReadable($FQFN));
} // END - if
// Return it
- return $hasCss;
+ return $GLOBALS[__FUNCTION__][getCurrentExtensionName()][getCurrentTheme()];
}
// Checks wether the given extension has a language file
// Count cache hits
incrementStatsEntry('cache_hits');
} else {
- // Not readable is default
- $readable = 'N';
-
- // Is the language file readable for this extension?
- if (isLanguageIncludeReadable($ext_name)) {
- // Readable
- $readable = 'Y';
- } // END - if
-
- // Put it in cache
- $GLOBALS['cache_array']['extension']['ext_lang'][$ext_name] = $readable;
+ // Determine it and put it in cache
+ $GLOBALS['cache_array']['extension']['ext_lang'][$ext_name] = convertBooleanToYesNo(isLanguageIncludeReadable($ext_name));
}
// Return result
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
// Is this include there?
- if ((isFileReadable($funcsInclude)) && (!isExtensionLibraryLoaded($ext_name)) && (getExtensionMode() == 'test')) {
- // Cache it!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=Y - FOUND!');
- $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = 'Y';
- } else {
- // Cache it!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=N - NOT FOUND!');
- $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = 'N';
- }
+ $isIncludeFound = ((isFileReadable($funcsInclude)) && (!isExtensionLibraryLoaded($ext_name)) && (getExtensionMode() == 'test'));
+
+ // And put in cache, converted
+ $GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = convertBooleanToYesNo($isIncludeFound);
}
// Return result
break;
case '0.3.1': // SQL queries for v0.3.1
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins_acls` MODIFY id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins_acls` CHANGE `id` `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT");
break;
case '0.4.0': // SQL queries for v0.4.0
addExtensionDependency('bonus');
// SQL commands to run
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` MODIFY data_type ENUM('TEMP','SEND','NEW','ADMIN','ACTIVE','DELETED') NOT NULL DEFAULT 'TEMP'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` MODIFY `data_type` ENUM('NEW','QUEUE','SEND','DELETED') NOT NULL DEFAULT 'NEW'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` CHANGE `data_type` `data_type` ENUM('TEMP','SEND','NEW','ADMIN','ACTIVE','DELETED') NOT NULL DEFAULT 'TEMP'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` CHANGE `data_type` ENUM('NEW','QUEUE','SEND','DELETED') NOT NULL DEFAULT 'NEW'");
break;
case 'remove': // Do stuff when removing extension
// SQL commands to run
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` MODIFY `data_type` ENUM('TEMP','SEND','NEW','ADMIN','ACTIVE') NOT NULL DEFAULT 'TEMP'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` MODIFY `data_type` ENUM('NEW','QUEUE','SEND') NOT NULL DEFAULT 'NEW'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` CHANGE `data_type` `data_type` ENUM('TEMP','SEND','NEW','ADMIN','ACTIVE') NOT NULL DEFAULT 'TEMP'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_bonus` CHANGE `data_type` `data_type` ENUM('NEW','QUEUE','SEND') NOT NULL DEFAULT 'NEW'");
addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('config_autopurge','list_autopurge')");
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `ap_notified`");
break;
addConfigAddSql('beg_rallye', "ENUM('Y','N') NOT NULL DEFAULT 'N'");
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `beg_points` FLOAT(21,5) UNSIGNED NOT NULL DEFAULT 0.00000");
- $visible = 'N'; $locked = 'Y';
- if (isExtensionActive('beg')) {
- $visible = 'Y';
- $locked = 'N';
- } // END - if
+ // Determine if menu entries are locked and/or visible to the user
+ $visible = convertBooleanToYesNo(isExtensionActive('beg'));
+ $locked = convertBooleanToYesNo(!isExtensionActive('beg'));
addMemberMenuSql('main','beg2','Bettel-Rallye', $visible, $locked, 7);
addAdminMenuSql('user','list_beg','Bettel-Rallye','Listet alle Teilnehmer der monatlichen Bettel-Rallye auf.','12');
case 'init': // When extension is initialized
// Remove old entries
$OLD = getBegTimeout();
- if (getBegUseridTimeout() > $OLD) $OLD = getBegUseridTimeout();
+ if (getBegUseridTimeout() > $OLD) {
+ $OLD = getBegUseridTimeout();
+ } // END - if
SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE (UNIX_TIMESTAMP() - `timeout`) >= ' . ($OLD + 60*60) . '', __FILE__, __LINE__);
// Check for beg rallye is active and send mails out
KEY (`cat_id`),
PRIMARY KEY (`id`)
) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Bonus mails'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` MODIFY `link_type` ENUM('NORMAL','BONUS') NOT NULL DEFAULT 'NORMAL'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` CHANGE `link_type` `link_type` ENUM('NORMAL','BONUS') NOT NULL DEFAULT 'NORMAL'");
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` ADD `bonus_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_links` ADD INDEX (`bonus_id`)");
break;
case '0.2.1': // SQL queries for v0.2.1
- // Add extension dependency because of the update command
- addExtensionDependency('sql_patches');
+ // Add extension dependency to ex-tuser because of the ALTER command
+ addExtensionDependency('user');
addConfigAddSql('login_bonus', 'FLOAT(20,3) NOT NULL DEFAULT 10.000');
addConfigAddSql('turbo_bonus', 'FLOAT(20,3) NOT NULL DEFAULT 100.000');
break;
case '0.0.4': // SQL queries for v0.0.4
- // Is the cache extension itself there?
- if (isExtensionActive('cache')) {
- // Check for cache when extension is already installed
- if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile();
- } // END - if
-
// Update notes (these will be set as task text!)
- setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt. Cache wurde reinitialisiert.");
+ setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt.");
break;
case '0.0.5': // SQL queries for v0.0.5
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Daten von gefundenen Sprachdateien werden zu den Erweiterungen gecacht.");
break;
- }
+ } // END - switch
break;
case 'modify': // When the extension got modified
default: // Unknown extension mode
logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
break;
-}
+} // END - switch
// [EOF]
?>
} // END - if
// Version number
-setThisExtensionVersion('0.0.0');
+setThisExtensionVersion('0.0.1');
// Version history array (add more with , '0.1' and so on)
-setExtensionVersionHistory(array('0.0.0'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installtion is running
- // This extension requires an up-to-date user
+ // This extension requires an up-to-date ext-user
addExtensionDependency('user');
// Coupon data
`coupon_type` ENUM('CODE','API') NOT NULL DEFAULT 'CODE',
`total_created` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
`total_cashed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-`points` FLOAT(20,5) NOT NULL DEFAULT 0.00000,
+`points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
`coupon_description` TEXT,
PRIMARY KEY (`id`)
) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Created coupons'");
// Configuration entries
addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
- addConfigAddSql('coupon_default_points', 'FLOAT(20,5) NOT NULL DEFAULT 100.00000');
- addConfigAddSql('coupon_points_account', "ENUM('ORDER','GENERAL') NOT NULL DEFAULT 'ORDER'");
- addConfigAddSql('coupon_payment_method', "ENUM('DIRECT','REF') NOT NULL DEFAULT 'DIRECT'");
- addConfigAddSql('coupon_locked_points_mode', "ENUM('LOCKED','UNLOCKED') NOT NULL DEFAULT 'LOCKED'");
+ addConfigAddSql('coupon_default_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 100.00000');
addConfigAddSql('coupon_autopurge_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
addConfigAddSql('coupon_userid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
case 'update': // Update an extension
switch (getCurrentExtensionVersion()) {
case '0.0.1': // SQL queries for v0.0.1
- addExtensionSql('');
+ addConfigDropSql('coupon_points_account');
+ addConfigDropSql('coupon_payment_method');
+ addConfigDropSql('coupon_locked_points_mode');
+
+ // This extension's update requires an up-to-date ext-sql_patches and ext-order
+ addExtensionDependency('sql_patches');
+ addExtensionDependency('order');
+
+ // Insert data in new table
+ addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`ext_name`,`column_name`,`locked_mode`,`payment_method`) VALUES('coupon','order_points','LOCKED','DIRECT')");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes('');
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running
- // SQL commands to run
+ // General and grade level data
+ addDropTableSql('grade_data');
+ addCreateTableSql('grade_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_name` VARCHAR(255) NOT NULL DEFAULT '',
+`grade_parent_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
+PRIMARY KEY (`id`),
+INDEX (`grade_parent_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade general data'");
+
+ // Data for if a grade level has been reached
+ addDropTableSql('grade_cash_data');
+ addCreateTableSql('grade_cash_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_cash_name` VARCHAR(255) NOT NULL DEFAULT '',
+`grade_cash_type` ENUM('DISCOUNT','BONUS') NOT NULL DEFAULT 'DISCOUNT',
+`reached_points` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL,
+`reached_mails` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
+`time_valid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`),
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade data if the grade have been \"cashed\"'");
+
+ // Connection grade<->cash data
+ addDropTableSql('grade_cash_connect');
+ addCreateTableSql('grade_cash_conenct', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_cash_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+PRIMARY KEY (`id`),
+UNIQUE KEY `grade_cash` (`grade_id`, `grade_cash_id`),
+INDEX (`grade_cash_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade<->cash data connection'");
+
+ // Connection grade<->user data
+ addDropTableSql('grade_user_connect');
+ addCreateTableSql('grade_user_connect', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`grade_expired TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`),
+UNIQUE KEY (`userid`, `grade_id`),
+INDEX (`grade_id`)
+) TYPE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Grade<->user connection'");
break;
case 'remove': // Do stuff when removing extension
// SQL commands to run
+ addDropTableSql('grade_data');
+ addDropTableSql('grade_cash_data');
+ addDropTableSql('grade_cash_connect');
+ addDropTableSql('grade_user_connect');
break;
case 'activate': // Do stuff when admin activates this extension
break;
case '0.5.3': // SQL queries for v0.5.3
- addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `order_points` FLOAT(20,5) NOT NULL DEFAULT 0.00000');
- addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `locked_order_points` FLOAT(20,5) NOT NULL DEFAULT 0.00000');
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_points` ADD `locked_order_points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000');
// This update depends on ext-user
addExtensionDependency('user');
} // END - if
// Version number
-setThisExtensionVersion('0.7.9');
+setThisExtensionVersion('0.8.0');
// Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0'));
// Keep this extension always active!
setExtensionAlwaysActive('Y');
addDropTableSql('admin_menu_las');
addDropTableSql('admin_menu_las_data');
addDropTableSql('admin_las_stats');
- addDropTableSql('filters');
addDropTableSql('dns_cache');
// Delete admin menu entries
- addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE
-`what`='config_extensions' OR
-`what`='config_home' OR
-`what`='list_unconfirmed' OR
-`what`='config_refid' OR
-`what`='config_title' OR
-`what`='sub_points' OR
-`what`='config_admin' OR
-`what`='config_proxy' OR
-`what`='config_session' OR
-`what`='list_filter'");
+ addExtensionSql("DELETE LOW_PRIORITY FROM
+ `{?_MYSQL_PREFIX?}_admin_menu`
+WHERE
+ `what`
+IN (
+ 'config_extensions',
+ 'config_home',
+ 'list_unconfirmed',
+ 'config_refid',
+ 'config_title',
+ 'sub_points',
+ 'config_admin',
+ 'config_proxy',
+ 'config_session',
+ 'list_filter',
+ 'list_point_accounts'
+)");
// Delete/update member menu entries
addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE
break;
case '0.1.5': // SQL queries for v0.1.5
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_extensions` DROP ext_has_admin");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_extensions` DROP `ext_has_admin`");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Spalte <u>ext_has_admin</u> aus der Tabelle <u>{?_MYSQL_PREFIX?}_extensions</u> entfernt, da sie keinen Sinn mehr macht.");
case '0.3.6': // SQL queries for v0.3.6
addConfigAddSql('salt_length', 'TINYINT(3) UNSIGNED NOT NULL DEFAULT 10');
addConfigAddSql('pass_scramble', "VARCHAR(255) NOT NULL DEFAULT ''");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` MODIFY `password` VARCHAR(255) NOT NULL DEFAULT ''");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` CHANGE `password` `password` VARCHAR(255) NOT NULL DEFAULT ''");
addConfigAddSql('rand_no', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
addConfigAddSql('file_hash', "VARCHAR(255) NOT NULL DEFAULT ''");
addConfigAddSql('master_salt', "VARCHAR(255) NOT NULL DEFAULT ''");
break;
case '0.5.9': // SQL queries for v0.5.9
- addDropTableSql('filters');
+ // Table 'filters' is vital because many functionality depends on it, so don't remove it
addCreateTableSql('filters', "(
-`filter_id` BIGINT(20) UNSIGNED AUTO_INCREMENT,
+`filter_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`filter_name` VARCHAR(50) NOT NULL DEFAULT '',
`filter_function` VARCHAR(100) NOT NULL DEFAULT '',
`filter_active` ENUM('N','Y') NOT NULL DEFAULT 'Y',
`added` DATETIME NOT NULL,
PRIMARY KEY (`hostname`),
INDEX (`ip`)
-) ENGINE = {?_TABLE_TYPE?}");
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Cache for DNS requests'");
// Configuration
addConfigAddSql('dns_cache_timeout', 'BIGINT(20) NOT NULL DEFAULT ' . (60*60*24));
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Adminscript <strong>what-config_email.php</strong> nach <strong>what-list_email_max_rec.php</strong> umbenannt.");
break;
+
+ case '0.8.0': // SQL queries for v0.8.0
+ // Points account data
+ addDropTableSql('points_data');
+ addCreateTableSql('points_data', "(
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`ext_name` VARCHAR(255) NOT NULL DEFAULT '',
+`column_name` VARCHAR(255) NOT NULL DEFAULT 'points',
+`locked_mode` ENUM('LOCKED','UNLOCKED') NOT NULL DEFAULT 'LOCKED',
+`payment_method` ENUM('DIRECT','REF') NOT NULL DEFAULT 'REF',
+PRIMARY KEY(`id`),
+INDEX (`ext_name`)
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Points account data'");
+
+ // Admin menu
+ addAdminMenuSql('setup','list_point_accounts','Guthabenkonten...','Veralten Sie hier bequem Einstellungen zu den Guthabenkonten.',5);
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Tabelle <em>points_data</em> erzeugt, diese soll das {?POINTS?}-Guthaben komplett lenken.");
+ break;
} // END - switch
break;
addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_user_stats` SET `pool_id`=NULL WHERE `pool_id`=0');
addExtensionSql('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `userid` IS NULL');
- // This update depends on ext-bonus
- addExtensionDependency('bonus');
-
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("NULL ist wichtiger als 0 und UNSIGNED auch.");
break;
} elseif ((!isInstallationPhase()) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) {
// Init add
$add = '';
- if (isExtensionINstalledAndNewer('sql_patches', '0.6.0')) $add = ", `filter_counter`";
+ if (isExtensionINstalledAndNewer('sql_patches', '0.6.0')) {
+ $add = ", `filter_counter`";
+ } // END - if
// Load all filters
$result = SQL_QUERY('SELECT
registerFilter('post_extension_installed', 'SOLVE_TASK');
registerFilter('post_extension_installed', 'LOAD_INCLUDES');
registerFilter('post_extension_installed', 'REMOVE_UPDATES');
+ registerFilter('post_extension_installed', 'EXTENSION_MARK_INSTALLED');
// Solving tasks
registerFilter('solve_task', 'SOLVE_TASK');
// "Unregisters" a filter from the given chain
function unregisterFilter ($F, $L, $filterName, $filterFunction, $force = false, $dry_run = false) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry_run=' . intval($dry_run) . ' - ENTERED!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry_run=' . intval($dry_run) . ' - ENTERED!');
// Extend the filter function name only if not loaded from database
if (!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) {
// Shall we remove? (default, not while just showing an extension removal)
if ($dry_run === false) {
// Mark for filter removal
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REMOVE: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ' - REMOVE!');
$GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R';
} // END - if
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry_run=' . intval($dry_run) . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',dry_run=' . intval($dry_run) . ' - EXIT!');
}
// "Runs" the given filters, filterData is optional and can be any type of data
function FILTER_CACHE_DESTROY_FILTER ($data) {
// Skip this step if the cache instance is not there
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
- if ((!isCacheInstanceValid()) || (getConfig('update_filter_usage') != 'Y')) {
+ if ((!isCacheInstanceValid()) || ((isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') != 'Y'))) {
return false;
} // END - if
// Filter to change column name for the right "points account"
function FILTER_COUPON_CHANGE_POINTS_COLUMN_NAME ($data) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
- // Are the points locked?
- if (($data['locked'] === true) && (getConfig('coupon_locked_points_mode') == 'LOCKED')) {
- // Locked points may be routed to special account
- $data['column'] = 'locked_order_points';
- } elseif (getConfig('coupon_points_account') == 'ORDER') {
- // These points should be routed to 'order' account
- $data['column'] = 'order_points';
- } else {
- // Else all went to general account
- $data['column'] = 'points';
- }
+ // Get the column name from extension's name and 'locked'
+ $data['column'] = getPointsColumnNameFromExtensionNameLocked('coupon', $data['locked']);
// Return data
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
// Initialize variables
$userid = '0';
- $isMember = 'N';
- $isAdmin = 'N';
- $action = getActionFromModuleWhat(getModule(), getWhat());
+ $isMember = convertBooleanToYesNo(isMember());
+ $isAdmin = convertBooleanToYesNo(isAdmin());
+ $action = getActionFromModuleWhat(getModule(), getWhat());
// Valid userid?
if (isMember()) {
- // Is valid user
+ // Is valid user, so get the userid
$userid = getMemberId();
- $isMember = 'Y';
- } // END - if
-
- if (isAdmin()) {
- // Is administrator
- $isAdmin = 'Y';
} // END - if
// Now search for the user
// Is the extension sql_patches updated?
if ((!isExtensionInstalled('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.9'))) {
// Abort silently here
+ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters, sql_patches might be missing. isExtensionInstalled()=' . isExtensionInstalled('sql_patches') . ',isExtensionInstalledAndOlder()=' . isExtensionInstalledAndOlder('sql_patches', '0.5.9'));
return false;
} // END - if
// Filter for running SQL commands
function FILTER_RUN_SQLS ($data) {
// Debug message
+ //* DEBUG: */ die('getSqls()=<pre>'.print_r(getSqls(), true).'</pre>ext_update_depends=<pre>'.print_r($GLOBALS['ext_update_depends'], true).'</pre>');
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Entered!');
// Is the array there?
// Is the config entry set?
if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
- // Create current week mark
- $currWeek = getWeek();
-
// Has it changed?
- if ((getConfig('last_week') != $currWeek) || (isWeeklyResetDebugEnabled())) {
+ if (((isConfigEntrySet('last_week')) && (getConfig('last_week') != getWeek())) || (isWeeklyResetDebugEnabled())) {
// Include weekly reset scripts
mergeIncludePool('reset', getArrayFromDirectory('inc/weekly/', 'weekly_'));
// Update config if not in debug mode
- if (!isWeeklyResetDebugEnabled()) updateConfiguration('last_week', $currWeek);
+ if (!isWeeklyResetDebugEnabled()) {
+ updateConfiguration('last_week', getWeek());
+ } // END - if
} // END - if
// Create current month mark
} // END - if
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
- if (((getConfig('last_hour') != getHour()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
+ if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) {
// Tell every module we are in reset-mode!
doHourly();
} // END - if
setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
}
+// Filter for marking extension as installed
+function FILTER_EXTENSION_MARK_INSTALLED ($data) {
+ // Mark it as installed
+ $GLOBALS['ext_is_installed'][$data['ext_name']] = true;
+}
+
// [EOF]
?>
return $GLOBALS['refid'];
}
+// Converts a boolean variable into 'Y' for true and 'N' for false
+function convertBooleanToYesNo ($boolean) {
+ // Default is 'N'
+ $converted = 'N';
+ if ($boolean === true) {
+ // Set 'Y'
+ $converted = 'Y';
+ } // END - if
+
+ // Return it
+ return $converted;
+}
+
//-----------------------------------------------------------------------------
// Automatically re-created functions, all taken from user comments on www.php.net
//-----------------------------------------------------------------------------
'ADMIN_CONFIG_COUPON_DEFAULT_TIME' => "Zeit, bis Gutscheine ablaufen sollen. Sie können diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachträglich anpassen.",
'ADMIN_CONFIG_COUPON_DEFAULT_POINTS' => "Ausgangsvergütung in {?POINTS?}. Sie können diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachträglich anpassen.",
'ADMIN_CONFIG_COUPON_AUTOPURGE_TIME' => "Dauer bis abgelaufene Gutscheine aus der Datenbank entfernt werden",
- 'ADMIN_CONFIG_COUPON_SELECT_PAYMENT_METHOD' => "Soll nur dem Mitglied direkt die Gutschrift aus dem Einlösen von Gutscheinen oder über das Referal-System gutgeschrieben werden?",
- 'ADMIN_CONFIG_COUPON_SELECT_POINTS_ACCOUNT' => "Sollen die {?POINTS?} aus den eingelösten Gutscheinen dem allgemeinen oder dem Werbekonto gutgeschrieben werden?",
- 'ADMIN_CONFIG_COUPON_SELECT_LOCKED_POINTS_MODE' => "Wenn das Mitglied noch zu bestätigende Mails offen hat, sollen die eingelösten Gutscheine einem gesperrten Konto oder dem oben eingestellten gutgeschrieben werden?",
'ADMIN_CONFIG_COUPON_USERID' => "Mitgliederaccount, von dem die eingelösten {?POINTS?} abgebucht werden sollen:",
// Admin - Send coupon to members
// Write catgories
if ((is_array(postRequestParameter('cat'))) && (count(postRequestParameter('cat')))) {
- foreach (postRequestParameter('cat') as $cat => $joined) {
+ foreach (postRequestParameter('cat') as $categoryId => $joined) {
if ($joined == 'Y') {
// Insert category entry
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (`userid`, `cat_id`) VALUES (%s, %s)",
- array($userid, bigintval($cat)), __FUNCTION__, __LINE__);
+ array(
+ $userid,
+ bigintval($categoryId)
+ ), __FUNCTION__, __LINE__);
} // END - if
} // END - foreach
} // END - if
$GLOBALS['cache_instance']->removeCacheFile();
unset($GLOBALS['cache_array']['admin_acls']);
}
- } else {
+ } elseif (count($GLOBALS['cache_array']['admin_acls']) > 0) {
// Nope, cache file is corrupted!
$GLOBALS['cache_instance']->removeCacheFile();
unset($GLOBALS['cache_array']['admin_acls']);
+ } elseif (isDebugModeEnabled()) {
+ // This may drive a lot messages to the logfile
+ //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'No entry found in admin_acls to rewrite.');
}
} elseif (isHtmlOutputMode()) {
// Create cache file here
$GLOBALS['cache_instance']->init();
- // Load all modules and their data (column 'id' is no longer required)
- $result = SQL_QUERY('SELECT `admin_id`, `action_menu`, `what_menu`, `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC, `action_menu` ASC, `what_menu` ASC', __FILE__, __LINE__);
+ // Load all admins and their data
+ $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC, `action_menu` ASC, `what_menu` ASC', __FILE__, __LINE__);
// Add all rows
while ($content = SQL_FETCHARRAY($result)) {
// Loop through all
foreach ($EXT_DUMMY['ext_name'] as $k => $ext_name) {
// Load CSS file
- if ($EXT_DUMMY['ext_css'][$k] == 'Y') addExtensionCssFile($ext_name . '.css');
+ if ($EXT_DUMMY['ext_css'][$k] == 'Y') {
+ addExtensionCssFile($ext_name . '.css');
+ } // END - if
// Load extension file itself
if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y')) {
// Add more if sql_patches is recent enougth
$add = '';
- if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) $add = ", `ext_has_css` AS ext_css";
+ if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
+ $add = ', `ext_has_css` AS `ext_css`';
+ } // END - if
// Load all modules and their data
- $result = SQL_QUERY('SELECT `id` AS ext_id, `ext_name`, `ext_active`, `ext_version`'.$add.' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__);
+ $result = SQL_QUERY('SELECT `id` AS `ext_id`, `ext_name`, `ext_active`, `ext_version`' . $add . ' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Load extension
loadExtension($content['ext_name'], 'test');
// Get menu entry
- $content['ext_menu'] = 'N';
- if (ifModuleHasMenu($content['ext_name'], true)) {
- // Extension is a module and has menu... pew!
- $content['ext_menu'] = 'Y';
- } // END - if
+ $content['ext_menu'] = convertBooleanToYesNo(ifModuleHasMenu($content['ext_name'], true));
// Get language entry
- $content['ext_lang'] = 'N';
- if (isLanguageIncludeReadable($content['ext_name'])) {
- // Readable
- $content['ext_lang'] = 'Y';
- } // END - if
+ $content['ext_lang'] = convertBooleanToYesNo(isLanguageIncludeReadable($content['ext_name']));
// Get function entry
- $content['ext_func'] = 'N';
- if (isExtensionFunctionFileReadable($content['ext_name'])) {
- // Readable
- $content['ext_func'] = 'Y';
- } // END - if
+ $content['ext_func'] = convertBooleanToYesNo(isExtensionFunctionFileReadable($content['ext_name']));
// Transfer EXT_ALWAYS_ACTIVE flag
$content['ext_keep'] = getThisExtensionAlwaysActive();
$GLOBALS['cache_instance']->init();
// Load all modules and their data
- $result = SQL_QUERY('SELECT id, level, percents FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY level', __FILE__, __LINE__);
+ $result = SQL_QUERY('SELECT `id`, `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC', __FILE__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Add row to cache file
$GLOBALS['cache_instance']->addRow($content);
// Load all themes and their data
if (isExtensionInstalledAndNewer('theme', '0.0.7')) {
- $result = SQL_QUERY('SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id`', __FILE__, __LINE__);
+ $result = SQL_QUERY('SELECT `id`, `theme_path`, `theme_active`, `theme_ver`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__);
} else {
- $result = SQL_QUERY('SELECT id, theme_path, theme_active, theme_ver FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id`', __FILE__, __LINE__);
+ $result = SQL_QUERY('SELECT `id`, `theme_path`, `theme_active`, `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id` ASC', __FILE__, __LINE__);
}
while ($content = SQL_FETCHARRAY($result)) {
// Add row to cache file
// Change activation status
function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') {
- $count = '0'; $newStatus = 'Y';
+ $count = '0';
if ((is_array($IDs)) && (count($IDs) > 0)) {
// "Walk" all through and count them
foreach ($IDs as $id => $selected) {
if (!empty($selected)) {
// Determine new status
$result = SQL_QUERY_ESC("SELECT %s FROM `{?_MYSQL_PREFIX?}_%s` WHERE %s=%s LIMIT 1",
- array($row, $table, $idRow, $id), __FUNCTION__, __LINE__);
+ array(
+ $row,
+ $table,
+ $idRow,
+ $id
+ ), __FUNCTION__, __LINE__);
// Row found?
if (SQL_NUMROWS($result) == 1) {
list($currStatus) = SQL_FETCHROW($result);
// And switch it N<->Y
- if ($currStatus == 'Y') $newStatus = 'N'; else $newStatus = 'Y';
+ $newStatus = convertBooleanToYesNo(!($currStatus == 'Y'));
// Change this status
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s` SET %s='%s' WHERE %s=%s LIMIT 1",
- array($table, $row, $newStatus, $idRow, $id), __FUNCTION__, __LINE__);
+ array(
+ $table,
+ $row,
+ $newStatus,
+ $idRow,
+ $id
+ ), __FUNCTION__, __LINE__);
// Count up affected rows
$count += SQL_AFFECTEDROWS();
$END = mktime(postRequestParameter('end_hour') , postRequestParameter('end_min') , postRequestParameter('end_sec') , postRequestParameter('end_month') , postRequestParameter('end_day') , postRequestParameter('end_year') );
// Is there already a rallye running?
- $result = SQL_QUERY_ESC("SELECT id, admin_id FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE (start_time <= %s AND end_time >= %s) OR (start_time >= %s AND start_time <= %s) LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id`, `admin_id` FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE (`start_time` <= %s AND `end_time` >= %s) OR (`start_time` >= %s AND `start_time` <= %s) LIMIT 1",
array($START, $START, $START, $END), __FILE__, __LINE__);
if (SQL_HASZERONUMS($result)) {
doAdminProcessMenuWeightning('admin', $AND);
// Run SQL
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);
// Do we have entries?
if (!SQL_HASZERONUMS($result)) {
// Add userid selection
$content['coupon_userid'] = addMemberSelectionBox(getConfig('coupon_userid'), false, true, true, 'coupon_userid');
- // Init all other template entries
- foreach (array('payment_method_ref', 'payment_method_direct', 'points_account_order', 'points_account_general', 'locked_points_mode_locked', 'locked_points_mode_unlocked') as $entry) {
- $content['coupon_' . $entry] = '';
- } // END - foreach
-
- // Set current selections
- foreach (array('payment_method', 'points_account', 'locked_points_mode') as $entry) {
- $content['coupon_' . $entry . '_' . strtolower(getConfig('coupon_' . $entry))] = ' checked="checked"';
- } // END - foreach
-
// Prepare some template data
$content['coupon_default_time_selection'] = createConfigurationTimeSelections('coupon_default_time' , 'WDh');
$content['coupon_autopurge_time_selection'] = createConfigurationTimeSelections('coupon_autopurge_time', 'WDh');
} // END - if
// Load all what menu points
- $result = SQL_QUERY("SELECT id, what, title
-FROM `{?_MYSQL_PREFIX?}_guest_menu`
-WHERE `action`='main' AND `what` != '' AND `what` IS NOT NULL AND `locked`='N'
-ORDER BY `sort` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT
+ `id`, `what`, `title`
+FROM
+ `{?_MYSQL_PREFIX?}_guest_menu`
+WHERE
+ `action`='main' AND
+ `what` != '' AND
+ `what` IS NOT NULL AND
+ `locked`='N'
+ORDER BY
+ `sort` ASC", __FILE__, __LINE__);
// Init variables
$OUT = '';
if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
// Load extension data with CSS informations
$result = SQL_QUERY("SELECT
- `id` AS ext_id, `ext_name`, `ext_active`, `ext_has_css` AS ext_css, `ext_version`
+ `id` AS `ext_id`,
+ `ext_name`,
+ `ext_active`,
+ `ext_has_css` AS `ext_css`,
+ `ext_version`
FROM
`{?_MYSQL_PREFIX?}_extensions`
".$where."
} else {
// Load extension data without CSS informations
$result = SQL_QUERY("SELECT
- `id` AS ext_id, `ext_name`, `ext_active`, `ext_version`
+ `id` AS `ext_id`,
+ `ext_name`,
+ `ext_active`,
+ `ext_version`
FROM
`{?_MYSQL_PREFIX?}_extensions`
".$where."
// Prepare CSS selection output
$cssSelection = '---';
if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
- $cssSelection = translateYesNo($content['ext_css']);
+ $cssSelection = '{%pipe,translateYesNo=' . $content['ext_css'] . '%}';
} // END - if
// Prepare data for the row template
if (SQL_HASZERONUMS($result)) {
// Finally add the new ACL
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_acls` (`admin_id`, `action_menu`, `what_menu`, `access_mode`)
-VALUES ('%s','%s','%s','%s')",
+VALUES (%s,'%s','%s','%s')",
array(
bigintval(postRequestParameter('admin_id')),
postRequestParameter('action_menu'),
// Add new code?
if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequestParameterSet('descr'))) {
// Check if country code does already exist
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` WHERE code='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` WHERE `code`='%s' LIMIT 1",
array(strtoupper(postRequestParameter('code'))), __FILE__, __LINE__);
if (SQL_HASZERONUMS($result)) {
// Save entry
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (code, descr, is_active) VALUES ('%s','%s','%s')",
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_countries` (`code`, `descr`, `is_active`) VALUES ('%s','%s','%s')",
array(
- strtoupper(substr(postRequestParameter('code'), 0, 2)),
- postRequestParameter('descr'),
- postRequestParameter('is_active')
+ strtoupper(substr(postRequestParameter('code'), 0, 2)),
+ postRequestParameter('descr'),
+ postRequestParameter('is_active')
), __FILE__, __LINE__);
// Country added
$content['is_active'] = generateOptionList('/ARRAY/', array('Y', 'N'), array('{--YES--}', '{--NO--}'), $isActive);
} else {
// Only display status when in delete-mode
- $content['is_active'] = translateYesNo($isActive);
+ $content['is_active'] = '{%pipe,translateYesNo=' . $isActive . '%}';
}
// Insert row template and switch color
// Load main template
loadTemplate('admin_list_country_form', false, $content);
- }
+ } // END - if
} else {
// Shall we modify / remove entries now?
- $message = ''; initSqls();
+ $message = '';
+ initSqls();
if ((isPostRequestParameterSet('modify')) && (isPostRequestParameterSet('id'))) {
// Modify
foreach (postRequestParameter('id') as $id => $sel) {
// @TODO Find a way to rewrite this. See some lines above for different queries
while (list($id, $id2, $type) = SQL_FETCHROW($result)) {
// Initializes all variables
- $cat = '';
$DATA = '';
$PROBLEM = '{--ADMIN_GENERAL_MAIL_PROBLEM--}';
$result_data = false;
LIMIT 1",
array($content['id']), __FILE__, __LINE__);
- /// Is there an entry?
+ // Is there an entry?
if (SQL_NUMROWS($result_main) == 1) {
// Load data
$content = SQL_FETCHARRAY($result_main);
displayMessage('{--SPONSOR_ACCOUNT_EMAIL_FAILED--}');
}
} else {
- /// ??? Other status?
+ // ??? Other status?
displayMessage('{--SPONSOR_ACCOUNT_STATUS_FAILED--}');
}
} else {
// Init array
$rows = array();
-//// TOP logins
+// TOP logins
$result = SQL_QUERY("SELECT
`userid`, `total_logins`, `last_online`
FROM
// Free result
SQL_FREERESULT($result);
-//// TOP earners
+// TOP earners
$result = SQL_QUERY("SELECT
d.userid,
(SUM(p.points) - d.used_points) AS `points`,
// Free result
SQL_FREERESULT($result);
-//// TOP referal "hunter"
+// TOP referal "hunter"
$result = SQL_QUERY("SELECT
d.userid,
SUM(r.counter) AS refs,
$LEAST = false;
if (isFormSent()) {
$count = '0';
- foreach (postRequestParameter('cat') as $cat => $joined) {
+ foreach (postRequestParameter('cat') as $categoryId => $joined) {
if ($joined != 'Y') $count++;
} // END - foreach
$count = '0';
// Go through all entries
- foreach (postRequestParameter('cat') as $cat => $joined) {
+ foreach (postRequestParameter('cat') as $categoryId => $joined) {
// Ini sql here
$sql = '';
switch ($joined) {
case 'Y':
$result_user = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid`=%s AND `cat_id`=%s LIMIT 1",
- array(getMemberId(), bigintval($cat)), __FILE__, __LINE__);
+ array(getMemberId(), bigintval($categoryId)), __FILE__, __LINE__);
// Debug message
- //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'cat='.$cat.',joined='.$joined.',getMemberId()='.getMemberId().',SQL_HASZERONUMS()='.intval(SQL_HASZERONUMS($result_user)));
+ //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'categoryId='.$categoryId.',joined='.$joined.',getMemberId()='.getMemberId().',SQL_HASZERONUMS()='.intval(SQL_HASZERONUMS($result_user)));
if (SQL_HASZERONUMS($result_user)) {
$sql = "INSERT INTO `{?_MYSQL_PREFIX?}_user_cats` (`userid`, `cat_id`) VALUES (%s,%s)";
if (!empty($sql)) {
// Run SQL command
- SQL_QUERY_ESC(trim($sql), array(getMemberId(), bigintval($cat)), __FILE__, __LINE__);
+ SQL_QUERY_ESC(trim($sql), array(getMemberId(), bigintval($categoryId)), __FILE__, __LINE__);
// Count this row
$count += SQL_AFFECTEDROWS();
}
// Add bonus mail to queue
-function addBonusMailToQueue ($subject, $text, $receiverList, $points, $seconds, $url, $cat, $mode='normal', $receiver=0) {
+function addBonusMailToQueue ($subject, $text, $receiverList, $points, $seconds, $url, $categoryId, $mode='normal', $receiver=0) {
// Is admin or bonus extension there?
if (!isAdmin()) {
// Abort here
// HTML extension active?
if (isExtensionActive('html_mail')) {
- // No HTML by default
- $HTML = 'N';
-
- // HTML mode?
- if ($mode == 'html') {
- // Yes, please
- $HTML = 'Y';
- } // END - if
+ // Determine if we have HTML mode active
+ $HTML = convertBooleanToYesNo($mode == 'html');
// Add HTML mail
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus`
(`subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `mails_sent`, `html_msg`)
-VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s','%s')",
+VALUES ('%s','%s','%s',%s,%s,'NEW', UNIX_TIMESTAMP(),'%s',%s,%s,%s,'%s')",
array(
$subject,
$text,
$receiverList,
$points,
- $seconds,
+ bigintval($seconds),
$url,
- $cat,
+ bigintval($categoryId),
$target,
bigintval($receiver),
$HTML
// Add regular mail
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus`
(`subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `mails_sent`)
-VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
+VALUES ('%s','%s','%s',%s,%s,'NEW', UNIX_TIMESTAMP(),'%s',%s,%s,%s)",
array(
$subject,
$text,
$receiverList,
$points,
- $seconds,
+ bigintval($seconds),
$url,
- $cat,
+ bigintval($categoryId),
$target,
bigintval($receiver),
), __FUNCTION__, __LINE__);
}
// Generate a receiver list for given category and maximum receivers
-function generateReceiverList ($cat, $receiver, $mode = '') {
+function generateReceiverList ($categoryId, $receiver, $mode = '') {
// Init variables
$CAT_TABS = '';
$CAT_WHERE = '';
$result = false;
// Secure data
- $cat = bigintval($cat);
- $receiver = bigintval($receiver);
+ $categoryId = bigintval($categoryId);
+ $receiver = bigintval($receiver);
// Is the receiver zero and mode set?
if (($receiver == '0') && (!empty($mode))) {
} // END - if
// Category given?
- if ($cat > 0) {
+ if ($categoryId > 0) {
// Select category
$CAT_TABS = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.`userid`=c.`userid`";
- $CAT_WHERE = sprintf(" AND c.`cat_id`=%s", $cat);
+ $CAT_WHERE = sprintf(" AND c.`cat_id`=%s", $categoryId);
} // END - if
// Exclude users in holiday?
if ((isExtensionActive('html_mail')) && ($mode == 'html')) {
// Only include HTML receivers
- $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.`html`='Y'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
+ $result = SQL_QUERY_ESC("SELECT d.`userid` FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.`html`='Y'".$CAT_WHERE." ORDER BY d.`{?order_select?}` {?order_mode?} LIMIT %s",
array(
$receiver
), __FUNCTION__, __LINE__);
} else {
// Include all
- $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
+ $result = SQL_QUERY_ESC("SELECT d.`userid` FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.`{?order_select?}` {?order_mode?} LIMIT %s",
array(
$receiver
), __FUNCTION__, __LINE__);
), __FUNCTION__, __LINE__);
}
+// Get points data for given extension's name
+function getPointsDataArrayFromExtensionName ($ext_name) {
+ // If we have cache, shortcut it here
+ if (isset($GLOBALS['cache_array']['points_data'])) {
+ // Return it
+ return $GLOBALS['cache_array']['points_data'];
+ } // END - if
+
+ // Now checkout the entry in database table
+ $result = SQL_QUERY_ESC("SELECT `id`, `ext_name`, `column_name`, `locked_mode`, `payment_method` FROM `{?_MYSQL_PREFIX?}_points_data` WHERE `ext_name`='%s' LIMIT 1",
+ array($ext_name), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Then load it
+ $pointsData = SQL_FETCHARRAY($result);
+
+ // Add all remaining entries
+ foreach ($pointsData as $key=>$value) {
+ $GLOBALS['cache_array']['points_data'][$key][$ext_name][$isLocked] = $value;
+ } // END - foreach
+ } else {
+ /*
+ * Having no entry is not bad but it means that all points will go to
+ * the general account which the user can let payout.
+ */
+ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',isLocked=' . intval($isLocked) . ' - No entry found, switching to general points account.');
+ }
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return it
+ return $GLOBALS['cache_array']['points_data'];
+}
+
+// Determines the right points column name for given extension and 'locked'
+function getPointsColumnNameFromExtensionNameLocked ($ext_name, $isLocked) {
+ // Extension sql_patches must be up-to-date
+ if (isExtensionInstalledAndOlder('sql_patches', '0.8.0')) {
+ // Please update ext-sql_patches
+ debug_report_bug(__FUNCTION__, __LINE__, 'sql_patches is out-dated. Please update to at least 0.8.0 to continue. ext_name=' . $ext_name . ',isLocked=' . intval($isLocked));
+ } // END - if
+
+ // Get the points_data entry
+ $pointsData = getPointsDataArrayFromExtensionName($ext_name);
+
+ // Regular points by default
+ $columnName = $pointsData['columnName'];
+
+ // Are the points locked?
+ if (($isLocked === true) && ($pointsData['locked_mode'] == 'LOCKED')) {
+ // Locked points, so prefix it
+ $columnName = 'locked_' . $pointsData['column_name'];
+ } // END - if
+
+ // Return the result
+ return $columName;
+}
+
// [EOF]
?>
// Is ext-sql_patches there and newer?
if (isExtensionInstalledAndNewer('sql_patches', '0.5.3')) {
// Set session save path if set
- if (getConfig('session_save_path') != '') {
+ if ((isConfigEntrySet('session_save_path')) && (getConfig('session_save_path') != '')) {
// Please make sure this valid!
session_save_path(getConfig('session_save_path'));
} // END - if
fetchUserData($userid, 'nickname');
} else {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "NO-NICK!<br />");
- /// Load by userid
+ // Load by userid
fetchUserData($userid);
}
// Is the cache there
if (!isset($GLOBALS[__FUNCTION__][$userid])) {
// Determine it
- $GLOBALS[__FUNCTION__][$userid] = (('' . round($userid) . '') != $userid);
+ $GLOBALS[__FUNCTION__][$userid] = ((!empty($userid)) && (('' . round($userid) . '') != $userid));
} // END - if
// Return the result
redirectOnUninstalledExtension('bonus');
// Bonus-Mails
- $result = SQL_QUERY_ESC("SELECT id, url, subject FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id`, `url`, `subject` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
array($bonusId), __FILE__, __LINE__);
break;
<span class="tiny">({?POINTS?})</span>
</td>
</tr>
- <tr>
- <td colspan="2" align="center" class="table_header bottom">
- <strong>{--ADMIN_CONFIG_COUPON_SELECT_PAYMENT_METHOD--}</strong>
- </td>
- </tr>
- <tr>
- <td class="bottom" align="right" height="20">
- <input type="radio" class="form_field" name="coupon_payment_method" value="DIRECT"$content[coupon_payment_method_direct] />
- {--ADMIN_CONFIG_PAYMENT_MODE_DIRECT--}
- </td>
- <td class="bottom" align="center">
- <input type="radio" class="form_field" name="coupon_payment_method" value="REF"$content[coupon_payment_method_ref] />
- {--ADMIN_CONFIG_PAYMENT_MODE_REF--}
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center" class="table_header bottom">
- <strong>{--ADMIN_CONFIG_COUPON_SELECT_POINTS_ACCOUNT--}</strong>
- </td>
- </tr>
- <tr>
- <td class="bottom" align="right" height="20">
- <input type="radio" class="form_field" name="coupon_points_account" value="ORDER"$content[coupon_points_account_order] />
- {--ADMIN_CONFIG_POINTS_ACCOUNT_ORDER--}
- </td>
- <td class="bottom" align="center">
- <input type="radio" class="form_field" name="coupon_points_account" value="GENERAL"$content[coupon_points_account_general] />
- {--ADMIN_CONFIG_POINTS_ACCOUNT_GENERAL--}
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center" class="table_header bottom">
- <strong>{--ADMIN_CONFIG_COUPON_SELECT_LOCKED_POINTS_MODE--}</strong>
- </td>
- </tr>
- <tr>
- <td class="bottom" align="right" height="20">
- <input type="radio" class="form_field" name="coupon_locked_points_mode" value="locked"$content[coupon_locked_points_mode_locked] />
- {--ADMIN_CONFIG_LOCKED_POINTS_MODE_LOCKED--}
- </td>
- <td class="bottom" align="center">
- <input type="radio" class="form_field" name="coupon_locked_points_mode" value="unlocked"$content[coupon_locked_points_mode_unlocked] />
- {--ADMIN_CONFIG_LOCKED_POINTS_MODE_UNLOCKED--}
- </td>
- </tr>
<tr>
<td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_USERID--}:</td>
<td class="bottom" align="center">
<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
<tr>
<td colspan="2" class="table_header bottom" align="center">
- <strong>{--ADMIN_ORDER_SETTINGS--}:</strong>
+ <strong>{--ADMIN_CONFIG_ORDER_TITLE--}:</strong>
</td>
</tr>
</tr>
<tr>
- <td class="bottom" align="right" width="200" style="padding-right:5px">{--ADMIN_RANDOM_MIN_CONFIRMED--}</td>
+ <td class="bottom" align="right" width="200" style="padding-right:5px">{--ADMIN_CONFIG_RANDOM_MIN_CONFIRMED--}</td>
<td class="bottom" align="center">
<input type="text" class="form_field" name="user_min_confirmed" size="3" maxlength="3" value="{?user_min_confirmed?}" />
</td>