$currentTab = postRequestElement('tab');
// Remove some elements which should not be saved
- foreach (array('tab', 'do', 'level') as $removedElement) {
+ foreach (['tab', 'do', 'level'] as $removedElement) {
// Remove this element from POST data
unsetPostRequestElement($removedElement);
} // END - foreach
// Call-back function to register first admin
function doAjaxInstallerStepRegisterFirstAdmin () {
// Is all set?
- if (!isSessionDataSet(array('admin_login', 'admin_email', 'admin_password1', 'admin_password2'))) {
+ if (!isSessionDataSet(['admin_login', 'admin_email', 'admin_password1', 'admin_password2'])) {
// Some required session data is not set
reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
} elseif (isAdminRegistered()) {
} // END - if
// Set a minimum of configuration, required to by-pass some error triggers in getConfig()
- $GLOBALS['config'] = array(
+ $GLOBALS['config'] = [
'sql_time' => 0,
'sql_count' => 0,
'num_templates' => 0,
+ 'DEBUG_MODE' => 'N',
+ 'verbose_sql' => 'N',
// 'DEFAULT_SALT_LENGTH' => 40,
- // 'DEBUG_MODE' => 'N',
// 'DEBUG_HOURLY' => 'N',
// 'DEBUG_DAILY' => 'N',
// 'DEBUG_MONTHLY' => 'N',
// 'DEBUG_WEEKLY' => 'N',
// 'DEBUG_REGEX' => 'N',
// 'ADMIN_REGISTERED' => 'N',
- // 'verbose_sql' => 'Y',
// For installation phase:
'SMTP_HOSTNAME' => '',
'SMTP_USER' => '',
'SMTP_PASSWORD' => '',
'MT_WORD' => '{--DEFAULT_MT_WORD--}',
- );
+ ];
}
// Getter for $GLOBALS['config'] entries
function updateOldConfigFile () {
// Watch out for these lines and execute them as single command
// @TODO Make this all better... :-/
- $watchLines = array(
+ $watchLines = [
'SITE_KEY' => 'SITE_KEY',
'DEFAULT_LANG' => 'DEFAULT_LANG',
'warn_no_pass' => 'WARN_NO_PASS',
'WEBMASTER' => 'WEBMASTER',
'PATH' => 'PATH',
'URL' => 'URL',
- );
+ ];
// Make these lower-case! (damn stupid code...)
- $lowerCase = array('WARN_NO_PASS', 'MAILER_INSTALLED', 'ADMIN_REGISTERED');
+ $lowerCase = ['WARN_NO_PASS', 'MAILER_INSTALLED', 'ADMIN_REGISTERED'];
// Special comments...
- $comments = array(
+ $comments = [
'WARN_NO_PASS' => 'NULLPASS-WARNING',
'MAILER_INSTALLED ' => 'INSTALLED',
'ADMIN_REGISTERED' => 'ADMIN-SETUP',
'dbase' => 'MYSQL-DBASE',
'login' => 'MYSQL-LOGIN',
'password' => 'MYSQL-PASSWORD'
- );
+ ];
// Copy template to new file destionation
copyFileVerified(getPath() . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
//setConfigEntry('ALLOW_TESTER_ACCOUNTS', 'Y');
// Your MySQL data (we don't like M$ SQL ;-) )
-$GLOBALS['mysql'] = array(
+$GLOBALS['mysql'] = [
// CFG: MYSQL-HOST
'host' => 'localhost',
// CFG: MYSQL-DBASE
'login' => 'user',
// CFG: MYSQL-PASSWORD
'password' => 'pass',
-);
+];
// SMTP-Subsystem (keep all empty to use legacy mail() command!)
// CFG: SMTP-HOSTNAME
$algos = mcrypt_list_algorithms();
// Remove any unsecure (e.g. DES/3DES)
- foreach (array('des', 'tripledes') as $unsecure) {
+ foreach (['des', 'tripledes'] as $unsecure) {
// Search for it
$id = array_search($unsecure, $algos, TRUE);
$data['__server'] = '';
// Check which method/target is set
- foreach (array('callback', 'extra_func', 'extra_func2') as $key) {
+ foreach (['callback', 'extra_func', 'extra_func2'] as $key) {
// Make lower-case
$value = strtolower($data[$key]);
} // END - if
// Add rest elements
- foreach (array('method', 'target', 'name', 'id') as $key) {
+ foreach (['method', 'target', 'name', 'id'] as $key) {
$data['__replacer'] .= ' ' . $key . '=\"' . $data['__form_' . $key] . '\"';
} // END - foreach
} // END - if
// Init dummy array
- $filterArray = array(
+ $filterArray = [
'chains' => [],
'loaded' => [],
'counter' => []
- );
+ ];
// Found in cache so rewrite the array
foreach ($GLOBALS['cache_array']['filter']['filter_name'] as $idx => $filterName) {
} // END - if
// Remove cache
- foreach (array('config', 'extension', 'filter', 'modules', 'earning', 'points_data') as $cache) {
+ foreach (['config', 'extension', 'filter', 'modules', 'earning', 'points_data'] as $cache) {
// Rebuild cache
rebuildCache($cache);
} // END - foreach
} // END - if
// Remove cache files
- foreach (array('admin', 'admin_acls', 'config', 'extension', 'earning', 'filter', 'imprint', 'modules', 'payments', 'points_data', 'refdepths', 'refsystem', 'themes') as $cache) {
+ foreach (['admin', 'admin_acls', 'config', 'extension', 'earning', 'filter', 'imprint', 'modules', 'payments', 'points_data', 'refdepths', 'refsystem', 'themes'] as $cache) {
// Rebuild it
rebuildCache($cache);
} // END - foreach
// Filter for loading more runtime includes (not for installation)
function FILTER_LOAD_RUNTIME_INCLUDES () {
// Load more includes
- foreach (array('databases') as $inc) {
+ foreach (['databases'] as $inc) {
// Load the include
loadIncludeOnce('inc/' . $inc . '.php');
} // END - foreach
} // END - if
// Get all menus
-foreach (array('guest','member','admin') as $menu) {
+foreach (['guest','member','admin'] as $menu) {
// Query it
$result = sqlQueryEscaped("SELECT `action`, `what` FROM `{?_MYSQL_PREFIX?}_%s_menu` ORDER BY `action` ASC,`what` ASC",
array($menu), __FILE__, __LINE__);
// @TODO Rewrite this to a filter
if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isValidCacheInstance())) {
// Destroy some cache files
- foreach (array('config', 'extension', 'filter', 'modules') as $cache) {
+ foreach (array['config', 'extension', 'filter', 'modules'] as $cache) {
// Use rebuildCache()
rebuildCache($cache);
} // END - foreach
$GLOBALS['skip_config'][$test] = TRUE;
// Remove data from array
- foreach (array('ye', 'mo', 'mn', 'we', 'da', 'ho', 'mi', 'se') as $rem) {
+ foreach (['ye', 'mo', 'mn', 'we', 'da', 'ho', 'mi', 'se'] as $rem) {
unset($postData[$test . '_' . $rem]);
} // END - foreach
* Try to find one and replace it. I do it this way to allow easy
* extending of this code.
*/
- foreach (array('admin_list_builder_id_value') as $key) {
+ foreach (['admin_list_builder_id_value'] as $key) {
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key);
// Is the cache entry set?
if (isset($GLOBALS[$key])) {
$path = str_replace(chr(92), '/', substr(dirname(__FILE__), 0, -3));
// Some very important function includes
-foreach (array('config', 'wrapper', 'template', 'module', 'inc', 'http', 'general') as $inc) {
- include($path . 'inc/' . $inc . '-functions.php');
+foreach (['config', 'wrapper', 'template', 'module', 'inc', 'http', 'general'] as $inc) {
+ include sprintf('%sinc/%s-functions.php', $path, $inc);
} // END - foreach
// Initialize application
// Init installer
function initInstaller () {
// Initialize installer group array
- $GLOBALS['installer_groups'] = array(
+ $GLOBALS['installer_groups'] = [
// base_data
'base_path' => 'base_data',
'base_url' => 'base_data',
'admin_email' => 'first_admin',
'admin_password1' => 'first_admin',
'admin_password2' => 'first_admin',
- );
+ ];
// Set mininmum password length/score and other config entries
setConfigEntry('min_password_length', 5);
initSession();
// Include more
- foreach (array('databases', 'install-functions', 'load_config', 'load_cache') as $inc) {
+ foreach (['databases', 'install-functions', 'load_config', 'load_cache'] as $inc) {
// Load include file
loadIncludeOnce('inc/' . $inc . '.php');
} // END - foreach
setNetworkFormName('invalid');
// Now search all valid
- foreach (array('save_config', 'add', 'edit', 'delete', 'do_edit', 'do_delete') as $formName) {
+ foreach (['save_config', 'add', 'edit', 'delete', 'do_edit', 'do_delete'] as $formName) {
// Is it detected
if (isFormSent($formName)) {
// Use this form name
setPostRequestElement('network_id', bigintval(getRequestElement('network_id')));
// NULL empty values
- foreach (array('network_api_site_id', 'network_api_referral_button', 'network_api_visual_pay_check') as $key) {
+ foreach (['network_api_site_id', 'network_api_referral_button', 'network_api_visual_pay_check'] as $key) {
// Is it set?
if (!isPostRequestElementSet($key)) {
// Remove empty value to get a NULL for an optional entry
* Some parameters are optional, at least one must be given so check a bunch
* of parameters.
*/
- foreach (array('network_min_waiting_time', 'network_max_waiting_time', 'network_min_remain_budget', 'network_min_remain_clicks', 'network_min_payment', 'network_allow_erotic', 'network_media_size', 'network_media_output') as $element) {
+ foreach (['network_min_waiting_time', 'network_max_waiting_time', 'network_min_remain_budget', 'network_min_remain_clicks', 'network_min_payment', 'network_allow_erotic', 'network_media_size', 'network_media_output'] as $element) {
// Is this element empty?
if (!isPostRequestElementSet($element)) {
// Then unset it to get a NULL for optional parameter
* Some parameters are optional, at least one must be given so check a bunch
* of parameters.
*/
- foreach (array('network_min_waiting_time', 'network_max_waiting_time', 'network_min_remain_budget', 'network_min_remain_clicks', 'network_min_payment', 'network_allow_erotic', 'network_media_size', 'network_media_output') as $element) {
+ foreach (['network_min_waiting_time', 'network_max_waiting_time', 'network_min_remain_budget', 'network_min_remain_clicks', 'network_min_payment', 'network_allow_erotic', 'network_media_size', 'network_media_output'] as $element) {
// Is this element empty?
if (!isPostRequestElementSet($element)) {
// Then unset it to get a NULL for optional parameter
// Add links for selecting some users
function addAlphabeticalSorting ($sortby) {
$add = '';
- foreach (array('page', 'offset', 'do', 'status') as $param) {
+ foreach (['page', 'offset', 'do', 'status'] as $param) {
if (isGetRequestElementSet($param)) {
$add .= '&' . $param . '=' . getRequestElement($param);
} // END - if
$add = '&page=' . getRequestElement('page') . '&offset=' . getRequestElement('offset');
// Add status/ mode
- foreach (array('do','status') as $param) {
+ foreach (['do','status'] as $param) {
if (isGetRequestElementSet($param)) {
$add .= '&' . $param . '=' . getRequestElement($param);
} // END - if
$OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat();
// Add status/mode
- foreach (array('do','status') as $param) {
+ foreach (['do','status'] as $param) {
if (isGetRequestElementSet($param)) {
$OUT .= '&' . $param . '=' . getRequestElement($param);
} // END - if
$content['wait_selection'] = createConfigurationTimeSelections('beg_notify_wait' , 'ms' );
// Init elements for faker-mode
- foreach (array('pay_mode_img', 'pay_mode_js', 'pay_mode_both', 'pay_mode_none') as $entry) {
+ foreach (['pay_mode_img', 'pay_mode_js', 'pay_mode_both', 'pay_mode_none'] as $entry) {
$content[$entry] = '';
} // END - foreach
adminSaveSettingsFromPostData();
} else {
// Init other selections
- foreach (array('send_mode_direct','send_mode_reset') as $entry) {
+ foreach (['send_mode_direct', 'send_mode_reset'] as $entry) {
$content[$entry] = '';
} // END - foreach
// Set current selections
- foreach (array('send_mode') as $entry) {
+ foreach (['send_mode'] as $entry) {
$content[$entry . '_' . strtolower(getConfig('doubler_' . $entry))] = ' checked="checked"';
} // END - foreach
$content['doubler_userid'] = addMemberSelectionBox(getDoublerUserid(), FALSE, TRUE, TRUE, 'doubler_userid');
// Number of rows to display (option lines!!!)
- foreach (array('new','pay','old') as $entry) {
+ foreach (['new', 'pay', 'old'] as $entry) {
$content['display_' . $entry] = generateOptions(
'/ARRAY/',
- array(
+ [
5,
10,
20,
40,
50,
100
- ), array(
+ ], [
5,
10,
20,
40,
50,
100
- ),
+ ],
getConfig('doubler_display_' . $entry)
);
} // END - foreach
$content['holiday_lock'] = createConfigurationTimeSelections('holiday_lock', 'WDh');
// Init all entries
- foreach (array('holiday_mode_direct','holiday_mode_reset') as $entry) {
+ foreach (['holiday_mode_direct', 'holiday_mode_reset'] as $entry) {
$content[$entry] = '';
} // END - foreach
$content['network_logging_purge'] = createConfigurationTimeSelections('network_logging_purge', 'WDh');
// Init Y/N selections
- foreach (array('network_logging_debug') as $key) {
+ foreach (['network_logging_debug'] as $key) {
$content[$key . '_y'] = '';
$content[$key . '_n'] = '';
} // END - foreach
adminSaveSettingsFromPostData();
} else {
// Init all selection entries
- foreach (array('order_max_full_order', 'order_max_full_max', 'order_mode_asc', 'order_mode_desc', 'repay_deleted_mails_repay', 'repay_deleted_mails_jackpot', 'repay_deleted_mails_shred') as $entry) {
+ foreach (['order_max_full_order', 'order_max_full_max', 'order_mode_asc', 'order_mode_desc', 'repay_deleted_mails_repay', 'repay_deleted_mails_jackpot', 'repay_deleted_mails_shred'] as $entry) {
$content[$entry] = '';
} // END - foreach
$content['url_tlock'] = createConfigurationTimeSelections('url_tlock' , 'WDh');
// Prepare more
- foreach (array('css_php_direct','css_php_file','css_php_inline','mailid_error_redirect_index','mailid_error_redirect_reject') as $entry) {
+ foreach (['css_php_direct', 'css_php_file', 'css_php_inline', 'mailid_error_redirect_index', 'mailid_error_redirect_reject'] as $entry) {
$content[$entry] = '';
} // END - foreach
} elseif (getRequestElement('sub') == 'settings') {
// Setup some settings like direct pay and so on
// Including new add-mode for one-time referral bonus
- foreach (array('allow_direct_pay') as $entry) {
+ foreach (['allow_direct_pay'] as $entry) {
$content[$entry . '_y'] = '';
$content[$entry . '_n'] = '';
$content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
$content['def_refid'] = 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) {
+ foreach (['refid_target_index', 'refid_target_register', 'select_user_zero_refid_y', 'select_user_zero_refid_n'] as $entry) {
$content[$entry] = '';
} // END - foreach
adminSaveSettingsFromPostData();
} else {
// Prepare more entries
- foreach (array('anonymous_ip_local','anonymous_ip_zero','anonymous_ip_random') as $entry) {
+ foreach (['anonymous_ip_local','anonymous_ip_zero','anonymous_ip_random'] as $entry) {
$content[$entry] = '';
} // END - foreach
adminSaveSettingsFromPostData();
} else {
// Guest stats
- foreach (array('members','modules','inactive') as $entry) {
+ foreach (['members', 'modules', 'inactive'] as $entry) {
$content['guest_stats_' . $entry] = '';
} // END - foreach
adminSaveSettingsFromPostData();
} else {
// Prepare content
- $content = array(
+ $content = [
'surfbar_static_time' => createConfigurationTimeSelections('surfbar_static_time' , 'ms' , 'left'),
'surfbar_static_lock' => createConfigurationTimeSelections('surfbar_static_lock' , 'hm' , 'left'),
'surfbar_restart_time' => createConfigurationTimeSelections('surfbar_restart_time' , 'ms' , 'left'),
'surfbar_purge_deleted' => createConfigurationTimeSelections('surfbar_purge_deleted' , 'WDh', 'left'),
'surfbar_purge_migrated' => createConfigurationTimeSelections('surfbar_purge_migrated', 'WDh', 'left'),
'surfbar_low_interval' => createConfigurationTimeSelections('surfbar_low_interval' , 'WDh', 'left'),
- );
+ ];
// Even some more...
- foreach (array('surfbar_payment_model_static','surfbar_payment_model_dynamic','surfbar_pause_mode_internal','surfbar_pause_mode_external','surfbar_notification_mode_instant','surfbar_notification_mode_reset') as $entry) {
+ foreach (['surfbar_payment_model_static','surfbar_payment_model_dynamic','surfbar_pause_mode_internal','surfbar_pause_mode_external','surfbar_notification_mode_instant','surfbar_notification_mode_reset'] as $entry) {
$content[$entry] = '';
} // END - foreach
// Let's test the API first (hold your horses here, cowboy! Thank you. :) )
if (doAdminTestWernisApi()) {
// Revert german commata
- foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
+ foreach (['payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent'] as $revert) {
setPostRequestElement('wernis_' . $revert, postRequestElement('wernis_' . $revert));
} // END - if
// @TODO Rewrite this to a filter
if (isExtensionActive('cache')) {
// Remove cache file (will be auto-created again!)
- foreach (array('config', 'extension', 'filter', 'modules') as $cache) {
+ foreach (['config', 'extension', 'filter', 'modules'] as $cache) {
// Rebuild cache file
rebuildCache($cache);
} // END - foreach
case 'overview': // General overview page
// Prepare links
- foreach (array('already_direct','already_ref','waiting_direct','waiting_ref') as $entry) {
+ foreach (['already_direct', 'already_ref', 'waiting_direct', 'waiting_ref'] as $entry) {
$content[$entry . '_link'] = '0';
} // END - switch
$content['payment_list'] = loadTemplate('guest_sponsor_payment', TRUE, $OUT);
// Init a lot array elements
- foreach (array('company','position','tax_ident','sex_m','sex_f','sex_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url','receive_warnings_y','receive_warnings_n','form_errors','refid') as $entry) {
+ foreach (['company', 'position', 'tax_ident', 'sex_m', 'sex_f', 'sex_c', 'surname', 'family', 'street_nr1', 'street_nr2', 'country', 'zip', 'city', 'phone', 'fax', 'cell', 'email', 'url', 'receive_warnings_y', 'receive_warnings_n', 'form_errors', 'refid'] as $entry) {
$content[$entry] = '';
} // END - foreach
// Check for invalid entries
if (isFilledArray($formErrors)) {
// Some found... :-(
- foreach (array('company','position','tax_ident','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url') as $entry) {
+ foreach (['company', 'position', 'tax_ident', 'surname', 'family', 'street_nr1', 'street_nr2', 'country', 'zip', 'city', 'phone', 'fax', 'cell', 'email', 'url'] as $entry) {
$content[$entry] = postRequestElement($entry);
} // END - foreach
} // END - if
// Init entries
- foreach (array('allow_y','allow_n') as $entry) {
+ foreach (['allow_y','allow_n'] as $entry) {
$content[$entry] = '';
} // END - foreach
} // END - if
// Put all calculated values in array
- $data = array(
+ $data = [
'Y' => $year,
'M' => $month,
'W' => $week,
'h' => $hour,
'm' => $minute,
's' => $second
- );
+ ];
//
// Now we convert them in seconds...
$OUT = $data;
} else {
// Init array
- $units = array(
+ $units = [
// Time unit -> field name
- 'unit_field' => array(
+ 'unit_field' => [
'Y' => 'ye',
'M' => 'mn',
'W' => 'we',
'h' => 'ho',
'm' => 'mi',
's' => 'se'
- ),
+ ],
// Time unit -> label
- 'unit_label' => array(
+ 'unit_label' => [
'Y' => 'YEAR',
'M' => 'MONTH',
'W' => 'WEEK',
'h' => 'HOUR',
'm' => 'MINUTE',
's' => 'SECOND'
- )
- );
+ ]
+ ];
// Generate table
$OUT = '<div align="' . $align . '">';
// Prepare output
// @TODO This can be easily moved out after the merge from EL branch to this is complete
- $content = array(
+ $content = [
'run_time' => $runTime,
'sql_time' => (getConfig('sql_time') * 1000),
- );
+ ];
// Load the template
$GLOBALS['__page_footer'] .= loadTemplate('show_timings', TRUE, $content);
// Send an email? (e.g. not wanted for evaluation errors)
if (($sendEmail === TRUE) && (!isInstaller()) && (isAdminRegistered())) {
// Prepare content
- $content = array(
+ $content = [
'message' => trim($message),
'backtrace' => trim(debug_get_mailable_backtrace())
- );
+ ];
// Send email to webmaster
sendAdminNotification('{--REPORT_BUG_SUBJECT--}', 'admin_report_bug', $content);
} // END - if
// Compile these by default
- $charsCompile = array(
- 'from' => array(
+ $charsCompile = [
+ 'from' => [
'{DOT}',
'{SLASH}',
'{QUOT}',
'{OPEN_SQR}',
'{CLOSE_SQR}',
'{PER}'
- ),
- 'to' => array(
+ ],
+ 'to' => [
'.',
'/',
chr(39),
'[',
']',
'%'
- )
- );
+ ]
+ ];
// Compile constants
if ($simple === FALSE) {
// Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$userid])) {
// Init array for filter chain
- $data = array(
+ $data = [
'userid' => $userid,
'points' => 0
- );
+ ];
// Run filter chain for getting more point values
$data = runFilterChain('get_total_points', $data);
// "Getter" for all columns for given alias and separator
function getAllPointColumns ($alias = NULL, $separator = ',') {
// Prepare the filter array
- $filterData = array(
+ $filterData = [
'columns' => '',
'alias' => $alias,
'separator' => $separator
- );
+ ];
// Run the filter
$filterData = runFilterChain('get_all_point_columns', $filterData);